[Libreoffice-commits] core.git: 4 commits - include/vcl sc/inc sc/qa sc/source sd/source sfx2/source svtools/source svx/uiconfig unusedcode.easy vcl/source
Caolán McNamara
caolanm at redhat.com
Wed Sep 10 04:47:28 PDT 2014
include/vcl/toolbox.hxx | 1
sc/inc/document.hxx | 2
sc/inc/filter.hxx | 4
sc/qa/unit/data/wks/pass/gnome647171-1.wks |binary
sc/qa/unit/data/wks/pass/sf_8de44549111f8ba3f67509354f677aab-2767-minimized.wks |binary
sc/qa/unit/filters-test.cxx | 4
sc/source/core/data/documen5.cxx | 35 -
sc/source/filter/inc/lotattr.hxx | 4
sc/source/filter/inc/lotform.hxx | 9
sc/source/filter/inc/lotimpop.hxx | 3
sc/source/filter/inc/lotrange.hxx | 7
sc/source/filter/inc/namebuff.hxx | 7
sc/source/filter/inc/op.h | 63 +-
sc/source/filter/inc/optab.h | 4
sc/source/filter/inc/root.hxx | 2
sc/source/filter/inc/scmem.h | 7
sc/source/filter/inc/tool.h | 6
sc/source/filter/lotus/filter.cxx | 108 +---
sc/source/filter/lotus/lotattr.cxx | 10
sc/source/filter/lotus/lotfilter.hxx | 77 +++
sc/source/filter/lotus/lotform.cxx | 17
sc/source/filter/lotus/lotimpop.cxx | 42 -
sc/source/filter/lotus/lotread.cxx | 15
sc/source/filter/lotus/lotus.cxx | 14
sc/source/filter/lotus/memory.cxx | 43 -
sc/source/filter/lotus/op.cxx | 207 +++-----
sc/source/filter/lotus/optab.cxx | 5
sc/source/filter/lotus/tool.cxx | 65 --
sc/source/ui/inc/gridwin.hxx | 7
sc/source/ui/view/gridwin.cxx | 30 -
sc/source/ui/view/gridwin5.cxx | 18
sd/source/ui/dlg/LayerTabBar.cxx | 11
sd/source/ui/inc/LayerTabBar.hxx | 4
sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx | 1
sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx | 12
sfx2/source/dialog/templdlg.cxx | 18
sfx2/source/inc/templdgi.hxx | 2
svtools/source/table/tablecontrol_impl.cxx | 254 ----------
svtools/source/table/tablecontrol_impl.hxx | 13
svx/uiconfig/ui/docrecoverybrokendialog.ui | 1
unusedcode.easy | 3
vcl/source/window/toolbox2.cxx | 6
42 files changed, 385 insertions(+), 756 deletions(-)
New commits:
commit 50df87ceddc5f4dbebe9552c07e6c899dc17717c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Sep 10 11:59:36 2014 +0100
create a regression test for loading lotus wks documents
Change-Id: I274236939c6de4db811f8932025c619479bebbee
diff --git a/sc/qa/unit/data/wks/fail/.gitignore b/sc/qa/unit/data/wks/fail/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/sc/qa/unit/data/wks/indeterminate/.gitignore b/sc/qa/unit/data/wks/indeterminate/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/sc/qa/unit/data/wks/pass/.gitignore b/sc/qa/unit/data/wks/pass/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/sc/qa/unit/data/wks/pass/gnome647171-1.wks b/sc/qa/unit/data/wks/pass/gnome647171-1.wks
new file mode 100644
index 0000000..b2130f5
Binary files /dev/null and b/sc/qa/unit/data/wks/pass/gnome647171-1.wks differ
diff --git a/sc/qa/unit/data/wks/pass/sf_8de44549111f8ba3f67509354f677aab-2767-minimized.wks b/sc/qa/unit/data/wks/pass/sf_8de44549111f8ba3f67509354f677aab-2767-minimized.wks
new file mode 100644
index 0000000..92f36c7
Binary files /dev/null and b/sc/qa/unit/data/wks/pass/sf_8de44549111f8ba3f67509354f677aab-2767-minimized.wks differ
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index 27db9c0..2080207 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -135,6 +135,10 @@ void ScFiltersTest::testCVEs()
testDir(OUString("dBase"),
getURLFromSrc("/sc/qa/unit/data/dbf/"), OUString());
+
+ testDir(OUString("Lotus"),
+ getURLFromSrc("/sc/qa/unit/data/wks/"), OUString());
+
#endif
}
commit 206b32c231ea9f1fc7dbb60af307e30d03398095
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Sep 10 11:09:30 2014 +0100
refactor lotus wks importer to remove globals
so that the global aLotusPatternPool map gets destroyed at a sane point in time
where calling delete on its patterns is a legal operation and not at some
random location in the dtor chain
Change-Id: I6f202c5345c6a227b5a680d70150bf32fb9450c7
diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx
index 53062c3..6d3df3d 100644
--- a/sc/inc/filter.hxx
+++ b/sc/inc/filter.hxx
@@ -129,7 +129,9 @@ class ScFormatFilter {
SC_DLLPUBLIC static ScFormatFilterPlugin &Get();
};
-FltError ScImportLotus123old( SvStream&, ScDocument*, rtl_TextEncoding eSrc );
+struct LotusContext;
+
+FltError ScImportLotus123old(LotusContext& rContext, SvStream&, ScDocument*, rtl_TextEncoding eSrc);
#endif
diff --git a/sc/source/filter/inc/lotattr.hxx b/sc/source/filter/inc/lotattr.hxx
index 2e0829a..fe5df58 100644
--- a/sc/source/filter/inc/lotattr.hxx
+++ b/sc/source/filter/inc/lotattr.hxx
@@ -110,7 +110,7 @@ class LotAttrCol
public:
void SetAttr (const SCROW nRow, const ScPatternAttr&);
- void Apply (const SCCOL nCol, const SCTAB nTab );
+ void Apply(LOTUS_ROOT* pLotRoot, const SCCOL nCol, const SCTAB nTab);
private:
struct ENTRY
@@ -130,7 +130,7 @@ public:
void SetAttr( const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow, const LotAttrWK3& );
- void Apply( const SCTAB nTabNum );
+ void Apply(LOTUS_ROOT* pLotRoot, const SCTAB nTabNum);
private:
diff --git a/sc/source/filter/inc/lotform.hxx b/sc/source/filter/inc/lotform.hxx
index c356fcd..4c3165d 100644
--- a/sc/source/filter/inc/lotform.hxx
+++ b/sc/source/filter/inc/lotform.hxx
@@ -56,9 +56,12 @@ enum FUNC_TYPE
// fuer 'Problemfaelle' beim Import
};
+struct LotusContext;
+
class LotusToSc : public LotusConverterBase
{
private:
+ LotusContext& m_rContext;
rtl_TextEncoding eSrcChar;
TokenId nAddToken; // ')+1.0'
TokenId nSubToken; // ~
@@ -69,8 +72,7 @@ private:
static FUNC_TYPE IndexToTypeWK123( sal_uInt8 );
static DefTokenId IndexToTokenWK123( sal_uInt8 );
void DoFunc( DefTokenId eOc, sal_uInt8 nAnz, const sal_Char* pExtName );
- void LotusRelToScRel( sal_uInt16 nCol, sal_uInt16 nRow,
- ScSingleRefData& rSRD );
+ void LotusRelToScRel(sal_uInt16 nCol, sal_uInt16 nRow, ScSingleRefData& rSRD);
bool bWK3; // alternative Codeumsetzung statt fuer < WK1
bool bWK123; // alternative for 123
@@ -85,13 +87,14 @@ private:
void NegToken( TokenId& rParam );
// ACHTUNG: wie ~, nur wird '-(<rParam>)' gebildet
public:
- LotusToSc( SvStream& aStr, svl::SharedStringPool& rSPool, rtl_TextEncoding eSrc, bool b );
+ LotusToSc(LotusContext &rContext, SvStream& aStr, svl::SharedStringPool& rSPool, rtl_TextEncoding eSrc, bool b);
virtual ConvErr Convert( const ScTokenArray*& rpErg, sal_Int32& nRest,
const FORMULA_TYPE eFT = FT_CellFormula ) SAL_OVERRIDE;
void Reset( const ScAddress& rEingPos );
inline void SetWK3( void );
+ LotusContext& getContext() { return m_rContext; }
private:
using LotusConverterBase::Reset;
diff --git a/sc/source/filter/inc/lotimpop.hxx b/sc/source/filter/inc/lotimpop.hxx
index ab1aa6e..f177eeb 100644
--- a/sc/source/filter/inc/lotimpop.hxx
+++ b/sc/source/filter/inc/lotimpop.hxx
@@ -30,6 +30,7 @@
class ScFormulaCell;
class LotusFontBuffer;
+struct LotusContext;
class ImportLotus : public ImportTyp
{
@@ -76,7 +77,7 @@ private:
inline void Skip( const sal_uInt16 nNumBytes );
public:
- ImportLotus( SvStream&, ScDocument*, rtl_TextEncoding eSrc );
+ ImportLotus(LotusContext& rContext, SvStream&, ScDocument*, rtl_TextEncoding eSrc);
virtual ~ImportLotus();
diff --git a/sc/source/filter/inc/lotrange.hxx b/sc/source/filter/inc/lotrange.hxx
index 59d1012..2950e50 100644
--- a/sc/source/filter/inc/lotrange.hxx
+++ b/sc/source/filter/inc/lotrange.hxx
@@ -94,15 +94,16 @@ inline bool LotusRange::IsSingle( void ) const
class LotusRangeList
{
private:
+ LOTUS_ROOT* m_pLotRoot;
LR_ID nIdCnt;
- ScComplexRefData aComplRef;
+ ScComplexRefData aComplRef;
static SCCOL nEingCol;
static SCROW nEingRow;
std::vector<LotusRange*> maRanges;
public:
- LotusRangeList( void );
- ~LotusRangeList( void );
+ LotusRangeList(LOTUS_ROOT* pLotRoot);
+ ~LotusRangeList( void );
inline sal_uInt16 GetIndex( SCCOL nCol, SCROW nRow );
inline sal_uInt16 GetIndex( SCCOL nColS, SCROW nRowS, SCCOL nColE, SCROW nRowE );
sal_uInt16 GetIndex( const LotusRange& );
diff --git a/sc/source/filter/inc/namebuff.hxx b/sc/source/filter/inc/namebuff.hxx
index 908e270..cf3bc90 100644
--- a/sc/source/filter/inc/namebuff.hxx
+++ b/sc/source/filter/inc/namebuff.hxx
@@ -172,12 +172,13 @@ private:
}
};
- ScTokenArray* pScTokenArray;
- sal_uInt16 nIntCount;
+ LOTUS_ROOT* m_pLotRoot;
+ ScTokenArray* pScTokenArray;
+ sal_uInt16 nIntCount;
std::vector<Entry> maEntries;
public:
- RangeNameBufferWK3( void );
+ RangeNameBufferWK3(LOTUS_ROOT* pLotRoot);
virtual ~RangeNameBufferWK3();
void Add( const OUString& rName, const ScComplexRefData& rCRD );
inline void Add( const OUString& rName, const ScRange& aScRange );
diff --git a/sc/source/filter/inc/op.h b/sc/source/filter/inc/op.h
index d6204ff..4e70bcb 100644
--- a/sc/source/filter/inc/op.h
+++ b/sc/source/filter/inc/op.h
@@ -24,38 +24,39 @@
// OP-Code-Funktionen
class SvStream;
-void NI( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_BOF( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_EOF( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_Integer( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_Number( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_Label( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_Integer3( SvStream &aStream, sal_uInt16 nLaenge ); // WK3
-void OP_Number3( SvStream &aStream, sal_uInt16 nLaenge ); // WK3
-void OP_Formula( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_Formula3( SvStream &aStream, sal_uInt16 nLaenge ); // WK3
-void OP_ColumnWidth( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_NamedRange( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_SymphNamedRange( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_Footer( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_Header( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_Margins( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_HiddenCols( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_Window1( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_Blank( SvStream &aStream, sal_uInt16 nLaenge );
+struct LotusContext;
+void NI(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_BOF(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_EOF(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_Integer(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_Number(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_Label(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_Integer3(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge ); // WK3
+void OP_Number3(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge ); // WK3
+void OP_Formula(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_Formula3(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge ); // WK3
+void OP_ColumnWidth(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_NamedRange(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_SymphNamedRange(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_Footer(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_Header(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_Margins(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_HiddenCols(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_Window1(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_Blank(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
// Lotus 123 bits.
-void OP_BOF123( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_EOF123( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_Number123( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_Label123( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_Formula123( SvStream &aStream, sal_uInt16 nLaenge );
-void OP_IEEENumber123(SvStream& r, sal_uInt16 n);
-void OP_Note123(SvStream &aStream, sal_uInt16 nLaenge);
-void OP_CreatePattern123(SvStream &aStream, sal_uInt16 nLaenge);
-void OP_SheetName123( SvStream &rStream, sal_uInt16 nLength );
-void OP_HorAlign123(sal_uInt8 nAlignPattern, SfxItemSet& rPattern /* const ScPatternAttr& rPattern*/ );
-void OP_VerAlign123(sal_uInt8 nAlignPattern, SfxItemSet& rPattern /* const ScPatternAttr& rPattern*/ );
-void OP_ApplyPatternArea123(SvStream& r);
+void OP_BOF123(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_EOF123(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_Number123(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_Label123(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_Formula123(LotusContext &rContext, SvStream &aStream, sal_uInt16 nLaenge );
+void OP_IEEENumber123(LotusContext &rContext,SvStream& r, sal_uInt16 n);
+void OP_Note123(LotusContext &rContext,SvStream &aStream, sal_uInt16 nLaenge);
+void OP_CreatePattern123(LotusContext &rContext,SvStream &aStream, sal_uInt16 nLaenge);
+void OP_SheetName123(LotusContext &rContext, SvStream &rStream, sal_uInt16 nLength );
+void OP_HorAlign123(LotusContext &rContext,sal_uInt8 nAlignPattern, SfxItemSet& rPattern /* const ScPatternAttr& rPattern*/ );
+void OP_VerAlign123(LotusContext &rContext,sal_uInt8 nAlignPattern, SfxItemSet& rPattern /* const ScPatternAttr& rPattern*/ );
+void OP_ApplyPatternArea123(LotusContext &rContext,SvStream& r);
#endif
diff --git a/sc/source/filter/inc/optab.h b/sc/source/filter/inc/optab.h
index 9fb0031..7d4ad1d 100644
--- a/sc/source/filter/inc/optab.h
+++ b/sc/source/filter/inc/optab.h
@@ -20,7 +20,9 @@
#ifndef INCLUDED_SC_SOURCE_FILTER_INC_OPTAB_H
#define INCLUDED_SC_SOURCE_FILTER_INC_OPTAB_H
-typedef void ( *OPCODE_FKT )( SvStream &aStream, sal_uInt16 nLaenge );
+struct LotusContext;
+
+typedef void ( *OPCODE_FKT )(LotusContext &rContext, SvStream &rStream, sal_uInt16 nLaenge);
#define FKT_LIMIT 101
diff --git a/sc/source/filter/inc/root.hxx b/sc/source/filter/inc/root.hxx
index e250b2c..0dd0e57 100644
--- a/sc/source/filter/inc/root.hxx
+++ b/sc/source/filter/inc/root.hxx
@@ -102,8 +102,6 @@ struct LOTUS_ROOT
~LOTUS_ROOT();
};
-extern LOTUS_ROOT* pLotusRoot; // -> Inkarn. in filter.cxx
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/inc/scmem.h b/sc/source/filter/inc/scmem.h
index c46645f..2c105ca 100644
--- a/sc/source/filter/inc/scmem.h
+++ b/sc/source/filter/inc/scmem.h
@@ -21,11 +21,12 @@
#define INCLUDED_SC_SOURCE_FILTER_INC_SCMEM_H
#include <sal/config.h>
-
#include <sal/types.h>
-bool MemNew( void );
-void MemDelete( void );
+struct LotusContext;
+
+bool MemNew(LotusContext& rContext);
+void MemDelete(LotusContext& rContext);
#endif
diff --git a/sc/source/filter/inc/tool.h b/sc/source/filter/inc/tool.h
index cadf3f5..5515834 100644
--- a/sc/source/filter/inc/tool.h
+++ b/sc/source/filter/inc/tool.h
@@ -27,9 +27,11 @@
const sal_uInt8 nDezStd = 0; // Dezimalstellen fuer Standard-Zellen
const sal_uInt8 nDezFloat = 2; // " " Float-Zellen
-void PutFormString( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Char *pString );
+struct LotusContext;
-void SetFormat( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt8 nFormat, sal_uInt8 nSt );
+void PutFormString(LotusContext& rContext, SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Char *pString);
+
+void SetFormat(LotusContext& rContext, SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt8 nFormat, sal_uInt8 nSt);
void InitPage( void );
diff --git a/sc/source/filter/lotus/filter.cxx b/sc/source/filter/lotus/filter.cxx
index 2fdb9e1..b4e3cb9 100644
--- a/sc/source/filter/lotus/filter.cxx
+++ b/sc/source/filter/lotus/filter.cxx
@@ -34,52 +34,25 @@
#include "scmem.h"
#include "decl.h"
#include "tool.h"
-
#include "fprogressbar.hxx"
-
-#include "op.h"
-
-// Konstanten
-const sal_uInt16 nBOF = 0x0000;
-
-// externe Variablen
-extern WKTYP eTyp; // Typ der gerade in bearbeitung befindlichen Datei
-WKTYP eTyp;
-
-extern bool bEOF; // zeigt Ende der Datei
-bool bEOF;
-
-extern rtl_TextEncoding eCharVon;
-rtl_TextEncoding eCharVon;
-
-extern ScDocument* pDoc; // Aufhaenger zum Dokumentzugriff
-ScDocument* pDoc;
-
-extern OPCODE_FKT pOpFkt[ FKT_LIMIT ];
- // -> optab.cxx, Tabelle moeglicher Opcodes
-extern OPCODE_FKT pOpFkt123[ FKT_LIMIT123 ];
- // -> optab.cxx, Table of possible Opcodes
-
-LOTUS_ROOT* pLotusRoot = NULL;
-
-std::map<sal_uInt16, ScPatternAttr> aLotusPatternPool;
+#include "lotfilter.hxx"
static FltError
-generate_Opcodes( SvStream& aStream, ScDocument& rDoc,
- ScfStreamProgressBar& aPrgrsBar, WKTYP eType )
+generate_Opcodes(LotusContext &rContext, SvStream& aStream,
+ ScfStreamProgressBar& aPrgrsBar)
{
OPCODE_FKT *pOps;
int nOps;
- switch(eType)
+ switch (rContext.eTyp)
{
case eWK_1:
case eWK_2:
- pOps = pOpFkt;
+ pOps = rContext.pOpFkt;
nOps = FKT_LIMIT;
break;
case eWK123:
- pOps = pOpFkt123;
+ pOps = rContext.pOpFkt123;
nOps = FKT_LIMIT123;
break;
case eWK3: return eERR_NI;
@@ -91,62 +64,58 @@ generate_Opcodes( SvStream& aStream, ScDocument& rDoc,
aStream.Seek( STREAM_SEEK_TO_END );
sal_Size nStrmSize = aStream.Tell();
aStream.Seek( STREAM_SEEK_TO_BEGIN );
- while( !bEOF && !aStream.IsEof() && (aStream.Tell() < nStrmSize) )
+ while( !rContext.bEOF && !aStream.IsEof() && (aStream.Tell() < nStrmSize) )
{
sal_uInt16 nOpcode, nLength;
aStream.ReadUInt16( nOpcode ).ReadUInt16( nLength );
aPrgrsBar.Progress();
if( nOpcode == LOTUS_EOF )
- bEOF = true;
-
+ rContext.bEOF = true;
else if( nOpcode == LOTUS_FILEPASSWD )
- return eERR_FILEPASSWD;
-
+ return eERR_FILEPASSWD;
else if( nOpcode < nOps )
- pOps[ nOpcode ] ( aStream, nLength );
-
- else if( eType == eWK123 &&
- nOpcode == LOTUS_PATTERN )
- {
- // This is really ugly - needs re-factoring ...
- aStream.SeekRel(nLength);
- aStream.ReadUInt16( nOpcode ).ReadUInt16( nLength );
- if ( nOpcode == 0x29a)
+ pOps[ nOpcode ] (rContext, aStream, nLength);
+ else if (rContext.eTyp == eWK123 && nOpcode == LOTUS_PATTERN)
{
+ // This is really ugly - needs re-factoring ...
aStream.SeekRel(nLength);
aStream.ReadUInt16( nOpcode ).ReadUInt16( nLength );
- if ( nOpcode == 0x804 )
+ if ( nOpcode == 0x29a)
{
- aStream.SeekRel(nLength);
- OP_ApplyPatternArea123(aStream);
+ aStream.SeekRel(nLength);
+ aStream.ReadUInt16( nOpcode ).ReadUInt16( nLength );
+ if ( nOpcode == 0x804 )
+ {
+ aStream.SeekRel(nLength);
+ OP_ApplyPatternArea123(rContext, aStream);
+ }
+ else
+ aStream.SeekRel(nLength);
}
else
- aStream.SeekRel(nLength);
+ aStream.SeekRel(nLength);
}
else
- aStream.SeekRel(nLength);
- }
- else
- aStream.SeekRel( nLength );
+ aStream.SeekRel( nLength );
}
- MemDelete();
+ MemDelete(rContext);
- rDoc.CalcAfterLoad();
+ rContext.pDoc->CalcAfterLoad();
return eERR_OK;
}
-WKTYP ScanVersion( SvStream& aStream )
+WKTYP ScanVersion(LotusContext &rContext, SvStream& aStream)
{
// PREC: pWKDatei: Zeiger auf offene Datei
// POST: return: Typ der Datei
- sal_uInt16 nOpcode, nVersNr, nRecLen;
+ sal_uInt16 nOpcode(0), nVersNr(0), nRecLen(0);
// erstes Byte muss wegen BOF zwingend 0 sein!
aStream.ReadUInt16( nOpcode );
- if( nOpcode != nBOF )
+ if (nOpcode != rContext.nBOF)
return eWK_UNKNOWN;
aStream.ReadUInt16( nRecLen ).ReadUInt16( nVersNr );
@@ -193,19 +162,17 @@ WKTYP ScanVersion( SvStream& aStream )
return eWK_UNKNOWN;
}
-FltError ScImportLotus123old( SvStream& aStream, ScDocument* pDocument, rtl_TextEncoding eSrc )
+FltError ScImportLotus123old(LotusContext& rContext, SvStream& aStream, ScDocument* pDocument, rtl_TextEncoding eSrc )
{
aStream.Seek( 0UL );
// Zeiger auf Dokument global machen
- pDoc = pDocument;
-
- bEOF = false;
-
- eCharVon = eSrc;
+ rContext.pDoc = pDocument;
+ rContext.bEOF = false;
+ rContext.eCharVon = eSrc;
// Speicher besorgen
- if( !MemNew() )
+ if( !MemNew(rContext) )
return eERR_NOMEM;
InitPage(); // Seitenformat initialisieren (nur Tab 0!)
@@ -214,11 +181,10 @@ FltError ScImportLotus123old( SvStream& aStream, ScDocument* pDocument, rtl_Text
ScfStreamProgressBar aPrgrsBar( aStream, pDocument->GetDocumentShell() );
// Datei-Typ ermitteln
- eTyp = ScanVersion( aStream );
-
- aLotusPatternPool.clear();
+ rContext.eTyp = ScanVersion(rContext, aStream);
+ rContext.aLotusPatternPool.clear();
- return generate_Opcodes( aStream, *pDoc, aPrgrsBar, eTyp );
+ return generate_Opcodes(rContext, aStream, aPrgrsBar);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/lotus/lotattr.cxx b/sc/source/filter/lotus/lotattr.cxx
index b309f6a..7254144 100644
--- a/sc/source/filter/lotus/lotattr.cxx
+++ b/sc/source/filter/lotus/lotattr.cxx
@@ -47,8 +47,8 @@ LotAttrCache::ENTRY::~ENTRY ()
delete pPattAttr;
}
-LotAttrCache::LotAttrCache (LOTUS_ROOT* pLotRoot):
- mpLotusRoot(pLotRoot)
+LotAttrCache::LotAttrCache (LOTUS_ROOT* pLotRoot)
+ : mpLotusRoot(pLotRoot)
{
pDocPool = mpLotusRoot->pDoc->GetPool();
@@ -218,7 +218,7 @@ void LotAttrCol::SetAttr( const SCROW nRow, const ScPatternAttr& rAttr )
}
}
-void LotAttrCol::Apply( const SCCOL nColNum, const SCTAB nTabNum )
+void LotAttrCol::Apply(LOTUS_ROOT* pLotusRoot, const SCCOL nColNum, const SCTAB nTabNum)
{
ScDocument* pDoc = pLotusRoot->pDoc;
@@ -248,11 +248,11 @@ void LotAttrTable::SetAttr( const SCCOL nColFirst, const SCCOL nColLast, const S
pCols[ nColCnt ].SetAttr( nRow, rPattAttr );
}
-void LotAttrTable::Apply( const SCTAB nTabNum )
+void LotAttrTable::Apply(LOTUS_ROOT* pLotusRoot, const SCTAB nTabNum)
{
SCCOL nColCnt;
for( nColCnt = 0 ; nColCnt <= MAXCOL ; nColCnt++ )
- pCols[ nColCnt ].Apply( nColCnt, nTabNum ); // macht auch gleich ein Clear() am Ende
+ pCols[ nColCnt ].Apply(pLotusRoot, nColCnt, nTabNum); // macht auch gleich ein Clear() am Ende
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/lotus/lotfilter.hxx b/sc/source/filter/lotus/lotfilter.hxx
new file mode 100644
index 0000000..047391a
--- /dev/null
+++ b/sc/source/filter/lotus/lotfilter.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SC_SOURCE_FILTER_LOTUS_FILTER_HXX
+#define INCLUDED_SC_SOURCE_FILTER_LOTUS_FILTER_HXX
+
+#include <map>
+#include "decl.h"
+#include "op.h"
+#include "optab.h"
+#include "root.hxx"
+
+class SvxHorJustifyItem;
+class ScProtectionAttr;
+class SfxUInt32Item;
+class FormCache;
+
+struct LotusContext
+{
+ const sal_uInt16 nBOF;
+ WKTYP eTyp; // Typ der gerade in bearbeitung befindlichen Datei
+ bool bEOF; // zeigt Ende der Datei
+ rtl_TextEncoding eCharVon;
+ ScDocument* pDoc; // Aufhaenger zum Dokumentzugriff
+ static OPCODE_FKT pOpFkt[ FKT_LIMIT ];
+ static OPCODE_FKT pOpFkt123[ FKT_LIMIT123 ]; // -> optab.cxx, Table of possible Opcodes
+ LOTUS_ROOT* pLotusRoot;
+ std::map<sal_uInt16, ScPatternAttr> aLotusPatternPool;
+
+ sal_uInt8 nDefaultFormat; // -> op.cpp, Standard-Zellenformat
+
+ SvxHorJustifyItem *pAttrRight, *pAttrLeft, *pAttrCenter, *pAttrRepeat, *pAttrStandard;
+ ScProtectionAttr* pAttrUnprot;
+ SfxUInt32Item** pAttrValForms;
+
+ FormCache* pValueFormCache; // -> in memory.cxx initialisiert
+
+ LotusContext()
+ : nBOF(0x0000)
+ , eTyp(eWK_UNKNOWN)
+ , bEOF(false)
+ , eCharVon(RTL_TEXTENCODING_DONTKNOW)
+ , pDoc(0)
+ , pLotusRoot(NULL)
+
+ , nDefaultFormat(0)
+ , pAttrRight(NULL)
+ , pAttrLeft(NULL)
+ , pAttrCenter(NULL)
+ , pAttrRepeat(NULL)
+ , pAttrStandard(NULL)
+ , pAttrUnprot(NULL)
+ , pAttrValForms(NULL)
+ , pValueFormCache(NULL)
+ {
+ }
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx
index 59d8750..31e844a 100644
--- a/sc/source/filter/lotus/lotform.cxx
+++ b/sc/source/filter/lotus/lotform.cxx
@@ -20,6 +20,7 @@
#include "decl.h"
#include "lotform.hxx"
#include "compiler.hxx"
+#include "lotfilter.hxx"
#include "lotrange.hxx"
#include "namebuff.hxx"
#include "root.hxx"
@@ -30,8 +31,6 @@
#include <comphelper/string.hxx>
#include <boost/scoped_array.hpp>
-extern WKTYP eTyp;
-
static const sal_Char* GetAddInName( const sal_uInt8 nIndex );
static DefTokenId lcl_KnownAddIn(const OString& rTest);
@@ -217,7 +216,7 @@ void LotusToSc::LotusRelToScRel( sal_uInt16 nCol, sal_uInt16 nRow, ScSingleRefDa
{
rSRD.SetRowRel(true);
// vorzeichenrichtige Erweiterung
- switch( eTyp )
+ switch (m_rContext.eTyp)
{
// 5432 1098 7654 3210
// 8421 8421 8421 8421
@@ -243,7 +242,7 @@ void LotusToSc::LotusRelToScRel( sal_uInt16 nCol, sal_uInt16 nRow, ScSingleRefDa
else
{
rSRD.SetRowRel(false);
- switch( eTyp )
+ switch (m_rContext.eTyp)
{
// 5432 1098 7654 3210
// 8421 8421 8421 8421
@@ -320,8 +319,10 @@ void LotusToSc::Reset( const ScAddress& rEingPos )
n0Token = aPool.Store( 0.0 );
}
-LotusToSc::LotusToSc( SvStream &rStream, svl::SharedStringPool& rSPool, rtl_TextEncoding e, bool b ) :
- LotusConverterBase(rStream, rSPool, 128)
+LotusToSc::LotusToSc(LotusContext &rContext, SvStream &rStream, svl::SharedStringPool& rSPool,
+ rtl_TextEncoding e, bool b)
+ : LotusConverterBase(rStream, rSPool, 128)
+ , m_rContext(rContext)
{
eSrcChar = e;
bWK3 = false;
@@ -343,7 +344,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest,
TokenId nMerk0;
DefTokenId eOc;
const sal_Char* pExtName = 0;
- RangeNameBufferWK3& rRangeNameBufferWK3 = *pLotusRoot->pRngNmBffWK3;
+ RangeNameBufferWK3& rRangeNameBufferWK3 = *m_rContext.pLotusRoot->pRngNmBffWK3;
ScComplexRefData aCRD;
aCRD.InitFlags();
@@ -352,7 +353,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest,
LR_ID nId;
TokenId nNewId;
- LotusRangeList& rRangeList = *pLotusRoot->pRangeNames;
+ LotusRangeList& rRangeList = *m_rContext.pLotusRoot->pRangeNames;
FuncType1* pIndexToType;
FuncType2* pIndexToToken;
diff --git a/sc/source/filter/lotus/lotimpop.cxx b/sc/source/filter/lotus/lotimpop.cxx
index 60fa5a4..b13ed65 100644
--- a/sc/source/filter/lotus/lotimpop.cxx
+++ b/sc/source/filter/lotus/lotimpop.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "lotfilter.hxx"
#include "lotimpop.hxx"
#include <osl/mutex.hxx>
@@ -41,12 +42,12 @@
LOTUS_ROOT::LOTUS_ROOT( ScDocument* pDocP, rtl_TextEncoding eQ )
:
pDoc( pDocP),
- pRangeNames( new LotusRangeList),
+ pRangeNames( new LotusRangeList(this)),
pScRangeName( pDocP->GetRangeName()),
eCharsetQ( eQ),
eFirstType( Lotus_X),
eActType( Lotus_X),
- pRngNmBffWK3( new RangeNameBufferWK3),
+ pRngNmBffWK3( new RangeNameBufferWK3(this)),
pFontBuff( new LotusFontBuffer),
pAttrTable( new LotAttrTable(this))
{
@@ -62,23 +63,24 @@ LOTUS_ROOT::~LOTUS_ROOT()
static osl::Mutex aLotImpSemaphore;
-ImportLotus::ImportLotus( SvStream& aStream, ScDocument* pDoc, rtl_TextEncoding eQ )
+ImportLotus::ImportLotus(LotusContext &rContext, SvStream& aStream, ScDocument* pDoc, rtl_TextEncoding eQ)
: ImportTyp(pDoc, eQ)
, pIn(&aStream)
- , aConv(*pIn, pDoc->GetSharedStringPool(), eQ, false)
+ , aConv(rContext, *pIn, pDoc->GetSharedStringPool(), eQ, false)
, nTab(0)
, nExtTab(0)
{
// good point to start locking of import lotus
aLotImpSemaphore.acquire();
- pLotusRoot = new LOTUS_ROOT(pDoc, eQ);
+ rContext.pLotusRoot = new LOTUS_ROOT(pDoc, eQ);
}
ImportLotus::~ImportLotus()
{
- delete pLotusRoot;
- pLotusRoot = NULL;
+ LotusContext &rContext = aConv.getContext();
+ delete rContext.pLotusRoot;
+ rContext.pLotusRoot = NULL;
// no need 4 pLotusRoot anymore
aLotImpSemaphore.release();
@@ -91,7 +93,8 @@ void ImportLotus::Bof( void )
Read( nFileCode );
Read( nFileSub );
- Read( pLotusRoot->aActRange );
+ LotusContext &rContext = aConv.getContext();
+ Read( rContext.pLotusRoot->aActRange );
Read( nSaveCnt );
Read( nMajorId );
Read( nMinorId );
@@ -102,11 +105,11 @@ void ImportLotus::Bof( void )
{
if( nFileCode == 0x1000 )
{// <= WK3
- pLotusRoot->eFirstType = pLotusRoot->eActType = Lotus_WK3;
+ rContext.pLotusRoot->eFirstType = rContext.pLotusRoot->eActType = Lotus_WK3;
}
else if( nFileCode == 0x1002 )
{// WK4
- pLotusRoot->eFirstType = pLotusRoot->eActType = Lotus_WK4;
+ rContext.pLotusRoot->eFirstType = rContext.pLotusRoot->eActType = Lotus_WK4;
}
}
}
@@ -192,7 +195,8 @@ void ImportLotus::Userrange( void )
Read( aScRange );
- pLotusRoot->pRngNmBffWK3->Add( aName, aScRange );
+ LotusContext &rContext = aConv.getContext();
+ rContext.pLotusRoot->pRngNmBffWK3->Add( aName, aScRange );
}
void ImportLotus::Errcell( void )
@@ -350,26 +354,29 @@ void ImportLotus::Font_Face( void )
Read( aName );
- pLotusRoot->pFontBuff->SetName( nNum, aName );
+ LotusContext &rContext = aConv.getContext();
+ rContext.pLotusRoot->pFontBuff->SetName( nNum, aName );
}
void ImportLotus::Font_Type( void )
{
+ LotusContext &rContext = aConv.getContext();
for( sal_uInt16 nCnt = 0 ; nCnt < LotusFontBuffer::nSize ; nCnt++ )
{
sal_uInt16 nType;
Read( nType );
- pLotusRoot->pFontBuff->SetType( nCnt, nType );
+ rContext.pLotusRoot->pFontBuff->SetType( nCnt, nType );
}
}
void ImportLotus::Font_Ysize( void )
{
+ LotusContext &rContext = aConv.getContext();
for( sal_uInt16 nCnt = 0 ; nCnt < LotusFontBuffer::nSize ; nCnt++ )
{
sal_uInt16 nSize;
Read( nSize );
- pLotusRoot->pFontBuff->SetHeight( nCnt, nSize );
+ rContext.pLotusRoot->pFontBuff->SetHeight( nCnt, nSize );
}
}
@@ -396,13 +403,14 @@ void ImportLotus::_Row( const sal_uInt16 nRecLen )
if( nHeight )
pD->SetRowHeight( static_cast<SCROW> (nRow), static_cast<SCTAB> (nExtTab), nHeight );
+ LotusContext &rContext = aConv.getContext();
while( nCntDwn )
- {
+ {
Read( aAttr );
Read( nRepeats );
if( aAttr.HasStyles() )
- pLotusRoot->pAttrTable->SetAttr(
+ rContext.pLotusRoot->pAttrTable->SetAttr(
nColCnt, static_cast<SCCOL> ( nColCnt + nRepeats ), static_cast<SCROW> (nRow), aAttr );
// hier und NICHT in class LotAttrTable, weil nur Attributiert wird,
@@ -438,7 +446,7 @@ void ImportLotus::_Row( const sal_uInt16 nRecLen )
nColCnt++;
nCntDwn--;
- }
+ }
if( bCenter )
// evtl. alte Center bemachen
diff --git a/sc/source/filter/lotus/lotread.cxx b/sc/source/filter/lotus/lotread.cxx
index c690eb5..c739ab2 100644
--- a/sc/source/filter/lotus/lotread.cxx
+++ b/sc/source/filter/lotus/lotread.cxx
@@ -21,6 +21,7 @@
#include "scerrors.hxx"
#include "root.hxx"
+#include "lotfilter.hxx"
#include "lotimpop.hxx"
#include "lotattr.hxx"
#include "fprogressbar.hxx"
@@ -55,12 +56,12 @@ FltError ImportLotus::Read()
// Progressbar starten
ScfStreamProgressBar aPrgrsBar( *pIn, pD->GetDocumentShell() );
-
+ LotusContext &rContext = aConv.getContext();
while( eAkt != S_END )
{
pIn->ReadUInt16( nOp ).ReadUInt16( nRecLen );
- if( pIn->IsEof() || nNextRec > SAL_MAX_UINT32 - nRecLen - 4 )
+ if( pIn->IsEof() || nNextRec > SAL_MAX_UINT32 - nRecLen - 4 )
eAkt = S_END;
nNextRec += nRecLen + 4;
@@ -79,7 +80,7 @@ FltError ImportLotus::Read()
if( nRecLen > 2 )
{
Bof();
- switch( pLotusRoot->eFirstType )
+ switch (rContext.pLotusRoot->eFirstType)
{
case Lotus_WK1: eAkt = S_WK1; break;
case Lotus_WK3: eAkt = S_WK3; break;
@@ -225,7 +226,7 @@ FltError ImportLotus::Read()
return eRet;
}
-FltError ImportLotus::Read( SvStream& rIn )
+FltError ImportLotus::Read(SvStream& rIn)
{
pIn = &rIn;
@@ -242,7 +243,7 @@ FltError ImportLotus::Read( SvStream& rIn )
// Progressbar starten
ScfStreamProgressBar aPrgrsBar( *pIn, pD->GetDocumentShell() );
-
+ LotusContext &rContext = aConv.getContext();
while( bRead )
{
pIn->ReadUInt16( nOp ).ReadUInt16( nRecLen );
@@ -284,7 +285,7 @@ FltError ImportLotus::Read( SvStream& rIn )
case 195:
if( nExtTab >= 0 )
- pLotusRoot->pAttrTable->Apply( ( SCTAB ) nExtTab );
+ rContext.pLotusRoot->pAttrTable->Apply(rContext.pLotusRoot, (SCTAB)nExtTab);
nExtTab++;
break;
case 197:
@@ -299,7 +300,7 @@ FltError ImportLotus::Read( SvStream& rIn )
}
}
- pLotusRoot->pAttrTable->Apply( ( SCTAB ) nExtTab );
+ rContext.pLotusRoot->pAttrTable->Apply(rContext.pLotusRoot, (SCTAB)nExtTab);
return eRet;
}
diff --git a/sc/source/filter/lotus/lotus.cxx b/sc/source/filter/lotus/lotus.cxx
index cc0af09..321d4bd 100644
--- a/sc/source/filter/lotus/lotus.cxx
+++ b/sc/source/filter/lotus/lotus.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "lotfilter.hxx"
#include "lotimpop.hxx"
#include <sfx2/docfile.hxx>
@@ -29,7 +30,7 @@
FltError ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium& rMedium, ScDocument* pDocument, rtl_TextEncoding eSrc )
{
- ScFilterOptions aFilterOpt;
+ ScFilterOptions aFilterOpt;
bool bWithWK3 = aFilterOpt.GetWK3Flag();
SvStream* pStream = rMedium.GetInStream();
@@ -43,7 +44,9 @@ FltError ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium& rMedium, ScDocum
pStream->SetBufferSize( 32768 );
- ImportLotus aLotusImport( *pStream, pDocument, eSrc );
+ LotusContext aContext;
+
+ ImportLotus aLotusImport(aContext, *pStream, pDocument, eSrc);
if( bWithWK3 )
eRet = aLotusImport.Read();
@@ -57,7 +60,7 @@ FltError ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium& rMedium, ScDocum
pStream->SetBufferSize( 32768 );
- eRet = ScImportLotus123old( *pStream, pDocument, eSrc );
+ eRet = ScImportLotus123old(aContext, *pStream, pDocument, eSrc);
pStream->SetBufferSize( 0 );
@@ -67,8 +70,9 @@ FltError ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium& rMedium, ScDocum
if( eRet != eERR_OK )
return eRet;
- if( pLotusRoot->eFirstType == Lotus_WK3 )
- {// versuchen *.FM3-File zu laden
+ if (aContext.pLotusRoot->eFirstType == Lotus_WK3)
+ {
+ // versuchen *.FM3-File zu laden
INetURLObject aURL( rMedium.GetURLObject() );
aURL.setExtension( "FM3" );
SfxMedium aMedium( aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_STD_READ );
diff --git a/sc/source/filter/lotus/memory.cxx b/sc/source/filter/lotus/memory.cxx
index 28630b7..5e348ea 100644
--- a/sc/source/filter/lotus/memory.cxx
+++ b/sc/source/filter/lotus/memory.cxx
@@ -24,43 +24,34 @@
#include "scmem.h"
#include <svx/algitem.hxx>
#include <editeng/justifyitem.hxx>
-
#include "attrib.hxx"
-
+#include "lotfilter.hxx"
#include "tool.h"
-extern ScDocument* pDoc;
-
-extern FormCache* pValueFormCache; // -> tool.cxx
-
-extern SvxHorJustifyItem *pAttrRight, *pAttrLeft, *pAttrCenter,
- *pAttrRepeat, *pAttrStandard; // -> tool.cxx, fuer GetFormAttr()
-extern ScProtectionAttr* pAttrUnprot; // -> tool.cxx, fuer PutFormString()
-
-bool MemNew( void )
+bool MemNew(LotusContext &rContext)
{
- pValueFormCache = new FormCache( pDoc );
+ rContext.pValueFormCache = new FormCache(rContext.pDoc);
// fuer tool.cxx::PutFormString()
- pAttrUnprot = new ScProtectionAttr( true );
- pAttrRight = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_RIGHT, ATTR_HOR_JUSTIFY );
- pAttrLeft = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_LEFT, ATTR_HOR_JUSTIFY );
- pAttrCenter = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY );
- pAttrRepeat = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_REPEAT, ATTR_HOR_JUSTIFY );
- pAttrStandard = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_STANDARD, ATTR_HOR_JUSTIFY );
+ rContext.pAttrUnprot = new ScProtectionAttr( true );
+ rContext.pAttrRight = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_RIGHT, ATTR_HOR_JUSTIFY );
+ rContext.pAttrLeft = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_LEFT, ATTR_HOR_JUSTIFY );
+ rContext.pAttrCenter = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY );
+ rContext.pAttrRepeat = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_REPEAT, ATTR_HOR_JUSTIFY );
+ rContext.pAttrStandard = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_STANDARD, ATTR_HOR_JUSTIFY );
return true;
}
-void MemDelete( void )
+void MemDelete(LotusContext &rContext)
{
- delete pValueFormCache;
- delete pAttrRight;
- delete pAttrLeft;
- delete pAttrCenter;
- delete pAttrRepeat;
- delete pAttrStandard;
- delete pAttrUnprot;
+ delete rContext.pValueFormCache;
+ delete rContext.pAttrRight;
+ delete rContext.pAttrLeft;
+ delete rContext.pAttrCenter;
+ delete rContext.pAttrRepeat;
+ delete rContext.pAttrStandard;
+ delete rContext.pAttrUnprot;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index fbbda65..c1eb970 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -43,85 +43,76 @@
#include "optab.h"
#include "tool.h"
#include "decl.h"
+#include "lotfilter.hxx"
#include "lotform.hxx"
#include "lotrange.hxx"
-
#include "root.hxx"
-
#include "ftools.hxx"
#include <vector>
#include <map>
#include <boost/scoped_array.hpp>
-extern WKTYP eTyp; // -> filter.cxx, aktueller Dateityp
-extern bool bEOF; // -> filter.cxx, zeigt Dateiende an
-extern sal_uInt8 nDefaultFormat; // -> tool.cxx, Default-Zellenformat
-extern ScDocument* pDoc; // -> filter.cxx, Aufhaenger zum Dokumentzugriff
-extern rtl_TextEncoding eCharVon; // -> filter.cxx, character set specified
-
static sal_uInt16 nDefWidth = ( sal_uInt16 ) ( TWIPS_PER_CHAR * 10 );
-extern std::map<sal_uInt16, ScPatternAttr> aLotusPatternPool;
-
-void NI( SvStream& r, sal_uInt16 n )
+void NI(LotusContext& /*rContext*/, SvStream& r, sal_uInt16 n)
{
r.SeekRel( n );
}
-void OP_BOF( SvStream& r, sal_uInt16 /*n*/ )
+void OP_BOF(LotusContext& /*rContext*/, SvStream& r, sal_uInt16 /*n*/)
{
r.SeekRel( 2 ); // Versionsnummer ueberlesen
}
-void OP_EOF( SvStream& /*r*/, sal_uInt16 /*n*/ )
+void OP_EOF(LotusContext& rContext, SvStream& /*r*/, sal_uInt16 /*n*/)
{
- bEOF = true;
+ rContext.bEOF = true;
}
-void OP_Integer( SvStream& r, sal_uInt16 /*n*/ )
+void OP_Integer(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
{
- sal_uInt8 nFormat;
- sal_uInt16 nCol, nRow;
- SCTAB nTab = 0;
- sal_Int16 nValue;
+ sal_uInt8 nFormat(0);
+ sal_uInt16 nCol(0), nRow(0);
+ SCTAB nTab(0);
+ sal_Int16 nValue(0);
r.ReadUChar( nFormat ).ReadUInt16( nCol ).ReadUInt16( nRow ).ReadInt16( nValue );
if (ValidColRow( static_cast<SCCOL>(nCol), nRow))
{
- pDoc->EnsureTable(nTab);
- pDoc->SetValue(ScAddress(nCol,nRow,nTab), static_cast<double>(nValue));
+ rContext.pDoc->EnsureTable(nTab);
+ rContext.pDoc->SetValue(ScAddress(nCol,nRow,nTab), static_cast<double>(nValue));
// 0 Stellen nach'm Komma!
- SetFormat( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, 0 );
+ SetFormat(rContext, static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, 0);
}
}
-void OP_Number( SvStream& r, sal_uInt16 /*n*/ )
+void OP_Number(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
{
- sal_uInt8 nFormat;
- sal_uInt16 nCol, nRow;
- SCTAB nTab = 0;
- double fValue;
+ sal_uInt8 nFormat(0);
+ sal_uInt16 nCol(0), nRow(0);
+ SCTAB nTab(0);
+ double fValue(0.0);
r.ReadUChar( nFormat ).ReadUInt16( nCol ).ReadUInt16( nRow ).ReadDouble( fValue );
if (ValidColRow( static_cast<SCCOL>(nCol), nRow))
{
fValue = ::rtl::math::round( fValue, 15 );
- pDoc->EnsureTable(nTab);
- pDoc->SetValue(ScAddress(nCol,nRow,nTab), fValue);
+ rContext.pDoc->EnsureTable(nTab);
+ rContext.pDoc->SetValue(ScAddress(nCol,nRow,nTab), fValue);
- SetFormat( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, nDezFloat );
+ SetFormat(rContext, static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, nDezFloat);
}
}
-void OP_Label( SvStream& r, sal_uInt16 n )
+void OP_Label(LotusContext& rContext, SvStream& r, sal_uInt16 n)
{
- sal_uInt8 nFormat;
- sal_uInt16 nCol, nRow;
- SCTAB nTab = 0;
+ sal_uInt8 nFormat(0);
+ sal_uInt16 nCol(0), nRow(0);
+ SCTAB nTab(0);
r.ReadUChar( nFormat ).ReadUInt16( nCol ).ReadUInt16( nRow );
@@ -136,13 +127,13 @@ void OP_Label( SvStream& r, sal_uInt16 n )
nFormat &= 0x80; // Bit 7 belassen
nFormat |= 0x75; // protected egal, special-text gesetzt
- PutFormString( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, pText.get() );
+ PutFormString(rContext, static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, pText.get());
- SetFormat( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, nDezStd );
+ SetFormat(rContext, static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, nDezStd);
}
}
-void OP_Formula( SvStream& r, sal_uInt16 /*n*/ )
+void OP_Formula(LotusContext &rContext, SvStream& r, sal_uInt16 /*n*/)
{
sal_uInt8 nFormat;
sal_uInt16 nCol, nRow, nFormulaSize;
@@ -156,24 +147,24 @@ void OP_Formula( SvStream& r, sal_uInt16 /*n*/ )
sal_Int32 nBytesLeft = nFormulaSize;
ScAddress aAddress( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab );
- svl::SharedStringPool& rSPool = pLotusRoot->pDoc->GetSharedStringPool();
- LotusToSc aConv(r, rSPool, pLotusRoot->eCharsetQ, false);
+ svl::SharedStringPool& rSPool = rContext.pLotusRoot->pDoc->GetSharedStringPool();
+ LotusToSc aConv(rContext, r, rSPool, rContext.pLotusRoot->eCharsetQ, false);
aConv.Reset( aAddress );
aConv.Convert( pErg, nBytesLeft );
if (ValidColRow( static_cast<SCCOL>(nCol), nRow))
{
- ScFormulaCell* pCell = new ScFormulaCell(pLotusRoot->pDoc, aAddress, *pErg);
+ ScFormulaCell* pCell = new ScFormulaCell(rContext.pLotusRoot->pDoc, aAddress, *pErg);
pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE );
- pDoc->EnsureTable(nTab);
- pDoc->SetFormulaCell(ScAddress(nCol,nRow,nTab), pCell);
+ rContext.pDoc->EnsureTable(nTab);
+ rContext.pDoc->SetFormulaCell(ScAddress(nCol,nRow,nTab), pCell);
// nFormat = Standard -> Nachkommastellen wie Float
- SetFormat( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, nDezFloat );
+ SetFormat(rContext, static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, nDezFloat);
}
}
-void OP_ColumnWidth( SvStream& r, sal_uInt16 /*n*/ )
+void OP_ColumnWidth(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
{
sal_uInt16 nCol, nBreite;
sal_uInt8 nWidthSpaces;
@@ -188,16 +179,16 @@ void OP_ColumnWidth( SvStream& r, sal_uInt16 /*n*/ )
nBreite = ( sal_uInt16 ) ( TWIPS_PER_CHAR * nWidthSpaces );
else
{
- pDoc->SetColHidden(static_cast<SCCOL>(nCol), static_cast<SCCOL>(nCol), 0, true);
+ rContext.pDoc->SetColHidden(static_cast<SCCOL>(nCol), static_cast<SCCOL>(nCol), 0, true);
nBreite = nDefWidth;
}
- pDoc->SetColWidth( static_cast<SCCOL> (nCol), nTab, nBreite );
+ rContext.pDoc->SetColWidth( static_cast<SCCOL> (nCol), nTab, nBreite );
}
}
-void OP_NamedRange( SvStream& r, sal_uInt16 /*n*/ )
- {
+void OP_NamedRange(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
+{
// POST: waren Koordinaten ungueltig, wird nicht gespeichert
sal_uInt16 nColSt, nRowSt, nColEnd, nRowEnd;
@@ -226,15 +217,15 @@ void OP_NamedRange( SvStream& r, sal_uInt16 /*n*/ )
else
strcpy( cBuf, cPuffer ); // #100211# - checked
- OUString aTmp( cBuf, strlen(cBuf), pLotusRoot->eCharsetQ );
+ OUString aTmp( cBuf, strlen(cBuf), rContext.pLotusRoot->eCharsetQ );
aTmp = ScfTools::ConvertToScDefinedName( aTmp );
- pLotusRoot->pRangeNames->Append( pRange, aTmp );
+ rContext.pLotusRoot->pRangeNames->Append( pRange, aTmp );
}
}
-void OP_SymphNamedRange( SvStream& r, sal_uInt16 /*n*/ )
+void OP_SymphNamedRange(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
{
// POST: waren Koordinaten ungueltig, wird nicht gespeichert
sal_uInt16 nColSt, nRowSt, nColEnd, nRowEnd;
@@ -265,29 +256,29 @@ void OP_SymphNamedRange( SvStream& r, sal_uInt16 /*n*/ )
else
strcpy( cBuf, cPuffer ); // #100211# - checked
- OUString aTmp( cBuf, strlen(cBuf), pLotusRoot->eCharsetQ );
+ OUString aTmp( cBuf, strlen(cBuf), rContext.pLotusRoot->eCharsetQ );
aTmp = ScfTools::ConvertToScDefinedName( aTmp );
- pLotusRoot->pRangeNames->Append( pRange, aTmp );
+ rContext.pLotusRoot->pRangeNames->Append( pRange, aTmp );
}
}
-void OP_Footer( SvStream& r, sal_uInt16 n )
+void OP_Footer(LotusContext& /*rContext*/, SvStream& r, sal_uInt16 n)
{
r.SeekRel( n );
}
-void OP_Header( SvStream& r, sal_uInt16 n )
+void OP_Header(LotusContext& /*rContext*/, SvStream& r, sal_uInt16 n)
{
r.SeekRel( n );
}
-void OP_Margins( SvStream& r, sal_uInt16 n )
+void OP_Margins(LotusContext& /*rContext*/, SvStream& r, sal_uInt16 n)
{
r.SeekRel( n );
}
-void OP_HiddenCols( SvStream& r, sal_uInt16 /*n*/ )
+void OP_HiddenCols(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
{
sal_uInt16 nByte, nBit;
SCCOL nCount;
@@ -300,8 +291,10 @@ void OP_HiddenCols( SvStream& r, sal_uInt16 /*n*/ )
for( nBit = 0 ; nBit < 8 ; nBit++ ) // ...jeweils 8 Bits = 256 Bits
{
if( nAkt & 0x01 ) // unterstes Bit gesetzt?
+ {
// -> Hidden Col
- pDoc->SetColHidden(nCount, nCount, 0, true);
+ rContext.pDoc->SetColHidden(nCount, nCount, 0, true);
+ }
nCount++;
nAkt = nAkt / 2; // der Naechste bitte...
@@ -309,11 +302,11 @@ void OP_HiddenCols( SvStream& r, sal_uInt16 /*n*/ )
}
}
-void OP_Window1( SvStream& r, sal_uInt16 n )
+void OP_Window1(LotusContext& rContext, SvStream& r, sal_uInt16 n)
{
r.SeekRel( 4 ); // Cursor Pos ueberspringen
- r.ReadUChar( nDefaultFormat );
+ r.ReadUChar(rContext.nDefaultFormat);
r.SeekRel( 1 ); // 'unused' ueberspringen
@@ -325,29 +318,29 @@ void OP_Window1( SvStream& r, sal_uInt16 n )
// statt Defaulteinstellung in SC alle Cols zu Fuss setzen
for( SCCOL nCol = 0 ; nCol <= MAXCOL ; nCol++ )
- pDoc->SetColWidth( nCol, 0, nDefWidth );
+ rContext.pDoc->SetColWidth( nCol, 0, nDefWidth );
}
-void OP_Blank( SvStream& r, sal_uInt16 /*n*/ )
+void OP_Blank(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
{
sal_uInt16 nCol, nRow;
sal_uInt8 nFormat;
r.ReadUChar( nFormat ).ReadUInt16( nCol ).ReadUInt16( nRow );
- SetFormat( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), 0, nFormat, nDezFloat );
+ SetFormat(rContext, static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), 0, nFormat, nDezFloat);
}
-void OP_BOF123( SvStream& r, sal_uInt16 /*n*/ )
+void OP_BOF123(LotusContext& /*rContext*/, SvStream& r, sal_uInt16 /*n*/)
{
r.SeekRel( 26 );
}
-void OP_EOF123( SvStream& /*r*/, sal_uInt16 /*n*/ )
+void OP_EOF123(LotusContext& rContext, SvStream& /*r*/, sal_uInt16 /*n*/)
{
- bEOF = true;
+ rContext.bEOF = true;
}
-void OP_Label123( SvStream& r, sal_uInt16 n )
+void OP_Label123(LotusContext& rContext, SvStream& r, sal_uInt16 n)
{
sal_uInt8 nTab, nCol;
sal_uInt16 nRow;
@@ -358,29 +351,29 @@ void OP_Label123( SvStream& r, sal_uInt16 n )
r.Read( pText.get(), n );
pText[ n ] = 0;
- PutFormString( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab), pText.get() );
+ PutFormString(rContext, static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab), pText.get());
}
-void OP_Number123( SvStream& r, sal_uInt16 /*n*/ )
+void OP_Number123(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
{
- sal_uInt8 nCol,nTab;
- sal_uInt16 nRow;
- sal_uInt32 nValue;
+ sal_uInt8 nCol(0), nTab(0);
+ sal_uInt16 nRow(0);
+ sal_uInt32 nValue(0);
r.ReadUInt16( nRow ).ReadUChar( nTab ).ReadUChar( nCol ).ReadUInt32( nValue );
- if (ValidColRow( static_cast<SCCOL>(nCol), nRow) && nTab <= pDoc->GetMaxTableNumber())
+ if (ValidColRow( static_cast<SCCOL>(nCol), nRow) && nTab <= rContext.pDoc->GetMaxTableNumber())
{
double fValue = Snum32ToDouble( nValue );
- pDoc->EnsureTable(nTab);
- pDoc->SetValue(ScAddress(nCol,nRow,nTab), fValue);
+ rContext.pDoc->EnsureTable(nTab);
+ rContext.pDoc->SetValue(ScAddress(nCol,nRow,nTab), fValue);
}
}
-void OP_Formula123( SvStream& r, sal_uInt16 n )
+void OP_Formula123(LotusContext& rContext, SvStream& r, sal_uInt16 n)
{
- sal_uInt8 nCol,nTab;
- sal_uInt16 nRow;
+ sal_uInt8 nCol(0), nTab(0);
+ sal_uInt16 nRow(0);
r.ReadUInt16( nRow ).ReadUChar( nTab ).ReadUChar( nCol );
r.SeekRel( 8 ); // Result- jump over
@@ -389,21 +382,21 @@ void OP_Formula123( SvStream& r, sal_uInt16 n )
sal_Int32 nBytesLeft = (n > 12) ? n - 12 : 0;
ScAddress aAddress( nCol, nRow, nTab );
- svl::SharedStringPool& rSPool = pLotusRoot->pDoc->GetSharedStringPool();
- LotusToSc aConv(r, rSPool, pLotusRoot->eCharsetQ, true);
+ svl::SharedStringPool& rSPool = rContext.pLotusRoot->pDoc->GetSharedStringPool();
+ LotusToSc aConv(rContext, r, rSPool, rContext.pLotusRoot->eCharsetQ, true);
aConv.Reset( aAddress );
aConv.Convert( pErg, nBytesLeft );
- if (ValidColRow( static_cast<SCCOL>(nCol), nRow) && nTab <= pDoc->GetMaxTableNumber())
+ if (ValidColRow( static_cast<SCCOL>(nCol), nRow) && nTab <= rContext.pDoc->GetMaxTableNumber())
{
- ScFormulaCell* pCell = new ScFormulaCell(pLotusRoot->pDoc, aAddress, *pErg);
+ ScFormulaCell* pCell = new ScFormulaCell(rContext.pLotusRoot->pDoc, aAddress, *pErg);
pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE );
- pDoc->EnsureTable(nTab);
- pDoc->SetFormulaCell(ScAddress(nCol,nRow,nTab), pCell);
+ rContext.pDoc->EnsureTable(nTab);
+ rContext.pDoc->SetFormulaCell(ScAddress(nCol,nRow,nTab), pCell);
}
}
-void OP_IEEENumber123( SvStream& r, sal_uInt16 /*n*/ )
+void OP_IEEENumber123(LotusContext& rContext, SvStream& r, sal_uInt16 /*n*/)
{
sal_uInt8 nCol,nTab;
sal_uInt16 nRow;
@@ -411,14 +404,14 @@ void OP_IEEENumber123( SvStream& r, sal_uInt16 /*n*/ )
r.ReadUInt16( nRow ).ReadUChar( nTab ).ReadUChar( nCol ).ReadDouble( dValue );
- if (ValidColRow( static_cast<SCCOL>(nCol), nRow) && nTab <= pDoc->GetMaxTableNumber())
+ if (ValidColRow( static_cast<SCCOL>(nCol), nRow) && nTab <= rContext.pDoc->GetMaxTableNumber())
{
- pDoc->EnsureTable(nTab);
- pDoc->SetValue(ScAddress(nCol,nRow,nTab), dValue);
+ rContext.pDoc->EnsureTable(nTab);
+ rContext.pDoc->SetValue(ScAddress(nCol,nRow,nTab), dValue);
}
}
-void OP_Note123( SvStream& r, sal_uInt16 n)
+void OP_Note123(LotusContext& rContext, SvStream& r, sal_uInt16 n)
{
sal_uInt8 nTab, nCol;
sal_uInt16 nRow;
@@ -429,14 +422,14 @@ void OP_Note123( SvStream& r, sal_uInt16 n)
r.Read( pText.get(), n );
pText[ n ] = 0;
- OUString aNoteText(pText.get(), strlen(pText.get()), pLotusRoot->eCharsetQ);
+ OUString aNoteText(pText.get(), strlen(pText.get()), rContext.pLotusRoot->eCharsetQ);
pText.reset();
ScAddress aPos( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab) );
- ScNoteUtil::CreateNoteFromString( *pDoc, aPos, aNoteText, false, false );
+ ScNoteUtil::CreateNoteFromString( *rContext.pDoc, aPos, aNoteText, false, false );
}
-void OP_HorAlign123( sal_uInt8 nAlignPattern, SfxItemSet& rPatternItemSet )
+void OP_HorAlign123(LotusContext& /*rContext*/, sal_uInt8 nAlignPattern, SfxItemSet& rPatternItemSet)
{
// pre: Pattern is stored in the last 3 bites of the 21st byte
// post: Appropriate Horizontal Alignement is set in rPattern according to the bit pattern.
@@ -469,7 +462,7 @@ void OP_HorAlign123( sal_uInt8 nAlignPattern, SfxItemSet& rPatternItemSet )
}
}
-void OP_VerAlign123( sal_uInt8 nAlignPattern,SfxItemSet& rPatternItemSet )
+void OP_VerAlign123(LotusContext& /*rContext*/, sal_uInt8 nAlignPattern, SfxItemSet& rPatternItemSet)
{
// pre: Pattern is stored in the last 3 bites of the 22nd byte
// post: Appropriate Verticle Alignement is set in rPattern according to the bit pattern.
@@ -498,11 +491,11 @@ void OP_VerAlign123( sal_uInt8 nAlignPattern,SfxItemSet& rPatternItemSet )
}
}
-void OP_CreatePattern123( SvStream& r, sal_uInt16 n)
+void OP_CreatePattern123(LotusContext& rContext, SvStream& r, sal_uInt16 n)
{
sal_uInt16 nCode,nPatternId;
- ScPatternAttr aPattern(pDoc->GetPool());
+ ScPatternAttr aPattern(rContext.pDoc->GetPool());
SfxItemSet& rItemSet = aPattern.GetItemSet();
r.ReadUInt16( nCode );
@@ -535,18 +528,18 @@ void OP_CreatePattern123( SvStream& r, sal_uInt16 n)
// Read 21st Byte
r.ReadUChar( Hor_Align );
- OP_HorAlign123( Hor_Align, rItemSet );
+ OP_HorAlign123(rContext, Hor_Align, rItemSet );
r.ReadUChar( Ver_Align );
- OP_VerAlign123( Ver_Align, rItemSet );
+ OP_VerAlign123(rContext, Ver_Align, rItemSet );
- aLotusPatternPool.insert( std::map<sal_uInt16, ScPatternAttr>::value_type( nPatternId, aPattern ) );
+ rContext.aLotusPatternPool.insert( std::map<sal_uInt16, ScPatternAttr>::value_type( nPatternId, aPattern ) );
n -= (n > 20) ? 20 : n;
}
r.SeekRel(n);
}
-void OP_SheetName123( SvStream& rStream, sal_uInt16 nLength )
+void OP_SheetName123(LotusContext& rContext, SvStream& rStream, sal_uInt16 nLength)
{
if (nLength <= 4)
{
@@ -560,7 +553,7 @@ void OP_SheetName123( SvStream& rStream, sal_uInt16 nLength )
rStream.ReadUInt16( nDummy ); // ignore the first 2 bytes (B0 36).
rStream.ReadUInt16( nDummy );
SCTAB nSheetNum = static_cast<SCTAB>(nDummy);
- pDoc->MakeTable(nSheetNum);
+ rContext.pDoc->MakeTable(nSheetNum);
::std::vector<sal_Char> sSheetName;
sSheetName.reserve(nLength-4);
@@ -573,12 +566,12 @@ void OP_SheetName123( SvStream& rStream, sal_uInt16 nLength )
if (!sSheetName.empty())
{
- OUString aName(&sSheetName[0], strlen(&sSheetName[0]), eCharVon);
- pDoc->RenameTab(nSheetNum, aName);
+ OUString aName(&sSheetName[0], strlen(&sSheetName[0]), rContext.eCharVon);
+ rContext.pDoc->RenameTab(nSheetNum, aName);
}
}
-void OP_ApplyPatternArea123( SvStream& rStream )
+void OP_ApplyPatternArea123(LotusContext& rContext, SvStream& rStream)
{
sal_uInt16 nOpcode, nLength;
sal_uInt16 nCol = 0, nColCount = 0, nRow = 0, nRowCount = 0, nTab = 0, nData, nTabCount = 0, nLevel = 0;
@@ -630,12 +623,12 @@ void OP_ApplyPatternArea123( SvStream& rStream )
{
rStream.ReadUInt16( nData );
rStream.SeekRel( nLength - 2 );
- std::map<sal_uInt16, ScPatternAttr>::iterator loc = aLotusPatternPool.find( nData );
+ std::map<sal_uInt16, ScPatternAttr>::iterator loc = rContext.aLotusPatternPool.find( nData );
// #126338# apparently, files with invalid index occur in the wild -> don't crash then
- if ( loc != aLotusPatternPool.end() )
+ if ( loc != rContext.aLotusPatternPool.end() )
for( int i = 0; i < nTabCount; i++)
{
- pDoc->ApplyPatternAreaTab( nCol, nRow, nCol + nColCount - 1, nRow + nRowCount - 1, static_cast< SCTAB >( nTab + i ), loc->second );
+ rContext.pDoc->ApplyPatternAreaTab( nCol, nRow, nCol + nColCount - 1, nRow + nRowCount - 1, static_cast< SCTAB >( nTab + i ), loc->second );
}
}
else
@@ -648,7 +641,7 @@ void OP_ApplyPatternArea123( SvStream& rStream )
}
while( nLevel && !rStream.IsEof() );
- aLotusPatternPool.clear();
+ rContext.aLotusPatternPool.clear();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/lotus/optab.cxx b/sc/source/filter/lotus/optab.cxx
index b5525d80..9c62307 100644
--- a/sc/source/filter/lotus/optab.cxx
+++ b/sc/source/filter/lotus/optab.cxx
@@ -19,9 +19,10 @@
#include "op.h"
#include "optab.h"
+#include "lotfilter.hxx"
// Bearbeitungsfunktion sal_Char *X( sal_Char * )
-OPCODE_FKT pOpFkt[ FKT_LIMIT ] =
+OPCODE_FKT LotusContext::pOpFkt[ FKT_LIMIT ] =
{ // Code
OP_BOF, // 0
OP_EOF, // 1
@@ -126,7 +127,7 @@ OPCODE_FKT pOpFkt[ FKT_LIMIT ] =
OP_HiddenCols, // 100
};
-OPCODE_FKT pOpFkt123[ FKT_LIMIT123 ] =
+OPCODE_FKT LotusContext::pOpFkt123[ FKT_LIMIT123 ] =
{ // Code
OP_BOF123, // 0
OP_EOF123, // 1
diff --git a/sc/source/filter/lotus/tool.cxx b/sc/source/filter/lotus/tool.cxx
index 288522a..273ae78 100644
--- a/sc/source/filter/lotus/tool.cxx
+++ b/sc/source/filter/lotus/tool.cxx
@@ -33,31 +33,11 @@
#include "ftools.hxx"
#include "stringutil.hxx"
#include "tokenarray.hxx"
+#include "lotfilter.hxx"
#include <math.h>
-// External variable
-extern WKTYP eTyp; // -> filter.cxx, aktueller Dateityp
-extern ScDocument* pDoc; // -> filter.cxx, Aufhaenger zum Dokumentzugriff
-
-// Global variable
-sal_uInt8 nDefaultFormat; // -> op.cpp, Standard-Zellenformat
-
-extern SvxHorJustifyItem *pAttrRight, *pAttrLeft, *pAttrCenter, *pAttrRepeat, *pAttrStandard;
-extern ScProtectionAttr* pAttrUnprot;
-extern SfxUInt32Item** pAttrValForms;
-
-SvxHorJustifyItem *pAttrRight, *pAttrLeft, *pAttrCenter, *pAttrRepeat, *pAttrStandard;
- // -> in memory.cxx initialisiert
-ScProtectionAttr* pAttrUnprot; // -> " memory.cxx "
-
-extern FormCache* pValueFormCache; // -> in memory.cxx initialisiert
-FormCache* pValueFormCache;
-
-SCCOL LotusRangeList::nEingCol;
-SCROW LotusRangeList::nEingRow;
-
-void PutFormString( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Char* pString )
+void PutFormString(LotusContext& rContext, SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Char* pString)
{
// Label-Format-Auswertung
OSL_ENSURE( pString != NULL, "PutFormString(): pString == NULL" );
@@ -72,47 +52,47 @@ void PutFormString( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Char* pString )
switch( cForm )
{
case '"': // rechtsbuendig
- pJustify = pAttrRight;
+ pJustify = rContext.pAttrRight;
pString++;
break;
case '\'': // linksbuendig
- pJustify = pAttrLeft;
+ pJustify = rContext.pAttrLeft;
pString++;
break;
case '^': // zentriert
- pJustify = pAttrCenter;
+ pJustify = rContext.pAttrCenter;
pString++;
break;
case '|': // printer command
pString = NULL;
break;
case '\\': // Wiederholung
- pJustify = pAttrRepeat;
+ pJustify = rContext.pAttrRepeat;
pString++;
break;
default: // kenn' ich nicht!
- pJustify = pAttrStandard;
+ pJustify = rContext.pAttrStandard;
}
if (!pString)
return;
- pDoc->ApplyAttr( nCol, nRow, nTab, *pJustify );
+ rContext.pDoc->ApplyAttr( nCol, nRow, nTab, *pJustify );
ScSetStringParam aParam;
aParam.setTextInput();
- pDoc->SetString(ScAddress(nCol,nRow,nTab), OUString(pString, strlen(pString), pLotusRoot->eCharsetQ), &aParam);
+ rContext.pDoc->SetString(ScAddress(nCol,nRow,nTab), OUString(pString, strlen(pString), rContext.pLotusRoot->eCharsetQ), &aParam);
}
-void SetFormat( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt8 nFormat, sal_uInt8 nSt )
+void SetFormat(LotusContext& rContext, SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt8 nFormat, sal_uInt8 nSt)
{
// PREC: nSt = Standard-Dezimalstellenanzahl
- pDoc->ApplyAttr( nCol, nRow, nTab, *( pValueFormCache->GetAttr( nFormat, nSt ) ) );
+ rContext.pDoc->ApplyAttr(nCol, nRow, nTab, *(rContext.pValueFormCache->GetAttr(nFormat, nSt)));
ScProtectionAttr aAttr;
aAttr.SetProtection( nFormat & 0x80 );
- pDoc->ApplyAttr( nCol, nRow, nTab, aAttr );
+ rContext.pDoc->ApplyAttr( nCol, nRow, nTab, aAttr );
}
void InitPage( void )
@@ -391,7 +371,8 @@ LotusRange::LotusRange( const LotusRange& rCpy )
Copy( rCpy );
}
-LotusRangeList::LotusRangeList( void )
+LotusRangeList::LotusRangeList(LOTUS_ROOT* pLotRoot)
+ : m_pLotRoot(pLotRoot)
{
aComplRef.InitFlags();
@@ -411,6 +392,9 @@ LotusRangeList::LotusRangeList( void )
pSingRef->SetFlag3D( false );
}
+SCCOL LotusRangeList::nEingCol;
+SCROW LotusRangeList::nEingRow;
+
LotusRangeList::~LotusRangeList ()
{
std::vector<LotusRange*>::iterator pIter;
@@ -453,16 +437,17 @@ void LotusRangeList::Append( LotusRange* pLR, const OUString& rName )
}
ScRangeData* pData = new ScRangeData(
- pLotusRoot->pDoc, rName, aTokArray );
+ m_pLotRoot->pDoc, rName, aTokArray );
- pLotusRoot->pScRangeName->insert( pData );
+ m_pLotRoot->pScRangeName->insert( pData );
pLR->SetId( nIdCnt );
nIdCnt++;
}
-RangeNameBufferWK3::RangeNameBufferWK3( void )
+RangeNameBufferWK3::RangeNameBufferWK3(LOTUS_ROOT* pLotRoot)
+ : m_pLotRoot(pLotRoot)
{
pScTokenArray = new ScTokenArray;
nIntCount = 1;
@@ -496,14 +481,14 @@ void RangeNameBufferWK3::Add( const OUString& rOrgName, const ScComplexRefData&
aInsert.bSingleRef = false;
}
- ScRangeData* pData = new ScRangeData( pLotusRoot->pDoc, aScName, *pScTokenArray );
+ ScRangeData* pData = new ScRangeData( m_pLotRoot->pDoc, aScName, *pScTokenArray );
aInsert.nRelInd = nIntCount;
pData->SetIndex( nIntCount );
nIntCount++;
maEntries.push_back( aInsert );
- pLotusRoot->pScRangeName->insert( pData );
+ m_pLotRoot->pScRangeName->insert( pData );
}
bool RangeNameBufferWK3::FindRel( const OUString& rRef, sal_uInt16& rIndex )
@@ -557,13 +542,13 @@ bool RangeNameBufferWK3::FindAbs( const OUString& rRef, sal_uInt16& rIndex )
pScTokenArray->AddDoubleReference( itr->aScComplexRefDataRel );
}
- ScRangeData* pData = new ScRangeData( pLotusRoot->pDoc, itr->aScAbsName, *pScTokenArray );
+ ScRangeData* pData = new ScRangeData( m_pLotRoot->pDoc, itr->aScAbsName, *pScTokenArray );
rIndex = itr->nAbsInd = nIntCount;
pData->SetIndex( rIndex );
nIntCount++;
- pLotusRoot->pScRangeName->insert( pData );
+ m_pLotRoot->pScRangeName->insert( pData );
}
return true;
commit abbeed756019e099d16acb4155c7c459fef2d1b4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Sep 10 09:26:16 2014 +0100
callcatcher: update unused code
Change-Id: Ie31c16318b09699e080484292d489a378e3a6dce
diff --git a/include/vcl/toolbox.hxx b/include/vcl/toolbox.hxx
index 6844893..c27c1b2 100644
--- a/include/vcl/toolbox.hxx
+++ b/include/vcl/toolbox.hxx
@@ -572,7 +572,6 @@ public:
Size GetDefaultImageSize() const;
void ChangeHighlight( sal_uInt16 nPos );
- void SetImageListProvider(vcl::IImageListProvider* _pProvider);
void SetToolbarLayoutMode( ToolBoxLayoutMode eLayout );
};
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 88e0623..e314145 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -567,8 +567,6 @@ public:
bool HasChartAtPoint( SCTAB nTab, const Point& rPos, OUString& rName );
::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > GetChartByName( const OUString& rChartName );
- std::vector<std::pair<css::uno::Reference<
- css::chart2::XChartDocument>, Rectangle> > GetAllCharts();
SC_DLLPUBLIC void GetChartRanges( const OUString& rChartName, ::std::vector< ScRangeList >& rRanges, ScDocument* pSheetNameDoc );
void SetChartRanges( const OUString& rChartName, const ::std::vector< ScRangeList >& rRanges );
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index b902979..b3a9813 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -661,41 +661,6 @@ uno::Reference< embed::XEmbeddedObject >
return uno::Reference< embed::XEmbeddedObject >();
}
-std::vector<std::pair<uno::Reference<chart2::XChartDocument>, Rectangle> > ScDocument::GetAllCharts()
-{
- std::vector<std::pair<uno::Reference<chart2::XChartDocument>, Rectangle> > aRet;
- if (!pDrawLayer)
- return aRet;
-
- for (SCTAB nTab=0; nTab< static_cast<SCTAB>(maTabs.size()); nTab++)
- {
- if (!maTabs[nTab])
- continue;
-
- SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
- OSL_ENSURE(pPage,"Page ?");
-
- if (!pPage)
- continue;
-
- SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS );
-
- for (SdrObject* pObject = aIter.Next(); pObject; pObject = aIter.Next())
- {
- if ( pObject->GetObjIdentifier() != OBJ_OLE2 )
- continue;
-
- uno::Reference< chart2::XChartDocument > xChartDoc( ScChartHelper::GetChartFromSdrObject( pObject ) );
- if(!xChartDoc.is())
- continue;
-
- Rectangle aRect = pObject->GetLastBoundRect();
- aRet.push_back(std::pair<uno::Reference<chart2::XChartDocument>, Rectangle>(xChartDoc, aRect));
- }
- }
- return aRet;
-}
-
void ScDocument::UpdateChartListenerCollection()
{
OSL_ASSERT(pChartListenerCollection);
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index ed066b2..8086335 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -130,7 +130,6 @@ class ScGridWindow : public Window, public DropTargetHelper, public DragSourceHe
VisibleRange maVisibleRange;
boost::scoped_ptr<sc::SpellCheckContext> mpSpellCheckCxt;
- boost::ptr_vector<Window> maChildWindows;
ScViewData* pViewData;
ScSplitPos eWhich;
@@ -416,12 +415,6 @@ public:
void UpdateShrinkOverlay();
void UpdateAllOverlays();
- /**
- * Takes ownership of the window
- */
- void AddChildWindow(Window* pChildWindow);
- void DeleteChildWindow(Window* pChildWindow);
-
protected:
// #114409#
void ImpCreateOverlayObjects();
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 071558c..7421959 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1634,36 +1634,6 @@ bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, bool bAction )
void ScGridWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
- if(!maChildWindows.empty())
- {
- const Point& rPos = rMEvt.GetPosPixel();
- for(boost::ptr_vector<Window>::iterator itr = maChildWindows.begin(),
- itrEnd = maChildWindows.end(); itr != itrEnd; ++itr)
- {
- if(!itr->IsVisible())
- continue;
-
- Point aPoint = itr->GetPosPixel();
- Size aSize = itr->GetSizePixel();
-
- if(rPos.X() >= aPoint.X() && rPos.X() <= (aPoint.X() + aSize.Width())
- && rPos.Y() >= aPoint.Y() && rPos.Y() <= (aPoint.Y() + aSize.Height()))
- {
- // we found a mouse event for the child window
- // we need to recalculate the position based on the child window
-
- Point aNewPos = rPos - aPoint;
- sal_uInt16 nClicks = rMEvt.GetClicks();
- sal_uInt16 nMode = rMEvt.GetMode();
- sal_uInt16 nButtons = rMEvt.GetButtons();
- sal_uInt16 nModifier = rMEvt.GetModifier();
-
- MouseEvent aEvent(aNewPos, nClicks, nMode, nButtons, nModifier);
- itr->MouseButtonDown(aEvent);
- return;
- }
- }
- }
nNestedButtonState = SC_NESTEDBUTTON_DOWN;
MouseEventState aState;
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index bed697b..9adb789 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -472,22 +472,4 @@ void ScGridWindow::SwitchView()
}
}
-void ScGridWindow::AddChildWindow(Window* pWindow)
-{
- maChildWindows.push_back(pWindow);
-}
-
-void ScGridWindow::DeleteChildWindow(Window* pWindow)
-{
- for(boost::ptr_vector<Window>::iterator itr = maChildWindows.begin(),
- itrEnd = maChildWindows.end(); itr != itrEnd; ++itr)
- {
- if(&(*itr) == pWindow)
- {
- maChildWindows.erase(itr);
- return;
- }
- }
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/LayerTabBar.cxx b/sd/source/ui/dlg/LayerTabBar.cxx
index 65ade494..82eaf93 100644
--- a/sd/source/ui/dlg/LayerTabBar.cxx
+++ b/sd/source/ui/dlg/LayerTabBar.cxx
@@ -55,17 +55,6 @@ LayerTabBar::LayerTabBar(DrawViewShell* pViewSh, Window* pParent)
SetHelpId( HID_SD_TABBAR_LAYERS );
}
-LayerTabBar::LayerTabBar (
- DrawViewShell* pViewSh,
- Window* pParent,
- const ResId& rResId)
- : TabBar (pParent, rResId.GetWinBits()),
- DropTargetHelper( this ),
- pDrViewSh(pViewSh)
-{
- EnableEditMode();
-}
-
LayerTabBar::~LayerTabBar()
{
}
diff --git a/sd/source/ui/inc/LayerTabBar.hxx b/sd/source/ui/inc/LayerTabBar.hxx
index 6f42de1..8c7f19e 100644
--- a/sd/source/ui/inc/LayerTabBar.hxx
+++ b/sd/source/ui/inc/LayerTabBar.hxx
@@ -38,10 +38,6 @@ public:
LayerTabBar (
DrawViewShell* pDrViewSh,
::Window* pParent);
- LayerTabBar (
- DrawViewShell* pDrViewSh,
- ::Window* pParent,
- const ResId& rResId);
virtual ~LayerTabBar (void);
/** Inform all listeners of this control that the current layer has been
diff --git a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
index 367db27..dcc9065 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
@@ -120,7 +120,6 @@ private:
const Bitmap& rPreview,
const BitmapEx& rOverlay,
const OutputDevice* pReferenceDevice) const;
- void InvalidateBitmaps (void);
/** Update the local pointer to the page object layouter to the
one owned by the general layouter.
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
index 3e7fe0d..12814c4 100644
--- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
@@ -101,18 +101,6 @@ bool PageObjectPainter::UpdatePageObjectLayouter (void)
return true;
}
-void PageObjectPainter::InvalidateBitmaps (void)
-{
- maNormalBackground.SetEmpty();
- maSelectionBackground.SetEmpty();
- maFocusedSelectionBackground.SetEmpty();
- maFocusedBackground.SetEmpty();
- maMouseOverBackground.SetEmpty();
- maMouseOverSelectedBackground.SetEmpty();
- maMouseOverFocusedBackground.SetEmpty();
- maMouseOverSelectedAndFocusedBackground.SetEmpty();
-}
-
void PageObjectPainter::SetTheme (const ::boost::shared_ptr<view::Theme>& rpTheme)
{
mpTheme = rpTheme;
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 5cf9fa7..7c2706a 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1014,24 +1014,6 @@ SfxStyleFamily SfxTemplateDialog::NIdToSfxFamilyId(sal_uInt16 nId)
}
}
-void SfxCommonTemplateDialog_Impl::SetAutomaticFilter()
-{
- sal_uInt16 nCount = aFilterLb.GetEntryCount();
- for ( sal_uInt16 i = 0; i < nCount; ++i )
- {
- sal_uIntPtr nFlags = (sal_uIntPtr)aFilterLb.GetEntryData(i);
- if ( SFXSTYLEBIT_AUTO == nFlags )
- {
- // automatic entry found -> select it
- aFilterLb.SelectEntryPos(i);
- // then call the handler to filter the styles
- FilterSelect( i - 1 );
- break;
- }
- }
-}
-
-
// Helper function: Access to the current family item
const SfxStyleFamilyItem *SfxCommonTemplateDialog_Impl::GetFamilyItem_Impl() const
{
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index 41328ec..2988d0a 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -293,8 +293,6 @@ public:
// normaly for derivates from SvTreeListBoxes, but in this case the dialog handles context menus
virtual PopupMenu* CreateContextMenu( void );
-
- void SetAutomaticFilter();
};
class DropToolBox_Impl : public ToolBox, public DropTargetHelper
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index f2b1b15..8975e2f 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -232,195 +232,6 @@ namespace svt { namespace table
}
};
-
-
- //= TableControl_Impl
-
-
-#ifdef DBG_UTIL
-
- //= SuspendInvariants
-
- class SuspendInvariants
- {
- private:
- const TableControl_Impl& m_rTable;
- sal_Int32 m_nSuspendFlags;
-
- public:
- SuspendInvariants( const TableControl_Impl& _rTable, sal_Int32 _nSuspendFlags )
- :m_rTable( _rTable )
- ,m_nSuspendFlags( _nSuspendFlags )
- {
- //DBG_ASSERT( ( m_rTable.m_nRequiredInvariants & m_nSuspendFlags ) == m_nSuspendFlags,
- // "SuspendInvariants: cannot suspend what is already suspended!" );
- const_cast< TableControl_Impl& >( m_rTable ).m_nRequiredInvariants &= ~m_nSuspendFlags;
- }
- ~SuspendInvariants()
- {
- const_cast< TableControl_Impl& >( m_rTable ).m_nRequiredInvariants |= m_nSuspendFlags;
- }
- };
- #define DBG_SUSPEND_INV( flags ) \
- SuspendInvariants aSuspendInv( *this, flags );
-#else
- #define DBG_SUSPEND_INV( flags )
-#endif
-
-#ifdef DBG_UTIL
-
- namespace
- {
- template< typename SCALAR_TYPE >
- bool lcl_checkLimitsExclusive( SCALAR_TYPE _nValue, SCALAR_TYPE _nMin, SCALAR_TYPE _nMax )
- {
- return ( _nValue > _nMin ) && ( _nValue < _nMax );
- }
-
- template< typename SCALAR_TYPE >
- bool lcl_checkLimitsExclusive_OrDefault_OrFallback( SCALAR_TYPE _nValue, SCALAR_TYPE _nMin, SCALAR_TYPE _nMax,
- PTableModel _pModel, SCALAR_TYPE _nDefaultOrFallback )
- {
- if ( !_pModel )
- return _nValue == _nDefaultOrFallback;
- if ( _nMax <= _nMin )
- return _nDefaultOrFallback == _nValue;
- return lcl_checkLimitsExclusive( _nValue, _nMin, _nMax );
- }
- }
-
-
- const sal_Char* TableControl_Impl::impl_checkInvariants() const
- {
- if ( !m_pModel )
- return "no model, not even an EmptyTableModel";
-
- if ( !m_pDataWindow )
- return "invalid data window!";
-
- if ( m_pModel->getColumnCount() != m_nColumnCount )
- return "column counts are inconsistent!";
-
- if ( m_pModel->getRowCount() != m_nRowCount )
- return "row counts are inconsistent!";
-
- if ( ( ( m_nCurColumn != COL_INVALID ) && !m_aColumnWidths.empty() && ( m_nCurColumn < 0 ) ) || ( m_nCurColumn >= (ColPos)m_aColumnWidths.size() ) )
- return "current column is invalid!";
-
- if ( !lcl_checkLimitsExclusive_OrDefault_OrFallback( m_nTopRow, (RowPos)-1, m_nRowCount, getModel(), (RowPos)0 ) )
- return "invalid top row value!";
-
- if ( !lcl_checkLimitsExclusive_OrDefault_OrFallback( m_nCurRow, (RowPos)-1, m_nRowCount, getModel(), ROW_INVALID ) )
- return "invalid current row value!";
-
- if ( !lcl_checkLimitsExclusive_OrDefault_OrFallback( m_nLeftColumn, (ColPos)-1, m_nColumnCount, getModel(), (ColPos)0 ) )
- return "invalid current column value!";
-
- if ( !lcl_checkLimitsExclusive_OrDefault_OrFallback( m_nCurColumn, (ColPos)-1, m_nColumnCount, getModel(), COL_INVALID ) )
- return "invalid current column value!";
-
- if ( m_pInputHandler != m_pModel->getInputHandler() )
- return "input handler is not the model-provided one!";
-
- // m_aSelectedRows should have reasonable content
- {
- if ( m_aSelectedRows.size() > size_t( m_pModel->getRowCount() ) )
- return "there are more rows selected than actually exist";
- for ( ::std::vector< RowPos >::const_iterator selRow = m_aSelectedRows.begin();
- selRow != m_aSelectedRows.end();
- ++selRow
- )
- {
- if ( ( *selRow < 0 ) || ( *selRow >= m_pModel->getRowCount() ) )
- return "a non-existent row is selected";
- }
- }
-
- // m_nColHeaderHeightPixel consistent with the model's value?
- {
- TableMetrics nHeaderHeight = m_pModel->hasColumnHeaders() ? m_pModel->getColumnHeaderHeight() : 0;
- nHeaderHeight = m_rAntiImpl.LogicToPixel( Size( 0, nHeaderHeight ), MAP_APPFONT ).Height();
- if ( nHeaderHeight != m_nColHeaderHeightPixel )
- return "column header heights are inconsistent!";
- }
-
- bool isDummyModel = dynamic_cast< const EmptyTableModel* >( m_pModel.get() ) != NULL;
- if ( !isDummyModel )
- {
- TableMetrics nRowHeight = m_pModel->getRowHeight();
- nRowHeight = m_rAntiImpl.LogicToPixel( Size( 0, nRowHeight ), MAP_APPFONT).Height();
- if ( nRowHeight != m_nRowHeightPixel )
- return "row heights are inconsistent!";
- }
-
- // m_nRowHeaderWidthPixel consistent with the model's value?
- {
- TableMetrics nHeaderWidth = m_pModel->hasRowHeaders() ? m_pModel->getRowHeaderWidth() : 0;
- nHeaderWidth = m_rAntiImpl.LogicToPixel( Size( nHeaderWidth, 0 ), MAP_APPFONT ).Width();
- if ( nHeaderWidth != m_nRowHeaderWidthPixel )
- return "row header widths are inconsistent!";
- }
-
- // m_aColumnWidths consistency
- if ( size_t( m_nColumnCount ) != m_aColumnWidths.size() )
- return "wrong number of cached column widths";
-
- for ( ColumnPositions::const_iterator col = m_aColumnWidths.begin();
- col != m_aColumnWidths.end();
- )
- {
- if ( col->getEnd() < col->getStart() )
- return "column widths: 'end' is expected to not be smaller than start";
-
- ColumnPositions::const_iterator nextCol = col + 1;
- if ( nextCol != m_aColumnWidths.end() )
- if ( col->getEnd() != nextCol->getStart() )
- return "column widths: one column's end should be the next column's start";
- col = nextCol;
- }
-
- if ( m_nLeftColumn < m_nColumnCount )
- if ( m_aColumnWidths[ m_nLeftColumn ].getStart() != m_nRowHeaderWidthPixel )
- return "the left-most column should start immediately after the row header";
-
- if ( m_nCursorHidden < 0 )
- return "invalid hidden count for the cursor!";
-
- if ( ( m_nRequiredInvariants & INV_SCROLL_POSITION ) && m_pVScroll )
- {
- DBG_SUSPEND_INV( INV_SCROLL_POSITION );
- // prevent infinite recursion
-
- if ( m_nLeftColumn < 0 )
- return "invalid left-most column index";
- if ( m_pVScroll->GetThumbPos() != m_nTopRow )
- return "vertical scroll bar |position| is incorrect!";
- if ( m_pVScroll->GetRange().Max() != m_nRowCount )
- return "vertical scroll bar |range| is incorrect!";
- if ( m_pVScroll->GetVisibleSize() != impl_getVisibleRows( false ) )
- return "vertical scroll bar |visible size| is incorrect!";
- }
-
- if ( ( m_nRequiredInvariants & INV_SCROLL_POSITION ) && m_pHScroll )
- {
- DBG_SUSPEND_INV( INV_SCROLL_POSITION );
- // prevent infinite recursion
-
- if ( m_pHScroll->GetThumbPos() != m_nLeftColumn )
- return "horizontal scroll bar |position| is incorrect!";
- if ( m_pHScroll->GetRange().Max() != m_nColumnCount )
- return "horizontal scroll bar |range| is incorrect!";
- if ( m_pHScroll->GetVisibleSize() != impl_getVisibleColumns( false ) )
- return "horizontal scroll bar |visible size| is incorrect!";
- }
-
- return NULL;
- }
-#endif
-
-#define DBG_CHECK_ME() \
-
-
TableControl_Impl::TableControl_Impl( TableControl& _rAntiImpl )
:m_rAntiImpl ( _rAntiImpl )
,m_pModel ( new EmptyTableModel )
@@ -445,9 +256,6 @@ namespace svt { namespace table
,m_nAnchor ( -1 )
,m_bUpdatingColWidths ( false )
,m_pAccessibleTable ( NULL )
-#ifdef DBG_UTIL
- ,m_nRequiredInvariants ( INV_SCROLL_POSITION )
-#endif
{
m_pSelEngine = new SelectionEngine( m_pDataWindow.get(), m_pTableFunctionSet );
m_pSelEngine->SetSelectionMode(SINGLE_SELECTION);
@@ -455,7 +263,6 @@ namespace svt { namespace table
m_pDataWindow->Show();
}
-
TableControl_Impl::~TableControl_Impl()
{
@@ -466,11 +273,8 @@ namespace svt { namespace table
DELETEZ( m_pSelEngine );
}
-
void TableControl_Impl::setModel( PTableModel _pModel )
{
- DBG_CHECK_ME();
-
SuppressCursor aHideCursor( *this );
if ( !!m_pModel )
@@ -520,7 +324,6 @@ namespace svt { namespace table
void TableControl_Impl::rowsInserted( RowPos i_first, RowPos i_last )
{
- DBG_CHECK_ME();
OSL_PRECOND( i_last >= i_first, "TableControl_Impl::rowsInserted: invalid row indexes!" );
TableSize const insertedRows = i_last - i_first + 1;
@@ -692,8 +495,6 @@ namespace svt { namespace table
void TableControl_Impl::impl_invalidateColumn( ColPos const i_column )
{
- DBG_CHECK_ME();
-
Rectangle const aAllCellsArea( impl_getAllVisibleCellsArea() );
const TableColumnGeometry aColumn( *this, aAllCellsArea, i_column );
@@ -729,8 +530,6 @@ namespace svt { namespace table
Rectangle TableControl_Impl::impl_getAllVisibleCellsArea() const
{
- DBG_CHECK_ME();
-
Rectangle aArea( Point( 0, 0 ), Size( 0, 0 ) );
// determine the right-most border of the last column which is
@@ -767,8 +566,6 @@ namespace svt { namespace table
Rectangle TableControl_Impl::impl_getAllVisibleDataCellArea() const
{
- DBG_CHECK_ME();
-
Rectangle aArea( impl_getAllVisibleCellsArea() );
aArea.Left() = m_nRowHeaderWidthPixel;
aArea.Top() = m_nColHeaderHeightPixel;
@@ -1398,8 +1195,6 @@ namespace svt { namespace table
void TableControl_Impl::onResize()
{
- DBG_CHECK_ME();
-
impl_ni_relayout();
checkCursorPosition();
}
@@ -1407,8 +1202,6 @@ namespace svt { namespace table
void TableControl_Impl::doPaintContent( const Rectangle& _rUpdateRect )
{
- DBG_CHECK_ME();
-
if ( !getModel() )
return;
PTableRenderer pRenderer = getModel()->getRenderer();
@@ -1531,8 +1324,6 @@ namespace svt { namespace table
void TableControl_Impl::hideCursor()
{
- DBG_CHECK_ME();
-
if ( ++m_nCursorHidden == 1 )
impl_ni_doSwitchCursor( false );
}
@@ -1540,8 +1331,6 @@ namespace svt { namespace table
void TableControl_Impl::showCursor()
{
- DBG_CHECK_ME();
-
DBG_ASSERT( m_nCursorHidden > 0, "TableControl_Impl::showCursor: cursor not hidden!" );
if ( --m_nCursorHidden == 0 )
impl_ni_doSwitchCursor( true );
@@ -1550,8 +1339,6 @@ namespace svt { namespace table
bool TableControl_Impl::dispatchAction( TableControlAction _eAction )
{
- DBG_CHECK_ME();
-
bool bSuccess = false;
bool selectionChanged = false;
@@ -1939,8 +1726,6 @@ namespace svt { namespace table
void TableControl_Impl::impl_getCellRect( ColPos _nColumn, RowPos _nRow, Rectangle& _rCellRect ) const
{
- DBG_CHECK_ME();
-
if ( !m_pModel
|| ( COL_INVALID == _nColumn )
|| ( ROW_INVALID == _nRow )
@@ -1957,14 +1742,12 @@ namespace svt { namespace table
RowPos TableControl_Impl::getRowAtPoint( const Point& rPoint ) const
{
- DBG_CHECK_ME();
return impl_getRowForAbscissa( rPoint.Y() );
}
ColPos TableControl_Impl::getColAtPoint( const Point& rPoint ) const
{
- DBG_CHECK_ME();
return impl_getColumnForOrdinate( rPoint.X() );
}
@@ -1990,8 +1773,6 @@ namespace svt { namespace table
ColumnMetrics TableControl_Impl::getColumnMetrics( ColPos const i_column ) const
{
- DBG_CHECK_ME();
-
ENSURE_OR_RETURN( ( i_column >= 0 ) && ( i_column < m_pModel->getColumnCount() ),
"TableControl_Impl::getColumnMetrics: illegal column index!", ColumnMetrics() );
return (ColumnMetrics const &)m_aColumnWidths[ i_column ];
@@ -2024,7 +1805,6 @@ namespace svt { namespace table
void TableControl_Impl::setPointer( Pointer const & i_pointer )
{
- DBG_CHECK_ME();
m_pDataWindow->SetPointer( i_pointer );
}
@@ -2091,14 +1871,12 @@ namespace svt { namespace table
bool TableControl_Impl::activateCell( ColPos const i_col, RowPos const i_row )
{
- DBG_CHECK_ME();
return goTo( i_col, i_row );
}
void TableControl_Impl::invalidateSelectedRegion( RowPos _nPrevRow, RowPos _nCurRow )
{
- DBG_CHECK_ME();
// get the visible area of the table control and set the Left and right border of the region to be repainted
Rectangle const aAllCells( impl_getAllVisibleCellsArea() );
@@ -2179,7 +1957,6 @@ namespace svt { namespace table
void TableControl_Impl::checkCursorPosition()
{
- DBG_CHECK_ME();
TableSize nVisibleRows = impl_getVisibleRows(true);
TableSize nVisibleCols = impl_getVisibleColumns(true);
@@ -2211,8 +1988,6 @@ namespace svt { namespace table
TableSize TableControl_Impl::impl_getVisibleRows( bool _bAcceptPartialRow ) const
{
- DBG_CHECK_ME();
-
DBG_ASSERT( m_pDataWindow, "TableControl_Impl::impl_getVisibleRows: no data window!" );
return lcl_getRowsFittingInto(
@@ -2225,8 +2000,6 @@ namespace svt { namespace table
TableSize TableControl_Impl::impl_getVisibleColumns( bool _bAcceptPartialCol ) const
{
- DBG_CHECK_ME();
-
DBG_ASSERT( m_pDataWindow, "TableControl_Impl::impl_getVisibleColumns: no data window!" );
return lcl_getColumnsVisibleWithin(
@@ -2240,8 +2013,6 @@ namespace svt { namespace table
bool TableControl_Impl::goTo( ColPos _nColumn, RowPos _nRow )
{
- DBG_CHECK_ME();
-
// TODO: give veto listeners a chance
if ( ( _nColumn < 0 ) || ( _nColumn >= m_nColumnCount )
@@ -2264,7 +2035,6 @@ namespace svt { namespace table
void TableControl_Impl::ensureVisible( ColPos _nColumn, RowPos _nRow, bool _bAcceptPartialVisibility )
{
- DBG_CHECK_ME();
DBG_ASSERT( ( _nColumn >= 0 ) && ( _nColumn < m_nColumnCount )
&& ( _nRow >= 0 ) && ( _nRow < m_nRowCount ),
"TableControl_Impl::ensureVisible: invalid coordinates!" );
@@ -2322,7 +2092,6 @@ namespace svt { namespace table
// if updates are enabled currently, scroll the viewport
if ( m_nTopRow != nOldTopRow )
{
- DBG_SUSPEND_INV( INV_SCROLL_POSITION );
SuppressCursor aHideCursor( *this );
// TODO: call a onStartScroll at our listener (or better an own onStartScroll,
// which hides the cursor and then calls the listener)
@@ -2368,7 +2137,6 @@ namespace svt { namespace table
TableSize TableControl_Impl::impl_scrollRows( TableSize const i_rowDelta )
{
- DBG_CHECK_ME();
return impl_ni_ScrollRows( i_rowDelta );
}
@@ -2388,7 +2156,6 @@ namespace svt { namespace table
// if updates are enabled currently, scroll the viewport
if ( m_nLeftColumn != nOldLeftColumn )
{
- DBG_SUSPEND_INV( INV_SCROLL_POSITION );
SuppressCursor aHideCursor( *this );
// TODO: call a onStartScroll at our listener (or better an own onStartScroll,
// which hides the cursor and then calls the listener)
@@ -2442,7 +2209,6 @@ namespace svt { namespace table
TableSize TableControl_Impl::impl_scrollColumns( TableSize const i_columnDelta )
{
- DBG_CHECK_ME();
return impl_ni_ScrollColumns( i_columnDelta );
}
@@ -2452,11 +2218,6 @@ namespace svt { namespace table
return m_pSelEngine;
}
-
-
-
-
-
bool TableControl_Impl::isRowSelected( RowPos i_row ) const
{
return ::std::find( m_aSelectedRows.begin(), m_aSelectedRows.end(), i_row ) != m_aSelectedRows.end();
@@ -2484,8 +2245,6 @@ namespace svt { namespace table
ColPos TableControl_Impl::impl_getColumnForOrdinate( long const i_ordinate ) const
{
- DBG_CHECK_ME();
-
if ( ( m_aColumnWidths.empty() ) || ( i_ordinate < 0 ) )
return COL_INVALID;
@@ -2512,8 +2271,6 @@ namespace svt { namespace table
RowPos TableControl_Impl::impl_getRowForAbscissa( long const i_abscissa ) const
{
- DBG_CHECK_ME();
-
if ( i_abscissa < 0 )
return ROW_INVALID;
@@ -2528,8 +2285,6 @@ namespace svt { namespace table
bool TableControl_Impl::markRowAsDeselected( RowPos const i_rowIndex )
{
- DBG_CHECK_ME();
-
::std::vector< RowPos >::iterator selPos = ::std::find( m_aSelectedRows.begin(), m_aSelectedRows.end(), i_rowIndex );
if ( selPos == m_aSelectedRows.end() )
return false;
@@ -2541,8 +2296,6 @@ namespace svt { namespace table
bool TableControl_Impl::markRowAsSelected( RowPos const i_rowIndex )
{
- DBG_CHECK_ME();
-
if ( isRowSelected( i_rowIndex ) )
return false;
@@ -2583,8 +2336,6 @@ namespace svt { namespace table
bool TableControl_Impl::markAllRowsAsSelected()
{
- DBG_CHECK_ME();
-
SelectionMode const eSelMode = getSelEngine()->GetSelectionMode();
ENSURE_OR_RETURN_FALSE( eSelMode == MULTIPLE_SELECTION, "TableControl_Impl::markAllRowsAsSelected: unsupported selection mode!" );
@@ -2616,7 +2367,6 @@ namespace svt { namespace table
void TableControl_Impl::commitCellEvent( sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue )
{
- DBG_CHECK_ME();
if ( impl_isAccessibleAlive() )
m_pAccessibleTable->commitCellEvent( i_eventID, i_newValue, i_oldValue );
}
@@ -2624,7 +2374,6 @@ namespace svt { namespace table
void TableControl_Impl::commitTableEvent( sal_Int16 const i_eventID, const Any& i_newValue, const Any& i_oldValue )
{
- DBG_CHECK_ME();
if ( impl_isAccessibleAlive() )
m_pAccessibleTable->commitTableEvent( i_eventID, i_newValue, i_oldValue );
}
@@ -2669,7 +2418,6 @@ namespace svt { namespace table
IMPL_LINK( TableControl_Impl, OnUpdateScrollbars, void*, /**/ )
{
- DBG_CHECK_ME();
// TODO: can't we simply use lcl_updateScrollbar here, so the scrollbars ranges are updated, instead of
// doing a complete re-layout?
impl_ni_relayout();
@@ -2722,14 +2470,12 @@ namespace svt { namespace table
bool TableControl_Impl::impl_isAccessibleAlive() const
{
- DBG_CHECK_ME();
return ( NULL != m_pAccessibleTable ) && m_pAccessibleTable->isAlive();
}
void TableControl_Impl::impl_commitAccessibleEvent( sal_Int16 const i_eventID, Any const & i_newValue, Any const & i_oldValue )
{
- DBG_CHECK_ME();
if ( impl_isAccessibleAlive() )
m_pAccessibleTable->commitEvent( i_eventID, i_newValue, i_oldValue );
}
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index 7a6191f..dc624c4 100644
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -144,16 +144,6 @@ namespace svt { namespace table
AccessibleFactoryAccess m_aFactoryAccess;
IAccessibleTableControl* m_pAccessibleTable;
-#ifdef DBG_UTIL
- #define INV_SCROLL_POSITION 1
- /** represents a bitmask of invariants to check
-
- Actually, impl_checkInvariants checks more invariants than denoted in this
- bit mask, but only those present here can be disabled temporarily.
- */
- sal_Int32 m_nRequiredInvariants;
-#endif
-
public:
void setModel( PTableModel _pModel );
@@ -175,9 +165,6 @@ namespace svt { namespace table
TableControl_Impl( TableControl& _rAntiImpl );
virtual ~TableControl_Impl();
-#ifdef DBG_UTIL
- const sal_Char* impl_checkInvariants() const;
-#endif
/** to be called when the anti-impl instance has been resized
*/
void onResize();
diff --git a/unusedcode.easy b/unusedcode.easy
index 4e5facb..b525d1f 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -64,6 +64,7 @@ VCLXGraphics::getLineColor()
VCLXGraphics::getRasterOp()
VCLXGraphics::getTextColor()
VCLXGraphics::getTextFillColor()
+XclXmlUtils::ToOString(XclRange const&)
XmlTestTools::parseXml(utl::TempFile&)
apitest::CellProperties::testRotateReference()
apitest::CellProperties::testVertJustify()
@@ -205,7 +206,6 @@ sc::CellValues::transferTo(ScColumn&, int)
sd::LeftDrawPaneShell::RegisterInterface(SfxModule*)
sd::LeftImpressPaneShell::RegisterInterface(SfxModule*)
sd::framework::FrameworkHelper::Instance(com::sun::star::uno::Reference<com::sun::star::frame::XController> const&)
-sd::slidesorter::view::PageObjectPainter::InvalidateBitmaps()
sfx2::SvBaseLink::SvBaseLink(rtl::OUString const&, unsigned short, sfx2::SvLinkSource*)
std::_Rb_tree<rtl::OUString, std::pair<rtl::OUString const, (anonymous namespace)::TemplateId>, std::_Select1st<std::pair<rtl::OUString const, (anonymous namespace)::TemplateId> >, std::less<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, (anonymous namespace)::TemplateId> > >::_Rb_tree(std::_Rb_tree<rtl::OUString, std::pair<rtl::OUString const, (anonymous namespace)::TemplateId>, std::_Select1st<std::pair<rtl::OUString const, (anonymous namespace)::TemplateId> >, std::less<rtl::OUString>, std::allocator<std::pair<rtl::OUString const, (anonymous namespace)::TemplateId> > >&&)
std::__cxx1998::vector<rtl::Reference<oox::xls::(anonymous namespace)::WorkerThread>, std::allocator<rtl::Reference<oox::xls::(anonymous namespace)::WorkerThread> > >::reserve(unsigned long)
@@ -215,7 +215,6 @@ svgio::svgreader::SvgDocument::removeSvgStyleAttributesFromMapper(rtl::OUString
svl::GridPrinter::clear()
svl::GridPrinter::resize(unsigned long, unsigned long)
svt::CheckInvariants(void const*)
-svt::table::TableControl_Impl::impl_checkInvariants() const
svt::table::UnoControlTableModel::checkInvariants() const
vcl::MapChar(vcl::_TrueTypeFont*, unsigned short, bool)
writerfilter::dmapper::StyleSheetTable::GetStyleIdFromIndex(unsigned int)
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 0168219..864ec63 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -2171,10 +2171,4 @@ void ToolBox::ImplUpdateImageList()
}
}
-void ToolBox::SetImageListProvider(vcl::IImageListProvider* _pProvider)
-{
- mpData->mpImageListProvider = _pProvider;
- ImplUpdateImageList();
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 3e0f9a148bf2c0a5916e850528a9b0472830bb9e
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list