summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2010-01-29 15:36:08 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2010-01-29 15:36:08 +0000
commite1842855acab54883d4b17cb520ef4f622d05bb4 (patch)
treeb1e2f392cd342756401016278b681c34c6aad800 /sc/source
parentf851cc84497986e5af50a102e504270d5f2fbd70 (diff)
parenta02a44429145de0a67f3b75656f10b146490feec (diff)
ab71: merge with DEV300_m63
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/attarray.cxx18
-rw-r--r--sc/source/core/data/attrib.cxx160
-rw-r--r--sc/source/core/data/autonamecache.cxx2
-rw-r--r--sc/source/core/data/bcaslot.cxx61
-rw-r--r--sc/source/core/data/cell.cxx76
-rw-r--r--sc/source/core/data/cell2.cxx18
-rw-r--r--sc/source/core/data/clipparam.cxx203
-rw-r--r--sc/source/core/data/column.cxx13
-rw-r--r--sc/source/core/data/column2.cxx48
-rw-r--r--sc/source/core/data/conditio.cxx17
-rw-r--r--sc/source/core/data/dociter.cxx4
-rw-r--r--sc/source/core/data/docpool.cxx4
-rw-r--r--sc/source/core/data/documen2.cxx110
-rw-r--r--sc/source/core/data/documen3.cxx70
-rw-r--r--sc/source/core/data/documen7.cxx7
-rw-r--r--sc/source/core/data/documen8.cxx58
-rw-r--r--sc/source/core/data/documen9.cxx4
-rw-r--r--sc/source/core/data/document.cxx727
-rw-r--r--sc/source/core/data/dpcachetable.cxx25
-rw-r--r--sc/source/core/data/dpgroup.cxx2
-rw-r--r--sc/source/core/data/dpobject.cxx71
-rw-r--r--sc/source/core/data/dpoutput.cxx8
-rw-r--r--sc/source/core/data/dpsave.cxx25
-rw-r--r--sc/source/core/data/dpsdbtab.cxx9
-rw-r--r--sc/source/core/data/dpshttab.cxx6
-rw-r--r--sc/source/core/data/dptabdat.cxx4
-rw-r--r--sc/source/core/data/dptabsrc.cxx38
-rw-r--r--sc/source/core/data/global.cxx80
-rw-r--r--sc/source/core/data/global2.cxx42
-rw-r--r--sc/source/core/data/makefile.mk2
-rw-r--r--sc/source/core/data/markarr.cxx8
-rw-r--r--sc/source/core/data/patattr.cxx15
-rw-r--r--sc/source/core/data/pivot.cxx1991
-rw-r--r--sc/source/core/data/pivot2.cxx427
-rw-r--r--sc/source/core/data/poolhelp.cxx72
-rw-r--r--sc/source/core/data/postit.cxx36
-rw-r--r--sc/source/core/data/stlpool.cxx19
-rw-r--r--sc/source/core/data/stlsheet.cxx15
-rw-r--r--sc/source/core/data/table1.cxx31
-rw-r--r--sc/source/core/data/table2.cxx63
-rw-r--r--sc/source/core/data/table3.cxx14
-rw-r--r--sc/source/core/data/table5.cxx3
-rw-r--r--sc/source/core/data/table6.cxx2
-rw-r--r--sc/source/core/data/validat.cxx7
-rw-r--r--sc/source/core/inc/bcaslot.hxx1
-rw-r--r--sc/source/core/inc/interpre.hxx16
-rw-r--r--sc/source/core/inc/parclass.hxx11
-rw-r--r--sc/source/core/inc/poolhelp.hxx19
-rw-r--r--sc/source/core/inc/refupdat.hxx7
-rw-r--r--sc/source/core/tool/address.cxx121
-rw-r--r--sc/source/core/tool/autoform.cxx6
-rw-r--r--sc/source/core/tool/callform.cxx4
-rw-r--r--sc/source/core/tool/chartpos.cxx62
-rw-r--r--sc/source/core/tool/chgtrack.cxx514
-rw-r--r--sc/source/core/tool/collect.cxx51
-rw-r--r--sc/source/core/tool/compiler.cxx242
-rw-r--r--sc/source/core/tool/dbcolect.cxx2
-rw-r--r--sc/source/core/tool/detfunc.cxx16
-rw-r--r--sc/source/core/tool/indexmap.cxx80
-rw-r--r--sc/source/core/tool/interpr1.cxx588
-rw-r--r--sc/source/core/tool/interpr2.cxx281
-rw-r--r--sc/source/core/tool/interpr3.cxx315
-rw-r--r--sc/source/core/tool/interpr4.cxx399
-rw-r--r--sc/source/core/tool/interpr5.cxx84
-rw-r--r--sc/source/core/tool/interpr6.cxx12
-rw-r--r--sc/source/core/tool/makefile.mk1
-rw-r--r--sc/source/core/tool/parclass.cxx263
-rw-r--r--sc/source/core/tool/rangelst.cxx4
-rw-r--r--sc/source/core/tool/rangenam.cxx161
-rw-r--r--sc/source/core/tool/rangeutl.cxx4
-rw-r--r--sc/source/core/tool/rechead.cxx56
-rw-r--r--sc/source/core/tool/reftokenhelper.cxx2
-rw-r--r--sc/source/core/tool/refupdat.cxx43
-rw-r--r--sc/source/core/tool/scmatrix.cxx84
-rw-r--r--sc/source/core/tool/subtotal.cxx182
-rw-r--r--sc/source/core/tool/token.cxx2
-rw-r--r--sc/source/core/tool/userlist.cxx4
-rw-r--r--sc/source/filter/excel/biffdump.cxx9864
-rw-r--r--sc/source/filter/excel/excdoc.cxx59
-rw-r--r--sc/source/filter/excel/excel.cxx36
-rw-r--r--sc/source/filter/excel/excimp8.cxx6
-rw-r--r--sc/source/filter/excel/excrecds.cxx38
-rw-r--r--sc/source/filter/excel/exctools.cxx2
-rw-r--r--sc/source/filter/excel/impop.cxx28
-rw-r--r--sc/source/filter/excel/makefile.mk3
-rw-r--r--sc/source/filter/excel/namebuff.cxx3
-rw-r--r--sc/source/filter/excel/read.cxx54
-rw-r--r--sc/source/filter/excel/tokstack.cxx50
-rw-r--r--sc/source/filter/excel/xeformula.cxx2033
-rw-r--r--sc/source/filter/excel/xelink.cxx12
-rw-r--r--sc/source/filter/excel/xename.cxx8
-rw-r--r--sc/source/filter/excel/xepivot.cxx19
-rw-r--r--sc/source/filter/excel/xestream.cxx7
-rw-r--r--sc/source/filter/excel/xetable.cxx60
-rw-r--r--sc/source/filter/excel/xichart.cxx4
-rw-r--r--sc/source/filter/excel/xicontent.cxx53
-rw-r--r--sc/source/filter/excel/xiescher.cxx8
-rw-r--r--sc/source/filter/excel/xihelper.cxx38
-rw-r--r--sc/source/filter/excel/xilink.cxx104
-rw-r--r--sc/source/filter/excel/xiroot.cxx12
-rw-r--r--sc/source/filter/excel/xistream.cxx170
-rw-r--r--sc/source/filter/excel/xistyle.cxx323
-rw-r--r--sc/source/filter/excel/xlchart.cxx49
-rw-r--r--sc/source/filter/excel/xlformula.cxx566
-rw-r--r--sc/source/filter/excel/xlroot.cxx14
-rw-r--r--sc/source/filter/excel/xlstream.cxx52
-rw-r--r--sc/source/filter/excel/xlstyle.cxx10
-rw-r--r--sc/source/filter/excel/xltools.cxx84
-rw-r--r--sc/source/filter/ftools/fapihelper.cxx53
-rw-r--r--sc/source/filter/ftools/ftools.cxx6
-rw-r--r--sc/source/filter/inc/excrecds.hxx13
-rw-r--r--sc/source/filter/inc/fapihelper.hxx6
-rw-r--r--sc/source/filter/inc/fdumper.hxx1520
-rw-r--r--sc/source/filter/inc/fdumperole.hxx186
-rw-r--r--sc/source/filter/inc/ftools.hxx4
-rw-r--r--sc/source/filter/inc/imp_op.hxx4
-rw-r--r--sc/source/filter/inc/op.h2
-rw-r--r--sc/source/filter/inc/qpro.hxx1
-rw-r--r--sc/source/filter/inc/root.hxx1
-rw-r--r--sc/source/filter/inc/tokstack.hxx2
-rw-r--r--sc/source/filter/inc/xcl97rec.hxx85
-rw-r--r--sc/source/filter/inc/xelink.hxx4
-rw-r--r--sc/source/filter/inc/xename.hxx4
-rw-r--r--sc/source/filter/inc/xepivot.hxx8
-rw-r--r--sc/source/filter/inc/xestream.hxx4
-rw-r--r--sc/source/filter/inc/xetable.hxx34
-rw-r--r--sc/source/filter/inc/xiescher.hxx4
-rw-r--r--sc/source/filter/inc/xihelper.hxx40
-rw-r--r--sc/source/filter/inc/xiroot.hxx6
-rw-r--r--sc/source/filter/inc/xistream.hxx66
-rw-r--r--sc/source/filter/inc/xistyle.hxx71
-rw-r--r--sc/source/filter/inc/xlconst.hxx27
-rw-r--r--sc/source/filter/inc/xlcontent.hxx4
-rw-r--r--sc/source/filter/inc/xldumper.hxx683
-rw-r--r--sc/source/filter/inc/xlformula.hxx173
-rw-r--r--sc/source/filter/inc/xlroot.hxx11
-rw-r--r--sc/source/filter/inc/xlstream.hxx13
-rw-r--r--sc/source/filter/inc/xlstyle.hxx12
-rw-r--r--sc/source/filter/inc/xltools.hxx15
-rw-r--r--sc/source/filter/lotus/op.cxx28
-rw-r--r--sc/source/filter/qpro/qpro.cxx6
-rw-r--r--sc/source/filter/xcl97/xcl97rec.cxx134
-rw-r--r--sc/source/filter/xml/XMLDDELinksContext.cxx15
-rw-r--r--sc/source/filter/xml/XMLExportIterator.cxx70
-rw-r--r--sc/source/filter/xml/XMLExportIterator.hxx8
-rw-r--r--sc/source/filter/xml/XMLStylesExportHelper.cxx4
-rw-r--r--sc/source/filter/xml/XMLTableShapeImportHelper.cxx39
-rw-r--r--sc/source/filter/xml/XMLTableShapeImportHelper.hxx2
-rw-r--r--sc/source/filter/xml/XMLTableShapeResizer.cxx6
-rw-r--r--sc/source/filter/xml/makefile.mk51
-rw-r--r--sc/source/filter/xml/sheetdata.cxx275
-rw-r--r--sc/source/filter/xml/xmlannoi.cxx10
-rw-r--r--sc/source/filter/xml/xmlannoi.hxx23
-rw-r--r--sc/source/filter/xml/xmlbodyi.cxx38
-rw-r--r--sc/source/filter/xml/xmlbodyi.hxx1
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx18
-rw-r--r--sc/source/filter/xml/xmlcoli.cxx12
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx844
-rw-r--r--sc/source/filter/xml/xmlexprt.hxx25
-rw-r--r--sc/source/filter/xml/xmlexternaltabi.cxx28
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx50
-rw-r--r--sc/source/filter/xml/xmlimprt.hxx2
-rw-r--r--sc/source/filter/xml/xmlrowi.cxx11
-rw-r--r--sc/source/filter/xml/xmlstyli.cxx72
-rw-r--r--sc/source/filter/xml/xmlstyli.hxx30
-rw-r--r--sc/source/filter/xml/xmlsubti.cxx10
-rw-r--r--sc/source/filter/xml/xmltabi.cxx17
-rw-r--r--sc/source/filter/xml/xmltabi.hxx1
-rw-r--r--sc/source/filter/xml/xmlwrap.cxx87
-rw-r--r--sc/source/ui/Accessibility/AccessibleCell.cxx2
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx74
-rw-r--r--sc/source/ui/Accessibility/AccessibleText.cxx140
-rw-r--r--sc/source/ui/app/scmod2.cxx9
-rw-r--r--sc/source/ui/dbgui/csvtablebox.cxx56
-rw-r--r--sc/source/ui/dbgui/fieldwnd.cxx60
-rw-r--r--sc/source/ui/dbgui/scuiasciiopt.cxx2
-rw-r--r--sc/source/ui/docshell/arealink.cxx14
-rw-r--r--sc/source/ui/docshell/dbdocimp.cxx17
-rw-r--r--sc/source/ui/docshell/docfunc.cxx101
-rw-r--r--sc/source/ui/docshell/docsh.cxx85
-rw-r--r--sc/source/ui/docshell/docsh3.cxx4
-rw-r--r--sc/source/ui/docshell/docsh4.cxx7
-rw-r--r--sc/source/ui/docshell/docsh5.cxx9
-rw-r--r--sc/source/ui/docshell/docsh8.cxx199
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx128
-rw-r--r--sc/source/ui/docshell/impex.cxx4
-rw-r--r--sc/source/ui/docshell/tablink.cxx2
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx6
-rw-r--r--sc/source/ui/drawfunc/drtxtob2.cxx2
-rw-r--r--sc/source/ui/drawfunc/futext3.cxx8
-rw-r--r--sc/source/ui/formdlg/privsplt.cxx18
-rw-r--r--sc/source/ui/inc/AccessibleDocumentPagePreview.hxx6
-rw-r--r--sc/source/ui/inc/AccessibleText.hxx4
-rw-r--r--sc/source/ui/inc/anyrefdg.hxx1
-rw-r--r--sc/source/ui/inc/cellsh.hxx3
-rw-r--r--sc/source/ui/inc/csvtablebox.hxx10
-rw-r--r--sc/source/ui/inc/docfunc.hxx2
-rw-r--r--sc/source/ui/inc/docsh.hxx13
-rw-r--r--sc/source/ui/inc/drawview.hxx2
-rw-r--r--sc/source/ui/inc/fieldwnd.hxx9
-rw-r--r--sc/source/ui/inc/gridwin.hxx57
-rw-r--r--sc/source/ui/inc/output.hxx2
-rw-r--r--sc/source/ui/inc/privsplt.hxx1
-rw-r--r--sc/source/ui/inc/refundo.hxx6
-rw-r--r--sc/source/ui/inc/tabview.hxx8
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx2
-rw-r--r--sc/source/ui/inc/undotab.hxx40
-rw-r--r--sc/source/ui/inc/viewfunc.hxx5
-rw-r--r--sc/source/ui/inc/viewutil.hxx2
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx2
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx5
-rw-r--r--sc/source/ui/miscdlgs/solveroptions.cxx2
-rw-r--r--sc/source/ui/navipi/content.cxx6
-rw-r--r--sc/source/ui/navipi/navipi.src2
-rw-r--r--sc/source/ui/pagedlg/pagedlg.src2
-rw-r--r--sc/source/ui/src/globstr.src14
-rw-r--r--sc/source/ui/src/hdrcont.src8
-rw-r--r--sc/source/ui/src/optdlg.src2
-rw-r--r--sc/source/ui/src/popup.src12
-rw-r--r--sc/source/ui/src/scfuncs.src42
-rw-r--r--sc/source/ui/undo/refundo.cxx21
-rw-r--r--sc/source/ui/undo/undoblk.cxx12
-rw-r--r--sc/source/ui/undo/undoblk3.cxx20
-rw-r--r--sc/source/ui/undo/undodat.cxx18
-rw-r--r--sc/source/ui/undo/undotab.cxx107
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx2
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx69
-rw-r--r--sc/source/ui/unoobj/chartuno.cxx11
-rw-r--r--sc/source/ui/unoobj/docuno.cxx93
-rw-r--r--sc/source/ui/unoobj/funcuno.cxx6
-rw-r--r--sc/source/ui/unoobj/scdetect.cxx2
-rw-r--r--sc/source/ui/unoobj/servuno.cxx133
-rw-r--r--sc/source/ui/unoobj/textuno.cxx41
-rw-r--r--sc/source/ui/vba/makefile.mk7
-rw-r--r--sc/source/ui/view/cellsh.cxx19
-rw-r--r--sc/source/ui/view/cellsh1.cxx123
-rw-r--r--sc/source/ui/view/cellsh2.cxx16
-rw-r--r--sc/source/ui/view/drawview.cxx50
-rw-r--r--sc/source/ui/view/editsh.cxx6
-rw-r--r--sc/source/ui/view/formatsh.cxx5
-rw-r--r--sc/source/ui/view/gridwin.cxx389
-rw-r--r--sc/source/ui/view/gridwin2.cxx444
-rw-r--r--sc/source/ui/view/gridwin4.cxx2
-rw-r--r--sc/source/ui/view/makefile.mk4
-rw-r--r--sc/source/ui/view/output.cxx14
-rw-r--r--sc/source/ui/view/output2.cxx27
-rw-r--r--sc/source/ui/view/tabcont.cxx4
-rw-r--r--sc/source/ui/view/tabview.cxx35
-rw-r--r--sc/source/ui/view/tabview3.cxx12
-rw-r--r--sc/source/ui/view/tabview5.cxx10
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx4
-rw-r--r--sc/source/ui/view/tabvwsha.cxx64
-rw-r--r--sc/source/ui/view/tabvwshb.cxx5
-rw-r--r--sc/source/ui/view/viewfun3.cxx382
-rw-r--r--sc/source/ui/view/viewfun4.cxx2
-rw-r--r--sc/source/ui/view/viewfun5.cxx9
-rw-r--r--sc/source/ui/view/viewutil.cxx34
257 files changed, 8732 insertions, 21687 deletions
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 00992cbf962a..1a466d231459 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -103,10 +103,10 @@ ScAttrArray::~ScAttrArray()
}
//------------------------------------------------------------------------
-
+#ifdef DBG_UTIL
void ScAttrArray::TestData() const
{
-#ifdef DBG_UTIL
+
USHORT nErr = 0;
if (pData)
{
@@ -129,8 +129,8 @@ void ScAttrArray::TestData() const
aMsg += ByteString::CreateFromInt32(nCol);
DBG_ERROR( aMsg.GetBuffer() );
}
-#endif
}
+#endif
//------------------------------------------------------------------------
@@ -170,6 +170,9 @@ void ScAttrArray::Reset( const ScPatternAttr* pPattern, BOOL bAlloc )
}
delete[] pData;
+ if (pDocument->IsStreamValid(nTab))
+ pDocument->SetStreamValid(nTab, FALSE);
+
if (bAlloc)
{
nCount = nLimit = 1;
@@ -472,6 +475,9 @@ void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPattern
pData[nInsert].pPattern = pPattern;
nCount++;
}
+
+ if (pDocument->IsStreamValid(nTab))
+ pDocument->SetStreamValid(nTab, FALSE);
}
}
// InfoBox(0, String(nCount) + String(" Eintraege") ).Execute();
@@ -550,6 +556,9 @@ void ScAttrArray::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet*
delete pNewPattern;
}
while ((nStart <= nEndRow) && (nPos < nCount));
+
+ if (pDocument->IsStreamValid(nTab))
+ pDocument->SetStreamValid(nTab, FALSE);
}
#ifdef DBG_UTIL
@@ -789,6 +798,9 @@ void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCac
}
}
while (nStart <= nEndRow);
+
+ if (pDocument->IsStreamValid(nTab))
+ pDocument->SetStreamValid(nTab, FALSE);
}
#ifdef DBG_UTIL
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index a5f38c813d8c..dcc6418445fa 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -636,32 +636,32 @@ SfxItemPresentation ScTableListItem::GetPresentation
// -----------------------------------------------------------------------
-BOOL ScTableListItem::GetTableList( List& aList ) const
-{
- for ( USHORT i=0; i<nCount; i++ )
- aList.Insert( new SCTAB( pTabArr[i] ) );
-
- return ( nCount > 0 );
-}
+//UNUSED2009-05 BOOL ScTableListItem::GetTableList( List& aList ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 for ( USHORT i=0; i<nCount; i++ )
+//UNUSED2009-05 aList.Insert( new SCTAB( pTabArr[i] ) );
+//UNUSED2009-05
+//UNUSED2009-05 return ( nCount > 0 );
+//UNUSED2009-05 }
// -----------------------------------------------------------------------
-void ScTableListItem::SetTableList( const List& rList )
-{
- nCount = (USHORT)rList.Count();
-
- delete [] pTabArr;
-
- if ( nCount > 0 )
- {
- pTabArr = new SCTAB [nCount];
-
- for ( USHORT i=0; i<nCount; i++ )
- pTabArr[i] = *( (SCTAB*)rList.GetObject( i ) );
- }
- else
- pTabArr = NULL;
-}
+//UNUSED2009-05 void ScTableListItem::SetTableList( const List& rList )
+//UNUSED2009-05 {
+//UNUSED2009-05 nCount = (USHORT)rList.Count();
+//UNUSED2009-05
+//UNUSED2009-05 delete [] pTabArr;
+//UNUSED2009-05
+//UNUSED2009-05 if ( nCount > 0 )
+//UNUSED2009-05 {
+//UNUSED2009-05 pTabArr = new SCTAB [nCount];
+//UNUSED2009-05
+//UNUSED2009-05 for ( USHORT i=0; i<nCount; i++ )
+//UNUSED2009-05 pTabArr[i] = *( (SCTAB*)rList.GetObject( i ) );
+//UNUSED2009-05 }
+//UNUSED2009-05 else
+//UNUSED2009-05 pTabArr = NULL;
+//UNUSED2009-05 }
// -----------------------------------------------------------------------
@@ -934,63 +934,63 @@ SfxPoolItem* ScPageHFItem::Create( SvStream& rStream, USHORT nVer ) const
//------------------------------------------------------------------------
-class ScFieldChangerEditEngine : public ScEditEngineDefaulter
-{
- TypeId aExtFileId;
- USHORT nConvPara;
- xub_StrLen nConvPos;
- BOOL bConvert;
-
-public:
- ScFieldChangerEditEngine( SfxItemPool* pEnginePool, BOOL bDeleteEnginePool );
- virtual ~ScFieldChangerEditEngine() {}
-
- virtual String CalcFieldValue( const SvxFieldItem& rField, USHORT nPara,
- USHORT nPos, Color*& rTxtColor,
- Color*& rFldColor );
-
-//UNUSED2008-05 BOOL ConvertFields();
-};
-
-ScFieldChangerEditEngine::ScFieldChangerEditEngine( SfxItemPool* pEnginePoolP,
- BOOL bDeleteEnginePoolP ) :
- ScEditEngineDefaulter( pEnginePoolP, bDeleteEnginePoolP ),
- aExtFileId( TYPE( SvxExtFileField ) ),
- nConvPara( 0 ),
- nConvPos( 0 ),
- bConvert( FALSE )
-{
-}
-
-String ScFieldChangerEditEngine::CalcFieldValue( const SvxFieldItem& rField,
- USHORT nPara, USHORT nPos, Color*& /* rTxtColor */, Color*& /* rFldColor */ )
-{
- const SvxFieldData* pFieldData = rField.GetField();
- if ( pFieldData && pFieldData->Type() == aExtFileId )
- {
- bConvert = TRUE;
- nConvPara = nPara;
- nConvPos = nPos;
- }
- return EMPTY_STRING;
-}
-
-//UNUSED2008-05 BOOL ScFieldChangerEditEngine::ConvertFields()
-//UNUSED2008-05 {
-//UNUSED2008-05 BOOL bConverted = FALSE;
-//UNUSED2008-05 do
-//UNUSED2008-05 {
-//UNUSED2008-05 bConvert = FALSE;
-//UNUSED2008-05 UpdateFields();
-//UNUSED2008-05 if ( bConvert )
-//UNUSED2008-05 {
-//UNUSED2008-05 ESelection aSel( nConvPara, nConvPos, nConvPara, nConvPos+1 );
-//UNUSED2008-05 QuickInsertField( SvxFieldItem( SvxFileField(), EE_FEATURE_FIELD), aSel );
-//UNUSED2008-05 bConverted = TRUE;
-//UNUSED2008-05 }
-//UNUSED2008-05 } while ( bConvert );
-//UNUSED2008-05 return bConverted;
-//UNUSED2008-05 }
+//UNUSED2009-05 class ScFieldChangerEditEngine : public ScEditEngineDefaulter
+//UNUSED2009-05 {
+//UNUSED2009-05 TypeId aExtFileId;
+//UNUSED2009-05 USHORT nConvPara;
+//UNUSED2009-05 xub_StrLen nConvPos;
+//UNUSED2009-05 BOOL bConvert;
+//UNUSED2009-05
+//UNUSED2009-05 public:
+//UNUSED2009-05 ScFieldChangerEditEngine( SfxItemPool* pEnginePool, BOOL bDeleteEnginePool );
+//UNUSED2009-05 virtual ~ScFieldChangerEditEngine() {}
+//UNUSED2009-05
+//UNUSED2009-05 virtual String CalcFieldValue( const SvxFieldItem& rField, USHORT nPara,
+//UNUSED2009-05 USHORT nPos, Color*& rTxtColor,
+//UNUSED2009-05 Color*& rFldColor );
+//UNUSED2009-05
+//UNUSED2009-05 BOOL ConvertFields();
+//UNUSED2009-05 };
+//UNUSED2009-05
+//UNUSED2009-05 ScFieldChangerEditEngine::ScFieldChangerEditEngine( SfxItemPool* pEnginePoolP,
+//UNUSED2009-05 BOOL bDeleteEnginePoolP ) :
+//UNUSED2009-05 ScEditEngineDefaulter( pEnginePoolP, bDeleteEnginePoolP ),
+//UNUSED2009-05 aExtFileId( TYPE( SvxExtFileField ) ),
+//UNUSED2009-05 nConvPara( 0 ),
+//UNUSED2009-05 nConvPos( 0 ),
+//UNUSED2009-05 bConvert( FALSE )
+//UNUSED2009-05 {
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 String ScFieldChangerEditEngine::CalcFieldValue( const SvxFieldItem& rField,
+//UNUSED2009-05 USHORT nPara, USHORT nPos, Color*& /* rTxtColor */, Color*& /* rFldColor */ )
+//UNUSED2009-05 {
+//UNUSED2009-05 const SvxFieldData* pFieldData = rField.GetField();
+//UNUSED2009-05 if ( pFieldData && pFieldData->Type() == aExtFileId )
+//UNUSED2009-05 {
+//UNUSED2009-05 bConvert = TRUE;
+//UNUSED2009-05 nConvPara = nPara;
+//UNUSED2009-05 nConvPos = nPos;
+//UNUSED2009-05 }
+//UNUSED2009-05 return EMPTY_STRING;
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 BOOL ScFieldChangerEditEngine::ConvertFields()
+//UNUSED2009-05 {
+//UNUSED2009-05 BOOL bConverted = FALSE;
+//UNUSED2009-05 do
+//UNUSED2009-05 {
+//UNUSED2009-05 bConvert = FALSE;
+//UNUSED2009-05 UpdateFields();
+//UNUSED2009-05 if ( bConvert )
+//UNUSED2009-05 {
+//UNUSED2009-05 ESelection aSel( nConvPara, nConvPos, nConvPara, nConvPos+1 );
+//UNUSED2009-05 QuickInsertField( SvxFieldItem( SvxFileField(), EE_FEATURE_FIELD), aSel );
+//UNUSED2009-05 bConverted = TRUE;
+//UNUSED2009-05 }
+//UNUSED2009-05 } while ( bConvert );
+//UNUSED2009-05 return bConverted;
+//UNUSED2009-05 }
void ScPageHFItem::SetLeftArea( const EditTextObject& rNew )
{
diff --git a/sc/source/core/data/autonamecache.cxx b/sc/source/core/data/autonamecache.cxx
index d106e5824571..2daa10fa29d4 100644
--- a/sc/source/core/data/autonamecache.cxx
+++ b/sc/source/core/data/autonamecache.cxx
@@ -99,7 +99,7 @@ const ScAutoNameAddresses& ScAutoNameCache::GetNameOccurences( const String& rNa
; // nothing, prevent compiler warning
break;
}
- if ( ScGlobal::pTransliteration->isEqual( aStr, rName ) )
+ if ( ScGlobal::GetpTransliteration()->isEqual( aStr, rName ) )
{
rAddresses.push_back( ScAddress( aIter.GetCol(), aIter.GetRow(), aIter.GetTab() ) );
}
diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index ff82d1fd362f..d3d86be58440 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -294,13 +294,13 @@ void ScBroadcastAreaSlot::DelBroadcastAreasInRange( const ScRange& rRange )
if (rRange.In( rAreaRange))
{
ScBroadcastArea* pArea = *aIter;
+ aBroadcastAreaTbl.erase( aIter++); // erase before modifying
if (!pArea->DecRef())
{
if (pBASM->IsInBulkBroadcast())
pBASM->RemoveBulkArea( pArea);
delete pArea;
}
- aBroadcastAreaTbl.erase( aIter++);
}
else
++aIter;
@@ -353,6 +353,21 @@ void ScBroadcastAreaSlot::UpdateRemove( UpdateRefMode eUpdateRefMode,
}
+void ScBroadcastAreaSlot::UpdateRemoveArea( ScBroadcastArea* pArea )
+{
+ ScBroadcastAreas::iterator aIter( aBroadcastAreaTbl.find( pArea));
+ if (aIter == aBroadcastAreaTbl.end())
+ return;
+ if (*aIter != pArea)
+ DBG_ERRORFILE( "UpdateRemoveArea: area pointer mismatch");
+ else
+ {
+ aBroadcastAreaTbl.erase( aIter);
+ pArea->DecRef();
+ }
+}
+
+
void ScBroadcastAreaSlot::UpdateInsert( ScBroadcastArea* pArea )
{
::std::pair< ScBroadcastAreas::iterator, bool > aPair =
@@ -732,6 +747,50 @@ void ScBroadcastAreaSlotMachine::UpdateBroadcastAreas(
}
}
+ // Updating an area's range will modify the hash key, remove areas from all
+ // affected slots. Will be reinserted later with the updated range.
+ ScBroadcastArea* pChain = pUpdateChain;
+ while (pChain)
+ {
+ ScBroadcastArea* pArea = pChain;
+ pChain = pArea->GetUpdateChainNext();
+ ScRange aRange( pArea->GetRange());
+ // remove from slots
+ for (SCTAB nTab = aRange.aStart.Tab(); nTab <= aRange.aEnd.Tab() && pArea->GetRef(); ++nTab)
+ {
+ TableSlotsMap::iterator iTab( aTableSlotsMap.find( nTab));
+ if (iTab == aTableSlotsMap.end())
+ {
+ DBG_ERRORFILE( "UpdateBroadcastAreas: Where's the TableSlot?!?");
+ continue; // for
+ }
+ ScBroadcastAreaSlot** ppSlots = (*iTab).second->getSlots();
+ SCSIZE nStart, nEnd, nRowBreak;
+ ComputeAreaPoints( aRange, nStart, nEnd, nRowBreak );
+ SCSIZE nOff = nStart;
+ SCSIZE nBreak = nOff + nRowBreak;
+ ScBroadcastAreaSlot** pp = ppSlots + nOff;
+ while ( nOff <= nEnd && pArea->GetRef() )
+ {
+ if (*pp)
+ (*pp)->UpdateRemoveArea( pArea);
+ if ( nOff < nBreak )
+ {
+ ++nOff;
+ ++pp;
+ }
+ else
+ {
+ nStart += BCA_SLOTS_ROW;
+ nOff = nStart;
+ pp = ppSlots + nOff;
+ nBreak = nOff + nRowBreak;
+ }
+ }
+ }
+
+ }
+
// shift sheets
if (nDz)
{
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index da2de0b68099..aea2bf4ff276 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -582,23 +582,6 @@ ScNoteCell::~ScNoteCell()
}
#endif
-ScNoteCell::ScNoteCell( SvStream& rStream, USHORT nVer ) :
- ScBaseCell( CELLTYPE_NOTE )
-{
- if( nVer >= SC_DATABYTES2 )
- {
- BYTE cData;
- rStream >> cData;
- if( cData & 0x0F )
- rStream.SeekRel( cData & 0x0F );
- }
-}
-
-void ScNoteCell::Save( SvStream& rStream ) const
-{
- rStream << (BYTE) 0x00;
-}
-
// ============================================================================
ScValueCell::ScValueCell() :
@@ -1576,6 +1559,10 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
}
bRunning = bOldRunning;
+ // #i102616# For single-sheet saving consider only content changes, not format type,
+ // because format type isn't set on loading (might be changed later)
+ BOOL bContentChanged = FALSE;
+
// Do not create a HyperLink() cell if the formula results in an error.
if( p->GetError() && pCode->IsHyperLink())
pCode->SetHyperLink(FALSE);
@@ -1614,7 +1601,12 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
// New error code?
if( p->GetError() != nOldErrCode )
+ {
bChanged = TRUE;
+ // bContentChanged only has to be set if the file content would be changed
+ if ( aResult.GetCellResultType() != svUnknown )
+ bContentChanged = TRUE;
+ }
// Different number format?
if( nFormatType != p->GetRetFormatType() )
{
@@ -1630,7 +1622,33 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
// In case of changes just obtain the result, no temporary and
// comparison needed anymore.
if (bChanged)
+ {
+ // #i102616# Compare anyway if the sheet is still marked unchanged for single-sheet saving
+ // Also handle special cases of initial results after loading.
+
+ if ( !bContentChanged && pDocument->IsStreamValid(aPos.Tab()) )
+ {
+ ScFormulaResult aNewResult( p->GetResultToken());
+ StackVar eOld = aResult.GetCellResultType();
+ StackVar eNew = aNewResult.GetCellResultType();
+ if ( eOld == svUnknown && ( eNew == svError || ( eNew == svDouble && aNewResult.GetDouble() == 0.0 ) ) )
+ {
+ // ScXMLTableRowCellContext::EndElement doesn't call SetFormulaResultDouble for 0
+ // -> no change
+ }
+ else
+ {
+ if ( eOld == svHybridCell ) // string result from SetFormulaResultString?
+ eOld = svString; // ScHybridCellToken has a valid GetString method
+
+ bContentChanged = (eOld != eNew ||
+ (eNew == svDouble && aResult.GetDouble() != aNewResult.GetDouble()) ||
+ (eNew == svString && aResult.GetString() != aNewResult.GetString()));
+ }
+ }
+
aResult.SetToken( p->GetResultToken() );
+ }
else
{
ScFormulaResult aNewResult( p->GetResultToken());
@@ -1639,6 +1657,19 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
bChanged = (eOld != eNew ||
(eNew == svDouble && aResult.GetDouble() != aNewResult.GetDouble()) ||
(eNew == svString && aResult.GetString() != aNewResult.GetString()));
+
+ // #i102616# handle special cases of initial results after loading (only if the sheet is still marked unchanged)
+ if ( bChanged && !bContentChanged && pDocument->IsStreamValid(aPos.Tab()) )
+ {
+ if ( ( eOld == svUnknown && ( eNew == svError || ( eNew == svDouble && aNewResult.GetDouble() == 0.0 ) ) ) ||
+ ( eOld == svHybridCell && eNew == svString && aResult.GetString() == aNewResult.GetString() ) )
+ {
+ // no change, see above
+ }
+ else
+ bContentChanged = TRUE;
+ }
+
aResult.Assign( aNewResult);
}
@@ -1675,13 +1706,19 @@ void ScFormulaCell::InterpretTail( ScInterpretTailParameter eTailParam )
// Coded double error may occur via filter import.
USHORT nErr = GetDoubleErrorValue( aResult.GetDouble());
aResult.SetResultError( nErr);
- bChanged = true;
+ bChanged = bContentChanged = true;
}
if( bChanged )
{
SetTextWidth( TEXTWIDTH_DIRTY );
SetScriptType( SC_SCRIPTTYPE_UNKNOWN );
}
+ if (bContentChanged && pDocument->IsStreamValid(aPos.Tab()))
+ {
+ // pass bIgnoreLock=TRUE, because even if called from pending row height update,
+ // a changed result must still reset the stream flag
+ pDocument->SetStreamValid(aPos.Tab(), FALSE, TRUE);
+ }
if ( !pCode->IsRecalcModeAlways() )
pDocument->RemoveFromFormulaTree( this );
@@ -1806,6 +1843,9 @@ void ScFormulaCell::SetDirty()
pDocument->TrackFormulas();
}
}
+
+ if (pDocument->IsStreamValid(aPos.Tab()))
+ pDocument->SetStreamValid(aPos.Tab(), FALSE);
}
}
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index 2a1525b76401..acac874704c6 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -53,7 +53,6 @@
#include "scmatrix.hxx"
#include "editutil.hxx"
#include "chgtrack.hxx"
-#include "indexmap.hxx"
#include "externalrefmgr.hxx"
using namespace formula;
@@ -135,8 +134,8 @@ void ScEditCell::GetString( String& rString ) const
EditEngine& rEngine = pDoc->GetEditEngine();
rEngine.SetText( *pData );
rString = ScEditUtil::GetMultilineString(rEngine); // string with line separators between paragraphs
- // kurze Strings fuer Formeln merken
- if ( rString.Len() < MAXSTRLEN )
+ // cache short strings for formulas
+ if ( rString.Len() < 256 )
((ScEditCell*)this)->pString = new String( rString ); //! non-const
}
else
@@ -1067,7 +1066,7 @@ void ScFormulaCell::UpdateInsertTab(SCTAB nTable)
pCode = new ScTokenArray( *pRangeData->GetCode() );
ScCompiler aComp2(pDocument, aPos, *pCode);
aComp2.SetGrammar(pDocument->GetGrammar());
- aComp2.MoveRelWrap();
+ aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
aComp2.UpdateInsertTab( nTable, FALSE );
// If the shared formula contained a named range/formula containing
// an absolute reference to a sheet, those have to be readjusted.
@@ -1103,7 +1102,7 @@ BOOL ScFormulaCell::UpdateDeleteTab(SCTAB nTable, BOOL bIsMove)
ScCompiler aComp2(pDocument, aPos, *pCode);
aComp2.SetGrammar(pDocument->GetGrammar());
aComp2.CompileTokenArray();
- aComp2.MoveRelWrap();
+ aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
aComp2.UpdateDeleteTab( nTable, FALSE, FALSE, bRefChanged );
// If the shared formula contained a named range/formula containing
// an absolute reference to a sheet, those have to be readjusted.
@@ -1140,7 +1139,7 @@ void ScFormulaCell::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo )
ScCompiler aComp2(pDocument, aPos, *pCode);
aComp2.SetGrammar(pDocument->GetGrammar());
aComp2.CompileTokenArray();
- aComp2.MoveRelWrap();
+ aComp2.MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
aComp2.UpdateMoveTab( nOldPos, nNewPos, TRUE );
bCompile = TRUE;
}
@@ -1480,14 +1479,15 @@ void ScFormulaCell::FindRangeNamesInUse(std::set<USHORT>& rIndexes) const
lcl_FindRangeNamesInUse( rIndexes, pCode, pDocument->GetRangeName() );
}
-void ScFormulaCell::ReplaceRangeNamesInUse( const ScIndexMap& rMap )
+void ScFormulaCell::ReplaceRangeNamesInUse( const ScRangeData::IndexMap& rMap )
{
for( FormulaToken* p = pCode->First(); p; p = pCode->Next() )
{
if( p->GetOpCode() == ocName )
{
- USHORT nIndex = p->GetIndex();
- USHORT nNewIndex = rMap.Find( nIndex );
+ sal_uInt16 nIndex = p->GetIndex();
+ ScRangeData::IndexMap::const_iterator itr = rMap.find(nIndex);
+ sal_uInt16 nNewIndex = itr == rMap.end() ? nIndex : itr->second;
if ( nIndex != nNewIndex )
{
p->SetIndex( nNewIndex );
diff --git a/sc/source/core/data/clipparam.cxx b/sc/source/core/data/clipparam.cxx
new file mode 100644
index 000000000000..b2ec555a0d5c
--- /dev/null
+++ b/sc/source/core/data/clipparam.cxx
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: document.cxx,v $
+ * $Revision: 1.90.36.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+// INCLUDE ---------------------------------------------------------------
+
+#include "clipparam.hxx"
+
+using ::std::vector;
+
+ScClipParam::ScClipParam() :
+ meDirection(Unspecified),
+ mbCutMode(false)
+{
+}
+
+ScClipParam::ScClipParam(const ScRange& rRange, bool bCutMode) :
+ meDirection(Unspecified),
+ mbCutMode(bCutMode)
+{
+ maRanges.Append(rRange);
+}
+
+ScClipParam::ScClipParam(const ScClipParam& r) :
+ maRanges(r.maRanges),
+ meDirection(r.meDirection),
+ mbCutMode(r.mbCutMode)
+{
+}
+
+bool ScClipParam::isMultiRange() const
+{
+ return maRanges.Count() > 1;
+}
+
+SCCOL ScClipParam::getPasteColSize()
+{
+ if (!maRanges.Count())
+ return 0;
+
+ switch (meDirection)
+ {
+ case ScClipParam::Column:
+ {
+ SCCOL nColSize = 0;
+ for (ScRangePtr p = maRanges.First(); p; p = maRanges.Next())
+ nColSize += p->aEnd.Col() - p->aStart.Col() + 1;
+ return nColSize;
+ }
+ case ScClipParam::Row:
+ {
+ // We assume that all ranges have identical column size.
+ const ScRange& rRange = *maRanges.First();
+ return rRange.aEnd.Col() - rRange.aStart.Col() + 1;
+ }
+ case ScClipParam::Unspecified:
+ default:
+ ;
+ }
+ return 0;
+}
+
+SCROW ScClipParam::getPasteRowSize()
+{
+ if (!maRanges.Count())
+ return 0;
+
+ switch (meDirection)
+ {
+ case ScClipParam::Column:
+ {
+ // We assume that all ranges have identical row size.
+ const ScRange& rRange = *maRanges.First();
+ return rRange.aEnd.Row() - rRange.aStart.Row() + 1;
+ }
+ case ScClipParam::Row:
+ {
+ SCROW nRowSize = 0;
+ for (ScRangePtr p = maRanges.First(); p; p = maRanges.Next())
+ nRowSize += p->aEnd.Row() - p->aStart.Row() + 1;
+ return nRowSize;
+ }
+ case ScClipParam::Unspecified:
+ default:
+ ;
+ }
+ return 0;
+}
+
+ScRange ScClipParam::getWholeRange() const
+{
+ ScRange aWhole;
+ bool bFirst = true;
+ ScRangeList aRanges = maRanges;
+ for (ScRange* p = aRanges.First(); p; p = aRanges.Next())
+ {
+ if (bFirst)
+ {
+ aWhole = *p;
+ bFirst = false;
+ continue;
+ }
+
+ if (aWhole.aStart.Col() > p->aStart.Col())
+ aWhole.aStart.SetCol(p->aStart.Col());
+
+ if (aWhole.aStart.Row() > p->aStart.Row())
+ aWhole.aStart.SetRow(p->aStart.Row());
+
+ if (aWhole.aEnd.Col() < p->aEnd.Col())
+ aWhole.aEnd.SetCol(p->aEnd.Col());
+
+ if (aWhole.aEnd.Row() < p->aEnd.Row())
+ aWhole.aEnd.SetRow(p->aEnd.Row());
+ }
+ return aWhole;
+}
+
+void ScClipParam::transpose()
+{
+ switch (meDirection)
+ {
+ case Column:
+ meDirection = ScClipParam::Row;
+ break;
+ case Row:
+ meDirection = ScClipParam::Column;
+ break;
+ case Unspecified:
+ default:
+ ;
+ }
+
+ ScRangeList aNewRanges;
+ if (maRanges.Count())
+ {
+ ScRange* p = maRanges.First();
+ SCCOL nColOrigin = p->aStart.Col();
+ SCROW nRowOrigin = p->aStart.Row();
+ for (; p; p = maRanges.Next())
+ {
+ SCCOL nColDelta = p->aStart.Col() - nColOrigin;
+ SCROW nRowDelta = p->aStart.Row() - nRowOrigin;
+ SCCOL nCol1 = 0;
+ SCCOL nCol2 = static_cast<SCCOL>(p->aEnd.Row() - p->aStart.Row());
+ SCROW nRow1 = 0;
+ SCROW nRow2 = static_cast<SCROW>(p->aEnd.Col() - p->aStart.Col());
+ nCol1 += static_cast<SCCOL>(nRowDelta);
+ nCol2 += static_cast<SCCOL>(nRowDelta);
+ nRow1 += static_cast<SCROW>(nColDelta);
+ nRow2 += static_cast<SCROW>(nColDelta);
+ ScRange aNew(nCol1, nRow1, p->aStart.Tab(), nCol2, nRow2, p->aStart.Tab());
+ aNewRanges.Append(aNew);
+ }
+ }
+ maRanges = aNewRanges;
+}
+
+// ============================================================================
+
+ScClipRangeNameData::ScClipRangeNameData() :
+ mbReplace(false)
+{
+}
+
+ScClipRangeNameData::~ScClipRangeNameData()
+{
+}
+
+void ScClipRangeNameData::insert(sal_uInt16 nOldIndex, sal_uInt16 nNewIndex)
+{
+ maRangeMap.insert(
+ ScRangeData::IndexMap::value_type(nOldIndex, nNewIndex));
+}
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 3238607fd613..0afc4fb1347c 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -240,11 +240,11 @@ BOOL ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark) const
}
-BOOL ScColumn::HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes,
- BOOL bLeft, BOOL bRight ) const
-{
- return pAttrArray->HasLines( nRow1, nRow2, rSizes, bLeft, bRight );
-}
+//UNUSED2009-05 BOOL ScColumn::HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes,
+//UNUSED2009-05 BOOL bLeft, BOOL bRight ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 return pAttrArray->HasLines( nRow1, nRow2, rSizes, bLeft, bRight );
+//UNUSED2009-05 }
BOOL ScColumn::HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const
@@ -1874,7 +1874,7 @@ void ScColumn::FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, std::set<USHORT>& r
}
void ScColumn::ReplaceRangeNamesInUse(SCROW nRow1, SCROW nRow2,
- const ScIndexMap& rMap )
+ const ScRangeData::IndexMap& rMap )
{
if (pItems)
for (SCSIZE i = 0; i < nCount; i++)
@@ -1891,7 +1891,6 @@ void ScColumn::ReplaceRangeNamesInUse(SCROW nRow1, SCROW nRow2,
}
}
-
void ScColumn::SetDirtyVar()
{
for (SCSIZE i=0; i<nCount; i++)
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index a7a5ba39fc6a..01c72ab4e0c4 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1191,23 +1191,23 @@ BOOL ScMarkedDataIter::Next( SCSIZE& rIndex )
return TRUE;
}
-USHORT ScColumn::GetErrorData( SCROW nRow ) const
-{
- SCSIZE nIndex;
- if (Search(nRow, nIndex))
- {
- ScBaseCell* pCell = pItems[nIndex].pCell;
- switch (pCell->GetCellType())
- {
- case CELLTYPE_FORMULA :
- return ((ScFormulaCell*)pCell)->GetErrCode();
-// break;
- default:
- return 0;
- }
- }
- return 0;
-}
+//UNUSED2009-05 USHORT ScColumn::GetErrorData( SCROW nRow ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 SCSIZE nIndex;
+//UNUSED2009-05 if (Search(nRow, nIndex))
+//UNUSED2009-05 {
+//UNUSED2009-05 ScBaseCell* pCell = pItems[nIndex].pCell;
+//UNUSED2009-05 switch (pCell->GetCellType())
+//UNUSED2009-05 {
+//UNUSED2009-05 case CELLTYPE_FORMULA :
+//UNUSED2009-05 return ((ScFormulaCell*)pCell)->GetErrCode();
+//UNUSED2009-05 // break;
+//UNUSED2009-05 default:
+//UNUSED2009-05 return 0;
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 return 0;
+//UNUSED2009-05 }
//------------
@@ -1376,13 +1376,13 @@ SCSIZE ScColumn::GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirecti
return nLines;
}
-SCROW ScColumn::GetFirstDataPos() const
-{
- if (nCount)
- return pItems[0].nRow;
- else
- return 0;
-}
+//UNUSED2009-05 SCROW ScColumn::GetFirstDataPos() const
+//UNUSED2009-05 {
+//UNUSED2009-05 if (nCount)
+//UNUSED2009-05 return pItems[0].nRow;
+//UNUSED2009-05 else
+//UNUSED2009-05 return 0;
+//UNUSED2009-05 }
SCROW ScColumn::GetLastDataPos() const
{
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 3c636d9049d4..45ead48d0f35 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -786,7 +786,7 @@ BOOL ScConditionEntry::IsValidStr( const String& rArg ) const
String aUpVal2( aStrVal2 );
if ( eOp == SC_COND_BETWEEN || eOp == SC_COND_NOTBETWEEN )
- if ( ScGlobal::pCollator->compareString( aUpVal1, aUpVal2 )
+ if ( ScGlobal::GetCollator()->compareString( aUpVal1, aUpVal2 )
== COMPARE_GREATER )
{
// richtige Reihenfolge fuer Wertebereich
@@ -797,16 +797,16 @@ BOOL ScConditionEntry::IsValidStr( const String& rArg ) const
switch ( eOp )
{
case SC_COND_EQUAL:
- bValid = (ScGlobal::pCollator->compareString(
+ bValid = (ScGlobal::GetCollator()->compareString(
rArg, aUpVal1 ) == COMPARE_EQUAL);
break;
case SC_COND_NOTEQUAL:
- bValid = (ScGlobal::pCollator->compareString(
+ bValid = (ScGlobal::GetCollator()->compareString(
rArg, aUpVal1 ) != COMPARE_EQUAL);
break;
default:
{
- sal_Int32 nCompare = ScGlobal::pCollator->compareString(
+ sal_Int32 nCompare = ScGlobal::GetCollator()->compareString(
rArg, aUpVal1 );
switch ( eOp )
{
@@ -826,7 +826,7 @@ BOOL ScConditionEntry::IsValidStr( const String& rArg ) const
case SC_COND_NOTBETWEEN:
// Test auf NOTBETWEEN:
bValid = ( nCompare == COMPARE_LESS ||
- ScGlobal::pCollator->compareString( rArg,
+ ScGlobal::GetCollator()->compareString( rArg,
aUpVal2 ) == COMPARE_GREATER );
if ( eOp == SC_COND_BETWEEN )
bValid = !bValid;
@@ -1553,13 +1553,6 @@ ScConditionalFormat* ScConditionalFormatList::GetFormat( sal_uInt32 nKey )
return NULL;
}
-//UNUSED2008-05 void ScConditionalFormatList::ResetUsed()
-//UNUSED2008-05 {
-//UNUSED2008-05 USHORT nCount = Count();
-//UNUSED2008-05 for (USHORT i=0; i<nCount; i++)
-//UNUSED2008-05 (*this)[i]->SetUsed(FALSE);
-//UNUSED2008-05 }
-
void ScConditionalFormatList::CompileAll()
{
USHORT nCount = Count();
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 3b650f5d8ca4..b88cd49a6a8c 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -1074,8 +1074,8 @@ ScBaseCell* ScQueryCellIterator::BinarySearch()
ScBaseCell* pCell;
SCSIZE nHi, nLo;
- CollatorWrapper* pCollator = (aParam.bCaseSens ? ScGlobal::pCaseCollator :
- ScGlobal::pCollator);
+ CollatorWrapper* pCollator = (aParam.bCaseSens ? ScGlobal::GetCaseCollator() :
+ ScGlobal::GetCollator());
SvNumberFormatter& rFormatter = *(pDoc->GetFormatTable());
const ScQueryEntry& rEntry = aParam.GetEntry(0);
bool bLessEqual = rEntry.eOp == SC_LESS_EQUAL;
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index c2a77a0d0ede..fce83f25cd93 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -741,7 +741,7 @@ SfxItemPresentation lcl_HFPresentation
default:
if ( !pIntl )
- pIntl = ScGlobal::pScIntlWrapper;
+ pIntl = ScGlobal::GetScIntlWrapper();
pItem->GetPresentation( ePresentation, eCoreMetric, ePresentationMetric, aText, pIntl );
}
@@ -1018,7 +1018,7 @@ SfxItemPresentation __EXPORT ScDocumentPool::GetPresentation(
default:
if ( !pIntl )
- pIntl = ScGlobal::pScIntlWrapper;
+ pIntl = ScGlobal::GetScIntlWrapper();
ePresentation = rItem.GetPresentation( ePresentation, GetMetric( nW ), ePresentationMetric, rText, pIntl );
break;
}
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 16613fbcbab4..3404866446fe 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -86,7 +86,6 @@
#include "editutil.hxx"
#include "hints.hxx"
#include "dpobject.hxx"
-#include "indexmap.hxx"
#include "scrdata.hxx"
#include "poolhelp.hxx"
#include "unoreflist.hxx"
@@ -96,6 +95,7 @@
#include "externalrefmgr.hxx"
#include "tabprotection.hxx"
#include "formulaparserpool.hxx"
+#include "clipparam.hxx"
// pImpl because including lookupcache.hxx in document.hxx isn't wanted, and
// dtor plus helpers are convenient.
@@ -155,6 +155,8 @@ ScDocument::ScDocument( ScDocumentMode eMode,
pScriptTypeData( NULL ),
pCacheFieldEditEngine( NULL ),
pDocProtection( NULL ),
+ mpClipParam( NULL),
+ pExternalRefMgr( NULL ),
pViewOptions( NULL ),
pDocOptions( NULL ),
pExtDocOptions( NULL ),
@@ -182,7 +184,6 @@ ScDocument::ScDocument( ScDocumentMode eMode,
bForcedFormulaPending( FALSE ),
bCalculatingFormulaTree( FALSE ),
bIsClip( eMode == SCDOCMODE_CLIP ),
- bCutMode( FALSE ),
bIsUndo( eMode == SCDOCMODE_UNDO ),
bIsVisible( FALSE ),
bIsEmbedded( FALSE ),
@@ -217,6 +218,7 @@ ScDocument::ScDocument( ScDocumentMode eMode,
mbAdjustHeightEnabled( true ),
mbExecuteLinkEnabled( true ),
mbChangeReadOnlyEnabled( false ),
+ mbStreamValidLocked( false ),
mnNamedRangesLockCount( 0 )
{
SetStorageGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT);
@@ -248,9 +250,6 @@ ScDocument::ScDocument( ScDocumentMode eMode,
pRangeName = new ScRangeName( 4, 4, FALSE, this );
pDBCollection = new ScDBCollection( 4, 4, FALSE, this );
-#if OLD_PIVOT_IMPLEMENTATION
- pPivotCollection = new ScPivotCollection(4, 4, this );
-#endif
pSelectionAttr = NULL;
pChartCollection = new ScChartCollection;
apTemporaryChartLock = std::auto_ptr< ScTemporaryChartLock >( new ScTemporaryChartLock(this) );
@@ -264,6 +263,15 @@ ScDocument::ScDocument( ScDocumentMode eMode,
aTrackTimer.SetTimeout( 100 );
}
+SvxLinkManager* ScDocument::GetLinkManager() const
+{
+ if ( bAutoCalc && !pLinkManager && pShell)
+ {
+ pLinkManager = new SvxLinkManager( pShell );
+ }
+ return pLinkManager;
+}
+
void ScDocument::SetStorageGrammar( formula::FormulaGrammar::Grammar eGram )
{
@@ -374,7 +382,7 @@ ScDocument::~ScDocument()
// Links aufrauemen
- if ( pLinkManager )
+ if ( GetLinkManager() )
{
// BaseLinks freigeben
for ( USHORT n = pLinkManager->GetServers().Count(); n; )
@@ -421,9 +429,6 @@ ScDocument::~ScDocument()
}
delete pRangeName;
delete pDBCollection;
-#if OLD_PIVOT_IMPLEMENTATION
- delete pPivotCollection;
-#endif
delete pSelectionAttr;
apTemporaryChartLock.reset();
delete pChartCollection;
@@ -548,12 +553,12 @@ ScNoteEditEngine& ScDocument::GetNoteEngine()
return *pNoteEngine;
}
-SfxItemPool& ScDocument::GetNoteItemPool()
-{
- if ( !pNoteItemPool )
- pNoteItemPool = new SfxItemPool(SdrObject::GetGlobalDrawObjectItemPool());
- return *pNoteItemPool;
-}
+//UNUSED2009-05 SfxItemPool& ScDocument::GetNoteItemPool()
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( !pNoteItemPool )
+//UNUSED2009-05 pNoteItemPool = new SfxItemPool(SdrObject::GetGlobalDrawObjectItemPool());
+//UNUSED2009-05 return *pNoteItemPool;
+//UNUSED2009-05 }
void ScDocument::ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks )
{
@@ -623,22 +628,22 @@ void ScDocument::PutCell( SCCOL nCol, SCROW nRow, SCTAB nTab,
}
}
-void ScDocument::PutCell( const ScAddress& rPos, ScBaseCell* pCell,
- ULONG nFormatIndex, BOOL bForceTab )
-{
- SCTAB nTab = rPos.Tab();
- if ( bForceTab && !pTab[nTab] )
- {
- BOOL bExtras = !bIsUndo; // Spaltenbreiten, Zeilenhoehen, Flags
-
- pTab[nTab] = new ScTable(this, nTab,
- String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("temp")),
- bExtras, bExtras);
- }
-
- if (pTab[nTab])
- pTab[nTab]->PutCell( rPos, nFormatIndex, pCell );
-}
+//UNUSED2009-05 void ScDocument::PutCell( const ScAddress& rPos, ScBaseCell* pCell,
+//UNUSED2009-05 ULONG nFormatIndex, BOOL bForceTab )
+//UNUSED2009-05 {
+//UNUSED2009-05 SCTAB nTab = rPos.Tab();
+//UNUSED2009-05 if ( bForceTab && !pTab[nTab] )
+//UNUSED2009-05 {
+//UNUSED2009-05 BOOL bExtras = !bIsUndo; // Spaltenbreiten, Zeilenhoehen, Flags
+//UNUSED2009-05
+//UNUSED2009-05 pTab[nTab] = new ScTable(this, nTab,
+//UNUSED2009-05 String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("temp")),
+//UNUSED2009-05 bExtras, bExtras);
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 if (pTab[nTab])
+//UNUSED2009-05 pTab[nTab]->PutCell( rPos, nFormatIndex, pCell );
+//UNUSED2009-05 }
BOOL ScDocument::GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow,
BOOL bNotes ) const
@@ -759,11 +764,6 @@ BOOL ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos )
pDBCollection->UpdateMoveTab( nOldPos, nNewPos );
xColNameRanges->UpdateReference( URM_REORDER, this, aSourceRange, 0,0,nDz );
xRowNameRanges->UpdateReference( URM_REORDER, this, aSourceRange, 0,0,nDz );
-#if OLD_PIVOT_IMPLEMENTATION
- if (pPivotCollection)
- pPivotCollection->UpdateReference( URM_REORDER,
- 0,0,nOldPos, MAXCOL,MAXROW,nOldPos, 0,0,nDz );
-#endif
if (pDPCollection)
pDPCollection->UpdateReference( URM_REORDER, aSourceRange, 0,0,nDz );
if (pDetOpList)
@@ -858,11 +858,6 @@ BOOL ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM
pRangeName->UpdateTabRef(nNewPos, 1);
pDBCollection->UpdateReference(
URM_INSDEL, 0,0,nNewPos, MAXCOL,MAXROW,MAXTAB, 0,0,1 );
-#if OLD_PIVOT_IMPLEMENTATION
- if (pPivotCollection)
- pPivotCollection->UpdateReference(
- URM_INSDEL, 0,0,nNewPos, MAXCOL,MAXROW,MAXTAB, 0,0,1 );
-#endif
if (pDPCollection)
pDPCollection->UpdateReference( URM_INSDEL, aRange, 0,0,1 );
if (pDetOpList)
@@ -978,23 +973,18 @@ ULONG ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
bOldAutoCalcSrc = pSrcDoc->GetAutoCalc();
pSrcDoc->SetAutoCalc( TRUE ); // falls was berechnet werden muss
}
- SvNumberFormatter* pThisFormatter = xPoolHelper->GetFormTable();
- SvNumberFormatter* pOtherFormatter = pSrcDoc->xPoolHelper->GetFormTable();
- if (pOtherFormatter && pOtherFormatter != pThisFormatter)
+
{
- SvNumberFormatterIndexTable* pExchangeList =
- pThisFormatter->MergeFormatter(*(pOtherFormatter));
- if (pExchangeList->Count() > 0)
- pFormatExchangeList = pExchangeList;
- }
- nDestPos = Min(nDestPos, (SCTAB)(GetTableCount() - 1));
- { // scope for bulk broadcast
- ScBulkBroadcast aBulkBroadcast( pBASM);
- pSrcDoc->pTab[nSrcPos]->CopyToTable(0, 0, MAXCOL, MAXROW,
- ( bResultsOnly ? IDF_ALL & ~IDF_FORMULA : IDF_ALL),
- FALSE, pTab[nDestPos] );
+ NumFmtMergeHandler aNumFmtMergeHdl(this, pSrcDoc);
+
+ nDestPos = Min(nDestPos, (SCTAB)(GetTableCount() - 1));
+ { // scope for bulk broadcast
+ ScBulkBroadcast aBulkBroadcast( pBASM);
+ pSrcDoc->pTab[nSrcPos]->CopyToTable(0, 0, MAXCOL, MAXROW,
+ ( bResultsOnly ? IDF_ALL & ~IDF_FORMULA : IDF_ALL),
+ FALSE, pTab[nDestPos] );
+ }
}
- pFormatExchangeList = NULL;
pTab[nDestPos]->SetTabNo(nDestPos);
if ( !bResultsOnly )
@@ -1004,7 +994,7 @@ ULONG ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
// array containing range names which might need update of indices
ScRangeData** pSrcRangeNames = nSrcRangeNames ? new ScRangeData* [nSrcRangeNames] : NULL;
// the index mapping thereof
- ScIndexMap aSrcRangeMap( nSrcRangeNames );
+ ScRangeData::IndexMap aSrcRangeMap;
BOOL bRangeNameReplace = FALSE;
// find named ranges that are used in the source sheet
@@ -1029,7 +1019,8 @@ ULONG ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
USHORT nExistingIndex = pExistingData->GetIndex();
pSrcRangeNames[i] = NULL; // don't modify the named range
- aSrcRangeMap.SetPair( i, nOldIndex, nExistingIndex );
+ aSrcRangeMap.insert(
+ ScRangeData::IndexMap::value_type(nOldIndex, nExistingIndex));
bRangeNameReplace = TRUE;
bNamesLost = TRUE;
}
@@ -1049,7 +1040,8 @@ ULONG ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
pData->TransferTabRef( nSrcPos, nDestPos );
pSrcRangeNames[i] = pData;
USHORT nNewIndex = pData->GetIndex();
- aSrcRangeMap.SetPair( i, nOldIndex, nNewIndex );
+ aSrcRangeMap.insert(
+ ScRangeData::IndexMap::value_type(nOldIndex, nNewIndex));
if ( !bRangeNameReplace )
bRangeNameReplace = ( nOldIndex != nNewIndex );
}
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 08170fd6cdc9..17650028db70 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -80,6 +80,7 @@
#include "listenercalls.hxx"
#include "tabprotection.hxx"
#include "formulaparserpool.hxx"
+#include "clipparam.hxx"
#include <memory>
@@ -230,46 +231,6 @@ ScDPObject* ScDocument::GetDPAtBlock( const ScRange & rBlock ) const
return NULL;
}
-#if OLD_PIVOT_IMPLEMENTATION
-ScPivotCollection* ScDocument::GetPivotCollection() const
-{
- return pPivotCollection;
-}
-
-void ScDocument::SetPivotCollection(ScPivotCollection* pNewPivotCollection)
-{
- if ( pPivotCollection && pNewPivotCollection &&
- *pPivotCollection == *pNewPivotCollection )
- {
- delete pNewPivotCollection;
- return;
- }
-
- if (pPivotCollection)
- delete pPivotCollection;
- pPivotCollection = pNewPivotCollection;
-
- if (pPivotCollection)
- {
- USHORT nCount = pPivotCollection->GetCount();
- for (USHORT i=0; i<nCount; i++)
- {
- ScPivot* pPivot = (*pPivotCollection)[i];
- if (pPivot->CreateData())
- pPivot->ReleaseData();
- }
- }
-}
-
-ScPivot* ScDocument::GetPivotAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
-{
- if (pPivotCollection)
- return pPivotCollection->GetPivotAtCursor(nCol, nRow, nTab);
- else
- return NULL;
-}
-#endif
-
ScChartCollection* ScDocument::GetChartCollection() const
{
return pChartCollection;
@@ -468,7 +429,7 @@ BOOL ScDocument::LinkExternalTab( SCTAB& rTab, const String& aDocTab,
{
ScTableLink* pLink = new ScTableLink( pShell, aFileName, aFilterName, aOptions, nRefreshDelay );
pLink->SetInCreate( TRUE );
- pLinkManager->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, aFileName,
+ GetLinkManager()->InsertFileLink( *pLink, OBJECT_CLIENT_FILE, aFileName,
&aFilterName );
pLink->Update();
pLink->SetInCreate( FALSE );
@@ -479,10 +440,11 @@ BOOL ScDocument::LinkExternalTab( SCTAB& rTab, const String& aDocTab,
return TRUE;
}
-ScExternalRefManager* ScDocument::GetExternalRefManager()
+ScExternalRefManager* ScDocument::GetExternalRefManager() const
{
+ ScDocument* pThis = const_cast<ScDocument*>(this);
if (!pExternalRefMgr.get())
- pExternalRefMgr.reset(new ScExternalRefManager(this));
+ pThis->pExternalRefMgr.reset( new ScExternalRefManager( pThis));
return pExternalRefMgr.get();
}
@@ -845,10 +807,6 @@ void ScDocument::UpdateReference( UpdateRefMode eUpdateRefMode,
xRowNameRanges->UpdateReference( eUpdateRefMode, this, aRange, nDx, nDy, nDz );
pDBCollection->UpdateReference( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz );
pRangeName->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz );
-#if OLD_PIVOT_IMPLEMENTATION
- if (pPivotCollection)
- pPivotCollection->UpdateReference( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz );
-#endif
if ( pDPCollection )
pDPCollection->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz );
UpdateChartRef( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz );
@@ -898,7 +856,7 @@ void ScDocument::UpdateReference( UpdateRefMode eUpdateRefMode,
{
ScDocument* pClipDoc = SC_MOD()->GetClipDoc();
if (pClipDoc)
- pClipDoc->bCutMode = FALSE;
+ pClipDoc->GetClipParam().mbCutMode = false;
}
}
}
@@ -908,7 +866,10 @@ void ScDocument::UpdateTranspose( const ScAddress& rDestPos, ScDocument* pClipDo
{
DBG_ASSERT(pClipDoc->bIsClip, "UpdateTranspose: kein Clip");
- ScRange aSource = pClipDoc->aClipRange; // Tab wird noch angepasst
+ ScRange aSource;
+ ScClipParam& rClipParam = GetClipParam();
+ if (rClipParam.maRanges.Count())
+ aSource = *rClipParam.maRanges.First();
ScAddress aDest = rDestPos;
SCTAB nClipTab = 0;
@@ -938,9 +899,6 @@ void ScDocument::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY )
//! UpdateChartRef
pRangeName->UpdateGrow( rArea, nGrowX, nGrowY );
-#if OLD_PIVOT_IMPLEMENTATION
- pPivotCollection->UpdateGrow( rArea, nGrowX, nGrowY );
-#endif
for (SCTAB i=0; i<=MAXTAB && pTab[i]; i++)
pTab[i]->UpdateGrow( rArea, nGrowX, nGrowY );
@@ -1776,16 +1734,10 @@ const ScDocOptions& ScDocument::GetDocOptions() const
void ScDocument::SetDocOptions( const ScDocOptions& rOpt )
{
- USHORT d,m,y;
-
DBG_ASSERT( pDocOptions, "No DocOptions! :-(" );
*pDocOptions = rOpt;
- rOpt.GetDate( d,m,y );
- SvNumberFormatter* pFormatter = xPoolHelper->GetFormTable();
- pFormatter->ChangeNullDate( d,m,y );
- pFormatter->ChangeStandardPrec( (USHORT)rOpt.GetStdPrecision() );
- pFormatter->SetYear2000( rOpt.GetYear2000() );
+ xPoolHelper->SetFormTableOpt(rOpt);
}
const ScViewOptions& ScDocument::GetViewOptions() const
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index c0ae477ed96b..9527089ebde3 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -125,6 +125,13 @@ void ScDocument::Broadcast( const ScHint& rHint )
// Repaint fuer bedingte Formate mit relativen Referenzen:
if ( pCondFormList && rHint.GetAddress() != BCA_BRDCST_ALWAYS )
pCondFormList->SourceChanged( rHint.GetAddress() );
+
+ if ( rHint.GetAddress() != BCA_BRDCST_ALWAYS )
+ {
+ SCTAB nTab = rHint.GetAddress().Tab();
+ if (pTab[nTab] && pTab[nTab]->IsStreamValid())
+ pTab[nTab]->SetStreamValid(FALSE);
+ }
}
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index c34e93f10d66..64433a30297a 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -271,6 +271,11 @@ void ScDocument::ModifyStyleSheet( SfxStyleSheetBase& rStyleSheet,
if ( ScGlobal::CheckWidthInvalidate( bNumFormatChanged,
rSet, rChanges ) )
InvalidateTextWidth( NULL, NULL, bNumFormatChanged );
+
+ for (SCTAB nTab=0; nTab<=MAXTAB; ++nTab)
+ if (pTab[nTab] && pTab[nTab]->IsStreamValid())
+ pTab[nTab]->SetStreamValid( FALSE );
+
ULONG nOldFormat =
((const SfxUInt32Item*)&rSet.Get(
ATTR_VALUE_FORMAT ))->GetValue();
@@ -319,20 +324,8 @@ void ScDocument::ModifyStyleSheet( SfxStyleSheetBase& rStyleSheet,
void ScDocument::CopyStdStylesFrom( ScDocument* pSrcDoc )
{
// #b5017505# number format exchange list has to be handled here, too
-
- SvNumberFormatter* pThisFormatter = xPoolHelper->GetFormTable();
- SvNumberFormatter* pOtherFormatter = pSrcDoc->xPoolHelper->GetFormTable();
- if (pOtherFormatter && pOtherFormatter != pThisFormatter)
- {
- SvNumberFormatterIndexTable* pExchangeList =
- pThisFormatter->MergeFormatter(*(pOtherFormatter));
- if (pExchangeList->Count() > 0)
- pFormatExchangeList = pExchangeList;
- }
-
+ NumFmtMergeHandler aNumFmtMergeHdl(this, pSrcDoc);
xPoolHelper->GetStylePool()->CopyStdStylesFrom( pSrcDoc->xPoolHelper->GetStylePool() );
-
- pFormatExchangeList = NULL;
}
//------------------------------------------------------------------------
@@ -920,7 +913,7 @@ BOOL ScDocument::IdleCheckLinks() // TRUE = demnaechst wieder versuche
{
BOOL bAnyLeft = FALSE;
- if (pLinkManager)
+ if (GetLinkManager())
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
USHORT nCount = rLinks.Count();
@@ -948,7 +941,7 @@ void ScDocument::SaveDdeLinks(SvStream& rStream) const
// bei 4.0-Export alle mit Modus != DEFAULT weglassen
BOOL bExport40 = ( rStream.GetVersion() <= SOFFICE_FILEFORMAT_40 );
- const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
+ const ::sfx2::SvBaseLinks& rLinks = GetLinkManager()->GetLinks();
USHORT nCount = rLinks.Count();
// erstmal zaehlen...
@@ -986,6 +979,7 @@ void ScDocument::LoadDdeLinks(SvStream& rStream)
{
ScMultipleReadHeader aHdr( rStream );
+ GetLinkManager();
USHORT nCount;
rStream >> nCount;
for (USHORT i=0; i<nCount; i++)
@@ -998,7 +992,7 @@ void ScDocument::LoadDdeLinks(SvStream& rStream)
BOOL ScDocument::HasDdeLinks() const
{
- if (pLinkManager) // Clipboard z.B. hat keinen LinkManager
+ if (GetLinkManager()) // Clipboard z.B. hat keinen LinkManager
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
USHORT nCount = rLinks.Count();
@@ -1025,7 +1019,7 @@ BOOL ScDocument::IsInLinkUpdate() const
void ScDocument::UpdateExternalRefLinks()
{
- if (!pLinkManager)
+ if (!GetLinkManager())
return;
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
@@ -1064,7 +1058,7 @@ void ScDocument::UpdateExternalRefLinks()
void ScDocument::UpdateDdeLinks()
{
- if (pLinkManager)
+ if (GetLinkManager())
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
USHORT nCount = rLinks.Count();
@@ -1110,7 +1104,7 @@ BOOL ScDocument::UpdateDdeLink( const String& rAppl, const String& rTopic, const
//! wenn's mal alles asynchron wird, aber auch hier
BOOL bFound = FALSE;
- if (pLinkManager)
+ if (GetLinkManager())
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
USHORT nCount = rLinks.Count();
@@ -1135,7 +1129,7 @@ BOOL ScDocument::UpdateDdeLink( const String& rAppl, const String& rTopic, const
void ScDocument::DisconnectDdeLinks()
{
- if (pLinkManager)
+ if (GetLinkManager())
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
USHORT nCount = rLinks.Count();
@@ -1158,7 +1152,7 @@ void ScDocument::CopyDdeLinks( ScDocument* pDestDoc ) const
pDestDoc->LoadDdeLinks(*pClipData);
}
}
- else if (pLinkManager) // Links direkt kopieren
+ else if (GetLinkManager()) // Links direkt kopieren
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
USHORT nCount = rLinks.Count();
@@ -1179,7 +1173,7 @@ void ScDocument::CopyDdeLinks( ScDocument* pDestDoc ) const
USHORT ScDocument::GetDdeLinkCount() const
{
USHORT nDdeCount = 0;
- if (pLinkManager)
+ if (GetLinkManager())
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
USHORT nCount = rLinks.Count();
@@ -1255,12 +1249,12 @@ ScDdeLink* lclGetDdeLink( const SvxLinkManager* pLinkManager, USHORT nDdePos )
bool ScDocument::FindDdeLink( const String& rAppl, const String& rTopic, const String& rItem, BYTE nMode, USHORT& rnDdePos )
{
- return lclGetDdeLink( pLinkManager, rAppl, rTopic, rItem, nMode, &rnDdePos ) != NULL;
+ return lclGetDdeLink( GetLinkManager(), rAppl, rTopic, rItem, nMode, &rnDdePos ) != NULL;
}
bool ScDocument::GetDdeLinkData( USHORT nDdePos, String& rAppl, String& rTopic, String& rItem ) const
{
- if( const ScDdeLink* pDdeLink = lclGetDdeLink( pLinkManager, nDdePos ) )
+ if( const ScDdeLink* pDdeLink = lclGetDdeLink( GetLinkManager(), nDdePos ) )
{
rAppl = pDdeLink->GetAppl();
rTopic = pDdeLink->GetTopic();
@@ -1272,7 +1266,7 @@ bool ScDocument::GetDdeLinkData( USHORT nDdePos, String& rAppl, String& rTopic,
bool ScDocument::GetDdeLinkMode( USHORT nDdePos, BYTE& rnMode ) const
{
- if( const ScDdeLink* pDdeLink = lclGetDdeLink( pLinkManager, nDdePos ) )
+ if( const ScDdeLink* pDdeLink = lclGetDdeLink( GetLinkManager(), nDdePos ) )
{
rnMode = pDdeLink->GetMode();
return true;
@@ -1282,7 +1276,7 @@ bool ScDocument::GetDdeLinkMode( USHORT nDdePos, BYTE& rnMode ) const
const ScMatrix* ScDocument::GetDdeLinkResultMatrix( USHORT nDdePos ) const
{
- const ScDdeLink* pDdeLink = lclGetDdeLink( pLinkManager, nDdePos );
+ const ScDdeLink* pDdeLink = lclGetDdeLink( GetLinkManager(), nDdePos );
return pDdeLink ? pDdeLink->GetResult() : NULL;
}
@@ -1293,7 +1287,7 @@ bool ScDocument::CreateDdeLink( const String& rAppl, const String& rTopic, const
on existing and new links. */
//! store DDE links additionally at document (for efficiency)?
DBG_ASSERT( nMode != SC_DDE_IGNOREMODE, "ScDocument::CreateDdeLink - SC_DDE_IGNOREMODE not allowed here" );
- if( pLinkManager && (nMode != SC_DDE_IGNOREMODE) )
+ if( GetLinkManager() && (nMode != SC_DDE_IGNOREMODE) )
{
ScDdeLink* pDdeLink = lclGetDdeLink( pLinkManager, rAppl, rTopic, rItem, nMode );
if( !pDdeLink )
@@ -1314,7 +1308,7 @@ bool ScDocument::CreateDdeLink( const String& rAppl, const String& rTopic, const
bool ScDocument::SetDdeLinkResultMatrix( USHORT nDdePos, ScMatrix* pResults )
{
- if( ScDdeLink* pDdeLink = lclGetDdeLink( pLinkManager, nDdePos ) )
+ if( ScDdeLink* pDdeLink = lclGetDdeLink( GetLinkManager(), nDdePos ) )
{
pDdeLink->SetResult( pResults );
return true;
@@ -1326,7 +1320,7 @@ bool ScDocument::SetDdeLinkResultMatrix( USHORT nDdePos, ScMatrix* pResults )
BOOL ScDocument::HasAreaLinks() const
{
- if (pLinkManager) // Clipboard z.B. hat keinen LinkManager
+ if (GetLinkManager()) // Clipboard z.B. hat keinen LinkManager
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
USHORT nCount = rLinks.Count();
@@ -1340,7 +1334,7 @@ BOOL ScDocument::HasAreaLinks() const
void ScDocument::UpdateAreaLinks()
{
- if (pLinkManager)
+ if (GetLinkManager())
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
USHORT nCount = rLinks.Count();
@@ -1355,7 +1349,7 @@ void ScDocument::UpdateAreaLinks()
void ScDocument::DeleteAreaLinksOnTab( SCTAB nTab )
{
- if (pLinkManager)
+ if (GetLinkManager())
{
const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
USHORT nPos = 0;
@@ -1374,7 +1368,7 @@ void ScDocument::DeleteAreaLinksOnTab( SCTAB nTab )
void ScDocument::UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode,
const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
{
- if (pLinkManager)
+ if (GetLinkManager())
{
bool bAnyUpdate = false;
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 06a683b0bf72..de27a80b17ee 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -223,7 +223,7 @@ void ScDocument::InitDrawLayer( SfxObjectShell* pDocShell )
if ( pShell && !pShell->IsLoading() ) // #88438# don't call GetTitle while loading
aName = pShell->GetTitle();
pDrawLayer = new ScDrawLayer( this, aName );
- if (pLinkManager)
+ if (GetLinkManager())
pDrawLayer->SetLinkManager( pLinkManager );
// Drawing pages are accessed by table number, so they must also be present
@@ -245,7 +245,7 @@ void ScDocument::InitDrawLayer( SfxObjectShell* pDocShell )
pTab[nTab]->GetName(aTabName);
pDrawLayer->ScRenamePage( nTab, aTabName );
- pTab[nTab]->SetDrawPageSize(); // #54782# sofort die richtige Groesse
+ pTab[nTab]->SetDrawPageSize(false); // #54782# set the right size immediately
#if 0
ULONG nx = (ULONG) ((double) (MAXCOL+1) * STD_COL_WIDTH * HMM_PER_TWIPS );
ULONG ny = (ULONG) ((double) (MAXROW+1) * ScGlobal::nStdRowHeight * HMM_PER_TWIPS );
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index f80d1c85bb9b..b36808357473 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -84,7 +84,6 @@
#include "detdata.hxx"
#include "cell.hxx"
#include "dpobject.hxx"
-#include "indexmap.hxx"
#include "detfunc.hxx" // for UpdateAllComments
#include "scmod.hxx"
#include "dociter.hxx"
@@ -94,6 +93,9 @@
#include "postit.hxx"
#include "externalrefmgr.hxx"
#include "tabprotection.hxx"
+#include "clipparam.hxx"
+
+#include <map>
namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
@@ -115,13 +117,14 @@ struct ScLessDefaultAttr
typedef std::set<ScDefaultAttr, ScLessDefaultAttr> ScDefaultAttrSet;
-void ScDocument::MakeTable( SCTAB nTab )
+void ScDocument::MakeTable( SCTAB nTab,bool _bNeedsNameCheck )
{
if ( ValidTab(nTab) && !pTab[nTab] )
{
String aString = ScGlobal::GetRscString(STR_TABLE_DEF); //"Tabelle"
aString += String::CreateFromInt32(nTab+1);
- CreateValidTabName( aString ); // keine doppelten
+ if ( _bNeedsNameCheck )
+ CreateValidTabName( aString ); // keine doppelten
pTab[nTab] = new ScTable(this, nTab, aString);
++nMaxTableNumber;
@@ -245,7 +248,7 @@ BOOL ScDocument::ValidNewTabName( const String& rName ) const
{
String aOldName;
pTab[i]->GetName(aOldName);
- bValid = !ScGlobal::pTransliteration->isEqual( rName, aOldName );
+ bValid = !ScGlobal::GetpTransliteration()->isEqual( rName, aOldName );
}
return bValid;
}
@@ -331,11 +334,6 @@ BOOL ScDocument::InsertTab( SCTAB nPos, const String& rName,
pRangeName->UpdateTabRef( nPos, 1 );
pDBCollection->UpdateReference(
URM_INSDEL, 0,0,nPos, MAXCOL,MAXROW,MAXTAB, 0,0,1 );
-#if OLD_PIVOT_IMPLEMENTATION
- if (pPivotCollection)
- pPivotCollection->UpdateReference(
- URM_INSDEL, 0,0,nPos, MAXCOL,MAXROW,MAXTAB, 0,0,1 );
-#endif
if (pDPCollection)
pDPCollection->UpdateReference( URM_INSDEL, aRange, 0,0,1 );
if (pDetOpList)
@@ -429,11 +427,6 @@ BOOL ScDocument::DeleteTab( SCTAB nTab, ScDocument* pRefUndoDoc )
pRangeName->UpdateTabRef( nTab, 2 );
pDBCollection->UpdateReference(
URM_INSDEL, 0,0,nTab, MAXCOL,MAXROW,MAXTAB, 0,0,-1 );
-#if OLD_PIVOT_IMPLEMENTATION
- if (pPivotCollection)
- pPivotCollection->UpdateReference(
- URM_INSDEL, 0,0,nTab, MAXCOL,MAXROW,MAXTAB, 0,0,-1 );
-#endif
if (pDPCollection)
pDPCollection->UpdateReference( URM_INSDEL, aRange, 0,0,-1 );
if (pDetOpList)
@@ -507,7 +500,7 @@ BOOL ScDocument::RenameTab( SCTAB nTab, const String& rName, BOOL /* bUpdateRef
{
String aOldName;
pTab[i]->GetName(aOldName);
- bValid = !ScGlobal::pTransliteration->isEqual( rName, aOldName );
+ bValid = !ScGlobal::GetpTransliteration()->isEqual( rName, aOldName );
}
if (bValid)
{
@@ -540,6 +533,28 @@ BOOL ScDocument::IsVisible( SCTAB nTab ) const
}
+BOOL ScDocument::IsStreamValid( SCTAB nTab ) const
+{
+ if ( ValidTab(nTab) && pTab[nTab] )
+ return pTab[nTab]->IsStreamValid();
+
+ return FALSE;
+}
+
+
+void ScDocument::SetStreamValid( SCTAB nTab, BOOL bSet, BOOL bIgnoreLock )
+{
+ if ( ValidTab(nTab) && pTab[nTab] )
+ pTab[nTab]->SetStreamValid( bSet, bIgnoreLock );
+}
+
+
+void ScDocument::LockStreamValid( bool bLock )
+{
+ mbStreamValidLocked = bLock;
+}
+
+
BOOL ScDocument::IsPendingRowHeights( SCTAB nTab ) const
{
if ( ValidTab(nTab) && pTab[nTab] )
@@ -1387,7 +1402,7 @@ void ScDocument::AddUndoTab( SCTAB nTab1, SCTAB nTab2, BOOL bColInfo, BOOL bRowI
void ScDocument::SetCutMode( BOOL bVal )
{
if (bIsClip)
- bCutMode = bVal;
+ GetClipParam().mbCutMode = bVal;
else
{
DBG_ERROR("SetCutMode without bIsClip");
@@ -1398,7 +1413,7 @@ void ScDocument::SetCutMode( BOOL bVal )
BOOL ScDocument::IsCutMode()
{
if (bIsClip)
- return bCutMode;
+ return GetClipParam().mbCutMode;
else
{
DBG_ERROR("IsCutMode ohne bIsClip");
@@ -1510,70 +1525,50 @@ void ScDocument::UndoToDocument(const ScRange& rRange,
pDestDoc->SetAutoCalc( bOldAutoCalc );
}
-
-void ScDocument::CopyToClip(SCCOL nCol1, SCROW nRow1,
- SCCOL nCol2, SCROW nRow2,
- BOOL bCut, ScDocument* pClipDoc,
- BOOL bAllTabs, const ScMarkData* pMarks,
- BOOL bKeepScenarioFlags, BOOL bIncludeObjects, BOOL bCloneNoteCaptions)
+void ScDocument::CopyToClip(const ScClipParam& rClipParam,
+ ScDocument* pClipDoc, const ScMarkData* pMarks,
+ bool bAllTabs, bool bKeepScenarioFlags, bool bIncludeObjects, bool bCloneNoteCaptions)
{
DBG_ASSERT( bAllTabs || pMarks, "CopyToClip: ScMarkData fehlt" );
- if (!bIsClip)
+ if (bIsClip)
+ return;
+
+ if (!pClipDoc)
{
- PutInOrder( nCol1, nCol2 );
- PutInOrder( nRow1, nRow2 );
- if (!pClipDoc)
- {
- DBG_ERROR("CopyToClip: no ClipDoc");
- pClipDoc = SC_MOD()->GetClipDoc();
- }
+ DBG_ERROR("CopyToClip: no ClipDoc");
+ pClipDoc = SC_MOD()->GetClipDoc();
+ }
- pClipDoc->aDocName = aDocName;
- pClipDoc->aClipRange = ScRange( nCol1,nRow1,0, nCol2,nRow2,0 );
- pClipDoc->ResetClip( this, pMarks );
- USHORT i;
- SCTAB j;
-
- std::set<USHORT> aUsedNames; // indexes of named ranges that are used in the copied cells
- for (j = 0; j <= MAXTAB; j++)
- if (pTab[j] && pClipDoc->pTab[j])
- if ( bAllTabs || !pMarks || pMarks->GetTableSelect(j) )
- pTab[j]->FindRangeNamesInUse( nCol1, nRow1, nCol2, nRow2, aUsedNames );
-
- pClipDoc->pRangeName->FreeAll();
- for (i = 0; i < pRangeName->GetCount(); i++) //! DB-Bereiche Pivot-Bereiche auch !!!
- {
- USHORT nIndex = ((ScRangeData*)((*pRangeName)[i]))->GetIndex();
- bool bInUse = ( aUsedNames.find(nIndex) != aUsedNames.end() );
- if (bInUse)
- {
- ScRangeData* pData = new ScRangeData(*((*pRangeName)[i]));
- if (!pClipDoc->pRangeName->Insert(pData))
- delete pData;
- else
- pData->SetIndex(nIndex);
- }
- }
- for (j = 0; j <= MAXTAB; j++)
- if (pTab[j] && pClipDoc->pTab[j])
- if ( bAllTabs || !pMarks || pMarks->GetTableSelect(j) )
- {
- pTab[j]->CopyToClip(nCol1, nRow1, nCol2, nRow2, pClipDoc->pTab[j], bKeepScenarioFlags, bCloneNoteCaptions);
+ pClipDoc->aDocName = aDocName;
+ pClipDoc->SetClipParam(rClipParam);
+ pClipDoc->ResetClip(this, pMarks);
- if ( pDrawLayer && bIncludeObjects )
- {
- // also copy drawing objects
+ ScRange aClipRange = rClipParam.getWholeRange();
+ CopyRangeNamesToClip(pClipDoc, aClipRange, pMarks, bAllTabs);
- Rectangle aObjRect = GetMMRect( nCol1, nRow1, nCol2, nRow2, j );
- pDrawLayer->CopyToClip( pClipDoc, j, aObjRect );
- }
- }
+ for (SCTAB i = 0; i <= MAXTAB; ++i)
+ {
+ if (!pTab[i] || !pClipDoc->pTab[i])
+ continue;
+
+ if (pMarks && !pMarks->GetTableSelect(i))
+ continue;
- pClipDoc->bCutMode = bCut;
+ pTab[i]->CopyToClip(rClipParam.maRanges, pClipDoc->pTab[i], bKeepScenarioFlags, bCloneNoteCaptions);
+
+ if (pDrawLayer && bIncludeObjects)
+ {
+ // also copy drawing objects
+ Rectangle aObjRect = GetMMRect(
+ aClipRange.aStart.Col(), aClipRange.aStart.Row(), aClipRange.aEnd.Col(), aClipRange.aEnd.Row(), i);
+ pDrawLayer->CopyToClip(pClipDoc, i, aObjRect);
+ }
}
-}
+ // Make sure to mark overlapped cells.
+ pClipDoc->ExtendMerge(aClipRange, true);
+}
void ScDocument::CopyTabToClip(SCCOL nCol1, SCROW nRow1,
SCCOL nCol2, SCROW nRow2,
@@ -1589,14 +1584,16 @@ void ScDocument::CopyTabToClip(SCCOL nCol1, SCROW nRow1,
pClipDoc = SC_MOD()->GetClipDoc();
}
+ ScClipParam& rClipParam = pClipDoc->GetClipParam();
pClipDoc->aDocName = aDocName;
- pClipDoc->aClipRange = ScRange( nCol1,nRow1,0, nCol2,nRow2,0 );
+ rClipParam.maRanges.RemoveAll();
+ rClipParam.maRanges.Append(ScRange(nCol1, nRow1, 0, nCol2, nRow2, 0));
pClipDoc->ResetClip( this, nTab );
if (pTab[nTab] && pClipDoc->pTab[nTab])
pTab[nTab]->CopyToClip(nCol1, nRow1, nCol2, nRow2, pClipDoc->pTab[nTab], FALSE, TRUE);
- pClipDoc->bCutMode = FALSE;
+ pClipDoc->GetClipParam().mbCutMode = false;
}
}
@@ -1626,6 +1623,7 @@ void ScDocument::TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsL
// Daten
+ ScRange aClipRange = GetClipParam().getWholeRange();
if ( ValidRow(aClipRange.aEnd.Row()-aClipRange.aStart.Row()) )
{
for (SCTAB i=0; i<=MAXTAB; i++)
@@ -1654,10 +1652,8 @@ void ScDocument::TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsL
}
}
- pTransClip->aClipRange = ScRange( 0, 0, aClipRange.aStart.Tab(),
- static_cast<SCCOL>(aClipRange.aEnd.Row() - aClipRange.aStart.Row()),
- static_cast<SCROW>(aClipRange.aEnd.Col() - aClipRange.aStart.Col()),
- aClipRange.aEnd.Tab() );
+ pTransClip->SetClipParam(GetClipParam());
+ pTransClip->GetClipParam().transpose();
}
else
{
@@ -1666,9 +1662,184 @@ void ScDocument::TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsL
// Dies passiert erst beim Einfuegen...
- bCutMode = FALSE;
+ GetClipParam().mbCutMode = false;
+}
+
+void ScDocument::CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks, bool bAllTabs)
+{
+ std::set<USHORT> aUsedNames; // indexes of named ranges that are used in the copied cells
+ for (SCTAB i = 0; i <= MAXTAB; ++i)
+ if (pTab[i] && pClipDoc->pTab[i])
+ if ( bAllTabs || !pMarks || pMarks->GetTableSelect(i) )
+ pTab[i]->FindRangeNamesInUse(
+ rClipRange.aStart.Col(), rClipRange.aStart.Row(),
+ rClipRange.aEnd.Col(), rClipRange.aEnd.Row(), aUsedNames);
+
+ pClipDoc->pRangeName->FreeAll();
+ for (USHORT i = 0; i < pRangeName->GetCount(); i++) //! DB-Bereiche Pivot-Bereiche auch !!!
+ {
+ USHORT nIndex = ((ScRangeData*)((*pRangeName)[i]))->GetIndex();
+ bool bInUse = ( aUsedNames.find(nIndex) != aUsedNames.end() );
+ if (bInUse)
+ {
+ ScRangeData* pData = new ScRangeData(*((*pRangeName)[i]));
+ if (!pClipDoc->pRangeName->Insert(pData))
+ delete pData;
+ else
+ pData->SetIndex(nIndex);
+ }
+ }
+}
+
+ScDocument::NumFmtMergeHandler::NumFmtMergeHandler(ScDocument* pDoc, ScDocument* pSrcDoc) :
+ mpDoc(pDoc)
+{
+ mpDoc->MergeNumberFormatter(pSrcDoc);
+}
+
+ScDocument::NumFmtMergeHandler::~NumFmtMergeHandler()
+{
+ mpDoc->pFormatExchangeList = NULL;
+}
+
+void ScDocument::MergeNumberFormatter(ScDocument* pSrcDoc)
+{
+ SvNumberFormatter* pThisFormatter = xPoolHelper->GetFormTable();
+ SvNumberFormatter* pOtherFormatter = pSrcDoc->xPoolHelper->GetFormTable();
+ if (pOtherFormatter && pOtherFormatter != pThisFormatter)
+ {
+ SvNumberFormatterIndexTable* pExchangeList =
+ pThisFormatter->MergeFormatter(*(pOtherFormatter));
+ if (pExchangeList->Count() > 0)
+ pFormatExchangeList = pExchangeList;
+ }
+}
+
+void ScDocument::CopyRangeNamesFromClip(ScDocument* pClipDoc, ScClipRangeNameData& rRangeNames)
+{
+ sal_uInt16 nClipRangeNameCount = pClipDoc->pRangeName->GetCount();
+ ScClipRangeNameData aClipRangeNames;
+
+ // array containing range names which might need update of indices
+ aClipRangeNames.mpRangeNames.resize(nClipRangeNameCount, NULL);
+
+ for (sal_uInt16 i = 0; i < nClipRangeNameCount; ++i) //! DB-Bereiche Pivot-Bereiche auch
+ {
+ /* Copy only if the name doesn't exist in this document.
+ If it exists we use the already existing name instead,
+ another possibility could be to create new names if
+ documents differ.
+ A proper solution would ask the user how to proceed.
+ The adjustment of the indices in the formulas is done later.
+ */
+ ScRangeData* pClipRangeData = (*pClipDoc->pRangeName)[i];
+ USHORT k;
+ if ( pRangeName->SearchName( pClipRangeData->GetName(), k ) )
+ {
+ aClipRangeNames.mpRangeNames[i] = NULL; // range name not inserted
+ USHORT nOldIndex = pClipRangeData->GetIndex();
+ USHORT nNewIndex = ((*pRangeName)[k])->GetIndex();
+ aClipRangeNames.insert(nOldIndex, nNewIndex);
+ if ( !aClipRangeNames.mbReplace )
+ aClipRangeNames.mbReplace = ( nOldIndex != nNewIndex );
+ }
+ else
+ {
+ ScRangeData* pData = new ScRangeData( *pClipRangeData );
+ pData->SetDocument(this);
+ if ( pRangeName->FindIndex( pData->GetIndex() ) )
+ pData->SetIndex(0); // need new index, done in Insert
+ if ( pRangeName->Insert( pData ) )
+ {
+ aClipRangeNames.mpRangeNames[i] = pData;
+ USHORT nOldIndex = pClipRangeData->GetIndex();
+ USHORT nNewIndex = pData->GetIndex();
+ aClipRangeNames.insert(nOldIndex, nNewIndex);
+ if ( !aClipRangeNames.mbReplace )
+ aClipRangeNames.mbReplace = ( nOldIndex != nNewIndex );
+ }
+ else
+ { // must be an overflow
+ delete pData;
+ aClipRangeNames.mpRangeNames[i] = NULL;
+ aClipRangeNames.insert(pClipRangeData->GetIndex(), 0);
+ aClipRangeNames.mbReplace = true;
+ }
+ }
+ }
+ rRangeNames = aClipRangeNames;
+}
+
+void ScDocument::UpdateRangeNamesInFormulas(
+ ScClipRangeNameData& rRangeNames, const ScRangeList& rDestRanges, const ScMarkData& rMark,
+ SCCOL nXw, SCROW nYw)
+{
+ // nXw and nYw are the extra width and height of the destination range
+ // extended due to presence of merged cell(s).
+
+ if (!rRangeNames.mbReplace)
+ return;
+
+ // first update all inserted named formulas if they contain other
+ // range names and used indices changed
+ size_t nRangeNameCount = rRangeNames.mpRangeNames.size();
+ for (size_t i = 0; i < nRangeNameCount; ++i) //! DB-Bereiche Pivot-Bereiche auch
+ {
+ if ( rRangeNames.mpRangeNames[i] )
+ rRangeNames.mpRangeNames[i]->ReplaceRangeNamesInUse(rRangeNames.maRangeMap);
+ }
+ // then update the formulas, they might need just the updated range names
+ for (ULONG nRange = 0; nRange < rDestRanges.Count(); ++nRange)
+ {
+ const ScRange* pRange = rDestRanges.GetObject( nRange);
+ SCCOL nCol1 = pRange->aStart.Col();
+ SCROW nRow1 = pRange->aStart.Row();
+ SCCOL nCol2 = pRange->aEnd.Col();
+ SCROW nRow2 = pRange->aEnd.Row();
+
+ SCCOL nC1 = nCol1;
+ SCROW nR1 = nRow1;
+ SCCOL nC2 = nC1 + nXw;
+ if (nC2 > nCol2)
+ nC2 = nCol2;
+ SCROW nR2 = nR1 + nYw;
+ if (nR2 > nRow2)
+ nR2 = nRow2;
+ do
+ {
+ do
+ {
+ for (SCTAB k = 0; k <= MAXTAB; k++)
+ {
+ if ( pTab[k] && rMark.GetTableSelect(k) )
+ pTab[k]->ReplaceRangeNamesInUse(nC1, nR1,
+ nC2, nR2, rRangeNames.maRangeMap);
+ }
+ nC1 = nC2 + 1;
+ nC2 = Min((SCCOL)(nC1 + nXw), nCol2);
+ } while (nC1 <= nCol2);
+ nC1 = nCol1;
+ nC2 = nC1 + nXw;
+ if (nC2 > nCol2)
+ nC2 = nCol2;
+ nR1 = nR2 + 1;
+ nR2 = Min((SCROW)(nR1 + nYw), nRow2);
+ } while (nR1 <= nRow2);
+ }
+}
+
+ScClipParam& ScDocument::GetClipParam()
+{
+ if (!mpClipParam.get())
+ mpClipParam.reset(new ScClipParam);
+
+ return *mpClipParam;
}
+void ScDocument::SetClipParam(const ScClipParam& rParam)
+{
+ mpClipParam.reset(new ScClipParam(rParam));
+}
BOOL ScDocument::IsClipboardSource() const
{
@@ -1768,7 +1939,7 @@ void ScDocument::CopyBlockFromClip( SCCOL nCol1, SCROW nRow1,
&& ppClipTab[nClipTab + nFollow + 1] )
++nFollow;
- if ( pCBFCP->pClipDoc->bCutMode )
+ if ( pCBFCP->pClipDoc->GetClipParam().mbCutMode )
{
BOOL bOldInserting = IsInsertingFromOtherDoc();
SetInsertingFromOtherDoc( TRUE);
@@ -1810,7 +1981,9 @@ void ScDocument::CopyNonFilteredFromClip( SCCOL nCol1, SCROW nRow1,
pCBFCP->pClipDoc->GetRowFlagsArray( nFlagTab);
SCROW nSourceRow = rClipStartRow;
- SCROW nSourceEnd = pCBFCP->pClipDoc->aClipRange.aEnd.Row();
+ SCROW nSourceEnd = 0;
+ if (pCBFCP->pClipDoc->GetClipParam().maRanges.Count())
+ nSourceEnd = pCBFCP->pClipDoc->GetClipParam().maRanges.First()->aEnd.Row();
SCROW nDestRow = nRow1;
while ( nSourceRow <= nSourceEnd && nDestRow <= nRow2 )
@@ -1856,67 +2029,11 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
BOOL bOldAutoCalc = GetAutoCalc();
SetAutoCalc( FALSE ); // avoid multiple recalculations
- SvNumberFormatter* pThisFormatter = xPoolHelper->GetFormTable();
- SvNumberFormatter* pOtherFormatter = pClipDoc->xPoolHelper->GetFormTable();
- if (pOtherFormatter && pOtherFormatter != pThisFormatter)
- {
- SvNumberFormatterIndexTable* pExchangeList =
- pThisFormatter->MergeFormatter(*(pOtherFormatter));
- if (pExchangeList->Count() > 0)
- pFormatExchangeList = pExchangeList;
- }
+ NumFmtMergeHandler aNumFmtMergeHdl(this, pClipDoc);
- USHORT nClipRangeNames = pClipDoc->pRangeName->GetCount();
- // array containing range names which might need update of indices
- ScRangeData** pClipRangeNames = nClipRangeNames ? new ScRangeData* [nClipRangeNames] : NULL;
- // the index mapping thereof
- ScIndexMap aClipRangeMap( nClipRangeNames );
- BOOL bRangeNameReplace = FALSE;
+ ScClipRangeNameData aClipRangeNames;
+ CopyRangeNamesFromClip(pClipDoc, aClipRangeNames);
- for (USHORT i = 0; i < nClipRangeNames; i++) //! DB-Bereiche Pivot-Bereiche auch
- {
- /* Copy only if the name doesn't exist in this document.
- If it exists we use the already existing name instead,
- another possibility could be to create new names if
- documents differ.
- A proper solution would ask the user how to proceed.
- The adjustment of the indices in the formulas is done later.
- */
- ScRangeData* pClipRangeData = (*pClipDoc->pRangeName)[i];
- USHORT k;
- if ( pRangeName->SearchName( pClipRangeData->GetName(), k ) )
- {
- pClipRangeNames[i] = NULL; // range name not inserted
- USHORT nOldIndex = pClipRangeData->GetIndex();
- USHORT nNewIndex = ((*pRangeName)[k])->GetIndex();
- aClipRangeMap.SetPair( i, nOldIndex, nNewIndex );
- if ( !bRangeNameReplace )
- bRangeNameReplace = ( nOldIndex != nNewIndex );
- }
- else
- {
- ScRangeData* pData = new ScRangeData( *pClipRangeData );
- pData->SetDocument(this);
- if ( pRangeName->FindIndex( pData->GetIndex() ) )
- pData->SetIndex(0); // need new index, done in Insert
- if ( pRangeName->Insert( pData ) )
- {
- pClipRangeNames[i] = pData;
- USHORT nOldIndex = pClipRangeData->GetIndex();
- USHORT nNewIndex = pData->GetIndex();
- aClipRangeMap.SetPair( i, nOldIndex, nNewIndex );
- if ( !bRangeNameReplace )
- bRangeNameReplace = ( nOldIndex != nNewIndex );
- }
- else
- { // must be an overflow
- delete pData;
- pClipRangeNames[i] = NULL;
- aClipRangeMap.SetPair( i, pClipRangeData->GetIndex(), 0 );
- bRangeNameReplace = TRUE;
- }
- }
- }
SCCOL nAllCol1 = rDestRange.aStart.Col();
SCROW nAllRow1 = rDestRange.aStart.Row();
SCCOL nAllCol2 = rDestRange.aEnd.Col();
@@ -1924,17 +2041,18 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
SCCOL nXw = 0;
SCROW nYw = 0;
+ ScRange aClipRange = pClipDoc->GetClipParam().getWholeRange();
for (SCTAB nTab = 0; nTab <= MAXTAB; nTab++) // find largest merge overlap
if (pClipDoc->pTab[nTab]) // all sheets of the clipboard content
{
- SCCOL nThisEndX = pClipDoc->aClipRange.aEnd.Col();
- SCROW nThisEndY = pClipDoc->aClipRange.aEnd.Row();
- pClipDoc->ExtendMerge( pClipDoc->aClipRange.aStart.Col(),
- pClipDoc->aClipRange.aStart.Row(),
+ SCCOL nThisEndX = aClipRange.aEnd.Col();
+ SCROW nThisEndY = aClipRange.aEnd.Row();
+ pClipDoc->ExtendMerge( aClipRange.aStart.Col(),
+ aClipRange.aStart.Row(),
nThisEndX, nThisEndY, nTab );
// only extra value from ExtendMerge
- nThisEndX = sal::static_int_cast<SCCOL>( nThisEndX - pClipDoc->aClipRange.aEnd.Col() );
- nThisEndY = sal::static_int_cast<SCROW>( nThisEndY - pClipDoc->aClipRange.aEnd.Row() );
+ nThisEndX = sal::static_int_cast<SCCOL>( nThisEndX - aClipRange.aEnd.Col() );
+ nThisEndY = sal::static_int_cast<SCROW>( nThisEndY - aClipRange.aEnd.Row() );
if ( nThisEndX > nXw )
nXw = nThisEndX;
if ( nThisEndY > nYw )
@@ -2001,10 +2119,10 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
if (bDoDouble)
ScColumn::bDoubleAlloc = TRUE;
- SCCOL nClipStartCol = pClipDoc->aClipRange.aStart.Col();
- SCROW nClipStartRow = pClipDoc->aClipRange.aStart.Row();
+ SCCOL nClipStartCol = aClipRange.aStart.Col();
+ SCROW nClipStartRow = aClipRange.aStart.Row();
// WaE: commented because unused: SCCOL nClipEndCol = pClipDoc->aClipRange.aEnd.Col();
- SCROW nClipEndRow = pClipDoc->aClipRange.aEnd.Row();
+ SCROW nClipEndRow = aClipRange.aEnd.Row();
for (ULONG nRange = 0; nRange < pDestRanges->Count(); ++nRange)
{
const ScRange* pRange = pDestRanges->GetObject( nRange);
@@ -2055,7 +2173,7 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
nC2 = Min((SCCOL)(nC1 + nXw), nCol2);
} while (nC1 <= nCol2);
if (nClipStartRow > nClipEndRow)
- nClipStartRow = pClipDoc->aClipRange.aStart.Row();
+ nClipStartRow = aClipRange.aStart.Row();
nC1 = nCol1;
nC2 = nC1 + nXw;
if (nC2 > nCol2)
@@ -2072,75 +2190,168 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar
pTab[k]->DecRecalcLevel();
bInsertingFromOtherDoc = FALSE;
- pFormatExchangeList = NULL;
- if ( bRangeNameReplace )
- {
- // first update all inserted named formulas if they contain other
- // range names and used indices changed
- for (USHORT i = 0; i < nClipRangeNames; i++) //! DB-Bereiche Pivot-Bereiche auch
- {
- if ( pClipRangeNames[i] )
- pClipRangeNames[i]->ReplaceRangeNamesInUse( aClipRangeMap );
- }
- // then update the formulas, they might need the just updated range names
- for (ULONG nRange = 0; nRange < pDestRanges->Count(); ++nRange)
- {
- const ScRange* pRange = pDestRanges->GetObject( nRange);
- SCCOL nCol1 = pRange->aStart.Col();
- SCROW nRow1 = pRange->aStart.Row();
- SCCOL nCol2 = pRange->aEnd.Col();
- SCROW nRow2 = pRange->aEnd.Row();
-
- SCCOL nC1 = nCol1;
- SCROW nR1 = nRow1;
- SCCOL nC2 = nC1 + nXw;
- if (nC2 > nCol2)
- nC2 = nCol2;
- SCROW nR2 = nR1 + nYw;
- if (nR2 > nRow2)
- nR2 = nRow2;
- do
- {
- do
- {
- for (SCTAB k = 0; k <= MAXTAB; k++)
- {
- if ( pTab[k] && rMark.GetTableSelect(k) )
- pTab[k]->ReplaceRangeNamesInUse(nC1, nR1,
- nC2, nR2, aClipRangeMap );
- }
- nC1 = nC2 + 1;
- nC2 = Min((SCCOL)(nC1 + nXw), nCol2);
- } while (nC1 <= nCol2);
- nC1 = nCol1;
- nC2 = nC1 + nXw;
- if (nC2 > nCol2)
- nC2 = nCol2;
- nR1 = nR2 + 1;
- nR2 = Min((SCROW)(nR1 + nYw), nRow2);
- } while (nR1 <= nRow2);
- }
- }
- if ( pClipRangeNames )
- delete [] pClipRangeNames;
+
+ UpdateRangeNamesInFormulas(aClipRangeNames, *pDestRanges, rMark, nXw, nYw);
+
// Listener aufbauen nachdem alles inserted wurde
StartListeningFromClip( nAllCol1, nAllRow1, nAllCol2, nAllRow2, rMark, nInsFlag );
// nachdem alle Listener aufgebaut wurden, kann gebroadcastet werden
BroadcastFromClip( nAllCol1, nAllRow1, nAllCol2, nAllRow2, rMark, nInsFlag );
if (bResetCut)
- pClipDoc->bCutMode = FALSE;
+ pClipDoc->GetClipParam().mbCutMode = false;
SetAutoCalc( bOldAutoCalc );
}
}
}
+static SCROW lcl_getLastNonFilteredRow(
+ const ScBitMaskCompressedArray<SCROW, BYTE>& rFlags, SCROW nBegRow, SCROW nEndRow,
+ SCROW nRowCount)
+{
+ SCROW nFilteredRow = rFlags.GetFirstForCondition(
+ nBegRow, nEndRow, CR_FILTERED, CR_FILTERED);
+
+ SCROW nRow = nFilteredRow - 1;
+ if (nRow - nBegRow + 1 > nRowCount)
+ // make sure the row range stays within the data size.
+ nRow = nBegRow + nRowCount - 1;
+
+ return nRow;
+}
+
+void ScDocument::CopyMultiRangeFromClip(
+ const ScAddress& rDestPos, const ScMarkData& rMark, sal_uInt16 nInsFlag, ScDocument* pClipDoc,
+ bool bResetCut, bool bAsLink, bool /*bIncludeFiltered*/, bool bSkipAttrForEmpty)
+{
+ if (bIsClip)
+ return;
+
+ if (!pClipDoc->bIsClip || !pClipDoc->GetTableCount())
+ // There is nothing in the clip doc to copy.
+ return;
+
+ BOOL bOldAutoCalc = GetAutoCalc();
+ SetAutoCalc( FALSE ); // avoid multiple recalculations
+
+ NumFmtMergeHandler aNumFmtMergeHdl(this, pClipDoc);
+
+ ScClipRangeNameData aClipRangeNames;
+ CopyRangeNamesFromClip(pClipDoc, aClipRangeNames);
+
+ SCCOL nCol1 = rDestPos.Col();
+ SCROW nRow1 = rDestPos.Row();
+ ScClipParam& rClipParam = pClipDoc->GetClipParam();
+
+ ScCopyBlockFromClipParams aCBFCP;
+ aCBFCP.pRefUndoDoc = NULL;
+ aCBFCP.pClipDoc = pClipDoc;
+ aCBFCP.nInsFlag = nInsFlag;
+ aCBFCP.bAsLink = bAsLink;
+ aCBFCP.bSkipAttrForEmpty = bSkipAttrForEmpty;
+ aCBFCP.nTabStart = MAXTAB;
+ aCBFCP.nTabEnd = 0;
+
+ for (SCTAB j = 0; j <= MAXTAB; ++j)
+ {
+ if (pTab[j] && rMark.GetTableSelect(j))
+ {
+ if ( j < aCBFCP.nTabStart )
+ aCBFCP.nTabStart = j;
+ aCBFCP.nTabEnd = j;
+ pTab[j]->IncRecalcLevel();
+ }
+ }
+
+ ScRange aDestRange;
+ rMark.GetMarkArea(aDestRange);
+ SCROW nLastMarkedRow = aDestRange.aEnd.Row();
+
+ bInsertingFromOtherDoc = TRUE; // kein Broadcast/Listener aufbauen bei Insert
+
+ SCROW nBegRow = nRow1;
+ sal_uInt16 nDelFlag = IDF_CONTENTS;
+ const ScBitMaskCompressedArray<SCROW, BYTE>& rFlags = GetRowFlagsArray(aCBFCP.nTabStart);
+
+ for (ScRange* p = rClipParam.maRanges.First(); p; p = rClipParam.maRanges.Next())
+ {
+ // The begin row must not be filtered.
+
+ SCROW nRowCount = p->aEnd.Row() - p->aStart.Row() + 1;
+
+ SCsCOL nDx = static_cast<SCsCOL>(nCol1 - p->aStart.Col());
+ SCsROW nDy = static_cast<SCsROW>(nBegRow - p->aStart.Row());
+ SCCOL nCol2 = nCol1 + p->aEnd.Col() - p->aStart.Col();
+
+ SCROW nEndRow = lcl_getLastNonFilteredRow(rFlags, nBegRow, nLastMarkedRow, nRowCount);
+
+ if (!bSkipAttrForEmpty)
+ DeleteArea(nCol1, nBegRow, nCol2, nEndRow, rMark, nDelFlag);
+
+ CopyBlockFromClip(nCol1, nBegRow, nCol2, nEndRow, rMark, nDx, nDy, &aCBFCP);
+ nRowCount -= nEndRow - nBegRow + 1;
+
+ while (nRowCount > 0)
+ {
+ // Get the first non-filtered row.
+ SCROW nNonFilteredRow = rFlags.GetFirstForCondition(nEndRow+1, nLastMarkedRow, CR_FILTERED, 0);
+ if (nNonFilteredRow > nLastMarkedRow)
+ return;
+
+ SCROW nRowsSkipped = nNonFilteredRow - nEndRow - 1;
+ nDy += nRowsSkipped;
+
+ nBegRow = nNonFilteredRow;
+ nEndRow = lcl_getLastNonFilteredRow(rFlags, nBegRow, nLastMarkedRow, nRowCount);
+
+ if (!bSkipAttrForEmpty)
+ DeleteArea(nCol1, nBegRow, nCol2, nEndRow, rMark, nDelFlag);
+
+ CopyBlockFromClip(nCol1, nBegRow, nCol2, nEndRow, rMark, nDx, nDy, &aCBFCP);
+ nRowCount -= nEndRow - nBegRow + 1;
+ }
+
+ if (rClipParam.meDirection == ScClipParam::Row)
+ // Begin row for the next range being pasted.
+ nBegRow = rFlags.GetFirstForCondition(nEndRow+1, nLastMarkedRow, CR_FILTERED, 0);
+ else
+ nBegRow = nRow1;
+
+ if (rClipParam.meDirection == ScClipParam::Column)
+ nCol1 += p->aEnd.Col() - p->aStart.Col() + 1;
+ }
+
+ for (SCTAB i = 0; i <= MAXTAB; i++)
+ if (pTab[i] && rMark.GetTableSelect(i))
+ pTab[i]->DecRecalcLevel();
+
+ bInsertingFromOtherDoc = FALSE;
+
+ ScRangeList aRanges;
+ aRanges.Append(aDestRange);
+ SCCOL nCols = aDestRange.aEnd.Col() - aDestRange.aStart.Col() + 1;
+ SCROW nRows = aDestRange.aEnd.Row() - aDestRange.aStart.Row() + 1;
+ UpdateRangeNamesInFormulas(aClipRangeNames, aRanges, rMark, nCols-1, nRows-1);
+
+ // Listener aufbauen nachdem alles inserted wurde
+ StartListeningFromClip(aDestRange.aStart.Col(), aDestRange.aStart.Row(),
+ aDestRange.aEnd.Col(), aDestRange.aEnd.Row(), rMark, nInsFlag );
+ // nachdem alle Listener aufgebaut wurden, kann gebroadcastet werden
+ BroadcastFromClip(aDestRange.aStart.Col(), aDestRange.aStart.Row(),
+ aDestRange.aEnd.Col(), aDestRange.aEnd.Row(), rMark, nInsFlag );
+
+ if (bResetCut)
+ pClipDoc->GetClipParam().mbCutMode = false;
+ SetAutoCalc( bOldAutoCalc );
+}
void ScDocument::SetClipArea( const ScRange& rArea, BOOL bCut )
{
if (bIsClip)
{
- aClipRange = rArea;
- bCutMode = bCut;
+ ScClipParam& rClipParam = GetClipParam();
+ rClipParam.maRanges.RemoveAll();
+ rClipParam.maRanges.Append(rArea);
+ rClipParam.mbCutMode = bCut;
}
else
{
@@ -2151,33 +2362,53 @@ void ScDocument::SetClipArea( const ScRange& rArea, BOOL bCut )
void ScDocument::GetClipArea(SCCOL& nClipX, SCROW& nClipY, BOOL bIncludeFiltered)
{
- if (bIsClip)
+ if (!bIsClip)
{
- nClipX = aClipRange.aEnd.Col() - aClipRange.aStart.Col();
+ DBG_ERROR("GetClipArea: kein Clip");
+ return;
+ }
- if ( bIncludeFiltered )
- nClipY = aClipRange.aEnd.Row() - aClipRange.aStart.Row();
- else
- {
- // count non-filtered rows
- // count on first used table in clipboard
- SCTAB nCountTab = 0;
- while ( nCountTab < MAXTAB && !pTab[nCountTab] )
- ++nCountTab;
-
- SCROW nResult = GetRowFlagsArray( nCountTab).CountForCondition(
- aClipRange.aStart.Row(), aClipRange.aEnd.Row(),
- CR_FILTERED, 0);
-
- if ( nResult > 0 )
- nClipY = nResult - 1;
- else
- nClipY = 0; // always return at least 1 row
- }
+ ScRangeList& rClipRanges = GetClipParam().maRanges;
+ if (!rClipRanges.Count())
+ // No clip range. Bail out.
+ return;
+
+ ScRangePtr p = rClipRanges.First();
+ SCCOL nStartCol = p->aStart.Col();
+ SCCOL nEndCol = p->aEnd.Col();
+ SCROW nStartRow = p->aStart.Row();
+ SCROW nEndRow = p->aEnd.Row();
+ for (p = rClipRanges.Next(); p; p = rClipRanges.Next())
+ {
+ if (p->aStart.Col() < nStartCol)
+ nStartCol = p->aStart.Col();
+ if (p->aStart.Row() < nStartRow)
+ nStartRow = p->aStart.Row();
+ if (p->aEnd.Col() > nEndCol)
+ nEndCol = p->aEnd.Col();
+ if (p->aEnd.Row() < nEndRow)
+ nEndRow = p->aEnd.Row();
}
+
+ nClipX = nEndCol - nStartCol;
+
+ if ( bIncludeFiltered )
+ nClipY = nEndRow - nStartRow;
else
{
- DBG_ERROR("GetClipArea: kein Clip");
+ // count non-filtered rows
+ // count on first used table in clipboard
+ SCTAB nCountTab = 0;
+ while ( nCountTab < MAXTAB && !pTab[nCountTab] )
+ ++nCountTab;
+
+ SCROW nResult = GetRowFlagsArray( nCountTab).CountForCondition(
+ nStartRow, nEndRow, CR_FILTERED, 0);
+
+ if ( nResult > 0 )
+ nClipY = nResult - 1;
+ else
+ nClipY = 0; // always return at least 1 row
}
}
@@ -2186,8 +2417,12 @@ void ScDocument::GetClipStart(SCCOL& nClipX, SCROW& nClipY)
{
if (bIsClip)
{
- nClipX = aClipRange.aStart.Col();
- nClipY = aClipRange.aStart.Row();
+ ScRangeList& rClipRanges = GetClipParam().maRanges;
+ if (rClipRanges.Count())
+ {
+ nClipX = rClipRanges.First()->aStart.Col();
+ nClipY = rClipRanges.First()->aStart.Row();
+ }
}
else
{
@@ -2203,8 +2438,12 @@ BOOL ScDocument::HasClipFilteredRows()
while ( nCountTab < MAXTAB && !pTab[nCountTab] )
++nCountTab;
- return GetRowFlagsArray( nCountTab).HasCondition( aClipRange.aStart.Row(),
- aClipRange.aEnd.Row(), CR_FILTERED, CR_FILTERED);
+ ScRangeList& rClipRanges = GetClipParam().maRanges;
+ if (!rClipRanges.Count())
+ return false;
+
+ return GetRowFlagsArray( nCountTab).HasCondition( rClipRanges.First()->aStart.Row(),
+ rClipRanges.First()->aEnd.Row(), CR_FILTERED, CR_FILTERED);
}
@@ -2674,6 +2913,26 @@ void ScDocument::SetTableOpDirty( const ScRange& rRange )
}
+void ScDocument::InterpretDirtyCells( const ScRangeList& rRanges )
+{
+ ULONG nRangeCount = rRanges.Count();
+ for (ULONG nPos=0; nPos<nRangeCount; nPos++)
+ {
+ ScCellIterator aIter( this, *rRanges.GetObject(nPos) );
+ ScBaseCell* pCell = aIter.GetFirst();
+ while (pCell)
+ {
+ if (pCell->GetCellType() == CELLTYPE_FORMULA)
+ {
+ if ( static_cast<ScFormulaCell*>(pCell)->GetDirty() && GetAutoCalc() )
+ static_cast<ScFormulaCell*>(pCell)->Interpret();
+ }
+ pCell = aIter.GetNext();
+ }
+ }
+}
+
+
void ScDocument::AddTableOpFormulaCell( ScFormulaCell* pCell )
{
ScInterpreterTableOpParams* p = aTableOpList.Last();
@@ -4581,11 +4840,11 @@ void ScDocument::AddPrintRange( SCTAB nTab, const ScRange& rNew )
}
-void ScDocument::SetPrintRange( SCTAB nTab, const ScRange& rNew )
-{
- if (ValidTab(nTab) && pTab[nTab])
- pTab[nTab]->SetPrintRange( rNew );
-}
+//UNUSED2009-05 void ScDocument::SetPrintRange( SCTAB nTab, const ScRange& rNew )
+//UNUSED2009-05 {
+//UNUSED2009-05 if (ValidTab(nTab) && pTab[nTab])
+//UNUSED2009-05 pTab[nTab]->SetPrintRange( rNew );
+//UNUSED2009-05 }
void ScDocument::SetPrintEntireSheet( SCTAB nTab )
diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpcachetable.cxx
index 2a1b4481ccaa..dc9b6450ac75 100644
--- a/sc/source/core/data/dpcachetable.cxx
+++ b/sc/source/core/data/dpcachetable.cxx
@@ -522,23 +522,6 @@ const String* ScDPCacheTable::getFieldName(sal_Int32 nIndex) const
return mrSharedString.getString(maHeader[nIndex]);
}
-sal_Int32 ScDPCacheTable::getFieldIndex(const String& rStr) const
-{
- sal_Int32 nStrId = mrSharedString.getStringId(rStr);
- if (nStrId < 0)
- // string not found.
- return nStrId;
-
- sal_Int32 n = maHeader.size();
- for (sal_Int32 i = 0; i < n; ++i)
- {
- if (maHeader[i] == nStrId)
- return i;
- }
-
- return -1;
-}
-
const TypedScStrCollection& ScDPCacheTable::getFieldEntries(sal_Int32 nIndex) const
{
if (nIndex < 0 || static_cast<size_t>(nIndex) >= maFieldEntries.size())
@@ -638,14 +621,6 @@ void ScDPCacheTable::clear()
maRowsVisible.clear();
}
-void ScDPCacheTable::swap(ScDPCacheTable& rOther)
-{
- maTable.swap(rOther.maTable);
- maHeader.swap(rOther.maHeader);
- maFieldEntries.swap(rOther.maFieldEntries);
- maRowsVisible.swap(rOther.maRowsVisible);
-}
-
bool ScDPCacheTable::empty() const
{
return maTable.empty();
diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx
index a92d1681ec0e..a2d21079826d 100644
--- a/sc/source/core/data/dpgroup.cxx
+++ b/sc/source/core/data/dpgroup.cxx
@@ -250,7 +250,7 @@ String lcl_GetDateGroupName( sal_Int32 nDatePart, sal_Int32 nValue, SvNumberForm
break;
case com::sun::star::sheet::DataPilotFieldGroupBy::MONTHS:
//! cache getMonths() result?
- aRet = ScGlobal::pCalendar->getDisplayName(
+ aRet = ScGlobal::GetCalendar()->getDisplayName(
::com::sun::star::i18n::CalendarDisplayIndex::MONTH,
sal_Int16(nValue-1), 0 ); // 0-based, get short name
break;
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index 813a3381c901..787875fcb5ff 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -1098,7 +1098,7 @@ bool lcl_IsAtStart( const String& rList, const String& rSearch, sal_Int32& rMatc
}
}
- if ( bParsed && ScGlobal::pTransliteration->isEqual( aDequoted, rSearch ) )
+ if ( bParsed && ScGlobal::GetpTransliteration()->isEqual( aDequoted, rSearch ) )
{
nMatchList = nQuoteEnd; // match count in the list string, including quotes
nMatchSearch = rSearch.Len();
@@ -1107,7 +1107,7 @@ bool lcl_IsAtStart( const String& rList, const String& rSearch, sal_Int32& rMatc
else
{
// otherwise look for search string at the start of rList
- ScGlobal::pTransliteration->equals( rList, 0, rList.Len(), nMatchList,
+ ScGlobal::GetpTransliteration()->equals( rList, 0, rList.Len(), nMatchList,
rSearch, 0, rSearch.Len(), nMatchSearch );
}
@@ -2122,50 +2122,6 @@ void ScDPObject::ConvertOrientation( ScDPSaveData& rSaveData,
}
}
-#if OLD_PIVOT_IMPLEMENTATION
-void ScDPObject::InitFromOldPivot( const ScPivot& rOld, ScDocument* pDocP, BOOL bSetSource )
-{
- ScDPSaveData aSaveData;
-
- ScPivotParam aParam;
- ScQueryParam aQuery;
- ScArea aArea;
- rOld.GetParam( aParam, aQuery, aArea );
-
- ConvertOrientation( aSaveData, aParam.aPageArr, aParam.nPageCount,
- sheet::DataPilotFieldOrientation_PAGE, pDocP, aArea.nRowStart, aArea.nTab,
- uno::Reference<sheet::XDimensionsSupplier>(), TRUE );
- ConvertOrientation( aSaveData, aParam.aColArr, aParam.nColCount,
- sheet::DataPilotFieldOrientation_COLUMN, pDocP, aArea.nRowStart, aArea.nTab,
- uno::Reference<sheet::XDimensionsSupplier>(), TRUE );
- ConvertOrientation( aSaveData, aParam.aRowArr, aParam.nRowCount,
- sheet::DataPilotFieldOrientation_ROW, pDocP, aArea.nRowStart, aArea.nTab,
- uno::Reference<sheet::XDimensionsSupplier>(), TRUE );
- ConvertOrientation( aSaveData, aParam.aDataArr, aParam.nDataCount,
- sheet::DataPilotFieldOrientation_DATA, pDocP, aArea.nRowStart, aArea.nTab,
- uno::Reference<sheet::XDimensionsSupplier>(), TRUE,
- aParam.aColArr, aParam.nColCount, aParam.aRowArr, aParam.nRowCount );
-
- aSaveData.SetIgnoreEmptyRows( rOld.GetIgnoreEmpty() );
- aSaveData.SetRepeatIfEmpty( rOld.GetDetectCat() );
- aSaveData.SetColumnGrand( rOld.GetMakeTotalCol() );
- aSaveData.SetRowGrand( rOld.GetMakeTotalRow() );
-
- SetSaveData( aSaveData );
- if (bSetSource)
- {
- ScSheetSourceDesc aDesc;
- aDesc.aSourceRange = rOld.GetSrcArea();
- rOld.GetQuery( aDesc.aQueryParam );
- SetSheetDesc( aDesc );
- }
- SetOutRange( rOld.GetDestArea() );
-
- aTableName = rOld.GetName();
- aTableTag = rOld.GetTag();
-}
-#endif
-
// -----------------------------------------------------------------------
// static
@@ -2506,26 +2462,3 @@ void ScDPCollection::clearCacheCellPool()
for_each(ps.begin(), ps.end(), DeleteCacheCells());
}
-//------------------------------------------------------------------------
-// convert old pivot tables into new datapilot tables
-
-#if OLD_PIVOT_IMPLEMENTATION
-void ScDPCollection::ConvertOldTables( ScPivotCollection& rOldColl )
-{
- // convert old pivot tables into new datapilot tables
-
- USHORT nOldCount = rOldColl.GetCount();
- for (USHORT i=0; i<nOldCount; i++)
- {
- ScDPObject* pNewObj = new ScDPObject(pDoc);
- pNewObj->InitFromOldPivot( *(rOldColl)[i], pDoc, TRUE );
- pNewObj->SetAlive( TRUE );
- Insert( pNewObj );
- }
- rOldColl.FreeAll();
-}
-#endif
-
-
-
-
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index 63acede160c9..d1fad68f16a2 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -1192,20 +1192,20 @@ bool ScDPOutput::GetDataResultPositionData(vector<sheet::DataPilotFieldFilter>&
bool lcl_IsNamedDataField( const ScDPGetPivotDataField& rTarget, const String& rSourceName, const String& rGivenName )
{
// match one of the names, ignoring case
- return ScGlobal::pTransliteration->isEqual( rTarget.maFieldName, rSourceName ) ||
- ScGlobal::pTransliteration->isEqual( rTarget.maFieldName, rGivenName );
+ return ScGlobal::GetpTransliteration()->isEqual( rTarget.maFieldName, rSourceName ) ||
+ ScGlobal::GetpTransliteration()->isEqual( rTarget.maFieldName, rGivenName );
}
bool lcl_IsNamedCategoryField( const ScDPGetPivotDataField& rFilter, const ScDPOutLevelData& rField )
{
//! name from source instead of caption?
- return ScGlobal::pTransliteration->isEqual( rFilter.maFieldName, rField.aCaption );
+ return ScGlobal::GetpTransliteration()->isEqual( rFilter.maFieldName, rField.aCaption );
}
bool lcl_IsCondition( const sheet::MemberResult& rResultEntry, const ScDPGetPivotDataField& rFilter )
{
//! handle numeric conditions?
- return ScGlobal::pTransliteration->isEqual( rResultEntry.Name, rFilter.maValStr );
+ return ScGlobal::GetpTransliteration()->isEqual( rResultEntry.Name, rFilter.maValStr );
}
bool lcl_CheckPageField( const ScDPOutLevelData& rField,
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index f4180312ce0d..62798076afb9 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -97,20 +97,6 @@ void lcl_SetBoolProperty( const uno::Reference<beans::XPropertySet>& xProp,
// -----------------------------------------------------------------------
-void lcl_SkipExtra( SvStream& rStream )
-{
- USHORT nExtra;
- rStream >> nExtra;
- if ( nExtra )
- {
- rStream.SeekRel( nExtra );
- if ( rStream.GetError() == SVSTREAM_OK )
- rStream.SetError( SCWARN_IMPORT_INFOLOST );
- }
-}
-
-// -----------------------------------------------------------------------
-
ScDPSaveMember::ScDPSaveMember(const String& rName) :
aName( rName ),
nVisibleMode( SC_DPSAVEMODE_DONTKNOW ),
@@ -352,17 +338,6 @@ void ScDPSaveDimension::SetOrientation(USHORT nNew)
nOrientation = nNew;
}
-void ScDPSaveDimension::SetSubTotals(BOOL bSet)
-{
- if (bSet)
- {
- USHORT nFunc = sheet::GeneralFunction_AUTO;
- SetSubTotals( 1, &nFunc );
- }
- else
- SetSubTotals( 0, NULL );
-}
-
void ScDPSaveDimension::SetSubTotals(long nCount, const USHORT* pFuncs)
{
if (pSubTotalFuncs)
diff --git a/sc/source/core/data/dpsdbtab.cxx b/sc/source/core/data/dpsdbtab.cxx
index 777ea3f38935..cfc98af5af99 100644
--- a/sc/source/core/data/dpsdbtab.cxx
+++ b/sc/source/core/data/dpsdbtab.cxx
@@ -231,15 +231,6 @@ long ScDatabaseDPData::GetColumnCount()
return pImpl->nColCount;
}
-void lcl_Reset( const uno::Reference<sdbc::XRowSet>& xRowSet )
- throw(sdbc::SQLException, uno::RuntimeException)
-{
- // isBeforeFirst / beforeFirst is not always available
- //! query if it is allowed
-
- xRowSet->execute(); // restart
-}
-
const TypedScStrCollection& ScDatabaseDPData::GetColumnEntries(long nColumn)
{
CreateCacheTable();
diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx
index 1e8c5627ee19..7956b68ad03f 100644
--- a/sc/source/core/data/dpshttab.cxx
+++ b/sc/source/core/data/dpshttab.cxx
@@ -140,12 +140,6 @@ long ScSheetDPData::GetColumnCount()
return pImpl->aCacheTable.getColSize();
}
-BOOL lcl_HasQuery( const ScQueryParam& rParam )
-{
- return rParam.GetEntryCount() > 0 &&
- rParam.GetEntry(0).bDoQuery;
-}
-
const TypedScStrCollection& ScSheetDPData::GetColumnEntries(long nColumn)
{
DBG_ASSERT(nColumn>=0 && nColumn < pImpl->aCacheTable.getColSize(), "ScSheetDPData: wrong column");
diff --git a/sc/source/core/data/dptabdat.cxx b/sc/source/core/data/dptabdat.cxx
index a58241cea416..41e44f84b647 100644
--- a/sc/source/core/data/dptabdat.cxx
+++ b/sc/source/core/data/dptabdat.cxx
@@ -66,7 +66,7 @@ BOOL ScDPItemData::IsCaseInsEqual( const ScDPItemData& r ) const
//! inline?
return bHasValue ? ( r.bHasValue && rtl::math::approxEqual( fValue, r.fValue ) ) :
( !r.bHasValue &&
- ScGlobal::pTransliteration->isEqual( aString, r.aString ) );
+ ScGlobal::GetpTransliteration()->isEqual( aString, r.aString ) );
}
size_t ScDPItemData::Hash() const
@@ -115,7 +115,7 @@ sal_Int32 ScDPItemData::Compare( const ScDPItemData& rA,
else if ( rB.bHasValue )
return 1; // values first
else
- return ScGlobal::pCollator->compareString( rA.aString, rB.aString );
+ return ScGlobal::GetCollator()->compareString( rA.aString, rB.aString );
}
// ---------------------------------------------------------------------------
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index 5fa5c393df37..3e9a7586fd1a 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -991,16 +991,16 @@ void ScDPSource::CreateRes_Impl()
}
}
-void ScDPSource::DumpState( ScDocument* pDoc, const ScAddress& rPos )
-{
- CreateRes_Impl();
-
- ScAddress aDocPos( rPos );
-
- if (pColResRoot->GetChildDimension())
- pColResRoot->GetChildDimension()->DumpState( NULL, pDoc, aDocPos );
- pRowResRoot->DumpState( pColResRoot, pDoc, aDocPos );
-}
+//UNUSED2009-05 void ScDPSource::DumpState( ScDocument* pDoc, const ScAddress& rPos )
+//UNUSED2009-05 {
+//UNUSED2009-05 CreateRes_Impl();
+//UNUSED2009-05
+//UNUSED2009-05 ScAddress aDocPos( rPos );
+//UNUSED2009-05
+//UNUSED2009-05 if (pColResRoot->GetChildDimension())
+//UNUSED2009-05 pColResRoot->GetChildDimension()->DumpState( NULL, pDoc, aDocPos );
+//UNUSED2009-05 pRowResRoot->DumpState( pColResRoot, pDoc, aDocPos );
+//UNUSED2009-05 }
void ScDPSource::FillLevelList( USHORT nOrientation, List& rList )
{
@@ -1497,13 +1497,13 @@ const ScDPItemData& ScDPDimension::GetSelectedData()
return *pSelectedData;
}
-BOOL ScDPDimension::IsValidPage( const ScDPItemData& rData )
-{
- if ( bHasSelectedPage )
- return rData.IsCaseInsEqual( GetSelectedData() );
-
- return TRUE; // no selection -> all data
-}
+//UNUSED2009-05 BOOL ScDPDimension::IsValidPage( const ScDPItemData& rData )
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( bHasSelectedPage )
+//UNUSED2009-05 return rData.IsCaseInsEqual( GetSelectedData() );
+//UNUSED2009-05
+//UNUSED2009-05 return TRUE; // no selection -> all data
+//UNUSED2009-05 }
// XPropertySet
@@ -2505,14 +2505,14 @@ ScDPMember* ScDPMembers::getByIndex(long nIndex) const
else if ( nHier == SC_DAPI_HIERARCHY_WEEK && nLev == SC_DAPI_LEVEL_WEEKDAY )
{
nVal = nIndex; // DayOfWeek is 0-based
- aName = ScGlobal::pCalendar->getDisplayName(
+ aName = ScGlobal::GetCalendar()->getDisplayName(
::com::sun::star::i18n::CalendarDisplayIndex::DAY,
sal::static_int_cast<sal_Int16>(nVal), 0 );
}
else if ( nHier == SC_DAPI_HIERARCHY_QUARTER && nLev == SC_DAPI_LEVEL_MONTH )
{
nVal = nIndex; // Month is 0-based
- aName = ScGlobal::pCalendar->getDisplayName(
+ aName = ScGlobal::GetCalendar()->getDisplayName(
::com::sun::star::i18n::CalendarDisplayIndex::MONTH,
sal::static_int_cast<sal_Int16>(nVal), 0 );
}
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 3320e9a9a95c..88ff065572b4 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -559,24 +559,9 @@ void ScGlobal::Init()
//! Wenn Sortierung etc. von der Sprache der installierten Offfice-Version
//! abhaengen sollen, hier "Application::GetSettings().GetUILanguage()"
- LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage();
- pLocale = new ::com::sun::star::lang::Locale( Application::GetSettings().GetLocale());
pSysLocale = new SvtSysLocale;
pCharClass = pSysLocale->GetCharClassPtr();
pLocaleData = pSysLocale->GetLocaleDataPtr();
- pCalendar = new CalendarWrapper( ::comphelper::getProcessServiceFactory() );
- pCalendar->loadDefaultCalendar( *pLocale );
- pCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() );
- pCollator->loadDefaultCollator( *pLocale, SC_COLLATOR_IGNORES );
- pCaseCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() );
- pCaseCollator->loadDefaultCollator( *pLocale, 0 );
- pTransliteration = new ::utl::TransliterationWrapper(
- ::comphelper::getProcessServiceFactory(), SC_TRANSLITERATION_IGNORECASE );
- pTransliteration->loadModuleIfNeeded( eOfficeLanguage );
- pCaseTransliteration = new ::utl::TransliterationWrapper(
- ::comphelper::getProcessServiceFactory(), SC_TRANSLITERATION_CASESENSE );
- pCaseTransliteration->loadModuleIfNeeded( eOfficeLanguage );
- pScIntlWrapper = new IntlWrapper( ::comphelper::getProcessServiceFactory(), *pLocale );
ppRscString = new String *[ STR_COUNT ];
for( USHORT nC = 0 ; nC < STR_COUNT ; nC++ ) ppRscString[ nC ] = NULL;
@@ -1766,6 +1751,7 @@ ScFunctionMgr::ScFunctionMgr()
aCatLists[i] = new List;
pRootList = aCatLists[0]; // Gesamtliste ("Alle") erstellen
+ CollatorWrapper* pCaseCollator = ScGlobal::GetCaseCollator();
for ( n=0; n<nCount; n++ )
{
ULONG nTmpCnt=0;
@@ -1775,8 +1761,7 @@ ScFunctionMgr::ScFunctionMgr()
// ist zwar case-sensitiv, aber Umlaute muessen richtig einsortiert werden
const ScFuncDesc* pTmpDesc = (const ScFuncDesc*)pRootList->GetObject(nTmpCnt);
- if ( ScGlobal::pCaseCollator->compareString(
- *pDesc->pFuncName, *pTmpDesc->pFuncName ) == COMPARE_LESS )
+ if ( pCaseCollator->compareString(*pDesc->pFuncName, *pTmpDesc->pFuncName ) == COMPARE_LESS )
break;
}
pRootList->Insert((void*)pDesc, nTmpCnt); // Einsortieren
@@ -1949,6 +1934,13 @@ sal_uInt32 ScFunctionCategory::getNumber() const
utl::TransliterationWrapper* ScGlobal::GetpTransliteration() //add by CHINA001
{
+ if ( !pTransliteration )
+ {
+ const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage();
+ pTransliteration = new ::utl::TransliterationWrapper(
+ ::comphelper::getProcessServiceFactory(), SC_TRANSLITERATION_IGNORECASE );
+ pTransliteration->loadModuleIfNeeded( eOfficeLanguage );
+ }
DBG_ASSERT(
pTransliteration,
"ScGlobal::GetpTransliteration() called before ScGlobal::Init()");
@@ -1962,3 +1954,57 @@ const LocaleDataWrapper* ScGlobal::GetpLocaleData()
"ScGlobal::GetpLocaleData() called before ScGlobal::Init()");
return pLocaleData;
}
+CalendarWrapper* ScGlobal::GetCalendar()
+{
+ if ( !pCalendar )
+ {
+ pCalendar = new CalendarWrapper( ::comphelper::getProcessServiceFactory() );
+ pCalendar->loadDefaultCalendar( *GetLocale() );
+ }
+ return pCalendar;
+}
+CollatorWrapper* ScGlobal::GetCollator()
+{
+ if ( !pCollator )
+ {
+ pCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() );
+ pCollator->loadDefaultCollator( *GetLocale(), SC_COLLATOR_IGNORES );
+ } // if ( !pCollator )
+ return pCollator;
+}
+CollatorWrapper* ScGlobal::GetCaseCollator()
+{
+ if ( !pCaseCollator )
+ {
+ pCaseCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() );
+ pCaseCollator->loadDefaultCollator( *GetLocale(), 0 );
+ } // if ( !pCaseCollator )
+ return pCaseCollator;
+}
+::utl::TransliterationWrapper* ScGlobal::GetCaseTransliteration()
+{
+ if ( !pCaseTransliteration )
+ {
+ const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage();
+ pCaseTransliteration = new ::utl::TransliterationWrapper(::comphelper::getProcessServiceFactory(), SC_TRANSLITERATION_CASESENSE );
+ pCaseTransliteration->loadModuleIfNeeded( eOfficeLanguage );
+ } // if ( !pCaseTransliteration )
+ return pCaseTransliteration;
+}
+IntlWrapper* ScGlobal::GetScIntlWrapper()
+{
+ if ( !pScIntlWrapper )
+ {
+ pScIntlWrapper = new IntlWrapper( ::comphelper::getProcessServiceFactory(), *GetLocale() );
+ }
+ return pScIntlWrapper;
+}
+::com::sun::star::lang::Locale* ScGlobal::GetLocale()
+{
+ if ( !pLocale )
+ {
+ pLocale = new ::com::sun::star::lang::Locale( Application::GetSettings().GetLocale());
+ }
+ return pLocale;
+}
+
diff --git a/sc/source/core/data/global2.cxx b/sc/source/core/data/global2.cxx
index c352dbb550d6..6af662119f12 100644
--- a/sc/source/core/data/global2.cxx
+++ b/sc/source/core/data/global2.cxx
@@ -96,17 +96,17 @@ ScImportParam::~ScImportParam()
{
}
-void ScImportParam::Clear()
-{
- nCol1 = nCol2 = 0;
- nRow1 = nRow2 = 0;
- bImport = FALSE;
- bNative = FALSE;
- bSql = TRUE;
- nType = ScDbTable;
- aDBName.Erase();
- aStatement.Erase();
-}
+//UNUSED2009-05 void ScImportParam::Clear()
+//UNUSED2009-05 {
+//UNUSED2009-05 nCol1 = nCol2 = 0;
+//UNUSED2009-05 nRow1 = nRow2 = 0;
+//UNUSED2009-05 bImport = FALSE;
+//UNUSED2009-05 bNative = FALSE;
+//UNUSED2009-05 bSql = TRUE;
+//UNUSED2009-05 nType = ScDbTable;
+//UNUSED2009-05 aDBName.Erase();
+//UNUSED2009-05 aStatement.Erase();
+//UNUSED2009-05 }
ScImportParam& ScImportParam::operator=( const ScImportParam& r )
{
@@ -849,16 +849,16 @@ __EXPORT ScPivotParam::~ScPivotParam()
//------------------------------------------------------------------------
-void __EXPORT ScPivotParam::Clear()
-{
- nCol = 0;
- nRow = 0;
- nTab = 0;
- bIgnoreEmptyRows = bDetectCategories = FALSE;
- bMakeTotalCol = bMakeTotalRow = TRUE;
- ClearLabelData();
- ClearPivotArrays();
-}
+//UNUSED2009-05 void __EXPORT ScPivotParam::Clear()
+//UNUSED2009-05 {
+//UNUSED2009-05 nCol = 0;
+//UNUSED2009-05 nRow = 0;
+//UNUSED2009-05 nTab = 0;
+//UNUSED2009-05 bIgnoreEmptyRows = bDetectCategories = FALSE;
+//UNUSED2009-05 bMakeTotalCol = bMakeTotalRow = TRUE;
+//UNUSED2009-05 ClearLabelData();
+//UNUSED2009-05 ClearPivotArrays();
+//UNUSED2009-05 }
//------------------------------------------------------------------------
diff --git a/sc/source/core/data/makefile.mk b/sc/source/core/data/makefile.mk
index 29618da6630b..d2c700c5f95d 100644
--- a/sc/source/core/data/makefile.mk
+++ b/sc/source/core/data/makefile.mk
@@ -56,6 +56,7 @@ SLOFILES = \
$(SLO)$/bcaslot.obj \
$(SLO)$/cell.obj \
$(SLO)$/cell2.obj \
+ $(SLO)$/clipparam.obj \
$(SLO)$/column.obj \
$(SLO)$/column2.obj \
$(SLO)$/column3.obj \
@@ -117,6 +118,7 @@ EXCEPTIONSFILES= \
$(SLO)$/autonamecache.obj \
$(SLO)$/bcaslot.obj \
$(SLO)$/cell2.obj \
+ $(SLO)$/clipparam.obj \
$(SLO)$/column.obj \
$(SLO)$/column3.obj \
$(SLO)$/documen2.obj \
diff --git a/sc/source/core/data/markarr.cxx b/sc/source/core/data/markarr.cxx
index f5855cb4424b..362c7e769b7a 100644
--- a/sc/source/core/data/markarr.cxx
+++ b/sc/source/core/data/markarr.cxx
@@ -254,10 +254,10 @@ void ScMarkArray::SetMarkArea( SCROW nStartRow, SCROW nEndRow, BOOL bMarked )
// InfoBox(0, String(nCount) + String(" Eintraege") ).Execute();
}
-void ScMarkArray::DeleteArea(SCROW nStartRow, SCROW nEndRow)
-{
- SetMarkArea(nStartRow, nEndRow, FALSE);
-}
+//UNUSED2009-05 void ScMarkArray::DeleteArea(SCROW nStartRow, SCROW nEndRow)
+//UNUSED2009-05 {
+//UNUSED2009-05 SetMarkArea(nStartRow, nEndRow, FALSE);
+//UNUSED2009-05 }
BOOL ScMarkArray::IsAllMarked( SCROW nStartRow, SCROW nEndRow ) const
{
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 5f2f3c1a4f6e..ee74a66bcc3b 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -258,14 +258,16 @@ void ScPatternAttr::GetFont(
FontEmphasisMark eEmphasis;
FontRelief eRelief;
Color aColor;
+ LanguageType eLang;
- USHORT nFontId, nHeightId, nWeightId, nPostureId;
+ USHORT nFontId, nHeightId, nWeightId, nPostureId, nLangId;
if ( nScript == SCRIPTTYPE_ASIAN )
{
nFontId = ATTR_CJK_FONT;
nHeightId = ATTR_CJK_FONT_HEIGHT;
nWeightId = ATTR_CJK_FONT_WEIGHT;
nPostureId = ATTR_CJK_FONT_POSTURE;
+ nLangId = ATTR_CJK_FONT_LANGUAGE;
}
else if ( nScript == SCRIPTTYPE_COMPLEX )
{
@@ -273,6 +275,7 @@ void ScPatternAttr::GetFont(
nHeightId = ATTR_CTL_FONT_HEIGHT;
nWeightId = ATTR_CTL_FONT_WEIGHT;
nPostureId = ATTR_CTL_FONT_POSTURE;
+ nLangId = ATTR_CTL_FONT_LANGUAGE;
}
else
{
@@ -280,6 +283,7 @@ void ScPatternAttr::GetFont(
nHeightId = ATTR_FONT_HEIGHT;
nWeightId = ATTR_FONT_WEIGHT;
nPostureId = ATTR_FONT_POSTURE;
+ nLangId = ATTR_FONT_LANGUAGE;
}
if ( pCondSet )
@@ -337,6 +341,10 @@ void ScPatternAttr::GetFont(
if ( pCondSet->GetItemState( ATTR_FONT_COLOR, TRUE, &pItem ) != SFX_ITEM_SET )
pItem = &rItemSet.Get( ATTR_FONT_COLOR );
aColor = ((const SvxColorItem*)pItem)->GetValue();
+
+ if ( pCondSet->GetItemState( nLangId, TRUE, &pItem ) != SFX_ITEM_SET )
+ pItem = &rItemSet.Get( nLangId );
+ eLang = ((const SvxLanguageItem*)pItem)->GetLanguage();
}
else // alles aus rItemSet
{
@@ -365,6 +373,9 @@ void ScPatternAttr::GetFont(
rItemSet.Get( ATTR_FONT_RELIEF )).GetValue();
aColor = ((const SvxColorItem&)
rItemSet.Get( ATTR_FONT_COLOR )).GetValue();
+ // for graphite language features
+ eLang =
+ ((const SvxLanguageItem&)rItemSet.Get( nLangId )).GetLanguage();
}
DBG_ASSERT(pFontAttr,"nanu?");
@@ -381,6 +392,8 @@ void ScPatternAttr::GetFont(
rFont.SetCharSet( pFontAttr->GetCharSet() );
rFont.SetPitch( pFontAttr->GetPitch() );
+ rFont.SetLanguage(eLang);
+
// Groesse
if ( pOutDev != NULL )
diff --git a/sc/source/core/data/pivot.cxx b/sc/source/core/data/pivot.cxx
index 30bacf79989a..00cdf2a84eac 100644
--- a/sc/source/core/data/pivot.cxx
+++ b/sc/source/core/data/pivot.cxx
@@ -34,1995 +34,4 @@
// -----------------------------------------------------------------------
-#if OLD_PIVOT_IMPLEMENTATION
-#ifdef _MSC_VER
-#pragma optimize("",off)
-#endif
-
-// INCLUDE ---------------------------------------------------------------
-
-#include <svtools/zforlist.hxx>
-#include <tools/solar.h>
-
-#include "globstr.hrc"
-#include "global.hxx"
-#include "subtotal.hxx"
-#include "scitems.hxx"
-#include "attrib.hxx"
-#include "patattr.hxx"
-#include "docpool.hxx"
-#include "document.hxx"
-#include "userlist.hxx"
-#include "pivot.hxx"
-#include "cell.hxx"
-#include "rechead.hxx"
-#include "compiler.hxx" // fuer errNoValue
-#include "progress.hxx"
-
-#include <string.h>
-#include <math.h>
-
-// STATIC DATA -----------------------------------------------------------
-
-//! bei Gelegenheit...
-
-static short nStaticStrRefCount = 0;
-static String* pLabel[PIVOT_MAXFUNC+1]; // incl. "auto"
-static String* pLabelTotal;
-static String* pLabelData;
-
-static SCSIZE nDataMult = 1;
-
-#define nFirstLine 2
-
-static const USHORT nFuncMaskArr[PIVOT_MAXFUNC+1] =
- { PIVOT_FUNC_SUM,
- PIVOT_FUNC_COUNT,
- PIVOT_FUNC_AVERAGE,
- PIVOT_FUNC_MAX,
- PIVOT_FUNC_MIN,
- PIVOT_FUNC_PRODUCT,
- PIVOT_FUNC_COUNT_NUM,
- PIVOT_FUNC_STD_DEV,
- PIVOT_FUNC_STD_DEVP,
- PIVOT_FUNC_STD_VAR,
- PIVOT_FUNC_STD_VARP,
- PIVOT_FUNC_AUTO }; // automatisch
-
-// -----------------------------------------------------------------------
-
-// 1 Filter-Knopf
-// 2 Feldnamen links
-// 3 "Daten" links
-// 4 Feldnamen oben
-// 5 "Daten" oben
-// 6 einzelne "Gesamt" oben rechts
-// 7 "Gesamt" oben rechts
-// 8 einzelne "Gesamt" unten links
-// 9 "Gesamt" unten links
-// 10 innere Kategorie links
-// 11 Teilergebnis Label einzeln links
-// 12 Teilergebnis Label gesamt links
-// 13 letzte Kategorie links
-// 14 innere Kategorie oben
-// 15 Teilergebnis Label einzeln oben
-// 16 Teilergebnis Label gesamt oben
-// 17 letzte Kategorie oben
-// 18 Werte innen
-// 19 Werte in Teilergebnisspalte
-// 20 Werte in Gesamt-Spalte
-// 21 Werte in einzelnen Gesamt-Spalten
-// 22 Werte in Ergebnis-Zeile Teilergebnis oder Gesamt
-// 23 Kreuzung von Spalte/Zeile (Teilergebnis-Spalte)
-// 24 Kreuzung von Spalte/Zeile (Gesamt-Spalte)
-// 25 wie 24 bei einzelnen "Gesamt"
-
-SCSIZE lcl_MaskToIndex( USHORT nFuncMask )
-{
- SCSIZE i;
- for (i=0; i<=PIVOT_MAXFUNC; i++)
- if (nFuncMask == nFuncMaskArr[i])
- return i;
-
- DBG_ERROR("Falsche Maske in MaskToIndex");
- return 0;
-}
-
-BOOL lcl_IsEmptyLine( ScDocument* pDoc, const ScAddress& rPos, SCCOL nCol2 )
-{
- //! ans Document verschieben !!!
-
- ScAddress aAdr( rPos );
- for (SCCOL nCol=aAdr.Col(); nCol<=nCol2; nCol++)
- {
- aAdr.SetCol( nCol );
- if ( pDoc->GetCell( aAdr ) )
- return FALSE;
- }
- return TRUE;
-}
-
-ScPivot::ScPivot(ScDocument* pDocument) :
- pDoc (pDocument),
- aQuery (),
- bHasHeader (FALSE),
- bIgnoreEmpty (FALSE),
- bDetectCat (FALSE),
- bMakeTotalCol (TRUE),
- bMakeTotalRow (TRUE),
- nColNameCount (0),
- pColNames (NULL),
- nSrcCol1 (0),
- nSrcRow1 (0),
- nSrcCol2 (0),
- nSrcRow2 (0),
- nSrcTab (0),
- nDestCol1 (0),
- nDestRow1 (0),
- nDestCol2 (0),
- nDestRow2 (0),
- nDestTab (0),
- nDataStartCol (0),
- nDataStartRow (0),
- nColCount (0),
- nRowCount (0),
- nDataCount (0),
- bValidArea (FALSE),
- bDataAtCol (FALSE)
-{
- for (SCSIZE i=0; i<PIVOT_MAXFIELD; i++)
- {
- pColList[i] = new PivotScStrCollection();
- pRowList[i] = new PivotScStrCollection();
- }
- pDataList = pColList[0];
- ppDataArr = NULL;
- nDataColCount = 0;
- nDataRowCount = 0;
- nRecCount = 0;
- pColRef = NULL;
-
- // Initialisierung der statischen Strings, wenn noetig
- nStaticStrRefCount += 1;
- if ( nStaticStrRefCount < 2 )
- {
- pLabelTotal = new String( ScGlobal::GetRscString(STR_PIVOT_TOTAL) );
- pLabelData = new String( ScGlobal::GetRscString(STR_PIVOT_DATA) );
-
- for (SCSIZE i=0; i<=PIVOT_MAXFUNC; i++ ) // incl. "auto"
- pLabel[i] = new String; // kein Leerzeichen
-
- *pLabel[ 0] = ScGlobal::GetRscString(STR_FUN_TEXT_SUM);
- *pLabel[ 1] = ScGlobal::GetRscString(STR_FUN_TEXT_COUNT);
- *pLabel[ 2] = ScGlobal::GetRscString(STR_FUN_TEXT_AVG);
- *pLabel[ 3] = ScGlobal::GetRscString(STR_FUN_TEXT_MAX);
- *pLabel[ 4] = ScGlobal::GetRscString(STR_FUN_TEXT_MIN);
- *pLabel[ 5] = ScGlobal::GetRscString(STR_FUN_TEXT_PRODUCT);
- *pLabel[ 6] = ScGlobal::GetRscString(STR_FUN_TEXT_COUNT); // Count2
- *pLabel[ 7] = ScGlobal::GetRscString(STR_FUN_TEXT_STDDEV);
- *pLabel[ 8] = ScGlobal::GetRscString(STR_FUN_TEXT_STDDEV); // Stddev2
- *pLabel[ 9] = ScGlobal::GetRscString(STR_FUN_TEXT_VAR);
- *pLabel[10] = ScGlobal::GetRscString(STR_FUN_TEXT_VAR); // Var2
- *pLabel[11] = ScGlobal::GetRscString(STR_TABLE_ERGEBNIS);
- }
-}
-
-ScPivot::ScPivot(const ScPivot& rPivot):
- ScDataObject(),
- pDoc (rPivot.pDoc),
- aQuery (rPivot.aQuery),
- bHasHeader (rPivot.bHasHeader),
- bIgnoreEmpty (rPivot.bIgnoreEmpty),
- bDetectCat (rPivot.bDetectCat),
- bMakeTotalCol (rPivot.bMakeTotalCol),
- bMakeTotalRow (rPivot.bMakeTotalRow),
- aName (rPivot.aName),
- aTag (rPivot.aTag),
- nColNameCount (0),
- pColNames (NULL),
- nSrcCol1 (rPivot.nSrcCol1),
- nSrcRow1 (rPivot.nSrcRow1),
- nSrcCol2 (rPivot.nSrcCol2),
- nSrcRow2 (rPivot.nSrcRow2),
- nSrcTab (rPivot.nSrcTab),
- nDestCol1 (rPivot.nDestCol1),
- nDestRow1 (rPivot.nDestRow1),
- nDestCol2 (rPivot.nDestCol2),
- nDestRow2 (rPivot.nDestRow2),
- nDestTab (rPivot.nDestTab),
- nDataStartCol (0),
- nDataStartRow (0),
- nColCount (0),
- nRowCount (0),
- nDataCount (0),
- bValidArea (FALSE),
- bDataAtCol (FALSE)
-{
- if (rPivot.nColNameCount>0 && rPivot.pColNames)
- {
- nColNameCount = rPivot.nColNameCount;
- pColNames = new String[nColNameCount];
- for (SCSIZE nCol=0; nCol<nColNameCount; nCol++)
- pColNames[nCol] = rPivot.pColNames[nCol];
- }
-
- for (SCSIZE i=0; i<PIVOT_MAXFIELD; i++)
- {
- pColList[i] = new PivotScStrCollection();
- pRowList[i] = new PivotScStrCollection();
- }
- pDataList = pColList[0];
- ppDataArr = NULL;
- nRecCount = 0;
- pColRef = NULL;
-
- SetColFields( rPivot.aColArr, rPivot.nColCount );
- SetRowFields( rPivot.aRowArr, rPivot.nRowCount );
- SetDataFields( rPivot.aDataArr, rPivot.nDataCount );
-
- nStaticStrRefCount += 1;
-}
-
-ScPivot::~ScPivot()
-{
- for (SCSIZE i=0; i<PIVOT_MAXFIELD; i++)
- {
- delete pColList[i];
- delete pRowList[i];
- }
- if (ppDataArr)
- {
- for (SCSIZE j=0; j<nDataRowCount; j++)
- delete[] ppDataArr[j];
- delete[] ppDataArr;
- ppDataArr = NULL;
- }
- delete[] pColRef;
-
- delete[] pColNames;
-
- // statische Strings ggF. wieder abraeumen
- nStaticStrRefCount -= 1;
- if ( nStaticStrRefCount == 0 )
- {
- delete pLabelTotal;
- delete pLabelData;
-
- for ( SCSIZE k=0; k<=PIVOT_MAXFUNC; k++ ) // incl. "auto"
- delete pLabel[k];
- }
-}
-
-ScPivot* ScPivot::CreateNew() const
-{
- ScPivot* pNewPivot = new ScPivot( pDoc );
-
- pNewPivot->SetQuery(aQuery);
- pNewPivot->SetHeader(bHasHeader);
- pNewPivot->SetIgnoreEmpty(bIgnoreEmpty);
- pNewPivot->SetDetectCat(bDetectCat);
- pNewPivot->SetMakeTotalCol(bMakeTotalCol);
- pNewPivot->SetMakeTotalRow(bMakeTotalRow);
-
- pNewPivot->SetSrcArea( nSrcCol1, nSrcRow1, nSrcCol2, nSrcRow2, nSrcTab );
- pNewPivot->SetDestPos( nDestCol1, nDestRow1, nDestTab );
-
- return pNewPivot;
-}
-
-void lcl_LoadFieldArr30( SvStream& /* rStream */, PivotField* /* pField */, USHORT /* nCount */ )
-{
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
- USHORT i;
-
- for (i=0; i<nCount; i++)
- {
- rStream >> pField[i].nCol
- >> pField[i].nFuncMask
- >> pField[i].nFuncCount;
- }
-#endif
-}
-
-void lcl_LoadFieldArr( SvStream& /* rStream */, PivotField* /* pField */, USHORT /* nCount */ )
-{
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
- USHORT i;
-
- for (i=0; i<nCount; i++)
- {
- BYTE cData;
- rStream >> cData;
- if( cData & 0x0F )
- rStream.SeekRel( cData & 0x0F );
- rStream >> pField[i].nCol
- >> pField[i].nFuncMask
- >> pField[i].nFuncCount;
- }
-#endif
-}
-
-void lcl_SaveFieldArr( SvStream& /* rStream */, const PivotField* /* pField */, USHORT /* nCount */ )
-{
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
- USHORT i;
-
- for (i=0; i<nCount; i++)
- {
- rStream << (BYTE) 0x00
- << pField[i].nCol
- << pField[i].nFuncMask
- << pField[i].nFuncCount;
- }
-#endif
-}
-
-// nach Load muessen Daten neu berechnet werden !
-
-BOOL ScPivot::Load( SvStream& /* rStream */, ScMultipleReadHeader& rHdr )
-{
- rHdr.StartEntry();
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
-
- rStream >> bHasHeader
-
- >> nSrcCol1
- >> nSrcRow1
- >> nSrcCol2
- >> nSrcRow2
- >> nSrcTab
-
- >> nDestCol1
- >> nDestRow1
- >> nDestCol2
- >> nDestRow2
- >> nDestTab;
-
- // Arrays immer ueber Set...Fields initalisieren!
-
- short nCount;
- PivotFieldArr aFieldArr;
-
- if( pDoc->GetSrcVersion() >= SC_DATABYTES2 )
- {
- rStream >> nCount;
- lcl_LoadFieldArr( rStream, aFieldArr, nCount );
- SetColFields(aFieldArr, nCount);
-
- rStream >> nCount;
- lcl_LoadFieldArr( rStream, aFieldArr, nCount );
- SetRowFields(aFieldArr, nCount);
-
- rStream >> nCount;
- lcl_LoadFieldArr( rStream, aFieldArr, nCount );
- SetDataFields(aFieldArr, nCount);
- }
- else
- {
- rStream >> nCount;
- lcl_LoadFieldArr30( rStream, aFieldArr, nCount );
- SetColFields(aFieldArr, nCount);
-
- rStream >> nCount;
- lcl_LoadFieldArr30( rStream, aFieldArr, nCount );
- SetRowFields(aFieldArr, nCount);
-
- rStream >> nCount;
- lcl_LoadFieldArr30( rStream, aFieldArr, nCount );
- SetDataFields(aFieldArr, nCount);
- }
-
- aQuery.Load( rStream );
-
- rStream >> bIgnoreEmpty;
- rStream >> bDetectCat;
-
- if (rHdr.BytesLeft())
- {
- rStream >> bMakeTotalCol; // ab 355i
- rStream >> bMakeTotalRow;
- }
-
- if (rHdr.BytesLeft()) // ab 500a
- {
- rStream.ReadByteString( aName, rStream.GetStreamCharSet() );
- rStream.ReadByteString( aTag, rStream.GetStreamCharSet() );
-
- DBG_ASSERT(!pColNames, "Spaltennamen schon gesetzt?");
- rStream >> nColNameCount;
- if (nColNameCount)
- {
- pColNames = new String[nColNameCount];
- for (SCCOL nCol=0; nCol<nColNameCount; nCol++)
- rStream.ReadByteString( pColNames[nCol], rStream.GetStreamCharSet() );
- }
- }
- // sonst wird hinterher aus ScPivotCollection::Load ein Name vergeben
-
- rHdr.EndEntry();
-#endif
- return TRUE;
-}
-
-BOOL ScPivot::Store( SvStream& /* rStream */, ScMultipleWriteHeader& rHdr ) const
-{
- rHdr.StartEntry();
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
-
- rStream << bHasHeader
-
- << nSrcCol1
- << nSrcRow1
- << nSrcCol2
- << nSrcRow2
- << nSrcTab
-
- << nDestCol1
- << nDestRow1
- << nDestCol2
- << nDestRow2
- << nDestTab
-
- << nColCount;
- lcl_SaveFieldArr( rStream, aColArr, nColCount );
- rStream << nRowCount;
- lcl_SaveFieldArr( rStream, aRowArr, nRowCount );
- rStream << nDataCount;
- lcl_SaveFieldArr( rStream, aDataArr, nDataCount );
-
- aQuery.Store( rStream );
-
- rStream << bIgnoreEmpty;
- rStream << bDetectCat;
-
- rStream << bMakeTotalCol; // ab 355i
- rStream << bMakeTotalRow;
-
- if( rStream.GetVersion() > SOFFICE_FILEFORMAT_40 ) // Name/Tag/Spalten ab 5.0
- {
- rStream.WriteByteString( aName, rStream.GetStreamCharSet() );
- rStream.WriteByteString( aTag, rStream.GetStreamCharSet() );
-
- if (!pColNames) ((ScPivot*)this)->nColNameCount = 0; // soll nicht sein
- rStream << nColNameCount;
- for (SCCOL nCol=0; nCol<nColNameCount; nCol++)
- rStream.WriteByteString( pColNames[nCol], rStream.GetStreamCharSet() );
- }
-
- rHdr.EndEntry();
-#endif
- return TRUE;
-}
-
-void ScPivot::SetQuery(const ScQueryParam& rQuery)
-{
- aQuery = rQuery;
-
- bValidArea = FALSE;
-}
-
-void ScPivot::GetQuery(ScQueryParam& rQuery) const
-{
- rQuery = aQuery;
-}
-
-void ScPivot::SetHeader(BOOL bHeader)
-{
- bHasHeader = bHeader;
- bValidArea = FALSE;
-}
-
-BOOL ScPivot::GetHeader() const
-{
- return bHasHeader;
-}
-
-void ScPivot::SetIgnoreEmpty(BOOL bIgnore)
-{
- bIgnoreEmpty = bIgnore;
- bValidArea = FALSE;
-}
-
-BOOL ScPivot::GetIgnoreEmpty() const
-{
- return bIgnoreEmpty;
-}
-
-void ScPivot::SetDetectCat(BOOL bDetect)
-{
- bDetectCat = bDetect;
- bValidArea = FALSE;
-}
-
-BOOL ScPivot::GetDetectCat() const
-{
- return bDetectCat;
-}
-
-void ScPivot::SetMakeTotalCol(BOOL bSet)
-{
- bMakeTotalCol = bSet;
- bValidArea = FALSE;
-}
-
-BOOL ScPivot::GetMakeTotalCol() const
-{
- return bMakeTotalCol;
-}
-
-void ScPivot::SetMakeTotalRow(BOOL bSet)
-{
- bMakeTotalRow = bSet;
- bValidArea = FALSE;
-}
-
-BOOL ScPivot::GetMakeTotalRow() const
-{
- return bMakeTotalRow;
-}
-
-void ScPivot::SetName(const String& rNew)
-{
- aName = rNew;
-}
-
-const String& ScPivot::GetName() const
-{
- return aName;
-}
-
-void ScPivot::SetTag(const String& rNew)
-{
- aTag = rNew;
-}
-
-const String& ScPivot::GetTag() const
-{
- return aTag;
-}
-
-void ScPivot::SetSrcArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab)
-{
- nSrcCol1 = Min(nCol1, (SCCOL)MAXCOL);
- nSrcRow1 = Min(nRow1, (SCROW)MAXROW);
- nSrcCol2 = Min(nCol2, (SCCOL)MAXCOL);
- nSrcRow2 = Min(nRow2, (SCROW)MAXROW);
- nSrcTab = nTab;
- bValidArea = FALSE;
-}
-
-void ScPivot::GetSrcArea(SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2, SCTAB& rTab) const
-{
- rCol1 = nSrcCol1;
- rRow1 = nSrcRow1;
- rCol2 = nSrcCol2;
- rRow2 = nSrcRow2;
- rTab = nSrcTab;
-}
-
-ScRange ScPivot::GetSrcArea() const
-{
- return ScRange( nSrcCol1,nSrcRow1,nSrcTab, nSrcCol2,nSrcRow2,nSrcTab );
-}
-
-void ScPivot::SetDestPos(SCCOL nCol, SCROW nRow, SCTAB nTab)
-{
- nDestCol1 = nCol;
- nDestRow1 = nRow;
- nDestTab = nTab;
- bValidArea = FALSE;
-}
-
-void ScPivot::GetDestArea(SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2, SCTAB& rTab) const
-{
- rCol1 = nDestCol1;
- rRow1 = nDestRow1;
- rTab = nDestTab;
- if (bValidArea)
- {
- rCol2 = nDestCol2;
- rRow2 = nDestRow2;
- }
- else
- {
- rCol2 = nDestCol1;
- rRow2 = nDestRow1;
- }
-}
-
-ScRange ScPivot::GetDestArea() const
-{
- ScAddress aStart( nDestCol1, nDestRow1, nDestTab );
- ScAddress aEnd = aStart;
- if ( bValidArea )
- aEnd = ScAddress( nDestCol2, nDestRow2, nDestTab );
- return ScRange( aStart, aEnd );
-}
-
-void ScPivot::MoveSrcArea( SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab )
-{
- if ( nNewCol != nSrcCol1 || nNewRow != nSrcRow1 || nNewTab != nSrcTab )
- {
- SCsCOL nDiffX = nNewCol - (SCsCOL) nSrcCol1;
- SCsROW nDiffY = nNewRow - (SCsROW) nSrcRow1;
-
- nSrcTab = nNewTab;
- nSrcCol1 = sal::static_int_cast<SCCOL>( nSrcCol1 + nDiffX );
- nSrcCol2 = sal::static_int_cast<SCCOL>( nSrcCol2 + nDiffX );
- nSrcRow1 = sal::static_int_cast<SCROW>( nSrcRow1 + nDiffY );
- nSrcRow2 = sal::static_int_cast<SCROW>( nSrcRow2 + nDiffY );
-
- aQuery.nCol1 = sal::static_int_cast<SCCOL>( aQuery.nCol1 + nDiffX );
- aQuery.nCol2 = sal::static_int_cast<SCCOL>( aQuery.nCol2 + nDiffX );
- aQuery.nRow1 = sal::static_int_cast<SCROW>( aQuery.nRow1 + nDiffY );
- aQuery.nRow2 = sal::static_int_cast<SCROW>( aQuery.nRow2 + nDiffY );
-
- SCSIZE nEC = aQuery.GetEntryCount();
- for (SCSIZE i=0; i<nEC; i++)
- if (aQuery.GetEntry(i).bDoQuery)
- aQuery.GetEntry(i).nField += nDiffX;
-
- if (bValidArea)
- {
- SCSIZE nC;
- SCSIZE nR;
- for (nC=0; nC<nColCount; nC++)
- if (aColArr[nC].nCol != PIVOT_DATA_FIELD)
- aColArr[nC].nCol = sal::static_int_cast<SCsCOL>( aColArr[nC].nCol + nDiffX );
- for (nR=0; nR<nRowCount; nR++)
- if (aRowArr[nR].nCol != PIVOT_DATA_FIELD)
- aRowArr[nR].nCol = sal::static_int_cast<SCsCOL>( aRowArr[nR].nCol + nDiffX );
- for (nC=0; nC<nDataCount; nC++)
- if (aDataArr[nC].nCol != PIVOT_DATA_FIELD)
- aDataArr[nC].nCol = sal::static_int_cast<SCsCOL>( aDataArr[nC].nCol + nDiffX );
- }
- }
-}
-
-void ScPivot::ExtendSrcArea( SCCOL nNewEndCol, SCROW nNewEndRow )
-{
- DBG_ASSERT( nNewEndCol >= nSrcCol2 && nNewEndRow >= nSrcRow2, "ExtendSrcArea: zu klein" );
-
- nSrcCol2 = nNewEndCol;
- nSrcRow2 = nNewEndRow;
-
- // alles andere bleibt erhalten
-}
-
-void ScPivot::MoveDestArea( SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab )
-{
- if ( nNewCol != nDestCol1 || nNewRow != nDestRow1 || nNewTab != nDestTab )
- {
- SCsCOL nDiffX = nNewCol - (SCsCOL) nDestCol1;
- SCsROW nDiffY = nNewRow - (SCsROW) nDestRow1;
-
- nDestTab = nNewTab;
- nDestCol1 = sal::static_int_cast<SCCOL>( nDestCol1 + nDiffX );
- nDestRow1 = sal::static_int_cast<SCROW>( nDestRow1 + nDiffY );
-
- if (bValidArea)
- {
- nDestCol2 = sal::static_int_cast<SCCOL>( nDestCol2 + nDiffX );
- nDestRow2 = sal::static_int_cast<SCROW>( nDestRow2 + nDiffY );
-
- nDataStartCol = sal::static_int_cast<SCCOL>( nDataStartCol + nDiffX );
- nDataStartRow = sal::static_int_cast<SCROW>( nDataStartRow + nDiffY );
- }
- }
-}
-
-void ScPivot::SetColFields(const PivotField* pFieldArr, SCSIZE nCount)
-{
- nColCount = Max(static_cast<SCSIZE>(0), Min(nCount, PIVOT_MAXFIELD));
- for (SCSIZE i = 0; i < nColCount; i++)
- {
- aColArr[i] = pFieldArr[i];
- aColArr[i].nFuncCount = 0;
- if (aColArr[i].nCol == PIVOT_DATA_FIELD)
- {
- aColArr[i].nFuncMask = PIVOT_FUNC_NONE;
- pDataList = pColList[i];
- bDataAtCol = TRUE;
- }
- else
- {
- for (SCsCOL j=0; j<=PIVOT_MAXFUNC; j++) // incl. "auto"
- if (aColArr[i].nFuncMask & nFuncMaskArr[j])
- aColArr[i].nFuncCount++;
- }
- }
- bValidArea = FALSE;
-}
-
-void ScPivot::GetColFields(PivotField* pFieldArr, SCSIZE& rCount) const
-{
- for (SCSIZE i=0; i<nColCount; i++)
- pFieldArr[i] = aColArr[i];
- rCount = nColCount;
-}
-
-void ScPivot::SetRowFields(const PivotField* pFieldArr, SCSIZE nCount)
-{
- nRowCount = Max(static_cast<SCSIZE>(0), Min(nCount, PIVOT_MAXFIELD));
- for (SCSIZE i = 0; i < nRowCount; i++)
- {
- aRowArr[i] = pFieldArr[i];
- aRowArr[i].nFuncCount = 0;
- if (aRowArr[i].nCol == PIVOT_DATA_FIELD)
- {
- aRowArr[i].nFuncMask = PIVOT_FUNC_NONE;
- pDataList = pRowList[i];
- bDataAtCol = FALSE;
- }
- else
- {
- for (SCSIZE j=0; j<=PIVOT_MAXFUNC; j++) // incl. "auto"
- if (aRowArr[i].nFuncMask & nFuncMaskArr[j])
- aRowArr[i].nFuncCount++;
- }
- }
- bValidArea = FALSE;
-}
-
-void ScPivot::GetRowFields(PivotField* pFieldArr, SCSIZE& rCount) const
-{
- for (SCSIZE i=0; i<nRowCount; i++)
- pFieldArr[i] = aRowArr[i];
- rCount = nRowCount;
-}
-
-void ScPivot::SetDataFields(const PivotField* pFieldArr, SCSIZE nCount)
-{
- USHORT nFuncNo;
- SCSIZE i;
-
- //
- // nDataCount vorausberechnen (wie unten)
- //
-
- nDataCount = 0;
- for (i = 0; i < nCount; i++)
- for (nFuncNo=0; nFuncNo<PIVOT_MAXFUNC; nFuncNo++)
- if (pFieldArr[i].nFuncMask & nFuncMaskArr[nFuncNo])
- if (nDataCount+1 < PIVOT_MAXFIELD)
- ++nDataCount;
-
- //
- // Eintraege anpassen
- //
-
- if ((nRowCount == 1) && (aRowArr[0].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1))
- {
- aColArr[nColCount] = aRowArr[0];
- pDataList = pColList[nColCount];
- nColCount++;
- nRowCount--;
- bDataAtCol = TRUE;
- }
- if ((nColCount == 1) && (aColArr[0].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1))
- {
- aRowArr[nRowCount] = aColArr[0];
- pDataList = pRowList[nRowCount];
- nRowCount++;
- nColCount--;
- bDataAtCol = FALSE;
- }
-
- if ((nDataCount == 1)
- && (aColArr[nColCount-1].nCol != PIVOT_DATA_FIELD)
- && (aColArr[nRowCount-1].nCol != PIVOT_DATA_FIELD))
- {
- if (bDataAtCol)
- {
- PivotField aField;
- SCSIZE nIndex = PIVOT_MAXFIELD;
- for (i=0; i<nColCount; i++)
- {
- if (aColArr[i].nCol == PIVOT_DATA_FIELD)
- {
- aField = aColArr[i];
- nIndex = i;
- }
- }
- DBG_ASSERT(nIndex < PIVOT_MAXFIELD, "no data field (GPF in old versions!)");
- if ( nIndex < PIVOT_MAXFIELD )
- {
- memcpy(&aColArr[nIndex], &aColArr[nIndex+1], (PIVOT_MAXFIELD - nIndex - 1) * sizeof(PivotField));
- aColArr[nColCount-1] = aField;
- pDataList = pColList[nColCount-1];
- }
- }
- else
- {
- PivotField aField;
- SCSIZE nIndex = PIVOT_MAXFIELD;
- for (i=0; i<nRowCount; i++)
- {
- if (aRowArr[i].nCol == PIVOT_DATA_FIELD)
- {
- aField = aRowArr[i];
- nIndex = i;
- }
- }
- DBG_ASSERT(nIndex < PIVOT_MAXFIELD, "no data field (GPF in old versions!)");
- if ( nIndex < PIVOT_MAXFIELD )
- {
- memcpy(&aRowArr[nIndex], &aRowArr[nIndex+1], (PIVOT_MAXFIELD - nIndex - 1) * sizeof(PivotField));
- aRowArr[nRowCount-1] = aField;
- pDataList = pRowList[nRowCount-1];
- }
- }
- }
-
- //
- // Datenfelder in Eintraege mit nur einer Funktion aufteilen
- //
-
- pDataList->FreeAll();
- nDataCount = 0;
- for (i = 0; i < nCount; i++)
- {
- for (nFuncNo=0; nFuncNo<PIVOT_MAXFUNC; nFuncNo++)
- if (pFieldArr[i].nFuncMask & nFuncMaskArr[nFuncNo])
- if (nDataCount+1 < PIVOT_MAXFIELD)
- {
- aDataArr[nDataCount] = pFieldArr[i];
- aDataArr[nDataCount].nFuncCount = 0;
- aDataArr[nDataCount].nFuncMask = nFuncMaskArr[nFuncNo];
-
- String aStr;
- pDoc->GetString(aDataArr[nDataCount].nCol, nSrcRow1, nSrcTab, aStr);
- if (aStr.Len() == 0)
- aStr = ScColToAlpha( aDataArr[nDataCount].nCol );
- TypedStrData* pStrData = new TypedStrData(aStr);
- if (!(pDataList->AtInsert(pDataList->GetCount(), pStrData)))
- {
- delete pStrData;
- DBG_ERROR("Fehler bei pDataList->AtInsert");
- }
-
- ++nDataCount;
- }
- }
-
- //
- //
- //
-
- bValidArea = FALSE;
-}
-
-void ScPivot::GetDataFields(PivotField* pFieldArr, SCSIZE& rCount) const
-{
-/* for (SCSIZE i=0; i<nDataCount; i++)
- pFieldArr[i] = aDataArr[i];
- rCount = nDataCount;
-*/
-
- rCount = 0;
- for (SCSIZE i=0; i<nDataCount; i++)
- {
- BOOL bFound = FALSE;
- for (SCSIZE j=0; j<rCount && !bFound; j++)
- if (pFieldArr[j].nCol == aDataArr[i].nCol)
- {
- // add to previous column only if new bits aren't already set there
- if ( ( pFieldArr[j].nFuncMask & aDataArr[i].nFuncMask ) == 0 )
- {
- pFieldArr[j].nFuncMask |= aDataArr[i].nFuncMask;
- pFieldArr[j].nFuncCount++;
- bFound = TRUE;
- }
- }
- if (!bFound)
- {
- pFieldArr[rCount] = aDataArr[i];
- ++rCount;
- }
- }
-}
-
-BOOL ScPivot::CreateData(BOOL bKeepDest)
-{
- //
- //
- //
-
- SCCOL nOldCol2 = nDestCol2;
- SCROW nOldRow2 = nDestRow2;
-
- pColRef = new PivotColRef[MAXCOL];
- aQuery.nCol1 = nSrcCol1;
- aQuery.nRow1 = nSrcRow1;
- aQuery.nCol2 = nSrcCol2;
- aQuery.nRow2 = nSrcRow2;
- aQuery.bHasHeader = bHasHeader;
- BOOL bRet = CreateFields();
- if (bRet)
- {
- SCSIZE i=0; // nDataMult berechnen - nach CreateFields, vor CreateFieldData !!!
- nDataMult = 1;
- if (nDataCount > 1)
- {
- if (bDataAtCol)
- {
- while (i<nColCount && aColArr[i].nCol != PIVOT_DATA_FIELD) i++;
- i++;
- while (i<nColCount)
- nDataMult *= pColList[i++]->GetCount();
- }
- else
- {
- while (i<nRowCount && aRowArr[i].nCol != PIVOT_DATA_FIELD) i++;
- i++;
- while (i<nRowCount)
- nDataMult *= pRowList[i++]->GetCount();
- }
- }
- DBG_ASSERT(nDataMult,"nDataMult==0");
-
- CalcArea();
- if ((ValidCol(nDestCol2)) && (ValidRow(nDestRow2)))
- {
- CreateFieldData();
- bValidArea = TRUE;
- }
- else
- bRet = FALSE;
- }
-
- if ( bKeepDest )
- {
- bValidArea = TRUE; //! ???
- nDestCol2 = nOldCol2;
- nDestRow2 = nOldRow2;
- }
-
- return bRet;
-}
-
-void ScPivot::DrawData()
-{
- ScProgress aProgress( pDoc->GetDocumentShell(), ScGlobal::GetRscString(STR_PIVOT_PROGRESS), nDestRow2-nDestRow1 );
-
- SCSIZE i;
-
- SCCOL nCol;
- SCROW nRow;
- String aStr;
- pDoc->pTab[nDestTab]->DeleteArea(nDestCol1, nDestRow1, nDestCol2, nDestRow2, IDF_ALL);
-
- if ( nDataStartRow > nDestRow1+nFirstLine )
- SetStyle(nDestCol1, nDestRow1+nFirstLine, nDestCol2, nDataStartRow-1, PIVOT_STYLE_TOP);
- SetStyle(nDataStartCol, nDataStartRow, nDestCol2, nDestRow2, PIVOT_STYLE_INNER);
-
- pDoc->SetString(nDestCol1, nDestRow1, nDestTab, ScGlobal::GetRscString(STR_CELL_FILTER));
- // Kategorie 1
- SetButton(nDestCol1, nDestRow1, nDestCol1, nDestRow1);
-
- if (bHasHeader) // Spalten / Zeilennamen ausgeben
- {
- if (nColCount != 0)
- {
- nCol = nDestCol1;
- nRow = nDataStartRow - 1;
- for (i=0; i<nColCount; i++)
- {
- if (aColArr[i].nCol != PIVOT_DATA_FIELD)
- {
- pDoc->GetString(aColArr[i].nCol, nSrcRow1, nSrcTab, aStr);
- if ( !aStr.Len() )
- aStr = ScColToAlpha( aColArr[i].nCol );
- pDoc->SetString(nCol, nRow, nDestTab, aStr);
- // Kategorie 2
- nCol++;
- }
- else if (nDataCount > 1)
- {
- pDoc->SetString(nCol, nRow, nDestTab, *pLabelData);
- // Kategorie 3
- nCol++;
- }
- }
- SetButton(nDestCol1, nRow, nCol-1, nRow);
- SetStyle(nDestCol1, nRow, nCol-1, nRow, PIVOT_STYLE_FIELDNAME);
- }
- if (nRowCount != 0)
- {
- nCol = nDataStartCol;
- nRow = nDestRow1 + nFirstLine;
- for (i=0; i<nRowCount; i++)
- {
- if (aRowArr[i].nCol != PIVOT_DATA_FIELD)
- {
- pDoc->GetString(aRowArr[i].nCol, nSrcRow1, nSrcTab, aStr);
- if ( !aStr.Len() )
- aStr = ScColToAlpha( aRowArr[i].nCol );
- pDoc->SetString(nCol, nRow, nDestTab, aStr);
- // Kategorie 4
- nCol++;
- }
- else if (nDataCount > 1)
- {
- pDoc->SetString(nCol, nRow, nDestTab, *pLabelData);
- // Kategorie 5
- nCol++;
- }
- }
- SetButton(nDataStartCol, nRow, nCol-1, nRow);
- SetStyle(nDataStartCol, nRow, nCol-1, nRow, PIVOT_STYLE_FIELDNAME);
- }
- }
-
- BOOL bNoRows = (nRowCount == 0) || ( nRowCount == 1 && aRowArr[0].nCol == PIVOT_DATA_FIELD );
- BOOL bNoCols = (nColCount == 0) || ( nColCount == 1 && aColArr[0].nCol == PIVOT_DATA_FIELD );
- if (!bMakeTotalCol) bNoRows = TRUE;
- if (!bMakeTotalRow) bNoCols = TRUE;
-
- SCCOL nTotalCol = nDestCol2;
- SCROW nTotalRow = nDestRow2;
- if (bDataAtCol)
- nTotalRow = sal::static_int_cast<SCROW>( nTotalRow - ( nDataCount - 1 ) );
- else
- nTotalCol = sal::static_int_cast<SCCOL>( nTotalCol - ( nDataCount - 1 ) );
-
- // Spaltenkoepfe ausgeben und ColRef initialisieren
- // (String-Collections sind initialisiert)
- nDataIndex = 0;
- nColIndex = 0;
- nCol = nDataStartCol;
- nRecCount = 0;
- RowToTable(0, nCol);
-
- // Zeilenkoepfe und Daten ausgeben
- // (ruft SetDataLine/SetFuncLine auf)
- nRowIndex = 0;
- nRow = nDataStartRow;
- ColToTable(0, nRow, aProgress);
-
- // Gesamtergebnis-Zeilen
-
- if (!bNoCols)
- {
- if (bDataAtCol)
- for (SCSIZE nTotCnt = 0; nTotCnt<nDataCount; nTotCnt++)
- SetFuncLine(nDataStartCol, nRow+nTotCnt, nDestTab,
- aDataArr[nTotCnt].nFuncMask, nTotCnt, 0, nDataRowCount);
- else
- SetFuncLine(nDataStartCol, nRow, nDestTab, PIVOT_FUNC_AUTO, SCSIZE_MAX, 0, nDataRowCount);
- }
-
-
- // Rahmen Spaltenergebnis
-
- if (!bNoRows)
- {
- if (!bDataAtCol)
- {
- for (i=0; i<nDataCount; i++)
- {
- String aLab = *pLabelTotal;
- aLab += ' ';
- aLab += *pLabel[lcl_MaskToIndex( aDataArr[i].nFuncMask )];
- aLab += ' ';
- aLab += pDataList->GetString(sal::static_int_cast<USHORT>(i));
- pDoc->SetString(sal::static_int_cast<SCCOL>(nTotalCol+i),
- sal::static_int_cast<SCROW>(nDestRow1 + nFirstLine), nDestTab, aLab);
- // Kategorie 6
- }
- }
- else
- {
- pDoc->SetString(nTotalCol, nDestRow1 + nFirstLine, nDestTab, *pLabelTotal);
- // Kategorie 7
- }
-
- if ( nDataStartRow > 0 )
- SetStyle(nTotalCol, nDestRow1+nFirstLine, nDestCol2, nDataStartRow-1, PIVOT_STYLE_TITLE);
- SetStyle(nTotalCol, nDataStartRow, nDestCol2, nDestRow2, PIVOT_STYLE_RESULT);
- SetFrame(nTotalCol, nDestRow1 + nFirstLine, nDestCol2, nDestRow2);
- }
-
- // Rahmen Zeilenergebnis
-
- if (!bNoCols)
- {
- if (bDataAtCol)
- {
- for (i=0; i<nDataCount; i++)
- {
- String aLab = *pLabelTotal;
- aLab += ' ';
- aLab += *pLabel[lcl_MaskToIndex( aDataArr[i].nFuncMask )];
- aLab += ' ';
- aLab += pDataList->GetString(sal::static_int_cast<USHORT>(i));
- pDoc->SetString(nDestCol1, nTotalRow+i, nDestTab, aLab);
- // Kategorie 8
- }
- }
- else
- {
- pDoc->SetString(nDestCol1, nTotalRow, nDestTab, *pLabelTotal);
- // Kategorie 9
- }
-
- if ( nDataStartCol > 0 )
- SetStyle(nDestCol1, nTotalRow, nDataStartCol-1, nDestRow2, PIVOT_STYLE_TITLE);
- SetStyle(nDataStartCol, nTotalRow, nDestCol2, nDestRow2, PIVOT_STYLE_RESULT);
- SetFrame(nDestCol1, nTotalRow, nDestCol2, nDestRow2);
- }
-
- // Rahmen gesamt
- SetFrame(nDestCol1, nDestRow1 + nFirstLine, nDestCol2, nDestRow2, 40);
-}
-
-void ScPivot::ReleaseData()
-{
- for (SCSIZE i = 0; i < PIVOT_MAXFIELD; i++)
- {
- pColList[i]->FreeAll();
- pRowList[i]->FreeAll();
- }
- if (ppDataArr)
- {
- for (SCSIZE i=0; i<nDataRowCount; i++)
- delete[] ppDataArr[i];
- delete[] ppDataArr;
- ppDataArr = NULL;
- }
- nDataColCount = 0;
- nDataRowCount = 0;
- delete[] pColRef;
- pColRef = NULL;
-}
-
-BOOL ScPivot::IsPivotAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
-{
- if (bValidArea)
- return ( nTab == nDestTab
- && nCol >= nDestCol1 && nCol <= nDestCol2
- && nRow >= nDestRow1 && nRow <= nDestRow2 );
- else
- return FALSE;
-}
-
-BOOL ScPivot::IsFilterAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
-{
- if (bValidArea)
- return (nCol == nDestCol1 && nRow == nDestRow1 && nTab == nDestTab);
- else
- return FALSE;
-}
-
-BOOL ScPivot::GetColFieldAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, SCCOL& rField) const
-{
- rField = 0;
- BOOL bRet = FALSE;
- if (bValidArea)
- {
- bRet = ( nCol >= nDestCol1 && nCol < nDataStartCol
- && nRow == nDataStartRow - 1
- && nTab == nDestTab );
- if (bRet)
- {
- rField = aColArr[nCol - nDestCol1].nCol;
- if (rField == PIVOT_DATA_FIELD)
- bRet = (nDataCount > 1);
- }
- }
- return bRet;
-}
-
-BOOL ScPivot::GetRowFieldAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, SCCOL& rField) const
-{
- rField = 0;
- BOOL bRet = FALSE;
- if (bValidArea)
- {
- bRet = ( nCol >= nDataStartCol && nCol < sal::static_int_cast<SCCOL>(nDataStartCol + nRowCount)
- && nRow == nDestRow1 + nFirstLine
- && nTab == nDestTab );
- if (bRet)
- {
- rField = aRowArr[nCol - nDataStartCol].nCol;
- if (rField == PIVOT_DATA_FIELD)
- bRet = (nDataCount > 1);
- }
- }
- return bRet;
-}
-
-
-//--------------------------------------------------------------------------------------------------
-// Private Methoden
-//--------------------------------------------------------------------------------------------------
-
-BOOL ScPivot::CreateFields()
-{
- SCSIZE i;
- SCROW nRow;
- SCROW nHeader;
- String aStr;
- TypedStrData* pStrData;
- if (bHasHeader)
- nHeader = 1;
- else
- nHeader = 0;
-
- // Sortieren nach Benutzerdefinierte Listen ??
- for (i = 0; i < nColCount; i++)
- {
- if (aColArr[i].nCol != PIVOT_DATA_FIELD)
- {
- pDoc->GetString(aColArr[i].nCol, nSrcRow1 + nHeader, nSrcTab, aStr);
- pColList[i]->SetUserData(ScGlobal::GetUserList()->GetData(aStr));
- }
- else
- pColList[i]->SetUserData(NULL);
- }
- for (i = 0; i < nRowCount; i++)
- {
- if (aRowArr[i].nCol != PIVOT_DATA_FIELD)
- {
- pDoc->GetString(aRowArr[i].nCol, nSrcRow1 + nHeader, nSrcTab, aStr);
- pRowList[i]->SetUserData(ScGlobal::GetUserList()->GetData(aStr));
- }
- else
- pRowList[i]->SetUserData(NULL);
- }
-
- ScAddress aSrcAdr( nSrcCol1, 0, nSrcTab );
- for (nRow = nSrcRow1 + nHeader; nRow <= nSrcRow2; nRow++)
- {
- BOOL bValidLine = TRUE;
- if (bIgnoreEmpty)
- {
- aSrcAdr.SetRow( nRow );
- bValidLine = !lcl_IsEmptyLine( pDoc, aSrcAdr, nSrcCol2 );
- }
- if (bValidLine)
- bValidLine = pDoc->pTab[nSrcTab]->ValidQuery(nRow, aQuery);
- if (bValidLine)
- {
- // Sortierte Liste der Felder erzeugen
- //! statt GetCategoryString leere weglassen !
-
- for (i = 0; i < nColCount; i++)
- {
- if (aColArr[i].nCol != PIVOT_DATA_FIELD)
- {
- SCROW nCatRow = bDetectCat ? GetCategoryRow( aColArr[i].nCol, nRow ) : nRow;
- pStrData = new TypedStrData( pDoc, aColArr[i].nCol, nCatRow, nSrcTab, TRUE );
- if (!(pColList[i]->Insert(pStrData)))
- delete pStrData;
- }
- }
- for (i = 0; i < nRowCount; i++)
- {
- if (aRowArr[i].nCol != PIVOT_DATA_FIELD)
- {
- SCROW nCatRow = bDetectCat ? GetCategoryRow( aRowArr[i].nCol, nRow ) : nRow;
- pStrData = new TypedStrData( pDoc, aRowArr[i].nCol, nCatRow, nSrcTab, TRUE );
- if (!(pRowList[i]->Insert(pStrData)))
- delete pStrData;
- }
- }
- }
- }
- return TRUE;
-}
-
-void ScPivot::CreateFieldData()
-{
- SCSIZE* pRowListIndex = nRowCount ? new SCSIZE[nRowCount] : NULL;
- SCSIZE* pColListIndex = nColCount ? new SCSIZE[nColCount] : NULL;
-
- SCSIZE i,j,k;
-
- ppDataArr = new SubTotal*[nDataRowCount];
- for (i=0; i<nDataRowCount; i++)
- ppDataArr[i] = new SubTotal[nDataColCount];
-
- if (bDataAtCol)
- for (j=0; j<nDataRowCount; j++)
- for (i=0; i<nDataColCount; i++)
- ppDataArr[j][i].nIndex = j/nDataMult%nDataCount;
- else
- for (j=0; j<nDataRowCount; j++)
- for (i=0; i<nDataColCount; i++)
- ppDataArr[j][i].nIndex = i/nDataMult%nDataCount;
-
- SCROW nHeader;
- if (bHasHeader)
- nHeader = 1;
- else
- nHeader = 0;
- ScAddress aSrcAdr( nSrcCol1, 0, nSrcTab );
- for (SCROW nRow = nSrcRow1 + nHeader; nRow <= nSrcRow2; nRow++)
- {
- BOOL bValidLine = TRUE;
- if (bIgnoreEmpty)
- {
- aSrcAdr.SetRow( nRow );
- bValidLine = !lcl_IsEmptyLine( pDoc, aSrcAdr, nSrcCol2 );
- }
- if (bValidLine)
- bValidLine = pDoc->pTab[nSrcTab]->ValidQuery(nRow, aQuery);
- if (bValidLine)
- {
- // Indizes der Kategorien nur einmal ausserhalb nDataCount
- for (j=0; j<nRowCount; j++)
- if (aRowArr[j].nCol != PIVOT_DATA_FIELD)
- {
- SCROW nCatRow = bDetectCat ? GetCategoryRow( aRowArr[j].nCol, nRow ) : nRow;
- TypedStrData aStrData( pDoc, aRowArr[j].nCol, nCatRow, nSrcTab, TRUE );
- pRowListIndex[j] = pRowList[j]->GetIndex(&aStrData);
- }
- for (j=0; j<nColCount; j++)
- if (aColArr[j].nCol != PIVOT_DATA_FIELD)
- {
- SCROW nCatRow = bDetectCat ? GetCategoryRow( aColArr[j].nCol, nRow ) : nRow;
- TypedStrData aStrData( pDoc, aColArr[j].nCol, nCatRow, nSrcTab, TRUE );
- pColListIndex[j] = pColList[j]->GetIndex(&aStrData);
- }
-
- String aStr;
- SCSIZE nCIndex;
- SCSIZE nRIndex;
- SCSIZE nIndex;
- ScAddress aAdr( 0, nRow, nSrcTab );
-
- for (i=0; i<nDataCount; i++)
- {
- // ColIndex Berechnen
- nCIndex = 0;
- for (j=0; j<nRowCount; j++)
- {
- if (aRowArr[j].nCol == PIVOT_DATA_FIELD)
- nIndex = i;
- else
- nIndex = pRowListIndex[j];
- if (nIndex)
- {
- for (k=j+1; k<nRowCount; k++)
- nIndex *= pRowList[k]->GetCount();
- nCIndex += nIndex;
- }
- }
- // RowIndex Berechnen
- nRIndex = 0;
- for (j=0; j<nColCount; j++)
- {
- if (aColArr[j].nCol == PIVOT_DATA_FIELD)
- nIndex = i;
- else
- nIndex = pColListIndex[j];
- if (nIndex)
- {
- for (k=j+1; k<nColCount; k++)
- nIndex *= pColList[k]->GetCount();
- nRIndex += nIndex;
- }
- }
- // Daten eintragen
- if ((nCIndex < nDataColCount) && (nRIndex < nDataRowCount))
- {
- DBG_ASSERT(ppDataArr[nRIndex][nCIndex].nIndex == i, "falsch init.");
-
- ppDataArr[nRIndex][nCIndex].nIndex = i;
- aAdr.SetCol( aDataArr[i].nCol );
- CellType eCellType = pDoc->GetCellType( aAdr );
- if ((eCellType != CELLTYPE_NONE) && (eCellType != CELLTYPE_NOTE))
- {
- BOOL bValue = (eCellType == CELLTYPE_VALUE);
- if (eCellType == CELLTYPE_FORMULA)
- {
- ScBaseCell* pCell = pDoc->GetCell( aAdr );
- bValue = ((ScFormulaCell*)pCell)->IsValue();
- }
-
- if (bValue)
- {
- double nVal = pDoc->GetValue( aAdr );
- ppDataArr[nRIndex][nCIndex].Update(nVal);
- }
- else
- ppDataArr[nRIndex][nCIndex].UpdateNoVal(); // nur nCount
- }
- }
- }
- }
- }
-
- delete pColListIndex;
- delete pRowListIndex;
-}
-
-void ScPivot::CalcArea()
-{
- BOOL bNoRows = (nRowCount == 0) || ( nRowCount == 1 && aRowArr[0].nCol == PIVOT_DATA_FIELD );
- BOOL bNoCols = (nColCount == 0) || ( nColCount == 1 && aColArr[0].nCol == PIVOT_DATA_FIELD );
- if (!bMakeTotalCol) bNoRows = TRUE;
- if (!bMakeTotalRow) bNoCols = TRUE;
-
- // StartSpalte/StartZeile des Datenbereichs berechnen
- if (bDataAtCol)
- {
- if (nDataCount > 1)
- nDataStartCol = sal::static_int_cast<SCCOL>(nDestCol1 + nColCount);
- else
- nDataStartCol = sal::static_int_cast<SCCOL>(nDestCol1 + Max(static_cast<SCSIZE>(0), nColCount - 1));
- }
- else
- nDataStartCol = sal::static_int_cast<SCCOL>(nDestCol1 + nColCount);
- if (!bDataAtCol)
- {
- if (nDataCount > 1)
- nDataStartRow = nDestRow1 + nRowCount + nFirstLine + 1;
- else
- nDataStartRow = nDestRow1 + Max(static_cast<SCSIZE>(0), nRowCount - 1) + nFirstLine + 1;
- }
- else
- nDataStartRow = nDestRow1 + nRowCount + nFirstLine + 1;
-
- //
- // Groesse der PivotTabelle berechnen
- //
-
- if (nRowCount == 0 || (nRowCount==1 && aRowArr[0].nCol==PIVOT_DATA_FIELD && nDataCount==1))
- {
- nDataColCount = 1;
- if (nDataCount == 1)
- nDestCol2 = sal::static_int_cast<SCCOL>(nDestCol1 + nColCount - 1);
- else
- nDestCol2 = sal::static_int_cast<SCCOL>(nDestCol1 + nColCount);
- }
- else
- {
- SCSIZE nDx;
- // Anzahl Spalten
- if ((aRowArr[nRowCount-1].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1))
- nDx = 2;
- else
- nDx = 1;
- SCSIZE nColLines = pRowList[nRowCount-nDx]->GetCount(); // SCSIZE to recognize overflow
- nDataColCount = pRowList[nRowCount-nDx]->GetCount();
- for (SCSIZE i=nRowCount-nDx; i-- > 0; )
- {
- nColLines *= pRowList[i]->GetCount();
- nDataColCount *= pRowList[i]->GetCount();
- if (!bDataAtCol)
- nColLines += (pRowList[i]->GetCount() * aRowArr[i].nFuncCount * nDataCount);
- else
- nColLines += (pRowList[i]->GetCount() * aRowArr[i].nFuncCount);
- }
- /*
- // Ergebnisspalten des letzten Elements
- if (aRowArr[nRowCount-1].nCol != PIVOT_DATA_FIELD)
- nColLines += (pRowList[nRowCount-1]->GetCount() * aRowArr[nRowCount-1].nFuncCount);
- */
- if (nColLines > static_cast<SCSIZE>(MAXCOL))
- nDestCol2 = MAXCOL+2; // ungueltig, 1 wird unten abgezogen
- else if (bDataAtCol)
- {
- if (nDataCount > 1)
- nDestCol2 = sal::static_int_cast<SCCOL>(nDestCol1 + nColCount + nColLines);
- else
- nDestCol2 = sal::static_int_cast<SCCOL>(nDestCol1 + (nColCount - 1) + nColLines);
- if (!bMakeTotalCol)
- --nDestCol2;
- }
- else
- nDestCol2 = sal::static_int_cast<SCCOL>(nDestCol1 + nColCount + nColLines);
- }
-
- if (nColCount == 0 || (nColCount==1 && aColArr[0].nCol==PIVOT_DATA_FIELD && nDataCount==1))
- {
- nDataRowCount = 1;
- if (nDataCount == 1)
- nDestRow2 = nDestRow1 + (nRowCount - 1) + nFirstLine + 1;
- else
- nDestRow2 = nDestRow1 + nRowCount + nFirstLine + 1;
- }
- else
- {
- SCSIZE nDx;
- // Anzahl Zeilen
- if ((aColArr[nColCount-1].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1))
- nDx = 2;
- else
- nDx = 1;
- SCSIZE nRowLines = pColList[nColCount-nDx]->GetCount(); // SCSIZE to recognize overflow
- nDataRowCount = pColList[nColCount-nDx]->GetCount();
- for (SCSIZE i=nColCount-nDx; i-- > 0; )
- {
- nRowLines *= pColList[i]->GetCount();
- nDataRowCount *= pColList[i]->GetCount();
- if (bDataAtCol)
- nRowLines += (pColList[i]->GetCount() * aColArr[i].nFuncCount * nDataCount);
- else
- nRowLines += (pColList[i]->GetCount() * aColArr[i].nFuncCount);
- }
- /*
- // Ergebniszeilen des letzten Elements
- if (aColArr[nColCount-1].nCol != PIVOT_DATA_FIELD)
- nRowLines += (pColList[nColCount-1]->GetCount() * aColArr[nColCount-1].nFuncCount);
- */
- if (nRowLines > static_cast<SCSIZE>(MAXROW))
- nDestRow2 = MAXROW+2; // ungueltig, 1 wird unten abgezogen
- else if (!bDataAtCol)
- {
- if (nDataCount > 1)
- nDestRow2 = nDestRow1 + nRowCount + nRowLines + nFirstLine + 1;
- else
- nDestRow2 = nDestRow1 + (nRowCount - 1) + nRowLines + nFirstLine + 1;
- if (!bMakeTotalRow)
- --nDestRow2;
- }
- else
- nDestRow2 = nDestRow1 + nRowCount + nRowLines + nFirstLine + 1;
- }
-
- if (bDataAtCol)
- {
- if (!bNoCols)
- nDestRow2 += nDataCount;
- nDestRow2 --;
- }
- else
- {
- if (!bNoRows)
- nDestCol2 = sal::static_int_cast<SCCOL>(nDestCol2 + nDataCount);
- nDestCol2 --;
- }
-}
-
-void ScPivot::SetDataLine(SCCOL nCol, SCROW nRow, SCTAB /* nTab */, SCSIZE nRIndex)
-{
- SCSIZE nCIndex2;
-
- SubTotal aGrandTotal[PIVOT_MAXFIELD]; // pro Daten-Feld
-
- for (SCSIZE i=0; i < nColIndex; i++)
- {
- SCSIZE nCIndex = pColRef[i].nDataIndex;
- if (nCIndex != sal::static_int_cast<SCSIZE>(PIVOT_FUNC_REF))
- {
-// if ( ppDataArr[nRIndex][nCIndex].GetCount() )
- {
- SCSIZE nDIndex = ppDataArr[nRIndex][nCIndex].nIndex;
- SetValue( sal::static_int_cast<SCCOL>(nCol+i), nRow, ppDataArr[nRIndex][nCIndex], aDataArr[nDIndex].nFuncMask );
- // Kategorie 18
-
- if (bDataAtCol)
- aGrandTotal[0].Update(ppDataArr[nRIndex][nCIndex]);
- else
- aGrandTotal[nDIndex].Update(ppDataArr[nRIndex][nCIndex]);
- }
- }
- else
- {
- SubTotal aTotal;
- SCSIZE k = i-1;
- while ((pColRef[k].nDataIndex == sal::static_int_cast<SCSIZE>(PIVOT_FUNC_REF)) && (k > 0))
- k--;
- for (SCSIZE j=k+1; (j-- > 0) && (pColRef[j].nRecCount > pColRef[i].nRecCount); )
- {
- nCIndex2 = pColRef[j].nDataIndex;
- if (nCIndex2 != sal::static_int_cast<SCSIZE>(PIVOT_FUNC_REF))
- {
- if ((pColRef[i].nIndex == ppDataArr[nRIndex][nCIndex2].nIndex) ||
- (pColRef[i].nIndex == SCSIZE_MAX))
- {
- aTotal.Update( ppDataArr[nRIndex][nCIndex2] );
- }
- }
- }
-
- USHORT nFunc = pColRef[i].nFuncMask;
- if (nFunc == PIVOT_FUNC_AUTO)
- nFunc = aDataArr[nRIndex/nDataMult%nDataCount].nFuncMask;
- SetValue( sal::static_int_cast<SCCOL>(nCol+i), nRow, aTotal, nFunc );
- // Kategorie 19
- }
- }
-
- BOOL bNoRows = (nRowCount == 0) || ( nRowCount == 1 && aRowArr[0].nCol == PIVOT_DATA_FIELD );
- if (!bMakeTotalCol) bNoRows = TRUE;
-
- if (!bNoRows)
- {
- if (bDataAtCol)
- {
- SetValue( nDestCol2, nRow, aGrandTotal[0], aDataArr[nRIndex/nDataMult%nDataCount].nFuncMask );
- // Kategorie 20
- }
- else
- {
- SCCOL nTotalCol = sal::static_int_cast<SCCOL>(nDestCol2 - nDataCount + 1);
- for (SCSIZE nTotCnt = 0; nTotCnt<nDataCount; nTotCnt++)
- {
- SetValue( sal::static_int_cast<SCCOL>(nTotalCol+nTotCnt), nRow, aGrandTotal[nTotCnt], aDataArr[nTotCnt].nFuncMask );
- // Kategorie 21
- }
- }
- }
-}
-
-void ScPivot::SetFuncLine(SCCOL nCol, SCROW nRow, SCTAB /* nTab */, USHORT nFunc, SCSIZE nIndex, SCSIZE nStartRIndex, SCSIZE nEndRIndex)
-{
- SCSIZE nSubtCount = 0;
- SubTotal aGrandTotal[PIVOT_MAXFIELD];
- USHORT nThisFunc = nFunc;
-
- for (SCSIZE i=0; i<nColIndex; i++)
- {
- SCSIZE nCIndex = pColRef[i].nDataIndex;
- if (nCIndex != sal::static_int_cast<SCSIZE>(PIVOT_FUNC_REF))
- {
- SubTotal aTotal;
- for (SCSIZE j = nStartRIndex; j < nEndRIndex; j++)
- {
- SCSIZE nDIndex = ppDataArr[j][nCIndex].nIndex;
- if ((nIndex == nDIndex) || (nIndex == SCSIZE_MAX))
- {
- aTotal.Update( ppDataArr[j][nCIndex] );
- }
- }
-
- if (bDataAtCol)
- aGrandTotal[0].Update( aTotal );
- else
- aGrandTotal[nCIndex/nDataMult%nDataCount].Update( aTotal ); //! immer ?
-
- if (nFunc == PIVOT_FUNC_AUTO)
- {
- if (bDataAtCol)
- {
- if (nIndex<nDataCount)
- nThisFunc = aDataArr[nIndex].nFuncMask;
- else
- {
- DBG_ERROR("wat fuer'n Index ???");
- }
- }
- else
- nThisFunc = aDataArr[nCIndex/nDataMult%nDataCount].nFuncMask;
- }
- SetValue( sal::static_int_cast<SCCOL>(nCol+i), nRow, aTotal, nThisFunc );
- // Kategorie 22
- }
- else
- { // Kreuzungspunkte kompatibel ?
-
- if ( nFunc == pColRef[i].nFuncMask )
- {
- SCSIZE nEffIndex = nIndex;
- if (nEffIndex == SCSIZE_MAX)
- {
- nEffIndex = nSubtCount % nDataCount;
- ++nSubtCount;
- }
- SubTotal aTotal;
-
- SCSIZE k = i-1;
- while ((pColRef[k].nDataIndex == sal::static_int_cast<SCSIZE>(PIVOT_FUNC_REF)) && (k > 0))
- k--;
- for (SCSIZE j=k+1; (j-- > 0) && (pColRef[j].nRecCount > pColRef[i].nRecCount); )
- {
- nCIndex = pColRef[j].nDataIndex;
- if (nCIndex != sal::static_int_cast<SCSIZE>(PIVOT_FUNC_REF))
- {
- for (SCSIZE nRIndex = nStartRIndex; nRIndex < nEndRIndex; nRIndex++)
- {
- SCSIZE nDIndex = ppDataArr[nRIndex][nCIndex].nIndex;
- if (nEffIndex == nDIndex)
- {
- aTotal.Update( ppDataArr[nRIndex][nCIndex] );
- }
- }
- }
- }
-
- if (nFunc == PIVOT_FUNC_AUTO)
- {
- if (nEffIndex<nDataCount)
- nThisFunc = aDataArr[nEffIndex].nFuncMask;
- else
- {
- DBG_ERROR("wat fuer'n Index ???");
- }
- }
- SetValue( sal::static_int_cast<SCCOL>(nCol+i), nRow, aTotal, nThisFunc );
- // Kategorie 23
- }
- }
- }
-
- BOOL bNoRows = (nRowCount == 0) || ( nRowCount == 1 && aRowArr[0].nCol == PIVOT_DATA_FIELD );
- if (!bMakeTotalCol) bNoRows = TRUE;
-
- if (!bNoRows)
- {
- if (bDataAtCol)
- {
- if (nFunc == PIVOT_FUNC_AUTO)
- {
- if (nIndex<nDataCount)
- nThisFunc = aDataArr[nIndex].nFuncMask;
- else
- {
- DBG_ERROR("wat fuer'n Index ???");
- }
- }
- SetValue( nDestCol2, nRow, aGrandTotal[0], nThisFunc );
- // Kategorie 24
- }
- else
- {
- SCCOL nTotalCol = sal::static_int_cast<SCCOL>(nDestCol2 - nDataCount + 1);
- for (SCSIZE nTotCnt = 0; nTotCnt<nDataCount; nTotCnt++)
- {
- if (nFunc == PIVOT_FUNC_AUTO)
- nThisFunc = aDataArr[nTotCnt%nDataCount].nFuncMask;
- SetValue( sal::static_int_cast<SCCOL>(nTotalCol+nTotCnt), nRow, aGrandTotal[nTotCnt], nThisFunc );
- // Kategorie 25
- }
- }
- }
-}
-
-void ScPivot::ColToTable(SCSIZE nField, SCROW& nRow, ScProgress& rProgress)
-{
- SCCOL nCol = sal::static_int_cast<SCCOL>(nDestCol1 + nField);
- if (nColCount == 0)
- {
-// SetDataLine(nCol + 1, nRow, nDestTab, nRowIndex);
- SetDataLine(nCol, nRow, nDestTab, nRowIndex);
- nRowIndex++;
- return;
- }
-
- SCSIZE nDx;
- if ((aColArr[nColCount -1].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1))
- nDx = 2;
- else
- nDx = 1;
- if (nField < nColCount - nDx)
- {
- for (USHORT i = 0; i < pColList[nField]->GetCount(); i++)
- {
- SCSIZE nSaveIndex = nRowIndex;
- String aStr = pColList[nField]->GetString(i);
- if (!aStr.Len()) aStr = ScGlobal::GetRscString(STR_EMPTYDATA);
- pDoc->SetString(nCol, nRow, nDestTab, aStr);
- // Kategorie 10
- SCROW nSaveRow = nRow;
- ColToTable(nField + 1, nRow, rProgress);
- SetStyle(nCol, nSaveRow, nCol, nRow - 1, PIVOT_STYLE_CATEGORY);
- SetFrame(nCol, nSaveRow, nCol, nRow - 1);
- if (aColArr[nField].nFuncCount > 0) // Zwischenergebnisse eingestellt?
- {
- nSaveRow = nRow;
- for (SCSIZE j=0; j<=PIVOT_MAXFUNC; j++) // incl. "auto"
- {
- if (aColArr[nField].nFuncMask & nFuncMaskArr[j])
- {
- String aLab;
- if (bDataAtCol)
- {
- for (SCSIZE k=0; k < nDataCount; k++)
- {
- String aDataStr = pDataList->GetString(sal::static_int_cast<USHORT>(k)); // always String
- aLab = aStr;
- SCSIZE nFuncType;
- if ( j==PIVOT_MAXFUNC )
- nFuncType = lcl_MaskToIndex( aDataArr[k].nFuncMask );
- else
- nFuncType = j;
- aLab += ' ';
- aLab += *pLabel[nFuncType];
- aLab += ' ';
- aLab += aDataStr;
- pDoc->SetString(nCol, nRow, nDestTab, aLab);
- // Kategorie 11
- SetFuncLine(nDataStartCol, nRow, nDestTab, nFuncMaskArr[j], k, nSaveIndex, nRowIndex);
- nRow++;
- }
- }
- else
- {
- aLab = aStr;
- aLab += ' ';
- aLab += *pLabel[j];
- pDoc->SetString(nCol, nRow, nDestTab, aLab);
- // Kategorie 12
- SetFuncLine(nDataStartCol, nRow, nDestTab, nFuncMaskArr[j], SCSIZE_MAX, nSaveIndex, nRowIndex);
- nRow++;
- }
- }
- }
- if ( nDataStartCol > 0 )
- SetStyle(nCol, nSaveRow, nDataStartCol-1, nRow-1, PIVOT_STYLE_TITLE);
- SetStyle(nDataStartCol, nSaveRow, nDestCol2, nRow-1, PIVOT_STYLE_RESULT);
- SetFrameHor(nCol, nSaveRow, nDestCol2, nRow-1);
- }
- nSaveIndex = nRowIndex;
- }
- }
- else if (nField < nColCount)
- {
- SCSIZE nCatCount = pColList[nField]->GetCount();
- SetStyle(nCol, nRow, nCol, nRow+nCatCount-1, PIVOT_STYLE_CATEGORY);
- SetFrame(nCol, nRow, nDestCol2, nRow+nCatCount-1);
- for (SCSIZE i = 0; i < nCatCount; i++)
- {
- String aTmpStr = pColList[nField]->GetString(sal::static_int_cast<USHORT>(i));
- if (!aTmpStr.Len()) aTmpStr = ScGlobal::GetRscString(STR_EMPTYDATA);
-
- String aPutStr;
- if (pColList[nField] == pDataList)
- {
- SCSIZE nFuncType = lcl_MaskToIndex( aDataArr[i].nFuncMask );
- aPutStr = *pLabel[nFuncType];
- aPutStr += ' ';
- aPutStr += aTmpStr;
- }
- else
- aPutStr += aTmpStr;
-
- pDoc->SetString(nCol, nRow, nDestTab, aPutStr);
- // Kategorie 13
- SetDataLine(nCol + 1, nRow, nDestTab, nRowIndex);
- nRowIndex++;
- nRow++;
-
- rProgress.SetState( nRow - nDestRow1 );
- }
- }
-}
-
-void ScPivot::RowToTable(SCSIZE nField, SCCOL& nCol)
-{
- nRecCount++;
- SCROW nRow = nDestRow1 + nFirstLine + nField + 1;
- if (nRowCount == 0)
- {
- pColRef[nColIndex].nDataIndex = nDataIndex;
- nColIndex++;
- nDataIndex++;
- return;
- }
-
- SCSIZE nDx;
- if ((aRowArr[nRowCount -1].nCol == PIVOT_DATA_FIELD) && (nDataCount == 1))
- nDx = 2;
- else
- nDx = 1;
-
- if (nField < nRowCount - nDx)
- {
- for (USHORT i = 0; i < pRowList[nField]->GetCount(); i++)
- {
- String aStr = pRowList[nField]->GetString(i);
- if (!aStr.Len()) aStr = ScGlobal::GetRscString(STR_EMPTYDATA);
- pDoc->SetString(nCol, nRow, nDestTab, aStr);
- // Kategorie 14
- SCCOL nSaveCol = nCol;
- RowToTable(nField + 1, nCol);
- SetStyle(nSaveCol, nRow, nCol - 1, nRow, PIVOT_STYLE_CATEGORY);
- SetFrame(nSaveCol, nRow, nCol - 1, nRow);
- if (aRowArr[nField].nFuncCount > 0)
- {
- nSaveCol = nCol;
- for (SCSIZE j=0; j<=PIVOT_MAXFUNC; j++) // incl. "auto"
- {
- if (aRowArr[nField].nFuncMask & nFuncMaskArr[j])
- {
- String aLab;
- if (!bDataAtCol)
- {
- for (SCSIZE k=0; k < nDataCount; k++)
- {
- aLab = aStr;
- SCSIZE nFuncType;
- if ( j==PIVOT_MAXFUNC )
- nFuncType = lcl_MaskToIndex( aDataArr[k].nFuncMask );
- else
- nFuncType = j;
- aLab += ' ';
- aLab += *pLabel[nFuncType];
- aLab += ' ';
- aLab += pDataList->GetString(sal::static_int_cast<USHORT>(k));
- pDoc->SetString(nCol, nRow, nDestTab, aLab);
- // Kategorie 15
- pColRef[nColIndex].nDataIndex = PIVOT_FUNC_REF;
- pColRef[nColIndex].nRecCount = nRecCount;
- pColRef[nColIndex].nIndex = k;
- pColRef[nColIndex].nFuncMask = nFuncMaskArr[j];
- nColIndex++;
- nCol++;
- }
- }
- else
- {
- aLab = aStr;
- aLab += ' ';
- aLab += *pLabel[j];
- pDoc->SetString(nCol, nRow, nDestTab, aLab);
- // Kategorie 16
- pColRef[nColIndex].nDataIndex = PIVOT_FUNC_REF;
- pColRef[nColIndex].nRecCount = nRecCount;
- pColRef[nColIndex].nIndex = SCSIZE_MAX;
- pColRef[nColIndex].nFuncMask = nFuncMaskArr[j];
- nColIndex++;
- nCol++;
- }
- }
- }
- if ( nDataStartRow > 0 )
- SetStyle(nSaveCol, nRow,
- nCol-1, nDataStartRow-1, PIVOT_STYLE_TITLE);
- SetStyle(nSaveCol, nDataStartRow, nCol-1, nDestRow2, PIVOT_STYLE_RESULT);
- SetFrameVer(nSaveCol, nRow, nCol-1, nDestRow2);
- }
- }
- }
- else if (nField < nRowCount)
- {
- SCSIZE nCatCount = pRowList[nField]->GetCount();
- SetStyle(nCol, nRow, sal::static_int_cast<SCCOL>(nCol+nCatCount-1), nRow, PIVOT_STYLE_CATEGORY);
- SetFrame(nCol, nRow, sal::static_int_cast<SCCOL>(nCol+nCatCount-1), nDestRow2);
- for (SCSIZE i = 0; i < nCatCount; i++)
- {
- String aTmpStr = pRowList[nField]->GetString(sal::static_int_cast<USHORT>(i));
- if (!aTmpStr.Len()) aTmpStr = ScGlobal::GetRscString(STR_EMPTYDATA);
-
- String aPutStr;
- if (pRowList[nField] == pDataList)
- {
- SCSIZE nFuncType = lcl_MaskToIndex( aDataArr[i].nFuncMask );
- aPutStr = *pLabel[nFuncType];
- aPutStr += ' ';
- aPutStr += aTmpStr;
- }
- else
- aPutStr = aTmpStr;
-
- pDoc->SetString(nCol, nRow, nDestTab, aPutStr);
- // Kategorie 17
- pColRef[nColIndex].nDataIndex = nDataIndex;
- pColRef[nColIndex].nRecCount = nRecCount;
- pColRef[nColIndex].nIndex = SCSIZE_MAX;
- pColRef[nColIndex].nFuncMask = PIVOT_FUNC_NONE;
- nColIndex++;
- nDataIndex++;
- nCol++;
- }
- }
- nRecCount--;
-}
-
-SCROW ScPivot::GetCategoryRow( SCCOL nCol, SCROW nRow )
-{
- SCROW nMinRow = nSrcRow1;
- if (bHasHeader) ++nMinRow;
- BOOL bFound = FALSE;
- do
- {
- if ( !pDoc->HasData( nCol, nRow, nSrcTab ) && nRow>nMinRow )
- --nRow;
- else
- bFound = TRUE;
- }
- while (!bFound);
- return nRow;
-}
-
-#endif
diff --git a/sc/source/core/data/pivot2.cxx b/sc/source/core/data/pivot2.cxx
index 20303f848b72..e12df0cda6e5 100644
--- a/sc/source/core/data/pivot2.cxx
+++ b/sc/source/core/data/pivot2.cxx
@@ -63,433 +63,6 @@
using ::com::sun::star::sheet::DataPilotFieldReference;
// STATIC DATA -----------------------------------------------------------
-
-#if OLD_PIVOT_IMPLEMENTATION
-//--------------------------------------------------------------------------------------------------
-// Hilfsmethoden von ScPivot
-//--------------------------------------------------------------------------------------------------
-
-void ScPivot::SetFrame(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nWidth)
-{
- if (pDoc->pTab[nDestTab])
- {
- SvxBorderLine aLine;
- aLine.SetOutWidth(nWidth);
- SvxBoxItem aBox( ATTR_BORDER );
- aBox.SetLine(&aLine, BOX_LINE_LEFT);
- aBox.SetLine(&aLine, BOX_LINE_TOP);
- aBox.SetLine(&aLine, BOX_LINE_RIGHT);
- aBox.SetLine(&aLine, BOX_LINE_BOTTOM);
- SvxBoxInfoItem aBoxInfo( ATTR_BORDER_INNER );
- aBoxInfo.SetValid(VALID_HORI,FALSE);
- aBoxInfo.SetValid(VALID_VERT,FALSE);
- aBoxInfo.SetValid(VALID_DISTANCE,FALSE);
- pDoc->pTab[nDestTab]->ApplyBlockFrame(&aBox, &aBoxInfo, nCol1, nRow1, nCol2, nRow2);
- }
-}
-
-void ScPivot::SetFrameHor(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
-{
- if (pDoc->pTab[nDestTab])
- {
- SvxBorderLine aLine;
- aLine.SetOutWidth(20);
- SvxBoxItem aBox( ATTR_BORDER );
- aBox.SetLine(&aLine, BOX_LINE_LEFT);
- aBox.SetLine(&aLine, BOX_LINE_TOP);
- aBox.SetLine(&aLine, BOX_LINE_RIGHT);
- aBox.SetLine(&aLine, BOX_LINE_BOTTOM);
- SvxBoxInfoItem aBoxInfo(ATTR_BORDER_INNER);
- aBoxInfo.SetValid(VALID_VERT,FALSE);
- aBoxInfo.SetValid(VALID_DISTANCE,FALSE);
- aBoxInfo.SetLine(&aLine, BOXINFO_LINE_HORI);
- pDoc->pTab[nDestTab]->ApplyBlockFrame(&aBox, &aBoxInfo, nCol1, nRow1, nCol2, nRow2);
- }
-}
-
-void ScPivot::SetFrameVer(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
-{
- if (pDoc->pTab[nDestTab])
- {
- SvxBorderLine aLine;
- aLine.SetOutWidth(20);
- SvxBoxItem aBox( ATTR_BORDER );
- aBox.SetLine(&aLine, BOX_LINE_LEFT);
- aBox.SetLine(&aLine, BOX_LINE_TOP);
- aBox.SetLine(&aLine, BOX_LINE_RIGHT);
- aBox.SetLine(&aLine, BOX_LINE_BOTTOM);
- SvxBoxInfoItem aBoxInfo( ATTR_BORDER_INNER );
- aBoxInfo.SetValid(VALID_HORI,FALSE);
- aBoxInfo.SetValid(VALID_DISTANCE,FALSE);
- aBoxInfo.SetLine(&aLine, BOXINFO_LINE_VERT);
- pDoc->pTab[nDestTab]->ApplyBlockFrame(&aBox, &aBoxInfo, nCol1, nRow1, nCol2, nRow2);
- }
-}
-
-void ScPivot::SetFontBold(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
-{
- if (pDoc->pTab[nDestTab])
- {
- ScPatternAttr aPattern( pDoc->GetPool() );
- aPattern.GetItemSet().Put( SvxWeightItem( WEIGHT_BOLD, ATTR_FONT_WEIGHT ) );
- pDoc->pTab[nDestTab]->ApplyPatternArea(nCol1, nRow1, nCol2, nRow2, aPattern);
- }
-}
-
-void ScPivot::SetJustifyLeft(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
-{
- if (pDoc->pTab[nDestTab])
- {
- ScPatternAttr aPattern( pDoc->GetPool() );
- aPattern.GetItemSet().Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_LEFT, ATTR_HOR_JUSTIFY ) );
- pDoc->pTab[nDestTab]->ApplyPatternArea(nCol1, nRow1, nCol2, nRow2, aPattern);
- }
-}
-
-void ScPivot::SetJustifyRight(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
-{
- if (pDoc->pTab[nDestTab])
- {
- ScPatternAttr aPattern( pDoc->GetPool() );
- aPattern.GetItemSet().Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_RIGHT, ATTR_HOR_JUSTIFY ) );
- pDoc->pTab[nDestTab]->ApplyPatternArea(nCol1, nRow1, nCol2, nRow2, aPattern);
- }
-}
-
-void ScPivot::SetButton(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
-{
- if (pDoc->pTab[nDestTab])
- {
- ScPatternAttr aPattern( pDoc->GetPool() );
- aPattern.GetItemSet().Put( ScMergeFlagAttr(SC_MF_BUTTON) );
- pDoc->pTab[nDestTab]->ApplyPatternArea(nCol1, nRow1, nCol2, nRow2, aPattern);
- }
-}
-
-void ScPivot::SetStyle(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nId)
-{
- if ( nCol1 > nCol2 || nRow1 > nRow2 )
- return; // Falls Bereiche leer sind
-
- USHORT nStringId = 0;
- switch (nId)
- {
- case PIVOT_STYLE_INNER: nStringId = STR_PIVOT_STYLE_INNER; break;
- case PIVOT_STYLE_RESULT: nStringId = STR_PIVOT_STYLE_RESULT; break;
- case PIVOT_STYLE_CATEGORY: nStringId = STR_PIVOT_STYLE_CATEGORY; break;
- case PIVOT_STYLE_TITLE: nStringId = STR_PIVOT_STYLE_TITLE; break;
- case PIVOT_STYLE_FIELDNAME: nStringId = STR_PIVOT_STYLE_FIELDNAME; break;
- case PIVOT_STYLE_TOP: nStringId = STR_PIVOT_STYLE_TOP; break;
- default:
- DBG_ERROR("falsche ID bei ScPivot::SetStyle");
- return;
- }
- String aStyleName = ScGlobal::GetRscString(nStringId);
-
- ScStyleSheetPool* pStlPool = pDoc->GetStyleSheetPool();
- ScStyleSheet* pStyle = (ScStyleSheet*) pStlPool->Find( aStyleName, SFX_STYLE_FAMILY_PARA );
- if (!pStyle)
- {
- // neu anlegen
-
- pStyle = (ScStyleSheet*) &pStlPool->Make( aStyleName, SFX_STYLE_FAMILY_PARA,
- SFXSTYLEBIT_USERDEF );
- pStyle->SetParent( ScGlobal::GetRscString(STR_STYLENAME_STANDARD) );
- SfxItemSet& rSet = pStyle->GetItemSet();
- if ( nId==PIVOT_STYLE_RESULT || nId==PIVOT_STYLE_TITLE )
- rSet.Put( SvxWeightItem( WEIGHT_BOLD, ATTR_FONT_WEIGHT ) );
- if ( nId==PIVOT_STYLE_CATEGORY || nId==PIVOT_STYLE_TITLE )
- rSet.Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_LEFT, ATTR_HOR_JUSTIFY ) );
- }
-
- pDoc->pTab[nDestTab]->ApplyStyleArea( nCol1, nRow1, nCol2, nRow2, *pStyle );
-}
-
-void ScPivot::SetValue(SCCOL nCol, SCROW nRow, const SubTotal& rTotal, USHORT nFunc)
-{
- if ( rTotal.Valid( nFunc ) == 1)
- pDoc->SetValue(nCol, nRow, nDestTab, rTotal.Result( nFunc ));
- else if ( rTotal.Valid( nFunc ) == 0)
- pDoc->SetError(nCol, nRow, nDestTab, errNoValue);
-}
-
-//--------------------------------------------------------------------------------------------------
-
-void ScPivot::GetParam( ScPivotParam& rParam, ScQueryParam& rQuery, ScArea& rSrcArea ) const
-{
- SCSIZE nCount;
- SCCOL nDummyCol;
- SCROW nDummyRow;
- GetDestArea( rParam.nCol,rParam.nRow, nDummyCol,nDummyRow, rParam.nTab );
-
- // Row und Col in der Bedeutung vertauscht:
- GetRowFields( rParam.aColArr, nCount );
- rParam.nColCount = nCount;
- GetColFields( rParam.aRowArr, nCount );
- rParam.nRowCount = nCount;
- GetDataFields( rParam.aDataArr, nCount );
- rParam.nDataCount = nCount;
-
- rParam.bIgnoreEmptyRows = GetIgnoreEmpty();
- rParam.bDetectCategories = GetDetectCat();
- rParam.bMakeTotalCol = GetMakeTotalCol();
- rParam.bMakeTotalRow = GetMakeTotalRow();
-
- GetQuery(rQuery);
- GetSrcArea( rSrcArea.nColStart, rSrcArea.nRowStart,
- rSrcArea.nColEnd, rSrcArea.nRowEnd, rSrcArea.nTab );
-}
-
-void ScPivot::SetParam( const ScPivotParam& rParam, const ScQueryParam& rQuery,
- const ScArea& rSrcArea )
-{
- SetQuery( rQuery );
- SetHeader( TRUE );
- SetSrcArea( rSrcArea.nColStart, rSrcArea.nRowStart,
- rSrcArea.nColEnd, rSrcArea.nRowEnd, rSrcArea.nTab );
- SetDestPos( rParam.nCol, rParam.nRow, rParam.nTab );
- SetIgnoreEmpty( rParam.bIgnoreEmptyRows );
- SetDetectCat( rParam.bDetectCategories );
- SetMakeTotalCol( rParam.bMakeTotalCol );
- SetMakeTotalRow( rParam.bMakeTotalRow );
-
- // Row und Col in der Bedeutung vertauscht:
- SetRowFields( rParam.aColArr, rParam.nColCount );
- SetColFields( rParam.aRowArr, rParam.nRowCount );
- SetDataFields( rParam.aDataArr, rParam.nDataCount );
-}
-
-ScDataObject* ScPivot::Clone() const
-{
- return new ScPivot(*this);
-}
-
-//--------------------------------------------------------------------------------------------------
-// PivotScStrCollection
-//--------------------------------------------------------------------------------------------------
-
-ScDataObject* PivotScStrCollection::Clone() const
-{
- return new PivotScStrCollection(*this);
-}
-
-short PivotScStrCollection::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const
-{
- DBG_ASSERT(pKey1&&pKey2,"0-Zeiger bei PivotScStrCollection::Compare");
-
- short nResult = 0;
-
- TypedStrData& rData1 = (TypedStrData&)*pKey1;
- TypedStrData& rData2 = (TypedStrData&)*pKey2;
-
- if ( rData1.nStrType > rData2.nStrType )
- nResult = 1;
- else if ( rData1.nStrType < rData2.nStrType )
- nResult = -1;
- else if ( !rData1.nStrType /* && !rData2.nStrType */ )
- {
- // Zahlen vergleichen:
-
- if ( rData1.nValue == rData2.nValue )
- nResult = 0;
- else if ( rData1.nValue < rData2.nValue )
- nResult = -1;
- else
- nResult = 1;
- }
- else /* if ( rData1.nStrType && rData2.nStrType ) */
- {
- // Strings vergleichen:
-
- if (pUserData)
- nResult = sal::static_int_cast<short>(pUserData->ICompare(rData1.aStrValue, rData2.aStrValue));
- else
- {
- nResult = (short) ScGlobal::pTransliteration->compareString(
- rData1.aStrValue, rData2.aStrValue );
- }
- }
-
- return nResult;
-}
-
-USHORT PivotScStrCollection::GetIndex(TypedStrData* pData) const
-{
- USHORT nIndex = 0;
- if (!Search(pData, nIndex))
- nIndex = 0;
- return nIndex;
-}
-
-//--------------------------------------------------------------------------------------------------
-// PivotCollection
-//--------------------------------------------------------------------------------------------------
-
-String ScPivotCollection::CreateNewName( USHORT nMin ) const
-{
- String aBase( RTL_CONSTASCII_USTRINGPARAM("DataPilot") );
- //! from Resource?
-
- for (USHORT nAdd=0; nAdd<=nCount; nAdd++) // nCount+1 Versuche
- {
- String aNewName = aBase;
- aNewName += String::CreateFromInt32( nMin + nAdd );
- BOOL bFound = FALSE;
- for (USHORT i=0; i<nCount && !bFound; i++)
- if (((ScPivot*)pItems[i])->GetName() == aNewName)
- bFound = TRUE;
- if (!bFound)
- return aNewName; // freien Namen gefunden
- }
- return String(); // sollte nicht vorkommen
-}
-
-ScPivot* ScPivotCollection::GetPivotAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const
-{
- if (pItems)
- {
- for (USHORT i = 0; i < nCount; i++)
- if (((ScPivot*)pItems[i])->IsPivotAtCursor(nCol, nRow, nTab))
- {
- return (ScPivot*)pItems[i];
- }
- }
- return NULL;
-}
-
-BOOL ScPivotCollection::Load(SvStream& rStream)
-{
- BOOL bSuccess = TRUE;
- USHORT nNewCount, i;
- FreeAll();
-
- ScMultipleReadHeader aHdr( rStream );
-
- rStream >> nNewCount;
- for (i=0; i<nNewCount && bSuccess; i++)
- {
- ScPivot* pPivot = new ScPivot( pDoc );
- if (pPivot)
- {
- bSuccess = pPivot->Load(rStream, aHdr);
- Insert( pPivot );
- }
- else
- bSuccess = FALSE;
- }
-
- // fuer alte Dateien: eindeutige Namen vergeben
-
- if (bSuccess)
- for (i=0; i<nCount; i++)
- if (!((const ScPivot*)At(i))->GetName().Len())
- ((ScPivot*)At(i))->SetName( CreateNewName() );
-
- return bSuccess;
-}
-
-BOOL ScPivotCollection::Store(SvStream& rStream) const
-{
- BOOL bSuccess = TRUE;
-
- ScMultipleWriteHeader aHdr( rStream );
-
- rStream << nCount;
-
- for (USHORT i=0; i<nCount && bSuccess; i++)
- bSuccess = ((const ScPivot*)At(i))->Store( rStream, aHdr );
-
- return bSuccess;
-}
-
-void ScPivotCollection::UpdateReference(UpdateRefMode eUpdateRefMode,
- SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
- SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
- SCsCOL nDx, SCsROW nDy, SCsTAB nDz )
-{
- for (USHORT i=0; i<nCount; i++)
- {
- SCCOL theCol1;
- SCROW theRow1;
- SCTAB theTab1;
- SCCOL theCol2;
- SCROW theRow2;
- SCTAB theTab2;
- ScRefUpdateRes eRes;
- ScPivot* pPivot = (ScPivot*)pItems[i];
-
- // Source
-
- pPivot->GetSrcArea( theCol1, theRow1, theCol2, theRow2, theTab1 );
- theTab2 = theTab1;
-
- eRes = ScRefUpdate::Update( pDoc, eUpdateRefMode,
- nCol1,nRow1,nTab1, nCol2,nRow2,nTab2, nDx,nDy,nDz,
- theCol1,theRow1,theTab1, theCol2,theRow2,theTab2 );
-
- if (eRes != UR_NOTHING)
- pPivot->MoveSrcArea( theCol1, theRow1, theTab1 );
-
- // Dest
-
- pPivot->GetDestArea( theCol1, theRow1, theCol2, theRow2, theTab1 );
- theTab2 = theTab1;
-
- eRes = ScRefUpdate::Update( pDoc, eUpdateRefMode,
- nCol1,nRow1,nTab1, nCol2,nRow2,nTab2, nDx,nDy,nDz,
- theCol1,theRow1,theTab1, theCol2,theRow2,theTab2 );
-
- if (eRes != UR_NOTHING)
- pPivot->MoveDestArea( theCol1, theRow1, theTab1 );
- }
-}
-
-void ScPivotCollection::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY )
-{
- // nur Quell-Bereich
-
- for (USHORT i=0; i<nCount; i++)
- {
- ScPivot* pPivot = (ScPivot*)pItems[i];
- ScRange aSrc = pPivot->GetSrcArea();
- ScRefUpdateRes eRes = ScRefUpdate::DoGrow( rArea, nGrowX, nGrowY, aSrc );
- if (eRes != UR_NOTHING)
- pPivot->ExtendSrcArea( aSrc.aEnd.Col(), aSrc.aEnd.Row() );
- }
-}
-
-BOOL ScPivotCollection::operator==(const ScPivotCollection& rCmp) const
-{
- if (nCount != rCmp.nCount)
- return FALSE;
-
- if (!nCount)
- return TRUE; // beide leer - nicht erst die Param's anlegen!
-
- ScPivotParam aMyParam, aCmpParam;
- ScQueryParam aMyQuery, aCmpQuery;
- ScArea aMyArea, aCmpArea;
-
- for (USHORT i=0; i<nCount; i++)
- {
- ScPivot* pMyPivot = (ScPivot*)pItems[i];
- pMyPivot->GetParam( aMyParam, aMyQuery, aMyArea );
- ScPivot* pCmpPivot = (ScPivot*)rCmp.pItems[i];
- pCmpPivot->GetParam( aCmpParam, aCmpQuery, aCmpArea );
- if (!( aMyArea==aCmpArea && aMyParam==aCmpParam && aMyQuery==aCmpQuery ))
- return FALSE;
- }
-
- return TRUE;
-}
-
-ScDataObject* ScPivotCollection::Clone() const
-{
- return new ScPivotCollection(*this);
-}
-
-#endif
-
// ============================================================================
LabelData::LabelData( const String& rName, short nCol, bool bIsValue ) :
diff --git a/sc/source/core/data/poolhelp.cxx b/sc/source/core/data/poolhelp.cxx
index 0121eca685e4..d85e16ad135f 100644
--- a/sc/source/core/data/poolhelp.cxx
+++ b/sc/source/core/data/poolhelp.cxx
@@ -46,26 +46,16 @@
// -----------------------------------------------------------------------
ScPoolHelper::ScPoolHelper( ScDocument* pSourceDoc )
+:pFormTable(NULL)
+,pEditPool(NULL)
+,pEnginePool(NULL)
+,m_pSourceDoc(pSourceDoc)
{
DBG_ASSERT( pSourceDoc, "ScPoolHelper: no document" );
-
pDocPool = new ScDocumentPool;
pDocPool->FreezeIdRanges();
mxStylePool = new ScStyleSheetPool( *pDocPool, pSourceDoc );
-
- pFormTable = new SvNumberFormatter( pSourceDoc->GetServiceManager(), ScGlobal::eLnge );
- pFormTable->SetColorLink( LINK( pSourceDoc, ScDocument, GetUserDefinedColor ) );
- pFormTable->SetEvalDateFormat( NF_EVALDATEFORMAT_INTL_FORMAT );
-
- pEditPool = EditEngine::CreatePool();
- pEditPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM );
- pEditPool->FreezeIdRanges();
- pEditPool->SetFileFormatVersion( SOFFICE_FILEFORMAT_50 ); // used in ScGlobal::EETextObjEqual
-
- pEnginePool = EditEngine::CreatePool();
- pEnginePool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM );
- pEnginePool->FreezeIdRanges();
}
ScPoolHelper::~ScPoolHelper()
@@ -76,12 +66,64 @@ ScPoolHelper::~ScPoolHelper()
mxStylePool.clear();
SfxItemPool::Free(pDocPool);
}
+SfxItemPool* ScPoolHelper::GetEditPool() const
+{
+ if ( !pEditPool )
+ {
+ pEditPool = EditEngine::CreatePool();
+ pEditPool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM );
+ pEditPool->FreezeIdRanges();
+ pEditPool->SetFileFormatVersion( SOFFICE_FILEFORMAT_50 ); // used in ScGlobal::EETextObjEqual
+ }
+ return pEditPool;
+}
+SfxItemPool* ScPoolHelper::GetEnginePool() const
+{
+ if ( !pEnginePool )
+ {
+ pEnginePool = EditEngine::CreatePool();
+ pEnginePool->SetDefaultMetric( SFX_MAPUNIT_100TH_MM );
+ pEnginePool->FreezeIdRanges();
+ } // ifg ( pEnginePool )
+ return pEnginePool;
+}
+SvNumberFormatter* ScPoolHelper::GetFormTable() const
+{
+ if ( !pFormTable )
+ {
+ pFormTable = new SvNumberFormatter( m_pSourceDoc->GetServiceManager(), ScGlobal::eLnge );
+ pFormTable->SetColorLink( LINK( m_pSourceDoc, ScDocument, GetUserDefinedColor ) );
+ pFormTable->SetEvalDateFormat( NF_EVALDATEFORMAT_INTL_FORMAT );
+
+ UseDocOptions(); // null date, year2000, std precision
+ }
+ return pFormTable;
+}
+
+void ScPoolHelper::UseDocOptions() const
+{
+ if (pFormTable)
+ {
+ USHORT d,m,y;
+ aOpt.GetDate( d,m,y );
+ pFormTable->ChangeNullDate( d,m,y );
+ pFormTable->ChangeStandardPrec( (USHORT)aOpt.GetStdPrecision() );
+ pFormTable->SetYear2000( aOpt.GetYear2000() );
+ }
+}
+
+void ScPoolHelper::SetFormTableOpt(const ScDocOptions& rOpt)
+{
+ aOpt = rOpt;
+ UseDocOptions(); // #i105512# if the number formatter exists, update its settings
+}
void ScPoolHelper::SourceDocumentGone()
{
// reset all pointers to the source document
mxStylePool->SetDocument( NULL );
- pFormTable->SetColorLink( Link() );
+ if ( pFormTable )
+ pFormTable->SetColorLink( Link() );
}
// -----------------------------------------------------------------------
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index c53694b7674c..7a08f352ed91 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -652,7 +652,9 @@ void ScPostIt::CreateCaptionFromInitData( const ScAddress& rPos ) const
been created already. */
OSL_ENSURE( !mrDoc.IsUndo() && !mrDoc.IsClipboard(), "ScPostIt::CreateCaptionFromInitData - note caption should not be created in undo/clip documents" );
- if( !maNoteData.mpCaption )
+ /* #i104915# Never try to create notes in Undo document, leads to
+ crash due to missing document members (e.g. row height array). */
+ if( !maNoteData.mpCaption && !mrDoc.IsUndo() )
{
// ScNoteCaptionCreator c'tor creates the caption and inserts it into the document and maNoteData
ScNoteCaptionCreator aCreator( mrDoc, rPos, maNoteData );
@@ -704,8 +706,13 @@ void ScPostIt::CreateCaption( const ScAddress& rPos, const SdrCaptionObj* pCapti
OSL_ENSURE( !maNoteData.mpCaption, "ScPostIt::CreateCaption - unexpected caption object found" );
maNoteData.mpCaption = 0;
- // drawing layer may be missing, if a note is copied into a clipboard document
+ /* #i104915# Never try to create notes in Undo document, leads to
+ crash due to missing document members (e.g. row height array). */
OSL_ENSURE( !mrDoc.IsUndo(), "ScPostIt::CreateCaption - note caption should not be created in undo documents" );
+ if( mrDoc.IsUndo() )
+ return;
+
+ // drawing layer may be missing, if a note is copied into a clipboard document
if( mrDoc.IsClipboard() )
mrDoc.InitDrawLayer();
@@ -786,19 +793,16 @@ SdrCaptionObj* ScNoteUtil::CreateTempCaption(
OUStringBuffer aBuffer( rUserText );
// add plain text of invisible (!) cell note (no formatting etc.)
SdrCaptionObj* pNoteCaption = 0;
- if( const ScPostIt* pNote = rDoc.GetNote( rPos ) )
+ const ScPostIt* pNote = rDoc.GetNote( rPos );
+ if( pNote && !pNote->IsCaptionShown() )
{
- if( !pNote->IsCaptionShown() )
- {
- if( aBuffer.getLength() > 0 )
- aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\n--------\n" ) );
- aBuffer.append( pNote->GetText() );
- pNoteCaption = pNote->GetOrCreateCaption( rPos );
- }
+ if( aBuffer.getLength() > 0 )
+ aBuffer.appendAscii( RTL_CONSTASCII_STRINGPARAM( "\n--------\n" ) ).append( pNote->GetText() );
+ pNoteCaption = pNote->GetOrCreateCaption( rPos );
}
// create a caption if any text exists
- if( aBuffer.getLength() == 0 )
+ if( !pNoteCaption && (aBuffer.getLength() == 0) )
return 0;
// prepare visible rectangle (add default distance to all borders)
@@ -811,20 +815,24 @@ SdrCaptionObj* ScNoteUtil::CreateTempCaption(
// create the caption object
ScCaptionCreator aCreator( rDoc, rPos, true, bTailFront );
SdrCaptionObj* pCaption = aCreator.GetCaption();
+
// insert caption into page (needed to set caption text)
rDrawPage.InsertObject( pCaption );
- // set the text to the object
- pCaption->SetText( aBuffer.makeStringAndClear() );
- // set formatting (must be done after setting text) and resize the box to fit the text
+ // clone the edit text object, unless user text is present, then set this text
if( pNoteCaption && (rUserText.getLength() == 0) )
{
+ if( OutlinerParaObject* pOPO = pNoteCaption->GetOutlinerParaObject() )
+ pCaption->SetOutlinerParaObject( new OutlinerParaObject( *pOPO ) );
+ // set formatting (must be done after setting text) and resize the box to fit the text
pCaption->SetMergedItemSetAndBroadcast( pNoteCaption->GetMergedItemSet() );
Rectangle aCaptRect( pCaption->GetLogicRect().TopLeft(), pNoteCaption->GetLogicRect().GetSize() );
pCaption->SetLogicRect( aCaptRect );
}
else
{
+ // if pNoteCaption is null, then aBuffer contains some text
+ pCaption->SetText( aBuffer.makeStringAndClear() );
ScCaptionUtil::SetDefaultItems( *pCaption, rDoc );
// adjust caption size to text size
long nMaxWidth = ::std::min< long >( aVisRect.GetWidth() * 2 / 3, SC_NOTECAPTION_MAXWIDTH_TEMP );
diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 22926f31d003..260385d6feac 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -95,10 +95,10 @@ void ScStyleSheetPool::SetDocument( ScDocument* pDocument )
//------------------------------------------------------------------------
-void ScStyleSheetPool::SetForceStdName( const String* pSet )
-{
- pForceStdName = pSet;
-}
+//UNUSED2009-05 void ScStyleSheetPool::SetForceStdName( const String* pSet )
+//UNUSED2009-05 {
+//UNUSED2009-05 pForceStdName = pSet;
+//UNUSED2009-05 }
//------------------------------------------------------------------------
@@ -263,7 +263,7 @@ void ScStyleSheetPool::CreateStandardStyles()
String aStr;
xub_StrLen nStrLen;
String aHelpFile;//XXX JN welcher Text???
- ULONG nNumFmt = 0L;
+ //ULONG nNumFmt = 0L;
SfxItemSet* pSet = NULL;
SfxItemSet* pHFSet = NULL;
SvxSetItem* pHFSetItem = NULL;
@@ -345,10 +345,11 @@ void ScStyleSheetPool::CreateStandardStyles()
pSheet->SetParent( SCSTR( STR_STYLENAME_RESULT ) );
pSheet->SetHelpId( aHelpFile, HID_SC_SHEET_CELL_ERG1 );
- pSet = &pSheet->GetItemSet();
- nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_CURRENCY,
- ScGlobal::eLnge );
- pSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumFmt ) );
+ // will now be done in GetItemSet();
+ // pSet = &pSheet->GetItemSet();
+ // nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_CURRENCY,
+ // ScGlobal::eLnge );
+ // pSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumFmt ) );
//----------------
// 4. Ueberschrift
diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx
index bad2c664cc4d..4452cd357132 100644
--- a/sc/source/core/data/stlsheet.cxx
+++ b/sc/source/core/data/stlsheet.cxx
@@ -53,10 +53,11 @@
#include <svtools/smplhint.hxx>
#include "attrib.hxx"
+
#include <vcl/svapp.hxx> // GetSettings()
#include "globstr.hrc"
-
+#include "sc.hrc"
//------------------------------------------------------------------------
TYPEINIT1(ScStyleSheet, SfxStyleSheet);
@@ -247,6 +248,18 @@ SfxItemSet& __EXPORT ScStyleSheet::GetItemSet()
break;
}
bMySet = TRUE;
+ } // if ( !pSet )
+ if ( nHelpId == HID_SC_SHEET_CELL_ERG1 )
+ {
+ if ( !pSet->Count() )
+ {
+ ScDocument* pDoc = ((ScStyleSheetPool&)GetPool()).GetDocument();
+ if ( pDoc )
+ {
+ ULONG nNumFmt = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_CURRENCY,ScGlobal::eLnge );
+ pSet->Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNumFmt ) );
+ } // if ( pDoc && pDoc->IsLoadingDone() )
+ }
}
return *pSet;
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 671ef91e1dbf..7d3a3535678c 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -142,6 +142,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const String& rNewName,
pOutlineTable( NULL ),
bTableAreaValid( FALSE ),
bVisible( TRUE ),
+ bStreamValid( FALSE ),
bPendingRowHeights( FALSE ),
nTab( nNewTab ),
nRecalcLvl( 0 ),
@@ -249,9 +250,18 @@ const String& ScTable::GetUpperName() const
void ScTable::SetVisible( BOOL bVis )
{
+ if (bVisible != bVis && IsStreamValid())
+ SetStreamValid(FALSE);
+
bVisible = bVis;
}
+void ScTable::SetStreamValid( BOOL bSet, BOOL bIgnoreLock )
+{
+ if ( bIgnoreLock || !pDocument->IsStreamValidLocked() )
+ bStreamValid = bSet;
+}
+
void ScTable::SetPendingRowHeights( BOOL bSet )
{
bPendingRowHeights = bSet;
@@ -1248,6 +1258,9 @@ void ScTable::UpdateInsertTab(SCTAB nTable)
{
if (nTab >= nTable) nTab++;
for (SCCOL i=0; i <= MAXCOL; i++) aCol[i].UpdateInsertTab(nTable);
+
+ if (IsStreamValid())
+ SetStreamValid(FALSE);
}
//UNUSED2008-05 void ScTable::UpdateInsertTabOnlyCells(SCTAB nTable)
@@ -1264,6 +1277,9 @@ void ScTable::UpdateDeleteTab( SCTAB nTable, BOOL bIsMove, ScTable* pRefUndo )
for (i=0; i <= MAXCOL; i++) aCol[i].UpdateDeleteTab(nTable, bIsMove, &pRefUndo->aCol[i]);
else
for (i=0; i <= MAXCOL; i++) aCol[i].UpdateDeleteTab(nTable, bIsMove, NULL);
+
+ if (IsStreamValid())
+ SetStreamValid(FALSE);
}
void ScTable::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo,
@@ -1275,6 +1291,9 @@ void ScTable::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo,
aCol[i].UpdateMoveTab( nOldPos, nNewPos, nTabNo );
rProgress.SetState( rProgress.GetState() + aCol[i].GetCodeCount() );
}
+
+ if (IsStreamValid())
+ SetStreamValid(FALSE);
}
void ScTable::UpdateCompile( BOOL bForceIfNameInUse )
@@ -1309,7 +1328,7 @@ void ScTable::FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW n
void ScTable::ReplaceRangeNamesInUse(SCCOL nCol1, SCROW nRow1,
SCCOL nCol2, SCROW nRow2,
- const ScIndexMap& rMap )
+ const ScRangeData::IndexMap& rMap )
{
for (SCCOL i = nCol1; i <= nCol2 && (ValidCol(i)); i++)
{
@@ -1459,11 +1478,11 @@ void ScTable::AddPrintRange( const ScRange& rNew )
aPrintRanges.push_back( rNew );
}
-void ScTable::SetPrintRange( const ScRange& rNew )
-{
- ClearPrintRanges();
- AddPrintRange( rNew );
-}
+//UNUSED2009-05 void ScTable::SetPrintRange( const ScRange& rNew )
+//UNUSED2009-05 {
+//UNUSED2009-05 ClearPrintRanges();
+//UNUSED2009-05 AddPrintRange( rNew );
+//UNUSED2009-05 }
void ScTable::SetPrintEntireSheet()
{
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 59858796078c..c8a25fbe0ec1 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -371,6 +371,16 @@ void ScTable::CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
}
}
+void ScTable::CopyToClip(const ScRangeList& rRanges, ScTable* pTable,
+ bool bKeepScenarioFlags, bool bCloneNoteCaptions)
+{
+ ScRangeList aRanges(rRanges);
+ for (ScRangePtr p = aRanges.First(); p; p = aRanges.Next())
+ {
+ CopyToClip(p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(),
+ pTable, bKeepScenarioFlags, bCloneNoteCaptions);
+ }
+}
void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
SCsCOL nDx, SCsROW nDy, USHORT nInsFlag,
@@ -837,13 +847,13 @@ void ScTable::PutCell( const ScAddress& rPos, ScBaseCell* pCell )
}
-void ScTable::PutCell( const ScAddress& rPos, ULONG nFormatIndex, ScBaseCell* pCell )
-{
- if (pCell)
- aCol[rPos.Col()].Insert( rPos.Row(), nFormatIndex, pCell );
- else
- aCol[rPos.Col()].Delete( rPos.Row() );
-}
+//UNUSED2009-05 void ScTable::PutCell( const ScAddress& rPos, ULONG nFormatIndex, ScBaseCell* pCell )
+//UNUSED2009-05 {
+//UNUSED2009-05 if (pCell)
+//UNUSED2009-05 aCol[rPos.Col()].Insert( rPos.Row(), nFormatIndex, pCell );
+//UNUSED2009-05 else
+//UNUSED2009-05 aCol[rPos.Col()].Delete( rPos.Row() );
+//UNUSED2009-05 }
BOOL ScTable::SetString( SCCOL nCol, SCROW nRow, SCTAB nTabP, const String& rString )
@@ -1182,22 +1192,22 @@ BOOL ScTable::HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USH
}
-BOOL ScTable::HasLines( const ScRange& rRange, Rectangle& rSizes ) const
-{
- SCCOL nCol1 = rRange.aStart.Col();
- SCROW nRow1 = rRange.aStart.Row();
- SCCOL nCol2 = rRange.aEnd.Col();
- SCROW nRow2 = rRange.aEnd.Row();
- PutInOrder( nCol1, nCol2 );
- PutInOrder( nRow1, nRow2 );
-
- BOOL bFound = FALSE;
- for (SCCOL i=nCol1; i<=nCol2; i++)
- if (aCol[i].HasLines( nRow1, nRow2, rSizes, (i==nCol1), (i==nCol2) ))
- bFound = TRUE;
-
- return bFound;
-}
+//UNUSED2009-05 BOOL ScTable::HasLines( const ScRange& rRange, Rectangle& rSizes ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 SCCOL nCol1 = rRange.aStart.Col();
+//UNUSED2009-05 SCROW nRow1 = rRange.aStart.Row();
+//UNUSED2009-05 SCCOL nCol2 = rRange.aEnd.Col();
+//UNUSED2009-05 SCROW nRow2 = rRange.aEnd.Row();
+//UNUSED2009-05 PutInOrder( nCol1, nCol2 );
+//UNUSED2009-05 PutInOrder( nRow1, nRow2 );
+//UNUSED2009-05
+//UNUSED2009-05 BOOL bFound = FALSE;
+//UNUSED2009-05 for (SCCOL i=nCol1; i<=nCol2; i++)
+//UNUSED2009-05 if (aCol[i].HasLines( nRow1, nRow2, rSizes, (i==nCol1), (i==nCol2) ))
+//UNUSED2009-05 bFound = TRUE;
+//UNUSED2009-05
+//UNUSED2009-05 return bFound;
+//UNUSED2009-05 }
BOOL ScTable::HasAttribSelection( const ScMarkData& rMark, USHORT nMask ) const
@@ -2837,7 +2847,7 @@ void ScTable::GetUpperCellString(SCCOL nCol, SCROW nRow, String& rStr)
// Berechnen der Groesse der Tabelle und setzen der Groesse an der DrawPage
-void ScTable::SetDrawPageSize()
+void ScTable::SetDrawPageSize(bool bResetStreamValid)
{
ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
if( pDrawLayer )
@@ -2852,6 +2862,11 @@ void ScTable::SetDrawPageSize()
pDrawLayer->SetPageSize( static_cast<sal_uInt16>(nTab), Size( x, y ) );
}
+
+ // #i102616# actions that modify the draw page size count as sheet modification
+ // (exception: InitDrawLayer)
+ if (bResetStreamValid && IsStreamValid())
+ SetStreamValid(FALSE);
}
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index ae299fdf5fca..01dc74f8644e 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -171,8 +171,8 @@ ScSortInfoArray* ScTable::CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2 )
BOOL ScTable::IsSortCollatorGlobal() const
{
- return pSortCollator == ScGlobal::pCollator ||
- pSortCollator == ScGlobal::pCaseCollator;
+ return pSortCollator == ScGlobal::GetCollator() ||
+ pSortCollator == ScGlobal::GetCaseCollator();
}
@@ -188,8 +188,8 @@ void ScTable::InitSortCollator( const ScSortParam& rPar )
else
{ // SYSTEM
DestroySortCollator();
- pSortCollator = (rPar.bCaseSens ? ScGlobal::pCaseCollator :
- ScGlobal::pCollator);
+ pSortCollator = (rPar.bCaseSens ? ScGlobal::GetCaseCollator() :
+ ScGlobal::GetCollator());
}
}
@@ -948,10 +948,10 @@ BOOL ScTable::ValidQuery(SCROW nRow, const ScQueryParam& rParam,
long nPos = -1;
SCSIZE i = 0;
BOOL bMatchWholeCell = pDocument->GetDocOptions().IsMatchWholeCell();
- CollatorWrapper* pCollator = (rParam.bCaseSens ? ScGlobal::pCaseCollator :
- ScGlobal::pCollator);
+ CollatorWrapper* pCollator = (rParam.bCaseSens ? ScGlobal::GetCaseCollator() :
+ ScGlobal::GetCollator());
::utl::TransliterationWrapper* pTransliteration = (rParam.bCaseSens ?
- ScGlobal::pCaseTransliteration : ScGlobal::pTransliteration);
+ ScGlobal::GetCaseTransliteration() : ScGlobal::GetpTransliteration());
while ( (i < nEntryCount) && rParam.GetEntry(i).bDoQuery )
{
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 021385678160..eb959dfb2ffa 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -353,6 +353,9 @@ void ScTable::SetPageStyle( const String& rName )
if ( pNewStyle ) // auch ohne den alten (fuer UpdateStdNames)
aPageStyle = aStrNew;
+
+ if (IsStreamValid())
+ SetStreamValid(FALSE);
}
}
}
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 9ca7b29b745e..09362b9996ed 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -658,7 +658,7 @@ BOOL ScTable::SearchAndReplace(const SvxSearchItem& rSearchItem,
{
// SearchParam no longer needed - SearchOptions contains all settings
com::sun::star::util::SearchOptions aSearchOptions = rSearchItem.GetSearchOptions();
- aSearchOptions.Locale = *ScGlobal::pLocale;
+ aSearchOptions.Locale = *ScGlobal::GetLocale();
// #107259# reflect UseAsianOptions flag in SearchOptions
// (use only ignore case and width if asian options are disabled).
diff --git a/sc/source/core/data/validat.cxx b/sc/source/core/data/validat.cxx
index 9bb8bff1081f..443474060c3e 100644
--- a/sc/source/core/data/validat.cxx
+++ b/sc/source/core/data/validat.cxx
@@ -953,13 +953,6 @@ ScValidationData* ScValidationDataList::GetData( sal_uInt32 nKey )
return NULL;
}
-void ScValidationDataList::ResetUsed()
-{
- USHORT nCount = Count();
- for (USHORT i=0; i<nCount; i++)
- (*this)[i]->SetUsed(FALSE);
-}
-
void ScValidationDataList::CompileXML()
{
USHORT nCount = Count();
diff --git a/sc/source/core/inc/bcaslot.hxx b/sc/source/core/inc/bcaslot.hxx
index ef2f77b55684..79335a35fa7e 100644
--- a/sc/source/core/inc/bcaslot.hxx
+++ b/sc/source/core/inc/bcaslot.hxx
@@ -192,6 +192,7 @@ public:
void UpdateRemove( UpdateRefMode eUpdateRefMode,
const ScRange& rRange,
SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
+ void UpdateRemoveArea( ScBroadcastArea* pArea );
void UpdateInsert( ScBroadcastArea* pArea );
};
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 9fcf743c1e85..659884dfd5de 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -193,6 +193,7 @@ void ReplaceCell( ScAddress& ); // for TableOp
void ReplaceCell( SCCOL& rCol, SCROW& rRow, SCTAB& rTab ); // for TableOp
BOOL IsTableOpInRange( const ScRange& );
ULONG GetCellNumberFormat( const ScAddress&, const ScBaseCell* );
+double ConvertStringToValue( const String& );
double GetCellValue( const ScAddress&, const ScBaseCell* );
double GetCellValueOrZero( const ScAddress&, const ScBaseCell* );
double GetValueCellValue( const ScAddress&, const ScValueCell* );
@@ -453,6 +454,8 @@ void ScClean();
void ScChar();
void ScJis();
void ScAsc();
+void ScUnicode();
+void ScUnichar();
void ScMin( BOOL bTextAsZero = FALSE );
void ScMax( BOOL bTextAsZero = FALSE );
double IterateParameters( ScIterFunc, BOOL bTextAsZero = FALSE );
@@ -542,7 +545,17 @@ void ScSpewFunc();
void ScGame();
//----------------Funktionen in interpr2.cxx---------------
-double GetDate(INT16 nYear, INT16 nMonth, INT16 nDay);
+
+/** Obtain the date serial number for a given date.
+ @param bStrict
+ If FALSE, nYear < 100 takes the two-digit year setting into account,
+ and rollover of invalid calendar dates takes place, e.g. 1999-02-31 =>
+ 1999-03-03.
+ If TRUE, the date passed must be a valid Gregorian calendar date. No
+ two-digit expanding or rollover is done.
+ */
+double GetDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, bool bStrict );
+
void ScGetActDate();
void ScGetActTime();
void ScGetYear();
@@ -682,6 +695,7 @@ void ScNoName();
void ScBadName();
// Statistik:
double phi(double x);
+double integralPhi(double x);
double taylor(double* pPolynom, USHORT nMax, double x);
double gauss(double x);
double gaussinv(double x);
diff --git a/sc/source/core/inc/parclass.hxx b/sc/source/core/inc/parclass.hxx
index be66587b4c0e..c72bcece7f19 100644
--- a/sc/source/core/inc/parclass.hxx
+++ b/sc/source/core/inc/parclass.hxx
@@ -72,7 +72,14 @@ public:
/** Area reference must be converted to array in any case, and must
also be propagated to subsequent operators and functions being part
of a parameter of this function. */
- ForceArray
+ ForceArray,
+
+ /** Area reference is not converted to array, but ForceArray must be
+ propagated to subsequent operators and functions being part of a
+ parameter of this function. Used with functions that treat
+ references separately from arrays, but need the forced array
+ calculation of parameters that are not references.*/
+ ReferenceOrForceArray
};
/// MUST be called once before any other method.
@@ -87,7 +94,7 @@ public:
USHORT nParameter);
/** Whether OpCode has a parameter of type
- ForceArray. */
+ ForceArray or ReferenceOrForceArray. */
static inline bool HasForceArray( OpCode eOp)
{
return 0 <= (short)eOp &&
diff --git a/sc/source/core/inc/poolhelp.hxx b/sc/source/core/inc/poolhelp.hxx
index 0d43278978b8..00474d63c080 100644
--- a/sc/source/core/inc/poolhelp.hxx
+++ b/sc/source/core/inc/poolhelp.hxx
@@ -34,6 +34,7 @@
#include <rtl/ref.hxx>
#include <vos/refernce.hxx>
#include <tools/link.hxx>
+#include "docoptio.hxx"
class ScDocument;
class ScDocumentPool;
@@ -45,11 +46,15 @@ class SfxItemPool;
class ScPoolHelper : public vos::OReference
{
private:
+ ScDocOptions aOpt;
ScDocumentPool* pDocPool;
rtl::Reference< ScStyleSheetPool > mxStylePool;
- SvNumberFormatter* pFormTable;
- SfxItemPool* pEditPool; // EditTextObjectPool
- SfxItemPool* pEnginePool; // EditEnginePool
+ mutable SvNumberFormatter* pFormTable;
+ mutable SfxItemPool* pEditPool; // EditTextObjectPool
+ mutable SfxItemPool* pEnginePool; // EditEnginePool
+ ScDocument* m_pSourceDoc;
+
+ void UseDocOptions() const;
public:
ScPoolHelper( ScDocument* pSourceDoc );
@@ -61,9 +66,11 @@ public:
// access to pointers (are never 0):
ScDocumentPool* GetDocPool() const { return pDocPool; }
ScStyleSheetPool* GetStylePool() const { return mxStylePool.get(); }
- SvNumberFormatter* GetFormTable() const { return pFormTable; }
- SfxItemPool* GetEditPool() const { return pEditPool; }
- SfxItemPool* GetEnginePool() const { return pEnginePool; }
+ SvNumberFormatter* GetFormTable() const;
+ SfxItemPool* GetEditPool() const;
+ SfxItemPool* GetEnginePool() const;
+
+ void SetFormTableOpt(const ScDocOptions& rOpt);
};
#endif
diff --git a/sc/source/core/inc/refupdat.hxx b/sc/source/core/inc/refupdat.hxx
index 0461578db0a6..6ecc67259463 100644
--- a/sc/source/core/inc/refupdat.hxx
+++ b/sc/source/core/inc/refupdat.hxx
@@ -82,7 +82,7 @@ public:
ScComplexRefData& rRef, BOOL bWrap, BOOL bAbsolute );
static void MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos,
- ScComplexRefData& rRef );
+ SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData& rRef );
/// Before calling, the absolute references must be up-to-date!
static ScRefUpdateRes UpdateTranspose( ScDocument* pDoc,
@@ -96,11 +96,6 @@ public:
static ScRefUpdateRes UpdateGrow(
const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY,
ScComplexRefData& rRef );
-
-#if OLD_PIVOT_IMPLEMENTATION
- static ScRefUpdateRes DoGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY,
- ScRange& rRef );
-#endif
};
diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx
index b38d5b52e4f5..259018e213ce 100644
--- a/sc/source/core/tool/address.cxx
+++ b/sc/source/core/tool/address.cxx
@@ -59,13 +59,13 @@ ScAddress::Details::Details ( const ScDocument* pDoc,
{
}
-void ScAddress::Details::SetPos ( const ScDocument* pDoc,
- const ScAddress & rAddr )
-{
- nRow = rAddr.Row();
- nCol = rAddr.Col();
- eConv = pDoc->GetAddressConvention();
-}
+//UNUSED2009-05 void ScAddress::Details::SetPos ( const ScDocument* pDoc,
+//UNUSED2009-05 const ScAddress & rAddr )
+//UNUSED2009-05 {
+//UNUSED2009-05 nRow = rAddr.Row();
+//UNUSED2009-05 nCol = rAddr.Col();
+//UNUSED2009-05 eConv = pDoc->GetAddressConvention();
+//UNUSED2009-05 }
////////////////////////////////////////////////////////////////////////////
@@ -218,18 +218,55 @@ static bool lcl_ScRange_External_TabSpan(
return true;
}
-// Returns NULL if the string should be a sheet name, but is invalid.
-// Returns a pointer to the first character after the sheet name, if there was
-// any, else pointer to start.
+/** Returns NULL if the string should be a sheet name, but is invalid.
+ Returns a pointer to the first character after the sheet name, if there was
+ any, else pointer to start.
+ @param pMsoxlQuoteStop
+ Starting _within_ a quoted name, but still may be 3D; quoted name stops
+ at pMsoxlQuoteStop
+ */
static const sal_Unicode *
lcl_XL_ParseSheetRef( const sal_Unicode* start,
String& rExternTabName,
- bool allow_3d )
+ bool allow_3d,
+ const sal_Unicode* pMsoxlQuoteStop )
{
String aTabName;
const sal_Unicode *p = start;
- if( *p == '\'' ) // XL only seems to use single quotes for sheet names
+ // XL only seems to use single quotes for sheet names.
+ if (pMsoxlQuoteStop)
+ {
+ const sal_Unicode* pCurrentStart = p;
+ while (p < pMsoxlQuoteStop)
+ {
+ if (*p == '\'')
+ {
+ // We pre-analyzed the quoting, no checks needed here.
+ if (*++p == '\'')
+ {
+ aTabName.Append( pCurrentStart,
+ sal::static_int_cast<xub_StrLen>( p - pCurrentStart));
+ pCurrentStart = ++p;
+ }
+ }
+ else if (*p == ':')
+ {
+ break; // while
+ }
+ else
+ ++p;
+ }
+ if (pCurrentStart < p)
+ aTabName.Append( pCurrentStart, sal::static_int_cast<xub_StrLen>( p - pCurrentStart));
+ if (!aTabName.Len())
+ return NULL;
+ if (p == pMsoxlQuoteStop)
+ ++p; // position on ! of ...'!...
+ if( *p != '!' && ( !allow_3d || *p != ':' ) )
+ return (!allow_3d && *p == ':') ? p : start;
+ }
+ else if( *p == '\'')
{
p = lcl_ParseQuotedName(p, aTabName);
if (!aTabName.Len())
@@ -290,8 +327,8 @@ lcl_XL_ParseSheetRef( const sal_Unicode* start,
break;
}
- if( *p != '!' &&( !allow_3d || *p != ':' ) )
- return start;
+ if( *p != '!' && ( !allow_3d || *p != ':' ) )
+ return (!allow_3d && *p == ':') ? p : start;
aTabName.Append( start, sal::static_int_cast<xub_StrLen>( p - start ) );
}
@@ -318,6 +355,7 @@ const sal_Unicode* ScRange::Parse_XL_Header(
rStartTabName.Erase();
rEndTabName.Erase();
rExternDocName.Erase();
+ const sal_Unicode* pMsoxlQuoteStop = NULL;
if (*p == '[')
{
++p;
@@ -371,9 +409,47 @@ const sal_Unicode* ScRange::Parse_XL_Header(
}
rExternDocName = ScGlobal::GetAbsDocName(rExternDocName, pDoc->GetDocumentShell());
}
+ else if (*p == '\'')
+ {
+ // Sickness in Excel's ODF msoxl namespace:
+ // 'E:\[EXTDATA8.XLS]Sheet1'!$A$7 or
+ // 'E:\[EXTDATA12B.XLSB]Sheet1:Sheet3'!$A$11
+ // But, 'Sheet1'!B3 would also be a valid!
+ // Excel does not allow [ and ] characters in sheet names though.
+ p = lcl_ParseQuotedName(p, rExternDocName);
+ if (!*p || *p != '!')
+ return start;
+ if (rExternDocName.Len())
+ {
+ xub_StrLen nOpen = rExternDocName.Search( '[');
+ if (nOpen == STRING_NOTFOUND)
+ rExternDocName.Erase();
+ else
+ {
+ xub_StrLen nClose = rExternDocName.Search( ']', nOpen+1);
+ if (nClose == STRING_NOTFOUND)
+ rExternDocName.Erase();
+ else
+ {
+ rExternDocName.Erase( nClose);
+ rExternDocName.Erase( nOpen, 1);
+ pMsoxlQuoteStop = p - 1; // the ' quote char
+ // There may be embedded escaped quotes, just matching the
+ // doc name's length may not work.
+ for (p = start; *p != '['; ++p)
+ ;
+ for ( ; *p != ']'; ++p)
+ ;
+ ++p;
+ }
+ }
+ }
+ if (!rExternDocName.Len())
+ p = start;
+ }
startTabs = p;
- p = lcl_XL_ParseSheetRef( p, rStartTabName, !bOnlyAcceptSingle );
+ p = lcl_XL_ParseSheetRef( p, rStartTabName, !bOnlyAcceptSingle, pMsoxlQuoteStop);
if( NULL == p )
return start; // invalid tab
if (bOnlyAcceptSingle && *p == ':')
@@ -383,7 +459,7 @@ const sal_Unicode* ScRange::Parse_XL_Header(
nFlags |= SCA_VALID_TAB | SCA_TAB_3D | SCA_TAB_ABSOLUTE;
if( *p == ':' ) // 3d ref
{
- p = lcl_XL_ParseSheetRef( p+1, rEndTabName, false );
+ p = lcl_XL_ParseSheetRef( p+1, rEndTabName, false, pMsoxlQuoteStop);
if( p == NULL )
{
nFlags = nSaveFlags;
@@ -413,7 +489,12 @@ const sal_Unicode* ScRange::Parse_XL_Header(
// Use the current tab, it needs to be passed in. : aEnd.SetTab( .. );
}
- if (!rExternDocName.Len())
+ if (rExternDocName.Len())
+ {
+ ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
+ pRefMgr->convertToAbsName( rExternDocName);
+ }
+ else
{
// Internal reference.
if (!rStartTabName.Len())
@@ -594,7 +675,8 @@ lcl_ScRange_Parse_XL_R1C1( ScRange& r,
if (p && p[0] != 0)
{
// any trailing invalid character must invalidate the whole address.
- nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB);
+ nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB |
+ SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2);
return nFlags;
}
@@ -661,7 +743,8 @@ lcl_ScRange_Parse_XL_R1C1( ScRange& r,
if (p && p[0] != 0)
{
// any trailing invalid character must invalidate the whole address.
- nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB);
+ nFlags &= ~(SCA_VALID | SCA_VALID_COL | SCA_VALID_ROW | SCA_VALID_TAB |
+ SCA_VALID_COL2 | SCA_VALID_ROW2 | SCA_VALID_TAB2);
return nFlags;
}
diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx
index 05af63a2ff2f..3b8a88c47e2f 100644
--- a/sc/source/core/tool/autoform.cxx
+++ b/sc/source/core/tool/autoform.cxx
@@ -1026,11 +1026,11 @@ short ScAutoFormat::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const
((ScAutoFormatData*)pKey1)->GetName(aStr1);
((ScAutoFormatData*)pKey2)->GetName(aStr2);
String aStrStandard = ScGlobal::GetRscString(STR_STYLENAME_STANDARD);
- if ( ScGlobal::pTransliteration->isEqual( aStr1, aStrStandard ) )
+ if ( ScGlobal::GetpTransliteration()->isEqual( aStr1, aStrStandard ) )
return -1;
- if ( ScGlobal::pTransliteration->isEqual( aStr2, aStrStandard ) )
+ if ( ScGlobal::GetpTransliteration()->isEqual( aStr2, aStrStandard ) )
return 1;
- return (short) ScGlobal::pTransliteration->compareString( aStr1, aStr2 );
+ return (short) ScGlobal::GetpTransliteration()->compareString( aStr1, aStr2 );
}
BOOL ScAutoFormat::Load()
diff --git a/sc/source/core/tool/callform.cxx b/sc/source/core/tool/callform.cxx
index c3634db854a6..b98525e45968 100644
--- a/sc/source/core/tool/callform.cxx
+++ b/sc/source/core/tool/callform.cxx
@@ -156,7 +156,7 @@ FuncData::FuncData(const FuncData& rData) :
short FuncCollection::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const
{
- return (short) ScGlobal::pTransliteration->compareString(
+ return (short) ScGlobal::GetpTransliteration()->compareString(
((FuncData*)pKey1)->aInternalName, ((FuncData*)pKey2)->aInternalName );
}
@@ -205,7 +205,7 @@ static ModuleCollection aModuleCollection;
short ModuleCollection::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const
{
- return (short) ScGlobal::pTransliteration->compareString(
+ return (short) ScGlobal::GetpTransliteration()->compareString(
((ModuleData*)pKey1)->aName, ((ModuleData*)pKey2)->aName );
}
diff --git a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx
index fff3122052bd..9873ea42ff13 100644
--- a/sc/source/core/tool/chartpos.cxx
+++ b/sc/source/core/tool/chartpos.cxx
@@ -616,34 +616,34 @@ ScChartPositionMap::~ScChartPositionMap()
}
-ScRangeListRef ScChartPositionMap::GetColRanges( SCCOL nChartCol ) const
-{
- ScRangeListRef xRangeList = new ScRangeList;
- if ( nChartCol < nColCount )
- {
- ULONG nStop = GetIndex( nChartCol, nRowCount );
- for ( ULONG nIndex = GetIndex( nChartCol, 0 ); nIndex < nStop; nIndex++ )
- {
- if ( ppData[ nIndex ] )
- xRangeList->Join( *ppData[ nIndex ] );
- }
- }
- return xRangeList;
-}
-
-
-ScRangeListRef ScChartPositionMap::GetRowRanges( SCROW nChartRow ) const
-{
- ScRangeListRef xRangeList = new ScRangeList;
- if ( nChartRow < nRowCount )
- {
- ULONG nStop = GetIndex( nColCount, nChartRow );
- for ( ULONG nIndex = GetIndex( 0, nChartRow ); nIndex < nStop;
- nIndex += nRowCount )
- {
- if ( ppData[ nIndex ] )
- xRangeList->Join( *ppData[ nIndex ] );
- }
- }
- return xRangeList;
-}
+//UNUSED2009-05 ScRangeListRef ScChartPositionMap::GetColRanges( SCCOL nChartCol ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 ScRangeListRef xRangeList = new ScRangeList;
+//UNUSED2009-05 if ( nChartCol < nColCount )
+//UNUSED2009-05 {
+//UNUSED2009-05 ULONG nStop = GetIndex( nChartCol, nRowCount );
+//UNUSED2009-05 for ( ULONG nIndex = GetIndex( nChartCol, 0 ); nIndex < nStop; nIndex++ )
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( ppData[ nIndex ] )
+//UNUSED2009-05 xRangeList->Join( *ppData[ nIndex ] );
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 return xRangeList;
+//UNUSED2009-05 }
+
+
+//UNUSED2009-05 ScRangeListRef ScChartPositionMap::GetRowRanges( SCROW nChartRow ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 ScRangeListRef xRangeList = new ScRangeList;
+//UNUSED2009-05 if ( nChartRow < nRowCount )
+//UNUSED2009-05 {
+//UNUSED2009-05 ULONG nStop = GetIndex( nColCount, nChartRow );
+//UNUSED2009-05 for ( ULONG nIndex = GetIndex( 0, nChartRow ); nIndex < nStop;
+//UNUSED2009-05 nIndex += nRowCount )
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( ppData[ nIndex ] )
+//UNUSED2009-05 xRangeList->Join( *ppData[ nIndex ] );
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 return xRangeList;
+//UNUSED2009-05 }
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 5f1213e79b35..22d996dd701f 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -157,29 +157,6 @@ ScChangeAction::ScChangeAction( ScChangeActionType eTypeP, const ScBigRange& rRa
aDateTime.ConvertToUTC();
}
-ScChangeAction::ScChangeAction( SvStream& rStrm, ScMultipleReadHeader& /* rHdr */,
- ScChangeTrack* /* pTrack */ )
- :
- pNext( NULL ),
- pPrev( NULL ),
- pLinkAny( NULL ),
- pLinkDeletedIn( NULL ),
- pLinkDeleted( NULL ),
- pLinkDependent( NULL )
-{
- // ScChangeTrack speichert aUser als Index auf Collection und eType selber
- UINT32 n32;
- UINT16 n16;
- rStrm >> aBigRange;
- rStrm >> n32; aDateTime.SetDate( n32 );
- rStrm >> n32; aDateTime.SetTime( n32 );
- rStrm >> n32; nAction = n32;
- rStrm >> n32; nRejectAction = n32;
- rStrm >> n16; eState = (ScChangeActionState) n16;
- rStrm.ReadByteString( aComment, rStrm.GetStreamCharSet() );
- // LinkEntries in zweiter Runde
-}
-
ScChangeAction::~ScChangeAction()
{
@@ -187,40 +164,6 @@ ScChangeAction::~ScChangeAction()
}
-BOOL ScChangeAction::Store( SvStream& rStrm, ScMultipleWriteHeader& /* rHdr */ ) const
-{
- // ScChangeTrack speichert aUser als Index auf Collection und eType selber
- rStrm << aBigRange;
- rStrm << (UINT32) aDateTime.GetDate();
- rStrm << (UINT32) aDateTime.GetTime();
- rStrm << (UINT32) nAction;
- rStrm << (UINT32) nRejectAction;
- rStrm << (UINT16) eState;
- rStrm.WriteByteString( aComment, rStrm.GetStreamCharSet() );
- // LinkEntries in zweiter Runde
-
- return TRUE;
-}
-
-
-BOOL ScChangeAction::StoreLinks( SvStream& rStrm ) const
-{
- BOOL bOk = ScChangeAction::StoreLinkChain( pLinkDeleted, rStrm );
- bOk &= ScChangeAction::StoreLinkChain( pLinkDependent, rStrm );
- return bOk;
-}
-
-
-BOOL ScChangeAction::LoadLinks( SvStream& rStrm, ScChangeTrack* pTrack )
-{
- BOOL bOk = ScChangeAction::LoadLinkChain( this, &pLinkDeleted, rStrm,
- pTrack, TRUE );
- bOk &= ScChangeAction::LoadLinkChain( this, &pLinkDependent, rStrm,
- pTrack, FALSE );
- return bOk;
-}
-
-
BOOL ScChangeAction::IsVisible() const
{
//! sequence order of execution is significant
@@ -682,159 +625,6 @@ void ScChangeAction::RejectRestoreContents( ScChangeTrack* pTrack,
}
-// static
-void ScChangeAction::StoreCell( ScBaseCell* /* pCell */, SvStream& /* rStrm */,
- ScMultipleWriteHeader& /* rHdr */ )
-{
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
- if ( pCell )
- {
- CellType eCellType = pCell->GetCellType();
- switch( eCellType )
- {
- case CELLTYPE_VALUE:
- rStrm << (BYTE) eCellType;
- ((ScValueCell*)pCell)->Save( rStrm );
- break;
- case CELLTYPE_STRING:
- rStrm << (BYTE) eCellType;
- ((ScStringCell*)pCell)->Save( rStrm );
- break;
- case CELLTYPE_EDIT:
- rStrm << (BYTE) eCellType;
- ((ScEditCell*)pCell)->Save( rStrm );
- break;
- case CELLTYPE_FORMULA:
- rStrm << (BYTE) eCellType;
- rStrm << ((ScFormulaCell*)pCell)->aPos;
- ((ScFormulaCell*)pCell)->Save( rStrm, rHdr );
- break;
- default:
- DBG_ERROR( "ScChangeAction::StoreCell: unknown CellType" );
- rStrm << (BYTE) CELLTYPE_NONE;
- }
- }
- else
- rStrm << (BYTE) CELLTYPE_NONE;
-#endif // SC_ROWLIMIT_STREAM_ACCESS
-}
-
-
-// static
-ScBaseCell* ScChangeAction::LoadCell( SvStream& /* rStrm */,
- ScMultipleReadHeader& /* rHdr */, ScDocument* /* pDoc */, USHORT /* nVer */ )
-{
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
- ScBaseCell* pCell;
- BYTE nByte;
- rStrm >> nByte;
- switch ( (CellType) nByte )
- {
- case CELLTYPE_VALUE:
- {
- pCell = new ScValueCell( rStrm, nVer );
- }
- break;
- case CELLTYPE_STRING:
- {
- pCell = new ScStringCell( rStrm, nVer );
- }
- break;
- case CELLTYPE_EDIT:
- {
- pCell = new ScEditCell( rStrm, nVer, pDoc );
- }
- break;
- case CELLTYPE_FORMULA:
- {
- ScAddress aPos;
- rStrm >> aPos;
- pCell = new ScFormulaCell( pDoc, aPos, rStrm, rHdr );
- ((ScFormulaCell*)pCell)->SetInChangeTrack( TRUE );
- }
- break;
- case CELLTYPE_NONE :
- pCell = NULL;
- break;
- default:
- DBG_ERROR( "ScChangeAction::LoadCell: unknown CellType" );
- rStrm.SetError( SVSTREAM_FILEFORMAT_ERROR );
- pCell = NULL;
- }
- return pCell;
-#else
- return 0;
-#endif // SC_ROWLIMIT_STREAM_ACCESS
-}
-
-
-// static
-BOOL ScChangeAction::StoreLinkChain( ScChangeActionLinkEntry* pLinkFirst,
- SvStream& rStrm )
-{
- BOOL bOk = TRUE;
- UINT32 nCount = 0;
- if ( pLinkFirst )
- {
- // rueckwaerts speichern, damit onLoad mit Insert die Reihenfolge wieder stimmt
- Stack* pStack = new Stack;
- for ( ScChangeActionLinkEntry* pL = pLinkFirst; pL; pL = pL->GetNext() )
- {
- ++nCount;
- pStack->Push( pL );
- }
- rStrm << nCount;
- ScChangeActionLinkEntry* pHere;
- while ( ( pHere = (ScChangeActionLinkEntry*) pStack->Pop() ) != NULL )
- {
- ScChangeAction* p = pHere->GetAction();
- rStrm << (UINT32) ( p ? p->GetActionNumber() : 0 );
- }
- delete pStack;
- }
- else
- rStrm << nCount;
- return bOk;
-}
-
-
-// static
-BOOL ScChangeAction::LoadLinkChain( ScChangeAction* pOfAction,
- ScChangeActionLinkEntry** ppLinkFirst, SvStream& rStrm,
- ScChangeTrack* pTrack, BOOL bLinkDeleted )
-{
- BOOL bOk = TRUE;
- UINT32 nCount;
- rStrm >> nCount;
- for ( UINT32 j = 0; j < nCount; j++ )
- {
- ScChangeAction* pAct = NULL;
- UINT32 nAct;
- rStrm >> nAct;
- if ( nAct )
- {
- pAct = pTrack->GetActionOrGenerated( nAct );
- DBG_ASSERT( pAct, "ScChangeAction::LoadLinkChain: missing Action" );
- }
- if ( bLinkDeleted )
- {
- if ( pAct )
- pAct->SetDeletedIn( pOfAction );
- }
- else
- {
- ScChangeActionLinkEntry* pLink = new ScChangeActionLinkEntry(
- ppLinkFirst, pAct );
- if ( pAct )
- pAct->AddLink( pOfAction, pLink );
- }
- }
- return bOk;
-}
-
-
void ScChangeAction::SetDeletedInThis( ULONG nActionNumber,
const ScChangeTrack* pTrack )
{
@@ -863,52 +653,6 @@ void ScChangeAction::AddDependent( ULONG nActionNumber,
}
}
-// static
-BOOL ScChangeAction::StoreCellList( ScChangeActionCellListEntry* pFirstCell,
- SvStream& rStrm )
-{
- UINT32 nCount = 0;
- for ( const ScChangeActionCellListEntry* pE = pFirstCell; pE;
- pE = pE->pNext )
- ++nCount;
- rStrm << nCount;
-
- if ( nCount )
- {
- for ( const ScChangeActionCellListEntry* pE = pFirstCell; pE;
- pE = pE->pNext )
- { // Store/Load vertauscht die Reihenfolge, aber das ist hierbei egal
- rStrm << (UINT32) pE->pContent->GetActionNumber();
- }
- }
- return TRUE;
-}
-
-
-BOOL ScChangeAction::LoadCellList( ScChangeAction* pOfAction,
- ScChangeActionCellListEntry*& /* pFirstCell */, SvStream& rStrm,
- ScChangeTrack* pTrack )
-{
- UINT32 nCount;
- rStrm >> nCount;
- if ( nCount )
- {
- for ( UINT32 j = 0; j < nCount; j++ )
- {
- ScChangeActionContent* pContent;
- UINT32 nContent;
- rStrm >> nContent;
- pContent = (ScChangeActionContent*) pTrack->GetActionOrGenerated( nContent );
- if ( pContent )
- pOfAction->AddContent( pContent );
- else
- {
- DBG_ERROR( "ScChangeActionDel::LoadLinks: missing Content" );
- }
- }
- }
- return TRUE;
-}
#if DEBUG_CHANGETRACK
String ScChangeAction::ToString( ScDocument* pDoc ) const
@@ -1082,13 +826,6 @@ ScChangeActionIns::ScChangeActionIns( const ScRange& rRange )
}
-ScChangeActionIns::ScChangeActionIns( SvStream& rStrm,
- ScMultipleReadHeader& rHdr, ScChangeTrack* pTrack )
- :
- ScChangeAction( rStrm, rHdr, pTrack )
-{
-}
-
ScChangeActionIns::ScChangeActionIns(const ULONG nActionNumber, const ScChangeActionState eStateP, const ULONG nRejectingNumber,
const ScBigRange& aBigRangeP, const String& aUserP, const DateTime& aDateTimeP, const String& sComment,
const ScChangeActionType eTypeP)
@@ -1102,13 +839,6 @@ ScChangeActionIns::~ScChangeActionIns()
}
-BOOL ScChangeActionIns::Store( SvStream& rStrm, ScMultipleWriteHeader& rHdr ) const
-{
- BOOL bOk = ScChangeAction::Store( rStrm, rHdr );
- return bOk;
-}
-
-
void ScChangeActionIns::GetDescription( String& rStr, ScDocument* pDoc,
BOOL bSplitRange, bool bWarning ) const
{
@@ -1209,26 +939,6 @@ ScChangeActionDel::ScChangeActionDel( const ScRange& rRange,
}
-ScChangeActionDel::ScChangeActionDel( SvStream& rStrm,
- ScMultipleReadHeader& rHdr, ScDocument* /* pDoc */, USHORT /* nVer */,
- ScChangeTrack* pTrackP )
- :
- ScChangeAction( rStrm, rHdr, pTrackP ),
- pTrack( pTrackP ),
- pFirstCell( NULL ),
- pLinkMove( NULL )
-{
-#if SC_ROWLIMIT_STREAM_ACCESS
-#error address types changed!
- UINT32 n32;
- INT16 n16s;
- rStrm >> n32; pCutOff = (ScChangeActionIns*)(ULONG) n32;
- rStrm >> n16s; nCutOff = n16s;
- rStrm >> n16s; nDx = n16s;
- rStrm >> n16s; nDy = n16s;
-#endif // SC_ROWLIMIT_STREAM_ACCESS
-}
-
ScChangeActionDel::ScChangeActionDel(const ULONG nActionNumber, const ScChangeActionState eStateP, const ULONG nRejectingNumber,
const ScBigRange& aBigRangeP, const String& aUserP, const DateTime& aDateTimeP, const String &sComment,
const ScChangeActionType eTypeP, const SCsCOLROW nD, ScChangeTrack* pTrackP) // wich of nDx and nDy is set is depend on the type
@@ -1255,72 +965,6 @@ ScChangeActionDel::~ScChangeActionDel()
delete pLinkMove;
}
-BOOL ScChangeActionDel::StoreLinks( SvStream& rStrm ) const
-{
- BOOL bOk = ScChangeAction::StoreLinks( rStrm );
- UINT32 nCount = 0;
- if ( pLinkMove )
- {
- // rueckwaerts speichern, damit onLoad mit Insert die Reihenfolge wieder stimmt
- Stack* pStack = new Stack;
- for ( ScChangeActionDelMoveEntry* pL = pLinkMove; pL; pL = pL->GetNext() )
- {
- ++nCount;
- pStack->Push( pL );
- }
- rStrm << nCount;
- ScChangeActionDelMoveEntry* pHere;
- while ( ( pHere = (ScChangeActionDelMoveEntry*) pStack->Pop() ) != NULL )
- {
- ScChangeAction* p = pHere->GetAction();
- rStrm << (UINT32) ( p ? p->GetActionNumber() : 0 );
- rStrm << (INT16) pHere->GetCutOffFrom();
- rStrm << (INT16) pHere->GetCutOffTo();
- }
- delete pStack;
- }
- else
- rStrm << nCount;
-
- bOk &= ScChangeAction::StoreCellList( pFirstCell, rStrm );
-
- return bOk;
-}
-
-
-BOOL ScChangeActionDel::LoadLinks( SvStream& rStrm, ScChangeTrack* pTrackP )
-{
- BOOL bOk = ScChangeAction::LoadLinks( rStrm, pTrackP );
- UINT32 nCount;
- rStrm >> nCount;
- for ( UINT32 j = 0; j < nCount; j++ )
- {
- ScChangeActionMove* pAct = NULL;
- UINT32 nAct;
- rStrm >> nAct;
- if ( nAct )
- {
- pAct = (ScChangeActionMove*) pTrackP->GetAction( nAct );
- DBG_ASSERT( pAct, "ScChangeActionDel::LoadLinks: missing Move" );
- }
- INT16 nFrom, nTo;
- rStrm >> nFrom >> nTo;
- ScChangeActionDelMoveEntry* pLink = new ScChangeActionDelMoveEntry(
- &pLinkMove, pAct, nFrom, nTo );
- if ( pAct )
- pAct->AddLink( this, pLink );
- }
- if ( pCutOff )
- {
- pCutOff = (ScChangeActionIns*) pTrackP->GetAction( (ULONG) pCutOff );
- DBG_ASSERT( pCutOff, "ScChangeActionDel::LoadLinks: missing Insert" );
- }
-
- bOk &= ScChangeAction::LoadCellList( this, pFirstCell, rStrm, pTrackP );
-
- return bOk;
-}
-
void ScChangeActionDel::AddContent( ScChangeActionContent* pContent )
{
ScChangeActionCellListEntry* pE = new ScChangeActionCellListEntry(
@@ -1623,18 +1267,6 @@ void ScChangeActionDel::UndoCutOffInsert()
// --- ScChangeActionMove --------------------------------------------------
-ScChangeActionMove::ScChangeActionMove( SvStream& rStrm,
- ScMultipleReadHeader& rHdr, ScChangeTrack* pTrackP )
- :
- ScChangeAction( rStrm, rHdr, pTrackP ),
- pTrack( pTrackP ),
- pFirstCell( NULL ),
- nStartLastCut(0),
- nEndLastCut(0)
-{
- rStrm >> aFromRange;
-}
-
ScChangeActionMove::ScChangeActionMove(const ULONG nActionNumber, const ScChangeActionState eStateP, const ULONG nRejectingNumber,
const ScBigRange& aToBigRange, const String& aUserP, const DateTime& aDateTimeP, const String &sComment,
const ScBigRange& aFromBigRange, ScChangeTrack* pTrackP) // wich of nDx and nDy is set is depend on the type
@@ -1654,30 +1286,6 @@ ScChangeActionMove::~ScChangeActionMove()
}
-BOOL ScChangeActionMove::Store( SvStream& rStrm, ScMultipleWriteHeader& rHdr ) const
-{
- BOOL bOk = ScChangeAction::Store( rStrm, rHdr );
- rStrm << aFromRange;
- return bOk;
-}
-
-
-BOOL ScChangeActionMove::StoreLinks( SvStream& rStrm ) const
-{
- BOOL bOk = ScChangeAction::StoreLinks( rStrm );
- bOk &= ScChangeAction::StoreCellList( pFirstCell, rStrm );
- return bOk;
-}
-
-
-BOOL ScChangeActionMove::LoadLinks( SvStream& rStrm, ScChangeTrack* pTrackP )
-{
- BOOL bOk = ScChangeAction::LoadLinks( rStrm, pTrackP );
- bOk &= ScChangeAction::LoadCellList( this, pFirstCell, rStrm, pTrackP );
- return bOk;
-}
-
-
void ScChangeActionMove::AddContent( ScChangeActionContent* pContent )
{
ScChangeActionCellListEntry* pE = new ScChangeActionCellListEntry(
@@ -1816,28 +1424,6 @@ BOOL ScChangeActionMove::Reject( ScDocument* pDoc )
const USHORT nMemPoolChangeActionContent = (0x8000 - 64) / sizeof(ScChangeActionContent);
IMPL_FIXEDMEMPOOL_NEWDEL( ScChangeActionContent, nMemPoolChangeActionContent, nMemPoolChangeActionContent )
-
-ScChangeActionContent::ScChangeActionContent( SvStream& rStrm,
- ScMultipleReadHeader& rHdr, ScDocument* pDoc, USHORT nVer,
- ScChangeTrack* pTrack )
- :
- ScChangeAction( rStrm, rHdr, pTrack ),
- pNextInSlot( NULL ),
- ppPrevInSlot( NULL )
-{
- UINT32 n32;
- rStrm.ReadByteString( aOldValue, rStrm.GetStreamCharSet() );
- rStrm.ReadByteString( aNewValue, rStrm.GetStreamCharSet() );
- rStrm >> n32; pNextContent = (ScChangeActionContent*)(ULONG) n32;
- rStrm >> n32; pPrevContent = (ScChangeActionContent*)(ULONG) n32;
-
- {
- ScMultipleReadHeader aDataHdr( rStrm );
- pOldCell = ScChangeAction::LoadCell( rStrm, aDataHdr, pDoc, nVer );
- pNewCell = ScChangeAction::LoadCell( rStrm, aDataHdr, pDoc, nVer );
- }
-}
-
ScChangeActionContent::ScChangeActionContent( const ULONG nActionNumber,
const ScChangeActionState eStateP, const ULONG nRejectingNumber,
const ScBigRange& aBigRangeP, const String& aUserP,
@@ -1895,52 +1481,6 @@ void ScChangeActionContent::ClearTrack()
}
-BOOL ScChangeActionContent::Store( SvStream& rStrm, ScMultipleWriteHeader& rHdr ) const
-{
- BOOL bOk = ScChangeAction::Store( rStrm, rHdr );
- rStrm.WriteByteString( aOldValue, rStrm.GetStreamCharSet() );
- rStrm.WriteByteString( aNewValue, rStrm.GetStreamCharSet() );
- rStrm << (UINT32) ( pNextContent ? pNextContent->GetActionNumber() : 0 );
- rStrm << (UINT32) ( pPrevContent ? pPrevContent->GetActionNumber() : 0 );
-
- {
- ScMultipleWriteHeader aDataHdr( rStrm );
- ScChangeAction::StoreCell( pOldCell, rStrm, aDataHdr );
- ScChangeAction::StoreCell( pNewCell, rStrm, aDataHdr );
- }
-
- return bOk;
-}
-
-
-BOOL ScChangeActionContent::StoreLinks( SvStream& rStrm ) const
-{
- BOOL bOk = ScChangeAction::StoreLinks( rStrm );
- return bOk;
-}
-
-
-BOOL ScChangeActionContent::LoadLinks( SvStream& rStrm, ScChangeTrack* pTrack )
-{
- BOOL bOk = ScChangeAction::LoadLinks( rStrm, pTrack );
- if ( pNextContent )
- {
- pNextContent = (ScChangeActionContent*) pTrack->GetAction(
- (ULONG) pNextContent );
- DBG_ASSERT( pNextContent,
- "ScChangeActionContent::LoadLinks: missing NextContent" );
- }
- if ( pPrevContent )
- {
- pPrevContent = (ScChangeActionContent*) pTrack->GetAction(
- (ULONG) pPrevContent );
- DBG_ASSERT( pPrevContent,
- "ScChangeActionContent::LoadLinks: missing PrevContent" );
- }
- return bOk;
-}
-
-
ScChangeActionContent* ScChangeActionContent::GetTopContent() const
{
if ( pNextContent )
@@ -2658,13 +2198,6 @@ void ScChangeActionContent::UpdateReference( const ScChangeTrack* pTrack,
// --- ScChangeActionReject ------------------------------------------------
-ScChangeActionReject::ScChangeActionReject( SvStream& rStrm,
- ScMultipleReadHeader& rHdr, ScChangeTrack* pTrack )
- :
- ScChangeAction( rStrm, rHdr, pTrack )
-{
-}
-
ScChangeActionReject::ScChangeActionReject(const ULONG nActionNumber, const ScChangeActionState eStateP, const ULONG nRejectingNumber,
const ScBigRange& aBigRangeP, const String& aUserP, const DateTime& aDateTimeP, const String& sComment)
:
@@ -2672,12 +2205,6 @@ ScChangeActionReject::ScChangeActionReject(const ULONG nActionNumber, const ScCh
{
}
-BOOL ScChangeActionReject::Store( SvStream& rStrm, ScMultipleWriteHeader& rHdr ) const
-{
- (void)ScChangeAction::Store( rStrm, rHdr );
- return TRUE;
-}
-
// --- ScChangeTrack -------------------------------------------------------
@@ -2915,29 +2442,6 @@ void ScChangeTrack::NotifyModified( ScChangeTrackMsgType eMsgType,
}
-void lcl_EnsureSorting( ScStrCollection& rCollection )
-{
- BOOL bSorted = TRUE;
- USHORT nCount = rCollection.GetCount();
- USHORT i;
- for (i=0; i+1<nCount; i++)
- if ( rCollection.Compare( rCollection[i], rCollection[i+1] ) != -1 )
- bSorted = FALSE;
-
- if ( !bSorted )
- {
- // if not sorted, rebuild collection
- ScStrCollection aNewColl;
- for (i=0; i<nCount; i++)
- {
- ScDataObject* pNewObj = rCollection[i]->Clone();
- if (!aNewColl.Insert(pNewObj))
- delete pNewObj;
- }
- rCollection = aNewColl;
- }
-}
-
void ScChangeTrack::MasterLinks( ScChangeAction* pAppend )
{
ScChangeActionType eType = pAppend->GetType();
@@ -3244,14 +2748,6 @@ BOOL ScChangeTrack::IsMatrixFormulaRangeDifferent( const ScBaseCell* pOldCell,
void ScChangeTrack::AppendContent( const ScAddress& rPos,
- const String& rNewValue )
-{
- ScBaseCell* pCell = pDoc->GetCell( rPos );
- AppendContent( rPos, rNewValue, pCell );
-}
-
-
-void ScChangeTrack::AppendContent( const ScAddress& rPos,
const String& rNewValue, ScBaseCell* pOldCell )
{
String aOldValue;
@@ -3321,16 +2817,6 @@ void ScChangeTrack::AppendContent( const ScAddress& rPos,
}
-void ScChangeTrack::AppendContent( const ScAddress& rPos,
- const ScBaseCell* pOldCell, ScDocument* pRefDoc )
-{
- if ( ScChangeActionContent::NeedsNumberFormat( pOldCell ) )
- AppendContent( rPos, pOldCell, pRefDoc->GetNumberFormat( rPos ), pRefDoc );
- else
- AppendContent( rPos, pOldCell, 0, pRefDoc );
-}
-
-
void ScChangeTrack::SetLastCutMoveRange( const ScRange& rRange,
ScDocument* pRefDoc )
{
diff --git a/sc/source/core/tool/collect.cxx b/sc/source/core/tool/collect.cxx
index 04343bb65a41..e66c14ee0317 100644
--- a/sc/source/core/tool/collect.cxx
+++ b/sc/source/core/tool/collect.cxx
@@ -96,7 +96,7 @@ ScCollection::~ScCollection()
}
//------------------------------------------------------------------------
-
+USHORT ScCollection::GetCount() const { return nCount; }
void ScCollection::AtFree(USHORT nIndex)
{
if ((pItems) && (nIndex < nCount))
@@ -334,38 +334,6 @@ ScDataObject* ScStrCollection::Clone() const
}
//------------------------------------------------------------------------
-
-void ScStrCollection::Load( SvStream& rStream )
-{
- ScReadHeader aHdr( rStream );
- lcl_DeleteScDataObjects( pItems, nCount );
- BOOL bDups;
- rStream >> bDups;
- SetDups( bDups );
- rStream >> nCount >> nLimit >> nDelta;
- pItems = new ScDataObject*[nLimit];
- String aStr;
- rtl_TextEncoding eSet = rStream.GetStreamCharSet();
- for ( USHORT i=0; i<nCount; i++ )
- {
- rStream.ReadByteString( aStr, eSet );
- pItems[i] = new StrData( aStr );
- }
-}
-
-void ScStrCollection::Store( SvStream& rStream ) const
-{
- ScWriteHeader aHdr( rStream );
- BOOL bDups = IsDups();
- rStream << bDups << nCount << nLimit << nDelta;
- rtl_TextEncoding eSet = rStream.GetStreamCharSet();
- for ( USHORT i=0; i<nCount; i++ )
- {
- rStream.WriteByteString( ((StrData*)pItems[i])->GetString(), eSet );
- }
-}
-
-//------------------------------------------------------------------------
// TypedScStrCollection
//------------------------------------------------------------------------
@@ -391,7 +359,8 @@ ScDataObject* TypedStrData::Clone() const
{
return new TypedStrData(*this);
}
-
+TypedScStrCollection::~TypedScStrCollection()
+{}
ScDataObject* TypedScStrCollection::Clone() const
{
return new TypedScStrCollection(*this);
@@ -428,10 +397,10 @@ short TypedScStrCollection::Compare( ScDataObject* pKey1, ScDataObject* pKey2 )
// Strings vergleichen:
//---------------------
if ( bCaseSensitive )
- nResult = (short) ScGlobal::pCaseTransliteration->compareString(
+ nResult = (short) ScGlobal::GetCaseTransliteration()->compareString(
rData1.aStrValue, rData2.aStrValue );
else
- nResult = (short) ScGlobal::pTransliteration->compareString(
+ nResult = (short) ScGlobal::GetpTransliteration()->compareString(
rData1.aStrValue, rData2.aStrValue );
}
}
@@ -467,12 +436,12 @@ BOOL TypedScStrCollection::FindText( const String& rStart, String& rResult,
TypedStrData* pData = (TypedStrData*) pItems[i];
if (pData->nStrType)
{
- if ( ScGlobal::pTransliteration->isMatch( rStart, pData->aStrValue ) )
+ if ( ScGlobal::GetpTransliteration()->isMatch( rStart, pData->aStrValue ) )
{
// If the collection is case sensitive, it may contain several entries
// that are equal when compared case-insensitive. They are skipped here.
if ( !bCaseSensitive || !aOldResult.Len() ||
- !ScGlobal::pTransliteration->isEqual(
+ !ScGlobal::GetpTransliteration()->isEqual(
pData->aStrValue, aOldResult ) )
{
rResult = pData->aStrValue;
@@ -495,12 +464,12 @@ BOOL TypedScStrCollection::FindText( const String& rStart, String& rResult,
TypedStrData* pData = (TypedStrData*) pItems[i];
if (pData->nStrType)
{
- if ( ScGlobal::pTransliteration->isMatch( rStart, pData->aStrValue ) )
+ if ( ScGlobal::GetpTransliteration()->isMatch( rStart, pData->aStrValue ) )
{
// If the collection is case sensitive, it may contain several entries
// that are equal when compared case-insensitive. They are skipped here.
if ( !bCaseSensitive || !aOldResult.Len() ||
- !ScGlobal::pTransliteration->isEqual(
+ !ScGlobal::GetpTransliteration()->isEqual(
pData->aStrValue, aOldResult ) )
{
rResult = pData->aStrValue;
@@ -523,7 +492,7 @@ BOOL TypedScStrCollection::GetExactMatch( String& rString ) const
for (USHORT i=0; i<nCount; i++)
{
TypedStrData* pData = (TypedStrData*) pItems[i];
- if ( pData->nStrType && ScGlobal::pTransliteration->isEqual(
+ if ( pData->nStrType && ScGlobal::GetpTransliteration()->isEqual(
pData->aStrValue, rString ) )
{
rString = pData->aStrValue; // String anpassen
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 2b66663f3ee9..df7131397aef 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -127,77 +127,6 @@ enum ScanState
static const sal_Char* pInternal[ 5 ] = { "GAME", "SPEW", "TTT", "STARCALCTEAM", "ANTWORT" };
using namespace ::com::sun::star::i18n;
-/////////////////////////////////////////////////////////////////////////
-
-short lcl_GetRetFormat( OpCode eOpCode )
-{
- switch (eOpCode)
- {
- case ocEqual:
- case ocNotEqual:
- case ocLess:
- case ocGreater:
- case ocLessEqual:
- case ocGreaterEqual:
- case ocAnd:
- case ocOr:
- case ocNot:
- case ocTrue:
- case ocFalse:
- case ocIsEmpty:
- case ocIsString:
- case ocIsNonString:
- case ocIsLogical:
- case ocIsRef:
- case ocIsValue:
- case ocIsFormula:
- case ocIsNA:
- case ocIsErr:
- case ocIsError:
- case ocIsEven:
- case ocIsOdd:
- case ocExact:
- return NUMBERFORMAT_LOGICAL;
- case ocGetActDate:
- case ocGetDate:
- case ocEasterSunday :
- return NUMBERFORMAT_DATE;
- case ocGetActTime:
- return NUMBERFORMAT_DATETIME;
- case ocGetTime:
- return NUMBERFORMAT_TIME;
- case ocNPV:
- case ocBW:
- case ocDIA:
- case ocGDA:
- case ocGDA2:
- case ocVBD:
- case ocLIA:
- case ocRMZ:
- case ocZW:
- case ocZinsZ:
- case ocKapz:
- case ocKumZinsZ:
- case ocKumKapZ:
- return NUMBERFORMAT_CURRENCY;
- case ocZins:
- case ocIRR:
- case ocMIRR:
- case ocZGZ:
- case ocEffektiv:
- case ocNominal:
- case ocPercentSign:
- return NUMBERFORMAT_PERCENT;
-// case ocSum:
-// case ocSumSQ:
-// case ocProduct:
-// case ocAverage:
-// return -1;
- default:
- return NUMBERFORMAT_NUMBER;
- }
- return NUMBERFORMAT_NUMBER;
-}
/////////////////////////////////////////////////////////////////////////
@@ -443,6 +372,15 @@ void ScCompiler::SetGrammar( const FormulaGrammar::Grammar eGrammar )
}
}
+void ScCompiler::SetEncodeUrlMode( EncodeUrlMode eMode )
+{
+ meEncodeUrlMode = eMode;
+}
+
+ScCompiler::EncodeUrlMode ScCompiler::GetEncodeUrlMode() const
+{
+ return meEncodeUrlMode;
+}
void ScCompiler::SetFormulaLanguage( const ScCompiler::OpCodeMapPtr & xMap )
{
@@ -532,22 +470,22 @@ ScCompiler::Convention::Convention( FormulaGrammar::AddressConvention eConv )
/* + */ t[43] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_EXP | SC_COMPILER_C_VALUE_SIGN;
/* , */ t[44] = SC_COMPILER_C_CHAR_VALUE | SC_COMPILER_C_VALUE;
/* - */ t[45] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_EXP | SC_COMPILER_C_VALUE_SIGN;
-/* . */ t[46] = SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_VALUE | SC_COMPILER_C_VALUE | SC_COMPILER_C_IDENT;
+/* . */ t[46] = SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_VALUE | SC_COMPILER_C_VALUE | SC_COMPILER_C_IDENT | SC_COMPILER_C_NAME;
/* / */ t[47] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP;
for (i = 48; i < 58; i++)
-/* 0-9 */ t[i] = SC_COMPILER_C_CHAR_VALUE | SC_COMPILER_C_WORD | SC_COMPILER_C_VALUE | SC_COMPILER_C_VALUE_EXP | SC_COMPILER_C_VALUE_VALUE | SC_COMPILER_C_IDENT;
+/* 0-9 */ t[i] = SC_COMPILER_C_CHAR_VALUE | SC_COMPILER_C_WORD | SC_COMPILER_C_VALUE | SC_COMPILER_C_VALUE_EXP | SC_COMPILER_C_VALUE_VALUE | SC_COMPILER_C_IDENT | SC_COMPILER_C_NAME;
/* : */ t[58] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD;
/* ; */ t[59] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP;
/* < */ t[60] = SC_COMPILER_C_CHAR_BOOL | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP;
/* = */ t[61] = SC_COMPILER_C_CHAR | SC_COMPILER_C_BOOL | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP;
/* > */ t[62] = SC_COMPILER_C_CHAR_BOOL | SC_COMPILER_C_BOOL | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP;
-/* ? */ t[63] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD;
+/* ? */ t[63] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD | SC_COMPILER_C_NAME;
/* @ */ // FREE
for (i = 65; i < 91; i++)
-/* A-Z */ t[i] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_IDENT | SC_COMPILER_C_IDENT;
+/* A-Z */ t[i] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_IDENT | SC_COMPILER_C_IDENT | SC_COMPILER_C_CHAR_NAME | SC_COMPILER_C_NAME;
if (FormulaGrammar::CONV_ODF == meConv)
{
@@ -562,11 +500,11 @@ ScCompiler::Convention::Convention( FormulaGrammar::AddressConvention eConv )
/* ] */ // FREE
}
/* ^ */ t[94] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP;
-/* _ */ t[95] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_IDENT | SC_COMPILER_C_IDENT;
+/* _ */ t[95] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_IDENT | SC_COMPILER_C_IDENT | SC_COMPILER_C_CHAR_NAME | SC_COMPILER_C_NAME;
/* ` */ // FREE
for (i = 97; i < 123; i++)
-/* a-z */ t[i] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_IDENT | SC_COMPILER_C_IDENT;
+/* a-z */ t[i] = SC_COMPILER_C_CHAR_WORD | SC_COMPILER_C_WORD | SC_COMPILER_C_CHAR_IDENT | SC_COMPILER_C_IDENT | SC_COMPILER_C_CHAR_NAME | SC_COMPILER_C_NAME;
/* { */ t[123] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP; // array open
/* | */ t[124] = SC_COMPILER_C_CHAR | SC_COMPILER_C_WORD_SEP | SC_COMPILER_C_VALUE_SEP; // array row sep (Should be OOo specific)
@@ -1066,14 +1004,19 @@ struct ConventionOOO_A1 : public Convention_A1
bool makeExternalSingleRefStr( ::rtl::OUStringBuffer& rBuffer, sal_uInt16 nFileId,
const String& rTabName, const ScSingleRefData& rRef,
- ScExternalRefManager* pRefMgr, bool bDisplayTabName ) const
+ ScExternalRefManager* pRefMgr, bool bDisplayTabName, bool bEncodeUrl ) const
{
if (bDisplayTabName)
{
String aFile;
const String* p = pRefMgr->getExternalFileName(nFileId);
if (p)
- aFile = *p;
+ {
+ if (bEncodeUrl)
+ aFile = *p;
+ else
+ aFile = INetURLObject::decode(*p, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS);
+ }
aFile.SearchAndReplaceAllAscii("'", String::CreateFromAscii("''"));
rBuffer.append(sal_Unicode('\''));
@@ -1107,7 +1050,23 @@ struct ConventionOOO_A1 : public Convention_A1
if (bODF)
rBuffer.append( sal_Unicode('['));
- makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef, pRefMgr, true);
+
+ bool bEncodeUrl = true;
+ switch (rCompiler.GetEncodeUrlMode())
+ {
+ case ScCompiler::ENCODE_BY_GRAMMAR:
+ bEncodeUrl = bODF;
+ break;
+ case ScCompiler::ENCODE_ALWAYS:
+ bEncodeUrl = true;
+ break;
+ case ScCompiler::ENCODE_NEVER:
+ bEncodeUrl = false;
+ break;
+ default:
+ ;
+ }
+ makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef, pRefMgr, true, bEncodeUrl);
if (bODF)
rBuffer.append( sal_Unicode(']'));
}
@@ -1129,9 +1088,25 @@ struct ConventionOOO_A1 : public Convention_A1
if (bODF)
rBuffer.append( sal_Unicode('['));
// Ensure that there's always a closing bracket, no premature returns.
+ bool bEncodeUrl = true;
+ switch (rCompiler.GetEncodeUrlMode())
+ {
+ case ScCompiler::ENCODE_BY_GRAMMAR:
+ bEncodeUrl = bODF;
+ break;
+ case ScCompiler::ENCODE_ALWAYS:
+ bEncodeUrl = true;
+ break;
+ case ScCompiler::ENCODE_NEVER:
+ bEncodeUrl = false;
+ break;
+ default:
+ ;
+ }
+
do
{
- if (!makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef.Ref1, pRefMgr, true))
+ if (!makeExternalSingleRefStr(rBuffer, nFileId, rTabName, aRef.Ref1, pRefMgr, true, bEncodeUrl))
break;
rBuffer.append(sal_Unicode(':'));
@@ -1157,7 +1132,7 @@ struct ConventionOOO_A1 : public Convention_A1
else if (bODF)
rBuffer.append( sal_Unicode('.')); // need at least the sheet separator in ODF
makeExternalSingleRefStr( rBuffer, nFileId, aLastTabName,
- aRef.Ref2, pRefMgr, bDisplayTabName);
+ aRef.Ref2, pRefMgr, bDisplayTabName, bEncodeUrl);
} while (0);
if (bODF)
rBuffer.append( sal_Unicode(']'));
@@ -1319,7 +1294,7 @@ struct ConventionXL
return lcl_makeExternalNameStr( rFile, rName, sal_Unicode('!'), false);
}
- static void makeExternalDocStr( ::rtl::OUStringBuffer& rBuffer, const String& rFullName )
+ static void makeExternalDocStr( ::rtl::OUStringBuffer& rBuffer, const String& rFullName, bool bEncodeUrl )
{
// Format that is easier to deal with inside OOo, because we use file
// URL, and all characetrs are allowed. Check if it makes sense to do
@@ -1330,8 +1305,14 @@ struct ConventionXL
rBuffer.append(sal_Unicode('['));
rBuffer.append(sal_Unicode('\''));
- const sal_Unicode* pBuf = rFullName.GetBuffer();
- xub_StrLen nLen = rFullName.Len();
+ String aFullName;
+ if (bEncodeUrl)
+ aFullName = rFullName;
+ else
+ aFullName = INetURLObject::decode(rFullName, INET_HEX_ESCAPE, INetURLObject::DECODE_UNAMBIGUOUS);
+
+ const sal_Unicode* pBuf = aFullName.GetBuffer();
+ xub_StrLen nLen = aFullName.Len();
for (xub_StrLen i = 0; i < nLen; ++i)
{
const sal_Unicode c = pBuf[i];
@@ -1544,7 +1525,8 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
ScSingleRefData aRef(rRef);
aRef.CalcAbsIfRel(rCompiler.GetPos());
- ConventionXL::makeExternalDocStr(rBuffer, *pFullName);
+ ConventionXL::makeExternalDocStr(
+ rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS);
ScRangeStringConverter::AppendTableName(rBuffer, rTabName);
rBuffer.append(sal_Unicode('!'));
@@ -1567,7 +1549,8 @@ struct ConventionXL_A1 : public Convention_A1, public ConventionXL
ScComplexRefData aRef(rRef);
aRef.CalcAbsIfRel(rCompiler.GetPos());
- ConventionXL::makeExternalDocStr(rBuffer, *pFullName);
+ ConventionXL::makeExternalDocStr(
+ rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS);
ConventionXL::makeExternalTabNameRange(rBuffer, rTabName, aTabNames, aRef);
rBuffer.append(sal_Unicode('!'));
@@ -1748,7 +1731,8 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
ScSingleRefData aRef(rRef);
aRef.CalcAbsIfRel(rCompiler.GetPos());
- ConventionXL::makeExternalDocStr(rBuffer, *pFullName);
+ ConventionXL::makeExternalDocStr(
+ rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS);
ScRangeStringConverter::AppendTableName(rBuffer, rTabName);
rBuffer.append(sal_Unicode('!'));
@@ -1772,7 +1756,8 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL
ScComplexRefData aRef(rRef);
aRef.CalcAbsIfRel(rCompiler.GetPos());
- ConventionXL::makeExternalDocStr(rBuffer, *pFullName);
+ ConventionXL::makeExternalDocStr(
+ rBuffer, *pFullName, rCompiler.GetEncodeUrlMode() == ScCompiler::ENCODE_ALWAYS);
ConventionXL::makeExternalTabNameRange(rBuffer, rTabName, aTabNames, aRef);
rBuffer.append(sal_Unicode('!'));
@@ -1824,6 +1809,7 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos,ScTokenArra
mnPredetectedReference(0),
mnRangeOpPosInSymbol(-1),
pConv( pConvOOO_A1 ),
+ meEncodeUrlMode( ENCODE_BY_GRAMMAR ),
mbCloseBrackets( true ),
mbExtendedErrorDetection( false ),
mbRewind( false )
@@ -1839,6 +1825,7 @@ ScCompiler::ScCompiler( ScDocument* pDocument, const ScAddress& rPos)
mnPredetectedReference(0),
mnRangeOpPosInSymbol(-1),
pConv( pConvOOO_A1 ),
+ meEncodeUrlMode( ENCODE_BY_GRAMMAR ),
mbCloseBrackets( true ),
mbExtendedErrorDetection( false ),
mbRewind( false )
@@ -2291,14 +2278,16 @@ Label_MaskStateMachine:
static const int kQuote = (1 << 4);
// Past ' closing quote.
static const int kClose = (1 << 5);
+ // Encountered # file/sheet separator.
+ static const int kFileSep = (1 << 6);
// Past . sheet name separator.
- static const int kPast = (1 << 6);
+ static const int kPast = (1 << 7);
// Marked name $$ follows sheet name separator, detected
// while we're still on the separator. Will be cleared when
// entering the name.
- static const int kMarkAhead = (1 << 7);
+ static const int kMarkAhead = (1 << 8);
// In marked defined name.
- static const int kDefName = (1 << 8);
+ static const int kDefName = (1 << 9);
bool bAddToSymbol = true;
if ((nMask & SC_COMPILER_C_ODF_RBRACKET) && !(nRefInName & kOpen))
@@ -2322,7 +2311,9 @@ Label_MaskStateMachine:
{
// Not in col/row yet.
- if ('$' == c && '$' == pSrc[0] && !(nRefInName & kOpen))
+ if (SC_COMPILER_FILE_TAB_SEP == c && (nRefInName & kFileSep))
+ nRefInName = 0;
+ else if ('$' == c && '$' == pSrc[0] && !(nRefInName & kOpen))
{
nRefInName &= ~kMarkAhead;
if (!(nRefInName & kDefName))
@@ -2369,16 +2360,20 @@ Label_MaskStateMachine:
}
else
{
- if ('\'' == pSrc[0])
+ switch (pSrc[0])
{
- // escapes embedded quote
- nRefInName |= kQuote;
- }
- else
- {
- // quote not followed by quote => close
- nRefInName |= kClose;
- nRefInName &= ~kOpen;
+ case '\'':
+ // escapes embedded quote
+ nRefInName |= kQuote;
+ break;
+ case SC_COMPILER_FILE_TAB_SEP:
+ // sheet name should follow
+ nRefInName |= kFileSep;
+ // fallthru
+ default:
+ // quote not followed by quote => close
+ nRefInName |= kClose;
+ nRefInName &= ~kOpen;
}
bAddToSymbol = !(nRefInName & kDefName);
}
@@ -2873,6 +2868,23 @@ BOOL ScCompiler::IsReference( const String& rName )
mbRewind = true;
return true; // end all checks
}
+ else
+ {
+ // Special treatment for the 'E:\[doc]Sheet1:Sheet3'!D5 Excel sickness,
+ // mnRangeOpPosInSymbol did not catch the range operator as it is
+ // within a quoted name.
+ switch (pConv->meConv)
+ {
+ case FormulaGrammar::CONV_XL_A1:
+ case FormulaGrammar::CONV_XL_R1C1:
+ case FormulaGrammar::CONV_XL_OOX:
+ if (rName.GetChar(0) == '\'' && IsDoubleReference( rName))
+ return true;
+ break;
+ default:
+ ; // nothing
+ }
+ }
return false;
}
@@ -3044,7 +3056,7 @@ BOOL ScCompiler::IsColRowName( const String& rName )
; // nothing, prevent compiler warning
break;
}
- if ( ScGlobal::pTransliteration->isEqual( aStr, aName ) )
+ if ( ScGlobal::GetpTransliteration()->isEqual( aStr, aName ) )
{
aRef.InitFlags();
aRef.nCol = aIter.GetCol();
@@ -3173,7 +3185,7 @@ BOOL ScCompiler::IsColRowName( const String& rName )
; // nothing, prevent compiler warning
break;
}
- if ( ScGlobal::pTransliteration->isEqual( aStr, aName ) )
+ if ( ScGlobal::GetpTransliteration()->isEqual( aStr, aName ) )
{
SCCOL nCol = aIter.GetCol();
SCROW nRow = aIter.GetRow();
@@ -3959,7 +3971,7 @@ BOOL ScCompiler::HandleRange()
if( pRangeData->HasReferences() )
{
SetRelNameReference();
- MoveRelWrap();
+ MoveRelWrap(pRangeData->GetMaxCol(), pRangeData->GetMaxRow());
}
pNew->Reset();
if ( bAddPair )
@@ -4011,7 +4023,7 @@ BOOL ScCompiler::HandleExternalReference(const FormulaToken& _aToken)
if (pNew->GetNextReference() != NULL)
{
SetRelNameReference();
- MoveRelWrap();
+ MoveRelWrap(MAXCOL, MAXROW);
}
pNew->Reset();
return GetToken();
@@ -4106,33 +4118,33 @@ void ScCompiler::SetRelNameReference()
// Wrap-adjust relative references of a RangeName to current position,
// don't call for other token arrays!
-void ScCompiler::MoveRelWrap()
+void ScCompiler::MoveRelWrap( SCCOL nMaxCol, SCROW nMaxRow )
{
pArr->Reset();
for( ScToken* t = static_cast<ScToken*>(pArr->GetNextReference()); t;
t = static_cast<ScToken*>(pArr->GetNextReference()) )
{
if ( t->GetType() == svSingleRef || t->GetType() == svExternalSingleRef )
- ScRefUpdate::MoveRelWrap( pDoc, aPos, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
+ ScRefUpdate::MoveRelWrap( pDoc, aPos, nMaxCol, nMaxRow, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
else
- ScRefUpdate::MoveRelWrap( pDoc, aPos, t->GetDoubleRef() );
+ ScRefUpdate::MoveRelWrap( pDoc, aPos, nMaxCol, nMaxRow, t->GetDoubleRef() );
}
}
// static
// Wrap-adjust relative references of a RangeName to current position,
// don't call for other token arrays!
-void ScCompiler::MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc,
- const ScAddress& rPos )
+void ScCompiler::MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, const ScAddress& rPos,
+ SCCOL nMaxCol, SCROW nMaxRow )
{
rArr.Reset();
for( ScToken* t = static_cast<ScToken*>(rArr.GetNextReference()); t;
t = static_cast<ScToken*>(rArr.GetNextReference()) )
{
if ( t->GetType() == svSingleRef || t->GetType() == svExternalSingleRef )
- ScRefUpdate::MoveRelWrap( pDoc, rPos, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
+ ScRefUpdate::MoveRelWrap( pDoc, rPos, nMaxCol, nMaxRow, SingleDoubleRefModifier( t->GetSingleRef() ).Ref() );
else
- ScRefUpdate::MoveRelWrap( pDoc, rPos, t->GetDoubleRef() );
+ ScRefUpdate::MoveRelWrap( pDoc, rPos, nMaxCol, nMaxRow, t->GetDoubleRef() );
}
}
@@ -4307,7 +4319,7 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
SingleDoubleRefModifier aMod( rRef );
if ( rRef.IsRelName() )
{
- ScRefUpdate::MoveRelWrap( pDoc, aPos, aMod.Ref() );
+ ScRefUpdate::MoveRelWrap( pDoc, aPos, MAXCOL, MAXROW, aMod.Ref() );
rChanged = TRUE;
}
else
@@ -4337,7 +4349,7 @@ ScRangeData* ScCompiler::UpdateReference(UpdateRefMode eUpdateRefMode,
SCTAB nTabs = rRef.Ref2.nTab - rRef.Ref1.nTab;
if ( rRef.Ref1.IsRelName() || rRef.Ref2.IsRelName() )
{
- ScRefUpdate::MoveRelWrap( pDoc, aPos, rRef );
+ ScRefUpdate::MoveRelWrap( pDoc, aPos, MAXCOL, MAXROW, rRef );
rChanged = TRUE;
}
else
diff --git a/sc/source/core/tool/dbcolect.cxx b/sc/source/core/tool/dbcolect.cxx
index e6c039b5d79f..61ca8ee00195 100644
--- a/sc/source/core/tool/dbcolect.cxx
+++ b/sc/source/core/tool/dbcolect.cxx
@@ -701,7 +701,7 @@ short ScDBCollection::Compare(ScDataObject* pKey1, ScDataObject* pKey2) const
{
const String& rStr1 = ((ScDBData*)pKey1)->GetName();
const String& rStr2 = ((ScDBData*)pKey2)->GetName();
- return (short) ScGlobal::pTransliteration->compareString( rStr1, rStr2 );
+ return (short) ScGlobal::GetpTransliteration()->compareString( rStr1, rStr2 );
}
// IsEqual - alles gleich
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 2d337eab2eb3..a08b81a1917c 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -290,6 +290,12 @@ void ScCommentData::UpdateCaptionSet( const SfxItemSet& rItemSet )
//------------------------------------------------------------------------
+void ScDetectiveFunc::Modified()
+{
+ if (pDoc->IsStreamValid(nTab))
+ pDoc->SetStreamValid(nTab, FALSE);
+}
+
inline BOOL Intersect( SCCOL nStartCol1, SCROW nStartRow1, SCCOL nEndCol1, SCROW nEndRow1,
SCCOL nStartCol2, SCROW nStartRow2, SCCOL nEndCol2, SCROW nEndRow2 )
{
@@ -547,6 +553,7 @@ BOOL ScDetectiveFunc::InsertArrow( SCCOL nCol, SCROW nRow,
pData->maEnd.Set( nCol, nRow, nTab);
+ Modified();
return TRUE;
}
@@ -609,6 +616,7 @@ BOOL ScDetectiveFunc::InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow,
pData->maStart.Set( nStartCol, nStartRow, nTab);
pData->maEnd.SetInvalid();
+ Modified();
return TRUE;
}
@@ -676,6 +684,8 @@ void ScDetectiveFunc::DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData
ScDrawObjData* pData = ScDrawLayer::GetObjData( pCircle, TRUE );
pData->maStart.Set( nCol, nRow, nTab);
pData->maEnd.SetInvalid();
+
+ Modified();
}
void ScDetectiveFunc::DeleteArrowsAt( SCCOL nCol, SCROW nRow, BOOL bDestPnt )
@@ -716,6 +726,8 @@ void ScDetectiveFunc::DeleteArrowsAt( SCCOL nCol, SCROW nRow, BOOL bDestPnt )
pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
delete[] ppObj;
+
+ Modified();
}
}
@@ -791,6 +803,8 @@ void ScDetectiveFunc::DeleteBox( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nR
pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
delete[] ppObj;
+
+ Modified();
}
}
@@ -1333,6 +1347,8 @@ BOOL ScDetectiveFunc::DeleteAll( ScDetectiveDelete eWhat )
pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
delete[] ppObj;
+
+ Modified();
}
return ( nDelCount != 0 );
diff --git a/sc/source/core/tool/indexmap.cxx b/sc/source/core/tool/indexmap.cxx
deleted file mode 100644
index 50d0347a0aa9..000000000000
--- a/sc/source/core/tool/indexmap.cxx
+++ /dev/null
@@ -1,80 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: indexmap.cxx,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sc.hxx"
-
-
-
-
-
-#include <memory.h>
-
-#include "indexmap.hxx"
-
-
-ScIndexMap::ScIndexMap( USHORT nEntries )
-{
- nCount = nEntries;
- ULONG nC = nEntries ? ((ULONG) nEntries * 2) : 2;
- pMap = new USHORT [ nC ];
- memset( pMap, 0, nC * sizeof(USHORT) );
-}
-
-
-ScIndexMap::~ScIndexMap()
-{
- delete [] pMap;
-}
-
-
-void ScIndexMap::SetPair( USHORT nEntry, USHORT nIndex1, USHORT nIndex2 )
-{
- if ( nEntry < nCount )
- {
- ULONG nOff = (ULONG) nEntry * 2;
- pMap[nOff] = nIndex1;
- pMap[nOff+1] = nIndex2;
- }
-}
-
-
-USHORT ScIndexMap::Find( USHORT nIndex1 ) const
-{
- USHORT* pStop = pMap + (ULONG) nCount * 2;
- for ( USHORT* pOff = pMap; pOff < pStop; pOff += 2 )
- {
- if ( *pOff == nIndex1 )
- return *(pOff+1);
- }
- return nIndex1;
-}
-
-
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 195366271f0d..904c2625730c 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -45,6 +45,7 @@
#include <sfx2/printer.hxx>
#include <unotools/collatorwrapper.hxx>
#include <unotools/transliterationwrapper.hxx>
+#include <rtl/ustring.hxx>
#include <rtl/logfile.hxx>
#include "interpre.hxx"
@@ -89,7 +90,7 @@ using namespace formula;
void ScInterpreter::ScIfJump()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIfJump" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIfJump" );
const short* pJump = pCur->GetJump();
short nJumpCount = pJump[ 0 ];
MatrixDoubleRefToMatrix();
@@ -219,7 +220,7 @@ void ScInterpreter::ScIfJump()
void ScInterpreter::ScChoseJump()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScChoseJump" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScChoseJump" );
// We have to set a jump, if there was none chosen because of an error set
// it to endpoint.
bool bHaveJump = false;
@@ -350,7 +351,7 @@ void lcl_AdjustJumpMatrix( ScJumpMatrix* pJumpM, ScMatrixRef& pResMat, SCSIZE nP
bool ScInterpreter::JumpMatrix( short nStackLevel )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::JumpMatrix" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::JumpMatrix" );
pJumpMatrix = static_cast<ScToken*>(pStack[sp-nStackLevel])->GetJumpMatrix();
ScMatrixRef pResMat = pJumpMatrix->GetResultMatrix();
SCSIZE nC, nR;
@@ -642,7 +643,7 @@ ScCompareOptions::ScCompareOptions( ScDocument* pDoc, const ScQueryEntry& rEntry
double ScInterpreter::CompareFunc( const ScCompare& rComp, ScCompareOptions* pOptions )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CompareFunc" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CompareFunc" );
// Keep DoubleError if encountered
// #i40539# if bEmpty is set, bVal/nVal are uninitialized
if ( !rComp.bEmpty[0] && rComp.bVal[0] && !::rtl::math::isFinite( rComp.nVal[0]))
@@ -734,8 +735,8 @@ double ScInterpreter::CompareFunc( const ScCompare& rComp, ScCompareOptions* pOp
else if (rEntry.eOp == SC_EQUAL || rEntry.eOp == SC_NOT_EQUAL)
{
::utl::TransliterationWrapper* pTransliteration =
- (pOptions->bIgnoreCase ? ScGlobal::pTransliteration :
- ScGlobal::pCaseTransliteration);
+ (pOptions->bIgnoreCase ? ScGlobal::GetpTransliteration() :
+ ScGlobal::GetCaseTransliteration());
bool bMatch;
if (pOptions->bMatchWholeCell)
bMatch = pTransliteration->isEqual( *rComp.pVal[0], *rComp.pVal[1]);
@@ -752,17 +753,17 @@ double ScInterpreter::CompareFunc( const ScCompare& rComp, ScCompareOptions* pOp
fRes = (bMatch ? 0 : 1);
}
else if (pOptions->bIgnoreCase)
- fRes = (double) ScGlobal::pCollator->compareString(
+ fRes = (double) ScGlobal::GetCollator()->compareString(
*rComp.pVal[ 0 ], *rComp.pVal[ 1 ] );
else
- fRes = (double) ScGlobal::pCaseCollator->compareString(
+ fRes = (double) ScGlobal::GetCaseCollator()->compareString(
*rComp.pVal[ 0 ], *rComp.pVal[ 1 ] );
}
else if (pDok->GetDocOptions().IsIgnoreCase())
- fRes = (double) ScGlobal::pCollator->compareString(
+ fRes = (double) ScGlobal::GetCollator()->compareString(
*rComp.pVal[ 0 ], *rComp.pVal[ 1 ] );
else
- fRes = (double) ScGlobal::pCaseCollator->compareString(
+ fRes = (double) ScGlobal::GetCaseCollator()->compareString(
*rComp.pVal[ 0 ], *rComp.pVal[ 1 ] );
}
return fRes;
@@ -771,7 +772,7 @@ double ScInterpreter::CompareFunc( const ScCompare& rComp, ScCompareOptions* pOp
double ScInterpreter::Compare()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Compare" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Compare" );
String aVal1, aVal2;
ScCompare aComp( &aVal1, &aVal2 );
for( short i = 1; i >= 0; i-- )
@@ -825,7 +826,7 @@ double ScInterpreter::Compare()
ScMatrixRef ScInterpreter::CompareMat( ScCompareOptions* pOptions )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CompareMat" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CompareMat" );
String aVal1, aVal2;
ScCompare aComp( &aVal1, &aVal2 );
ScMatrixRef pMat[2];
@@ -1002,7 +1003,7 @@ ScMatrixRef ScInterpreter::QueryMat( ScMatrix* pMat, ScCompareOptions& rOptions
void ScInterpreter::ScEqual()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScEqual" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScEqual" );
if ( GetStackType(1) == svMatrix || GetStackType(2) == svMatrix )
{
ScMatrixRef pMat = CompareMat();
@@ -1021,7 +1022,7 @@ void ScInterpreter::ScEqual()
void ScInterpreter::ScNotEqual()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNotEqual" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNotEqual" );
if ( GetStackType(1) == svMatrix || GetStackType(2) == svMatrix )
{
ScMatrixRef pMat = CompareMat();
@@ -1040,7 +1041,7 @@ void ScInterpreter::ScNotEqual()
void ScInterpreter::ScLess()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLess" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLess" );
if ( GetStackType(1) == svMatrix || GetStackType(2) == svMatrix )
{
ScMatrixRef pMat = CompareMat();
@@ -1059,7 +1060,7 @@ void ScInterpreter::ScLess()
void ScInterpreter::ScGreater()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGreater" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGreater" );
if ( GetStackType(1) == svMatrix || GetStackType(2) == svMatrix )
{
ScMatrixRef pMat = CompareMat();
@@ -1078,7 +1079,7 @@ void ScInterpreter::ScGreater()
void ScInterpreter::ScLessEqual()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLessEqual" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLessEqual" );
if ( GetStackType(1) == svMatrix || GetStackType(2) == svMatrix )
{
ScMatrixRef pMat = CompareMat();
@@ -1097,7 +1098,7 @@ void ScInterpreter::ScLessEqual()
void ScInterpreter::ScGreaterEqual()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGreaterEqual" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGreaterEqual" );
if ( GetStackType(1) == svMatrix || GetStackType(2) == svMatrix )
{
ScMatrixRef pMat = CompareMat();
@@ -1116,7 +1117,7 @@ void ScInterpreter::ScGreaterEqual()
void ScInterpreter::ScAnd()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAnd" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAnd" );
nFuncFmtType = NUMBERFORMAT_LOGICAL;
short nParamCount = GetByte();
if ( MustHaveParamCountMin( nParamCount, 1 ) )
@@ -1214,7 +1215,7 @@ void ScInterpreter::ScAnd()
void ScInterpreter::ScOr()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScOr" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScOr" );
nFuncFmtType = NUMBERFORMAT_LOGICAL;
short nParamCount = GetByte();
if ( MustHaveParamCountMin( nParamCount, 1 ) )
@@ -1313,7 +1314,7 @@ void ScInterpreter::ScOr()
void ScInterpreter::ScNeg()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNeg" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNeg" );
// Simple negation doesn't change current format type to number, keep
// current type.
nFuncFmtType = nCurFmtType;
@@ -1355,7 +1356,7 @@ void ScInterpreter::ScNeg()
void ScInterpreter::ScPercentSign()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPercentSign" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPercentSign" );
nFuncFmtType = NUMBERFORMAT_PERCENT;
const FormulaToken* pSaveCur = pCur;
BYTE nSavePar = cPar;
@@ -1371,7 +1372,7 @@ void ScInterpreter::ScPercentSign()
void ScInterpreter::ScNot()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNot" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNot" );
nFuncFmtType = NUMBERFORMAT_LOGICAL;
switch ( GetStackType() )
{
@@ -1411,21 +1412,21 @@ void ScInterpreter::ScNot()
void ScInterpreter::ScPi()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPi" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPi" );
PushDouble(F_PI);
}
void ScInterpreter::ScRandom()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRandom" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRandom" );
PushDouble((double)rand() / ((double)RAND_MAX+1.0));
}
void ScInterpreter::ScTrue()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTrue" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTrue" );
nFuncFmtType = NUMBERFORMAT_LOGICAL;
PushInt(1);
}
@@ -1433,7 +1434,7 @@ void ScInterpreter::ScTrue()
void ScInterpreter::ScFalse()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFalse" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFalse" );
nFuncFmtType = NUMBERFORMAT_LOGICAL;
PushInt(0);
}
@@ -1441,124 +1442,121 @@ void ScInterpreter::ScFalse()
void ScInterpreter::ScDeg()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDeg" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDeg" );
PushDouble((GetDouble() / F_PI) * 180.0);
}
void ScInterpreter::ScRad()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRad" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRad" );
PushDouble(GetDouble() * (F_PI / 180));
}
void ScInterpreter::ScSin()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSin" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSin" );
PushDouble(::rtl::math::sin(GetDouble()));
}
void ScInterpreter::ScCos()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCos" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCos" );
PushDouble(::rtl::math::cos(GetDouble()));
}
void ScInterpreter::ScTan()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTan" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTan" );
PushDouble(::rtl::math::tan(GetDouble()));
}
void ScInterpreter::ScCot()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCot" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCot" );
PushDouble(1.0 / ::rtl::math::tan(GetDouble()));
}
void ScInterpreter::ScArcSin()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcSin" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcSin" );
PushDouble(asin(GetDouble()));
}
void ScInterpreter::ScArcCos()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcCos" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcCos" );
PushDouble(acos(GetDouble()));
}
void ScInterpreter::ScArcTan()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcTan" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcTan" );
PushDouble(atan(GetDouble()));
}
void ScInterpreter::ScArcCot()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcCot" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcCot" );
PushDouble((F_PI2) - atan(GetDouble()));
}
void ScInterpreter::ScSinHyp()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSinHyp" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSinHyp" );
PushDouble(sinh(GetDouble()));
}
void ScInterpreter::ScCosHyp()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCosHyp" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCosHyp" );
PushDouble(cosh(GetDouble()));
}
void ScInterpreter::ScTanHyp()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTanHyp" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTanHyp" );
PushDouble(tanh(GetDouble()));
}
void ScInterpreter::ScCotHyp()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCotHyp" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCotHyp" );
PushDouble(1.0 / tanh(GetDouble()));
}
void ScInterpreter::ScArcSinHyp()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcSinHyp" );
- double nVal = GetDouble();
- PushDouble(log(nVal + sqrt((nVal * nVal) + 1.0)));
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcSinHyp" );
+ PushDouble( ::rtl::math::asinh( GetDouble()));
}
-
void ScInterpreter::ScArcCosHyp()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcCosHyp" );
- double nVal = GetDouble();
- if (nVal < 1.0)
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcCosHyp" );
+ double fVal = GetDouble();
+ if (fVal < 1.0)
PushIllegalArgument();
else
- PushDouble(log(nVal + sqrt((nVal * nVal) - 1.0)));
+ PushDouble( ::rtl::math::acosh( fVal));
}
-
void ScInterpreter::ScArcTanHyp()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcTanHyp" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcTanHyp" );
double fVal = GetDouble();
if (fabs(fVal) >= 1.0)
PushIllegalArgument();
@@ -1569,7 +1567,7 @@ void ScInterpreter::ScArcTanHyp()
void ScInterpreter::ScArcCotHyp()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcCotHyp" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcCotHyp" );
double nVal = GetDouble();
if (fabs(nVal) <= 1.0)
PushIllegalArgument();
@@ -1580,14 +1578,14 @@ void ScInterpreter::ScArcCotHyp()
void ScInterpreter::ScExp()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScExp" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScExp" );
PushDouble(exp(GetDouble()));
}
void ScInterpreter::ScSqrt()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSqrt" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSqrt" );
double fVal = GetDouble();
if (fVal >= 0.0)
PushDouble(sqrt(fVal));
@@ -1598,7 +1596,7 @@ void ScInterpreter::ScSqrt()
void ScInterpreter::ScIsEmpty()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsEmpty" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsEmpty" );
short nRes = 0;
nFuncFmtType = NUMBERFORMAT_LOGICAL;
switch ( GetRawStackType() )
@@ -1653,7 +1651,7 @@ void ScInterpreter::ScIsEmpty()
short ScInterpreter::IsString()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::IsString" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::IsString" );
nFuncFmtType = NUMBERFORMAT_LOGICAL;
short nRes = 0;
switch ( GetRawStackType() )
@@ -1714,21 +1712,21 @@ short ScInterpreter::IsString()
void ScInterpreter::ScIsString()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsString" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsString" );
PushInt( IsString() );
}
void ScInterpreter::ScIsNonString()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsNonString" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsNonString" );
PushInt( !IsString() );
}
void ScInterpreter::ScIsLogical()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsLogical" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsLogical" );
short nRes = 0;
switch ( GetStackType() )
{
@@ -1767,7 +1765,7 @@ void ScInterpreter::ScIsLogical()
void ScInterpreter::ScType()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScType" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScType" );
short nType = 0;
switch ( GetStackType() )
{
@@ -1876,7 +1874,7 @@ void ScInterpreter::ScCell()
String aFuncResult;
ScBaseCell* pCell = GetCell( aCellPos );
- ScCellKeywordTranslator::transKeyword(aInfoType, ScGlobal::pLocale, ocCell);
+ ScCellKeywordTranslator::transKeyword(aInfoType, ScGlobal::GetLocale(), ocCell);
// *** ADDRESS INFO ***
if( aInfoType.EqualsAscii( "COL" ) )
@@ -2065,7 +2063,7 @@ void ScInterpreter::ScCell()
void ScInterpreter::ScIsRef()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCell" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCell" );
nFuncFmtType = NUMBERFORMAT_LOGICAL;
short nRes = 0;
switch ( GetStackType() )
@@ -2103,7 +2101,7 @@ void ScInterpreter::ScIsRef()
void ScInterpreter::ScIsValue()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsValue" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsValue" );
nFuncFmtType = NUMBERFORMAT_LOGICAL;
short nRes = 0;
switch ( GetRawStackType() )
@@ -2167,7 +2165,7 @@ void ScInterpreter::ScIsValue()
void ScInterpreter::ScIsFormula()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsFormula" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsFormula" );
nFuncFmtType = NUMBERFORMAT_LOGICAL;
short nRes = 0;
switch ( GetStackType() )
@@ -2191,7 +2189,7 @@ void ScInterpreter::ScIsFormula()
void ScInterpreter::ScFormula()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFormula" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFormula" );
String aFormula;
switch ( GetStackType() )
{
@@ -2223,7 +2221,7 @@ void ScInterpreter::ScFormula()
void ScInterpreter::ScIsNV()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsNV" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsNV" );
nFuncFmtType = NUMBERFORMAT_LOGICAL;
short nRes = 0;
switch ( GetStackType() )
@@ -2272,7 +2270,7 @@ void ScInterpreter::ScIsNV()
void ScInterpreter::ScIsErr()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsErr" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsErr" );
nFuncFmtType = NUMBERFORMAT_LOGICAL;
short nRes = 0;
switch ( GetStackType() )
@@ -2327,7 +2325,7 @@ void ScInterpreter::ScIsErr()
void ScInterpreter::ScIsError()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsError" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsError" );
nFuncFmtType = NUMBERFORMAT_LOGICAL;
short nRes = 0;
switch ( GetStackType() )
@@ -2379,7 +2377,7 @@ void ScInterpreter::ScIsError()
short ScInterpreter::IsEven()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::IsEven" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::IsEven" );
nFuncFmtType = NUMBERFORMAT_LOGICAL;
short nRes = 0;
double fVal = 0.0;
@@ -2462,21 +2460,21 @@ short ScInterpreter::IsEven()
void ScInterpreter::ScIsEven()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsEven" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsEven" );
PushInt( IsEven() );
}
void ScInterpreter::ScIsOdd()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIsOdd" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIsOdd" );
PushInt( !IsEven() );
}
void ScInterpreter::ScN()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScN" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScN" );
USHORT nErr = nGlobalError;
nGlobalError = 0;
double fVal;
@@ -2515,7 +2513,7 @@ void ScInterpreter::ScTrim()
void ScInterpreter::ScUpper()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTrim" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTrim" );
String aString = GetString();
ScGlobal::pCharClass->toUpper(aString);
PushString(aString);
@@ -2524,7 +2522,7 @@ void ScInterpreter::ScUpper()
void ScInterpreter::ScPropper()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPropper" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPropper" );
//2do: what to do with I18N-CJK ?!?
String aStr( GetString() );
const xub_StrLen nLen = aStr.Len();
@@ -2557,7 +2555,7 @@ void ScInterpreter::ScPropper()
void ScInterpreter::ScLower()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLower" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLower" );
String aString( GetString() );
ScGlobal::pCharClass->toLower(aString);
PushString(aString);
@@ -2566,7 +2564,7 @@ void ScInterpreter::ScLower()
void ScInterpreter::ScLen()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLen" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLen" );
String aStr( GetString() );
PushDouble( aStr.Len() );
}
@@ -2574,7 +2572,7 @@ void ScInterpreter::ScLen()
void ScInterpreter::ScT()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScT" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScT" );
switch ( GetStackType() )
{
case svDoubleRef :
@@ -2629,7 +2627,7 @@ void ScInterpreter::ScT()
void ScInterpreter::ScValue()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScValue" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScValue" );
String aInputString;
double fVal;
@@ -2711,7 +2709,7 @@ inline BOOL lcl_ScInterpreter_IsPrintable( sal_Unicode c )
void ScInterpreter::ScClean()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScClean" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScClean" );
String aStr( GetString() );
for ( xub_StrLen i = 0; i < aStr.Len(); i++ )
{
@@ -2724,7 +2722,7 @@ void ScInterpreter::ScClean()
void ScInterpreter::ScCode()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCode" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCode" );
//2do: make it full range unicode?
const String& rStr = GetString();
PushInt( (sal_uChar) ByteString::ConvertFromUnicode( rStr.GetChar(0), gsl_getSystemTextEncoding() ) );
@@ -2733,7 +2731,7 @@ void ScInterpreter::ScCode()
void ScInterpreter::ScChar()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScChar" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScChar" );
//2do: make it full range unicode?
double fVal = GetDouble();
if (fVal < 0.0 || fVal >= 256.0)
@@ -2793,7 +2791,7 @@ static ::rtl::OUString lcl_convertIntoFullWidth( const ::rtl::OUString & rStr )
*/
void ScInterpreter::ScJis()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScJis" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScJis" );
if (MustHaveParamCount( GetByte(), 1))
PushString( lcl_convertIntoFullWidth( GetString()));
}
@@ -2807,15 +2805,48 @@ void ScInterpreter::ScJis()
*/
void ScInterpreter::ScAsc()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAsc" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAsc" );
if (MustHaveParamCount( GetByte(), 1))
PushString( lcl_convertIntoHalfWidth( GetString()));
}
+void ScInterpreter::ScUnicode()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScUnicode" );
+ if ( MustHaveParamCount( GetByte(), 1 ) )
+ {
+ const rtl::OUString& rStr = GetString();
+ if (rStr.getLength() <= 0)
+ PushIllegalParameter();
+ else
+ {
+ sal_Int32 i = 0;
+ PushDouble( rStr.iterateCodePoints(&i) );
+ }
+ }
+}
+
+void ScInterpreter::ScUnichar()
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScUnichar" );
+ if ( MustHaveParamCount( GetByte(), 1 ) )
+ {
+ double dVal = ::rtl::math::approxFloor( GetDouble() );
+ if ((dVal < 0x000000) || (dVal > 0x10FFFF))
+ PushIllegalArgument();
+ else
+ {
+ sal_uInt32 nCodePoint = static_cast<sal_uInt32>( dVal );
+ rtl::OUString aStr( &nCodePoint, 1 );
+ PushString( aStr );
+ }
+ }
+}
+
void ScInterpreter::ScMin( BOOL bTextAsZero )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMin" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMin" );
short nParamCount = GetByte();
if (!MustHaveParamCountMin( nParamCount, 1))
return;
@@ -2940,7 +2971,7 @@ void ScInterpreter::ScMin( BOOL bTextAsZero )
void ScInterpreter::ScMax( BOOL bTextAsZero )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMax" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMax" );
short nParamCount = GetByte();
if (!MustHaveParamCountMin( nParamCount, 1))
return;
@@ -3065,7 +3096,7 @@ void ScInterpreter::ScMax( BOOL bTextAsZero )
double ScInterpreter::IterateParameters( ScIterFunc eFunc, BOOL bTextAsZero )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::IterateParameters" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::IterateParameters" );
short nParamCount = GetByte();
double fRes = ( eFunc == ifPRODUCT ) ? 1.0 : 0.0;
double fVal = 0.0;
@@ -3377,42 +3408,42 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, BOOL bTextAsZero )
void ScInterpreter::ScSumSQ()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSumSQ" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSumSQ" );
PushDouble( IterateParameters( ifSUMSQ ) );
}
void ScInterpreter::ScSum()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSum" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSum" );
PushDouble( IterateParameters( ifSUM ) );
}
void ScInterpreter::ScProduct()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScProduct" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScProduct" );
PushDouble( IterateParameters( ifPRODUCT ) );
}
void ScInterpreter::ScAverage( BOOL bTextAsZero )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAverage" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAverage" );
PushDouble( IterateParameters( ifAVERAGE, bTextAsZero ) );
}
void ScInterpreter::ScCount()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCount" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCount" );
PushDouble( IterateParameters( ifCOUNT ) );
}
void ScInterpreter::ScCount2()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCount2" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCount2" );
PushDouble( IterateParameters( ifCOUNT2 ) );
}
@@ -3420,7 +3451,7 @@ void ScInterpreter::ScCount2()
void ScInterpreter::GetStVarParams( double& rVal, double& rValCount,
BOOL bTextAsZero )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetStVarParams" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetStVarParams" );
short nParamCount = GetByte();
std::vector<double> values;
@@ -3529,15 +3560,14 @@ void ScInterpreter::GetStVarParams( double& rVal, double& rValCount,
::std::vector<double>::size_type n = values.size();
vMean = fSum / n;
for (::std::vector<double>::size_type i = 0; i < n; i++)
- vSum += (values[i] - vMean) * (values[i] - vMean);
-
+ vSum += ::rtl::math::approxSub( values[i], vMean) * ::rtl::math::approxSub( values[i], vMean);
rVal = vSum;
}
void ScInterpreter::ScVar( BOOL bTextAsZero )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScVar" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScVar" );
double nVal;
double nValCount;
GetStVarParams( nVal, nValCount, bTextAsZero );
@@ -3551,7 +3581,7 @@ void ScInterpreter::ScVar( BOOL bTextAsZero )
void ScInterpreter::ScVarP( BOOL bTextAsZero )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScVarP" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScVarP" );
double nVal;
double nValCount;
GetStVarParams( nVal, nValCount, bTextAsZero );
@@ -3562,7 +3592,7 @@ void ScInterpreter::ScVarP( BOOL bTextAsZero )
void ScInterpreter::ScStDev( BOOL bTextAsZero )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScStDev" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScStDev" );
double nVal;
double nValCount;
GetStVarParams( nVal, nValCount, bTextAsZero );
@@ -3575,7 +3605,7 @@ void ScInterpreter::ScStDev( BOOL bTextAsZero )
void ScInterpreter::ScStDevP( BOOL bTextAsZero )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScStDevP" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScStDevP" );
double nVal;
double nValCount;
GetStVarParams( nVal, nValCount, bTextAsZero );
@@ -3605,7 +3635,7 @@ void ScInterpreter::ScStDevP( BOOL bTextAsZero )
void ScInterpreter::ScColumns()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScColumns" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScColumns" );
BYTE nParamCount = GetByte();
ULONG nVal = 0;
SCCOL nCol1;
@@ -3649,7 +3679,7 @@ void ScInterpreter::ScColumns()
void ScInterpreter::ScRows()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRows" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRows" );
BYTE nParamCount = GetByte();
ULONG nVal = 0;
SCCOL nCol1;
@@ -3692,7 +3722,7 @@ void ScInterpreter::ScRows()
void ScInterpreter::ScTables()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTables" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTables" );
BYTE nParamCount = GetByte();
ULONG nVal;
if ( nParamCount == 0 )
@@ -3734,7 +3764,7 @@ void ScInterpreter::ScTables()
void ScInterpreter::ScColumn()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScColumn" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScColumn" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 0, 1 ) )
{
@@ -3810,7 +3840,7 @@ void ScInterpreter::ScColumn()
void ScInterpreter::ScRow()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRow" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRow" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 0, 1 ) )
{
@@ -3885,7 +3915,7 @@ void ScInterpreter::ScRow()
void ScInterpreter::ScTable()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTable" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTable" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 0, 1 ) )
{
@@ -3975,7 +4005,7 @@ static sal_Int32 lcl_CompareMatrix2Query( SCSIZE i, const ScMatrix& rMat,
const String& rStr1 = rMat.GetString(i);
const String& rStr2 = *rEntry.pStr;
- return ScGlobal::pCollator->compareString( rStr1, rStr2); // case-insensitive
+ return ScGlobal::GetCollator()->compareString( rStr1, rStr2); // case-insensitive
}
/** returns the last item with the identical value as the original item
@@ -4034,7 +4064,7 @@ static void lcl_GetLastMatch( SCSIZE& rIndex, const ScMatrix& rMat,
void ScInterpreter::ScMatch()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMatch" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMatch" );
ScMatrixRef pMatSrc = NULL;
BYTE nParamCount = GetByte();
@@ -4293,7 +4323,7 @@ void ScInterpreter::ScMatch()
void ScInterpreter::ScCountEmptyCells()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCountEmptyCells" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCountEmptyCells" );
if ( MustHaveParamCount( GetByte(), 1 ) )
{
ULONG nMaxCount = 0, nCount = 0;
@@ -4346,7 +4376,7 @@ void ScInterpreter::ScCountEmptyCells()
void ScInterpreter::ScCountIf()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCountIf" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCountIf" );
if ( MustHaveParamCount( GetByte(), 2 ) )
{
String rString;
@@ -4538,7 +4568,7 @@ void ScInterpreter::ScCountIf()
void ScInterpreter::ScSumIf()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSumIf" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSumIf" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 2, 3 ) )
{
@@ -4905,7 +4935,7 @@ void ScInterpreter::ScSumIf()
void ScInterpreter::ScLookup()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLookup" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLookup" );
BYTE nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 2, 3 ) )
return ;
@@ -4917,9 +4947,16 @@ void ScInterpreter::ScLookup()
SCSIZE nLenMajor = 0; // length of major direction
bool bVertical = true; // whether to lookup vertically or horizontally
+ // The third parameter, result array, for double, string and single reference.
+ double fResVal = 0.0;
+ String aResStr;
+ ScAddress aResAdr;
+ StackVar eResArrayType = svUnknown;
+
if (nParamCount == 3)
{
- switch (GetStackType())
+ eResArrayType = GetStackType();
+ switch (eResArrayType)
{
case svDoubleRef:
{
@@ -4953,16 +4990,32 @@ void ScInterpreter::ScLookup()
}
}
break;
+ case svDouble:
+ fResVal = GetDouble();
+ break;
+ case svString:
+ aResStr = GetString();
+ break;
+ case svSingleRef:
+ PopSingleRef( aResAdr );
+ break;
default:
PushIllegalParameter();
return;
}
}
+ // For double, string and single reference.
+ double fDataVal = 0.0;
+ String aDataStr;
+ ScAddress aDataAdr;
+ bool bValueData = false;
+
// Get the data-result range and also determine whether this is vertical
// lookup or horizontal lookup.
- switch (GetStackType())
+ StackVar eDataArrayType = GetStackType();
+ switch (eDataArrayType)
{
case svDoubleRef:
{
@@ -4992,15 +5045,43 @@ void ScInterpreter::ScLookup()
nLenMajor = bVertical ? nR : nC;
}
break;
+ case svDouble:
+ {
+ fDataVal = GetDouble();
+ bValueData = true;
+ }
+ break;
+ case svString:
+ {
+ aDataStr = GetString();
+ }
+ break;
+ case svSingleRef:
+ {
+ PopSingleRef( aDataAdr );
+ const ScBaseCell* pDataCell = GetCell( aDataAdr );
+ if (HasCellEmptyData( pDataCell))
+ {
+ // Empty cells aren't found anywhere, bail out early.
+ SetError( NOTAVAILABLE);
+ }
+ else if (HasCellValueData( pDataCell))
+ {
+ fDataVal = GetCellValue( aDataAdr, pDataCell );
+ bValueData = true;
+ }
+ else
+ GetCellString( aDataStr, pDataCell );
+ }
+ break;
default:
- PushIllegalParameter();
- return;
+ SetError( errIllegalParameter);
}
if (nGlobalError)
{
- PushIllegalParameter();
+ PushError( nGlobalError);
return;
}
@@ -5011,6 +5092,84 @@ void ScInterpreter::ScLookup()
if ( !FillEntry(rEntry) )
return;
+ if ( eDataArrayType == svDouble || eDataArrayType == svString ||
+ eDataArrayType == svSingleRef )
+ {
+ // Delta position for a single value is always 0.
+
+ // Found if data <= query, but not if query is string and found data is
+ // numeric or vice versa. This is how Excel does it but doesn't
+ // document it.
+
+ bool bFound = false;
+ if ( bValueData )
+ {
+ if ( rEntry.bQueryByString )
+ bFound = false;
+ else
+ bFound = (fDataVal <= rEntry.nVal);
+ }
+ else
+ {
+ if ( !rEntry.bQueryByString )
+ bFound = false;
+ else
+ bFound = (ScGlobal::GetCollator()->compareString( aDataStr, *rEntry.pStr) <= 0);
+ }
+
+ if (!bFound)
+ {
+ PushNA();
+ return;
+ }
+
+ if (pResMat)
+ {
+ if (pResMat->IsValue( 0 ))
+ PushDouble(pResMat->GetDouble( 0 ));
+ else
+ PushString(pResMat->GetString( 0 ));
+ }
+ else if (nParamCount == 3)
+ {
+ switch (eResArrayType)
+ {
+ case svDouble:
+ PushDouble( fResVal );
+ break;
+ case svString:
+ PushString( aResStr );
+ break;
+ case svDoubleRef:
+ aResAdr.Set( nResCol1, nResRow1, nResTab);
+ // fallthru
+ case svSingleRef:
+ PushCellResultToken( true, aResAdr, NULL, NULL);
+ break;
+ default:
+ DBG_ERRORFILE( "ScInterpreter::ScLookup: unhandled eResArrayType, single value data");
+ }
+ }
+ else
+ {
+ switch (eDataArrayType)
+ {
+ case svDouble:
+ PushDouble( fDataVal );
+ break;
+ case svString:
+ PushString( aDataStr );
+ break;
+ case svSingleRef:
+ PushCellResultToken( true, aDataAdr, NULL, NULL);
+ break;
+ default:
+ DBG_ERRORFILE( "ScInterpreter::ScLookup: unhandled eDataArrayType, single value data");
+ }
+ }
+ return;
+ }
+
// Now, perform the search to compute the delta position (nDelta).
if (pDataMat)
@@ -5096,6 +5255,20 @@ void ScInterpreter::ScLookup()
bFound = true;
}
+ // With 0-9 < A-Z, if query is numeric and data found is string, or
+ // vice versa, the (yet another undocumented) Excel behavior is to
+ // return #N/A instead.
+
+ if (bFound)
+ {
+ SCCOLROW i = nDelta;
+ SCSIZE n = pDataMat->GetElementCount();
+ if (static_cast<SCSIZE>(i) >= n)
+ i = static_cast<SCCOLROW>(n);
+ if (bool(rEntry.bQueryByString) == bool(pDataMat->IsValue(i)))
+ bFound = false;
+ }
+
if (!bFound)
{
PushNA();
@@ -5208,35 +5381,69 @@ void ScInterpreter::ScLookup()
}
else if (nParamCount == 3)
{
- // Use the result array vector. Note that the result array is assumed
- // to be a vector (i.e. 1-dimensinoal array).
-
- ScAddress aAdr;
- aAdr.SetTab(nResTab);
- bool bResVertical = (nResRow2 - nResRow1) > 0;
- if (bResVertical)
+ switch (eResArrayType)
{
- SCROW nTempRow = static_cast<SCROW>(nResRow1 + nDelta);
- if (nTempRow > MAXROW)
+ case svDoubleRef:
{
- PushDouble(0);
- return;
+ // Use the result array vector. Note that the result array is assumed
+ // to be a vector (i.e. 1-dimensinoal array).
+
+ ScAddress aAdr;
+ aAdr.SetTab(nResTab);
+ bool bResVertical = (nResRow2 - nResRow1) > 0;
+ if (bResVertical)
+ {
+ SCROW nTempRow = static_cast<SCROW>(nResRow1 + nDelta);
+ if (nTempRow > MAXROW)
+ {
+ PushDouble(0);
+ return;
+ }
+ aAdr.SetCol(nResCol1);
+ aAdr.SetRow(nTempRow);
+ }
+ else
+ {
+ SCCOL nTempCol = static_cast<SCCOL>(nResCol1 + nDelta);
+ if (nTempCol > MAXCOL)
+ {
+ PushDouble(0);
+ return;
+ }
+ aAdr.SetCol(nTempCol);
+ aAdr.SetRow(nResRow1);
+ }
+ PushCellResultToken( true, aAdr, NULL, NULL);
}
- aAdr.SetCol(nResCol1);
- aAdr.SetRow(nTempRow);
- }
- else
- {
- SCCOL nTempCol = static_cast<SCCOL>(nResCol1 + nDelta);
- if (nTempCol > MAXCOL)
+ break;
+ case svDouble:
+ case svString:
+ case svSingleRef:
{
- PushDouble(0);
- return;
+ if (nDelta != 0)
+ PushNA();
+ else
+ {
+ switch (eResArrayType)
+ {
+ case svDouble:
+ PushDouble( fResVal );
+ break;
+ case svString:
+ PushString( aResStr );
+ break;
+ case svSingleRef:
+ PushCellResultToken( true, aResAdr, NULL, NULL);
+ break;
+ default:
+ ; // nothing
+ }
+ }
}
- aAdr.SetCol(nTempCol);
- aAdr.SetRow(nResRow1);
+ break;
+ default:
+ DBG_ERRORFILE( "ScInterpreter::ScLookup: unhandled eResArrayType, range search");
}
- PushCellResultToken(true, aAdr, NULL, NULL);
}
else
{
@@ -5274,12 +5481,12 @@ void ScInterpreter::ScLookup()
void ScInterpreter::ScHLookup()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScHLookup" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScHLookup" );
CalculateLookup(TRUE);
}
void ScInterpreter::CalculateLookup(BOOL HLookup)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateLookup" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateLookup" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 3, 4 ) )
{
@@ -5375,12 +5582,13 @@ void ScInterpreter::CalculateLookup(BOOL HLookup)
String aParamStr = *rEntry.pStr;
if ( bSorted )
{
+ static CollatorWrapper* pCollator = ScGlobal::GetCollator();
for (SCSIZE i = 0; i < nMatCount; i++)
{
if (HLookup ? pMat->IsString(i, 0) : pMat->IsString(0, i))
{
sal_Int32 nRes =
- ScGlobal::pCollator->compareString( HLookup ? pMat->GetString(i,0) : pMat->GetString(0,i), aParamStr);
+ pCollator->compareString( HLookup ? pMat->GetString(i,0) : pMat->GetString(0,i), aParamStr);
if (nRes <= 0)
nDelta = i;
else if (i>0) // #i2168# ignore first mismatch
@@ -5396,7 +5604,7 @@ void ScInterpreter::CalculateLookup(BOOL HLookup)
{
if (HLookup ? pMat->IsString(i, 0) : pMat->IsString(0, i))
{
- if ( ScGlobal::pTransliteration->isEqual(
+ if ( ScGlobal::GetpTransliteration()->isEqual(
HLookup ? pMat->GetString(i,0) : pMat->GetString(0,i), aParamStr ) )
{
nDelta = i;
@@ -5502,7 +5710,7 @@ void ScInterpreter::CalculateLookup(BOOL HLookup)
bool ScInterpreter::FillEntry(ScQueryEntry& rEntry)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::FillEntry" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::FillEntry" );
switch ( GetStackType() )
{
case svDouble:
@@ -5566,7 +5774,7 @@ bool ScInterpreter::FillEntry(ScQueryEntry& rEntry)
}
void ScInterpreter::ScVLookup()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScVLookup" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScVLookup" );
CalculateLookup(FALSE);
}
@@ -5576,7 +5784,7 @@ void ScInterpreter::ScVLookup()
void ScInterpreter::ScSubTotal()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSubTotal" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSubTotal" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCountMin( nParamCount, 2 ) )
{
@@ -5621,7 +5829,7 @@ void ScInterpreter::ScSubTotal()
BOOL ScInterpreter::GetDBParams(SCTAB& rTab, ScQueryParam& rParam,
BOOL& rMissingField )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetDBParams" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetDBParams" );
BOOL bRet = FALSE;
BOOL bAllowMissingField = FALSE;
if ( rMissingField )
@@ -5734,7 +5942,7 @@ BOOL ScInterpreter::GetDBParams(SCTAB& rTab, ScQueryParam& rParam,
{
ScBaseCell* pCell = GetCell( aLook );
GetCellString( aCellStr, pCell );
- bFound = ScGlobal::pTransliteration->isEqual( aCellStr, aStr );
+ bFound = ScGlobal::GetpTransliteration()->isEqual( aCellStr, aStr );
if (!bFound)
aLook.IncCol();
}
@@ -5790,7 +5998,7 @@ BOOL ScInterpreter::GetDBParams(SCTAB& rTab, ScQueryParam& rParam,
void ScInterpreter::DBIterator( ScIterFunc eFunc )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::DBIterator" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::DBIterator" );
SCTAB nTab1;
double nErg = 0.0;
double fMem = 0.0;
@@ -5853,14 +6061,14 @@ void ScInterpreter::DBIterator( ScIterFunc eFunc )
void ScInterpreter::ScDBSum()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBSum" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBSum" );
DBIterator( ifSUM );
}
void ScInterpreter::ScDBCount()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBCount" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBCount" );
SCTAB nTab;
ScQueryParam aQueryParam;
BOOL bMissingField = TRUE;
@@ -5909,7 +6117,7 @@ void ScInterpreter::ScDBCount()
void ScInterpreter::ScDBCount2()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBCount2" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBCount2" );
SCTAB nTab;
ScQueryParam aQueryParam;
BOOL bMissingField = TRUE;
@@ -5933,35 +6141,35 @@ void ScInterpreter::ScDBCount2()
void ScInterpreter::ScDBAverage()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBAverage" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBAverage" );
DBIterator( ifAVERAGE );
}
void ScInterpreter::ScDBMax()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBMax" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBMax" );
DBIterator( ifMAX );
}
void ScInterpreter::ScDBMin()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBMin" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBMin" );
DBIterator( ifMIN );
}
void ScInterpreter::ScDBProduct()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBProduct" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBProduct" );
DBIterator( ifPRODUCT );
}
void ScInterpreter::GetDBStVarParams( double& rVal, double& rValCount )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetDBStVarParams" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetDBStVarParams" );
std::vector<double> values;
double vSum = 0.0;
double vMean = 0.0;
@@ -6002,7 +6210,7 @@ void ScInterpreter::GetDBStVarParams( double& rVal, double& rValCount )
void ScInterpreter::ScDBStdDev()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBStdDev" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBStdDev" );
double fVal, fCount;
GetDBStVarParams( fVal, fCount );
PushDouble( sqrt(fVal/(fCount-1)));
@@ -6011,7 +6219,7 @@ void ScInterpreter::ScDBStdDev()
void ScInterpreter::ScDBStdDevP()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBStdDevP" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBStdDevP" );
double fVal, fCount;
GetDBStVarParams( fVal, fCount );
PushDouble( sqrt(fVal/fCount));
@@ -6020,7 +6228,7 @@ void ScInterpreter::ScDBStdDevP()
void ScInterpreter::ScDBVar()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBVar" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBVar" );
double fVal, fCount;
GetDBStVarParams( fVal, fCount );
PushDouble(fVal/(fCount-1));
@@ -6029,7 +6237,7 @@ void ScInterpreter::ScDBVar()
void ScInterpreter::ScDBVarP()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBVarP" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBVarP" );
double fVal, fCount;
GetDBStVarParams( fVal, fCount );
PushDouble(fVal/fCount);
@@ -6084,7 +6292,7 @@ ScTokenArray* lcl_CreateExternalRefTokenArray( const ScAddress& rPos, ScDocument
void ScInterpreter::ScIndirect()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIndirect" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIndirect" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 1, 2 ) )
{
@@ -6193,7 +6401,7 @@ void ScInterpreter::ScIndirect()
void ScInterpreter::ScAddressFunc()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAddressFunc" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAddressFunc" );
String sTabStr;
BYTE nParamCount = GetByte();
@@ -6268,7 +6476,7 @@ void ScInterpreter::ScAddressFunc()
void ScInterpreter::ScOffset()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScOffset" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScOffset" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 3, 5 ) )
{
@@ -6344,7 +6552,7 @@ void ScInterpreter::ScOffset()
void ScInterpreter::ScIndex()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIndex" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIndex" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 1, 4 ) )
{
@@ -6550,7 +6758,7 @@ void ScInterpreter::ScIndex()
void ScInterpreter::ScMultiArea()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMultiArea" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMultiArea" );
// Legacy support, convert to RefList
BYTE nParamCount = GetByte();
if (MustHaveParamCountMin( nParamCount, 1))
@@ -6565,7 +6773,7 @@ void ScInterpreter::ScMultiArea()
void ScInterpreter::ScAreas()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAreas" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAreas" );
BYTE nParamCount = GetByte();
if (MustHaveParamCount( nParamCount, 1))
{
@@ -6603,7 +6811,7 @@ void ScInterpreter::ScAreas()
void ScInterpreter::ScCurrency()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCurrency" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCurrency" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 1, 2 ) )
{
@@ -6664,17 +6872,25 @@ void ScInterpreter::ScCurrency()
void ScInterpreter::ScReplace()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScReplace" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScReplace" );
if ( MustHaveParamCount( GetByte(), 4 ) )
{
String aNewStr( GetString() );
- short nCount = (short) GetDouble();
- short nPos = (short) GetDouble();
+ double fCount = ::rtl::math::approxFloor( GetDouble());
+ double fPos = ::rtl::math::approxFloor( GetDouble());
String aOldStr( GetString() );
- if( nPos < 1 || nCount < 1 )
+ if (fPos < 1.0 || fPos > static_cast<double>(STRING_MAXLEN)
+ || fCount < 0.0 || fCount > static_cast<double>(STRING_MAXLEN))
PushIllegalArgument();
else
{
+ xub_StrLen nCount = static_cast<xub_StrLen>(fCount);
+ xub_StrLen nPos = static_cast<xub_StrLen>(fPos);
+ xub_StrLen nLen = aOldStr.Len();
+ if (nPos > nLen + 1)
+ nPos = nLen + 1;
+ if (nCount > nLen - nPos + 1)
+ nCount = nLen - nPos + 1;
aOldStr.Erase( nPos-1, nCount );
if ( CheckStringResultLen( aOldStr, aNewStr ) )
aOldStr.Insert( aNewStr, nPos-1 );
@@ -6686,7 +6902,7 @@ void ScInterpreter::ScReplace()
void ScInterpreter::ScFixed()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFixed" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFixed" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 1, 3 ) )
{
@@ -6746,7 +6962,7 @@ void ScInterpreter::ScFixed()
void ScInterpreter::ScFind()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFind" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFind" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 2, 3 ) )
{
@@ -6772,7 +6988,7 @@ void ScInterpreter::ScFind()
void ScInterpreter::ScExact()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScExact" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScExact" );
nFuncFmtType = NUMBERFORMAT_LOGICAL;
if ( MustHaveParamCount( GetByte(), 2 ) )
{
@@ -6785,7 +7001,7 @@ void ScInterpreter::ScExact()
void ScInterpreter::ScLeft()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLeft" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLeft" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 1, 2 ) )
{
@@ -6812,7 +7028,7 @@ void ScInterpreter::ScLeft()
void ScInterpreter::ScRight()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRight" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRight" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 1, 2 ) )
{
@@ -6840,7 +7056,7 @@ void ScInterpreter::ScRight()
void ScInterpreter::ScSearch()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSearch" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSearch" );
double fAnz;
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 2, 3 ) )
@@ -6881,7 +7097,7 @@ void ScInterpreter::ScSearch()
void ScInterpreter::ScMid()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMid" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMid" );
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double fAnz = ::rtl::math::approxFloor(GetDouble());
@@ -6897,7 +7113,7 @@ void ScInterpreter::ScMid()
void ScInterpreter::ScText()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScText" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScText" );
if ( MustHaveParamCount( GetByte(), 2 ) )
{
String sFormatString = GetString();
@@ -6923,7 +7139,7 @@ void ScInterpreter::ScText()
void ScInterpreter::ScSubstitute()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSubstitute" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSubstitute" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 3, 4 ) )
{
@@ -6978,7 +7194,7 @@ void ScInterpreter::ScSubstitute()
void ScInterpreter::ScRept()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRept" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRept" );
if ( MustHaveParamCount( GetByte(), 2 ) )
{
double fAnz = ::rtl::math::approxFloor(GetDouble());
@@ -7011,7 +7227,7 @@ void ScInterpreter::ScRept()
void ScInterpreter::ScConcat()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScConcat" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScConcat" );
BYTE nParamCount = GetByte();
String aRes;
while( nParamCount-- > 0)
@@ -7025,7 +7241,7 @@ void ScInterpreter::ScConcat()
void ScInterpreter::ScErrorType()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScErrorType" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScErrorType" );
USHORT nErr;
USHORT nOldError = nGlobalError;
nGlobalError = 0;
@@ -7107,7 +7323,7 @@ void ScInterpreter::ScErrorType()
BOOL ScInterpreter::MayBeRegExp( const String& rStr, const ScDocument* pDoc )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::MayBeRegExp" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::MayBeRegExp" );
if ( pDoc && !pDoc->GetDocOptions().IsFormulaRegexEnabled() )
return FALSE;
if ( !rStr.Len() || (rStr.Len() == 1 && rStr.GetChar(0) != '.') )
@@ -7177,7 +7393,7 @@ static struct LookupCacheDebugCounter
bool ScInterpreter::LookupQueryWithCache( ScAddress & o_rResultPos,
const ScQueryParam & rParam ) const
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::LookupQueryWithCache" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::LookupQueryWithCache" );
bool bFound = false;
const ScQueryEntry& rEntry = rParam.GetEntry(0);
bool bColumnsMatch = (rParam.nCol1 == rEntry.nField);
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index d4d938d482ed..fc0f085706c5 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -69,24 +69,33 @@ using namespace formula;
// Datum und Zeit
//-----------------------------------------------------------------------------
-double ScInterpreter::GetDate(INT16 nYear, INT16 nMonth, INT16 nDay)
+double ScInterpreter::GetDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, bool bStrict )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetDate" );
- if ( nYear < 100 )
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetDateSerial" );
+ if ( nYear < 100 && !bStrict )
nYear = pFormatter->ExpandTwoDigitYear( nYear );
- INT16 nY, nM;
- if (nMonth > 0)
- {
- nY = nYear + (nMonth-1) / 12;
- nM = ((nMonth-1) % 12) + 1;
- }
+ // Do not use a default Date ctor here because it asks system time with a
+ // performance penalty.
+ INT16 nY, nM, nD;
+ if (bStrict)
+ nY = nYear, nM = nMonth, nD = nDay;
else
{
- nY = nYear + (nMonth-12) / 12;
- nM = 12 - (-nMonth) % 12;
+ if (nMonth > 0)
+ {
+ nY = nYear + (nMonth-1) / 12;
+ nM = ((nMonth-1) % 12) + 1;
+ }
+ else
+ {
+ nY = nYear + (nMonth-12) / 12;
+ nM = 12 - (-nMonth) % 12;
+ }
+ nD = 1;
}
- Date aDate(1, nM, nY);
- aDate += nDay - 1;
+ Date aDate( nD, nM, nY);
+ if (!bStrict)
+ aDate += nDay - 1;
if (aDate.IsValid())
return (double) (aDate - *(pFormatter->GetNullDate()));
else
@@ -102,7 +111,7 @@ double ScInterpreter::GetDate(INT16 nYear, INT16 nMonth, INT16 nDay)
void ScInterpreter::ScGetActDate()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetActDate" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetActDate" );
nFuncFmtType = NUMBERFORMAT_DATE;
Date aActDate;
long nDiff = aActDate - *(pFormatter->GetNullDate());
@@ -111,7 +120,7 @@ void ScInterpreter::ScGetActDate()
void ScInterpreter::ScGetActTime()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetActTime" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetActTime" );
nFuncFmtType = NUMBERFORMAT_DATETIME;
Date aActDate;
long nDiff = aActDate - *(pFormatter->GetNullDate());
@@ -125,7 +134,7 @@ void ScInterpreter::ScGetActTime()
void ScInterpreter::ScGetYear()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetYear" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetYear" );
Date aDate = *(pFormatter->GetNullDate());
aDate += (long) ::rtl::math::approxFloor(GetDouble());
PushDouble( (double) aDate.GetYear() );
@@ -133,7 +142,7 @@ void ScInterpreter::ScGetYear()
void ScInterpreter::ScGetMonth()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetMonth" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetMonth" );
Date aDate = *(pFormatter->GetNullDate());
aDate += (long) ::rtl::math::approxFloor(GetDouble());
PushDouble( (double) aDate.GetMonth() );
@@ -141,7 +150,7 @@ void ScInterpreter::ScGetMonth()
void ScInterpreter::ScGetDay()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetDay" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetDay" );
Date aDate = *(pFormatter->GetNullDate());
aDate += (long)::rtl::math::approxFloor(GetDouble());
PushDouble((double) aDate.GetDay());
@@ -149,7 +158,7 @@ void ScInterpreter::ScGetDay()
void ScInterpreter::ScGetMin()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetMin" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetMin" );
double fTime = GetDouble();
fTime -= ::rtl::math::approxFloor(fTime); // Datumsanteil weg
long nVal = (long)::rtl::math::approxFloor(fTime*D_TIMEFACTOR+0.5) % 3600;
@@ -158,7 +167,7 @@ void ScInterpreter::ScGetMin()
void ScInterpreter::ScGetSec()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetSec" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetSec" );
double fTime = GetDouble();
fTime -= ::rtl::math::approxFloor(fTime); // Datumsanteil weg
long nVal = (long)::rtl::math::approxFloor(fTime*D_TIMEFACTOR+0.5) % 60;
@@ -167,7 +176,7 @@ void ScInterpreter::ScGetSec()
void ScInterpreter::ScGetHour()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetHour" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetHour" );
double fTime = GetDouble();
fTime -= ::rtl::math::approxFloor(fTime); // Datumsanteil weg
long nVal = (long)::rtl::math::approxFloor(fTime*D_TIMEFACTOR+0.5) / 3600;
@@ -176,7 +185,7 @@ void ScInterpreter::ScGetHour()
void ScInterpreter::ScGetDateValue()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetDateValue" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetDateValue" );
String aInputString = GetString();
sal_uInt32 nFIndex = 0; // damit default Land/Spr.
double fVal;
@@ -194,7 +203,7 @@ void ScInterpreter::ScGetDateValue()
void ScInterpreter::ScGetDayOfWeek()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetDayOfWeek" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetDayOfWeek" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 1, 2 ) )
{
@@ -222,7 +231,7 @@ void ScInterpreter::ScGetDayOfWeek()
void ScInterpreter::ScGetWeekOfYear()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetWeekOfYear" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetWeekOfYear" );
if ( MustHaveParamCount( GetByte(), 2 ) )
{
short nFlag = (short) ::rtl::math::approxFloor(GetDouble());
@@ -235,7 +244,7 @@ void ScInterpreter::ScGetWeekOfYear()
void ScInterpreter::ScEasterSunday()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScEasterSunday" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScEasterSunday" );
nFuncFmtType = NUMBERFORMAT_DATE;
if ( MustHaveParamCount( GetByte(), 1 ) )
{
@@ -260,13 +269,13 @@ void ScInterpreter::ScEasterSunday()
O = H + L - 7 * M + 114;
nDay = sal::static_int_cast<INT16>( O % 31 + 1 );
nMonth = sal::static_int_cast<INT16>( int(O / 31) );
- PushDouble( GetDate( nYear, nMonth, nDay ) );
+ PushDouble( GetDateSerial( nYear, nMonth, nDay, true ) );
}
}
void ScInterpreter::ScGetDate()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetDate" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetDate" );
nFuncFmtType = NUMBERFORMAT_DATE;
if ( MustHaveParamCount( GetByte(), 3 ) )
{
@@ -277,14 +286,14 @@ void ScInterpreter::ScGetDate()
PushIllegalArgument();
else
{
- PushDouble(GetDate(nYear, nMonth, nDay));
+ PushDouble(GetDateSerial(nYear, nMonth, nDay, false));
}
}
}
void ScInterpreter::ScGetTime()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetTime" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetTime" );
nFuncFmtType = NUMBERFORMAT_TIME;
if ( MustHaveParamCount( GetByte(), 3 ) )
{
@@ -297,7 +306,7 @@ void ScInterpreter::ScGetTime()
void ScInterpreter::ScGetDiffDate()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetDiffDate" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetDiffDate" );
if ( MustHaveParamCount( GetByte(), 2 ) )
{
double nDate2 = GetDouble();
@@ -308,7 +317,7 @@ void ScInterpreter::ScGetDiffDate()
void ScInterpreter::ScGetDiffDate360()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetDiffDate360" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetDiffDate360" );
/* Implementation follows
* http://www.bondmarkets.com/eCommerce/SMD_Fields_030802.pdf
* Appendix B: Day-Count Bases, there are 7 different ways to calculate the
@@ -403,7 +412,7 @@ void ScInterpreter::ScGetDiffDate360()
void ScInterpreter::ScGetTimeValue()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetTimeValue" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetTimeValue" );
String aInputString = GetString();
sal_uInt32 nFIndex = 0; // damit default Land/Spr.
double fVal;
@@ -425,7 +434,7 @@ void ScInterpreter::ScGetTimeValue()
void ScInterpreter::ScPlusMinus()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPlusMinus" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPlusMinus" );
double nVal = GetDouble();
short n = 0;
if (nVal < 0.0)
@@ -437,20 +446,20 @@ void ScInterpreter::ScPlusMinus()
void ScInterpreter::ScAbs()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAbs" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAbs" );
PushDouble(fabs(GetDouble()));
}
void ScInterpreter::ScInt()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScInt" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScInt" );
PushDouble(::rtl::math::approxFloor(GetDouble()));
}
void ScInterpreter::RoundNumber( rtl_math_RoundingMode eMode )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::RoundNumber" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::RoundNumber" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 1, 2 ) )
{
@@ -471,25 +480,25 @@ void ScInterpreter::RoundNumber( rtl_math_RoundingMode eMode )
void ScInterpreter::ScRound()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRound" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRound" );
RoundNumber( rtl_math_RoundingMode_Corrected );
}
void ScInterpreter::ScRoundDown()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRoundDown" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRoundDown" );
RoundNumber( rtl_math_RoundingMode_Down );
}
void ScInterpreter::ScRoundUp()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRoundUp" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRoundUp" );
RoundNumber( rtl_math_RoundingMode_Up );
}
void ScInterpreter::ScCeil()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCeil" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCeil" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 2, 3 ) )
{
@@ -512,7 +521,7 @@ void ScInterpreter::ScCeil()
void ScInterpreter::ScFloor()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFloor" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFloor" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 2, 3 ) )
{
@@ -535,7 +544,7 @@ void ScInterpreter::ScFloor()
void ScInterpreter::ScEven()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScEven" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScEven" );
double fVal = GetDouble();
if (fVal < 0.0)
PushDouble(::rtl::math::approxFloor(fVal/2.0) * 2.0);
@@ -545,7 +554,7 @@ void ScInterpreter::ScEven()
void ScInterpreter::ScOdd()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScOdd" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScOdd" );
double fVal = GetDouble();
if (fVal >= 0.0)
{
@@ -564,7 +573,7 @@ void ScInterpreter::ScOdd()
void ScInterpreter::ScArcTan2()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArcTan2" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArcTan2" );
if ( MustHaveParamCount( GetByte(), 2 ) )
{
double nVal2 = GetDouble();
@@ -575,7 +584,7 @@ void ScInterpreter::ScArcTan2()
void ScInterpreter::ScLog()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLog" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLog" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 1, 2 ) )
{
@@ -594,7 +603,7 @@ void ScInterpreter::ScLog()
void ScInterpreter::ScLn()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLn" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLn" );
double fVal = GetDouble();
if (fVal > 0.0)
PushDouble(log(fVal));
@@ -604,7 +613,7 @@ void ScInterpreter::ScLn()
void ScInterpreter::ScLog10()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLog10" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLog10" );
double fVal = GetDouble();
if (fVal > 0.0)
PushDouble(log10(fVal));
@@ -614,7 +623,7 @@ void ScInterpreter::ScLog10()
void ScInterpreter::ScNPV()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNPV" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNPV" );
nFuncFmtType = NUMBERFORMAT_CURRENCY;
short nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 2, 31 ) )
@@ -682,7 +691,7 @@ void ScInterpreter::ScNPV()
void ScInterpreter::ScIRR()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIRR" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIRR" );
double fSchaetzwert;
nFuncFmtType = NUMBERFORMAT_PERCENT;
BYTE nParamCount = GetByte();
@@ -825,7 +834,7 @@ void ScInterpreter::ScISPMT()
double ScInterpreter::ScGetBw(double fZins, double fZzr, double fRmz,
double fZw, double fF)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMIRR" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMIRR" );
double fBw;
if (fZins == 0.0)
fBw = fZw + fRmz * fZzr;
@@ -841,7 +850,7 @@ double ScInterpreter::ScGetBw(double fZins, double fZzr, double fRmz,
void ScInterpreter::ScBW()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScBW" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScBW" );
nFuncFmtType = NUMBERFORMAT_CURRENCY;
double nRmz, nZzr, nZins, nZw = 0, nFlag = 0;
BYTE nParamCount = GetByte();
@@ -859,7 +868,7 @@ void ScInterpreter::ScBW()
void ScInterpreter::ScDIA()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDIA" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDIA" );
nFuncFmtType = NUMBERFORMAT_CURRENCY;
if ( MustHaveParamCount( GetByte(), 4 ) )
{
@@ -876,7 +885,7 @@ void ScInterpreter::ScDIA()
double ScInterpreter::ScGetGDA(double fWert, double fRest, double fDauer,
double fPeriode, double fFaktor)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetGDA" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetGDA" );
double fGda, fZins, fAlterWert, fNeuerWert;
fZins = fFaktor / fDauer;
if (fZins >= 1.0)
@@ -902,7 +911,7 @@ double ScInterpreter::ScGetGDA(double fWert, double fRest, double fDauer,
void ScInterpreter::ScGDA()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGDA" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGDA" );
nFuncFmtType = NUMBERFORMAT_CURRENCY;
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 4, 5 ) )
@@ -926,7 +935,7 @@ void ScInterpreter::ScGDA()
void ScInterpreter::ScGDA2()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGDA2" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGDA2" );
nFuncFmtType = NUMBERFORMAT_CURRENCY;
BYTE nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 4, 5 ) )
@@ -973,7 +982,7 @@ void ScInterpreter::ScGDA2()
double ScInterpreter::ScInterVDB(double fWert,double fRest,double fDauer,
double fDauer1,double fPeriode,double fFaktor)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScInterVDB" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScInterVDB" );
double fVdb=0;
double fIntEnd = ::rtl::math::approxCeil(fPeriode);
ULONG nLoopEnd = (ULONG) fIntEnd;
@@ -1024,7 +1033,7 @@ inline double DblMin( double a, double b )
void ScInterpreter::ScVDB()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScVDB" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScVDB" );
nFuncFmtType = NUMBERFORMAT_CURRENCY;
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 5, 7 ) )
@@ -1101,7 +1110,7 @@ void ScInterpreter::ScVDB()
void ScInterpreter::ScLaufz()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLaufz" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLaufz" );
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double nZukunft = GetDouble();
@@ -1113,7 +1122,7 @@ void ScInterpreter::ScLaufz()
void ScInterpreter::ScLIA()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLIA" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLIA" );
nFuncFmtType = NUMBERFORMAT_CURRENCY;
if ( MustHaveParamCount( GetByte(), 3 ) )
{
@@ -1127,7 +1136,7 @@ void ScInterpreter::ScLIA()
double ScInterpreter::ScGetRmz(double fZins, double fZzr, double fBw,
double fZw, double fF)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetRmz" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetRmz" );
double fRmz;
if (fZins == 0.0)
fRmz = (fBw + fZw) / fZzr;
@@ -1146,7 +1155,7 @@ double ScInterpreter::ScGetRmz(double fZins, double fZzr, double fBw,
void ScInterpreter::ScRMZ()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRMZ" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRMZ" );
double nZins, nZzr, nBw, nZw = 0, nFlag = 0;
nFuncFmtType = NUMBERFORMAT_CURRENCY;
BYTE nParamCount = GetByte();
@@ -1164,7 +1173,7 @@ void ScInterpreter::ScRMZ()
void ScInterpreter::ScZGZ()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScZGZ" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScZGZ" );
nFuncFmtType = NUMBERFORMAT_PERCENT;
if ( MustHaveParamCount( GetByte(), 3 ) )
{
@@ -1178,7 +1187,7 @@ void ScInterpreter::ScZGZ()
double ScInterpreter::ScGetZw(double fZins, double fZzr, double fRmz,
double fBw, double fF)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetZw" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetZw" );
double fZw;
if (fZins == 0.0)
fZw = fBw + fRmz * fZzr;
@@ -1195,7 +1204,7 @@ double ScInterpreter::ScGetZw(double fZins, double fZzr, double fRmz,
void ScInterpreter::ScZW()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScZW" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScZW" );
double nZins, nZzr, nRmz, nBw = 0, nFlag = 0;
nFuncFmtType = NUMBERFORMAT_CURRENCY;
BYTE nParamCount = GetByte();
@@ -1213,7 +1222,7 @@ void ScInterpreter::ScZW()
void ScInterpreter::ScZZR()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScZZR" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScZZR" );
double nZins, nRmz, nBw, nZw = 0, nFlag = 0;
BYTE nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 3, 5 ) )
@@ -1237,7 +1246,7 @@ void ScInterpreter::ScZZR()
bool ScInterpreter::RateIteration( double fNper, double fPayment, double fPv,
double fFv, double fPayType, double & fGuess )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::RateIteration" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::RateIteration" );
// See also #i15090#
// Newton-Raphson method: x(i+1) = x(i) - f(x(i)) / f'(x(i))
// This solution handles integer and non-integer values of Nper different.
@@ -1331,7 +1340,7 @@ bool ScInterpreter::RateIteration( double fNper, double fPayment, double fPv,
// In Calc UI it is the function RATE(Nper;Pmt;Pv;Fv;Type;Guess)
void ScInterpreter::ScZins()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScZins" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScZins" );
double fPv, fPayment, fNper;
// defaults for missing arguments, see ODFF spec
double fFv = 0, fPayType = 0, fGuess = 0.1;
@@ -1366,7 +1375,7 @@ void ScInterpreter::ScZins()
double ScInterpreter::ScGetZinsZ(double fZins, double fZr, double fZzr, double fBw,
double fZw, double fF, double& fRmz)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetZinsZ" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetZinsZ" );
fRmz = ScGetRmz(fZins, fZzr, fBw, fZw, fF); // fuer kapz auch bei fZr == 1
double fZinsZ;
nFuncFmtType = NUMBERFORMAT_CURRENCY;
@@ -1389,7 +1398,7 @@ double ScInterpreter::ScGetZinsZ(double fZins, double fZr, double fZzr, double f
void ScInterpreter::ScZinsZ()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScZinsZ" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScZinsZ" );
double nZins, nZr, nRmz, nZzr, nBw, nZw = 0, nFlag = 0;
nFuncFmtType = NUMBERFORMAT_CURRENCY;
BYTE nParamCount = GetByte();
@@ -1411,7 +1420,7 @@ void ScInterpreter::ScZinsZ()
void ScInterpreter::ScKapz()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScKapz" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScKapz" );
double nZins, nZr, nZzr, nBw, nZw = 0, nFlag = 0, nRmz, nZinsz;
nFuncFmtType = NUMBERFORMAT_CURRENCY;
BYTE nParamCount = GetByte();
@@ -1436,7 +1445,7 @@ void ScInterpreter::ScKapz()
void ScInterpreter::ScKumZinsZ()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScKumZinsZ" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScKumZinsZ" );
nFuncFmtType = NUMBERFORMAT_CURRENCY;
if ( MustHaveParamCount( GetByte(), 6 ) )
{
@@ -1477,7 +1486,7 @@ void ScInterpreter::ScKumZinsZ()
void ScInterpreter::ScKumKapZ()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScKumKapZ" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScKumKapZ" );
nFuncFmtType = NUMBERFORMAT_CURRENCY;
if ( MustHaveParamCount( GetByte(), 6 ) )
{
@@ -1519,7 +1528,7 @@ void ScInterpreter::ScKumKapZ()
void ScInterpreter::ScEffektiv()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScEffektiv" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScEffektiv" );
nFuncFmtType = NUMBERFORMAT_PERCENT;
if ( MustHaveParamCount( GetByte(), 2 ) )
{
@@ -1537,7 +1546,7 @@ void ScInterpreter::ScEffektiv()
void ScInterpreter::ScNominal()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNominal" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNominal" );
nFuncFmtType = NUMBERFORMAT_PERCENT;
if ( MustHaveParamCount( GetByte(), 2 ) )
{
@@ -1555,13 +1564,24 @@ void ScInterpreter::ScNominal()
void ScInterpreter::ScMod()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMod" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMod" );
if ( MustHaveParamCount( GetByte(), 2 ) )
{
- double nVal2 = GetDouble();
- double nVal1 = GetDouble();
- PushDouble( ::rtl::math::approxSub( nVal1,
- ::rtl::math::approxFloor(nVal1 / nVal2) * nVal2));
+ double fVal2 = GetDouble(); // Denominator
+ double fVal1 = GetDouble(); // Numerator
+ if (fVal2 == floor(fVal2)) // a pure integral number stored in double
+ {
+ double fResult = fmod(fVal1,fVal2);
+ if ( (fResult != 0.0) &&
+ ((fVal1 > 0.0 && fVal2 < 0.0) || (fVal1 < 0.0 && fVal2 > 0.0)))
+ fResult += fVal2 ;
+ PushDouble( fResult );
+ }
+ else
+ {
+ PushDouble( ::rtl::math::approxSub( fVal1,
+ ::rtl::math::approxFloor(fVal1 / fVal2) * fVal2));
+ }
}
}
@@ -1582,7 +1602,7 @@ void ScInterpreter::ScMod()
*/
void ScInterpreter::ScBackSolver()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScBackSolver" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScBackSolver" );
if ( MustHaveParamCount( GetByte(), 3 ) )
{
BOOL bDoneIteration = FALSE;
@@ -1786,7 +1806,7 @@ void ScInterpreter::ScBackSolver()
void ScInterpreter::ScIntersect()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIntersect" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIntersect" );
formula::FormulaTokenRef p2nd = PopToken();
formula::FormulaTokenRef p1st = PopToken();
@@ -1934,7 +1954,7 @@ void ScInterpreter::ScIntersect()
void ScInterpreter::ScRangeFunc()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRangeFunc" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRangeFunc" );
formula::FormulaTokenRef x2 = PopToken();
formula::FormulaTokenRef x1 = PopToken();
@@ -1953,7 +1973,7 @@ void ScInterpreter::ScRangeFunc()
void ScInterpreter::ScUnionFunc()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScUnionFunc" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScUnionFunc" );
formula::FormulaTokenRef p2nd = PopToken();
formula::FormulaTokenRef p1st = PopToken();
@@ -2031,7 +2051,7 @@ void ScInterpreter::ScUnionFunc()
void ScInterpreter::ScCurrent()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCurrent" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCurrent" );
FormulaTokenRef xTok( PopToken());
if (xTok)
{
@@ -2044,7 +2064,7 @@ void ScInterpreter::ScCurrent()
void ScInterpreter::ScStyle()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScStyle" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScStyle" );
BYTE nParamCount = GetByte();
if (nParamCount >= 1 && nParamCount <= 3)
{
@@ -2105,7 +2125,7 @@ ScDdeLink* lcl_GetDdeLink( SvxLinkManager* pLinkMgr,
void ScInterpreter::ScDde()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDde" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDde" );
// Applikation, Datei, Bereich
// Application, Topic, Item
@@ -2471,7 +2491,7 @@ void ScInterpreter::ScRoman()
BOOL lcl_GetArabicValue( sal_Unicode cChar, USHORT& rnValue, BOOL& rbIsDec )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScBase" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScBase" );
switch( cChar )
{
case 'M': rnValue = 1000; rbIsDec = TRUE; break;
@@ -2489,7 +2509,7 @@ BOOL lcl_GetArabicValue( sal_Unicode cChar, USHORT& rnValue, BOOL& rbIsDec )
void ScInterpreter::ScArabic()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScArabic" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScArabic" );
String aRoman( GetString() );
if( nGlobalError )
PushError( nGlobalError);
@@ -2546,18 +2566,89 @@ void ScInterpreter::ScArabic()
void ScInterpreter::ScHyperLink()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScHyperLink" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScHyperLink" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 1, 2 ) )
{
- String aCellText = GetString();
- ScMatrixRef pResMat = GetNewMat(1,2);
- pResMat->PutString(aCellText,0);
- pResMat->PutString((nParamCount == 2) ? GetString() : aCellText, 1);
+ double fVal = 0.0;
+ String aStr;
+ ScMatValType nResultType = SC_MATVAL_STRING;
+
+ if ( nParamCount == 2 )
+ {
+ switch ( GetStackType() )
+ {
+ case svDouble:
+ fVal = GetDouble();
+ nResultType = SC_MATVAL_VALUE;
+ break;
+ case svString:
+ aStr = GetString();
+ break;
+ case svSingleRef:
+ case svDoubleRef:
+ {
+ ScAddress aAdr;
+ if ( !PopDoubleRefOrSingleRef( aAdr ) )
+ break;
+ ScBaseCell* pCell = GetCell( aAdr );
+ if (HasCellEmptyData( pCell))
+ nResultType = SC_MATVAL_EMPTY;
+ else
+ {
+ USHORT nErr = GetCellErrCode( pCell );
+ if (nErr)
+ SetError( nErr);
+ else if (HasCellValueData( pCell))
+ {
+ fVal = GetCellValue( aAdr, pCell );
+ nResultType = SC_MATVAL_VALUE;
+ }
+ else
+ GetCellString( aStr, pCell );
+ }
+ }
+ break;
+ case svMatrix:
+ nResultType = GetDoubleOrStringFromMatrix( fVal, aStr);
+ break;
+ case svMissing:
+ case svEmptyCell:
+ Pop();
+ // mimic xcl
+ fVal = 0.0;
+ nResultType = SC_MATVAL_VALUE;
+ break;
+ default:
+ PopError();
+ SetError( errIllegalArgument);
+ }
+ }
+ String aUrl = GetString();
+ ScMatrixRef pResMat = GetNewMat( 1, 2);
+ if (nGlobalError)
+ {
+ fVal = CreateDoubleError( nGlobalError);
+ nResultType = SC_MATVAL_VALUE;
+ }
+ if (nParamCount == 2 || nGlobalError)
+ {
+ if (ScMatrix::IsValueType( nResultType))
+ pResMat->PutDouble( fVal, 0);
+ else if (ScMatrix::IsRealStringType( nResultType))
+ pResMat->PutString( aStr, 0);
+ else // EmptyType, EmptyPathType, mimic xcl
+ pResMat->PutDouble( 0.0, 0 );
+ }
+ else
+ pResMat->PutString( aUrl, 0 );
+ pResMat->PutString( aUrl, 1 );
bMatrixFormula = true;
PushMatrix(pResMat);
}
}
+
+
BOOL lclConvertMoney( const String& aSearchUnit, double& rfRate, int& rnDec )
{
struct ConvertInfo
@@ -2782,7 +2873,7 @@ void lclAppendBlock( ByteString& rText, sal_Int32 nValue )
void ScInterpreter::ScBahtText()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScBahtText" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScBahtText" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 1 ) )
{
@@ -2851,7 +2942,7 @@ void ScInterpreter::ScBahtText()
void ScInterpreter::ScGetPivotData()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGetPivotData" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGetPivotData" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 2, 30 ) )
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index e7435c4a1546..4d4a59509fca 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -188,13 +188,13 @@ double lcl_IterateInverse( const ScDistFunc& rFunction, double fAx, double fBx,
void ScInterpreter::ScNoName()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNoName" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNoName" );
PushError(errNoName);
}
void ScInterpreter::ScBadName()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScBadName" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScBadName" );
short nParamCount = GetByte();
while (nParamCount-- > 0)
{
@@ -205,13 +205,18 @@ void ScInterpreter::ScBadName()
double ScInterpreter::phi(double x)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::phi" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::phi" );
return 0.39894228040143268 * exp(-(x * x) / 2.0);
}
+double ScInterpreter::integralPhi(double x)
+{ // Using gauss(x)+0.5 has severe cancellation errors for x<-4
+ return 0.5 * ::rtl::math::erfc(-x * 0.7071067811865475); // * 1/sqrt(2)
+}
+
double ScInterpreter::taylor(double* pPolynom, USHORT nMax, double x)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::taylor" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::taylor" );
double nVal = pPolynom[nMax];
for (short i = nMax-1; i >= 0; i--)
{
@@ -222,7 +227,7 @@ double ScInterpreter::taylor(double* pPolynom, USHORT nMax, double x)
double ScInterpreter::gauss(double x)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::gauss" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::gauss" );
double t0[] =
{ 0.39894228040143268, -0.06649038006690545, 0.00997355701003582,
-0.00118732821548045, 0.00011543468761616, -0.00000944465625950,
@@ -270,7 +275,7 @@ double ScInterpreter::gauss(double x)
double ScInterpreter::gaussinv(double x)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::gaussinv" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::gaussinv" );
double q,t,z;
q=x-0.5;
@@ -442,7 +447,7 @@ double ScInterpreter::gaussinv(double x)
double ScInterpreter::Fakultaet(double x)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Fakultaet" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Fakultaet" );
x = ::rtl::math::approxFloor(x);
if (x < 0.0)
return 0.0;
@@ -468,7 +473,7 @@ double ScInterpreter::Fakultaet(double x)
double ScInterpreter::BinomKoeff(double n, double k)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::BinomKoeff" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::BinomKoeff" );
double nVal = 0.0;
k = ::rtl::math::approxFloor(k);
if (n < k)
@@ -606,7 +611,7 @@ double lcl_GetLogGammaHelper(double fZ)
/** You must ensure non integer arguments for fZ<1 */
double ScInterpreter::GetGamma(double fZ)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetGamma" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetGamma" );
const double fLogPi = log(F_PI);
const double fLogDblMax = log( ::std::numeric_limits<double>::max());
@@ -652,7 +657,7 @@ double ScInterpreter::GetGamma(double fZ)
/** You must ensure fZ>0 */
double ScInterpreter::GetLogGamma(double fZ)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetLogGamma" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetLogGamma" );
if (fZ >= fMaxGammaArgument)
return lcl_GetLogGammaHelper(fZ);
if (fZ >= 1.0)
@@ -664,7 +669,7 @@ double ScInterpreter::GetLogGamma(double fZ)
double ScInterpreter::GetFDist(double x, double fF1, double fF2)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetFDist" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetFDist" );
double arg = fF2/(fF2+fF1*x);
double alpha = fF2/2.0;
double beta = fF1/2.0;
@@ -678,7 +683,7 @@ double ScInterpreter::GetFDist(double x, double fF1, double fF2)
double ScInterpreter::GetTDist(double T, double fDF)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetTDist" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetTDist" );
return 0.5 * GetBetaDist(fDF/(fDF+T*T), fDF/2.0, 0.5);
/*
USHORT DF = (USHORT) fDF;
@@ -717,7 +722,7 @@ double ScInterpreter::GetTDist(double T, double fDF)
/** You must ensure fDF>0.0 */
double ScInterpreter::GetChiDist(double fX, double fDF)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetChiDist" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetChiDist" );
if (fX <= 0.0)
return 1.0; // see ODFF
else
@@ -730,7 +735,7 @@ double ScInterpreter::GetChiDist(double fX, double fDF)
/** You must ensure fDF>0.0 */
double ScInterpreter::GetChiSqDistCDF(double fX, double fDF)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetChiSqDistCDF" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetChiSqDistCDF" );
if (fX <= 0.0)
return 0.0; // see ODFF
else
@@ -801,7 +806,7 @@ void ScInterpreter::ScChiSqDist()
void ScInterpreter::ScGamma()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGamma" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGamma" );
double x = GetDouble();
double fResult;
if (x <= 0.0 && x == ::rtl::math::approxFloor(x))
@@ -821,7 +826,7 @@ void ScInterpreter::ScGamma()
void ScInterpreter::ScLogGamma()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLogGamma" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLogGamma" );
double x = GetDouble();
if (x > 0.0) // constraint from ODFF
PushDouble( GetLogGamma(x));
@@ -1125,19 +1130,19 @@ double ScInterpreter::GetBetaDist(double fXin, double fAlpha, double fBeta)
void ScInterpreter::ScPhi()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPhi" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPhi" );
PushDouble(phi(GetDouble()));
}
void ScInterpreter::ScGauss()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGauss" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGauss" );
PushDouble(gauss(GetDouble()));
}
void ScInterpreter::ScFisher()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFisher" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFisher" );
double fVal = GetDouble();
if (fabs(fVal) >= 1.0)
PushIllegalArgument();
@@ -1147,13 +1152,13 @@ void ScInterpreter::ScFisher()
void ScInterpreter::ScFisherInv()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFisherInv" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFisherInv" );
PushDouble( tanh( GetDouble()));
}
void ScInterpreter::ScFact()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFact" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFact" );
double nVal = GetDouble();
if (nVal < 0.0)
PushIllegalArgument();
@@ -1163,7 +1168,7 @@ void ScInterpreter::ScFact()
void ScInterpreter::ScKombin()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScKombin" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScKombin" );
if ( MustHaveParamCount( GetByte(), 2 ) )
{
double k = ::rtl::math::approxFloor(GetDouble());
@@ -1177,7 +1182,7 @@ void ScInterpreter::ScKombin()
void ScInterpreter::ScKombin2()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScKombin2" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScKombin2" );
if ( MustHaveParamCount( GetByte(), 2 ) )
{
double k = ::rtl::math::approxFloor(GetDouble());
@@ -1191,7 +1196,7 @@ void ScInterpreter::ScKombin2()
void ScInterpreter::ScVariationen()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScVariationen" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScVariationen" );
if ( MustHaveParamCount( GetByte(), 2 ) )
{
double k = ::rtl::math::approxFloor(GetDouble());
@@ -1212,7 +1217,7 @@ void ScInterpreter::ScVariationen()
void ScInterpreter::ScVariationen2()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScVariationen2" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScVariationen2" );
if ( MustHaveParamCount( GetByte(), 2 ) )
{
double k = ::rtl::math::approxFloor(GetDouble());
@@ -1226,7 +1231,7 @@ void ScInterpreter::ScVariationen2()
void ScInterpreter::ScB()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScB" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScB" );
BYTE nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 3, 4 ) )
return ;
@@ -1279,8 +1284,8 @@ void ScInterpreter::ScB()
// double nVal = fabs(gauss(xs / Varianz) - gauss(xe / Varianz));
// PushDouble(nVal);
// }
- if (xe <= n && xs <= xe &&
- p < 1.0 && p > 0.0 && n >= 0.0 && xs >= 0.0 )
+ bool bIsValidX = ( 0.0 <= xs && xs <= xe && xe <= n);
+ if ( bIsValidX && 0.0 < p && p < 1.0 )
{
double q = 1.0 - p;
double fFactor = pow(q, n);
@@ -1342,13 +1347,25 @@ void ScInterpreter::ScB()
}
}
else
- PushIllegalArgument();
+ {
+ if ( bIsValidX ) // not(0<p<1)
+ {
+ if ( p == 0.0 )
+ PushDouble( (xs == 0.0) ? 1.0 : 0.0 );
+ else if ( p == 1.0 )
+ PushDouble( (xe == n) ? 1.0 : 0.0 );
+ else
+ PushIllegalArgument();
+ }
+ else
+ PushIllegalArgument();
+ }
}
}
void ScInterpreter::ScBinomDist()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScBinomDist" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScBinomDist" );
if ( MustHaveParamCount( GetByte(), 4 ) )
{
double kum = GetDouble(); // 0 oder 1
@@ -1429,7 +1446,7 @@ void ScInterpreter::ScBinomDist()
void ScInterpreter::ScCritBinom()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCritBinom" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCritBinom" );
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double alpha = GetDouble(); // alpha
@@ -1477,7 +1494,7 @@ void ScInterpreter::ScCritBinom()
void ScInterpreter::ScNegBinomDist()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNegBinomDist" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNegBinomDist" );
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double p = GetDouble(); // p
@@ -1498,52 +1515,65 @@ void ScInterpreter::ScNegBinomDist()
void ScInterpreter::ScNormDist()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNormDist" );
- if ( MustHaveParamCount( GetByte(), 4 ) )
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNormDist" );
+ BYTE nParamCount = GetByte();
+ if ( !MustHaveParamCount( nParamCount, 3, 4))
+ return;
+ bool bCumulative = nParamCount == 4 ? GetBool() : true;
+ double sigma = GetDouble(); // standard deviation
+ double mue = GetDouble(); // mean
+ double x = GetDouble(); // x
+ if (sigma <= 0.0)
{
- double kum = GetDouble(); // 0 oder 1
- double sigma = GetDouble(); // Stdabw
- double mue = GetDouble(); // Mittelwert
- double x = GetDouble(); // x
- if (sigma < 0.0)
- PushError( errIllegalArgument);
- else if (sigma == 0.0)
- PushError( errDivisionByZero);
- else if (kum == 0.0) // Dichte
- PushDouble(phi((x-mue)/sigma)/sigma);
- else // Verteilung
- PushDouble(0.5 + gauss((x-mue)/sigma));
+ PushIllegalArgument();
+ return;
}
+ if (bCumulative)
+ PushDouble(integralPhi((x-mue)/sigma));
+ else
+ PushDouble(phi((x-mue)/sigma)/sigma);
}
-void ScInterpreter::ScLogNormDist()
+void ScInterpreter::ScLogNormDist() //expanded, see #i100119#
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLogNormDist" );
- if ( MustHaveParamCount( GetByte(), 3 ) )
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLogNormDist" );
+ BYTE nParamCount = GetByte();
+ if ( !MustHaveParamCount( nParamCount, 1, 4))
+ return;
+ bool bCumulative = nParamCount == 4 ? GetBool() : true; // cumulative
+ double sigma = nParamCount >= 3 ? GetDouble() : 1.0; // standard deviation
+ double mue = nParamCount >= 2 ? GetDouble() : 0.0; // mean
+ double x = GetDouble(); // x
+ if (sigma <= 0.0)
{
- double sigma = GetDouble(); // Stdabw
- double mue = GetDouble(); // Mittelwert
- double x = GetDouble(); // x
- if (sigma < 0.0)
- PushError( errIllegalArgument);
- else if (sigma == 0.0)
- PushError( errDivisionByZero);
- else if (x <= 0.0)
+ PushIllegalArgument();
+ return;
+ }
+ if (bCumulative)
+ { // cumulative
+ if (x <= 0.0)
+ PushDouble(0.0);
+ else
+ PushDouble(integralPhi((log(x)-mue)/sigma));
+ }
+ else
+ { // density
+ if (x <= 0.0)
PushIllegalArgument();
else
- PushDouble(0.5 + gauss((log(x)-mue)/sigma));
+ PushDouble(phi((log(x)-mue)/sigma)/sigma/x);
}
}
void ScInterpreter::ScStdNormDist()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScStdNormDist" );
- PushDouble(0.5 + gauss(GetDouble()));
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScStdNormDist" );
+ PushDouble(integralPhi(GetDouble()));
}
void ScInterpreter::ScExpDist()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScExpDist" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScExpDist" );
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double kum = GetDouble(); // 0 oder 1
@@ -1570,7 +1600,7 @@ void ScInterpreter::ScExpDist()
void ScInterpreter::ScTDist()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTDist" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTDist" );
if ( !MustHaveParamCount( GetByte(), 3 ) )
return;
double fFlag = ::rtl::math::approxFloor(GetDouble());
@@ -1590,7 +1620,7 @@ void ScInterpreter::ScTDist()
void ScInterpreter::ScFDist()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFDist" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFDist" );
if ( !MustHaveParamCount( GetByte(), 3 ) )
return;
double fF2 = ::rtl::math::approxFloor(GetDouble());
@@ -1606,7 +1636,7 @@ void ScInterpreter::ScFDist()
void ScInterpreter::ScChiDist()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScChiDist" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScChiDist" );
double fResult;
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
@@ -1628,7 +1658,7 @@ void ScInterpreter::ScChiDist()
void ScInterpreter::ScWeibull()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScWeibull" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScWeibull" );
if ( MustHaveParamCount( GetByte(), 4 ) )
{
double kum = GetDouble(); // 0 oder 1
@@ -1647,43 +1677,61 @@ void ScInterpreter::ScWeibull()
void ScInterpreter::ScPoissonDist()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPoissonDist" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPoissonDist" );
BYTE nParamCount = GetByte();
if ( MustHaveParamCount( nParamCount, 2, 3 ) )
{
- double kum = (nParamCount == 3 ? GetDouble() : 1); // 0 oder 1
- double lambda = GetDouble(); // Mittelwert
- double x = ::rtl::math::approxFloor(GetDouble()); // x
+ bool bCumulative = (nParamCount == 3 ? GetBool() : true); // default cumulative
+ double lambda = GetDouble(); // Mean
+ double x = ::rtl::math::approxFloor(GetDouble()); // discrete distribution
if (lambda < 0.0 || x < 0.0)
PushIllegalArgument();
- else if (kum == 0.0) // Dichte
+ else if (!bCumulative) // Probability mass function
{
if (lambda == 0.0)
PushInt(0);
else
{
- double fPoissonVar = 1.0;
- for ( double f = 0.0; f < x; ++f )
- fPoissonVar *= lambda / ( f + 1.0 );
- PushDouble( fPoissonVar*exp( -lambda ) );
+ if (lambda >712) // underflow in exp(-lambda)
+ { // accuracy 11 Digits
+ PushDouble( exp(x*log(lambda)-lambda-GetLogGamma(x+1.0)));
+ }
+ else
+ {
+ double fPoissonVar = 1.0;
+ for ( double f = 0.0; f < x; ++f )
+ fPoissonVar *= lambda / ( f + 1.0 );
+ PushDouble( fPoissonVar * exp( -lambda ) );
+ }
}
}
- else // Verteilung
+ else // Cumulative distribution function
{
if (lambda == 0.0)
PushInt(1);
else
{
- double sum = 1.0;
- double fFak = 1.0;
- ULONG nEnd = (ULONG) x;
- for (ULONG i = 1; i <= nEnd; i++)
+ if (lambda > 712 ) // underflow in exp(-lambda)
+ { // accuracy 12 Digits
+ PushDouble(GetUpRegIGamma(x+1.0,lambda));
+ }
+ else
{
- fFak *= (double)i;
- sum += pow( lambda, (double)i ) / fFak;
+ if (x >= 936.0) // result is always undistinghable from 1
+ PushDouble (1.0);
+ else
+ {
+ double fSummand = exp(-lambda);
+ double fSum = fSummand;
+ int nEnd = sal::static_int_cast<int>( x );
+ for (int i = 1; i <= nEnd; i++)
+ {
+ fSummand = (fSummand * lambda)/(double)i;
+ fSum += fSummand;
+ }
+ PushDouble(fSum);
+ }
}
- sum *= exp(-lambda);
- PushDouble(sum);
}
}
}
@@ -1716,7 +1764,7 @@ void lcl_PutFactorialElements( ::std::vector< double >& cn, double fLower, doubl
*/
void ScInterpreter::ScHypGeomDist()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScHypGeomDist" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScHypGeomDist" );
const size_t nMaxArraySize = 500000; // arbitrary max array size
if ( !MustHaveParamCount( GetByte(), 4 ) )
@@ -1931,7 +1979,7 @@ void ScInterpreter::ScHypGeomDist()
void ScInterpreter::ScGammaDist()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGammaDist" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGammaDist" );
BYTE nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 3, 4 ) )
return;
@@ -1956,7 +2004,7 @@ void ScInterpreter::ScGammaDist()
void ScInterpreter::ScNormInv()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScNormInv" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScNormInv" );
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double sigma = GetDouble();
@@ -1973,7 +2021,7 @@ void ScInterpreter::ScNormInv()
void ScInterpreter::ScSNormInv()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSNormInv" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSNormInv" );
double x = GetDouble();
if (x < 0.0 || x > 1.0)
PushIllegalArgument();
@@ -1985,7 +2033,7 @@ void ScInterpreter::ScSNormInv()
void ScInterpreter::ScLogNormInv()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLogNormInv" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLogNormInv" );
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double sigma = GetDouble(); // Stdabw
@@ -2012,7 +2060,7 @@ public:
void ScInterpreter::ScGammaInv()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGammaInv" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGammaInv" );
if ( !MustHaveParamCount( GetByte(), 3 ) )
return;
double fBeta = GetDouble();
@@ -2051,7 +2099,7 @@ public:
void ScInterpreter::ScBetaInv()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScBetaInv" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScBetaInv" );
BYTE nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 3, 5 ) )
return;
@@ -2105,7 +2153,7 @@ public:
void ScInterpreter::ScTInv()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTInv" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTInv" );
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
double fDF = ::rtl::math::approxFloor(GetDouble());
@@ -2138,7 +2186,7 @@ public:
void ScInterpreter::ScFInv()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFInv" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFInv" );
if ( !MustHaveParamCount( GetByte(), 3 ) )
return;
double fF2 = ::rtl::math::approxFloor(GetDouble());
@@ -2172,7 +2220,7 @@ public:
void ScInterpreter::ScChiInv()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScChiInv" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScChiInv" );
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
double fDF = ::rtl::math::approxFloor(GetDouble());
@@ -2228,7 +2276,7 @@ void ScInterpreter::ScChiSqInv()
void ScInterpreter::ScConfidence()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScConfidence" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScConfidence" );
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double n = ::rtl::math::approxFloor(GetDouble());
@@ -2243,7 +2291,7 @@ void ScInterpreter::ScConfidence()
void ScInterpreter::ScZTest()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScZTest" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScZTest" );
BYTE nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 2, 3 ) )
return;
@@ -2352,9 +2400,12 @@ void ScInterpreter::ScZTest()
{
mue = fSum/rValCount;
if (nParamCount != 3)
+ {
sigma = (fSumSqr - fSum*fSum/rValCount)/(rValCount-1.0);
-
- PushDouble(0.5 - gauss((mue-x)/sqrt(sigma/rValCount)));
+ PushDouble(0.5 - gauss((mue-x)/sqrt(sigma/rValCount)));
+ }
+ else
+ PushDouble(0.5 - gauss((mue-x)*sqrt(rValCount)/sigma));
}
}
bool ScInterpreter::CalculateTest(BOOL _bTemplin
@@ -2362,7 +2413,7 @@ bool ScInterpreter::CalculateTest(BOOL _bTemplin
,const ScMatrixRef& pMat1,const ScMatrixRef& pMat2
,double& fT,double& fF)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateTest" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateTest" );
double fCount1 = 0.0;
double fCount2 = 0.0;
double fSum1 = 0.0;
@@ -2430,7 +2481,7 @@ bool ScInterpreter::CalculateTest(BOOL _bTemplin
}
void ScInterpreter::ScTTest()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTTest" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTTest" );
if ( !MustHaveParamCount( GetByte(), 4 ) )
return;
double fTyp = ::rtl::math::approxFloor(GetDouble());
@@ -2510,7 +2561,7 @@ void ScInterpreter::ScTTest()
void ScInterpreter::ScFTest()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFTest" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFTest" );
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
ScMatrixRef pMat2 = GetMatrix();
@@ -2589,7 +2640,7 @@ void ScInterpreter::ScFTest()
void ScInterpreter::ScChiTest()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScChiTest" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScChiTest" );
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
ScMatrixRef pMat2 = GetMatrix();
@@ -2662,7 +2713,7 @@ void ScInterpreter::ScChiTest()
void ScInterpreter::ScKurt()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScKurt" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScKurt" );
double fSum,fCount,vSum;
std::vector<double> values;
if ( !CalculateSkew(fSum,fCount,vSum,values) )
@@ -2704,7 +2755,7 @@ void ScInterpreter::ScKurt()
void ScInterpreter::ScHarMean()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScHarMean" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScHarMean" );
short nParamCount = GetByte();
double nVal = 0.0;
double nValCount = 0.0;
@@ -2824,7 +2875,7 @@ void ScInterpreter::ScHarMean()
void ScInterpreter::ScGeoMean()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGeoMean" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGeoMean" );
short nParamCount = GetByte();
double nVal = 0.0;
double nValCount = 0.0;
@@ -2945,7 +2996,7 @@ void ScInterpreter::ScGeoMean()
void ScInterpreter::ScStandard()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScStandard" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScStandard" );
if ( MustHaveParamCount( GetByte(), 3 ) )
{
double sigma = GetDouble();
@@ -2961,7 +3012,7 @@ void ScInterpreter::ScStandard()
}
bool ScInterpreter::CalculateSkew(double& fSum,double& fCount,double& vSum,std::vector<double>& values)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateSkew" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateSkew" );
short nParamCount = GetByte();
if ( !MustHaveParamCountMin( nParamCount, 1 ) )
return false;
@@ -3066,7 +3117,7 @@ bool ScInterpreter::CalculateSkew(double& fSum,double& fCount,double& vSum,std::
void ScInterpreter::ScSkew()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSkew" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSkew" );
double fSum,fCount,vSum;
std::vector<double> values;
if ( !CalculateSkew(fSum,fCount,vSum,values) )
@@ -3123,7 +3174,7 @@ double ScInterpreter::GetMedian( vector<double> & rArray )
void ScInterpreter::ScMedian()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMedian" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMedian" );
BYTE nParamCount = GetByte();
if ( !MustHaveParamCountMin( nParamCount, 1 ) )
return;
@@ -3165,7 +3216,7 @@ double ScInterpreter::GetPercentile( vector<double> & rArray, double fPercentile
void ScInterpreter::ScPercentile()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPercentile" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPercentile" );
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
double alpha = GetDouble();
@@ -3181,7 +3232,7 @@ void ScInterpreter::ScPercentile()
void ScInterpreter::ScQuartile()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScQuartile" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScQuartile" );
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
double fFlag = ::rtl::math::approxFloor(GetDouble());
@@ -3197,7 +3248,7 @@ void ScInterpreter::ScQuartile()
void ScInterpreter::ScModalValue()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScModalValue" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScModalValue" );
BYTE nParamCount = GetByte();
if ( !MustHaveParamCountMin( nParamCount, 1 ) )
return;
@@ -3243,7 +3294,7 @@ void ScInterpreter::ScModalValue()
void ScInterpreter::CalculateSmallLarge(BOOL bSmall)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateSmallLarge" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateSmallLarge" );
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
double f = ::rtl::math::approxFloor(GetDouble());
@@ -3274,19 +3325,19 @@ void ScInterpreter::CalculateSmallLarge(BOOL bSmall)
void ScInterpreter::ScLarge()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScLarge" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScLarge" );
CalculateSmallLarge(FALSE);
}
void ScInterpreter::ScSmall()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSmall" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSmall" );
CalculateSmallLarge(TRUE);
}
void ScInterpreter::ScPercentrank()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPercentrank" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPercentrank" );
BYTE nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 2 ) )
return;
@@ -3361,7 +3412,7 @@ void ScInterpreter::ScPercentrank()
void ScInterpreter::ScTrimMean()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTrimMean" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTrimMean" );
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
double alpha = GetDouble();
@@ -3391,7 +3442,7 @@ void ScInterpreter::ScTrimMean()
void ScInterpreter::GetNumberSequenceArray( BYTE nParamCount, vector<double>& rArray )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetSortArray" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetSortArray" );
ScAddress aAdr;
ScRange aRange;
short nParam = nParamCount;
@@ -3537,7 +3588,7 @@ static void lcl_QuickSort( long nLo, long nHi, vector<double>& rSortArray, vecto
void ScInterpreter::QuickSort( vector<double>& rSortArray, vector<long>* pIndexOrder )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::QuickSort" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::QuickSort" );
long n = static_cast<long>(rSortArray.size());
if (pIndexOrder)
@@ -3565,7 +3616,7 @@ void ScInterpreter::QuickSort( vector<double>& rSortArray, vector<long>* pIndexO
void ScInterpreter::ScRank()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRank" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRank" );
BYTE nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 2, 3 ) )
return;
@@ -3685,7 +3736,7 @@ void ScInterpreter::ScRank()
void ScInterpreter::ScAveDev()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAveDev" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAveDev" );
BYTE nParamCount = GetByte();
if ( !MustHaveParamCountMin( nParamCount, 1 ) )
return;
@@ -3840,7 +3891,7 @@ void ScInterpreter::ScAveDev()
void ScInterpreter::ScDevSq()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDevSq" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDevSq" );
double nVal;
double nValCount;
GetStVarParams(nVal, nValCount);
@@ -3849,7 +3900,7 @@ void ScInterpreter::ScDevSq()
void ScInterpreter::ScProbability()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScProbability" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScProbability" );
BYTE nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 3, 4 ) )
return;
@@ -3913,25 +3964,25 @@ void ScInterpreter::ScProbability()
void ScInterpreter::ScCorrel()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCorrel" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCorrel" );
// This is identical to ScPearson()
ScPearson();
}
void ScInterpreter::ScCovar()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCovar" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCovar" );
CalculatePearsonCovar(FALSE,FALSE);
}
void ScInterpreter::ScPearson()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPearson" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPearson" );
CalculatePearsonCovar(TRUE,FALSE);
}
void ScInterpreter::CalculatePearsonCovar(BOOL _bPearson,BOOL _bStexy)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculatePearsonCovar" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculatePearsonCovar" );
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
ScMatrixRef pMat1 = GetMatrix();
@@ -4017,7 +4068,7 @@ void ScInterpreter::CalculatePearsonCovar(BOOL _bPearson,BOOL _bStexy)
void ScInterpreter::ScRSQ()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRSQ" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRSQ" );
// Same as ScPearson()*ScPearson()
ScPearson();
if (!nGlobalError)
@@ -4039,12 +4090,12 @@ void ScInterpreter::ScRSQ()
void ScInterpreter::ScSTEXY()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSTEXY" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSTEXY" );
CalculatePearsonCovar(TRUE,TRUE);
}
void ScInterpreter::CalculateSlopeIntercept(BOOL bSlope)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateSlopeIntercept" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateSlopeIntercept" );
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
ScMatrixRef pMat1 = GetMatrix();
@@ -4116,19 +4167,19 @@ void ScInterpreter::CalculateSlopeIntercept(BOOL bSlope)
void ScInterpreter::ScSlope()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSlope" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSlope" );
CalculateSlopeIntercept(TRUE);
}
void ScInterpreter::ScIntercept()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScIntercept" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScIntercept" );
CalculateSlopeIntercept(FALSE);
}
void ScInterpreter::ScForecast()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScForecast" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScForecast" );
if ( !MustHaveParamCount( GetByte(), 3 ) )
return;
ScMatrixRef pMat1 = GetMatrix();
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index a73fe62998a6..11fd414c81f2 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -99,7 +99,7 @@ ScSpew ScInterpreter::theSpew;
void ScInterpreter::ReplaceCell( ScAddress& rPos )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ReplaceCell" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ReplaceCell" );
ScInterpreterTableOpParams* pTOp = pDok->aTableOpList.First();
while (pTOp)
{
@@ -121,7 +121,7 @@ void ScInterpreter::ReplaceCell( ScAddress& rPos )
void ScInterpreter::ReplaceCell( SCCOL& rCol, SCROW& rRow, SCTAB& rTab )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ReplaceCell" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ReplaceCell" );
ScAddress aCellPos( rCol, rRow, rTab );
ScInterpreterTableOpParams* pTOp = pDok->aTableOpList.First();
while (pTOp)
@@ -148,7 +148,7 @@ void ScInterpreter::ReplaceCell( SCCOL& rCol, SCROW& rRow, SCTAB& rTab )
BOOL ScInterpreter::IsTableOpInRange( const ScRange& rRange )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::IsTableOpInRange" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::IsTableOpInRange" );
if ( rRange.aStart == rRange.aEnd )
return FALSE; // not considered to be a range in TableOp sense
@@ -168,7 +168,7 @@ BOOL ScInterpreter::IsTableOpInRange( const ScRange& rRange )
ULONG ScInterpreter::GetCellNumberFormat( const ScAddress& rPos, const ScBaseCell* pCell)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetCellNumberFormat" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetCellNumberFormat" );
ULONG nFormat;
USHORT nErr;
if ( pCell )
@@ -193,10 +193,10 @@ ULONG ScInterpreter::GetCellNumberFormat( const ScAddress& rPos, const ScBaseCel
}
-// nur ValueCell, Formelzellen speichern das Ergebnis bereits gerundet
+/// Only ValueCell, formula cells already store the result rounded.
double ScInterpreter::GetValueCellValue( const ScAddress& rPos, const ScValueCell* pCell )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetValueCellValue" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetValueCellValue" );
double fVal = pCell->GetValue();
if ( bCalcAsShown && fVal != 0.0 )
{
@@ -207,9 +207,207 @@ double ScInterpreter::GetValueCellValue( const ScAddress& rPos, const ScValueCel
}
+/** Convert string content to numeric value.
+
+ Converted are only integer numbers including exponent, and ISO 8601 dates
+ and times in their extended formats with separators. Anything else,
+ especially fractional numeric values with decimal separators or dates other
+ than ISO 8601 would be locale dependent and is a no-no. Leading and
+ trailing blanks are ignored.
+
+ The following ISO 8601 formats are converted:
+
+ CCYY-MM-DD
+ CCYY-MM-DDThh:mm
+ CCYY-MM-DDThh:mm:ss
+ CCYY-MM-DDThh:mm:ss,s
+ CCYY-MM-DDThh:mm:ss.s
+ hh:mm
+ hh:mm:ss
+ hh:mm:ss,s
+ hh:mm:ss.s
+
+ The century CC may not be omitted and the two-digit year setting is not
+ taken into account. Instead of the T date and time separator exactly one
+ blank may be used.
+
+ If a date is given, it must be a valid Gregorian calendar date. In this
+ case the optional time must be in the range 00:00 to 23:59:59.99999...
+ If only time is given, it may have any value for hours, taking elapsed time
+ into account; minutes and seconds are limited to the value 59 as well.
+ */
+
+double ScInterpreter::ConvertStringToValue( const String& rStr )
+{
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ConvertStringToValue" );
+ double fValue = 0.0;
+ ::rtl::OUString aStr( rStr);
+ rtl_math_ConversionStatus eStatus;
+ sal_Int32 nParseEnd;
+ // Decimal and group separator 0 => only integer and possibly exponent,
+ // stops at first non-digit non-sign.
+ fValue = ::rtl::math::stringToDouble( aStr, 0, 0, &eStatus, &nParseEnd);
+ sal_Int32 nLen;
+ if (eStatus == rtl_math_ConversionStatus_Ok && nParseEnd < (nLen = aStr.getLength()))
+ {
+ // Not at string end, check for trailing blanks or switch to date or
+ // time parsing or bail out.
+ const sal_Unicode* const pStart = aStr.getStr();
+ const sal_Unicode* p = pStart + nParseEnd;
+ const sal_Unicode* const pStop = pStart + nLen;
+ switch (*p++)
+ {
+ case ' ':
+ while (p < pStop && *p == ' ')
+ ++p;
+ if (p < pStop)
+ SetError( errNoValue);
+ break;
+ case '-':
+ case ':':
+ {
+ bool bDate = (*(p-1) == '-');
+ enum State { year = 0, month, day, hour, minute, second, fraction, done, blank, stop };
+ sal_Int32 nUnit[done] = {0,0,0,0,0,0,0};
+ const sal_Int32 nLimit[done] = {0,12,31,0,59,59,0};
+ State eState = (bDate ? month : minute);
+ nCurFmtType = (bDate ? NUMBERFORMAT_DATE : NUMBERFORMAT_TIME);
+ nUnit[eState-1] = aStr.copy( 0, nParseEnd).toInt32();
+ const sal_Unicode* pLastStart = p;
+ // Ensure there's no preceding sign. Negative dates
+ // currently aren't handled correctly. Also discard
+ // +CCYY-MM-DD
+ p = pStart;
+ while (p < pStop && *p == ' ')
+ ++p;
+ if (p < pStop && !CharClass::isAsciiDigit(*p))
+ SetError( errNoValue);
+ p = pLastStart;
+ while (p < pStop && !nGlobalError && eState < blank)
+ {
+ if (eState == minute)
+ nCurFmtType |= NUMBERFORMAT_TIME;
+ if (CharClass::isAsciiDigit(*p))
+ {
+ // Maximum 2 digits per unit, except fractions.
+ if (p - pLastStart >= 2 && eState != fraction)
+ SetError( errNoValue);
+ }
+ else if (p > pLastStart)
+ {
+ // We had at least one digit.
+ if (eState < done)
+ {
+ nUnit[eState] = aStr.copy( pLastStart - pStart, p - pLastStart).toInt32();
+ if (nLimit[eState] && nLimit[eState] < nUnit[eState])
+ SetError( errNoValue);
+ }
+ pLastStart = p + 1; // hypothetical next start
+ // Delimiters must match, a trailing delimiter
+ // yields an invalid date/time.
+ switch (eState)
+ {
+ case month:
+ // Month must be followed by separator and
+ // day, no trailing blanks.
+ if (*p != '-' || (p+1 == pStop))
+ SetError( errNoValue);
+ break;
+ case day:
+ if ((*p != 'T' || (p+1 == pStop)) && *p != ' ')
+ SetError( errNoValue);
+ // Take one blank as a valid delimiter
+ // between date and time.
+ break;
+ case hour:
+ // Hour must be followed by separator and
+ // minute, no trailing blanks.
+ if (*p != ':' || (p+1 == pStop))
+ SetError( errNoValue);
+ break;
+ case minute:
+ if ((*p != ':' || (p+1 == pStop)) && *p != ' ')
+ SetError( errNoValue);
+ if (*p == ' ')
+ eState = done;
+ break;
+ case second:
+ if (((*p != ',' && *p != '.') || (p+1 == pStop)) && *p != ' ')
+ SetError( errNoValue);
+ if (*p == ' ')
+ eState = done;
+ break;
+ case fraction:
+ eState = done;
+ break;
+ case year:
+ case done:
+ case blank:
+ case stop:
+ SetError( errNoValue);
+ break;
+ }
+ eState = static_cast<State>(eState + 1);
+ }
+ else
+ SetError( errNoValue);
+ ++p;
+ }
+ if (eState == blank)
+ {
+ while (p < pStop && *p == ' ')
+ ++p;
+ if (p < pStop)
+ SetError( errNoValue);
+ eState = stop;
+ }
+
+ // Month without day, or hour without minute.
+ if (eState == month || (eState == day && p <= pLastStart) ||
+ eState == hour || (eState == minute && p <= pLastStart))
+ SetError( errNoValue);
+
+ if (!nGlobalError)
+ {
+ // Catch the very last unit at end of string.
+ if (p > pLastStart && eState < done)
+ {
+ nUnit[eState] = aStr.copy( pLastStart - pStart, p - pLastStart).toInt32();
+ if (nLimit[eState] && nLimit[eState] < nUnit[eState])
+ SetError( errNoValue);
+ }
+ if (bDate && nUnit[hour] > 23)
+ SetError( errNoValue);
+ if (!nGlobalError)
+ {
+ if (bDate && nUnit[day] == 0)
+ nUnit[day] = 1;
+ double fFraction = (nUnit[fraction] <= 0 ? 0.0 :
+ ::rtl::math::pow10Exp( nUnit[fraction],
+ static_cast<int>( -ceil( log10( static_cast<double>( nUnit[fraction]))))));
+ fValue = (bDate ? GetDateSerial(
+ sal::static_int_cast<INT16>(nUnit[year]),
+ sal::static_int_cast<INT16>(nUnit[month]),
+ sal::static_int_cast<INT16>(nUnit[day]),
+ true) : 0.0);
+ fValue += ((nUnit[hour] * 3600) + (nUnit[minute] * 60) + nUnit[second] + fFraction) / 86400.0;
+ }
+ }
+ }
+ break;
+ default:
+ SetError( errNoValue);
+ }
+ if (nGlobalError)
+ fValue = 0.0;
+ }
+ return fValue;
+}
+
+
double ScInterpreter::GetCellValue( const ScAddress& rPos, const ScBaseCell* pCell )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetCellValue" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetCellValue" );
USHORT nErr = nGlobalError;
nGlobalError = 0;
double nVal = GetCellValueOrZero( rPos, pCell );
@@ -221,8 +419,8 @@ double ScInterpreter::GetCellValue( const ScAddress& rPos, const ScBaseCell* pCe
double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const ScBaseCell* pCell )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetCellValueOrZero" );
- double fValue;
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetCellValueOrZero" );
+ double fValue = 0.0;
if (pCell)
{
CellType eType = pCell->GetCellType();
@@ -242,8 +440,9 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const ScBaseCel
}
else
{
- SetError(errCellNoValue);
- fValue = 0.0;
+ String aStr;
+ pFCell->GetString( aStr );
+ fValue = ConvertStringToValue( aStr );
}
}
else
@@ -264,26 +463,28 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const ScBaseCel
break;
case CELLTYPE_STRING:
case CELLTYPE_EDIT:
-#if 0
-// Xcl does it, but SUM(A1:A2) differs from A1+A2. No good.
{
+ // SUM(A1:A2) differs from A1+A2. No good. But people insist on
+ // it ... #i5658#
String aStr;
if ( eType == CELLTYPE_STRING )
((ScStringCell*)pCell)->GetString( aStr );
else
((ScEditCell*)pCell)->GetString( aStr );
- sal_uInt32 nFIndex = 0; // damit default Land/Spr.
- if ( !pFormatter->IsNumberFormat( aStr, nFIndex, fValue ) )
- {
- SetError(errNoValue);
- fValue = 0.0;
- }
+ fValue = ConvertStringToValue( aStr );
}
break;
+ case CELLTYPE_NONE:
+ case CELLTYPE_NOTE:
+ fValue = 0.0; // empty or broadcaster cell
+ break;
+ case CELLTYPE_SYMBOLS:
+#if DBG_UTIL
+ case CELLTYPE_DESTROYED:
#endif
- default:
SetError(errCellNoValue);
fValue = 0.0;
+ break;
}
}
else
@@ -294,7 +495,7 @@ double ScInterpreter::GetCellValueOrZero( const ScAddress& rPos, const ScBaseCel
void ScInterpreter::GetCellString( String& rStr, const ScBaseCell* pCell )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetCellString" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetCellString" );
USHORT nErr = 0;
if (pCell)
{
@@ -345,7 +546,7 @@ void ScInterpreter::GetCellString( String& rStr, const ScBaseCell* pCell )
BOOL ScInterpreter::CreateDoubleArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2, BYTE* pCellArr)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CreateDoubleArr" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CreateDoubleArr" );
#if SC_ROWLIMIT_MORE_THAN_64K
#error row limit 64k
#endif
@@ -426,7 +627,7 @@ BOOL ScInterpreter::CreateStringArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
BYTE* pCellArr)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CreateStringArr" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CreateStringArr" );
#if SC_ROWLIMIT_MORE_THAN_64K
#error row limit 64k
#endif
@@ -521,7 +722,7 @@ BOOL ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2,
BYTE* pCellArr)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CreateCellArr" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CreateCellArr" );
#if SC_ROWLIMIT_MORE_THAN_64K
#error row limit 64k
#endif
@@ -642,7 +843,7 @@ BOOL ScInterpreter::CreateCellArr(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
void ScInterpreter::PushWithoutError( FormulaToken& r )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushWithoutError" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushWithoutError" );
if ( sp >= MAXSTACK )
SetError( errStackOverflow );
else
@@ -660,7 +861,7 @@ void ScInterpreter::PushWithoutError( FormulaToken& r )
void ScInterpreter::Push( FormulaToken& r )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Push" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Push" );
if ( sp >= MAXSTACK )
SetError( errStackOverflow );
else
@@ -683,7 +884,7 @@ void ScInterpreter::Push( FormulaToken& r )
void ScInterpreter::PushTempToken( FormulaToken* p )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushTempToken" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushTempToken" );
if ( sp >= MAXSTACK )
{
SetError( errStackOverflow );
@@ -716,7 +917,7 @@ void ScInterpreter::PushTempToken( FormulaToken* p )
void ScInterpreter::PushTempTokenWithoutError( FormulaToken* p )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushTempTokenWithoutError" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushTempTokenWithoutError" );
p->IncRef();
if ( sp >= MAXSTACK )
{
@@ -738,7 +939,7 @@ void ScInterpreter::PushTempTokenWithoutError( FormulaToken* p )
void ScInterpreter::PushTempToken( const FormulaToken& r )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushTempToken" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushTempToken" );
if (!IfErrorPushError())
PushTempTokenWithoutError( r.Clone());
}
@@ -747,7 +948,7 @@ void ScInterpreter::PushTempToken( const FormulaToken& r )
void ScInterpreter::PushCellResultToken( bool bDisplayEmptyAsString,
const ScAddress & rAddress, short * pRetTypeExpr, ULONG * pRetIndexExpr )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushCellResultToken" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushCellResultToken" );
ScBaseCell* pCell = pDok->GetCell( rAddress);
if (!pCell || pCell->HasEmptyData())
{
@@ -792,7 +993,7 @@ void ScInterpreter::PushCellResultToken( bool bDisplayEmptyAsString,
void ScInterpreter::Pop()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Pop" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Pop" );
if( sp )
sp--;
else
@@ -804,7 +1005,7 @@ void ScInterpreter::Pop()
void ScInterpreter::PopError()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopError" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopError" );
if( sp )
{
sp--;
@@ -818,7 +1019,7 @@ void ScInterpreter::PopError()
FormulaTokenRef ScInterpreter::PopToken()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopToken" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopToken" );
if (sp)
{
sp--;
@@ -835,7 +1036,7 @@ FormulaTokenRef ScInterpreter::PopToken()
double ScInterpreter::PopDouble()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopDouble" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopDouble" );
nCurFmtType = NUMBERFORMAT_NUMBER;
nCurFmtIndex = 0;
if( sp )
@@ -864,7 +1065,7 @@ double ScInterpreter::PopDouble()
const String& ScInterpreter::PopString()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopString" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopString" );
nCurFmtType = NUMBERFORMAT_TEXT;
nCurFmtIndex = 0;
if( sp )
@@ -893,7 +1094,7 @@ const String& ScInterpreter::PopString()
void ScInterpreter::ValidateRef( const ScSingleRefData & rRef )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ValidateRef" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ValidateRef" );
SCCOL nCol;
SCROW nRow;
SCTAB nTab;
@@ -903,7 +1104,7 @@ void ScInterpreter::ValidateRef( const ScSingleRefData & rRef )
void ScInterpreter::ValidateRef( const ScComplexRefData & rRef )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ValidateRef" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ValidateRef" );
ValidateRef( rRef.Ref1);
ValidateRef( rRef.Ref2);
}
@@ -911,7 +1112,7 @@ void ScInterpreter::ValidateRef( const ScComplexRefData & rRef )
void ScInterpreter::ValidateRef( const ScRefList & rRefList )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ValidateRef" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ValidateRef" );
ScRefList::const_iterator it( rRefList.begin());
ScRefList::const_iterator end( rRefList.end());
for ( ; it != end; ++it)
@@ -924,7 +1125,7 @@ void ScInterpreter::ValidateRef( const ScRefList & rRefList )
void ScInterpreter::SingleRefToVars( const ScSingleRefData & rRef,
SCCOL & rCol, SCROW & rRow, SCTAB & rTab )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::SingleRefToVars" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::SingleRefToVars" );
if ( rRef.IsColRel() )
rCol = aPos.Col() + rRef.nRelCol;
else
@@ -948,7 +1149,7 @@ void ScInterpreter::SingleRefToVars( const ScSingleRefData & rRef,
void ScInterpreter::PopSingleRef(SCCOL& rCol, SCROW &rRow, SCTAB& rTab)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopSingleRef" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopSingleRef" );
if( sp )
{
--sp;
@@ -974,7 +1175,7 @@ void ScInterpreter::PopSingleRef(SCCOL& rCol, SCROW &rRow, SCTAB& rTab)
void ScInterpreter::PopSingleRef( ScAddress& rAdr )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopSingleRef" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopSingleRef" );
if( sp )
{
--sp;
@@ -1009,7 +1210,7 @@ void ScInterpreter::DoubleRefToVars( const ScToken* p,
SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2,
BOOL bDontCheckForTableOp )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::DoubleRefToVars" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::DoubleRefToVars" );
const ScComplexRefData& rCRef = p->GetDoubleRef();
SingleRefToVars( rCRef.Ref1, rCol1, rRow1, rTab1);
SingleRefToVars( rCRef.Ref2, rCol2, rRow2, rTab2);
@@ -1026,7 +1227,7 @@ void ScInterpreter::PopDoubleRef(SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1,
SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2,
BOOL bDontCheckForTableOp )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopDoubleRef" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopDoubleRef" );
if( sp )
{
--sp;
@@ -1052,7 +1253,7 @@ void ScInterpreter::PopDoubleRef(SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1,
void ScInterpreter::DoubleRefToRange( const ScComplexRefData & rCRef,
ScRange & rRange, BOOL bDontCheckForTableOp )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::DoubleRefToRange" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::DoubleRefToRange" );
SCCOL nCol;
SCROW nRow;
SCTAB nTab;
@@ -1070,7 +1271,7 @@ void ScInterpreter::DoubleRefToRange( const ScComplexRefData & rCRef,
void ScInterpreter::PopDoubleRef( ScRange & rRange, short & rParam, size_t & rRefInList )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopDoubleRef" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopDoubleRef" );
if (sp)
{
formula::FormulaToken* pToken = pStack[ sp-1 ];
@@ -1117,7 +1318,7 @@ void ScInterpreter::PopDoubleRef( ScRange & rRange, short & rParam, size_t & rRe
void ScInterpreter::PopDoubleRef( ScRange& rRange, BOOL bDontCheckForTableOp )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopDoubleRef" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopDoubleRef" );
if( sp )
{
--sp;
@@ -1141,7 +1342,7 @@ void ScInterpreter::PopDoubleRef( ScRange& rRange, BOOL bDontCheckForTableOp )
BOOL ScInterpreter::PopDoubleRefOrSingleRef( ScAddress& rAdr )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopDoubleRefOrSingleRef" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopDoubleRefOrSingleRef" );
switch ( GetStackType() )
{
case svDoubleRef :
@@ -1167,7 +1368,7 @@ BOOL ScInterpreter::PopDoubleRefOrSingleRef( ScAddress& rAdr )
void ScInterpreter::PopDoubleRefPushMatrix()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopDoubleRefPushMatrix" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopDoubleRefPushMatrix" );
if ( GetStackType() == svDoubleRef )
{
ScMatrixRef pMat = GetMatrix();
@@ -1183,14 +1384,14 @@ void ScInterpreter::PopDoubleRefPushMatrix()
ScTokenMatrixMap* ScInterpreter::CreateTokenMatrixMap()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CreateTokenMatrixMap" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CreateTokenMatrixMap" );
return new ScTokenMatrixMap;
}
bool ScInterpreter::ConvertMatrixParameters()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ConvertMatrixParameters" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ConvertMatrixParameters" );
USHORT nParams = pCur->GetParamCount();
DBG_ASSERT( nParams <= sp, "ConvertMatrixParameters: stack/param count mismatch");
SCSIZE nJumpCols = 0, nJumpRows = 0;
@@ -1237,7 +1438,8 @@ bool ScInterpreter::ConvertMatrixParameters()
{
ScParameterClassification::Type eType =
ScParameterClassification::GetParameterType( pCur, nParams - i);
- if ( eType != ScParameterClassification::Reference )
+ if ( eType != ScParameterClassification::Reference &&
+ eType != ScParameterClassification::ReferenceOrForceArray)
{
SCCOL nCol1, nCol2;
SCROW nRow1, nRow2;
@@ -1268,7 +1470,8 @@ bool ScInterpreter::ConvertMatrixParameters()
{
ScParameterClassification::Type eType =
ScParameterClassification::GetParameterType( pCur, nParams - i);
- if ( eType != ScParameterClassification::Reference )
+ if ( eType != ScParameterClassification::Reference &&
+ eType != ScParameterClassification::ReferenceOrForceArray)
{
// can't convert to matrix
SetError( errNoValue);
@@ -1320,7 +1523,7 @@ bool ScInterpreter::ConvertMatrixParameters()
ScMatrixRef ScInterpreter::PopMatrix()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PopMatrix" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PopMatrix" );
if( sp )
{
--sp;
@@ -1351,7 +1554,7 @@ ScMatrixRef ScInterpreter::PopMatrix()
void ScInterpreter::PushDouble(double nVal)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushDouble" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushDouble" );
TreatDoubleError( nVal );
if (!IfErrorPushError())
PushTempTokenWithoutError( new FormulaDoubleToken( nVal ) );
@@ -1360,7 +1563,7 @@ void ScInterpreter::PushDouble(double nVal)
void ScInterpreter::PushInt(int nVal)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushInt" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushInt" );
if (!IfErrorPushError())
PushTempTokenWithoutError( new FormulaDoubleToken( nVal ) );
}
@@ -1368,7 +1571,7 @@ void ScInterpreter::PushInt(int nVal)
void ScInterpreter::PushStringBuffer( const sal_Unicode* pString )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushStringBuffer" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushStringBuffer" );
if ( pString )
PushString( String( pString ) );
else
@@ -1378,7 +1581,7 @@ void ScInterpreter::PushStringBuffer( const sal_Unicode* pString )
void ScInterpreter::PushString( const String& rString )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushString" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushString" );
if (!IfErrorPushError())
PushTempTokenWithoutError( new FormulaStringToken( rString ) );
}
@@ -1386,7 +1589,7 @@ void ScInterpreter::PushString( const String& rString )
void ScInterpreter::PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushSingleRef" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushSingleRef" );
if (!IfErrorPushError())
{
ScSingleRefData aRef;
@@ -1402,7 +1605,7 @@ void ScInterpreter::PushSingleRef(SCCOL nCol, SCROW nRow, SCTAB nTab)
void ScInterpreter::PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushDoubleRef" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushDoubleRef" );
if (!IfErrorPushError())
{
ScComplexRefData aRef;
@@ -1420,7 +1623,7 @@ void ScInterpreter::PushDoubleRef(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
void ScInterpreter::PushMatrix(ScMatrix* pMat)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushMatrix" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushMatrix" );
pMat->SetErrorInterpreter( NULL);
// No if (!IfErrorPushError()) because ScMatrix stores errors itself,
// but with notifying ScInterpreter via nGlobalError, substituting it would
@@ -1433,56 +1636,56 @@ void ScInterpreter::PushMatrix(ScMatrix* pMat)
void ScInterpreter::PushError( USHORT nError )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushError" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushError" );
SetError( nError ); // only sets error if not already set
PushTempTokenWithoutError( new FormulaErrorToken( nGlobalError));
}
void ScInterpreter::PushParameterExpected()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushParameterExpected" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushParameterExpected" );
PushError( errParameterExpected);
}
void ScInterpreter::PushIllegalParameter()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushIllegalParameter" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushIllegalParameter" );
PushError( errIllegalParameter);
}
void ScInterpreter::PushIllegalArgument()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushIllegalArgument" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushIllegalArgument" );
PushError( errIllegalArgument);
}
void ScInterpreter::PushNA()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushNA" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushNA" );
PushError( NOTAVAILABLE);
}
void ScInterpreter::PushNoValue()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::PushNoValue" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::PushNoValue" );
PushError( errNoValue);
}
BOOL ScInterpreter::IsMissing()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::IsMissing" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::IsMissing" );
return sp && pStack[sp - 1]->GetType() == svMissing;
}
StackVar ScInterpreter::GetRawStackType()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetRawStackType" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetRawStackType" );
StackVar eRes;
if( sp )
{
@@ -1499,7 +1702,7 @@ StackVar ScInterpreter::GetRawStackType()
StackVar ScInterpreter::GetStackType()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetStackType" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetStackType" );
StackVar eRes;
if( sp )
{
@@ -1518,7 +1721,7 @@ StackVar ScInterpreter::GetStackType()
StackVar ScInterpreter::GetStackType( BYTE nParam )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetStackType" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetStackType" );
StackVar eRes;
if( sp > nParam-1 )
{
@@ -1534,7 +1737,7 @@ StackVar ScInterpreter::GetStackType( BYTE nParam )
BOOL ScInterpreter::DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& rAdr )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::DoubleRefToPosSingleRef" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::DoubleRefToPosSingleRef" );
// Check for a singleton first - no implicit intersection for them.
if( rRange.aStart == rRange.aEnd )
{
@@ -1623,7 +1826,7 @@ BOOL ScInterpreter::DoubleRefToPosSingleRef( const ScRange& rRange, ScAddress& r
double ScInterpreter::GetDouble()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetDouble" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetDouble" );
double nVal;
switch( GetRawStackType() )
{
@@ -1631,15 +1834,7 @@ double ScInterpreter::GetDouble()
nVal = PopDouble();
break;
case svString:
- {
- String aStr(PopString());
- sal_uInt32 nFIndex = 0; // damit default Land/Spr.
- if(!pFormatter->IsNumberFormat( aStr, nFIndex, nVal ) )
- {
- SetError( errIllegalArgument); //! fit to ScN()
- nVal = 0.0;
- }
- }
+ nVal = ConvertStringToValue( PopString());
break;
case svSingleRef:
{
@@ -1707,7 +1902,7 @@ double ScInterpreter::GetDouble()
double ScInterpreter::GetDoubleWithDefault(double nDefault)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetDoubleWithDefault" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetDoubleWithDefault" );
bool bMissing = IsMissing();
double nResultVal = GetDouble();
if ( bMissing )
@@ -1718,7 +1913,7 @@ double ScInterpreter::GetDoubleWithDefault(double nDefault)
const String& ScInterpreter::GetString()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetString" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetString" );
switch (GetRawStackType())
{
case svError:
@@ -1809,7 +2004,7 @@ const String& ScInterpreter::GetString()
ScMatValType ScInterpreter::GetDoubleOrStringFromMatrix( double& rDouble,
String& rString )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetDoubleOrStringFromMatrix" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetDoubleOrStringFromMatrix" );
ScMatValType nMatValType = SC_MATVAL_EMPTY;
switch ( GetStackType() )
{
@@ -1859,7 +2054,7 @@ ScMatValType ScInterpreter::GetDoubleOrStringFromMatrix( double& rDouble,
void ScInterpreter::ScDBGet()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBGet" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBGet" );
SCTAB nTab;
ScQueryParam aQueryParam;
BOOL bMissingField = FALSE;
@@ -1937,7 +2132,7 @@ void ScInterpreter::ScDBGet()
void ScInterpreter::ScExternal()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScExternal" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScExternal" );
USHORT nIndex;
BYTE nParamCount = GetByte();
String aUnoName;
@@ -2484,14 +2679,14 @@ void ScInterpreter::ScExternal()
void ScInterpreter::ScMissing()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMissing" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMissing" );
PushTempToken( new FormulaMissingToken );
}
void ScInterpreter::ScMacro()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMacro" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMacro" );
SbxBase::ResetError();
BYTE nParamCount = GetByte();
@@ -2720,7 +2915,7 @@ void ScInterpreter::ScMacro()
BOOL ScInterpreter::SetSbxVariable( SbxVariable* pVar, const ScAddress& rPos )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::SetSbxVariable" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::SetSbxVariable" );
BOOL bOk = TRUE;
ScBaseCell* pCell = pDok->GetCell( rPos );
if (pCell)
@@ -2778,7 +2973,7 @@ BOOL ScInterpreter::SetSbxVariable( SbxVariable* pVar, const ScAddress& rPos )
void ScInterpreter::ScTableOp()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTableOp" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTableOp" );
BYTE nParamCount = GetByte();
if (nParamCount != 3 && nParamCount != 5)
{
@@ -2874,7 +3069,7 @@ void ScInterpreter::ScTableOp()
void ScInterpreter::ScErrCell()
{
-RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScErrCell" );
+RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScErrCell" );
double fErrNum = GetDouble();
PushError((USHORT) fErrNum);
}
@@ -2882,7 +3077,7 @@ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter
void ScInterpreter::ScDBArea()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDBArea" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDBArea" );
ScDBData* pDBData = pDok->GetDBCollection()->FindIndex( pCur->GetIndex());
if (pDBData)
{
@@ -2904,7 +3099,7 @@ void ScInterpreter::ScDBArea()
void ScInterpreter::ScColRowNameAuto()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScColRowNameAuto" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScColRowNameAuto" );
ScComplexRefData aRefData( static_cast<const ScToken*>(pCur)->GetDoubleRef() );
aRefData.CalcAbsIfRel( aPos );
if ( aRefData.Valid() )
@@ -3065,7 +3260,7 @@ void ScInterpreter::ScExternalRef()
void ScInterpreter::ScAnswer()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAnswer" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAnswer" );
String aStr( GetString() );
if( aStr.EqualsIgnoreCaseAscii( "Das Leben, das Universum und der ganze Rest" ) )
{
@@ -3079,12 +3274,12 @@ void ScInterpreter::ScAnswer()
void ScInterpreter::ScCalcTeam()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScCalcTeam" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScCalcTeam" );
static BOOL bShown = FALSE;
if( !bShown )
{
ShowTheTeam();
- String aTeam( RTL_CONSTASCII_USTRINGPARAM( "Ballach, Nebel, Rentz, Rathke, Marmion" ) );
+ String aTeam( RTL_CONSTASCII_USTRINGPARAM( "Nebel, Benisch, Rentz, Rathke" ) );
if ( (GetByte() == 1) && ::rtl::math::approxEqual( GetDouble(), 1996) )
aTeam.AppendAscii( " (a word with 'B': -Olk, -Nietsch, -Daeumling)" );
PushString( aTeam );
@@ -3097,7 +3292,7 @@ void ScInterpreter::ScCalcTeam()
void ScInterpreter::ScSpewFunc()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSpewFunc" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSpewFunc" );
BOOL bRefresh = FALSE;
BOOL bClear = FALSE;
// Stack aufraeumen
@@ -3145,7 +3340,7 @@ extern "C" { static void SAL_CALL thisModule() {} }
void ScInterpreter::ScGame()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGame" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGame" );
enum GameType {
SC_GAME_NONE,
SC_GAME_ONCE,
@@ -3374,7 +3569,7 @@ ScInterpreter::ScInterpreter( ScFormulaCell* pCell, ScDocument* pDoc,
pFormatter( pDoc->GetFormatTable() ),
bCalcAsShown( pDoc->GetDocOptions().IsCalcAsShown() )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTTT" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTTT" );
// pStack = new ScToken*[ MAXSTACK ];
BYTE cMatFlag = pMyFormulaCell->GetMatrixFlag();
@@ -3408,7 +3603,7 @@ ScInterpreter::~ScInterpreter()
void ScInterpreter::GlobalExit() // static
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GlobalExit" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GlobalExit" );
DBG_ASSERT(!bGlobalStackInUse, "wer benutzt noch den TokenStack?");
DELETEZ(pGlobalStack);
}
@@ -3416,7 +3611,7 @@ void ScInterpreter::GlobalExit() // static
StackVar ScInterpreter::Interpret()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Interpret" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Interpret" );
short nRetTypeExpr = NUMBERFORMAT_UNDEFINED;
ULONG nRetIndexExpr = 0;
USHORT nErrorFunction = 0;
@@ -3803,6 +3998,8 @@ StackVar ScInterpreter::Interpret()
case ocGetPivotData : ScGetPivotData(); break;
case ocJis : ScJis(); break;
case ocAsc : ScAsc(); break;
+ case ocUnicode : ScUnicode(); break;
+ case ocUnichar : ScUnichar(); break;
case ocAnswer : ScAnswer(); break;
case ocTeam : ScCalcTeam(); break;
case ocTTT : ScTTT(); break;
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 41ddf3dc0aa0..7da4778bfe1a 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -106,7 +106,7 @@ const double fInvEpsilon = 1.0E-7;
double ScInterpreter::ScGetGCD(double fx, double fy)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::div" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::div" );
// By ODFF definition GCD(0,a) => a. This is also vital for the code in
// ScGCD() to work correctly with a preset fy=0.0
if (fy == 0.0)
@@ -128,7 +128,7 @@ double ScInterpreter::ScGetGCD(double fx, double fy)
void ScInterpreter::ScGCD()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGCD" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGCD" );
short nParamCount = GetByte();
if ( MustHaveParamCountMin( nParamCount, 1 ) )
{
@@ -310,7 +310,7 @@ void ScInterpreter:: ScLCM()
ScMatrixRef ScInterpreter::GetNewMat(SCSIZE nC, SCSIZE nR)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetNewMat" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetNewMat" );
ScMatrix* pMat = new ScMatrix( nC, nR);
pMat->SetErrorInterpreter( this);
SCSIZE nCols, nRows;
@@ -328,7 +328,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken
SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
SCCOL nCol2, SCROW nRow2, SCTAB nTab2 )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CreateMatrixFromDoubleRef" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CreateMatrixFromDoubleRef" );
ScMatrixRef pMat = NULL;
if (nTab1 == nTab2 && !nGlobalError)
{
@@ -449,7 +449,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken
ScMatrixRef ScInterpreter::GetMatrix()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetMatrix" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetMatrix" );
ScMatrixRef pMat = NULL;
switch (GetRawStackType())
{
@@ -532,7 +532,7 @@ ScMatrixRef ScInterpreter::GetMatrix()
void ScInterpreter::ScMatValue()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMatValue" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMatValue" );
if ( MustHaveParamCount( GetByte(), 3 ) )
{
// 0 to count-1
@@ -604,7 +604,7 @@ void ScInterpreter::ScMatValue()
}
void ScInterpreter::CalculateMatrixValue(const ScMatrix* pMat,SCSIZE nC,SCSIZE nR)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateMatrixValue" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateMatrixValue" );
if (pMat)
{
SCSIZE nCl, nRw;
@@ -628,7 +628,7 @@ void ScInterpreter::CalculateMatrixValue(const ScMatrix* pMat,SCSIZE nC,SCSIZE n
void ScInterpreter::ScEMat()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScEMat" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScEMat" );
if ( MustHaveParamCount( GetByte(), 1 ) )
{
SCSIZE nDim = static_cast<SCSIZE>(::rtl::math::approxFloor(GetDouble()));
@@ -650,7 +650,7 @@ void ScInterpreter::ScEMat()
void ScInterpreter::MEMat(ScMatrix* mM, SCSIZE n)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::MEMat" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::MEMat" );
mM->FillDouble(0.0, 0, 0, n-1, n-1);
for (SCSIZE i = 0; i < n; i++)
mM->PutDouble(1.0, i, i);
@@ -660,7 +660,7 @@ void ScInterpreter::MFastMult(ScMatrix* pA, ScMatrix* pB, ScMatrix* pR,
SCSIZE n, SCSIZE m, SCSIZE l)
// Multipliziert n x m Mat a mit m x l Mat b nach Mat r
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::MFastMult" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::MFastMult" );
double sum;
for (SCSIZE i = 0; i < n; i++)
{
@@ -830,7 +830,7 @@ static void lcl_LUP_solve( const ScMatrix* mLU, const SCSIZE n,
void ScInterpreter::ScMatDet()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMatDet" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMatDet" );
if ( MustHaveParamCount( GetByte(), 1 ) )
{
ScMatrixRef pMat = GetMatrix();
@@ -877,7 +877,7 @@ void ScInterpreter::ScMatDet()
void ScInterpreter::ScMatInv()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMatInv" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMatInv" );
if ( MustHaveParamCount( GetByte(), 1 ) )
{
ScMatrixRef pMat = GetMatrix();
@@ -979,7 +979,7 @@ void ScInterpreter::ScMatInv()
void ScInterpreter::ScMatMult()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMatMult" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMatMult" );
if ( MustHaveParamCount( GetByte(), 2 ) )
{
ScMatrixRef pMat2 = GetMatrix();
@@ -1029,7 +1029,7 @@ void ScInterpreter::ScMatMult()
void ScInterpreter::ScMatTrans()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMatTrans" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMatTrans" );
if ( MustHaveParamCount( GetByte(), 1 ) )
{
ScMatrixRef pMat = GetMatrix();
@@ -1102,7 +1102,7 @@ ScMatrixRef lcl_MatrixCalculation(const _Function& _pOperation,ScMatrix* pMat1,
ScMatrixRef ScInterpreter::MatConcat(ScMatrix* pMat1, ScMatrix* pMat2)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::MatConcat" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::MatConcat" );
SCSIZE nC1, nC2, nMinC;
SCSIZE nR1, nR2, nMinR;
SCSIZE i, j;
@@ -1166,12 +1166,12 @@ void lcl_GetDiffDateTimeFmtType( short& nFuncFmt, short nFmt1, short nFmt2 )
void ScInterpreter::ScAdd()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAdd" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAdd" );
CalculateAddSub(FALSE);
}
void ScInterpreter::CalculateAddSub(BOOL _bSub)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateAddSub" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateAddSub" );
ScMatrixRef pMat1 = NULL;
ScMatrixRef pMat2 = NULL;
double fVal1 = 0.0, fVal2 = 0.0;
@@ -1306,7 +1306,7 @@ void ScInterpreter::CalculateAddSub(BOOL _bSub)
void ScInterpreter::ScAmpersand()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScAmpersand" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScAmpersand" );
ScMatrixRef pMat1 = NULL;
ScMatrixRef pMat2 = NULL;
String sStr1, sStr2;
@@ -1398,13 +1398,13 @@ void ScInterpreter::ScAmpersand()
void ScInterpreter::ScSub()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSub" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSub" );
CalculateAddSub(TRUE);
}
void ScInterpreter::ScMul()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMul" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMul" );
ScMatrixRef pMat1 = NULL;
ScMatrixRef pMat2 = NULL;
double fVal1 = 0.0, fVal2 = 0.0;
@@ -1483,7 +1483,7 @@ void ScInterpreter::ScMul()
void ScInterpreter::ScDiv()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScDiv" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScDiv" );
ScMatrixRef pMat1 = NULL;
ScMatrixRef pMat2 = NULL;
double fVal1 = 0.0, fVal2 = 0.0;
@@ -1574,14 +1574,14 @@ void ScInterpreter::ScDiv()
void ScInterpreter::ScPower()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPower" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPower" );
if ( MustHaveParamCount( GetByte(), 2 ) )
ScPow();
}
void ScInterpreter::ScPow()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScPow" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScPow" );
ScMatrixRef pMat1 = NULL;
ScMatrixRef pMat2 = NULL;
double fVal1 = 0.0, fVal2 = 0.0;
@@ -1649,7 +1649,7 @@ void ScInterpreter::ScPow()
void ScInterpreter::ScSumProduct()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSumProduct" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSumProduct" );
BYTE nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 1, 30 ) )
return;
@@ -1703,12 +1703,12 @@ void ScInterpreter::ScSumProduct()
void ScInterpreter::ScSumX2MY2()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSumX2MY2" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSumX2MY2" );
CalculateSumX2MY2SumX2DY2(FALSE);
}
void ScInterpreter::CalculateSumX2MY2SumX2DY2(BOOL _bSumX2DY2)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateSumX2MY2SumX2DY2" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateSumX2MY2SumX2DY2" );
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
@@ -1749,13 +1749,13 @@ void ScInterpreter::CalculateSumX2MY2SumX2DY2(BOOL _bSumX2DY2)
void ScInterpreter::ScSumX2DY2()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSumX2DY2" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSumX2DY2" );
CalculateSumX2MY2SumX2DY2(TRUE);
}
void ScInterpreter::ScSumXMY2()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScSumXMY2" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScSumXMY2" );
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
@@ -1799,7 +1799,7 @@ void ScInterpreter::ScSumXMY2()
void ScInterpreter::ScFrequency()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScFrequency" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScFrequency" );
if ( !MustHaveParamCount( GetByte(), 2 ) )
return;
@@ -1959,7 +1959,7 @@ BOOL ScInterpreter::RGetVariances( ScMatrix* pV, ScMatrix* pX,
// -----------------------------------------------------------------------------
void ScInterpreter::Calculate(ScMatrixRef& pResMat,ScMatrixRef& pE,ScMatrixRef& pQ,ScMatrixRef& pV,ScMatrixRef& pMatX,BOOL bConstant,SCSIZE N,SCSIZE M,BYTE nCase)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::RGetVariances" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::RGetVariances" );
// pE[0] := Sigma i=1...n (Yi)
// pE[k] := Sigma i=1...n (Xki*Yi)
// pE[M+1] := Sigma i=1...n (Yi**2)
@@ -2053,7 +2053,7 @@ void ScInterpreter::Calculate(ScMatrixRef& pResMat,ScMatrixRef& pE,ScMatrixRef&
void ScInterpreter::ScRGP()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRGP" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRGP" );
CalulateRGPRKP(FALSE);
}
bool ScInterpreter::CheckMatrix(BOOL _bLOG,BOOL _bTrendGrowth,BYTE& nCase,SCSIZE& nCX,SCSIZE& nCY,SCSIZE& nRX,SCSIZE& nRY,SCSIZE& M,SCSIZE& N,ScMatrixRef& pMatX,ScMatrixRef& pMatY)
@@ -2154,7 +2154,7 @@ bool ScInterpreter::CheckMatrix(BOOL _bLOG,BOOL _bTrendGrowth,BYTE& nCase,SCSIZE
}
void ScInterpreter::CalulateRGPRKP(BOOL _bRKP)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CheckMatrix" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CheckMatrix" );
BYTE nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 1, 4 ) )
return;
@@ -2353,13 +2353,13 @@ void ScInterpreter::CalulateRGPRKP(BOOL _bRKP)
void ScInterpreter::ScRKP()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScRKP" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScRKP" );
CalulateRGPRKP(TRUE);
}
// -----------------------------------------------------------------------------
bool ScInterpreter::Calculate4(BOOL _bExp,ScMatrixRef& pResMat,ScMatrixRef& pQ,BOOL bConstant,SCSIZE N,SCSIZE M)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Calculate4" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Calculate4" );
pQ->PutDouble((double)N, 0, 0);
if (bConstant)
{
@@ -2412,7 +2412,7 @@ bool ScInterpreter::Calculate4(BOOL _bExp,ScMatrixRef& pResMat,ScMatrixRef& pQ,B
ScMatrixRef ScInterpreter::Calculate2(const BOOL bConstant,const SCSIZE M ,const SCSIZE N,ScMatrixRef& pMatX,ScMatrixRef& pMatY,BYTE nCase)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Calculate2" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Calculate2" );
SCSIZE i, j, k;
ScMatrixRef pQ = GetNewMat(M+1, M+2);
ScMatrixRef pE = GetNewMat(M+2, 1);
@@ -2511,7 +2511,7 @@ ScMatrixRef ScInterpreter::Calculate2(const BOOL bConstant,const SCSIZE M ,const
}
bool ScInterpreter::Calculate3(const SCSIZE M ,ScMatrixRef& pQ)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::Calculate3" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::Calculate3" );
SCSIZE S, L;
for (S = 1; S < M+1; S++)
{
@@ -2550,12 +2550,12 @@ bool ScInterpreter::Calculate3(const SCSIZE M ,ScMatrixRef& pQ)
void ScInterpreter::ScTrend()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScTrend" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScTrend" );
CalculateTrendGrowth(FALSE);
}
void ScInterpreter::CalculateTrendGrowth(BOOL _bGrowth)
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::CalculateTrendGrowth" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::CalculateTrendGrowth" );
BYTE nParamCount = GetByte();
if ( !MustHaveParamCount( nParamCount, 1, 4 ) )
return;
@@ -2716,13 +2716,13 @@ void ScInterpreter::CalculateTrendGrowth(BOOL _bGrowth)
void ScInterpreter::ScGrowth()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScGrowth" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScGrowth" );
CalculateTrendGrowth(TRUE);
}
void ScInterpreter::ScMatRef()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScMatRef" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScMatRef" );
// Falls Deltarefs drin sind...
Push( (FormulaToken&)*pCur );
ScAddress aAdr;
@@ -2792,11 +2792,11 @@ void ScInterpreter::ScMatRef()
void ScInterpreter::ScInfo()
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::ScInfo" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ScInfo" );
if( MustHaveParamCount( GetByte(), 1 ) )
{
String aStr = GetString();
- ScCellKeywordTranslator::transKeyword(aStr, ScGlobal::pLocale, ocInfo);
+ ScCellKeywordTranslator::transKeyword(aStr, ScGlobal::GetLocale(), ocInfo);
if( aStr.EqualsAscii( "SYSTEM" ) )
PushString( String( RTL_CONSTASCII_USTRINGPARAM( SC_INFO_OSVERSION ) ) );
else if( aStr.EqualsAscii( "OSVERSION" ) )
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 118b5f0ece68..e8b69a4e6eda 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -48,7 +48,7 @@ double const fHalfMachEps = 0.5 * ::std::numeric_limits<double>::epsilon();
uses continued fraction with odd items */
double ScInterpreter::GetGammaContFraction( double fA, double fX )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetGammaContFraction" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetGammaContFraction" );
double const fBigInv = ::std::numeric_limits<double>::epsilon();
double const fBig = 1.0/fBigInv;
@@ -105,7 +105,7 @@ double ScInterpreter::GetGammaContFraction( double fA, double fX )
uses power series */
double ScInterpreter::GetGammaSeries( double fA, double fX )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetGammaSeries" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetGammaSeries" );
double fDenomfactor = fA;
double fSummand = 1.0/fA;
double fSum = fSummand;
@@ -129,7 +129,7 @@ double ScInterpreter::GetGammaSeries( double fA, double fX )
/** You must ensure fA>0.0 && fX>0.0) */
double ScInterpreter::GetLowRegIGamma( double fA, double fX )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetLowRegIGamma" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetLowRegIGamma" );
double fLnFactor = fA * log(fX) - fX - GetLogGamma(fA);
double fFactor = exp(fLnFactor); // Do we need more accuracy than exp(ln()) has?
if (fX>fA+1.0) // includes fX>1.0; 1-GetUpRegIGamma, continued fraction
@@ -141,7 +141,7 @@ double ScInterpreter::GetLowRegIGamma( double fA, double fX )
/** You must ensure fA>0.0 && fX>0.0) */
double ScInterpreter::GetUpRegIGamma( double fA, double fX )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetUpRegIGamma" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetUpRegIGamma" );
double fLnFactor= fA*log(fX)-fX-GetLogGamma(fA);
double fFactor = exp(fLnFactor); //Do I need more accuracy than exp(ln()) has?;
@@ -156,7 +156,7 @@ double ScInterpreter::GetUpRegIGamma( double fA, double fX )
You must ensure fAlpha>0.0 and fLambda>0.0 */
double ScInterpreter::GetGammaDistPDF( double fX, double fAlpha, double fLambda )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetGammaDistPDF" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetGammaDistPDF" );
if (fX <= 0.0)
return 0.0; // see ODFF
else
@@ -194,7 +194,7 @@ double ScInterpreter::GetGammaDistPDF( double fX, double fAlpha, double fLambda
You must ensure fAlpha>0.0 and fLambda>0.0 */
double ScInterpreter::GetGammaDist( double fX, double fAlpha, double fLambda )
{
- RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "Eike.Rathke@sun.com", "ScInterpreter::GetGammaDist" );
+ RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::GetGammaDist" );
if (fX <= 0.0)
return 0.0;
else
diff --git a/sc/source/core/tool/makefile.mk b/sc/source/core/tool/makefile.mk
index ac0aa23fc044..52d9bad7c18c 100644
--- a/sc/source/core/tool/makefile.mk
+++ b/sc/source/core/tool/makefile.mk
@@ -80,7 +80,6 @@ SLOFILES = \
$(SLO)$/filtopt.obj \
$(SLO)$/formulaparserpool.obj \
$(SLO)$/hints.obj \
- $(SLO)$/indexmap.obj \
$(SLO)$/inputopt.obj \
$(SLO)$/interpr1.obj \
$(SLO)$/interpr2.obj \
diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx
index 634c6adbb5cf..5f2094d2f0f7 100644
--- a/sc/source/core/tool/parclass.cxx
+++ b/sc/source/core/tool/parclass.cxx
@@ -64,138 +64,138 @@ const ScParameterClassification::RawData ScParameterClassification::pRawData[] =
// IF() and CHOOSE() are somewhat special, since the ScJumpMatrix is
// created inside those functions and ConvertMatrixParameters() is not
// called for them.
- { ocIf, {{ Array, Reference, Reference }, false }},
- { ocChose, {{ Array, Reference }, true }},
+ { ocIf, {{ Array, Reference, Reference }, false }},
+ { ocChose, {{ Array, Reference }, true }},
// Other specials.
- { ocOpen, {{ Bounds }, false }},
- { ocClose, {{ Bounds }, false }},
- { ocSep, {{ Bounds }, false }},
- { ocNoName, {{ Bounds }, false }},
- { ocErrCell, {{ Bounds }, false }},
- { ocStop, {{ Bounds }, false }},
- { ocUnion, {{ Reference, Reference }, false }},
- { ocRange, {{ Reference, Reference }, false }},
+ { ocOpen, {{ Bounds }, false }},
+ { ocClose, {{ Bounds }, false }},
+ { ocSep, {{ Bounds }, false }},
+ { ocNoName, {{ Bounds }, false }},
+ { ocErrCell, {{ Bounds }, false }},
+ { ocStop, {{ Bounds }, false }},
+ { ocUnion, {{ Reference, Reference }, false }},
+ { ocRange, {{ Reference, Reference }, false }},
// Functions with Value parameters only but not in resource.
- { ocBackSolver, {{ Value, Value, Value }, false }},
- { ocTableOp, {{ Value, Value, Value, Value, Value }, false }},
+ { ocBackSolver, {{ Value, Value, Value }, false }},
+ { ocTableOp, {{ Value, Value, Value, Value, Value }, false }},
// Operators and functions.
- { ocAdd, {{ Array, Array }, false }},
- { ocAmpersand, {{ Array, Array }, false }},
- { ocAnd, {{ Reference }, true }},
- { ocAreas, {{ Reference }, false }},
- { ocAveDev, {{ Reference }, true }},
- { ocAverage, {{ Reference }, true }},
- { ocAverageA, {{ Reference }, true }},
- { ocCell, {{ Value, Reference }, false }},
- { ocColumn, {{ Reference }, false }},
- { ocColumns, {{ Reference }, true }},
- { ocCorrel, {{ ForceArray, ForceArray }, false }},
- { ocCount, {{ Reference }, true }},
- { ocCount2, {{ Reference }, true }},
- { ocCountEmptyCells, {{ Reference }, false }},
- { ocCountIf, {{ Reference, Value }, false }},
- { ocCovar, {{ ForceArray, ForceArray }, false }},
- { ocDBAverage, {{ Reference, Reference, Reference }, false }},
- { ocDBCount, {{ Reference, Reference, Reference }, false }},
- { ocDBCount2, {{ Reference, Reference, Reference }, false }},
- { ocDBGet, {{ Reference, Reference, Reference }, false }},
- { ocDBMax, {{ Reference, Reference, Reference }, false }},
- { ocDBMin, {{ Reference, Reference, Reference }, false }},
- { ocDBProduct, {{ Reference, Reference, Reference }, false }},
- { ocDBStdDev, {{ Reference, Reference, Reference }, false }},
- { ocDBStdDevP, {{ Reference, Reference, Reference }, false }},
- { ocDBSum, {{ Reference, Reference, Reference }, false }},
- { ocDBVar, {{ Reference, Reference, Reference }, false }},
- { ocDBVarP, {{ Reference, Reference, Reference }, false }},
- { ocDevSq, {{ Reference }, true }},
- { ocDiv, {{ Array, Array }, false }},
- { ocEqual, {{ Array, Array }, false }},
- { ocForecast, {{ Value, ForceArray, ForceArray }, false }},
- { ocFrequency, {{ Reference, Reference }, false }},
- { ocFTest, {{ ForceArray, ForceArray }, false }},
- { ocGeoMean, {{ Reference }, true }},
- { ocGCD, {{ Reference }, true }},
- { ocGreater, {{ Array, Array }, false }},
- { ocGreaterEqual, {{ Array, Array }, false }},
- { ocGrowth, {{ Reference, Reference, Reference, Value }, false }},
- { ocHarMean, {{ Reference }, true }},
- { ocHLookup, {{ Value, Reference, Value, Value }, false }},
- { ocIRR, {{ Reference, Value }, false }},
- { ocIndex, {{ Reference, Value, Value, Value }, false }},
- { ocIntercept, {{ ForceArray, ForceArray }, false }},
- { ocIntersect, {{ Reference, Reference }, false }},
- { ocIsRef, {{ Reference }, false }},
- { ocLCM, {{ Reference }, true }},
- { ocKurt, {{ Reference }, true }},
- { ocLarge, {{ Reference, Value }, false }},
- { ocLess, {{ Array, Array }, false }},
- { ocLessEqual, {{ Array, Array }, false }},
- { ocLookup, {{ Value, Reference, Reference }, false }},
- { ocMatch, {{ Value, Reference, Reference }, false }},
- { ocMatDet, {{ ForceArray }, false }},
- { ocMatInv, {{ ForceArray }, false }},
- { ocMatMult, {{ ForceArray, ForceArray }, false }},
- { ocMatTrans, {{ Array }, false }}, // strange, but Xcl doesn't force MatTrans array
- { ocMatValue, {{ Reference, Value, Value }, false }},
- { ocMax, {{ Reference }, true }},
- { ocMaxA, {{ Reference }, true }},
- { ocMedian, {{ Reference }, true }},
- { ocMin, {{ Reference }, true }},
- { ocMinA, {{ Reference }, true }},
- { ocMIRR, {{ Reference, Value, Value }, false }},
- { ocModalValue, {{ ForceArray }, true }},
- { ocMul, {{ Array, Array }, false }},
- { ocMultiArea, {{ Reference }, true }},
- { ocN, {{ Reference }, false }},
- { ocNPV, {{ Value, Reference }, true }},
- { ocNeg, {{ Array }, false }},
- { ocNegSub, {{ Array }, false }},
- { ocNot, {{ Array }, false }},
- { ocNotEqual, {{ Array, Array }, false }},
- { ocOffset, {{ Reference, Value, Value, Value, Value }, false }},
- { ocOr, {{ Reference }, true }},
- { ocPearson, {{ ForceArray, ForceArray }, false }},
- { ocPercentile, {{ Reference, Value }, false }},
- { ocPercentrank, {{ Reference, Value }, false }},
- { ocPow, {{ Array, Array }, false }},
- { ocPower, {{ Array, Array }, false }},
- { ocProb, {{ ForceArray, ForceArray, Value, Value }, false }},
- { ocProduct, {{ Reference }, true }},
- { ocQuartile, {{ Reference, Value }, false }},
- { ocRank, {{ Value, Reference, Value }, false }},
- { ocRGP, {{ Reference, Reference, Value, Value }, false }},
- { ocRKP, {{ Reference, Reference, Value, Value }, false }},
- { ocRow, {{ Reference }, false }},
- { ocRows, {{ Reference }, true }},
- { ocRSQ, {{ ForceArray, ForceArray }, false }},
- { ocSchiefe, {{ Reference }, true }},
- { ocSlope, {{ ForceArray, ForceArray }, false }},
- { ocSmall, {{ Reference, Value }, false }},
- { ocStDev, {{ Reference }, true }},
- { ocStDevA, {{ Reference }, true }},
- { ocStDevP, {{ Reference }, true }},
- { ocStDevPA, {{ Reference }, true }},
- { ocSTEYX, {{ ForceArray, ForceArray }, false }},
- { ocSub, {{ Array, Array }, false }},
- { ocSubTotal, {{ Value, Reference }, true }},
- { ocSum, {{ Reference }, true }},
- { ocSumIf, {{ Reference, Value, Reference }, false }},
- { ocSumProduct, {{ ForceArray }, true }},
- { ocSumSQ, {{ Reference }, true }},
- { ocSumX2MY2, {{ ForceArray, ForceArray }, false }},
- { ocSumX2DY2, {{ ForceArray, ForceArray }, false }},
- { ocSumXMY2, {{ ForceArray, ForceArray }, false }},
- { ocTable, {{ Reference }, false }},
- { ocTables, {{ Reference }, true }},
- { ocTrend, {{ Reference, Reference, Reference, Value }, false }},
- { ocTrimMean, {{ Reference, Value }, false }},
- { ocTTest, {{ ForceArray, ForceArray, Value, Value }, false }},
- { ocVar, {{ Reference }, true }},
- { ocVarA, {{ Reference }, true }},
- { ocVarP, {{ Reference }, true }},
- { ocVarPA, {{ Reference }, true }},
- { ocVLookup, {{ Value, Reference, Value, Value }, false }},
- { ocZTest, {{ Reference, Value, Value }, false }},
+ { ocAdd, {{ Array, Array }, false }},
+ { ocAmpersand, {{ Array, Array }, false }},
+ { ocAnd, {{ Reference }, true }},
+ { ocAreas, {{ Reference }, false }},
+ { ocAveDev, {{ Reference }, true }},
+ { ocAverage, {{ Reference }, true }},
+ { ocAverageA, {{ Reference }, true }},
+ { ocCell, {{ Value, Reference }, false }},
+ { ocColumn, {{ Reference }, false }},
+ { ocColumns, {{ Reference }, true }},
+ { ocCorrel, {{ ForceArray, ForceArray }, false }},
+ { ocCount, {{ Reference }, true }},
+ { ocCount2, {{ Reference }, true }},
+ { ocCountEmptyCells, {{ Reference }, false }},
+ { ocCountIf, {{ Reference, Value }, false }},
+ { ocCovar, {{ ForceArray, ForceArray }, false }},
+ { ocDBAverage, {{ Reference, Reference, Reference }, false }},
+ { ocDBCount, {{ Reference, Reference, Reference }, false }},
+ { ocDBCount2, {{ Reference, Reference, Reference }, false }},
+ { ocDBGet, {{ Reference, Reference, Reference }, false }},
+ { ocDBMax, {{ Reference, Reference, Reference }, false }},
+ { ocDBMin, {{ Reference, Reference, Reference }, false }},
+ { ocDBProduct, {{ Reference, Reference, Reference }, false }},
+ { ocDBStdDev, {{ Reference, Reference, Reference }, false }},
+ { ocDBStdDevP, {{ Reference, Reference, Reference }, false }},
+ { ocDBSum, {{ Reference, Reference, Reference }, false }},
+ { ocDBVar, {{ Reference, Reference, Reference }, false }},
+ { ocDBVarP, {{ Reference, Reference, Reference }, false }},
+ { ocDevSq, {{ Reference }, true }},
+ { ocDiv, {{ Array, Array }, false }},
+ { ocEqual, {{ Array, Array }, false }},
+ { ocForecast, {{ Value, ForceArray, ForceArray }, false }},
+ { ocFrequency, {{ Reference, Reference }, false }},
+ { ocFTest, {{ ForceArray, ForceArray }, false }},
+ { ocGeoMean, {{ Reference }, true }},
+ { ocGCD, {{ Reference }, true }},
+ { ocGreater, {{ Array, Array }, false }},
+ { ocGreaterEqual, {{ Array, Array }, false }},
+ { ocGrowth, {{ Reference, Reference, Reference, Value }, false }},
+ { ocHarMean, {{ Reference }, true }},
+ { ocHLookup, {{ Value, Reference, Value, Value }, false }},
+ { ocIRR, {{ Reference, Value }, false }},
+ { ocIndex, {{ Reference, Value, Value, Value }, false }},
+ { ocIntercept, {{ ForceArray, ForceArray }, false }},
+ { ocIntersect, {{ Reference, Reference }, false }},
+ { ocIsRef, {{ Reference }, false }},
+ { ocLCM, {{ Reference }, true }},
+ { ocKurt, {{ Reference }, true }},
+ { ocLarge, {{ Reference, Value }, false }},
+ { ocLess, {{ Array, Array }, false }},
+ { ocLessEqual, {{ Array, Array }, false }},
+ { ocLookup, {{ Value, ReferenceOrForceArray, ReferenceOrForceArray }, false }},
+ { ocMatch, {{ Value, Reference, Reference }, false }},
+ { ocMatDet, {{ ForceArray }, false }},
+ { ocMatInv, {{ ForceArray }, false }},
+ { ocMatMult, {{ ForceArray, ForceArray }, false }},
+ { ocMatTrans, {{ Array }, false }}, // strange, but Xcl doesn't force MatTrans array
+ { ocMatValue, {{ Reference, Value, Value }, false }},
+ { ocMax, {{ Reference }, true }},
+ { ocMaxA, {{ Reference }, true }},
+ { ocMedian, {{ Reference }, true }},
+ { ocMin, {{ Reference }, true }},
+ { ocMinA, {{ Reference }, true }},
+ { ocMIRR, {{ Reference, Value, Value }, false }},
+ { ocModalValue, {{ ForceArray }, true }},
+ { ocMul, {{ Array, Array }, false }},
+ { ocMultiArea, {{ Reference }, true }},
+ { ocN, {{ Reference }, false }},
+ { ocNPV, {{ Value, Reference }, true }},
+ { ocNeg, {{ Array }, false }},
+ { ocNegSub, {{ Array }, false }},
+ { ocNot, {{ Array }, false }},
+ { ocNotEqual, {{ Array, Array }, false }},
+ { ocOffset, {{ Reference, Value, Value, Value, Value }, false }},
+ { ocOr, {{ Reference }, true }},
+ { ocPearson, {{ ForceArray, ForceArray }, false }},
+ { ocPercentile, {{ Reference, Value }, false }},
+ { ocPercentrank, {{ Reference, Value }, false }},
+ { ocPow, {{ Array, Array }, false }},
+ { ocPower, {{ Array, Array }, false }},
+ { ocProb, {{ ForceArray, ForceArray, Value, Value }, false }},
+ { ocProduct, {{ Reference }, true }},
+ { ocQuartile, {{ Reference, Value }, false }},
+ { ocRank, {{ Value, Reference, Value }, false }},
+ { ocRGP, {{ Reference, Reference, Value, Value }, false }},
+ { ocRKP, {{ Reference, Reference, Value, Value }, false }},
+ { ocRow, {{ Reference }, false }},
+ { ocRows, {{ Reference }, true }},
+ { ocRSQ, {{ ForceArray, ForceArray }, false }},
+ { ocSchiefe, {{ Reference }, true }},
+ { ocSlope, {{ ForceArray, ForceArray }, false }},
+ { ocSmall, {{ Reference, Value }, false }},
+ { ocStDev, {{ Reference }, true }},
+ { ocStDevA, {{ Reference }, true }},
+ { ocStDevP, {{ Reference }, true }},
+ { ocStDevPA, {{ Reference }, true }},
+ { ocSTEYX, {{ ForceArray, ForceArray }, false }},
+ { ocSub, {{ Array, Array }, false }},
+ { ocSubTotal, {{ Value, Reference }, true }},
+ { ocSum, {{ Reference }, true }},
+ { ocSumIf, {{ Reference, Value, Reference }, false }},
+ { ocSumProduct, {{ ForceArray }, true }},
+ { ocSumSQ, {{ Reference }, true }},
+ { ocSumX2MY2, {{ ForceArray, ForceArray }, false }},
+ { ocSumX2DY2, {{ ForceArray, ForceArray }, false }},
+ { ocSumXMY2, {{ ForceArray, ForceArray }, false }},
+ { ocTable, {{ Reference }, false }},
+ { ocTables, {{ Reference }, true }},
+ { ocTrend, {{ Reference, Reference, Reference, Value }, false }},
+ { ocTrimMean, {{ Reference, Value }, false }},
+ { ocTTest, {{ ForceArray, ForceArray, Value, Value }, false }},
+ { ocVar, {{ Reference }, true }},
+ { ocVarA, {{ Reference }, true }},
+ { ocVarP, {{ Reference }, true }},
+ { ocVarPA, {{ Reference }, true }},
+ { ocVLookup, {{ Value, Reference, Value, Value }, false }},
+ { ocZTest, {{ Reference, Value, Value }, false }},
// Excel doubts:
// ocT: Excel says (and handles) Reference, error? This means no position
// dependent SingleRef if DoubleRef, and no array calculation, just the
@@ -265,7 +265,7 @@ void ScParameterClassification::Init()
}
for ( size_t j=0; j < CommonData::nMaxParams; ++j )
{
- if ( pRun->aData.nParam[j] == ForceArray )
+ if ( pRun->aData.nParam[j] == ForceArray || pRun->aData.nParam[j] == ReferenceOrForceArray )
{
pRun->bHasForceArray = true;
break; // for
@@ -537,6 +537,9 @@ void ScParameterClassification::GenerateDocumentation()
case ForceArray :
aStr += " ForceArray";
break;
+ case ReferenceOrForceArray :
+ aStr += " ReferenceOrForceArray";
+ break;
case Bounds :
aStr += " (Bounds, classification error?)";
break;
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 5c11249ef6be..775b0207be59 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -624,7 +624,7 @@ ScRangePairList_QsortNameCompare( const void* p1, const void* p2 )
{
ps1->pDoc->GetName( rStartPos1.Tab(), aStr1 );
ps2->pDoc->GetName( rStartPos2.Tab(), aStr2 );
- nComp = ScGlobal::pCollator->compareString( aStr1, aStr2 );
+ nComp = ScGlobal::GetCollator()->compareString( aStr1, aStr2 );
}
switch ( nComp )
{
@@ -655,7 +655,7 @@ ScRangePairList_QsortNameCompare( const void* p1, const void* p2 )
{
ps1->pDoc->GetName( rEndPos1.Tab(), aStr1 );
ps2->pDoc->GetName( rEndPos2.Tab(), aStr2 );
- nComp = ScGlobal::pCollator->compareString( aStr1, aStr2 );
+ nComp = ScGlobal::GetCollator()->compareString( aStr1, aStr2 );
}
switch ( nComp )
{
diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx
index 704c3255486e..7795256dce3c 100644
--- a/sc/source/core/tool/rangenam.cxx
+++ b/sc/source/core/tool/rangenam.cxx
@@ -49,7 +49,6 @@
#include "rechead.hxx"
#include "refupdat.hxx"
#include "document.hxx"
-#include "indexmap.hxx"
using namespace formula;
@@ -60,7 +59,7 @@ using namespace formula;
// Interner ctor fuer das Suchen nach einem Index
ScRangeData::ScRangeData( USHORT n )
- : pCode( NULL ), nIndex( n ), bModified( FALSE )
+ : pCode( NULL ), nIndex( n ), bModified( FALSE ), mnMaxRow(-1), mnMaxCol(-1)
{}
ScRangeData::ScRangeData( ScDocument* pDok,
@@ -76,7 +75,9 @@ ScRangeData::ScRangeData( ScDocument* pDok,
eType ( nType ),
pDoc ( pDok ),
nIndex ( 0 ),
- bModified ( FALSE )
+ bModified ( FALSE ),
+ mnMaxRow (-1),
+ mnMaxCol (-1)
{
if (rSymbol.Len() > 0)
{
@@ -122,7 +123,9 @@ ScRangeData::ScRangeData( ScDocument* pDok,
eType ( nType ),
pDoc ( pDok ),
nIndex ( 0 ),
- bModified ( FALSE )
+ bModified ( FALSE ),
+ mnMaxRow (-1),
+ mnMaxCol (-1)
{
if( !pCode->GetCodeError() )
{
@@ -157,7 +160,9 @@ ScRangeData::ScRangeData( ScDocument* pDok,
eType ( RT_NAME ),
pDoc ( pDok ),
nIndex ( 0 ),
- bModified ( FALSE )
+ bModified ( FALSE ),
+ mnMaxRow (-1),
+ mnMaxCol (-1)
{
ScSingleRefData aRefData;
aRefData.InitAddress( rTarget );
@@ -179,7 +184,9 @@ ScRangeData::ScRangeData(const ScRangeData& rScRangeData) :
eType (rScRangeData.eType),
pDoc (rScRangeData.pDoc),
nIndex (rScRangeData.nIndex),
- bModified (rScRangeData.bModified)
+ bModified (rScRangeData.bModified),
+ mnMaxRow (rScRangeData.mnMaxRow),
+ mnMaxCol (rScRangeData.mnMaxCol)
{}
ScRangeData::~ScRangeData()
@@ -247,7 +254,7 @@ void ScRangeData::UpdateSymbol( rtl::OUStringBuffer& rBuffer, const ScAddress& r
::std::auto_ptr<ScTokenArray> pTemp( pCode->Clone() );
ScCompiler aComp( pDoc, rPos, *pTemp.get());
aComp.SetGrammar(eGrammar);
- aComp.MoveRelWrap();
+ aComp.MoveRelWrap(GetMaxCol(), GetMaxRow());
aComp.CreateStringFromTokenArray( rBuffer );
}
@@ -355,19 +362,19 @@ BOOL ScRangeData::operator== (const ScRangeData& rData) const // fuer Undo
return TRUE;
}
-BOOL ScRangeData::IsRangeAtCursor( const ScAddress& rPos, BOOL bStartOnly ) const
-{
- BOOL bRet = FALSE;
- ScRange aRange;
- if ( IsReference(aRange) )
- {
- if ( bStartOnly )
- bRet = ( rPos == aRange.aStart );
- else
- bRet = ( aRange.In( rPos ) );
- }
- return bRet;
-}
+//UNUSED2009-05 BOOL ScRangeData::IsRangeAtCursor( const ScAddress& rPos, BOOL bStartOnly ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 BOOL bRet = FALSE;
+//UNUSED2009-05 ScRange aRange;
+//UNUSED2009-05 if ( IsReference(aRange) )
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( bStartOnly )
+//UNUSED2009-05 bRet = ( rPos == aRange.aStart );
+//UNUSED2009-05 else
+//UNUSED2009-05 bRet = ( aRange.In( rPos ) );
+//UNUSED2009-05 }
+//UNUSED2009-05 return bRet;
+//UNUSED2009-05 }
BOOL ScRangeData::IsRangeAtBlock( const ScRange& rBlock ) const
{
@@ -393,7 +400,7 @@ BOOL ScRangeData::IsReference( ScRange& rRange, const ScAddress& rPos ) const
::std::auto_ptr<ScTokenArray> pTemp( pCode->Clone() );
ScCompiler aComp( pDoc, rPos, *pTemp);
aComp.SetGrammar(pDoc->GetGrammar());
- aComp.MoveRelWrap();
+ aComp.MoveRelWrap(MAXCOL, MAXROW);
return pTemp->IsReference( rRange );
}
@@ -446,48 +453,45 @@ void ScRangeData::UpdateTabRef(SCTAB nOldTable, USHORT nFlag, SCTAB nNewTable)
}
}
-// wie beim Uebernehmen von Namen in Excel
void ScRangeData::MakeValidName( String& rName ) // static
{
//ScCompiler::InitSymbolsNative();
- // ungueltige Zeichen vorne weglassen
+ // strip leading invalid characters
xub_StrLen nPos = 0;
xub_StrLen nLen = rName.Len();
- while ( nPos < nLen && !ScCompiler::IsWordChar( rName, nPos) )
+ while ( nPos < nLen && !ScCompiler::IsCharFlagAllConventions( rName, nPos, SC_COMPILER_C_NAME) )
++nPos;
if ( nPos>0 )
rName.Erase(0,nPos);
- // wenn vorne ein ungueltiges Anfangszeichen steht, '_' davor
- if ( rName.Len() && !ScCompiler::IsCharWordChar( rName, 0 ) )
+ // if the first character is an invalid start character, precede with '_'
+ if ( rName.Len() && !ScCompiler::IsCharFlagAllConventions( rName, 0, SC_COMPILER_C_CHAR_NAME ) )
rName.Insert('_',0);
- // ungueltige durch '_' ersetzen
+ // replace invalid with '_'
nLen = rName.Len();
for (nPos=0; nPos<nLen; nPos++)
{
- if ( !ScCompiler::IsWordChar( rName, nPos) )
+ if ( !ScCompiler::IsCharFlagAllConventions( rName, nPos, SC_COMPILER_C_NAME) )
rName.SetChar( nPos, '_' );
}
- // Name darf keine Referenz beinhalten, wie in IsNameValid
+ // Ensure that the proposed name is not a reference under any convention,
+ // same as in IsNameValid()
ScAddress aAddr;
- ScRange aRange;
- int nConv = FormulaGrammar::CONV_UNSPECIFIED; // use int so that op++ works
-
- // Ensure that the proposed name is not an address under any convention
- while ( ++nConv != FormulaGrammar::CONV_LAST )
- {
+ ScRange aRange;
+ for (int nConv = FormulaGrammar::CONV_UNSPECIFIED; ++nConv < FormulaGrammar::CONV_LAST; )
+ {
ScAddress::Details details( static_cast<FormulaGrammar::AddressConvention>( nConv ) );
- while( aRange.Parse( rName, NULL, details )
- || aAddr.Parse( rName, NULL, details ) )
+ // Don't check Parse on VALID, any partial only VALID may result in
+ // #REF! during compile later!
+ while (aRange.Parse( rName, NULL, details) || aAddr.Parse( rName, NULL, details))
{
- //! Range Parse auch bei Bereich mit ungueltigem Tabellennamen gueltig
- //! Address Parse dito, Name erzeugt deswegen bei Compile ein #REF!
- if ( rName.SearchAndReplace( ':', '_' ) == STRING_NOTFOUND
- && rName.SearchAndReplace( '.', '_' ) == STRING_NOTFOUND )
+ //! Range Parse is partially valid also with invalid sheet name,
+ //! Address Parse dito, during compile name would generate a #REF!
+ if ( rName.SearchAndReplace( '.', '_' ) == STRING_NOTFOUND )
rName.Insert('_',0);
}
}
@@ -495,31 +499,50 @@ void ScRangeData::MakeValidName( String& rName ) // static
BOOL ScRangeData::IsNameValid( const String& rName, ScDocument* pDoc )
{
- /* If changed, ScfTools::ConvertToScDefinedName (sc/source/filter/ftools/ftools.cxx)
- needs to be changed too. */
+ /* XXX If changed, sc/source/filter/ftools/ftools.cxx
+ * ScfTools::ConvertToScDefinedName needs to be changed too. */
xub_StrLen nPos = 0;
xub_StrLen nLen = rName.Len();
- if ( !nLen || !ScCompiler::IsCharWordChar( rName, nPos++ ) )
+ if ( !nLen || !ScCompiler::IsCharFlagAllConventions( rName, nPos++, SC_COMPILER_C_CHAR_NAME ) )
return FALSE;
while ( nPos < nLen )
{
- if ( !ScCompiler::IsWordChar( rName, nPos++ ) )
+ if ( !ScCompiler::IsCharFlagAllConventions( rName, nPos++, SC_COMPILER_C_NAME ) )
return FALSE;
}
- // Parse nicht auf VALID pruefen, es reicht, wenn irgendein Bestandteil
- // erkannt wurde
+ ScAddress aAddr;
ScRange aRange;
- if( aRange.Parse( rName, pDoc ) ) // THIS IS WRONG
- return FALSE;
- else
+ for (int nConv = FormulaGrammar::CONV_UNSPECIFIED; ++nConv < FormulaGrammar::CONV_LAST; )
{
- ScAddress aAddr;
- if ( aAddr.Parse( rName, pDoc ) ) // THIS IS WRONG
+ ScAddress::Details details( static_cast<FormulaGrammar::AddressConvention>( nConv ) );
+ // Don't check Parse on VALID, any partial only VALID may result in
+ // #REF! during compile later!
+ if (aRange.Parse( rName, pDoc, details) || aAddr.Parse( rName, pDoc, details))
return FALSE;
}
return TRUE;
}
+void ScRangeData::SetMaxRow(SCROW nRow)
+{
+ mnMaxRow = nRow;
+}
+
+SCROW ScRangeData::GetMaxRow() const
+{
+ return mnMaxRow >= 0 ? mnMaxRow : MAXROW;
+}
+
+void ScRangeData::SetMaxCol(SCCOL nCol)
+{
+ mnMaxCol = nCol;
+}
+
+SCCOL ScRangeData::GetMaxCol() const
+{
+ return mnMaxCol >= 0 ? mnMaxCol : MAXCOL;
+}
+
USHORT ScRangeData::GetErrCode()
{
@@ -560,20 +583,20 @@ void ScRangeData::TransferTabRef( SCTAB nOldTab, SCTAB nNewTab )
}
}
-
-void ScRangeData::ReplaceRangeNamesInUse( const ScIndexMap& rMap )
+void ScRangeData::ReplaceRangeNamesInUse( const IndexMap& rMap )
{
- BOOL bCompile = FALSE;
+ bool bCompile = false;
for ( FormulaToken* p = pCode->First(); p; p = pCode->Next() )
{
if ( p->GetOpCode() == ocName )
{
- const USHORT nOldIndex = p->GetIndex();
- const USHORT nNewIndex = rMap.Find( nOldIndex );
+ const sal_uInt16 nOldIndex = p->GetIndex();
+ IndexMap::const_iterator itr = rMap.find(nOldIndex);
+ const sal_uInt16 nNewIndex = itr == rMap.end() ? nOldIndex : itr->second;
if ( nOldIndex != nNewIndex )
{
p->SetIndex( nNewIndex );
- bCompile = TRUE;
+ bCompile = true;
}
}
}
@@ -655,7 +678,7 @@ __cdecl
#endif
ScRangeData_QsortNameCompare( const void* p1, const void* p2 )
{
- return (int) ScGlobal::pCollator->compareString(
+ return (int) ScGlobal::GetCollator()->compareString(
(*(const ScRangeData**)p1)->GetName(),
(*(const ScRangeData**)p2)->GetName() );
}
@@ -771,16 +794,16 @@ ScRangeData* ScRangeName::FindIndex( USHORT nIndex )
return NULL;
}
-ScRangeData* ScRangeName::GetRangeAtCursor( const ScAddress& rPos, BOOL bStartOnly ) const
-{
- if ( pItems )
- {
- for ( USHORT i = 0; i < nCount; i++ )
- if ( ((ScRangeData*)pItems[i])->IsRangeAtCursor( rPos, bStartOnly ) )
- return (ScRangeData*)pItems[i];
- }
- return NULL;
-}
+//UNUSED2009-05 ScRangeData* ScRangeName::GetRangeAtCursor( const ScAddress& rPos, BOOL bStartOnly ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( pItems )
+//UNUSED2009-05 {
+//UNUSED2009-05 for ( USHORT i = 0; i < nCount; i++ )
+//UNUSED2009-05 if ( ((ScRangeData*)pItems[i])->IsRangeAtCursor( rPos, bStartOnly ) )
+//UNUSED2009-05 return (ScRangeData*)pItems[i];
+//UNUSED2009-05 }
+//UNUSED2009-05 return NULL;
+//UNUSED2009-05 }
ScRangeData* ScRangeName::GetRangeAtBlock( const ScRange& rBlock ) const
{
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index b1654421b12c..4a26a5004799 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -786,7 +786,7 @@ static void lcl_appendCellAddress(
if (rExtInfo.mbExternal)
{
ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
- const String* pFilePath = pRefMgr->getExternalFileName(rExtInfo.mnFileId);
+ const String* pFilePath = pRefMgr->getExternalFileName(rExtInfo.mnFileId, true);
if (!pFilePath)
return;
@@ -821,7 +821,7 @@ static void lcl_appendCellRangeAddress(
DBG_ASSERT(rExtInfo1.mnFileId == rExtInfo2.mnFileId, "File IDs do not match between 1st and 2nd addresses.");
ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
- const String* pFilePath = pRefMgr->getExternalFileName(rExtInfo1.mnFileId);
+ const String* pFilePath = pRefMgr->getExternalFileName(rExtInfo1.mnFileId, true);
if (!pFilePath)
return;
diff --git a/sc/source/core/tool/rechead.cxx b/sc/source/core/tool/rechead.cxx
index 7e8a271470e4..517759524c92 100644
--- a/sc/source/core/tool/rechead.cxx
+++ b/sc/source/core/tool/rechead.cxx
@@ -44,62 +44,6 @@
// =======================================================================
-ScReadHeader::ScReadHeader(SvStream& rNewStream) :
- rStream( rNewStream )
-{
- sal_uInt32 nDataSize;
- rStream >> nDataSize;
- nDataEnd = rStream.Tell() + nDataSize;
-}
-
-ScReadHeader::~ScReadHeader()
-{
- ULONG nReadEnd = rStream.Tell();
- DBG_ASSERT( nReadEnd <= nDataEnd, "zuviele Bytes gelesen" );
- if ( nReadEnd != nDataEnd )
- {
- if ( rStream.GetError() == SVSTREAM_OK )
- rStream.SetError( SCWARN_IMPORT_INFOLOST );
- rStream.Seek(nDataEnd); // Rest ueberspringen
- }
-}
-
-ULONG ScReadHeader::BytesLeft() const
-{
- ULONG nReadEnd = rStream.Tell();
- if (nReadEnd <= nDataEnd)
- return nDataEnd-nReadEnd;
-
- DBG_ERROR("Fehler bei ScReadHeader::BytesLeft");
- return 0;
-}
-
-// -----------------------------------------------------------------------
-
-ScWriteHeader::ScWriteHeader(SvStream& rNewStream, sal_uInt32 nDefault) :
- rStream( rNewStream )
-{
- nDataSize = nDefault;
- rStream << nDataSize;
-
- nDataPos = rStream.Tell();
-}
-
-ScWriteHeader::~ScWriteHeader()
-{
- ULONG nPos = rStream.Tell();
-
- if ( nPos - nDataPos != nDataSize ) // Default getroffen?
- {
- nDataSize = nPos - nDataPos;
- rStream.Seek(nDataPos - sizeof(sal_uInt32));
- rStream << nDataSize; // Groesse am Anfang eintragen
- rStream.Seek(nPos);
- }
-}
-
-// =======================================================================
-
ScMultipleReadHeader::ScMultipleReadHeader(SvStream& rNewStream) :
rStream( rNewStream )
{
diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx
index e129abdcf97f..d0f2b8233de0 100644
--- a/sc/source/core/tool/reftokenhelper.cxx
+++ b/sc/source/core/tool/reftokenhelper.cxx
@@ -51,7 +51,7 @@ using ::rtl::OUString;
void ScRefTokenHelper::compileRangeRepresentation(
vector<ScSharedTokenRef>& rRefTokens, const OUString& rRangeStr, ScDocument* pDoc, FormulaGrammar::Grammar eGrammar)
{
- const sal_Unicode cSep = ';';
+ const sal_Unicode cSep = GetScCompilerNativeSymbol(ocSep).GetChar(0);
const sal_Unicode cQuote = '\'';
bool bFailure = false;
diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx
index d019a6082583..1f70ef80963c 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -821,27 +821,27 @@ ScRefUpdateRes ScRefUpdate::Move( ScDocument* pDoc, const ScAddress& rPos,
}
void ScRefUpdate::MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos,
- ScComplexRefData& rRef )
+ SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData& rRef )
{
if( rRef.Ref1.IsColRel() )
{
rRef.Ref1.nCol = rRef.Ref1.nRelCol + rPos.Col();
- lcl_MoveItWrap( rRef.Ref1.nCol, static_cast<SCsCOL>(0), MAXCOL );
+ lcl_MoveItWrap( rRef.Ref1.nCol, static_cast<SCsCOL>(0), nMaxCol );
}
if( rRef.Ref2.IsColRel() )
{
rRef.Ref2.nCol = rRef.Ref2.nRelCol + rPos.Col();
- lcl_MoveItWrap( rRef.Ref2.nCol, static_cast<SCsCOL>(0), MAXCOL );
+ lcl_MoveItWrap( rRef.Ref2.nCol, static_cast<SCsCOL>(0), nMaxCol );
}
if( rRef.Ref1.IsRowRel() )
{
rRef.Ref1.nRow = rRef.Ref1.nRelRow + rPos.Row();
- lcl_MoveItWrap( rRef.Ref1.nRow, static_cast<SCsROW>(0), MAXROW );
+ lcl_MoveItWrap( rRef.Ref1.nRow, static_cast<SCsROW>(0), nMaxRow );
}
if( rRef.Ref2.IsRowRel() )
{
rRef.Ref2.nRow = rRef.Ref2.nRelRow + rPos.Row();
- lcl_MoveItWrap( rRef.Ref2.nRow, static_cast<SCsROW>(0), MAXROW );
+ lcl_MoveItWrap( rRef.Ref2.nRow, static_cast<SCsROW>(0), nMaxRow );
}
SCsTAB nMaxTab = (SCsTAB) pDoc->GetTableCount() - 1;
if( rRef.Ref1.IsTabRel() )
@@ -939,37 +939,4 @@ ScRefUpdateRes ScRefUpdate::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCRO
return eRet;
}
-#if OLD_PIVOT_IMPLEMENTATION
-ScRefUpdateRes ScRefUpdate::DoGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY,
- ScRange& rRef )
-{
- // wie UpdateGrow, nur mit Range statt RefData
-
- ScRefUpdateRes eRet = UR_NOTHING;
-
- BOOL bUpdateX = ( nGrowX &&
- rRef.aStart.Col() == rArea.aStart.Col() && rRef.aEnd.Col() == rArea.aEnd.Col() &&
- rRef.aStart.Row() >= rArea.aStart.Row() && rRef.aEnd.Row() <= rArea.aEnd.Row() &&
- rRef.aStart.Tab() >= rArea.aStart.Tab() && rRef.aEnd.Tab() <= rArea.aEnd.Tab() );
- BOOL bUpdateY = ( nGrowY &&
- rRef.aStart.Col() >= rArea.aStart.Col() && rRef.aEnd.Col() <= rArea.aEnd.Col() &&
- ( rRef.aStart.Row() == rArea.aStart.Row() || rRef.aStart.Row() == rArea.aStart.Row()+1 ) &&
- rRef.aEnd.Row() == rArea.aEnd.Row() &&
- rRef.aStart.Tab() >= rArea.aStart.Tab() && rRef.aEnd.Tab() <= rArea.aEnd.Tab() );
-
- if ( bUpdateX )
- {
- rRef.aEnd.SetCol( rRef.aEnd.Col() + nGrowX );
- eRet = UR_UPDATED;
- }
- if ( bUpdateY )
- {
- rRef.aEnd.SetRow( rRef.aEnd.Row() + nGrowY );
- eRet = UR_UPDATED;
- }
-
- return eRet;
-}
-#endif
-
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index af22bf7e43a3..ad7147ccb14d 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -608,48 +608,48 @@ void ScMatrix::MatTrans(ScMatrix& mRes) const
}
}
-void ScMatrix::MatCopyUpperLeft(ScMatrix& mRes) const
-{
- if (nColCount < mRes.nColCount || nRowCount < mRes.nRowCount)
- {
- DBG_ERRORFILE("ScMatrix::MatCopyUpperLeft: dimension error");
- }
- else
- {
- if (mnValType)
- {
- ScMatValType nType;
- mRes.ResetIsString();
- for ( SCSIZE i = 0; i < mRes.nColCount; i++ )
- {
- SCSIZE nStart = i * nRowCount;
- for ( SCSIZE j = 0; j < mRes.nRowCount; j++ )
- {
- if ( IsNonValueType( (nType = mnValType[nStart+j]) ))
- mRes.PutStringEntry( pMat[nStart+j].pS, nType,
- i*mRes.nRowCount+j );
- else
- {
- mRes.pMat[i*mRes.nRowCount+j].fVal = pMat[nStart+j].fVal;
- mRes.mnValType[i*mRes.nRowCount+j] = nType;
- }
- }
- }
- }
- else
- {
- mRes.DeleteIsString();
- for ( SCSIZE i = 0; i < mRes.nColCount; i++ )
- {
- SCSIZE nStart = i * nRowCount;
- for ( SCSIZE j = 0; j < mRes.nRowCount; j++ )
- {
- mRes.pMat[i*mRes.nRowCount+j].fVal = pMat[nStart+j].fVal;
- }
- }
- }
- }
-}
+//UNUSED2009-05 void ScMatrix::MatCopyUpperLeft(ScMatrix& mRes) const
+//UNUSED2009-05 {
+//UNUSED2009-05 if (nColCount < mRes.nColCount || nRowCount < mRes.nRowCount)
+//UNUSED2009-05 {
+//UNUSED2009-05 DBG_ERRORFILE("ScMatrix::MatCopyUpperLeft: dimension error");
+//UNUSED2009-05 }
+//UNUSED2009-05 else
+//UNUSED2009-05 {
+//UNUSED2009-05 if (mnValType)
+//UNUSED2009-05 {
+//UNUSED2009-05 ScMatValType nType;
+//UNUSED2009-05 mRes.ResetIsString();
+//UNUSED2009-05 for ( SCSIZE i = 0; i < mRes.nColCount; i++ )
+//UNUSED2009-05 {
+//UNUSED2009-05 SCSIZE nStart = i * nRowCount;
+//UNUSED2009-05 for ( SCSIZE j = 0; j < mRes.nRowCount; j++ )
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( IsNonValueType( (nType = mnValType[nStart+j]) ))
+//UNUSED2009-05 mRes.PutStringEntry( pMat[nStart+j].pS, nType,
+//UNUSED2009-05 i*mRes.nRowCount+j );
+//UNUSED2009-05 else
+//UNUSED2009-05 {
+//UNUSED2009-05 mRes.pMat[i*mRes.nRowCount+j].fVal = pMat[nStart+j].fVal;
+//UNUSED2009-05 mRes.mnValType[i*mRes.nRowCount+j] = nType;
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 else
+//UNUSED2009-05 {
+//UNUSED2009-05 mRes.DeleteIsString();
+//UNUSED2009-05 for ( SCSIZE i = 0; i < mRes.nColCount; i++ )
+//UNUSED2009-05 {
+//UNUSED2009-05 SCSIZE nStart = i * nRowCount;
+//UNUSED2009-05 for ( SCSIZE j = 0; j < mRes.nRowCount; j++ )
+//UNUSED2009-05 {
+//UNUSED2009-05 mRes.pMat[i*mRes.nRowCount+j].fVal = pMat[nStart+j].fVal;
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 }
void ScMatrix::FillDouble( double fVal, SCSIZE nC1, SCSIZE nR1, SCSIZE nC2, SCSIZE nR2 )
{
diff --git a/sc/source/core/tool/subtotal.cxx b/sc/source/core/tool/subtotal.cxx
index 828a65654242..c8061441abfc 100644
--- a/sc/source/core/tool/subtotal.cxx
+++ b/sc/source/core/tool/subtotal.cxx
@@ -39,188 +39,6 @@
// -----------------------------------------------------------------------
-#if OLD_PIVOT_IMPLEMENTATION
-SubTotal::SubTotal()
-{
- nIndex = 0; //! test fuer Pivot
-
- nCount = 0;
- nCount2 = 0;
- nSum = 0.0;
- nSumSqr = 0.0;
- nMax = -MAXDOUBLE;
- nMin = MAXDOUBLE;
- nProduct = 1.0;
- bSumOk = TRUE;
- bSumSqrOk = TRUE;
- bProductOk = TRUE;
-}
-
-
-SubTotal::~SubTotal()
-{
-}
-
-
-void SubTotal::UpdateNoVal()
-{
- nCount++;
-}
-
-
-void SubTotal::Update( double nVal )
-{
- SAL_MATH_FPEXCEPTIONS_OFF();
- nCount++;
- nCount2++;
- if (nVal > nMax) nMax = nVal;
- if (nVal < nMin) nMin = nVal;
- nProgress = 0;
- if (bSumOk) nSum += nVal;
- nProgress = 1;
- if (bProductOk) nProduct *= nVal;
- nProgress = 2;
- if (bSumSqrOk) nSumSqr += nVal*nVal;
- if (!::rtl::math::isFinite(nSum))
- bSumOk = FALSE;
- if (!::rtl::math::isFinite(nProduct))
- bProductOk = FALSE;
- if (!::rtl::math::isFinite(nSumSqr))
- bSumSqrOk = FALSE;
-}
-
-
-void SubTotal::Update( const SubTotal& rVal )
-{
- SAL_MATH_FPEXCEPTIONS_OFF();
- nCount += rVal.nCount;
- nCount2 += rVal.nCount2;
- if (rVal.nMax > nMax) nMax = rVal.nMax;
- if (rVal.nMin < nMin) nMin = rVal.nMin;
- nProgress = 0;
- if (rVal.bSumOk && bSumOk)
- nSum += rVal.nSum;
- else
- bSumOk = FALSE;
- nProgress = 1;
- if (rVal.bProductOk && bProductOk)
- nProduct *= rVal.nProduct;
- else
- bProductOk = FALSE;
- nProgress = 2;
- if (rVal.bSumSqrOk && bSumSqrOk)
- nSumSqr += rVal.nSumSqr;
- else
- bSumSqrOk = FALSE;
- if (!::rtl::math::isFinite(nSum))
- bSumOk = FALSE;
- if (!::rtl::math::isFinite(nProduct))
- bProductOk = FALSE;
- if (!::rtl::math::isFinite(nSumSqr))
- bSumSqrOk = FALSE;
-}
-
-
-short SubTotal::Valid( USHORT nFunction ) const
- // return 0 => Fehler, -1 => kein Wert, 1 => ok
-{
- short nRet;
- switch (nFunction)
- {
- case PIVOT_FUNC_AVERAGE:
- if (nCount2 == 0)
- nRet = -1;
- else
- nRet = bSumOk;
- break;
- case PIVOT_FUNC_STD_DEVP:
- case PIVOT_FUNC_STD_VARP:
- if (nCount2 == 0)
- nRet = -1;
- else
- nRet = bSumSqrOk;
- break;
- case PIVOT_FUNC_STD_DEV:
- case PIVOT_FUNC_STD_VAR:
- if (nCount2 < 2)
- nRet = -1;
- else
- nRet = bSumSqrOk;
- break;
- case PIVOT_FUNC_MAX:
- if (nCount2 == 0)
- nRet = -1;
- else
- nRet = 1;
- break;
- case PIVOT_FUNC_MIN:
- if (nCount2 == 0)
- nRet = -1;
- else
- nRet = 1;
- break;
- case PIVOT_FUNC_SUM:
- if (nCount2 == 0)
- nRet = -1;
- else
- nRet = bSumOk;
- break;
- case PIVOT_FUNC_PRODUCT:
- if (nCount2 == 0)
- nRet = -1;
- else
- nRet = bProductOk;
- break;
- default:
- nRet = 1;
- break;
- }
- return nRet;
-}
-
-
-double SubTotal::Result( USHORT nFunction ) const
-{
- double nRet = 0.0;
- switch (nFunction)
- {
- case PIVOT_FUNC_COUNT: nRet = (double) nCount; break;
- case PIVOT_FUNC_COUNT_NUM: nRet = (double) nCount2; break;
- case PIVOT_FUNC_SUM: nRet = nSum; break;
- case PIVOT_FUNC_MAX: nRet = nMax; break;
- case PIVOT_FUNC_MIN: nRet = nMin; break;
- case PIVOT_FUNC_PRODUCT: nRet = nProduct; break;
- case PIVOT_FUNC_AVERAGE:
- if (nCount2 > 0)
- nRet = nSum / (double) nCount2;
- break;
- case PIVOT_FUNC_STD_DEV:
- if (nCount2 > 1)
- nRet = sqrt((nSumSqr - nSum*nSum/(double)(nCount2))
- / (double)(nCount2-1));
- break;
- case PIVOT_FUNC_STD_DEVP:
- if (nCount2 > 0)
- nRet = sqrt((nSumSqr - nSum*nSum/(double)(nCount2))
- / (double)nCount2);
- break;
- case PIVOT_FUNC_STD_VAR:
- if (nCount2 > 1)
- nRet = (nSumSqr - nSum*nSum/(double)(nCount2))
- / (double)(nCount2-1);
- break;
- case PIVOT_FUNC_STD_VARP:
- if (nCount2 > 0)
- nRet = (nSumSqr - nSum*nSum/(double)(nCount2))
- / (double)(nCount2);
- break;
- default:
- DBG_ERROR("unbekannte Funktion bei SubTotal::Result");
- }
- return nRet;
-}
-#endif
-
BOOL SubTotal::SafePlus(double& fVal1, double fVal2)
{
BOOL bOk = TRUE;
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 0f03d31d3fc8..6c5c6a03b773 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -119,7 +119,7 @@ IMPL_FIXEDMEMPOOL_NEWDEL( ImpTokenIterator, 32, 16 )
// Align MemPools on 4k boundaries - 64 bytes (4k is a MUST for OS/2)
// Since RawTokens are temporary for the compiler, don't align on 4k and waste memory.
-// ScRawToken size is FixMembers + MAXSTRLEN ~= 264
+// ScRawToken size is FixMembers + MAXSTRLEN + ~4 ~= 1036
IMPL_FIXEDMEMPOOL_NEWDEL( ScRawToken, 8, 4 )
// Some ScDoubleRawToken, FixMembers + sizeof(double) ~= 16
const USHORT nMemPoolDoubleRawToken = 0x0400 / sizeof(ScDoubleRawToken);
diff --git a/sc/source/core/tool/userlist.cxx b/sc/source/core/tool/userlist.cxx
index bc3537d1c94a..24dd852c6a5f 100644
--- a/sc/source/core/tool/userlist.cxx
+++ b/sc/source/core/tool/userlist.cxx
@@ -153,7 +153,7 @@ StringCompare ScUserListData::Compare(const String& rSubStr1, const String& rSub
else if (bFound2)
return COMPARE_GREATER;
else
- return (StringCompare) ScGlobal::pCaseTransliteration->compareString( rSubStr1, rSubStr2 );
+ return (StringCompare) ScGlobal::GetCaseTransliteration()->compareString( rSubStr1, rSubStr2 );
}
StringCompare ScUserListData::ICompare(const String& rSubStr1, const String& rSubStr2) const
@@ -179,7 +179,7 @@ StringCompare ScUserListData::ICompare(const String& rSubStr1, const String& rSu
else if (bFound2)
return COMPARE_GREATER;
else
- return (StringCompare) ScGlobal::pTransliteration->compareString( rSubStr1, rSubStr2 );
+ return (StringCompare) ScGlobal::GetpTransliteration()->compareString( rSubStr1, rSubStr2 );
}
ScUserList::ScUserList(USHORT nLim, USHORT nDel) :
diff --git a/sc/source/filter/excel/biffdump.cxx b/sc/source/filter/excel/biffdump.cxx
deleted file mode 100644
index c3478cf8cb50..000000000000
--- a/sc/source/filter/excel/biffdump.cxx
+++ /dev/null
@@ -1,9864 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: biffdump.cxx,v $
- * $Revision: 1.91 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sc.hxx"
-#include "biffdump.hxx"
-
-#if EXC_INCL_DUMPER
-#include <tools/stream.hxx>
-#include <sfx2/docfile.hxx>
-#include <sfx2/objsh.hxx>
-#include <sot/storinfo.hxx>
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include <rtl/math.hxx>
-#include "document.hxx"
-#include "global.hxx"
-#include "fprogressbar.hxx"
-#include "xlpivot.hxx"
-#include "xicontent.hxx"
-#include "imp_op.hxx"
-
-#define GETSTR(s) ByteString( s, RTL_TEXTENCODING_MS_1252 )
-
-static const sal_Char* __pHexPrefix = "0x";
-static const sal_Char* __pBinPrefix = "0b";
-static const sal_Char* pU = "UNKNOWN ";
-
-const sal_Char* Biff8RecDumper::pLevelPreString = " ";
-const sal_Char* Biff8RecDumper::pLevelPreStringNT = pLevelPreString + strlen( pLevelPreString );
-UINT32 Biff8RecDumper::nInstances = 0;
-sal_Char* Biff8RecDumper::pBlankLine = NULL;
-const UINT16 Biff8RecDumper::nLenBlankLine = 255;
-const UINT16 Biff8RecDumper::nRecCnt = 0x2020;
-UINT8* Biff8RecDumper::pCharType = NULL;
-UINT8* Biff8RecDumper::pCharVal = NULL;
-
-static const UINT16 nLevelInc = 1;
-
-static UINT16 nXFCount = 0;
-
-static UINT16 nSXLISize[2] = {0, 0}; // array size for SXLI records [rows/cols]
-static UINT16 nSXLIIndex = 0; // current index for SXLI records
-
-// ============================================================================
-
-namespace {
-
-// decimal --------------------------------------------------------------------
-
-inline void lclAppendDec( ByteString& rStr, sal_uInt8 nData )
-{
- rStr.Append( ByteString::CreateFromInt32( nData ) );
-}
-
-inline void lclAppendDec( ByteString& rStr, sal_Int8 nData )
-{
- rStr.Append( ByteString::CreateFromInt32( nData ) );
-}
-
-inline void lclAppendDec( ByteString& rStr, sal_uInt16 nData )
-{
- rStr.Append( ByteString::CreateFromInt32( nData ) );
-}
-
-inline void lclAppendDec( ByteString& rStr, sal_Int16 nData )
-{
- rStr.Append( ByteString::CreateFromInt32( nData ) );
-}
-
-inline void lclAppendDec( ByteString& rStr, sal_uInt32 nData )
-{
- rStr.Append( ByteString::CreateFromInt64( nData ) );
-}
-
-inline void lclAppendDec( ByteString& rStr, sal_Int32 nData )
-{
- rStr.Append( ByteString::CreateFromInt32( nData ) );
-}
-
-inline void lclAppendDec( ByteString& rStr, float fData )
-{
- rStr.Append( ByteString( ::rtl::math::doubleToString( fData, rtl_math_StringFormat_G, 15, '.', true ) ) );
-}
-
-inline void lclAppendDec( ByteString& rStr, double fData )
-{
- rStr.Append( ByteString( ::rtl::math::doubleToString( fData, rtl_math_StringFormat_G, 15, '.', true ) ) );
-}
-
-// hexadecimal ----------------------------------------------------------------
-
-void lclAppendHex( ByteString& rStr, sal_uInt8 nData, bool bPrefix = true )
-{
- static const sal_Char spcHexDigits[] = "0123456789ABCDEF";
- static const ByteString saPrefix( "0x" );
-
- if( bPrefix )
- rStr.Append( saPrefix );
- rStr.Append( spcHexDigits[ (nData >> 4) & 0x0F ] ).Append( spcHexDigits[ nData & 0x0F ] );
-}
-
-inline void lclAppendHex( ByteString& rStr, sal_Int8 nData, bool bPrefix = true )
-{
- lclAppendHex( rStr, static_cast< sal_uInt8 >( nData ), bPrefix );
-}
-
-void lclAppendHex( ByteString& rStr, sal_uInt16 nData, bool bPrefix = true )
-{
- lclAppendHex( rStr, static_cast< sal_uInt8 >( nData >> 8 ), bPrefix );
- lclAppendHex( rStr, static_cast< sal_uInt8 >( nData ), false );
-}
-
-inline void lclAppendHex( ByteString& rStr, sal_Int16 nData, bool bPrefix = true )
-{
- lclAppendHex( rStr, static_cast< sal_uInt16 >( nData ), bPrefix );
-}
-
-void lclAppendHex( ByteString& rStr, sal_uInt32 nData, bool bPrefix = true )
-{
- lclAppendHex( rStr, static_cast< sal_uInt16 >( nData >> 16 ), bPrefix );
- lclAppendHex( rStr, static_cast< sal_uInt16 >( nData ), false );
-}
-
-inline void lclAppendHex( ByteString& rStr, sal_Int32 nData, bool bPrefix = true )
-{
- lclAppendHex( rStr, static_cast< sal_uInt32 >( nData ), bPrefix );
-}
-
-inline void lclAppendHex( ByteString& rStr, double fData, bool bPrefix = true )
-{
- const sal_uInt32* pnData = reinterpret_cast< const sal_uInt32* >( &fData );
- lclAppendHex( rStr, pnData[ 0 ], bPrefix );
- lclAppendHex( rStr, pnData[ 1 ], false );
-}
-
-// others ---------------------------------------------------------------------
-
-void lclAppendGuid( ByteString& rStr, const XclGuid& rGuid )
-{
- lclAppendHex( rStr, SVBT32ToUInt32( rGuid.mpnData ), false );
- rStr.Append( '-' );
- lclAppendHex( rStr, SVBT16ToShort( rGuid.mpnData + 4 ), false );
- rStr.Append( '-' );
- lclAppendHex( rStr, SVBT16ToShort( rGuid.mpnData + 6 ), false );
- rStr.Append( '-' );
- lclAppendHex( rStr, rGuid.mpnData[ 8 ], false );
- lclAppendHex( rStr, rGuid.mpnData[ 9 ], false );
- rStr.Append( '-' );
- lclAppendHex( rStr, rGuid.mpnData[ 10 ], false );
- lclAppendHex( rStr, rGuid.mpnData[ 11 ], false );
- lclAppendHex( rStr, rGuid.mpnData[ 12 ], false );
- lclAppendHex( rStr, rGuid.mpnData[ 13 ], false );
- lclAppendHex( rStr, rGuid.mpnData[ 14 ], false );
- lclAppendHex( rStr, rGuid.mpnData[ 15 ], false );
-}
-
-} // namespace
-
-// ============================================================================
-
-static void __AddHexNibble( ByteString& r, UINT8 nVal )
-{
- const sal_Char pH[] = "0123456789ABCDEF";
-
- nVal &= 0x0F;
-
- r += pH[ nVal ];
-}
-
-
-static void __AddPureHex( ByteString& r, UINT8 nVal )
-{
- __AddHexNibble( r, nVal >> 4 );
- __AddHexNibble( r, nVal );
-}
-
-
-static void __AddHex( ByteString& r, UINT8 nVal )
-{
- r += __pHexPrefix;
- __AddHexNibble( r, nVal >> 4 );
- __AddHexNibble( r, nVal );
-}
-
-
-static void __AddPureHex( ByteString& r, UINT16 nVal )
-{
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 12 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 8 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 4 ) );
- __AddHexNibble( r, ( UINT8 ) nVal );
-}
-
-
-static void __AddHex( ByteString& r, UINT16 nVal )
-{
- r += __pHexPrefix;
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 12 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 8 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 4 ) );
- __AddHexNibble( r, ( UINT8 ) nVal );
-}
-
-
-static void __AddPureHex( ByteString& r, UINT32 nVal )
-{
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 28 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 24 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 20 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 16 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 12 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 8 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 4 ) );
- __AddHexNibble( r, ( UINT8 ) nVal );
-}
-
-
-static void __AddHex( ByteString& r, UINT32 nVal )
-{
- r += __pHexPrefix;
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 28 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 24 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 20 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 16 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 12 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 8 ) );
- __AddHexNibble( r, ( UINT8 ) ( nVal >> 4 ) );
- __AddHexNibble( r, ( UINT8 ) nVal );
-}
-
-
-static void __AddHex( ByteString& r, INT32 nVal )
-{
- __AddHex( r, (UINT32) nVal );
-}
-
-
-static void __AddPureBinNibble( ByteString& r, UINT8 nVal )
-{
- nVal <<= 4;
- for( int n = 4 ; n ; n-- )
- {
- r += ( nVal & 0x80 )? "1" : "0";
- nVal <<= 1;
- }
-}
-
-
-static void __AddPureBin( ByteString& r, UINT8 nVal )
-{
- __AddPureBinNibble( r, nVal >> 4 );
- r += " ";
- __AddPureBinNibble( r, nVal );
-}
-
-
-static void __AddPureBin( ByteString& r, UINT16 nVal )
-{
- const sal_Char* pIn = " ";
- __AddPureBin( r, ( UINT8 ) ( nVal >> 8 ) );
- r += pIn;
- __AddPureBin( r, ( UINT8 ) nVal );
-}
-
-
-static void __AddPureBin( ByteString& r, UINT32 nVal )
-{
- const sal_Char* pIn = " ";
- __AddPureBin( r, ( UINT8 ) ( nVal >> 24 ) );
- r += pIn;
- __AddPureBin( r, ( UINT8 ) ( nVal >> 16 ) );
- r += pIn;
- __AddPureBin( r, ( UINT8 ) ( nVal >> 8 ) );
- r += pIn;
- __AddPureBin( r, ( UINT8 ) nVal );
-}
-
-
-inline static void __AddDec( ByteString& r, UINT32 n )
-{
- sal_Char p[ 32 ];
- sprintf( p, "%u", n ); // #100211# - checked
- r += p;
-}
-
-
-inline static void __AddDec( ByteString& r, UINT16 n )
-{
- __AddDec( r, ( UINT32 ) n );
-}
-
-
-inline static void __AddDec( ByteString& r, UINT8 n )
-{
- __AddDec( r, ( UINT32 ) n );
-}
-
-
-inline static void __AddDec( ByteString& r, INT32 n )
-{
- sal_Char p[ 32 ];
- sprintf( p, "%d", n ); // #100211# - checked
- r += p;
-}
-
-
-inline static void __AddDec( ByteString& r, INT16 n )
-{
- __AddDec( r, ( INT32 ) n );
-}
-
-inline static void __AddDec( ByteString& r, sal_Int8 n )
-{
- __AddDec( r, ( INT32 ) n );
-}
-
-
-static void __AddDec( ByteString& r, UINT32 nVal, UINT16 nNumOfDig, sal_Char c = ' ' )
-{
- ByteString t;
- ByteString aVal;
- __AddDec( aVal, nVal );
- if( nNumOfDig > (UINT16) aVal.Len() )
- t.Fill( nNumOfDig - (UINT16) aVal.Len(), c );
- r += t;
- r += aVal;
-}
-
-
-inline static void __AddDec1616( ByteString& r, UINT32 n )
-{
- __AddDec( r, (UINT16)(n >> 16) );
- r += '.';
- __AddDec( r, (UINT16)(n & 0xFFFF) );
-}
-
-
-static void __AddDouble( ByteString& r, const double f )
-{
- r += ByteString( ::rtl::math::doubleToString( f, rtl_math_StringFormat_G, 15, '.', TRUE ) );
-}
-
-
-static inline void __AddRK( ByteString& rString, sal_Int32 nRKValue )
-{
- __AddDouble( rString, XclTools::GetDoubleFromRK( nRKValue ) );
-}
-
-
-inline static void __Add16p16( ByteString& r, UINT32 n )
-{
- __AddDouble( r, double(n) / 65536.0 );
-}
-
-
-static void lcl_AddRef( ByteString& rStr, sal_uInt16 nCol, sal_uInt16 nRow )
-{
- ScAddress aRef( static_cast< SCCOL >( nCol ), static_cast< SCROW >( nRow ), 0 );
- rStr.Append( GETSTR( aRef.GetColRowString() ) );
-}
-
-
-static void lcl_AddRangeRef( ByteString& rStr, sal_uInt16 nCol1, sal_uInt16 nRow1, sal_uInt16 nCol2, sal_uInt16 nRow2 )
-{
- lcl_AddRef( rStr, nCol1, nRow1 );
- if( (nCol1 != nCol2) || (nRow1 != nRow2) )
- {
- rStr.Append( ':' );
- lcl_AddRef( rStr, nCol2, nRow2 );
- }
-}
-
-
-static void __AddCellHead( ByteString& r, const UINT16 nC, const UINT16 nR, const UINT16 nXF )
-{
- lcl_AddRef( r, (UINT8) nC, nR );
- r += " (XF=";
- __AddDec( r, nXF );
- r += ')';
-}
-
-
-inline static void lcl_AddFlag(
- ByteString& rString, bool bFlag, const sal_Char* pcTrue = "true", const sal_Char* pcFalse = "false" )
-{
- rString += (bFlag ? pcTrue : pcFalse);
-}
-
-inline static void lcl_AddOnOff( ByteString& rString, bool bFlag )
-{
- lcl_AddFlag( rString, bFlag, "on", "off" );
-}
-
-
-static void lcl_AddEnum(
- ByteString& rString, long nValue, const sal_Char* const ppcEnums[], long nSize,
- const sal_Char* pcDefault = 0, long nOffset = 0 )
-{
- nValue -= nOffset;
- const sal_Char* pcText = "!unknown!";
- if( (0 <= nValue) && (nValue < nSize) && ppcEnums[ nValue ] )
- pcText = ppcEnums[ nValue ];
- else if( pcDefault )
- pcText = pcDefault;
- if( *pcText ) // nonempty string
- rString.Append( " (" ).Append( pcText ).Append( ')' );
-}
-
-
-namespace {
-
-void lclDumpString( SvStream& rOutStrm, const ByteString& rData )
-{
- ByteString aOutStr;
- xub_StrLen nIdx = 0;
- for( ; (nIdx < rData.Len()) && (aOutStr.Len() < 80); ++nIdx )
- {
- sal_Char cChar = rData.GetChar( nIdx );
- if( 32 <= cChar )
- aOutStr.Append( cChar );
- else
- {
- aOutStr.Append( '<' );
- __AddHex( aOutStr, static_cast< sal_uInt8 >( cChar ) );
- aOutStr.Append( '>' );
- }
- }
- rOutStrm << aOutStr.GetBuffer();
- if( nIdx < rData.Len() )
- rOutStrm << "<...>";
-}
-
-void lclDumpStringValue( SvStream& rOutStrm, const ByteString& rName, const ByteString& rData )
-{
- rOutStrm << rName.GetBuffer() << "='";
- lclDumpString( rOutStrm, rData );
- rOutStrm << '\'';
-}
-
-void lclDumpString( SvStream& rOutStrm, const String& rData )
-{
- ByteString aOutStr;
- xub_StrLen nIdx = 0;
- for( ; (nIdx < rData.Len()) && (aOutStr.Len() < 80); ++nIdx )
- {
- sal_Unicode cChar = rData.GetChar( nIdx );
- if( (32 <= cChar) && (cChar <= 255) )
- aOutStr.Append( static_cast< sal_Char >( cChar ) );
- else
- {
- aOutStr.Append( '<' );
- if( cChar < 256 )
- __AddHex( aOutStr, static_cast< sal_uInt8 >( cChar ) );
- else
- __AddHex( aOutStr, static_cast< sal_uInt16 >( cChar ) );
- aOutStr.Append( '>' );
- }
- }
- rOutStrm << aOutStr.GetBuffer();
- if( nIdx < rData.Len() )
- rOutStrm << "<...>";
-}
-
-void lclDumpStringValue( SvStream& rOutStrm, const ByteString& rName, const String& rData )
-{
- rOutStrm << rName.GetBuffer() << "='";
- lclDumpString( rOutStrm, rData );
- rOutStrm << '\'';
-}
-
-} // namespace
-
-
-IdRangeList::~IdRangeList()
-{
- Clear();
-}
-
-
-void IdRangeList::Clear( void )
-{
- IdRange* p = ( IdRange* ) First();
-
- while( p )
- {
- delete p;
- p = ( IdRange* ) Next();
- }
-
- List::Clear();
-}
-
-// ============================================================================
-//
-// H E L P E R O B J E C T S
-//
-// ============================================================================
-
-namespace {
-
-// ----------------------------------------------------------------------------
-
-class XclDumpStreamHeader
-{
-public:
- explicit XclDumpStreamHeader( SvStream& rInStrm, SvStream& rOutStrm, const String& rStrmName, const String& rStrmPath );
- ~XclDumpStreamHeader();
- inline ULONG GetStreamLen() const { return mnStrmLen; }
-
-private:
- SvStream& mrOutStrm;
- String maStrmName;
- String maStrmPath;
- ByteString maSeparator;
- ULONG mnStrmLen;
-};
-
-XclDumpStreamHeader::XclDumpStreamHeader( SvStream& rInStrm, SvStream& rOutStrm, const String& rStrmName, const String& rStrmPath ) :
- mrOutStrm( rOutStrm ),
- maStrmName( rStrmName ),
- maStrmPath( rStrmPath ),
- mnStrmLen( 0 )
-{
- maSeparator.Assign( '+' ).Expand( 78, '-' );
-
- rInStrm.Seek( STREAM_SEEK_TO_END );
- mnStrmLen = rInStrm.Tell();
- rInStrm.Seek( STREAM_SEEK_TO_BEGIN );
-
- ByteString aLine;
- lclAppendDec( aLine, mnStrmLen );
-
- mrOutStrm << maSeparator.GetBuffer() << "\n";
- mrOutStrm << "| STREAM-BEGIN\n";
- mrOutStrm << "| ";
- lclDumpStringValue( mrOutStrm, "stream-name", maStrmName );
- mrOutStrm << "\n| ";
- lclDumpStringValue( mrOutStrm, "stream-path", maStrmPath );
- mrOutStrm << "\n| stream-len=" << aLine.GetBuffer() << "\n";
- mrOutStrm << "|\n\n";
-}
-
-XclDumpStreamHeader::~XclDumpStreamHeader()
-{
- mrOutStrm << "|\n";
- mrOutStrm << "| ";
- lclDumpStringValue( mrOutStrm, "stream-name", maStrmName );
- mrOutStrm << "\n| ";
- lclDumpStringValue( mrOutStrm, "stream-path", maStrmPath );
- mrOutStrm << "\n";
- mrOutStrm << "| STREAM-END\n";
- mrOutStrm << maSeparator.GetBuffer() << "\n\n";
-}
-
-// ----------------------------------------------------------------------------
-
-class XclDumpStorageHeader
-{
-public:
- explicit XclDumpStorageHeader( SotStorage& rInStrg, SvStream& rOutStrm, const String& rStrgPath );
- ~XclDumpStorageHeader();
-
-private:
- SvStream& mrOutStrm;
- String maStrgName;
- String maStrgPath;
- ByteString maSeparator;
-};
-
-XclDumpStorageHeader::XclDumpStorageHeader( SotStorage& rInStrg, SvStream& rOutStrm, const String& rStrgPath ) :
- mrOutStrm( rOutStrm ),
- maStrgName( rInStrg.GetName() ),
- maStrgPath( rStrgPath )
-{
- maSeparator.Assign( "++" ).Expand( 78, '=' );
-
- mrOutStrm << maSeparator.GetBuffer() << "\n";
- mrOutStrm << "|| STORAGE-BEGIN\n";
- mrOutStrm << "|| ";
- lclDumpStringValue( mrOutStrm, "storage-name", maStrgName );
- mrOutStrm << "\n|| ";
- lclDumpStringValue( mrOutStrm, "storage-path", maStrgPath );
- mrOutStrm << "\n";
-
- SvStorageInfoList aInfoList;
- rInStrg.FillInfoList( &aInfoList );
- ByteString aLine;
- lclAppendDec( aLine, aInfoList.Count() );
- mrOutStrm << "|| directory-size=" << aLine.GetBuffer() << "\n";
-
- for( ULONG nInfo = 0; nInfo < aInfoList.Count(); ++nInfo )
- {
- SvStorageInfo& rInfo = aInfoList.GetObject( nInfo );
- mrOutStrm << "|| type=";
- if( rInfo.IsStream() )
- mrOutStrm << "stream ";
- else if( rInfo.IsStorage() )
- mrOutStrm << "storage ";
- else
- mrOutStrm << "unknown ";
- lclDumpStringValue( mrOutStrm, "name", rInfo.GetName() );
- mrOutStrm << "\n";
- }
-
- mrOutStrm << "||\n\n";
-}
-
-XclDumpStorageHeader::~XclDumpStorageHeader()
-{
- mrOutStrm << "||\n";
- mrOutStrm << "|| ";
- lclDumpStringValue( mrOutStrm, "storage-name", maStrgName );
- mrOutStrm << "\n|| ";
- lclDumpStringValue( mrOutStrm, "storage-path", maStrgPath );
- mrOutStrm << "\n";
- mrOutStrm << "|| STORAGE-END\n";
- mrOutStrm << maSeparator.GetBuffer() << "\n\n";
-}
-
-// ----------------------------------------------------------------------------
-
-}
-
-// ============================================================================
-//
-// ============================================================================
-
-void Biff8RecDumper::Print( const ByteString& r )
-{
- DBG_ASSERT( pDumpStream, "-Biff8RecDumper::Print(): Stream is wech!" );
- *pDumpStream << '\n' << pLevelPre;
- pDumpStream->Write( r.GetBuffer(), r.Len() );
-}
-
-
-void Biff8RecDumper::Print( const sal_Char* p )
-{
- DBG_ASSERT( pDumpStream, "-Biff8RecDumper::Print(): Stream is wech!" );
- DBG_ASSERT( p, "-Biff8RecDumper::Print(): ByteString is wech!" );
-
- *pDumpStream << '\n' << pLevelPre << p;
-}
-
-
-static const sal_Char* GetSeriesType( const UINT16 n )
-{
- const sal_Char* p;
-
- switch( n )
- {
- case 0: p = "(date) "; break;
- case 1: p = "(numeric) "; break;
- case 2: p = "(sequence)"; break;
- case 3: p = "(text) "; break;
- default: p = "(unknown) ";
- }
-
- return p;
-}
-
-
-static const sal_Char* GetLineType( const UINT16 n )
-{
- const sal_Char* p;
-
- switch( n )
- {
- case 0: p = "solid"; break;
- case 1: p = "dash"; break;
- case 2: p = "dot"; break;
- case 3: p = "dash-dot"; break;
- case 4: p = "dash-dot-dot"; break;
- case 5: p = "none"; break;
- case 6: p = "dark gray pattern"; break;
- case 7: p = "medium gray pattern"; break;
- case 8: p = "light gray pattern"; break;
- default: p = pU;
- }
-
- return p;
-}
-
-
-static ByteString GetRGB( const UINT32 n )
-{
- ByteString s;
-
- s += "R";
- __AddDec( s, ( UINT8 ) n );
- s += " G";
- __AddDec( s, ( UINT8 ) ( n >> 8 ) );
- s += " B";
- __AddDec( s, ( UINT8 ) ( n >> 16 ) );
-
- return s;
-}
-
-
-static void AddRef( ByteString& t, UINT16 nRow, UINT16 nC, BOOL bName, UINT16 nTab = 0xFFFF )
-{
- BOOL bColRel = ( nC & 0x4000 ) != 0;
- BOOL bRowRel = ( nC & 0x8000 ) != 0;
- UINT8 nCol = (UINT8) nC;
- INT8 nRelCol = (INT8) nCol;
- INT16 nRelRow = (INT16) nRow;
-
- if( nTab < 0xFFFF )
- {
- t += "XTI(";
- __AddDec( t, nTab );
- t += ")!";
- }
-
- if( bName )
- {
- // dump relative: [Column|Row]
- // [C-1,R-1] = one column left, one row up
- // [C+1,R+1] = one column right, one row down
- // [C,R] = same column/row
- // [C=B,R=2] = absolute column B/row 2
- t += "[C";
- if( bColRel )
- {
- if( nRelCol > 0 )
- t += '+';
- if( nRelCol != 0 )
- __AddDec( t, (INT16)nRelCol );
- }
- else
- {
- t += '=';
- t += GETSTR( ::ScScColToAlpha( nCol ) );
- }
-
- t += ",R";
- if( bRowRel )
- {
- if( nRelRow > 0 )
- t += "+";
- if( nRelRow != 0 )
- __AddDec( t, nRelRow );
- }
- else
- {
- t += '=';
- __AddDec( t, (INT32)nRow + 1 );
- }
- t += ']';
- }
- else
- {
- if( !bColRel )
- t += '$';
- t += GETSTR( ::ScColToAlpha( nCol ) );
- if( !bRowRel )
- t += '$';
- __AddDec( t, (UINT16)(nRow + 1) );
- }
-}
-
-static void AddRangeRef( ByteString& t, UINT16 nRow1, UINT16 nC1, UINT16 nRow2, UINT16 nC2, BOOL bName, UINT16 nTab = 0xFFFF )
-{
- AddRef( t, nRow1, nC1, bName, nTab );
- if( (nRow1 != nRow2) || (nC1 != nC2) )
- {
- t += ':';
- AddRef( t, nRow2, nC2, bName );
- }
-}
-
-
-
-static BOOL AddUNICODEString( ByteString& rStr, XclImpStream& rStrm, const BOOL b16BitLen = TRUE, UINT16 nLen = 0, ByteString* pRawName = 0 )
-{
- BOOL bRet = TRUE;
-
- if( !nLen )
- nLen = b16BitLen ? rStrm.ReaduInt16() : rStrm.ReaduInt8();
- UINT8 nGrbit = rStrm.ReaduInt8();
-
- UINT32 nExtLen;
- UINT16 nCrun;
- bool b16Bit, bFarEast, bRichString;
- rStrm.ReadUniStringExtHeader( b16Bit, bRichString, bFarEast, nCrun, nExtLen, nGrbit );
-
- rStr += "(l=";
- __AddDec( rStr, nLen );
- rStr += " f=";
- __AddHex( rStr, nGrbit );
- rStr += " ";
- rStr += b16Bit ? "16-Bit" : "8-Bit";
-
- if( bRichString && bFarEast )
- rStr += " rich far-east";
- else if( bRichString && !bFarEast )
- rStr += " rich";
- else if ( !bRichString && bFarEast )
- rStr += " far-east";
- rStr += ") '";
-
- ByteString aData( rStrm.ReadRawUniString( nLen, b16Bit ), RTL_TEXTENCODING_MS_1252 );
- if( pRawName ) *pRawName = aData;
-
- xub_StrLen nIndex = 0;
- while( (nIndex < aData.Len()) && (nIndex < 255) )
- {
- UINT8 nChar = (UINT8)aData.GetChar( nIndex );
- if( nChar < ' ' )
- {
- ByteString aIns( '<' );
- __AddHex( aIns, nChar );
- aIns += '>';
- aData.Erase( nIndex, 1 ).Insert( aIns, nIndex );
- nIndex += 5;
- }
- nIndex++;
- }
-
- rStr += aData.Copy( 0, 255 );
- rStr += '\'';
- if( aData.Len() > 255 )
- rStr += "...";
-
- if( nCrun )
- {
- rStr += " + ";
- __AddDec( rStr, nCrun );
- rStr += " format blocks (";
- nCrun *= 4;
- __AddDec( rStr, nCrun );
- rStr += " bytes)";
- rStrm.Ignore( nCrun );
- }
- if( nExtLen )
- {
- rStr += " + ";
- __AddDec( rStr, nExtLen );
- rStr += " byte extended:";
- for( sal_uInt32 nIdx = 0; rStrm.IsValid() && (nIdx < nExtLen); ++nIdx )
- {
- rStr.Append( ' ' );
- __AddPureHex( rStr, rStrm.ReaduInt8() );
- }
- }
-
- return bRet;
-}
-
-
-DUMP_ERR::~DUMP_ERR()
-{
- if( pHint )
- delete pHint;
-}
-
-
-
-
-#define Read1(rIn) (rIn).ReaduInt8()
-#define Read2(rIn) (rIn).ReaduInt16()
-#define Read4(rIn) (rIn).ReaduInt32()
-#define Read8(rIn) (rIn).ReadDouble()
-#define LINESTART() {t.Erase();t+=pPre;}
-#define IGNORE(n) rIn.Ignore(n)
-#define ADDBIN(n) __AddBin( t, Read##n( rIn ) )
-#define ADDHEX(n) __AddHex( t, Read##n( rIn ) )
-#define ADDDEC(n) __AddDec( t, Read##n( rIn ) )
-#define ADDDOUBLE() __AddDouble( t, rIn.ReadDouble() )
-#define ADD16P16() __Add16p16( t, Read4( rIn ) )
-#define ADDTEXT(T) t += T
-#define PRINT() Print( t )
-#define PreDump(LEN) {rIn.PushPosition();ContDump(LEN);rIn.PopPosition();}
-#define ADDCELLHEAD() {UINT16 nR,nC,nX;rIn>>nR>>nC>>nX;__AddCellHead(t,nC,nR,nX);}
-#define STARTFLAG() {ADDTEXT( "flags=" ); __AddHex( t, __nFlags ); ADDTEXT( " " );}
-#define ADDFLAG(mask,text) {if( __nFlags & mask ) t.Append( ' ' ).Append( text );}
-#define ADDRESERVED(mask) ADDFLAG(mask,"!RESERVED!")
-
-
-UINT16 Biff8RecDumper::DumpXF( XclImpStream& rStrm, const sal_Char* pPre )
-{
- ByteString t; // "t" needed by macros
-
- sal_uInt32 nBorder1, nBorder2;
- sal_uInt16 nFont, nNumFmt, nTypeProt, nAlign, nMiscAttrib, nArea, __nFlags, nTmp;
- rStrm >> nFont >> nNumFmt >> nTypeProt >> nAlign >> nMiscAttrib >> nBorder1 >> nBorder2 >> nArea;
- bool bCell = !::get_flag( nTypeProt, EXC_XF_STYLE );
-
- // XF type/parent
- LINESTART();
- ::extract_value( nTmp, nTypeProt, 4, 12 );
- ADDTEXT( "index=#" ); __AddDec( t, nXFCount++ );
- ADDTEXT( " type=" ); lcl_AddFlag( t, bCell, "cell", "style" );
- ADDTEXT( " parent-xf=#" ); __AddDec( t, nTmp );
- PRINT();
-
- // attribute used flags
- LINESTART();
- ::extract_value( __nFlags, nMiscAttrib, 10, 6 );
- if( !bCell ) __nFlags ^= 0x3F; // in style XFs a 0 means used
- ADDTEXT( "used " ); STARTFLAG();
- ADDFLAG( EXC_XF_DIFF_VALFMT, "numfmt" );
- ADDFLAG( EXC_XF_DIFF_FONT, "font" );
- ADDFLAG( EXC_XF_DIFF_ALIGN, "align" );
- ADDFLAG( EXC_XF_DIFF_BORDER, "border" );
- ADDFLAG( EXC_XF_DIFF_AREA, "area" );
- ADDFLAG( EXC_XF_DIFF_PROT, "prot" );
- PRINT();
-
- // cell protection/font/number format
- LINESTART();
- ADDTEXT( "cell-lock=" ); lcl_AddOnOff( t, ::get_flag( nTypeProt, EXC_XF_LOCKED ) );
- ADDTEXT( " hidden=" ); lcl_AddOnOff( t, ::get_flag( nTypeProt, EXC_XF_HIDDEN ) );
- ADDTEXT( " font=" ); __AddDec( t, nFont );
- ADDTEXT( " num-fmt=" ); __AddDec( t, nNumFmt );
- PRINT();
-
- // alignment
- LINESTART();
- ::extract_value( nTmp, nAlign, 0, 3 );
- ADDTEXT( "hor-align=" ); __AddDec( t, nTmp );
- ADDTEXT( " (" );
- switch( nTmp )
- {
- case EXC_XF_HOR_GENERAL: ADDTEXT( "general" ); break;
- case EXC_XF_HOR_LEFT: ADDTEXT( "left" ); break;
- case EXC_XF_HOR_CENTER: ADDTEXT( "center" ); break;
- case EXC_XF_HOR_RIGHT: ADDTEXT( "right" ); break;
- case EXC_XF_HOR_FILL: ADDTEXT( "fill" ); break;
- case EXC_XF_HOR_JUSTIFY: ADDTEXT( "justify" ); break;
- case EXC_XF_HOR_CENTER_AS: ADDTEXT( "center-as" ); break;
- case EXC_XF_HOR_DISTRIB: ADDTEXT( "distrib" ); break;
- default: ADDTEXT( "!unknown!" );
- };
- ::extract_value( nTmp, nAlign, 4, 3 );
- ADDTEXT( ") ver-align=" ); __AddDec( t, nTmp );
- ADDTEXT( " (" );
- switch( nTmp )
- {
- case EXC_XF_VER_TOP: ADDTEXT( "top" ); break;
- case EXC_XF_VER_CENTER: ADDTEXT( "center" ); break;
- case EXC_XF_VER_BOTTOM: ADDTEXT( "bottom" ); break;
- case EXC_XF_VER_JUSTIFY: ADDTEXT( "justify" ); break;
- case EXC_XF_VER_DISTRIB: ADDTEXT( "distrib" ); break;
- default: ADDTEXT( "!unknown!" );
- };
- ADDTEXT( ") text-wrap=" ); lcl_AddOnOff( t, ::get_flag( nAlign, EXC_XF_LINEBREAK ) );
- PRINT();
-
- LINESTART();
- ::extract_value( nTmp, nAlign, 8, 8 );
- ADDTEXT( "rotation=" ); __AddDec( t, nTmp );
- ADDTEXT( " (" );
- if( nTmp < 91 )
- { __AddDec( t, nTmp ); ADDTEXT( "\xB0" ); }
- else if( nTmp < 181 )
- { __AddDec( t, static_cast< sal_Int32 >( 90 - nTmp ) ); ADDTEXT( "\xB0" ); }
- else if( nTmp == EXC_ROT_STACKED )
- { ADDTEXT( "stacked" ); }
- else
- { ADDTEXT( "!unknown!" ); }
- ::extract_value( nTmp, nMiscAttrib, 0, 4 );
- ADDTEXT( ") indent=" ); __AddDec( t, nTmp );
- ADDTEXT( " shrink=" ); lcl_AddOnOff( t, ::get_flag( nMiscAttrib, EXC_XF8_SHRINK ) );
- ::extract_value( nTmp, nMiscAttrib, 6, 2 );
- ADDTEXT( " text-dir=" ); __AddDec( t, nTmp );
- ADDTEXT( " (" );
- switch( nTmp )
- {
- case EXC_XF_TEXTDIR_CONTEXT: ADDTEXT( "context" ); break;
- case EXC_XF_TEXTDIR_LTR: ADDTEXT( "ltr" ); break;
- case EXC_XF_TEXTDIR_RTL: ADDTEXT( "rtl" ); break;
- default: ADDTEXT( "!unknown!" );
- };
- ADDTEXT( ")" );
- PRINT();
-
- // border/area
- LINESTART();
- ::extract_value( nTmp, nBorder1, 0, 4 );
- ADDTEXT( "left-line=" ); __AddDec( t, nTmp );
- ::extract_value( nTmp, nBorder1, 16, 7 );
- ADDTEXT( " color=" ); __AddDec( t, nTmp );
- ::extract_value( nTmp, nBorder1, 4, 4 );
- ADDTEXT( " right-line =" ); __AddDec( t, nTmp );
- ::extract_value( nTmp, nBorder1, 23, 7 );
- ADDTEXT( " color=" ); __AddDec( t, nTmp );
- PRINT();
- LINESTART();
- ::extract_value( nTmp, nBorder1, 8, 4 );
- ADDTEXT( "top-line =" ); __AddDec( t, nTmp );
- ::extract_value( nTmp, nBorder2, 0, 7 );
- ADDTEXT( " color=" ); __AddDec( t, nTmp );
- ::extract_value( nTmp, nBorder1, 12, 4 );
- ADDTEXT( " bottom-line=" ); __AddDec( t, nTmp );
- ::extract_value( nTmp, nBorder2, 7, 7 );
- ADDTEXT( " color=" ); __AddDec( t, nTmp );
- PRINT();
- LINESTART();
- ::extract_value( nTmp, nBorder2, 21, 4 );
- ADDTEXT( "diag-line=" ); __AddDec( t, nTmp );
- ::extract_value( nTmp, nBorder2, 14, 7 );
- ADDTEXT( " color=" ); __AddDec( t, nTmp );
- ADDTEXT( " diag-tl-to-br=" ); lcl_AddOnOff( t, ::get_flag( nBorder1, 0x40000000UL ) );
- ADDTEXT( " diag-bl-to-tr=" ); lcl_AddOnOff( t, ::get_flag( nBorder1, 0x80000000UL ) );
- PRINT();
- LINESTART();
- ::extract_value( nTmp, nBorder2, 26, 6 );
- ADDTEXT( "area-pattern=" ); __AddDec( t, nTmp );
- ::extract_value( nTmp, nArea, 0, 7 );
- ADDTEXT( " fore-color=" ); __AddDec( t, nTmp );
- ::extract_value( nTmp, nArea, 7, 7 );
- ADDTEXT( " back-color=" ); __AddDec( t, nTmp );
- PRINT();
-
- return 0;
-}
-
-void Biff8RecDumper::DumpValidPassword( XclImpStream& rIn, const sal_Char* pPre )
-{
- ByteString t;
- UINT16 nHash;
- rIn >> nHash;
- LINESTART();
- ADDTEXT( "hash=" );
- __AddHex( t, nHash );
- if( nHash )
- {
- ByteString sPasswd;
- ByteString sDummy;
- UINT16 nLen = 9;
- UINT16 nDummy;
- UINT16 nNewChar;
-
- nHash ^= 0xCE4B;
- nDummy = nHash;
- ADDTEXT( " without-mask=" );
- __AddHex( t, nHash );
- while( !(nDummy & 0x8000) && nLen )
- {
- nLen--;
- nDummy <<= 1;
- }
- if( !nLen ) nLen = 2;
- if( (nLen ^ nHash) & 0x0001 ) nLen++;
- if( nLen == 9 )
- {
- nLen = 10;
- nHash ^= 0x8001;
- }
- nHash ^= nLen;
- if( nLen < 9 ) nHash <<= (8 - nLen);
- for( UINT16 iChar = nLen; iChar > 0; iChar-- )
- {
- switch( iChar )
- {
- case 10:
- nNewChar = (nHash & 0xC000) | 0x0400;
- nHash ^= nNewChar;
- nNewChar >>= 2;
- break;
- case 9:
- nNewChar = 0x4200;
- nHash ^= nNewChar;
- nNewChar >>= 1;
- break;
- case 1:
- nNewChar = nHash & 0xFF00;
- break;
- default:
- nNewChar = (nHash & 0xE000) ^ 0x2000;
- if( !nNewChar ) nNewChar = (nHash & 0xF000) ^ 0x1800;
- if( nNewChar == 0x6000 ) nNewChar = 0x6100;
- nHash ^= nNewChar;
- nHash <<= 1;
- break;
- }
- nNewChar >>= 8;
- nNewChar &= 0x00FF;
- sDummy = sPasswd;
- sPasswd = (sal_Char) nNewChar;
- sPasswd += sDummy;
- }
- ADDTEXT( " valid-password='" );
- t += sPasswd;
- ADDTEXT( "'" );
- }
- PRINT();
-}
-
-
-void __AddGUID( ByteString& rStr, XclImpStream& rIn )
-{
- UINT16 nIndex;
- __AddPureHex( rStr, Read4( rIn ) );
- rStr += "-";
- __AddPureHex( rStr, Read2( rIn ) );
- rStr += "-";
- __AddPureHex( rStr, Read2( rIn ) );
- rStr += "-";
- // last 2 parts byte for byte
- for( nIndex = 0; nIndex < 2; nIndex++ )
- __AddPureHex( rStr, Read1( rIn ) );
- rStr += "-";
- for( nIndex = 0; nIndex < 6; nIndex++ )
- __AddPureHex( rStr, Read1( rIn ) );
-}
-
-
-void Biff8RecDumper::PreDumpDecrypted( ULONG nL )
-{
- if( !nL ) return;
-
- ByteString t;
- const sal_Char* pPre = (pLevelPre > pLevelPreString) ? pLevelPre - 1 : pLevelPre;
-
- LINESTART();
- ADDTEXT( "*** encrypted ***" );
- PRINT();
- pIn->DisableDecryption();
- pIn->Seek( EXC_REC_SEEK_TO_BEGIN );
- ContDump( nL );
-
- if( pIn->HasValidDecrypter() )
- {
- LINESTART();
- ADDTEXT( "*** decrypted ***" );
- PRINT();
- pIn->EnableDecryption();
- pIn->Seek( EXC_REC_SEEK_TO_BEGIN );
- ContDump( nL );
- }
-}
-
-
-void Biff8RecDumper::RecDump( BOOL bSubStream )
-{
- const sal_Char* p;
- BOOL bDec = FALSE;
- ByteString aTmp;
- UINT16 __nFlags;
- const UINT16 nR = pIn->GetRecId();
- const ByteString* pName = GetName( nR );
-
- // set CONTINUE handling mode
- switch( nR )
- {
- case 0x000A: // EOF
- case 0x003C: // CONT
- case 0x005D: // OBJ
- case 0x00EC: // MSODRAWING
- case 0x01B6: // TXO
- pIn->ResetRecord( false );
- break;
- case 0x1066: // CHGELFRAME
- pIn->ResetRecord( bReadContRecs, 0x1066 );
- break;
- default:
- pIn->ResetRecord( bReadContRecs );
- }
- const ULONG nL = pIn->GetRecSize();
-
- switch( nR )
- {
- case 0x0009:
- case 0x0209:
- case 0x0409:
- case 0x0809:
- nLevelCnt = 0;
- break;
- case 0x1033:
- if( pName )
- aTmp = *pName;
- else
- aTmp = "BEGIN ";
- bDec = ( pLevelPre + nLevelInc ) >= pLevelPreString;
- nLevelCnt++;
- aTmp.Append( ByteString::CreateFromInt32( nLevelCnt ) );
- pName = &aTmp;
- break;
- case 0x1034:
- if( pName )
- aTmp = *pName;
- else
- aTmp = "END ";
- if( ( pLevelPre + nLevelInc ) <= pLevelPreStringNT )
- pLevelPre += nLevelInc;
- if( nLevelCnt )
- {
- aTmp.Append( ByteString::CreateFromInt32( nLevelCnt ) );
- nLevelCnt--;
- }
- else
- aTmp += "#LEVEL ERROR#";
- pName = &aTmp;
- break;
- }
-
- ByteString aT;
- ByteString& t = aT;
- const sal_Char* pPre = (pLevelPre > pLevelPreString) ? pLevelPre - 1 : pLevelPre;
-
- if( nR || nL ) // skip dummy-zero DIMENSIONS at eof
- {
- if( bBlankLine )
- *pDumpStream << '\n';
-
- aT += pLevelPre;
- __AddHex( aT, nR );
-
- if( pName )
- {
- aT += " (";
- aT += *pName;
- aT += ") [";
- }
- else
- aT += " [";
-
- if( bReadContRecs )
- __AddHex( aT, nL );
- else
- __AddHex( aT, (UINT16)nL );
- aT += "]";
- if( !bSkipOffset )
- {
- aT += " :";
- __AddHex( aT, UINT32(pIn->GetSvStreamPos() - 2 * sizeof(UINT16)) );
- aT += ':';
- }
-
- Print( aT );
- }
-
- if( HasModeNameOnly( nR ) )
- ;
- else if( HasModeHex( nR ) || !bBIFF8 )
- {
- if( bEncrypted )
- PreDumpDecrypted( nL );
- else
- ContDump( nL );
- }
- else if( nMaxBodyLines && nL )
- {
- XclImpStream& rIn = *pIn;
-
- if( bEncrypted )
- {
- PreDumpDecrypted( nL );
- LINESTART();
- ADDTEXT( "*** contents ***" );
- PRINT();
- pIn->Seek( EXC_REC_SEEK_TO_BEGIN );
- }
-
- LINESTART();
-
- switch( nR )
- {
- case 0x0000: // DIMENSIONS - used area
- case 0x0200:
- {
- LINESTART();
- UINT32 nR1, nR2;
- UINT16 nC1, nC2;
- rIn >> nR1 >> nR2 >> nC1 >> nC2;
- ADDTEXT( "first row: " ); __AddHex( t, nR1 );
- ADDTEXT( " last row+1: " ); __AddHex( t, nR2 );
- ADDTEXT( " first col: " ); __AddHex( t, nC1 );
- ADDTEXT( " last col+1: " ); __AddHex( t, nC2 );
- ADDTEXT( " (" ); lcl_AddRangeRef( t, nC1, (UINT16)nR1, nC2-1, (UINT16)nR2-1 );
- ADDTEXT( ")" );
- PRINT();
- }
- break;
- case 0x06:
- {
- ADDCELLHEAD();
- PRINT();
- LINESTART();
- ADDTEXT( "val = " );
- ADDDOUBLE();
- rIn >> __nFlags;
- if( __nFlags )
- {
- ADDTEXT( " " );
- STARTFLAG();
- ADDFLAG( 0x01, "fAlwaysCalc" );
- ADDFLAG( 0x02, "fCalcOnLoad" );
- ADDFLAG( 0x08, "fShrFmla" );
- }
- PRINT();
- LINESTART();
- UINT16 n;
- ADDTEXT( "chn = " );
- ADDHEX( 4 );
- rIn >> n;
- ADDTEXT( " cce = " );
- __AddDec( t, n );
- PRINT();
- FormulaDump( n, FT_CellFormula );
- if( rIn.GetRecLeft() > 0 )
- {
- LINESTART();
- ADDTEXT( "additional formula data" );
- PRINT();
- ContDump( rIn.GetRecLeft() );
- }
- }
- break;
- case 0x0013: // PASSWORD
- DumpValidPassword( rIn, pPre );
- break;
- case 0x0014: // HEADER
- case 0x0015: // FOOTER
- if( rIn.GetRecLeft() )
- AddUNICODEString( t, rIn );
- PRINT();
- break;
- case 0x17:
- {
- if( mnSubstream == EXC_BOF_WORKSPACE )
- {
- ADDTEXT( "filename=" );
- AddUNICODEString( t, rIn );
- PRINT();
- }
- else
- {
- UINT16 n;
- rIn >> n;
- ADDTEXT( "# of XTI: " );
- __AddDec( t, n );
- PRINT();
- UINT16 nSB, nF, nL;
- while( n && rIn.IsValid() )
- {
- LINESTART();
- rIn >> nSB >> nF >> nL;
- ADDTEXT( "Supbook = " );
- __AddDec( t, nSB );
- ADDTEXT( " Tab = " );
- __AddDec( t, nF );
- ADDTEXT( " ... " );
- __AddDec( t, nL );
- PRINT();
- n--;
- }
- }
- }
- break;
- case 0x0018:
- case 0x0218: // NAME
- {
- sal_uInt8 nKey, nNameLen, nMenuLen, nDescrLen, nHelpLen, nStatusLen;
- sal_uInt16 nFmlaSize, nRes, nTab;
-
- rIn >> __nFlags >> nKey >> nNameLen >> nFmlaSize >> nRes >> nTab >> nMenuLen >> nDescrLen >> nHelpLen >> nStatusLen;
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x0001, "fHidden" );
- ADDFLAG( 0x0002, "fFunc" );
- ADDFLAG( 0x0004, "fVBProc" );
- ADDFLAG( 0x0008, "fProc" );
- ADDFLAG( 0x0010, "fCalcExp" );
- ADDFLAG( 0x0020, "fBuiltIn" );
- ADDFLAG( 0x1000, "fBig" );
- ADDRESERVED( 0xE000 );
- ADDTEXT( " func-group-idx=" );
- __AddDec( t, (UINT16)((__nFlags & 0x0FC0) >> 6) );
- ADDTEXT( " shortcut=" ); __AddHex( t, nKey );
- PRINT();
-
- LINESTART();
- ADDTEXT( "fmla-size=" ); __AddDec( t, nFmlaSize );
- ADDTEXT( " reserved=" ); __AddHex( t, nRes );
- ADDTEXT( " tab=" ); __AddDec( t, nTab );
- if( !nTab ) ADDTEXT( " (global)" );
- PRINT();
-
- LINESTART();
- sal_uInt16 nBuiltIn = 0;
- bool bBuiltIn = (nNameLen == 1) && (__nFlags & 0x0020);
- if( bBuiltIn )
- {
- rIn.PushPosition();
- sal_uInt8 nStrFlags;
- rIn >> nStrFlags;
- nBuiltIn = (nStrFlags & 1) ? rIn.ReaduInt16() : rIn.ReaduInt8();
- rIn.PopPosition();
- }
- ADDTEXT( "name=" );
- ByteString aName;
- AddUNICODEString( t, rIn, false, nNameLen, &aName );
- if( bBuiltIn )
- {
- static const sal_Char* const ppcNames[] = {
- "Consolidate_Area", "Auto_Open", "Auto_Close", "Extract", "Database",
- "Criteria", "Print_Area", "Print_Titles", "Recorder", "Data_Form",
- "Auto_Activate", "Auto_Deactivate", "Sheet_Title", "_FilterDatabase" };
- lcl_AddEnum( t, nBuiltIn, ppcNames, STATIC_TABLE_SIZE( ppcNames ) );
- if( (0 <= nBuiltIn) && (nBuiltIn < STATIC_TABLE_SIZE( ppcNames )) )
- aName.Assign( ppcNames[ nBuiltIn ] );
- }
- maNames.push_back( aName );
- PRINT();
-
- if( nFmlaSize && (rIn.GetRecLeft() > 0) )
- {
- LINESTART();
- ADDTEXT( "name-definition=" );
- PRINT();
- FormulaDump( nFmlaSize, FT_RangeName );
- }
- if( nMenuLen )
- {
- LINESTART();
- ADDTEXT( "menu-text=" );
- AddUNICODEString( t, rIn, false, nMenuLen );
- PRINT();
- }
- if( nDescrLen )
- {
- LINESTART();
- ADDTEXT( "descr-text=" );
- AddUNICODEString( t, rIn, false, nDescrLen );
- PRINT();
- }
- if( nHelpLen )
- {
- LINESTART();
- ADDTEXT( "help-text=" );
- AddUNICODEString( t, rIn, false, nHelpLen );
- PRINT();
- }
- if( nStatusLen )
- {
- LINESTART();
- ADDTEXT( "status-text=" );
- AddUNICODEString( t, rIn, false, nStatusLen );
- PRINT();
- }
- }
- break;
- case 0x001D: // SELECTION - list of selections
- {
- ADDTEXT( "pane: " ); ADDDEC( 1 );
- ADDTEXT( " active cell: " );
- UINT16 nR, nC;
- rIn >> nR >> nC;
- lcl_AddRef( t, nC, nR );
- ADDTEXT( " active index: " ); ADDDEC( 2 );
- ADDTEXT( " ref count: " );
- UINT16 nCount;
- rIn >> nCount;
- __AddDec( t, nCount );
- PRINT();
- for( UINT16 nIndex = 0; nIndex < nCount && rIn.IsValid(); nIndex++ )
- {
- LINESTART();
- UINT16 nR1, nR2;
- UINT8 nC1, nC2;
- rIn >> nR1 >> nR2 >> nC1 >> nC2;
- ADDTEXT( "ref#" ); __AddDec( t, nIndex, 3 );
- ADDTEXT( ": " ); lcl_AddRangeRef( t, nC1, nR1, nC2, nR2 );
- PRINT();
- }
- }
- break;
- case 0x0023: // EXTERNNAME
- {
- PreDump( rIn.GetRecSize() );
- rIn >> __nFlags;
- STARTFLAG();
- ADDFLAG( 0x0001, "builtin" );
- ADDFLAG( 0x0002, "automatic" );
- ADDFLAG( 0x0004, "wantcliprepr" );
- ADDFLAG( 0x0008, "DDEstddocname" );
- ADDFLAG( 0x0010, "OLE" );
- ADDRESERVED( 0x8000 );
- sal_uInt16 nClip = (__nFlags & 0x7FE0) >> 5;
- ADDTEXT( " clip-format=" ); __AddHex( t, nClip );
- PRINT(); LINESTART();
- bool bFormula = false, bArray = false;
- if( (__nFlags & 0x0001) || !(__nFlags & 0x7FFE) )
- {
- ADDTEXT( "type=external name" );
- ADDTEXT( " table=" ); ADDDEC( 2 );
- ADDTEXT( " reserved=" ); ADDHEX( 2 );
- bFormula = true;
- }
- else if( __nFlags & 0x0010 )
- {
- ADDTEXT( "type=OLE" );
- ADDTEXT( " stream-id=" ); ADDHEX( 4 );
- }
- else
- {
- ADDTEXT( "type=DDE" );
- ADDTEXT( " reserved=" ); ADDHEX( 4 );
- bArray = true;
- }
- PRINT(); LINESTART();
- ADDTEXT( "name=" ); AddUNICODEString( t, rIn, FALSE );
- PRINT();
- if( rIn.GetRecLeft() > 0 )
- {
- LINESTART();
- if( bFormula )
- {
- sal_uInt16 nSize = rIn.ReaduInt16();
- ADDTEXT( "formula (size=" ); __AddDec( t, nSize );
- ADDTEXT( "):" );
- PRINT();
- FormulaDump( nSize, FT_RangeName );
- }
- else if( bArray && (rIn.GetRecLeft() >= 3) )
- {
- LINESTART();
- ADDTEXT( "constant array width=" ); ADDDEC( 1 );
- ADDTEXT( " height=" ); ADDDEC( 2 );
- PRINT();
- while( rIn.GetRecLeft() > 0 )
- {
- sal_uInt8 nType = rIn.ReaduInt8();
- LINESTART();
- ADDTEXT( "type=" ); __AddHex( t, nType );
- ADDTEXT( " (" );
- switch( nType )
- {
- case 0x00:
- ADDTEXT( "empty) reserved=" ); ADDHEX( 4 );
- ADDTEXT( " " ); ADDHEX( 4 );
- break;
- case 0x01:
- ADDTEXT( "double) value=" ); ADDDOUBLE();
- break;
- case 0x02:
- ADDTEXT( "string) text=" ); AddUNICODEString( t, rIn );
- break;
- case 0x04:
- ADDTEXT( "bool) value=" ); lcl_AddFlag( t, rIn.ReaduInt8() );
- ADDTEXT( " reserved=" ); ADDHEX( 1 );
- ADDTEXT( " " ); ADDHEX( 2 );
- ADDTEXT( " " ); ADDHEX( 4 );
- break;
- case 0x10:
- ADDTEXT( "error) code=" ); ADDHEX( 1 );
- ADDTEXT( " reserved=" ); ADDHEX( 1 );
- ADDTEXT( " " ); ADDHEX( 2 );
- ADDTEXT( " " ); ADDHEX( 4 );
- break;
- default:
- ADDTEXT( "!unknown!)" );
- rIn.Ignore( 8 );
- }
- PRINT();
- }
- }
- if( rIn.GetRecLeft() > 0 )
- {
- LINESTART();
- ADDTEXT( "additional data:" );
- PRINT();
- ContDump( rIn.GetRecLeft() );
- }
- }
- }
- break;
- case 0x0026:
- case 0x0027:
- case 0x0028:
- case 0x0029:
- LINESTART();
- ADDDOUBLE();
- PRINT();
- break;
- case 0x002F: // FILEPASS
- {
- LINESTART();
- sal_uInt16 nType;
- rIn >> nType;
- ADDTEXT( "encrypt-type=" ); __AddHex( t, nType );
- ADDTEXT( " (" );
- switch( nType )
- {
- case 0x0000:
- {
- ADDTEXT( "BIFF2-BIFF7 XOR) key=" );
- ADDHEX( 2 );
- ADDTEXT( " hash=" );
- ADDHEX( 2 );
- PRINT();
- }
- break;
-
- case 0x0001:
- {
- ADDTEXT( "BIFF8 standard/strong)" );
- PRINT();
- LINESTART();
- ADDTEXT( "reserved=" ); ADDHEX( 2 );
- sal_uInt16 nMode;
- rIn >> nMode;
- ADDTEXT( " mode=" ); __AddHex( t, nMode );
- ADDTEXT( " (" );
- switch( nMode )
- {
- case 0x0001:
- {
- ADDTEXT( "BIFF8 standard)" );
- PRINT();
- LINESTART();
- ADDTEXT( "document-id=..." );
- PRINT();
- ContDump( 16 );
- LINESTART();
- ADDTEXT( "salt-data=..." );
- PRINT();
- ContDump( 16 );
- LINESTART();
- ADDTEXT( "salt-hash=..." );
- PRINT();
- ContDump( 16 );
- }
- break;
- case 0x0002:
- {
- ADDTEXT( "BIFF8X strong) flags=" );
- ADDHEX( 4 );
- PRINT();
- LINESTART();
- ADDTEXT( "info-size=" ); ADDHEX( 4 );
- ADDTEXT( " flags=" ); ADDHEX( 4 );
- ADDTEXT( " unknown=" ); ADDHEX( 4 );
- PRINT();
- LINESTART();
- ADDTEXT( "stream-crypt-id=" ); ADDHEX( 4 );
- ADDTEXT( " hash-algo-id=" ); ADDHEX( 4 );
- ADDTEXT( " hash-key-len=" ); ADDDEC( 4 );
- PRINT();
- LINESTART();
- ADDTEXT( "crypt-prov-type=" ); ADDHEX( 4 );
- ADDTEXT( " unknown=" ); ADDHEX( 4 );
- ADDTEXT( " unknown=" ); ADDHEX( 4 );
- PRINT();
- LINESTART();
- ADDTEXT( "crypt-provider-name='" );
- sal_uInt16 nChar;
- do
- {
- rIn >> nChar;
- if( nChar )
- t += (sal_Char)(((32 <= nChar) && (nChar <=127)) ? nChar : '.');
- }
- while( nChar );
- ADDTEXT( "'" );
- PRINT();
- LINESTART();
- sal_uInt32 nLen;
- rIn >> nLen;
- ADDTEXT( "*** document-id *** len=" ); __AddHex( t, nLen );
- PRINT();
- ContDump( nLen );
- LINESTART();
- ADDTEXT( "*** salt-data *** len=" ); __AddHex( t, nLen );
- PRINT();
- ContDump( nLen );
- LINESTART();
- rIn >> nLen;
- ADDTEXT( "*** salt-hash *** len=" ); __AddHex( t, nLen );
- PRINT();
- ContDump( nLen );
- }
- break;
- default:
- {
- ADDTEXT( "!unknown!)" );
- PRINT();
- ContDump( rIn.GetRecLeft() );
- }
- }
- }
- break;
-
- default:
- {
- ADDTEXT( "!unknown!)" );
- PRINT();
- ContDump( rIn.GetRecLeft() );
- }
- }
- }
- break;
- case 0x0031: // FONT
- case 0x0231:
- {
- LINESTART();
- ADDTEXT( "(index=" ); __AddDec( t, nFontIndex );
- ADDTEXT( ") " );
- nFontIndex++; if( nFontIndex == 4 ) nFontIndex++;
- ADDTEXT( "height: " ); ADDDEC( 2 );
- ADDTEXT( "/20pt " );
- rIn >> __nFlags;
- STARTFLAG();
- ADDFLAG( 0x0002, "fItalic" );
- ADDFLAG( 0x0008, "fStrikeout" );
- ADDFLAG( 0x0010, "fOutline" );
- ADDFLAG( 0x0020, "fShadow" );
- ADDRESERVED( 0xFFC5 );
- PRINT();
- LINESTART();
- ADDTEXT( "color: " ); ADDDEC( 2 );
- ADDTEXT( " boldness: " ); ADDDEC( 2 );
- ADDTEXT( " sub/sup: " ); ADDDEC( 2 );
- ADDTEXT( " underline: " ); ADDHEX( 1 );
- PRINT();
- LINESTART();
- ADDTEXT( "family: " ); ADDDEC( 1 );
- ADDTEXT( " charset: " ); ADDDEC( 1 );
-// ADDTEXT( " reserved: " ); ADDHEX( 1 );
- rIn.Ignore( 1 );
- ADDTEXT( " " );
- AddUNICODEString( t, rIn, FALSE );
- PRINT();
- }
- break;
- case 0x003D: // WINDOW1
- {
- LINESTART();
- ADDTEXT( "pos-x=" ); ADDDEC( 2 );
- ADDTEXT( " pos-y=" ); ADDDEC( 2 );
- ADDTEXT( " width=" ); ADDDEC( 2 );
- ADDTEXT( " height=" ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- rIn >> __nFlags;
- STARTFLAG();
- ADDFLAG( 0x0001, "hide-window" );
- ADDFLAG( 0x0002, "min-window" );
- ADDFLAG( 0x0008, "show-hscroll" );
- ADDFLAG( 0x0010, "show-vscroll" );
- ADDFLAG( 0x0020, "show-tabbar" );
- ADDRESERVED( 0xFFC4 );
- PRINT();
- LINESTART();
- ADDTEXT( "active-tab=" ); ADDDEC( 2 );
- ADDTEXT( " first-vis-tab=" ); ADDDEC( 2 );
- ADDTEXT( " selected-tabs=" ); ADDDEC( 2 );
- ADDTEXT( " tabbar-width=" ); ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0x0041: // PANE
- {
- LINESTART();
- ADDTEXT( "vert-split-pos=" ); ADDDEC( 2 );
- ADDTEXT( " hor-split-pos=" ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "first-row=" ); ADDDEC( 2 );
- ADDTEXT( " first-col=" ); ADDDEC( 2 );
- ADDTEXT( " active-pane=" ); ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0x0042: // CODEPAGE
- {
- LINESTART();
- sal_uInt16 nCodePage = rIn.ReaduInt16();
- ADDTEXT( "codepage=" ); __AddHex( t, nCodePage );
- ADDTEXT( " (" ); __AddDec( t, nCodePage );
- ADDTEXT( ")" );
- PRINT();
- }
- break;
- case 0x004D: // PLS
- {
- LINESTART();
- static const sal_Char* const ppcTypes[] = { "Win", "Mac" };
- sal_uInt16 nType = rIn.ReaduInt16();
- ADDTEXT( "environment=" );
- lcl_AddEnum( t, nType, ppcTypes, STATIC_TABLE_SIZE( ppcTypes ) );
- PRINT();
- if( nType == 0 )
- {
- String aData;
- sal_uInt32 __nFlags;
- LINESTART();
- rIn.SetNulSubstChar( '\0' );
- aData = rIn.ReadRawUniString( 32, true );
- ADDTEXT( "device-name='" ); ADDTEXT( GETSTR( aData ) );
- ADDTEXT( "'" );
- PRINT(); LINESTART();
- ADDTEXT( "spec-version=" ); ADDDEC( 2 );
- ADDTEXT( " driver-version=" ); ADDDEC( 2 );
- sal_uInt16 nOwnSize, nPrvSize;
- rIn >> nOwnSize >> nPrvSize;
- ADDTEXT( " own-size=" ); __AddDec( t, nOwnSize );
- ADDTEXT( " prv-size=" ); __AddDec( t, nPrvSize );
- PRINT(); LINESTART();
- rIn >> __nFlags;
- STARTFLAG();
- ADDFLAG( 0x00000001, "orient" );
- ADDFLAG( 0x00000002, "paper-size" );
- ADDFLAG( 0x00000004, "paper-height" );
- ADDFLAG( 0x00000008, "paper-width" );
- ADDFLAG( 0x00000010, "scale" );
- ADDFLAG( 0x00000100, "copies" );
- ADDRESERVED( 0xE0000080 );
- PRINT(); LINESTART();
- static const sal_Char* const ppcOrient[] = { 0, "portrait", "landsc" };
- sal_uInt16 nOrient = rIn.ReaduInt16();
- ADDTEXT( "orientation=" );
- lcl_AddEnum( t, nOrient, ppcOrient, STATIC_TABLE_SIZE( ppcOrient ) );
- ADDTEXT( " paper-size=" ); ADDDEC( 2 );
- ADDTEXT( " paper-width=" ); ADDDEC( 2 );
- ADDTEXT( " paper-height=" ); ADDDEC( 2 );
- PRINT(); LINESTART();
- ADDTEXT( "scale=" ); ADDDEC( 2 );
- ADDTEXT( " copies=" ); ADDDEC( 2 );
- PRINT();
- if( nOwnSize > 88 )
- {
- LINESTART(); ADDTEXT( "additional data:" ); PRINT();
- ContDump( nOwnSize - 88 );
- }
- if( nPrvSize > 0 )
- {
- LINESTART(); ADDTEXT( "private data:" ); PRINT();
- ContDump( nPrvSize );
- }
- }
- if( rIn.GetRecLeft() > 0 )
- {
- LINESTART(); ADDTEXT( "unknown data:" ); PRINT();
- ContDump( rIn.GetRecLeft() );
- }
- }
- break;
- case 0x51:
- {
- UINT16 nR1, nR2;
- UINT8 nC1, nC2;
- rIn >> nR1 >> nR2 >> nC1 >> nC2;
- lcl_AddRangeRef( t, nC1, nR1, nC2, nR2 );
- PRINT();
- LINESTART();
- ADDTEXT( "workbook: " );
- AddUNICODEString( t, rIn, TRUE );
- PRINT();
- }
- break;
- case 0x0052: // DCONNAME
- {
- ADDTEXT( "name=" );
- AddUNICODEString( t, rIn, TRUE );
- PRINT();
- LINESTART();
- ADDTEXT( "sheet=" );
- AddUNICODEString( t, rIn, TRUE );
- PRINT();
- }
- break;
- case 0x5B: // FILESHARING
- {
- PreDump( nL );
- rIn >> __nFlags;
- if( __nFlags )
- {
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x0001, "fReadOnlyRec" );
- PRINT();
- }
- DumpValidPassword( rIn, pPre );
- }
- break;
- case 0x5D:
- ObjDump( nL );
- break;
- case 0x007D: // COLINFO - col range info
- {
- LINESTART();
- ADDTEXT( "col range: " );
- ADDDEC( 2 );
- ADDTEXT( "-" );
- ADDDEC( 2 );
- ADDTEXT( " width: " );
- ADDDEC( 2 );
- ADDTEXT( "/256 charwidth ix to XF: " );
- ADDDEC( 2 );
- PRINT();
- rIn >> __nFlags;
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x0001, "fHidden" );
- ADDTEXT( " outlnlev=" );
- __AddDec( t, (UINT16)((__nFlags & 0x0700) >> 8) );
- ADDFLAG( 0x1000, "fCollapsed" );
- ADDRESERVED( 0xE8FE );
- PRINT();
- LINESTART();
- ADDTEXT( "reserved: " );
- ADDHEX( 1 );
- PRINT();
- }
- break;
- case 0x7E:
- {
-// LINESTART();
- ADDCELLHEAD();
- ADDTEXT( " val = " );
- __AddRK( t, rIn.ReadInt32() );
- PRINT();
- }
- break;
- case 0x0080: // GUTS - row & col gutters for outlines
- {
- LINESTART();
- ADDTEXT( "size row gutter: " );
- __AddDec( t, Read2( rIn ), 5 );
- ADDTEXT( " | size col gutter: " );
- __AddDec( t, Read2( rIn ), 5 );
- PRINT();
- LINESTART();
- ADDTEXT( "max outline lev: " );
- __AddDec( t, Read2( rIn ), 5 );
- ADDTEXT( " | max outline lev: " );
- __AddDec( t, Read2( rIn ), 5 );
- PRINT();
- }
- break;
- case 0x0081: // WSBOOL - additional workspace info
- {
- rIn >> __nFlags;
- LINESTART();
- STARTFLAG();
- if( __nFlags & 0x00F1 )
- {
- ADDFLAG( 0x0001, "fShowAutoBreaks" );
- ADDFLAG( 0x0010, "fDialog" );
- ADDFLAG( 0x0020, "fApplyStyles" );
- ADDFLAG( 0x0040, "fRowSumsBelow" );
- ADDFLAG( 0x0080, "fColSumsBelow" );
- PRINT();
- LINESTART();
- }
- if( __nFlags & (0xCD00 | 0x320E) )
- {
- ADDTEXT( " " );
- ADDFLAG( 0x0100, "fFitToPage" );
- ADDFLAG( 0x0400, "fDispRowGuts" );
- ADDFLAG( 0x0800, "fDispColGuts" );
- ADDFLAG( 0x4000, "fAee" );
- ADDFLAG( 0x8000, "fAfe" );
- ADDRESERVED( 0x320E );
- PRINT();
- }
- if( !__nFlags )
- PRINT();
- }
- break;
- case 0x008C: // COUNTRY
- {
- LINESTART();
- ADDTEXT( "ui-country=" ); ADDDEC( 2 );
- ADDTEXT( " doc-country=" ); ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0x92: // PALETTE
- {
- UINT16 nColCnt;
- rIn >> nColCnt;
- LINESTART();
- ADDTEXT( "count: " );
- __AddDec( t, nColCnt );
- PRINT();
- LINESTART();
- for( UINT16 nCol = 0; nCol < nColCnt; nCol++ )
- {
- __AddDec( t, nCol, 2 );
- ADDTEXT( "=" );
- ADDHEX( 4 );
- ADDTEXT( " " );
- if( (nCol % 5 == 4) || (nCol == nColCnt - 1) )
- {
- PRINT();
- LINESTART();
- }
- }
- }
- break;
- case 0x9D: // AUTOFILTERINFO -- count of drop-down arrows
- {
- LINESTART();
- ADDTEXT( "count of drop-down arrows: " );
- ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0x9E: // AUTOFILTER -- autofilter settings
- {
- UINT8 nType;
- UINT8 nCompare;
- ByteString sTemp[ 2 ];
- UINT16 nLen[ 2 ] = { 0, 0 };
- UINT8 nF;
- LINESTART();
- ADDTEXT( "count: " );
- ADDDEC( 2 );
- rIn >> __nFlags;
- STARTFLAG();
- ADDFLAG( 0x0003, "fJoin" );
- ADDFLAG( 0x0004, "fSimpleEq1" );
- ADDFLAG( 0x0008, "fSimpleEq2" );
- ADDFLAG( 0x0010, "fTop10" );
- ADDFLAG( 0x0020, "fTop" );
- ADDFLAG( 0x0040, "fPercent" );
- PRINT();
- LINESTART();
- if( __nFlags & 0x0003 )
- ADDTEXT( "(custom conditions are OR-ed" );
- else
- ADDTEXT( "(custom conditions are AND-ed" );
- if( __nFlags & 0x0010 )
- {
- if( __nFlags & 0x0020 )
- ADDTEXT( "; show top " );
- else
- ADDTEXT( "; show bottom " );
- __AddDec( t, (UINT16)(__nFlags >> 7) );
- if( __nFlags & 0x0040 )
- ADDTEXT( " percent" );
- else
- ADDTEXT( " items" );
- }
- ADDTEXT( ")" );
- PRINT();
- for( nF = 0; nF < 2; nF++ )
- {
- LINESTART();
- __AddDec( t, (UINT16)(nF + 1) );
- ADDTEXT( ". Filter: " );
- rIn >> nType >> nCompare;
- switch( nType )
- {
- case 0x00: ADDTEXT( "not used " ); break;
- case 0x02: ADDTEXT( "RK " ); break;
- case 0x04: ADDTEXT( "double " ); break;
- case 0x06: ADDTEXT( "string " ); break;
- case 0x08: ADDTEXT( "bool/err " ); break;
- case 0x0A: ADDTEXT( "show nothing " ); break;
- case 0x0C: ADDTEXT( "all blanks " ); break;
- case 0x0E: ADDTEXT( "all non-blanks " ); break;
- default:
- ADDTEXT( "unknown (" );
- __AddHex( t, nType );
- ADDTEXT( ") " );
- }
- switch( nCompare )
- {
- case 0x01: ADDTEXT( "< " ); break;
- case 0x02: ADDTEXT( "= " ); break;
- case 0x03: ADDTEXT( "<= " ); break;
- case 0x04: ADDTEXT( "> " ); break;
- case 0x05: ADDTEXT( "<> " ); break;
- case 0x06: ADDTEXT( ">= " ); break;
- default: if( nCompare ) __AddHex( t, nCompare );
- }
- sTemp[ nF ] = t;
- switch( nType )
- {
- case 0x02:
- __AddRK( sTemp[ nF ], rIn.ReadInt32() );
- IGNORE( 4 );
- break;
- case 0x04:
- __AddDouble( sTemp[ nF ], Read8( rIn ) );
- break;
- case 0x06:
- IGNORE( 4 );
- nLen[ nF ] = Read1( rIn );
- IGNORE( 3 );
- break;
- case 0x08:
- __AddHex( sTemp[ nF ], Read1( rIn ) );
- sTemp[ nF ] += " ";
- __AddHex( sTemp[ nF ], Read1( rIn ) );
- IGNORE( 6 );
- break;
- default:
- IGNORE( 8 );
- }
- }
- for( nF = 0; nF < 2; nF++ )
- {
- t = sTemp[ nF ];
- if( nLen[ nF ] )
- AddUNICODEString( t, rIn, TRUE, nLen[ nF ] );
- PRINT();
- }
- }
- break;
- case 0xA0:
- {
- UINT16 nN, nD;
- rIn >> nN >> nD;
- LINESTART();
- ADDTEXT( "Window Zoom Magnification = " );
- __AddDec( t, nN );
- ADDTEXT( "/" );
- __AddDec( t, nD );
- PRINT();
- }
- break;
- case 0x00A1: // SETUP
- {
- LINESTART();
- ADDTEXT( "paper size: " ); ADDDEC( 2 );
- ADDTEXT( " scaling: " ); ADDDEC( 2 );
- ADDTEXT( " start page: " ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "fit to width: " ); ADDDEC( 2 );
- ADDTEXT( " fit to height: " ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- rIn >> __nFlags;
- STARTFLAG();
- ADDFLAG( 0x0001, "fLeftRight" );
- ADDFLAG( 0x0002, "fPortrait" );
- ADDFLAG( 0x0004, "fNoPrintSettings" );
- ADDFLAG( 0x0008, "fMonochrom" );
- ADDFLAG( 0x0010, "fDraft" );
- ADDFLAG( 0x0020, "fNotes" );
- ADDFLAG( 0x0040, "fNoOrientation" );
- ADDFLAG( 0x0080, "fCustomNumber" );
- PRINT();
- LINESTART();
- ADDTEXT( "Print res: " ); ADDDEC( 2 );
- ADDTEXT( " vert print res: " ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "header margin: " ); ADDDOUBLE();
- ADDTEXT( " footer margin: " ); ADDDOUBLE();
- ADDTEXT( " copies: " ); ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0xAF:
- {
- UINT16 nCref;
- UINT8 nLocked, nHidden, nName, nComment, nNameUser;
- rIn >> nCref >> nLocked >> nHidden >> nName >> nComment >> nNameUser;
- LINESTART();
- ADDTEXT( "Changing Cells = " );
- __AddDec( t, nCref );
- if( nLocked )
- ADDTEXT( " fLocked" );
- if( nHidden )
- ADDTEXT( " fHidden" );
- PRINT();
- LINESTART();
- ADDTEXT( "Name = " );
- __AddDec( t, nName );
- ADDTEXT( " Comment = " );
- __AddDec( t, nComment );
- ADDTEXT( " Name User = " );
- __AddDec( t, nNameUser );
- PRINT();
- ContDump( rIn.GetRecLeft() );
- }
- break;
- case 0xB0: // SXVIEW
- {
- UINT16 nColFirst, nColLast, nRowFirst, nRowLast;
- rIn >> nRowFirst >> nRowLast >> nColFirst >> nColLast;
- nSXLIIndex = 0; // new pivot table
- LINESTART();
- ADDTEXT( "PivotTable: " ); __AddDec( t, nColFirst );
- ADDTEXT( " / " ); __AddDec( t, nRowFirst );
- ADDTEXT( " - " ); __AddDec( t, nColLast );
- ADDTEXT( " / " ); __AddDec( t, nRowLast );
- PRINT();
- LINESTART();
- ADDTEXT( "1st Head: " ); ADDDEC( 2 );
- rIn >> nRowFirst;
- ADDTEXT( " First Data: " ); ADDDEC( 2 );
- ADDTEXT( " / " ); __AddDec( t, nRowFirst );
- PRINT();
- LINESTART();
- ADDTEXT( "Cache index: " ); ADDDEC( 2 );
- ADDTEXT( " reserved: " ); ADDHEX( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "axis 4 data: " ); ADDDEC( 2 );
- ADDTEXT( " pos 4 Data: " ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "num of fields: " ); ADDDEC( 2 );
- rIn >> nSXLISize[0] >> nSXLISize[1];
- ADDTEXT( " ...row fields: " ); __AddDec( t, nSXLISize[0] );
- ADDTEXT( " ...col fields: " ); __AddDec( t, nSXLISize[1] );
- PRINT();
- LINESTART();
- ADDTEXT( "num of page fields: " ); ADDDEC( 2 );
- ADDTEXT( " ...data fields: " ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "data rows: " ); ADDDEC( 2 );
- ADDTEXT( " data cols: " ); ADDDEC( 2 );
- rIn >> __nFlags;
- PRINT();
- if( __nFlags )
- {
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x0001, "fRowGrand" );
- ADDFLAG( 0x0002, "fColGrand" );
- ADDFLAG( 0x0008, "fAutoFormat" );
- ADDFLAG( 0x0010, "fWidthHeightAuto" );
- ADDFLAG( 0x0020, "fFontAuto" );
- ADDFLAG( 0x0040, "fAlignAuto" );
- ADDFLAG( 0x0080, "fBorderAuto" );
- ADDFLAG( 0x0100, "fPatternAuto" );
- ADDFLAG( 0x0200, "fNumberAuto" );
- PRINT();
- }
- LINESTART();
- ADDTEXT( "index 2 PivotTable autoform: " );
- ADDDEC( 2 );
- PRINT();
- LINESTART();
- UINT16 nTableLen = Read2( rIn );
- UINT16 nDataLen = Read2( rIn );
- ADDTEXT( "PivotTable name: " );
- if( nTableLen )
- AddUNICODEString( t, rIn, TRUE, nTableLen );
- else
- ADDTEXT( "-/-" );
- PRINT();
- LINESTART();
- ADDTEXT( "data field name: " );
- if( nDataLen )
- AddUNICODEString( t, rIn, TRUE, nDataLen );
- else
- ADDTEXT( "-/-" );
- PRINT();
- }
- break;
- case 0xB1: // SXVD
- {
- rIn >> __nFlags;
- LINESTART();
- ADDTEXT( "Axis (" );
- __AddHex( t, __nFlags );
- ADDTEXT( "):" );
- if( __nFlags )
- {
- ADDFLAG( 0x0001, "row" );
- ADDFLAG( 0x0002, "col" );
- ADDFLAG( 0x0004, "page" );
- ADDFLAG( 0x0008, "data" );
- }
- else
- ADDTEXT( " no axis" );
- ADDTEXT( " num of att. subtotals: " );
- ADDDEC( 2 );
- PRINT();
- rIn >> __nFlags;
- LINESTART();
- ADDTEXT( "subtotal type(" );
- __AddHex( t, __nFlags );
- ADDTEXT( "):" );
- if( __nFlags )
- {
- ADDFLAG( 0x0001, "Default" );
- ADDFLAG( 0x0002, "Sum" );
- ADDFLAG( 0x0004, "Counta" );
- ADDFLAG( 0x0008, "Average" );
- ADDFLAG( 0x0010, "Max" );
- ADDFLAG( 0x0020, "Min" );
- ADDFLAG( 0x0040, "Product" );
- ADDFLAG( 0x0080, "Count" );
- ADDFLAG( 0x0100, "Stdev" );
- ADDFLAG( 0x0200, "Stddevp" );
- ADDFLAG( 0x0400, "Var" );
- ADDFLAG( 0x0800, "Varp" );
- }
- else
- ADDTEXT( " none" );
- PRINT();
- LINESTART();
- ADDTEXT( "num of items: " );
- ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "Name: " );
- UINT16 nLen = Read2( rIn );
- if( nLen == 0xFFFF )
- ADDTEXT( "<name in cache>" );
- else if( nLen )
- AddUNICODEString( t, rIn, TRUE, nLen );
- PRINT();
- }
- break;
- case 0xB2: // SXVI
- {
- UINT16 nType, nCache;
- rIn >> nType >> __nFlags >> nCache;
- LINESTART();
- switch( nType )
- {
- case 0xFE: p = "Page"; break;
- case 0xFF: p = "Null"; break;
- case 0x00: p = "Data"; break;
- case 0x01: p = "Default"; break;
- case 0x02: p = "SUM"; break;
- case 0x03: p = "COUNT"; break;
- case 0x04: p = "AVERAGE"; break;
- case 0x05: p = "MAX"; break;
- case 0x06: p = "MIN"; break;
- case 0x07: p = "PRODUCT"; break;
- case 0x08: p = "COUNTA"; break;
- case 0x09: p = "STDEV"; break;
- case 0x0A: p = "STDEVP"; break;
- case 0x0B: p = "VAR"; break;
- case 0x0C: p = "VARP"; break;
- case 0x0D: p = "Grand total"; break;
- default: p = pU;
- }
- ADDTEXT( "Type (" );
- __AddHex( t, nType );
- ADDTEXT( "): " );
- ADDTEXT( p );
- ADDTEXT( " iCache: " );
- __AddDec( t, nCache );
- PRINT();
- if( __nFlags )
- {
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x01, "fHidden" );
- ADDFLAG( 0x02, "fHideDetail" );
- ADDFLAG( 0x04, "fFormula" );
- ADDFLAG( 0x08, "fMissing" );
- PRINT();
- }
- LINESTART();
- ADDTEXT( "Name: " );
- UINT16 nCch = Read2( rIn );
- if( nCch == 0xFFFF )
- ADDTEXT( "<name in cache>" );
- else if( nCch )
- AddUNICODEString( t, rIn, TRUE, nCch );
- else
- ADDTEXT( "<empty string>" );
- PRINT();
- }
- break;
- case 0xB4: // SXIVD
- {
- const UINT16 nBrkNum = 5;
- UINT16 nBrk = nBrkNum;
- UINT16 nSize = (UINT16)(nL / 2);
- LINESTART();
- for( UINT16 i = 0; i < nSize; i++ )
- {
- ADDHEX( 2 );
- nBrk--;
- if( nBrk )
- ADDTEXT( " " );
- else
- {
- PRINT();
- LINESTART();
- nBrk = nBrkNum;
- }
- }
- if( nBrk < nBrkNum ) PRINT();
- }
- break;
- case 0xB5: // SXLI - pivot table line item array
- {
- UINT16 nIdent;
- UINT16 nType;
- UINT16 nMaxInd;
- const sal_Char* pInd = " ";
- const sal_Char* pType[] = {
- "Data", "Default", "SUM", "COUNT","AVERAGE",
- "MAX", "MIN", "PRODUCT", "COUNTA", "STDEV",
- "STDEVP", "VAR", "VARP", "Grand total",
- "Blank line" }; // undocumented
- while( rIn.GetRecLeft() > 0 )
- {
- rIn >> nIdent >> nType >> nMaxInd >> __nFlags;
- LINESTART();
- ADDTEXT( "# of ident. items: " );
- __AddDec( t, nIdent );
- ADDTEXT( " Type (" );
- __AddHex( t, nType );
- ADDTEXT( "): " );
- if( nType > 0x0E )
- p = pU;
- else
- p = pType[ nType ];
- ADDTEXT( p );
- ADDTEXT( " relevant indexes: " );
- __AddDec( t, nMaxInd );
- PRINT();
- LINESTART();
- ADDTEXT( pInd );
- STARTFLAG();
- ADDFLAG( 0x0001, "fMultiDataName" );
- ADDFLAG( 0x0200, "fSub" );
- ADDFLAG( 0x0400, "fBlock" );
- ADDFLAG( 0x0800, "fGrand" );
- ADDFLAG( 0x1000, "fMultiDataOnAxis" );
- ADDFLAG( 0x2000, "fBlankLine" ); // undocumented
- ADDFLAG( 0x4000, "fHideDetail" ); // undocumented
- ADDRESERVED( 0x8000 );
- PRINT();
- LINESTART();
- ADDTEXT( pInd );
- ADDTEXT( "index to data field: " );
- __AddDec( t, (UINT16) ( (__nFlags & 0x01FE) >> 1 ) );
- PRINT();
- LINESTART();
- ADDTEXT( pInd );
- ADDTEXT( "array of " );
- __AddDec( t, nSXLISize[nSXLIIndex] );
- ADDTEXT( " indexes (^ are ident., * are irrelevant):" );
- PRINT();
- LINESTART();
- ADDTEXT( pInd );
- ADDTEXT( " " );
- const UINT16 nBrkNum = 5;
- UINT16 nBrk = nBrkNum;
- for( UINT16 i = 0; i < nSXLISize[nSXLIIndex]; i++ )
- {
- __AddDec( t, Read2( rIn ), 7 );
- if( i < nIdent )
- ADDTEXT( "^" );
- else if( i < nMaxInd )
- ADDTEXT( " " );
- else
- ADDTEXT( "*" );
- nBrk--;
- if( !nBrk )
- {
- PRINT();
- LINESTART();
- ADDTEXT( pInd );
- ADDTEXT( " " );
- nBrk = nBrkNum;
- }
- }
- if( nBrk < nBrkNum )
- PRINT();
- }
- nSXLIIndex = 1 - nSXLIIndex;
- }
- break;
- case 0xB6: // SXPI - pivot table page item(s)
- {
- UINT16 nArrayCnt = (UINT16)(nL / 6);
- LINESTART();
- __AddDec( t, nArrayCnt );
- ADDTEXT( " page items:" );
- PRINT();
- for( UINT16 iArray = 0; iArray < nArrayCnt; iArray++ )
- {
- LINESTART();
- ADDTEXT( "index SXVD: " );
- __AddDec( t, Read2( rIn ), 3 );
- ADDTEXT( " index SXVI: " );
- UINT16 nSXVIInd;
- rIn >> nSXVIInd;
- __AddDec( t, nSXVIInd, 5 );
- if( nSXVIInd == 32765 )
- ADDTEXT( " (All items) Obj ID: " );
- else
- ADDTEXT( " Obj ID: " );
- ADDHEX( 2 );
- PRINT();
- }
- }
- break;
- case 0xBD:
- {
- UINT16 nC, nR, nXF;
- INT32 nRK;
- UINT16 n = (UINT16)((nL - 4) / 6);
-
- rIn >> nR >> nC;
- while( n )
- {
- rIn >> nXF >> nRK;
- LINESTART();
- __AddCellHead( t, nC, nR, nXF );
- ADDTEXT( " val = " );
- __AddRK( t, nRK );
- PRINT();
- nC++;
- n--;
- }
- }
- break;
- case 0xBE:
- {
- LINESTART();
- ADDCELLHEAD();
- PRINT();
- LINESTART();
- ADDTEXT( "next XFs: " );
- UINT16 n = (UINT16)((nL - 6) / 2);
- while( n )
- {
- __AddDec( t, Read2( rIn ) );
- n--;
- if( n )
- ADDTEXT( ' ' );
- }
- PRINT();
- }
- break;
- case 0x00C5: // SXDI
- {
- LINESTART();
- ADDTEXT( "Field: " );
- ADDDEC( 2 );
- UINT16 nFunc = Read2( rIn );
- ADDTEXT( " aggregation func (" );
- __AddHex( t, nFunc );
- ADDTEXT( "): " );
- const sal_Char* pFunc[] = { "Sum", "Count", "Average", "Max", "Min",
- "Product", "Count Nums", "StdDev", "StdDevp", "Var",
- "Varp" };
- p = (nFunc > 0x0A) ? pU : pFunc[ nFunc ];
- ADDTEXT( p );
- ADDTEXT( " display format (" );
- const sal_Char* pDispl[] = {
- "Normal", "Difference", "Percentage of", "Percentage difference from", "Running total in",
- "Percentage of row", "Percentage of column", "Percentage of total", "Index" };
- UINT16 nDispl = Read2( rIn );
- __AddHex( t, nDispl );
- ADDTEXT( "): " );
- p = (nDispl > 0x08) ? pU : pDispl[ nDispl ];
- ADDTEXT( p );
- PRINT();
- LINESTART();
- ADDTEXT( "ind. to SXVD: " ); ADDDEC( 2 );
- ADDTEXT( " ind. to SXVI: " ); ADDDEC( 2 );
- ADDTEXT( " num format: " ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "name: " );
- UINT16 nCch = Read2( rIn );
- if( nCch == 0xFFFF )
- ADDTEXT( "<name in cache>" );
- else if( nCch )
- AddUNICODEString( t, rIn, TRUE, nCch );
- else
- ADDTEXT( "<empty string>" );
- PRINT();
- }
- break;
- case 0x00C6: // SXDB - cache info
- {
- ADDTEXT( "number of recs: " ); ADDDEC( 4 );
- ADDTEXT( " stream id: " ); ADDHEX( 2 );
- ADDTEXT( " flags: " ); ADDHEX( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "DB block recs: " ); ADDDEC( 2 );
- ADDTEXT( " base fields: " ); ADDDEC( 2 );
- ADDTEXT( " all fields: " ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "reserved: " ); ADDHEX( 2 );
- ADDTEXT( " type: " ); ADDHEX( 2 );
- ADDTEXT( " changed by:" );
- PRINT();
- LINESTART();
- AddUNICODEString( t, rIn );
- PRINT();
- }
- break;
- case 0x00C7: // SXFIELD - Pivot Field
- {
- nItemCnt = 0;
-
- ADDTEXT( "#" );
- __AddDec( t, nFieldCnt, 3 );
- nFieldCnt++;
- ADDTEXT( " (pivot field): " );
- if( rIn.GetRecLeft() < 14 )
- {
- ADDTEXT( "<break in pivot field start>" );
- PRINT();
- }
- else
- {
- PRINT();
- LINESTART();
- ADDTEXT( pPre );
- rIn >> __nFlags;
- STARTFLAG();
- ADDFLAG( 0x0001, "fOrigItems" );
- ADDFLAG( 0x0002, "fPostponed" );
- ADDFLAG( 0x0004, "fCalculated" );
- ADDFLAG( 0x0008, "fGroupChild" );
- ADDFLAG( 0x0010, "fNumGroup" );
- ADDFLAG( 0x0200, "fLongIndex" );
- ADDFLAG( 0x1000, "f1000?" );
- ADDFLAG( 0x8000, "f8000?" );
- ADDRESERVED( 0x6000 );
- ADDTEXT( " data-type=" );
- __AddHex( t, static_cast< sal_uInt16 >( __nFlags & 0x0DE0 ) );
- ADDTEXT( "=" );
- switch( __nFlags & 0x0DE0 )
- {
- case 0x0000: ADDTEXT( "spc" ); break;
- case 0x0480: ADDTEXT( "str" ); break;
- case 0x0520: ADDTEXT( "int[+dbl]" ); break;
- case 0x0560: ADDTEXT( "dbl" ); break;
- case 0x05A0: ADDTEXT( "str+int[+dbl]" ); break;
- case 0x05E0: ADDTEXT( "str+dbl" ); break;
- case 0x0900: ADDTEXT( "dat" ); break;
- case 0x0D00: ADDTEXT( "dat+int/dbl" ); break;
- case 0x0D80: ADDTEXT( "dat+str[+int/dbl]" ); break;
- default: ADDTEXT( pU );
- }
- PRINT();
- LINESTART();
- ADDTEXT( pPre );
- ADDTEXT( "group-subfield=" ); ADDDEC( 2 );
- ADDTEXT( " group-basefield=" ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( pPre );
- ADDTEXT( "item-count=" ); ADDDEC( 2 );
- ADDTEXT( " group-item-count=" ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( pPre );
- ADDTEXT( "base-item-count=" ); ADDDEC( 2 );
- ADDTEXT( " source-item-count=" ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( pPre );
- if( rIn.GetRecLeft() < 3 )
- {
- ADDTEXT( "<break in pivot field name>" );
- PRINT();
- }
- else
- {
- ADDTEXT( "name=" );
- AddUNICODEString( t, rIn );
- PRINT();
- }
- }
- }
- break;
- case 0x00C8: // SXINDEXLIST - indexes to source data
- {
- ADDTEXT( "#" );
- __AddDec( t, nTabIndexCnt, 3 );
- nTabIndexCnt++;
- ADDTEXT( " (index list):" );
- for( UINT16 iIndex = 0; iIndex < rIn.GetRecSize(); iIndex++ )
- {
- ADDTEXT( " " );
- ADDHEX( 1 );
- }
- PRINT();
- }
- break;
- case 0x00C9: // SXDOUBLE - cache entry: double value
- {
- ADDTEXT( "#" );
- __AddDec( t, nItemCnt, 3 );
- ADDTEXT( " (double): " );
- nItemCnt++;
- ADDTEXT( " " );
- ADDDOUBLE();
- PRINT();
- }
- break;
- case 0x00CA: // SXBOOLEAN - cache entry: boolean value
- {
- ADDTEXT( "#" );
- __AddDec( t, nItemCnt, 3 );
- ADDTEXT( " (boolean): " );
- nItemCnt++;
- ADDTEXT( " " );
- lcl_AddFlag( t, rIn.ReaduInt16() != 0 );
- PRINT();
- }
- break;
- case 0x00CB: // SXERROR - cache entry: error code
- {
- ADDTEXT( "#" );
- __AddDec( t, nItemCnt, 3 );
- ADDTEXT( " (error): " );
- nItemCnt++;
- ADDTEXT( " " );
- ADDHEX( 2 );
- PRINT();
- }
- break;
- case 0x00CC: // SXINTEGER - signed 16bit integer
- {
- ADDTEXT( "#" );
- __AddDec( t, nItemCnt, 3 );
- ADDTEXT( " (integer): " );
- nItemCnt++;
- ADDTEXT( " " );
- ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0x00CD: // SXSTRING - String
- {
- if( bSubStream )
- {
- ADDTEXT( "#" );
- __AddDec( t, nItemCnt, 3 );
- ADDTEXT( " (string): " );
- nItemCnt++;
- }
- AddUNICODEString( t, rIn );
- PRINT();
- }
- break;
- case 0x00CE: // SXDATETIME - date & time special format
- {
- ADDTEXT( "#" );
- __AddDec( t, nItemCnt, 3 );
- ADDTEXT( " (date/time): " );
- nItemCnt++;
- UINT8 nDay, nHour, nMin, nSec;
- UINT16 nYear, nMonth;
- rIn >> nYear >> nMonth >> nDay >> nHour >> nMin >> nSec;
- if( nDay )
- {
- __AddDec( t, nDay );
- ADDTEXT( "." );
- __AddDec( t, nMonth );
- ADDTEXT( "." );
- __AddDec( t, nYear );
- ADDTEXT( " " );
- }
- __AddDec( t, nHour, 2, '0' );
- ADDTEXT( ":" );
- __AddDec( t, nMin, 2, '0' );
- ADDTEXT( ":" );
- __AddDec( t, nSec, 2, '0' );
- PRINT();
- }
- break;
- case 0x00CF: // SXEMPTY - cache entry: empty
- {
- ADDTEXT( "#" );
- __AddDec( t, nItemCnt, 3 );
- ADDTEXT( " (empty): " );
- nItemCnt++;
- PRINT();
- }
- break;
- case 0x00D5: // SXIDSTM - pivot table cache stream id
- {
- LINESTART();
- UINT16 nStrId = Read2( rIn );
- ADDTEXT( "Stream ID: " );
- __AddHex( t, nStrId );
- PRINT();
- DumpRecordStream( OpenStorage( EXC_STORAGE_PTCACHE ), ScfTools::GetHexStr( nStrId ), EMPTY_STRING );
- }
- break;
- case 0x00D8: // SXNUMGROUP - numerical grouping in pivot cache field
- {
- LINESTART();
- rIn >> __nFlags;
- STARTFLAG();
- ADDFLAG( 0x0001, "fAutoMin" );
- ADDFLAG( 0x0002, "fAutoMax" );
- ADDTEXT( " data-type=" );
- switch( (__nFlags & 0x003C) >> 2 )
- {
- case 0x0001: ADDTEXT( "seconds" ); break;
- case 0x0002: ADDTEXT( "minutes" ); break;
- case 0x0003: ADDTEXT( "hours" ); break;
- case 0x0004: ADDTEXT( "days" ); break;
- case 0x0005: ADDTEXT( "months" ); break;
- case 0x0006: ADDTEXT( "quarters" ); break;
- case 0x0007: ADDTEXT( "years" ); break;
- case 0x0008: ADDTEXT( "numeric" ); break;
- default: ADDTEXT( pU );
- }
- (__nFlags &= 0xFFC0) >>= 6;
- ADDTEXT( " remaining=" ); __AddHex( t, __nFlags );
- ADDTEXT( "=" ); __AddDec( t, __nFlags );
- PRINT();
- }
- break;
- case 0xE0:
- DumpXF( rIn, pPre );
- break;
- case 0xE3:
- {
- LINESTART();
- ADDTEXT( "view source (" );
- UINT16 n = Read2( rIn );
- __AddHex( t, n );
- ADDTEXT( "): " );
- switch( n )
- {
- case 0x01: p = "M$ Excel list or database"; break;
- case 0x02: p = "external data source"; break;
- case 0x04: p = "multiple consolidation ranges"; break;
- case 0x08: p = "pivot table"; break;
- case 0x10: p = "scenario manager summary report"; break;
- default: p = pU;
- }
- ADDTEXT( p );
- PRINT();
- }
- break;
- case 0x00E5: // CELLMERGING
- {
- UINT16 nCount, nInd;
- UINT16 nRow1, nRow2, nCol1, nCol2;
- rIn >> nCount;
- LINESTART();
- ADDTEXT( "Count: " );
- __AddDec( t, nCount );
- PRINT();
- LINESTART();
- for( nInd = 0; nInd < 3; nInd++ )
- ADDTEXT( " row - row / col-col | " );
- PRINT();
- LINESTART();
- if( (ULONG)(nCount * 8 + 2) == nL )
- {
- for( nInd = 0; nInd < nCount; nInd++ )
- {
- rIn >> nRow1 >> nRow2 >> nCol1 >> nCol2;
- __AddDec( t, nRow1, 5 );
- ADDTEXT( "-" );
- __AddDec( t, nRow2, 5 );
- ADDTEXT( " / " );
- __AddDec( t, nCol1, 3 );
- ADDTEXT( "-" );
- __AddDec( t, nCol2, 3 );
- ADDTEXT( " | " );
- if( (nInd % 3 == 2) || (nInd == nCount - 1) )
- {
- PRINT();
- LINESTART();
- }
- }
- }
- else
- {
- LINESTART();
- ADDTEXT( "<Wrong record length!>" );
- PRINT();
- }
- }
- break;
- case 0xEB:
- case 0xEC:
- case 0xED:
- EscherDump( nL, true );
- break;
- case 0x00F6: // SXNAME
- {
- LINESTART();
- rIn >> __nFlags;
- STARTFLAG();
- ADDFLAG( 0x0002, "fNameErr" );
- ADDRESERVED( 0xFFFD );
- ADDTEXT( " field=" ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- sal_Int16 nFunc;
- rIn >> nFunc;
- ADDTEXT( "function=" ); __AddHex( t, (INT32)nFunc );
- static const sal_Char* const ppcFuncs[] = {
- "none", 0, "sum", "counta", "count", "average", "max", "min",
- "product", "stdev", "stdevp", "var", "varp" };
- lcl_AddEnum( t, nFunc, ppcFuncs, STATIC_TABLE_SIZE( ppcFuncs ), 0, -1 );
- ADDTEXT( " SXPAIR-count=" ); ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0x00F9: // SXFMLA
- {
- LINESTART();
- sal_uInt16 nSize;
- rIn >> nSize;
- ADDTEXT( "formula-size=" ); __AddDec( t, nSize );
- ADDTEXT( " SXNAME-count=" ); ADDDEC( 2 );
- PRINT();
- FormulaDump( nSize, FT_RangeName );
- }
- break;
- case 0xFC:
- {
- UINT16 nCnt = 0;
- BOOL bOK = TRUE;
- ContDump( 8 );
-
- while( bOK && (rIn.GetRecLeft() > 0) )
- {
- LINESTART();
- __AddDec( t, nCnt );
- ADDTEXT( ": " );
- bOK = AddUNICODEString( t, rIn );
- PRINT();
- nCnt++;
- }
- }
- break;
- case 0xFD:
- {
- LINESTART();
- ADDCELLHEAD();
- ADDTEXT( " sst = " );
- ADDDEC(4);
- PRINT();
- }
- break;
- case 0x0100: // SXVDEX
- {
- LINESTART();
- sal_uInt32 __nFlags = Read4( rIn );
- STARTFLAG();
- if( __nFlags & 0x0000009F )
- {
- ADDFLAG( 0x00000001, "fShowAllItems" );
- ADDFLAG( 0x00000002, "fDragToRow" );
- ADDFLAG( 0x00000004, "fDragToColumn" );
- ADDFLAG( 0x00000008, "fDragToPage" );
- ADDFLAG( 0x00000010, "fDragToHide" );
- ADDFLAG( 0x00000080, "fServerBased" );
- PRINT();
- LINESTART();
- }
- if( __nFlags & 0x00007E00 )
- {
- ADDTEXT( " " );
- ADDFLAG( 0x00000200, "fAutoSort" );
- ADDFLAG( 0x00000400, "fAscendSort" );
- ADDFLAG( 0x00000800, "fAutoShow" );
- ADDFLAG( 0x00001000, "fAscendShow" );
- ADDFLAG( 0x00002000, "fCalculatedField" );
- ADDFLAG( 0x00004000, "fLONewPage" ); // undocumented
- PRINT();
- LINESTART();
- }
- if( __nFlags & 0xFFE00000 )
- {
- ADDTEXT( " " ); // Layout flags:
- ADDFLAG( 0x00200000, "fLOReport" ); // undocumented
- ADDFLAG( 0x00400000, "fLOBlankLine" ); // undocumented
- ADDFLAG( 0x00800000, "fLOSubTotalTop" ); // undocumented
- ADDTEXT( " show-items=" ); __AddDec( t, sal_uInt32( __nFlags >> 24 ) );
- PRINT();
- LINESTART();
- }
- if( __nFlags & 0x001F8160 )
- {
- ADDTEXT( " !RESERVED!" );
- PRINT();
- }
- if( !__nFlags )
- PRINT();
- LINESTART();
- ADDTEXT( " sort-field=" );
- ADDDEC( 2 );
- ADDTEXT( " show-field=" );
- ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "format=" );
- UINT16 n = Read2( rIn );
- if( n )
- __AddDec( t, n );
- else
- ADDTEXT( "none" );
- PRINT();
- }
- break;
- case 0x0122: // SXDBEX - ext. cache info
- {
- ADDTEXT( "last changed: " ); ADDDOUBLE();
- ADDTEXT( " SXFORMULA recs: " ); ADDDEC( 4 );
- PRINT();
- }
- break;
- case 0x0138: // CHTRINFO - change tracking info
- {
- rIn.DisableDecryption();
- ADDTEXT( "14 bytes of unknown data..." );
- PRINT();
- ContDump( 14 );
- LINESTART();
- ADDTEXT( "16 bytes unknown identification:" );
- PRINT();
- ContDump( 16 );
- LINESTART();
- ADDTEXT( "unknown: " ); ADDHEX( 2 );
- ADDTEXT( " user: " );
- if( rIn.GetRecLeft() > 3 )
- AddUNICODEString( t, rIn );
- PRINT();
- LINESTART();
- __AddDec( t, (UINT16)(rIn.GetRecLeft() - 10) );
- ADDTEXT( " bytes of unknown data..." );
- PRINT();
- ContDump( rIn.GetRecLeft() - 10 );
- LINESTART();
- ADDTEXT( "date/time: " ); ADDDEC( 2 );
- ADDTEXT( "-" ); ADDDEC( 1 );
- ADDTEXT( "-" ); ADDDEC( 1 );
- ADDTEXT( " " ); ADDDEC( 1 );
- ADDTEXT( ":" ); ADDDEC( 1 );
- ADDTEXT( ":" ); ADDDEC( 1 );
- ADDTEXT( " unknown: " ); ADDHEX( 1 );
- ADDTEXT( " " ); ADDHEX( 2 );
- PRINT();
- }
- break;
- case 0x0137: // CHTRINSERT - change tracking: insert/remove
- {
- ADDTEXT( "len: " ); ADDDEC( 4 );
- ADDTEXT( " index: " ); ADDDEC( 4 );
- ADDTEXT( " op: " );
- UINT16 nOp;
- rIn >> nOp;
- switch( nOp )
- {
- case 0x0000: ADDTEXT( "insert row" ); break;
- case 0x0001: ADDTEXT( "insert column" ); break;
- case 0x0002: ADDTEXT( "delete row" ); break;
- case 0x0003: ADDTEXT( "delete column" ); break;
- default:
- __AddHex( t, nOp );
- ADDTEXT( " *UNKNOWN*" );
- }
- ADDTEXT( " accept: " ); ADDHEX( 2 );
- ADDTEXT( " tab: " ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- UINT16 __nFlags = Read2( rIn );
- STARTFLAG();
- ADDFLAG( 0x0001, "fAuto" );
- ADDRESERVED( 0xFFFE );
- UINT16 nCol1, nRow1, nCol2, nRow2;
- rIn >> nRow1 >> nRow2 >> nCol1 >> nCol2;
- ADDTEXT( " range: " ); lcl_AddRangeRef( t, nCol1, nRow1, nCol2, nRow2 );
- ADDTEXT( " unknown: " ); ADDHEX( 4 );
- PRINT();
- }
- break;
- case 0x013B: // CHTRCELLCONTENT: change tracking: changed cell
- {
- PreDump( nL );
- ADDTEXT( "len: " ); ADDDEC( 4 );
- ADDTEXT( " index: " ); ADDDEC( 4 );
- ADDTEXT( " opcode: " ); ADDHEX( 2 );
- ADDTEXT( " accept: " ); ADDHEX( 2 );
- ADDTEXT( " tab: " ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- UINT16 nChg, nOldType, nNewType;
- rIn >> nChg;
- nOldType = (nChg & 0x0038) >> 3;
- nNewType = nChg & 0x0007;
- ADDTEXT( "change (" ); __AddHex( t, nChg );
- ADDTEXT( "): " );
- switch( nOldType )
- {
- case 0x0000: ADDTEXT( "empty->" ); break;
- case 0x0001: ADDTEXT( "RK->" ); break;
- case 0x0002: ADDTEXT( "double->" ); break;
- case 0x0003: ADDTEXT( "string->" ); break;
- case 0x0004: ADDTEXT( "bool->" ); break;
- case 0x0005: ADDTEXT( "formula->" ); break;
- default: ADDTEXT( "*UNKNOWN*->" );
- }
- switch( nNewType )
- {
- case 0x0000: ADDTEXT( "empty" ); break;
- case 0x0001: ADDTEXT( "RK" ); break;
- case 0x0002: ADDTEXT( "double" ); break;
- case 0x0003: ADDTEXT( "string" ); break;
- case 0x0004: ADDTEXT( "bool" ); break;
- case 0x0005: ADDTEXT( "formula" ); break;
- default: ADDTEXT( "*UNKNOWN*" );
- }
- UINT16 nFormatData = (nChg & 0xFF00);
- if( (nFormatData == 0x1100) || (nFormatData == 0x1300) )
- ADDTEXT( "; contains add. data" );
- ADDTEXT( " format: " ); ADDHEX( 2 );
- UINT16 nCol, nRow;
- rIn >> nRow >> nCol;
- ADDTEXT( " address: " ); lcl_AddRef( t, nCol, nRow );
- PRINT();
- LINESTART();
- UINT16 nOldLen;
- rIn >> nOldLen;
- ADDTEXT( "old value len: " ); __AddHex( t, nOldLen );
- if( nOldType == 0x0003 )
- nOldLen >>= 1;
- ADDTEXT( " unknown: " ); ADDHEX( 4 );
- PRINT();
- UINT16 nCount = 0;
- switch( nFormatData )
- {
- case 0x1100: nCount = 8; break;
- case 0x1300: nCount = 4; break;
- }
- if( nCount )
- {
- LINESTART();
- ADDTEXT( "additional format data:" );
- for( UINT16 nIndex = 0; nIndex < nCount; nIndex ++ )
- {
- ADDTEXT( " " );
- ADDHEX( 2 );
- }
- PRINT();
- }
- if( nOldType )
- {
- LINESTART();
- ADDTEXT( "old value: " );
- switch( nOldType )
- {
- case 0x0001:
- __AddRK( t, rIn.ReadInt32() );
- PRINT();
- break;
- case 0x0002:
- ADDDOUBLE();
- PRINT();
- break;
- case 0x0003:
- AddUNICODEString( t, rIn );
- PRINT();
- break;
- case 0x0004:
- if( Read2( rIn ) )
- ADDTEXT( "true" );
- else
- ADDTEXT( "false" );
- PRINT();
- break;
- case 0x0005:
- {
- PRINT();
- UINT16 nLen;
- rIn >> nLen;
- FormulaDump( nLen, FT_CellFormula );
- IGNORE( 1 );
- }
- break;
- }
- }
- if( nNewType )
- {
- LINESTART();
- ADDTEXT( "new value: " );
- switch( nNewType )
- {
- case 0x0001:
- __AddRK( t, rIn.ReadInt32() );
- PRINT();
- break;
- case 0x0002:
- ADDDOUBLE();
- PRINT();
- break;
- case 0x0003:
- AddUNICODEString( t, rIn );
- PRINT();
- break;
- case 0x0004:
- if( Read2( rIn ) )
- ADDTEXT( "true" );
- else
- ADDTEXT( "false" );
- PRINT();
- break;
- case 0x0005:
- {
- PRINT();
- UINT16 nLen;
- rIn >> nLen;
- FormulaDump( nLen, FT_CellFormula );
- IGNORE( 1 );
- }
- break;
- }
- }
- if( rIn.GetRecLeft() > 0 )
- {
- LINESTART();
- ADDTEXT( "*UNKNOWN* data:" );
- PRINT();
- PreDump( rIn.GetRecLeft() );
- }
- }
- break;
- case 0x013D: // TABID
- {
- ADDTEXT( "tab ids:" );
- while( rIn.GetRecLeft() )
- {
- ADDTEXT( " " );
- ADDDEC( 2 );
- }
- PRINT();
- }
- break;
- case 0x0140: // CHTRMOVE - change tracking: moved range
- {
- ADDTEXT( "len: " ); ADDDEC( 4 );
- ADDTEXT( " index: " ); ADDDEC( 4 );
- ADDTEXT( " opcode: " ); ADDHEX( 2 );
- ADDTEXT( " accept: " ); ADDHEX( 2 );
- PRINT();
- UINT16 nTab1, nTab2;
- UINT16 nCol11, nCol12, nCol21, nCol22;
- UINT16 nRow11, nRow12, nRow21, nRow22;
- rIn >> nTab2 >> nRow11 >> nRow12 >> nCol11 >> nCol12 >> nRow21 >> nRow22 >> nCol21 >> nCol22 >> nTab1;
- LINESTART();
- ADDTEXT( "move range from: tab=" ); __AddDec( t, nTab1 );
- ADDTEXT( " " ); lcl_AddRangeRef( t, nCol11, nRow11, nCol12, nRow12 );
- ADDTEXT( " to: tab=" ); __AddDec( t, nTab2 );
- ADDTEXT( " " ); lcl_AddRangeRef( t, nCol21, nRow21, nCol22, nRow22 );
- ADDTEXT( " unknown: " ); ADDHEX( 4 );
- PRINT();
- }
- break;
- case 0x014D: // CHTRINSERTTAB - change tracking: insert tab
- {
- ADDTEXT( "len: " ); ADDDEC( 4 );
- ADDTEXT( " index: " ); ADDDEC( 4 );
- ADDTEXT( " opcode: " ); ADDHEX( 2 );
- ADDTEXT( " accept: " ); ADDHEX( 2 );
- ADDTEXT( " tab: " ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "unknown: " ); ADDHEX( 4 );
- ADDTEXT( " table name: " );
- AddUNICODEString( t, rIn );
- PRINT();
- LINESTART();
- __AddDec( t, (sal_uInt32)rIn.GetRecLeft() );
- ADDTEXT( " bytes of unknown data:" );
- PRINT();
- ContDump( rIn.GetRecLeft() );
- }
- break;
- case 0x015F: // LABELRANGES
- {
- UINT16 nCnt, nR1, nR2, nC1, nC2;
- rIn >> nCnt;
- ADDTEXT( "row headers: " ); __AddDec( t, nCnt );
- PRINT();
- while( nCnt-- )
- {
- rIn >> nR1 >> nR2 >> nC1 >> nC2;
- LINESTART();
- AddRangeRef( t, nR1, nC1 | 0xC000, nR2, nC2 | 0xC000, FALSE );
- PRINT();
- }
- rIn >> nCnt;
- LINESTART();
- ADDTEXT( "column headers: " ); __AddDec( t, nCnt );
- PRINT();
- while( nCnt-- )
- {
- rIn >> nR1 >> nR2 >> nC1 >> nC2;
- LINESTART();
- AddRangeRef( t, nR1, nC1 | 0xC000, nR2, nC2 | 0xC000, FALSE );
- PRINT();
- }
- }
- break;
- case 0x0193:
- {
- ADDTEXT( "unknown: " ); ADDHEX( 4 );
- PRINT();
- LINESTART();
- ADDTEXT( "16 bytes unknown identification:" );
- PRINT();
- ContDump( 16 );
- LINESTART();
- ADDTEXT( "date/time: " ); ADDDEC( 2 );
- ADDTEXT( "-" ); ADDDEC( 1 );
- ADDTEXT( "-" ); ADDDEC( 1 );
- ADDTEXT( " " ); ADDDEC( 1 );
- ADDTEXT( ":" ); ADDDEC( 1 );
- ADDTEXT( ":" ); ADDDEC( 1 );
- ADDTEXT( " unknown: " ); ADDHEX( 1 );
- PRINT();
- LINESTART();
- ADDTEXT( "user: " );
- if( rIn.GetRecLeft() > 3 )
- AddUNICODEString( t, rIn );
- PRINT();
- }
- break;
- case 0x0194:
- {
- rIn.DisableDecryption();
- ADDTEXT( "unknown: " ); ADDHEX( 4 );
- ADDTEXT( " date/time: " ); ADDDEC( 2 );
- ADDTEXT( "-" ); ADDDEC( 1 );
- ADDTEXT( "-" ); ADDDEC( 1 );
- ADDTEXT( " " ); ADDDEC( 1 );
- ADDTEXT( ":" ); ADDDEC( 1 );
- ADDTEXT( ":" ); ADDDEC( 1 );
- ADDTEXT( " unknown: " ); ADDHEX( 1 );
- PRINT();
- LINESTART();
- ADDTEXT( "user: " );
- if( rIn.GetRecLeft() > 3 )
- AddUNICODEString( t, rIn );
- PRINT();
- LINESTART();
- __AddDec( t, (sal_uInt32)rIn.GetRecLeft() );
- ADDTEXT( " bytes of unknown data:" );
- PRINT();
- ContDump( rIn.GetRecLeft() );
- }
- break;
- case 0x0195:
- rIn.DisableDecryption();
- ContDump( nL );
- break;
- case 0x0196:
- {
- rIn.DisableDecryption();
- ADDTEXT( "unknown: " ); ADDHEX( 2 );
- ADDTEXT( " " ); ADDHEX( 2 );
- ADDTEXT( " " ); ADDHEX( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "16 bytes unknown identification:" );
- PRINT();
- ContDump( 16 );
- LINESTART();
- ADDTEXT( "16 bytes unknown identification:" );
- PRINT();
- ContDump( 16 );
- LINESTART();
- ADDTEXT( "count of changes: " ); ADDDEC( 2 );
- ADDTEXT( " " );
- __AddDec( t, (sal_uInt32)rIn.GetRecLeft() );
- ADDTEXT( " bytes of unknown data:" );
- PRINT();
- ContDump( rIn.GetRecLeft() );
- }
- break;
- case 0x01A9: // USERBVIEW
- {
- LINESTART();
- ADDTEXT( "view id: " ); ADDHEX( 4 );
- ADDTEXT( " tab id: " ); ADDDEC( 4 );
- ADDTEXT( " guid: " ); __AddGUID( t, rIn );
- PRINT();
- LINESTART();
- ADDTEXT( "window x: " ); ADDDEC( 4 );
- ADDTEXT( " y: " ); ADDDEC( 4 );
- ADDTEXT( " width: " ); ADDDEC( 4 );
- ADDTEXT( " height: " ); ADDDEC( 4 );
- ADDTEXT( " ratio: " ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- UINT16 __nFlags = Read2( rIn );
- STARTFLAG();
- ADDFLAG( 0x0001, "fDsplFormulaBar" );
- ADDFLAG( 0x0002, "fDsplStatus" );
- ADDFLAG( 0x0004, "fNoteOff" );
- ADDFLAG( 0x0008, "fDsplHScroll" );
- ADDFLAG( 0x0010, "fDsplVScroll" );
- ADDFLAG( 0x0020, "fBotAdornment" );
- ADDFLAG( 0x0040, "fZoom" );
- ADDFLAG( 0x0080, "fShowPlaceHld" );
- ADDFLAG( 0x0100, "fHideAll" );
- if( !(__nFlags & 0x0180) )
- ADDTEXT( " fShowAll" );
- PRINT();
- LINESTART();
- ADDTEXT( "flags2: " ); ADDHEX( 2 );
- ADDTEXT( " merge int: " ); ADDDEC( 2 );
- ADDTEXT( " reserved: " ); ADDHEX( 2 );
- PRINT();
- if( rIn.GetRecLeft() > 3 )
- {
- LINESTART();
- ADDTEXT( "name: " );
- AddUNICODEString( t, rIn );
- PRINT();
- }
- }
- break;
- case 0x01AA: // USERSVIEWBEGIN
- {
- LINESTART();
- ADDTEXT( "guid: " ); __AddGUID( t, rIn );
- ADDTEXT( " tab id: " ); ADDDEC( 4 );
- PRINT();
- LINESTART();
- ADDTEXT( "wscale: " ); ADDDEC( 4 );
- ADDTEXT( " icolor: " ); ADDDEC( 4 );
- ADDTEXT( " pane: " ); ADDDEC( 4 );
- PRINT();
- LINESTART();
- UINT32 __nFlags = Read4( rIn );
- STARTFLAG();
- if( __nFlags & 0x000000FF )
- {
- ADDFLAG( 0x00000001, "fShowPgBrk" );
- ADDFLAG( 0x00000002, "fDsplForml" );
- ADDFLAG( 0x00000004, "fDsplGrid" );
- ADDFLAG( 0x00000008, "fDsplRCHead" );
- ADDFLAG( 0x00000010, "fDsplGuts" );
- ADDFLAG( 0x00000020, "fDsplZeros" );
- ADDFLAG( 0x00000040, "fPrintHorC" );
- ADDFLAG( 0x00000080, "fPrintVerC" );
- PRINT();
- LINESTART();
- }
- if( __nFlags & 0x00007F00 )
- {
- ADDTEXT( " " );
- ADDFLAG( 0x00000100, "fPrintRCHead" );
- ADDFLAG( 0x00000200, "fPrintGrid" );
- ADDFLAG( 0x00000400, "fFitToPage" );
- ADDFLAG( 0x00000800, "fPrintArea" );
- ADDFLAG( 0x00001000, "fOnePrintArea" );
- ADDFLAG( 0x00002000, "fFilter" );
- ADDFLAG( 0x00004000, "fAutoFilter" );
- PRINT();
- LINESTART();
- }
- if( __nFlags & 0xFFF80000 )
- {
- ADDTEXT( " " );
- ADDFLAG( 0x00020000, "fSplitV" );
- ADDFLAG( 0x00040000, "fSplitH" );
- ADDFLAG( 0x00180000, "fHiddenRow" );
- ADDFLAG( 0x00200000, "fHiddenCol" );
- ADDFLAG( 0x01000000, "fChartSize" );
- ADDFLAG( 0x02000000, "fFilterUnique" );
- ADDFLAG( 0x04000000, "fLayoutView" );
- ADDRESERVED( 0xF8C18000 );
- PRINT();
- LINESTART();
- }
- if( !__nFlags )
- PRINT();
- ADDTEXT( "visible: " ); ADDHEX( 2 );
- ADDTEXT( " " ); ADDHEX( 2 );
- ADDTEXT( " " ); ADDHEX( 2 );
- ADDTEXT( " " ); ADDHEX( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "pane pos vert: " ); ADDDOUBLE();
- ADDTEXT( " hor: " ); ADDDOUBLE();
- ADDTEXT( " 1st vis right: " ); ADDDEC( 2 );
- ADDTEXT( " bott: " ); ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0x01AB: // USERSVIEWEND
- {
- LINESTART();
- ADDTEXT( "settings are valid: " ); ADDHEX( 2 );
- PRINT();
- }
- break;
- case 0x01AD: // QSI - web query range
- {
- LINESTART();
- rIn >> __nFlags;
- STARTFLAG();
- ADDFLAG( 0x0001, "fTitles" );
- ADDFLAG( 0x0002, "fRowNums" );
- ADDFLAG( 0x0004, "fDisRefr" );
- ADDFLAG( 0x0080, "fFill" );
- ADDFLAG( 0x0100, "fAutoFmt" );
- ADDFLAG( 0x0400, "fDisEdit" );
- ADDRESERVED( 0xFA78 );
- PRINT();
- LINESTART();
- ADDTEXT( "AutoFmt: " ); ADDDEC( 2 );
- ADDTEXT( " AutoFmtAttr: " ); ADDHEX( 2 );
- ADDTEXT( " reserved: " ); ADDHEX( 4 );
- PRINT();
- LINESTART();
- ADDTEXT( "name: " );
- AddUNICODEString( t, rIn );
- PRINT();
- }
- break;
- case 0x01AE:
- {
- LINESTART();
- ADDTEXT( "# of tabs: " );
- UINT16 nTabs;
- rIn >> nTabs;
- __AddDec( t, nTabs );
- rIn.PushPosition();
- PRINT();
- LINESTART();
- if( nL <= (ULONG)(2 + 2 * nTabs) )
- {
- ADDTEXT( "----- shortened record -----" );
- PRINT();
-
- rIn.PopPosition();
- ContDump( nL - 2 );
- }
- else
- {
- rIn.RejectPosition();
- ADDTEXT( "file name: " );
- AddUNICODEString( t, rIn );
- PRINT();
- while( nTabs )
- {
- LINESTART();
- ADDTEXT( " " );
- AddUNICODEString( t, rIn );
- PRINT();
- nTabs--;
- }
- }
-
- }
- break;
- case 0x01B0: // CONDFMT
- {
- LINESTART();
- ADDTEXT( "cf-count=" ); ADDDEC( 2 );
- rIn >> __nFlags;
- ADDTEXT( " " );
- STARTFLAG();
- ADDFLAG( 0x0001, "tough-recalc" );
- ADDRESERVED( 0xFFFE );
- PRINT();
- LINESTART();
- sal_uInt16 nR1, nR2, nC1, nC2, nCount;
- rIn >> nR1 >> nR2 >> nC1 >> nC2 >> nCount;
- ADDTEXT( "max-range=" ); lcl_AddRangeRef( t, nC1, nR1, nC2, nR2 );
- ADDTEXT( " range-count=" ); __AddDec( t, nCount );
- PRINT();
-
- for( sal_uInt16 nRange = 0; rIn.IsValid() && (nRange < nCount); ++nRange )
- {
- if( !(nRange % 4) )
- {
- LINESTART();
- ADDTEXT( pPre );
- }
- rIn >> nR1 >> nR2 >> nC1 >> nC2;
- ByteString aRef;
- lcl_AddRangeRef( aRef, nC1, nR1, nC2, nR2 );
- aRef.Expand( 16, ' ' );
- ADDTEXT( aRef );
- if( (nRange % 4 == 3) || (nRange + 1 == nCount) )
- PRINT();
- }
- }
- break;
- case 0x01B1: // CF - conditional format
- {
- sal_uInt8 nType, nOp;
- sal_uInt16 nSize1, nSize2;
- sal_uInt32 nFlags;
- rIn >> nType >> nOp >> nSize1 >> nSize2 >> nFlags;
- LINESTART();
- ADDTEXT( "type=" ); __AddHex( t, nType );
- ADDTEXT( " (" );
- switch( nType )
- {
- case 0x01: ADDTEXT( "compare" ); break;
- case 0x02: ADDTEXT( "formula" ); break;
- default: ADDTEXT( "!unknown!" );
- }
- ADDTEXT( ") operator=" ); __AddHex( t, nOp );
- ADDTEXT( " (" );
- switch( nOp )
- {
- case 0x00: ADDTEXT( "none" ); break;
- case 0x01: ADDTEXT( "between" ); break;
- case 0x02: ADDTEXT( "not-between" ); break;
- case 0x03: ADDTEXT( "equal" ); break;
- case 0x04: ADDTEXT( "not-equal" ); break;
- case 0x05: ADDTEXT( "greater" ); break;
- case 0x06: ADDTEXT( "less" ); break;
- case 0x07: ADDTEXT( "greater-eq" ); break;
- case 0x08: ADDTEXT( "less-eq" ); break;
- default: ADDTEXT( "!unknown!" );
- }
- ADDTEXT( ")" );
- PRINT();
- LINESTART();
- ADDTEXT( "formula-size-1=" ); __AddDec( t, nSize1 );
- ADDTEXT( " formula-size-2=" ); __AddDec( t, nSize2 );
- PRINT();
- LINESTART();
- sal_uInt32 __nFlags = nFlags;
- STARTFLAG();
- __nFlags = ~__nFlags;
- ADDFLAG( 0x00000400, "bord-lft" );
- ADDFLAG( 0x00000800, "bord-rgt" );
- ADDFLAG( 0x00001000, "bord-top" );
- ADDFLAG( 0x00002000, "bord-bot" );
- ADDFLAG( 0x00010000, "patt-style" );
- ADDFLAG( 0x00020000, "patt-fgcol" );
- ADDFLAG( 0x00040000, "patt-bgcol" );
- __nFlags = ~__nFlags;
- ADDFLAG( 0x04000000, "font" );
- ADDFLAG( 0x10000000, "bord" );
- ADDFLAG( 0x20000000, "patt" );
- ADDRESERVED( 0xCBC00000 );
- PRINT();
- LINESTART();
- ADDTEXT( "unknown=" ); ADDHEX( 2 );
- PRINT();
- if( nFlags & 0x04000000 )
- {
- LINESTART(); ADDTEXT( "*** FONT ***" ); PRINT();
- ContDump( 64 );
- LINESTART();
- ADDTEXT( "height=" ); ADDHEX( 4 );
- rIn >> __nFlags;
- ADDTEXT( " style-" );
- STARTFLAG();
- ADDFLAG( 0x00000002, "italic" );
- ADDFLAG( 0x00000080, "strikeout" );
- ADDRESERVED( 0xFFFFFF7D );
- ADDTEXT( " weight=" ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- sal_uInt16 nEsc;
- rIn >> nEsc;
- ADDTEXT( "escapement=" ); __AddDec( t, nEsc );
- ADDTEXT( " (" );
- switch( nEsc )
- {
- case 0x0000: ADDTEXT( "none" ); break;
- case 0x0001: ADDTEXT( "super" ); break;
- case 0x0002: ADDTEXT( "sub" ); break;
- default: ADDTEXT( "!unknown!" );
- }
- sal_uInt8 nUnd;
- rIn >> nUnd;
- ADDTEXT( ") underline=" ); __AddDec( t, nUnd );
- ADDTEXT( " (" );
- switch( nUnd )
- {
- case 0x00: ADDTEXT( "none" ); break;
- case 0x01: ADDTEXT( "single" ); break;
- case 0x02: ADDTEXT( "double" ); break;
- default: ADDTEXT( "!unknown!" );
- }
- ADDTEXT( ") unknown=" ); ADDHEX( 1 );
- ADDTEXT( " " ); ADDHEX( 1 );
- ADDTEXT( " " ); ADDHEX( 1 );
- PRINT();
- LINESTART();
- ADDTEXT( "color=" ); ADDHEX( 4 );
- ADDTEXT( " unknown=" ); ADDHEX( 4 );
- rIn >> __nFlags;
- ADDTEXT( " used-" );
- STARTFLAG();
- __nFlags = ~__nFlags;
- ADDFLAG( 0x00000002, "italic" );
- ADDFLAG( 0x00000080, "strikeout" );
- __nFlags = ~__nFlags;
- ADDRESERVED( 0xFFFFFF65 );
- PRINT();
- LINESTART();
- ADDTEXT( "escape-def=" ); ADDHEX( 4 );
- ADDTEXT( " underl-def=" ); ADDHEX( 4 );
- PRINT();
- ContDump( 18 );
- }
- if( nFlags & 0x10000000 )
- {
- LINESTART(); ADDTEXT( "*** BORDER ***" ); PRINT();
- sal_uInt16 nLine;
- sal_uInt32 nColor;
- rIn >> nLine >> nColor;
- LINESTART();
- ADDTEXT( "line-style=" ); __AddHex( t, nLine );
- ADDTEXT( " (lft=" ); __AddDec( t, (sal_uInt16)(nLine & 0x000F) );
- ADDTEXT( " rgt=" ); __AddDec( t, (sal_uInt16)((nLine & 0x00F0) >> 4) );
- ADDTEXT( " top=" ); __AddDec( t, (sal_uInt16)((nLine & 0x0F00) >> 8) );
- ADDTEXT( " bot=" ); __AddDec( t, (sal_uInt16)((nLine & 0xF000) >> 12) );
- ADDTEXT( ")" );
- PRINT();
- LINESTART();
- ADDTEXT( "line-color=" ); __AddHex( t, nColor );
- ADDTEXT( " (lft=" ); __AddDec( t, (sal_uInt16)(nColor & 0x0000007F) );
- ADDTEXT( " rgt=" ); __AddDec( t, (sal_uInt16)((nColor & 0x00003F80) >> 7) );
- ADDTEXT( " top=" ); __AddDec( t, (sal_uInt16)((nColor & 0x007F0000) >> 16) );
- ADDTEXT( " bot=" ); __AddDec( t, (sal_uInt16)((nColor & 0x3F800000) >> 23) );
- ADDTEXT( ") unknown=" ); ADDHEX( 2 );
- PRINT();
- }
- if( nFlags & 0x20000000 )
- {
- LINESTART(); ADDTEXT( "*** AREA ***" ); PRINT();
- sal_uInt16 nPatt, nColor;
- rIn >> nPatt >> nColor;
- LINESTART();
- ADDTEXT( "pattern=" ); __AddHex( t, nPatt );
- ADDTEXT( " (" ); __AddDec( t, (sal_uInt16)((nPatt & 0xFC00) >> 10) );
- ADDTEXT( ") color=" ); __AddHex( t, nColor );
- ADDTEXT( " (fg=" ); __AddDec( t, (sal_uInt16)(nColor & 0x007F) );
- ADDTEXT( " bg=" ); __AddDec( t, (sal_uInt16)((nColor & 0x3F80) >> 7) );
- ADDTEXT( ")" );
- PRINT();
- }
- if( rIn.IsValid() && nSize1 && (rIn.GetRecLeft() >= nSize1) )
- {
- LINESTART(); ADDTEXT( "*** FORMULA 1 ***" ); PRINT();
- FormulaDump( nSize1, FT_RangeName );
- }
- if( rIn.IsValid() && nSize2 && (rIn.GetRecLeft() >= nSize2) )
- {
- LINESTART(); ADDTEXT( "*** FORMULA 2 ***" ); PRINT();
- FormulaDump( nSize2, FT_RangeName );
- }
- }
- break;
- case 0x01B2: // DVAL - header of DV recs
- {
- rIn >> __nFlags;
- LINESTART();
- STARTFLAG();
- ADDTEXT( " (" );
- __AddPureBin( t, __nFlags );
- ADDTEXT( ")" );
- ADDTEXT( "):" );
- ADDFLAG( 0x0001, "fWnClosed" );
- ADDFLAG( 0x0002, "fWnPinned" );
- ADDFLAG( 0x0004, "fCached" );
- PRINT();
- LINESTART();
- ADDTEXT( "input window: " );
- ADDHEX( 4 );
- ADDTEXT( " / " );
- ADDHEX( 4 );
- PRINT();
- LINESTART();
- ADDTEXT( "object id: " );
- ADDHEX( 4 );
- PRINT();
- LINESTART();
- ADDTEXT( "num of DV recs: " );
- ADDDEC( 4 );
- PRINT();
- }
- break;
- case 0x01B6: // TXO - text box
- {
- LINESTART();
- rIn >> __nFlags;
- STARTFLAG();
- switch( __nFlags & 0x000E )
- {
- case 0x0002: ADDTEXT( " h-left" ); break;
- case 0x0004: ADDTEXT( " h-center" ); break;
- case 0x0006: ADDTEXT( " h-right" ); break;
- case 0x0008: ADDTEXT( " h-block" ); break;
- default: ADDTEXT( " *h-unknown*" );
- }
- switch( __nFlags & 0x0070 )
- {
- case 0x0010: ADDTEXT( " v-top" ); break;
- case 0x0020: ADDTEXT( " v-center" ); break;
- case 0x0030: ADDTEXT( " v-bottom" ); break;
- case 0x0040: ADDTEXT( " v-block" ); break;
- default: ADDTEXT( " *v-unknown*" );
- }
- ADDFLAG( 0x0200, "lock-text" );
- ADDRESERVED( 0xFD81 );
- ADDTEXT( " orient=" );
- sal_uInt16 nOrient = rIn.ReaduInt16();
- __AddDec( t, nOrient );
- ADDTEXT( " (" );
- switch( nOrient )
- {
- case 0: ADDTEXT( "no-rot" ); break;
- case 1: ADDTEXT( "stacked" ); break;
- case 2: ADDTEXT( "90\xB0 ccw" ); break;
- case 3: ADDTEXT( "90\xB0 cw" ); break;
- default: ADDTEXT( "!unknown!" );
- }
- ADDTEXT( ")" );
- PRINT();
- LINESTART();
- ADDTEXT( "reserved=" );
- ADDHEX( 2 ); ADDTEXT( " " ); ADDHEX( 2 ); ADDTEXT( " " ); ADDHEX( 2 );
- ADDTEXT( " text-len=" ); ADDDEC( 2 );
- ADDTEXT( " format-size=" ); ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "reserved=" ); ADDHEX( 2 );
- sal_uInt16 nLinkSize = rIn.ReaduInt16();
- ADDTEXT( " link-size=" ); __AddDec( t, nLinkSize );
- PRINT();
- if( nLinkSize > 0 )
- {
- LINESTART();
- sal_uInt16 nFmlaSize = rIn.ReaduInt16();
- ADDTEXT( "fmla-size=" ); __AddDec( t, nFmlaSize );
- ADDTEXT( " reserved=" ); ADDHEX( 4 );
- PRINT();
- FormulaDump( nFmlaSize, FT_CellFormula );
- }
- }
- break;
- case 0x01BE: // DV - data validation record
- {
- UINT32 __nFlags;
- rIn >> __nFlags;
- LINESTART();
- STARTFLAG();
- ADDTEXT( " (" );
- __AddPureBin( t, __nFlags );
- ADDTEXT( ")" );
- PRINT();
- LINESTART();
- if( __nFlags )
- {
- ADDTEXT( " " );
- ADDFLAG( 0x00000080, "fStrLookup" );
- ADDFLAG( 0x00000100, "fAllowBlank" );
- ADDFLAG( 0x00000200, "fSuppressCombo" );
- ADDFLAG( 0x00040000, "fShowInputMsg" );
- ADDFLAG( 0x00080000, "fShowErrorMsg" );
- }
- PRINT();
- LINESTART();
- ADDTEXT( "error style: " );
- const char* pErrStyle[] = { "stop", "warning", "info", "4" };
- ADDTEXT( pErrStyle[ ( __nFlags >> 4 ) & 0x03 ] );
- PRINT();
- LINESTART();
- const char* pValType[] =
- {
- "all", "integer", "decimal", "list", "date", "time", "text len", "user",
- "8", "9", "A", "B", "C", "D", "E", "F"
- };
- LINESTART();
- ADDTEXT( "validation type: " );
- ADDTEXT( pValType[ __nFlags & 0x0000000F ] );
- PRINT();
-
- const char* pOpType[] =
- {
- "between", "not between", "equal", "not equal",
- "greater", "less", "greater or equal", "less or equal",
- "8", "9", "A", "B", "C", "D", "E", "F"
- };
- LINESTART();
- ADDTEXT( "operator type: " );
- ADDTEXT( pOpType[ ( __nFlags >> 20 ) & 0x0000000F ] );
- PRINT();
-
- LINESTART();
- ADDTEXT( "Prompt Title: " );
- AddUNICODEString( t, rIn );
- PRINT();
- LINESTART();
- ADDTEXT( "Error Title: " );
- AddUNICODEString( t, rIn );
- PRINT();
- LINESTART();
- ADDTEXT( "Prompt Message: " );
- AddUNICODEString( t, rIn );
- PRINT();
- LINESTART();
- ADDTEXT( "Error Message: " );
- AddUNICODEString( t, rIn );
- PRINT();
- if( rIn.GetRecLeft() > 8 )
- {
- UINT16 nLen;
- rIn >> nLen;
- LINESTART();
- ADDTEXT( "Len1: " );
- __AddDec( t, nLen );
- ADDTEXT( " (unknown1: " );
- ADDHEX( 2 );
- ADDTEXT( ")" );
- PRINT();
- FormulaDump( nLen, FT_RangeName );
-
- rIn >> nLen;
- LINESTART();
- ADDTEXT( "Len2: " );
- __AddDec( t, nLen );
- ADDTEXT( " (unknown2: " );
- ADDHEX( 2 );
- ADDTEXT( ")" );
- PRINT();
- FormulaDump( nLen, FT_RangeName );
-
- LINESTART();
- ADDTEXT( "range count: " );
- ADDHEX( 2 );
- PRINT();
- }
-
- while( rIn.GetRecLeft() >= 8 )
- {
- // Row-Row / Col-Col
- UINT16 nR1, nR2, nC1, nC2;
- rIn >> nR1 >> nR2 >> nC1 >> nC2;
- LINESTART();
- AddRangeRef( t, nR1, nC1 | 0xC000, nR2, nC2 | 0xC000, FALSE );
- PRINT();
- }
- }
- break;
- case 0x01B8: // HLINK
- {
- PreDump( nL );
-
- UINT32 n1, n2;
- LINESTART();
- PRINT();
- UINT16 nR1, nR2, nC1, nC2;
- rIn >> nR1 >> nR2 >> nC1 >> nC2;
- ADDTEXT( "Cellrange=" );
- lcl_AddRangeRef( t, nC1, nR1, nC2, nR2 );
- PRINT();
- LINESTART();
- ADDTEXT( "GUID StdLink=" ); __AddGUID( t, rIn );
- PRINT();
- LINESTART();
- ADDTEXT( " must=79EAC9D0-BAF9-11CE-8C82-00AA004BA90B" );
- PRINT();
- LINESTART();
- ADDTEXT( "unknown=" ); ADDHEX( 4 );
- PRINT();
- UINT32 __nFlags = Read4( rIn );
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x00000001, "fBody" );
- ADDFLAG( 0x00000002, "fAbs" );
- ADDFLAG( 0x00000014, "fDescr" );
- ADDFLAG( 0x00000008, "fMark" );
- ADDFLAG( 0x00000080, "fFrame" );
- ADDFLAG( 0x00000100, "fUNC" );
- ADDRESERVED( 0xFFFFFE60 );
- PRINT();
-
- //description
- String aData;
- if( __nFlags & 0x00000014 )
- {
- LINESTART();
- rIn >> n1;
- ADDTEXT( "## Description ## [l=" );
- __AddDec( t, n1 );
- ADDTEXT( "]: '" );
- aData = rIn.ReadRawUniString( (USHORT)(n1 - 1), TRUE );
- t += GETSTR( aData );
- ADDTEXT( "<" ); ADDHEX( 2 ); ADDTEXT( ">'" ); // trailing zero
- PRINT();
- }
-
- // frame name
- if( __nFlags & 0x00000080 )
- {
- LINESTART();
- rIn >> n1;
- ADDTEXT( "## Frame ## [l=" );
- __AddDec( t, n1 );
- ADDTEXT( "]: '" );
- aData = rIn.ReadRawUniString( (USHORT)(n1 - 1), TRUE );
- t += GETSTR( aData );
- ADDTEXT( "<" ); ADDHEX( 2 ); ADDTEXT( ">'" ); // trailing zero
- PRINT();
- }
-
- // network path
- if( __nFlags & 0x00000100 )
- {
- LINESTART();
- rIn >> n1;
- ADDTEXT( "## UNC ## [l=" );
- __AddDec( t, n1 );
- ADDTEXT( "]: '" );
- aData = rIn.ReadRawUniString( (USHORT)(n1 - 1), TRUE );
- t += GETSTR( aData );
- ADDTEXT( "<" ); ADDHEX( 2 ); ADDTEXT( ">'" ); // trailing zero
- PRINT();
- }
-
- // file link or URL
- else if( __nFlags & 0x00000001 )
- {
- rIn.PushPosition();
- rIn >> n1;
- rIn.PopPosition();
- LINESTART();
- ADDTEXT( "## Content GUID ## " );
- __AddGUID( t, rIn );
- switch( n1 )
- {
- case 0x00000303: // file
- {
- ADDTEXT( " File Moniker" );
- PRINT();
- LINESTART();
- ADDTEXT( " must=00000303-0000-0000-C000-000000000046" );
- PRINT();
- LINESTART();
- ADDTEXT( "## File link ## up level=" );
- ADDDEC( 2 );
- rIn >> n2;
- ADDTEXT( " [l=" ); __AddDec( t, n2 );
- ADDTEXT( ", 8-Bit]: '" );
- aData = rIn.ReadRawByteString( (USHORT)(n2 - 1) );
- t += GETSTR( aData );
- ADDTEXT( "<" ); ADDHEX( 1 ); ADDTEXT( ">'" ); // trailing zero
- PRINT();
- ContDump( 24 );
- rIn >> n2;
- LINESTART();
- ADDTEXT( "bytes left=" ); __AddDec( t, n2 );
- if( n2 )
- {
- rIn >> n2;
- LINESTART();
- ADDTEXT( " string byte count=" );
- __AddDec( t, n2 );
- ADDTEXT( " unknown=" );
- ADDHEX( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "[l=" );
- __AddDec( t, n2 / 2 );
- ADDTEXT( "]: '" );
- aData = rIn.ReadRawUniString( (USHORT)n2, TRUE );
- t += GETSTR( aData );
- ADDTEXT( "'" );
- }
- PRINT();
- }
- break;
- case 0x79EAC9E0: // URL
- {
- ADDTEXT( " URL Moniker" );
- PRINT();
- LINESTART();
- ADDTEXT( " must=79EAC9E0-BAF9-11CE-8C82-00AA004BA90B" );
- PRINT();
- rIn >> n2;
- LINESTART();
- ADDTEXT( "## URL ## string byte count=" );
- __AddDec( t, n2 );
- PRINT();
- LINESTART();
- ADDTEXT( "[l=" );
- __AddDec( t, n2 / 2 );
- ADDTEXT( "]: '" );
- aData = rIn.ReadRawUniString( (USHORT)(n2 / 2 - 1), TRUE );
- t += GETSTR( aData );
- ADDTEXT( "<" ); ADDHEX( 2 ); ADDTEXT( ">'" ); // trailing zero
- PRINT();
- }
- break;
- default:
- {
- ADDTEXT( " (!!UNKNOWN!!)" );
- PRINT();
- }
- break;
- }
- }
-
- // text mark
- if( __nFlags & 0x00000008 )
- {
- LINESTART();
- rIn >> n1;
- ADDTEXT( "## Text mark ## [l=" );
- __AddDec( t, n1 );
- ADDTEXT( "]: '" );
- aData = rIn.ReadRawUniString( (USHORT)(n1 - 1), TRUE );
- t += GETSTR( aData );
- ADDTEXT( "<" ); ADDHEX( 2 ); ADDTEXT( ">'" ); // trailing zero
- PRINT();
- }
- }
- break;
- case 0x01BB: // SXFDBTYPE - SQL data type
- {
- ADDTEXT( "SQL data type: " ); ADDHEX( 2 );
- PRINT();
- }
- break;
- case 0x0201:
- {
- LINESTART();
- ADDCELLHEAD();
- PRINT();
- }
- break;
- case 0x0203:
- {
- LINESTART();
- ADDCELLHEAD();
- ADDTEXT( " val = " );
- ADDDOUBLE();
- PRINT();
- }
- break;
- case 0x0205:
- {
- LINESTART();
- ADDCELLHEAD();
- ADDTEXT( " val = " ); ADDHEX( 1 );
- ADDTEXT( " type = " ); ADDDEC( 1 );
- PRINT();
- }
- break;
- case 0x0208: // ROW - row info
- {
- LINESTART();
- ADDTEXT( "row #: " ); ADDDEC( 2 );
- ADDTEXT( " def. cols: " ); ADDDEC( 2 );
- ADDTEXT( "-" ); ADDDEC( 2 );
- ADDTEXT( " ht: " ); ADDDEC( 2 );
- ADDTEXT( " reserved: " ); ADDHEX( 4 );
- PRINT();
- rIn >> __nFlags;
- LINESTART();
- STARTFLAG();
- ADDTEXT( " outlnlev=" );
- __AddDec( t, (UINT16)(__nFlags & 0x0007) );
- ADDFLAG( 0x0010, "fCollapsed" );
- ADDFLAG( 0x0020, "fRowHeightZero" );
- ADDFLAG( 0x0040, "fUnsynced" );
- ADDFLAG( 0x0080, "fGhostDirty" );
- ADDRESERVED( 0xFF08 );
- PRINT();
- UINT16 nXF;
- rIn >> nXF;
- LINESTART();
- ADDTEXT( "ix to XF: " ); __AddDec( t, (UINT16)(nXF & 0x0FFF) );
- ADDTEXT( " add. flags(" ); __AddHex( t, nXF );
- ADDTEXT( "):" );
- ADDFLAG( 0x1000, "fExAsc" );
- ADDFLAG( 0x2000, "fExDsc" );
- ADDRESERVED( 0xC000 );
- PRINT();
- }
- break;
- case 0x0021: // ARRAY
- case 0x0221:
- {
- UINT16 nR1, nR2;
- UINT8 nC1, nC2;
- rIn >> nR1 >> nR2 >> nC1 >> nC2 >> __nFlags;
- LINESTART();
- ADDTEXT( "range: " );
- lcl_AddRangeRef( t, nC1, nR1, nC2, nR2 );
- PRINT();
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x0001, "fAlwaysCalc" );
- ADDFLAG( 0x0002, "fCalcOnLoad" );
- ADDRESERVED( 0xFFFC );
- PRINT();
- LINESTART();
- ADDTEXT( "chn = " );
- ADDHEX( 4 );
- UINT16 n;
- rIn >> n;
- ADDTEXT( " cce = " );
- __AddDec( t, n );
- PRINT();
- FormulaDump( n, FT_SharedFormula );
- }
- break;
- case 0x0225: // DEFAULTROWHEIGHT - height & flags
- {
- rIn >> __nFlags;
- LINESTART();
- ADDTEXT( "default row " );
- STARTFLAG();
- ADDFLAG( 0x0001, "fUnsynced" );
- ADDFLAG( 0x0002, "fRowHtZero" );
- ADDFLAG( 0x0004, "fExAsc" );
- ADDFLAG( 0x0008, "fExDsc" );
- ADDRESERVED( 0xFFF0 );
- PRINT();
- LINESTART();
- ADDTEXT( "default row height: " );
- ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0x023E: // WINDOW2
- {
- LINESTART();
- rIn >> __nFlags;
- STARTFLAG();
- ADDFLAG( 0x0001, "show-formulas" );
- ADDFLAG( 0x0002, "show-grid" );
- ADDFLAG( 0x0004, "show-headers" );
- ADDFLAG( 0x0008, "frozen" );
- ADDFLAG( 0x0010, "show-zero" );
- ADDFLAG( 0x0020, "auto-grid-color" );
- ADDFLAG( 0x0040, "right-to-left" );
- ADDFLAG( 0x0080, "show-outline" );
- ADDFLAG( 0x0100, "remove-splits" );
- ADDFLAG( 0x0200, "sheet-selected" );
- ADDFLAG( 0x0400, "sheet-visible" );
- ADDFLAG( 0x0800, "show-pagebreak" );
- ADDRESERVED( 0xF000 );
- PRINT();
- LINESTART();
- ADDTEXT( "first-row=" ); ADDDEC( 2 );
- ADDTEXT( " first-col=" ); ADDDEC( 2 );
- ADDTEXT( " grid-color=" ); ADDDEC( 2 );
- ADDTEXT( " reserved=" ); ADDHEX( 2 );
- PRINT();
- // reallife: WINDOW2 in charts do not have teh following fields
- if( rIn.GetRecLeft() >= 8 )
- {
- LINESTART();
- ADDTEXT( "pagebreak-zoom=" ); ADDDEC( 2 );
- ADDTEXT( "% view-zoom=" ); ADDDEC( 2 );
- ADDTEXT( "% reserved=" ); ADDHEX( 4 );
- PRINT();
- }
- }
- break;
- case 0x027E:
- {
- ADDCELLHEAD();
- ADDTEXT( " val = " );
- __AddRK( t, rIn.ReadInt32() );
- PRINT();
- }
- break;
- case 0x0293: // STYLE
- {
- LINESTART();
- sal_uInt16 nXF;
- rIn >> nXF;
- ADDTEXT( "xf-ref=" ); __AddHex( t, nXF );
- ADDTEXT( " (xf=#" ); __AddDec( t, static_cast< sal_uInt16 >( nXF & EXC_STYLE_XFMASK ) );
- if( ::get_flag( nXF, EXC_STYLE_BUILTIN ) )
- {
- sal_uInt8 nStyleId, nLevel;
- rIn >> nStyleId >> nLevel;
- ADDTEXT( " builtin) style-id=" ); __AddDec( t, nStyleId );
- ADDTEXT( " (" );
- static const sal_Char* ppcStyles[] = {
- "Normal", "RowLevel", "ColLevel", "Comma", "Currency",
- "Percent", "Comma_0", "Currency_0",
- "Hyperlink", "Followed_Hyperlink" };
- if( nStyleId < STATIC_TABLE_SIZE( ppcStyles ) )
- ADDTEXT( ppcStyles[ nStyleId ] );
- else
- ADDTEXT( "!unknown!" );
- ADDTEXT( ") outline-level=" ); __AddDec( t, nLevel );
- }
- else
- {
- ADDTEXT( ") name=" );
- AddUNICODEString( t, rIn );
- }
- PRINT();
- }
- break;
- case 0x041E:
- {
- LINESTART();
- ADDTEXT( "Index: " ); ADDHEX( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "Format: " ); AddUNICODEString( t, rIn );
- PRINT();
- }
- break;
- case 0x04BC:
- {
- UINT16 nR1, nR2;
- UINT8 nC1, nC2;
- LINESTART();
- rIn >> nR1 >> nR2 >> nC1 >> nC2;
- lcl_AddRangeRef( t, nC1, nR1, nC2, nR2 );
- PRINT();
- LINESTART();
- ADDTEXT( "reserved = " );
- __AddPureHex( t, Read2( rIn ) );
- UINT16 n;
- rIn >> n;
- ADDTEXT( " cce = " );
- __AddDec( t, n );
- PRINT();
- FormulaDump( n, FT_SharedFormula );
- }
- break;
- case 0x0803: // WEBQRYSETTINGS - web query: options
- {
- UINT16 nCnt;
- LINESTART();
- ADDTEXT( "repeated recnum: " );
- ADDHEX( 2 );
- ADDTEXT( " unknown:" );
- for( nCnt = 0; nCnt < 3; nCnt++ )
- {
- ADDTEXT( " " );
- ADDHEX( 2 );
- }
- PRINT();
- LINESTART();
- rIn >> __nFlags;
- STARTFLAG();
- ADDFLAG( 0x0001, "fImportPRE" );
- ADDFLAG( 0x0002, "fIgnoreSep" );
- ADDFLAG( 0x0004, "fUseSetting" );
- ADDFLAG( 0x0010, "fIgnoreDate" );
- ADDFLAG( 0x0020, "fWhatIsIt?" );
- ADDRESERVED( 0xFFC8 );
- PRINT();
- LINESTART();
- rIn >> __nFlags;
- STARTFLAG();
- ADDFLAG( 0x0002, "fTables" );
- ADDRESERVED( 0xFFFD );
- PRINT();
- LINESTART();
- ADDTEXT( "unknown: " ); ADDHEX( 2 );
- ADDTEXT( " " ); ADDHEX( 2 );
- ADDTEXT( " " ); ADDHEX( 2 );
- ADDTEXT( " " ); ADDHEX( 2 );
- ADDTEXT( " " ); ADDHEX( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "refresh: " ); ADDDEC( 2 );
- ADDTEXT( " unknown: " ); ADDHEX( 2 );
- ADDTEXT( " " ); ADDHEX( 2 );
- PRINT();
- }
- break;
- case 0x0804: // WEBQRYTABLES - web query: selected tables
- {
- LINESTART();
- ADDTEXT( "repeated recnum: " ); ADDHEX( 2 );
- ADDTEXT( " unknown: " ); ADDHEX( 2 );
- PRINT();
- if( nL > 6 )
- {
- LINESTART();
- ADDTEXT( "text: " );
- AddUNICODEString( t, rIn );
- PRINT();
- }
- }
- break;
- case 0x0809: // BOF
- {
- rIn.DisableDecryption();
- LINESTART();
- ADDTEXT( "version number: " );
- ADDHEX( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "substream type: " );
- rIn >> mnSubstream;
- __AddHex( t, mnSubstream );
- ADDTEXT( " (" );
- switch( mnSubstream )
- {
- case 0x0005: p = "Workbook globals"; break;
- case 0x0006: p = "Visual Basic module"; break;
- case 0x0010: p = "Worksheet or dialog sheet"; break;
- case 0x0020: p = "Chart"; break;
- case 0x0040: p = "MS 4.0 Macro"; break;
- case 0x0100: p = "Workspace file"; break;
- default: p = pU;
- }
- ADDTEXT( p );
- ADDTEXT( ")" );
- PRINT();
- LINESTART();
- UINT16 n;
- rIn >> n;
- ADDTEXT( "build identifier: ");
- __AddHex( t, n );
- ADDTEXT( " (=" );
- __AddDec( t, n );
- ADDTEXT( ")" );
- PRINT();
-
- LINESTART();
- rIn >> n;
- ADDTEXT( "build year: ");
- __AddHex( t, n );
- ADDTEXT( " (=" );
- __AddDec( t, n );
- ADDTEXT( ")" );
- PRINT();
-
- UINT32 __nFlags;
- rIn >> __nFlags;
- LINESTART();
- ADDTEXT( "file history " );
- STARTFLAG();
- if( __nFlags )
- {
- ADDFLAG( 0x00000001, "fWin" );
- ADDFLAG( 0x00000002, "fRisc" );
- ADDFLAG( 0x00000004, "fBeta" );
- ADDFLAG( 0x00000008, "fWinAny" );
- ADDFLAG( 0x00000010, "fMacAny" );
- ADDFLAG( 0x00000020, "fBetaAny" );
- ADDFLAG( 0x00000100, "fRiscAny" );
- ADDRESERVED( 0xFFFFE0C0 );
- }
- PRINT();
-
- LINESTART();
- ADDTEXT( "lowest BIFF version: ");
- ADDHEX( 4 );
- PRINT();
- }
- break;
- case 0x1002: // ChartChart
- {
- LINESTART();
- ADDTEXT( "Pos = " );
- ADD16P16();
- ADDTEXT( " / " );
- ADD16P16();
- ADDTEXT( " Size = " );
- ADD16P16();
- ADDTEXT( " / " );
- ADD16P16();
- PRINT();
- }
- break;
- case 0x1003: // ChartSeries
- {
- sal_uInt16 nCatType, nValType, nCatCnt, nValCnt, nBubType, nBubCnt;
- rIn >> nCatType >> nValType >> nCatCnt >> nValCnt >> nBubType >> nBubCnt;
- LINESTART();
- ADDTEXT( "category-type=" ); __AddDec( t, nCatType );
- ADDTEXT( " " ); ADDTEXT( GetSeriesType( nCatType ) );
- ADDTEXT( " count=" ); __AddDec( t, nCatCnt );
- PRINT();
- LINESTART();
- ADDTEXT( " value-type=" ); __AddDec( t, nValType );
- ADDTEXT( " " ); ADDTEXT( GetSeriesType( nValType ) );
- ADDTEXT( " count=" ); __AddDec( t, nValCnt );
- PRINT();
- LINESTART();
- ADDTEXT( " bubble-type=" ); __AddDec( t, nBubType );
- ADDTEXT( " " ); ADDTEXT( GetSeriesType( nBubType ) );
- ADDTEXT( " count=" ); __AddDec( t, nBubCnt );
- PRINT();
- }
- break;
- case 0x1006: // ChartDataformat
- {
- INT16 n;
- LINESTART();
- rIn >> n;
- ADDTEXT( "Point number = " );
- __AddDec( t, n );
- if( n == -1 )
- ADDTEXT( " (entire series)" );
- PRINT();
- LINESTART();
- ADDTEXT( "Series index = " );
- ADDDEC( 2 );
- ADDTEXT( " Series number = " );
- ADDDEC( 2 );
- if( Read2( rIn ) & 0x01 )
- ADDTEXT( " (fXL4iss)" );
- PRINT();
- }
- break;
- case 0x1007: // ChartLineform
- {
- LINESTART();
- ADDTEXT( "Color = " );
- ADDTEXT( GetRGB( Read4( rIn ) ) );
- ADDTEXT( " Pattern : " );
- ADDTEXT( GetLineType( Read2( rIn ) ) );
- switch( ( INT16 ) Read2( rIn ) )
- {
- case -1: p = "hairline"; break;
- case 0: p = "narrow (single)"; break;
- case 1: p = "medium (double)"; break;
- case 2: p = "wide (triple)"; break;
- default: p = pU;
- }
- ADDTEXT( ", " );
- ADDTEXT( p );
- PRINT();
- rIn >> __nFlags;
- if( __nFlags )
- {
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x0001, "fAuto" );
- ADDFLAG( 0x0004, "fDrawTick" );
- PRINT();
- }
- LINESTART();
- ADDTEXT( "color index = " );
- ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0x1009: // ChartMarkerformat
- {
- UINT16 n;
- LINESTART();
- ADDTEXT( "Fore = " );
- ADDTEXT( GetRGB( Read4( rIn ) ) );
- ADDTEXT( " Back = " );
- ADDTEXT( GetRGB( Read4( rIn ) ) );
- rIn >> n;
- switch( n )
- {
- case 0: p = "no marker"; break;
- case 1: p = "square"; break;
- case 2: p = "diamond"; break;
- case 3: p = "triangle"; break;
- case 4: p = "X"; break;
- case 5: p = "star"; break;
- case 6: p = "Dow-Jones"; break;
- case 7: p = "std deviation"; break;
- case 8: p = "circle"; break;
- case 9: p = "plus sign"; break;
- default: p = pU;
- }
- ADDTEXT( " Type = " );
- ADDTEXT( p );
- PRINT();
- rIn >> __nFlags;
- if( __nFlags )
- {
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x0001, "fAuto" );
- ADDFLAG( 0x0010, "fNoBackg" );
- ADDFLAG( 0x0020, "fNoFore" );
- ADDRESERVED( 0xFFCE );
- PRINT();
- }
- LINESTART();
- ADDTEXT( "border color = " );
- ADDDEC( 2 );
- ADDTEXT( " fill color = " );
- ADDDEC( 2 );
- ADDTEXT( " size = " );
- ADDDEC(4);
- PRINT();
- }
- break;
- case 0x100A: // ChartAreaformat
- {
- LINESTART();
- ADDTEXT( "Fore = " );
- ADDTEXT( GetRGB( Read4( rIn ) ) );
- ADDTEXT( " Back = " );
- ADDTEXT( GetRGB( Read4( rIn ) ) );
- ADDTEXT( " Pattern = " );
- UINT16 n;
- rIn >> n >> __nFlags;
- __AddDec( t, n );
- ADDTEXT( " (" );
- __AddHex( t, n );
- ADDTEXT( ")" );
- PRINT();
- if( __nFlags )
- {
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x01, "fAuto" );
- ADDFLAG( 0x02, "fInvertNeg" );
- PRINT();
- }
- }
- LINESTART();
- ADDTEXT( "color index fore = " );
- ADDDEC( 2 );
- ADDTEXT( ", back = " );
- ADDDEC( 2 );
- PRINT();
- break;
- case 0x100B: // ChartPieformat
- LINESTART();
- ADDDEC( 2 );
- ADDTEXT( "%" );
- PRINT();
- break;
- case 0x100C: // ChartAttachedlabel
- ContDump( nL );
- break;
- case 0x100D: // ChartSeriestext
- ContDump( nL );
- break;
- case 0x1014: // ChartChartformat
- {
- ContDump( 16 );
- LINESTART();
- rIn >> __nFlags;
- if( __nFlags )
- {
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x0001, "fVaried" );
- PRINT();
- }
- LINESTART();
- ADDTEXT( "drawing order = " );
- ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0x1015: // ChartLegend
- {
- UINT32 nX, nY, nDx, nDy;
- UINT8 nWType, nWSpacing;
- rIn >> nX >> nY >> nDx >> nDy >> nWType >> nWSpacing >> __nFlags;
- LINESTART();
- __AddDec( t, nX );
- ADDTEXT( " / " );
- __AddDec( t, nY );
- ADDTEXT( " [" );
- __AddDec( t, nDx );
- ADDTEXT( " / " );
- __AddDec( t, nDy );
- ADDTEXT( "]" );
- PRINT();
- LINESTART();
- ADDTEXT( " Type: " );
- switch( nWType )
- {
- case 0: p = "bottom"; break;
- case 1: p = "corner"; break;
- case 2: p = "top"; break;
- case 3: p = "right"; break;
- case 4: p = "left"; break;
- case 7: p = "not docked or inside the plot area"; break;
- default: p = pU;
- }
- ADDTEXT( p );
- ADDTEXT( " Spacing: " );
- switch( nWSpacing )
- {
- case 0: p = "close"; break;
- case 1: p = "medium"; break;
- case 2: p = "open"; break;
- default: p = pU;
- }
- ADDTEXT( p );
- PRINT();
- if( __nFlags )
- {
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x01, "fAutoPosition" );
- ADDFLAG( 0x02, "fAutoSeries" );
- ADDFLAG( 0x04, "fAutoPosX" );
- ADDFLAG( 0x08, "fAutoPosY" );
- ADDFLAG( 0x10, "fVert" );
- ADDFLAG( 0x20, "fWasDataTable" );
- PRINT();
- }
- }
- break;
- case 0x1016: // ChartSerieslist
- ContDump( nL );
- break;
- case 0x1017: // ChartBar
- {
- LINESTART();
- ADDTEXT( "space betw. bars = " );
- ADDDEC( 2 );
- ADDTEXT( " space betw. cat = " );
- ADDDEC( 2 );
- PRINT();
- rIn >> __nFlags;
- if( __nFlags )
- {
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x0001, "fTranspose" );
- ADDFLAG( 0x0002, "fStacked" );
- ADDFLAG( 0x0004, "f100" );
- ADDFLAG( 0x0008, "fHasShadow" );
- PRINT();
- }
- }
- break;
- case 0x1018: // ChartLine
- ContDump( nL );
- break;
- case 0x1019: // ChartPie
- ContDump( nL );
- break;
- case 0x101A: // ChartArea
- ContDump( nL );
- break;
- case 0x101C: // ChartLine
- ContDump( nL );
- break;
- case 0x101D: // ChartAxis
- {
- static const sal_Char* const ppcIds[] = { "x-axis", "y-axis", "z-axis" };
- LINESTART();
- sal_uInt16 nAxisId = rIn.ReaduInt16();
- ADDTEXT( "axis-id=" ); __AddDec( t, nAxisId );
- lcl_AddEnum( t, nAxisId, ppcIds, STATIC_TABLE_SIZE( ppcIds ) );
- PRINT();
- ContDump( 16 );
- }
- break;
- case 0x101E: // CHTICK
- {
- static const sal_Char* const ppcTickMode[] = { "off", "inside", "outside", "cross" };
- static const sal_Char* const ppcTickPos[] = { "off", "low", "high", "next-to-axis" };
- static const sal_Char* const ppcText[] = { "transparent", "opaque" };
- LINESTART();
- sal_uInt8 nMajor, nMinor, nPos, nText;
- rIn >> nMajor >> nMinor >> nPos >> nText;
- ADDTEXT( "major=" ); __AddDec( t, nMajor );
- lcl_AddEnum( t, nMajor, ppcTickMode, STATIC_TABLE_SIZE( ppcTickMode ) );
- ADDTEXT( " minor=" ); __AddDec( t, nMinor );
- lcl_AddEnum( t, nMinor, ppcTickMode, STATIC_TABLE_SIZE( ppcTickMode ) );
- PRINT();
- LINESTART();
- ADDTEXT( "position=" ); __AddDec( t, nPos );
- lcl_AddEnum( t, nPos, ppcTickPos, STATIC_TABLE_SIZE( ppcTickPos ) );
- ADDTEXT( " text-mode=" ); __AddDec( t, nText );
- lcl_AddEnum( t, nText, ppcText, STATIC_TABLE_SIZE( ppcText ) );
- ADDTEXT( " text-color=" );
- ADDTEXT( GetRGB( Read4( rIn ) ) );
- PRINT();
- LINESTART();
- ADDTEXT( "reserved=" ); ADDHEX( 4 );
- ADDTEXT( "," ); ADDHEX( 4 );
- ADDTEXT( "," ); ADDHEX( 4 );
- ADDTEXT( "," ); ADDHEX( 4 );
- PRINT();
- rIn >> __nFlags;
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x0001, "fAutoCol" );
- ADDFLAG( 0x0002, "fAutoBack" );
- ADDFLAG( 0x0020, "fAutoRot" );
- ADDRESERVED( 0xFFDC );
- PRINT();
- LINESTART();
- ADDTEXT( "color=" ); ADDDEC( 2 );
- ADDTEXT( " rotation=" ); ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0x101F: // CHVALUERANGE
- {
- LINESTART();
- ADDTEXT( "min=" ); ADDDOUBLE();
- ADDTEXT( " max=" ); ADDDOUBLE();
- ADDTEXT( " major=" ); ADDDOUBLE();
- ADDTEXT( " minor=" ); ADDDOUBLE();
- ADDTEXT( " axis-cross=" ); ADDDOUBLE();
- PRINT();
- rIn >> __nFlags;
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x0001, "fAutoMin" );
- ADDFLAG( 0x0002, "fAutoMax" );
- ADDFLAG( 0x0004, "fAutoMajor" );
- ADDFLAG( 0x0008, "fAutoMinor" );
- ADDFLAG( 0x0010, "fAutoCross" );
- ADDFLAG( 0x0020, "fLogScale" );
- ADDFLAG( 0x0040, "fReverse" );
- ADDFLAG( 0x0080, "fMaxCross" );
- ADDRESERVED( 0xFF00 );
- PRINT();
- }
- break;
- case 0x1020: // CHEXTRANGE
- {
- LINESTART();
- ADDTEXT( "axis-cross=" ); ADDDEC( 2 );
- ADDTEXT( " label-freq=" ); ADDDEC( 2 );
- ADDTEXT( " mark-freq=" ); ADDDEC( 2 );
- PRINT();
- rIn >> __nFlags;
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x0001, "fBetween" );
- ADDFLAG( 0x0002, "fMaxCross" );
- ADDFLAG( 0x0004, "fReverse" );
- ADDRESERVED( 0xFFF8 );
- PRINT();
- }
- break;
- case 0x1021: // ChartAxislineformat
- {
- LINESTART();
- switch( Read2( rIn ) )
- {
- case 0: p = "axis line itself"; break;
- case 1: p = "major grid line"; break;
- case 2: p = "minor grid line"; break;
- case 3: p = "walls or floor"; break;
- default: p = pU;
- }
- ADDTEXT( p );
- PRINT();
- }
- break;
- case 0x1022: // CHARTFORMATLINK
- ContDump( nL );
- break;
- case 0x1024: // ChartDefaulttext
- ContDump( nL );
- break;
- case 0x1025: // ChartText
- {
- LINESTART();
- UINT8 nAt, nVat;
- UINT16 nBkgMode;
- INT32 nX, nY, nDx, nDy;
- UINT16 nGrbit2, nIcvText;
- INT16 nTrot;
- rIn >> nAt >> nVat >> nBkgMode;
- ADDTEXT( "h = " );
- switch( nAt )
- {
- case 1: p = "left"; break;
- case 2: p = "center"; break;
- case 3: p = "right"; break;
- case 4: p = "justify"; break;
- case 5: p = "distribute"; break;
- default: p = pU;
- }
- ADDTEXT( p );
- ADDTEXT( " v = " );
- switch( nVat )
- {
- case 1: p = "top"; break;
- case 2: p = "center"; break;
- case 3: p = "bottom"; break;
- case 4: p = "justify"; break;
- case 5: p = "distribute"; break;
- default: p = pU;
- }
- ADDTEXT( p );
- ADDTEXT( " mode = " );
- if( nBkgMode == 1 )
- ADDTEXT( "transparent" );
- else if( nBkgMode == 2 )
- ADDTEXT( "opaque" );
- else
- ADDTEXT( pU );
- PRINT();
- LINESTART();
- ADDTEXT( "color = " );
- ADDTEXT( GetRGB( Read4( rIn ) ) );
- rIn >> nX >> nY >> nDx >> nDy >> __nFlags >> nIcvText >> nGrbit2 >> nTrot;
- ADDTEXT( " pos[size] = " );
- __AddDec( t, nX );
- ADDTEXT( " / " );
- __AddDec( t, nY );
- ADDTEXT( " [" );
- __AddDec( t, nDx );
- ADDTEXT( " / " );
- __AddDec( t, nDy );
- ADDTEXT( "]" );
- PRINT();
- LINESTART();
- ADDTEXT( " (pos[size] = " );
- __AddHex( t, nX );
- ADDTEXT( " / " );
- __AddHex( t, nY );
- ADDTEXT( " [" );
- __AddHex( t, nDx );
- ADDTEXT( " / " );
- __AddHex( t, nDy );
- ADDTEXT( "])" );
- PRINT();
- if( __nFlags )
- {
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x0001, "fAutoColor" );
- ADDFLAG( 0x0002, "fShowKey" );
- ADDFLAG( 0x0004, "fShowValue" );
- ADDFLAG( 0x0008, "fVert" );
- ADDFLAG( 0x0010, "fAutoText" );
- ADDFLAG( 0x0020, "fGenerated" );
- ADDFLAG( 0x0040, "fDeleted" );
- ADDFLAG( 0x0080, "fAutoMode" );
- ADDFLAG( 0x0800, "fShLabPct" );
- ADDFLAG( 0x1000, "fShowPct" );
- ADDFLAG( 0x2000, "fShowBubbleSizes" );
- ADDFLAG( 0x4000, "fShowLabel" );
- PRINT();
- }
- LINESTART();
- ADDTEXT( "rot = " );
- switch( __nFlags & 0x0700 )
- {
- case 0x0000: p = "no rotation"; break;
- case 0x0100: p = "top to bottom, upright"; break;
- case 0x0200: p = "90 deg counterclockwise"; break;
- case 0x0300: p = "90 deg clockwise"; break;
- default: p = pU;
- }
- ADDTEXT( p );
- ADDTEXT( " trot = " );
- __AddDec( t, nTrot );
- PRINT();
- LINESTART();
- ADDTEXT( "text color = " );
- __AddDec( t, nIcvText );
- PRINT();
- LINESTART();
- ADDTEXT( "placement: " );
- switch( nGrbit2 & 0x000F )
- {
- case 0: p = "0 default"; break;
- case 1: p = "outside"; break;
- case 2: p = "inside"; break;
- case 3: p = "center"; break;
- case 4: p = "axis"; break;
- case 5: p = "above"; break;
- case 6: p = "below"; break;
- case 7: p = "left"; break;
- case 8: p = "right"; break;
- case 9: p = "auto"; break;
- case 10: p = "moved"; break;
- default: p = pU;
- }
- ADDTEXT( p );
- PRINT();
- }
- break;
- case 0x1026: // ChartFontx
- ContDump( nL );
- break;
- case 0x1027: // CHOBJECTLINK
- {
- static const sal_Char* const ppcObjLink[] = { 0, "title", "y-axis", "x-axis", "data", "legend", "none", "z-axis" };
- LINESTART();
- sal_uInt16 nObjLink;
- rIn >> nObjLink;
- ADDTEXT( "link=" ); __AddDec( t, nObjLink );
- lcl_AddEnum( t, nObjLink, ppcObjLink, STATIC_TABLE_SIZE( ppcObjLink ) );
- ADDTEXT( " series=" ); ADDDEC( 2 );
- ADDTEXT( " point=" ); ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0x1032: // ChartFrame
- {
- LINESTART();
- switch( Read2( rIn ) )
- {
- case 0: p = "no border"; break;
- case 1:
- case 2:
- case 3: p = "reserved"; break;
- case 4: p = "with shadow"; break;
- default: p = pU;
- }
- ADDTEXT( "Frame type: " );
- ADDTEXT( p );
- PRINT();
- rIn >> __nFlags;
- if( __nFlags )
- {
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x01, "fAutoSize" );
- ADDFLAG( 0x02, "fAutoPosition" );
- PRINT();
- }
- }
- break;
- case 0x1035: // ChartPlotarea
- ContDump( nL );
- break;
- case 0x103A: // Chart3D
- ContDump( nL );
- break;
- case 0x103C: // ChartPicf
- LINESTART();
- ADDTEXT( "bmp-mode=" ); ADDDEC( 2 );
- ADDTEXT( " format=" ); ADDDEC( 2 );
- ADDTEXT( " flags=" ); ADDHEX( 2 );
- ADDTEXT( " scale=" ); ADDDOUBLE();
- PRINT();
- break;
- case 0x103D: // ChartDropbar
- ContDump( nL );
- break;
- case 0x103E: // ChartRadar
- ContDump( nL );
- break;
- case 0x103F: // ChartSurface
- ContDump( nL );
- break;
- case 0x1040: // ChartRadararea
- ContDump( nL );
- break;
- case 0x1041: // ChartAxisparent
- {
- LINESTART();
- switch( Read2( rIn ) )
- {
- case 0: p = "main"; break;
- case 1: p = "secondary"; break;
- default: p = pU;
- }
- ADDTEXT( "Index: " );
- ADDTEXT( p );
- ADDTEXT( " " );
- ADDDEC(4);
- ADDTEXT( '/' );
- ADDDEC(4);
- ADDTEXT( " [" );
- ADDDEC(4);
- ADDTEXT( '/' );
- ADDDEC(4);
- ADDTEXT( ']' );
- PRINT();
- }
- break;
- case 0x1043: // ChartLegendxn
- ContDump( nL );
- break;
- case 0x1044: // ChartShtprops
- ContDump( nL );
- break;
- case 0x1045: // ChartSertocrt
- ContDump( nL );
- break;
- case 0x1046: // ChartAxesused
- {
- LINESTART();
- ADDTEXT( "Used : " );
- ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0x1048: // ChartSbaseref
- ContDump( nL );
- break;
- case 0x104A: // CHSERPARENT
- LINESTART();
- ADDTEXT( "parent-index=" ); ADDDEC( 2 );
- ADDTEXT( " (one-based)" );
- PRINT();
- break;
- case 0x104B: // CHSERTRENDLINE
- {
- static const sal_Char* const ppcType[] =
- { "poynomial", "exponential", "logarithmic", "power", "moving-avg" };
- sal_uInt8 nType;
- rIn >> nType;
- LINESTART();
- ADDTEXT( "line-type=" ); __AddDec( t, nType );
- lcl_AddEnum( t, nType, ppcType, STATIC_TABLE_SIZE( ppcType ) );
- ADDTEXT( " order=" ); ADDDEC( 1 );
- ADDTEXT( " intercept=" ); ADDDOUBLE();
- PRINT();
- LINESTART();
- ADDTEXT( "show-equation=" ); ADDDEC( 1 );
- ADDTEXT( " show-r-sqr=" ); ADDDEC( 1 );
- PRINT();
- LINESTART();
- ADDTEXT( "forecast-for=" ); ADDDOUBLE();
- ADDTEXT( " forecast-back=" ); ADDDOUBLE();
- PRINT();
- }
- break;
- case 0x104E: // ChartIfmt
- ContDump( nL );
- break;
- case 0x104F: // ChartPos
- {
- LINESTART();
- UINT16 nMdTopLt, nMdBotRt;
- INT32 nX, nY, nDx, nDy;
- rIn >> nMdTopLt >> nMdBotRt >> nX >> nY >> nDx >> nDy;
- ADDTEXT( "TopLr = " );
- __AddDec( t, nMdTopLt );
- ADDTEXT( " BotRt = " );
- __AddDec( t, nMdBotRt );
- PRINT();
- LINESTART();
- __AddDec( t, nX );
- ADDTEXT( " / " );
- __AddDec( t, nY );
- ADDTEXT( " [" );
- __AddDec( t, nDx );
- ADDTEXT( " / " );
- __AddDec( t, nDy );
- ADDTEXT( "]" );
- PRINT();
- }
- break;
- case 0x1050: // ChartAlruns
- ContDump( nL );
- break;
- case 0x1051: // AI
- {
- LINESTART();
- UINT8 n8 = Read1( rIn );
- switch( n8 )
- {
- case 0: p = "title or text"; break;
- case 1: p = "values"; break;
- case 2: p = "categories"; break;
- case 3: p = "bubble sizes"; break;
- default: p = pU;
- }
- ADDTEXT( "Link index identifier: " );
- ADDTEXT( p );
- if ( p == pU )
- __AddHex( t, n8 );
- PRINT();
- LINESTART();
- switch( Read1( rIn ) )
- {
- case 0: p = "default categories"; break;
- case 1: p = "text or value"; break;
- case 2: p = "linked to worksheet"; break;
- case 3: p = "not used (HaHaHa...)"; break;
- case 4: p = "error reported"; break;
- default: p = pU;
- }
- ADDTEXT( "Refernce type: " );
- ADDTEXT( p );
- PRINT();
- rIn >> __nFlags;
- if( __nFlags )
- {
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x01, "fCustomIfmt" );
- PRINT();
- }
- LINESTART();
- ADDTEXT( "Numberformat = " );
- ADDDEC( 2 );
- PRINT();
- LINESTART();
- UINT16 n;
- rIn >> n;
- ADDTEXT( "Formula [" );
- __AddDec( t, n );
- ADDTEXT( "]: ---------------- " );
- PRINT();
- FormulaDump( n, FT_CellFormula );
- }
- break;
- case 0x105B: // CHSERERRORBAR
- {
- static const sal_Char* const ppcType[] = { 0, "x-plus", "x-minus", "y-plus", "y-minus" };
- static const sal_Char* const ppcSource[] = { 0, "percent", "fixed", "std-dev", "custom", "std-error" };
- static const sal_Char* const ppcLineEnd[] = { "blank", "t-shape" };
- sal_uInt8 nType, nSource, nLineEnd;
- rIn >> nType >> nSource >> nLineEnd;
- LINESTART();
- ADDTEXT( "bar-type=" ); __AddDec( t, nType );
- lcl_AddEnum( t, nType, ppcType, STATIC_TABLE_SIZE( ppcType ) );
- ADDTEXT( " value-source=" ); __AddDec( t, nSource );
- lcl_AddEnum( t, nSource, ppcSource, STATIC_TABLE_SIZE( ppcSource ) );
- ADDTEXT( " line-end=" ); __AddDec( t, nLineEnd );
- lcl_AddEnum( t, nLineEnd, ppcLineEnd, STATIC_TABLE_SIZE( ppcLineEnd ) );
- PRINT();
- LINESTART();
- ADDTEXT( "reserved=" ); ADDHEX( 1 );
- ADDTEXT( " value=" ); ADDDOUBLE();
- ADDTEXT( " ref-count=" ); ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0x105D: // ChartSerfmt
- ContDump( nL );
- break;
- case 0x105F: // Chart3DDataForm
- {
- UINT8 nGround, nTop;
- nGround = Read1( rIn );
- nTop = Read1( rIn );
- UINT16 nStyle = ((UINT16)nGround << 8) | nTop;
- LINESTART();
- ADDTEXT( "3D - format (" );
- __AddHex( t, nGround );
- ADDTEXT( " " );
- __AddHex( t, nTop );
- ADDTEXT( "): " );
- switch( nStyle )
- {
- case 0x0000: ADDTEXT( "bar" ); break;
- case 0x0001: ADDTEXT( "pyramid" ); break;
- case 0x0002: ADDTEXT( "pyramid, cut" ); break;
- case 0x0100: ADDTEXT( "cylinder" ); break;
- case 0x0101: ADDTEXT( "cone" ); break;
- case 0x0102: ADDTEXT( "cone, cut" ); break;
- default: ADDTEXT( pU );
- }
- PRINT();
- }
- break;
- case 0x1060: // ChartFbi
- {
- LINESTART();
- ADDTEXT( "dmixBasis = " );
- ADDDEC( 2 );
- ADDTEXT( " dmiyBasis = " );
- ADDDEC( 2 );
- ADDTEXT( " twpHeightBasis = " );
- ADDDEC( 2 );
- ADDTEXT( " scab = " );
- ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "ifnt = " );
- ADDDEC( 2 );
- PRINT();
- }
- break;
- case 0x1061: // ChartBoppop
- ContDump( nL );
- break;
- case 0x1062: // ChartAxcext
- {
- LINESTART();
- ADDTEXT( "cat on axis: " );
- ADDDEC( 2 );
- ADDTEXT( " ... " );
- ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "major unit: val = " );
- ADDDEC( 2 );
- ADDTEXT( " units = " );
- ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "minor unit: val = " );
- ADDDEC( 2 );
- ADDTEXT( " units = " );
- ADDDEC( 2 );
- PRINT();
- LINESTART();
- ADDTEXT( "base unit = " );
- ADDDEC( 2 );
- ADDTEXT( " crossing point of val axis = " );
- ADDDEC( 2 );
- PRINT();
- rIn >> __nFlags;
- if( __nFlags )
- {
- LINESTART();
- STARTFLAG();
- ADDFLAG( 0x0001, "fAutoMin" );
- ADDFLAG( 0x0002, "fAutoMax" );
- ADDFLAG( 0x0004, "fAutoMajor" );
- ADDFLAG( 0x0008, "fAutoMinor" );
- ADDFLAG( 0x0010, "fDateAxis" );
- ADDFLAG( 0x0020, "fAutoBase" );
- ADDFLAG( 0x0040, "fAutoCross" );
- ADDFLAG( 0x0080, "fAutoDate" );
- PRINT();
- }
- }
- break;
- case 0x1063: // ChartDat
- ContDump( nL );
- break;
- case 0x1064: // ChartPlotgrowth
- {
- UINT32 nDx, nDy;
- rIn >> nDx >> nDy;
- LINESTART();
- ADDTEXT( "dxPlotGrowth = " );
- __Add16p16( t, nDx );
- ADDTEXT( " (" );
- __AddHex( t, nDx );
- ADDTEXT( ") dyPlotGrowth = " );
- __Add16p16( t, nDy );
- ADDTEXT( " (" );
- __AddHex( t, nDy );
- ADDTEXT( ")" );
- PRINT();
- }
- break;
- case 0x1065: // ChartSiindex
- ContDump( nL );
- break;
- case 0x1066: // ChartGelframe
- EscherDump( nL, false );
- break;
- case 0x1067: // ChartBoppcustom
- ContDump( nL );
- break;
- default:
- if( !bEncrypted )
- ContDump( nL );
- }
-
- }
-
- if( nR == EXC_ID_FILEPASS )
- {
- bEncrypted = true;
- pIn->Seek( EXC_REC_SEEK_TO_BEGIN );
- bool bValid = (XclImpDecryptHelper::ReadFilepass( *pIn ) == ERRCODE_NONE);
- LINESTART();
- ADDTEXT( "decrypter=" ); lcl_AddOnOff( t, bValid );
- PRINT();
- bBIFF8 = bBIFF8 && bValid; // dump BIFF8 hex only on invalid decrypter
- }
-
- if( bDec )
- pLevelPre -= nLevelInc;
-}
-
-
-static const sal_Char* GetBlipType( UINT8 n )
-{
- switch ( n )
- {
- case 0 :
- return " ERROR";
- break;
- case 1 :
- return " UNKNOWN";
- break;
- case 2 :
- return " EMF";
- break;
- case 3 :
- return " WMF";
- break;
- case 4 :
- return " PICT";
- break;
- case 5 :
- return " JPEG";
- break;
- case 6 :
- return " PNG";
- break;
- case 7 :
- return " DIB";
- break;
- default:
- if ( n < 32 )
- return " NotKnown";
- else
- return " Client";
- }
-}
-
-void Biff8RecDumper::EscherDump( const ULONG nMaxLen, bool bDumpOffset )
-{
- ULONG n = nMaxLen;
- UINT16 nPre, nR;
- UINT32 nL;
- const sal_Char* p;
- ByteString aT;
- UINT16 nDumpSize;
-
- aT += pLevelPre;
-
- ULONG nStartPos = pIn->GetSvStreamPos();
- while( pIn->IsValid() && (n > 0) )
- {
- ULONG nCurrPos = pIn->GetSvStreamPos();
- *pIn >> nPre >> nR >> nL;
- n -= sizeof( nPre ) + sizeof( nR ) + sizeof( nL );
-
- switch( nR )
- {
- case 0xF000: p = "MsofbtDggContainer"; break;
- case 0xF006: p = "MsofbtDgg"; break;
- case 0xF016: p = "MsofbtCLSID"; break;
- case 0xF00B: p = "MsofbtOPT"; break;
- case 0xF11A: p = "MsofbtColorMRU"; break;
- case 0xF11E: p = "MsofbtSplitMenuColors"; break;
- case 0xF001: p = "MsofbtBstoreContainer"; break;
- case 0xF007: p = "MsofbtBSE"; break;
- case 0xF002: p = "MsofbtDgContainer"; break;
- case 0xF008: p = "MsofbtDg"; break;
- case 0xF118: p = "MsofbtRegroupItem"; break;
- case 0xF120: p = "MsofbtColorScheme"; break;
- case 0xF003: p = "MsofbtSpgrContainer"; break;
- case 0xF004: p = "MsofbtSpContainer"; break;
- case 0xF009: p = "MsofbtSpgr"; break;
- case 0xF00A: p = "MsofbtSp"; break;
- case 0xF00C: p = "MsofbtTextbox"; break;
- case 0xF00D: p = "MsofbtClientTextbox"; break;
- case 0xF00E: p = "MsofbtAnchor"; break;
- case 0xF00F: p = "MsofbtChildAnchor"; break;
- case 0xF010: p = "MsofbtClientAnchor"; break;
- case 0xF011: p = "MsofbtClientData"; break;
- case 0xF11F: p = "MsofbtOleObject"; break;
- case 0xF11D: p = "MsofbtDeletedPspl"; break;
- case 0xF005: p = "MsofbtSolverContainer"; break;
- case 0xF012: p = "MsofbtConnectorRule"; break;
- case 0xF013: p = "MsofbtAlignRule"; break;
- case 0xF014: p = "MsofbtArcRule"; break;
- case 0xF015: p = "MsofbtClientRule"; break;
- case 0xF017: p = "MsofbtCalloutRule"; break;
- case 0xF119: p = "MsofbtSelection"; break;
- case 0xF122: p = "MsofbtUDefProp"; break;
- default:
- if( nR >= 0xF018 && nR <= 0xF117 )
- p = "MsofbtBLIP";
- else if ( ( nPre & 0x000F ) == 0x000F )
- p = "UNKNOWN container";
- else
- p = "UNKNOWN ID";
- }
-
- aT += " ";
- __AddHex( aT, nR );
- ((aT += " ") += p) += " [";
- __AddHex( aT, nPre );
- aT += ',';
- __AddHex( aT, nL );
- aT += "] instance: ";
- __AddDec( aT, (UINT16)(nPre >> 4) );
- if( bDumpOffset )
- {
- aT.Append( " pos=" );
- __AddHex( aT, static_cast< sal_uInt32 >( mnEscherPos + nCurrPos - nStartPos ) );
- }
- Print( aT );
-
- if ( nR == 0xF007 && 36 <= n && 36 <= nL )
- { // BSE, FBSE
- ULONG nP = pIn->GetRecPos();
- UINT8 n8;
- UINT16 n16;
- UINT32 n32;
-
- aT = " btWin32: ";
- *pIn >> n8;
- __AddHex( aT, n8 );
- aT += GetBlipType( n8 );
- aT += " btMacOS: ";
- *pIn >> n8;
- __AddHex( aT, n8 );
- aT += GetBlipType( n8 );
- Print( aT );
-
- aT = " rgbUid:";
- Print( aT );
- ContDump( 16 );
-
- aT = " tag: ";
- *pIn >> n16;
- __AddHex( aT, n16 );
- Print( aT );
-
- aT = " size: ";
- *pIn >> n32;
- __AddHex( aT, n32 );
- Print( aT );
-
- aT = " cRef: ";
- *pIn >> n32;
- __AddHex( aT, n32 );
- Print( aT );
-
- aT = " offs: ";
- *pIn >> n32;
- __AddHex( aT, n32 );
- Print( aT );
-
- aT = " usage: ";
- *pIn >> n8;
- __AddHex( aT, n8 );
- aT += " cbName: ";
- *pIn >> n8;
- __AddHex( aT, n8 );
- aT += " unused2: ";
- *pIn >> n8;
- __AddHex( aT, n8 );
- aT += " unused3: ";
- *pIn >> n8;
- __AddHex( aT, n8 );
- Print( aT );
-
- n -= pIn->GetRecPos() - nP;
- nL = 0; // loop to MsofbtBLIP
- }
- else if ( nR == 0xF00F && 0x10 <= n && 0x10 <= nL )
- { // ChildAnchor
- ULONG nP = pIn->GetRecPos();
- sal_Int32 n32;
-
- aT.Assign( " pos1=" );
- *pIn >> n32; lclAppendDec( aT, n32 );
- aT.Append( " pos2=" );
- *pIn >> n32; lclAppendDec( aT, n32 );
- aT.Append( " pos3=" );
- *pIn >> n32; lclAppendDec( aT, n32 );
- aT.Append( " pos4=" );
- *pIn >> n32; lclAppendDec( aT, n32 );
- Print( aT );
-
- ULONG nC = pIn->GetRecPos() - nP;
- n -= nC;
- nL -= nC;
- }
- else if ( nR == 0xF010 && 0x12 <= n && 0x12 <= nL )
- { // ClientAnchor
- ULONG nP = pIn->GetRecPos();
- UINT16 n16;
-
- aT = " Flag: ";
- *pIn >> n16;
- __AddHex( aT, n16 );
- if( n16 & 0x0001 ) aT += " -fixedpos";
- if( n16 & 0x0002 ) aT += " -fixedsize";
- Print( aT );
-
- aT = " Col1: ";
- *pIn >> n16;
- __AddHex( aT, n16 );
- aT += " dX1: ";
- *pIn >> n16;
- __AddHex( aT, n16 );
- aT += " Row1: ";
- *pIn >> n16;
- __AddHex( aT, n16 );
- aT += " dY1: ";
- *pIn >> n16;
- __AddHex( aT, n16 );
- Print( aT );
-
- aT = " Col2: ";
- *pIn >> n16;
- __AddHex( aT, n16 );
- aT += " dX2: ";
- *pIn >> n16;
- __AddHex( aT, n16 );
- aT += " Row2: ";
- *pIn >> n16;
- __AddHex( aT, n16 );
- aT += " dY2: ";
- *pIn >> n16;
- __AddHex( aT, n16 );
- Print( aT );
-
- ULONG nC = pIn->GetRecPos() - nP;
- n -= nC;
- nL -= nC;
- }
- else if ( nR == 0xF00A )
- {
- sal_uInt32 nId, nFlags;
- *pIn >> nId >> nFlags;
- aT.Assign( " shape-id=" );
- __AddHex( aT, nId );
- aT.Append( " flags=" );
- __AddHex( aT, nFlags );
- Print( aT );
- nL -= 8; n -= 8;
- }
- else if ( nR == 0xF00B || nR == 0xF122 )
- { // OPT
- sal_uInt32 nComplex = 0;
- while ( nL >= 6 + nComplex && n >= 6 + nComplex )
- {
- UINT16 n16;
- UINT32 n32;
- *pIn >> n16 >> n32;
- nL -= 6; n -= 6;
- aT = " ";
- __AddHex( aT, n16 );
- aT += " (";
- __AddDec( aT, n16 & 0x3FFF, 5 );
- if ( (n16 & 0x8000) == 0 )
- {
- if ( n16 & 0x4000 )
- aT += ", fBlipID";
- aT += ") ";
- __AddHex( aT, n32 );
- if ( (n16 & 0x4000) == 0 )
- {
- aT += " (";
- __AddDec1616( aT, n32 );
- aT += ')';
- }
- Print( aT );
- }
- else
- {
- aT += ", fComplex) ";
- __AddHex( aT, n32 );
- Print( aT );
- nComplex += n32;
- }
- }
- // complex property data
- while ( nComplex && n > 0 )
- {
- sal_uInt32 nDumpSize = (nComplex > n) ? n : nComplex;
- ContDump( nDumpSize );
- nComplex -= nDumpSize;
- nL -= nDumpSize;
- n -= nDumpSize;
- }
- }
- else if ( nR == 0xF012 )
- {
- aT = " Connector rule: "; __AddDec( aT, pIn->ReaduInt32() );
- aT += " ShapeID A: "; __AddHex( aT, pIn->ReaduInt32() );
- aT += " ShapeID B: "; __AddHex( aT, pIn->ReaduInt32() );
- Print( aT );
- aT = " ShapeID connector: "; __AddHex( aT, pIn->ReaduInt32() );
- aT += " Connect pt A: "; __AddHex( aT, pIn->ReaduInt32() );
- aT += " Connect pt B: "; __AddHex( aT, pIn->ReaduInt32() );
- Print( aT );
- nL -= 24; n -= 24;
- }
-
- if( ( nPre & 0x000F ) == 0x000F )
- { // Container
- if ( nL <= (UINT32) n )
- Print( " completed within" );
- else
- Print( " continued elsewhere" );
- }
- else
- // -> 0x0000 ... 0x0FFF
- {
- nDumpSize = ( ( UINT32 ) nL > ( UINT32 ) n )? ( UINT16 ) n : ( UINT16 ) nL;
-
- if( nDumpSize )
- {
- ContDump( nDumpSize );
- n -= nDumpSize;
- }
- }
-
- aT.Erase();
- }
- if( bDumpOffset )
- mnEscherPos += nMaxLen;
-}
-
-
-void Biff8RecDumper::ObjDump( const ULONG nMaxLen )
-{
-#if 0
-// if an entire hex block is needed
- pIn->PushPosition();
- ContDump( nMaxLen );
- pIn->PopPosition();
-#endif
-
- ULONG n = nMaxLen;
- UINT16 nR, nL;
- const sal_Char* p;
- ByteString t;
- XclImpStream& rIn = *pIn;
- UINT16 nDumpSize;
- sal_uInt16 nObjFlags = 0;
-
- t += pLevelPre;
-
- while( n > 0 )
- {
- rIn >> nR >> nL;
- n -= sizeof( nR ) + sizeof( nL );
-
- BOOL bDetails = FALSE;
- switch( nR )
- {
- case 0x0000: p = "ftEnd"; break;
- case 0x0001: p = "(Reserved)"; break;
- case 0x0002: p = "(Reserved)"; break;
- case 0x0003: p = "(Reserved)"; break;
- case 0x0004: p = "ftMacro"; break;
- case 0x0005: p = "ftButton"; break;
- case 0x0006: p = "ftGmo"; break;
- case 0x0007: p = "ftCf"; break;
- case 0x0008: p = "ftPioGrbit"; bDetails = TRUE; break;
- case 0x0009: p = "ftPictFmla"; bDetails = TRUE; break;
- case 0x000A: p = "ftCbls"; break;
- case 0x000B: p = "ftRbo"; break;
- case 0x000C: p = "ftSbs"; break;
- case 0x000D: p = "ftNts"; break;
- case 0x000E: p = "ftSbsFmla"; break;
- case 0x000F: p = "ftGboData"; break;
- case 0x0010: p = "ftEdoData"; break;
- case 0x0011: p = "ftRboData"; break;
- case 0x0012: p = "ftCblsData"; break;
- case 0x0013: p = "ftLbsData"; break;
- case 0x0014: p = "ftCblsFmla"; break;
- case 0x0015: p = "ftCmo"; bDetails = TRUE; break;
- default:
- p = "UNKNOWN ID";
- }
-
- t += " ";
- __AddHex( t, nR );
- t += " [";
- __AddHex( t, nL );
- (t += "] ") += p;
- Print( t );
-
- nDumpSize = ( ( UINT32 ) nL > ( UINT32 ) n )? ( UINT16 ) n : ( UINT16 ) nL;
-
- if( nDumpSize )
- {
- ULONG nPos1 = (bDetails ? rIn.GetRecPos() : 0);
- ContDump( nDumpSize );
- n -= nDumpSize;
- if ( bDetails )
- {
- ULONG nPos2 = rIn.GetRecPos();
- rIn.Seek( nPos1 );
- t.Erase();
- switch ( nR )
- {
- case 0x0008 : // ftPioGrbit
- {
- rIn >> nObjFlags;
- UINT16 __nFlags = nObjFlags;
- if ( __nFlags )
- {
- ADDTEXT( " " );
- STARTFLAG();
- ADDFLAG( 0x0001, "man-size" );
- ADDFLAG( 0x0002, "linked" );
- ADDFLAG( 0x0008, "symbol" );
- ADDFLAG( 0x0010, "control" );
- ADDFLAG( 0x0020, "ctls-stream" );
- ADDFLAG( 0x0200, "autoload" );
- ADDRESERVED( 0xFDC4 );
- }
- }
- break;
- case 0x0009 : // ftPictFmla
- {
- ADDTEXT( " Document type " );
- UINT16 nFmlaLen;
- rIn >> nFmlaLen;
- if( nObjFlags & 0x0002 )
- {
- ADDTEXT( "linked\n OLE stream: LNK??? (from EXTERNNAME) " );
- rIn >> nFmlaLen;
- ADDTEXT( " unknown=" ); ADDHEX( 4 );
- PRINT();
- t.Erase();
- FormulaDump( nFmlaLen, FT_CellFormula );
- }
- else
- {
- ADDTEXT( "embedded " );
- const UINT16 nStringOffset = 14; // MAY be right
- rIn.Seek( nPos1 + nStringOffset );
- INT32 nBytesLeft = nL - nStringOffset;
- UINT16 nStrLen = rIn.ReaduInt16();
- ULONG nPos3 = rIn.GetRecPos();
- if( nStrLen )
- AddUNICODEString( t, rIn, TRUE, nStrLen );
- nBytesLeft -= (rIn.GetRecPos() - nPos3);
- ADDTEXT( '\n' );
- if ( nBytesLeft < 4 )
- ADDTEXT( " >> ByteString OVERRUN <<\n" );
-
- rIn.Seek( nPos1 + sizeof(nFmlaLen) + nFmlaLen );
- if( nObjFlags & 0x0020 )
- {
- sal_uInt32 nStrmStart, nStrmLen;
- rIn >> nStrmStart >> nStrmLen;
- ADDTEXT( " 'Ctls' stream start=" );
- __AddHex( t, nStrmStart );
- ADDTEXT( " size=" );
- __AddHex( t, nStrmLen );
- maCtlsPosMap[ nStrmStart ] = nStrmLen;
- }
- else
- {
- ADDTEXT( " OLE storage name: MBD" );
- __AddPureHex( t, rIn.ReaduInt32() );
- }
- }
- }
- break;
- case 0x0015 : // ftCmo
- {
- UINT16 nType, nId;
- rIn >> nType >> nId;
- ADDTEXT( " Object ID " );
- __AddHex( t, nId );
- switch ( nType )
- {
- case 0x0000 : p = "Group"; break;
- case 0x0001 : p = "Line"; break;
- case 0x0002 : p = "Rectangle"; break;
- case 0x0003 : p = "Oval"; break;
- case 0x0004 : p = "Arc"; break;
- case 0x0005 : p = "Chart"; break;
- case 0x0006 : p = "Text"; break;
- case 0x0007 : p = "Button"; break;
- case 0x0008 : p = "Picture"; break;
- case 0x0009 : p = "Polygon"; break;
- case 0x000a : p = "(Reserved)"; break;
- case 0x000b : p = "Check box"; break;
- case 0x000c : p = "Option button";break;
- case 0x000d : p = "Edit box"; break;
- case 0x000e : p = "Label"; break;
- case 0x000f : p = "Dialog box"; break;
- case 0x0010 : p = "Spinner"; break;
- case 0x0011 : p = "Scroll bar"; break;
- case 0x0012 : p = "List box"; break;
- case 0x0013 : p = "Group box"; break;
- case 0x0014 : p = "Combo box"; break;
- case 0x0015 : p = "(Reserved)"; break;
- case 0x0016 : p = "(Reserved)"; break;
- case 0x0017 : p = "(Reserved)"; break;
- case 0x0018 : p = "(Reserved)"; break;
- case 0x0019 : p = "Comment"; break;
- case 0x001a : p = "(Reserved)"; break;
- case 0x001b : p = "(Reserved)"; break;
- case 0x001c : p = "(Reserved)"; break;
- case 0x001d : p = "(Reserved)"; break;
- case 0x001e : p = "Microsoft Office drawing"; break;
- default:
- p = "UNKNOWN";
- }
- ADDTEXT( ", type " );
- __AddHex( t, nType );
- ADDTEXT( ' ' );
- ADDTEXT( p );
- }
- break;
- }
- if ( t.Len() )
- PRINT();
- rIn.Seek( nPos2 );
- }
- }
-
- t.Erase();
- }
-}
-
-
-#undef LINESTART
-#undef IGNORE
-#undef ADDHEX
-#undef ADDDEC
-#undef PRINT
-#undef PreDump
-#undef ADDCELLHEAD
-
-void Biff8RecDumper::ContDump( const ULONG nL )
-{
- UINT32 nC = nMaxBodyLines;
- UINT32 n = nL;
- UINT32 nInL, nTmp;
- UINT8* pB = new UINT8[ nL ];
- UINT8* p;
- const UINT16 nLineLen = 16;
- UINT16 nCharCnt;
- BOOL bPart;
- ByteString aT;
-
- aT += pLevelPre;
-
- while( n && nC )
- {
- bPart = n < nLineLen;
- nInL = bPart? n : nLineLen;
- n -= nInL;
-
- pIn->Read( pB, nInL );
-
- // als Hex-Codes
- nTmp = nInL;
- p = pB;
- nCharCnt = 0;
- while( nTmp )
- {
- if( nCharCnt == nLineLen / 2 )
- aT += ' ';
-
- nCharCnt++;
-
- aT += ' ';
- __AddPureHex( aT, *p );
- p++;
-
- nTmp--;
- }
-
- if( bPart )
- aT += GetBlanks( ( UINT16 ) ( ( nLineLen - nInL ) * 3 ) );
-
- // als chars
-
- aT += " ";
- if( nInL < 9 )
- aT += ' ';
-
- nTmp = nInL;
- p = pB;
- nCharCnt = 0;
- while( nTmp )
- {
- if( nCharCnt == nLineLen / 2 )
- aT += ' ';
-
- nCharCnt++;
-
- if( IsPrintable( *p ) )
- aT += static_cast< sal_Char >( *p );
- else
- aT += '.';
-
- p++;
-
- nTmp--;
- }
-
- Print( aT );
- aT.Erase();
- aT += pLevelPre;
-
- nC--;
- }
-
- delete[] pB;
-}
-
-
-// Formula dumper =============================================================
-
-/** Name and parameter count of an Excel function. */
-struct XclDumpFunc
-{
- const sal_Char* pName; /// Name of the function.
- sal_uInt16 nParam; /// Parameter count for fixed functions.
-};
-
-static const XclDumpFunc pFuncData[] =
-{
-/* 0*/ { "COUNT", 0 },
- { "IF", 0 },
- { "ISNA", 1 },
- { "ISERROR", 1 },
- { "SUM", 0 },
-/* 5*/ { "AVERAGE", 0 },
- { "MIN", 0 },
- { "MAX", 0 },
- { "ROW", 0 },
- { "COLUMN", 0 },
-/* 10*/ { "NA", 0 },
- { "NPV", 0 },
- { "STDEV", 0 },
- { "DOLLAR", 0 },
- { "FIXED", 0 },
-/* 15*/ { "SIN", 1 },
- { "COS", 1 },
- { "TAN", 1 },
- { "ATAN", 1 },
- { "PI", 0 },
-/* 20*/ { "SQRT", 1 },
- { "EXP", 1 },
- { "LN", 1 },
- { "LOG10", 1 },
- { "ABS", 1 },
-/* 25*/ { "INT", 1 },
- { "SIGN", 1 },
- { "ROUND", 2 },
- { "LOOKUP", 0 },
- { "INDEX", 0 },
-/* 30*/ { "REPT", 2 },
- { "MID", 3 },
- { "LEN", 1 },
- { "VALUE", 1 },
- { "TRUE", 0 },
-/* 35*/ { "FALSE", 0 },
- { "AND", 0 },
- { "OR", 0 },
- { "NOT", 1 },
- { "MOD", 2 },
-/* 40*/ { "DCOUNT", 3 },
- { "DSUM", 3 },
- { "DAVERAGE", 3 },
- { "DMIN", 3 },
- { "DMAX", 3 },
-/* 45*/ { "DSTDEV", 3 },
- { "VAR", 0 },
- { "DVAR", 3 },
- { "TEXT", 2 },
- { "LINEST", 0 },
-/* 50*/ { "TREND", 0 },
- { "LOGEST", 0 },
- { "GROWTH", 0 },
- { "GOTO" }, // macro/internal
- { "HALT" }, // macro/internal
-/* 55*/ { "RETURN" }, // macro/internal
- { "PV", 0 },
- { "FV", 0 },
- { "NPER", 0 },
- { "PMT", 0 },
-/* 60*/ { "RATE", 0 },
- { "MIRR", 3 },
- { "IRR", 0 },
- { "RAND", 0 },
- { "MATCH", 0 },
-/* 65*/ { "DATE", 3 },
- { "TIME", 3 },
- { "DAY", 1 },
- { "MONTH", 1 },
- { "YEAR", 1 },
-/* 70*/ { "WEEKDAY", 0 },
- { "HOUR", 1 },
- { "MINUTE", 1 },
- { "SECOND", 1 },
- { "NOW", 0 },
-/* 75*/ { "AREAS", 1 },
- { "ROWS", 1 },
- { "COLUMNS", 1 },
- { "OFFSET", 0 },
- { "ABSREF" }, // macro/internal
-/* 80*/ { "RELREF" }, // macro/internal
- { "ARGUMENT" }, // macro/internal
- { "SEARCH", 0 },
- { "TRANSPOSE", 1 },
- { "ERROR" }, // macro/internal
-/* 85*/ { "STEP" }, // macro/internal
- { "TYPE", 1 },
- { "ECHO" }, // macro/internal
- { "SET.NAME" }, // macro/internal
- { "CALLER" }, // macro/internal
-/* 90*/ { "DEREF" }, // macro/internal
- { "WINDOWS" }, // macro/internal
- { "SERIES" }, // macro/internal
- { "DOCUMENTS" }, // macro/internal
- { "ACTIVE.CELL" }, // macro/internal
-/* 95*/ { "SELECTION" }, // macro/internal
- { "RESULT" }, // macro/internal
- { "ATAN2", 2 },
- { "ASIN", 1 },
- { "ACOS", 1 },
-/*100*/ { "CHOOSE", 0 },
- { "HLOOKUP", 0 },
- { "VLOOKUP", 0 },
- { "LINKS" }, // macro/internal
- { "INPUT" }, // macro/internal
-/*105*/ { "ISREF", 1 },
- { "GET.FORMULA" }, // macro/internal
- { "GET.NAME" }, // macro/internal
- { "SET.VALUE", 2 }, // macro/internal
- { "LOG", 0 },
-/*110*/ { "EXEC" }, // macro/internal
- { "CHAR", 1 },
- { "LOWER", 1 },
- { "UPPER", 1 },
- { "PROPER", 1 },
-/*115*/ { "LEFT", 0 },
- { "RIGHT", 0 },
- { "EXACT", 2 },
- { "TRIM", 1 },
- { "REPLACE", 4 },
-/*120*/ { "SUBSTITUTE", 0 },
- { "CODE", 1 },
- { "NAMES" }, // macro/internal
- { "DIRECTORY" }, // macro/internal
- { "FIND", 0 },
-/*125*/ { "CELL", 0 },
- { "ISERR", 1 },
- { "ISTEXT", 1 },
- { "ISNUMBER", 1 },
- { "ISBLANK", 1 },
-/*130*/ { "T", 1 },
- { "N", 1 },
- { "FOPEN" }, // macro/internal
- { "FCLOSE" }, // macro/internal
- { "FSIZE" }, // macro/internal
-/*135*/ { "FREADLN" }, // macro/internal
- { "FREAD" }, // macro/internal
- { "FWRITELN" }, // macro/internal
- { "FWRITE" }, // macro/internal
- { "FPOS" }, // macro/internal
-/*140*/ { "DATEVALUE", 1 },
- { "TIMEVALUE", 1 },
- { "SLN", 3 },
- { "SYD", 4 },
- { "DDB", 0 },
-/*145*/ { "GET.DEF" }, // macro/internal
- { "REFTEXT" }, // macro/internal
- { "TEXTREF" }, // macro/internal
- { "INDIRECT", 0 },
- { "REGISTER" }, // macro/internal
-/*150*/ { "CALL" },
- { "ADD.BAR" }, // macro/internal
- { "ADD.MENU" }, // macro/internal
- { "ADD.COMMAND" }, // macro/internal
- { "ENABLE.COMMAND" }, // macro/internal
-/*155*/ { "CHECK.COMMAND" }, // macro/internal
- { "RENAME.COMMAND" }, // macro/internal
- { "SHOW.BAR" }, // macro/internal
- { "DELETE.MENU" }, // macro/internal
- { "DELETE.COMMAND" }, // macro/internal
-/*160*/ { "GET.CHART.ITEM" }, // macro/internal
- { "DIALOG.BOX" }, // macro/internal
- { "CLEAN", 1 },
- { "MDETERM", 1 },
- { "MINVERSE", 1 },
-/*165*/ { "MMULT", 2 },
- { "FILES" }, // macro/internal
- { "IPMT", 0 },
- { "PPMT", 0 },
- { "COUNTA", 0 },
-/*170*/ { "CANCEL.KEY" }, // macro/internal
- { "FOR" }, // macro/internal
- { "WHILE" }, // macro/internal
- { "BREAK" }, // macro/internal
- { "NEXT" }, // macro/internal
-/*175*/ { "INITIATE" }, // macro/internal
- { "REQUEST" }, // macro/internal
- { "POKE" }, // macro/internal
- { "EXECUTE" }, // macro/internal
- { "TERMINATE" }, // macro/internal
-/*180*/ { "RESTART" }, // macro/internal
- { "HELP" }, // macro/internal
- { "GET.BAR" }, // macro/internal
- { "PRODUCT", 0 },
- { "FACT", 1 },
-/*185*/ { "GET.CELL" }, // macro/internal
- { "GET.WORKSPACE" }, // macro/internal
- { "GET.WINDOW" }, // macro/internal
- { "GET.DOCUMENT" }, // macro/internal
- { "DPRODUCT", 3 },
-/*190*/ { "ISNONTEXT", 1 },
- { "GET.NOTE" }, // macro/internal
- { "NOTE" }, // macro/internal
- { "STDEVP", 0 },
- { "VARP", 0 },
-/*195*/ { "DSTDDEVP", 3 },
- { "DVARP", 3 },
- { "TRUNC", 0 },
- { "ISLOGICAL", 1 },
- { "DBCOUNTA", 3 },
-/*200*/ { "DELETE.BAR" }, // macro/internal
- { "UNREGISTER" }, // macro/internal
- { "202" }, // not used
- { "203" }, // not used
- { "USDOLLAR" },
-/*205*/ { "FINDB" },
- { "SEARCHB" },
- { "REPLACEB", 4 },
- { "LEFTB" },
- { "RIGHTB" },
-/*210*/ { "MIDB", 3 },
- { "LENB", 1 },
- { "ROUNDUP", 2 },
- { "ROUNDDOWN", 2 },
- { "ASC", 1 },
-/*215*/ { "DBSC", 1 },
- { "RANK", 0 },
- { "217" }, // not used
- { "218" }, // not used
- { "ADDRESS", 0 },
-/*220*/ { "DAYS360", 0 },
- { "TODAY", 0 },
- { "VDB", 0 },
- { "ELSE" }, // macro/internal
- { "ELSE.IF" }, // macro/internal
-/*225*/ { "END.IF" }, // macro/internal
- { "FOR.CELL" }, // macro/internal
- { "MEDIAN", 0 },
- { "SUMPRODUCT", 0 },
- { "SINH", 1 },
-/*230*/ { "COSH", 1 },
- { "TANH", 1 },
- { "ASINH", 1 },
- { "ACOSH", 1 },
- { "ATANH", 1 },
-/*235*/ { "DGET", 3 },
- { "CREATE.OBJECT" }, // macro/internal
- { "VOLATILE" }, // macro/internal
- { "LAST.ERROR" }, // macro/internal
- { "CUSTOM.UNDO" }, // macro/internal
-/*240*/ { "CUSTOM.REPEAT" }, // macro/internal
- { "FORMULA.CONVERT" }, // macro/internal
- { "GET.LINK.INFO" }, // macro/internal
- { "TEXT.BOX" }, // macro/internal
- { "INFO", 1 },
-/*245*/ { "GROUP" }, // macro/internal
- { "GET.OBJECT" }, // macro/internal
- { "DB", 0 },
- { "PAUSE" }, // macro/internal
- { "249" }, // not used
-/*250*/ { "250" }, // not used
- { "RESUME" }, // macro/internal
- { "FREQUENCY", 2 },
- { "ADD.TOOLBAR" }, // macro/internal
- { "DELETE.TOOLBAR" }, // macro/internal
-/*255*/ { "EXTERN.CALL" }, // macro/internal
- { "RESET.TOOLBAR" }, // macro/internal
- { "EVALUATE" }, // macro/internal
- { "GET.TOOLBAR" }, // macro/internal
- { "GET.TOOL" }, // macro/internal
-/*260*/ { "SPELLING.CHECK" }, // macro/internal
- { "ERROR.TYPE", 1 },
- { "APP.TITLE" }, // macro/internal
- { "WINDOW.TITLE" }, // macro/internal
- { "SAVE.TOOLBAR" }, // macro/internal
-/*265*/ { "ENABLE.TOOL" }, // macro/internal
- { "PRESS.TOOL" }, // macro/internal
- { "REGISTER.ID" }, // macro/internal
- { "GET.WORKBOOK" }, // macro/internal
- { "AVEDEV", 0 },
-/*270*/ { "BETADIST", 0 },
- { "GAMMALN", 1 },
- { "BETAINV", 0 },
- { "BINOMDIST", 4 },
- { "CHIDIST", 2 },
-/*275*/ { "CHIINV", 2 },
- { "COMBIN", 2 },
- { "CONFIDENCE", 3 },
- { "CRITBINOM", 3 },
- { "EVEN", 1 },
-/*280*/ { "EXPONDIST", 3 },
- { "FDIST", 3 },
- { "FINV", 3 },
- { "FISHER", 1 },
- { "FISHERINV", 1 },
-/*285*/ { "FLOOR", 2 },
- { "GAMMADIST", 4 },
- { "GAMMAINV", 3 },
- { "CEILING", 2 },
- { "HYPGEOMDIST", 4 },
-/*290*/ { "LOGNORMDIST", 3 },
- { "LOGINV", 3 },
- { "NEGBINOMDIST", 3 },
- { "NORMDIST", 4 },
- { "NORMSDIST", 1 },
-/*295*/ { "NORMINV", 3 },
- { "NORMSINV", 1 },
- { "STANDARDIZE", 3 },
- { "ODD", 1 },
- { "PERMUT", 2 },
-/*300*/ { "POISSON", 3 },
- { "TDIST", 3 },
- { "WEIBULL", 4 },
- { "SUMXMY2", 2 },
- { "SUMX2MY2", 2 },
-/*305*/ { "SUMX2PY2", 2 },
- { "CHITEST", 2 },
- { "CORREL", 2 },
- { "COVAR", 2 },
- { "FORECAST", 3 },
-/*310*/ { "FTEST", 2 },
- { "INTERCEPT", 2 },
- { "PEARSON", 2 },
- { "RSQ", 2 },
- { "STEYX", 2 },
-/*315*/ { "SLOPE", 2 },
- { "TTEST", 4 },
- { "PROB", 0 },
- { "DEVSQ", 0 },
- { "GEOMEAN", 0 },
-/*320*/ { "HARMEAN", 0 },
- { "SUMSQ", 0 },
- { "KURT", 0 },
- { "SKEW", 0 },
- { "ZTEST", 0 },
-/*325*/ { "LARGE", 2 },
- { "SMALL", 2 },
- { "QUARTILE", 2 },
- { "PERCENTILE", 2 },
- { "PERCENTRANK", 0 },
-/*330*/ { "MODE", 0 },
- { "TRIMMEAN", 2 },
- { "TINV", 2 },
- { "333" }, // not used
- { "MOVIE.COMMAND" }, // macro/internal
-/*335*/ { "GET.MOVIE" }, // macro/internal
- { "CONCATENATE", 0 },
- { "POWER", 2 },
- { "PIVOT.ADD.DATA" }, // macro/internal
- { "GET.PIVOT.TABLE" }, // macro/internal
-/*340*/ { "GET.PIVOT.FIELD" }, // macro/internal
- { "GET.PIVOT.ITEM" }, // macro/internal
- { "RADIANS", 1 },
- { "DEGREES", 1 },
- { "SUBTOTAL", 0 },
-/*345*/ { "SUMIF", 0 },
- { "COUNTIF", 2 },
- { "COUNTBLANK", 1 },
- { "SCENARIO.GET" }, // macro/internal
- { "OPTIONS.LISTS.GET" }, // macro/internal
-/*350*/ { "ISPMT", 4 },
- { "DATEDIF", 3 },
- { "DATESTRING", 1 },
- { "NUMBERSTRING", 2 },
- { "ROMAN", 0 },
-/*355*/ { "OPEN.DIALOG" }, // macro/internal
- { "SAVE.DIALOG" }, // macro/internal
- { "VIEW.GET" }, // macro/internal
- { "GETPIVOTDATA", 0 },
- { "HYPERLINK", 2 },
-/*360*/ { "PHONETIC", 1 },
- { "AVERAGEA", 0 },
- { "MAXA", 0 },
- { "MINA", 0 },
- { "STDEVPA", 0 },
-/*365*/ { "VARPA", 0 },
- { "STDEVA", 0 },
- { "VARA", 0 },
- { "BAHTTEXT", 1 },
- { "THAIDAYOFWEEK", 1 },
-/*370*/ { "THAIDIGIT", 1 },
- { "THAIMONTHOFYEAR", 1 },
- { "THAINUMSOUND", 1 },
- { "THAINUMSTRING", 1 },
- { "THAISTRINGLENGTH", 1 },
-/*375*/ { "ISTHAIDIGIT", 1 },
- { "ROUNDBAHTDOWN", 1 },
- { "ROUNDBAHTUP", 1 },
- { "THAIYEAR", 1 },
- { "RTD" },
-/*380*/ { "ISHYPERLINK", 1 }
-};
-
-const XclDumpFunc* lcl_GetFuncData( sal_uInt16 nIndex )
-{
- return (nIndex < STATIC_TABLE_SIZE( pFuncData )) ? (pFuncData + nIndex) : NULL;
-}
-
-// ----------------------------------------------------------------------------
-
-/** Stack helper to create a human readable formula string from UPN. */
-class XclDumpFormulaStackImpl : private ScfDelStack< ByteString >
-{
-public:
- void PushOperand( const ByteString& rOperand );
- void PushUnary( const ByteString& rOperator, bool bInFront );
- void PushBinary( const ByteString& rOperator );
- void PushFunction( const ByteString& rFuncName, sal_uInt16 nParamCount );
- inline ByteString GetString() const { return Top() ? *Top() : ByteString(); }
-};
-
-void XclDumpFormulaStackImpl::PushOperand( const ByteString& rOperand )
-{
- Push( new ByteString( rOperand ) );
-}
-
-void XclDumpFormulaStackImpl::PushUnary( const ByteString& rOperator, bool bInFront )
-{
- if( !Count() ) return;
- ByteString* pOp = Top();
- pOp->Insert( rOperator, bInFront ? 0 : pOp->Len() );
-}
-
-void XclDumpFormulaStackImpl::PushBinary( const ByteString& rOperator )
-{
- if( Count() < 2 ) return;
- // second operand is on top
- ByteString* pSecond = Pop();
- ByteString* pFirst = Top();
- *pFirst += rOperator;
- *pFirst += *pSecond;
- delete pSecond;
-}
-
-void XclDumpFormulaStackImpl::PushFunction( const ByteString& rFuncName, sal_uInt16 nParamCount )
-{
- if( Count() < nParamCount ) return;
- ByteString* pNew = new ByteString( ')' );
- for( sal_uInt16 nIndex = 0; nIndex < nParamCount; ++nIndex )
- {
- if( nIndex ) pNew->Insert( ';', 0 );
- ByteString* pOp = Pop();
- pNew->Insert( *pOp, 0 );
- delete pOp;
- }
- pNew->Insert( '(', 0 );
- pNew->Insert( rFuncName, 0 );
- Push( pNew );
-}
-
-// ----------------------------------------------------------------------------
-
-/** Stack to create a human readable formula and token class overview from UPN. */
-class XclDumpFormulaStack
-{
-public:
- void PushOperand( const ByteString& rOperand, sal_uInt8 nToken );
- inline void PushOperand( const sal_Char* pcOperand, sal_uInt8 nToken )
- { PushOperand( ByteString( pcOperand ), nToken ); }
-
- void PushUnary( const ByteString& rOperator, bool bInFront = true );
- inline void PushUnary( const sal_Char* pcOperator, bool bInFront = true )
- { PushUnary( ByteString( pcOperator ), bInFront ); }
-
- void PushBinary( const ByteString& rOperator );
- inline void PushBinary( const sal_Char* pcOperator )
- { PushBinary( ByteString( pcOperator ) ); }
-
- void PushFunction( const ByteString& rFuncName, sal_uInt16 nParamCount, sal_uInt8 nToken );
- inline void PushFunction( const sal_Char* pcFuncName, sal_uInt16 nParamCount, sal_uInt8 nToken )
- { PushFunction( ByteString( pcFuncName ), nParamCount, nToken ); }
-
- inline ByteString GetFormula() const { return maFmla.GetString(); }
- inline ByteString GetTokenClasses() const { return maClass.GetString(); }
-
- static ByteString GetTokenClass( sal_uInt8 nToken );
-
-private:
- void PushTokenClass( sal_uInt8 nToken );
-
- XclDumpFormulaStackImpl maFmla;
- XclDumpFormulaStackImpl maClass;
-};
-
-void XclDumpFormulaStack::PushOperand( const ByteString& rOperand, sal_uInt8 nToken )
-{
- maFmla.PushOperand( rOperand );
- maClass.PushOperand( GetTokenClass( nToken ) );
-}
-
-void XclDumpFormulaStack::PushUnary( const ByteString& rOperator, bool bInFront )
-{
- maFmla.PushUnary( rOperator, bInFront );
- maClass.PushUnary( rOperator, bInFront );
-}
-
-void XclDumpFormulaStack::PushBinary( const ByteString& rOperator )
-{
- maFmla.PushBinary( rOperator );
- maClass.PushBinary( rOperator );
-}
-
-void XclDumpFormulaStack::PushFunction( const ByteString& rFuncName, sal_uInt16 nParamCount, sal_uInt8 nToken )
-{
- maFmla.PushFunction( rFuncName, nParamCount );
- maClass.PushFunction( GetTokenClass( nToken ), nParamCount );
-}
-
-ByteString XclDumpFormulaStack::GetTokenClass( sal_uInt8 nToken )
-{
- sal_Char cClass = 'B';
- switch( nToken & 0xE0 )
- {
- case 0x20: cClass = 'R'; break;
- case 0x40: cClass = 'V'; break;
- case 0x60: cClass = 'A'; break;
- }
- return ByteString( cClass );
-}
-
-// ----------------------------------------------------------------------------
-
-const sal_Char* lcl_GetErrorString( sal_uInt8 nErr )
-{
- switch( nErr )
- {
- case 0x00: return "#NULL!";
- case 0x07: return "#DIV/0!";
- case 0x0F: return "#VALUE!";
- case 0x17: return "#REF!";
- case 0x1D: return "#NAME?";
- case 0x24: return "#NUM!";
- case 0x2A: return "#N/A!";
- }
- return "!unknown!";
-}
-
-
-
-void lcl_StartToken( ByteString& rString, sal_uInt16 nPos, sal_uInt8 nToken, const sal_Char* pTokenName )
-{
- rString.Erase();
- rString.Append( " " );
- __AddHex( rString, nPos );
- rString.Append( " " );
- __AddHex( rString, nToken );
- rString.Append( " t" ).Append( pTokenName ).Expand( 33, ' ' );
-}
-
-void lcl_StartTokenClass( ByteString& rString, sal_uInt16 nPos, sal_uInt8 nToken, const sal_Char* pTokenName )
-{
- ByteString aToken( pTokenName );
- aToken.Append( XclDumpFormulaStack::GetTokenClass( nToken ) );
- lcl_StartToken( rString, nPos, nToken, aToken.GetBuffer() );
-}
-
-void Biff8RecDumper::FormulaDump( const UINT16 nL, const FORMULA_TYPE eFT )
-{
- if( !nL )
- return;
-
- sal_uInt32 nStartPos = pIn->GetRecPos();
- const sal_uInt32 nAfterPos = nStartPos + nL;
-
- BYTE nOp;
- ByteString t, aOperand;
- BOOL bError = FALSE;
- const BOOL bRangeName = eFT == FT_RangeName;
- const BOOL bSharedFormula = eFT == FT_SharedFormula;
- const BOOL bRNorSF = bRangeName || bSharedFormula;
-
- XclDumpFormulaStack aStack;
- sal_Bool bPrinted = sal_True;
-
-#define PRINTTOKEN() { if( !bPrinted ) Print( t ); bPrinted = sal_True; }
-#define STARTTOKEN( name ) lcl_StartToken( t, static_cast< sal_uInt16 >( pIn->GetRecPos() - nStartPos - 1 ), nOp, name )
-#define STARTTOKENCLASS( name ) lcl_StartTokenClass( t, static_cast< sal_uInt16 >( pIn->GetRecPos() - nStartPos - 1 ), nOp, name )
-
- while( pIn->IsValid() && ( pIn->GetRecPos() < nAfterPos ) && !bError )
- {
- *pIn >> nOp;
- bPrinted = sal_False;
- aOperand.Erase();
-
- switch( nOp ) // Buch Seite:
- { // SDK4 SDK5
- case 0x01: // Array Formula [325 ]
- {
- STARTTOKEN( "Exp" );
- sal_uInt16 nRow, nCol;
- *pIn >> nRow >> nCol;
- t += "array formula or shared formula, base-address=";
- lcl_AddRef( t, nCol, nRow );
- aStack.PushFunction( "ARRAY", 0, nOp );
- }
- break;
- case 0x02: // Data Table [325 277]
- {
- STARTTOKEN( "Tbl" );
- sal_uInt16 nRow, nCol;
- *pIn >> nRow >> nCol;
- t += "multiple operation, base-address=";
- lcl_AddRef( t, nCol, nRow );
- aStack.PushFunction( "MULTIPLE.OPERATIONS", 0, nOp );
- }
- break;
- case 0x03: // Addition [312 264]
- STARTTOKEN( "Add" );
- aStack.PushBinary( "+" );
- break;
- case 0x04: // Subtraction [313 264]
- STARTTOKEN( "Sub" );
- aStack.PushBinary( "-" );
- break;
- case 0x05: // Multiplication [313 264]
- STARTTOKEN( "Mul" );
- aStack.PushBinary( "*" );
- break;
- case 0x06: // Division [313 264]
- STARTTOKEN( "Div" );
- aStack.PushBinary( "/" );
- break;
- case 0x07: // Exponetiation [313 265]
- STARTTOKEN( "Power" );
- aStack.PushBinary( "^" );
- break;
- case 0x08: // Concatenation [313 265]
- STARTTOKEN( "Concat" );
- aStack.PushBinary( "&" );
- break;
- case 0x09: // Less Than [313 265]
- STARTTOKEN( "LT" );
- aStack.PushBinary( "<" );
- break;
- case 0x0A: // Less Than or Equal [313 265]
- STARTTOKEN( "LE" );
- aStack.PushBinary( "<=" );
- break;
- case 0x0B: // Equal [313 265]
- STARTTOKEN( "EQ" );
- aStack.PushBinary( "=" );
- break;
- case 0x0C: // Greater Than or Equal [313 265]
- STARTTOKEN( "GE" );
- aStack.PushBinary( ">=" );
- break;
- case 0x0D: // Greater Than [313 265]
- STARTTOKEN( "GT" );
- aStack.PushBinary( ">" );
- break;
- case 0x0E: // Not Equal [313 265]
- STARTTOKEN( "NE" );
- aStack.PushBinary( "<>" );
- break;
- case 0x0F: // Intersection [314 265]
- STARTTOKEN( "Isect" );
- aStack.PushBinary( " " );
- break;
- case 0x10: // List [314 265]
- STARTTOKEN( "List" );
- aStack.PushBinary( ";" );
- break;
- case 0x11: // Range [314 265]
- STARTTOKEN( "Range" );
- aStack.PushBinary( ":" );
- break;
- case 0x12: // Unary Plus [312 264]
- STARTTOKEN( "Uplus" );
- aStack.PushUnary( "+" );
- break;
- case 0x13: // Unary Minus [312 264]
- STARTTOKEN( "Uminus" );
- aStack.PushUnary( "-" );
- break;
- case 0x14: // Percent Sign [312 264]
- STARTTOKEN( "Percent" );
- aStack.PushUnary( "%", false );
- break;
- case 0x15: // Parenthesis [326 278]
- STARTTOKEN( "Paren" );
- // simulate two unary operators to enclose operand
- aStack.PushUnary( "(" );
- aStack.PushUnary( ")", false );
- break;
- case 0x16: // Missing Argument [314 266]
- STARTTOKEN( "MissArg" );
- aStack.PushOperand( "~", nOp );
- break;
- case 0x17: // ByteString Constant [314 266]
- {
- STARTTOKEN( "Str" );
-
- UINT8 nLen;
- *pIn >> nLen;
-
- t += "string [len=";
- __AddDec( t, nLen );
- t += "] ";
-
- aOperand += '"';
- if( nLen )
- aOperand += GETSTR( pIn->ReadUniString( nLen ) );
- else
- pIn->Ignore( 1 );
- aOperand += '"';
- t += aOperand;
- aStack.PushOperand( aOperand, nOp );
- }
- break;
- case 0x18:
- {
- STARTTOKEN( "Extended" );
- UINT8 nEptg;
- *pIn >> nEptg;
-
-#define D(name,size,ext,type) {t+="eptg ";__AddDec(t,(UINT16)nEptg);t+=": "; \
- t+=name;t+=" [";__AddDec(t,(UINT16)size);t+="] ";t+=type; \
- if(ext)t+=" + ext";PRINTTOKEN();ContDump(size);aStack.PushOperand(name,nOp);}
- switch( nEptg )
- { // name size ext type
- case 0x00: // res
- D( "res", 0, 0, "" );
- break;
- case 0x01: // Lel 4 - err
- D( "Lel", 4, 0, "err" );
- break;
- case 0x02: // Rw 4 - ref
- D( "Rw", 4, 0, "ref" );
- break;
- case 0x03: // Col 4 - ref
- D( "Col", 4, 0, "ref" );
- break;
- case 0x04: // res
- case 0x05: // res
- D( "res", 0, 0, "" );
- break;
- case 0x06: // RwV 4 - val
- D( "RwV", 4, 0, "val" );
- break;
- case 0x07: // ColV 4 - val
- D( "ColV", 4, 0, "val" );
- break;
- case 0x08: // res
- case 0x09: // res
- D( "res", 0, 0, "" );
- break;
- case 0x0A: // Radical 13 - ref
- D( "Radical", 13, 0, "ref" );
- break;
- case 0x0B: // RadicalS 13 x ref
- D( "RadicalS", 13, 1, "ref" );
- break;
- case 0x0C: // RwS 4 x ref
- D( "RwS", 4, 1, "ref" );
- break;
- case 0x0D: // ColS 4 x ref
- D( "ColS", 4, 1, "ref" );
- break;
- case 0x0E: // RwSV 4 x val
- D( "RwSV", 4, 1, "val" );
- break;
- case 0x0F: // ColSV 4 x val
- D( "ColSV", 4, 1, "val" );
- break;
- case 0x10: // RadicalLel 4 - err
- D( "RadicalLel", 4, 0, "err" );
- break;
- case 0x11: // res
- case 0x12: // res
- case 0x13: // res
- case 0x14: // res
- case 0x15: // res
- case 0x16: // res
- case 0x17: // res
- case 0x18: // res
- D( "res", 0, 0, "" );
- break;
- case 0x19: // invalid values
- case 0x1A: // invalid values
- D( "invalid vals", 0, 0, "" );
- break;
- case 0x1B: // res
- case 0x1C: // res
- D( "res", 0, 0, "" );
- break;
- case 0x1D: // SxName 4 - val
- D( "SxName", 4, 0, "val" );
- break;
- case 0x1E: // res
- D( "res", 0, 0, "" );
- break;
- default:
- D( "!unknown!", 0, 0, "" );
- }
-#undef D
- }
- break;
- case 0x19: // Special Attribute [327 279]
- {
- STARTTOKEN( "Attr" );
- UINT16 nData, nFakt;
- BYTE nOpt;
-
- *pIn >> nOpt >> nData;
- nFakt = 2;
-
- t += "flags="; __AddHex( t, nOpt );
-
- if( nOpt & 0x01 ) t += " volatile";
- if( nOpt & 0x02 ) t += " if";
- if( nOpt & 0x04 ) t += " choose";
- if( nOpt & 0x08 ) t += " skip";
- if( nOpt & 0x10 ) t += " sum";
- if( nOpt & 0x20 ) t += " assignment";
- if( nOpt & 0x40 ) t += " space";
- if( nOpt & 0x80 ) t += " unknown";
-
- if( nOpt & 0x02 )
- {
- t += " skip-to-false=";
- __AddHex( t, nData );
- }
- if( nOpt & 0x04 )
- {
- t += " count=";
- __AddDec( t, nData );
- t += " skip=";
- for( sal_uInt16 nIdx = 0; nIdx <= nData; ++nIdx )
- {
- if( nIdx ) t += ',';
- __AddDec( t, pIn->ReaduInt16() );
- }
- }
- if( nOpt & 0x08 )
- {
- t += " skip=";
- __AddHex( t, nData );
- t += " (";
- __AddDec( t, sal_uInt8( nData + 1 ) );
- t += " bytes)";
- }
- if( nOpt & 0x10 )
- aStack.PushFunction( "ATTRSUM", 1, nOp );
- if( nOpt & 0x40 )
- {
- t += " type=";
- __AddDec( t, static_cast< sal_uInt8 >( nData ) );
- t += " count=";
- __AddDec( t, static_cast< sal_uInt8 >( nData >> 8 ) );
- }
- }
- break;
- case 0x1C: // Error Value [314 266]
- {
- STARTTOKEN( "Err" );
- sal_uInt8 nErr = pIn->ReaduInt8();
- t += "error value ("; __AddHex( t, nErr );
- t += ") ";
- t += lcl_GetErrorString( nErr );
- aStack.PushOperand( lcl_GetErrorString( nErr ), nOp );
- }
- break;
- case 0x1D: // Boolean [315 266]
- STARTTOKEN( "Bool" );
- aOperand += pIn->ReaduInt8() ? "TRUE" : "FALSE";
- t += aOperand;
- aStack.PushOperand( aOperand, nOp );
- break;
- case 0x1E: // Integer [315 266]
- STARTTOKEN( "Int" );
- __AddDec( aOperand, pIn->ReaduInt16() );
- t += aOperand;
- aStack.PushOperand( aOperand, nOp );
- break;
- case 0x1F: // Number [315 266]
- STARTTOKEN( "Num" );
- __AddDouble( aOperand, pIn->ReadDouble() );
- t += aOperand;
- aStack.PushOperand( aOperand, nOp );
- break;
- case 0x20: // Array Constant [317 268]
- case 0x40:
- case 0x60:
- STARTTOKENCLASS( "Array" );
- pIn->Ignore( 7 );
- aStack.PushOperand( "{ConstArray}", nOp );
- break;
- case 0x21: // Function, Fixed Number of Arguments [333 282]
- case 0x41:
- case 0x61:
- {
- STARTTOKENCLASS( "Func" );
- UINT16 nInd = pIn->ReaduInt16();
- const XclDumpFunc* pFunc = lcl_GetFuncData( nInd );
- aOperand += pFunc ? pFunc->pName : "!unknown!";
-
- t += "fix function: index="; __AddHex( t, nInd );
- t += " ("; t += aOperand;
- t += ')';
- aStack.PushFunction( aOperand, pFunc ? pFunc->nParam : 0, nOp );
- }
- break;
- case 0x22: // Function, Variable Number of Arg. [333 283]
- case 0x42:
- case 0x62:
- {
- STARTTOKENCLASS( "FuncVar" );
- BYTE nAnz;
- UINT16 nInd;
- *pIn >> nAnz >> nInd;
- const XclDumpFunc* pFunc = lcl_GetFuncData( nInd & 0x7FFF );
- aOperand += pFunc ? pFunc->pName : "!unknown!";
-
- t += "var function: index="; __AddHex( t, nInd );
- t += " ("; t += aOperand;
- t += ") param count="; __AddHex( t, nAnz );
- t += " ("; __AddDec( t, (UINT8)(nAnz & 0x7F) );
- t += ')';
- if( nAnz & 0x8000 )
- t += " cmd-equiv.";
- aStack.PushFunction( aOperand, nAnz & 0x7F, nOp );
- }
- break;
- case 0x23: // Name [318 269]
- case 0x43:
- case 0x63:
- {
- STARTTOKENCLASS( "Name" );
- sal_uInt16 nNameIdx = pIn->ReaduInt16();
- __AddDec( aOperand, nNameIdx );
- t += "internal name: index=";
- t += aOperand;
- pIn->Ignore( 2 );
- if( (0 < nNameIdx) && (nNameIdx <= maNames.size()) )
- aOperand = maNames[ nNameIdx - 1 ];
- else
- aOperand.Insert( "NAME(", 0 ).Append( ')' );
- aStack.PushOperand( aOperand, nOp );
- }
- break;
- case 0x24: // Cell Reference [319 270]
- case 0x44:
- case 0x64:
- case 0x2A: // Deleted Cell Reference [323 273]
- case 0x4A:
- case 0x6A:
- {
- if( (nOp & 0x1F) == 0x04 )
- STARTTOKENCLASS( "Ref" );
- else
- STARTTOKENCLASS( "RefErr" );
-
- UINT16 nCol, nRow;
- *pIn >> nRow >> nCol;
- AddRef( aOperand, nRow, nCol, bRangeName );
- t += "2D cell ref C/R="; __AddHex( t, nCol );
- t += '/'; __AddHex( t, nRow );
- t += ' '; t += aOperand;
- aStack.PushOperand( aOperand, nOp );
- }
- break;
- case 0x25: // Area Reference [320 270]
- case 0x45:
- case 0x65:
- case 0x2B: // Deleted Area Refernce [323 273]
- case 0x4B:
- case 0x6B:
- {
- if( (nOp & 0x1F) == 0x05 )
- STARTTOKENCLASS( "Area" );
- else
- STARTTOKENCLASS( "AreaErr" );
-
- UINT16 nRowFirst, nRowLast, nColFirst, nColLast;
- *pIn >> nRowFirst >> nRowLast >> nColFirst >> nColLast;
- AddRangeRef( aOperand, nRowFirst, nColFirst, nRowLast, nColLast, bRangeName );
- t += "2D area ref C/R:C/R="; __AddHex( t, nColFirst );
- t += '/'; __AddHex( t, nRowFirst );
- t += ':'; __AddHex( t, nColLast );
- t += '/'; __AddHex( t, nRowLast );
- t += ' '; t += aOperand;
- aStack.PushOperand( aOperand, nOp );
- }
- break;
- case 0x26: // Constant Reference Subexpression [321 271]
- case 0x46:
- case 0x66:
- {
- STARTTOKENCLASS( "MemArea" );
- sal_uInt32 nRes;
- sal_uInt16 nSize;
- *pIn >> nRes >> nSize;
- t += "reserved="; __AddHex( t, nRes );
- t += " size="; __AddDec( t, nSize );
- }
- break;
- case 0x27: // Erroneous Constant Reference Subexpr. [322 272]
- case 0x47:
- case 0x67:
- {
- STARTTOKENCLASS( "MemErr" );
- sal_uInt32 nRes;
- sal_uInt16 nSize;
- *pIn >> nRes >> nSize;
- t += "reserved="; __AddHex( t, nRes );
- t += " size="; __AddDec( t, nSize );
- }
- break;
- case 0x28: // Incomplete Constant Reference Subexpr.[331 281]
- case 0x48:
- case 0x68:
- {
- STARTTOKENCLASS( "MemNoMem" );
- sal_uInt32 nRes;
- sal_uInt16 nSize;
- *pIn >> nRes >> nSize;
- t += "reserved="; __AddHex( t, nRes );
- t += " size="; __AddDec( t, nSize );
- }
- break;
- case 0x29: // Variable Reference Subexpression [331 281]
- case 0x49:
- case 0x69:
- {
- STARTTOKENCLASS( "MemFunc" );
- sal_uInt16 nSize;
- *pIn >> nSize;
- t += "size="; __AddDec( t, nSize );
- }
- break;
- case 0x2C: // Cell Reference Within a Name/ShrdFmla [323 273]
- case 0x4C:
- case 0x6C:
- {
- STARTTOKENCLASS( "RefN" );
- UINT16 nRow, nCol;
- *pIn >> nRow >> nCol;
- AddRef( aOperand, nRow, nCol, bRNorSF );
- t += "2D cell ref in name C/R="; __AddHex( t, nCol );
- t += '/'; __AddHex( t, nRow );
- t += ' '; t += aOperand;
- aStack.PushOperand( aOperand, nOp );
- }
- break;
- case 0x2D: // Area Reference Within a Name/ShrdFmla [324 274]
- case 0x4D:
- case 0x6D:
- {
- STARTTOKENCLASS( "AreaN" );
- UINT16 nRowFirst, nRowLast, nColFirst, nColLast;
- *pIn >> nRowFirst >> nRowLast >> nColFirst >> nColLast;
- AddRangeRef( aOperand, nRowFirst, nColFirst, nRowLast, nColLast, bRNorSF );
- t += "2D area ref in name C/R:C/R"; __AddHex( t, nColFirst );
- t += '/'; __AddHex( t, nRowFirst );
- t += ':'; __AddHex( t, nColLast );
- t += '/'; __AddHex( t, nRowLast );
- t += ' '; t += aOperand;
- aStack.PushOperand( aOperand, nOp );
- }
- break;
- case 0x2E: // Reference Subexpression Within a Name [332 282]
- case 0x4E:
- case 0x6E:
- {
- STARTTOKENCLASS( "MemAreaN" );
- sal_uInt16 nSize;
- *pIn >> nSize;
- t += "size="; __AddDec( t, nSize );
- }
- break;
- case 0x2F: // Incomplete Reference Subexpression... [332 282]
- case 0x4F:
- case 0x6F:
- {
- STARTTOKENCLASS( "MemNoMemN" );
- sal_uInt16 nSize;
- *pIn >> nSize;
- t += "size="; __AddDec( t, nSize );
- }
- break;
- case 0x39: // Name or External Name [ 275]
- case 0x59:
- case 0x79:
- {
- STARTTOKENCLASS( "NameX" );
- UINT16 nXti, nName;
- *pIn >> nXti >> nName;
- pIn->Ignore( 2 );
- t += "external name: XTI="; __AddDec( t, nXti );
- t += " name index="; __AddDec( t, nName );
- aOperand += "EXTNAME(XTI(";
- __AddDec( aOperand, nXti );
- aOperand += "),";
- __AddDec( aOperand, nName );
- aOperand += ')';
- aStack.PushOperand( aOperand, nOp );
- }
- break;
- case 0x3A: // 3-D Cell Reference [ 275]
- case 0x5A:
- case 0x7A:
- case 0x3C: // Deleted 3-D Cell Reference [ 277]
- case 0x5C:
- case 0x7C:
- {
- if( (nOp & 0x1F) == 0x1A )
- STARTTOKENCLASS( "Ref3d" );
- else
- STARTTOKENCLASS( "Ref3dErr" );
-
- UINT16 nXti, nRow, nCol;
- *pIn >> nXti >> nRow >> nCol;
- AddRef( aOperand, nRow, nCol, bRangeName, nXti );
- t += "3D cell ref Xti!C/R="; __AddHex( t, nXti );
- t += '!'; __AddHex( t, nCol );
- t += '/'; __AddHex( t, nRow );
- t += ' '; t += aOperand;
- aStack.PushOperand( aOperand, nOp );
- }
- break;
- case 0x3B: // 3-D Area Reference [ 276]
- case 0x5B:
- case 0x7B:
- case 0x3D: // Deleted 3-D Area Reference [ 277]
- case 0x5D:
- case 0x7D:
- {
- if( (nOp & 0x1F) == 0x1B )
- STARTTOKENCLASS( "Area3d" );
- else
- STARTTOKENCLASS( "Area3dErr" );
-
- UINT16 nXti, nRow1, nCol1, nRow2, nCol2;
- *pIn >> nXti >> nRow1 >> nRow2 >> nCol1 >> nCol2;
- AddRangeRef( aOperand, nRow1, nCol1, nRow2, nCol2, bRangeName, nXti );
- t += "3D area ref Xti!C/R:C/R="; __AddHex( t, nXti );
- t += '!'; __AddHex( t, nCol1 );
- t += '/'; __AddHex( t, nRow1 );
- t += ':'; __AddHex( t, nCol2 );
- t += '/'; __AddHex( t, nRow2 );
- t += ' '; t += aOperand;
- aStack.PushOperand( aOperand, nOp );
- }
- break;
- default:
- STARTTOKEN( "unknown" );
- bError = TRUE;
- }
- PRINTTOKEN();
- }
- t.Assign( " Formula = " );
- if( aStack.GetFormula().Len() ) t += aStack.GetFormula(); else t += "ERROR IN STACK";
- Print( t );
- t.Assign( " Tokencl = " ).Append( aStack.GetTokenClasses() );
- Print( t );
- pIn->Seek( nAfterPos );
-}
-
-
-// ============================================================================
-//
-// S T R E A M C O N T E N T S
-//
-// ============================================================================
-
-void Biff8RecDumper::DumpBinary( SvStream& rInStrm, ULONG nSize )
-{
- ULONG nStrmPos = rInStrm.Tell();
- rInStrm.Seek( STREAM_SEEK_TO_END );
- ULONG nStrmLen = rInStrm.Tell();
- rInStrm.Seek( nStrmPos );
- ULONG nDumpEnd = (nSize == STREAM_SEEK_TO_END) ? nStrmLen : ::std::min( nStrmPos + nSize, nStrmLen );
-
- const ULONG LINE_SIZE = 16;
- sal_uInt8 pnData[ LINE_SIZE ];
-
- while( rInStrm.Tell() < nDumpEnd )
- {
- ByteString aBinLine;
- ByteString aTextLine;
-
- ULONG nLineLen = ::std::min( nDumpEnd - rInStrm.Tell(), LINE_SIZE );
- rInStrm.Read( pnData, nLineLen );
-
- for( sal_uInt8 *pnByte = pnData, *pnEnd = pnData + nLineLen; pnByte != pnEnd; ++pnByte )
- {
- if( pnByte - pnData == LINE_SIZE / 2 )
- {
- aBinLine.Append( ' ' );
- aTextLine.Append( ' ' );
- }
- __AddPureHex( aBinLine, *pnByte );
- aBinLine.Append( ' ' );
- aTextLine.Append( static_cast< sal_Char >( IsPrintable( *pnByte ) ? *pnByte : '.' ) );
- }
-
- aBinLine.Expand( LINE_SIZE * 3 + 3, ' ' );
- (*pDumpStream) << aBinLine.GetBuffer() << aTextLine.GetBuffer() << "\n";
- }
-}
-
-// ============================================================================
-//
-// F O R M C O N T R O L S
-//
-// ============================================================================
-
-namespace {
-
-// little helpers -------------------------------------------------------------
-
-/** Import from bytestream. */
-SvStream& operator>>( SvStream& rStrm, XclGuid& rGuid )
-{
- rStrm.Read( rGuid.mpnData, 16 );
- return rStrm;
-}
-
-/** Output guid into text stream. */
-SvStream& operator<<( SvStream& rStrm, const XclGuid& rGuid )
-{
- ByteString aOut;
- lclAppendGuid( aOut, rGuid );
- return rStrm << aOut.GetBuffer();
-}
-
-void lclAlignStream( SvStream& rInStrm, ULONG nStartPos, ULONG nDataWidth )
-{
- rInStrm.SeekRel( nDataWidth - 1 - (rInStrm.Tell() - nStartPos + nDataWidth - 1) % nDataWidth );
-}
-
-// control types --------------------------------------------------------------
-
-const sal_uInt16 EXC_CTRL_PAGE = 0x0007;
-const sal_uInt16 EXC_CTRL_IMAGE = 0x000C;
-const sal_uInt16 EXC_CTRL_FRAME = 0x000E;
-const sal_uInt16 EXC_CTRL_SPINBUTTON = 0x0010;
-const sal_uInt16 EXC_CTRL_PUSHBUTTON = 0x0011;
-const sal_uInt16 EXC_CTRL_TABSTRIP = 0x0012;
-const sal_uInt16 EXC_CTRL_LABEL = 0x0015;
-const sal_uInt16 EXC_CTRL_TEXTBOX = 0x0017;
-const sal_uInt16 EXC_CTRL_LISTBOX = 0x0018;
-const sal_uInt16 EXC_CTRL_COMBOBOX = 0x0019;
-const sal_uInt16 EXC_CTRL_CHECKBOX = 0x001A;
-const sal_uInt16 EXC_CTRL_OPTIONBUTTON = 0x001B;
-const sal_uInt16 EXC_CTRL_TOGGLEBUTTON = 0x001C;
-const sal_uInt16 EXC_CTRL_SCROLLBAR = 0x002F;
-const sal_uInt16 EXC_CTRL_MULTIPAGE = 0x0039;
-const sal_uInt16 EXC_CTRL_REFEDIT = 0x8000;
-const sal_uInt16 EXC_CTRL_FONTDATA = 0xFFF0; // internal use only
-const sal_uInt16 EXC_CTRL_USERFORM = 0xFFF1; // internal use only
-const sal_uInt16 EXC_CTRL_ADDDATA = 0xFFF2; // internal use only
-const sal_uInt16 EXC_CTRL_FRAMECHILD = 0xFFF3; // internal use only
-const sal_uInt16 EXC_CTRL_PROGRESSBAR = 0xFFF4; // internal use only
-const sal_uInt16 EXC_CTRL_UNKNOWN = 0xFFFF; // internal use only
-
-const sal_uInt16 EXC_CTRL_RECORD_ID = 0x0000;
-const sal_uInt16 EXC_CTRL_CLIENT_ID = 0x0200;
-const sal_uInt16 EXC_CTRL_CONTAINER_ID = 0x0400;
-
-// control names --------------------------------------------------------------
-
-struct XclDumpControlInfo
-{
- sal_uInt16 mnType;
- const sal_Char* mpcName;
- sal_uInt16 mnId;
-};
-
-static const XclDumpControlInfo spControlInfos[] =
-{
- { EXC_CTRL_PAGE, "Page", EXC_CTRL_CONTAINER_ID },
- { EXC_CTRL_IMAGE, "Image", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_FRAME, "Frame", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_SPINBUTTON, "Spin", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_PUSHBUTTON, "PushButton", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_TABSTRIP, "TabStrip", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_LABEL, "Label", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_TEXTBOX, "TextBox", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_LISTBOX, "ListBox", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_COMBOBOX, "ComboBox", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_CHECKBOX, "CheckBox", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_OPTIONBUTTON, "OptionButton", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_TOGGLEBUTTON, "ToggleButton", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_SCROLLBAR, "ScrollBar", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_MULTIPAGE, "MultiPage", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_REFEDIT, "RefEdit", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_FONTDATA, "FontData", EXC_CTRL_CLIENT_ID },
- { EXC_CTRL_USERFORM, "UserForm", EXC_CTRL_CONTAINER_ID },
- { EXC_CTRL_ADDDATA, "AddData", EXC_CTRL_RECORD_ID },
- { EXC_CTRL_FRAMECHILD, "FrameChild", EXC_CTRL_RECORD_ID },
- { EXC_CTRL_PROGRESSBAR, "ProgressBar", EXC_CTRL_RECORD_ID }
-};
-
-typedef ::std::map< sal_uInt16, const XclDumpControlInfo* > XclDumpControlInfoMap;
-typedef ScfRef< XclDumpControlInfoMap > XclDumpControlInfoMapRef;
-
-XclDumpControlInfoMapRef lclCreateControlInfoMap()
-{
- XclDumpControlInfoMapRef xMap( new XclDumpControlInfoMap );
- for( const XclDumpControlInfo *pIt = spControlInfos, *pEnd = STATIC_TABLE_END( spControlInfos ); pIt != pEnd; ++pIt )
- (*xMap)[ pIt->mnType ] = pIt;
- return xMap;
-}
-
-const XclDumpControlInfoMap& lclGetControlInfoMap()
-{
- static const XclDumpControlInfoMapRef sxMap = lclCreateControlInfoMap();
- return *sxMap;
-}
-
-void lclAppendControlType( ByteString& rStr, sal_uInt16 nCtrlType )
-{
- const XclDumpControlInfoMap& rMap = lclGetControlInfoMap();
- XclDumpControlInfoMap::const_iterator aIt = rMap.find( nCtrlType );
- rStr.Append( (aIt == rMap.end()) ? "*UNKNOWN*" : aIt->second->mpcName );
-}
-
-void lclDumpControlType( SvStream& rOutStrm, sal_uInt16 nCtrlType )
-{
- ByteString aTitle( "type=" );
- lclAppendHex( aTitle, nCtrlType );
- aTitle.Append( " (" );
- lclAppendControlType( aTitle, nCtrlType );
- aTitle.Append( ')' );
- rOutStrm << aTitle.GetBuffer();
-}
-
-sal_uInt16 lclDumpControlHeader( SvStream& rInStrm, SvStream& rOutStrm, sal_uInt16 nCtrlType )
-{
- lclDumpControlType( rOutStrm, nCtrlType );
- sal_uInt16 nId, nSize;
- rInStrm >> nId >> nSize;
- ByteString aLine( " id=" ); lclAppendHex( aLine, nId );
- const XclDumpControlInfoMap& rMap = lclGetControlInfoMap();
- XclDumpControlInfoMap::const_iterator aIt = rMap.find( nCtrlType );
- bool bValid = (aIt != rMap.end()) && (aIt->second->mnId == nId);
- aLine.Append( bValid ? " (valid)" : " (invalid)" );
- aLine.Append( " size=" ); lclAppendHex( aLine, nSize );
- rOutStrm << aLine.GetBuffer() << "\n";
- return nSize;
-}
-
-// control GUIDs --------------------------------------------------------------
-
-struct XclDumpControlGuid
-{
- sal_uInt16 mnType;
- sal_uInt32 mnGuidData1;
- sal_uInt16 mnGuidData2;
- sal_uInt16 mnGuidData3;
- sal_uInt8 mnGuidData41;
- sal_uInt8 mnGuidData42;
- sal_uInt8 mnGuidData43;
- sal_uInt8 mnGuidData44;
- sal_uInt8 mnGuidData45;
- sal_uInt8 mnGuidData46;
- sal_uInt8 mnGuidData47;
- sal_uInt8 mnGuidData48;
-};
-
-static const XclDumpControlGuid spControlGuids[] =
-{
- { EXC_CTRL_PUSHBUTTON, 0xD7053240, 0xCE69, 0x11CD, 0xA7, 0x77, 0x00, 0xDD, 0x01, 0x14, 0x3C, 0x57 },
- { EXC_CTRL_TOGGLEBUTTON, 0x8BD21D60, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 },
- { EXC_CTRL_CHECKBOX, 0x8BD21D40, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 },
- { EXC_CTRL_OPTIONBUTTON, 0x8BD21D50, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 },
- { EXC_CTRL_LABEL, 0x978C9E23, 0xD4B0, 0x11CE, 0xBF, 0x2D, 0x00, 0xAA, 0x00, 0x3F, 0x40, 0xD0 },
- { EXC_CTRL_TEXTBOX, 0x8BD21D10, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 },
- { EXC_CTRL_LISTBOX, 0x8BD21D20, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 },
- { EXC_CTRL_COMBOBOX, 0x8BD21D30, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 },
- { EXC_CTRL_SPINBUTTON, 0x79176FB0, 0xB7F2, 0x11CE, 0x97, 0xEF, 0x00, 0xAA, 0x00, 0x6D, 0x27, 0x76 },
- { EXC_CTRL_SCROLLBAR, 0xDFD181E0, 0x5E2F, 0x11CE, 0xA4, 0x49, 0x00, 0xAA, 0x00, 0x4A, 0x80, 0x3D },
- { EXC_CTRL_IMAGE, 0x4C599241, 0x6926, 0x101B, 0x99, 0x92, 0x00, 0x00, 0x0B, 0x65, 0xC6, 0xF9 },
- { EXC_CTRL_PROGRESSBAR, 0x35053A22, 0x8589, 0x11D1, 0xB1, 0x6A, 0x00, 0xC0, 0xF0, 0x28, 0x36, 0x28 }
-};
-
-typedef ::std::map< XclGuid, sal_uInt16 > XclDumpControlGuidMap;
-typedef ScfRef< XclDumpControlGuidMap > XclDumpControlGuidMapRef;
-
-XclDumpControlGuidMapRef lclCreateControlGuidMap()
-{
- XclDumpControlGuidMapRef xMap( new XclDumpControlGuidMap );
- for( const XclDumpControlGuid *pIt = spControlGuids, *pEnd = STATIC_TABLE_END( spControlGuids ); pIt != pEnd; ++pIt )
- {
- XclGuid aGuid( pIt->mnGuidData1, pIt->mnGuidData2, pIt->mnGuidData3,
- pIt->mnGuidData41, pIt->mnGuidData42, pIt->mnGuidData43, pIt->mnGuidData44,
- pIt->mnGuidData45, pIt->mnGuidData46, pIt->mnGuidData47, pIt->mnGuidData48 );
- (*xMap)[ aGuid ] = pIt->mnType;
- }
- return xMap;
-}
-
-const XclDumpControlGuidMap& lclGetControlGuidMap()
-{
- static const XclDumpControlGuidMapRef sxMap = lclCreateControlGuidMap();
- return *sxMap;
-}
-
-sal_uInt16 lclDumpControlGuid( SvStream& rInStrm, SvStream& rOutStrm )
-{
- XclGuid aGuid;
- rInStrm >> aGuid;
- const XclDumpControlGuidMap& rMap = lclGetControlGuidMap();
- XclDumpControlGuidMap::const_iterator aIt = rMap.find( aGuid );
- sal_uInt16 nCtrlType = (aIt == rMap.end()) ? EXC_CTRL_UNKNOWN : aIt->second;
- rOutStrm << "guid=" << aGuid;
- return nCtrlType;
-};
-
-// other guids ----------------------------------------------------------------
-
-static const XclGuid saStdFontGuid( 0x0BE35203, 0x8F91, 0x11CE, 0x9D, 0xE3, 0x00, 0xAA, 0x00, 0x4B, 0xB8, 0x51 );
-static const XclGuid saStdPicGuid( 0x0BE35204, 0x8F91, 0x11CE, 0x9D, 0xE3, 0x00, 0xAA, 0x00, 0x4B, 0xB8, 0x51 );\
-
-// ----------------------------------------------------------------------------
-
-} // namespace
-
-// *** yet some other ugly macros for the specials of form control dumping ***
-
-// align the instream
-#define EXC_CTRLDUMP_ALIGN_INSTRM( val ) lclAlignStream( rInStrm, nStartPos, val )
-// push the string to outstream
-#define EXC_CTRLDUMP_PRINT() { if( t.Len() ) { rOutStrm << t.GetBuffer() << '\n'; t.Erase(); } }
-
-// implementation, don't use
-#define IMPL_EXC_CTRLDUMP_PLAIN_VALUE( type, func, text ) { type n; rInStrm >> n; t.Append( " " text "=" ); func( t, n ); EXC_CTRLDUMP_PRINT(); }
-#define IMPL_EXC_CTRLDUMP_VALUE( type, func, text ) { EXC_CTRLDUMP_ALIGN_INSTRM( sizeof( type ) ); IMPL_EXC_CTRLDUMP_PLAIN_VALUE( type, func, text ); }
-#define IMPL_EXC_CTRLDUMP_PLAIN_VAR( var, mask, func, text ) { rInStrm >> var; var &= (mask); t.Append( " " text "=" ); func( t, var ); EXC_CTRLDUMP_PRINT(); }
-#define IMPL_EXC_CTRLDUMP_VAR( var, mask, func, text ) { EXC_CTRLDUMP_ALIGN_INSTRM( sizeof( var ) ); IMPL_EXC_CTRLDUMP_PLAIN_VAR( var, mask, func, text ); }
-
-// read a value from stream (no stream alignment)
-#define EXC_CTRLDUMP_PLAIN_HEX4( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( sal_uInt32, lclAppendHex, text )
-#define EXC_CTRLDUMP_PLAIN_DEC4( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( sal_Int32, lclAppendDec, text )
-#define EXC_CTRLDUMP_PLAIN_HEX2( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( sal_uInt16, lclAppendHex, text )
-#define EXC_CTRLDUMP_PLAIN_DEC2( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( sal_Int16, lclAppendDec, text )
-#define EXC_CTRLDUMP_PLAIN_HEX1( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( sal_uInt8, lclAppendHex, text )
-#define EXC_CTRLDUMP_PLAIN_DEC1( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( sal_Int8, lclAppendDec, text )
-#define EXC_CTRLDUMP_PLAIN_DECF( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( float, lclAppendDec, text )
-// read a value from stream (with stream alignment)
-#define EXC_CTRLDUMP_HEX4( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_uInt32, lclAppendHex, text )
-#define EXC_CTRLDUMP_DEC4( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_Int32, lclAppendDec, text )
-#define EXC_CTRLDUMP_HEX2( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_uInt16, lclAppendHex, text )
-#define EXC_CTRLDUMP_DEC2( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_Int16, lclAppendDec, text )
-#define EXC_CTRLDUMP_HEX1( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_uInt8, lclAppendHex, text )
-#define EXC_CTRLDUMP_DEC1( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_Int8, lclAppendDec, text )
-// read a value from stream into existing variable (no stream alignment)
-#define EXC_CTRLDUMP_PLAIN_HEXVAR( var, text ) IMPL_EXC_CTRLDUMP_PLAIN_VAR( var, ~0, lclAppendHex, text )
-#define EXC_CTRLDUMP_PLAIN_DECVAR( var, text ) IMPL_EXC_CTRLDUMP_PLAIN_VAR( var, ~0, lclAppendDec, text )
-#define EXC_CTRLDUMP_PLAIN_HEXVARMASK( var, mask, text ) IMPL_EXC_CTRLDUMP_PLAIN_VAR( var, mask, lclAppendHex, text )
-#define EXC_CTRLDUMP_PLAIN_DECVARMASK( var, mask, text ) IMPL_EXC_CTRLDUMP_PLAIN_VAR( var, mask, lclAppendDec, text )
-// read a value from stream into existing variable (with stream alignment)
-#define EXC_CTRLDUMP_HEXVAR( var, text ) IMPL_EXC_CTRLDUMP_VAR( var, ~0, lclAppendHex, text )
-#define EXC_CTRLDUMP_DECVAR( var, text ) IMPL_EXC_CTRLDUMP_VAR( var, ~0, lclAppendDec, text )
-#define EXC_CTRLDUMP_HEXVARMASK( var, mask, text ) IMPL_EXC_CTRLDUMP_VAR( var, mask, lclAppendHex, text )
-#define EXC_CTRLDUMP_DECVARMASK( var, mask, text ) IMPL_EXC_CTRLDUMP_VAR( var, mask, lclAppendDec, text )
-// read flag fields
-#define EXC_CTRLDUMP_PLAIN_STARTOPTFLAG( text, doread, defaults )\
-{ \
- nFlags = defaults; \
- t.Append( " " text ); \
- if( doread ) \
- rInStrm >> nFlags; \
- else \
- t.Append( "-defaulted" ); \
- t.Append( '=' ); \
- lclAppendHex( t, nFlags ); \
-}
-#define EXC_CTRLDUMP_STARTOPTFLAG( text, doread, defaults ) { if( doread ) { EXC_CTRLDUMP_ALIGN_INSTRM( sizeof( nFlags ) ); } EXC_CTRLDUMP_PLAIN_STARTOPTFLAG( text, doread, defaults ) }
-#define EXC_CTRLDUMP_PLAIN_STARTFLAG( text ) EXC_CTRLDUMP_PLAIN_STARTOPTFLAG( text, true, 0 )
-#define EXC_CTRLDUMP_STARTFLAG( text ) EXC_CTRLDUMP_STARTOPTFLAG( text, true, 0 )
-#define EXC_CTRLDUMP_ADDFLAG( flag, text ) { if( nFlags & (flag) ) t.Append( " " text ); }
-#define EXC_CTRLDUMP_ADDFLAGVALUE( start, width, text ) { sal_uInt32 nValue; ::extract_value( nValue, nFlags, start, width ); t.Append( " " text "=" ); lclAppendDec( t, nValue ); }
-#define EXC_CTRLDUMP_ENDFLAG( reserved ) { if( nFlags & (reserved) ) { t.Append( " ?" ); lclAppendHex( t, static_cast< sal_uInt32 >( nFlags & (reserved) ) ); } EXC_CTRLDUMP_PRINT(); }
-// read coordinates
-#define EXC_CTRLDUMP_COORD2( text ) { EXC_CTRLDUMP_ALIGN_INSTRM( 4 ); EXC_CTRLDUMP_DEC2( text "-x" ); EXC_CTRLDUMP_DEC2( text "-y" ); }
-#define EXC_CTRLDUMP_COORD4( text ) { EXC_CTRLDUMP_DEC4( text "-x" ); EXC_CTRLDUMP_DEC4( text "-y" ); }
-#define EXC_CTRLDUMP_SIZE4( text ) { EXC_CTRLDUMP_DEC4( text "-width" ); EXC_CTRLDUMP_DEC4( text "-height" ); }
-// read guid
-#define EXC_CTRLDUMP_PLAIN_GUID( text ) IMPL_EXC_CTRLDUMP_PLAIN_VALUE( XclGuid, lclAppendGuid, text )
-#define EXC_CTRLDUMP_GUID( text ) { EXC_CTRLDUMP_ALIGN_INSTRM( 4 ); EXC_CTRLDUMP_PLAIN_GUID( text ); }
-// read control type
-#define EXC_CTRLDUMP_CTRLTYPE( var, text ) \
-{ \
- EXC_CTRLDUMP_ALIGN_INSTRM( 2 ); \
- rInStrm >> var; \
- t.Assign( " " text "=" ); lclAppendHex( t, var ); \
- t.Append( " (" ); lclAppendControlType( t, var ); \
- t.Append( ')' ); \
- EXC_CTRLDUMP_PRINT(); \
-}
-// read character array, add to string, but do not print
-#define EXC_CTRLDUMP_RAWSTRING( var ) \
-{ \
- t.Append( "='" ); \
- if( var ) \
- { \
- EXC_CTRLDUMP_ALIGN_INSTRM( 4 ); \
- ULONG nNextPos = rInStrm.Tell() + (var); \
- if( var > 128 ) var = 128; \
- sal_Char pc[ 129 ]; \
- rInStrm.Read( pc, var ); pc[ var ] = '\0'; \
- t.Append( pc ); \
- rInStrm.Seek( nNextPos ); \
- } \
- t.Append( '\'' ); \
-}
-// read a string
-#define EXC_CTRLDUMP_STRING( var, text ) \
-{ \
- t.Append( " " text ); \
- EXC_CTRLDUMP_RAWSTRING( var ); \
- EXC_CTRLDUMP_PRINT(); \
-}
-// read an array of strings
-#define EXC_CTRLDUMP_STRINGARRAY( total, count, text ) \
-{ \
- ULONG nNextPos = rInStrm.Tell() + (total); \
- for( sal_uInt32 nIdx = 0; (nIdx < (count)) && (rInStrm.Tell() < nNextPos); ++nIdx )\
- { \
- EXC_CTRLDUMP_ALIGN_INSTRM( 4 ); \
- sal_uInt32 nLen; \
- rInStrm >> nLen; \
- nLen &= 0x7FFFFFFF; \
- t.Append( " " text "[" ); \
- lclAppendDec( t, nIdx + 1 ); \
- t.Append( ']' ); \
- EXC_CTRLDUMP_RAWSTRING( nLen ); \
- } \
- EXC_CTRLDUMP_PRINT(); \
- rInStrm.Seek( nNextPos ); \
-}
-// read embedded font data
-#define EXC_CTRLDUMP_FONT( var, text ) \
-if( var ) \
-{ \
- EXC_CTRLDUMP_PRINT(); \
- XclGuid aGuid; rInStrm >> aGuid; \
- rOutStrm << "embedded-font-guid=" << aGuid; \
- if( aGuid == saStdFontGuid ) \
- { \
- rOutStrm << " (StdFont)\n"; \
- EXC_CTRLDUMP_PLAIN_HEX1( "unknown1" ); \
- EXC_CTRLDUMP_PLAIN_DEC1( "script-type" ); \
- EXC_CTRLDUMP_PLAIN_HEX1( "unknown2" ); \
- sal_uInt8 nFlags; \
- EXC_CTRLDUMP_PLAIN_STARTFLAG( "font-style-flags" ); \
- EXC_CTRLDUMP_ADDFLAG( 0x02, "italic" ); \
- EXC_CTRLDUMP_ADDFLAG( 0x04, "underline" ); \
- EXC_CTRLDUMP_ADDFLAG( 0x08, "strikeout" ); \
- EXC_CTRLDUMP_ENDFLAG( 0xF1 ); \
- EXC_CTRLDUMP_PLAIN_DEC2( "font-weight" ); \
- EXC_CTRLDUMP_PLAIN_DEC4( "font-size" ); \
-/* font-size := pt*10000 + (1-((pt+1)%3))*2500 */ \
- sal_uInt8 nLen; \
- EXC_CTRLDUMP_PLAIN_DECVAR( nLen, "font-name-len" ); \
- sal_Char* p = new sal_Char[ nLen + 1 ]; \
- rInStrm.Read( p, nLen ); p[ nLen ] = '\0'; \
- t.Append( " font-name='" ).Append( p ).Append( '\'' );\
- delete [] p; \
- EXC_CTRLDUMP_PRINT(); \
- } \
- else \
- rOutStrm << " (*UNKNOWN*)\n"; \
-}
-// read image data
-#define EXC_CTRLDUMP_IMAGE( var, text ) \
-if( var ) \
-{ \
- EXC_CTRLDUMP_PRINT(); \
- XclGuid aGuid; rInStrm >> aGuid; \
- rOutStrm << "embedded-" text "-guid=" << aGuid; \
- if( aGuid == saStdPicGuid ) \
- { \
- rOutStrm << " (StdPict)\n"; \
- EXC_CTRLDUMP_PLAIN_HEX2( "u1" ); \
- EXC_CTRLDUMP_PLAIN_HEX2( "u2" ); \
- sal_uInt32 nLen; \
- EXC_CTRLDUMP_PLAIN_DECVAR( nLen, text "-len" ); \
- rInStrm.SeekRel( nLen ); \
- } \
- else \
- rOutStrm << " (*UNKNOWN*)\n"; \
-}
-// hex dump remaining or unknown data
-#define EXC_CTRLDUMP_REMAINING( nextpos ) \
-{ \
- EXC_CTRLDUMP_ALIGN_INSTRM( 4 ); \
- if( rInStrm.Tell() < (nextpos) ) \
- { \
- rOutStrm << " unknown-data=\n"; \
- DumpBinary( rInStrm, ::std::min< ULONG >( (nextpos) - rInStrm.Tell(), 1024 ) );\
- } \
- rInStrm.Seek( nextpos ); \
-}
-
-// *** macros end ***
-
-void Biff8RecDumper::DumpControlContents( SvStream& rInStrm, sal_uInt16 nCtrlType )
-{
- SvStream& rOutStrm = *pDumpStream;
-
- if( nCtrlType == EXC_CTRL_PROGRESSBAR )
- {
- lclDumpControlType( rOutStrm, nCtrlType );
- rOutStrm << '\n';
-
- ByteString t; // "t" needed for macros
- sal_uInt32 nFlags = 0; // "nFlags" needed for macros
-
- EXC_CTRLDUMP_PLAIN_HEX4( "unknown" );
- EXC_CTRLDUMP_PLAIN_HEX4( "unknown" );
- EXC_CTRLDUMP_PLAIN_DEC4( "width" );
- EXC_CTRLDUMP_PLAIN_DEC4( "height" );
- EXC_CTRLDUMP_PLAIN_HEX4( "unknown" );
- EXC_CTRLDUMP_PLAIN_HEX4( "unknown" );
- EXC_CTRLDUMP_PLAIN_HEX4( "unknown" );
- EXC_CTRLDUMP_PLAIN_DECF( "min" );
- EXC_CTRLDUMP_PLAIN_DECF( "max" );
- EXC_CTRLDUMP_PLAIN_STARTFLAG( "flags1" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000001, "vertical" );
- EXC_CTRLDUMP_ADDFLAG( 0x00010000, "smooth-scroll" );
- EXC_CTRLDUMP_ENDFLAG( 0xFFFEFFFE );
- EXC_CTRLDUMP_PLAIN_HEX4( "unknown" );
- EXC_CTRLDUMP_PLAIN_HEX4( "unknown" );
- EXC_CTRLDUMP_PLAIN_HEX4( "unknown" );
- EXC_CTRLDUMP_PLAIN_STARTFLAG( "flags2" );
- EXC_CTRLDUMP_ADDFLAG( 0x0001, "border-single" );
- EXC_CTRLDUMP_ADDFLAG( 0x0002, "enabled" );
- EXC_CTRLDUMP_ADDFLAG( 0x0004, "3d-style" );
- EXC_CTRLDUMP_ADDFLAGVALUE( 3, 8, "mouse-icon" );
- EXC_CTRLDUMP_ADDFLAG( 0x2000, "ole-drop-manual" );
- EXC_CTRLDUMP_ENDFLAG( 0xFFFFD800 );
- return;
- }
-
- sal_uInt16 nSize = lclDumpControlHeader( rInStrm, rOutStrm, nCtrlType );
- if( nSize > 0 )
- {
- ULONG nStartPos = rInStrm.Tell(); // for stream alignment macro
- ByteString t; // "t" needed for macros
- sal_uInt32 nFlags = 0; // "nFlags" needed for macros
-
- bool bHasFontData = false;
- sal_uInt32 nNameLen = 0;
- sal_uInt32 nCaptionLen = 0;
- sal_uInt32 nValueLen = 0;
- sal_uInt32 nGroupNameLen = 0;
- sal_uInt32 nTagLen = 0;
- sal_uInt32 nTipLen = 0;
- sal_uInt32 nCtrlIdLen = 0;
- sal_uInt32 nCtrlSrcLen = 0;
- sal_uInt32 nRowSrcLen = 0;
- sal_uInt16 nPic = 0;
- sal_uInt16 nIcon = 0;
- sal_uInt16 nFont = 0;
-
- switch( nCtrlType )
- {
- case EXC_CTRL_PUSHBUTTON:
- {
- EXC_CTRLDUMP_STARTFLAG( "content-flags" );
- EXC_CTRLDUMP_ADDFLAG( 0x0001, "forecolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x0002, "backcolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x0004, "option" );
- EXC_CTRLDUMP_ADDFLAG( 0x0008, "caption" );
- EXC_CTRLDUMP_ADDFLAG( 0x0010, "picpos" );
- EXC_CTRLDUMP_ADDFLAG( 0x0020, "size" );
- EXC_CTRLDUMP_ADDFLAG( 0x0040, "mouseptr" );
- EXC_CTRLDUMP_ADDFLAG( 0x0080, "pic" );
- EXC_CTRLDUMP_ADDFLAG( 0x0100, "accel" );
- EXC_CTRLDUMP_ADDFLAG( 0x0200, "notakefocus" );
- EXC_CTRLDUMP_ADDFLAG( 0x0400, "icon" );
- EXC_CTRLDUMP_ENDFLAG( 0xFFFFF800 );
- sal_uInt32 nCtrlFlags = nFlags;
-
- if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_HEX4( "forecolor" );
- if( nCtrlFlags & 0x0002 ) EXC_CTRLDUMP_HEX4( "backcolor" );
-
- EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x0004, 0x0000001B );
- EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000004, "locked" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000008, "opaque" );
- EXC_CTRLDUMP_ADDFLAG( 0x00800000, "wordwrap" );
- EXC_CTRLDUMP_ADDFLAG( 0x10000000, "autosize" );
- EXC_CTRLDUMP_ENDFLAG( 0xEF7FFFF1 );
-
- if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_DECVARMASK( nCaptionLen, 0x7FFFFFFF, "caption-len" );
- if( nCtrlFlags & 0x0010 ) EXC_CTRLDUMP_COORD2( "picpos" );
- if( nCtrlFlags & 0x0040 ) EXC_CTRLDUMP_DEC1( "mouseptr" );
- if( nCtrlFlags & 0x0080 ) EXC_CTRLDUMP_HEXVAR( nPic, "pic" );
- if( nCtrlFlags & 0x0100 ) EXC_CTRLDUMP_HEX2( "accel" );
- if( nCtrlFlags & 0x0400 ) EXC_CTRLDUMP_HEXVAR( nIcon, "icon" );
-
- if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_STRING( nCaptionLen, "caption" );
- if( nCtrlFlags & 0x0020 ) EXC_CTRLDUMP_SIZE4( "size" );
- EXC_CTRLDUMP_REMAINING( nStartPos + nSize );
-
- EXC_CTRLDUMP_IMAGE( nPic, "pic" );
- EXC_CTRLDUMP_IMAGE( nIcon, "icon" );
- bHasFontData = true;
- }
- break;
-
- case EXC_CTRL_TOGGLEBUTTON:
- case EXC_CTRL_CHECKBOX:
- case EXC_CTRL_OPTIONBUTTON:
- case EXC_CTRL_TEXTBOX:
- case EXC_CTRL_LISTBOX:
- case EXC_CTRL_COMBOBOX:
- case EXC_CTRL_REFEDIT:
- {
- EXC_CTRLDUMP_STARTFLAG( "content-flags" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000001, "option" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000002, "backcolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000004, "forecolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000008, "maxlen" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000010, "borderstyle" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000020, "scrollbars" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000040, "style" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000080, "mouseptr" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000100, "size" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000200, "passwordchar" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000400, "listwidth" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000800, "boundcol" );
- EXC_CTRLDUMP_ADDFLAG( 0x00001000, "textcol" );
- EXC_CTRLDUMP_ADDFLAG( 0x00002000, "colcount" );
- EXC_CTRLDUMP_ADDFLAG( 0x00004000, "listrows" );
- EXC_CTRLDUMP_ADDFLAG( 0x00008000, "colwidth?" );
- EXC_CTRLDUMP_ADDFLAG( 0x00010000, "matchentry" );
- EXC_CTRLDUMP_ADDFLAG( 0x00020000, "liststyle" );
- EXC_CTRLDUMP_ADDFLAG( 0x00040000, "showdropbtn" );
- EXC_CTRLDUMP_ADDFLAG( 0x00100000, "dropbtnstyle" );
- EXC_CTRLDUMP_ADDFLAG( 0x00200000, "multistate" );
- EXC_CTRLDUMP_ADDFLAG( 0x00400000, "value" );
- EXC_CTRLDUMP_ADDFLAG( 0x00800000, "caption" );
- EXC_CTRLDUMP_ADDFLAG( 0x01000000, "picpos" );
- EXC_CTRLDUMP_ADDFLAG( 0x02000000, "bordercolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x04000000, "specialeff" );
- EXC_CTRLDUMP_ADDFLAG( 0x08000000, "icon" );
- EXC_CTRLDUMP_ADDFLAG( 0x10000000, "pic" );
- EXC_CTRLDUMP_ADDFLAG( 0x20000000, "accel" );
- EXC_CTRLDUMP_ENDFLAG( 0x40080000 ); // 0x80000000 always set?
- sal_uInt32 nCtrlFlags = nFlags;
-
- EXC_CTRLDUMP_STARTFLAG( "2nd-content-flags" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000001, "groupname" );
- EXC_CTRLDUMP_ENDFLAG( 0xFFFFFFFE );
- sal_uInt32 nCtrlFlags2 = nFlags;
-
- EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x00000001, 0x2C80081B );
- EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000004, "locked" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000008, "opaque" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000400, "colheads" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000800, "intheight" );
- EXC_CTRLDUMP_ADDFLAG( 0x00001000, "matchreq" );
- EXC_CTRLDUMP_ADDFLAG( 0x00002000, "align" );
- EXC_CTRLDUMP_ADDFLAGVALUE( 15, 4, "ime-mode" );
- EXC_CTRLDUMP_ADDFLAG( 0x00080000, "dragbehav" );
- EXC_CTRLDUMP_ADDFLAG( 0x00100000, "enterkeybehav" );
- EXC_CTRLDUMP_ADDFLAG( 0x00200000, "enterfieldbehav" );
- EXC_CTRLDUMP_ADDFLAG( 0x00400000, "tabkeybehav" );
- EXC_CTRLDUMP_ADDFLAG( 0x00800000, "wordwrap" );
- EXC_CTRLDUMP_ADDFLAG( 0x04000000, "selmargin" );
- EXC_CTRLDUMP_ADDFLAG( 0x08000000, "autowordsel" );
- EXC_CTRLDUMP_ADDFLAG( 0x10000000, "autosize" );
- EXC_CTRLDUMP_ADDFLAG( 0x20000000, "hidesel" );
- EXC_CTRLDUMP_ADDFLAG( 0x40000000, "autotab" );
- EXC_CTRLDUMP_ADDFLAG( 0x80000000, "multiline" );
- EXC_CTRLDUMP_ENDFLAG( 0x030043F1 );
-
- if( nCtrlFlags & 0x00000002 ) EXC_CTRLDUMP_HEX4( "backcolor" );
- if( nCtrlFlags & 0x00000004 ) EXC_CTRLDUMP_HEX4( "forecolor" );
- if( nCtrlFlags & 0x00000008 ) EXC_CTRLDUMP_DEC4( "maxlen" );
- if( nCtrlFlags & 0x00000010 ) EXC_CTRLDUMP_DEC1( "borderstyle" );
- if( nCtrlFlags & 0x00000020 ) EXC_CTRLDUMP_DEC1( "scrollbars" );
- if( nCtrlFlags & 0x00000040 ) EXC_CTRLDUMP_DEC1( "style" );
- if( nCtrlFlags & 0x00000080 ) EXC_CTRLDUMP_DEC1( "mouseptr" );
- if( nCtrlFlags & 0x00000200 ) EXC_CTRLDUMP_HEX2( "passwordchar" );
- if( nCtrlFlags & 0x00000400 ) EXC_CTRLDUMP_DEC4( "listwidth" );
- if( nCtrlFlags & 0x00000800 ) EXC_CTRLDUMP_DEC2( "boundcol" );
- if( nCtrlFlags & 0x00001000 ) EXC_CTRLDUMP_DEC2( "textcol" );
- if( nCtrlFlags & 0x00002000 ) EXC_CTRLDUMP_DEC2( "colcount" );
- if( nCtrlFlags & 0x00004000 ) EXC_CTRLDUMP_DEC2( "listrows" );
- if( nCtrlFlags & 0x00008000 ) EXC_CTRLDUMP_DEC2( "colwidth?" );
- if( nCtrlFlags & 0x00010000 ) EXC_CTRLDUMP_DEC1( "matchentry" );
- if( nCtrlFlags & 0x00020000 ) EXC_CTRLDUMP_DEC1( "liststyle" );
- if( nCtrlFlags & 0x00040000 ) EXC_CTRLDUMP_DEC1( "showdropbtn" );
- if( nCtrlFlags & 0x00100000 ) EXC_CTRLDUMP_DEC1( "dropbtnstyle" );
- if( nCtrlFlags & 0x00200000 ) EXC_CTRLDUMP_DEC1( "multistate" );
- if( nCtrlFlags & 0x00400000 ) EXC_CTRLDUMP_DECVARMASK( nValueLen, 0x7FFFFFFF, "value-len" );
- if( nCtrlFlags & 0x00800000 ) EXC_CTRLDUMP_DECVARMASK( nCaptionLen, 0x7FFFFFFF, "caption-len" );
- if( nCtrlFlags & 0x01000000 ) EXC_CTRLDUMP_COORD2( "picpos" );
- if( nCtrlFlags & 0x02000000 ) EXC_CTRLDUMP_HEX4( "bordercolor" );
- if( nCtrlFlags & 0x04000000 ) EXC_CTRLDUMP_DEC4( "specialeff" );
- if( nCtrlFlags & 0x08000000 ) EXC_CTRLDUMP_HEXVAR( nIcon, "icon" );
- if( nCtrlFlags & 0x10000000 ) EXC_CTRLDUMP_HEXVAR( nPic, "pic" );
- if( nCtrlFlags & 0x20000000 ) EXC_CTRLDUMP_HEX1( "accel" );
- if( nCtrlFlags2 & 0x00000001 ) EXC_CTRLDUMP_DECVARMASK( nGroupNameLen, 0x7FFFFFFF, "groupname-len" );
-
- if( nCtrlFlags & 0x00000100 ) EXC_CTRLDUMP_SIZE4( "size" );
- if( nCtrlFlags & 0x00400000 ) EXC_CTRLDUMP_STRING( nValueLen, "value" );
- if( nCtrlFlags & 0x00800000 ) EXC_CTRLDUMP_STRING( nCaptionLen, "caption" );
- if( nCtrlFlags2 & 0x00000001 ) EXC_CTRLDUMP_STRING( nGroupNameLen, "groupname" );
- EXC_CTRLDUMP_REMAINING( nStartPos + nSize );
-
- EXC_CTRLDUMP_IMAGE( nIcon, "icon" );
- EXC_CTRLDUMP_IMAGE( nPic, "pic" );
- bHasFontData = true;
- }
- break;
-
- case EXC_CTRL_LABEL:
- {
- EXC_CTRLDUMP_STARTFLAG( "content-flags" );
- EXC_CTRLDUMP_ADDFLAG( 0x0001, "forecolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x0002, "backcolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x0004, "option" );
- EXC_CTRLDUMP_ADDFLAG( 0x0008, "caption" );
- EXC_CTRLDUMP_ADDFLAG( 0x0010, "picpos" );
- EXC_CTRLDUMP_ADDFLAG( 0x0020, "size" );
- EXC_CTRLDUMP_ADDFLAG( 0x0040, "mouseptr" );
- EXC_CTRLDUMP_ADDFLAG( 0x0080, "bordercolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x0100, "borderstyle" );
- EXC_CTRLDUMP_ADDFLAG( 0x0200, "specialeff" );
- EXC_CTRLDUMP_ADDFLAG( 0x0400, "pic" );
- EXC_CTRLDUMP_ADDFLAG( 0x0800, "accel" );
- EXC_CTRLDUMP_ADDFLAG( 0x1000, "icon" );
- EXC_CTRLDUMP_ENDFLAG( 0xFFFFE000 );
- sal_uInt32 nCtrlFlags = nFlags;
-
- if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_HEX4( "forecolor" );
- if( nCtrlFlags & 0x0002 ) EXC_CTRLDUMP_HEX4( "backcolor" );
-
- EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x0004, 0x0080001B );
- EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000004, "locked" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000008, "opaque" );
- EXC_CTRLDUMP_ADDFLAG( 0x00800000, "wordwrap" );
- EXC_CTRLDUMP_ADDFLAG( 0x10000000, "autosize" );
- EXC_CTRLDUMP_ENDFLAG( 0xEF7FFFF0 ); // 0x00000001 always set?
-
- if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_DECVARMASK( nCaptionLen, 0x7FFFFFFF, "caption-len" );
- if( nCtrlFlags & 0x0010 ) EXC_CTRLDUMP_COORD2( "picpos" );
- if( nCtrlFlags & 0x0040 ) EXC_CTRLDUMP_DEC1( "mouseptr" );
- if( nCtrlFlags & 0x0080 ) EXC_CTRLDUMP_HEX4( "bordercolor" );
- if( nCtrlFlags & 0x0100 ) EXC_CTRLDUMP_HEX2( "borderstyle" );
- if( nCtrlFlags & 0x0200 ) EXC_CTRLDUMP_HEX2( "specialeff" );
- if( nCtrlFlags & 0x0400 ) EXC_CTRLDUMP_HEXVAR( nPic, "pic" );
- if( nCtrlFlags & 0x0800 ) EXC_CTRLDUMP_HEX2( "accel" );
- if( nCtrlFlags & 0x1000 ) EXC_CTRLDUMP_HEXVAR( nIcon, "icon" );
-
- if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_STRING( nCaptionLen, "caption" );
- if( nCtrlFlags & 0x0020 ) EXC_CTRLDUMP_SIZE4( "size" );
- EXC_CTRLDUMP_REMAINING( nStartPos + nSize );
-
- EXC_CTRLDUMP_IMAGE( nPic, "pic" );
- EXC_CTRLDUMP_IMAGE( nIcon, "icon" );
- bHasFontData = true;
- }
- break;
-
- case EXC_CTRL_SPINBUTTON:
- case EXC_CTRL_SCROLLBAR:
- {
- EXC_CTRLDUMP_STARTFLAG( "content-flags" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000001, "forecolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000002, "backcolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000004, "option" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000008, "size" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000010, "mouseptr" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000100, "unknown1" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000200, "unknown2" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000400, "unknown3" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000020, "min" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000040, "max" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000080, "value" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000800, "step" );
- EXC_CTRLDUMP_ADDFLAG( 0x00001000, "page-step" );
- EXC_CTRLDUMP_ADDFLAG( 0x00002000, "orient" );
- EXC_CTRLDUMP_ADDFLAG( 0x00004000, "prop-thumb" );
- EXC_CTRLDUMP_ADDFLAG( 0x00008000, "delay" );
- EXC_CTRLDUMP_ADDFLAG( 0x00010000, "icon" );
- EXC_CTRLDUMP_ENDFLAG( 0xFFFE0000 );
- sal_uInt32 nCtrlFlags = nFlags;
-
- if( nCtrlFlags & 0x00000001 ) EXC_CTRLDUMP_HEX4( "forecolor" );
- if( nCtrlFlags & 0x00000002 ) EXC_CTRLDUMP_HEX4( "backcolor" );
-
- EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x00000004, 0x0000001B );
- EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000004, "locked" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000008, "opaque" );
- EXC_CTRLDUMP_ADDFLAG( 0x10000000, "autosize" );
- EXC_CTRLDUMP_ENDFLAG( 0xEFFFFFF1 );
-
- if( nCtrlFlags & 0x00000010 ) EXC_CTRLDUMP_DEC1( "mouseptr" );
- if( nCtrlFlags & 0x00000020 ) EXC_CTRLDUMP_DEC4( "min" );
- if( nCtrlFlags & 0x00000040 ) EXC_CTRLDUMP_DEC4( "max" );
- if( nCtrlFlags & 0x00000080 ) EXC_CTRLDUMP_DEC4( "value" );
- if( nCtrlFlags & 0x00000100 ) EXC_CTRLDUMP_HEX4( "unknown1" );
- if( nCtrlFlags & 0x00000200 ) EXC_CTRLDUMP_HEX4( "unknown2" );
- if( nCtrlFlags & 0x00000400 ) EXC_CTRLDUMP_HEX4( "unknown3" );
- if( nCtrlFlags & 0x00000800 ) EXC_CTRLDUMP_DEC4( "step" );
- if( nCtrlFlags & 0x00001000 ) EXC_CTRLDUMP_DEC4( "page-step" );
- if( nCtrlFlags & 0x00002000 ) EXC_CTRLDUMP_DEC4( "orient" );
- if( nCtrlFlags & 0x00004000 ) EXC_CTRLDUMP_DEC4( "prop-thumb" );
- if( nCtrlFlags & 0x00008000 ) EXC_CTRLDUMP_DEC4( "delay" );
- if( nCtrlFlags & 0x00010000 ) EXC_CTRLDUMP_HEXVAR( nIcon, "icon" );
-
- if( nCtrlFlags & 0x00000008 ) EXC_CTRLDUMP_SIZE4( "size" );
- EXC_CTRLDUMP_REMAINING( nStartPos + nSize );
-
- EXC_CTRLDUMP_IMAGE( nIcon, "icon" );
- }
- break;
-
- case EXC_CTRL_IMAGE:
- {
- EXC_CTRLDUMP_STARTFLAG( "content-flags" );
- EXC_CTRLDUMP_ADDFLAG( 0x0004, "autosize" );
- EXC_CTRLDUMP_ADDFLAG( 0x0008, "bordercolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x0010, "backcolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x0020, "borderstyle" );
- EXC_CTRLDUMP_ADDFLAG( 0x0040, "mouseptr" );
- EXC_CTRLDUMP_ADDFLAG( 0x0080, "picsizemode" );
- EXC_CTRLDUMP_ADDFLAG( 0x0100, "speceffect" );
- EXC_CTRLDUMP_ADDFLAG( 0x0200, "size" );
- EXC_CTRLDUMP_ADDFLAG( 0x0400, "pic" );
- EXC_CTRLDUMP_ADDFLAG( 0x0800, "picalign" );
- EXC_CTRLDUMP_ADDFLAG( 0x1000, "pictiling" );
- EXC_CTRLDUMP_ADDFLAG( 0x2000, "option" );
- EXC_CTRLDUMP_ADDFLAG( 0x4000, "icon" );
- EXC_CTRLDUMP_ENDFLAG( 0xFFFF8003 );
- sal_uInt32 nCtrlFlags = nFlags;
-
- if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_HEX4( "bordercolor" );
- if( nCtrlFlags & 0x0010 ) EXC_CTRLDUMP_HEX4( "backcolor" );
- if( nCtrlFlags & 0x0020 ) EXC_CTRLDUMP_HEX1( "borderstyle" );
- if( nCtrlFlags & 0x0040 ) EXC_CTRLDUMP_DEC1( "mouseptr" );
- if( nCtrlFlags & 0x0080 ) EXC_CTRLDUMP_DEC1( "picsizemode" );
- if( nCtrlFlags & 0x0100 ) EXC_CTRLDUMP_HEX1( "speceffect" );
- if( nCtrlFlags & 0x0400 ) EXC_CTRLDUMP_HEXVAR( nPic, "pic" );
- if( nCtrlFlags & 0x0800 ) EXC_CTRLDUMP_HEX1( "picalign" );
-
- EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x2000, 0x0000001B );
- EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000008, "opaque" );
- EXC_CTRLDUMP_ENDFLAG( 0xFFFFFFF5 );
-
- if( nCtrlFlags & 0x4000 ) EXC_CTRLDUMP_HEXVAR( nIcon, "icon" );
-
- if( nCtrlFlags & 0x0200 ) EXC_CTRLDUMP_SIZE4( "size" );
- EXC_CTRLDUMP_REMAINING( nStartPos + nSize );
-
- EXC_CTRLDUMP_IMAGE( nPic, "pic" );
- EXC_CTRLDUMP_IMAGE( nIcon, "icon" );
- }
- break;
-
- case EXC_CTRL_TABSTRIP:
- {
- EXC_CTRLDUMP_STARTFLAG( "content-flags" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000001, "selected-tab" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000002, "backcolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000004, "forecolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000010, "size" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000020, "caption-arr-len" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000040, "mouseptr" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000100, "taborientation" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000200, "tabstyle" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000400, "multirow" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000800, "fixed-width" );
- EXC_CTRLDUMP_ADDFLAG( 0x00001000, "fixed-height" );
- EXC_CTRLDUMP_ADDFLAG( 0x00008000, "infotip-arr-len" );
- EXC_CTRLDUMP_ADDFLAG( 0x00020000, "id-arr-len" );
- EXC_CTRLDUMP_ADDFLAG( 0x00040000, "option" );
- EXC_CTRLDUMP_ADDFLAG( 0x00080000, "last-id" );
- EXC_CTRLDUMP_ADDFLAG( 0x00200000, "unknown-arr-len" );
- EXC_CTRLDUMP_ADDFLAG( 0x00400000, "tab-count" );
- EXC_CTRLDUMP_ADDFLAG( 0x00800000, "shortcut-arr-len" );
- EXC_CTRLDUMP_ADDFLAG( 0x01000000, "icon" );
- EXC_CTRLDUMP_ENDFLAG( 0xFE116088 );
- sal_uInt32 nCtrlFlags = nFlags;
-
- sal_uInt32 nTabCount = 0;
- sal_uInt32 nIdArrLen = 0;
- sal_uInt32 nUnknownArrLen = 0;
- sal_uInt32 nShortArrLen = 0;
-
- if( nCtrlFlags & 0x00000001 ) EXC_CTRLDUMP_DEC4( "selected-tab" ); // size ok?
- if( nCtrlFlags & 0x00000002 ) EXC_CTRLDUMP_HEX4( "backcolor" );
- if( nCtrlFlags & 0x00000004 ) EXC_CTRLDUMP_HEX4( "forecolor" );
- if( nCtrlFlags & 0x00000020 ) EXC_CTRLDUMP_HEXVAR( nCaptionLen, "caption-arr-len" );
- if( nCtrlFlags & 0x00000040 ) EXC_CTRLDUMP_DEC1( "mouseptr" ); // size ok?
- if( nCtrlFlags & 0x00000100 ) EXC_CTRLDUMP_DEC4( "taborientation" ); // size ok?
- if( nCtrlFlags & 0x00000200 ) EXC_CTRLDUMP_DEC4( "tabstyle" ); // size ok?
- if( nCtrlFlags & 0x00000800 ) EXC_CTRLDUMP_DEC4( "fixed-width" );
- if( nCtrlFlags & 0x00001000 ) EXC_CTRLDUMP_DEC4( "fixed-height" );
- if( nCtrlFlags & 0x00008000 ) EXC_CTRLDUMP_HEXVAR( nTipLen, "infotip-arr-len" );
- if( nCtrlFlags & 0x00020000 ) EXC_CTRLDUMP_HEXVAR( nIdArrLen, "id-arr-len" );
-
- EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x00040000, 0x0000001B );
- EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" );
- EXC_CTRLDUMP_ENDFLAG( 0xFFFFFFFD );
-
- if( nCtrlFlags & 0x00080000 ) EXC_CTRLDUMP_DEC4( "last-id" );
- if( nCtrlFlags & 0x00200000 ) EXC_CTRLDUMP_HEXVAR( nUnknownArrLen, "unknown-arr-len" );
- if( nCtrlFlags & 0x00400000 ) EXC_CTRLDUMP_DECVAR( nTabCount, "tab-count" );
- if( nCtrlFlags & 0x00800000 ) EXC_CTRLDUMP_HEXVAR( nShortArrLen, "shortcut-arr-len" );
- if( nCtrlFlags & 0x01000000 ) EXC_CTRLDUMP_HEXVAR( nIcon, "icon" );
-
- if( nCtrlFlags & 0x00000010 ) EXC_CTRLDUMP_SIZE4( "size" );
- if( nCtrlFlags & 0x00000020 ) EXC_CTRLDUMP_STRINGARRAY( nCaptionLen, nTabCount, "caption" );
- if( nCtrlFlags & 0x00008000 ) EXC_CTRLDUMP_STRINGARRAY( nTipLen, nTabCount, "infotip" );
- if( nCtrlFlags & 0x00020000 ) EXC_CTRLDUMP_STRINGARRAY( nIdArrLen, nTabCount, "id" );
- if( nCtrlFlags & 0x00200000 ) EXC_CTRLDUMP_STRINGARRAY( nUnknownArrLen, nTabCount, "unknown" );
- if( nCtrlFlags & 0x00800000 ) EXC_CTRLDUMP_STRINGARRAY( nShortArrLen, nTabCount, "shortcut" );
- EXC_CTRLDUMP_REMAINING( nStartPos + nSize );
-
- EXC_CTRLDUMP_IMAGE( nIcon, "icon" );
- bHasFontData = true;
- }
- break;
-
- case EXC_CTRL_USERFORM:
- case EXC_CTRL_FRAME:
- case EXC_CTRL_MULTIPAGE:
- case EXC_CTRL_PAGE:
- {
- EXC_CTRLDUMP_STARTFLAG( "content-flags" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000002, "backcolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000004, "forecolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000008, "last-id" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000040, "option" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000080, "borderstyle" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000100, "mouseptr" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000200, "scrollbars" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000400, "size" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000800, "scrollsize" );
- EXC_CTRLDUMP_ADDFLAG( 0x00001000, "scrollpos" );
- EXC_CTRLDUMP_ADDFLAG( 0x00008000, "icon" );
- EXC_CTRLDUMP_ADDFLAG( 0x00010000, "cycle" );
- EXC_CTRLDUMP_ADDFLAG( 0x00020000, "speceffect" );
- EXC_CTRLDUMP_ADDFLAG( 0x00040000, "bordercolor" );
- EXC_CTRLDUMP_ADDFLAG( 0x00080000, "caption" );
- EXC_CTRLDUMP_ADDFLAG( 0x00100000, "font" );
- EXC_CTRLDUMP_ADDFLAG( 0x00200000, "pic" );
- EXC_CTRLDUMP_ADDFLAG( 0x00400000, "zoom" );
- EXC_CTRLDUMP_ADDFLAG( 0x00800000, "picalign" );
- EXC_CTRLDUMP_ADDFLAG( 0x01000000, "pictiling" );
- EXC_CTRLDUMP_ADDFLAG( 0x02000000, "picsizemode" );
- EXC_CTRLDUMP_ADDFLAG( 0x04000000, "typeinfover" );
- EXC_CTRLDUMP_ADDFLAG( 0x08000000, "drawbuffer" );
- EXC_CTRLDUMP_ENDFLAG( 0xF0006031 );
- sal_uInt32 nCtrlFlags = nFlags;
-
- if( nCtrlFlags & 0x00000002 ) EXC_CTRLDUMP_HEX4( "backcolor" );
- if( nCtrlFlags & 0x00000004 ) EXC_CTRLDUMP_HEX4( "forecolor" );
- if( nCtrlFlags & 0x00000008 ) EXC_CTRLDUMP_DEC4( "last-id" );
-
- EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x00000040, 0x00000002 );
- EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" );
- EXC_CTRLDUMP_ENDFLAG( 0xFFFFFFFD );
-
- if( nCtrlFlags & 0x00000080 ) EXC_CTRLDUMP_HEX1( "borderstyle" );
- if( nCtrlFlags & 0x00000100 ) EXC_CTRLDUMP_DEC1( "mouseptr" );
- if( nCtrlFlags & 0x00000200 ) EXC_CTRLDUMP_HEX1( "scrollbars" );
- if( nCtrlFlags & 0x00008000 ) EXC_CTRLDUMP_HEXVAR( nIcon, "icon" );
- if( nCtrlFlags & 0x00010000 ) EXC_CTRLDUMP_DEC1( "cycle" );
- if( nCtrlFlags & 0x00020000 ) EXC_CTRLDUMP_HEX1( "speceffect" );
- if( nCtrlFlags & 0x00040000 ) EXC_CTRLDUMP_HEX4( "bordercolor" );
- if( nCtrlFlags & 0x00080000 ) EXC_CTRLDUMP_DECVARMASK( nCaptionLen, 0x7FFFFFFF, "caption-len" );
- if( nCtrlFlags & 0x00100000 ) EXC_CTRLDUMP_HEXVAR( nFont, "font" );
- if( nCtrlFlags & 0x00200000 ) EXC_CTRLDUMP_HEXVAR( nPic, "pic" );
- if( nCtrlFlags & 0x00400000 ) EXC_CTRLDUMP_DEC4( "zoom" );
- if( nCtrlFlags & 0x00800000 ) EXC_CTRLDUMP_HEX1( "picalign" );
- if( nCtrlFlags & 0x02000000 ) EXC_CTRLDUMP_DEC1( "picsizemode" );
- if( nCtrlFlags & 0x04000000 ) EXC_CTRLDUMP_DEC4( "typeinfover" );
- if( nCtrlFlags & 0x08000000 ) EXC_CTRLDUMP_DEC4( "drawbuffer" );
-
- if( nCtrlFlags & 0x00000400 ) EXC_CTRLDUMP_SIZE4( "size" );
- if( nCtrlFlags & 0x00000800 ) EXC_CTRLDUMP_SIZE4( "scrollsize" );
- if( nCtrlFlags & 0x00001000 ) EXC_CTRLDUMP_COORD4( "scrollpos" );
- if( nCtrlFlags & 0x00080000 ) EXC_CTRLDUMP_STRING( nCaptionLen, "caption" );
- EXC_CTRLDUMP_REMAINING( nStartPos + nSize );
-
- EXC_CTRLDUMP_FONT( nFont, "font" );
- EXC_CTRLDUMP_IMAGE( nIcon, "icon" );
- EXC_CTRLDUMP_IMAGE( nPic, "pic" );
- }
- break;
-
- case EXC_CTRL_FONTDATA:
- {
- EXC_CTRLDUMP_STARTFLAG( "content-flags" );
- EXC_CTRLDUMP_ADDFLAG( 0x01, "font-name" );
- EXC_CTRLDUMP_ADDFLAG( 0x02, "font-style" );
- EXC_CTRLDUMP_ADDFLAG( 0x04, "font-size" );
- EXC_CTRLDUMP_ADDFLAG( 0x10, "language-id" );
- EXC_CTRLDUMP_ADDFLAG( 0x40, "align" );
- EXC_CTRLDUMP_ADDFLAG( 0x80, "font-weight" );
- EXC_CTRLDUMP_ENDFLAG( 0xFFFFFF08 ); // 0x20 always set?
- sal_uInt32 nCtrlFlags = nFlags;
-
- if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_DECVARMASK( nNameLen, 0x7FFFFFFF, "font-name-len" );
-
- EXC_CTRLDUMP_STARTOPTFLAG( "font-style-flags", nCtrlFlags & 0x0002, 0x40000000 );
- EXC_CTRLDUMP_ADDFLAG( 0x0001, "bold" );
- EXC_CTRLDUMP_ADDFLAG( 0x0002, "italic" );
- EXC_CTRLDUMP_ADDFLAG( 0x0004, "underline" );
- EXC_CTRLDUMP_ADDFLAG( 0x0008, "strikeout" );
- EXC_CTRLDUMP_ADDFLAG( 0x2000, "sunken" );
- EXC_CTRLDUMP_ENDFLAG( 0xBFFFDFF0 ); // 0x40000000 always set?
-
- if( nCtrlFlags & 0x0004 ) EXC_CTRLDUMP_DEC4( "font-size" );
- if( nCtrlFlags & 0x0010 ) EXC_CTRLDUMP_HEX2( "language-id" );
- if( nCtrlFlags & 0x0040 )
- {
- EXC_CTRLDUMP_ALIGN_INSTRM( 2 );
- sal_uInt16 nAlign; rInStrm >> nAlign;
- t += " align="; lclAppendDec( t, nAlign );
- switch( nAlign )
- {
- case 1: t += "=left"; break;
- case 2: t += "=right"; break;
- case 3: t += "=center"; break;
- default: t += "=!unknown!";
- }
- EXC_CTRLDUMP_PRINT();
- }
- if( nCtrlFlags & 0x0080 ) EXC_CTRLDUMP_DEC2( "font-weight" );
-
- if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_STRING( nNameLen, "font-name" );
- EXC_CTRLDUMP_REMAINING( nStartPos + nSize );
- }
- break;
-
- case EXC_CTRL_ADDDATA:
- {
- EXC_CTRLDUMP_STARTFLAG( "content-flags" );
- EXC_CTRLDUMP_ADDFLAG( 0x0001, "guid1" );
- EXC_CTRLDUMP_ADDFLAG( 0x0002, "guid2" );
- EXC_CTRLDUMP_ADDFLAG( 0x0008, "guid4" );
- EXC_CTRLDUMP_ADDFLAG( 0x0040, "unknown1" );
- EXC_CTRLDUMP_ENDFLAG( 0xFFFFFFB4 );
- sal_uInt32 nCtrlFlags = nFlags;
-
- if( nCtrlFlags & 0x0040 ) EXC_CTRLDUMP_HEX4( "unknown1" );
-
- if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_GUID( "guid1" );
- if( nCtrlFlags & 0x0002 ) EXC_CTRLDUMP_GUID( "guid2" );
- if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_GUID( "guid4" );
- EXC_CTRLDUMP_REMAINING( nStartPos + nSize );
- }
- break;
-
- case EXC_CTRL_FRAMECHILD:
- {
- EXC_CTRLDUMP_STARTFLAG( "content-flags" );
- EXC_CTRLDUMP_ADDFLAG( 0x0001, "name-len" );
- EXC_CTRLDUMP_ADDFLAG( 0x0002, "tag-len" );
- EXC_CTRLDUMP_ADDFLAG( 0x0004, "storage-id" );
- EXC_CTRLDUMP_ADDFLAG( 0x0008, "helpcontext-id" );
- EXC_CTRLDUMP_ADDFLAG( 0x0010, "option" );
- EXC_CTRLDUMP_ADDFLAG( 0x0020, "substream-len" );
- EXC_CTRLDUMP_ADDFLAG( 0x0040, "tabpos" );
- EXC_CTRLDUMP_ADDFLAG( 0x0080, "type" );
- EXC_CTRLDUMP_ADDFLAG( 0x0100, "pos" );
- EXC_CTRLDUMP_ADDFLAG( 0x0800, "tiptext" );
- EXC_CTRLDUMP_ADDFLAG( 0x1000, "ctrl-id" );
- EXC_CTRLDUMP_ADDFLAG( 0x2000, "ctrl-source" );
- EXC_CTRLDUMP_ADDFLAG( 0x4000, "row-source" );
- EXC_CTRLDUMP_ENDFLAG( 0xFFFF8600 );
- sal_uInt32 nCtrlFlags = nFlags;
-
- sal_uInt32 nStorageId = 0;
- sal_uInt32 nSubStrmLen = 0;
- sal_uInt16 nChildType = EXC_CTRL_UNKNOWN;
-
- if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_DECVARMASK( nNameLen, 0x7FFFFFFF, "name-len" );
- if( nCtrlFlags & 0x0002 ) EXC_CTRLDUMP_DECVARMASK( nTagLen, 0x7FFFFFFF, "tag-len" );
- if( nCtrlFlags & 0x0004 ) EXC_CTRLDUMP_PLAIN_DECVAR( nStorageId, "storage-id" );
- if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_PLAIN_DEC4( "helpcontext-id" );
-
- EXC_CTRLDUMP_STARTOPTFLAG( "option-flags", nCtrlFlags & 0x0010, 0x00000033 );
- EXC_CTRLDUMP_ADDFLAG( 0x00000001, "tabstop" );
- EXC_CTRLDUMP_ADDFLAG( 0x00000002, "visible" );
- EXC_CTRLDUMP_ADDFLAG( 0x00040000, "container" );
- EXC_CTRLDUMP_ENDFLAG( 0xFFFBFFFC );
-
- if( nCtrlFlags & 0x0020 ) EXC_CTRLDUMP_HEXVAR( nSubStrmLen, "substream-len" );
- if( nCtrlFlags & 0x0040 ) EXC_CTRLDUMP_DEC2( "tabpos" );
- if( nCtrlFlags & 0x0080 ) EXC_CTRLDUMP_CTRLTYPE( nChildType, "type" );
- if( nCtrlFlags & 0x0800 ) EXC_CTRLDUMP_DECVARMASK( nTipLen, 0x7FFFFFFF, "infotip-len" );
- if( nCtrlFlags & 0x1000 ) EXC_CTRLDUMP_DECVARMASK( nCtrlIdLen, 0x7FFFFFFF, "ctrl-id-len" );
- if( nCtrlFlags & 0x2000 ) EXC_CTRLDUMP_DECVARMASK( nCtrlSrcLen, 0x7FFFFFFF, "ctrl-source-len" );
- if( nCtrlFlags & 0x4000 ) EXC_CTRLDUMP_DECVARMASK( nRowSrcLen, 0x7FFFFFFF, "row-source-len" );
-
- if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_STRING( nNameLen, "name" );
- if( nCtrlFlags & 0x0002 ) EXC_CTRLDUMP_STRING( nTagLen, "tag" );
- if( nCtrlFlags & 0x0100 ) EXC_CTRLDUMP_COORD4( "pos" );
- if( nCtrlFlags & 0x0800 ) EXC_CTRLDUMP_STRING( nTipLen, "infotip" );
- if( nCtrlFlags & 0x1000 ) EXC_CTRLDUMP_STRING( nCtrlIdLen, "ctrl-id" );
- if( nCtrlFlags & 0x2000 ) EXC_CTRLDUMP_STRING( nCtrlSrcLen, "ctrl-source" );
- if( nCtrlFlags & 0x4000 ) EXC_CTRLDUMP_STRING( nRowSrcLen, "row-source" );
- EXC_CTRLDUMP_REMAINING( nStartPos + nSize );
-
- if( (nCtrlFlags & 0x0080) && (nChildType != EXC_CTRL_UNKNOWN) )
- {
- if( (nFlags & 0x00040000) && (nStorageId > 0) )
- maCtrlStorages.push_back( XclDumpCtrlPortion( nStorageId, nChildType ) );
- if( (nCtrlFlags & 0x0020) && (nSubStrmLen > 0) )
- maCtrlPortions.push_back( XclDumpCtrlPortion( nSubStrmLen, nChildType ) );
- }
- }
- break;
-
- default:
- EXC_CTRLDUMP_REMAINING( nStartPos + nSize );
- }
-
- // font data
- if( bHasFontData )
- DumpControlContents( rInStrm, EXC_CTRL_FONTDATA );
- }
-}
-
-// ============================================================================
-//
-// S T R E A M S
-//
-// ============================================================================
-
-void Biff8RecDumper::DumpBinaryStream( SotStorageRef xStrg, const String& rStrmName, const String& rStrgPath )
-{
- SotStorageStreamRef xInStrm = OpenStream( xStrg, rStrmName );
- if( !xInStrm || !pDumpStream ) return;
-
- XclDumpStreamHeader aStrmHeader( *xInStrm, *pDumpStream, rStrmName, rStrgPath );
- DumpBinary( *xInStrm );
- (*pDumpStream) << "\n";
-}
-
-void Biff8RecDumper::DumpTextStream( SotStorageRef xStrg, const String& rStrmName, const String& rStrgPath )
-{
- SotStorageStreamRef xInStrm = OpenStream( xStrg, rStrmName );
- if( !xInStrm || !pDumpStream ) return;
-
- XclDumpStreamHeader aStrmHeader( *xInStrm, *pDumpStream, rStrmName, rStrgPath );
- while( xInStrm->Tell() < aStrmHeader.GetStreamLen() )
- {
- ByteString aLine;
- xInStrm->ReadLine( aLine );
- lclDumpString( *pDumpStream, aLine );
- (*pDumpStream) << "\n";
- }
- (*pDumpStream) << "\n";
-}
-
-void Biff8RecDumper::DumpRecordStream( SotStorageRef xStrg, const String& rStrmName, const String& rStrgPath )
-{
- SotStorageStreamRef xInStrm = OpenStream( xStrg, rStrmName );
- if( !xInStrm || !pDumpStream ) return;
-
- XclDumpStreamHeader aStrmHeader( *xInStrm, *pDumpStream, rStrmName, rStrgPath );
-
- XclImpStream* pOldStream = pIn;
- pIn = new XclImpStream( *xInStrm, GetRoot() );
- XclImpStream& rIn = *pIn;
- if( pOldStream )
- rIn.CopyDecrypterFrom( *pOldStream );
-
- // -- dump from here --
- UINT16 nId;
- BOOL bLoop = TRUE;
-
- while( bLoop && rIn.StartNextRecord() )
- {
- nId = rIn.GetRecId();
- if( HasModeDump( nId ) )
- RecDump( TRUE );
-
- bLoop = (nId != 0x000A);
- }
-
- delete pIn;
- pIn = pOldStream;
-}
-
-void Biff8RecDumper::DumpCtlsStream()
-{
- SotStorageStreamRef xInStrm = OpenStream( EXC_STREAM_CTLS );
- if( !xInStrm || !pDumpStream ) return;
-
- SvStream& rInStrm = *xInStrm;
- SvStream& rOutStrm = *pDumpStream;
- XclDumpStreamHeader aStrmHeader( rInStrm, rOutStrm, EXC_STREAM_CTLS, EMPTY_STRING );
-
- for( StrmPortionMap::const_iterator aIt = maCtlsPosMap.begin(), aEnd = maCtlsPosMap.end(); aIt != aEnd; ++aIt )
- {
- ULONG nCtrlPos = static_cast< ULONG >( aIt->first );
- ULONG nCtrlEnd = nCtrlPos + static_cast< ULONG >( aIt->second );
- if( nCtrlEnd <= aStrmHeader.GetStreamLen() )
- {
- // stream position
- ULONG nStartPos = nCtrlPos; // for stream alignment macro
- rInStrm.Seek( nStartPos );
-
- ByteString t( "\npos=" ); __AddHex( t, aIt->first );
- t.Append( " len=" ); __AddHex( t, aIt->second );
- rOutStrm << t.GetBuffer() << " ";
-
- // control type
- sal_uInt16 nCtrlType = lclDumpControlGuid( rInStrm, rOutStrm );
- rOutStrm << "\n";
-
- // control contents
- if( nCtrlType != EXC_CTRL_UNKNOWN )
- DumpControlContents( rInStrm, nCtrlType );
-
- // remaining unknown data
- EXC_CTRLDUMP_REMAINING( nCtrlEnd );
- rOutStrm << "\n";
- }
- }
-}
-
-void Biff8RecDumper::DumpControlFrameStream( SotStorageRef xInStrg, sal_uInt16 nCtrlType, const String& rStrgPath )
-{
- static const String saStrmName( sal_Unicode( 'f' ) );
-
- SotStorageStreamRef xInStrm = OpenStream( xInStrg, saStrmName );
- if( !xInStrm || !pDumpStream ) return;
-
- SvStream& rInStrm = *xInStrm;
- SvStream& rOutStrm = *pDumpStream;
- XclDumpStreamHeader aStrmHeader( rInStrm, rOutStrm, saStrmName, rStrgPath );
-
- if( aStrmHeader.GetStreamLen() > 0 )
- {
- ByteString t; // "t" needed for macros
-
- rOutStrm << "header-record\n";
- DumpControlContents( rInStrm, nCtrlType );
- rOutStrm << "\n";
-
- if( nCtrlType == EXC_CTRL_USERFORM )
- {
- rOutStrm << "add-records\n";
- sal_uInt16 nAddCount;
- EXC_CTRLDUMP_PLAIN_DECVAR( nAddCount, "count" );
- EXC_CTRLDUMP_PRINT();
- rOutStrm << "\n";
-
- for( sal_uInt16 nAdd = 0; (nAdd < nAddCount) && (rInStrm.Tell() < aStrmHeader.GetStreamLen()); ++nAdd )
- {
- DumpControlContents( rInStrm, EXC_CTRL_ADDDATA );
- rOutStrm << "\n";
- }
- }
-
- rOutStrm << "children-records\n";
- sal_uInt32 nRecCount, nTotalSize;
- EXC_CTRLDUMP_PLAIN_DECVAR( nRecCount, "count" );
- EXC_CTRLDUMP_PLAIN_HEXVAR( nTotalSize, "total-size" );
- if( nTotalSize > 0 )
- {
- EXC_CTRLDUMP_PLAIN_HEX4( "header-unknown" );
- rOutStrm << "\n";
-
- for( sal_uInt32 nRec = 0; (nRec < nRecCount) && (rInStrm.Tell() < aStrmHeader.GetStreamLen()); ++nRec )
- {
- DumpControlContents( rInStrm, EXC_CTRL_FRAMECHILD );
- rOutStrm << "\n";
- }
- }
- else
- rOutStrm << "\n";
-
- if( rInStrm.Tell() < aStrmHeader.GetStreamLen() )
- {
- rOutStrm << "remaining=\n";
- DumpBinary( rInStrm );
- rOutStrm << "\n";
- }
- }
-}
-
-void Biff8RecDumper::DumpControlObjectsStream( SotStorageRef xInStrg, const String& rStrgPath )
-{
- static const String saStrmName( sal_Unicode( 'o' ) );
-
- SotStorageStreamRef xInStrm = OpenStream( xInStrg, saStrmName );
- if( !xInStrm || !pDumpStream ) return;
-
- SvStream& rInStrm = *xInStrm;
- SvStream& rOutStrm = *pDumpStream;
- XclDumpStreamHeader aStrmHeader( rInStrm, rOutStrm, saStrmName, rStrgPath );
-
- if( aStrmHeader.GetStreamLen() > 0 )
- {
- ULONG nStrmPos = 0;
- for( XclDumpCtrlPortionVec::const_iterator aIt = maCtrlPortions.begin(), aEnd = maCtrlPortions.end(); aIt != aEnd; ++aIt )
- {
- rInStrm.Seek( nStrmPos );
- DumpControlContents( rInStrm, aIt->second );
- rOutStrm << "\n";
- nStrmPos += aIt->first;
- }
-
- if( rInStrm.Tell() < aStrmHeader.GetStreamLen() )
- {
- rOutStrm << "remaining=\n";
- DumpBinary( rInStrm );
- rOutStrm << "\n";
- }
- }
-}
-
-// ============================================================================
-//
-// S T O R A G E S
-//
-// ============================================================================
-
-void Biff8RecDumper::DumpAnyStorage( SotStorageRef xParentStrg, const String& rStrgName, const String& rStrgPath )
-{
- SotStorageRef xInStrg = OpenStorage( xParentStrg, rStrgName );
- if( !xInStrg || !pDumpStream ) return;
-
- XclDumpStorageHeader aStrgHeader( *xInStrg, *pDumpStream, rStrgPath );
-}
-
-void Biff8RecDumper::DumpUserFormStorage( SotStorageRef xParentStrg, const String& rStrgName, sal_uInt16 nCtrlType, const String& rStrgPath )
-{
- SotStorageRef xInStrg = OpenStorage( xParentStrg, rStrgName );
- if( !xInStrg || !pDumpStream ) return;
-
- XclDumpStorageHeader aStrgHeader( *xInStrg, *pDumpStream, rStrgPath );
-
- // streams
- maCtrlStorages.clear();
- maCtrlPortions.clear();
- DumpControlFrameStream( xInStrg, nCtrlType, rStrgPath );
- DumpControlObjectsStream( xInStrg, rStrgPath );
- DumpTextStream( xInStrg, CREATE_STRING( "\003VBFrame" ), rStrgPath );
-
- // frame substorages
- XclDumpCtrlPortionVec aCtrlStorages( maCtrlStorages ); // make local copy, maCtrlStorages is reused in loop
- for( XclDumpCtrlPortionVec::const_iterator aIt = aCtrlStorages.begin(), aEnd = aCtrlStorages.end(); aIt != aEnd; ++aIt )
- {
- sal_uInt32 nStorageId = aIt->first;
- String aSubName( sal_Unicode( 'i' ) );
- if( nStorageId < 10 )
- aSubName.Append( sal_Unicode( '0' ) );
- aSubName.Append( String::CreateFromInt32( static_cast< sal_Int32 >( nStorageId ) ) );
-
- String aPath( rStrgPath );
- aPath.Append( sal_Unicode( '/' ) ).Append( rStrgName );
-
- DumpUserFormStorage( xInStrg, aSubName, aIt->second, aPath );
- }
-}
-
-void Biff8RecDumper::DumpVbaProjectStorage()
-{
- SotStorageRef xInStrg = OpenStorage( EXC_STORAGE_VBA_PROJECT );
- if( !xInStrg || !pDumpStream ) return;
-
- XclDumpStorageHeader aStrgHeader( *xInStrg, *pDumpStream, EMPTY_STRING );
- // PROJECT substream
- DumpTextStream( xInStrg, CREATE_STRING( "PROJECT" ), EXC_STORAGE_VBA_PROJECT );
- // VBA storage
- DumpAnyStorage( xInStrg, EXC_STORAGE_VBA, EXC_STORAGE_VBA_PROJECT );
- // user forms
- SvStorageInfoList aInfoList;
- xInStrg->FillInfoList( &aInfoList );
- for( ULONG nInfo = 0; nInfo < aInfoList.Count(); ++nInfo )
- {
- SvStorageInfo& rInfo = aInfoList.GetObject( nInfo );
- if( rInfo.IsStorage() && (rInfo.GetName() != EXC_STORAGE_VBA) )
- DumpUserFormStorage( xInStrg, rInfo.GetName(), EXC_CTRL_USERFORM, EXC_STORAGE_VBA_PROJECT );
- }
-}
-
-// ============================================================================
-//
-// ============================================================================
-
-const sal_Char* Biff8RecDumper::GetBlanks( const UINT16 nNumOfBlanks )
-{
- DBG_ASSERT( pBlankLine, "-Biff8RecDumper::GetBlanks(): nicht so schnell mein Freund!" );
- DBG_ASSERT( nNumOfBlanks <= nLenBlankLine,
- "+Biff8RecDumper::GetBlanks(): So viel kannst Du nicht von mir verlangen!" );
-
- return pBlankLine + ( ( nNumOfBlanks <= nLenBlankLine )? ( nLenBlankLine - nNumOfBlanks ) : 0 );
-}
-
-
-BOOL Biff8RecDumper::IsLineEnd( const sal_Char c, sal_Char& rNext, SvStream& rIn, INT32& rLeft )
-{
- static const sal_Char cNL = '\n';
- static const sal_Char cRET = '\r';
-
- if( IsEndOfLine( c ) )
- {
- sal_Char cDouble = ( c == cNL )? cRET : cNL;
-
- if( rNext == cDouble )
- {
- rIn >> rNext;
- rLeft--;
- }
-
- return TRUE;
- }
- else
- return FALSE;
-}
-
-
-_KEYWORD Biff8RecDumper::GetKeyType( const ByteString& r )
-{
- ByteString t( r );
- _KEYWORD e;
-
- t.ToUpperAscii();
-
- if( t == "SKIPDUMP" )
- e = Skipdump;
- else if( t == "SKIPOFFSET" )
- e = SkipOffset;
- else if( t == "READCONTRECS" )
- e = ReadContRecs;
- else if( t == "NOWARNINGS" )
- e = NoWarnings;
- else if( t == "CONTLOAD" )
- e = Contload;
- else if( t == "BLANKLINE" )
- e = BlankLine;
- else if( t == "EXPORTBOOKSTREAM" )
- e = ExportBookStream;
- else if( t == "PARSEP" )
- e = Parsep;
- else if( t == "MAXBODYLINES" )
- e = Maxbodylines;
- else if( t == "INCLUDE" || t == "+" )
- e = Include;
- else if( t == "EXCLUDE" || t == "-" )
- e = Exclude;
- else if( t == "HEX" || t == "H" )
- e = Hex;
- else if( t == "BODY" || t == "B" )
- e = Body;
- else if( t == "NAMEONLY" || t =="N" )
- e = NameOnly;
- else if( t == "COMMENT" )
- e = Comment;
- else if( t == "OUTPUT" )
- e = Output;
- else if( t == "TITLE" )
- e = Title;
- else if( t == "CLEARFILE" )
- e = ClearFile;
- else
- e = KW_Unknown;
-
- return e;
-}
-
-
-void Biff8RecDumper::Init( void )
-{
- bClearFile = FALSE;
-
- if( pDumpModes || ppRecNames )
- return;
-
- const sal_Char* pDefName = "biffrecdumper.ini";
- const sal_Char* pIniKey = "BIFFRECDUMPERINI";
- const sal_Char pPathSep[] = { SAL_PATHDELIMITER, '\0' };
- ByteString aIniName;
-
- SvFileStream* pIn = NULL;
-
- // first try: search for biffrecdumper.ini in dir, specified in %HOME%
- const sal_Char* pHome = getenv( "HOME" );
- if( pHome )
- {
- aIniName = pHome;
- aIniName.EraseTrailingChars( *pPathSep );
- aIniName += pPathSep;
- aIniName += pDefName;
-
- pIn = CreateInStream( aIniName.GetBuffer() );
- }
-
- if( !pIn )
- { // %HOME% not set or %HOME%\biffrecdumper.ini could not be opened
- const sal_Char* pIni = getenv( pIniKey );
- if( pIni )
- {
- pIn = CreateInStream( pIni );
- if( !pIn )
- {
- AddError( 0, "Could not open ini file", ByteString( pIni ) );
- bEndLoading = TRUE; // zur Sicherheit....
- }
- }
- }
-
- if( pIn )
- {
- pIn->Seek( STREAM_SEEK_TO_END );
-
- const UINT32 nStreamLen = pIn->Tell();
-
- if( nStreamLen <= 1 )
- {
- pIn->Close();
- delete pIn;
- return;
- }
-
- pIn->Seek( STREAM_SEEK_TO_BEGIN );
-
- pDumpModes = new UINT16[ nRecCnt ];
- ppRecNames = new ByteString*[ nRecCnt ];
-
- memset( pDumpModes, 0x00, sizeof( UINT16 ) * nRecCnt );
- memset( ppRecNames, 0x00, sizeof( ByteString* )* nRecCnt );
-
- enum STATE { PreLine, InCommand, PostCommand, InId, PostEqu,
- InVal, InName, InInExClude, InBodyMode, PostSepIEC,
- PostSepBM, InComment };
-
- STATE eAct = PreLine;
- sal_Char c;
- sal_Char cNext;
- INT32 n = ( INT32 ) nStreamLen;
- ByteString aCommand;
- ByteString aVal;
- ByteString aInExClude;
- ByteString aHexBody;
- UINT32 nLine = 1;
- BOOL bCommand = FALSE;
-
- *pIn >> c >> cNext;
-
- while( n > 0 )
- {
- n--;
-
- switch( eAct )
- {
- case PreLine:
- if( IsAlphaNum( c ) )
- {
- if( IsNum( c ) )
- {
- eAct = InId;
- bCommand = FALSE;
- }
- else
- {
- eAct = InCommand;
- bCommand = TRUE;
- }
- aCommand.Erase();
- aCommand += c;
- }
- else if( c == cComm1 && cNext == cComm2 )
- eAct = InComment;
- else if( IsLineEnd( c, cNext, *pIn, n ) )
- nLine++;
- else if( !IsBlank( c ) )
- {
- AddError( nLine, "Unexpected command or id" );
- n = 0;
- }
- break;
- case InCommand:
- if( c == '=' )
- {
- eAct = PostEqu;
- aVal.Erase();
- }
- else if( IsAlpha( c ) )
- aCommand += c;
- else if( IsBlank( c ) )
- eAct = PostCommand;
- else if( IsLineEnd( c, cNext, *pIn, n ) )
- {
- if( ExecCommand( nLine, aCommand ) )
- {
- eAct = PreLine;
- nLine++;
- }
- else
- n = 0;
- }
- else if( c == cComm1 && cNext == cComm2 )
- {
- if( ExecCommand( nLine, aCommand ) )
- eAct = InComment;
- else
- {
- AddError( nLine, "Invalid command before comment", aCommand );
- n = 0;
- }
- }
- else
- {
- aCommand += '>';
- aCommand += c;
- aCommand += '<';
- AddError( nLine, "Invalid character in command or id", aCommand );
- n = 0;
- }
- break;
- case PostCommand:
- if( c == '=' )
- {
- eAct = PostEqu;
- aVal.Erase();
- }
- else if( IsLineEnd( c, cNext, *pIn, n ) )
- {
- if( ExecCommand( nLine, aCommand ) )
- {
- eAct = PreLine;
- nLine++;
- }
- else
- n = 0;
- }
- else if( c == cComm1 && cNext == cComm2 )
- {
- if( ExecCommand( nLine, aCommand ) )
- eAct = InComment;
- else
- {
- AddError( nLine, "Invalid command before comment", aCommand );
- n = 0;
- }
- }
- else if( !IsBlank( c ) )
- {
- AddError( nLine, "Expecting blank or \'=\' following the command", aCommand );
- n = 0;
- }
- break;
- case InId:
- if( c == '=' )
- {
- eAct = PostEqu;
- aVal.Erase();
- }
- else if( IsAlphaNum( c ) )
- aCommand += c;
- else if( IsBlank( c ) )
- eAct = PostCommand;
- else if( ( c == cComm1 && cNext == cComm2 ) || IsLineEnd( c, cNext, *pIn, n ) )
- {
- AddError( nLine, "Unexpected end of record id", aCommand );
- eAct = InComment;
- }
- else
- {
- AddError( nLine, "Unexpected sal_Char in record id", aCommand );
- n = 0;
- }
- break;
- case PostEqu:
- if( bCommand )
- { // Command
- if( c == cComm1 && cNext == cComm2 )
- {
- if( ExecCommand( nLine, aCommand ) )
- eAct = InComment;
- else
- {
- AddError( nLine, "Unknown command", aCommand );
- n = 0;
- }
- }
- else if( IsLineEnd( c, cNext, *pIn, n ) )
- {
- if( ExecCommand( nLine, aCommand ) )
- {
- eAct = PreLine;
- nLine++;
- }
- else
- {
- AddError( nLine, "Unknown command", aCommand );
- n = 0;
- }
- }
- else if( !bCommand && c == cParSep )
- eAct = PostSepIEC;
- else if( !IsBlank( c ) )
- {
- aVal.Erase();
- aVal += c;
- eAct = InVal;
- }
- }
- else
- { // Set
- if( ( c == cComm1 && cNext == cComm2 ) || IsLineEnd( c, cNext, *pIn, n ) )
- {
- AddError( nLine, "No mode set for record", aCommand );
- n = 0;
- }
- else if( !bCommand && c == cParSep )
- eAct = PostSepIEC;
- else
- {
- aVal.Erase();
- aVal += c;
- eAct = InName;
- aInExClude.Erase();
- aHexBody.Erase();
- }
- }
- break;
- case InVal:
- if( c == cComm1 && cNext == cComm2 )
- {
- if( ExecCommand( nLine, aCommand, &aVal ) )
- eAct = InComment;
- else
- {
- AddError( nLine, "Unknown command", aCommand );
- n = 0;
- }
- }
- else if( IsLineEnd( c, cNext, *pIn, n ) )
- {
- if( ExecCommand( nLine, aCommand, &aVal ) )
- {
- eAct = PreLine;
- nLine++;
- }
- else
- {
- AddError( nLine, "Unknown command", aCommand );
- n = 0;
- }
- }
- else
- aVal += c;
- break;
- case InName:
- if( c == cParSep )
- eAct = PostSepIEC;
- else if( c == cComm1 && cNext == cComm2 )
- {
- if( ExecSetVal( nLine, aCommand, &aVal, NULL, NULL ) )
- eAct = InComment;
- else
- n = 0;
- }
- else if( IsLineEnd( c, cNext, *pIn, n ) )
- {
- if( ExecSetVal( nLine, aCommand, &aVal, NULL, NULL ) )
- {
- eAct = PreLine;
- nLine++;
- }
- else
- n = 0;
- }
- else
- aVal += c;
- break;
- case InInExClude:
- if( c == cParSep )
- eAct = PostSepBM;
- else if( c == cComm1 && cNext == cComm2 )
- {
- if( ExecSetVal( nLine, aCommand, &aVal, &aInExClude, NULL ) )
- eAct = InComment;
- else
- n = 0;
- }
- else if( IsLineEnd( c, cNext, *pIn, n ) )
- {
- if( ExecSetVal( nLine, aCommand, &aVal, &aInExClude, NULL ) )
- {
- eAct = PreLine;
- nLine++;
- }
- else
- n = 0;
- }
- else
- aInExClude += c;
- break;
- case InBodyMode:
- if( c == cParSep )
- {
- AddError( nLine, "Only 3 parameter possible" );
- n = 0;
- }
- else if( c == cComm1 && cNext == cComm2 )
- {
- if( ExecSetVal( nLine, aCommand, &aVal, &aInExClude, &aHexBody ) )
- eAct = InComment;
- else
- n = 0;
- }
- else if( IsLineEnd( c, cNext, *pIn, n ) )
- {
- if( ExecSetVal( nLine, aCommand, &aVal, &aInExClude, &aHexBody ) )
- {
- eAct = PreLine;
- nLine++;
- }
- else
- n = 0;
- }
- else
- aInExClude += c;
- break;
- case PostSepIEC:
- if( c == cParSep )
- eAct = PostSepBM;
- else if( c == cComm1 && cNext == cComm2 )
- {
- if( ExecSetVal( nLine, aCommand, &aVal, NULL, NULL ) )
- eAct = InComment;
- else
- n = 0;
- }
- else if( IsLineEnd( c, cNext, *pIn, n ) )
- {
- if( ExecSetVal( nLine, aCommand, &aVal, NULL, NULL ) )
- {
- eAct = PreLine;
- nLine++;
- }
- else
- n = 0;
- }
- else if( !IsBlank( c ) )
- {
- aInExClude += c;
- eAct = InInExClude;
- }
- break;
- case PostSepBM:
- if( c == cParSep )
- eAct = PostSepBM;
- else if( c == cComm1 && cNext == cComm2 )
- {
- if( ExecSetVal( nLine, aCommand, &aVal, &aInExClude, NULL ) )
- eAct = InComment;
- else
- n = 0;
- }
- else if( IsLineEnd( c, cNext, *pIn, n ) )
- {
- if( ExecSetVal( nLine, aCommand, &aVal, &aInExClude, NULL ) )
- {
- eAct = PreLine;
- nLine++;
- }
- else
- n = 0;
- }
- else if( !IsBlank( c ) )
- {
- aHexBody += c;
- eAct = InBodyMode;
- }
- break;
- case InComment:
- if( IsLineEnd( c, cNext, *pIn, n ) )
- {
- eAct = PreLine;
- nLine++;
- }
- break;
- default:
- n = 0;
- }
-
- c = cNext;
- *pIn >> cNext;
- }
-
- pIn->Close();
- delete pIn;
- }
-}
-
-
-BOOL Biff8RecDumper::ExecCommand( const UINT32 nL, const ByteString& r, const ByteString* pVal )
-{
- _KEYWORD e = GetKeyType( r );
- BOOL b = TRUE;
- const UINT32 nValLen = ( pVal )? pVal->Len() : 0;
- BOOL bSet;
- UINT16 nMode;
-
- switch( e )
- {
- case Skipdump: bSkip = TRUE; break;
- case SkipOffset: bSkipOffset = TRUE; break;
- case ReadContRecs: bReadContRecs = TRUE; break;
- case NoWarnings: bWarnings = FALSE; break;
- case Contload: bEndLoading = TRUE; break;
- case BlankLine: bBlankLine = TRUE; break;
- case ExportBookStream: bExportBookStream = TRUE; break;
- case Parsep:
- if( nValLen == 0 )
- {
- AddError( nL, "No separator found" );
- b = FALSE;
- }
- else if( nValLen == 1 )
- cParSep = *( pVal->GetBuffer() );
- else
- {
- AddError( nL, "More than 1 sal_Char is not valid for separator", *pVal );
- b = FALSE;
- }
- break;
- case Maxbodylines:
- if( nValLen )
- {
- UINT32 n = GetVal( *pVal );
-
- if( n == 0xFFFFFFFF )
- {
- AddError( nL, "Syntax error in value of body lines" );
- b = FALSE;
- }
- else
- nMaxBodyLines = n;
- }
- else
- {
- AddError( nL, "No value specified for number of body lines" );
- b = FALSE;
- }
- break;
- case Include:
- bSet = FALSE;
- nMode = MODE_SKIP;
- goto _common;
- case Exclude:
- bSet = TRUE;
- nMode = MODE_SKIP;
- goto _common;
- case Hex:
- bSet = TRUE;
- nMode = MODE_HEX;
- goto _common;
- case Body:
- bSet = FALSE;
- nMode = MODE_HEX;
- goto _common;
- case NameOnly:
- bSet = TRUE;
- nMode = MODE_NAMEONLY;
- goto _common;
-_common:
- if( pVal )
- {
- IdRangeList aRL;
- if( FillIdRangeList( nL, aRL, *pVal ) )
- {
- const IdRange* p = aRL.First();
- if( bSet )
- {
- while( p )
- { SetFlag( p->nFirst, p->nLast, nMode ); p = aRL.Next(); }
- }
- else
- {
- while( p )
- { ClrFlag( p->nFirst, p->nLast, nMode ); p = aRL.Next(); }
- }
- }
- else
- b = FALSE;
- }
- break;
- case Comment:
- if( pVal && pVal->Len() >= 2 )
- {
- cComm1 = pVal->GetChar( 0 );
- cComm2 = pVal->GetChar( 1 );
- }
- break;
- case Output:
- CopyStrpOnStrp( pOutName, pVal );
- if( pOutName )
- {
- if( *pOutName == "*" )
- {
- ByteString aDefault( "DefaultDumpName.txt" );
- SfxObjectShell* pShell = GetDocShell();
- if( pShell )
- {
- SfxMedium* pMedium = pShell->GetMedium();
- if( pMedium )
- {
- const ByteString aTextExtension( ".txt" );
- aDefault = GETSTR( pMedium->GetPhysicalName() );
- xub_StrLen nStrLen = aDefault.Len();
- if( nStrLen >= 4 )
- {
- ByteString aTmp( aDefault );
- aTmp.ToLowerAscii();
- if( aTmp.Copy( nStrLen -4 ) == ".xls" )
- aDefault.Replace( nStrLen - 4, aTextExtension.Len(), aTextExtension );
- else
- aDefault += aTextExtension;
- }
- else
- aDefault += aTextExtension;
- }
- }
-
- *pOutName = aDefault;
- }
- CreateOutStream();
- }
- else if( pDumpStream )
- {
- pDumpStream->Close();
- DELANDNULL( pDumpStream );
- }
- break;
- case Title:
- CopyStrpOnStrp( pTitle, pVal );
- break;
- case ClearFile:
- bClearFile = TRUE;
- break;
- default:
- AddError( nL, "Unknown command", r );
- b = FALSE;
- }
-
- return b;
-}
-
-
-BOOL Biff8RecDumper::ExecSetVal( const UINT32 nL, const ByteString& rId, const ByteString* pName,
- const ByteString* pIEC, const ByteString* pHB )
-{
- UINT32 _nId = GetVal( rId );
-
- if( _nId == 0xFFFFFFFF )
- {
- AddError( nL, "Syntax error in record id", rId );
- return FALSE;
- }
- else if( _nId >= ( UINT32 ) nRecCnt )
- {
- AddError( nL, "Record id to high", rId );
- return FALSE;
- }
-
- UINT16 nId = ( UINT16 ) _nId;
-
- if( pName && pName->Len() )
- SetName( nId, *pName );
-
- _KEYWORD e;
- UINT16 n = GetMode( nId );
-
- if( pIEC && pIEC->Len() )
- {
- e = GetKeyType( *pIEC );
-
- if( e == Include )
- n &= ~MODE_SKIP;
- else if( e == Exclude )
- n |= MODE_SKIP;
- else
- {
- AddError( nL, "Invalid key for in-/exclude", *pIEC );
- return FALSE;
- }
- }
-
- if( pHB && pHB->Len() )
- {
- e = GetKeyType( *pHB );
-
- if( e == NameOnly )
- n |= MODE_NAMEONLY;
- else
- {
- n &= ~MODE_NAMEONLY;
- if( e == Hex )
- n |= MODE_HEX;
- else if( e == Body )
- n &= ~MODE_HEX;
- else
- {
- AddError( nL, "Invalid key for hex/body/name only", *pIEC );
- return FALSE;
- }
- }
- }
-
- SetMode( nId, n );
- return TRUE;
-}
-
-
-void Biff8RecDumper::SetFlag( const UINT16 nF, const UINT16 nL, const UINT16 nFl )
-{
- UINT16 n = ( nF < nL )? nF : nL;
- UINT16 nLast = ( nF < nL )? nL : nF;
-
- if( nLast >= nRecCnt )
- nLast = nRecCnt - 1;
-
- while( n <= nLast )
- {
- pDumpModes[ n ] |= nFl;
- n++;
- }
-}
-
-
-void Biff8RecDumper::ClrFlag( const UINT16 nF, const UINT16 nL, const UINT16 nFlags )
-{
- UINT16 n = ( nF < nL )? nF : nL;
- UINT16 nLast = ( nF < nL )? nL : nF;
- UINT16 nFl = ~nFlags;
-
- if( nLast >= nRecCnt )
- nLast = nRecCnt - 1;
-
- while( n <= nLast )
- {
- pDumpModes[ n ] &= nFl;
- n++;
- }
-}
-
-
-void Biff8RecDumper::SetName( const UINT16 n, ByteString* p )
-{
- if( n < nRecCnt )
- CopyStrpOnStrp( ppRecNames[ n ], p );
-}
-
-
-UINT32 Biff8RecDumper::GetVal( const ByteString& r )
-{
- const sal_Char* p = r.GetBuffer();
- sal_Char c = *p;
- UINT32 n = 0;
- const UINT32 nLimitDec = 0xFFFFFFFF / 10;
- const UINT32 nLimitHex = 0xFFFFFFFF / 16;
- BOOL bError = FALSE;
-
- enum STATE { First, Dec, MaybeHex, Hex };
-
- STATE e = First;
-
- while( c )
- {
- switch( e )
- {
- case First:
- if( IsNum( c ) )
- {
- if( c == '0' )
- e = MaybeHex;
- else
- {
- e = Dec;
- n = GetVal( c );
- }
- }
- else
- bError = TRUE;
- break;
- case Dec:
- if( n < nLimitDec && IsNum( c ) )
- {
- n *= 10;
- n += GetVal( c );
- }
- else
- bError = TRUE;
- break;
- case MaybeHex:
- if( c == 'x' || c == 'X' )
- {
- e = Hex;
- n = 0;
- }
- else if( IsNum( c ) )
- {
- n = GetVal( c );
- e = Dec;
- }
- else
- bError = TRUE;
- break;
- case Hex:
- if( n < nLimitHex && IsHex( c ) )
- {
- n *= 16;
- n += GetVal( c );
- }
- else
- bError = TRUE;
- break;
- }
-
- if( bError )
- c = 0x00;
- else
- {
- p++;
- c = *p;
- }
- }
-
- if( bError )
- return 0xFFFFFFFF;
- else
- return n;
-}
-
-
-BOOL Biff8RecDumper::FillIdRangeList( const UINT32 nL, IdRangeList& rRL, const ByteString& rV )
-{
- rRL.Clear();
-
- const sal_Char* pSyntErr = "Syntax error in number (list)";
-
-#define SYNTERR(ch) AddError( ((UINT32)(b=FALSE))+nL, pSyntErr, ch? ((((t+=">")+=ByteString::CreateFromInt32(ch))+="<")) : t )
-#define NEWVAL(_n) _n=(n>=(UINT32)nRecCnt)?nRecCnt-1:(UINT16)n
-#define ORDERN() {if(n1>n2){UINT16 nT=n1;n1=n2;n2=nT;}}
-
- const sal_Char* p = rV.GetBuffer();
- sal_Char c = *p;
- const sal_Char cSep = cParSep;
- const sal_Char cCont = '.';
- const sal_Char cAll = '*';
- ByteString t;
- UINT16 n1 = 0, n2 = 0;
- UINT32 n;
- BOOL b = TRUE;
- BOOL bExp2 = FALSE;
-
- enum STATE { PreFirst, InFirst, PostFirst, InCont, PreLast, InLast, PostLast };
- STATE e = PreFirst;
-
- while( c )
- {
- switch( e )
- {
- case PreFirst:
- if( IsAlphaNum( c ) )
- {
- t += c;
- e = InFirst;
- }
- else if( c == cAll )
- {
- rRL.Append( 0, nRecCnt - 1 );
- e = PostLast;
- }
- else if( !IsBlank( c ) )
- SYNTERR( c );
- break;
- case InFirst:
- if( c == cSep || c == cCont || IsBlank( c ) )
- {
- n = GetVal( t );
- if( n == 0xFFFFFFFF )
- SYNTERR( 0 );
- else
- NEWVAL( n1 );
-
- t.Erase();
-
- if( c == cSep )
- {
- rRL.Append( n1, n1 );
- e = PreFirst;
- }
- else if( c == cCont )
- {
- bExp2 = TRUE;
- e = InCont;
- }
- else
- e = PostFirst;
- }
- else if( IsAlphaNum( c ) )
- t += c;
- else
- SYNTERR( c );
- break;
- case PostFirst:
- if( c == cCont )
- {
- e = InCont;
- bExp2 = TRUE;
- }
- else if( c == cSep )
- {
- n = GetVal( t );
- if( n == 0xFFFFFFFF )
- SYNTERR( 0 );
- else
- NEWVAL( n1 );
-
- e = PreFirst;
- }
- else if( !IsBlank( c ) )
- SYNTERR( c );
- break;
- case InCont:
- if( IsAlphaNum( c ) )
- {
- t += c;
- e = InLast;
- }
- else if( IsBlank( c ) )
- e = PreLast;
- else if( c == cSep || c == cAll )
- {
- rRL.Append( n1, nRecCnt - 1 );
- bExp2 = FALSE;
- e = PreFirst;
- }
- else if( c != cCont )
- SYNTERR( c );
- break;
- case PreLast:
- if( IsAlphaNum( c ) )
- {
- t += c;
- e = InLast;
- }
- else if( !IsBlank( c ) )
- SYNTERR( c );
- break;
- break;
- case InLast:
- if( c == cSep || IsBlank( c ) )
- {
- n = GetVal( t );
- if( n == 0xFFFFFFFF )
- SYNTERR( 0 );
- else
- NEWVAL( n2 );
-
- t.Erase();
- ORDERN();
- rRL.Append( n1, n2 );
- bExp2 = FALSE;
- e = ( c == cSep )? PreFirst : PostLast;
- }
- else if( IsAlphaNum( c ) )
- t += c;
- else
- SYNTERR( c );
- break;
- case PostLast:
- if( c == cSep )
- {
- e = PreFirst;
- bExp2 = FALSE;
- }
- else if( !IsBlank( c ) )
- SYNTERR( c );
- break;
- }
-
- if( b )
- {
- p++;
- c = *p;
- }
- else
- c = 0x00;
- }
-
- if( bExp2 )
- {
- if( t.Len() )
- {
- n = GetVal( t );
- if( n == 0xFFFFFFFF )
- SYNTERR( 0 );
- else
- NEWVAL( n2 );
- ORDERN();
- }
- else
- n2 = nRecCnt - 1;
-
- if( b )
- rRL.Append( n1, n2 );
- }
-
-#undef SYNTERR
-#undef NEWVAL
-#undef ORDERN
-
- return b;
-}
-
-
-BOOL Biff8RecDumper::CreateOutStream()
-{
- if( pDumpStream )
- {
- pDumpStream->Close();
- DELANDNULL( pDumpStream );
- }
-
- if( !bSkip && pOutName )
- {
- pOutName->EraseLeadingChars( ' ' );
- pOutName->EraseTrailingChars( ' ' );
- pOutName->EraseLeadingChars( '\t' );
- pOutName->EraseTrailingChars( '\t' );
-
- pDumpStream = new SvFileStream( String::CreateFromAscii( pOutName->GetBuffer() ), STREAM_WRITE|STREAM_SHARE_DENYWRITE|(bClearFile?STREAM_TRUNC:0) );
-
- if( pDumpStream->IsOpen() )
- {
- pDumpStream->Seek( bClearFile? STREAM_SEEK_TO_BEGIN : STREAM_SEEK_TO_END );
- return TRUE;
- }
- else
- {
- DELANDNULL( pDumpStream );
- }
- }
-
- return FALSE;
-}
-
-
-SvFileStream* Biff8RecDumper::CreateInStream( const sal_Char* pN )
-{
- SvFileStream* p = new SvFileStream( String::CreateFromAscii( pN ), STREAM_READ|STREAM_SHARE_DENYWRITE );
-
- if( p->IsOpen() )
- return p;
- else
- {
- delete p;
- return NULL;
- }
-}
-
-
-SvFileStream* Biff8RecDumper::CreateInStream( const sal_Char* pP, const sal_Char* pN )
-{
- ByteString t( pP );
- const sal_Char c = t.GetChar( t.Len() - 1 );
-
- if( c != '\\' )
- t += '\\';
- else if( c != '/' )
- t += '/';
-
- t += pN;
-
- return CreateInStream( t.GetBuffer() );
-}
-
-
-void Biff8RecDumper::AddError( const UINT32 n, const ByteString& rT, const ByteString& rH )
-{
- DUMP_ERR* p = new DUMP_ERR( n, rT, rH );
-
- if( pFirst )
- pLast->pNext = p;
- else
- pFirst = p;
-
- pLast = p;
-}
-
-
-Biff8RecDumper::Biff8RecDumper( const XclImpRoot& rRoot, BOOL _bBIFF8 ) :
- XclImpRoot( rRoot ),
- bBIFF8( _bBIFF8 ),
- bEncrypted( false ),
- mnEscherPos( 0 )
-{
- nXFCount = 0;
- nFontIndex = 0;
- nInstances++;
- mnSubstream = EXC_BOF_UNKNOWN;
-
- if( !pCharType )
- {
- pCharType = new UINT8[ 256 ];
- memset( pCharType, 0x00, 256 );
-
- pCharVal = new UINT8[ 256 ];
- memset( pCharVal, 0x00, 256 );
-
- sal_Char c;
- UINT8 n;
-
-#define __TYPE(n) pCharType[(UINT8)n]
-#define __VAL(n) pCharVal[(UINT8)n]
-
- __TYPE( '\n' ) = CT_EOL;
- __TYPE( '\r' ) = CT_EOL;
-
- __TYPE( ' ' ) = CT_BLANK;
- __TYPE( '\t' ) = CT_BLANK;
-
- for( c = '0', n = 0 ; c <= '9' ; c++, n++ )
- {
- __TYPE( c ) = CT_NUM|CT_HEX|CT_ALPHANUM;
- __VAL( c ) = n;
- }
- for( c = 'a', n = 10 ; c <= 'f' ; c++, n++ )
- {
- __TYPE( c ) = CT_HEX|CT_ALPHA|CT_ALPHANUM|CT_LOWERALPHA;
- __VAL( c ) = n;
- }
- for( c = 'g' ; c <= 'z' ; c++ )
- __TYPE( c ) = CT_ALPHA|CT_ALPHANUM|CT_LOWERALPHA;
- for( c = 'A', n = 10 ; c <= 'F' ; c++, n++ )
- {
- __TYPE( c ) = CT_HEX|CT_ALPHA|CT_ALPHANUM|CT_UPPERALPHA;
- __VAL( c ) = n;
- }
- for( c = 'G' ; c <= 'Z' ; c++ )
- __TYPE( c ) = CT_ALPHA|CT_ALPHANUM|CT_UPPERALPHA;
-
-#undef __TYPE
-#undef __VAL
- }
-
- pDumpStream = NULL;
-
- if( !pBlankLine )
- {
- pBlankLine = new sal_Char[ nLenBlankLine + 1 ];
- memset( pBlankLine, ' ', nLenBlankLine );
- pBlankLine[ nLenBlankLine ] = 0x00;
- }
-
- pTitle = NULL;
- pOutName = NULL;
- pLevelPre = pLevelPreStringNT;
-
- nMaxBodyLines = 1024;
- bEndLoading = bSkip = bSkipOffset = bReadContRecs = bBlankLine = bExportBookStream = FALSE;
- bWarnings = TRUE;
-
- pDumpModes = NULL;
- ppRecNames = NULL;
-
- pFirst = pLast = pAct = NULL;
-
- cParSep = ',';
- cComm1 = cComm2 = '/';
-
- nFieldCnt = nItemCnt = nTabIndexCnt = 0;
-
- Init();
-}
-
-
-Biff8RecDumper::~Biff8RecDumper()
-{
- if( pDumpStream )
- {
- pDumpStream->Close();
- delete pDumpStream;
- }
-
- if( nInstances )
- {
- nInstances--;
- if( !nInstances )
- {
- delete[] pBlankLine;
- pBlankLine = NULL;
-
- delete[] pCharType;
- pCharType = NULL;
-
- delete[] pCharVal;
- pCharVal = NULL;
- }
- }
-
- if( pDumpModes )
- delete[] pDumpModes;
-
- if( ppRecNames )
- {
- ByteString** pp = ppRecNames;
- UINT16 n = nRecCnt;
- while( n )
- {
- if( *pp )
- delete *pp;
- pp++;
- n--;
- }
- delete[] ppRecNames;
- }
-
- if( pTitle )
- delete pTitle;
-
- if( pOutName )
- delete pOutName;
-
- DUMP_ERR* p = pFirst;
- DUMP_ERR* pD;
- if( p )
- {
- pD = p;
- p = p->pNext;
- delete pD;
- }
-}
-
-
-BOOL Biff8RecDumper::Dump( XclImpStream& r )
-{
- const DUMP_ERR* pErr = FirstErr();
-
- if( pErr )
- {
- if( pDumpStream )
- {
- SvFileStream& rOut = *pDumpStream;
- while( pErr )
- {
- rOut << "\nError";
- if( pErr->nLine )
- {
- ByteString t;
- t += ByteString::CreateFromInt32( pErr->nLine );
- rOut << " at line " << t.GetBuffer();
- }
-
- rOut << ": " << pErr->aText.GetBuffer();
-
- if( pErr->pHint )
- rOut << " (" << pErr->pHint->GetBuffer() << ')';
- pErr = NextErr();
- }
- rOut << '\n';
- }
- }
- else if( pDumpStream && !bSkip )
- {
- SvStream& rOutStrm = *pDumpStream;
-
- if( bExportBookStream && pOutName )
- {
- ByteString aBookOutName( *pOutName, 0, pOutName->Len() - 4 );
- aBookOutName.Append( "_book.xls" );
- SvFileStream aBook( String::CreateFromAscii( aBookOutName.GetBuffer() ), STREAM_WRITE|STREAM_SHARE_DENYWRITE|STREAM_TRUNC );
- if( aBook.IsOpen() )
- {
- const sal_uInt32 nBufLen = 0xFFFF;
- sal_uInt8 pBuffer[ nBufLen ];
- r.StoreGlobalPosition();
- while( r.StartNextRecord() )
- {
- r.ResetRecord( false );
- sal_uInt16 nRecSize = (sal_uInt16) Min( r.GetRecSize(), nBufLen );
- aBook << r.GetRecId() << nRecSize;
- r.Read( pBuffer, nRecSize );
- aBook.Write( pBuffer, nRecSize );
- }
- r.SeekGlobalPosition();
- }
- }
-
- if( pTitle )
- rOutStrm << pTitle->GetBuffer();
-
- pIn = &r;
- r.StoreGlobalPosition();
-
- ::std::auto_ptr< XclDumpStorageHeader > xStrgHerader;
- SotStorageRef xRootStrg = GetRootStorage();
- if( xRootStrg.Is() )
- xStrgHerader.reset( new XclDumpStorageHeader( *xRootStrg, rOutStrm, EMPTY_STRING ) );
-
- ::std::auto_ptr< ScfProgressBar > xProgress( new ScfProgressBar(
- GetDocShell(), String( RTL_CONSTASCII_USTRINGPARAM( "Dumper" ) ) ) );
- sal_Int32 nStreamSeg = xProgress->AddSegment( r.GetSvStreamSize() );
- xProgress->ActivateSegment( nStreamSeg );
-
- while( r.StartNextRecord() )
- {
- xProgress->ProgressAbs( r.GetSvStreamPos() );
- if( HasModeDump( r.GetRecId() ) )
- RecDump();
- }
-
- rOutStrm << "\n\n";
-
- pIn = NULL;
- xProgress.reset();
-
- r.SeekGlobalPosition();
-
- // dump substreams
- if( xRootStrg.Is() )
- {
- pIn = NULL;
- bool bOldEncr = bEncrypted;
- bEncrypted = false;
- DumpRecordStream( xRootStrg, EXC_STREAM_USERNAMES, EMPTY_STRING );
-
- pIn = &r;
- bEncrypted = bOldEncr;
- DumpRecordStream( xRootStrg, EXC_STREAM_REVLOG, EMPTY_STRING );
-
- pIn = NULL;
-
- DumpCtlsStream();
- DumpVbaProjectStorage();
- }
- }
-
- return !bEndLoading;
-}
-
-#undef Read1
-#undef Read2
-#undef Read4
-#undef Read8
-
-#endif
-
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index d1b08b9cfc68..c72d165c7972 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -144,12 +144,12 @@ static void lcl_AddWorkbookProtection( XclExpRecordList<>& aRecList, ExcTable& s
}
#endif
-static void lcl_AddScenariosAndFilters( XclExpRecordList<>& aRecList, ExcTable& self, SCTAB mnScTab )
+static void lcl_AddScenariosAndFilters( XclExpRecordList<>& aRecList, const XclExpRoot& rRoot, SCTAB nScTab )
{
// Scenarios
- aRecList.AppendNewRecord( new ExcEScenarioManager( self.GetDoc(), mnScTab ) );
+ aRecList.AppendNewRecord( new ExcEScenarioManager( rRoot, nScTab ) );
// filter
- aRecList.AppendRecord( self.GetFilterManager().CreateRecord( mnScTab ) );
+ aRecList.AppendRecord( rRoot.GetFilterManager().CreateRecord( nScTab ) );
}
@@ -205,20 +205,47 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList )
rR.pObjRecs = NULL; // per sheet
+ sal_uInt16 nWriteProtHash = 0;
+ if( SfxObjectShell* pDocShell = GetDocShell() )
+ {
+ ScfPropertySet aPropSet( pDocShell->GetModel() );
+ sal_Int32 nApiHash = 0;
+ if( aPropSet.GetProperty( nApiHash, CREATE_OUSTRING( "WriteProtectionPassword" ) ) && (0 < nApiHash) && (nApiHash <= SAL_MAX_UINT16) )
+ {
+ nWriteProtHash = static_cast< sal_uInt16 >( nApiHash );
+ Add( new XclExpEmptyRecord( EXC_ID_WRITEPROT ) );
+ }
+ }
+
+ // TODO: correct codepage for BIFF5?
+ sal_uInt16 nCodePage = XclTools::GetXclCodePage( (GetBiff() <= EXC_BIFF5) ? RTL_TEXTENCODING_MS_1252 : RTL_TEXTENCODING_UNICODE );
+
if( GetBiff() <= EXC_BIFF5 )
+ {
+ Add( new XclExpEmptyRecord( EXC_ID_INTERFACEHDR ) );
+ Add( new XclExpUInt16Record( EXC_ID_MMS, 0 ) );
+ Add( new XclExpEmptyRecord( EXC_ID_TOOLBARHDR ) );
+ Add( new XclExpEmptyRecord( EXC_ID_TOOLBAREND ) );
+ Add( new XclExpEmptyRecord( EXC_ID_INTERFACEEND ) );
Add( new ExcDummy_00 );
+ }
else
{
- if ( IsDocumentEncrypted() )
- Add( new XclExpFilePass(GetRoot()) );
-
- Add( new XclExpInterfaceHdr );
- Add( new XclExpMMS );
- Add( new XclExpInterfaceEnd );
+ if( IsDocumentEncrypted() )
+ Add( new XclExpFilePass( GetRoot() ) );
+ Add( new XclExpInterfaceHdr( nCodePage ) );
+ Add( new XclExpUInt16Record( EXC_ID_MMS, 0 ) );
+ Add( new XclExpEmptyRecord( EXC_ID_INTERFACEEND ) );
Add( new XclExpWriteAccess );
- Add( new XclExpCodePage );
- Add( new XclExpDSF );
- Add( new XclExpExcel9File );
+ }
+
+ Add( new XclExpFileSharing( GetRoot(), nWriteProtHash ) );
+ Add( new XclExpUInt16Record( EXC_ID_CODEPAGE, nCodePage ) );
+
+ if( GetBiff() == EXC_BIFF8 )
+ {
+ Add( new XclExpBoolRecord( EXC_ID_DSF, false ) );
+ Add( new XclExpEmptyRecord( EXC_ID_XL9FILE ) );
rR.pTabId = new XclExpChTrTabId( Max( nExcTabCount, nCodenames ) );
Add( rR.pTabId );
if( HasVbaStorage() )
@@ -228,10 +255,10 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList )
if( rCodeName.Len() )
Add( new XclCodename( rCodeName ) );
}
-
- Add( new XclExpFnGroupCount );
}
+ Add( new XclExpUInt16Record( EXC_ID_FNGROUPCOUNT, 14 ) );
+
// erst Namen- und Tabellen-Eintraege aufbauen
String aName;
@@ -473,7 +500,7 @@ void ExcTable::FillAsTable( size_t nCodeNameIdx )
aRecList.AppendRecord( CreateRecord( EXC_ID_EXTERNSHEET ) );
if ( eBiff == EXC_BIFF8 )
- lcl_AddScenariosAndFilters( aRecList, *this, mnScTab );
+ lcl_AddScenariosAndFilters( aRecList, GetRoot(), mnScTab );
// cell table: DEFCOLWIDTH, COLINFO, DIMENSIONS, ROW, cell records
aRecList.AppendRecord( mxCellTable );
@@ -585,7 +612,7 @@ void ExcTable::FillAsXmlTable( size_t nCodeNameIdx )
// web queries
Add( new XclExpWebQueryBuffer( GetRoot() ) );
- lcl_AddScenariosAndFilters( aRecList, *this, mnScTab );
+ lcl_AddScenariosAndFilters( aRecList, GetRoot(), mnScTab );
// MERGEDCELLS record, generated by the cell table
aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID_MERGEDCELLS ) );
diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx
index 3965d0acaf4e..8365ef0db3f9 100644
--- a/sc/source/filter/excel/excel.cxx
+++ b/sc/source/filter/excel/excel.cxx
@@ -98,15 +98,21 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument
CREATE_OUSTRING( "com.sun.star.comp.oox.ExcelBiffFilter" ), aArgs ), uno::UNO_QUERY_THROW );
xImporter->setTargetDocument( xComponent );
- MediaDescriptor aDescriptor;
- if( const SfxItemSet* pItemSet = rMedium.GetItemSet() )
+ MediaDescriptor aMediaDesc;
+ SfxItemSet* pItemSet = rMedium.GetItemSet();
+ if( pItemSet )
+ {
if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_FILE_NAME ) ) )
- aDescriptor[ MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( pItem->GetValue() );
- aDescriptor[ MediaDescriptor::PROP_INPUTSTREAM() ] <<= rMedium.GetInputStream();
+ aMediaDesc[ MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( pItem->GetValue() );
+ if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_PASSWORD ) ) )
+ aMediaDesc[ MediaDescriptor::PROP_PASSWORD() ] <<= ::rtl::OUString( pItem->GetValue() );
+ }
+ aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] <<= rMedium.GetInputStream();
+ aMediaDesc[ MediaDescriptor::PROP_INTERACTIONHANDLER() ] <<= rMedium.GetInteractionHandler();
// call the filter
uno::Reference< document::XFilter > xFilter( xImporter, uno::UNO_QUERY_THROW );
- bool bResult = xFilter->filter( aDescriptor.getAsConstPropertyValueList() );
+ bool bResult = xFilter->filter( aMediaDesc.getAsConstPropertyValueList() );
// if filter returns false, document is invalid, or dumper has disabled import -> exit here
if( !bResult )
@@ -141,27 +147,27 @@ FltError ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument
if( xRootStrg.Is() )
{
// try to open the "Book" stream
- SotStorageStreamRef xBookStrm5 = ScfTools::OpenStorageStreamRead( xRootStrg, EXC_STREAM_BOOK );
- XclBiff eBookStrm5Biff = xBookStrm5.Is() ? XclImpStream::DetectBiffVersion( *xBookStrm5 ) : EXC_BIFF_UNKNOWN;
+ SotStorageStreamRef xBookStrm = ScfTools::OpenStorageStreamRead( xRootStrg, EXC_STREAM_BOOK );
+ XclBiff eBookBiff = xBookStrm.Is() ? XclImpStream::DetectBiffVersion( *xBookStrm ) : EXC_BIFF_UNKNOWN;
// try to open the "Workbook" stream
- SotStorageStreamRef xBookStrm8 = ScfTools::OpenStorageStreamRead( xRootStrg, EXC_STREAM_WORKBOOK );
- XclBiff eBookStrm8Biff = xBookStrm8.Is() ? XclImpStream::DetectBiffVersion( *xBookStrm8 ) : EXC_BIFF_UNKNOWN;
+ SotStorageStreamRef xWorkbookStrm = ScfTools::OpenStorageStreamRead( xRootStrg, EXC_STREAM_WORKBOOK );
+ XclBiff eWorkbookBiff = xWorkbookStrm.Is() ? XclImpStream::DetectBiffVersion( *xWorkbookStrm ) : EXC_BIFF_UNKNOWN;
// decide which stream to use
- if( (eBookStrm8Biff != EXC_BIFF_UNKNOWN) && ((eBookStrm5Biff == EXC_BIFF_UNKNOWN) || (eBookStrm8Biff > eBookStrm5Biff)) )
+ if( (eWorkbookBiff != EXC_BIFF_UNKNOWN) && ((eBookBiff == EXC_BIFF_UNKNOWN) || (eWorkbookBiff > eBookBiff)) )
{
/* Only "Workbook" stream exists; or both streams exist,
and "Workbook" has higher BIFF version than "Book" stream. */
- xStrgStrm = xBookStrm8;
- eBiff = eBookStrm8Biff;
+ xStrgStrm = xWorkbookStrm;
+ eBiff = eWorkbookBiff;
}
- else if( eBookStrm5Biff != EXC_BIFF_UNKNOWN )
+ else if( eBookBiff != EXC_BIFF_UNKNOWN )
{
/* Only "Book" stream exists; or both streams exist,
and "Book" has higher BIFF version than "Workbook" stream. */
- xStrgStrm = xBookStrm5;
- eBiff = eBookStrm5Biff;
+ xStrgStrm = xBookStrm;
+ eBiff = eBookBiff;
}
pBookStrm = xStrgStrm;
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 35662f44d2bb..008382b8a29d 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -165,14 +165,14 @@ void ImportExcel8::Boundsheet( void )
UINT8 nLen;
UINT16 nGrbit;
- aIn.Ignore( 4 );
+ aIn.DisableDecryption();
+ maSheetOffsets.push_back( aIn.ReaduInt32() );
+ aIn.EnableDecryption();
aIn >> nGrbit >> nLen;
String aName( aIn.ReadUniString( nLen ) );
GetTabInfo().AppendXclTabName( aName, nBdshtTab );
- *pExcRoot->pTabNameBuff << aName;
-
SCTAB nScTab = static_cast< SCTAB >( nBdshtTab );
if( nScTab > 0 )
{
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index 0f51bb8f2f1b..4ee5f70dc938 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -107,17 +107,10 @@ using ::rtl::OString;
//--------------------------------------------------------- class ExcDummy_00 -
const BYTE ExcDummy_00::pMyData[] = {
- 0xe1, 0x00, 0x00, 0x00, // INTERFACEHDR
- 0xc1, 0x00, 0x02, 0x00, 0x00, 0x00, // MMS
- 0xbf, 0x00, 0x00, 0x00, // TOOLBARHDR
- 0xc0, 0x00, 0x00, 0x00, // TOOLBAREND
- 0xe2, 0x00, 0x00, 0x00, // INTERFACEEND
- 0x5c, 0x00, 0x20, 0x00, 0x04, 0x4d, 0x72, 0x20, 0x58, // WRITEACCESS
+ 0x5c, 0x00, 0x20, 0x00, 0x04, 'C', 'a', 'l', 'c', // WRITEACCESS
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x42, 0x00, 0x02, 0x00, 0xe4, 0x04, // CODEPAGE
- 0x9c, 0x00, 0x02, 0x00, 0x0e, 0x00 // FNGROUPCOUNT
+ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
};
const sal_Size ExcDummy_00::nMyLen = sizeof( ExcDummy_00::pMyData );
@@ -218,12 +211,6 @@ UINT16 ExcDummyRec::GetNum( void ) const
//------------------------------------------------------- class ExcBoolRecord -
-ExcBoolRecord::ExcBoolRecord( SfxItemSet* pItemSet, USHORT nWhich, BOOL bDefault )
-{
- bVal = pItemSet? ( ( const SfxBoolItem& ) pItemSet->Get( nWhich ) ).GetValue() : bDefault;
-}
-
-
void ExcBoolRecord::SaveCont( XclExpStream& rStrm )
{
rStrm << (UINT16)(bVal ? 0x0001 : 0x0000);
@@ -321,27 +308,6 @@ sal_Size ExcEof::GetLen( void ) const
-//----------------------------------------------------- class ExcFngroupcount -
-
-void ExcFngroupcount::SaveCont( XclExpStream& rStrm )
-{
- rStrm << ( UINT16 ) 0x000E; // copied from Excel
-}
-
-
-UINT16 ExcFngroupcount::GetNum( void ) const
-{
- return 0x009C;
-}
-
-
-sal_Size ExcFngroupcount::GetLen( void ) const
-{
- return 2;
-}
-
-
-
//--------------------------------------------------------- class ExcDummy_00 -
sal_Size ExcDummy_00::GetLen( void ) const
diff --git a/sc/source/filter/excel/exctools.cxx b/sc/source/filter/excel/exctools.cxx
index 11400ca20742..d698278d9d3c 100644
--- a/sc/source/filter/excel/exctools.cxx
+++ b/sc/source/filter/excel/exctools.cxx
@@ -68,7 +68,6 @@ RootData::RootData( void )
{
eDateiTyp = BiffX;
pExtSheetBuff = NULL;
- pTabNameBuff = NULL;
pShrfmlaBuff = NULL;
pExtNameBuff = NULL;
pFmlaConverter = NULL;
@@ -90,7 +89,6 @@ RootData::RootData( void )
RootData::~RootData()
{
delete pExtSheetBuff;
- delete pTabNameBuff;
delete pShrfmlaBuff;
delete pExtNameBuff;
delete pAutoFilterBuffer;
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index cfbef0a15a6e..9b868f4d3268 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -46,6 +46,7 @@
#include <svx/pageitem.hxx>
#include <svx/colritem.hxx>
#include <sfx2/printer.hxx>
+#include <sfx2/docfile.hxx>
#include <svtools/zforlist.hxx>
#include <sfx2/objsh.hxx>
@@ -135,7 +136,6 @@ ImportExcel::ImportExcel( XclImpRootData& rImpData, SvStream& rStrm ):
pExcRoot->pIR = this; // ExcRoot -> XclImpRoot
pExcRoot->eDateiTyp = BiffX;
pExcRoot->pExtSheetBuff = new ExtSheetBuffer( pExcRoot ); //&aExtSheetBuff;
- pExcRoot->pTabNameBuff = new NameBuffer( pExcRoot ); //&aTabNameBuff;
pExcRoot->pShrfmlaBuff = new ShrfmlaBuffer( pExcRoot ); //&aShrfrmlaBuff;
pExcRoot->pExtNameBuff = new ExtNameBuff ( *this );
@@ -175,6 +175,25 @@ ImportExcel::~ImportExcel( void )
}
+void ImportExcel::ReadFileSharing()
+{
+ sal_uInt16 nRecommendReadOnly, nPasswordHash;
+ maStrm >> nRecommendReadOnly >> nPasswordHash;
+
+ if( (nRecommendReadOnly != 0) || (nPasswordHash != 0) )
+ if( SfxItemSet* pItemSet = GetMedium().GetItemSet() )
+ pItemSet->Put( SfxBoolItem( SID_DOC_READONLY, TRUE ) );
+
+ if( nPasswordHash != 0 )
+ {
+ if( SfxObjectShell* pDocShell = GetDocShell() )
+ {
+ ScfPropertySet aPropSet( pDocShell->GetModel() );
+ aPropSet.SetProperty( CREATE_OUSTRING( "WriteProtectionPassword" ), static_cast< sal_Int32 >( nPasswordHash ) );
+ }
+ }
+}
+
sal_uInt16 ImportExcel::ReadXFIndex( bool bBiff2 )
{
sal_uInt16 nXFIdx = 0;
@@ -604,7 +623,6 @@ void ImportExcel::DocPasssword( void )
void ImportExcel::Codepage( void )
{
- maStrm.EnableDecryption();
SetCodePage( maStrm.ReaduInt16() );
}
@@ -679,14 +697,14 @@ void ImportExcel::Boundsheet( void )
if( GetBiff() == EXC_BIFF5 )
{
- aIn.Ignore( 4 );
+ aIn.DisableDecryption();
+ maSheetOffsets.push_back( aIn.ReaduInt32() );
+ aIn.EnableDecryption();
aIn >> nGrbit;
}
String aName( aIn.ReadByteString( FALSE ) );
- *pExcRoot->pTabNameBuff << aName;
-
SCTAB nScTab = static_cast< SCTAB >( nBdshtTab );
if( nScTab > 0 )
{
diff --git a/sc/source/filter/excel/makefile.mk b/sc/source/filter/excel/makefile.mk
index 4fffb1ef3ed1..4c94b0712d89 100644
--- a/sc/source/filter/excel/makefile.mk
+++ b/sc/source/filter/excel/makefile.mk
@@ -103,7 +103,6 @@ SLOFILES = \
$(SLO)$/xlpage.obj \
$(SLO)$/xlpivot.obj \
$(SLO)$/xlroot.obj \
- $(SLO)$/xlstream.obj \
$(SLO)$/xlstyle.obj \
$(SLO)$/xltools.obj \
$(SLO)$/xltracer.obj \
@@ -122,6 +121,7 @@ EXCEPTIONSFILES = \
$(SLO)$/excimp8.obj \
$(SLO)$/excrecds.obj \
$(SLO)$/expop2.obj \
+ $(SLO)$/impop.obj \
$(SLO)$/namebuff.obj \
$(SLO)$/tokstack.obj \
$(SLO)$/xecontent.obj \
@@ -153,6 +153,7 @@ EXCEPTIONSFILES = \
$(SLO)$/xlchart.obj \
$(SLO)$/xlformula.obj \
$(SLO)$/xlpivot.obj \
+ $(SLO)$/xlroot.obj \
$(SLO)$/xlstyle.obj \
$(SLO)$/xlview.obj
diff --git a/sc/source/filter/excel/namebuff.cxx b/sc/source/filter/excel/namebuff.cxx
index df53c3edcd3c..b01f5a728263 100644
--- a/sc/source/filter/excel/namebuff.cxx
+++ b/sc/source/filter/excel/namebuff.cxx
@@ -127,6 +127,9 @@ void ShrfmlaBuffer::Store( const ScRange& rRange, const ScTokenArray& rToken )
DBG_ASSERT( mnCurrIdx <= 0xFFFF, "*ShrfmlaBuffer::Store(): Gleich wird mir schlecht...!" );
ScRangeData* pData = new ScRangeData( pExcRoot->pIR->GetDocPtr(), aName, rToken, rRange.aStart, RT_SHARED );
+ const ScAddress& rMaxPos = pExcRoot->pIR->GetMaxPos();
+ pData->SetMaxCol(rMaxPos.Col());
+ pData->SetMaxRow(rMaxPos.Row());
pData->SetIndex( static_cast< USHORT >( mnCurrIdx ) );
pExcRoot->pIR->GetNamedRanges().Insert( pData );
index_hash[rRange.aStart] = static_cast< USHORT >( mnCurrIdx );
diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx
index e7473ba23d02..afa66422ca44 100644
--- a/sc/source/filter/excel/read.cxx
+++ b/sc/source/filter/excel/read.cxx
@@ -99,9 +99,28 @@ FltError ImportExcel::Read( void )
::std::auto_ptr< ScfSimpleProgressBar > pProgress( new ScfSimpleProgressBar(
aIn.GetSvStreamSize(), GetDocShell(), STR_LOAD_DOC ) );
+ /* #i104057# Need to track a base position for progress bar calculation,
+ because sheet substreams may not be in order of sheets. */
+ sal_Size nProgressBasePos = 0;
+ sal_Size nProgressBaseSize = 0;
+
while( eAkt != Z_Ende )
{
- aIn.StartNextRecord();
+ if( eAkt == Z_Biff5E )
+ {
+ sal_uInt16 nScTab = GetCurrScTab();
+ if( nScTab < maSheetOffsets.size() )
+ {
+ nProgressBaseSize += (aIn.GetSvStreamPos() - nProgressBasePos);
+ nProgressBasePos = maSheetOffsets[ nScTab ];
+ aIn.StartNextRecord( nProgressBasePos );
+ }
+ else
+ eAkt = Z_Ende;
+ }
+ else
+ aIn.StartNextRecord();
+
nOpcode = aIn.GetRecId();
if( !aIn.IsValid() )
@@ -124,8 +143,11 @@ FltError ImportExcel::Read( void )
break;
}
+ if( eAkt == Z_Ende )
+ break;
+
if( eAkt != Z_Biff5TPre && eAkt != Z_Biff5WPre )
- pProgress->ProgressAbs( aIn.GetSvStreamPos() );
+ pProgress->ProgressAbs( nProgressBaseSize + aIn.GetSvStreamPos() - nProgressBasePos );
switch( eAkt )
{
@@ -305,6 +327,7 @@ FltError ImportExcel::Read( void )
if( eLastErr != ERRCODE_NONE )
eAkt = Z_Ende;
break;
+ case EXC_ID_FILESHARING: ReadFileSharing(); break;
case 0x41: rTabViewSett.ReadPane( maStrm ); break;
case 0x42: Codepage(); break; // CODEPAGE [ 2345]
case 0x56: Builtinfmtcnt(); break; // BUILTINFMTCNT[ 34 ]
@@ -374,6 +397,7 @@ FltError ImportExcel::Read( void )
if( eLastErr != ERRCODE_NONE )
eAkt = Z_Ende;
break;
+ case EXC_ID_FILESHARING: ReadFileSharing(); break;
case 0x41: rTabViewSett.ReadPane( maStrm ); break;
case 0x42: Codepage(); break; // CODEPAGE [ 2345]
case 0x55: DefColWidth(); break;
@@ -412,6 +436,7 @@ FltError ImportExcel::Read( void )
if( eLastErr != ERRCODE_NONE )
eAkt = Z_Ende;
break;
+ case EXC_ID_FILESHARING: ReadFileSharing(); break;
case 0x17: Externsheet(); break; // EXTERNSHEET [ 2345]
case 0x42: Codepage(); break; // CODEPAGE [ 2345]
case 0x55: DefColWidth(); break;
@@ -546,6 +571,7 @@ FltError ImportExcel::Read( void )
if( eLastErr != ERRCODE_NONE )
eAkt = Z_Ende;
break;
+ case EXC_ID_FILESHARING: ReadFileSharing(); break;
case 0x3D: Window1(); break;
case 0x42: Codepage(); break; // CODEPAGE [ 2345]
case 0x85: Boundsheet(); break; // BOUNDSHEET [ 5]
@@ -800,9 +826,28 @@ FltError ImportExcel8::Read( void )
::std::auto_ptr< ScfSimpleProgressBar > pProgress( new ScfSimpleProgressBar(
aIn.GetSvStreamSize(), GetDocShell(), STR_LOAD_DOC ) );
+ /* #i104057# Need to track a base position for progress bar calculation,
+ because sheet substreams may not be in order of sheets. */
+ sal_Size nProgressBasePos = 0;
+ sal_Size nProgressBaseSize = 0;
+
while( eAkt != EXC_STATE_END )
{
- aIn.StartNextRecord();
+ if( eAkt == EXC_STATE_BEFORE_SHEET )
+ {
+ sal_uInt16 nScTab = GetCurrScTab();
+ if( nScTab < maSheetOffsets.size() )
+ {
+ nProgressBaseSize += (aIn.GetSvStreamPos() - nProgressBasePos);
+ nProgressBasePos = maSheetOffsets[ nScTab ];
+ aIn.StartNextRecord( nProgressBasePos );
+ }
+ else
+ eAkt = EXC_STATE_END;
+ }
+ else
+ aIn.StartNextRecord();
+
if( !aIn.IsValid() )
{
// #124240# #i63591# finalize table if EOF is missing
@@ -826,7 +871,7 @@ FltError ImportExcel8::Read( void )
break;
if( eAkt != EXC_STATE_SHEET_PRE && eAkt != EXC_STATE_GLOBALS_PRE )
- pProgress->ProgressAbs( aIn.GetSvStreamPos() );
+ pProgress->ProgressAbs( nProgressBaseSize + aIn.GetSvStreamPos() - nProgressBasePos );
sal_uInt16 nRecId = aIn.GetRecId();
@@ -902,6 +947,7 @@ FltError ImportExcel8::Read( void )
if( eLastErr != ERRCODE_NONE )
eAkt = EXC_STATE_END;
break;
+ case EXC_ID_FILESHARING: ReadFileSharing(); break;
case 0x3D: Window1(); break;
case 0x42: Codepage(); break; // CODEPAGE [ 2345 ]
case 0x85: Boundsheet(); break; // BOUNDSHEET [ 5 ]
diff --git a/sc/source/filter/excel/tokstack.cxx b/sc/source/filter/excel/tokstack.cxx
index 28ce1a19b932..34c2b9284fed 100644
--- a/sc/source/filter/excel/tokstack.cxx
+++ b/sc/source/filter/excel/tokstack.cxx
@@ -208,20 +208,20 @@ void TokenPool::GrowDouble( void )
}
-void TokenPool::GrowError( void )
-{
- UINT16 nP_ErrNew = nP_Err * 2;
-
- USHORT* pP_ErrNew = new USHORT[ nP_ErrNew ];
-
- for( UINT16 nL = 0 ; nL < nP_Err ; nL++ )
- pP_ErrNew[ nL ] = pP_Err[ nL ];
-
- nP_Err = nP_ErrNew;
-
- delete[] pP_Err;
- pP_Err = pP_ErrNew;
-}
+//UNUSED2009-05 void TokenPool::GrowError( void )
+//UNUSED2009-05 {
+//UNUSED2009-05 UINT16 nP_ErrNew = nP_Err * 2;
+//UNUSED2009-05
+//UNUSED2009-05 USHORT* pP_ErrNew = new USHORT[ nP_ErrNew ];
+//UNUSED2009-05
+//UNUSED2009-05 for( UINT16 nL = 0 ; nL < nP_Err ; nL++ )
+//UNUSED2009-05 pP_ErrNew[ nL ] = pP_Err[ nL ];
+//UNUSED2009-05
+//UNUSED2009-05 nP_Err = nP_ErrNew;
+//UNUSED2009-05
+//UNUSED2009-05 delete[] pP_Err;
+//UNUSED2009-05 pP_Err = pP_ErrNew;
+//UNUSED2009-05 }
void TokenPool::GrowTripel( void )
@@ -593,28 +593,6 @@ const TokenId TokenPool::Store( const double& rDouble )
}
-//UNUSED2008-05 const TokenId TokenPool::StoreError( USHORT nError )
-//UNUSED2008-05 {
-//UNUSED2008-05 if( nElementAkt >= nElement )
-//UNUSED2008-05 GrowElement();
-//UNUSED2008-05
-//UNUSED2008-05 if( nP_ErrAkt >= nP_Err )
-//UNUSED2008-05 GrowError();
-//UNUSED2008-05
-//UNUSED2008-05 pElement[ nElementAkt ] = nP_ErrAkt; // Index in Error-Array
-//UNUSED2008-05 pType[ nElementAkt ] = T_Err; // Typinfo Error eintragen
-//UNUSED2008-05
-//UNUSED2008-05 pP_Err[ nP_ErrAkt ] = nError;
-//UNUSED2008-05
-//UNUSED2008-05 pSize[ nElementAkt ] = 1; // eigentlich Banane
-//UNUSED2008-05
-//UNUSED2008-05 nElementAkt++;
-//UNUSED2008-05 nP_ErrAkt++;
-//UNUSED2008-05
-//UNUSED2008-05 return ( const TokenId ) nElementAkt; // Ausgabe von altem Wert + 1!
-//UNUSED2008-05 }
-
-
const TokenId TokenPool::Store( const UINT16 nIndex )
{
if( nElementAkt >= nElement )
diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx
index e065099b2824..849ac080bb1d 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -31,25 +31,29 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
+// XXX xelink.hxx MUST be included before xeformula.hxx because of the
+// redifinition of the CREATE_OUSTRING() macro, which is in oox/helper.hxx
+// (indirectly included via xelink.hxx) and ../inc/ftools.hxx (indirectly
+// included via xeformula.hxx) that does an undef first. Ugly.
+#include "xelink.hxx"
+#include "xeformula.hxx"
+
#include <list>
#include <map>
+#include <memory>
+#include "addincol.hxx"
#include "compiler.hxx"
+#include "document.hxx"
+#include "externalrefmgr.hxx"
#include "rangelst.hxx"
-#include "addincol.hxx"
-#include "xestream.hxx"
-#include "xehelper.hxx"
-#include "xelink.hxx"
-#include "xename.hxx"
-#include "xeformula.hxx"
#include "token.hxx"
#include "tokenarray.hxx"
+#include "xehelper.hxx"
+#include "xename.hxx"
+#include "xestream.hxx"
-#include "document.hxx"
-#include "externalrefmgr.hxx"
-
-#include <memory>
+using namespace ::formula;
-using namespace formula;
// External reference log =====================================================
XclExpRefLogEntry::XclExpRefLogEntry() :
@@ -63,90 +67,60 @@ XclExpRefLogEntry::XclExpRefLogEntry() :
// Formula compiler ===========================================================
-/** Type of token class handling. */
-enum XclExpTokenClassType
-{
- EXC_CLASSTYPE_CELL, /// Cell formula, shared formula.
- EXC_CLASSTYPE_ARRAY, /// Array formula, conditional formatting, data validation.
- EXC_CLASSTYPE_NAME /// Defined name, range list.
-};
+namespace {
-/** Type of the link manager to be used. */
-enum XclExpLinkMgrType
+/** Wrapper structure for a processed Calc formula token with additional
+ settings (whitespaces). */
+struct XclExpScToken
{
- EXC_LINKMGRTYPE_NONE, /// No link manager, 2D references only.
- EXC_LINKMGRTYPE_LOCAL, /// Local (per-sheet) link manager.
- EXC_LINKMGRTYPE_GLOBAL /// Global link manager.
+ const FormulaToken* mpScToken; /// Currently processed Calc token.
+ sal_uInt8 mnSpaces; /// Number of spaces before the Calc token.
+
+ inline explicit XclExpScToken() : mpScToken( 0 ), mnSpaces( 0 ) {}
+ inline bool Is() const { return mpScToken != 0; }
+ inline StackVar GetType() const { return mpScToken ? mpScToken->GetType() : static_cast< StackVar >( svUnknown ); }
+ inline OpCode GetOpCode() const { return mpScToken ? mpScToken->GetOpCode() : static_cast< OpCode >( ocNone ); }
};
// ----------------------------------------------------------------------------
-/** Configuration data of the formula compiler. */
-struct XclExpCompConfig
+/** Effective token class conversion types. */
+enum XclExpClassConv
{
- XclFormulaType meType; /// Type of the formula to be created.
- XclExpTokenClassType meClassType; /// Token class handling type.
- XclExpLinkMgrType meLinkMgrType; /// Link manager to be used.
- bool mbFromCell; /// True = Any kind of cell formula (cell, array, shared).
- bool mb3DRefOnly; /// True = Only 3D references allowed (e.g. names).
- bool mbAllowArrays; /// True = Allow inline arrays.
+ EXC_CLASSCONV_ORG, /// Keep original class of the token.
+ EXC_CLASSCONV_VAL, /// Convert ARR tokens to VAL class (REF remains uncahnged).
+ EXC_CLASSCONV_ARR /// Convert VAL tokens to ARR class (REF remains uncahnged).
};
// ----------------------------------------------------------------------------
-/** Working data of the formula compiler. Used to push onto a stack for recursive calls. */
-struct XclExpCompData
+/** Token class conversion and position of a token in the token array. */
+struct XclExpTokenConvInfo
{
- typedef ::std::list< const ScMatrix* > ScMatrixList;
- typedef ScfRef< ScMatrixList > ScMatrixListRef;
- typedef ScfRef< ScTokenArray > ScTokenArrayRef;
-
- XclExpCompConfig maCfg; /// Configuration for current formula type.
- ScfUInt8Vec maTokVec; /// Byte vector containing token data.
- ScTokenArrayRef mxOwnScTokArr; /// Own clone of a Calc token array.
- XclTokenArrayIterator maTokArrIt; /// Iterator in Calc token array.
- XclExpLinkManager* mpLinkMgr; /// Link manager for current context (local/global).
- XclExpRefLog* mpRefLog; /// Log for external references.
- ScMatrixListRef mxInlineArr; /// List of inline arrays (in reverse order)
-
- const ScAddress* mpScBasePos; /// Current cell position of the formula.
-
- // processing data during compilation
- sal_uInt16 mnLastTokPos; /// Position of last appended Excel token ID.
- sal_uInt8 mnLastDefClass; /// Default class of last appended Excel token ID.
- sal_uInt8 mnRefExpClass; /// New class for VAL parameters, if REF is expected.
- sal_uInt8 mnValExpClass; /// New class for all parameters, if VAL is expected.
- sal_uInt8 mnArrExpClass; /// New class for all parameters, if ARR is expected.
- bool mbStopAtSep; /// True = Stop subexpression creation at an ocSep token.
- bool mbVolatile; /// True = Formula contains volatile function.
- bool mbIsArrExp; /// True = ARR class is expected somewhere before.
- bool mbOk; /// Current state of the compiler.
-
- explicit XclExpCompData();
+ sal_uInt16 mnTokPos; /// Position of the token in the token array.
+ XclFuncParamConv meConv; /// Token class conversion type.
+ bool mbValType; /// Data type (false = REFTYPE, true = VALTYPE).
};
-XclExpCompData::XclExpCompData() :
- mpLinkMgr( 0 ),
- mpRefLog( 0 ),
- mpScBasePos( 0 ),
- mbOk( false )
+/** Vector of token position and conversion for all operands of an operator,
+ or for all parameters of a function. */
+struct XclExpOperandList : public ::std::vector< XclExpTokenConvInfo >
{
-}
-
-// ----------------------------------------------------------------------------
+ inline explicit XclExpOperandList() { reserve( 2 ); }
+ void AppendOperand( sal_uInt16 nTokPos, XclFuncParamConv eConv, bool bValType );
+};
-/** Working data for a processed Calc formula token. */
-struct XclExpTokenData
+void XclExpOperandList::AppendOperand( sal_uInt16 nTokPos, XclFuncParamConv eConv, bool bValType )
{
- const formula::FormulaToken*
- mpScToken; /// Currently processed Calc token.
- sal_uInt8 mnSpaces; /// Number of spaces before the Calc token.
+ resize( size() + 1 );
+ XclExpTokenConvInfo& rConvInfo = back();
+ rConvInfo.mnTokPos = nTokPos;
+ rConvInfo.meConv = eConv;
+ rConvInfo.mbValType = bValType;
+}
- inline explicit XclExpTokenData() : mpScToken( 0 ), mnSpaces( 0 ) {}
- inline bool Is() const { return mpScToken != 0; }
- inline formula::StackVar GetType() const { return mpScToken ? mpScToken->GetType() : static_cast< formula::StackVar >( svUnknown ); }
- inline OpCode GetOpCode() const { return mpScToken ? mpScToken->GetOpCode() : static_cast< OpCode >( ocNone ); }
-};
+typedef ScfRef< XclExpOperandList > XclExpOperandListRef;
+typedef ::std::vector< XclExpOperandListRef > XclExpOperandListVector;
// ----------------------------------------------------------------------------
@@ -175,87 +149,168 @@ class XclExpFuncData
{
public:
explicit XclExpFuncData(
- const XclExpTokenData& rTokData,
+ const XclExpScToken& rTokData,
const XclFunctionInfo& rFuncInfo,
- const XclExpExtFuncData& rExtFuncData,
- sal_uInt8 nExpRetClass );
+ const XclExpExtFuncData& rExtFuncData );
- inline const formula::FormulaToken& GetScToken() const { return *mrTokData.mpScToken; }
+ inline const FormulaToken& GetScToken() const { return *mrTokData.mpScToken; }
inline OpCode GetOpCode() const { return mrFuncInfo.meOpCode; }
inline sal_uInt16 GetXclFuncIdx() const { return mrFuncInfo.mnXclFunc; }
inline bool IsVolatile() const { return mrFuncInfo.IsVolatile(); }
+ inline bool IsFixedParamCount() const { return mrFuncInfo.IsFixedParamCount(); }
inline bool IsMacroFunc() const { return mrFuncInfo.IsMacroFunc(); }
inline sal_uInt8 GetSpaces() const { return mrTokData.mnSpaces; }
inline const XclExpExtFuncData& GetExtFuncData() const { return maExtFuncData; }
-
inline sal_uInt8 GetReturnClass() const { return mrFuncInfo.mnRetClass; }
- inline sal_uInt8 GetExpReturnClass() const { return mnExpRetClass; }
- inline sal_uInt8 GetExpParamClass() const { return mrFuncInfo.mpnParamClass[ mnClassIdx ]; }
- void IncExpParamClassIdx();
+ const XclFuncParamInfo& GetParamInfo() const;
+ bool IsCalcOnlyParam() const;
+ bool IsExcelOnlyParam() const;
+ void IncParamInfoIdx();
inline sal_uInt8 GetMinParamCount() const { return mrFuncInfo.mnMinParamCount; }
inline sal_uInt8 GetMaxParamCount() const { return mrFuncInfo.mnMaxParamCount; }
- inline sal_uInt8 GetParamCount() const { return mnParamCount; }
- inline void IncParamCount() { ++mnParamCount; }
+ inline sal_uInt8 GetParamCount() const { return static_cast< sal_uInt8 >( mxOperands->size() ); }
+ void FinishParam( sal_uInt16 nTokPos );
+ inline XclExpOperandListRef GetOperandList() const { return mxOperands; }
inline ScfUInt16Vec& GetAttrPosVec() { return maAttrPosVec; }
inline void AppendAttrPos( sal_uInt16 nPos ) { maAttrPosVec.push_back( nPos ); }
private:
ScfUInt16Vec maAttrPosVec; /// Token array positions of tAttr tokens.
- const XclExpTokenData& mrTokData; /// Data about processed function name token.
+ const XclExpScToken& mrTokData; /// Data about processed function name token.
const XclFunctionInfo& mrFuncInfo; /// Constant data about processed function.
XclExpExtFuncData maExtFuncData; /// Data for external functions (macro, add-in).
- sal_uInt8 mnExpRetClass; /// Expected token class for return value.
- sal_uInt8 mnClassIdx; /// Index into expected parameter class array of mrFuncInfo.
- sal_uInt8 mnParamCount; /// Current number of parameters of a function.
+ XclExpOperandListRef mxOperands; /// Class conversion and position of all parameters.
+ const XclFuncParamInfo* mpParamInfo; /// Information for current parameter.
};
-XclExpFuncData::XclExpFuncData(
- const XclExpTokenData& rTokData, const XclFunctionInfo& rFuncInfo,
- const XclExpExtFuncData& rExtFuncData, sal_uInt8 nExpRetClass ) :
+XclExpFuncData::XclExpFuncData( const XclExpScToken& rTokData,
+ const XclFunctionInfo& rFuncInfo, const XclExpExtFuncData& rExtFuncData ) :
mrTokData( rTokData ),
mrFuncInfo( rFuncInfo ),
maExtFuncData( rExtFuncData ),
- mnExpRetClass( nExpRetClass ),
- mnClassIdx( 0 ),
- mnParamCount( 0 )
+ mxOperands( new XclExpOperandList ),
+ mpParamInfo( rFuncInfo.mpParamInfos )
{
DBG_ASSERT( mrTokData.mpScToken, "XclExpFuncData::XclExpFuncData - missing core token" );
// set name of an add-in function
- if( !maExtFuncData.maFuncName.Len() && dynamic_cast< const formula::FormulaExternalToken* >( mrTokData.mpScToken ) )
+ if( (maExtFuncData.maFuncName.Len() == 0) && dynamic_cast< const FormulaExternalToken* >( mrTokData.mpScToken ) )
maExtFuncData.Set( GetScToken().GetExternal(), true, false );
}
-void XclExpFuncData::IncExpParamClassIdx()
+const XclFuncParamInfo& XclExpFuncData::GetParamInfo() const
{
- if( (mnClassIdx + 1 < EXC_FUNCINFO_CLASSCOUNT) && (mrFuncInfo.mpnParamClass[ mnClassIdx + 1 ] != EXC_TOKCLASS_NONE) )
- ++mnClassIdx;
+ static const XclFuncParamInfo saInvalidInfo = { EXC_PARAM_NONE, EXC_PARAMCONV_ORG, false };
+ return mpParamInfo ? *mpParamInfo : saInvalidInfo;
}
-// reference handling ---------------------------------------------------------
-
-namespace {
+bool XclExpFuncData::IsCalcOnlyParam() const
+{
+ return mpParamInfo && (mpParamInfo->meValid == EXC_PARAM_CALCONLY);
+}
-inline bool lclIsRefRel2D( const ScSingleRefData& rRefData )
+bool XclExpFuncData::IsExcelOnlyParam() const
{
- return rRefData.IsColRel() || rRefData.IsRowRel();
+ return mpParamInfo && (mpParamInfo->meValid == EXC_PARAM_EXCELONLY);
}
-inline bool lclIsRefDel2D( const ScSingleRefData& rRefData )
+void XclExpFuncData::IncParamInfoIdx()
{
- return rRefData.IsColDeleted() || rRefData.IsRowDeleted();
+ if( mpParamInfo )
+ {
+ // move pointer to next entry, if something explicit follows
+ if( (static_cast<size_t>(mpParamInfo - mrFuncInfo.mpParamInfos + 1) < EXC_FUNCINFO_PARAMINFO_COUNT) && (mpParamInfo[ 1 ].meValid != EXC_PARAM_NONE) )
+ ++mpParamInfo;
+ // if last parameter type is 'Excel-only' or 'Calc-only', do not repeat it
+ else if( IsExcelOnlyParam() || IsCalcOnlyParam() )
+ mpParamInfo = 0;
+ // otherwise: repeat last parameter class
+ }
}
-inline bool lclIsRefRel2D( const ScComplexRefData& rRefData )
+void XclExpFuncData::FinishParam( sal_uInt16 nTokPos )
{
- return lclIsRefRel2D( rRefData.Ref1 ) || lclIsRefRel2D( rRefData.Ref2 );
+ // write token class conversion info for this parameter
+ const XclFuncParamInfo& rParamInfo = GetParamInfo();
+ mxOperands->AppendOperand( nTokPos, rParamInfo.meConv, rParamInfo.mbValType );
+ // move to next parameter info structure
+ IncParamInfoIdx();
}
-inline bool lclIsRefDel2D( const ScComplexRefData& rRefData )
+// compiler configuration -----------------------------------------------------
+
+/** Type of token class handling. */
+enum XclExpFmlaClassType
{
- return lclIsRefDel2D( rRefData.Ref1 ) || lclIsRefDel2D( rRefData.Ref2 );
+ EXC_CLASSTYPE_CELL, /// Cell formula, shared formula.
+ EXC_CLASSTYPE_ARRAY, /// Array formula, conditional formatting, data validation.
+ EXC_CLASSTYPE_NAME /// Defined name, range list.
+};
+
+/** Configuration data of the formula compiler. */
+struct XclExpCompConfig
+{
+ XclFormulaType meType; /// Type of the formula to be created.
+ XclExpFmlaClassType meClassType; /// Token class handling type.
+ bool mbLocalLinkMgr; /// True = local (per-sheet) link manager, false = global.
+ bool mbFromCell; /// True = Any kind of cell formula (cell, array, shared).
+ bool mb3DRefOnly; /// True = Only 3D references allowed (e.g. names).
+ bool mbAllowArrays; /// True = Allow inline arrays.
+};
+
+/** The table containing configuration data for all formula types. */
+static const XclExpCompConfig spConfigTable[] =
+{
+ // formula type token class type lclLM inCell 3dOnly allowArray
+ { EXC_FMLATYPE_CELL, EXC_CLASSTYPE_CELL, true, true, false, true },
+ { EXC_FMLATYPE_SHARED, EXC_CLASSTYPE_CELL, true, true, false, true },
+ { EXC_FMLATYPE_MATRIX, EXC_CLASSTYPE_ARRAY, true, true, false, true },
+ { EXC_FMLATYPE_CONDFMT, EXC_CLASSTYPE_ARRAY, true, false, false, false },
+ { EXC_FMLATYPE_DATAVAL, EXC_CLASSTYPE_ARRAY, true, false, false, false },
+ { EXC_FMLATYPE_NAME, EXC_CLASSTYPE_NAME, false, false, true, true },
+ { EXC_FMLATYPE_CHART, EXC_CLASSTYPE_NAME, true, false, true, true },
+ { EXC_FMLATYPE_CONTROL, EXC_CLASSTYPE_NAME, true, false, false, false },
+ { EXC_FMLATYPE_WQUERY, EXC_CLASSTYPE_NAME, true, false, true, false },
+ { EXC_FMLATYPE_LISTVAL, EXC_CLASSTYPE_NAME, true, false, false, false }
+};
+
+// ----------------------------------------------------------------------------
+
+/** Working data of the formula compiler. Used to push onto a stack for recursive calls. */
+struct XclExpCompData
+{
+ typedef ScfRef< ScTokenArray > ScTokenArrayRef;
+
+ const XclExpCompConfig& mrCfg; /// Configuration for current formula type.
+ ScTokenArrayRef mxOwnScTokArr; /// Own clone of a Calc token array.
+ XclTokenArrayIterator maTokArrIt; /// Iterator in Calc token array.
+ XclExpLinkManager* mpLinkMgr; /// Link manager for current context (local/global).
+ XclExpRefLog* mpRefLog; /// Log for external references.
+ const ScAddress* mpScBasePos; /// Current cell position of the formula.
+
+ ScfUInt8Vec maTokVec; /// Byte vector containing token data.
+ ScfUInt8Vec maExtDataVec; /// Byte vector containing extended data (arrays, stacked NLRs).
+ XclExpOperandListVector maOpListVec; /// Formula structure, maps operators to their operands.
+ ScfUInt16Vec maOpPosStack; /// Stack with positions of operand tokens waiting for an operator.
+ bool mbStopAtSep; /// True = Stop subexpression creation at an ocSep token.
+ bool mbVolatile; /// True = Formula contains volatile function.
+ bool mbOk; /// Current state of the compiler.
+
+ explicit XclExpCompData( const XclExpCompConfig* pCfg );
+};
+
+XclExpCompData::XclExpCompData( const XclExpCompConfig* pCfg ) :
+ mrCfg( pCfg ? *pCfg : spConfigTable[ 0 ] ),
+ mpLinkMgr( 0 ),
+ mpRefLog( 0 ),
+ mpScBasePos( 0 ),
+ mbStopAtSep( false ),
+ mbVolatile( false ),
+ mbOk( pCfg != 0 )
+{
+ DBG_ASSERT( pCfg, "XclExpFmlaCompImpl::Init - unknown formula type" );
}
} // namespace
@@ -263,7 +318,7 @@ inline bool lclIsRefDel2D( const ScComplexRefData& rRefData )
// ----------------------------------------------------------------------------
/** Implementation class of the export formula compiler. */
-class XclExpFmlaCompImpl : protected XclExpRoot, protected XclTokenArrayHelper, private XclExpCompData
+class XclExpFmlaCompImpl : protected XclExpRoot, protected XclTokenArrayHelper
{
public:
explicit XclExpFmlaCompImpl( const XclExpRoot& rRoot );
@@ -285,64 +340,64 @@ public:
// ------------------------------------------------------------------------
private:
const XclExpCompConfig* GetConfigForType( XclFormulaType eType ) const;
- inline sal_uInt16 GetSize() const { return static_cast< sal_uInt16 >( maTokVec.size() ); }
+ inline sal_uInt16 GetSize() const { return static_cast< sal_uInt16 >( mxData->maTokVec.size() ); }
- void EnterRecursive();
void Init( XclFormulaType eType );
void Init( XclFormulaType eType, const ScTokenArray& rScTokArr,
const ScAddress* pScBasePos, XclExpRefLog* pRefLog );
- void LeaveRecursive();
- void FinalizeFormula( ScfUInt8Vec & rExtensionTokens );
- void AppendInlineArrays( ScfUInt8Vec & rExtensionTokens );
- XclTokenArrayRef CreateTokenArray( ScfUInt8Vec* pExtensionTokens = NULL );
+ void RecalcTokenClasses();
+ void RecalcTokenClass( const XclExpTokenConvInfo& rConvInfo, XclFuncParamConv ePrevConv, XclExpClassConv ePrevClassConv, bool bWasRefClass );
+
+ void FinalizeFormula();
+ XclTokenArrayRef CreateTokenArray();
// compiler ---------------------------------------------------------------
- // XclExpTokenData: pass-by-value and return-by-value is intended
-
- const formula::FormulaToken* GetNextRawToken();
- const formula::FormulaToken* PeekNextRawToken( bool bSkipSpaces ) const;
-
- bool GetNextToken( XclExpTokenData& rTokData );
- XclExpTokenData GetNextToken();
-
- XclExpTokenData Expression( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses, bool bStopAtSep );
- XclExpTokenData SkipExpression( XclExpTokenData aTokData, bool bStopAtSep );
-
- XclExpTokenData OrTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses );
- XclExpTokenData AndTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses );
- XclExpTokenData CompareTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses );
- XclExpTokenData ConcatTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses );
- XclExpTokenData AddSubTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses );
- XclExpTokenData MulDivTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses );
- XclExpTokenData PowTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses );
- XclExpTokenData UnaryPostTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses );
- XclExpTokenData UnaryPreTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses );
- XclExpTokenData ListTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses );
- XclExpTokenData IntersectTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool& rbHasRefOp );
- XclExpTokenData RangeTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool& rbHasRefOp );
- XclExpTokenData Factor( XclExpTokenData aTokData, sal_uInt8 nExpClass );
+ // XclExpScToken: pass-by-value and return-by-value is intended
+
+ const FormulaToken* GetNextRawToken();
+ const FormulaToken* PeekNextRawToken( bool bSkipSpaces ) const;
+
+ bool GetNextToken( XclExpScToken& rTokData );
+ XclExpScToken GetNextToken();
+
+ XclExpScToken Expression( XclExpScToken aTokData, bool bInParentheses, bool bStopAtSep );
+ XclExpScToken SkipExpression( XclExpScToken aTokData, bool bStopAtSep );
+
+ XclExpScToken OrTerm( XclExpScToken aTokData, bool bInParentheses );
+ XclExpScToken AndTerm( XclExpScToken aTokData, bool bInParentheses );
+ XclExpScToken CompareTerm( XclExpScToken aTokData, bool bInParentheses );
+ XclExpScToken ConcatTerm( XclExpScToken aTokData, bool bInParentheses );
+ XclExpScToken AddSubTerm( XclExpScToken aTokData, bool bInParentheses );
+ XclExpScToken MulDivTerm( XclExpScToken aTokData, bool bInParentheses );
+ XclExpScToken PowTerm( XclExpScToken aTokData, bool bInParentheses );
+ XclExpScToken UnaryPostTerm( XclExpScToken aTokData, bool bInParentheses );
+ XclExpScToken UnaryPreTerm( XclExpScToken aTokData, bool bInParentheses );
+ XclExpScToken ListTerm( XclExpScToken aTokData, bool bInParentheses );
+ XclExpScToken IntersectTerm( XclExpScToken aTokData, bool& rbHasRefOp );
+ XclExpScToken RangeTerm( XclExpScToken aTokData, bool& rbHasRefOp );
+ XclExpScToken Factor( XclExpScToken aTokData );
// formula structure ------------------------------------------------------
- void ProcessDouble( const XclExpTokenData& rTokData );
- void ProcessString( const XclExpTokenData& rTokData );
- void ProcessError( const XclExpTokenData& rTokData );
- void ProcessMissing( const XclExpTokenData& rTokData );
- void ProcessBad( const XclExpTokenData& rTokData );
- void ProcessParentheses( const XclExpTokenData& rTokData, sal_uInt8 nExpClass );
- void ProcessBoolean( const XclExpTokenData& rTokData );
- void ProcessDdeLink( const XclExpTokenData& rTokData, sal_uInt8 nExpClass );
- void ProcessExternal( const XclExpTokenData& rTokData, sal_uInt8 nExpClass );
- void ProcessExternalName( const XclExpTokenData& rTokData, sal_uInt8 nExpClass );
-
- void ProcessFunction( const XclExpTokenData& rTokData, sal_uInt8 nExpClass );
+ void ProcessDouble( const XclExpScToken& rTokData );
+ void ProcessString( const XclExpScToken& rTokData );
+ void ProcessError( const XclExpScToken& rTokData );
+ void ProcessMissing( const XclExpScToken& rTokData );
+ void ProcessBad( const XclExpScToken& rTokData );
+ void ProcessParentheses( const XclExpScToken& rTokData );
+ void ProcessBoolean( const XclExpScToken& rTokData );
+ void ProcessDdeLink( const XclExpScToken& rTokData );
+ void ProcessExternal( const XclExpScToken& rTokData );
+ void ProcessMatrix( const XclExpScToken& rTokData );
+
+ void ProcessFunction( const XclExpScToken& rTokData );
void PrepareFunction( XclExpFuncData& rFuncData );
void FinishFunction( XclExpFuncData& rFuncData, sal_uInt8 nCloseSpaces );
void FinishIfFunction( XclExpFuncData& rFuncData );
void FinishChooseFunction( XclExpFuncData& rFuncData );
- XclExpTokenData ProcessParam( XclExpTokenData aTokData, XclExpFuncData& rFuncData );
+ XclExpScToken ProcessParam( XclExpScToken aTokData, XclExpFuncData& rFuncData );
void PrepareParam( XclExpFuncData& rFuncData );
void FinishParam( XclExpFuncData& rFuncData );
void AppendDefaultParam( XclExpFuncData& rFuncData );
@@ -360,28 +415,20 @@ private:
bool bNatLangRef ) const;
XclExpRefLogEntry* GetNewRefLogEntry();
- void ProcessCellRef( const XclExpTokenData& rTokData, sal_uInt8 nExpClass );
- void ProcessRangeRef( const XclExpTokenData& rTokData, sal_uInt8 nExpClass );
- void ProcessMatrix( const XclExpTokenData& rTokData, sal_uInt8 nExpClass );
- void ProcessDefinedName( const XclExpTokenData& rTokData, sal_uInt8 nExpClass );
- void ProcessDatabaseArea( const XclExpTokenData& rTokData, sal_uInt8 nExpClass );
-
- // token identifiers ------------------------------------------------------
-
- void SetReplaceTokenClasses();
- void SetArrExpFlag( bool bIsArrExp );
- void UpdateArrExpFlag( sal_uInt8 nParamExpClass, sal_uInt8 nFuncRetClass );
-
- void AdjustTokenClass( sal_uInt8& rnTokenId, sal_uInt8 nExpClass );
- void AdjustLastTokenClass( sal_uInt8 nExpClass );
- void AdjustLastTokenClassForEastereggOp();
-
- void AppendOpTokenId( sal_uInt8 nTokenId, sal_uInt8 nExpClass, sal_uInt8 nSpaces = 0 );
-//UNUSED2008-05 void AppendFuncTokenId( sal_uInt16 nXclFuncIdx, sal_uInt8 nRetClass, sal_uInt8 nExpRetClass, sal_uInt8 nSpaces = 0 );
- void AppendVarFuncTokenId( sal_uInt16 nXclFuncIdx, sal_uInt8 nRetClass, sal_uInt8 nExpRetClass, sal_uInt8 nParamCount, sal_uInt8 nSpaces = 0 );
+ void ProcessCellRef( const XclExpScToken& rTokData );
+ void ProcessRangeRef( const XclExpScToken& rTokData );
+ void ProcessExternalCellRef( const XclExpScToken& rTokData );
+ void ProcessExternalRangeRef( const XclExpScToken& rTokData );
+ void ProcessDefinedName( const XclExpScToken& rTokData );
+ void ProcessExternalName( const XclExpScToken& rTokData );
+ void ProcessDatabaseArea( const XclExpScToken& rTokData );
// token vector -----------------------------------------------------------
+ void PushOperandPos( sal_uInt16 nTokPos );
+ void PushOperatorPos( sal_uInt16 nTokPos, const XclExpOperandListRef& rxOperands );
+ sal_uInt16 PopOperandPos();
+
void Append( sal_uInt8 nData );
void Append( sal_uInt8 nData, size_t nCount );
void Append( sal_uInt16 nData );
@@ -393,21 +440,30 @@ private:
void AppendRange( const XclRange& rXclRange );
void AppendSpaceToken( sal_uInt8 nType, sal_uInt8 nCount );
+
+ void AppendOperandTokenId( sal_uInt8 nTokenId, sal_uInt8 nSpaces = 0 );
void AppendIntToken( sal_uInt16 nValue, sal_uInt8 nSpaces = 0 );
void AppendNumToken( double fValue, sal_uInt8 nSpaces = 0 );
void AppendBoolToken( bool bValue, sal_uInt8 nSpaces = 0 );
void AppendErrorToken( sal_uInt8 nErrCode, sal_uInt8 nSpaces = 0 );
void AppendMissingToken( sal_uInt8 nSpaces = 0 );
- void AppendNameToken( sal_uInt16 nNameIdx, sal_uInt8 nExpClass, sal_uInt8 nSpaces = 0 );
- void AppendMissingNameToken( const String& rName, sal_uInt8 nExpClass, sal_uInt8 nSpaces = 0 );
- void AppendNameXToken( sal_uInt16 nExtSheet, sal_uInt16 nExtName, sal_uInt8 nExpClass, sal_uInt8 nSpaces = 0 );
- void AppendMacroCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nExpClass, sal_uInt8 nSpaces = 0 );
- void AppendAddInFuncToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nExpClass, sal_uInt8 nSpaces = 0 );
- void AppendEuroToolFuncToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nExpClass, sal_uInt8 nSpaces = 0 );
+ void AppendNameToken( sal_uInt16 nNameIdx, sal_uInt8 nSpaces = 0 );
+ void AppendMissingNameToken( const String& rName, sal_uInt8 nSpaces = 0 );
+ void AppendNameXToken( sal_uInt16 nExtSheet, sal_uInt16 nExtName, sal_uInt8 nSpaces = 0 );
+ void AppendMacroCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nSpaces = 0 );
+ void AppendAddInCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nSpaces = 0 );
+ void AppendEuroToolCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nSpaces = 0 );
+
+ void AppendOperatorTokenId( sal_uInt8 nTokenId, const XclExpOperandListRef& rxOperands, sal_uInt8 nSpaces = 0 );
+ void AppendUnaryOperatorToken( sal_uInt8 nTokenId, sal_uInt8 nSpaces = 0 );
+ void AppendBinaryOperatorToken( sal_uInt8 nTokenId, bool bValType, sal_uInt8 nSpaces = 0 );
+ void AppendLogicalOperatorToken( sal_uInt16 nXclFuncIdx, sal_uInt8 nOpCount );
+ void AppendFuncToken( const XclExpFuncData& rFuncData );
+
void AppendParenToken( sal_uInt8 nOpenSpaces = 0, sal_uInt8 nCloseSpaces = 0 );
void AppendJumpToken( XclExpFuncData& rFuncData, sal_uInt8 nAttrType );
- void Insert( sal_uInt16 nInsertPos, sal_uInt16 nInsertSize );
+ void InsertZeros( sal_uInt16 nInsertPos, sal_uInt16 nInsertSize );
void Overwrite( sal_uInt16 nWriteToPos, sal_uInt16 nOffset );
void UpdateAttrGoto( sal_uInt16 nAttrPos );
@@ -415,14 +471,23 @@ private:
bool IsSpaceToken( sal_uInt16 nPos ) const;
void RemoveTrailingParen();
+ void AppendExt( sal_uInt8 nData );
+ void AppendExt( sal_uInt8 nData, size_t nCount );
+ void AppendExt( sal_uInt16 nData );
+ void AppendExt( sal_uInt32 nData );
+ void AppendExt( double fData );
+ void AppendExt( const String& rString );
+
// ------------------------------------------------------------------------
private:
typedef ::std::map< XclFormulaType, XclExpCompConfig > XclExpCompConfigMap;
- typedef ::std::list< XclExpCompData > XclExpCompDataList;
+ typedef ScfRef< XclExpCompData > XclExpCompDataRef;
+ typedef ::std::vector< XclExpCompDataRef > XclExpCompDataVector;
XclExpCompConfigMap maCfgMap; /// Compiler configuration map for all formula types.
XclFunctionProvider maFuncProv; /// Excel function data provider.
- XclExpCompDataList maCompDataList; /// List for working data, when compiler is called recursively.
+ XclExpCompDataRef mxData; /// Working data for current formula.
+ XclExpCompDataVector maDataStack; /// Stack for working data, when compiler is called recursively.
const XclBiff meBiff; /// Cached BIFF version to save GetBiff() calls.
const SCsCOL mnMaxAbsCol; /// Maximum column index.
const SCsROW mnMaxAbsRow; /// Maximum row index.
@@ -430,31 +495,8 @@ private:
const SCsROW mnMaxScRow; /// Maximum row index in Calc itself.
const sal_uInt16 mnMaxColMask; /// Mask to delete invalid bits in column fields.
const sal_uInt16 mnMaxRowMask; /// Mask to delete invalid bits in row fields.
- bool mbRunning; /// true = compiler already running (for recursive calls).
-};
-
-// ----------------------------------------------------------------------------
-
-namespace {
-
-/** The table containing configuration data for all formula types. */
-static const XclExpCompConfig spConfigTable[] =
-{
- // formula type token class type link manager type inCell 3dOnly allowArray
- { EXC_FMLATYPE_CELL, EXC_CLASSTYPE_CELL, EXC_LINKMGRTYPE_LOCAL, true, false, true },
- { EXC_FMLATYPE_SHARED, EXC_CLASSTYPE_CELL, EXC_LINKMGRTYPE_LOCAL, true, false, true },
- { EXC_FMLATYPE_MATRIX, EXC_CLASSTYPE_ARRAY, EXC_LINKMGRTYPE_LOCAL, true, false, true },
- { EXC_FMLATYPE_CONDFMT, EXC_CLASSTYPE_ARRAY, EXC_LINKMGRTYPE_NONE, false, false, false },
- { EXC_FMLATYPE_DATAVAL, EXC_CLASSTYPE_ARRAY, EXC_LINKMGRTYPE_NONE, false, false, false },
- { EXC_FMLATYPE_NAME, EXC_CLASSTYPE_NAME, EXC_LINKMGRTYPE_GLOBAL, false, true, true },
- { EXC_FMLATYPE_CHART, EXC_CLASSTYPE_NAME, EXC_LINKMGRTYPE_LOCAL, false, true, true },
- { EXC_FMLATYPE_CONTROL, EXC_CLASSTYPE_NAME, EXC_LINKMGRTYPE_LOCAL, false, false, false },
- { EXC_FMLATYPE_WQUERY, EXC_CLASSTYPE_NAME, EXC_LINKMGRTYPE_LOCAL, false, true, false },
- { EXC_FMLATYPE_LISTVAL, EXC_CLASSTYPE_NAME, EXC_LINKMGRTYPE_NONE, false, false, false }
};
-} // namespace
-
// ----------------------------------------------------------------------------
XclExpFmlaCompImpl::XclExpFmlaCompImpl( const XclExpRoot& rRoot ) :
@@ -466,8 +508,7 @@ XclExpFmlaCompImpl::XclExpFmlaCompImpl( const XclExpRoot& rRoot ) :
mnMaxScCol( static_cast< SCsCOL >( rRoot.GetScMaxPos().Col() ) ),
mnMaxScRow( static_cast< SCsROW >( rRoot.GetScMaxPos().Row() ) ),
mnMaxColMask( static_cast< sal_uInt16 >( rRoot.GetXclMaxPos().Col() ) ),
- mnMaxRowMask( static_cast< sal_uInt16 >( rRoot.GetXclMaxPos().Row() ) ),
- mbRunning( false )
+ mnMaxRowMask( static_cast< sal_uInt16 >( rRoot.GetXclMaxPos().Row() ) )
{
// build the configuration map
for( const XclExpCompConfig* pEntry = spConfigTable; pEntry != STATIC_TABLE_END( spConfigTable ); ++pEntry )
@@ -481,9 +522,9 @@ XclTokenArrayRef XclExpFmlaCompImpl::CreateFormula( XclFormulaType eType,
Init( eType, rScTokArr, pScBasePos, pRefLog );
// start compilation, if initialization didn't fail
- if( mbOk )
+ if( mxData->mbOk )
{
- XclExpTokenData aTokData( GetNextToken() );
+ XclExpScToken aTokData( GetNextToken() );
USHORT nScError = rScTokArr.GetCodeError();
if( (nScError != 0) && (!aTokData.Is() || (aTokData.GetOpCode() == ocStop)) )
{
@@ -492,29 +533,28 @@ XclTokenArrayRef XclExpFmlaCompImpl::CreateFormula( XclFormulaType eType,
}
else if( aTokData.Is() )
{
- // expected class is VAL in cell and array formulas, and REF in names
- sal_uInt8 nExpClass = (maCfg.meClassType == EXC_CLASSTYPE_NAME) ? EXC_TOKCLASS_REF : EXC_TOKCLASS_VAL;
- aTokData = Expression( aTokData, nExpClass, false, false );
+ aTokData = Expression( aTokData, false, false );
}
else
{
DBG_ERRORFILE( "XclExpFmlaCompImpl::CreateFormula - empty token array" );
- mbOk = false;
+ mxData->mbOk = false;
}
- if( mbOk )
+ if( mxData->mbOk )
{
// #i44907# auto-generated SUBTOTAL formula cells have trailing ocStop token
- mbOk = !aTokData.Is() || (aTokData.GetOpCode() == ocStop);
- DBG_ASSERT( mbOk, "XclExpFmlaCompImpl::CreateFormula - unknown garbage behind formula" );
+ mxData->mbOk = !aTokData.Is() || (aTokData.GetOpCode() == ocStop);
+ DBG_ASSERT( mxData->mbOk, "XclExpFmlaCompImpl::CreateFormula - unknown garbage behind formula" );
}
}
- // finalizing, e.g. add tAttrVolatile token, and storing any inline arrays
- ScfUInt8Vec aExtensionTokens;
- FinalizeFormula( aExtensionTokens );
+ // finalize (add tAttrVolatile token, calculate all token classes)
+ RecalcTokenClasses();
+ FinalizeFormula();
- return CreateTokenArray( &aExtensionTokens );
+ // leave recursive call, create and return the final token array
+ return CreateTokenArray();
}
XclTokenArrayRef XclExpFmlaCompImpl::CreateErrorFormula( sal_uInt8 nErrCode )
@@ -527,7 +567,7 @@ XclTokenArrayRef XclExpFmlaCompImpl::CreateErrorFormula( sal_uInt8 nErrCode )
XclTokenArrayRef XclExpFmlaCompImpl::CreateSpecialRefFormula( sal_uInt8 nTokenId, const XclAddress& rXclPos )
{
Init( EXC_FMLATYPE_NAME );
- AppendOpTokenId( nTokenId, EXC_TOKCLASS_NONE );
+ AppendOperandTokenId( nTokenId );
Append( rXclPos.mnRow );
Append( rXclPos.mnCol ); // do not use AppendAddress(), we always need 16-bit column here
return CreateTokenArray();
@@ -536,7 +576,7 @@ XclTokenArrayRef XclExpFmlaCompImpl::CreateSpecialRefFormula( sal_uInt8 nTokenId
XclTokenArrayRef XclExpFmlaCompImpl::CreateNameXFormula( sal_uInt16 nExtSheet, sal_uInt16 nExtName )
{
Init( EXC_FMLATYPE_NAME );
- AppendNameXToken( nExtSheet, nExtName, EXC_TOKCLASS_NONE );
+ AppendNameXToken( nExtSheet, nExtName );
return CreateTokenArray();
}
@@ -555,47 +595,13 @@ const XclExpCompConfig* XclExpFmlaCompImpl::GetConfigForType( XclFormulaType eTy
return (aIt == maCfgMap.end()) ? 0 : &aIt->second;
}
-void XclExpFmlaCompImpl::EnterRecursive()
-{
- if( mbRunning )
- // compiler invoked recursively - store old working data
- maCompDataList.push_back( static_cast< const XclExpCompData& >( *this ) );
- else
- mbRunning = true;
-}
-
void XclExpFmlaCompImpl::Init( XclFormulaType eType )
{
// compiler invoked recursively? - store old working data
- EnterRecursive();
-
- // compiler configuration
- const XclExpCompConfig* pCfg = GetConfigForType( eType );
- mbOk = pCfg != 0;
- DBG_ASSERT( mbOk, "XclExpFmlaCompImpl::Init - unknown formula type" );
- if( mbOk )
- {
- // copy config data to own member
- maCfg = *pCfg;
-
- // reset per-formula data
- maTokVec.clear();
- mxOwnScTokArr.reset();
- maTokArrIt.Init();
- mpLinkMgr = 0;
- mpRefLog = 0;
- mxInlineArr.reset();
-
- mpScBasePos = 0;
-
- // init processing data used during compilation
- mnLastTokPos = SAL_MAX_UINT16;
- mnLastDefClass = EXC_TOKCLASS_NONE;
- mbStopAtSep = false;
- mbVolatile = false;
- mbIsArrExp = false;
- SetReplaceTokenClasses(); // initializes the token class variables for AdjustTokenClass()
- }
+ if( mxData.get() )
+ maDataStack.push_back( mxData );
+ // new compiler working data structure
+ mxData.reset( new XclExpCompData( GetConfigForType( eType ) ) );
}
void XclExpFmlaCompImpl::Init( XclFormulaType eType, const ScTokenArray& rScTokArr,
@@ -605,199 +611,222 @@ void XclExpFmlaCompImpl::Init( XclFormulaType eType, const ScTokenArray& rScTokA
Init( eType );
// special initialization
- if( mbOk ) switch( maCfg.meType )
+ if( mxData->mbOk ) switch( mxData->mrCfg.meType )
{
case EXC_FMLATYPE_CELL:
case EXC_FMLATYPE_MATRIX:
case EXC_FMLATYPE_CHART:
- mbOk = pScBasePos != 0;
- DBG_ASSERT( mbOk, "XclExpFmlaCompImpl::Init - missing cell address" );
- mpScBasePos = pScBasePos;
+ mxData->mbOk = pScBasePos != 0;
+ DBG_ASSERT( mxData->mbOk, "XclExpFmlaCompImpl::Init - missing cell address" );
+ mxData->mpScBasePos = pScBasePos;
break;
case EXC_FMLATYPE_SHARED:
- mbOk = pScBasePos != 0;
- DBG_ASSERT( mbOk, "XclExpFmlaCompImpl::Init - missing cell address" );
+ mxData->mbOk = pScBasePos != 0;
+ DBG_ASSERT( mxData->mbOk, "XclExpFmlaCompImpl::Init - missing cell address" );
// clone the passed token array, convert references relative to current cell position
- mxOwnScTokArr.reset( rScTokArr.Clone() );
- ScCompiler::MoveRelWrap( *mxOwnScTokArr, GetDocPtr(), *pScBasePos );
- // don't remember pScBasePos in mpScBasePos, shared formulas use real relative refs
+ mxData->mxOwnScTokArr.reset( rScTokArr.Clone() );
+ ScCompiler::MoveRelWrap( *mxData->mxOwnScTokArr, GetDocPtr(), *pScBasePos, MAXCOL, MAXROW );
+ // don't remember pScBasePos in mxData->mpScBasePos, shared formulas use real relative refs
break;
default:;
}
- if( mbOk )
+ if( mxData->mbOk )
{
// link manager to be used
- switch( maCfg.meLinkMgrType )
- {
- case EXC_LINKMGRTYPE_NONE: mpLinkMgr = 0; break;
- case EXC_LINKMGRTYPE_LOCAL: mpLinkMgr = &GetLocalLinkManager(); break;
- case EXC_LINKMGRTYPE_GLOBAL: mpLinkMgr = &GetGlobalLinkManager(); break;
- }
+ mxData->mpLinkMgr = mxData->mrCfg.mbLocalLinkMgr ? &GetLocalLinkManager() : &GetGlobalLinkManager();
// token array iterator (use cloned token array if present)
- maTokArrIt.Init( mxOwnScTokArr.is() ? *mxOwnScTokArr : rScTokArr, false );
- mpRefLog = pRefLog;
+ mxData->maTokArrIt.Init( mxData->mxOwnScTokArr.is() ? *mxData->mxOwnScTokArr : rScTokArr, false );
+ mxData->mpRefLog = pRefLog;
}
}
-void XclExpFmlaCompImpl::LeaveRecursive()
+void XclExpFmlaCompImpl::RecalcTokenClasses()
{
- mbRunning = !maCompDataList.empty();
- if( mbRunning )
+ if( mxData->mbOk )
{
- // compiler invoked recursively - restore old working data
- static_cast< XclExpCompData& >( *this ) = maCompDataList.back();
- maCompDataList.pop_back();
+ mxData->mbOk = mxData->maOpPosStack.size() == 1;
+ DBG_ASSERT( mxData->mbOk, "XclExpFmlaCompImpl::RecalcTokenClasses - position of root token expected on stack" );
+ if( mxData->mbOk )
+ {
+ /* Cell and array formulas start with VAL conversion and VALTYPE
+ parameter type, defined names start with ARR conversion and
+ REFTYPE parameter type for the root token. */
+ XclExpOperandList aOperands;
+ bool bNameFmla = mxData->mrCfg.meClassType == EXC_CLASSTYPE_NAME;
+ XclFuncParamConv eParamConv = bNameFmla ? EXC_PARAMCONV_ARR : EXC_PARAMCONV_VAL;
+ XclExpClassConv eClassConv = bNameFmla ? EXC_CLASSCONV_ARR : EXC_CLASSCONV_VAL;
+ XclExpTokenConvInfo aConvInfo = { PopOperandPos(), eParamConv, !bNameFmla };
+ RecalcTokenClass( aConvInfo, eParamConv, eClassConv, bNameFmla );
+ }
+
+ // clear operand vectors (calls to the expensive InsertZeros() may follow)
+ mxData->maOpListVec.clear();
+ mxData->maOpPosStack.clear();
}
}
-void XclExpFmlaCompImpl::AppendInlineArrays( ScfUInt8Vec& rExtensionTokens )
+void XclExpFmlaCompImpl::RecalcTokenClass( const XclExpTokenConvInfo& rConvInfo,
+ XclFuncParamConv ePrevConv, XclExpClassConv ePrevClassConv, bool bWasRefClass )
{
- // The const_cast is needed, otherwise MS and Sun compilers can't promote
- // the non-const iterators obtained via ScMatrixList* to const iterators.
- const ScMatrixList* pList = const_cast< const ScMatrixList* >( mxInlineArr.get() );
- for( ScMatrixList::const_reverse_iterator aIt = pList->rbegin(), aEnd = pList->rend(); aIt != aEnd ; ++aIt )
- {
- const ScMatrix* pMatrix = *aIt;
- SCSIZE nC, nMaxC, nR, nMaxR;
+ DBG_ASSERT( rConvInfo.mnTokPos < GetSize(), "XclExpFmlaCompImpl::RecalcTokenClass - invalid token position" );
+ sal_uInt8& rnTokenId = mxData->maTokVec[ rConvInfo.mnTokPos ];
+ sal_uInt8 nTokClass = GetTokenClass( rnTokenId );
- pMatrix->GetDimensions( nMaxC, nMaxR );
+ // REF tokens in VALTYPE parameters behave like VAL tokens
+ if( rConvInfo.mbValType && (nTokClass == EXC_TOKCLASS_REF) )
+ ChangeTokenClass( rnTokenId, nTokClass = EXC_TOKCLASS_VAL );
- if( meBiff == EXC_BIFF8 )
- {
- rExtensionTokens.push_back( sal::static_int_cast<sal_uInt8>( nMaxC - 1 ) );
- rExtensionTokens.resize( rExtensionTokens.size() + 2 );
- ShortToSVBT16( static_cast< USHORT >( nMaxR - 1 ), &*(rExtensionTokens.end() - 2) );
- }
- else
- {
- rExtensionTokens.push_back( static_cast< sal_uInt8 >( (nMaxC == 256) ? 0 : nMaxC ) );
- rExtensionTokens.resize( rExtensionTokens.size() + 2 );
- ShortToSVBT16( static_cast< USHORT >( nMaxR ), &*(rExtensionTokens.end() - 2) );
- }
+ // replace RPO conversion of operator with parent conversion
+ XclFuncParamConv eConv = (rConvInfo.meConv == EXC_PARAMCONV_RPO) ? ePrevConv : rConvInfo.meConv;
- for( nR = 0 ; nR < nMaxR ; nR++)
- {
- for( nC = 0 ; nC < nMaxC ; nC++)
+ // find the effective token class conversion to be performed for this token
+ XclExpClassConv eClassConv = EXC_CLASSCONV_ORG;
+ switch( eConv )
+ {
+ case EXC_PARAMCONV_ORG:
+ // conversion is forced independent of parent conversion
+ eClassConv = EXC_CLASSCONV_ORG;
+ break;
+ case EXC_PARAMCONV_VAL:
+ // conversion is forced independent of parent conversion
+ eClassConv = EXC_CLASSCONV_VAL;
+ break;
+ case EXC_PARAMCONV_ARR:
+ // conversion is forced independent of parent conversion
+ eClassConv = EXC_CLASSCONV_ARR;
+ break;
+ case EXC_PARAMCONV_RPT:
+ switch( ePrevConv )
{
- if( pMatrix->IsValue( nC, nR ) )
- {
- ScMatValType nType;
- const ScMatrixValue* pVal = pMatrix->Get( nC, nR, nType);
-
- if( nType == SC_MATVAL_BOOLEAN )
- {
- rExtensionTokens.push_back( EXC_CACHEDVAL_BOOL );
-
- rExtensionTokens.resize( rExtensionTokens.size() + 8 );
- const bool bVal = ! ::rtl::math::approxEqual( pVal->fVal, 0. );
- UInt32ToSVBT32( bVal ? 1 : 0, &*(rExtensionTokens.end() - 8) );
- UInt32ToSVBT32( 0, &*(rExtensionTokens.end() - 4) );
- }
- else
- {
- USHORT nErr = pVal->GetError();
- if( nErr )
- {
- rExtensionTokens.push_back( EXC_CACHEDVAL_ERROR );
-
- rExtensionTokens.resize( rExtensionTokens.size() + 8 );
- UInt32ToSVBT32( XclTools::GetXclErrorCode ( nErr ),
- &*(rExtensionTokens.end() - 8) );
- UInt32ToSVBT32( 0, &*(rExtensionTokens.end() - 4) );
- }
- else
- {
- rExtensionTokens.push_back( EXC_CACHEDVAL_DOUBLE );
-
- const double nVal = pMatrix->GetDouble( nC, nR );
- rExtensionTokens.resize( rExtensionTokens.size() + 8 );
- DoubleToSVBT64( nVal, &*(rExtensionTokens.end() - 8) );
- }
- }
- }
- else if( pMatrix->IsEmpty( nC, nR ) )
- {
- rExtensionTokens.push_back( EXC_CACHEDVAL_EMPTY );
-
- rExtensionTokens.resize( rExtensionTokens.size() + 8 );
- UInt32ToSVBT32( 0, &*(rExtensionTokens.end() - 8) );
- UInt32ToSVBT32( 0, &*(rExtensionTokens.end() - 4) );
- }
- else if( pMatrix->IsString( nC, nR ) )
- {
- rExtensionTokens.push_back( EXC_CACHEDVAL_STRING );
-
- const String & rString = pMatrix->GetString( nC, nR );
- XclExpStringRef xXclStr = XclExpStringHelper::CreateString(
- GetRoot(), rString,
- ((meBiff == EXC_BIFF8) ? EXC_STR_DEFAULT : EXC_STR_8BITLENGTH),
- EXC_TOK_STR_MAXLEN );
- size_t nSize = rExtensionTokens.size();
- rExtensionTokens.resize( nSize + xXclStr->GetSize() );
- xXclStr->WriteToMem( &rExtensionTokens[ nSize ] );
- }
-
+ case EXC_PARAMCONV_ORG:
+ case EXC_PARAMCONV_VAL:
+ case EXC_PARAMCONV_ARR:
+ /* If parent token has REF class (REF token in REFTYPE
+ function parameter), then RPT does not repeat the
+ previous explicit ORG or ARR conversion, but always
+ falls back to VAL conversion. */
+ eClassConv = bWasRefClass ? EXC_CLASSCONV_VAL : ePrevClassConv;
+ break;
+ case EXC_PARAMCONV_RPT:
+ // nested RPT repeats the previous effective conversion
+ eClassConv = ePrevClassConv;
+ break;
+ case EXC_PARAMCONV_RPX:
+ /* If parent token has REF class (REF token in REFTYPE
+ function parameter), then RPX repeats the previous
+ effective conversion (wich will be either ORG or ARR,
+ but never VAL), otherwise falls back to ORG conversion. */
+ eClassConv = bWasRefClass ? ePrevClassConv : EXC_CLASSCONV_ORG;
+ break;
+ case EXC_PARAMCONV_RPO: // does not occur
+ break;
}
- }
+ break;
+ case EXC_PARAMCONV_RPX:
+ /* If current token still has REF class, set previous effective
+ conversion as current conversion. This will not have an effect
+ on the REF token but is needed for RPT parameters of this
+ function that want to repeat this conversion type. If current
+ token is VAL or ARR class, the previous ARR conversion will be
+ repeated on the token, but VAL conversion will not. */
+ eClassConv = ((nTokClass == EXC_TOKCLASS_REF) || (ePrevClassConv == EXC_CLASSCONV_ARR)) ?
+ ePrevClassConv : EXC_CLASSCONV_ORG;
+ break;
+ case EXC_PARAMCONV_RPO: // does not occur (see above)
+ break;
}
+
+ // do the token class conversion
+ switch( eClassConv )
+ {
+ case EXC_CLASSCONV_ORG:
+ /* Cell formulas: leave the current token class. Cell formulas
+ are the only type of formulas where all tokens can keep
+ their original token class.
+ Array and defined name formulas: convert VAL to ARR. */
+ if( (mxData->mrCfg.meClassType != EXC_CLASSTYPE_CELL) && (nTokClass == EXC_TOKCLASS_VAL) )
+ ChangeTokenClass( rnTokenId, nTokClass = EXC_TOKCLASS_ARR );
+ break;
+ case EXC_CLASSCONV_VAL:
+ // convert ARR to VAL
+ if( nTokClass == EXC_TOKCLASS_ARR )
+ ChangeTokenClass( rnTokenId, nTokClass = EXC_TOKCLASS_VAL );
+ break;
+ case EXC_CLASSCONV_ARR:
+ // convert VAL to ARR
+ if( nTokClass == EXC_TOKCLASS_VAL )
+ ChangeTokenClass( rnTokenId, nTokClass = EXC_TOKCLASS_ARR );
+ break;
+ }
+
+ // do conversion for nested operands, if token is an operator or function
+ if( rConvInfo.mnTokPos < mxData->maOpListVec.size() )
+ if( const XclExpOperandList* pOperands = mxData->maOpListVec[ rConvInfo.mnTokPos ].get() )
+ for( XclExpOperandList::const_iterator aIt = pOperands->begin(), aEnd = pOperands->end(); aIt != aEnd; ++aIt )
+ RecalcTokenClass( *aIt, eConv, eClassConv, nTokClass == EXC_TOKCLASS_REF );
}
-void XclExpFmlaCompImpl::FinalizeFormula( ScfUInt8Vec & rExtensionTokens )
+void XclExpFmlaCompImpl::FinalizeFormula()
{
- if( mbOk )
+ if( mxData->mbOk )
{
// Volatile? Add a tAttrVolatile token at the beginning of the token array.
- if( mbVolatile )
+ if( mxData->mbVolatile )
{
// tAttrSpace token can be extended with volatile flag
if( !IsSpaceToken( 0 ) )
{
- Insert( 0, 4 );
- maTokVec[ 0 ] = EXC_TOKID_ATTR;
+ InsertZeros( 0, 4 );
+ mxData->maTokVec[ 0 ] = EXC_TOKID_ATTR;
}
- maTokVec[ 1 ] |= EXC_TOK_ATTR_VOLATILE;
+ mxData->maTokVec[ 1 ] |= EXC_TOK_ATTR_VOLATILE;
}
// Token array too long? -> error
- mbOk = maTokVec.size() <= EXC_TOKARR_MAXLEN;
-
- // Store any inline arrays
- if( mbOk && mxInlineArr.is() )
- AppendInlineArrays( rExtensionTokens );
+ mxData->mbOk = mxData->maTokVec.size() <= EXC_TOKARR_MAXLEN;
}
- if( !mbOk )
+ if( !mxData->mbOk )
{
// Any unrecoverable error? -> Create a =#NA formula.
- maTokVec.clear();
- mbVolatile = false;
+ mxData->maTokVec.clear();
+ mxData->maExtDataVec.clear();
+ mxData->mbVolatile = false;
AppendErrorToken( EXC_ERR_NA );
}
}
-XclTokenArrayRef XclExpFmlaCompImpl::CreateTokenArray( ScfUInt8Vec* pExtensionTokens )
+XclTokenArrayRef XclExpFmlaCompImpl::CreateTokenArray()
{
- // create the Excel token array object before calling LeaveRecursive()
- XclTokenArrayRef xTokArr( new XclTokenArray( maTokVec, mbVolatile, pExtensionTokens ) );
+ // create the Excel token array from working data before resetting mxData
+ DBG_ASSERT( mxData->mrCfg.mbAllowArrays || mxData->maExtDataVec.empty(), "XclExpFmlaCompImpl::CreateTokenArray - unexpected extended data" );
+ if( !mxData->mrCfg.mbAllowArrays )
+ mxData->maExtDataVec.clear();
+ XclTokenArrayRef xTokArr( new XclTokenArray( mxData->maTokVec, mxData->maExtDataVec, mxData->mbVolatile ) );
+ mxData.reset();
// compiler invoked recursively? - restore old working data
- LeaveRecursive();
+ if( !maDataStack.empty() )
+ {
+ mxData = maDataStack.back();
+ maDataStack.pop_back();
+ }
return xTokArr;
}
// compiler -------------------------------------------------------------------
-const formula::FormulaToken* XclExpFmlaCompImpl::GetNextRawToken()
+const FormulaToken* XclExpFmlaCompImpl::GetNextRawToken()
{
- const formula::FormulaToken* pScToken = maTokArrIt.Get();
- ++maTokArrIt;
+ const FormulaToken* pScToken = mxData->maTokArrIt.Get();
+ ++mxData->maTokArrIt;
return pScToken;
}
-const formula::FormulaToken* XclExpFmlaCompImpl::PeekNextRawToken( bool bSkipSpaces ) const
+const FormulaToken* XclExpFmlaCompImpl::PeekNextRawToken( bool bSkipSpaces ) const
{
/* Returns pointer to next raw token in the token array. The token array
iterator already points to the next token (A call to GetNextToken()
@@ -806,11 +835,11 @@ const formula::FormulaToken* XclExpFmlaCompImpl::PeekNextRawToken( bool bSkipSpa
created and set to the passed skip-spaces mode. If spaces have to be
skipped, and the iterator currently points to a space token, the
constructor will move it to the next non-space token. */
- XclTokenArrayIterator aTempIt( maTokArrIt, bSkipSpaces );
+ XclTokenArrayIterator aTempIt( mxData->maTokArrIt, bSkipSpaces );
return aTempIt.Get();
}
-bool XclExpFmlaCompImpl::GetNextToken( XclExpTokenData& rTokData )
+bool XclExpFmlaCompImpl::GetNextToken( XclExpScToken& rTokData )
{
rTokData.mpScToken = GetNextRawToken();
rTokData.mnSpaces = (rTokData.GetOpCode() == ocSpaces) ? rTokData.mpScToken->GetByte() : 0;
@@ -819,9 +848,9 @@ bool XclExpFmlaCompImpl::GetNextToken( XclExpTokenData& rTokData )
return rTokData.Is();
}
-XclExpTokenData XclExpFmlaCompImpl::GetNextToken()
+XclExpScToken XclExpFmlaCompImpl::GetNextToken()
{
- XclExpTokenData aTokData;
+ XclExpScToken aTokData;
GetNextToken( aTokData );
return aTokData;
}
@@ -919,195 +948,187 @@ inline sal_uInt8 lclGetRangeTokenId( OpCode eOpCode )
} // namespace
-XclExpTokenData XclExpFmlaCompImpl::Expression( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses, bool bStopAtSep )
+XclExpScToken XclExpFmlaCompImpl::Expression( XclExpScToken aTokData, bool bInParentheses, bool bStopAtSep )
{
- if( mbOk && aTokData.Is() )
+ if( mxData->mbOk && aTokData.Is() )
{
// remember old stop-at-ocSep mode, restored below
- bool bOldStopAtSep = mbStopAtSep;
- mbStopAtSep = bStopAtSep;
+ bool bOldStopAtSep = mxData->mbStopAtSep;
+ mxData->mbStopAtSep = bStopAtSep;
// start compilation of the subexpression
- aTokData = OrTerm( aTokData, nExpClass, bInParentheses );
+ aTokData = OrTerm( aTokData, bInParentheses );
// restore old stop-at-ocSep mode
- mbStopAtSep = bOldStopAtSep;
+ mxData->mbStopAtSep = bOldStopAtSep;
}
return aTokData;
}
-XclExpTokenData XclExpFmlaCompImpl::SkipExpression( XclExpTokenData aTokData, bool bStopAtSep )
+XclExpScToken XclExpFmlaCompImpl::SkipExpression( XclExpScToken aTokData, bool bStopAtSep )
{
- while( mbOk && aTokData.Is() && (aTokData.GetOpCode() != ocClose) && (!bStopAtSep || (aTokData.GetOpCode() != ocSep)) )
+ while( mxData->mbOk && aTokData.Is() && (aTokData.GetOpCode() != ocClose) && (!bStopAtSep || (aTokData.GetOpCode() != ocSep)) )
{
if( aTokData.GetOpCode() == ocOpen )
{
aTokData = SkipExpression( GetNextToken(), false );
- if( mbOk ) mbOk = aTokData.GetOpCode() == ocClose;
+ if( mxData->mbOk ) mxData->mbOk = aTokData.GetOpCode() == ocClose;
}
aTokData = GetNextToken();
}
return aTokData;
}
-XclExpTokenData XclExpFmlaCompImpl::OrTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses )
+XclExpScToken XclExpFmlaCompImpl::OrTerm( XclExpScToken aTokData, bool bInParentheses )
{
- aTokData = AndTerm( aTokData, nExpClass, bInParentheses );
+ aTokData = AndTerm( aTokData, bInParentheses );
sal_uInt8 nParamCount = 1;
- while( mbOk && (aTokData.GetOpCode() == ocOr) )
+ while( mxData->mbOk && (aTokData.GetOpCode() == ocOr) )
{
- AdjustLastTokenClassForEastereggOp(); // see comment in this function
RemoveTrailingParen();
- aTokData = AndTerm( GetNextToken(), EXC_TOKCLASS_REF, bInParentheses );
+ aTokData = AndTerm( GetNextToken(), bInParentheses );
RemoveTrailingParen();
++nParamCount;
- if( mbOk ) mbOk = nParamCount <= EXC_FUNC_MAXPARAM;
+ if( mxData->mbOk ) mxData->mbOk = nParamCount <= EXC_FUNC_MAXPARAM;
}
- if( mbOk && (nParamCount > 1) )
- AppendVarFuncTokenId( EXC_FUNCID_OR, EXC_TOKCLASS_VAL, nExpClass, nParamCount );
+ if( mxData->mbOk && (nParamCount > 1) )
+ AppendLogicalOperatorToken( EXC_FUNCID_OR, nParamCount );
return aTokData;
}
-XclExpTokenData XclExpFmlaCompImpl::AndTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses )
+XclExpScToken XclExpFmlaCompImpl::AndTerm( XclExpScToken aTokData, bool bInParentheses )
{
- aTokData = CompareTerm( aTokData, nExpClass, bInParentheses );
+ aTokData = CompareTerm( aTokData, bInParentheses );
sal_uInt8 nParamCount = 1;
- while( mbOk && (aTokData.GetOpCode() == ocAnd) )
+ while( mxData->mbOk && (aTokData.GetOpCode() == ocAnd) )
{
- AdjustLastTokenClassForEastereggOp(); // see comment in this function
RemoveTrailingParen();
- aTokData = CompareTerm( GetNextToken(), EXC_TOKCLASS_REF, bInParentheses );
+ aTokData = CompareTerm( GetNextToken(), bInParentheses );
RemoveTrailingParen();
++nParamCount;
- if( mbOk ) mbOk = nParamCount <= EXC_FUNC_MAXPARAM;
+ if( mxData->mbOk ) mxData->mbOk = nParamCount <= EXC_FUNC_MAXPARAM;
}
- if( mbOk && (nParamCount > 1) )
- AppendVarFuncTokenId( EXC_FUNCID_AND, EXC_TOKCLASS_VAL, nExpClass, nParamCount );
+ if( mxData->mbOk && (nParamCount > 1) )
+ AppendLogicalOperatorToken( EXC_FUNCID_AND, nParamCount );
return aTokData;
}
-XclExpTokenData XclExpFmlaCompImpl::CompareTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses )
+XclExpScToken XclExpFmlaCompImpl::CompareTerm( XclExpScToken aTokData, bool bInParentheses )
{
- aTokData = ConcatTerm( aTokData, nExpClass, bInParentheses );
+ aTokData = ConcatTerm( aTokData, bInParentheses );
sal_uInt8 nOpTokenId = EXC_TOKID_NONE;
- while( mbOk && ((nOpTokenId = lclGetCompareTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
+ while( mxData->mbOk && ((nOpTokenId = lclGetCompareTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
{
- AdjustLastTokenClass( nExpClass | EXC_TOKCLASS_INOP_FLAG );
sal_uInt8 nSpaces = aTokData.mnSpaces;
- aTokData = ConcatTerm( GetNextToken(), nExpClass | EXC_TOKCLASS_INOP_FLAG, bInParentheses );
- AppendOpTokenId( nOpTokenId, nExpClass, nSpaces );
+ aTokData = ConcatTerm( GetNextToken(), bInParentheses );
+ AppendBinaryOperatorToken( nOpTokenId, true, nSpaces );
}
return aTokData;
}
-XclExpTokenData XclExpFmlaCompImpl::ConcatTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses )
+XclExpScToken XclExpFmlaCompImpl::ConcatTerm( XclExpScToken aTokData, bool bInParentheses )
{
- aTokData = AddSubTerm( aTokData, nExpClass, bInParentheses );
+ aTokData = AddSubTerm( aTokData, bInParentheses );
sal_uInt8 nOpTokenId = EXC_TOKID_NONE;
- while( mbOk && ((nOpTokenId = lclGetConcatTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
+ while( mxData->mbOk && ((nOpTokenId = lclGetConcatTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
{
- AdjustLastTokenClass( nExpClass | EXC_TOKCLASS_INOP_FLAG );
sal_uInt8 nSpaces = aTokData.mnSpaces;
- aTokData = AddSubTerm( GetNextToken(), nExpClass | EXC_TOKCLASS_INOP_FLAG, bInParentheses );
- AppendOpTokenId( nOpTokenId, nExpClass, nSpaces );
+ aTokData = AddSubTerm( GetNextToken(), bInParentheses );
+ AppendBinaryOperatorToken( nOpTokenId, true, nSpaces );
}
return aTokData;
}
-XclExpTokenData XclExpFmlaCompImpl::AddSubTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses )
+XclExpScToken XclExpFmlaCompImpl::AddSubTerm( XclExpScToken aTokData, bool bInParentheses )
{
- aTokData = MulDivTerm( aTokData, nExpClass, bInParentheses );
+ aTokData = MulDivTerm( aTokData, bInParentheses );
sal_uInt8 nOpTokenId = EXC_TOKID_NONE;
- while( mbOk && ((nOpTokenId = lclGetAddSubTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
+ while( mxData->mbOk && ((nOpTokenId = lclGetAddSubTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
{
- AdjustLastTokenClass( nExpClass | EXC_TOKCLASS_INOP_FLAG );
sal_uInt8 nSpaces = aTokData.mnSpaces;
- aTokData = MulDivTerm( GetNextToken(), nExpClass | EXC_TOKCLASS_INOP_FLAG, bInParentheses );
- AppendOpTokenId( nOpTokenId, nExpClass, nSpaces );
+ aTokData = MulDivTerm( GetNextToken(), bInParentheses );
+ AppendBinaryOperatorToken( nOpTokenId, true, nSpaces );
}
return aTokData;
}
-XclExpTokenData XclExpFmlaCompImpl::MulDivTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses )
+XclExpScToken XclExpFmlaCompImpl::MulDivTerm( XclExpScToken aTokData, bool bInParentheses )
{
- aTokData = PowTerm( aTokData, nExpClass, bInParentheses );
+ aTokData = PowTerm( aTokData, bInParentheses );
sal_uInt8 nOpTokenId = EXC_TOKID_NONE;
- while( mbOk && ((nOpTokenId = lclGetMulDivTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
+ while( mxData->mbOk && ((nOpTokenId = lclGetMulDivTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
{
- AdjustLastTokenClass( nExpClass | EXC_TOKCLASS_INOP_FLAG );
sal_uInt8 nSpaces = aTokData.mnSpaces;
- aTokData = PowTerm( GetNextToken(), nExpClass | EXC_TOKCLASS_INOP_FLAG, bInParentheses );
- AppendOpTokenId( nOpTokenId, nExpClass, nSpaces );
+ aTokData = PowTerm( GetNextToken(), bInParentheses );
+ AppendBinaryOperatorToken( nOpTokenId, true, nSpaces );
}
return aTokData;
}
-XclExpTokenData XclExpFmlaCompImpl::PowTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses )
+XclExpScToken XclExpFmlaCompImpl::PowTerm( XclExpScToken aTokData, bool bInParentheses )
{
- aTokData = UnaryPostTerm( aTokData, nExpClass, bInParentheses );
+ aTokData = UnaryPostTerm( aTokData, bInParentheses );
sal_uInt8 nOpTokenId = EXC_TOKID_NONE;
- while( mbOk && ((nOpTokenId = lclGetPowTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
+ while( mxData->mbOk && ((nOpTokenId = lclGetPowTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
{
- AdjustLastTokenClass( nExpClass | EXC_TOKCLASS_INOP_FLAG );
sal_uInt8 nSpaces = aTokData.mnSpaces;
- aTokData = UnaryPostTerm( GetNextToken(), nExpClass | EXC_TOKCLASS_INOP_FLAG, bInParentheses );
- AppendOpTokenId( nOpTokenId, nExpClass, nSpaces );
+ aTokData = UnaryPostTerm( GetNextToken(), bInParentheses );
+ AppendBinaryOperatorToken( nOpTokenId, true, nSpaces );
}
return aTokData;
}
-XclExpTokenData XclExpFmlaCompImpl::UnaryPostTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses )
+XclExpScToken XclExpFmlaCompImpl::UnaryPostTerm( XclExpScToken aTokData, bool bInParentheses )
{
- aTokData = UnaryPreTerm( aTokData, nExpClass, bInParentheses );
+ aTokData = UnaryPreTerm( aTokData, bInParentheses );
sal_uInt8 nOpTokenId = EXC_TOKID_NONE;
- while( mbOk && ((nOpTokenId = lclGetUnaryPostTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
+ while( mxData->mbOk && ((nOpTokenId = lclGetUnaryPostTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
{
- AdjustLastTokenClass( nExpClass | EXC_TOKCLASS_INOP_FLAG );
- AppendOpTokenId( nOpTokenId, nExpClass, aTokData.mnSpaces );
+ AppendUnaryOperatorToken( nOpTokenId, aTokData.mnSpaces );
GetNextToken( aTokData );
}
return aTokData;
}
-XclExpTokenData XclExpFmlaCompImpl::UnaryPreTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses )
+XclExpScToken XclExpFmlaCompImpl::UnaryPreTerm( XclExpScToken aTokData, bool bInParentheses )
{
- sal_uInt8 nOpTokenId = mbOk ? lclGetUnaryPreTokenId( aTokData.GetOpCode() ) : EXC_TOKID_NONE;
+ sal_uInt8 nOpTokenId = mxData->mbOk ? lclGetUnaryPreTokenId( aTokData.GetOpCode() ) : EXC_TOKID_NONE;
if( nOpTokenId != EXC_TOKID_NONE )
{
sal_uInt8 nSpaces = aTokData.mnSpaces;
- aTokData = UnaryPreTerm( GetNextToken(), nExpClass | EXC_TOKCLASS_INOP_FLAG, bInParentheses );
- AppendOpTokenId( nOpTokenId, nExpClass, nSpaces );
+ aTokData = UnaryPreTerm( GetNextToken(), bInParentheses );
+ AppendUnaryOperatorToken( nOpTokenId, nSpaces );
}
else
- aTokData = ListTerm( aTokData, nExpClass, bInParentheses );
+ {
+ aTokData = ListTerm( aTokData, bInParentheses );
+ }
return aTokData;
}
-XclExpTokenData XclExpFmlaCompImpl::ListTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool bInParentheses )
+XclExpScToken XclExpFmlaCompImpl::ListTerm( XclExpScToken aTokData, bool bInParentheses )
{
sal_uInt16 nSubExprPos = GetSize();
bool bHasAnyRefOp = false;
bool bHasListOp = false;
- aTokData = IntersectTerm( aTokData, nExpClass, bHasAnyRefOp );
+ aTokData = IntersectTerm( aTokData, bHasAnyRefOp );
sal_uInt8 nOpTokenId = EXC_TOKID_NONE;
- while( mbOk && ((nOpTokenId = lclGetListTokenId( aTokData.GetOpCode(), mbStopAtSep )) != EXC_TOKID_NONE) )
+ while( mxData->mbOk && ((nOpTokenId = lclGetListTokenId( aTokData.GetOpCode(), mxData->mbStopAtSep )) != EXC_TOKID_NONE) )
{
- AdjustLastTokenClass( EXC_TOKCLASS_ANY_IN_REFOP );
sal_uInt8 nSpaces = aTokData.mnSpaces;
- aTokData = IntersectTerm( GetNextToken(), EXC_TOKCLASS_ANY_IN_REFOP, bHasAnyRefOp );
- AppendOpTokenId( nOpTokenId, nExpClass, nSpaces );
+ aTokData = IntersectTerm( GetNextToken(), bHasAnyRefOp );
+ AppendBinaryOperatorToken( nOpTokenId, false, nSpaces );
bHasAnyRefOp = bHasListOp = true;
}
if( bHasAnyRefOp )
{
- // adjust last added token back to REF
- AdjustLastTokenClass( EXC_TOKCLASS_ANY_IN_REFOP );
// add a tMemFunc token enclosing the entire reference subexpression
sal_uInt16 nSubExprSize = GetSize() - nSubExprPos;
- Insert( nSubExprPos, 3 );
- maTokVec[ nSubExprPos ] = GetTokenId( EXC_TOKID_MEMFUNC, EXC_TOKCLASS_REF );
+ InsertZeros( nSubExprPos, 3 );
+ mxData->maTokVec[ nSubExprPos ] = GetTokenId( EXC_TOKID_MEMFUNC, EXC_TOKCLASS_REF );
Overwrite( nSubExprPos + 1, nSubExprSize );
- // adjust the tMemFunc token according to passed expected token class
- mnLastTokPos = nSubExprPos;
- AdjustLastTokenClass( nExpClass );
+ // update the operand/operator stack (set the list expression as operand of the tMemFunc)
+ XclExpOperandListRef xOperands( new XclExpOperandList );
+ xOperands->AppendOperand( PopOperandPos(), EXC_PARAMCONV_VAL, false );
+ PushOperatorPos( nSubExprPos, xOperands );
}
// #i86439# enclose list operator into parentheses, e.g. Calc's =AREAS(A1~A2) to Excel's =AREAS((A1;A2))
if( bHasListOp && !bInParentheses )
@@ -1115,77 +1136,66 @@ XclExpTokenData XclExpFmlaCompImpl::ListTerm( XclExpTokenData aTokData, sal_uInt
return aTokData;
}
-XclExpTokenData XclExpFmlaCompImpl::IntersectTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool& rbHasRefOp )
+XclExpScToken XclExpFmlaCompImpl::IntersectTerm( XclExpScToken aTokData, bool& rbHasRefOp )
{
- aTokData = RangeTerm( aTokData, nExpClass, rbHasRefOp );
+ aTokData = RangeTerm( aTokData, rbHasRefOp );
sal_uInt8 nOpTokenId = EXC_TOKID_NONE;
- while( mbOk && ((nOpTokenId = lclGetIntersectTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
+ while( mxData->mbOk && ((nOpTokenId = lclGetIntersectTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
{
- AdjustLastTokenClass( EXC_TOKCLASS_ANY_IN_REFOP );
sal_uInt8 nSpaces = aTokData.mnSpaces;
- aTokData = RangeTerm( GetNextToken(), EXC_TOKCLASS_ANY_IN_REFOP, rbHasRefOp );
- AppendOpTokenId( nOpTokenId, nExpClass, nSpaces );
+ aTokData = RangeTerm( GetNextToken(), rbHasRefOp );
+ AppendBinaryOperatorToken( nOpTokenId, false, nSpaces );
rbHasRefOp = true;
}
return aTokData;
}
-XclExpTokenData XclExpFmlaCompImpl::RangeTerm( XclExpTokenData aTokData, sal_uInt8 nExpClass, bool& rbHasRefOp )
+XclExpScToken XclExpFmlaCompImpl::RangeTerm( XclExpScToken aTokData, bool& rbHasRefOp )
{
- aTokData = Factor( aTokData, nExpClass );
+ aTokData = Factor( aTokData );
sal_uInt8 nOpTokenId = EXC_TOKID_NONE;
- while( mbOk && ((nOpTokenId = lclGetRangeTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
+ while( mxData->mbOk && ((nOpTokenId = lclGetRangeTokenId( aTokData.GetOpCode() )) != EXC_TOKID_NONE) )
{
- AdjustLastTokenClass( EXC_TOKCLASS_ANY_IN_REFOP );
sal_uInt8 nSpaces = aTokData.mnSpaces;
- aTokData = Factor( GetNextToken(), EXC_TOKCLASS_ANY_IN_REFOP );
- AppendOpTokenId( nOpTokenId, nExpClass, nSpaces );
+ aTokData = Factor( GetNextToken() );
+ AppendBinaryOperatorToken( nOpTokenId, false, nSpaces );
rbHasRefOp = true;
}
return aTokData;
}
-XclExpTokenData XclExpFmlaCompImpl::Factor( XclExpTokenData aTokData, sal_uInt8 nExpClass )
+XclExpScToken XclExpFmlaCompImpl::Factor( XclExpScToken aTokData )
{
- if( !mbOk || !aTokData.Is() ) return XclExpTokenData();
+ if( !mxData->mbOk || !aTokData.Is() ) return XclExpScToken();
- formula::StackVar eTokType = aTokData.GetType();
- OpCode eOpCode = aTokData.GetOpCode();
-
- if (eOpCode == ocExternalRef)
+ switch( aTokData.GetType() )
{
- ProcessExternalName( aTokData, nExpClass );
- return GetNextToken();
- }
-
- switch( eTokType )
- {
- case svUnknown: mbOk = false; break;
- case formula::svDouble: ProcessDouble( aTokData ); break;
- case formula::svString: ProcessString( aTokData ); break;
+ case svUnknown: mxData->mbOk = false; break;
+ case svDouble: ProcessDouble( aTokData ); break;
+ case svString: ProcessString( aTokData ); break;
#if 0 // erAck
- case formula::svError: ProcessError( aTokData ); break;
+ case svError: ProcessError( aTokData ); break;
#endif
- case svSingleRef: ProcessCellRef( aTokData, nExpClass ); break;
- case formula::svDoubleRef: ProcessRangeRef( aTokData, nExpClass ); break;
- case svMatrix: ProcessMatrix( aTokData, nExpClass ); break;
- case svExternal: ProcessExternal( aTokData, nExpClass ); break;
-
- default:
+ case svSingleRef: ProcessCellRef( aTokData ); break;
+ case svDoubleRef: ProcessRangeRef( aTokData ); break;
+ case svExternalSingleRef: ProcessExternalCellRef( aTokData ); break;
+ case svExternalDoubleRef: ProcessExternalRangeRef( aTokData ); break;
+ case svExternalName: ProcessExternalName( aTokData ); break;
+ case svMatrix: ProcessMatrix( aTokData ); break;
+ case svExternal: ProcessExternal( aTokData ); break;
+
+ default: switch( aTokData.GetOpCode() )
{
- switch( eOpCode )
- {
- case ocNone: /* do nothing */ break;
- case ocMissing: ProcessMissing( aTokData ); break;
- case ocBad: ProcessBad( aTokData ); break;
- case ocOpen: ProcessParentheses( aTokData, nExpClass ); break;
- case ocName: ProcessDefinedName( aTokData, nExpClass ); break;
- case ocDBArea: ProcessDatabaseArea( aTokData, nExpClass ); break;
- case ocFalse:
- case ocTrue: ProcessBoolean( aTokData ); break;
- case ocDde: ProcessDdeLink( aTokData, nExpClass ); break;
- default: ProcessFunction( aTokData, nExpClass );
- }
+ case ocNone: /* do nothing */ break;
+ case ocMissing: ProcessMissing( aTokData ); break;
+ case ocBad: ProcessBad( aTokData ); break;
+ case ocOpen: ProcessParentheses( aTokData ); break;
+ case ocName: ProcessDefinedName( aTokData ); break;
+ case ocDBArea: ProcessDatabaseArea( aTokData ); break;
+ case ocFalse:
+ case ocTrue: ProcessBoolean( aTokData ); break;
+ case ocDde: ProcessDdeLink( aTokData ); break;
+ default: ProcessFunction( aTokData );
}
}
@@ -1194,7 +1204,7 @@ XclExpTokenData XclExpFmlaCompImpl::Factor( XclExpTokenData aTokData, sal_uInt8
// formula structure ----------------------------------------------------------
-void XclExpFmlaCompImpl::ProcessDouble( const XclExpTokenData& rTokData )
+void XclExpFmlaCompImpl::ProcessDouble( const XclExpScToken& rTokData )
{
double fValue = rTokData.mpScToken->GetDouble();
double fInt;
@@ -1205,13 +1215,13 @@ void XclExpFmlaCompImpl::ProcessDouble( const XclExpTokenData& rTokData )
AppendNumToken( fValue, rTokData.mnSpaces );
}
-void XclExpFmlaCompImpl::ProcessString( const XclExpTokenData& rTokData )
+void XclExpFmlaCompImpl::ProcessString( const XclExpScToken& rTokData )
{
- AppendOpTokenId( EXC_TOKID_STR, EXC_TOKCLASS_NONE, rTokData.mnSpaces );
+ AppendOperandTokenId( EXC_TOKID_STR, rTokData.mnSpaces );
Append( rTokData.mpScToken->GetString() );
}
-void XclExpFmlaCompImpl::ProcessError( const XclExpTokenData& rTokData )
+void XclExpFmlaCompImpl::ProcessError( const XclExpScToken& rTokData )
{
#if 0 // erAck
AppendErrorToken( XclTools::GetXclErrorCode( rTokData.mpScToken->GetError() ), rTokData.mnSpaces );
@@ -1220,36 +1230,36 @@ void XclExpFmlaCompImpl::ProcessError( const XclExpTokenData& rTokData )
#endif
}
-void XclExpFmlaCompImpl::ProcessMissing( const XclExpTokenData& rTokData )
+void XclExpFmlaCompImpl::ProcessMissing( const XclExpScToken& rTokData )
{
AppendMissingToken( rTokData.mnSpaces );
}
-void XclExpFmlaCompImpl::ProcessBad( const XclExpTokenData& rTokData )
+void XclExpFmlaCompImpl::ProcessBad( const XclExpScToken& rTokData )
{
AppendErrorToken( EXC_ERR_NA, rTokData.mnSpaces );
}
-void XclExpFmlaCompImpl::ProcessParentheses( const XclExpTokenData& rTokData, sal_uInt8 nExpClass )
+void XclExpFmlaCompImpl::ProcessParentheses( const XclExpScToken& rTokData )
{
- XclExpTokenData aTokData( Expression( GetNextToken(), nExpClass, true, false ) );
- mbOk = aTokData.GetOpCode() == ocClose;
+ XclExpScToken aTokData = Expression( GetNextToken(), true, false );
+ mxData->mbOk = aTokData.GetOpCode() == ocClose;
AppendParenToken( rTokData.mnSpaces, aTokData.mnSpaces );
}
-void XclExpFmlaCompImpl::ProcessBoolean( const XclExpTokenData& rTokData )
+void XclExpFmlaCompImpl::ProcessBoolean( const XclExpScToken& rTokData )
{
- mbOk = GetNextToken().GetOpCode() == ocOpen;
- if( mbOk ) mbOk = GetNextToken().GetOpCode() == ocClose;
- if( mbOk )
+ mxData->mbOk = GetNextToken().GetOpCode() == ocOpen;
+ if( mxData->mbOk ) mxData->mbOk = GetNextToken().GetOpCode() == ocClose;
+ if( mxData->mbOk )
AppendBoolToken( rTokData.GetOpCode() == ocTrue, rTokData.mnSpaces );
}
namespace {
-inline bool lclGetTokenString( String& rString, const XclExpTokenData& rTokData )
+inline bool lclGetTokenString( String& rString, const XclExpScToken& rTokData )
{
- bool bIsStr = (rTokData.GetType() == formula::svString) && (rTokData.GetOpCode() == ocPush);
+ bool bIsStr = (rTokData.GetType() == svString) && (rTokData.GetOpCode() == ocPush);
if( bIsStr )
rString = rTokData.mpScToken->GetString();
return bIsStr;
@@ -1257,169 +1267,113 @@ inline bool lclGetTokenString( String& rString, const XclExpTokenData& rTokData
} // namespace
-void XclExpFmlaCompImpl::ProcessDdeLink( const XclExpTokenData& rTokData, sal_uInt8 nExpClass )
+void XclExpFmlaCompImpl::ProcessDdeLink( const XclExpScToken& rTokData )
{
String aApplic, aTopic, aItem;
- mbOk = GetNextToken().GetOpCode() == ocOpen;
- if( mbOk ) mbOk = lclGetTokenString( aApplic, GetNextToken() );
- if( mbOk ) mbOk = GetNextToken().GetOpCode() == ocSep;
- if( mbOk ) mbOk = lclGetTokenString( aTopic, GetNextToken() );
- if( mbOk ) mbOk = GetNextToken().GetOpCode() == ocSep;
- if( mbOk ) mbOk = lclGetTokenString( aItem, GetNextToken() );
- if( mbOk ) mbOk = GetNextToken().GetOpCode() == ocClose;
- if( mbOk ) mbOk = aApplic.Len() && aTopic.Len() && aItem.Len();
- if( mbOk )
+ mxData->mbOk = GetNextToken().GetOpCode() == ocOpen;
+ if( mxData->mbOk ) mxData->mbOk = lclGetTokenString( aApplic, GetNextToken() );
+ if( mxData->mbOk ) mxData->mbOk = GetNextToken().GetOpCode() == ocSep;
+ if( mxData->mbOk ) mxData->mbOk = lclGetTokenString( aTopic, GetNextToken() );
+ if( mxData->mbOk ) mxData->mbOk = GetNextToken().GetOpCode() == ocSep;
+ if( mxData->mbOk ) mxData->mbOk = lclGetTokenString( aItem, GetNextToken() );
+ if( mxData->mbOk ) mxData->mbOk = GetNextToken().GetOpCode() == ocClose;
+ if( mxData->mbOk ) mxData->mbOk = aApplic.Len() && aTopic.Len() && aItem.Len();
+ if( mxData->mbOk )
{
sal_uInt16 nExtSheet, nExtName;
- if( mpLinkMgr && mpLinkMgr->InsertDde( nExtSheet, nExtName, aApplic, aTopic, aItem ) )
- AppendNameXToken( nExtSheet, nExtName, nExpClass, rTokData.mnSpaces );
+ if( mxData->mpLinkMgr && mxData->mpLinkMgr->InsertDde( nExtSheet, nExtName, aApplic, aTopic, aItem ) )
+ AppendNameXToken( nExtSheet, nExtName, rTokData.mnSpaces );
else
AppendErrorToken( EXC_ERR_NA, rTokData.mnSpaces );
}
}
-void XclExpFmlaCompImpl::ProcessExternal( const XclExpTokenData& rTokData, sal_uInt8 nExpClass )
+void XclExpFmlaCompImpl::ProcessExternal( const XclExpScToken& rTokData )
{
/* #i47228# Excel import generates svExternal/ocMacro tokens for invalid
names and for external/invalid function calls. This function looks for
the next token in the token array. If it is an opening parenthesis, the
token is processed as external function call, otherwise as undefined name. */
- const formula::FormulaToken* pNextScToken = PeekNextRawToken( true );
+ const FormulaToken* pNextScToken = PeekNextRawToken( true );
if( !pNextScToken || (pNextScToken->GetOpCode() != ocOpen) )
- AppendMissingNameToken( rTokData.mpScToken->GetExternal(), nExpClass, rTokData.mnSpaces );
+ AppendMissingNameToken( rTokData.mpScToken->GetExternal(), rTokData.mnSpaces );
else
- ProcessFunction( rTokData, nExpClass );
+ ProcessFunction( rTokData );
}
-void XclExpFmlaCompImpl::ProcessExternalName( const XclExpTokenData& rTokData, sal_uInt8 nExpClass )
+void XclExpFmlaCompImpl::ProcessMatrix( const XclExpScToken& rTokData )
{
- StackVar eType = rTokData.GetType();
-
- ScExternalRefManager* pRefMgr = GetDoc().GetExternalRefManager();
- USHORT nFileId = rTokData.mpScToken->GetIndex();
- switch (eType)
+ const ScMatrix* pMatrix = static_cast< const ScToken* >( rTokData.mpScToken )->GetMatrix();
+ if( pMatrix && mxData->mrCfg.mbAllowArrays )
{
- case svExternalSingleRef:
- {
- if (!mpScBasePos)
- {
- AppendErrorToken(EXC_ERR_REF, rTokData.mnSpaces);
- break;
- }
- ScSingleRefData aRef(static_cast<const ScToken*>(rTokData.mpScToken)->GetSingleRef());
- aRef.CalcAbsIfRel(*mpScBasePos);
- const String& rTabName = rTokData.mpScToken->GetString();
- ScExternalRefCache::TokenRef p = pRefMgr->getSingleRefToken(nFileId, rTabName, ScAddress(aRef.nCol, aRef.nRow, aRef.nTab), NULL, NULL);
- if (!p.get())
- {
- AppendErrorToken(EXC_ERR_REF, rTokData.mnSpaces);
- break;
- }
+ SCSIZE nScCols, nScRows;
+ pMatrix->GetDimensions( nScCols, nScRows );
+ DBG_ASSERT( (nScCols > 0) && (nScRows > 0), "XclExpFmlaCompImpl::ProcessMatrix - invalid matrix size" );
+ sal_uInt16 nCols = ::limit_cast< sal_uInt16 >( nScCols, 0, 256 );
+ sal_uInt16 nRows = ::limit_cast< sal_uInt16 >( nScRows, 0, 1024 );
- mpLinkMgr->StoreCell(nFileId, rTabName, aRef);
-
- XclAddress aXclPos(ScAddress::UNINITIALIZED);
- ConvertRefData(aRef, aXclPos, false, false, false);
-
- sal_uInt16 nExtSheet, nFirstSBTab, nLastSBTab;
- mpLinkMgr->FindExtSheet(nFileId, rTabName, 1, nExtSheet, nFirstSBTab, nLastSBTab, GetNewRefLogEntry());
- sal_uInt8 nBaseId = lclIsRefDel2D(aRef) ? EXC_TOKID_REFERR3D : EXC_TOKID_REF3D;
- AppendOpTokenId(GetTokenId(nBaseId, EXC_TOKCLASS_REF), nExpClass, rTokData.mnSpaces);
- Append(nExtSheet);
- if (meBiff <= EXC_BIFF5)
- {
- Append(0, 8);
- Append(static_cast<sal_uInt16>(nFirstSBTab));
- Append(static_cast<sal_uInt16>(nFirstSBTab));
- }
- AppendAddress(aXclPos);
- }
- break;
- case svExternalDoubleRef:
- {
- if (!mpScBasePos)
- {
- AppendErrorToken(XclTools::GetXclErrorCode(errNoRef), rTokData.mnSpaces);
- break;
- }
- ScComplexRefData aRef(static_cast<const ScToken*>(rTokData.mpScToken)->GetDoubleRef());
- aRef.CalcAbsIfRel(*mpScBasePos);
- const String& rTabName = rTokData.mpScToken->GetString();
- const ScSingleRefData& r1 = aRef.Ref1;
- const ScSingleRefData& r2 = aRef.Ref2;
- ScRange aRange(r1.nCol, r1.nRow, r1.nTab, r2.nCol, r2.nRow, r2.nTab);
- ScExternalRefCache::TokenArrayRef pArray = pRefMgr->getDoubleRefTokens(nFileId, rTabName, aRange, NULL);
- if (!pArray.get())
- {
- AppendErrorToken(EXC_ERR_REF, rTokData.mnSpaces);
- break;
- }
+ // create the tArray token
+ AppendOperandTokenId( GetTokenId( EXC_TOKID_ARRAY, EXC_TOKCLASS_ARR ), rTokData.mnSpaces );
+ Append( static_cast< sal_uInt8 >( (meBiff == EXC_BIFF8) ? (nCols - 1) : nCols ) );
+ Append( static_cast< sal_uInt16 >( (meBiff == EXC_BIFF8) ? (nRows - 1) : nRows ) );
+ Append( static_cast< sal_uInt32 >( 0 ) );
- mpLinkMgr->StoreCellRange(nFileId, rTabName, aRef);
- XclRange aXclRange(ScAddress::UNINITIALIZED);
- ConvertRefData(aRef, aXclRange, false);
- sal_uInt16 nExtSheet, nFirstSBTab, nLastSBTab;
- sal_uInt16 nTabSpan = r2.nTab - r1.nTab + 1;
- mpLinkMgr->FindExtSheet(nFileId, rTabName, nTabSpan, nExtSheet, nFirstSBTab, nLastSBTab, GetNewRefLogEntry());
-
- sal_uInt8 nBaseId = lclIsRefDel2D(aRef) ? EXC_TOKID_AREAERR3D : EXC_TOKID_AREA3D;
- AppendOpTokenId(GetTokenId( nBaseId, EXC_TOKCLASS_REF ), nExpClass, rTokData.mnSpaces);
- Append(nExtSheet);
- if (meBiff <= EXC_BIFF5)
- {
- Append(0, 8);
- Append(static_cast<sal_uInt16>(nFirstSBTab));
- Append(static_cast<sal_uInt16>(nLastSBTab));
- }
- AppendRange(aXclRange);
- }
- break;
- case svExternalName:
+ // create the extended data containing the array values
+ AppendExt( static_cast< sal_uInt8 >( (meBiff == EXC_BIFF8) ? (nCols - 1) : nCols ) );
+ AppendExt( static_cast< sal_uInt16 >( (meBiff == EXC_BIFF8) ? (nRows - 1) : nRows ) );
+ for( SCSIZE nScRow = 0; nScRow < nScRows; ++nScRow )
{
- const String& aName = rTokData.mpScToken->GetString();
- ScExternalRefCache::TokenArrayRef pArray = pRefMgr->getRangeNameTokens(nFileId, aName);
- if (!pArray.get() || !mpScBasePos)
+ for( SCSIZE nScCol = 0; nScCol < nScCols; ++nScCol )
{
- AppendErrorToken(XclTools::GetXclErrorCode(errNoName), rTokData.mnSpaces);
- break;
- }
-
- // Go through all these tokens to store the external cell/range
- // references for CRN records.
- for (formula::FormulaToken* p = pArray->First(); p; p = pArray->Next())
- {
- if (p->GetOpCode() == ocExternalRef)
+ ScMatValType nType;
+ const ScMatrixValue* pMatVal = pMatrix->Get( nScCol, nScRow, nType );
+ DBG_ASSERT( pMatVal, "XclExpFmlaCompImpl::ProcessMatrix - missing matrix value" );
+ if( ScMatrix::IsValueType( nType ) ) // value, boolean, or error
{
- if (p->GetType() == svExternalSingleRef)
+ if( ScMatrix::IsBooleanType( nType ) )
{
- ScSingleRefData aData(static_cast<ScToken*>(p)->GetSingleRef());
- aData.CalcAbsIfRel(*mpScBasePos);
- mpLinkMgr->StoreCell(nFileId, p->GetString(), aData);
+ AppendExt( EXC_CACHEDVAL_BOOL );
+ AppendExt( static_cast< sal_uInt8 >( pMatVal->GetBoolean() ? 1 : 0 ) );
+ AppendExt( 0, 7 );
}
- else if (p->GetType() == svExternalDoubleRef)
+ else if( USHORT nErr = pMatVal->GetError() )
{
- ScComplexRefData aData(static_cast<ScToken*>(p)->GetDoubleRef());
- aData.CalcAbsIfRel(*mpScBasePos);
- mpLinkMgr->StoreCellRange(nFileId, p->GetString(), aData);
+ AppendExt( EXC_CACHEDVAL_ERROR );
+ AppendExt( XclTools::GetXclErrorCode( nErr ) );
+ AppendExt( 0, 7 );
+ }
+ else
+ {
+ AppendExt( EXC_CACHEDVAL_DOUBLE );
+ AppendExt( pMatVal->fVal );
+ }
+ }
+ else // string or empty
+ {
+ const String& rStr = pMatVal->GetString();
+ if( rStr.Len() == 0 )
+ {
+ AppendExt( EXC_CACHEDVAL_EMPTY );
+ AppendExt( 0, 8 );
+ }
+ else
+ {
+ AppendExt( EXC_CACHEDVAL_STRING );
+ AppendExt( rStr );
}
}
}
-
- const String* pFile = pRefMgr->getExternalFileName(nFileId);
- sal_uInt16 nExtSheet, nExtName;
- if (mpLinkMgr->InsertExtName(nExtSheet, nExtName, *pFile, aName, pArray))
- AppendNameXToken(nExtSheet, nExtName, nExpClass, rTokData.mnSpaces);
- else
- AppendErrorToken(EXC_ERR_REF, rTokData.mnSpaces);
}
- break;
- default:
- ; // nothing
+ }
+ else
+ {
+ // array in places that do not allow it (cond fmts, data validation)
+ AppendErrorToken( EXC_ERR_NA, rTokData.mnSpaces );
}
}
-void XclExpFmlaCompImpl::ProcessFunction( const XclExpTokenData& rTokData, sal_uInt8 nExpClass )
+void XclExpFmlaCompImpl::ProcessFunction( const XclExpScToken& rTokData )
{
OpCode eOpCode = rTokData.GetOpCode();
const XclFunctionInfo* pFuncInfo = maFuncProv.GetFuncInfoFromOpCode( eOpCode );
@@ -1437,15 +1391,15 @@ void XclExpFmlaCompImpl::ProcessFunction( const XclExpTokenData& rTokData, sal_u
}
}
- mbOk = pFuncInfo != 0;
- if( !mbOk ) return;
+ mxData->mbOk = pFuncInfo != 0;
+ if( !mxData->mbOk ) return;
// functions simulated by a macro call in file format
if( pFuncInfo->IsMacroFunc() )
aExtFuncData.Set( pFuncInfo->GetMacroFuncName(), false, true );
- XclExpFuncData aFuncData( rTokData, *pFuncInfo, aExtFuncData, nExpClass );
- XclExpTokenData aTokData;
+ XclExpFuncData aFuncData( rTokData, *pFuncInfo, aExtFuncData );
+ XclExpScToken aTokData;
// preparations for special functions, before function processing starts
PrepareFunction( aFuncData );
@@ -1455,12 +1409,12 @@ void XclExpFmlaCompImpl::ProcessFunction( const XclExpTokenData& rTokData, sal_u
while( eState != STATE_END ) switch( eState )
{
case STATE_START:
- mbOk = GetNextToken( aTokData ) && (aTokData.GetOpCode() == ocOpen);
- eState = mbOk ? STATE_OPEN : STATE_END;
+ mxData->mbOk = GetNextToken( aTokData ) && (aTokData.GetOpCode() == ocOpen);
+ eState = mxData->mbOk ? STATE_OPEN : STATE_END;
break;
case STATE_OPEN:
- mbOk = GetNextToken( aTokData );
- eState = mbOk ? ((aTokData.GetOpCode() == ocClose) ? STATE_CLOSE : STATE_PARAM) : STATE_END;
+ mxData->mbOk = GetNextToken( aTokData );
+ eState = mxData->mbOk ? ((aTokData.GetOpCode() == ocClose) ? STATE_CLOSE : STATE_PARAM) : STATE_END;
break;
case STATE_PARAM:
aTokData = ProcessParam( aTokData, aFuncData );
@@ -1468,13 +1422,13 @@ void XclExpFmlaCompImpl::ProcessFunction( const XclExpTokenData& rTokData, sal_u
{
case ocSep: eState = STATE_SEP; break;
case ocClose: eState = STATE_CLOSE; break;
- default: mbOk = false;
+ default: mxData->mbOk = false;
}
- if( !mbOk ) eState = STATE_END;
+ if( !mxData->mbOk ) eState = STATE_END;
break;
case STATE_SEP:
- mbOk = (aFuncData.GetParamCount() < EXC_FUNC_MAXPARAM) && GetNextToken( aTokData );
- eState = mbOk ? STATE_PARAM : STATE_END;
+ mxData->mbOk = (aFuncData.GetParamCount() < EXC_FUNC_MAXPARAM) && GetNextToken( aTokData );
+ eState = mxData->mbOk ? STATE_PARAM : STATE_END;
break;
case STATE_CLOSE:
FinishFunction( aFuncData, aTokData.mnSpaces );
@@ -1506,11 +1460,8 @@ void XclExpFmlaCompImpl::FinishFunction( XclExpFuncData& rFuncData, sal_uInt8 nC
// check if parameter count fits into the limits of the function
sal_uInt8 nParamCount = rFuncData.GetParamCount();
- sal_uInt8 nMinCount = rFuncData.GetMinParamCount();
- sal_uInt8 nMaxCount = rFuncData.GetMaxParamCount();
- if( (nMinCount <= nParamCount) && (nParamCount <= nMaxCount) )
+ if( (rFuncData.GetMinParamCount() <= nParamCount) && (nParamCount <= rFuncData.GetMaxParamCount()) )
{
- sal_uInt16 nXclFuncIdx = rFuncData.GetXclFuncIdx();
// first put the tAttrSpace tokens, they must not be included in tAttrGoto handling
AppendSpaceToken( EXC_TOK_ATTR_SPACE_SP_CLOSE, nCloseSpaces );
AppendSpaceToken( EXC_TOK_ATTR_SPACE_SP, rFuncData.GetSpaces() );
@@ -1526,31 +1477,10 @@ void XclExpFmlaCompImpl::FinishFunction( XclExpFuncData& rFuncData, sal_uInt8 nC
}
// put the tFunc or tFuncVar token (or another special token, e.g. tAttrSum)
- sal_uInt8 nRetClass = rFuncData.GetReturnClass();
- sal_uInt8 nExpRetClass = rFuncData.GetExpReturnClass();
- if( (nXclFuncIdx == EXC_FUNCID_SUM) && (nParamCount == 1) )
- {
- // SUM with only one parameter
- AppendOpTokenId( EXC_TOKID_ATTR, nExpRetClass );
- Append( EXC_TOK_ATTR_SUM );
- Append( sal_uInt16( 0 ) );
- }
- else if( (nMinCount == nMaxCount) && (nXclFuncIdx != EXC_FUNCID_EXTERNCALL) )
- {
- // fixed number of parameters
- AppendOpTokenId( GetTokenId( EXC_TOKID_FUNC, nRetClass ), nExpRetClass );
- Append( nXclFuncIdx );
- }
- else
- {
- // variable number of parameters
- AppendOpTokenId( GetTokenId( EXC_TOKID_FUNCVAR, nRetClass ), nExpRetClass );
- Append( nParamCount );
- Append( nXclFuncIdx );
- }
+ AppendFuncToken( rFuncData );
// update volatile flag - is set if at least one used function is volatile
- mbVolatile |= rFuncData.IsVolatile();
+ mxData->mbVolatile |= rFuncData.IsVolatile();
// update jump tokens for specific functions, add additional tokens
switch( rFuncData.GetOpCode() )
@@ -1564,11 +1494,11 @@ void XclExpFmlaCompImpl::FinishFunction( XclExpFuncData& rFuncData, sal_uInt8 nC
case ocCot: // simulate COT(x) by (1/TAN(x))
case ocCotHyp: // simulate COTH(x) by (1/TANH(x))
- AppendOpTokenId( EXC_TOKID_DIV, EXC_TOKCLASS_NONE );
+ AppendBinaryOperatorToken( EXC_TOKID_DIV, true );
AppendParenToken();
break;
case ocArcCot: // simulate ACOT(x) by (PI/2-ATAN(x))
- AppendOpTokenId( EXC_TOKID_SUB, EXC_TOKCLASS_NONE );
+ AppendBinaryOperatorToken( EXC_TOKID_SUB, true );
AppendParenToken();
break;
@@ -1576,7 +1506,7 @@ void XclExpFmlaCompImpl::FinishFunction( XclExpFuncData& rFuncData, sal_uInt8 nC
}
}
else
- mbOk = false;
+ mxData->mbOk = false;
}
void XclExpFmlaCompImpl::FinishIfFunction( XclExpFuncData& rFuncData )
@@ -1607,7 +1537,7 @@ void XclExpFmlaCompImpl::FinishChooseFunction( XclExpFuncData& rFuncData )
// size of jump table: number of choices, plus 1 for error position
sal_uInt16 nJumpArrSize = 2 * (nChoices + 1);
// insert the jump table into the tAttrChoose token
- Insert( nJumpArrPos, nJumpArrSize );
+ InsertZeros( nJumpArrPos, nJumpArrSize );
// update positions of tAttrGoto tokens after jump table insertion
sal_uInt16 nIdx;
for( nIdx = 1; nIdx < nParamCount; ++nIdx )
@@ -1621,25 +1551,20 @@ void XclExpFmlaCompImpl::FinishChooseFunction( XclExpFuncData& rFuncData )
Overwrite( nJumpArrPos + 2 * nIdx, static_cast< sal_uInt16 >( rAttrPos[ nIdx ] + 4 - nJumpArrPos ) );
}
-XclExpTokenData XclExpFmlaCompImpl::ProcessParam( XclExpTokenData aTokData, XclExpFuncData& rFuncData )
+XclExpScToken XclExpFmlaCompImpl::ProcessParam( XclExpScToken aTokData, XclExpFuncData& rFuncData )
{
- if( rFuncData.GetExpParamClass() == EXC_FUNC_PAR_CALCONLY )
+ if( rFuncData.IsCalcOnlyParam() )
{
// skip Calc-only parameter, stop at next ocClose or ocSep
aTokData = SkipExpression( aTokData, true );
- rFuncData.IncExpParamClassIdx();
+ rFuncData.IncParamInfoIdx();
}
else
{
// insert Excel-only parameters, modifies param count and class in rFuncData
- while( rFuncData.GetExpParamClass() == EXC_FUNC_PAR_EXCELONLY )
+ while( rFuncData.IsExcelOnlyParam() )
AppendDefaultParam( rFuncData );
- // propagate expected ARR class to subsequent subexpressions
- sal_uInt8 nExpClass = rFuncData.GetExpParamClass();
- bool bOldIsArrExp = mbIsArrExp;
- UpdateArrExpFlag( nExpClass, rFuncData.GetReturnClass() );
-
// process the parameter, stop at next ocClose or ocSep
PrepareParam( rFuncData );
/* #i37355# insert tMissArg token for missing parameters --
@@ -1649,12 +1574,10 @@ XclExpTokenData XclExpFmlaCompImpl::ProcessParam( XclExpTokenData aTokData, XclE
{
case ocSep:
case ocClose: AppendMissingToken(); break; // empty parameter
- default: aTokData = Expression( aTokData, nExpClass, false, true );
+ default: aTokData = Expression( aTokData, false, true );
}
- // restore old expected ARR class mode
- SetArrExpFlag( bOldIsArrExp );
// finalize the parameter and add special tokens, e.g. for IF or CHOOSE parameters
- if( mbOk ) FinishParam( rFuncData );
+ if( mxData->mbOk ) FinishParam( rFuncData );
}
return aTokData;
}
@@ -1698,21 +1621,18 @@ void XclExpFmlaCompImpl::PrepareParam( XclExpFuncData& rFuncData )
void XclExpFmlaCompImpl::FinishParam( XclExpFuncData& rFuncData )
{
- // index of this parameter is equal to number of already finished parameters
- sal_uInt8 nParamIdx = rFuncData.GetParamCount();
-
- // increase parameter count
- rFuncData.IncParamCount();
- // move to next expected parameter class
- rFuncData.IncExpParamClassIdx();
+ // increase parameter count, update operand stack
+ rFuncData.FinishParam( PopOperandPos() );
+ // append more tokens for parameters of some special functions
+ sal_uInt8 nParamIdx = rFuncData.GetParamCount() - 1;
switch( rFuncData.GetOpCode() )
{
case ocArcCotHyp: // simulate ACOTH(x) by ATANH(1/(x))
if( nParamIdx == 0 )
{
AppendParenToken();
- AppendOpTokenId( EXC_TOKID_DIV, EXC_TOKCLASS_NONE );
+ AppendBinaryOperatorToken( EXC_TOKID_DIV, true );
}
break;
default:;
@@ -1727,19 +1647,19 @@ void XclExpFmlaCompImpl::AppendDefaultParam( XclExpFuncData& rFuncData )
switch( rFuncData.GetOpCode() )
{
case ocExternal:
- AppendAddInFuncToken( rFuncData.GetExtFuncData(), EXC_TOKCLASS_REF );
+ AppendAddInCallToken( rFuncData.GetExtFuncData() );
break;
case ocEuroConvert:
- AppendEuroToolFuncToken( rFuncData.GetExtFuncData(), EXC_TOKCLASS_REF );
+ AppendEuroToolCallToken( rFuncData.GetExtFuncData() );
break;
case ocMacro:
- AppendMacroCallToken( rFuncData.GetExtFuncData(), EXC_TOKCLASS_REF );
+ AppendMacroCallToken( rFuncData.GetExtFuncData() );
break;
default:
{
DBG_ASSERT( rFuncData.IsMacroFunc(), "XclExpFmlaCompImpl::AppendDefaultParam - unknown opcode" );
if( rFuncData.IsMacroFunc() )
- AppendMacroCallToken( rFuncData.GetExtFuncData(), EXC_TOKCLASS_REF );
+ AppendMacroCallToken( rFuncData.GetExtFuncData() );
else
AppendMissingToken(); // to keep parameter count valid
}
@@ -1813,25 +1733,77 @@ void XclExpFmlaCompImpl::AppendTrailingParam( XclExpFuncData& rFuncData )
}
break;
+ case ocNormDist:
+ if( nParamCount == 3 )
+ {
+ // NORMDIST function needs 4 parameters in Excel
+ PrepareParam( rFuncData );
+ AppendBoolToken( true );
+ FinishParam( rFuncData );
+ }
+ break;
+
+ case ocLogNormDist:
+ switch( nParamCount )
+ {
+ // LOGNORMDIST function needs 3 parameters in Excel
+ case 1:
+ PrepareParam( rFuncData );
+ AppendIntToken( 0 );
+ FinishParam( rFuncData );
+ // do not break, add next default parameter
+ case 2:
+ PrepareParam( rFuncData );
+ AppendIntToken( 1 );
+ FinishParam( rFuncData );
+ break;
+ default:;
+ }
+
+ break;
+
default:;
}
}
-// ----------------------------------------------------------------------------
+// reference handling ---------------------------------------------------------
+
+namespace {
+
+inline bool lclIsRefRel2D( const ScSingleRefData& rRefData )
+{
+ return rRefData.IsColRel() || rRefData.IsRowRel();
+}
+
+inline bool lclIsRefDel2D( const ScSingleRefData& rRefData )
+{
+ return rRefData.IsColDeleted() || rRefData.IsRowDeleted();
+}
+
+inline bool lclIsRefRel2D( const ScComplexRefData& rRefData )
+{
+ return lclIsRefRel2D( rRefData.Ref1 ) || lclIsRefRel2D( rRefData.Ref2 );
+}
+
+inline bool lclIsRefDel2D( const ScComplexRefData& rRefData )
+{
+ return lclIsRefDel2D( rRefData.Ref1 ) || lclIsRefDel2D( rRefData.Ref2 );
+}
+
+} // namespace
SCTAB XclExpFmlaCompImpl::GetScTab( const ScSingleRefData& rRefData ) const
{
- bool bInvTab = rRefData.IsTabDeleted() || (!mpScBasePos && rRefData.IsTabRel());
+ bool bInvTab = rRefData.IsTabDeleted() || (!mxData->mpScBasePos && IsInGlobals() && rRefData.IsTabRel());
return bInvTab ? SCTAB_INVALID : static_cast< SCTAB >( rRefData.nTab );
}
bool XclExpFmlaCompImpl::IsRef2D( const ScSingleRefData& rRefData ) const
{
- /* rRefData.IsFlag3D() determines if sheet name is always visible, even on the
- own sheet. If 3D references are allowed, the passed reference does not count
- as 2D reference. If only 2D references are allowed (mpLinkMgr is 0), this
- flag is ignored, thus the passed reference will be handled as 2D reference. */
- return (!mpLinkMgr || !rRefData.IsFlag3D()) && !rRefData.IsTabDeleted() &&
+ /* rRefData.IsFlag3D() determines if sheet name is always visible, even on
+ the own sheet. If 3D references are allowed, the passed reference does
+ not count as 2D reference. */
+ return (!mxData->mpLinkMgr || !rRefData.IsFlag3D()) && !rRefData.IsTabDeleted() &&
(rRefData.IsTabRel() ? (rRefData.nRelTab == 0) : (static_cast< SCTAB >( rRefData.nTab ) == GetCurrScTab()));
}
@@ -1844,10 +1816,10 @@ void XclExpFmlaCompImpl::ConvertRefData(
ScSingleRefData& rRefData, XclAddress& rXclPos,
bool bNatLangRef, bool bTruncMaxCol, bool bTruncMaxRow ) const
{
- if( mpScBasePos )
+ if( mxData->mpScBasePos )
{
// *** reference position exists (cell, matrix) - convert to absolute ***
- rRefData.CalcAbsIfRel( *mpScBasePos );
+ rRefData.CalcAbsIfRel( *mxData->mpScBasePos );
// convert column index
SCsCOL& rnScCol = rRefData.nCol;
@@ -1876,6 +1848,10 @@ void XclExpFmlaCompImpl::ConvertRefData(
// convert row index (2-step-cast ScsROW->sal_Int16->sal_uInt16 to get all bits correctly)
sal_Int16 nXclRelRow = static_cast< sal_Int16 >( rRefData.IsRowRel() ? rRefData.nRelRow : rRefData.nRow );
rXclPos.mnRow = static_cast< sal_uInt16 >( nXclRelRow ) & mnMaxRowMask;
+
+ // resolve relative tab index if possible
+ if( rRefData.IsTabRel() && !IsInGlobals() && (GetCurrScTab() < GetDoc().GetTableCount()) )
+ rRefData.nTab = static_cast< SCsTAB >( GetCurrScTab() + rRefData.nRelTab );
}
// flags for relative column and row
@@ -1905,19 +1881,19 @@ void XclExpFmlaCompImpl::ConvertRefData(
XclExpRefLogEntry* XclExpFmlaCompImpl::GetNewRefLogEntry()
{
- if( mpRefLog )
+ if( mxData->mpRefLog )
{
- mpRefLog->resize( mpRefLog->size() + 1 );
- return &mpRefLog->back();
+ mxData->mpRefLog->resize( mxData->mpRefLog->size() + 1 );
+ return &mxData->mpRefLog->back();
}
return 0;
}
-void XclExpFmlaCompImpl::ProcessCellRef( const XclExpTokenData& rTokData, sal_uInt8 nExpClass )
+void XclExpFmlaCompImpl::ProcessCellRef( const XclExpScToken& rTokData )
{
// get the Excel address components, adjust internal data in aRefData
- bool bNatLangRef = (meBiff == EXC_BIFF8) && mpScBasePos && (rTokData.GetOpCode() == ocColRowName);
- ScSingleRefData aRefData( static_cast<const ScToken*>(rTokData.mpScToken)->GetSingleRef() );
+ bool bNatLangRef = (meBiff == EXC_BIFF8) && mxData->mpScBasePos && (rTokData.GetOpCode() == ocColRowName);
+ ScSingleRefData aRefData = static_cast< const ScToken* >( rTokData.mpScToken )->GetSingleRef();
XclAddress aXclPos( ScAddress::UNINITIALIZED );
ConvertRefData( aRefData, aXclPos, bNatLangRef, false, false );
@@ -1927,33 +1903,33 @@ void XclExpFmlaCompImpl::ProcessCellRef( const XclExpTokenData& rTokData, sal_uI
"XclExpFmlaCompImpl::ProcessCellRef - broken natural language reference" );
// create tNlr token for natural language reference
sal_uInt8 nSubId = aRefData.IsColRel() ? EXC_TOK_NLR_COLV : EXC_TOK_NLR_ROWV;
- AppendOpTokenId( EXC_TOKID_NLR, nExpClass, rTokData.mnSpaces );
+ AppendOperandTokenId( EXC_TOKID_NLR, rTokData.mnSpaces );
Append( nSubId );
AppendAddress( aXclPos );
}
else
{
// store external cell contents in CRN records
- if( maCfg.mbFromCell && mpLinkMgr && mpScBasePos )
- mpLinkMgr->StoreCell( aRefData );
+ if( mxData->mrCfg.mbFromCell && mxData->mpLinkMgr && mxData->mpScBasePos )
+ mxData->mpLinkMgr->StoreCell( aRefData );
// create the tRef, tRefErr, tRefN, tRef3d, or tRefErr3d token
- if( !maCfg.mb3DRefOnly && IsRef2D( aRefData ) )
+ if( !mxData->mrCfg.mb3DRefOnly && IsRef2D( aRefData ) )
{
// 2D reference (not in defined names, but allowed in range lists)
- sal_uInt8 nBaseId = (!mpScBasePos && lclIsRefRel2D( aRefData )) ? EXC_TOKID_REFN :
+ sal_uInt8 nBaseId = (!mxData->mpScBasePos && lclIsRefRel2D( aRefData )) ? EXC_TOKID_REFN :
(lclIsRefDel2D( aRefData ) ? EXC_TOKID_REFERR : EXC_TOKID_REF);
- AppendOpTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), nExpClass, rTokData.mnSpaces );
+ AppendOperandTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), rTokData.mnSpaces );
AppendAddress( aXclPos );
}
- else if( mpLinkMgr ) // 3D reference
+ else if( mxData->mpLinkMgr ) // 3D reference
{
// 1-based EXTERNSHEET index and 0-based Excel sheet index
sal_uInt16 nExtSheet, nXclTab;
- mpLinkMgr->FindExtSheet( nExtSheet, nXclTab, GetScTab( aRefData ), GetNewRefLogEntry() );
+ mxData->mpLinkMgr->FindExtSheet( nExtSheet, nXclTab, GetScTab( aRefData ), GetNewRefLogEntry() );
// write the token
sal_uInt8 nBaseId = lclIsRefDel2D( aRefData ) ? EXC_TOKID_REFERR3D : EXC_TOKID_REF3D;
- AppendOpTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), nExpClass, rTokData.mnSpaces );
+ AppendOperandTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), rTokData.mnSpaces );
Append( nExtSheet );
if( meBiff <= EXC_BIFF5 )
{
@@ -1971,35 +1947,35 @@ void XclExpFmlaCompImpl::ProcessCellRef( const XclExpTokenData& rTokData, sal_uI
}
}
-void XclExpFmlaCompImpl::ProcessRangeRef( const XclExpTokenData& rTokData, sal_uInt8 nExpClass )
+void XclExpFmlaCompImpl::ProcessRangeRef( const XclExpScToken& rTokData )
{
// get the Excel address components, adjust internal data in aRefData
- ScComplexRefData aRefData( static_cast<const ScToken*>(rTokData.mpScToken)->GetDoubleRef() );
+ ScComplexRefData aRefData = static_cast< const ScToken* >( rTokData.mpScToken )->GetDoubleRef();
XclRange aXclRange( ScAddress::UNINITIALIZED );
ConvertRefData( aRefData, aXclRange, false );
// store external cell contents in CRN records
- if( maCfg.mbFromCell && mpLinkMgr && mpScBasePos )
- mpLinkMgr->StoreCellRange( aRefData );
+ if( mxData->mrCfg.mbFromCell && mxData->mpLinkMgr && mxData->mpScBasePos )
+ mxData->mpLinkMgr->StoreCellRange( aRefData );
// create the tArea, tAreaErr, tAreaN, tArea3d, or tAreaErr3d token
- if( !maCfg.mb3DRefOnly && IsRef2D( aRefData ) )
+ if( !mxData->mrCfg.mb3DRefOnly && IsRef2D( aRefData ) )
{
// 2D reference (not in name formulas, but allowed in range lists)
- sal_uInt8 nBaseId = (!mpScBasePos && lclIsRefRel2D( aRefData )) ? EXC_TOKID_AREAN :
+ sal_uInt8 nBaseId = (!mxData->mpScBasePos && lclIsRefRel2D( aRefData )) ? EXC_TOKID_AREAN :
(lclIsRefDel2D( aRefData ) ? EXC_TOKID_AREAERR : EXC_TOKID_AREA);
- AppendOpTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), nExpClass, rTokData.mnSpaces );
+ AppendOperandTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), rTokData.mnSpaces );
AppendRange( aXclRange );
}
- else if( mpLinkMgr ) // 3D reference
+ else if( mxData->mpLinkMgr ) // 3D reference
{
// 1-based EXTERNSHEET index and 0-based Excel sheet indexes
sal_uInt16 nExtSheet, nFirstXclTab, nLastXclTab;
- mpLinkMgr->FindExtSheet( nExtSheet, nFirstXclTab, nLastXclTab,
+ mxData->mpLinkMgr->FindExtSheet( nExtSheet, nFirstXclTab, nLastXclTab,
GetScTab( aRefData.Ref1 ), GetScTab( aRefData.Ref2 ), GetNewRefLogEntry() );
// write the token
sal_uInt8 nBaseId = lclIsRefDel2D( aRefData ) ? EXC_TOKID_AREAERR3D : EXC_TOKID_AREA3D;
- AppendOpTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), nExpClass, rTokData.mnSpaces );
+ AppendOperandTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), rTokData.mnSpaces );
Append( nExtSheet );
if( meBiff <= EXC_BIFF5 )
{
@@ -2016,7 +1992,80 @@ void XclExpFmlaCompImpl::ProcessRangeRef( const XclExpTokenData& rTokData, sal_u
}
}
-void XclExpFmlaCompImpl::ProcessDefinedName( const XclExpTokenData& rTokData, sal_uInt8 nExpClass )
+void XclExpFmlaCompImpl::ProcessExternalCellRef( const XclExpScToken& rTokData )
+{
+ if( mxData->mpLinkMgr )
+ {
+ // get the Excel address components, adjust internal data in aRefData
+ ScSingleRefData aRefData = static_cast< const ScToken* >( rTokData.mpScToken )->GetSingleRef();
+ XclAddress aXclPos( ScAddress::UNINITIALIZED );
+ ConvertRefData( aRefData, aXclPos, false, false, false );
+
+ // store external cell contents in CRN records
+ USHORT nFileId = rTokData.mpScToken->GetIndex();
+ const String& rTabName = rTokData.mpScToken->GetString();
+ if( mxData->mrCfg.mbFromCell && mxData->mpScBasePos )
+ mxData->mpLinkMgr->StoreCell( nFileId, rTabName, aRefData );
+
+ // 1-based EXTERNSHEET index and 0-based Excel sheet indexes
+ sal_uInt16 nExtSheet, nFirstSBTab, nLastSBTab;
+ mxData->mpLinkMgr->FindExtSheet( nFileId, rTabName, 1, nExtSheet, nFirstSBTab, nLastSBTab, GetNewRefLogEntry() );
+ // write the token
+ sal_uInt8 nBaseId = lclIsRefDel2D( aRefData ) ? EXC_TOKID_REFERR3D : EXC_TOKID_REF3D;
+ AppendOperandTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), rTokData.mnSpaces );
+ Append( nExtSheet );
+ if( meBiff <= EXC_BIFF5 )
+ {
+ Append( 0, 8 );
+ Append( nFirstSBTab );
+ Append( nLastSBTab );
+ }
+ AppendAddress( aXclPos );
+ }
+ else
+ {
+ AppendErrorToken( EXC_ERR_REF, rTokData.mnSpaces );
+ }
+}
+
+void XclExpFmlaCompImpl::ProcessExternalRangeRef( const XclExpScToken& rTokData )
+{
+ if( mxData->mpLinkMgr )
+ {
+ // get the Excel address components, adjust internal data in aRefData
+ ScComplexRefData aRefData = static_cast< const ScToken* >( rTokData.mpScToken )->GetDoubleRef();
+ XclRange aXclRange( ScAddress::UNINITIALIZED );
+ ConvertRefData( aRefData, aXclRange, false );
+
+ // store external cell contents in CRN records
+ USHORT nFileId = rTokData.mpScToken->GetIndex();
+ const String& rTabName = rTokData.mpScToken->GetString();
+ if( mxData->mrCfg.mbFromCell && mxData->mpScBasePos )
+ mxData->mpLinkMgr->StoreCellRange( nFileId, rTabName, aRefData );
+
+ // 1-based EXTERNSHEET index and 0-based Excel sheet indexes
+ sal_uInt16 nExtSheet, nFirstSBTab, nLastSBTab;
+ sal_uInt16 nTabSpan = static_cast< sal_uInt16 >( aRefData.Ref2.nTab - aRefData.Ref1.nTab + 1 );
+ mxData->mpLinkMgr->FindExtSheet( nFileId, rTabName, nTabSpan, nExtSheet, nFirstSBTab, nLastSBTab, GetNewRefLogEntry() );
+ // write the token
+ sal_uInt8 nBaseId = lclIsRefDel2D( aRefData ) ? EXC_TOKID_AREAERR3D : EXC_TOKID_AREA3D;
+ AppendOperandTokenId( GetTokenId( nBaseId, EXC_TOKCLASS_REF ), rTokData.mnSpaces );
+ Append( nExtSheet );
+ if( meBiff <= EXC_BIFF5 )
+ {
+ Append( 0, 8 );
+ Append( nFirstSBTab );
+ Append( nLastSBTab );
+ }
+ AppendRange( aXclRange );
+ }
+ else
+ {
+ AppendErrorToken( EXC_ERR_REF, rTokData.mnSpaces );
+ }
+}
+
+void XclExpFmlaCompImpl::ProcessDefinedName( const XclExpScToken& rTokData )
{
XclExpNameManager& rNameMgr = GetNameManager();
sal_uInt16 nNameIdx = rNameMgr.InsertName( rTokData.mpScToken->GetIndex() );
@@ -2024,218 +2073,172 @@ void XclExpFmlaCompImpl::ProcessDefinedName( const XclExpTokenData& rTokData, sa
{
// global names always with tName token, local names dependent on config
SCTAB nScTab = rNameMgr.GetScTab( nNameIdx );
- if( (nScTab == SCTAB_GLOBAL) || (!maCfg.mb3DRefOnly && (nScTab == GetCurrScTab())) )
+ if( (nScTab == SCTAB_GLOBAL) || (!mxData->mrCfg.mb3DRefOnly && (nScTab == GetCurrScTab())) )
{
- AppendNameToken( nNameIdx, nExpClass, rTokData.mnSpaces );
+ AppendNameToken( nNameIdx, rTokData.mnSpaces );
}
- else if( mpLinkMgr )
+ else if( mxData->mpLinkMgr )
{
// use the same special EXTERNNAME to refer to any local name
- sal_uInt16 nExtSheet = mpLinkMgr->FindExtSheet( EXC_EXTSH_OWNDOC );
- AppendNameXToken( nExtSheet, nNameIdx, nExpClass, rTokData.mnSpaces );
+ sal_uInt16 nExtSheet = mxData->mpLinkMgr->FindExtSheet( EXC_EXTSH_OWNDOC );
+ AppendNameXToken( nExtSheet, nNameIdx, rTokData.mnSpaces );
}
else
AppendErrorToken( EXC_ERR_NAME, rTokData.mnSpaces );
// volatile names (containing volatile functions)
- mbVolatile |= rNameMgr.IsVolatile( nNameIdx );
+ mxData->mbVolatile |= rNameMgr.IsVolatile( nNameIdx );
}
else
AppendErrorToken( EXC_ERR_NAME, rTokData.mnSpaces );
}
-void XclExpFmlaCompImpl::ProcessDatabaseArea( const XclExpTokenData& rTokData, sal_uInt8 nExpClass )
-{
- sal_uInt16 nNameIdx = GetNameManager().InsertDBRange( rTokData.mpScToken->GetIndex() );
- AppendNameToken( nNameIdx, nExpClass, rTokData.mnSpaces );
-}
-
-// token identifiers ----------------------------------------------------------
-
-void XclExpFmlaCompImpl::SetReplaceTokenClasses()
+void XclExpFmlaCompImpl::ProcessExternalName( const XclExpScToken& rTokData )
{
- /* REF expected: change VAL to ARR in array and name type, or if ARR is expected somewhere before.
- Example: How does the return class of PI() (default VAL) change in SUM() (expects REF)?
- =SUM(PI()) -> PI() still returns VAL in cell formula
- {=SUM(PI())} -> PI() returns ARR in array formula
- =MDET(SUM(PI())) -> expected ARR from MDET(), PI() returns ARR too
- */
- mnRefExpClass = (mbIsArrExp || (maCfg.meClassType != EXC_CLASSTYPE_CELL)) ? EXC_TOKCLASS_ARR : EXC_TOKCLASS_VAL;
+ if( mxData->mpLinkMgr )
+ {
+ ScExternalRefManager& rExtRefMgr = *GetDoc().GetExternalRefManager();
+ USHORT nFileId = rTokData.mpScToken->GetIndex();
+ const String& rName = rTokData.mpScToken->GetString();
+ ScExternalRefCache::TokenArrayRef xArray = rExtRefMgr.getRangeNameTokens( nFileId, rName );
+ if( xArray.get() )
+ {
+ // store external cell contents in CRN records
+ if( mxData->mpScBasePos )
+ {
+ for( FormulaToken* pScToken = xArray->First(); pScToken; pScToken = xArray->Next() )
+ {
+ if( pScToken->GetOpCode() == ocExternalRef )
+ {
+ switch( pScToken->GetType() )
+ {
+ case svExternalSingleRef:
+ {
+ ScSingleRefData aRefData = static_cast< ScToken* >( pScToken )->GetSingleRef();
+ aRefData.CalcAbsIfRel( *mxData->mpScBasePos );
+ mxData->mpLinkMgr->StoreCell( nFileId, pScToken->GetString(), aRefData );
+ }
+ break;
+ case svExternalDoubleRef:
+ {
+ ScComplexRefData aRefData = static_cast< ScToken* >( pScToken )->GetDoubleRef();
+ aRefData.CalcAbsIfRel( *mxData->mpScBasePos );
+ mxData->mpLinkMgr->StoreCellRange( nFileId, pScToken->GetString(), aRefData );
+ }
+ default:
+ ; // nothing, avoid compiler warning
+ }
+ }
+ }
+ }
- /* VAL expected: set to ARR, if ARR is expected somewhere before; otherwise set to VAL.
- Example: How does the class of A1 (default REF) change in ABS() (expects VAL)?
- =ABS(A1) -> A1 is VAL in cell formula
- =MDET(ABS(A1)) -> expected ARR from MDET(), A1 is ARR in cell formula
- */
- mnValExpClass = mbIsArrExp ? EXC_TOKCLASS_ARR : EXC_TOKCLASS_VAL;
+ // insert the new external name and create the tNameX token
+ sal_uInt16 nExtSheet, nExtName;
+ const String* pFile = rExtRefMgr.getExternalFileName( nFileId );
+ if( pFile && mxData->mpLinkMgr->InsertExtName( nExtSheet, nExtName, *pFile, rName, xArray ) )
+ {
+ AppendNameXToken( nExtSheet, nExtName, rTokData.mnSpaces );
+ return;
+ }
+ }
+ }
- /* ARR expected: always set to ARR. */
- mnArrExpClass = EXC_TOKCLASS_ARR;
+ // on any error: create a #NAME? error
+ AppendErrorToken( EXC_ERR_NAME, rTokData.mnSpaces );
}
-void XclExpFmlaCompImpl::SetArrExpFlag( bool bIsArrExp )
+void XclExpFmlaCompImpl::ProcessDatabaseArea( const XclExpScToken& rTokData )
{
- if( mbIsArrExp != bIsArrExp )
- {
- mbIsArrExp = bIsArrExp;
- SetReplaceTokenClasses();
- }
+ sal_uInt16 nNameIdx = GetNameManager().InsertDBRange( rTokData.mpScToken->GetIndex() );
+ AppendNameToken( nNameIdx, rTokData.mnSpaces );
}
-void XclExpFmlaCompImpl::UpdateArrExpFlag( sal_uInt8 nParamExpClass, sal_uInt8 nFuncRetClass )
+// token vector ---------------------------------------------------------------
+
+void XclExpFmlaCompImpl::PushOperandPos( sal_uInt16 nTokPos )
{
- bool bNewIsArrExp = false;
- switch( maCfg.meClassType )
- {
- case EXC_CLASSTYPE_CELL:
- bNewIsArrExp = nParamExpClass == EXC_TOKCLASS_ARR;
- break;
- case EXC_CLASSTYPE_ARRAY:
- bNewIsArrExp = nParamExpClass != EXC_TOKCLASS_VAL;
- break;
- case EXC_CLASSTYPE_NAME:
- bNewIsArrExp = ((nParamExpClass != EXC_TOKCLASS_VAL) || (nFuncRetClass != EXC_TOKCLASS_REF));
- break;
+ mxData->maOpPosStack.push_back( nTokPos );
+}
- default :
- break;
- }
- SetArrExpFlag( mbIsArrExp || bNewIsArrExp );
+void XclExpFmlaCompImpl::PushOperatorPos( sal_uInt16 nTokPos, const XclExpOperandListRef& rxOperands )
+{
+ PushOperandPos( nTokPos );
+ DBG_ASSERT( rxOperands.get(), "XclExpFmlaCompImpl::AppendOperatorTokenId - missing operand list" );
+ if( mxData->maOpListVec.size() <= nTokPos )
+ mxData->maOpListVec.resize( nTokPos + 1, XclExpOperandListRef() );
+ mxData->maOpListVec[ nTokPos ] = rxOperands;
}
-void XclExpFmlaCompImpl::AdjustTokenClass( sal_uInt8& rnTokenId, sal_uInt8 nExpClass )
+sal_uInt16 XclExpFmlaCompImpl::PopOperandPos()
{
- sal_uInt8 nIsClass = GetTokenClass( rnTokenId );
- if( nIsClass != EXC_TOKCLASS_NONE )
+ DBG_ASSERT( !mxData->mbOk || !mxData->maOpPosStack.empty(), "XclExpFmlaCompImpl::PopOperandPos - token stack broken" );
+ mxData->mbOk &= !mxData->maOpPosStack.empty();
+ if( mxData->mbOk )
{
- if( nExpClass == EXC_TOKCLASS_ANY_IN_REFOP )
- {
- // always set to REF, if used by reference operators
- ChangeTokenClass( rnTokenId, EXC_TOKCLASS_REF );
- }
- else
- {
- /* If a REF token is part of a value operator, it behaves like a VAL token.
- e.g.: =SUM(A1) -> SUM() expects REF, A1 is REF.
- =SUM(A1+A1) -> SUM() expects REF, but both A1 are handled like VAL tokens. */
- if( (nIsClass == EXC_TOKCLASS_REF) && ::get_flag( nExpClass, EXC_TOKCLASS_INOP_FLAG ) )
- {
- ChangeTokenClass( rnTokenId, EXC_TOKCLASS_VAL );
- nIsClass = EXC_TOKCLASS_VAL; // update nIsClass for following switch
- }
-
- // change token class according to expected parameter class
- switch( nExpClass )
- {
- case EXC_TOKCLASS_REF:
- case EXC_TOKCLASS_REF_IN_VALOP:
- if( nIsClass == EXC_TOKCLASS_VAL )
- ChangeTokenClass( rnTokenId, mnRefExpClass );
- break;
- case EXC_TOKCLASS_VAL:
- case EXC_TOKCLASS_VAL_IN_VALOP:
- ChangeTokenClass( rnTokenId, mnValExpClass );
- break;
- case EXC_TOKCLASS_ARR:
- case EXC_TOKCLASS_ARR_IN_VALOP:
- ChangeTokenClass( rnTokenId, mnArrExpClass );
- break;
- }
- }
+ sal_uInt16 nTokPos = mxData->maOpPosStack.back();
+ mxData->maOpPosStack.pop_back();
+ return nTokPos;
}
+ return 0;
}
-void XclExpFmlaCompImpl::AdjustLastTokenClass( sal_uInt8 nExpClass )
+namespace {
+
+inline void lclAppend( ScfUInt8Vec& orVector, sal_uInt16 nData )
{
- DBG_ASSERT( mnLastTokPos < GetSize(), "XclExpFmlaCompImpl::AdjustLastTokenClass - invalid position" );
- sal_uInt8& rnTokenId = maTokVec[ mnLastTokPos ];
- mnLastDefClass = GetTokenClass( rnTokenId );
- AdjustTokenClass( rnTokenId, nExpClass );
+ orVector.resize( orVector.size() + 2 );
+ ShortToSVBT16( nData, &*(orVector.end() - 2) );
}
-void XclExpFmlaCompImpl::AdjustLastTokenClassForEastereggOp()
+inline void lclAppend( ScfUInt8Vec& orVector, sal_uInt32 nData )
{
- /* This very special function cares about the leading subexpression of the
- Calc easteregg operators OR and AND.
- Example: The Calc formula =(A1:A2)OR(0) will be compiled to the Excel
- formula =OR(A1:A2,0). The Excel OR function expects REF parameters to
- be able to process all cells in a range reference. Since this compiler
- didn't know this when processing the (A1:A2) subexpression, it may
- create a tAreaV token from the reference (e.g. if in cell context).
- This would cause Excel to only evaluate cell A1, and to ignore cell A2,
- if the formula is located in cell B1.
- So this function changes the last token back to its default class and
- adjusts it with expected REF class, which is what would happen, if a
- regular OR or AND function is processed. */
- DBG_ASSERT( mnLastTokPos < GetSize(), "XclExpFmlaCompImpl::AdjustLastTokenClassForEastereggOp - invalid position" );
- sal_uInt8& rnTokenId = maTokVec[ mnLastTokPos ];
- if( GetTokenClass( rnTokenId ) != EXC_TOKCLASS_NONE )
- {
- ChangeTokenClass( rnTokenId, mnLastDefClass );
- AdjustTokenClass( rnTokenId, EXC_TOKCLASS_REF );
- }
+ orVector.resize( orVector.size() + 4 );
+ UInt32ToSVBT32( nData, &*(orVector.end() - 4) );
}
-void XclExpFmlaCompImpl::AppendOpTokenId( sal_uInt8 nTokenId, sal_uInt8 nExpClass, sal_uInt8 nSpaces )
+inline void lclAppend( ScfUInt8Vec& orVector, double fData )
{
- AppendSpaceToken( EXC_TOK_ATTR_SPACE_SP, nSpaces );
- mnLastTokPos = GetSize();
- Append( nTokenId );
- AdjustLastTokenClass( nExpClass );
+ orVector.resize( orVector.size() + 8 );
+ DoubleToSVBT64( fData, &*(orVector.end() - 8) );
}
-//UNUSED2008-05 void XclExpFmlaCompImpl::AppendFuncTokenId(
-//UNUSED2008-05 sal_uInt16 nXclFuncIdx, sal_uInt8 nRetClass, sal_uInt8 nExpRetClass, sal_uInt8 nSpaces )
-//UNUSED2008-05 {
-//UNUSED2008-05 AppendOpTokenId( GetTokenId( EXC_TOKID_FUNC, nRetClass ), nExpRetClass, nSpaces );
-//UNUSED2008-05 Append( nXclFuncIdx );
-//UNUSED2008-05 }
-
-void XclExpFmlaCompImpl::AppendVarFuncTokenId(
- sal_uInt16 nXclFuncIdx, sal_uInt8 nRetClass, sal_uInt8 nExpRetClass,
- sal_uInt8 nParamCount, sal_uInt8 nSpaces )
+inline void lclAppend( ScfUInt8Vec& orVector, const XclExpRoot& rRoot, const String& rString, XclStrFlags nStrFlags )
{
- AppendOpTokenId( GetTokenId( EXC_TOKID_FUNCVAR, nRetClass ), nExpRetClass, nSpaces );
- Append( nParamCount );
- Append( nXclFuncIdx );
+ XclExpStringRef xXclStr = XclExpStringHelper::CreateString( rRoot, rString, nStrFlags, EXC_TOK_STR_MAXLEN );
+ size_t nSize = orVector.size();
+ orVector.resize( nSize + xXclStr->GetSize() );
+ xXclStr->WriteToMem( &orVector[ nSize ] );
}
-// token vector ---------------------------------------------------------------
+} // namespace
void XclExpFmlaCompImpl::Append( sal_uInt8 nData )
{
- maTokVec.push_back( nData );
+ mxData->maTokVec.push_back( nData );
}
void XclExpFmlaCompImpl::Append( sal_uInt8 nData, size_t nCount )
{
- maTokVec.resize( maTokVec.size() + nCount, nData );
+ mxData->maTokVec.resize( mxData->maTokVec.size() + nCount, nData );
}
void XclExpFmlaCompImpl::Append( sal_uInt16 nData )
{
- maTokVec.resize( maTokVec.size() + 2 );
- ShortToSVBT16( nData, &*(maTokVec.end() - 2) );
+ lclAppend( mxData->maTokVec, nData );
}
void XclExpFmlaCompImpl::Append( sal_uInt32 nData )
{
- maTokVec.resize( maTokVec.size() + 4 );
- UInt32ToSVBT32( nData, &*(maTokVec.end() - 4) );
+ lclAppend( mxData->maTokVec, nData );
}
void XclExpFmlaCompImpl::Append( double fData )
{
- maTokVec.resize( maTokVec.size() + 8 );
- DoubleToSVBT64( fData, &*(maTokVec.end() - 8) );
+ lclAppend( mxData->maTokVec, fData );
}
void XclExpFmlaCompImpl::Append( const String& rString )
{
- XclExpStringRef xXclStr = XclExpStringHelper::CreateString(
- GetRoot(), rString, EXC_STR_8BITLENGTH, EXC_TOK_STR_MAXLEN );
- size_t nSize = maTokVec.size();
- maTokVec.resize( nSize + xXclStr->GetSize() );
- xXclStr->WriteToMem( &maTokVec[ nSize ] );
+ lclAppend( mxData->maTokVec, GetRoot(), rString, EXC_STR_8BITLENGTH );
}
void XclExpFmlaCompImpl::AppendAddress( const XclAddress& rXclPos )
@@ -2265,7 +2268,7 @@ void XclExpFmlaCompImpl::AppendRange( const XclRange& rXclRange )
void XclExpFmlaCompImpl::AppendSpaceToken( sal_uInt8 nType, sal_uInt8 nCount )
{
- if( nCount )
+ if( nCount > 0 )
{
Append( EXC_TOKID_ATTR );
Append( EXC_TOK_ATTR_SPACE );
@@ -2274,40 +2277,47 @@ void XclExpFmlaCompImpl::AppendSpaceToken( sal_uInt8 nType, sal_uInt8 nCount )
}
}
+void XclExpFmlaCompImpl::AppendOperandTokenId( sal_uInt8 nTokenId, sal_uInt8 nSpaces )
+{
+ AppendSpaceToken( EXC_TOK_ATTR_SPACE_SP, nSpaces );
+ PushOperandPos( GetSize() );
+ Append( nTokenId );
+}
+
void XclExpFmlaCompImpl::AppendIntToken( sal_uInt16 nValue, sal_uInt8 nSpaces )
{
- AppendOpTokenId( EXC_TOKID_INT, EXC_TOKCLASS_NONE, nSpaces );
+ AppendOperandTokenId( EXC_TOKID_INT, nSpaces );
Append( nValue );
}
void XclExpFmlaCompImpl::AppendNumToken( double fValue, sal_uInt8 nSpaces )
{
- AppendOpTokenId( EXC_TOKID_NUM, EXC_TOKCLASS_NONE, nSpaces );
+ AppendOperandTokenId( EXC_TOKID_NUM, nSpaces );
Append( fValue );
}
void XclExpFmlaCompImpl::AppendBoolToken( bool bValue, sal_uInt8 nSpaces )
{
- AppendOpTokenId( EXC_TOKID_BOOL, EXC_TOKCLASS_NONE, nSpaces );
+ AppendOperandTokenId( EXC_TOKID_BOOL, nSpaces );
Append( bValue ? EXC_TOK_BOOL_TRUE : EXC_TOK_BOOL_FALSE );
}
void XclExpFmlaCompImpl::AppendErrorToken( sal_uInt8 nErrCode, sal_uInt8 nSpaces )
{
- AppendOpTokenId( EXC_TOKID_ERR, EXC_TOKCLASS_NONE, nSpaces );
+ AppendOperandTokenId( EXC_TOKID_ERR, nSpaces );
Append( nErrCode );
}
void XclExpFmlaCompImpl::AppendMissingToken( sal_uInt8 nSpaces )
{
- AppendOpTokenId( EXC_TOKID_MISSARG, EXC_TOKCLASS_NONE, nSpaces );
+ AppendOperandTokenId( EXC_TOKID_MISSARG, nSpaces );
}
-void XclExpFmlaCompImpl::AppendNameToken( sal_uInt16 nNameIdx, sal_uInt8 nExpClass, sal_uInt8 nSpaces )
+void XclExpFmlaCompImpl::AppendNameToken( sal_uInt16 nNameIdx, sal_uInt8 nSpaces )
{
if( nNameIdx > 0 )
{
- AppendOpTokenId( GetTokenId( EXC_TOKID_NAME, EXC_TOKCLASS_REF ), nExpClass, nSpaces );
+ AppendOperandTokenId( GetTokenId( EXC_TOKID_NAME, EXC_TOKCLASS_REF ), nSpaces );
Append( nNameIdx );
Append( 0, (meBiff <= EXC_BIFF5) ? 12 : 2 );
}
@@ -2315,15 +2325,15 @@ void XclExpFmlaCompImpl::AppendNameToken( sal_uInt16 nNameIdx, sal_uInt8 nExpCla
AppendErrorToken( EXC_ERR_NAME );
}
-void XclExpFmlaCompImpl::AppendMissingNameToken( const String& rName, sal_uInt8 nExpClass, sal_uInt8 nSpaces )
+void XclExpFmlaCompImpl::AppendMissingNameToken( const String& rName, sal_uInt8 nSpaces )
{
sal_uInt16 nNameIdx = GetNameManager().InsertRawName( rName );
- AppendNameToken( nNameIdx, nExpClass, nSpaces );
+ AppendNameToken( nNameIdx, nSpaces );
}
-void XclExpFmlaCompImpl::AppendNameXToken( sal_uInt16 nExtSheet, sal_uInt16 nExtName, sal_uInt8 nExpClass, sal_uInt8 nSpaces )
+void XclExpFmlaCompImpl::AppendNameXToken( sal_uInt16 nExtSheet, sal_uInt16 nExtName, sal_uInt8 nSpaces )
{
- AppendOpTokenId( GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ), nExpClass, nSpaces );
+ AppendOperandTokenId( GetTokenId( EXC_TOKID_NAMEX, EXC_TOKCLASS_REF ), nSpaces );
Append( nExtSheet );
if( meBiff <= EXC_BIFF5 )
Append( 0, 8 );
@@ -2331,34 +2341,94 @@ void XclExpFmlaCompImpl::AppendNameXToken( sal_uInt16 nExtSheet, sal_uInt16 nExt
Append( 0, (meBiff <= EXC_BIFF5) ? 12 : 2 );
}
-void XclExpFmlaCompImpl::AppendMacroCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nExpClass, sal_uInt8 nSpaces )
+void XclExpFmlaCompImpl::AppendMacroCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nSpaces )
{
sal_uInt16 nNameIdx = GetNameManager().InsertMacroCall( rExtFuncData.maFuncName, rExtFuncData.mbVBasic, true, rExtFuncData.mbHidden );
- AppendNameToken( nNameIdx, nExpClass, nSpaces );
+ AppendNameToken( nNameIdx, nSpaces );
}
-void XclExpFmlaCompImpl::AppendAddInFuncToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nExpClass, sal_uInt8 nSpaces )
+void XclExpFmlaCompImpl::AppendAddInCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nSpaces )
{
String aXclFuncName;
- if( ScGlobal::GetAddInCollection()->GetExcelName( rExtFuncData.maFuncName, GetUILanguage(), aXclFuncName ) )
+ if( mxData->mpLinkMgr && ScGlobal::GetAddInCollection()->GetExcelName( rExtFuncData.maFuncName, GetUILanguage(), aXclFuncName ) )
{
sal_uInt16 nExtSheet, nExtName;
- if( mpLinkMgr && mpLinkMgr->InsertAddIn( nExtSheet, nExtName, aXclFuncName ) )
+ if( mxData->mpLinkMgr->InsertAddIn( nExtSheet, nExtName, aXclFuncName ) )
{
- AppendNameXToken( nExtSheet, nExtName, nExpClass, nSpaces );
+ AppendNameXToken( nExtSheet, nExtName, nSpaces );
return;
}
}
- AppendMacroCallToken( rExtFuncData, nExpClass, nSpaces );
+ AppendMacroCallToken( rExtFuncData, nSpaces );
}
-void XclExpFmlaCompImpl::AppendEuroToolFuncToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nExpClass, sal_uInt8 nSpaces )
+void XclExpFmlaCompImpl::AppendEuroToolCallToken( const XclExpExtFuncData& rExtFuncData, sal_uInt8 nSpaces )
{
sal_uInt16 nExtSheet, nExtName;
- if( mpLinkMgr && mpLinkMgr->InsertEuroTool( nExtSheet, nExtName, rExtFuncData.maFuncName ) )
- AppendNameXToken( nExtSheet, nExtName, nExpClass, nSpaces );
+ if( mxData->mpLinkMgr && mxData->mpLinkMgr->InsertEuroTool( nExtSheet, nExtName, rExtFuncData.maFuncName ) )
+ AppendNameXToken( nExtSheet, nExtName, nSpaces );
else
- AppendMacroCallToken( rExtFuncData, nExpClass, nSpaces );
+ AppendMacroCallToken( rExtFuncData, nSpaces );
+}
+
+void XclExpFmlaCompImpl::AppendOperatorTokenId( sal_uInt8 nTokenId, const XclExpOperandListRef& rxOperands, sal_uInt8 nSpaces )
+{
+ AppendSpaceToken( EXC_TOK_ATTR_SPACE_SP, nSpaces );
+ PushOperatorPos( GetSize(), rxOperands );
+ Append( nTokenId );
+}
+
+void XclExpFmlaCompImpl::AppendUnaryOperatorToken( sal_uInt8 nTokenId, sal_uInt8 nSpaces )
+{
+ XclExpOperandListRef xOperands( new XclExpOperandList );
+ xOperands->AppendOperand( PopOperandPos(), EXC_PARAMCONV_RPO, true );
+ AppendOperatorTokenId( nTokenId, xOperands, nSpaces );
+}
+
+void XclExpFmlaCompImpl::AppendBinaryOperatorToken( sal_uInt8 nTokenId, bool bValType, sal_uInt8 nSpaces )
+{
+ XclExpOperandListRef xOperands( new XclExpOperandList );
+ xOperands->AppendOperand( PopOperandPos(), EXC_PARAMCONV_RPO, bValType );
+ xOperands->AppendOperand( PopOperandPos(), EXC_PARAMCONV_RPO, bValType );
+ AppendOperatorTokenId( nTokenId, xOperands, nSpaces );
+}
+
+void XclExpFmlaCompImpl::AppendLogicalOperatorToken( sal_uInt16 nXclFuncIdx, sal_uInt8 nOpCount )
+{
+ XclExpOperandListRef xOperands( new XclExpOperandList );
+ for( sal_uInt8 nOpIdx = 0; nOpIdx < nOpCount; ++nOpIdx )
+ xOperands->AppendOperand( PopOperandPos(), EXC_PARAMCONV_RPX, false );
+ AppendOperatorTokenId( GetTokenId( EXC_TOKID_FUNCVAR, EXC_TOKCLASS_VAL ), xOperands );
+ Append( nOpCount );
+ Append( nXclFuncIdx );
+}
+
+void XclExpFmlaCompImpl::AppendFuncToken( const XclExpFuncData& rFuncData )
+{
+ sal_uInt16 nXclFuncIdx = rFuncData.GetXclFuncIdx();
+ sal_uInt8 nParamCount = rFuncData.GetParamCount();
+ sal_uInt8 nRetClass = rFuncData.GetReturnClass();
+
+ if( (nXclFuncIdx == EXC_FUNCID_SUM) && (nParamCount == 1) )
+ {
+ // SUM with only one parameter
+ AppendOperatorTokenId( EXC_TOKID_ATTR, rFuncData.GetOperandList() );
+ Append( EXC_TOK_ATTR_SUM );
+ Append( sal_uInt16( 0 ) );
+ }
+ else if( rFuncData.IsFixedParamCount() )
+ {
+ // fixed number of parameters
+ AppendOperatorTokenId( GetTokenId( EXC_TOKID_FUNC, nRetClass ), rFuncData.GetOperandList() );
+ Append( nXclFuncIdx );
+ }
+ else
+ {
+ // variable number of parameters
+ AppendOperatorTokenId( GetTokenId( EXC_TOKID_FUNCVAR, nRetClass ), rFuncData.GetOperandList() );
+ Append( nParamCount );
+ Append( nXclFuncIdx );
+ }
}
void XclExpFmlaCompImpl::AppendParenToken( sal_uInt8 nOpenSpaces, sal_uInt8 nCloseSpaces )
@@ -2378,16 +2448,31 @@ void XclExpFmlaCompImpl::AppendJumpToken( XclExpFuncData& rFuncData, sal_uInt8 n
Append( sal_uInt16( 0 ) ); // placeholder that will be updated later
}
-void XclExpFmlaCompImpl::Insert( sal_uInt16 nInsertPos, sal_uInt16 nInsertSize )
+void XclExpFmlaCompImpl::InsertZeros( sal_uInt16 nInsertPos, sal_uInt16 nInsertSize )
{
- DBG_ASSERT( nInsertPos < maTokVec.size(), "XclExpFmlaCompImpl::Insert - invalid position" );
- maTokVec.insert( maTokVec.begin() + nInsertPos, nInsertSize, 0 );
+ // insert zeros into the token array
+ DBG_ASSERT( nInsertPos < mxData->maTokVec.size(), "XclExpFmlaCompImpl::Insert - invalid position" );
+ mxData->maTokVec.insert( mxData->maTokVec.begin() + nInsertPos, nInsertSize, 0 );
+
+ // update positions of operands waiting for an operator
+ for( ScfUInt16Vec::iterator aIt = mxData->maOpPosStack.begin(), aEnd = mxData->maOpPosStack.end(); aIt != aEnd; ++aIt )
+ if( nInsertPos <= *aIt )
+ *aIt = *aIt + nInsertSize;
+
+ // update operand lists of all operator tokens
+ if( nInsertPos < mxData->maOpListVec.size() )
+ mxData->maOpListVec.insert( mxData->maOpListVec.begin() + nInsertPos, nInsertSize, XclExpOperandListRef() );
+ for( XclExpOperandListVector::iterator aIt = mxData->maOpListVec.begin(), aEnd = mxData->maOpListVec.end(); aIt != aEnd; ++aIt )
+ if( aIt->get() )
+ for( XclExpOperandList::iterator aIt2 = (*aIt)->begin(), aEnd2 = (*aIt)->end(); aIt2 != aEnd2; ++aIt2 )
+ if( nInsertPos <= aIt2->mnTokPos )
+ aIt2->mnTokPos = aIt2->mnTokPos + nInsertSize;
}
void XclExpFmlaCompImpl::Overwrite( sal_uInt16 nWriteToPos, sal_uInt16 nOffset )
{
- DBG_ASSERT( static_cast< size_t >( nWriteToPos + 1 ) < maTokVec.size(), "XclExpFmlaCompImpl::Overwrite - invalid position" );
- ShortToSVBT16( nOffset, &maTokVec[ nWriteToPos ] );
+ DBG_ASSERT( static_cast< size_t >( nWriteToPos + 1 ) < mxData->maTokVec.size(), "XclExpFmlaCompImpl::Overwrite - invalid position" );
+ ShortToSVBT16( nOffset, &mxData->maTokVec[ nWriteToPos ] );
}
void XclExpFmlaCompImpl::UpdateAttrGoto( sal_uInt16 nAttrPos )
@@ -2403,19 +2488,49 @@ void XclExpFmlaCompImpl::UpdateAttrGoto( sal_uInt16 nAttrPos )
bool XclExpFmlaCompImpl::IsSpaceToken( sal_uInt16 nPos ) const
{
return
- (static_cast< size_t >( nPos + 4 ) <= maTokVec.size()) &&
- (maTokVec[ nPos ] == EXC_TOKID_ATTR) &&
- (maTokVec[ nPos + 1 ] == EXC_TOK_ATTR_SPACE);
+ (static_cast< size_t >( nPos + 4 ) <= mxData->maTokVec.size()) &&
+ (mxData->maTokVec[ nPos ] == EXC_TOKID_ATTR) &&
+ (mxData->maTokVec[ nPos + 1 ] == EXC_TOK_ATTR_SPACE);
}
void XclExpFmlaCompImpl::RemoveTrailingParen()
{
// remove trailing tParen token
- if( !maTokVec.empty() && (maTokVec.back() == EXC_TOKID_PAREN) )
- maTokVec.pop_back();
+ if( !mxData->maTokVec.empty() && (mxData->maTokVec.back() == EXC_TOKID_PAREN) )
+ mxData->maTokVec.pop_back();
// remove remaining tAttrSpace tokens
- while( (maTokVec.size() >= 4) && IsSpaceToken( GetSize() - 4 ) )
- maTokVec.erase( maTokVec.end() - 4, maTokVec.end() );
+ while( (mxData->maTokVec.size() >= 4) && IsSpaceToken( GetSize() - 4 ) )
+ mxData->maTokVec.erase( mxData->maTokVec.end() - 4, mxData->maTokVec.end() );
+}
+
+void XclExpFmlaCompImpl::AppendExt( sal_uInt8 nData )
+{
+ mxData->maExtDataVec.push_back( nData );
+}
+
+void XclExpFmlaCompImpl::AppendExt( sal_uInt8 nData, size_t nCount )
+{
+ mxData->maExtDataVec.resize( mxData->maExtDataVec.size() + nCount, nData );
+}
+
+void XclExpFmlaCompImpl::AppendExt( sal_uInt16 nData )
+{
+ lclAppend( mxData->maExtDataVec, nData );
+}
+
+void XclExpFmlaCompImpl::AppendExt( sal_uInt32 nData )
+{
+ lclAppend( mxData->maExtDataVec, nData );
+}
+
+void XclExpFmlaCompImpl::AppendExt( double fData )
+{
+ lclAppend( mxData->maExtDataVec, fData );
+}
+
+void XclExpFmlaCompImpl::AppendExt( const String& rString )
+{
+ lclAppend( mxData->maExtDataVec, GetRoot(), rString, (meBiff == EXC_BIFF8) ? EXC_STR_DEFAULT : EXC_STR_8BITLENGTH );
}
// ============================================================================
@@ -2530,29 +2645,5 @@ XclTokenArrayRef XclExpFormulaCompiler::CreateNameXFormula(
return mxImpl->CreateNameXFormula( nExtSheet, nExtName );
}
-void XclExpFmlaCompImpl::ProcessMatrix( const XclExpTokenData& rTokData, sal_uInt8 nExpClass )
-{
- const ScMatrix* pMatrix = static_cast<const ScToken*>(rTokData.mpScToken)->GetMatrix();
- if( maCfg.mbAllowArrays && pMatrix )
- {
- SCSIZE nCols, nRows;
- pMatrix->GetDimensions( nCols, nRows );
-
- AppendOpTokenId( GetTokenId( EXC_TOKID_ARRAY, EXC_TOKCLASS_ARR ), nExpClass, rTokData.mnSpaces );
- Append( static_cast< sal_uInt8 >( (meBiff == EXC_BIFF8) ? (nCols - 1) : nCols ) );
- Append( static_cast< sal_uInt16 >( (meBiff == EXC_BIFF8) ? (nRows - 1) : nRows ) );
- Append( static_cast< sal_uInt32 >( 0 ) );
-
- if( !mxInlineArr )
- mxInlineArr.reset( new ScMatrixList );
- mxInlineArr->push_front( pMatrix ); // save it for later
- }
- else
- {
- // Array in places that do not allow it (cond fmts, data validation)
- AppendErrorToken( EXC_ERR_NA, rTokData.mnSpaces );
- }
-}
-
// ============================================================================
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index 3fc04d7edd1a..47f101f4c351 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -846,11 +846,11 @@ SCTAB XclExpTabInfo::GetRealScTab( SCTAB nSortedScTab ) const
return (nSortedScTab < mnScCnt) ? maFromSortedVec[ nSortedScTab ] : SCTAB_INVALID;
}
-SCTAB XclExpTabInfo::GetSortedScTab( SCTAB nScTab ) const
-{
- DBG_ASSERT( nScTab < mnScCnt, "XclExpTabInfo::GetSortedScTab - sheet out of range" );
- return (nScTab < mnScCnt) ? maToSortedVec[ nScTab ] : SCTAB_INVALID;
-}
+//UNUSED2009-05 SCTAB XclExpTabInfo::GetSortedScTab( SCTAB nScTab ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 DBG_ASSERT( nScTab < mnScCnt, "XclExpTabInfo::GetSortedScTab - sheet out of range" );
+//UNUSED2009-05 return (nScTab < mnScCnt) ? maToSortedVec[ nScTab ] : SCTAB_INVALID;
+//UNUSED2009-05 }
bool XclExpTabInfo::GetFlag( SCTAB nScTab, sal_uInt8 nFlags ) const
{
@@ -903,7 +903,7 @@ typedef ::std::vector< XclExpTabName > XclExpTabNameVec;
inline bool operator<( const XclExpTabName& rArg1, const XclExpTabName& rArg2 )
{
// compare the sheet names only
- return ScGlobal::pCollator->compareString( rArg1.first, rArg2.first ) == COMPARE_LESS;
+ return ScGlobal::GetCollator()->compareString( rArg1.first, rArg2.first ) == COMPARE_LESS;
}
void XclExpTabInfo::CalcSortedIndexes()
diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx
index b4de1126959d..ace7a66dc1f9 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -720,10 +720,10 @@ sal_uInt16 XclExpNameManager::InsertDBRange( USHORT nScDBRangeIdx )
return mxImpl->InsertDBRange( nScDBRangeIdx );
}
-sal_uInt16 XclExpNameManager::InsertBuiltInName( sal_Unicode cBuiltIn, XclTokenArrayRef xTokArr, SCTAB nScTab )
-{
- return mxImpl->InsertBuiltInName( cBuiltIn, xTokArr, nScTab );
-}
+//UNUSED2009-05 sal_uInt16 XclExpNameManager::InsertBuiltInName( sal_Unicode cBuiltIn, XclTokenArrayRef xTokArr, SCTAB nScTab )
+//UNUSED2009-05 {
+//UNUSED2009-05 return mxImpl->InsertBuiltInName( cBuiltIn, xTokArr, nScTab );
+//UNUSED2009-05 }
sal_uInt16 XclExpNameManager::InsertBuiltInName( sal_Unicode cBuiltIn, const ScRange& rRange )
{
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index 457cdd2a17e4..69b323e1e718 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -662,6 +662,9 @@ XclExpPivotCache::XclExpPivotCache( const XclExpRoot& rRoot, const ScDPObject& r
if( 2 * (nDocRow2 - nDocRow1) < (nSrcRow2 - nSrcRow1) )
::set_flag( maPCInfo.mnFlags, EXC_SXDB_SAVEDATA, false );
+ // #160184# Excel must refresh tables to make drilldown working
+ ::set_flag( maPCInfo.mnFlags, EXC_SXDB_REFRESH_LOAD );
+
// adjust row indexes, keep one row of empty area to surely have the empty cache item
if( nSrcRow1 < nDocRow1 )
nSrcRow1 = nDocRow1 - 1;
@@ -701,10 +704,10 @@ const XclExpPCField* XclExpPivotCache::GetField( sal_uInt16 nFieldIdx ) const
return maFieldList.GetRecord( nFieldIdx ).get();
}
-const XclExpPCField* XclExpPivotCache::GetField( const String& rFieldName ) const
-{
- return const_cast< XclExpPivotCache* >( this )->GetFieldAcc( rFieldName );
-}
+//UNUSED2009-05 const XclExpPCField* XclExpPivotCache::GetField( const String& rFieldName ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 return const_cast< XclExpPivotCache* >( this )->GetFieldAcc( rFieldName );
+//UNUSED2009-05 }
bool XclExpPivotCache::HasAddFields() const
{
@@ -1014,10 +1017,10 @@ sal_uInt16 XclExpPTField::GetLastDataInfoIndex() const
return static_cast< sal_uInt16 >( maDataInfoVec.size() - 1 );
}
-const XclExpPTItem* XclExpPTField::GetItem( const String& rName ) const
-{
- return const_cast< XclExpPTField* >( this )->GetItemAcc( rName );
-}
+//UNUSED2009-05 const XclExpPTItem* XclExpPTField::GetItem( const String& rName ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 return const_cast< XclExpPTField* >( this )->GetItemAcc( rName );
+//UNUSED2009-05 }
sal_uInt16 XclExpPTField::GetItemIndex( const String& rName, sal_uInt16 nDefaultIdx ) const
{
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 6b2f53c8056a..10d23eccdf27 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -485,7 +485,7 @@ XclExpBiff8Encrypter::XclExpBiff8Encrypter( const XclExpRoot& rRoot, const sal_u
String aPass = rRoot.GetPassword();
if (aPass.Len() == 0)
// Empty password. Get the default biff8 password.
- aPass = XclCryptoHelper::GetBiff8WbProtPassword();
+ aPass = rRoot.GetDefaultPassword();
Init(aPass, nDocId, nSalt);
}
@@ -985,11 +985,6 @@ bool XclExpXmlStream::importDocument() throw()
return false;
}
-sal_Int32 XclExpXmlStream::getSchemeClr( sal_Int32 /*nColorSchemeToken*/ ) const
-{
- return -1;
-}
-
oox::vml::Drawing* XclExpXmlStream::getVmlDrawing()
{
return 0;
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index fadc916d7b86..ef30e9a78f6d 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -653,36 +653,36 @@ void XclExpBooleanCell::WriteContents( XclExpStream& rStrm )
// ----------------------------------------------------------------------------
-IMPL_FIXEDMEMPOOL_NEWDEL( XclExpErrorCell, 256, 256 )
-
-XclExpErrorCell::XclExpErrorCell(
- const XclExpRoot rRoot, const XclAddress& rXclPos,
- const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId, sal_uInt8 nErrCode ) :
- // #i41210# always use latin script for error cells
- XclExpSingleCellBase( rRoot, EXC_ID3_BOOLERR, 2, rXclPos, pPattern, ApiScriptType::LATIN, nForcedXFId ),
- mnErrCode( nErrCode )
-{
-}
-
-void XclExpErrorCell::SaveXml( XclExpXmlStream& rStrm )
-{
- sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
- rWorksheet->startElement( XML_c,
- XML_r, XclXmlUtils::ToOString( GetXclPos() ).getStr(),
- XML_s, lcl_GetStyleId( rStrm, *this ).getStr(),
- XML_t, "e",
- // OOXTODO: XML_cm, XML_vm, XML_ph
- FSEND );
- rWorksheet->startElement( XML_v, FSEND );
- rWorksheet->write( (sal_Int32) mnErrCode );
- rWorksheet->endElement( XML_v );
- rWorksheet->endElement( XML_c );
-}
-
-void XclExpErrorCell::WriteContents( XclExpStream& rStrm )
-{
- rStrm << mnErrCode << EXC_BOOLERR_ERROR;
-}
+//UNUSED2009-05 IMPL_FIXEDMEMPOOL_NEWDEL( XclExpErrorCell, 256, 256 )
+//UNUSED2009-05
+//UNUSED2009-05 XclExpErrorCell::XclExpErrorCell(
+//UNUSED2009-05 const XclExpRoot rRoot, const XclAddress& rXclPos,
+//UNUSED2009-05 const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId, sal_uInt8 nErrCode ) :
+//UNUSED2009-05 // #i41210# always use latin script for error cells
+//UNUSED2009-05 XclExpSingleCellBase( rRoot, EXC_ID3_BOOLERR, 2, rXclPos, pPattern, ApiScriptType::LATIN, nForcedXFId ),
+//UNUSED2009-05 mnErrCode( nErrCode )
+//UNUSED2009-05 {
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 void XclExpErrorCell::SaveXml( XclExpXmlStream& rStrm )
+//UNUSED2009-05 {
+//UNUSED2009-05 sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
+//UNUSED2009-05 rWorksheet->startElement( XML_c,
+//UNUSED2009-05 XML_r, XclXmlUtils::ToOString( GetXclPos() ).getStr(),
+//UNUSED2009-05 XML_s, lcl_GetStyleId( rStrm, *this ).getStr(),
+//UNUSED2009-05 XML_t, "e",
+//UNUSED2009-05 // OOXTODO: XML_cm, XML_vm, XML_ph
+//UNUSED2009-05 FSEND );
+//UNUSED2009-05 rWorksheet->startElement( XML_v, FSEND );
+//UNUSED2009-05 rWorksheet->write( (sal_Int32) mnErrCode );
+//UNUSED2009-05 rWorksheet->endElement( XML_v );
+//UNUSED2009-05 rWorksheet->endElement( XML_c );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 void XclExpErrorCell::WriteContents( XclExpStream& rStrm )
+//UNUSED2009-05 {
+//UNUSED2009-05 rStrm << mnErrCode << EXC_BOOLERR_ERROR;
+//UNUSED2009-05 }
// ----------------------------------------------------------------------------
diff --git a/sc/source/filter/excel/xichart.cxx b/sc/source/filter/excel/xichart.cxx
index 2d920b0a0bd4..dc542a1c1eeb 100644
--- a/sc/source/filter/excel/xichart.cxx
+++ b/sc/source/filter/excel/xichart.cxx
@@ -2159,7 +2159,9 @@ void XclImpChChart3d::ReadChChart3d( XclImpStream& rStrm )
void XclImpChChart3d::Convert( ScfPropertySet& rPropSet, bool b3dWallChart ) const
{
namespace cssd = ::com::sun::star::drawing;
- DBG_ASSERT( ::get_flag( maData.mnFlags, EXC_CHCHART3D_HASWALLS ) == b3dWallChart, "XclImpChChart3d::Convert - wrong wall flag" );
+
+// #i104057# do not assert this, written by broken external generators
+// DBG_ASSERT( ::get_flag( maData.mnFlags, EXC_CHCHART3D_HASWALLS ) == b3dWallChart, "XclImpChChart3d::Convert - wrong wall flag" );
sal_Int32 nRotationY = 0;
sal_Int32 nRotationX = 0;
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 24c1999b581b..7b5fb222a12b 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -377,14 +377,33 @@ void XclImpHyperlink::ConvertToValidTabName(String& rUrl)
String aNewUrl(sal_Unicode('#')), aTabName;
bool bInQuote = false;
+ bool bQuoteTabName = false;
for (xub_StrLen i = 1; i < n; ++i)
{
c = rUrl.GetChar(i);
if (c == sal_Unicode('\''))
{
+ if (bInQuote && i+1 < n && rUrl.GetChar(i+1) == sal_Unicode('\''))
+ {
+ // Two consecutive single quotes ('') signify a single literal
+ // quite. When this occurs, the whole table name needs to be
+ // quoted.
+ bQuoteTabName = true;
+ aTabName.Append(c);
+ aTabName.Append(c);
+ ++i;
+ continue;
+ }
+
bInQuote = !bInQuote;
if (!bInQuote && aTabName.Len() > 0)
+ {
+ if (bQuoteTabName)
+ aNewUrl.Append(sal_Unicode('\''));
aNewUrl.Append(aTabName);
+ if (bQuoteTabName)
+ aNewUrl.Append(sal_Unicode('\''));
+ }
}
else if (bInQuote)
aTabName.Append(c);
@@ -1011,7 +1030,7 @@ XclImpDecrypterRef lclReadFilepass5( XclImpStream& rStrm )
{
sal_uInt16 nKey, nHash;
rStrm >> nKey >> nHash;
- xDecr.reset( new XclImpBiff5Decrypter( rStrm.GetRoot(), nKey, nHash ) );
+ xDecr.reset( new XclImpBiff5Decrypter( nKey, nHash ) );
}
return xDecr;
}
@@ -1022,14 +1041,13 @@ XclImpDecrypterRef lclReadFilepass8_Standard( XclImpStream& rStrm )
DBG_ASSERT( rStrm.GetRecLeft() == 48, "lclReadFilepass8 - wrong record size" );
if( rStrm.GetRecLeft() == 48 )
{
- sal_uInt8 pnDocId[ 16 ];
- sal_uInt8 pnSaltData[ 16 ];
- sal_uInt8 pnSaltHash[ 16 ];
- rStrm.Read( pnDocId, 16 );
- rStrm.Read( pnSaltData, 16 );
- rStrm.Read( pnSaltHash, 16 );
- xDecr.reset( new XclImpBiff8Decrypter(
- rStrm.GetRoot(), pnDocId, pnSaltData, pnSaltHash ) );
+ sal_uInt8 pnSalt[ 16 ];
+ sal_uInt8 pnVerifier[ 16 ];
+ sal_uInt8 pnVerifierHash[ 16 ];
+ rStrm.Read( pnSalt, 16 );
+ rStrm.Read( pnVerifier, 16 );
+ rStrm.Read( pnVerifierHash, 16 );
+ xDecr.reset( new XclImpBiff8Decrypter( pnSalt, pnVerifier, pnVerifierHash ) );
}
return xDecr;
}
@@ -1087,6 +1105,7 @@ ErrCode XclImpDecryptHelper::ReadFilepass( XclImpStream& rStrm )
XclImpDecrypterRef xDecr;
rStrm.DisableDecryption();
+ // read the FILEPASS record and create a new decrypter object
switch( rStrm.GetRoot().GetBiff() )
{
case EXC_BIFF2:
@@ -1097,21 +1116,15 @@ ErrCode XclImpDecryptHelper::ReadFilepass( XclImpStream& rStrm )
default: DBG_ERROR_BIFF();
};
- if (!xDecr.is())
- return EXC_ENCR_ERROR_UNSUPP_CRYPT;
-
// set decrypter at import stream
rStrm.SetDecrypter( xDecr );
- // Store the document password for export.
- SfxItemSet* pSet = rStrm.GetRoot().GetDocShell()->GetMedium()->GetItemSet();
- if (pSet)
- {
- String aPass = xDecr->GetPassword();
- pSet->Put( SfxStringItem(SID_PASSWORD, aPass) );
- }
+ // request and verify a password (decrypter implements IDocPasswordVerifier)
+ if( xDecr.is() )
+ rStrm.GetRoot().RequestPassword( *xDecr );
- return xDecr->GetError();
+ // return error code (success, wrong password, etc.)
+ return xDecr.is() ? xDecr->GetError() : EXC_ENCR_ERROR_UNSUPP_CRYPT;
}
// Document protection ========================================================
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 98e8719414df..599b33f9c8aa 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -2900,10 +2900,10 @@ void XclImpPictureObj::ReadPictFmla( XclImpStream& rStrm, sal_uInt16 nLinkSize )
// DFF stream conversion ======================================================
-void XclImpSolverContainer::ReadSolverContainer( SvStream& rDffStrm )
-{
- rDffStrm >> *this;
-}
+//UNUSED2009-05 void XclImpSolverContainer::ReadSolverContainer( SvStream& rDffStrm )
+//UNUSED2009-05 {
+//UNUSED2009-05 rDffStrm >> *this;
+//UNUSED2009-05 }
void XclImpSolverContainer::InsertSdrObjectInfo( SdrObject& rSdrObj, sal_uInt32 nDffShapeId, sal_uInt32 nDffFlags )
{
diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx
index dab0a5c412c2..47b42ad51e93 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -137,23 +137,23 @@ bool XclImpAddressConverter::ConvertRange( ScRange& rScRange,
return bValidStart;
}
-ScRange XclImpAddressConverter::CreateValidRange(
- const XclRange& rXclRange, SCTAB nScTab1, SCTAB nScTab2, bool bWarn )
-{
- return ScRange(
- CreateValidAddress( rXclRange.maFirst, nScTab1, bWarn ),
- CreateValidAddress( rXclRange.maLast, nScTab2, bWarn ) );
-}
+//UNUSED2009-05 ScRange XclImpAddressConverter::CreateValidRange(
+//UNUSED2009-05 const XclRange& rXclRange, SCTAB nScTab1, SCTAB nScTab2, bool bWarn )
+//UNUSED2009-05 {
+//UNUSED2009-05 return ScRange(
+//UNUSED2009-05 CreateValidAddress( rXclRange.maFirst, nScTab1, bWarn ),
+//UNUSED2009-05 CreateValidAddress( rXclRange.maLast, nScTab2, bWarn ) );
+//UNUSED2009-05 }
// cell range list ------------------------------------------------------------
-bool XclImpAddressConverter::CheckRangeList( const XclRangeList& rXclRanges, bool bWarn )
-{
- for( XclRangeList::const_iterator aIt = rXclRanges.begin(), aEnd = rXclRanges.end(); aIt != aEnd; ++aIt )
- if( !CheckRange( *aIt, bWarn ) )
- return false;
- return true;
-}
+//UNUSED2009-05 bool XclImpAddressConverter::CheckRangeList( const XclRangeList& rXclRanges, bool bWarn )
+//UNUSED2009-05 {
+//UNUSED2009-05 for( XclRangeList::const_iterator aIt = rXclRanges.begin(), aEnd = rXclRanges.end(); aIt != aEnd; ++aIt )
+//UNUSED2009-05 if( !CheckRange( *aIt, bWarn ) )
+//UNUSED2009-05 return false;
+//UNUSED2009-05 return true;
+//UNUSED2009-05 }
void XclImpAddressConverter::ConvertRangeList( ScRangeList& rScRanges,
const XclRangeList& rXclRanges, SCTAB nScTab, bool bWarn )
@@ -254,11 +254,11 @@ EditTextObject* XclImpStringHelper::CreateTextObject(
return lclCreateTextObject( rRoot, rString, EXC_FONTITEM_EDITENG, 0 );
}
-EditTextObject* XclImpStringHelper::CreateNoteObject(
- const XclImpRoot& rRoot, const XclImpString& rString )
-{
- return lclCreateTextObject( rRoot, rString, EXC_FONTITEM_NOTE, 0 );
-}
+//UNUSED2009-05 EditTextObject* XclImpStringHelper::CreateNoteObject(
+//UNUSED2009-05 const XclImpRoot& rRoot, const XclImpString& rString )
+//UNUSED2009-05 {
+//UNUSED2009-05 return lclCreateTextObject( rRoot, rString, EXC_FONTITEM_NOTE, 0 );
+//UNUSED2009-05 }
ScBaseCell* XclImpStringHelper::CreateCell(
const XclImpRoot& rRoot, const XclImpString& rString, sal_uInt16 nXFIndex )
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx
index 2c2426382178..00268215a5dc 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -153,6 +153,7 @@ struct XclImpXti
sal_uInt16 mnSupbook; /// Index to SUPBOOK record.
sal_uInt16 mnSBTabFirst; /// Index to the first sheet of the range in the SUPBOOK.
sal_uInt16 mnSBTabLast; /// Index to the last sheet of the range in the SUPBOOK.
+ inline explicit XclImpXti() : mnSupbook( SAL_MAX_UINT16 ), mnSBTabFirst( SAL_MAX_UINT16 ), mnSBTabLast( SAL_MAX_UINT16 ) {}
};
inline XclImpStream& operator>>( XclImpStream& rStrm, XclImpXti& rXti )
@@ -204,28 +205,30 @@ public:
const String& GetMacroName( sal_uInt16 nExtSheet, sal_uInt16 nExtName ) const;
private:
+ /** Returns the specified XTI (link entry from BIFF8 EXTERNSHEET record). */
+ const XclImpXti* GetXti( sal_uInt16 nXtiIndex ) const;
/** Returns the specified SUPBOOK (external document). */
- const XclImpSupbook* GetSupbook( sal_uInt32 nXtiIndex ) const;
- /** Returns the SUPBOOK (external workbook) specified by its URL. */
- const XclImpSupbook* GetSupbook( const String& rUrl ) const;
+ const XclImpSupbook* GetSupbook( sal_uInt16 nXtiIndex ) const;
+//UNUSED2009-05 /** Returns the SUPBOOK (external workbook) specified by its URL. */
+//UNUSED2009-05 const XclImpSupbook* GetSupbook( const String& rUrl ) const;
void LoadCachedValues();
- /** Finds the largest range of sheet indexes in a SUPBOOK after a start sheet index.
- @param rnSBTabFirst (out-param) The first sheet index of the range in SUPBOOK is returned here.
- @param rnSBTabLast (out-param) The last sheet index of the range in SUPBOOK is returned here (inclusive).
- @param nSupbook The list index of the SUPBOOK.
- @param nSBTabStart The first allowed sheet index. Sheet ranges with an earlier start index are ignored.
- @return true = the return values are valid; false = nothing found. */
- bool FindNextTabRange(
- sal_uInt16& rnSBTabFirst, sal_uInt16& rnSBTabLast,
- sal_uInt16 nSupbook, sal_uInt16 nSBTabStart ) const;
+//UNUSED2009-05 /** Finds the largest range of sheet indexes in a SUPBOOK after a start sheet index.
+//UNUSED2009-05 @param rnSBTabFirst (out-param) The first sheet index of the range in SUPBOOK is returned here.
+//UNUSED2009-05 @param rnSBTabLast (out-param) The last sheet index of the range in SUPBOOK is returned here (inclusive).
+//UNUSED2009-05 @param nSupbook The list index of the SUPBOOK.
+//UNUSED2009-05 @param nSBTabStart The first allowed sheet index. Sheet ranges with an earlier start index are ignored.
+//UNUSED2009-05 @return true = the return values are valid; false = nothing found. */
+//UNUSED2009-05 bool FindNextTabRange(
+//UNUSED2009-05 sal_uInt16& rnSBTabFirst, sal_uInt16& rnSBTabLast,
+//UNUSED2009-05 sal_uInt16 nSupbook, sal_uInt16 nSBTabStart ) const;
private:
- typedef ScfDelList< XclImpXti > XclImpXtiList;
+ typedef ::std::vector< XclImpXti > XclImpXtiVector;
typedef ScfDelList< XclImpSupbook > XclImpSupbookList;
- XclImpXtiList maXtiList; /// List of all XTI structures.
+ XclImpXtiVector maXtiList; /// List of all XTI structures.
XclImpSupbookList maSupbookList; /// List of external documents.
bool mbCreated; /// true = Calc sheets already created.
};
@@ -582,15 +585,17 @@ void XclImpLinkManagerImpl::ReadExternsheet( XclImpStream& rStrm )
{
sal_uInt16 nXtiCount;
rStrm >> nXtiCount;
-
- XclImpXti* pXti;
- while( nXtiCount )
- {
- pXti = new XclImpXti;
- rStrm >> *pXti;
- maXtiList.Append( pXti );
- --nXtiCount;
- }
+ DBG_ASSERT( static_cast< sal_Size >( nXtiCount * 6 ) == rStrm.GetRecLeft(), "XclImpLinkManagerImpl::ReadExternsheet - invalid count" );
+ nXtiCount = static_cast< sal_uInt16 >( ::std::min< sal_Size >( nXtiCount, rStrm.GetRecLeft() / 6 ) );
+
+ /* #i104057# A weird external XLS generator writes multiple EXTERNSHEET
+ records instead of only one as expected. Surprisingly, Excel seems to
+ insert the entries of the second record before the entries of the first
+ record. */
+ XclImpXtiVector aNewEntries( nXtiCount );
+ for( XclImpXtiVector::iterator aIt = aNewEntries.begin(), aEnd = aNewEntries.end(); rStrm.IsValid() && (aIt != aEnd); ++aIt )
+ rStrm >> *aIt;
+ maXtiList.insert( maXtiList.begin(), aNewEntries.begin(), aNewEntries.end() );
LoadCachedValues();
}
@@ -627,7 +632,7 @@ bool XclImpLinkManagerImpl::IsSelfRef( sal_uInt16 nXtiIndex ) const
bool XclImpLinkManagerImpl::GetScTabRange(
SCTAB& rnFirstScTab, SCTAB& rnLastScTab, sal_uInt16 nXtiIndex ) const
{
- if( const XclImpXti* pXti = maXtiList.GetObject( nXtiIndex ) )
+ if( const XclImpXti* pXti = GetXti( nXtiIndex ) )
{
if (maSupbookList.GetObject(pXti->mnSupbook))
{
@@ -671,20 +676,25 @@ const String& XclImpLinkManagerImpl::GetMacroName( sal_uInt16 nExtSheet, sal_uIn
return pSupbook ? pSupbook->GetMacroName( nExtName ) : EMPTY_STRING;
}
-const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( sal_uInt32 nXtiIndex ) const
+const XclImpXti* XclImpLinkManagerImpl::GetXti( sal_uInt16 nXtiIndex ) const
{
- const XclImpXti* pXti = maXtiList.GetObject( nXtiIndex );
- return pXti ? maSupbookList.GetObject( pXti->mnSupbook ) : 0;
+ return (nXtiIndex < maXtiList.size()) ? &maXtiList[ nXtiIndex ] : 0;
}
-const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( const String& rUrl ) const
+const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( sal_uInt16 nXtiIndex ) const
{
- for( const XclImpSupbook* pSupbook = maSupbookList.First(); pSupbook; pSupbook = maSupbookList.Next() )
- if( pSupbook->GetXclUrl() == rUrl )
- return pSupbook;
- return 0;
+ const XclImpXti* pXti = GetXti( nXtiIndex );
+ return pXti ? maSupbookList.GetObject( pXti->mnSupbook ) : 0;
}
+//UNUSED2009-05 const XclImpSupbook* XclImpLinkManagerImpl::GetSupbook( const String& rUrl ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 for( const XclImpSupbook* pSupbook = maSupbookList.First(); pSupbook; pSupbook = maSupbookList.Next() )
+//UNUSED2009-05 if( pSupbook->GetXclUrl() == rUrl )
+//UNUSED2009-05 return pSupbook;
+//UNUSED2009-05 return 0;
+//UNUSED2009-05 }
+
void XclImpLinkManagerImpl::LoadCachedValues()
{
// Read all CRN records which can be accessed via XclImpSupbook, and store
@@ -698,21 +708,21 @@ void XclImpLinkManagerImpl::LoadCachedValues()
}
}
-bool XclImpLinkManagerImpl::FindNextTabRange(
- sal_uInt16& rnSBTabFirst, sal_uInt16& rnSBTabLast,
- sal_uInt16 nSupbook, sal_uInt16 nSBTabStart ) const
-{
- rnSBTabFirst = rnSBTabLast = EXC_NOTAB;
- for( const XclImpXti* pXti = maXtiList.First(); pXti; pXti = maXtiList.Next() )
- {
- if( (nSupbook == pXti->mnSupbook) && (nSBTabStart <= pXti->mnSBTabLast) && (pXti->mnSBTabFirst < rnSBTabFirst) )
- {
- rnSBTabFirst = ::std::max( nSBTabStart, pXti->mnSBTabFirst );
- rnSBTabLast = pXti->mnSBTabLast;
- }
- }
- return rnSBTabFirst != EXC_NOTAB;
-}
+//UNUSED2009-05 bool XclImpLinkManagerImpl::FindNextTabRange(
+//UNUSED2009-05 sal_uInt16& rnSBTabFirst, sal_uInt16& rnSBTabLast,
+//UNUSED2009-05 sal_uInt16 nSupbook, sal_uInt16 nSBTabStart ) const
+//UNUSED2009-05 {
+//UNUSED2009-05 rnSBTabFirst = rnSBTabLast = EXC_NOTAB;
+//UNUSED2009-05 for( const XclImpXti* pXti = maXtiList.First(); pXti; pXti = maXtiList.Next() )
+//UNUSED2009-05 {
+//UNUSED2009-05 if( (nSupbook == pXti->mnSupbook) && (nSBTabStart <= pXti->mnSBTabLast) && (pXti->mnSBTabFirst < rnSBTabFirst) )
+//UNUSED2009-05 {
+//UNUSED2009-05 rnSBTabFirst = ::std::max( nSBTabStart, pXti->mnSBTabFirst );
+//UNUSED2009-05 rnSBTabLast = pXti->mnSBTabLast;
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 return rnSBTabFirst != EXC_NOTAB;
+//UNUSED2009-05 }
// ============================================================================
diff --git a/sc/source/filter/excel/xiroot.cxx b/sc/source/filter/excel/xiroot.cxx
index 55ba4bdc4cb4..30cab47f57f5 100644
--- a/sc/source/filter/excel/xiroot.cxx
+++ b/sc/source/filter/excel/xiroot.cxx
@@ -52,7 +52,6 @@
XclImpRootData::XclImpRootData( XclBiff eBiff, SfxMedium& rMedium,
SotStorageRef xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ) :
XclRootData( eBiff, rMedium, xRootStrg, rDoc, eTextEnc, false ),
- mbPassQueried( false ),
mbHasCodePage( false )
{
}
@@ -270,16 +269,5 @@ String XclImpRoot::GetScAddInName( const String& rXclName ) const
return rXclName;
}
-const String& XclImpRoot::QueryPassword() const
-{
- if( !mrImpData.mbPassQueried )
- {
- mrImpData.maPassw = ScfApiHelper::QueryPasswordForMedium( GetMedium() );
- // set to true, even if dialog has been cancelled (never ask twice)
- mrImpData.mbPassQueried = true;
- }
- return mrImpData.maPassw;
-}
-
// ============================================================================
diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx
index e7780c065118..a040f21b1c4f 100644
--- a/sc/source/filter/excel/xistream.cxx
+++ b/sc/source/filter/excel/xistream.cxx
@@ -31,13 +31,16 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-// ============================================================================
#include "xistream.hxx"
#include "xlstring.hxx"
#include "xiroot.hxx"
#include <vector>
+using ::rtl::OString;
+using ::rtl::OUString;
+using ::rtl::OUStringToOString;
+
// ============================================================================
// Decryption
// ============================================================================
@@ -50,6 +53,7 @@ XclImpDecrypter::XclImpDecrypter() :
}
XclImpDecrypter::XclImpDecrypter( const XclImpDecrypter& rSrc ) :
+ ::comphelper::IDocPasswordVerifier(),
mnError( rSrc.mnError ),
mnOldPos( STREAM_SEEK_TO_END ),
mnRecSize( 0 )
@@ -68,6 +72,13 @@ XclImpDecrypterRef XclImpDecrypter::Clone() const
return xNewDecr;
}
+::comphelper::DocPasswordVerifierResult XclImpDecrypter::verifyPassword( const OUString& rPassword )
+{
+ bool bValid = OnVerify( rPassword );
+ mnError = bValid ? ERRCODE_NONE : ERRCODE_ABORT;
+ return bValid ? ::comphelper::DocPasswordVerifierResult_OK : ::comphelper::DocPasswordVerifierResult_WRONG_PASSWORD;
+}
+
void XclImpDecrypter::Update( SvStream& rStrm, sal_uInt16 nRecSize )
{
if( IsValid() )
@@ -99,47 +110,48 @@ sal_uInt16 XclImpDecrypter::Read( SvStream& rStrm, void* pData, sal_uInt16 nByte
return nRet;
}
-const String XclImpDecrypter::GetPassword() const
-{
- return maPass;
-}
+// ----------------------------------------------------------------------------
-void XclImpDecrypter::SetHasValidPassword( bool bValid )
+XclImpBiff5Decrypter::XclImpBiff5Decrypter( sal_uInt16 nKey, sal_uInt16 nHash ) :
+ maPassword( 16 ),
+ mnKey( nKey ),
+ mnHash( nHash )
{
- mnError = bValid ? ERRCODE_NONE : EXC_ENCR_ERROR_WRONG_PASS;
}
-void XclImpDecrypter::SetPassword( const String& rPass )
+XclImpBiff5Decrypter::XclImpBiff5Decrypter( const XclImpBiff5Decrypter& rSrc ) :
+ XclImpDecrypter( rSrc ),
+ maPassword( rSrc.maPassword ),
+ mnKey( rSrc.mnKey ),
+ mnHash( rSrc.mnHash )
{
- maPass = rPass;
+ if( IsValid() )
+ maCodec.InitKey( &maPassword.front() );
}
-// ----------------------------------------------------------------------------
-
-XclImpBiff5Decrypter::XclImpBiff5Decrypter( const XclImpRoot& rRoot, sal_uInt16 nKey, sal_uInt16 nHash )
+XclImpBiff5Decrypter* XclImpBiff5Decrypter::OnClone() const
{
- Init( XclCryptoHelper::GetBiff5WbProtPassword(), nKey, nHash );
- if( !IsValid() )
- {
- //! TODO: correct byte string encoding in all cases?
- ByteString aPass( rRoot.QueryPassword(), RTL_TEXTENCODING_MS_1252 );
- Init( aPass, nKey, nHash );
- }
+ return new XclImpBiff5Decrypter( *this );
}
-XclImpBiff5Decrypter::XclImpBiff5Decrypter( const XclImpBiff5Decrypter& rSrc ) :
- XclImpDecrypter( rSrc )
+bool XclImpBiff5Decrypter::OnVerify( const OUString& rPassword )
{
- if( rSrc.IsValid() )
+ /* Convert password to a byte string. TODO: this needs some finetuning
+ according to the spec... */
+ OString aBytePassword = OUStringToOString( rPassword, osl_getThreadTextEncoding() );
+ sal_Int32 nLen = aBytePassword.getLength();
+ if( (0 < nLen) && (nLen < 16) )
{
- memcpy( mpnPassw, rSrc.mpnPassw, sizeof( mpnPassw ) );
- maCodec.InitKey( mpnPassw );
- }
-}
+ // copy byte string to sal_uInt8 array
+ maPassword.clear();
+ maPassword.resize( 16, 0 );
+ memcpy( &maPassword.front(), aBytePassword.getStr(), static_cast< size_t >( nLen ) );
-XclImpBiff5Decrypter* XclImpBiff5Decrypter::OnClone() const
-{
- return new XclImpBiff5Decrypter( *this );
+ // init codec
+ maCodec.InitKey( &maPassword.front() );
+ return maCodec.VerifyKey( mnKey, mnHash );
+ }
+ return false;
}
void XclImpBiff5Decrypter::OnUpdate( sal_Size /*nOldStrmPos*/, sal_Size nNewStrmPos, sal_uInt16 nRecSize )
@@ -155,48 +167,26 @@ sal_uInt16 XclImpBiff5Decrypter::OnRead( SvStream& rStrm, sal_uInt8* pnData, sal
return nRet;
}
-void XclImpBiff5Decrypter::Init( const ByteString& rPass, sal_uInt16 nKey, sal_uInt16 nHash )
-{
- xub_StrLen nLen = rPass.Len();
- bool bValid = (0 < nLen) && (nLen < 16);
-
- if( bValid )
- {
- // transform ByteString to sal_uInt8 array
- memset( mpnPassw, 0, sizeof( mpnPassw ) );
- for( xub_StrLen nChar = 0; nChar < nLen; ++nChar )
- mpnPassw[ nChar ] = static_cast< sal_uInt8 >( rPass.GetChar( nChar ) );
- // init codec
- maCodec.InitKey( mpnPassw );
- bValid = maCodec.VerifyKey( nKey, nHash );
-
- String aUniPass( rPass, RTL_TEXTENCODING_MS_1252 );
- SetPassword( aUniPass );
- }
-
- SetHasValidPassword( bValid );
-}
-
// ----------------------------------------------------------------------------
-XclImpBiff8Decrypter::XclImpBiff8Decrypter(
- const XclImpRoot& rRoot, sal_uInt8 pnDocId[ 16 ],
- sal_uInt8 pnSaltData[ 16 ], sal_uInt8 pnSaltHash[ 16 ] )
+XclImpBiff8Decrypter::XclImpBiff8Decrypter( sal_uInt8 pnSalt[ 16 ],
+ sal_uInt8 pnVerifier[ 16 ], sal_uInt8 pnVerifierHash[ 16 ] ) :
+ maPassword( 16, 0 ),
+ maSalt( pnSalt, pnSalt + 16 ),
+ maVerifier( pnVerifier, pnVerifier + 16 ),
+ maVerifierHash( pnVerifierHash, pnVerifierHash + 16 )
{
- Init( XclCryptoHelper::GetBiff8WbProtPassword(), pnDocId, pnSaltData, pnSaltHash );
- if( !IsValid() )
- Init( rRoot.QueryPassword(), pnDocId, pnSaltData, pnSaltHash );
}
XclImpBiff8Decrypter::XclImpBiff8Decrypter( const XclImpBiff8Decrypter& rSrc ) :
- XclImpDecrypter( rSrc )
+ XclImpDecrypter( rSrc ),
+ maPassword( rSrc.maPassword ),
+ maSalt( rSrc.maSalt ),
+ maVerifier( rSrc.maVerifier ),
+ maVerifierHash( rSrc.maVerifierHash )
{
- if( rSrc.IsValid() )
- {
- memcpy( mpnPassw, rSrc.mpnPassw, sizeof( mpnPassw ) );
- memcpy( mpnDocId, rSrc.mpnDocId, sizeof( mpnDocId ) );
- maCodec.InitKey( mpnPassw, mpnDocId );
- }
+ if( IsValid() )
+ maCodec.InitKey( &maPassword.front(), &maSalt.front() );
}
XclImpBiff8Decrypter* XclImpBiff8Decrypter::OnClone() const
@@ -204,6 +194,27 @@ XclImpBiff8Decrypter* XclImpBiff8Decrypter::OnClone() const
return new XclImpBiff8Decrypter( *this );
}
+bool XclImpBiff8Decrypter::OnVerify( const OUString& rPassword )
+{
+ sal_Int32 nLen = rPassword.getLength();
+ if( (0 < nLen) && (nLen < 16) )
+ {
+ // copy string to sal_uInt16 array
+ maPassword.clear();
+ maPassword.resize( 16, 0 );
+ const sal_Unicode* pcChar = rPassword.getStr();
+ const sal_Unicode* pcCharEnd = pcChar + nLen;
+ ::std::vector< sal_uInt16 >::iterator aIt = maPassword.begin();
+ for( ; pcChar < pcCharEnd; ++pcChar, ++aIt )
+ *aIt = static_cast< sal_uInt16 >( *pcChar );
+
+ // init codec
+ maCodec.InitKey( &maPassword.front(), &maSalt.front() );
+ return maCodec.VerifyKey( &maVerifier.front(), &maVerifierHash.front() );
+ }
+ return false;
+}
+
void XclImpBiff8Decrypter::OnUpdate( sal_Size nOldStrmPos, sal_Size nNewStrmPos, sal_uInt16 /*nRecSize*/ )
{
if( nNewStrmPos != nOldStrmPos )
@@ -252,31 +263,6 @@ sal_uInt16 XclImpBiff8Decrypter::OnRead( SvStream& rStrm, sal_uInt8* pnData, sal
return nRet;
}
-void XclImpBiff8Decrypter::Init(
- const String& rPass, sal_uInt8 pnDocId[ 16 ],
- sal_uInt8 pnSaltData[ 16 ], sal_uInt8 pnSaltHash[ 16 ] )
-{
- xub_StrLen nLen = rPass.Len();
- bool bValid = (0 < nLen) && (nLen < 16);
-
- if( bValid )
- {
- // transform String to sal_uInt16 array
- memset( mpnPassw, 0, sizeof( mpnPassw ) );
- for( xub_StrLen nChar = 0; nChar < nLen; ++nChar )
- mpnPassw[ nChar ] = static_cast< sal_uInt16 >( rPass.GetChar( nChar ) );
- // copy document ID
- memcpy( mpnDocId, pnDocId, sizeof( mpnDocId ) );
- // init codec
- maCodec.InitKey( mpnPassw, mpnDocId );
- bValid = maCodec.VerifyKey( pnSaltData, pnSaltHash );
-
- SetPassword(rPass);
- }
-
- SetHasValidPassword( bValid );
-}
-
sal_uInt32 XclImpBiff8Decrypter::GetBlock( sal_Size nStrmPos ) const
{
return static_cast< sal_uInt32 >( nStrmPos / EXC_ENCR_BLOCKSIZE );
@@ -428,6 +414,12 @@ bool XclImpStream::StartNextRecord()
return mbValidRec;
}
+bool XclImpStream::StartNextRecord( sal_Size nNextRecPos )
+{
+ mnNextRecPos = nNextRecPos;
+ return StartNextRecord();
+}
+
void XclImpStream::ResetRecord( bool bContLookup, sal_uInt16 nAltContId )
{
if( mbValidRec )
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 7f1627e89e7f..07368f6db680 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -968,9 +968,7 @@ XclImpXF::XclImpXF( const XclImpRoot& rRoot ) :
XclImpRoot( rRoot ),
mpStyleSheet( 0 ),
mnXclNumFmt( 0 ),
- mnXclFont( 0 ),
- mbWasBuiltIn( false ),
- mbForceCreate( false )
+ mnXclFont( 0 )
{
}
@@ -1088,32 +1086,61 @@ void XclImpXF::ReadXF( XclImpStream& rStrm )
}
}
-void XclImpXF::SetStyleName( const String& rStyleName )
+const ScPatternAttr& XclImpXF::CreatePattern( bool bSkipPoolDefs )
{
- DBG_ASSERT( IsStyleXF(), "XclImpXF::SetStyleName - not a style XF" );
- DBG_ASSERT( rStyleName.Len(), "XclImpXF::SetStyleName - style name empty" );
- if( IsStyleXF() && !maStyleName.Len() )
+ if( mpPattern.get() )
+ return *mpPattern;
+
+ // create new pattern attribute set
+ mpPattern.reset( new ScPatternAttr( GetDoc().GetPool() ) );
+ SfxItemSet& rItemSet = mpPattern->GetItemSet();
+
+ // parent cell style
+ if( IsCellXF() && !mpStyleSheet )
{
- maStyleName = rStyleName;
- mbForceCreate = true;
+ mpStyleSheet = GetXFBuffer().CreateStyleSheet( mnParent );
+ if( XclImpXF* pParentXF = GetXFBuffer().GetXF( mnParent ) )
+ UpdateUsedFlags( *pParentXF );
}
-}
-void XclImpXF::SetBuiltInStyleName( sal_uInt8 nStyleId, sal_uInt8 nLevel )
-{
- DBG_ASSERT( IsStyleXF(), "XclImpXF::SetStyleName - not a style XF" );
- if( IsStyleXF() && !maStyleName.Len() )
+ // cell protection
+ if( mbProtUsed )
+ maProtection.FillToItemSet( rItemSet, bSkipPoolDefs );
+
+ // font
+ if( mbFontUsed )
+ GetFontBuffer().FillToItemSet( rItemSet, EXC_FONTITEM_CELL, mnXclFont, bSkipPoolDefs );
+
+ // value format
+ if( mbFmtUsed )
{
- mbWasBuiltIn = true;
- maStyleName = XclTools::GetBuiltInStyleName( nStyleId, nLevel );
- mbForceCreate = nStyleId == EXC_STYLE_NORMAL; // force creation of "Default" style
+ GetNumFmtBuffer().FillToItemSet( rItemSet, mnXclNumFmt, bSkipPoolDefs );
+ // Trace occurrences of Windows date formats
+ GetTracer().TraceDates( mnXclNumFmt );
}
-}
-void XclImpXF::CreateUserStyle()
-{
- if( IsStyleXF() && mbForceCreate )
- CreateStyleSheet();
+ // alignment
+ if( mbAlignUsed )
+ maAlignment.FillToItemSet( rItemSet, GetFontBuffer().GetFont( mnXclFont ), bSkipPoolDefs );
+
+ // border
+ if( mbBorderUsed )
+ {
+ maBorder.FillToItemSet( rItemSet, GetPalette(), bSkipPoolDefs );
+ GetTracer().TraceBorderLineStyle(maBorder.mnLeftLine > EXC_LINE_HAIR ||
+ maBorder.mnRightLine > EXC_LINE_HAIR || maBorder.mnTopLine > EXC_LINE_HAIR ||
+ maBorder.mnBottomLine > EXC_LINE_HAIR );
+ }
+
+ // area
+ if( mbAreaUsed )
+ {
+ maArea.FillToItemSet( rItemSet, GetPalette(), bSkipPoolDefs );
+ GetTracer().TraceFillPattern(maArea.mnPattern != EXC_PATT_NONE &&
+ maArea.mnPattern != EXC_PATT_SOLID);
+ }
+
+ return *mpPattern;
}
void XclImpXF::ApplyPattern(
@@ -1176,94 +1203,100 @@ void XclImpXF::UpdateUsedFlags( const XclImpXF& rParentXF )
mbAreaUsed = !rParentXF.mbAreaUsed || !(maArea == rParentXF.maArea);
}
-const ScPatternAttr& XclImpXF::CreatePattern( bool bSkipPoolDefs )
-{
- if( mpPattern.get() )
- return *mpPattern;
-
- // create new pattern attribute set
- mpPattern.reset( new ScPatternAttr( GetDoc().GetPool() ) );
- SfxItemSet& rItemSet = mpPattern->GetItemSet();
-
- // parent cell style
- if( IsCellXF() )
- {
- if( XclImpXF* pParentXF = GetXFBuffer().GetXF( mnParent ) )
- {
- mpStyleSheet = pParentXF->CreateStyleSheet();
- UpdateUsedFlags( *pParentXF );
- }
- }
-
- // cell protection
- if( mbProtUsed )
- maProtection.FillToItemSet( rItemSet, bSkipPoolDefs );
+// ----------------------------------------------------------------------------
- // font
- if( mbFontUsed )
- GetFontBuffer().FillToItemSet( rItemSet, EXC_FONTITEM_CELL, mnXclFont, bSkipPoolDefs );
+XclImpStyle::XclImpStyle( const XclImpRoot& rRoot ) :
+ XclImpRoot( rRoot ),
+ mnXfId( EXC_XF_NOTFOUND ),
+ mnBuiltinId( EXC_STYLE_USERDEF ),
+ mnLevel( EXC_STYLE_NOLEVEL ),
+ mbBuiltin( false ),
+ mbCustom( false ),
+ mbHidden( false ),
+ mpStyleSheet( 0 )
+{
+}
- // value format
- if( mbFmtUsed )
- {
- GetNumFmtBuffer().FillToItemSet( rItemSet, mnXclNumFmt, bSkipPoolDefs );
- // Trace occurrences of Windows date formats
- GetTracer().TraceDates( mnXclNumFmt );
- }
+void XclImpStyle::ReadStyle( XclImpStream& rStrm )
+{
+ DBG_ASSERT_BIFF( GetBiff() >= EXC_BIFF3 );
- // alignment
- if( mbAlignUsed )
- maAlignment.FillToItemSet( rItemSet, GetFontBuffer().GetFont( mnXclFont ), bSkipPoolDefs );
+ sal_uInt16 nXFIndex;
+ rStrm >> nXFIndex;
+ mnXfId = nXFIndex & EXC_STYLE_XFMASK;
+ mbBuiltin = ::get_flag( nXFIndex, EXC_STYLE_BUILTIN );
- // border
- if( mbBorderUsed )
+ if( mbBuiltin )
{
- maBorder.FillToItemSet( rItemSet, GetPalette(), bSkipPoolDefs );
- GetTracer().TraceBorderLineStyle(maBorder.mnLeftLine > EXC_LINE_HAIR ||
- maBorder.mnRightLine > EXC_LINE_HAIR || maBorder.mnTopLine > EXC_LINE_HAIR ||
- maBorder.mnBottomLine > EXC_LINE_HAIR );
+ rStrm >> mnBuiltinId >> mnLevel;
}
-
- // area
- if( mbAreaUsed )
+ else
{
- maArea.FillToItemSet( rItemSet, GetPalette(), bSkipPoolDefs );
- GetTracer().TraceFillPattern(maArea.mnPattern != EXC_PATT_NONE &&
- maArea.mnPattern != EXC_PATT_SOLID);
+ maName = (GetBiff() <= EXC_BIFF5) ? rStrm.ReadByteString( false ) : rStrm.ReadUniString();
+ // #i103281# check if this is a new built-in style introduced in XL2007
+ if( (GetBiff() == EXC_BIFF8) && (rStrm.GetNextRecId() == EXC_ID_STYLEEXT) && rStrm.StartNextRecord() )
+ {
+ sal_uInt8 nExtFlags;
+ rStrm.Ignore( 12 );
+ rStrm >> nExtFlags;
+ mbBuiltin = ::get_flag( nExtFlags, EXC_STYLEEXT_BUILTIN );
+ mbCustom = ::get_flag( nExtFlags, EXC_STYLEEXT_CUSTOM );
+ mbHidden = ::get_flag( nExtFlags, EXC_STYLEEXT_HIDDEN );
+ if( mbBuiltin )
+ {
+ rStrm.Ignore( 1 ); // category
+ rStrm >> mnBuiltinId >> mnLevel;
+ }
+ }
}
-
- return *mpPattern;
}
-ScStyleSheet* XclImpXF::CreateStyleSheet()
+ScStyleSheet* XclImpStyle::CreateStyleSheet()
{
- if( !mpStyleSheet && maStyleName.Len() ) // valid name implies style XF
+ // #i1624# #i1768# ignore unnamed user styles
+ if( !mpStyleSheet && (maFinalName.Len() > 0) )
{
- // there may be a user-defined "Default" - test on built-in too!
- bool bDefStyle = mbWasBuiltIn && (maStyleName == ScGlobal::GetRscString( STR_STYLENAME_STANDARD ));
+ bool bCreatePattern = false;
+ XclImpXF* pXF = GetXFBuffer().GetXF( mnXfId );
+
+ bool bDefStyle = mbBuiltin && (mnBuiltinId == EXC_STYLE_NORMAL);
if( bDefStyle )
{
- // set all flags to true to get all items in CreatePattern()
- SetAllUsedFlags( true );
+ // set all flags to true to get all items in XclImpXF::CreatePattern()
+ if( pXF ) pXF->SetAllUsedFlags( true );
// use existing "Default" style sheet
mpStyleSheet = static_cast< ScStyleSheet* >( GetStyleSheetPool().Find(
ScGlobal::GetRscString( STR_STYLENAME_STANDARD ), SFX_STYLE_FAMILY_PARA ) );
- DBG_ASSERT( mpStyleSheet, "XclImpXF::CreateStyleSheet - Default style not found" );
+ DBG_ASSERT( mpStyleSheet, "XclImpStyle::CreateStyleSheet - Default style not found" );
+ bCreatePattern = true;
}
else
{
- /* mbWasBuiltIn==true forces renaming of equal-named user defined styles
- to be able to re-export built-in styles correctly. */
- mpStyleSheet = &ScfTools::MakeCellStyleSheet( GetStyleSheetPool(), maStyleName, mbWasBuiltIn );
+ /* #i103281# do not create another style sheet of the same name,
+ if it exists already. This is needed to prevent that styles
+ pasted from clipboard get duplicated over and over. */
+ mpStyleSheet = static_cast< ScStyleSheet* >( GetStyleSheetPool().Find( maFinalName, SFX_STYLE_FAMILY_PARA ) );
+ if( !mpStyleSheet )
+ {
+ mpStyleSheet = &static_cast< ScStyleSheet& >( GetStyleSheetPool().Make( maFinalName, SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_USERDEF ) );
+ bCreatePattern = true;
+ }
}
// bDefStyle==true omits default pool items in CreatePattern()
- if( mpStyleSheet )
- mpStyleSheet->GetItemSet().Put( CreatePattern( bDefStyle ).GetItemSet() );
+ if( bCreatePattern && mpStyleSheet && pXF )
+ mpStyleSheet->GetItemSet().Put( pXF->CreatePattern( bDefStyle ).GetItemSet() );
}
return mpStyleSheet;
}
+void XclImpStyle::CreateUserStyle( const String& rFinalName )
+{
+ maFinalName = rFinalName;
+ if( !IsBuiltin() || mbCustom )
+ CreateStyleSheet();
+}
+
// ----------------------------------------------------------------------------
XclImpXFBuffer::XclImpXFBuffer( const XclImpRoot& rRoot ) :
@@ -1274,6 +1307,9 @@ XclImpXFBuffer::XclImpXFBuffer( const XclImpRoot& rRoot ) :
void XclImpXFBuffer::Initialize()
{
maXFList.Clear();
+ maBuiltinStyles.Clear();
+ maUserStyles.Clear();
+ maStylesByXf.clear();
}
void XclImpXFBuffer::ReadXF( XclImpStream& rStrm )
@@ -1281,39 +1317,15 @@ void XclImpXFBuffer::ReadXF( XclImpStream& rStrm )
XclImpXF* pXF = new XclImpXF( GetRoot() );
pXF->ReadXF( rStrm );
maXFList.Append( pXF );
-
- if( (GetBiff() >= EXC_BIFF3) && (maXFList.Count() == 1) )
- // set the name of the "Default" cell style (always the first XF in an Excel file)
- pXF->SetBuiltInStyleName( EXC_STYLE_NORMAL, 0 );
}
void XclImpXFBuffer::ReadStyle( XclImpStream& rStrm )
{
- DBG_ASSERT_BIFF( GetBiff() >= EXC_BIFF3 );
-
- sal_uInt16 nXFIndex;
- rStrm >> nXFIndex;
-
- XclImpXF* pXF = GetXF( nXFIndex & EXC_STYLE_XFMASK ); // bits 0...11 are used for XF index
- if( pXF && pXF->IsStyleXF() )
- {
- if( ::get_flag( nXFIndex, EXC_STYLE_BUILTIN ) ) // built-in styles
- {
- sal_uInt8 nStyleId, nLevel;
- rStrm >> nStyleId >> nLevel;
- pXF->SetBuiltInStyleName( nStyleId, nLevel );
- }
- else // user-defined styles
- {
- String aStyleName;
- if( GetBiff() <= EXC_BIFF5 )
- aStyleName = rStrm.ReadByteString( false ); // 8 bit length
- else
- aStyleName = rStrm.ReadUniString();
- if( aStyleName.Len() ) // #i1624# #i1768# ignore unnamed styles
- pXF->SetStyleName( aStyleName );
- }
- }
+ XclImpStyle* pStyle = new XclImpStyle( GetRoot() );
+ pStyle->ReadStyle( rStrm );
+ (pStyle->IsBuiltin() ? maBuiltinStyles : maUserStyles).Append( pStyle );
+ DBG_ASSERT( maStylesByXf.count( pStyle->GetXfId() ) == 0, "XclImpXFBuffer::ReadStyle - multiple styles with equal XF identifier" );
+ maStylesByXf[ pStyle->GetXfId() ] = pStyle;
}
sal_uInt16 XclImpXFBuffer::GetFontIndex( sal_uInt16 nXFIndex ) const
@@ -1327,10 +1339,93 @@ const XclImpFont* XclImpXFBuffer::GetFont( sal_uInt16 nXFIndex ) const
return GetFontBuffer().GetFont( GetFontIndex( nXFIndex ) );
}
+namespace {
+
+/** Functor for case-insensitive string comparison, usable in maps etc. */
+struct IgnoreCaseCompare
+{
+ inline bool operator()( const String& rName1, const String& rName2 ) const
+ { return rName1.CompareIgnoreCaseToAscii( rName2 ) == COMPARE_LESS; }
+};
+
+} // namespace
+
void XclImpXFBuffer::CreateUserStyles()
{
- for( XclImpXF* pXF = maXFList.First(); pXF; pXF = maXFList.Next() )
- pXF->CreateUserStyle();
+ // calculate final names of all styles
+ typedef ::std::map< String, XclImpStyle*, IgnoreCaseCompare > CellStyleNameMap;
+ typedef ::std::vector< XclImpStyle* > XclImpStyleVector;
+
+ CellStyleNameMap aCellStyles;
+ XclImpStyleVector aConflictNameStyles;
+
+ /* First, reserve style names that are built-in in Calc. This causes that
+ imported cell styles get different unused names and thus do not try to
+ overwrite these built-in styles. For BIFF4 workbooks (which contain a
+ separate list of cell styles per sheet), reserve all existing styles if
+ current sheet is not the first sheet (this styles buffer will be
+ initialized again for every new sheet). This will create unique names
+ for styles in different sheets with the same name. Assuming that the
+ BIFF4W import filter is never used to import from clipboard... */
+ bool bReserveAll = (GetBiff() == EXC_BIFF4) && (GetCurrScTab() > 0);
+ SfxStyleSheetIterator aStyleIter( GetDoc().GetStyleSheetPool(), SFX_STYLE_FAMILY_PARA );
+ String aStandardName = ScGlobal::GetRscString( STR_STYLENAME_STANDARD );
+ for( SfxStyleSheetBase* pStyleSheet = aStyleIter.First(); pStyleSheet; pStyleSheet = aStyleIter.Next() )
+ if( (pStyleSheet->GetName() != aStandardName) && (bReserveAll || !pStyleSheet->IsUserDefined()) )
+ if( aCellStyles.count( pStyleSheet->GetName() ) == 0 )
+ aCellStyles[ pStyleSheet->GetName() ] = 0;
+
+ /* Calculate names of built-in styles. Store styles with reserved names
+ in the aConflictNameStyles list. */
+ for( XclImpStyle* pStyle = maBuiltinStyles.First(); pStyle; pStyle = maBuiltinStyles.Next() )
+ {
+ String aStyleName = XclTools::GetBuiltInStyleName( pStyle->GetBuiltinId(), pStyle->GetName(), pStyle->GetLevel() );
+ DBG_ASSERT( bReserveAll || (aCellStyles.count( aStyleName ) == 0),
+ "XclImpXFBuffer::CreateUserStyles - multiple styles with equal built-in identifier" );
+ if( aCellStyles.count( aStyleName ) > 0 )
+ aConflictNameStyles.push_back( pStyle );
+ else
+ aCellStyles[ aStyleName ] = pStyle;
+ }
+
+ /* Calculate names of user defined styles. Store styles with reserved
+ names in the aConflictNameStyles list. */
+ for( XclImpStyle* pStyle = maUserStyles.First(); pStyle; pStyle = maUserStyles.Next() )
+ {
+ // #i1624# #i1768# ignore unnamed user styles
+ if( pStyle->GetName().Len() > 0 )
+ {
+ if( aCellStyles.count( pStyle->GetName() ) > 0 )
+ aConflictNameStyles.push_back( pStyle );
+ else
+ aCellStyles[ pStyle->GetName() ] = pStyle;
+ }
+ }
+
+ // find unused names for all styles with conflicting names
+ for( XclImpStyleVector::iterator aIt = aConflictNameStyles.begin(), aEnd = aConflictNameStyles.end(); aIt != aEnd; ++aIt )
+ {
+ XclImpStyle* pStyle = *aIt;
+ String aUnusedName;
+ sal_Int32 nIndex = 0;
+ do
+ {
+ aUnusedName.Assign( pStyle->GetName() ).Append( ' ' ).Append( String::CreateFromInt32( ++nIndex ) );
+ }
+ while( aCellStyles.count( aUnusedName ) > 0 );
+ aCellStyles[ aUnusedName ] = pStyle;
+ }
+
+ // set final names and create user-defined and modified built-in cell styles
+ for( CellStyleNameMap::iterator aIt = aCellStyles.begin(), aEnd = aCellStyles.end(); aIt != aEnd; ++aIt )
+ if( aIt->second )
+ aIt->second->CreateUserStyle( aIt->first );
+}
+
+ScStyleSheet* XclImpXFBuffer::CreateStyleSheet( sal_uInt16 nXFIndex )
+{
+ XclImpStyleMap::iterator aIt = maStylesByXf.find( nXFIndex );
+ return (aIt == maStylesByXf.end()) ? 0 : aIt->second->CreateStyleSheet();
}
void XclImpXFBuffer::ApplyPattern(
diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx
index dfe74405fbf6..d5664c088e29 100644
--- a/sc/source/filter/excel/xlchart.cxx
+++ b/sc/source/filter/excel/xlchart.cxx
@@ -504,35 +504,36 @@ const XclChFormatInfo& XclChFormatInfoProvider::GetFormatInfo( XclChObjectType e
namespace {
// chart type service names
-const sal_Char SERVICE_CHART2_AREA[] = "com.sun.star.chart2.AreaChartType";
-const sal_Char SERVICE_CHART2_CANDLE[] = "com.sun.star.chart2.CandleStickChartType";
-const sal_Char SERVICE_CHART2_COLUMN[] = "com.sun.star.chart2.ColumnChartType";
-const sal_Char SERVICE_CHART2_LINE[] = "com.sun.star.chart2.LineChartType";
-const sal_Char SERVICE_CHART2_NET[] = "com.sun.star.chart2.NetChartType";
-const sal_Char SERVICE_CHART2_PIE[] = "com.sun.star.chart2.PieChartType";
-const sal_Char SERVICE_CHART2_SCATTER[] = "com.sun.star.chart2.ScatterChartType";
-const sal_Char SERVICE_CHART2_BUBBLE[] = "com.sun.star.chart2.BubbleChartType";
-const sal_Char SERVICE_CHART2_SURFACE[] = "com.sun.star.chart2.ColumnChartType"; // Todo
+const sal_Char SERVICE_CHART2_AREA[] = "com.sun.star.chart2.AreaChartType";
+const sal_Char SERVICE_CHART2_CANDLE[] = "com.sun.star.chart2.CandleStickChartType";
+const sal_Char SERVICE_CHART2_COLUMN[] = "com.sun.star.chart2.ColumnChartType";
+const sal_Char SERVICE_CHART2_LINE[] = "com.sun.star.chart2.LineChartType";
+const sal_Char SERVICE_CHART2_NET[] = "com.sun.star.chart2.NetChartType";
+const sal_Char SERVICE_CHART2_FILLEDNET[] = "com.sun.star.chart2.FilledNetChartType";
+const sal_Char SERVICE_CHART2_PIE[] = "com.sun.star.chart2.PieChartType";
+const sal_Char SERVICE_CHART2_SCATTER[] = "com.sun.star.chart2.ScatterChartType";
+const sal_Char SERVICE_CHART2_BUBBLE[] = "com.sun.star.chart2.BubbleChartType";
+const sal_Char SERVICE_CHART2_SURFACE[] = "com.sun.star.chart2.ColumnChartType"; // Todo
namespace csscd = ::com::sun::star::chart::DataLabelPlacement;
static const XclChTypeInfo spTypeInfos[] =
{
- // chart type chart type category record id service varied point color def label pos comb2d 3d polar area2d area3d 1stvis xcateg swap stack revers betw
- { EXC_CHTYPEID_BAR, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, true, true, false, true, true, false, true, false, true, false, true },
- { EXC_CHTYPEID_HORBAR, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, false, true, false, true, true, false, true, true, true, false, true },
- { EXC_CHTYPEID_LINE, EXC_CHTYPECATEG_LINE, EXC_ID_CHLINE, SERVICE_CHART2_LINE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, true, false, false, true, false, true, false, true, false, false },
- { EXC_CHTYPEID_AREA, EXC_CHTYPECATEG_LINE, EXC_ID_CHAREA, SERVICE_CHART2_AREA, EXC_CHVARPOINT_NONE, csscd::CENTER, true, true, false, true, true, false, true, false, true, true, false },
- { EXC_CHTYPEID_STOCK, EXC_CHTYPECATEG_LINE, EXC_ID_CHLINE, SERVICE_CHART2_CANDLE, EXC_CHVARPOINT_NONE, csscd::RIGHT, true, false, false, false, false, false, true, false, true, false, false },
- { EXC_CHTYPEID_RADARLINE, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARLINE, SERVICE_CHART2_NET, EXC_CHVARPOINT_SINGLE, csscd::TOP, false, false, true, false, true, false, true, false, false, false, false },
- { EXC_CHTYPEID_RADARAREA, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARAREA, SERVICE_CHART2_NET, EXC_CHVARPOINT_NONE, csscd::TOP, false, false, true, true, true, false, true, false, false, false, false },
- { EXC_CHTYPEID_PIE, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, true, true, false, false, false, false },
- { EXC_CHTYPEID_DONUT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, false, true, false, false, true, false },
- { EXC_CHTYPEID_PIEEXT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIEEXT, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, false, true, true, true, true, true, false, false, false, false },
- { EXC_CHTYPEID_SCATTER, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_SCATTER, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, false, false, false, true, false, false, false, false, false, false },
- { EXC_CHTYPEID_BUBBLES, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_BUBBLE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, false, false, false, true, true, false, false, false, false, false, false },
- { EXC_CHTYPEID_SURFACE, EXC_CHTYPECATEG_SURFACE, EXC_ID_CHSURFACE, SERVICE_CHART2_SURFACE, EXC_CHVARPOINT_NONE, csscd::RIGHT, false, true, false, true, true, false, true, false, false, false, false },
- { EXC_CHTYPEID_UNKNOWN, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, true, true, false, true, true, false, true, false, true, false, true }
+ // chart type chart type category record id service varied point color def label pos comb2d 3d polar area2d area3d 1stvis xcateg swap stack revers betw
+ { EXC_CHTYPEID_BAR, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, true, true, false, true, true, false, true, false, true, false, true },
+ { EXC_CHTYPEID_HORBAR, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, false, true, false, true, true, false, true, true, true, false, true },
+ { EXC_CHTYPEID_LINE, EXC_CHTYPECATEG_LINE, EXC_ID_CHLINE, SERVICE_CHART2_LINE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, true, false, false, true, false, true, false, true, false, false },
+ { EXC_CHTYPEID_AREA, EXC_CHTYPECATEG_LINE, EXC_ID_CHAREA, SERVICE_CHART2_AREA, EXC_CHVARPOINT_NONE, csscd::CENTER, true, true, false, true, true, false, true, false, true, true, false },
+ { EXC_CHTYPEID_STOCK, EXC_CHTYPECATEG_LINE, EXC_ID_CHLINE, SERVICE_CHART2_CANDLE, EXC_CHVARPOINT_NONE, csscd::RIGHT, true, false, false, false, false, false, true, false, true, false, false },
+ { EXC_CHTYPEID_RADARLINE, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARLINE, SERVICE_CHART2_NET, EXC_CHVARPOINT_SINGLE, csscd::TOP, false, false, true, false, true, false, true, false, false, false, false },
+ { EXC_CHTYPEID_RADARAREA, EXC_CHTYPECATEG_RADAR, EXC_ID_CHRADARAREA, SERVICE_CHART2_FILLEDNET, EXC_CHVARPOINT_NONE, csscd::TOP, false, false, true, true, true, false, true, false, false, true, false },
+ { EXC_CHTYPEID_PIE, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, true, true, false, false, false, false },
+ { EXC_CHTYPEID_DONUT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIE, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, true, true, true, true, false, true, false, false, true, false },
+ { EXC_CHTYPEID_PIEEXT, EXC_CHTYPECATEG_PIE, EXC_ID_CHPIEEXT, SERVICE_CHART2_PIE, EXC_CHVARPOINT_MULTI, csscd::AVOID_OVERLAP, false, false, true, true, true, true, true, false, false, false, false },
+ { EXC_CHTYPEID_SCATTER, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_SCATTER, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, true, false, false, false, true, false, false, false, false, false, false },
+ { EXC_CHTYPEID_BUBBLES, EXC_CHTYPECATEG_SCATTER, EXC_ID_CHSCATTER, SERVICE_CHART2_BUBBLE, EXC_CHVARPOINT_SINGLE, csscd::RIGHT, false, false, false, true, true, false, false, false, false, false, false },
+ { EXC_CHTYPEID_SURFACE, EXC_CHTYPECATEG_SURFACE, EXC_ID_CHSURFACE, SERVICE_CHART2_SURFACE, EXC_CHVARPOINT_NONE, csscd::RIGHT, false, true, false, true, true, false, true, false, false, false, false },
+ { EXC_CHTYPEID_UNKNOWN, EXC_CHTYPECATEG_BAR, EXC_ID_CHBAR, SERVICE_CHART2_COLUMN, EXC_CHVARPOINT_SINGLE, csscd::OUTSIDE, true, true, false, true, true, false, true, false, true, false, true }
};
} // namespace
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index 2e15a39e68dd..b8c18eb3e7c0 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -30,16 +30,18 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-#include "xestream.hxx"
#include "xlformula.hxx"
+
#include "compiler.hxx"
#include "rangenam.hxx"
-#include "xlroot.hxx"
-#include "xistream.hxx"
#include "token.hxx"
#include "tokenarray.hxx"
+#include "xestream.hxx"
+#include "xistream.hxx"
+#include "xlroot.hxx"
+
+using namespace ::formula;
-using namespace formula;
// Function data ==============================================================
String XclFunctionInfo::GetMacroFuncName() const
@@ -49,278 +51,291 @@ String XclFunctionInfo::GetMacroFuncName() const
return EMPTY_STRING;
}
+// abbreviations for function return token class
const sal_uInt8 R = EXC_TOKCLASS_REF;
const sal_uInt8 V = EXC_TOKCLASS_VAL;
const sal_uInt8 A = EXC_TOKCLASS_ARR;
-const sal_uInt8 C = EXC_FUNC_PAR_CALCONLY;
-const sal_uInt8 E = EXC_FUNC_PAR_EXCELONLY;
-const sal_uInt8 I = EXC_FUNC_PAR_INVALID;
+
+// abbreviations for parameter infos
+#define RO { EXC_PARAM_REGULAR, EXC_PARAMCONV_ORG, false }
+#define RV { EXC_PARAM_REGULAR, EXC_PARAMCONV_VAL, false }
+#define RA { EXC_PARAM_REGULAR, EXC_PARAMCONV_ARR, false }
+#define RR { EXC_PARAM_REGULAR, EXC_PARAMCONV_RPT, false }
+#define RX { EXC_PARAM_REGULAR, EXC_PARAMCONV_RPX, false }
+#define VO { EXC_PARAM_REGULAR, EXC_PARAMCONV_ORG, true }
+#define VV { EXC_PARAM_REGULAR, EXC_PARAMCONV_VAL, true }
+#define VA { EXC_PARAM_REGULAR, EXC_PARAMCONV_ARR, true }
+#define VR { EXC_PARAM_REGULAR, EXC_PARAMCONV_RPT, true }
+#define VX { EXC_PARAM_REGULAR, EXC_PARAMCONV_RPX, true }
+#define RO_E { EXC_PARAM_EXCELONLY, EXC_PARAMCONV_ORG, false }
+#define VR_E { EXC_PARAM_EXCELONLY, EXC_PARAMCONV_RPT, true }
+#define C { EXC_PARAM_CALCONLY, EXC_PARAMCONV_ORG, false }
/** Functions new in BIFF2. */
static const XclFunctionInfo saFuncTable_2[] =
{
- { ocCount, 0, 0, 30, V, { R }, 0, 0 },
- { ocIf, 1, 2, 3, R, { V, R }, 0, 0 },
- { ocIsNA, 2, 1, 1, V, { V }, 0, 0 },
- { ocIsError, 3, 1, 1, V, { V }, 0, 0 },
- { ocSum, 4, 0, 30, V, { R }, 0, 0 },
- { ocAverage, 5, 1, 30, V, { R }, 0, 0 },
- { ocMin, 6, 1, 30, V, { R }, 0, 0 },
- { ocMax, 7, 1, 30, V, { R }, 0, 0 },
- { ocRow, 8, 0, 1, V, { R }, 0, 0 },
- { ocColumn, 9, 0, 1, V, { R }, 0, 0 },
+ { ocCount, 0, 0, 30, V, { RX }, 0, 0 },
+ { ocIf, 1, 2, 3, R, { VO, RO }, 0, 0 },
+ { ocIsNA, 2, 1, 1, V, { VR }, 0, 0 },
+ { ocIsError, 3, 1, 1, V, { VR }, 0, 0 },
+ { ocSum, 4, 0, 30, V, { RX }, 0, 0 },
+ { ocAverage, 5, 1, 30, V, { RX }, 0, 0 },
+ { ocMin, 6, 1, 30, V, { RX }, 0, 0 },
+ { ocMax, 7, 1, 30, V, { RX }, 0, 0 },
+ { ocRow, 8, 0, 1, V, { RO }, 0, 0 },
+ { ocColumn, 9, 0, 1, V, { RO }, 0, 0 },
{ ocNotAvail, 10, 0, 0, V, {}, 0, 0 },
- { ocNPV, 11, 2, 30, V, { V, R }, 0, 0 },
- { ocStDev, 12, 1, 30, V, { R }, 0, 0 },
- { ocCurrency, 13, 1, 2, V, { V }, 0, 0 },
- { ocFixed, 14, 1, 2, V, { V, V, C, I }, 0, 0 },
- { ocSin, 15, 1, 1, V, { V }, 0, 0 },
- { ocCos, 16, 1, 1, V, { V }, 0, 0 },
- { ocTan, 17, 1, 1, V, { V }, 0, 0 },
- { ocCot, 17, 1, 1, V, { V }, EXC_FUNCFLAG_EXPORTONLY, 0 },
- { ocArcTan, 18, 1, 1, V, { V }, 0, 0 },
- { ocArcCot, 18, 1, 1, V, { V }, EXC_FUNCFLAG_EXPORTONLY, 0 },
+ { ocNPV, 11, 2, 30, V, { VR, RX }, 0, 0 },
+ { ocStDev, 12, 1, 30, V, { RX }, 0, 0 },
+ { ocCurrency, 13, 1, 2, V, { VR }, 0, 0 },
+ { ocFixed, 14, 1, 2, V, { VR, VR, C }, 0, 0 },
+ { ocSin, 15, 1, 1, V, { VR }, 0, 0 },
+ { ocCos, 16, 1, 1, V, { VR }, 0, 0 },
+ { ocTan, 17, 1, 1, V, { VR }, 0, 0 },
+ { ocCot, 17, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, 0 },
+ { ocArcTan, 18, 1, 1, V, { VR }, 0, 0 },
+ { ocArcCot, 18, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, 0 },
{ ocPi, 19, 0, 0, V, {}, 0, 0 },
- { ocSqrt, 20, 1, 1, V, { V }, 0, 0 },
- { ocExp, 21, 1, 1, V, { V }, 0, 0 },
- { ocLn, 22, 1, 1, V, { V }, 0, 0 },
- { ocLog10, 23, 1, 1, V, { V }, 0, 0 },
- { ocAbs, 24, 1, 1, V, { V }, 0, 0 },
- { ocInt, 25, 1, 1, V, { V }, 0, 0 },
- { ocPlusMinus, 26, 1, 1, V, { V }, 0, 0 },
- { ocRound, 27, 2, 2, V, { V }, 0, 0 },
- { ocLookup, 28, 2, 3, V, { V, R }, 0, 0 },
- { ocIndex, 29, 2, 4, R, { R, V }, 0, 0 },
- { ocRept, 30, 2, 2, V, { V }, 0, 0 },
- { ocMid, 31, 3, 3, V, { V }, 0, 0 },
- { ocLen, 32, 1, 1, V, { V }, 0, 0 },
- { ocValue, 33, 1, 1, V, { V }, 0, 0 },
+ { ocSqrt, 20, 1, 1, V, { VR }, 0, 0 },
+ { ocExp, 21, 1, 1, V, { VR }, 0, 0 },
+ { ocLn, 22, 1, 1, V, { VR }, 0, 0 },
+ { ocLog10, 23, 1, 1, V, { VR }, 0, 0 },
+ { ocAbs, 24, 1, 1, V, { VR }, 0, 0 },
+ { ocInt, 25, 1, 1, V, { VR }, 0, 0 },
+ { ocPlusMinus, 26, 1, 1, V, { VR }, 0, 0 },
+ { ocRound, 27, 2, 2, V, { VR }, 0, 0 },
+ { ocLookup, 28, 2, 3, V, { VR, RA }, 0, 0 },
+ { ocIndex, 29, 2, 4, R, { RA, VV }, 0, 0 },
+ { ocRept, 30, 2, 2, V, { VR }, 0, 0 },
+ { ocMid, 31, 3, 3, V, { VR }, 0, 0 },
+ { ocLen, 32, 1, 1, V, { VR }, 0, 0 },
+ { ocValue, 33, 1, 1, V, { VR }, 0, 0 },
{ ocTrue, 34, 0, 0, V, {}, 0, 0 },
{ ocFalse, 35, 0, 0, V, {}, 0, 0 },
- { ocAnd, 36, 1, 30, V, { R }, 0, 0 },
- { ocOr, 37, 1, 30, V, { R }, 0, 0 },
- { ocNot, 38, 1, 1, V, { V }, 0, 0 },
- { ocMod, 39, 2, 2, V, { V }, 0, 0 },
- { ocDBCount, 40, 3, 3, V, { R }, 0, 0 },
- { ocDBSum, 41, 3, 3, V, { R }, 0, 0 },
- { ocDBAverage, 42, 3, 3, V, { R }, 0, 0 },
- { ocDBMin, 43, 3, 3, V, { R }, 0, 0 },
- { ocDBMax, 44, 3, 3, V, { R }, 0, 0 },
- { ocDBStdDev, 45, 3, 3, V, { R }, 0, 0 },
- { ocVar, 46, 1, 30, V, { R }, 0, 0 },
- { ocDBVar, 47, 3, 3, V, { R }, 0, 0 },
- { ocText, 48, 2, 2, V, { V }, 0, 0 },
- { ocRGP, 49, 1, 2, A, { R, R, C, C, I }, 0, 0 },
- { ocTrend, 50, 1, 3, A, { R, R, R, C, I }, 0, 0 },
- { ocRKP, 51, 1, 2, A, { R, R, C, C, I }, 0, 0 },
- { ocGrowth, 52, 1, 3, A, { R, R, R, C, I }, 0, 0 },
- { ocBW, 56, 3, 5, V, { V }, 0, 0 },
- { ocZW, 57, 3, 5, V, { V }, 0, 0 },
- { ocZZR, 58, 3, 5, V, { V }, 0, 0 },
- { ocRMZ, 59, 3, 5, V, { V }, 0, 0 },
- { ocZins, 60, 3, 6, V, { V }, 0, 0 },
- { ocMIRR, 61, 3, 3, V, { R, V }, 0, 0 },
- { ocIRR, 62, 1, 2, V, { R, V }, 0, 0 },
+ { ocAnd, 36, 1, 30, V, { RX }, 0, 0 },
+ { ocOr, 37, 1, 30, V, { RX }, 0, 0 },
+ { ocNot, 38, 1, 1, V, { VR }, 0, 0 },
+ { ocMod, 39, 2, 2, V, { VR }, 0, 0 },
+ { ocDBCount, 40, 3, 3, V, { RO, RR }, 0, 0 },
+ { ocDBSum, 41, 3, 3, V, { RO, RR }, 0, 0 },
+ { ocDBAverage, 42, 3, 3, V, { RO, RR }, 0, 0 },
+ { ocDBMin, 43, 3, 3, V, { RO, RR }, 0, 0 },
+ { ocDBMax, 44, 3, 3, V, { RO, RR }, 0, 0 },
+ { ocDBStdDev, 45, 3, 3, V, { RO, RR }, 0, 0 },
+ { ocVar, 46, 1, 30, V, { RX }, 0, 0 },
+ { ocDBVar, 47, 3, 3, V, { RO, RR }, 0, 0 },
+ { ocText, 48, 2, 2, V, { VR }, 0, 0 },
+ { ocRGP, 49, 1, 2, A, { RA, RA, C, C }, 0, 0 },
+ { ocTrend, 50, 1, 3, A, { RA, RA, RA, C }, 0, 0 },
+ { ocRKP, 51, 1, 2, A, { RA, RA, C, C }, 0, 0 },
+ { ocGrowth, 52, 1, 3, A, { RA, RA, RA, C }, 0, 0 },
+ { ocBW, 56, 3, 5, V, { VR }, 0, 0 },
+ { ocZW, 57, 3, 5, V, { VR }, 0, 0 },
+ { ocZZR, 58, 3, 5, V, { VR }, 0, 0 },
+ { ocRMZ, 59, 3, 5, V, { VR }, 0, 0 },
+ { ocZins, 60, 3, 6, V, { VR }, 0, 0 },
+ { ocMIRR, 61, 3, 3, V, { RA, VR }, 0, 0 },
+ { ocIRR, 62, 1, 2, V, { RA, VR }, 0, 0 },
{ ocRandom, 63, 0, 0, V, {}, EXC_FUNCFLAG_VOLATILE, 0 },
- { ocMatch, 64, 2, 3, V, { V, R }, 0, 0 },
- { ocGetDate, 65, 3, 3, V, { V }, 0, 0 },
- { ocGetTime, 66, 3, 3, V, { V }, 0, 0 },
- { ocGetDay, 67, 1, 1, V, { V }, 0, 0 },
- { ocGetMonth, 68, 1, 1, V, { V }, 0, 0 },
- { ocGetYear, 69, 1, 1, V, { V }, 0, 0 },
- { ocGetDayOfWeek, 70, 1, 1, V, { V, C, I }, 0, 0 },
- { ocGetHour, 71, 1, 1, V, { V }, 0, 0 },
- { ocGetMin, 72, 1, 1, V, { V }, 0, 0 },
- { ocGetSec, 73, 1, 1, V, { V }, 0, 0 },
+ { ocMatch, 64, 2, 3, V, { VR, RX, RR }, 0, 0 },
+ { ocGetDate, 65, 3, 3, V, { VR }, 0, 0 },
+ { ocGetTime, 66, 3, 3, V, { VR }, 0, 0 },
+ { ocGetDay, 67, 1, 1, V, { VR }, 0, 0 },
+ { ocGetMonth, 68, 1, 1, V, { VR }, 0, 0 },
+ { ocGetYear, 69, 1, 1, V, { VR }, 0, 0 },
+ { ocGetDayOfWeek, 70, 1, 1, V, { VR, C }, 0, 0 },
+ { ocGetHour, 71, 1, 1, V, { VR }, 0, 0 },
+ { ocGetMin, 72, 1, 1, V, { VR }, 0, 0 },
+ { ocGetSec, 73, 1, 1, V, { VR }, 0, 0 },
{ ocGetActTime, 74, 0, 0, V, {}, EXC_FUNCFLAG_VOLATILE, 0 },
- { ocAreas, 75, 1, 1, V, { R }, 0, 0 },
- { ocRows, 76, 1, 1, V, { R }, 0, 0 },
- { ocColumns, 77, 1, 1, V, { R }, 0, 0 },
- { ocOffset, 78, 3, 5, R, { R, V }, EXC_FUNCFLAG_VOLATILE, 0 },
- { ocSearch, 82, 2, 3, V, { V }, 0, 0 },
- { ocMatTrans, 83, 1, 1, A, { A }, 0, 0 },
- { ocType, 86, 1, 1, V, { V }, 0, 0 },
- { ocArcTan2, 97, 2, 2, V, { V }, 0, 0 },
- { ocArcSin, 98, 1, 1, V, { V }, 0, 0 },
- { ocArcCos, 99, 1, 1, V, { V }, 0, 0 },
- { ocChose, 100, 2, 30, R, { V, R }, 0, 0 },
- { ocHLookup, 101, 3, 3, V, { V, R, R, C, I }, 0, 0 },
- { ocVLookup, 102, 3, 3, V, { V, R, R, C, I }, 0, 0 },
- { ocIsRef, 105, 1, 1, V, { R }, 0, 0 },
- { ocLog, 109, 1, 2, V, { V }, 0, 0 },
- { ocChar, 111, 1, 1, V, { V }, 0, 0 },
- { ocLower, 112, 1, 1, V, { V }, 0, 0 },
- { ocUpper, 113, 1, 1, V, { V }, 0, 0 },
- { ocPropper, 114, 1, 1, V, { V }, 0, 0 },
- { ocLeft, 115, 1, 2, V, { V }, 0, 0 },
- { ocRight, 116, 1, 2, V, { V }, 0, 0 },
- { ocExact, 117, 2, 2, V, { V }, 0, 0 },
- { ocTrim, 118, 1, 1, V, { V }, 0, 0 },
- { ocReplace, 119, 4, 4, V, { V }, 0, 0 },
- { ocSubstitute, 120, 3, 4, V, { V }, 0, 0 },
- { ocCode, 121, 1, 1, V, { V }, 0, 0 },
- { ocFind, 124, 2, 3, V, { V }, 0, 0 },
- { ocCell, 125, 1, 2, V, { V, R }, EXC_FUNCFLAG_VOLATILE, 0 },
- { ocIsErr, 126, 1, 1, V, { V }, 0, 0 },
- { ocIsString, 127, 1, 1, V, { V }, 0, 0 },
- { ocIsValue, 128, 1, 1, V, { V }, 0, 0 },
- { ocIsEmpty, 129, 1, 1, V, { V }, 0, 0 },
- { ocT, 130, 1, 1, V, { R }, 0, 0 },
- { ocN, 131, 1, 1, V, { R }, 0, 0 },
- { ocGetDateValue, 140, 1, 1, V, { V }, 0, 0 },
- { ocGetTimeValue, 141, 1, 1, V, { V }, 0, 0 },
- { ocLIA, 142, 3, 3, V, { V }, 0, 0 },
- { ocDIA, 143, 4, 4, V, { V }, 0, 0 },
- { ocGDA, 144, 4, 5, V, { V }, 0, 0 },
- { ocIndirect, 148, 1, 2, R, { V }, EXC_FUNCFLAG_VOLATILE, 0 },
- { ocClean, 162, 1, 1, V, { V }, 0, 0 },
- { ocMatDet, 163, 1, 1, V, { A }, 0, 0 },
- { ocMatInv, 164, 1, 1, A, { A }, 0, 0 },
- { ocMatMult, 165, 2, 2, A, { A }, 0, 0 },
- { ocZinsZ, 167, 4, 6, V, { V }, 0, 0 },
- { ocKapz, 168, 4, 6, V, { V }, 0, 0 },
- { ocCount2, 169, 0, 30, V, { R }, 0, 0 },
- { ocProduct, 183, 0, 30, V, { R }, 0, 0 },
- { ocFact, 184, 1, 1, V, { V }, 0, 0 },
- { ocDBProduct, 189, 3, 3, V, { R }, 0, 0 },
- { ocIsNonString, 190, 1, 1, V, { V }, 0, 0 },
- { ocStDevP, 193, 1, 30, V, { R }, 0, 0 },
- { ocVarP, 194, 1, 30, V, { R }, 0, 0 },
- { ocDBStdDevP, 195, 3, 3, V, { R }, 0, 0 },
- { ocDBVarP, 196, 3, 3, V, { R }, 0, 0 },
- { ocTrunc, 197, 1, 1, V, { V, C, I }, 0, 0 },
- { ocIsLogical, 198, 1, 1, V, { V }, 0, 0 },
- { ocDBCount2, 199, 3, 3, V, { R }, 0, 0 },
- { ocCurrency, 204, 1, 2, V, { V }, EXC_FUNCFLAG_IMPORTONLY, 0 },
- { ocRoundUp, 212, 2, 2, V, { V }, 0, 0 },
- { ocRoundDown, 213, 2, 2, V, { V }, 0, 0 },
- { ocExternal, 255, 1, 30, R, { E, R }, EXC_FUNCFLAG_IMPORTONLY, 0 }
+ { ocAreas, 75, 1, 1, V, { RO }, 0, 0 },
+ { ocRows, 76, 1, 1, V, { RO }, 0, 0 },
+ { ocColumns, 77, 1, 1, V, { RO }, 0, 0 },
+ { ocOffset, 78, 3, 5, R, { RO, VR }, EXC_FUNCFLAG_VOLATILE, 0 },
+ { ocSearch, 82, 2, 3, V, { VR }, 0, 0 },
+ { ocMatTrans, 83, 1, 1, A, { VO }, 0, 0 },
+ { ocType, 86, 1, 1, V, { VX }, 0, 0 },
+ { ocArcTan2, 97, 2, 2, V, { VR }, 0, 0 },
+ { ocArcSin, 98, 1, 1, V, { VR }, 0, 0 },
+ { ocArcCos, 99, 1, 1, V, { VR }, 0, 0 },
+ { ocChose, 100, 2, 30, R, { VO, RO }, 0, 0 },
+ { ocHLookup, 101, 3, 3, V, { VV, RO, RO, C }, 0, 0 },
+ { ocVLookup, 102, 3, 3, V, { VV, RO, RO, C }, 0, 0 },
+ { ocIsRef, 105, 1, 1, V, { RX }, 0, 0 },
+ { ocLog, 109, 1, 2, V, { VR }, 0, 0 },
+ { ocChar, 111, 1, 1, V, { VR }, 0, 0 },
+ { ocLower, 112, 1, 1, V, { VR }, 0, 0 },
+ { ocUpper, 113, 1, 1, V, { VR }, 0, 0 },
+ { ocPropper, 114, 1, 1, V, { VR }, 0, 0 },
+ { ocLeft, 115, 1, 2, V, { VR }, 0, 0 },
+ { ocRight, 116, 1, 2, V, { VR }, 0, 0 },
+ { ocExact, 117, 2, 2, V, { VR }, 0, 0 },
+ { ocTrim, 118, 1, 1, V, { VR }, 0, 0 },
+ { ocReplace, 119, 4, 4, V, { VR }, 0, 0 },
+ { ocSubstitute, 120, 3, 4, V, { VR }, 0, 0 },
+ { ocCode, 121, 1, 1, V, { VR }, 0, 0 },
+ { ocFind, 124, 2, 3, V, { VR }, 0, 0 },
+ { ocCell, 125, 1, 2, V, { VV, RO }, EXC_FUNCFLAG_VOLATILE, 0 },
+ { ocIsErr, 126, 1, 1, V, { VR }, 0, 0 },
+ { ocIsString, 127, 1, 1, V, { VR }, 0, 0 },
+ { ocIsValue, 128, 1, 1, V, { VR }, 0, 0 },
+ { ocIsEmpty, 129, 1, 1, V, { VR }, 0, 0 },
+ { ocT, 130, 1, 1, V, { RO }, 0, 0 },
+ { ocN, 131, 1, 1, V, { RO }, 0, 0 },
+ { ocGetDateValue, 140, 1, 1, V, { VR }, 0, 0 },
+ { ocGetTimeValue, 141, 1, 1, V, { VR }, 0, 0 },
+ { ocLIA, 142, 3, 3, V, { VR }, 0, 0 },
+ { ocDIA, 143, 4, 4, V, { VR }, 0, 0 },
+ { ocGDA, 144, 4, 5, V, { VR }, 0, 0 },
+ { ocIndirect, 148, 1, 2, R, { VR }, EXC_FUNCFLAG_VOLATILE, 0 },
+ { ocClean, 162, 1, 1, V, { VR }, 0, 0 },
+ { ocMatDet, 163, 1, 1, V, { VA }, 0, 0 },
+ { ocMatInv, 164, 1, 1, A, { VA }, 0, 0 },
+ { ocMatMult, 165, 2, 2, A, { VA }, 0, 0 },
+ { ocZinsZ, 167, 4, 6, V, { VR }, 0, 0 },
+ { ocKapz, 168, 4, 6, V, { VR }, 0, 0 },
+ { ocCount2, 169, 0, 30, V, { RX }, 0, 0 },
+ { ocProduct, 183, 0, 30, V, { RX }, 0, 0 },
+ { ocFact, 184, 1, 1, V, { VR }, 0, 0 },
+ { ocDBProduct, 189, 3, 3, V, { RO, RR }, 0, 0 },
+ { ocIsNonString, 190, 1, 1, V, { VR }, 0, 0 },
+ { ocStDevP, 193, 1, 30, V, { RX }, 0, 0 },
+ { ocVarP, 194, 1, 30, V, { RX }, 0, 0 },
+ { ocDBStdDevP, 195, 3, 3, V, { RO, RR }, 0, 0 },
+ { ocDBVarP, 196, 3, 3, V, { RO, RR }, 0, 0 },
+ { ocTrunc, 197, 1, 1, V, { VR, C }, 0, 0 },
+ { ocIsLogical, 198, 1, 1, V, { VR }, 0, 0 },
+ { ocDBCount2, 199, 3, 3, V, { RO, RR }, 0, 0 },
+ { ocCurrency, 204, 1, 2, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 },
+ { ocRoundUp, 212, 2, 2, V, { VR }, 0, 0 },
+ { ocRoundDown, 213, 2, 2, V, { VR }, 0, 0 },
+ { ocExternal, 255, 1, 30, R, { RO_E, RO }, EXC_FUNCFLAG_IMPORTONLY, 0 }
};
/** Functions new in BIFF3. */
static const XclFunctionInfo saFuncTable_3[] =
{
- { ocRGP, 49, 1, 4, A, { R, R, V, V }, 0, 0 }, // BIFF2: 1-2, BIFF3: 1-4
- { ocTrend, 50, 1, 4, A, { R, R, R, V }, 0, 0 }, // BIFF2: 1-3, BIFF3: 1-4
- { ocRKP, 51, 1, 4, A, { R, R, V, V }, 0, 0 }, // BIFF2: 1-2, BIFF3: 1-4
- { ocGrowth, 52, 1, 4, A, { R, R, R, V }, 0, 0 }, // BIFF2: 1-3, BIFF3: 1-4
- { ocTrunc, 197, 1, 2, V, { V }, 0, 0 }, // BIFF2: 1, BIFF3: 1-2
- { ocAddress, 219, 2, 5, V, { V, V, V, V, V }, 0, 0 },
- { ocGetDiffDate360, 220, 2, 2, V, { V, V, C, I }, 0, 0 },
+ { ocRGP, 49, 1, 4, A, { RA, RA, VV }, 0, 0 }, // BIFF2: 1-2, BIFF3: 1-4
+ { ocTrend, 50, 1, 4, A, { RA, RA, RA, VV }, 0, 0 }, // BIFF2: 1-3, BIFF3: 1-4
+ { ocRKP, 51, 1, 4, A, { RA, RA, VV }, 0, 0 }, // BIFF2: 1-2, BIFF3: 1-4
+ { ocGrowth, 52, 1, 4, A, { RA, RA, RA, VV }, 0, 0 }, // BIFF2: 1-3, BIFF3: 1-4
+ { ocTrunc, 197, 1, 2, V, { VR }, 0, 0 }, // BIFF2: 1, BIFF3: 1-2
+ { ocAddress, 219, 2, 5, V, { VR }, 0, 0 },
+ { ocGetDiffDate360, 220, 2, 2, V, { VR, VR, C }, 0, 0 },
{ ocGetActDate, 221, 0, 0, V, {}, EXC_FUNCFLAG_VOLATILE, 0 },
- { ocVBD, 222, 5, 7, V, { V }, 0, 0 },
- { ocMedian, 227, 1, 30, V, { R }, 0, 0 },
- { ocSumProduct, 228, 1, 30, V, { A }, 0, 0 },
- { ocSinHyp, 229, 1, 1, V, { V }, 0, 0 },
- { ocCosHyp, 230, 1, 1, V, { V }, 0, 0 },
- { ocTanHyp, 231, 1, 1, V, { V }, 0, 0 },
- { ocCotHyp, 231, 1, 1, V, { V }, EXC_FUNCFLAG_EXPORTONLY, 0 },
- { ocArcSinHyp, 232, 1, 1, V, { V }, 0, 0 },
- { ocArcCosHyp, 233, 1, 1, V, { V }, 0, 0 },
- { ocArcTanHyp, 234, 1, 1, V, { V }, 0, 0 },
- { ocArcCotHyp, 234, 1, 1, V, { V }, EXC_FUNCFLAG_EXPORTONLY, 0 },
- { ocDBGet, 235, 3, 3, V, { R }, 0, 0 },
- { ocInfo, 244, 1, 1, V, { V }, EXC_FUNCFLAG_VOLATILE, 0 }
+ { ocVBD, 222, 5, 7, V, { VR }, 0, 0 },
+ { ocMedian, 227, 1, 30, V, { RX }, 0, 0 },
+ { ocSumProduct, 228, 1, 30, V, { VA }, 0, 0 },
+ { ocSinHyp, 229, 1, 1, V, { VR }, 0, 0 },
+ { ocCosHyp, 230, 1, 1, V, { VR }, 0, 0 },
+ { ocTanHyp, 231, 1, 1, V, { VR }, 0, 0 },
+ { ocCotHyp, 231, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, 0 },
+ { ocArcSinHyp, 232, 1, 1, V, { VR }, 0, 0 },
+ { ocArcCosHyp, 233, 1, 1, V, { VR }, 0, 0 },
+ { ocArcTanHyp, 234, 1, 1, V, { VR }, 0, 0 },
+ { ocArcCotHyp, 234, 1, 1, V, { VR }, EXC_FUNCFLAG_EXPORTONLY, 0 },
+ { ocDBGet, 235, 3, 3, V, { RO, RR }, 0, 0 },
+ { ocInfo, 244, 1, 1, V, { VR }, EXC_FUNCFLAG_VOLATILE, 0 }
};
/** Functions new in BIFF4. */
static const XclFunctionInfo saFuncTable_4[] =
{
- { ocFixed, 14, 1, 3, V, { V }, 0, 0 }, // BIFF2-3: 1-2, BIFF4: 1-3
- { ocAsc, 214, 1, 1, V, { V }, 0, 0 },
- { ocJis, 215, 1, 1, V, { V }, 0, 0 },
- { ocRank, 216, 2, 3, V, { V, R, V }, 0, 0 },
- { ocGDA2, 247, 4, 5, V, { V }, 0, 0 },
- { ocFrequency, 252, 2, 2, A, { R }, 0, 0 },
- { ocErrorType, 261, 1, 1, V, { V }, 0, 0 },
- { ocAveDev, 269, 1, 30, V, { R }, 0, 0 },
- { ocBetaDist, 270, 3, 5, V, { V }, 0, 0 },
- { ocGammaLn, 271, 1, 1, V, { V }, 0, 0 },
- { ocBetaInv, 272, 3, 5, V, { V }, 0, 0 },
- { ocBinomDist, 273, 4, 4, V, { V }, 0, 0 },
- { ocChiDist, 274, 2, 2, V, { V }, 0, 0 },
- { ocChiInv, 275, 2, 2, V, { V }, 0, 0 },
- { ocKombin, 276, 2, 2, V, { V }, 0, 0 },
- { ocConfidence, 277, 3, 3, V, { V }, 0, 0 },
- { ocKritBinom, 278, 3, 3, V, { V }, 0, 0 },
- { ocEven, 279, 1, 1, V, { V }, 0, 0 },
- { ocExpDist, 280, 3, 3, V, { V }, 0, 0 },
- { ocFDist, 281, 3, 3, V, { V }, 0, 0 },
- { ocFInv, 282, 3, 3, V, { V }, 0, 0 },
- { ocFisher, 283, 1, 1, V, { V }, 0, 0 },
- { ocFisherInv, 284, 1, 1, V, { V }, 0, 0 },
- { ocFloor, 285, 2, 2, V, { V, V, C, I }, 0, 0 },
- { ocGammaDist, 286, 4, 4, V, { V }, 0, 0 },
- { ocGammaInv, 287, 3, 3, V, { V }, 0, 0 },
- { ocCeil, 288, 2, 2, V, { V, V, C, I }, 0, 0 },
- { ocHypGeomDist, 289, 4, 4, V, { V }, 0, 0 },
- { ocLogNormDist, 290, 3, 3, V, { V }, 0, 0 },
- { ocLogInv, 291, 3, 3, V, { V }, 0, 0 },
- { ocNegBinomVert, 292, 3, 3, V, { V }, 0, 0 },
- { ocNormDist, 293, 4, 4, V, { V }, 0, 0 },
- { ocStdNormDist, 294, 1, 1, V, { V }, 0, 0 },
- { ocNormInv, 295, 3, 3, V, { V }, 0, 0 },
- { ocSNormInv, 296, 1, 1, V, { V }, 0, 0 },
- { ocStandard, 297, 3, 3, V, { V }, 0, 0 },
- { ocOdd, 298, 1, 1, V, { V }, 0, 0 },
- { ocVariationen, 299, 2, 2, V, { V }, 0, 0 },
- { ocPoissonDist, 300, 3, 3, V, { V }, 0, 0 },
- { ocTDist, 301, 3, 3, V, { V }, 0, 0 },
- { ocWeibull, 302, 4, 4, V, { V }, 0, 0 },
- { ocSumXMY2, 303, 2, 2, V, { A }, 0, 0 },
- { ocSumX2MY2, 304, 2, 2, V, { A }, 0, 0 },
- { ocSumX2DY2, 305, 2, 2, V, { A }, 0, 0 },
- { ocChiTest, 306, 2, 2, V, { A }, 0, 0 },
- { ocCorrel, 307, 2, 2, V, { A }, 0, 0 },
- { ocCovar, 308, 2, 2, V, { A }, 0, 0 },
- { ocForecast, 309, 3, 3, V, { V, A }, 0, 0 },
- { ocFTest, 310, 2, 2, V, { A }, 0, 0 },
- { ocIntercept, 311, 2, 2, V, { A }, 0, 0 },
- { ocPearson, 312, 2, 2, V, { A }, 0, 0 },
- { ocRSQ, 313, 2, 2, V, { A }, 0, 0 },
- { ocSTEYX, 314, 2, 2, V, { A }, 0, 0 },
- { ocSlope, 315, 2, 2, V, { A }, 0, 0 },
- { ocTTest, 316, 4, 4, V, { A, A, V }, 0, 0 },
- { ocProb, 317, 3, 4, V, { A, A, V }, 0, 0 },
- { ocDevSq, 318, 1, 30, V, { R }, 0, 0 },
- { ocGeoMean, 319, 1, 30, V, { R }, 0, 0 },
- { ocHarMean, 320, 1, 30, V, { R }, 0, 0 },
- { ocSumSQ, 321, 0, 30, V, { R }, 0, 0 },
- { ocKurt, 322, 1, 30, V, { R }, 0, 0 },
- { ocSchiefe, 323, 1, 30, V, { R }, 0, 0 },
- { ocZTest, 324, 2, 3, V, { R, V }, 0, 0 },
- { ocLarge, 325, 2, 2, V, { R, V }, 0, 0 },
- { ocSmall, 326, 2, 2, V, { R, V }, 0, 0 },
- { ocQuartile, 327, 2, 2, V, { R, V }, 0, 0 },
- { ocPercentile, 328, 2, 2, V, { R, V }, 0, 0 },
- { ocPercentrank, 329, 2, 3, V, { R, V }, 0, 0 },
- { ocModalValue, 330, 1, 30, V, { A }, 0, 0 },
- { ocTrimMean, 331, 2, 2, V, { R, V }, 0, 0 },
- { ocTInv, 332, 2, 2, V, { V }, 0, 0 }
+ { ocFixed, 14, 1, 3, V, { VR }, 0, 0 }, // BIFF2-3: 1-2, BIFF4: 1-3
+ { ocAsc, 214, 1, 1, V, { VR }, 0, 0 },
+ { ocJis, 215, 1, 1, V, { VR }, 0, 0 },
+ { ocRank, 216, 2, 3, V, { VR, RO, VR }, 0, 0 },
+ { ocGDA2, 247, 4, 5, V, { VR }, 0, 0 },
+ { ocFrequency, 252, 2, 2, A, { RA }, 0, 0 },
+ { ocErrorType, 261, 1, 1, V, { VR }, 0, 0 },
+ { ocAveDev, 269, 1, 30, V, { RX }, 0, 0 },
+ { ocBetaDist, 270, 3, 5, V, { VR }, 0, 0 },
+ { ocGammaLn, 271, 1, 1, V, { VR }, 0, 0 },
+ { ocBetaInv, 272, 3, 5, V, { VR }, 0, 0 },
+ { ocBinomDist, 273, 4, 4, V, { VR }, 0, 0 },
+ { ocChiDist, 274, 2, 2, V, { VR }, 0, 0 },
+ { ocChiInv, 275, 2, 2, V, { VR }, 0, 0 },
+ { ocKombin, 276, 2, 2, V, { VR }, 0, 0 },
+ { ocConfidence, 277, 3, 3, V, { VR }, 0, 0 },
+ { ocKritBinom, 278, 3, 3, V, { VR }, 0, 0 },
+ { ocEven, 279, 1, 1, V, { VR }, 0, 0 },
+ { ocExpDist, 280, 3, 3, V, { VR }, 0, 0 },
+ { ocFDist, 281, 3, 3, V, { VR }, 0, 0 },
+ { ocFInv, 282, 3, 3, V, { VR }, 0, 0 },
+ { ocFisher, 283, 1, 1, V, { VR }, 0, 0 },
+ { ocFisherInv, 284, 1, 1, V, { VR }, 0, 0 },
+ { ocFloor, 285, 2, 2, V, { VR, VR, C }, 0, 0 },
+ { ocGammaDist, 286, 4, 4, V, { VR }, 0, 0 },
+ { ocGammaInv, 287, 3, 3, V, { VR }, 0, 0 },
+ { ocCeil, 288, 2, 2, V, { VR, VR, C }, 0, 0 },
+ { ocHypGeomDist, 289, 4, 4, V, { VR }, 0, 0 },
+ { ocLogNormDist, 290, 3, 3, V, { VR }, 0, 0 },
+ { ocLogInv, 291, 3, 3, V, { VR }, 0, 0 },
+ { ocNegBinomVert, 292, 3, 3, V, { VR }, 0, 0 },
+ { ocNormDist, 293, 4, 4, V, { VR }, 0, 0 },
+ { ocStdNormDist, 294, 1, 1, V, { VR }, 0, 0 },
+ { ocNormInv, 295, 3, 3, V, { VR }, 0, 0 },
+ { ocSNormInv, 296, 1, 1, V, { VR }, 0, 0 },
+ { ocStandard, 297, 3, 3, V, { VR }, 0, 0 },
+ { ocOdd, 298, 1, 1, V, { VR }, 0, 0 },
+ { ocVariationen, 299, 2, 2, V, { VR }, 0, 0 },
+ { ocPoissonDist, 300, 3, 3, V, { VR }, 0, 0 },
+ { ocTDist, 301, 3, 3, V, { VR }, 0, 0 },
+ { ocWeibull, 302, 4, 4, V, { VR }, 0, 0 },
+ { ocSumXMY2, 303, 2, 2, V, { VA }, 0, 0 },
+ { ocSumX2MY2, 304, 2, 2, V, { VA }, 0, 0 },
+ { ocSumX2DY2, 305, 2, 2, V, { VA }, 0, 0 },
+ { ocChiTest, 306, 2, 2, V, { VA }, 0, 0 },
+ { ocCorrel, 307, 2, 2, V, { VA }, 0, 0 },
+ { ocCovar, 308, 2, 2, V, { VA }, 0, 0 },
+ { ocForecast, 309, 3, 3, V, { VR, VA }, 0, 0 },
+ { ocFTest, 310, 2, 2, V, { VA }, 0, 0 },
+ { ocIntercept, 311, 2, 2, V, { VA }, 0, 0 },
+ { ocPearson, 312, 2, 2, V, { VA }, 0, 0 },
+ { ocRSQ, 313, 2, 2, V, { VA }, 0, 0 },
+ { ocSTEYX, 314, 2, 2, V, { VA }, 0, 0 },
+ { ocSlope, 315, 2, 2, V, { VA }, 0, 0 },
+ { ocTTest, 316, 4, 4, V, { VA, VA, VR }, 0, 0 },
+ { ocProb, 317, 3, 4, V, { VA, VA, VR }, 0, 0 },
+ { ocDevSq, 318, 1, 30, V, { RX }, 0, 0 },
+ { ocGeoMean, 319, 1, 30, V, { RX }, 0, 0 },
+ { ocHarMean, 320, 1, 30, V, { RX }, 0, 0 },
+ { ocSumSQ, 321, 0, 30, V, { RX }, 0, 0 },
+ { ocKurt, 322, 1, 30, V, { RX }, 0, 0 },
+ { ocSchiefe, 323, 1, 30, V, { RX }, 0, 0 },
+ { ocZTest, 324, 2, 3, V, { RX, VR }, 0, 0 },
+ { ocLarge, 325, 2, 2, V, { RX, VR }, 0, 0 },
+ { ocSmall, 326, 2, 2, V, { RX, VR }, 0, 0 },
+ { ocQuartile, 327, 2, 2, V, { RX, VR }, 0, 0 },
+ { ocPercentile, 328, 2, 2, V, { RX, VR }, 0, 0 },
+ { ocPercentrank, 329, 2, 3, V, { RX, VR, VR_E }, 0, 0 },
+ { ocModalValue, 330, 1, 30, V, { VA }, 0, 0 },
+ { ocTrimMean, 331, 2, 2, V, { RX, VR }, 0, 0 },
+ { ocTInv, 332, 2, 2, V, { VR }, 0, 0 }
};
/** Functions new in BIFF5/BIFF7. Unsupported functions: DATEDIF, DATESTRING, NUMBERSTRING. */
static const XclFunctionInfo saFuncTable_5[] =
{
- { ocGetDayOfWeek, 70, 1, 2, V, { V }, 0, 0 }, // BIFF2-4: 1, BIFF5: 1-2
- { ocHLookup, 101, 3, 4, V, { V, R, R, V }, 0, 0 }, // BIFF2-4: 3, BIFF5: 3-4
- { ocVLookup, 102, 3, 4, V, { V, R, R, V }, 0, 0 }, // BIFF2-4: 3, BIFF5: 3-4
- { ocGetDiffDate360, 220, 2, 3, V, { V }, 0, 0 }, // BIFF3-4: 2, BIFF5: 2-3
- { ocMacro, 255, 1, 30, R, { E, R }, EXC_FUNCFLAG_EXPORTONLY, 0 },
- { ocExternal, 255, 1, 30, R, { E, R }, EXC_FUNCFLAG_EXPORTONLY, 0 },
- { ocConcat, 336, 0, 30, V, { V }, 0, 0 },
- { ocPower, 337, 2, 2, V, { V }, 0, 0 },
- { ocRad, 342, 1, 1, V, { V }, 0, 0 },
- { ocDeg, 343, 1, 1, V, { V }, 0, 0 },
- { ocSubTotal, 344, 2, 30, V, { V, R }, 0, 0 },
- { ocSumIf, 345, 2, 3, V, { R, V, R }, 0, 0 },
- { ocCountIf, 346, 2, 2, V, { R, V }, 0, 0 },
- { ocCountEmptyCells, 347, 1, 1, V, { R }, 0, 0 },
- { ocISPMT, 350, 4, 4, V, { V }, 0, 0 },
- { ocNoName, 351, 3, 3, V, { V }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // DATEDIF
- { ocNoName, 352, 1, 1, V, { V }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // DATESTRING
- { ocNoName, 353, 2, 2, V, { V }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // NUMBERSTRING
- { ocRoman, 354, 1, 2, V, { V }, 0, 0 }
+ { ocGetDayOfWeek, 70, 1, 2, V, { VR }, 0, 0 }, // BIFF2-4: 1, BIFF5: 1-2
+ { ocHLookup, 101, 3, 4, V, { VV, RO, RO, VV }, 0, 0 }, // BIFF2-4: 3, BIFF5: 3-4
+ { ocVLookup, 102, 3, 4, V, { VV, RO, RO, VV }, 0, 0 }, // BIFF2-4: 3, BIFF5: 3-4
+ { ocGetDiffDate360, 220, 2, 3, V, { VR }, 0, 0 }, // BIFF3-4: 2, BIFF5: 2-3
+ { ocMacro, 255, 1, 30, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, 0 },
+ { ocExternal, 255, 1, 30, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, 0 },
+ { ocConcat, 336, 0, 30, V, { VR }, 0, 0 },
+ { ocPower, 337, 2, 2, V, { VR }, 0, 0 },
+ { ocRad, 342, 1, 1, V, { VR }, 0, 0 },
+ { ocDeg, 343, 1, 1, V, { VR }, 0, 0 },
+ { ocSubTotal, 344, 2, 30, V, { VR, RO }, 0, 0 },
+ { ocSumIf, 345, 2, 3, V, { RO, VR, RO }, 0, 0 },
+ { ocCountIf, 346, 2, 2, V, { RO, VR }, 0, 0 },
+ { ocCountEmptyCells, 347, 1, 1, V, { RO }, 0, 0 },
+ { ocISPMT, 350, 4, 4, V, { VR }, 0, 0 },
+ { ocNoName, 351, 3, 3, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // DATEDIF
+ { ocNoName, 352, 1, 1, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // DATESTRING
+ { ocNoName, 353, 2, 2, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // NUMBERSTRING
+ { ocRoman, 354, 1, 2, V, { VR }, 0, 0 }
};
#define EXC_FUNCNAME_PREFIX "_xlfn."
@@ -330,19 +345,19 @@ const sal_Char* const EXC_FUNCNAME_BAHTTEXT = EXC_FUNCNAME_PREFIX "BAHTTEXT";
/** Functions new in BIFF8. Unsupported functions: PHONETIC. */
static const XclFunctionInfo saFuncTable_8[] =
{
- { ocGetPivotData, 358, 2, 30, V, { V, R, V }, 0, 0 },
- { ocHyperLink, 359, 1, 2, V, { V }, 0, 0 },
- { ocNoName, 360, 1, 1, V, { R }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // PHONETIC
- { ocAverageA, 361, 1, 30, V, { R }, 0, 0 },
- { ocMaxA, 362, 1, 30, V, { R }, 0, 0 },
- { ocMinA, 363, 1, 30, V, { R }, 0, 0 },
- { ocStDevPA, 364, 1, 30, V, { R }, 0, 0 },
- { ocVarPA, 365, 1, 30, V, { R }, 0, 0 },
- { ocStDevA, 366, 1, 30, V, { R }, 0, 0 },
- { ocVarA, 367, 1, 30, V, { R }, 0, 0 },
- { ocBahtText, 368, 1, 1, V, { V }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME_BAHTTEXT },
- { ocBahtText, 255, 2, 2, V, { E, V }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME_BAHTTEXT },
- { ocEuroConvert, 255, 4, 6, V, { E, V }, EXC_FUNCFLAG_EXPORTONLY, "EUROCONVERT" }
+ { ocGetPivotData, 358, 2, 30, V, { RR, RR, VR }, 0, 0 },
+ { ocHyperLink, 359, 1, 2, V, { VV, VO }, 0, 0 },
+ { ocNoName, 360, 1, 1, V, { RO }, EXC_FUNCFLAG_IMPORTONLY, 0 }, // PHONETIC
+ { ocAverageA, 361, 1, 30, V, { RX }, 0, 0 },
+ { ocMaxA, 362, 1, 30, V, { RX }, 0, 0 },
+ { ocMinA, 363, 1, 30, V, { RX }, 0, 0 },
+ { ocStDevPA, 364, 1, 30, V, { RX }, 0, 0 },
+ { ocVarPA, 365, 1, 30, V, { RX }, 0, 0 },
+ { ocStDevA, 366, 1, 30, V, { RX }, 0, 0 },
+ { ocVarA, 367, 1, 30, V, { RX }, 0, 0 },
+ { ocBahtText, 368, 1, 1, V, { VR }, EXC_FUNCFLAG_IMPORTONLY, EXC_FUNCNAME_BAHTTEXT },
+ { ocBahtText, 255, 2, 2, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, EXC_FUNCNAME_BAHTTEXT },
+ { ocEuroConvert, 255, 4, 6, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, "EUROCONVERT" }
};
// ----------------------------------------------------------------------------
@@ -436,16 +451,17 @@ XclTokenArray::XclTokenArray( bool bVolatile ) :
{
}
-XclTokenArray::XclTokenArray( ScfUInt8Vec& rTokVec, bool bVolatile,
- ScfUInt8Vec* pExtensionTokens) :
+XclTokenArray::XclTokenArray( ScfUInt8Vec& rTokVec, bool bVolatile ) :
mbVolatile( bVolatile )
{
maTokVec.swap( rTokVec );
- if( NULL != pExtensionTokens)
- {
- DBG_ASSERT( maTokVec.size() <= 0xFFFF, "XclTokenArray::XclTokenArray - extension array too long" );
- maExtensions.swap( *pExtensionTokens );
- }
+}
+
+XclTokenArray::XclTokenArray( ScfUInt8Vec& rTokVec, ScfUInt8Vec& rExtDataVec, bool bVolatile ) :
+ mbVolatile( bVolatile )
+{
+ maTokVec.swap( rTokVec );
+ maExtDataVec.swap( rExtDataVec );
}
sal_uInt16 XclTokenArray::GetSize() const
@@ -482,8 +498,8 @@ void XclTokenArray::WriteArray( XclExpStream& rStrm ) const
{
if( !maTokVec.empty() )
rStrm.Write( &maTokVec.front(), GetSize() );
- if( !maExtensions.empty() )
- rStrm.Write( &maExtensions.front(), limit_cast< sal_uInt16 >(maExtensions.size() ) );
+ if( !maExtDataVec.empty() )
+ rStrm.Write( &maExtDataVec.front(), maExtDataVec.size() );
}
void XclTokenArray::Write( XclExpStream& rStrm ) const
@@ -494,7 +510,7 @@ void XclTokenArray::Write( XclExpStream& rStrm ) const
bool XclTokenArray::operator==( const XclTokenArray& rTokArr ) const
{
- return (mbVolatile == rTokArr.mbVolatile) && (maTokVec == rTokArr.maTokVec);
+ return (mbVolatile == rTokArr.mbVolatile) && (maTokVec == rTokArr.maTokVec) && (maExtDataVec == rTokArr.maExtDataVec);
}
XclImpStream& operator>>( XclImpStream& rStrm, XclTokenArray& rTokArr )
@@ -558,7 +574,7 @@ void XclTokenArrayIterator::Init()
void XclTokenArrayIterator::Init( const ScTokenArray& rScTokArr, bool bSkipSpaces )
{
USHORT nTokArrLen = rScTokArr.GetLen();
- mppScTokenBeg = static_cast< const formula::FormulaToken*const* >( nTokArrLen ? rScTokArr.GetArray() : 0 );
+ mppScTokenBeg = static_cast< const FormulaToken* const* >( nTokArrLen ? rScTokArr.GetArray() : 0 );
mppScTokenEnd = mppScTokenBeg ? (mppScTokenBeg + nTokArrLen) : 0;
mppScToken = (mppScTokenBeg != mppScTokenEnd) ? mppScTokenBeg : 0;
mbSkipSpaces = bSkipSpaces;
@@ -588,9 +604,9 @@ void XclTokenArrayIterator::SkipSpaces()
// strings and string lists ---------------------------------------------------
-bool XclTokenArrayHelper::GetTokenString( String& rString, const formula::FormulaToken& rScToken )
+bool XclTokenArrayHelper::GetTokenString( String& rString, const FormulaToken& rScToken )
{
- bool bIsStr = (rScToken.GetType() == formula::svString) && (rScToken.GetOpCode() == ocPush);
+ bool bIsStr = (rScToken.GetType() == svString) && (rScToken.GetOpCode() == ocPush);
if( bIsStr ) rString = rScToken.GetString();
return bIsStr;
}
@@ -653,7 +669,7 @@ void XclTokenArrayHelper::ConvertStringToList( ScTokenArray& rScTokArr, sal_Unic
const ScTokenArray* XclTokenArrayHelper::GetSharedFormula( const XclRoot& rRoot, const ScTokenArray& rScTokArr )
{
if( rScTokArr.GetLen() == 1 )
- if( const formula::FormulaToken* pScToken = rScTokArr.GetArray()[ 0 ] )
+ if( const FormulaToken* pScToken = rScTokArr.GetArray()[ 0 ] )
if( pScToken->GetOpCode() == ocName )
if( ScRangeData* pData = rRoot.GetNamedRanges().FindIndex( pScToken->GetIndex() ) )
if( pData->HasType( RT_SHARED ) )
@@ -665,7 +681,7 @@ const ScTokenArray* XclTokenArrayHelper::GetSharedFormula( const XclRoot& rRoot,
namespace {
-inline bool lclGetAddress( ScAddress& rAddress, const formula::FormulaToken& rToken )
+inline bool lclGetAddress( ScAddress& rAddress, const FormulaToken& rToken )
{
OpCode eOpCode = rToken.GetOpCode();
bool bIsSingleRef = (eOpCode == ocPush) && (rToken.GetType() == svSingleRef);
diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index 8f5ddadd0370..0b6af9da2e63 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -35,6 +35,7 @@
#include <vcl/svapp.hxx>
#include <svtools/stritem.hxx>
#include <svtools/languageoptions.hxx>
+#include <svtools/useroptions.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/printer.hxx>
#include <sfx2/docfile.hxx>
@@ -79,6 +80,7 @@ XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium,
mrMedium( rMedium ),
mxRootStrg( xRootStrg ),
mrDoc( rDoc ),
+ maDefPassword( CREATE_STRING( "VelvetSweatshop" ) ),
meTextEnc( eTextEnc ),
meSysLang( Application::GetSettings().GetLanguage() ),
meDocLang( Application::GetSettings().GetLanguage() ),
@@ -94,6 +96,11 @@ XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium,
mnScTab( 0 ),
mbExport( bExport )
{
+ // user name
+ maUserName = SvtUserOptions().GetLastName();
+ if( maUserName.Len() == 0 )
+ maUserName = CREATE_STRING( "Calc" );
+
// default script type, e.g. for empty cells
switch( ScGlobal::GetDefaultScriptType() )
{
@@ -198,6 +205,13 @@ void XclRoot::SetCharWidth( const XclFontData& rFontData )
}
}
+String XclRoot::RequestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) const
+{
+ ::std::vector< OUString > aDefaultPasswords;
+ aDefaultPasswords.push_back( mrData.maDefPassword );
+ return ScfApiHelper::QueryPasswordForMedium( mrData.mrMedium, rVerifier, &aDefaultPasswords );
+}
+
bool XclRoot::HasVbaStorage() const
{
SotStorageRef xRootStrg = GetRootStorage();
diff --git a/sc/source/filter/excel/xlstream.cxx b/sc/source/filter/excel/xlstream.cxx
deleted file mode 100644
index 7340e073c51f..000000000000
--- a/sc/source/filter/excel/xlstream.cxx
+++ /dev/null
@@ -1,52 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: xlstream.cxx,v $
- * $Revision: 1.5 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sc.hxx"
-
-// ============================================================================
-#include "xlstream.hxx"
-
-// Encryption/decryption ======================================================
-
-const ByteString XclCryptoHelper::GetBiff5WbProtPassword()
-{
- static const ByteString saPass( "VelvetSweatshop" );
- return saPass;
-}
-
-const String XclCryptoHelper::GetBiff8WbProtPassword()
-{
- static const String saPass( GetBiff5WbProtPassword(), RTL_TEXTENCODING_ASCII_US );
- return saPass;
-}
-
-// ============================================================================
-
diff --git a/sc/source/filter/excel/xlstyle.cxx b/sc/source/filter/excel/xlstyle.cxx
index 4e5bf9b7570a..401f135b381a 100644
--- a/sc/source/filter/excel/xlstyle.cxx
+++ b/sc/source/filter/excel/xlstyle.cxx
@@ -471,11 +471,11 @@ void XclFontData::SetApiFamily( sal_Int16 nApiFamily )
}
}
-void XclFontData::SetApiFontEncoding( sal_Int16 nApiFontEnc )
-{
- // API constants are equal to rtl_TextEncoding constants
- SetFontEncoding( static_cast< rtl_TextEncoding >( nApiFontEnc ) );
-}
+//UNUSED2009-05 void XclFontData::SetApiFontEncoding( sal_Int16 nApiFontEnc )
+//UNUSED2009-05 {
+//UNUSED2009-05 // API constants are equal to rtl_TextEncoding constants
+//UNUSED2009-05 SetFontEncoding( static_cast< rtl_TextEncoding >( nApiFontEnc ) );
+//UNUSED2009-05 }
void XclFontData::SetApiPosture( Awt::FontSlant eApiPosture )
{
diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx
index ef38a0037ca0..6398e25b9be7 100644
--- a/sc/source/filter/excel/xltools.cxx
+++ b/sc/source/filter/excel/xltools.cxx
@@ -426,16 +426,19 @@ rtl_TextEncoding XclTools::GetTextEncoding( sal_uInt16 nCodePage )
return pEntry->meTextEnc;
}
-//UNUSED2008-05 sal_uInt16 XclTools::GetXclCodePage( rtl_TextEncoding eTextEnc )
-//UNUSED2008-05 {
-//UNUSED2008-05 const XclCodePageEntry* pEntry = ::std::find_if( pCodePageTable, pCodePageTableEnd, XclCodePageEntry_TEPred( eTextEnc ) );
-//UNUSED2008-05 if( pEntry == pCodePageTableEnd )
-//UNUSED2008-05 {
-//UNUSED2008-05 DBG_ERROR1( "XclTools::GetXclCodePage - unsupported text encoding: %d", eTextEnc );
-//UNUSED2008-05 return 1252;
-//UNUSED2008-05 }
-//UNUSED2008-05 return pEntry->mnCodePage;
-//UNUSED2008-05 }
+sal_uInt16 XclTools::GetXclCodePage( rtl_TextEncoding eTextEnc )
+{
+ if( eTextEnc == RTL_TEXTENCODING_UNICODE )
+ return 1200; // for BIFF8
+
+ const XclCodePageEntry* pEntry = ::std::find_if( pCodePageTable, pCodePageTableEnd, XclCodePageEntry_TEPred( eTextEnc ) );
+ if( pEntry == pCodePageTableEnd )
+ {
+ DBG_ERROR1( "XclTools::GetXclCodePage - unsupported text encoding: %d", eTextEnc );
+ return 1252;
+ }
+ return pEntry->mnCodePage;
+}
// font names -----------------------------------------------------------------
@@ -511,7 +514,8 @@ sal_Unicode XclTools::GetBuiltInDefNameIndex( const String& rDefName )
// built-in style names -------------------------------------------------------
-const String XclTools::maStyleNamePrefix( RTL_CONSTASCII_USTRINGPARAM( "Excel_BuiltIn_" ) );
+const String XclTools::maStyleNamePrefix1( RTL_CONSTASCII_USTRINGPARAM( "Excel_BuiltIn_" ) );
+const String XclTools::maStyleNamePrefix2( RTL_CONSTASCII_USTRINGPARAM( "Excel Built-in " ) );
static const sal_Char* const ppcStyleNames[] =
{
@@ -527,21 +531,35 @@ static const sal_Char* const ppcStyleNames[] =
"Followed_Hyperlink"
};
-String XclTools::GetBuiltInStyleName( sal_uInt8 nStyleId, sal_uInt8 nLevel )
+String XclTools::GetBuiltInStyleName( sal_uInt8 nStyleId, const String& rName, sal_uInt8 nLevel )
{
String aStyleName;
if( nStyleId == EXC_STYLE_NORMAL ) // "Normal" becomes "Default" style
+ {
aStyleName = ScGlobal::GetRscString( STR_STYLENAME_STANDARD );
- else if( nStyleId < STATIC_TABLE_SIZE( ppcStyleNames ) )
- aStyleName.Assign( maStyleNamePrefix ).AppendAscii( ppcStyleNames[ nStyleId ] );
-
- if( (nStyleId == EXC_STYLE_ROWLEVEL) || (nStyleId == EXC_STYLE_COLLEVEL) )
- aStyleName.Append( String::CreateFromInt32( nLevel + 1 ) );
+ }
+ else
+ {
+ aStyleName = maStyleNamePrefix1;
+ if( nStyleId < STATIC_TABLE_SIZE( ppcStyleNames ) )
+ aStyleName.AppendAscii( ppcStyleNames[ nStyleId ] );
+ else if( rName.Len() > 0 )
+ aStyleName.Append( rName );
+ else
+ aStyleName.Append( String::CreateFromInt32( nStyleId ) );
+ if( (nStyleId == EXC_STYLE_ROWLEVEL) || (nStyleId == EXC_STYLE_COLLEVEL) )
+ aStyleName.Append( String::CreateFromInt32( nLevel + 1 ) );
+ }
return aStyleName;
}
+String XclTools::GetBuiltInStyleName( const String& rStyleName )
+{
+ return String( maStyleNamePrefix1 ).Append( rStyleName );
+}
+
bool XclTools::IsBuiltInStyleName( const String& rStyleName, sal_uInt8* pnStyleId, xub_StrLen* pnNextChar )
{
// "Default" becomes "Normal"
@@ -553,10 +571,15 @@ bool XclTools::IsBuiltInStyleName( const String& rStyleName, sal_uInt8* pnStyleI
}
// try the other built-in styles
- xub_StrLen nPrefixLen = maStyleNamePrefix.Len();
sal_uInt8 nFoundId = 0;
xub_StrLen nNextChar = 0;
- if( rStyleName.EqualsIgnoreCaseAscii( maStyleNamePrefix, 0, nPrefixLen ) )
+
+ xub_StrLen nPrefixLen = 0;
+ if( rStyleName.EqualsIgnoreCaseAscii( maStyleNamePrefix1, 0, maStyleNamePrefix1.Len() ) )
+ nPrefixLen = maStyleNamePrefix1.Len();
+ else if( rStyleName.EqualsIgnoreCaseAscii( maStyleNamePrefix2, 0, maStyleNamePrefix2.Len() ) )
+ nPrefixLen = maStyleNamePrefix2.Len();
+ if( nPrefixLen > 0 )
{
String aShortName;
for( sal_uInt8 nId = 0; nId < STATIC_TABLE_SIZE( ppcStyleNames ); ++nId )
@@ -583,14 +606,14 @@ bool XclTools::IsBuiltInStyleName( const String& rStyleName, sal_uInt8* pnStyleI
if( pnStyleId ) *pnStyleId = EXC_STYLE_USERDEF;
if( pnNextChar ) *pnNextChar = 0;
- return false;
+ return nPrefixLen > 0; // also return true for unknown built-in styles
}
bool XclTools::GetBuiltInStyleId( sal_uInt8& rnStyleId, sal_uInt8& rnLevel, const String& rStyleName )
{
sal_uInt8 nStyleId;
xub_StrLen nNextChar;
- if( IsBuiltInStyleName( rStyleName, &nStyleId, &nNextChar ) )
+ if( IsBuiltInStyleName( rStyleName, &nStyleId, &nNextChar ) && (nStyleId != EXC_STYLE_USERDEF) )
{
if( (nStyleId == EXC_STYLE_ROWLEVEL) || (nStyleId == EXC_STYLE_COLLEVEL) )
{
@@ -617,24 +640,25 @@ bool XclTools::GetBuiltInStyleId( sal_uInt8& rnStyleId, sal_uInt8& rnLevel, cons
// conditional formatting style names -----------------------------------------
-const String XclTools::maCFStyleNamePrefix( RTL_CONSTASCII_USTRINGPARAM( "Excel_CondFormat_" ) );
+const String XclTools::maCFStyleNamePrefix1( RTL_CONSTASCII_USTRINGPARAM( "Excel_CondFormat_" ) );
+const String XclTools::maCFStyleNamePrefix2( RTL_CONSTASCII_USTRINGPARAM( "ConditionalStyle_" ) );
String XclTools::GetCondFormatStyleName( SCTAB nScTab, sal_Int32 nFormat, sal_uInt16 nCondition )
{
- return String( maCFStyleNamePrefix ).Append( String::CreateFromInt32( nScTab + 1 ) ).
+ return String( maCFStyleNamePrefix1 ).Append( String::CreateFromInt32( nScTab + 1 ) ).
Append( '_' ).Append( String::CreateFromInt32( nFormat + 1 ) ).
Append( '_' ).Append( String::CreateFromInt32( nCondition + 1 ) );
}
bool XclTools::IsCondFormatStyleName( const String& rStyleName, xub_StrLen* pnNextChar )
{
- xub_StrLen nPrefixLen = maCFStyleNamePrefix.Len();
- if( rStyleName.EqualsIgnoreCaseAscii( maCFStyleNamePrefix, 0, nPrefixLen ) )
- {
- if( pnNextChar ) *pnNextChar = nPrefixLen;
- return true;
- }
- return false;
+ xub_StrLen nPrefixLen = 0;
+ if( rStyleName.EqualsIgnoreCaseAscii( maCFStyleNamePrefix1, 0, maCFStyleNamePrefix1.Len() ) )
+ nPrefixLen = maCFStyleNamePrefix1.Len();
+ else if( rStyleName.EqualsIgnoreCaseAscii( maCFStyleNamePrefix2, 0, maCFStyleNamePrefix2.Len() ) )
+ nPrefixLen = maCFStyleNamePrefix2.Len();
+ if( pnNextChar ) *pnNextChar = nPrefixLen;
+ return nPrefixLen > 0;
}
// stream handling ------------------------------------------------------------
diff --git a/sc/source/filter/ftools/fapihelper.cxx b/sc/source/filter/ftools/fapihelper.cxx
index 3befbf4d866f..31190b6407b1 100644
--- a/sc/source/filter/ftools/fapihelper.cxx
+++ b/sc/source/filter/ftools/fapihelper.cxx
@@ -35,9 +35,8 @@
#include <algorithm>
#include <com/sun/star/lang/XServiceName.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/task/XInteractionHandler.hpp>
-#include <com/sun/star/task/XInteractionRequest.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
+#include <comphelper/docpasswordhelper.hxx>
#include <comphelper/processfactory.hxx>
#include <tools/urlobj.hxx>
#include <sfx2/objsh.hxx>
@@ -45,7 +44,6 @@
#include <sfx2/sfxsids.hrc>
#include <svtools/stritem.hxx>
#include <svtools/itemset.hxx>
-#include <svtools/docpasswdrequest.hxx>
#include "miscuno.hxx"
using ::rtl::OUString;
@@ -55,14 +53,14 @@ using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_SET_THROW;
using ::com::sun::star::uno::TypeClass_BOOLEAN;
using ::com::sun::star::uno::XInterface;
using ::com::sun::star::beans::XPropertySet;
using ::com::sun::star::beans::XPropertyState;
using ::com::sun::star::lang::XServiceName;
using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::task::XInteractionHandler;
-using ::com::sun::star::task::XInteractionRequest;
+using ::com::sun::star::task::PasswordRequestMode_PASSWORD_ENTER;
// Static helper functions ====================================================
@@ -141,40 +139,25 @@ Reference< XInterface > ScfApiHelper::CreateInstanceWithArgs(
return CreateInstanceWithArgs( ::comphelper::getProcessServiceFactory(), rServiceName, rArgs );
}
-String ScfApiHelper::QueryPasswordForMedium( SfxMedium& rMedium )
+String ScfApiHelper::QueryPasswordForMedium( SfxMedium& rMedium,
+ ::comphelper::IDocPasswordVerifier& rVerifier, const ::std::vector< OUString >* pDefaultPasswords )
{
- String aPassw;
- const SfxItemSet* pSet = rMedium.GetItemSet();
+ OUString aMediaPassword;
+ SfxItemSet* pItemSet = rMedium.GetItemSet();
const SfxPoolItem *pPasswordItem;
+ if( pItemSet && (SFX_ITEM_SET == pItemSet->GetItemState( SID_PASSWORD, TRUE, &pPasswordItem )) )
+ aMediaPassword = static_cast< const SfxStringItem* >( pPasswordItem )->GetValue();
+ OUString aDocName = INetURLObject( rMedium.GetOrigURL() ).GetName( INetURLObject::DECODE_WITH_CHARSET );
- if( pSet && (SFX_ITEM_SET == pSet->GetItemState( SID_PASSWORD, TRUE, &pPasswordItem )) )
- {
- aPassw = static_cast< const SfxStringItem* >( pPasswordItem )->GetValue();
- }
- else
- {
- try
- {
- Reference< XInteractionHandler > xHandler( rMedium.GetInteractionHandler() );
- if( xHandler.is() )
- {
- RequestDocumentPassword* pRequest = new RequestDocumentPassword(
- ::com::sun::star::task::PasswordRequestMode_PASSWORD_ENTER,
- INetURLObject( rMedium.GetOrigURL() ).GetName( INetURLObject::DECODE_WITH_CHARSET ) );
- Reference< XInteractionRequest > xRequest( pRequest );
-
- xHandler->handle( xRequest );
-
- if( pRequest->isPassword() )
- aPassw = pRequest->getPassword();
- }
- }
- catch( Exception& )
- {
- }
- }
+ bool bIsDefaultPassword = false;
+ OUString aPassword = ::comphelper::DocPasswordHelper::requestAndVerifyDocPassword(
+ rVerifier, aMediaPassword, rMedium.GetInteractionHandler(), aDocName,
+ ::comphelper::DocPasswordRequestType_MS, pDefaultPasswords, &bIsDefaultPassword );
+
+ if( !bIsDefaultPassword && (aPassword.getLength() > 0) && pItemSet )
+ pItemSet->Put( SfxStringItem( SID_PASSWORD, aPassword ) );
- return aPassw;
+ return aPassword;
}
// Property sets ==============================================================
diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx
index 98faeb9f03d4..2271a8f35d4d 100644
--- a/sc/source/filter/ftools/ftools.cxx
+++ b/sc/source/filter/ftools/ftools.cxx
@@ -160,13 +160,15 @@ Color ScfTools::GetMixedColor( const Color& rFore, const Color& rBack, sal_uInt8
// *** conversion of names *** ------------------------------------------------
+/* XXX As in sc/source/core/tool/rangenam.cxx ScRangeData::IsValidName() */
+
void ScfTools::ConvertToScDefinedName( String& rName )
{
xub_StrLen nLen = rName.Len();
- if( nLen && !ScCompiler::IsCharWordChar( rName, 0 ) )
+ if( nLen && !ScCompiler::IsCharFlagAllConventions( rName, 0, SC_COMPILER_C_CHAR_NAME ) )
rName.SetChar( 0, '_' );
for( xub_StrLen nPos = 1; nPos < nLen; ++nPos )
- if( !ScCompiler::IsWordChar( rName, nPos ) )
+ if( !ScCompiler::IsCharFlagAllConventions( rName, nPos, SC_COMPILER_C_NAME ) )
rName.SetChar( nPos, '_' );
}
diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx
index 1f2eee05fd55..79607802ccdc 100644
--- a/sc/source/filter/inc/excrecds.hxx
+++ b/sc/source/filter/inc/excrecds.hxx
@@ -149,7 +149,6 @@ protected:
public:
inline ExcBoolRecord( const BOOL bDefault ) : bVal( bDefault ) {}
- ExcBoolRecord( SfxItemSet*, USHORT nWhich, BOOL bDefault );
virtual sal_Size GetLen( void ) const;
};
@@ -211,18 +210,6 @@ public:
};
-//----------------------------------------------------- class ExcFngroupcount -
-
-class ExcFngroupcount : public ExcRecord
-{
-private:
- virtual void SaveCont( XclExpStream& rStrm );
-public:
- virtual UINT16 GetNum( void ) const;
- virtual sal_Size GetLen( void ) const;
-};
-
-
//--------------------------------------------------------- class ExcDummy_00 -
// INTERFACEHDR to FNGROUPCOUNT (see excrecds.cxx)
diff --git a/sc/source/filter/inc/fapihelper.hxx b/sc/source/filter/inc/fapihelper.hxx
index d8881889e7fa..f3cdc782ee9c 100644
--- a/sc/source/filter/inc/fapihelper.hxx
+++ b/sc/source/filter/inc/fapihelper.hxx
@@ -45,6 +45,8 @@ namespace com { namespace sun { namespace star {
namespace lang { class XMultiServiceFactory; }
} } }
+namespace comphelper { class IDocPasswordVerifier; }
+
// Static helper functions ====================================================
class SfxMedium;
@@ -109,7 +111,9 @@ public:
/** Opens a password dialog and returns the entered password.
@return The entered password or an empty string on 'Cancel' or any error. */
- static String QueryPasswordForMedium( SfxMedium& rMedium );
+ static String QueryPasswordForMedium( SfxMedium& rMedium,
+ ::comphelper::IDocPasswordVerifier& rVerifier,
+ const ::std::vector< ::rtl::OUString >* pDefaultPasswords = 0 );
};
template< typename Type >
diff --git a/sc/source/filter/inc/fdumper.hxx b/sc/source/filter/inc/fdumper.hxx
deleted file mode 100644
index ea4aabf69009..000000000000
--- a/sc/source/filter/inc/fdumper.hxx
+++ /dev/null
@@ -1,1520 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: fdumper.hxx,v $
- * $Revision: 1.8.28.2 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SC_FDUMPER_HXX
-#define SC_FDUMPER_HXX
-
-#define SCF_INCL_DUMPER (OSL_DEBUG_LEVEL > 0) && 0
-
-#include <map>
-// #include <math.h>
-#include "ftools.hxx"
-
-#if SCF_INCL_DUMPER
-
-class SvStream;
-class SfxMedium;
-class SfxObjectShell;
-class Color;
-class DateTime;
-
-namespace scf {
-namespace dump {
-
-#define SCF_DUMP_UNUSED "unused"
-#define SCF_DUMP_UNKNOWN "?unknown"
-
-#define SCF_DUMP_ERRASCII( ascii ) "?err:" ascii
-#define SCF_DUMP_ERRSTRING( ascii ) CREATE_STRING( SCF_DUMP_ERRASCII( ascii ) )
-
-#define SCF_DUMP_ERR_NOMAP SCF_DUMP_ERRSTRING( "no-map" )
-#define SCF_DUMP_ERR_NONAME SCF_DUMP_ERRSTRING( "no-name" )
-#define SCF_DUMP_ERR_STREAM SCF_DUMP_ERRSTRING( "stream-error" )
-
-// ============================================================================
-// ============================================================================
-
-/** Specifiers for atomic data types. */
-enum DataType
-{
- DATATYPE_VOID, /// No data type.
- DATATYPE_INT8, /// Signed 8-bit integer.
- DATATYPE_UINT8, /// Unsigned 8-bit integer.
- DATATYPE_INT16, /// Signed 16-bit integer.
- DATATYPE_UINT16, /// Unsigned 16-bit integer.
- DATATYPE_INT32, /// Signed 32-bit integer.
- DATATYPE_UINT32, /// Unsigned 32-bit integer.
- DATATYPE_INT64, /// Signed 64-bit integer.
- DATATYPE_UINT64, /// Unsigned 64-bit integer.
- DATATYPE_FLOAT, /// Floating-point, single precision.
- DATATYPE_DOUBLE /// Floating-point, double precision.
-};
-
-// ----------------------------------------------------------------------------
-
-/** Specifiers for the output format of values. */
-enum FormatType
-{
- FORMATTYPE_NONE, /// No numeric format (e.g. show name only).
- FORMATTYPE_DEC, /// Decimal.
- FORMATTYPE_HEX, /// Hexadecimal.
- FORMATTYPE_BIN, /// Binary.
- FORMATTYPE_FIX, /// Fixed-point.
- FORMATTYPE_BOOL /// Boolean ('true' or 'false').
-};
-
-// ----------------------------------------------------------------------------
-
-/** Describes the output format of a data item.
-
- Data items are written in the following format:
-
- <NAME>=<VALUE>=<NAME-FROM-LIST>
-
- NAME is the name of the data item. The name is contained in the members
- maItemName and maItemNameUtf8. If the name is empty, only the value is
- written (without a leading equality sign).
-
- VALUE is the numeric value of the data item. Its format is dependent on the
- output format given in the member meFmtType. If the format type is
- FORMATTYPE_NONE, no value is written.
-
- NAME-FROM-LIST is a symbolic name for the current value of the data item.
- Various types of name lists produce different names for values, which can
- be used for enumerations or names for single bits in bitfields (see class
- NameListBase and derived classes). The name of the list is given in the
- member maListName. If it is empty, no name is written for the value.
- */
-struct ItemFormat
-{
- DataType meDataType; /// Data type of the item.
- FormatType meFmtType; /// Output format for the value.
- String maItemName; /// Name of the item.
- ByteString maItemNameUtf8; /// Name of the item, converted to UTF-8.
- String maListName; /// Name of a name list to be used for this item.
-
- explicit ItemFormat();
-
- void Set( DataType eDataType, FormatType eFmtType, const String& rItemName );
- void Set( DataType eDataType, FormatType eFmtType, const String& rItemName, const String& rListName );
-
- /** Initializes the struct from a vector of strings containing the item format.
-
- The vector must contain at least 2 strings. The struct is filled from
- the strings in the vector in the following order:
- 1) Data type (one of: [u]int8, [u]int16, [u]int32, [u]int64, float, double).
- 2) Format type (one of: dec, hex, bin, fix, bool, unused, unknown).
- 3) Item name (optional).
- 4) Name list name (optional).
-
- @return Iterator pointing to the first unhandled string.
- */
- ScfStringVec::const_iterator Parse( const ScfStringVec& rFormatVec );
-
- /** Initializes the struct from a string containing the item format.
-
- The string must have the following format:
- DATATYPE,FORMATTYPE[,ITEMNAME[,LISTNAME]]
-
- DATATYPE is the data type of the item (see above for possible values).
- FORMATTYPE is the format type of the item (see above for possible values).
- ITEMNAME is the name of the item (optional).
- LISTNAME is the name of a name list (optional).
-
- @return List containing remaining unhandled format strings.
- */
- ScfStringVec Parse( const String& rFormatStr );
-};
-
-// ============================================================================
-// ============================================================================
-
-/** Static helper functions for formatted output to strings. */
-class StringHelper
-{
-public:
- // append string to string ------------------------------------------------
-
- static void AppendString( String& rStr, const String& rData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' );
-
- // append decimal ---------------------------------------------------------
-
- static void AppendDec( String& rStr, sal_uInt8 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' );
- static void AppendDec( String& rStr, sal_Int8 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' );
- static void AppendDec( String& rStr, sal_uInt16 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' );
- static void AppendDec( String& rStr, sal_Int16 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' );
- static void AppendDec( String& rStr, sal_uInt32 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' );
- static void AppendDec( String& rStr, sal_Int32 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' );
- static void AppendDec( String& rStr, sal_uInt64 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' );
- static void AppendDec( String& rStr, sal_Int64 nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' );
- static void AppendDec( String& rStr, double fData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' );
-
- // append hexadecimal -----------------------------------------------------
-
- static void AppendHex( String& rStr, sal_uInt8 nData, bool bPrefix = true );
- static void AppendHex( String& rStr, sal_Int8 nData, bool bPrefix = true );
- static void AppendHex( String& rStr, sal_uInt16 nData, bool bPrefix = true );
- static void AppendHex( String& rStr, sal_Int16 nData, bool bPrefix = true );
- static void AppendHex( String& rStr, sal_uInt32 nData, bool bPrefix = true );
- static void AppendHex( String& rStr, sal_Int32 nData, bool bPrefix = true );
- static void AppendHex( String& rStr, sal_uInt64 nData, bool bPrefix = true );
- static void AppendHex( String& rStr, sal_Int64 nData, bool bPrefix = true );
- static void AppendHex( String& rStr, double fData, bool bPrefix = true );
-
- // append shortened hexadecimal -------------------------------------------
-
- static void AppendShortHex( String& rStr, sal_uInt8 nData, bool bPrefix = true );
- static void AppendShortHex( String& rStr, sal_Int8 nData, bool bPrefix = true );
- static void AppendShortHex( String& rStr, sal_uInt16 nData, bool bPrefix = true );
- static void AppendShortHex( String& rStr, sal_Int16 nData, bool bPrefix = true );
- static void AppendShortHex( String& rStr, sal_uInt32 nData, bool bPrefix = true );
- static void AppendShortHex( String& rStr, sal_Int32 nData, bool bPrefix = true );
- static void AppendShortHex( String& rStr, sal_uInt64 nData, bool bPrefix = true );
- static void AppendShortHex( String& rStr, sal_Int64 nData, bool bPrefix = true );
-
- // append binary ----------------------------------------------------------
-
- static void AppendBin( String& rStr, sal_uInt8 nData, bool bDots = true );
- static void AppendBin( String& rStr, sal_Int8 nData, bool bDots = true );
- static void AppendBin( String& rStr, sal_uInt16 nData, bool bDots = true );
- static void AppendBin( String& rStr, sal_Int16 nData, bool bDots = true );
- static void AppendBin( String& rStr, sal_uInt32 nData, bool bDots = true );
- static void AppendBin( String& rStr, sal_Int32 nData, bool bDots = true );
- static void AppendBin( String& rStr, sal_uInt64 nData, bool bDots = true );
- static void AppendBin( String& rStr, sal_Int64 nData, bool bDots = true );
- static void AppendBin( String& rStr, double fData, bool bDots = true );
-
- // append fixed-point decimal ---------------------------------------------
-
- template< typename Type >
- static void AppendFix( String& rStr, Type nData, xub_StrLen nWidth = 0 );
-
- // append formatted value -------------------------------------------------
-
- static void AppendBool( String& rStr, bool bData );
- template< typename Type >
- static void AppendValue( String& rStr, Type nData, FormatType eFmtType );
-
- // encoded text output ----------------------------------------------------
-
- static void AppendCChar( String& rStr, sal_Unicode cChar, bool bPrefix = true );
- static void AppendEncChar( String& rStr, sal_Unicode cChar, xub_StrLen nCount = 1, bool bPrefix = true );
- static void AppendEncString( String& rStr, const String& rData, bool bPrefix = true );
-
- // token list -------------------------------------------------------------
-
- static void AppendToken( String& rStr, const String& rToken, sal_Unicode cSep = ',' );
- static void AppendToken( String& rStr, sal_Int64 nToken, sal_Unicode cSep = ',' );
- static void PrependToken( String& rStr, const String& rToken, sal_Unicode cSep = ',' );
- static void PrependToken( String& rStr, sal_Int64 nToken, sal_Unicode cSep = ',' );
-
- static void AppendIndex( String& rStr, const String& rIdx );
- static void AppendIndex( String& rStr, sal_Int64 nIdx );
- static void AppendIndexedText( String& rStr, const String& rData, const String& rIdx );
- static void AppendIndexedText( String& rStr, const String& rData, sal_Int64 nIdx );
-
- static String GetToken( const String& rData, xub_StrLen& rnPos, sal_Unicode cSep = ',' );
-
- // quoting and trimming ---------------------------------------------------
-
- /** Encloses the passed string with the passed characters. Uses cOpen, if cClose is NUL. */
- static void Enclose( String& rStr, sal_Unicode cOpen, sal_Unicode cClose = '\0' );
-
- static void TrimSpaces( String& rStr );
- static void TrimQuotes( String& rStr );
-
- // string conversion ------------------------------------------------------
-
- static ByteString ConvertToUtf8( const String& rStr );
- static DataType ConvertToDataType( const String& rStr );
- static FormatType ConvertToFormatType( const String& rStr );
-
- static bool ConvertFromDec( sal_Int64& rnData, const String& rData );
- static bool ConvertFromHex( sal_Int64& rnData, const String& rData );
-
- static bool ConvertStringToInt( sal_Int64& rnData, const String& rData );
- static bool ConvertStringToDouble( double& rfData, const String& rData );
- static bool ConvertStringToBool( const String& rData );
-
- // string to list conversion ----------------------------------------------
-
- static void ConvertStringToStringList( ScfStringVec& rVec, const String& rData, bool bIgnoreEmpty );
- static void ConvertStringToIntList( ScfInt64Vec& rVec, const String& rData, bool bIgnoreEmpty );
-
- // file names -------------------------------------------------------------
-
- static String ConvertFileNameToUrl( const String& rFileName );
- static xub_StrLen GetFileNamePos( const String& rFileUrl );
-};
-
-// ----------------------------------------------------------------------------
-
-template< typename Type >
-void StringHelper::AppendFix( String& rStr, Type nData, xub_StrLen nWidth )
-{
- AppendDec( rStr, static_cast< double >( nData ) / pow( 2.0, 4.0 * sizeof( Type ) ), nWidth );
-}
-
-template< typename Type >
-void StringHelper::AppendValue( String& rStr, Type nData, FormatType eFmtType )
-{
- switch( eFmtType )
- {
- case FORMATTYPE_DEC: AppendDec( rStr, nData ); break;
- case FORMATTYPE_HEX: AppendHex( rStr, nData ); break;
- case FORMATTYPE_BIN: AppendBin( rStr, nData ); break;
- case FORMATTYPE_FIX: AppendFix( rStr, nData ); break;
- case FORMATTYPE_BOOL: AppendBool( rStr, nData ); break;
- default:;
- }
-}
-
-// ============================================================================
-
-class StringWrapper
-{
-public:
- inline StringWrapper() {}
- inline /*implicit*/ StringWrapper( const String& rStr ) : maStr( rStr ) {}
- inline /*implicit*/ StringWrapper( const sal_Char* pcStr ) : maStr( String::CreateFromAscii( pcStr ? pcStr : "" ) ) {}
- inline /*implicit*/ StringWrapper( sal_Unicode cChar ) : maStr( cChar ) {}
-
- inline bool Empty() const { return maStr.Len() == 0; }
- inline const String& GetString() const { return maStr; }
-
-private:
- String maStr;
-};
-
-// ============================================================================
-// ============================================================================
-
-class Base;
-typedef ScfRef< Base > BaseRef;
-
-/** Base class for all dumper classes.
-
- Derived classes implement the virtual function ImplIsValid(). It should
- check all members the other functions rely on. If the function
- ImplIsValid() returns true, all references and pointers can be used without
- further checking.
-
- Overview of all classes in this header file based on this Base class:
-
- Base
- |
- +----> NameListBase
- | |
- | +----> ConstList ------> MultiList
- | +----> FlagsList ------> CombiList
- | +----> UnitConverter
- |
- +----> ConfigCoreData
- +----> Config
- +----> CoreData
- |
- +----> Input ------> SvStreamInput
- +----> Output
- |
- +----> ObjectBase
- |
- +----> InputObjectBase
- | |
- | +----> StreamObjectBase
- | | |
- | | +----> SvStreamObject
- | | +----> OleStreamObject
- | | +----> WrappedStreamObject
- | |
- | +----> RecordHeaderBase
- |
- +----> OleStorageObject
- +----> DumperBase
- */
-class Base
-{
-public:
- virtual ~Base();
-
- inline bool IsValid() const { return ImplIsValid(); }
- inline static bool IsValid( BaseRef xBase ) { return xBase.is() && xBase->IsValid(); }
-
-protected:
- inline explicit Base() {}
-
- virtual bool ImplIsValid() const = 0;
-};
-
-// ============================================================================
-// ============================================================================
-
-class ConfigItemBase
-{
-public:
- virtual ~ConfigItemBase();
- void ReadConfigBlock( SvStream& rStrm );
-
-protected:
- inline explicit ConfigItemBase() {}
-
- virtual void ImplProcessConfigItemStr( SvStream& rStrm, const String& rKey, const String& rData );
- virtual void ImplProcessConfigItemInt( SvStream& rStrm, sal_Int64 nKey, const String& rData );
-
- void ReadConfigBlockContents( SvStream& rStrm );
- void IgnoreConfigBlockContents( SvStream& rStrm );
-
-private:
- enum LineType { LINETYPE_DATA, LINETYPE_BEGIN, LINETYPE_END };
-
- LineType ReadConfigLine( SvStream& rStrm, String& rKey, String& rData ) const;
- LineType ReadConfigLine( SvStream& rStrm ) const;
- void ProcessConfigItem( SvStream& rStrm, const String& rKey, const String& rData );
-};
-
-// ============================================================================
-
-class ConfigCoreData;
-class Config;
-
-class NameListBase;
-typedef ScfRef< NameListBase > NameListRef;
-
-/** Base class of all classes providing names for specific values (name lists).
-
- The idea is to provide a unique interfase for all different methods to
- write specific names for any values. This can be enumerations (dedicated
- names for a subset of values), or names for bits in bit fields. Classes
- derived from this base class implement the specific behaviour for the
- desired purpose.
- */
-class NameListBase : public Base, public ConfigItemBase
-{
-public:
- typedef ::std::map< sal_Int64, String > StringMap;
- typedef StringMap::const_iterator const_iterator;
-
- virtual ~NameListBase();
-
- /** Sets a name for the specified key. */
- void SetName( sal_Int64 nKey, const StringWrapper& rNameWrp );
- /** Include all names of the passed list. */
- void IncludeList( NameListRef xList );
-
- /** Returns true, if the map contains an entry for the passed key. */
- template< typename Type >
- inline bool HasName( Type nKey ) const
- { return maMap.count( static_cast< sal_Int64 >( nKey ) ) != 0; }
- /** Returns the name for the passed key. */
- template< typename Type >
- inline String GetName( const Config& rCfg, Type nKey ) const
- { return ImplGetName( rCfg, static_cast< sal_Int64 >( nKey ) ); }
- /** Returns a display name for the passed double value. */
- inline String GetName( const Config& rCfg, double fValue ) const
- { return ImplGetNameDbl( rCfg, fValue ); }
-
- /** Returns a map iterator pointing to the first contained name. */
- inline const_iterator begin() const { return maMap.begin(); }
- /** Returns a map iterator pointing one past the last contained name. */
- inline const_iterator end() const { return maMap.end(); }
-
-protected:
- inline explicit NameListBase( const ConfigCoreData& rCoreData ) : mrCoreData( rCoreData ) {}
-
- virtual bool ImplIsValid() const;
- virtual void ImplProcessConfigItemStr( SvStream& rStrm, const String& rKey, const String& rData );
- virtual void ImplProcessConfigItemInt( SvStream& rStrm, sal_Int64 nKey, const String& rData );
-
- /** Derived classes set the name for the passed key. */
- virtual void ImplSetName( sal_Int64 nKey, const String& rName ) = 0;
- /** Derived classes generate and return the name for the passed key. */
- virtual String ImplGetName( const Config& rCfg, sal_Int64 nKey ) const = 0;
- /** Derived classes generate and return the name for the passed double value. */
- virtual String ImplGetNameDbl( const Config& rCfg, double fValue ) const = 0;
- /** Derived classes insert all names and other settings from the passed list. */
- virtual void ImplIncludeList( const NameListBase& rList ) = 0;
-
- /** Returns the configuration core data, which can be used to access other name lists. */
- inline const ConfigCoreData& GetCoreData() const { return mrCoreData; }
- /** Inserts the passed name into the internal map. */
- void InsertRawName( sal_Int64 nKey, const String& rName );
- /** Returns the name for the passed key, or 0, if nothing found. */
- const String* FindRawName( sal_Int64 nKey ) const;
-
-private:
- /** Includes name lists, given in a comma separated list of names of the lists. */
- void Include( const String& rListKeys );
- /** Excludes names from the list, given by a comma separated list of their keys. */
- void Exclude( const String& rKeys );
-
-private:
- StringMap maMap;
- const ConfigCoreData& mrCoreData;
-};
-
-// ============================================================================
-
-class ConstList : public NameListBase
-{
-public:
- explicit ConstList( const ConfigCoreData& rCoreData );
-
- /** Sets a default name for unknown keys. */
- inline void SetDefaultName( const StringWrapper& rDefName ) { maDefName = rDefName.GetString(); }
- /** Enables or disables automatic quotation of returned names. */
- inline void SetQuoteNames( bool bQuoteNames ) { mbQuoteNames = bQuoteNames; }
-
-protected:
- virtual void ImplProcessConfigItemStr( SvStream& rStrm, const String& rKey, const String& rData );
-
- /** Sets the name for the passed key. */
- virtual void ImplSetName( sal_Int64 nKey, const String& rName );
- /** Returns the name for the passed key, or the default name, if key is not contained. */
- virtual String ImplGetName( const Config& rCfg, sal_Int64 nKey ) const;
- /** Returns the name for the passed double value. */
- virtual String ImplGetNameDbl( const Config& rCfg, double fValue ) const;
- /** Inserts all names from the passed list. */
- virtual void ImplIncludeList( const NameListBase& rList );
-
-private:
- String maDefName;
- bool mbQuoteNames;
-};
-
-// ============================================================================
-
-class MultiList : public ConstList
-{
-public:
- explicit MultiList( const ConfigCoreData& rCoreData );
-
- void SetNamesFromVec( sal_Int64 nStartKey, const ScfStringVec& rNames );
-
-protected:
- virtual void ImplProcessConfigItemStr( SvStream& rStrm, const String& rKey, const String& rData );
- virtual void ImplSetName( sal_Int64 nKey, const String& rName );
-
-private:
- void InsertNames( sal_Int64 nStartKey, const String& rData );
-
-private:
- bool mbIgnoreEmpty;
-};
-
-// ============================================================================
-
-class FlagsList : public NameListBase
-{
-public:
- explicit FlagsList( const ConfigCoreData& rCoreData );
-
- /** Sets flags to be ignored on output. */
- template< typename Type >
- inline void SetIgnoreFlags( Type nIgnore )
- { mnIgnore = static_cast< sal_Int64 >( nIgnore ); }
-
-protected:
- virtual void ImplProcessConfigItemStr( SvStream& rStrm, const String& rKey, const String& rData );
-
- /** Sets the name for the passed key. */
- virtual void ImplSetName( sal_Int64 nKey, const String& rName );
- /** Returns the name for the passed key. */
- virtual String ImplGetName( const Config& rCfg, sal_Int64 nKey ) const;
- /** Returns the name for the passed double value. */
- virtual String ImplGetNameDbl( const Config& rCfg, double fValue ) const;
- /** Inserts all flags from the passed list. */
- virtual void ImplIncludeList( const NameListBase& rList );
-
-private:
- sal_Int64 mnIgnore;
-};
-
-// ============================================================================
-
-class CombiList : public FlagsList
-{
-public:
- explicit CombiList( const ConfigCoreData& rCoreData );
-
-protected:
- /** Sets the name for the passed key. */
- virtual void ImplSetName( sal_Int64 nKey, const String& rName );
- /** Returns the name for the passed key. */
- virtual String ImplGetName( const Config& rCfg, sal_Int64 nKey ) const;
- /** Inserts all flags from the passed list. */
- virtual void ImplIncludeList( const NameListBase& rList );
-
-private:
- struct ExtItemFormat : public ItemFormat
- {
- bool mbShiftValue;
- inline explicit ExtItemFormat() : mbShiftValue( true ) {}
- };
- typedef ::std::map< sal_Int64, ExtItemFormat > ExtItemFormatMap;
- ExtItemFormatMap maFmtMap;
-};
-
-// ============================================================================
-
-class UnitConverter : public NameListBase
-{
-public:
- explicit UnitConverter( const ConfigCoreData& rCoreData );
-
- inline void SetUnitName( const StringWrapper& rUnitName ) { maUnitName = rUnitName.GetString(); }
- inline void SetFactor( double fFactor ) { mfFactor = fFactor; }
-
-protected:
- /** Sets the name for the passed key. */
- virtual void ImplSetName( sal_Int64 nKey, const String& rName );
- /** Returns the converted value with appended unit name. */
- virtual String ImplGetName( const Config& rCfg, sal_Int64 nKey ) const;
- /** Returns the converted value with appended unit name. */
- virtual String ImplGetNameDbl( const Config& rCfg, double fValue ) const;
- /** Empty implementation. */
- virtual void ImplIncludeList( const NameListBase& rList );
-
-private:
- String maUnitName;
- double mfFactor;
-};
-
-// ============================================================================
-
-class NameListWrapper
-{
-public:
- inline NameListWrapper() {}
- inline /*implicit*/ NameListWrapper( const String& rListName ) : maNameWrp( rListName ) {}
- inline /*implicit*/ NameListWrapper( const sal_Char* pcListName ) : maNameWrp( pcListName ) {}
- inline /*implicit*/ NameListWrapper( NameListRef xList ) : mxList( xList ) {}
-
- inline bool Empty() const { return !mxList && maNameWrp.Empty(); }
- NameListRef GetNameList( const Config& rCfg ) const;
-
-private:
- StringWrapper maNameWrp;
- mutable NameListRef mxList;
-};
-
-static const NameListWrapper NO_LIST;
-
-// ============================================================================
-// ============================================================================
-
-class ConfigCoreData : public Base, public ConfigItemBase
-{
-public:
- explicit ConfigCoreData( const String& rFileName );
- virtual ~ConfigCoreData();
-
- void SetOption( const String& rKey, const String& rData );
- const String* GetOption( const String& rKey ) const;
-
- template< typename ListType >
- ScfRef< ListType > CreateNameList( const String& rListName );
- void SetNameList( const String& rListName, NameListRef xList );
- void EraseNameList( const String& rListName );
- NameListRef GetNameList( const String& rListName ) const;
-
-protected:
- inline explicit ConfigCoreData() : mbLoaded( false ) {}
- void Construct( const String& rFileName );
-
- virtual bool ImplIsValid() const;
- virtual void ImplProcessConfigItemStr( SvStream& rStrm, const String& rKey, const String& rData );
-
-private:
- void ConstructCfgCoreData();
-
- bool ReadConfigFile( const String& rFileUrl );
- template< typename ListType >
- void ReadNameList( SvStream& rStrm, const String& rListName );
- void CreateShortList( const String& rData );
- void CreateUnitConverter( const String& rData );
-
-private:
- typedef ::std::map< String, String > ConfigDataMap;
- typedef ::std::map< String, NameListRef > NameListMap;
-
- ConfigDataMap maConfigData;
- NameListMap maNameLists;
- String maConfigPath;
- bool mbLoaded;
-};
-
-// ----------------------------------------------------------------------------
-
-template< typename ListType >
-ScfRef< ListType > ConfigCoreData::CreateNameList( const String& rListName )
-{
- ScfRef< ListType > xList;
- if( rListName.Len() > 0 )
- {
- xList.reset( new ListType( *this ) );
- SetNameList( rListName, xList );
- }
- return xList;
-}
-
-template< typename ListType >
-void ConfigCoreData::ReadNameList( SvStream& rStrm, const String& rListName )
-{
- NameListRef xList = CreateNameList< ListType >( rListName );
- if( xList.is() )
- xList->ReadConfigBlock( rStrm );
-}
-
-// ============================================================================
-
-class Config : public Base
-{
-public:
- explicit Config( const Config& rParent );
- explicit Config( const String& rFileName );
- explicit Config( const sal_Char* pcEnvVar );
- virtual ~Config();
-
- void SetStringOption( const StringWrapper& rKey, const StringWrapper& rData );
-
- const String& GetStringOption( const StringWrapper& rKey, const String& rDefault ) const;
- bool GetBoolOption( const StringWrapper& rKey, bool bDefault ) const;
- template< typename Type >
- Type GetIntOption( const StringWrapper& rKey, Type nDefault ) const;
-
- bool IsDumperEnabled() const;
- bool IsImportEnabled() const;
-
- template< typename ListType >
- ScfRef< ListType > CreateNameList( const StringWrapper& rListName );
- void SetNameList( const StringWrapper& rListName, NameListRef xList );
- void EraseNameList( const StringWrapper& rListName );
- NameListRef GetNameList( const StringWrapper& rListName ) const;
-
- /** Returns the name for the passed key from the passed name list. */
- template< typename Type >
- String GetName( const NameListWrapper& rListWrp, Type nKey ) const;
- /** Returns true, if the passed name list contains an entry for the passed key. */
- template< typename Type >
- bool HasName( const NameListWrapper& rList, Type nKey ) const;
-
-protected:
- inline explicit Config() {}
- void Construct( const Config& rParent );
- void Construct( const String& rFileName );
- void Construct( const sal_Char* pcEnvVar );
-
- virtual bool ImplIsValid() const;
- virtual const String* ImplGetOption( const String& rKey ) const;
- virtual NameListRef ImplGetNameList( const String& rListName ) const;
-
-private:
- typedef ScfRef< ConfigCoreData > ConfigCoreDataRef;
- ConfigCoreDataRef mxCoreData;
-};
-
-typedef ScfRef< Config > ConfigRef;
-
-// ----------------------------------------------------------------------------
-
-template< typename Type >
-Type Config::GetIntOption( const StringWrapper& rKey, Type nDefault ) const
-{
- sal_Int64 nRawData;
- const String* pData = ImplGetOption( rKey.GetString() );
- return (pData && StringHelper::ConvertStringToInt( nRawData, *pData )) ?
- static_cast< Type >( nRawData ) : nDefault;
-}
-
-template< typename ListType >
-ScfRef< ListType > Config::CreateNameList( const StringWrapper& rListName )
-{
- return mxCoreData->CreateNameList< ListType >( rListName.GetString() );
-}
-
-template< typename Type >
-String Config::GetName( const NameListWrapper& rListWrp, Type nKey ) const
-{
- NameListRef xList = rListWrp.GetNameList( *this );
- return xList.is() ? xList->GetName( *this, nKey ) : SCF_DUMP_ERR_NOMAP;
-}
-
-template< typename Type >
-bool Config::HasName( const NameListWrapper& rListWrp, Type nKey ) const
-{
- NameListRef xList = rListWrp.GetNameList( *this );
- return xList.is() && xList->HasName( nKey );
-}
-
-// ============================================================================
-// ============================================================================
-
-class CoreData : public Base
-{
-public:
- explicit CoreData( SfxMedium& rMedium, SfxObjectShell* pDocShell );
-
- inline SfxMedium& GetMedium() { return mrMedium; }
- inline SfxObjectShell* GetDocShell() { return mpDocShell; }
- SvStream& GetCoreStream();
-
-protected:
- virtual bool ImplIsValid() const;
-
-private:
- SfxMedium& mrMedium;
- SfxObjectShell* mpDocShell;
-};
-
-typedef ScfRef< CoreData > CoreDataRef;
-
-// ============================================================================
-// ============================================================================
-
-class Input : public Base
-{
-public:
- virtual sal_Size GetSize() const = 0;
- virtual sal_Size Tell() const = 0;
- virtual void Seek( sal_Size nPos ) = 0;
- virtual void SeekRel( sal_sSize nRelPos ) = 0;
- virtual sal_Size Read( void* pBuffer, sal_Size nSize ) = 0;
- virtual void ReadLine( String& rLine, rtl_TextEncoding eEnc ) = 0;
-
- virtual Input& operator>>( sal_Int8& rnData ) = 0;
- virtual Input& operator>>( sal_uInt8& rnData ) = 0;
- virtual Input& operator>>( sal_Int16& rnData ) = 0;
- virtual Input& operator>>( sal_uInt16& rnData ) = 0;
- virtual Input& operator>>( sal_Int32& rnData ) = 0;
- virtual Input& operator>>( sal_uInt32& rnData ) = 0;
- virtual Input& operator>>( float& rfData ) = 0;
- virtual Input& operator>>( double& rfData ) = 0;
-
- inline bool IsValidPos() const { return Tell() < GetSize(); }
- template< typename Type >
- inline Type ReadValue() { Type nValue; *this >> nValue; return nValue; }
-
-protected:
- virtual bool ImplIsValid() const;
-};
-
-typedef ScfRef< Input > InputRef;
-
-Input& operator>>( Input& rIn, sal_Int64& rnData );
-Input& operator>>( Input& rIn, sal_uInt64& rnData );
-
-// ============================================================================
-
-class SvStreamInput : public Input
-{
-public:
- explicit SvStreamInput( SvStream& rStrm );
- virtual ~SvStreamInput();
-
- virtual sal_Size GetSize() const;
- virtual sal_Size Tell() const;
- virtual void Seek( sal_Size nPos );
- virtual void SeekRel( sal_sSize nRelPos );
- virtual sal_Size Read( void* pBuffer, sal_Size nSize );
- virtual void ReadLine( String& rLine, rtl_TextEncoding eEnc );
-
- virtual SvStreamInput& operator>>( sal_Int8& rnData );
- virtual SvStreamInput& operator>>( sal_uInt8& rnData );
- virtual SvStreamInput& operator>>( sal_Int16& rnData );
- virtual SvStreamInput& operator>>( sal_uInt16& rnData );
- virtual SvStreamInput& operator>>( sal_Int32& rnData );
- virtual SvStreamInput& operator>>( sal_uInt32& rnData );
- virtual SvStreamInput& operator>>( float& rfData );
- virtual SvStreamInput& operator>>( double& rfData );
-
-private:
- SvStream& mrStrm;
-};
-
-// ============================================================================
-// ============================================================================
-
-class Output : public Base
-{
-public:
- explicit Output( SvStream& rStrm );
-
- // ------------------------------------------------------------------------
-
- void NewLine();
- void EmptyLine( size_t nCount = 1 );
- inline String& GetLine() { return maLine; }
-
- void SetPrefix( const String& rPrefix );
- inline const String& GetPrefix() const { return maPrefix; }
-
- void IncIndent();
- void DecIndent();
- void ResetIndent();
-
- void StartTable( xub_StrLen nW1 );
- void StartTable( xub_StrLen nW1, xub_StrLen nW2 );
- void StartTable( xub_StrLen nW1, xub_StrLen nW2, xub_StrLen nW3 );
- void StartTable( xub_StrLen nW1, xub_StrLen nW2, xub_StrLen nW3, xub_StrLen nW4 );
- void StartTable( size_t nColCount, const xub_StrLen* pnColWidths );
- void Tab();
- void Tab( size_t nCol );
- void EndTable();
-
- void ResetItemIndex( sal_Int64 nIdx = 0 );
- void StartItem( const sal_Char* pcName = 0 );
- void ContItem();
- void EndItem();
- inline const String& GetLastItemValue() const { return maLastItem; }
-
- void StartMultiItems();
- void EndMultiItems();
-
- // ------------------------------------------------------------------------
-
- void WriteChar( sal_Unicode cChar, xub_StrLen nCount = 1 );
- void WriteAscii( const sal_Char* pcStr );
- void WriteString( const String& rStr );
- void WriteArray( const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep = ',' );
- void WriteBool( bool bData );
- void WriteColor( const Color& rColor );
- void WriteDateTime( const DateTime& rDateTime );
-
-
- template< typename Type >
- inline void WriteDec( Type nData, xub_StrLen nWidth = 0, sal_Unicode cFill = ' ' )
- { StringHelper::AppendDec( maLine, nData, nWidth, cFill ); }
- template< typename Type >
- inline void WriteHex( Type nData, bool bPrefix = true )
- { StringHelper::AppendHex( maLine, nData, bPrefix ); }
- template< typename Type >
- inline void WriteBin( Type nData, bool bDots = true )
- { StringHelper::AppendBin( maLine, nData, bDots ); }
- template< typename Type >
- inline void WriteFix( Type nData, xub_StrLen nWidth = 0 )
- { StringHelper::AppendFix( maLine, nData, nWidth ); }
- template< typename Type >
- inline void WriteValue( Type nData, FormatType eFmtType )
- { StringHelper::AppendValue( maLine, nData, eFmtType ); }
- template< typename Type >
- inline void WriteName( const Config& rCfg, Type nData, const NameListWrapper& rListWrp )
- { WriteString( rCfg.GetName( rListWrp, nData ) ); }
-
- // ------------------------------------------------------------------------
-protected:
- virtual bool ImplIsValid() const;
-
-private:
- void WriteItemName( const sal_Char* pcName );
-
-private:
- typedef ::std::vector< xub_StrLen > StringLenVec;
-
- SvStream& mrStrm;
- String maPrefix;
- ByteString maPrefixUtf8;
- ByteString maIndent;
- String maLine;
- String maLastItem;
- StringLenVec maColPos;
- size_t mnCol;
- size_t mnItemLevel;
- size_t mnMultiLevel;
- sal_Int64 mnItemIdx;
- xub_StrLen mnLastItem;
-};
-
-typedef ScfRef< Output > OutputRef;
-
-// ============================================================================
-
-class PrefixGuard : private ScfNoCopy
-{
-public:
- inline explicit PrefixGuard( Output& rOut, const String& rPrefix ) :
- mrOut( rOut ), maOldPrefix( rOut.GetPrefix() ) { mrOut.SetPrefix( rPrefix ); }
- inline ~PrefixGuard() { mrOut.SetPrefix( maOldPrefix ); }
-private:
- Output& mrOut;
- String maOldPrefix;
-};
-
-// ----------------------------------------------------------------------------
-
-class IndentGuard : private ScfNoCopy
-{
-public:
- inline explicit IndentGuard( Output& rOut ) : mrOut( rOut ) { mrOut.IncIndent(); }
- inline ~IndentGuard() { mrOut.DecIndent(); }
-private:
- Output& mrOut;
-};
-
-// ----------------------------------------------------------------------------
-
-class TableGuard : private ScfNoCopy
-{
-public:
- inline explicit TableGuard( Output& rOut, xub_StrLen nW1 ) :
- mrOut( rOut ) { mrOut.StartTable( nW1 ); }
- inline explicit TableGuard( Output& rOut, xub_StrLen nW1, xub_StrLen nW2 ) :
- mrOut( rOut ) { mrOut.StartTable( nW1, nW2 ); }
- inline explicit TableGuard( Output& rOut, xub_StrLen nW1, xub_StrLen nW2, xub_StrLen nW3 ) :
- mrOut( rOut ) { mrOut.StartTable( nW1, nW2, nW3 ); }
- inline explicit TableGuard( Output& rOut, xub_StrLen nW1, xub_StrLen nW2, xub_StrLen nW3, xub_StrLen nW4 ) :
- mrOut( rOut ) { mrOut.StartTable( nW1, nW2, nW3, nW4 ); }
- inline explicit TableGuard( Output& rOut, size_t nColCount,
- const xub_StrLen* pnColWidths ) :
- mrOut( rOut ) { mrOut.StartTable( nColCount, pnColWidths ); }
- inline ~TableGuard() { mrOut.EndTable(); }
- inline void Tab() { mrOut.Tab(); }
- inline void Tab( size_t nCol ) { mrOut.Tab( nCol ); }
-private:
- Output& mrOut;
-};
-
-// ----------------------------------------------------------------------------
-
-class ItemGuard : private ScfNoCopy
-{
-public:
- inline explicit ItemGuard( Output& rOut, const sal_Char* pcName = 0 ) :
- mrOut( rOut ) { mrOut.StartItem( pcName ); }
- inline ~ItemGuard() { mrOut.EndItem(); }
- inline void Cont() { mrOut.ContItem(); }
-private:
- Output& mrOut;
-};
-
-// ----------------------------------------------------------------------------
-
-class MultiItemsGuard : private ScfNoCopy
-{
-public:
- inline explicit MultiItemsGuard( Output& rOut ) : mrOut( rOut ) { mrOut.StartMultiItems(); }
- inline ~MultiItemsGuard() { mrOut.EndMultiItems(); }
-private:
- Output& mrOut;
-};
-
-// ============================================================================
-// ============================================================================
-
-class ObjectBase : public Base
-{
-public:
- virtual ~ObjectBase();
-
- SfxMedium& GetCoreMedium() const;
- SvStream& GetCoreStream() const;
-
- void Dump();
-
- // ------------------------------------------------------------------------
-protected:
- inline explicit ObjectBase() {}
- void Construct( ConfigRef xConfig, CoreDataRef xCore, OutputRef xOut );
- void Construct( const ObjectBase& rParent );
-
- virtual bool ImplIsValid() const;
- virtual ConfigRef ImplReconstructConfig();
- virtual OutputRef ImplReconstructOutput();
- virtual void ImplDumpHeader();
- virtual void ImplDumpBody();
- virtual void ImplDumpFooter();
-
- // ------------------------------------------------------------------------
-
- void ReconstructConfig();
- void ReconstructOutput();
-
- inline Config& Cfg() const { return *mxConfig; }
- inline CoreData& Core() const { return *mxCore; }
- inline Output& Out() const { return *mxOut; }
-
- // ------------------------------------------------------------------------
-
- void WriteEmptyItem( const sal_Char* pcName );
- void WriteInfoItem( const sal_Char* pcName, const StringWrapper& rData );
- void WriteStringItem( const sal_Char* pcName, const String& rData );
- void WriteArrayItem( const sal_Char* pcName, const sal_uInt8* pnData, sal_Size nSize, sal_Unicode cSep = ',' );
- void WriteBoolItem( const sal_Char* pcName, bool bData );
- void WriteColorItem( const sal_Char* pcName, const Color& rColor );
- void WriteDateTimeItem( const sal_Char* pcName, const DateTime& rDateTime );
- void WriteGuidItem( const sal_Char* pcName, const String& rGuid );
-
- template< typename Type >
- void AddNameToItem( Type nData, const NameListWrapper& rListWrp );
-
- template< typename Type >
- void WriteNameItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp );
- template< typename Type >
- void WriteDecItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type >
- void WriteHexItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type >
- void WriteBinItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type >
- void WriteFixItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type >
- void WriteDecBoolItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type >
- void WriteValueItem( const sal_Char* pcName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp = NO_LIST );
-
- template< typename Type >
- void WriteValueItem( const ItemFormat& rItemFmt, Type nData );
-
-private:
- ConfigRef mxConfig;
- CoreDataRef mxCore;
- OutputRef mxOut;
-};
-
-typedef ScfRef< ObjectBase > ObjectRef;
-
-// ----------------------------------------------------------------------------
-
-template< typename Type >
-void ObjectBase::AddNameToItem( Type nData, const NameListWrapper& rListWrp )
-{
- if( !rListWrp.Empty() )
- {
- mxOut->ContItem();
- mxOut->WriteName( *mxConfig, nData, rListWrp );
- }
-}
-
-template< typename Type >
-void ObjectBase::WriteNameItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp )
-{
- ItemGuard aItem( *mxOut, pcName );
- mxOut->WriteName( *mxConfig, nData, rListWrp );
-}
-
-template< typename Type >
-void ObjectBase::WriteDecItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp )
-{
- ItemGuard aItem( *mxOut, pcName );
- mxOut->WriteDec( nData );
- AddNameToItem( nData, rListWrp );
-}
-
-template< typename Type >
-void ObjectBase::WriteHexItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp )
-{
- ItemGuard aItem( *mxOut, pcName );
- mxOut->WriteHex( nData );
- AddNameToItem( nData, rListWrp );
-}
-
-template< typename Type >
-void ObjectBase::WriteBinItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp )
-{
- ItemGuard aItem( *mxOut, pcName );
- mxOut->WriteBin( nData );
- AddNameToItem( nData, rListWrp );
-}
-
-template< typename Type >
-void ObjectBase::WriteFixItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp )
-{
- ItemGuard aItem( *mxOut, pcName );
- mxOut->WriteFix( nData );
- AddNameToItem( nData, rListWrp );
-}
-
-template< typename Type >
-void ObjectBase::WriteDecBoolItem( const sal_Char* pcName, Type nData, const NameListWrapper& rListWrp )
-{
- ItemGuard aItem( *mxOut, pcName );
- mxOut->WriteDec( nData );
- aItem.Cont();
- mxOut->WriteBool( nData != 0 );
- AddNameToItem( nData, rListWrp );
-}
-
-template< typename Type >
-void ObjectBase::WriteValueItem( const sal_Char* pcName, Type nData, FormatType eFmtType, const NameListWrapper& rListWrp )
-{
- if( eFmtType == FORMATTYPE_BOOL )
- WriteDecBoolItem( pcName, nData, rListWrp );
- else
- {
- ItemGuard aItem( *mxOut, pcName );
- mxOut->WriteValue( nData, eFmtType );
- AddNameToItem( nData, rListWrp );
- }
-}
-
-template< typename Type >
-void ObjectBase::WriteValueItem( const ItemFormat& rItemFmt, Type nData )
-{
- WriteValueItem( rItemFmt.maItemNameUtf8.GetBuffer(),
- nData, rItemFmt.meFmtType, rItemFmt.maListName );
-}
-
-// ============================================================================
-
-class InputObjectBase : public ObjectBase
-{
-public:
- virtual ~InputObjectBase();
-
- // ------------------------------------------------------------------------
-protected:
- inline explicit InputObjectBase() {}
- void Construct( const ObjectBase& rParent, InputRef xIn );
- void Construct( const InputObjectBase& rParent );
-
- virtual bool ImplIsValid() const;
- virtual InputRef ImplReconstructInput();
- virtual void ImplDumpBody();
-
- // ------------------------------------------------------------------------
-
- void ReconstructInput();
-
- inline Input& In() const { return *mxIn; }
-
- // ------------------------------------------------------------------------
-
- void SkipBlock( sal_Size nSize, bool bShowSize = true );
- void DumpRawBinary( sal_Size nSize, bool bShowOffset = true, bool bStream = false );
-
- void DumpBinary( const sal_Char* pcName, sal_Size nSize, bool bShowOffset = true );
- void DumpArray( const sal_Char* pcName, sal_Size nSize, sal_Unicode cSep = ',' );
- void DumpRemaining( sal_Size nSize );
- inline void DumpUnused( sal_Size nSize ) { DumpArray( SCF_DUMP_UNUSED, nSize ); }
- inline void DumpUnknown( sal_Size nSize ) { DumpArray( SCF_DUMP_UNKNOWN, nSize ); }
-
- void DumpBinaryStream( bool bShowOffset = true );
- void DumpTextStream( rtl_TextEncoding eEnc, bool bShowLines = true );
-
- String DumpGuid( const sal_Char* pcName );
- void DumpItem( const ItemFormat& rItemFmt );
-
- template< typename Type >
- Type DumpName( const sal_Char* pcName, const NameListWrapper& rListWrp );
- template< typename Type >
- Type DumpDec( const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type >
- Type DumpHex( const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type >
- Type DumpBin( const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type >
- Type DumpFix( const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type >
- Type DumpBool( const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type >
- Type DumpValue( const ItemFormat& rItemFmt );
-
- template< typename Type1, typename Type2 >
- Type1 DumpName( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type1, typename Type2 >
- Type1 DumpDec( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type1, typename Type2 >
- Type1 DumpHex( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type1, typename Type2 >
- Type1 DumpBin( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type1, typename Type2 >
- Type1 DumpFix( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type1, typename Type2 >
- Type1 DumpBool( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp = NO_LIST );
- template< typename Type1, typename Type2 >
- Type1 DumpValue( bool bType1, const ItemFormat& rItemFmt );
-
- // ------------------------------------------------------------------------
-
- using ObjectBase::Construct;
-
-private:
- InputRef mxIn;
-};
-
-typedef ScfRef< InputObjectBase > InputObjectRef;
-
-// ----------------------------------------------------------------------------
-
-template< typename Type >
-Type InputObjectBase::DumpName( const sal_Char* pcName, const NameListWrapper& rListWrp )
-{
- Type nData;
- *mxIn >> nData;
- WriteNameItem( pcName, nData, rListWrp );
- return nData;
-}
-
-template< typename Type >
-Type InputObjectBase::DumpDec( const sal_Char* pcName, const NameListWrapper& rListWrp )
-{
- Type nData;
- *mxIn >> nData;
- WriteDecItem( pcName, nData, rListWrp );
- return nData;
-}
-
-template< typename Type >
-Type InputObjectBase::DumpHex( const sal_Char* pcName, const NameListWrapper& rListWrp )
-{
- Type nData;
- *mxIn >> nData;
- WriteHexItem( pcName, nData, rListWrp );
- return nData;
-}
-
-template< typename Type >
-Type InputObjectBase::DumpBin( const sal_Char* pcName, const NameListWrapper& rListWrp )
-{
- Type nData;
- *mxIn >> nData;
- WriteBinItem( pcName, nData, rListWrp );
- return nData;
-}
-
-template< typename Type >
-Type InputObjectBase::DumpFix( const sal_Char* pcName, const NameListWrapper& rListWrp )
-{
- Type nData;
- *mxIn >> nData;
- WriteFixItem( pcName, nData, rListWrp );
- return nData;
-}
-
-template< typename Type >
-Type InputObjectBase::DumpBool( const sal_Char* pcName, const NameListWrapper& rListWrp )
-{
- Type nData;
- *mxIn >> nData;
- WriteDecBoolItem( pcName, nData, rListWrp );
- return nData;
-}
-
-template< typename Type >
-Type InputObjectBase::DumpValue( const ItemFormat& rItemFmt )
-{
- Type nData;
- *mxIn >> nData;
- WriteValueItem( rItemFmt, nData );
- return nData;
-}
-
-template< typename Type1, typename Type2 >
-Type1 InputObjectBase::DumpName( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp )
-{
- return bType1 ? DumpName< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( DumpName< Type2 >( pcName, rListWrp ) );
-}
-
-template< typename Type1, typename Type2 >
-Type1 InputObjectBase::DumpDec( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp )
-{
- return bType1 ? DumpDec< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( DumpDec< Type2 >( pcName, rListWrp ) );
-}
-
-template< typename Type1, typename Type2 >
-Type1 InputObjectBase::DumpHex( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp )
-{
- return bType1 ? DumpHex< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( DumpHex< Type2 >( pcName, rListWrp ) );
-}
-
-template< typename Type1, typename Type2 >
-Type1 InputObjectBase::DumpBin( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp )
-{
- return bType1 ? DumpBin< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( DumpBin< Type2 >( pcName, rListWrp ) );
-}
-
-template< typename Type1, typename Type2 >
-Type1 InputObjectBase::DumpFix( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp )
-{
- return bType1 ? DumpFix< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( DumpFix< Type2 >( pcName, rListWrp ) );
-}
-
-template< typename Type1, typename Type2 >
-Type1 InputObjectBase::DumpBool( bool bType1, const sal_Char* pcName, const NameListWrapper& rListWrp )
-{
- return bType1 ? DumpBool< Type1 >( pcName, rListWrp ) : static_cast< Type1 >( DumpBool< Type2 >( pcName, rListWrp ) );
-}
-
-template< typename Type1, typename Type2 >
-Type1 InputObjectBase::DumpValue( bool bType1, const ItemFormat& rItemFmt )
-{
- return bType1 ? DumpValue< Type1 >( rItemFmt ) : static_cast< Type1 >( DumpValue< Type2 >( rItemFmt ) );
-}
-
-// ============================================================================
-// ============================================================================
-
-class StreamObjectBase : public InputObjectBase
-{
-public:
- virtual ~StreamObjectBase();
-
- inline SvStream& GetStream() { return *mpStrm; }
- inline const String& GetStreamName() const { return maName; }
- inline const String& GetStreamPath() const { return maPath; }
- String GetFullName() const;
- sal_Size GetStreamSize() const;
-
-protected:
- inline explicit StreamObjectBase() : mpStrm( 0 ) {}
- void Construct( const ObjectBase& rParent, SvStream& rStrm,
- const String& rPath, const String& rStrmName, InputRef xIn );
- void Construct( const ObjectBase& rParent, SvStream& rStrm,
- const String& rPath, const String& rStrmName );
- void Construct( const ObjectBase& rParent, SvStream& rStrm );
-
- virtual bool ImplIsValid() const;
- virtual void ImplDumpHeader();
- virtual void ImplDumpFooter();
- virtual void ImplDumpExtendedHeader();
-
- using InputObjectBase::Construct;
-
-private:
- void DumpStreamInfo( bool bExtended );
-
-private:
- SvStream* mpStrm;
- String maPath;
- String maName;
-};
-
-typedef ScfRef< StreamObjectBase > StreamObjectRef;
-
-// ============================================================================
-
-class SvStreamObject : public StreamObjectBase
-{
-public:
- explicit SvStreamObject( const ObjectBase& rParent, SvStream& rStrm );
- virtual ~SvStreamObject();
-
-protected:
- inline explicit SvStreamObject() {}
- void Construct( const ObjectBase& rParent, SvStream& rStrm );
-
- using StreamObjectBase::Construct;
-};
-
-typedef ScfRef< SvStreamObject > SvStreamObjectRef;
-
-// ============================================================================
-
-class WrappedStreamObject : public StreamObjectBase
-{
-public:
- explicit WrappedStreamObject( const ObjectBase& rParent, StreamObjectRef xStrmObj );
- virtual ~WrappedStreamObject();
-
-protected:
- inline explicit WrappedStreamObject() {}
- void Construct( const ObjectBase& rParent, StreamObjectRef xStrmObj );
-
- virtual bool ImplIsValid() const;
-
- using StreamObjectBase::Construct;
-
-private:
- StreamObjectRef mxStrmObj;
-};
-
-// ============================================================================
-// ============================================================================
-
-struct RecordHeaderConfigInfo
-{
- const sal_Char* mpcRecNames;
- const sal_Char* mpcShowRecPos;
- const sal_Char* mpcShowRecSize;
- const sal_Char* mpcShowRecId;
- const sal_Char* mpcShowRecName;
- const sal_Char* mpcShowRecBody;
-};
-
-// ----------------------------------------------------------------------------
-
-class RecordHeaderBase : public InputObjectBase
-{
-public:
- virtual ~RecordHeaderBase();
-
- inline NameListRef GetRecNames() const { return mxRecNames; }
- inline bool IsShowRecPos() const { return mbShowRecPos; }
- inline bool IsShowRecSize() const { return mbShowRecSize; }
- inline bool IsShowRecId() const { return mbShowRecId; }
- inline bool IsShowRecName() const { return mbShowRecName; }
- inline bool IsShowRecBody() const { return mbShowRecBody; }
-
-protected:
- inline explicit RecordHeaderBase() {}
- void Construct( const InputObjectBase& rParent, const RecordHeaderConfigInfo& rCfgInfo );
-
- virtual bool ImplIsValid() const;
-
- using InputObjectBase::Construct;
-
-private:
- NameListRef mxRecNames;
- bool mbShowRecPos;
- bool mbShowRecSize;
- bool mbShowRecId;
- bool mbShowRecName;
- bool mbShowRecBody;
-};
-
-// ============================================================================
-// ============================================================================
-
-class DumperBase : public ObjectBase
-{
-public:
- virtual ~DumperBase();
-
- bool IsImportEnabled() const;
-
-protected:
- inline explicit DumperBase() {}
- void Construct( ConfigRef xConfig, CoreDataRef xCore );
- void Construct( ConfigRef xConfig, SfxMedium& rMedium, SfxObjectShell* pDocShell );
-
- using ObjectBase::Construct;
-
-private:
- typedef ScfRef< SvStream > SvStreamRef;
- SvStreamRef mxOutStrm;
-};
-
-// ============================================================================
-// ============================================================================
-
-} // namespace dump
-} // namespace scf
-
-#endif
-#endif
-
diff --git a/sc/source/filter/inc/fdumperole.hxx b/sc/source/filter/inc/fdumperole.hxx
deleted file mode 100644
index ad6d1b0dedd9..000000000000
--- a/sc/source/filter/inc/fdumperole.hxx
+++ /dev/null
@@ -1,186 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: fdumperole.hxx,v $
- * $Revision: 1.7 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SC_FDUMPEROLE_HXX
-#define SC_FDUMPEROLE_HXX
-
-#include <sot/storage.hxx>
-#include <sot/storinfo.hxx>
-#include "fdumper.hxx"
-
-#if SCF_INCL_DUMPER
-
-namespace scf {
-namespace dump {
-
-// ============================================================================
-// ============================================================================
-
-class OleStorageObject : public ObjectBase
-{
-public:
- explicit OleStorageObject( const OleStorageObject& rParentStrg, const String& rStrgName );
- explicit OleStorageObject( const ObjectBase& rParent, SotStorageRef xRootStrg );
- explicit OleStorageObject( const ObjectBase& rParent, SvStream& rRootStrm );
- explicit OleStorageObject( const ObjectBase& rParent );
- virtual ~OleStorageObject();
-
- inline SotStorageRef GetStorage() const { return mxStrg; }
- inline const String& GetStoragePath() const { return maPath; }
- inline const String& GetStorageName() const { return maName; }
- String GetFullName() const;
-
- void ExtractStorageToFileSystem();
-
-protected:
- inline explicit OleStorageObject() {}
- void Construct( const ObjectBase& rParent, SotStorageRef xStrg, const String& rPath );
- void Construct( const OleStorageObject& rParentStrg, const String& rStrgName );
- void Construct( const ObjectBase& rParent, SvStream& rRootStrm );
- void Construct( const ObjectBase& rParent );
-
- virtual bool ImplIsValid() const;
- virtual void ImplDumpHeader();
- virtual void ImplDumpFooter();
-
- using ObjectBase::Construct;
-
-private:
- void DumpStorageInfo( bool bExtended );
-
-private:
- SotStorageRef mxStrg;
- String maPath;
- String maName;
-};
-
-typedef ScfRef< OleStorageObject > OleStorageObjectRef;
-
-// ============================================================================
-
-class OleStorageIterator : public Base
-{
-public:
- explicit OleStorageIterator( const OleStorageObject& rStrg );
- explicit OleStorageIterator( SotStorageRef xStrg );
- ~OleStorageIterator();
-
- ULONG GetSize() const;
-
- OleStorageIterator& operator++();
- const SvStorageInfo* operator->() const;
-
-protected:
- void Construct( SotStorageRef xStrg );
-
-private:
- virtual bool ImplIsValid() const;
-
-private:
- typedef ScfRef< SvStorageInfoList > SvStorageInfoListRef;
- SvStorageInfoListRef mxInfoList;
- ULONG mnIndex;
-};
-
-// ============================================================================
-// ============================================================================
-
-class OleStreamObject : public StreamObjectBase
-{
-public:
- explicit OleStreamObject( const OleStorageObject& rParentStrg, const String& rStrmName );
- virtual ~OleStreamObject();
-
-protected:
- inline explicit OleStreamObject() {}
- void Construct( const OleStorageObject& rParentStrg, const String& rStrmName );
-
- virtual bool ImplIsValid() const;
-
- using StreamObjectBase::Construct;
-
-private:
- SotStorageStreamRef mxStrm;
-};
-
-typedef ScfRef< OleStreamObject > OleStreamObjectRef;
-
-// ============================================================================
-
-class OlePropertyStreamObject : public OleStreamObject
-{
-public:
- explicit OlePropertyStreamObject( const OleStorageObject& rParentStrg, const String& rStrmName );
-
-protected:
- inline explicit OlePropertyStreamObject() {}
- void Construct( const OleStorageObject& rParentStrg, const String& rStrmName );
-
- virtual void ImplDumpBody();
-
- using OleStreamObject::Construct;
-
-private:
- void DumpSection( const String& rGuid, sal_uInt32 nStartPos );
-
- void DumpProperty( sal_Int32 nPropId, sal_uInt32 nStartPos );
- void DumpCodePageProperty( sal_uInt32 nStartPos );
- void DumpDictionaryProperty( sal_uInt32 nStartPos );
-
- void DumpPropertyContents( sal_Int32 nPropId );
- void DumpPropertyValue( sal_Int32 nPropId, sal_Int32 nBaseType );
-
- sal_Int32 DumpPropertyType();
- void DumpBlob( const sal_Char* pcName );
- String DumpString8( const sal_Char* pcName );
- String DumpCharArray8( const sal_Char* pcName, sal_Int32 nCharCount );
- String DumpString16( const sal_Char* pcName );
- String DumpCharArray16( const sal_Char* pcName, sal_Int32 nCharCount );
- DateTime DumpFileTime( const sal_Char* pcName );
-
- bool StartElement( sal_uInt32 nStartPos );
- void WriteSectionHeader( const String& rGuid, sal_uInt32 nStartPos );
- void WritePropertyHeader( sal_Int32 nPropId, sal_uInt32 nStartPos );
-
-private:
- NameListRef mxPropIds;
- rtl_TextEncoding meTextEnc;
- bool mbIsUnicode;
-};
-
-// ============================================================================
-// ============================================================================
-
-} // namespace dump
-} // namespace scf
-
-#endif
-#endif
-
diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx
index 393775e721f7..5fd338a73bb5 100644
--- a/sc/source/filter/inc/ftools.hxx
+++ b/sc/source/filter/inc/ftools.hxx
@@ -38,6 +38,7 @@
#include <tools/string.hxx>
#include <tools/list.hxx>
#include <tools/debug.hxx>
+#include <oox/helper/helper.hxx>
#include "filter.hxx"
#include "scdllapi.h"
@@ -50,9 +51,6 @@
/** Expands to a temporary String, created from an ASCII character array. */
#define CREATE_STRING( ascii ) String( RTL_CONSTASCII_USTRINGPARAM( ascii ) )
-/** Expands to a temporary ::rtl::OUString, created from an ASCII character array. */
-#undef CREATE_OUSTRING
-#define CREATE_OUSTRING( ascii ) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ascii ) )
// items and item sets --------------------------------------------------------
diff --git a/sc/source/filter/inc/imp_op.hxx b/sc/source/filter/inc/imp_op.hxx
index f8dad9a45c48..fa0e6b7f5074 100644
--- a/sc/source/filter/inc/imp_op.hxx
+++ b/sc/source/filter/inc/imp_op.hxx
@@ -99,6 +99,8 @@ protected:
XclImpStream maStrm; // input stream
XclImpStream& aIn; // input stream
+ ScfUInt32Vec maSheetOffsets;
+
NameBuffer* pExtNameBuff; // ... externe Namen (Ind.-Basis=1)
ExcelToSc* pFormConv; // Formel-Konverter
@@ -119,6 +121,8 @@ protected:
// Abschneiden von Zellen fuehrt
// Record-Funktionen
+ void ReadFileSharing();
+
sal_uInt16 ReadXFIndex( bool bBiff2 );
void ReadDimensions();
diff --git a/sc/source/filter/inc/op.h b/sc/source/filter/inc/op.h
index fb79084f48fb..2bfbedde0aed 100644
--- a/sc/source/filter/inc/op.h
+++ b/sc/source/filter/inc/op.h
@@ -42,7 +42,7 @@ void OP_EOF( SvStream &aStream, USHORT nLaenge );
void OP_Integer( SvStream &aStream, USHORT nLaenge );
void OP_Number( SvStream &aStream, USHORT nLaenge );
void OP_Label( SvStream &aStream, USHORT nLaenge );
-void OP_Text( SvStream &aStream, USHORT nLaenge ); // WK3
+//UNUSED2009-05 void OP_Text( SvStream &aStream, USHORT nLaenge ); // WK3
void OP_Integer3( SvStream &aStream, USHORT nLaenge ); // WK3
void OP_Number3( SvStream &aStream, USHORT nLaenge ); // WK3
void OP_Formula( SvStream &aStream, USHORT nLaenge );
diff --git a/sc/source/filter/inc/qpro.hxx b/sc/source/filter/inc/qpro.hxx
index 0db26b9c280c..a9b1c61955c5 100644
--- a/sc/source/filter/inc/qpro.hxx
+++ b/sc/source/filter/inc/qpro.hxx
@@ -48,7 +48,6 @@ class ScQProReader : public ScBiffReader
{
public:
bool recordsLeft();
- bool IsEndOfFile();
void SetEof( bool bValue ){ mbEndOfFile = bValue; }
bool nextRecord();
sal_uInt16 getId() { return mnId; }
diff --git a/sc/source/filter/inc/root.hxx b/sc/source/filter/inc/root.hxx
index 3aa94ca542b1..ffff5dd9ff94 100644
--- a/sc/source/filter/inc/root.hxx
+++ b/sc/source/filter/inc/root.hxx
@@ -67,7 +67,6 @@ struct RootData // -> Inkarnation jeweils im ImportExcel-Objekt!
{
BiffTyp eDateiTyp; // feine Differenzierung
ExtSheetBuffer* pExtSheetBuff;
- NameBuffer* pTabNameBuff;
ShrfmlaBuffer* pShrfmlaBuff;
ExtNameBuff* pExtNameBuff;
ExcelToSc* pFmlaConverter;
diff --git a/sc/source/filter/inc/tokstack.hxx b/sc/source/filter/inc/tokstack.hxx
index 9627f2457a67..3a60b709d5bf 100644
--- a/sc/source/filter/inc/tokstack.hxx
+++ b/sc/source/filter/inc/tokstack.hxx
@@ -179,7 +179,7 @@ class TokenPool
void GrowString( void );
void GrowDouble( void );
- void GrowError( void );
+//UNUSED2009-05 void GrowError( void );
void GrowTripel( void );
void GrowId( void );
void GrowElement( void );
diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx
index 649a7bd02702..ef97a60a8a8e 100644
--- a/sc/source/filter/inc/xcl97rec.hxx
+++ b/sc/source/filter/inc/xcl97rec.hxx
@@ -412,7 +412,7 @@ private:
sal_Size nRecLen;
XclExpString sName;
XclExpString sComment;
- static XclExpString sUsername;
+ XclExpString sUserName;
UINT8 nProtected;
inline ExcEScenarioCell* _First() { return (ExcEScenarioCell*) List::First(); }
@@ -424,7 +424,7 @@ private:
protected:
public:
- ExcEScenario( ScDocument& rDoc, SCTAB nTab );
+ ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab );
virtual ~ExcEScenario();
virtual UINT16 GetNum() const;
@@ -450,7 +450,7 @@ private:
protected:
public:
- ExcEScenarioManager( ScDocument& rDoc, SCTAB nTab );
+ ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab );
virtual ~ExcEScenarioManager();
virtual void Save( XclExpStream& rStrm );
@@ -558,53 +558,14 @@ private:
// ============================================================================
-class XclExpFnGroupCount : public XclExpRecord
-{
-public:
- explicit XclExpFnGroupCount();
- virtual ~XclExpFnGroupCount();
-
-private:
- virtual void WriteBody( XclExpStream& rStrm );
-};
-
-// ============================================================================
-
/** Beginning of User Interface Records */
-class XclExpInterfaceHdr : public XclExpRecord
+class XclExpInterfaceHdr : public XclExpUInt16Record
{
public:
- explicit XclExpInterfaceHdr();
- virtual ~XclExpInterfaceHdr();
+ explicit XclExpInterfaceHdr( sal_uInt16 nCodePage );
private:
- virtual void WriteBody( XclExpStream& rStrm );
-};
-
-// ============================================================================
-
-/** Beginning of User Interface Records */
-class XclExpInterfaceEnd : public XclExpRecord
-{
-public:
- explicit XclExpInterfaceEnd();
- virtual ~XclExpInterfaceEnd();
-
-private:
- virtual void WriteBody( XclExpStream& rStrm );
-};
-
-// ============================================================================
-
-/** ADDMENU/DELMENU Record Group Count */
-class XclExpMMS : public XclExpRecord
-{
-public:
- explicit XclExpMMS();
- virtual ~XclExpMMS();
-
-private:
- virtual void WriteBody( XclExpStream& rStrm );
+ virtual void WriteBody( XclExpStream& rStrm );
};
// ============================================================================
@@ -623,26 +584,19 @@ private:
// ============================================================================
-class XclExpCodePage : public XclExpRecord
+class XclExpFileSharing : public XclExpRecord
{
public:
- explicit XclExpCodePage();
- virtual ~XclExpCodePage();
-
-private:
- virtual void WriteBody( XclExpStream& rStrm );
-};
+ explicit XclExpFileSharing( const XclExpRoot& rRoot, sal_uInt16 nPasswordHash );
-// ============================================================================
+ virtual void Save( XclExpStream& rStrm );
-class XclExpDSF : public XclExpRecord
-{
-public:
- explicit XclExpDSF();
- virtual ~XclExpDSF();
+private:
+ virtual void WriteBody( XclExpStream& rStrm );
private:
- virtual void WriteBody( XclExpStream& rStrm );
+ XclExpString maUserName;
+ sal_uInt16 mnPasswordHash;
};
// ============================================================================
@@ -671,19 +625,6 @@ private:
// ============================================================================
-/** What's this record for? It is a zero-byte record. */
-class XclExpExcel9File : public XclExpRecord
-{
-public:
- explicit XclExpExcel9File();
- virtual ~XclExpExcel9File();
-
-private:
- virtual void WriteBody( XclExpStream& rStrm );
-};
-
-// ============================================================================
-
class XclExpRecalcId : public XclExpDummyRecord
{
public:
diff --git a/sc/source/filter/inc/xelink.hxx b/sc/source/filter/inc/xelink.hxx
index 3a016759275e..1b49bf7bac02 100644
--- a/sc/source/filter/inc/xelink.hxx
+++ b/sc/source/filter/inc/xelink.hxx
@@ -84,8 +84,8 @@ public:
/** Returns the Calc sheet index of the nSortedTab-th entry in the sorted sheet names list. */
SCTAB GetRealScTab( SCTAB nSortedScTab ) const;
- /** Returns the index of the passed Calc sheet in the sorted sheet names list. */
- SCTAB GetSortedScTab( SCTAB nScTab ) const;
+//UNUSED2009-05 /** Returns the index of the passed Calc sheet in the sorted sheet names list. */
+//UNUSED2009-05 SCTAB GetSortedScTab( SCTAB nScTab ) const;
/** Returns the number of Calc sheets. */
inline SCTAB GetScTabCount() const { return mnScCnt; }
diff --git a/sc/source/filter/inc/xename.hxx b/sc/source/filter/inc/xename.hxx
index affe57264331..32c48e779cad 100644
--- a/sc/source/filter/inc/xename.hxx
+++ b/sc/source/filter/inc/xename.hxx
@@ -56,8 +56,8 @@ public:
/** Inserts the Calc database range with the passed index and returns the Excel NAME index. */
sal_uInt16 InsertDBRange( USHORT nScDBRangeIdx );
- /** Inserts a new built-in defined name. */
- sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, XclTokenArrayRef xTokArr, SCTAB nScTab );
+//UNUSED2009-05 /** Inserts a new built-in defined name. */
+//UNUSED2009-05 sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, XclTokenArrayRef xTokArr, SCTAB nScTab );
/** Inserts a new built-in defined name, referring to the passed sheet range. */
sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, const ScRange& rRange );
/** Inserts a new built-in defined name, referring to the passed sheet range list. */
diff --git a/sc/source/filter/inc/xepivot.hxx b/sc/source/filter/inc/xepivot.hxx
index 80356d41f4a8..28df1586cdcb 100644
--- a/sc/source/filter/inc/xepivot.hxx
+++ b/sc/source/filter/inc/xepivot.hxx
@@ -198,8 +198,8 @@ public:
sal_uInt16 GetFieldCount() const;
/** Returns the specified pivot cache field. */
const XclExpPCField* GetField( sal_uInt16 nFieldIdx ) const;
- /** Returns a pivot cache field by its name. */
- const XclExpPCField* GetField( const String& rFieldName ) const;
+//UNUSED2009-05 /** Returns a pivot cache field by its name. */
+//UNUSED2009-05 const XclExpPCField* GetField( const String& rFieldName ) const;
/** Returns true, if this pivot cache contains non-standard fields (e.g. grouping fields). */
bool HasAddFields() const;
@@ -301,8 +301,8 @@ public:
/** Returns the index of the last inserted data info struct. */
sal_uInt16 GetLastDataInfoIndex() const;
- /** Returns an item by its name. */
- const XclExpPTItem* GetItem( const String& rName ) const;
+//UNUSED2009-05 /** Returns an item by its name. */
+//UNUSED2009-05 const XclExpPTItem* GetItem( const String& rName ) const;
/** Returns the list index of an item by its name.
@param nDefaultIdx This value will be returned, if the item could not be found. */
sal_uInt16 GetItemIndex( const String& rName, sal_uInt16 nDefaultIdx ) const;
diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx
index 676b0d550875..857d756e2133 100644
--- a/sc/source/filter/inc/xestream.hxx
+++ b/sc/source/filter/inc/xestream.hxx
@@ -211,9 +211,6 @@ private:
bool mbInRec; /// true = currently writing inside of a record.
};
-// ----------------------------------------------------------------------------
-
-
// ============================================================================
class XclExpBiff8Encrypter
@@ -336,7 +333,6 @@ public:
// only needed for import; ignore
virtual bool importDocument() throw();
- virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const;
virtual oox::vml::Drawing* getVmlDrawing();
virtual const oox::drawingml::Theme* getCurrentTheme() const;
virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx
index 5322b0c47f01..6680aa1719ca 100644
--- a/sc/source/filter/inc/xetable.hxx
+++ b/sc/source/filter/inc/xetable.hxx
@@ -409,23 +409,23 @@ private:
// ----------------------------------------------------------------------------
-/** Represents a BOOLERR record that describes a cell with an error code. */
-class XclExpErrorCell : public XclExpSingleCellBase
-{
- DECL_FIXEDMEMPOOL_NEWDEL( XclExpErrorCell )
-
-public:
- explicit XclExpErrorCell( const XclExpRoot rRoot, const XclAddress& rXclPos,
- const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
- sal_uInt8 nErrCode );
-
- virtual void SaveXml( XclExpXmlStream& rStrm );
-private:
- virtual void WriteContents( XclExpStream& rStrm );
-
-private:
- sal_uInt8 mnErrCode; /// The error code.
-};
+//UNUSED2009-05 /** Represents a BOOLERR record that describes a cell with an error code. */
+//UNUSED2009-05 class XclExpErrorCell : public XclExpSingleCellBase
+//UNUSED2009-05 {
+//UNUSED2009-05 DECL_FIXEDMEMPOOL_NEWDEL( XclExpErrorCell )
+//UNUSED2009-05
+//UNUSED2009-05 public:
+//UNUSED2009-05 explicit XclExpErrorCell( const XclExpRoot rRoot, const XclAddress& rXclPos,
+//UNUSED2009-05 const ScPatternAttr* pPattern, sal_uInt32 nForcedXFId,
+//UNUSED2009-05 sal_uInt8 nErrCode );
+//UNUSED2009-05
+//UNUSED2009-05 virtual void SaveXml( XclExpXmlStream& rStrm );
+//UNUSED2009-05 private:
+//UNUSED2009-05 virtual void WriteContents( XclExpStream& rStrm );
+//UNUSED2009-05
+//UNUSED2009-05 private:
+//UNUSED2009-05 sal_uInt8 mnErrCode; /// The error code.
+//UNUSED2009-05 };
// ----------------------------------------------------------------------------
diff --git a/sc/source/filter/inc/xiescher.hxx b/sc/source/filter/inc/xiescher.hxx
index 5fd785992ae4..c9d2daa6bb2f 100644
--- a/sc/source/filter/inc/xiescher.hxx
+++ b/sc/source/filter/inc/xiescher.hxx
@@ -917,8 +917,8 @@ private:
class XclImpSolverContainer : public SvxMSDffSolverContainer
{
public:
- /** Reads the entire solver container. Stream must point to begin of container header. */
- void ReadSolverContainer( SvStream& rDffStrm );
+//UNUSED2009-05 /** Reads the entire solver container. Stream must point to begin of container header. */
+//UNUSED2009-05 void ReadSolverContainer( SvStream& rDffStrm );
/** Inserts information about a new SdrObject. */
void InsertSdrObjectInfo( SdrObject& rSdrObj, sal_uInt32 nDffShapeId, sal_uInt32 nDffFlags );
diff --git a/sc/source/filter/inc/xihelper.hxx b/sc/source/filter/inc/xihelper.hxx
index 5e60feeb49bb..a46d473f02a9 100644
--- a/sc/source/filter/inc/xihelper.hxx
+++ b/sc/source/filter/inc/xihelper.hxx
@@ -89,24 +89,24 @@ public:
bool ConvertRange( ScRange& rScRange, const XclRange& rXclRange,
SCTAB nScTab1, SCTAB nScTab2, bool bWarn );
- /** Returns a valid cell range by moving it into allowed dimensions.
- @descr The start and/or end position of the range may be modified.
- @param rXclRange The Excel cell range to convert.
- @param bWarn true = Sets the internal flag that produces a warning box
- after loading/saving the file, if the cell range contains invalid cells.
- @return The converted Calc cell range. */
- ScRange CreateValidRange( const XclRange& rXclRange,
- SCTAB nScTab1, SCTAB nScTab2, bool bWarn );
+//UNUSED2009-05 /** Returns a valid cell range by moving it into allowed dimensions.
+//UNUSED2009-05 @descr The start and/or end position of the range may be modified.
+//UNUSED2009-05 @param rXclRange The Excel cell range to convert.
+//UNUSED2009-05 @param bWarn true = Sets the internal flag that produces a warning box
+//UNUSED2009-05 after loading/saving the file, if the cell range contains invalid cells.
+//UNUSED2009-05 @return The converted Calc cell range. */
+//UNUSED2009-05 ScRange CreateValidRange( const XclRange& rXclRange,
+//UNUSED2009-05 SCTAB nScTab1, SCTAB nScTab2, bool bWarn );
// cell range list --------------------------------------------------------
- /** Checks if the passed cell range list is valid.
- @param rXclRanges The Excel cell range list to check.
- @param bWarn true = Sets the internal flag that produces a warning box
- after loading/saving the file, if the cell range list contains at
- least one invalid range.
- @return true = Cell range list in rScRanges is completly valid. */
- bool CheckRangeList( const XclRangeList& rXclRanges, bool bWarn );
+//UNUSED2009-05 /** Checks if the passed cell range list is valid.
+//UNUSED2009-05 @param rXclRanges The Excel cell range list to check.
+//UNUSED2009-05 @param bWarn true = Sets the internal flag that produces a warning box
+//UNUSED2009-05 after loading/saving the file, if the cell range list contains at
+//UNUSED2009-05 least one invalid range.
+//UNUSED2009-05 @return true = Cell range list in rScRanges is completly valid. */
+//UNUSED2009-05 bool CheckRangeList( const XclRangeList& rXclRanges, bool bWarn );
/** Converts the passed Excel cell range list to a Calc cell range list.
@descr The start position of the ranges will not be modified. Cell
@@ -139,11 +139,11 @@ public:
const XclImpRoot& rRoot,
const XclImpString& rString );
- /** Returns a new edit engine text object for a cell note.
- @param nXFIndex Index to XF for first text portion (for escapement). */
- static EditTextObject* CreateNoteObject(
- const XclImpRoot& rRoot,
- const XclImpString& rString );
+//UNUSED2009-05 /** Returns a new edit engine text object for a cell note.
+//UNUSED2009-05 @param nXFIndex Index to XF for first text portion (for escapement). */
+//UNUSED2009-05 static EditTextObject* CreateNoteObject(
+//UNUSED2009-05 const XclImpRoot& rRoot,
+//UNUSED2009-05 const XclImpString& rString );
/** Creates a new text cell or edit cell for a Calc document.
@param nXFIndex Index to XF for first text portion (for escapement). */
diff --git a/sc/source/filter/inc/xiroot.hxx b/sc/source/filter/inc/xiroot.hxx
index 915f9610a1f3..f331683988ab 100644
--- a/sc/source/filter/inc/xiroot.hxx
+++ b/sc/source/filter/inc/xiroot.hxx
@@ -117,9 +117,6 @@ struct XclImpRootData : public XclRootData
XclImpTabProtectRef mxTabProtect; /// Sheet protection options for current sheet.
XclImpDocProtectRef mxDocProtect; /// Document protection options.
- String maPassw; /// Entered password for stream decryption.
- bool mbPassQueried; /// true = Password already querried.
-
bool mbHasCodePage; /// true = CODEPAGE record exists.
explicit XclImpRootData( XclBiff eBiff, SfxMedium& rMedium,
@@ -205,9 +202,6 @@ public:
/** Returns the Calc add-in function name for an Excel function name. */
String GetScAddInName( const String& rXclName ) const;
- /** Queries a password from the user and returns it (empty string -> input cancelled). */
- const String& QueryPassword() const;
-
private:
mutable XclImpRootData& mrImpData; /// Reference to the global import data struct.
};
diff --git a/sc/source/filter/inc/xistream.hxx b/sc/source/filter/inc/xistream.hxx
index ccaaccdc0357..bbc1cc04fde5 100644
--- a/sc/source/filter/inc/xistream.hxx
+++ b/sc/source/filter/inc/xistream.hxx
@@ -31,6 +31,7 @@
#ifndef SC_XISTREAM_HXX
#define SC_XISTREAM_HXX
+#include <comphelper/docpasswordhelper.hxx>
#include <svx/mscodec.hxx>
#include "xlstream.hxx"
#include "xlconst.hxx"
@@ -52,7 +53,7 @@ class XclImpDecrypter;
typedef ScfRef< XclImpDecrypter > XclImpDecrypterRef;
/** Base class for BIFF stream decryption. */
-class XclImpDecrypter
+class XclImpDecrypter : public ::comphelper::IDocPasswordVerifier
{
public:
explicit XclImpDecrypter();
@@ -60,40 +61,39 @@ public:
/** Returns the current error code of the decrypter. */
inline ErrCode GetError() const { return mnError; }
- /** Returns true, if the decrypter has been constructed successfully.
- This means especially that construction happened with a valid password. */
+ /** Returns true, if the decoder has been initialized correctly. */
inline bool IsValid() const { return mnError == ERRCODE_NONE; }
/** Creates a (ref-counted) copy of this decrypter object. */
XclImpDecrypterRef Clone() const;
+ /** Implementation of the ::comphelper::IDocPasswordVerifier interface,
+ calls the new virtual function implVerify(). */
+ virtual ::comphelper::DocPasswordVerifierResult
+ verifyPassword( const ::rtl::OUString& rPassword );
+
/** Updates the decrypter on start of a new record or after seeking stream. */
void Update( SvStream& rStrm, sal_uInt16 nRecSize );
/** Reads and decrypts nBytes bytes and stores data into the existing(!) buffer pData.
@return Count of bytes really read. */
sal_uInt16 Read( SvStream& rStrm, void* pData, sal_uInt16 nBytes );
- const String GetPassword() const;
-
protected:
/** Protected copy c'tor for OnClone(). */
explicit XclImpDecrypter( const XclImpDecrypter& rSrc );
- /** Sets the decrypter to a state showing whether the password was correct. */
- void SetHasValidPassword( bool bValid );
-
- void SetPassword( const String& rPass );
-
private:
/** Implementation of cloning this object. */
virtual XclImpDecrypter* OnClone() const = 0;
+ /** Derived classes implement password verification and initialization of
+ the decoder. */
+ virtual bool OnVerify( const ::rtl::OUString& rPassword ) = 0;
/** Implementation of updating the decrypter. */
virtual void OnUpdate( sal_Size nOldStrmPos, sal_Size nNewStrmPos, sal_uInt16 nRecSize ) = 0;
/** Implementation of the decryption. */
virtual sal_uInt16 OnRead( SvStream& rStrm, sal_uInt8* pnData, sal_uInt16 nBytes ) = 0;
private:
- String maPass; /// Stored password (needed for export)
ErrCode mnError; /// Decrypter error code.
sal_Size mnOldPos; /// Last known stream position.
sal_uInt16 mnRecSize; /// Current record size.
@@ -105,12 +105,7 @@ private:
class XclImpBiff5Decrypter : public XclImpDecrypter
{
public:
- /** Constructs the decrypter.
- @descr Checks if the passed key and hash specify workbook protection.
- Asks for a password otherwise.
- @param nKey Password key from FILEPASS record to verify password.
- @param nHash Password hash value from FILEPASS record to verify password. */
- explicit XclImpBiff5Decrypter( const XclImpRoot& rRoot, sal_uInt16 nKey, sal_uInt16 nHash );
+ explicit XclImpBiff5Decrypter( sal_uInt16 nKey, sal_uInt16 nHash );
private:
/** Private copy c'tor for OnClone(). */
@@ -118,18 +113,18 @@ private:
/** Implementation of cloning this object. */
virtual XclImpBiff5Decrypter* OnClone() const;
+ /** Implements password verification and initialization of the decoder. */
+ virtual bool OnVerify( const ::rtl::OUString& rPassword );
/** Implementation of updating the decrypter. */
virtual void OnUpdate( sal_Size nOldStrmPos, sal_Size nNewStrmPos, sal_uInt16 nRecSize );
/** Implementation of the decryption. */
virtual sal_uInt16 OnRead( SvStream& rStrm, sal_uInt8* pnData, sal_uInt16 nBytes );
- /** Initializes the members.
- @postcond Internal status is set and can be querried with IsValid(). */
- void Init( const ByteString& rPass, sal_uInt16 nKey, sal_uInt16 nHash );
-
private:
::svx::MSCodec_XorXLS95 maCodec; /// Crypto algorithm implementation.
- sal_uInt8 mpnPassw[ 16 ]; /// Cached password data for copy construction.
+ ::std::vector< sal_uInt8 > maPassword;
+ sal_uInt16 mnKey;
+ sal_uInt16 mnHash;
};
// ----------------------------------------------------------------------------
@@ -138,14 +133,8 @@ private:
class XclImpBiff8Decrypter : public XclImpDecrypter
{
public:
- /** Constructs the decrypter.
- @descr Checks if the passed salt data specifies workbook protection.
- Asks for a password otherwise.
- @param pnDocId Unique document identifier from FILEPASS record.
- @param pnSaltData Salt data from FILEPASS record.
- @param pnSaltHash Salt hash value from FILEPASS record. */
- explicit XclImpBiff8Decrypter( const XclImpRoot& rRoot, sal_uInt8 pnDocId[ 16 ],
- sal_uInt8 pnSaltData[ 16 ], sal_uInt8 pnSaltHash[ 16 ] );
+ explicit XclImpBiff8Decrypter( sal_uInt8 pnSalt[ 16 ],
+ sal_uInt8 pnVerifier[ 16 ], sal_uInt8 pnVerifierHash[ 16 ] );
private:
/** Private copy c'tor for OnClone(). */
@@ -153,16 +142,13 @@ private:
/** Implementation of cloning this object. */
virtual XclImpBiff8Decrypter* OnClone() const;
+ /** Implements password verification and initialization of the decoder. */
+ virtual bool OnVerify( const ::rtl::OUString& rPassword );
/** Implementation of updating the decrypter. */
virtual void OnUpdate( sal_Size nOldStrmPos, sal_Size nNewStrmPos, sal_uInt16 nRecSize );
/** Implementation of the decryption. */
virtual sal_uInt16 OnRead( SvStream& rStrm, sal_uInt8* pnData, sal_uInt16 nBytes );
- /** Initializes the internal codec.
- @postcond Internal status is set and can be querried with IsValid(). */
- void Init( const String& rPass, sal_uInt8 pnDocId[ 16 ],
- sal_uInt8 pnSaltData[ 16 ], sal_uInt8 pnSaltHash[ 16 ] );
-
/** Returns the block number corresponding to the passed stream position. */
sal_uInt32 GetBlock( sal_Size nStrmPos ) const;
/** Returns the block offset corresponding to the passed stream position. */
@@ -170,8 +156,10 @@ private:
private:
::svx::MSCodec_Std97 maCodec; /// Crypto algorithm implementation.
- sal_uInt16 mpnPassw[ 16 ]; /// Cached password data for copy construction.
- sal_uInt8 mpnDocId[ 16 ]; /// Cached document ID for copy construction.
+ ::std::vector< sal_uInt16 > maPassword;
+ ::std::vector< sal_uInt8 > maSalt;
+ ::std::vector< sal_uInt8 > maVerifier;
+ ::std::vector< sal_uInt8 > maVerifierHash;
};
// ============================================================================
@@ -281,6 +269,10 @@ public:
CONTINUE usage is switched on.
@return false = no record found (end of stream). */
bool StartNextRecord();
+ /** Sets stream pointer to the start of the record content for the record
+ at the passed absolute stream position.
+ @return false = no record found (end of stream). */
+ bool StartNextRecord( sal_Size nNextRecPos );
/** Sets stream pointer to begin of record content.
@param bContLookup Automatic CONTINUE lookup on/off. In difference
to other stream settings, this setting is persistent until next call of
diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx
index fe43aa75c331..a67458366057 100644
--- a/sc/source/filter/inc/xistyle.hxx
+++ b/sc/source/filter/inc/xistyle.hxx
@@ -397,21 +397,14 @@ public:
/** Reads an XF record. */
void ReadXF( XclImpStream& rStrm );
- /** Sets the style name of this XF, if it is a style XF.
- @descr Additionally creates this user-defined style in the Calc document. */
- void SetStyleName( const String& rStyleName );
- /** Sets the style name of this XF from a built-in Excel style, if it is a style XF.
- @descr Does not create the style in the Calc document. This is done on demand
- in CreatePattern(), if the style is really used. */
- void SetBuiltInStyleName( sal_uInt8 nStyleId, sal_uInt8 nLevel );
-
- inline const String& GetStyleName() const { return maStyleName; }
inline sal_uInt8 GetHorAlign() const { return maAlignment.mnHorAlign; }
inline sal_uInt8 GetVerAlign() const { return maAlignment.mnVerAlign; }
inline sal_uInt16 GetFontIndex() const { return mnXclFont; }
- /** Creates the Calc style sheet, if this is a user-defined style. */
- void CreateUserStyle();
+ /** Creates a Calc item set containing an item set with all cell properties.
+ @param bSkipPoolDefs true = Do not put items equal to pool default; false = Put all items.
+ @return A read-only reference to the item set stored internally. */
+ const ScPatternAttr& CreatePattern( bool bSkipPoolDefs = false );
/** Inserts all formatting attributes to the specified area in the Calc document.
@param nForcedNumFmt If not set to NUMBERFORMAT_ENTRY_NOT_FOUND, it will overwrite
@@ -436,20 +429,10 @@ private:
/** Sets own "attribute used" flags, if attributes are different from passed parent XF. */
void UpdateUsedFlags( const XclImpXF& rParentXF );
- /** Creates a Calc item set containing an item set with all cell properties.
- @param bSkipPoolDefs true = Do not put items equal to pool default; false = Put all items.
- @return A read-only reference to the item set stored internally. */
- const ScPatternAttr& CreatePattern( bool bSkipPoolDefs = false );
- /** Creates a cell style sheet and inserts it into the Calc document.
- @descr Creates a style sheet only for style XFs with a valid style name.
- @return The pointer to the cell style sheet, or 0, if there is no style sheet. */
- ScStyleSheet* CreateStyleSheet();
-
private:
typedef ::std::auto_ptr< ScPatternAttr > ScPatternAttrPtr;
ScPatternAttrPtr mpPattern; /// Calc item set.
- String maStyleName; /// Name of the style sheet.
ScStyleSheet* mpStyleSheet; /// Calc cell style sheet.
XclImpCellProt maProtection; /// Cell protection flags.
@@ -458,9 +441,42 @@ private:
XclImpCellArea maArea; /// Background area style.
sal_uInt16 mnXclNumFmt; /// Index to number format.
sal_uInt16 mnXclFont; /// Index to font record.
+};
+
+// ----------------------------------------------------------------------------
- bool mbWasBuiltIn; /// true = XF was an Excel built-in style.
- bool mbForceCreate; /// true = Force creation of style sheet.
+/** Contains all data of a cell style associated with an XF record. */
+class XclImpStyle : protected XclImpRoot
+{
+public:
+ explicit XclImpStyle( const XclImpRoot& rRoot );
+
+ /** Reads a STYLE record. */
+ void ReadStyle( XclImpStream& rStrm );
+
+ inline const String& GetName() const { return maName; }
+ inline sal_uInt16 GetXfId() const { return mnXfId; }
+ inline bool IsBuiltin() const { return mbBuiltin && (mnBuiltinId != EXC_STYLE_USERDEF); }
+ inline sal_uInt8 GetBuiltinId() const { return mnBuiltinId; }
+ inline sal_uInt8 GetLevel() const { return mnLevel; }
+
+ /** Creates a cell style sheet and inserts it into the Calc document.
+ @return The pointer to the cell style sheet, or 0, if there is no style sheet. */
+ ScStyleSheet* CreateStyleSheet();
+ /** Creates the Calc style sheet, if this is a user-defined style. */
+ void CreateUserStyle( const String& rFinalName );
+
+private:
+ String maName; /// Cell style name.
+ sal_uInt16 mnXfId; /// Formatting for this cell style.
+ sal_uInt8 mnBuiltinId; /// Identifier for builtin styles.
+ sal_uInt8 mnLevel; /// Level for builtin column/row styles.
+ bool mbBuiltin; /// True = builtin style.
+ bool mbCustom; /// True = customized builtin style.
+ bool mbHidden; /// True = style not visible in GUI.
+
+ String maFinalName; /// Final name used in the Calc document.
+ ScStyleSheet* mpStyleSheet; /// Calc cell style sheet.
};
// ----------------------------------------------------------------------------
@@ -491,6 +507,9 @@ public:
/** Creates all user defined style sheets. */
void CreateUserStyles();
+ /** Creates a cell style sheet of the passed XF and inserts it into the Calc document.
+ @return The pointer to the cell style sheet, or 0, if there is no style sheet. */
+ ScStyleSheet* CreateStyleSheet( sal_uInt16 nXFIndex );
/** Inserts formatting attributes from an XF to the specified area in the Calc document.
@param nForcedNumFmt If not set to NUMBERFORMAT_ENTRY_NOT_FOUND, it will overwrite
@@ -501,7 +520,13 @@ public:
SCTAB nScTab, const XclImpXFIndex& rXFIndex );
private:
+ typedef ScfDelList< XclImpStyle > XclImpStyleList;
+ typedef ::std::map< sal_uInt16, XclImpStyle* > XclImpStyleMap;
+
ScfDelList< XclImpXF > maXFList; /// List of contents of all XF record.
+ XclImpStyleList maBuiltinStyles; /// List of built-in cell styles.
+ XclImpStyleList maUserStyles; /// List of user defined cell styles.
+ XclImpStyleMap maStylesByXf; /// Maps XF records to cell styles.
};
// Buffer for XF indexes in cells =============================================
diff --git a/sc/source/filter/inc/xlconst.hxx b/sc/source/filter/inc/xlconst.hxx
index eebaa76e4702..eeb3fb3982b9 100644
--- a/sc/source/filter/inc/xlconst.hxx
+++ b/sc/source/filter/inc/xlconst.hxx
@@ -205,6 +205,10 @@ const sal_uInt16 EXC_WSBOOL_FITTOPAGE = 0x0100;
const sal_uInt16 EXC_WSBOOL_DEFAULTFLAGS = 0x04C1;
+// (0x0086) WRITEPROT ---------------------------------------------------------
+
+const sal_uInt16 EXC_ID_WRITEPROT = 0x0086;
+
// (0x008C) COUNTRY -----------------------------------------------------------
const sal_uInt16 EXC_ID_COUNTRY = 0x008C;
@@ -213,6 +217,10 @@ const sal_uInt16 EXC_ID_COUNTRY = 0x008C;
const sal_uInt16 EXC_ID_FILTERMODE = 0x009B;
+// (0x009C) FNGROUPCOUNT ------------------------------------------------------
+
+const sal_uInt16 EXC_ID_FNGROUPCOUNT = 0x009C;
+
// (0x009D) AUTOFILTERINFO ----------------------------------------------------
const sal_uInt16 EXC_ID_AUTOFILTERINFO = 0x009D;
@@ -221,15 +229,34 @@ const sal_uInt16 EXC_ID_AUTOFILTERINFO = 0x009D;
const sal_uInt16 EXC_ID_AUTOFILTER = 0x009E;
+// (0x00BF, 0x00C0, 0x00C1) TOOLBARHDR, TOOLBAREND, MMS -----------------------
+
+const sal_uInt16 EXC_ID_TOOLBARHDR = 0x00BF;
+const sal_uInt16 EXC_ID_TOOLBAREND = 0x00C0;
+const sal_uInt16 EXC_ID_MMS = 0x00C1;
+
+// (0x00E1, 0x00E2) INTERFACEHDR, INTERFACEEND --------------------------------
+
+const sal_uInt16 EXC_ID_INTERFACEHDR = 0x00E1;
+const sal_uInt16 EXC_ID_INTERFACEEND = 0x00E2;
+
// (0x0160) USESELFS ----------------------------------------------------------
const sal_uInt16 EXC_ID_USESELFS = 0x0160;
+// (0x0161) DSF ---------------------------------------------------------------
+
+const sal_uInt16 EXC_ID_DSF = 0x0161;
+
// (0x01AA,0x01AB) USERSVIEWBEGIN, USERSVIEWEND -------------------------------
const sal_uInt16 EXC_ID_USERSVIEWBEGIN = 0x01AA;
const sal_uInt16 EXC_ID_USERSVIEWEND = 0x01AB;
+// (0x01C0) XL9FILE --------------------------------------------------------
+
+const sal_uInt16 EXC_ID_XL9FILE = 0x01C0;
+
// (0x8xx) Future records -----------------------------------------------------
/** Enumerates different header types of future records. */
diff --git a/sc/source/filter/inc/xlcontent.hxx b/sc/source/filter/inc/xlcontent.hxx
index 32803987f5c4..6c86e0be68b7 100644
--- a/sc/source/filter/inc/xlcontent.hxx
+++ b/sc/source/filter/inc/xlcontent.hxx
@@ -35,6 +35,10 @@
// Constants ==================================================================
+// (0x005B) FILESHARING -------------------------------------------------------
+
+const sal_uInt16 EXC_ID_FILESHARING = 0x005B;
+
// (0x00E5) MERGEDCELLS -------------------------------------------------------
const sal_uInt16 EXC_ID_MERGEDCELLS = 0x00E5;
diff --git a/sc/source/filter/inc/xldumper.hxx b/sc/source/filter/inc/xldumper.hxx
deleted file mode 100644
index b35482955f71..000000000000
--- a/sc/source/filter/inc/xldumper.hxx
+++ /dev/null
@@ -1,683 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: xldumper.hxx,v $
- * $Revision: 1.12 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef SC_XLDUMPER_HXX
-#define SC_XLDUMPER_HXX
-
-#include "fdumper.hxx"
-
-#include <stack>
-#include "fdumperdff.hxx"
-#include "fdumperole.hxx"
-#include "xlconst.hxx"
-#include "xlstring.hxx"
-#include "xlstyle.hxx"
-
-#if SCF_INCL_DUMPER
-
-class SfxMedium;
-class SfxObjectShell;
-class ScDocument;
-struct XclImpRootData;
-class XclImpRoot;
-class XclImpStream;
-class XclFunctionProvider;
-
-namespace scf {
-namespace dump {
-namespace xls {
-
-// ============================================================================
-// ============================================================================
-
-struct Address
-{
- sal_Int32 mnCol;
- sal_Int32 mnRow;
- inline explicit Address() : mnCol( 0 ), mnRow( 0 ) {}
- void Read( XclImpStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false );
-};
-
-// ----------------------------------------------------------------------------
-
-struct Range
-{
- Address maFirst;
- Address maLast;
- inline explicit Range() {}
- void Read( XclImpStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false );
-};
-
-// ----------------------------------------------------------------------------
-
-struct RangeList : public ::std::vector< Range >
-{
- inline explicit RangeList() {}
- void Read( XclImpStream& rStrm, bool bCol16Bit = true, bool bRow32Bit = false );
-};
-
-// ============================================================================
-
-struct FormulaAddress : public Address
-{
- bool mbRelCol;
- bool mbRelRow;
- inline explicit FormulaAddress() : mbRelCol( false ), mbRelRow( false ) {}
-};
-
-// ----------------------------------------------------------------------------
-
-struct FormulaRange
-{
- FormulaAddress maFirst;
- FormulaAddress maLast;
- inline explicit FormulaRange() {}
-};
-
-// ============================================================================
-
-class StringHelper : public ::scf::dump::StringHelper
-{
-public:
- static void AppendAddrCol( String& rStr, sal_Int32 nCol, bool bRel );
- static void AppendAddrRow( String& rStr, sal_Int32 nRow, bool bRel );
- static void AppendAddrName( String& rStr, sal_Unicode cPrefix, sal_Int32 nColRow, bool bRel );
-
- static void AppendAddress( String& rStr, const Address& rPos );
- static void AppendRange( String& rStr, const Range& rRange );
- static void AppendRangeList( String& rStr, const RangeList& rRanges );
-
- static void AppendAddress( String& rStr, const FormulaAddress& rPos, bool bNameMode );
- static void AppendRange( String& rStr, const FormulaRange& rRange, bool bNameMode );
-};
-
-// ============================================================================
-// ============================================================================
-
-class RecordHeaderObject : public RecordHeaderBase
-{
-public:
- explicit RecordHeaderObject( const InputObjectBase& rParent );
-
- inline bool IsMergeContRec() const { return mbMergeContRec; }
- inline bool HasRecName( sal_uInt16 nRecId ) const { return GetRecNames()->HasName( nRecId ); }
-
- void DumpRecordHeader( XclImpStream& rStrm );
-
-protected:
- virtual bool ImplIsValid() const;
-
-private:
- bool mbMergeContRec;
-};
-
-typedef ScfRef< RecordHeaderObject > RecHeaderObjectRef;
-
-// ============================================================================
-// ============================================================================
-
-class BiffConfig : public Config
-{
-public:
- explicit BiffConfig( const Config& rParent, XclBiff eBiff );
-
-protected:
- virtual bool ImplIsValid() const;
- virtual NameListRef ImplGetNameList( const String& rKey ) const;
-
-private:
- XclBiff meBiff;
-};
-
-typedef ScfRef< BiffConfig > BiffConfigRef;
-
-// ============================================================================
-
-class RootData : public Base
-{
-public:
- explicit RootData( SfxMedium& rMedium, XclBiff eBiff );
- virtual ~RootData();
-
- inline const XclImpRoot& GetRoot() const { return *mxRoot; }
-
- rtl_TextEncoding GetTextEncoding() const;
- void SetTextEncoding( rtl_TextEncoding eTextEnc );
-
-protected:
- virtual bool ImplIsValid() const;
-
-private:
- typedef ScfRef< ScDocument > ScDocumentRef;
- typedef ScfRef< XclImpRootData > XclImpRootDataRef;
- typedef ScfRef< XclImpRoot > XclImpRootRef;
-
- ScDocumentRef mxDoc;
- XclImpRootDataRef mxRootData;
- XclImpRootRef mxRoot;
-};
-
-typedef ScfRef< RootData > RootDataRef;
-
-// ============================================================================
-
-class RootObjectBase : public WrappedStreamObject
-{
-public:
- virtual ~RootObjectBase();
-
- inline RootData& Root() const { return *mxRootData; }
- inline const XclImpRoot& GetXclRoot() const { return mxRootData->GetRoot(); }
- inline XclImpStream& GetXclStream() const { return *mxStrm; }
- inline XclBiff GetBiff() const { return meBiff; }
-
-protected:
- explicit RootObjectBase();
- void Construct( const ObjectBase& rParent, SvStream& rStrm, XclBiff eBiff );
- void Construct( const OleStorageObject& rParentStrg, const String& rStrmName, XclBiff eBiff );
- void Construct( const RootObjectBase& rParent );
-
- virtual bool ImplIsValid() const;
- virtual void ImplDumpExtendedHeader();
- virtual ConfigRef ImplReconstructConfig();
- virtual InputRef ImplReconstructInput();
-
- String GetErrorName( sal_uInt8 nErrCode ) const;
-
- // ------------------------------------------------------------------------
-
- double WriteRkItem( const sal_Char* pcName, sal_Int32 nRk );
- void WriteBooleanItem( const sal_Char* pcName, sal_uInt8 nBool );
- void WriteErrorCodeItem( const sal_Char* pcName, sal_uInt8 nErrCode );
-
- void WriteColIndexItem( const sal_Char* pcName, sal_Int32 nCol );
- void WriteColRangeItem( const sal_Char* pcName, sal_Int32 nCol1, sal_Int32 nCol2 );
- void WriteRowIndexItem( const sal_Char* pcName, sal_Int32 nRow );
- void WriteRowRangeItem( const sal_Char* pcName, sal_Int32 nRow1, sal_Int32 nRow2 );
-
- void WriteAddressItem( const sal_Char* pcName, const Address& rPos );
- void WriteRangeItem( const sal_Char* pcName, const Range& rRange );
- void WriteRangeListItem( const sal_Char* pcName, const RangeList& rRanges );
-
- template< typename Type >
- void WriteRectItem( const sal_Char* pcName,
- Type nLeft, Type nTop, Type nWidth, Type nHeight,
- const NameListWrapper& rListWrp = NO_LIST,
- FormatType eFmtType = FORMATTYPE_DEC );
-
- // ------------------------------------------------------------------------
-
- String DumpString( const sal_Char* pcName = 0, XclStrFlags nFlags = EXC_STR_DEFAULT );
- double DumpRk( const sal_Char* pcName = 0 );
- sal_uInt8 DumpBoolean( const sal_Char* pcName = 0 );
- sal_uInt8 DumpErrorCode( const sal_Char* pcName = 0 );
-
- Color DumpRgbColor( const sal_Char* pcName = 0 );
- rtl_TextEncoding DumpCodePage( const sal_Char* pcName = 0 );
- void DumpFormulaResult( const sal_Char* pcName = 0 );
-
- sal_Int32 DumpColIndex( const sal_Char* pcName = 0, bool bCol16Bit = true );
- sal_Int32 DumpColRange( const sal_Char* pcName = 0, bool bCol16Bit = true );
- sal_Int32 DumpRowIndex( const sal_Char* pcName = 0, bool bRow32Bit = false );
- sal_Int32 DumpRowRange( const sal_Char* pcName = 0, bool bRow32Bit = false );
-
- Address DumpAddress( const sal_Char* pcName = 0, bool bCol16Bit = true, bool bRow32Bit = false );
- Range DumpRange( const sal_Char* pcName = 0, bool bCol16Bit = true, bool bRow32Bit = false );
- void DumpRangeList( const sal_Char* pcName = 0, bool bCol16Bit = true, bool bRow32Bit = false );
-
- void DumpConstArrayHeader( sal_uInt32& rnCols, sal_uInt32& rnRows );
- String DumpConstValue();
-
- template< typename Type >
- void DumpRect( const sal_Char* pcName,
- const NameListWrapper& rListWrp = NO_LIST,
- FormatType eFmtType = FORMATTYPE_DEC );
-
- // ------------------------------------------------------------------------
-
- using WrappedStreamObject::Construct;
-
-private:
- void ConstructRootObjBase( XclBiff eBiff );
-
-private:
- typedef ScfRef< XclImpStream > XclImpStreamRef;
-
- RootDataRef mxRootData;
- BiffConfigRef mxBiffCfg;
- XclImpStreamRef mxStrm;
- XclBiff meBiff;
- NameListRef mxBoolean;
- NameListRef mxErrCodes;
- NameListRef mxConstType;
- NameListRef mxResultType;
-};
-
-// ----------------------------------------------------------------------------
-
-template< typename Type >
-void RootObjectBase::WriteRectItem( const sal_Char* pcName,
- Type nLeft, Type nTop, Type nWidth, Type nHeight,
- const NameListWrapper& rListWrp, FormatType eFmtType )
-{
- MultiItemsGuard aMultiGuard( Out() );
- WriteEmptyItem( pcName );
- WriteValueItem( "x-pos", nLeft, eFmtType, rListWrp );
- WriteValueItem( "y-pos", nTop, eFmtType, rListWrp );
- WriteValueItem( "x-size", nWidth, eFmtType, rListWrp );
- WriteValueItem( "y-size", nHeight, eFmtType, rListWrp );
-}
-
-template< typename Type >
-void RootObjectBase::DumpRect( const sal_Char* pcName,
- const NameListWrapper& rListWrp, FormatType eFmtType )
-{
- Type nLeft, nTop, nWidth, nHeight;
- *mxStrm >> nLeft >> nTop >> nWidth >> nHeight;
- WriteRectItem( pcName, nLeft, nTop, nWidth, nHeight, rListWrp, eFmtType );
-}
-
-// ============================================================================
-// ============================================================================
-
-class SimpleObjectBase : public RootObjectBase
-{
-public:
- virtual ~SimpleObjectBase();
-
-protected:
- inline explicit SimpleObjectBase() {}
- void Construct( const RootObjectBase& rParent );
-
- virtual void ImplDumpHeader();
- virtual void ImplDumpFooter();
-
- using RootObjectBase::Construct;
-};
-
-// ============================================================================
-// ============================================================================
-
-/** Stack to create a human readable formula string from a UPN token array. */
-class FormulaStack
-{
-public:
- explicit FormulaStack();
-
- inline const String& GetFormulaString() const { return GetString( maFmlaStack ); }
- inline const String& GetClassesString() const { return GetString( maClassStack ); }
-
- void PushOperand( const StringWrapper& rOp, const String& rTokClass );
- void PushOperand( const StringWrapper& rOp );
- void PushUnaryOp( const StringWrapper& rLOp, const StringWrapper& rROp );
- void PushBinaryOp( const StringWrapper& rOp );
- void PushFuncOp( const StringWrapper& rFunc, const String& rTokClass, sal_uInt8 nParamCount );
-
- inline void SetError() { mbError = true; }
- void ReplaceOnTop( const String& rOld, const String& rNew );
-
-private:
- typedef ::std::stack< String > StringStack;
-
- inline bool Check( bool bCond ) { return (mbError |= !bCond) == false; }
-
- const String& GetString( const StringStack& rStack ) const;
- void PushUnaryOp( StringStack& rStack, const String& rLOp, const String& rROp );
- void PushBinaryOp( StringStack& rStack, const String& rOp );
- void PushFuncOp( StringStack& rStack, const String& rOp, sal_uInt8 nParamCount );
-
-private:
- StringStack maFmlaStack;
- StringStack maClassStack;
- bool mbError;
-};
-
-// ============================================================================
-
-class FormulaObject : public SimpleObjectBase
-{
-public:
- explicit FormulaObject( const RootObjectBase& rParent );
- virtual ~FormulaObject();
-
- sal_uInt16 ReadFormulaSize();
- sal_uInt16 DumpFormulaSize( const sal_Char* pcName = 0 );
-
- void DumpCellFormula( const sal_Char* pcName, sal_uInt16 nSize );
- void DumpCellFormula( const sal_Char* pcName = 0 );
- void DumpNameFormula( const sal_Char* pcName, sal_uInt16 nSize );
- void DumpNameFormula( const sal_Char* pcName = 0 );
-
-protected:
- virtual void ImplDumpHeader();
- virtual void ImplDumpBody();
-
-private:
- void ConstructFmlaObj();
-
- void DumpFormula( const sal_Char* pcName, sal_uInt16 nSize, bool bNameMode );
- void DumpFormula( const sal_Char* pcName, bool bNameMode );
-
- FormulaAddress CreateTokenAddress( sal_uInt16 nCol, sal_uInt16 nRow, bool bRelC, bool bRelR, bool bNameMode ) const;
- String CreateFunc( sal_uInt16 nFuncIdx ) const;
- String CreateRef( const String& rData ) const;
- String CreateName( sal_uInt16 nNameIdx ) const;
- String CreatePlaceHolder( size_t nIdx ) const;
- String CreatePlaceHolder() const;
-
- void WriteTokenAddressItem( const sal_Char* pcName, const FormulaAddress& rPos, bool bNameMode );
- void WriteTokenAddress3dItem( const sal_Char* pcName, const String& rRef, const FormulaAddress& rPos, bool bNameMode );
- void WriteTokenRangeItem( const sal_Char* pcName, const FormulaRange& rRange, bool bNameMode );
- void WriteTokenRange3dItem( const sal_Char* pcName, const String& rRef, const FormulaRange& rRange, bool bNameMode );
-
- sal_uInt16 DumpTokenFuncIdx();
- sal_uInt16 DumpTokenCol( const sal_Char* pcName, bool& rbRelC, bool& rbRelR );
- sal_uInt16 DumpTokenRow( const sal_Char* pcName, bool& rbRelC, bool& rbRelR );
- FormulaAddress DumpTokenAddress( bool bNameMode );
- FormulaRange DumpTokenRange( bool bNameMode );
- String DumpTokenRefIdx();
- void DumpTokenRefTabIdxs();
-
- void DumpIntToken();
- void DumpDoubleToken();
- void DumpStringToken();
- void DumpBoolToken();
- void DumpErrorToken();
- void DumpMissArgToken();
-
- void DumpArrayToken( const String& rTokClass );
- void DumpNameToken( const String& rTokClass );
- void DumpNameXToken( const String& rTokClass );
- void DumpRefToken( const String& rTokClass, bool bNameMode );
- void DumpAreaToken( const String& rTokClass, bool bNameMode );
- void DumpRefErrToken( const String& rTokClass, bool bArea );
- void DumpRef3dToken( const String& rTokClass, bool bNameMode );
- void DumpArea3dToken( const String& rTokClass, bool bNameMode );
- void DumpRefErr3dToken( const String& rTokClass, bool bArea );
- void DumpMemFuncToken( const String& rTokClass );
- void DumpMemAreaToken( const String& rTokClass, bool bAddData );
-
- void DumpExpToken( const StringWrapper& rName );
- void DumpUnaryOpToken( const StringWrapper& rLOp, const StringWrapper& rROp );
- void DumpBinaryOpToken( const StringWrapper& rOp );
- void DumpFuncToken( const String& rTokClass );
- void DumpFuncVarToken( const String& rTokClass );
- void DumpCmdToken( const String& rTokClass );
-
- void DumpSheetToken();
- void DumpEndSheetToken();
- bool DumpAttrToken();
-
- bool DumpNlrToken();
- void DumpNlrErrToken();
- void DumpNlrColRowToken( const String& rTokClass, bool bAddData );
- void DumpNlrRangeToken( const String& rTokClass, bool bAddData );
- void DumpNlrRangeErrToken();
-
- void DumpAddTokenData();
- void DumpAddDataNlr( size_t nIdx );
- void DumpAddDataArray( size_t nIdx );
- void DumpAddDataMemArea( size_t nIdx );
-
-private:
- enum AddDataType { ADDDATA_NLR, ADDDATA_ARRAY, ADDDATA_MEMAREA };
-
- typedef ScfRef< FormulaStack > FormulaStackRef;
- typedef ScfRef< XclFunctionProvider > XclFuncProvRef;
- typedef ::std::vector< AddDataType > AddDataTypeVec;
-
- NameListRef mxTokens;
- NameListRef mxClasses;
- NameListRef mxFuncNames;
- NameListRef mxParamCnt;
- NameListRef mxRelFlags;
- NameListRef mxNlrTypes;
- NameListRef mxAttrTypes;
- NameListRef mxSpTypes;
-
- FormulaStackRef mxStack;
- XclFuncProvRef mxFuncProv;
- AddDataTypeVec maAddData;
- String maRefPrefix;
- const sal_Char* mpcName;
- sal_uInt16 mnSize;
- bool mbNameMode;
-};
-
-typedef ScfRef< FormulaObject > FormulaObjectRef;
-
-// ============================================================================
-// ============================================================================
-
-class RecordStreamObject : public RootObjectBase
-{
-public:
- explicit RecordStreamObject( const ObjectBase& rParent, SvStream& rStrm, XclBiff eBiff = EXC_BIFF_UNKNOWN );
- explicit RecordStreamObject( const OleStorageObject& rParentStrg, const String& rStrmName, XclBiff eBiff = EXC_BIFF_UNKNOWN );
- virtual ~RecordStreamObject();
-
-protected:
- inline explicit RecordStreamObject() {}
- void Construct( const ObjectBase& rParent, SvStream& rStrm, XclBiff eBiff );
- void Construct( const OleStorageObject& rParentStrg, const String& rStrmName, XclBiff eBiff );
-
- virtual bool ImplIsValid() const;
- virtual void ImplDumpBody();
-
- virtual void ImplPreProcessRecord();
- virtual void ImplDumpRecord();
- virtual void ImplPostProcessRecord();
-
- inline RecordHeaderObject& GetRecordHeader() const { return *mxHdrObj; }
- inline FormulaObject& GetFormulaDumper() const { return *mxFmlaObj; }
- inline DffDumpObject& GetDffDumper() const { return *mxDffObj; }
-
- void DumpRepeatedRecordId();
-
- using RootObjectBase::Construct;
-
-private:
- void ConstructRecStrmObj();
-
- void DumpRecordBody();
- void DumpSimpleRecord( const String& rRecData );
-
-private:
- String maProgressName;
- RecHeaderObjectRef mxHdrObj;
- FormulaObjectRef mxFmlaObj;
- DffDumpObjectRef mxDffObj;
- NameListRef mxSimpleRecs;
-};
-
-// ============================================================================
-
-class WorkbookStreamObject : public RecordStreamObject
-{
-public:
- explicit WorkbookStreamObject( const ObjectBase& rParent, SvStream& rStrm );
- explicit WorkbookStreamObject( const OleStorageObject& rParentStrg, const String& rStrmName );
- virtual ~WorkbookStreamObject();
-
-protected:
- virtual void ImplPreProcessRecord();
- virtual void ImplDumpRecord();
- virtual void ImplPostProcessRecord();
-
-private:
- void ConstructWbStrmObj();
-
- const XclFontData* GetFontData( sal_uInt16 nFontIdx ) const;
- sal_uInt16 GetXfData( sal_uInt16 nXfIdx ) const;
- rtl_TextEncoding GetFontEncoding( sal_uInt16 nXfIdx ) const;
- String CreateFontName( const XclFontData& rFontData ) const;
-
- template< typename Type >
- Type DumpPatternIdx( const sal_Char* pcName = 0 );
- template< typename Type >
- Type DumpColorIdx( const sal_Char* pcName = 0 );
-
- sal_uInt16 DumpFontIdx( const sal_Char* pcName = 0 );
- sal_uInt16 DumpFormatIdx( const sal_Char* pcName = 0 );
- sal_uInt16 DumpXfIdx( const sal_Char* pcName = 0, bool bBiff2Style = false );
-
- sal_uInt16 DumpCellHeader( bool bBiff2Style = false );
- void DumpBoolErr();
-
- void DumpFontRec();
- void DumpFormatRec();
- void DumpXfRec();
-
- void DumpObjRec();
- void DumpObjRec5();
- void DumpObjRec8();
-
-private:
- typedef ::std::vector< XclFontData > XclFontDataVec;
-
- NameListRef mxColors;
- NameListRef mxBorderStyles;
- NameListRef mxFillPatterns;
- NameListRef mxFontNames;
- NameListRef mxFormats;
- XclFontDataVec maFontDatas;
- ScfUInt16Vec maXfDatas;
- sal_uInt16 mnFormatIdx;
- sal_uInt16 mnPTRowFields;
- sal_uInt16 mnPTColFields;
- sal_uInt16 mnPTSxliIdx;
- bool mbHasCodePage;
-};
-
-// ----------------------------------------------------------------------------
-
-template< typename Type >
-Type WorkbookStreamObject::DumpPatternIdx( const sal_Char* pcName )
-{
- return DumpDec< Type >( pcName ? pcName : "fill-pattern", mxFillPatterns );
-}
-
-template< typename Type >
-Type WorkbookStreamObject::DumpColorIdx( const sal_Char* pcName )
-{
- return DumpDec< Type >( pcName ? pcName : "color-idx", mxColors );
-}
-
-// ============================================================================
-
-class PivotCacheStreamObject : public RecordStreamObject
-{
-public:
- explicit PivotCacheStreamObject( const ObjectBase& rParent, SvStream& rStrm );
- explicit PivotCacheStreamObject( const OleStorageObject& rParentStrg, const String& rStrmName );
- virtual ~PivotCacheStreamObject();
-
-protected:
- virtual void ImplDumpRecord();
-};
-
-// ============================================================================
-
-class VbaProjectStreamObject : public OleStreamObject
-{
-public:
- explicit VbaProjectStreamObject( const OleStorageObject& rParentStrg );
-
-protected:
- virtual void ImplDumpBody();
-};
-
-// ============================================================================
-// ============================================================================
-
-class PivotCacheStorageObject : public OleStorageObject
-{
-public:
- explicit PivotCacheStorageObject( const OleStorageObject& rParentStrg );
-
-protected:
- virtual void ImplDumpBody();
-};
-
-// ============================================================================
-
-class VbaProjectStorageObject : public OleStorageObject
-{
-public:
- explicit VbaProjectStorageObject( const OleStorageObject& rParentStrg );
-
-protected:
- virtual void ImplDumpBody();
-};
-
-// ============================================================================
-
-class VbaStorageObject : public OleStorageObject
-{
-public:
- explicit VbaStorageObject( const OleStorageObject& rParentStrg );
-
-protected:
- virtual void ImplDumpBody();
-};
-
-// ============================================================================
-
-class RootStorageObject : public OleStorageObject
-{
-public:
- explicit RootStorageObject( const ObjectBase& rParent );
-
-protected:
- virtual void ImplDumpBody();
-};
-
-// ============================================================================
-// ============================================================================
-
-class Dumper : public DumperBase
-{
-public:
- explicit Dumper( SfxMedium& rMedium, SfxObjectShell* pDocShell );
-
-protected:
- virtual void ImplDumpBody();
-};
-
-// ============================================================================
-// ============================================================================
-
-} // namespace xls
-} // namespace dump
-} // namespace scf
-
-#endif
-#endif
-
diff --git a/sc/source/filter/inc/xlformula.hxx b/sc/source/filter/inc/xlformula.hxx
index ef9274bc0338..aed77452b311 100644
--- a/sc/source/filter/inc/xlformula.hxx
+++ b/sc/source/filter/inc/xlformula.hxx
@@ -32,8 +32,8 @@
#define SC_XLFORMULA_HXX
#include <map>
+#include <formula/opcode.hxx>
#include "address.hxx"
-#include "formula/opcode.hxx"
#include "ftools.hxx"
// Constants ==================================================================
@@ -43,18 +43,11 @@ const size_t EXC_TOKARR_MAXLEN = 4096; /// Maximum size of a to
// Token class flags ----------------------------------------------------------
const sal_uInt8 EXC_TOKCLASS_MASK = 0x60;
-const sal_uInt8 EXC_TOKCLASS_INOP_FLAG = 0x80; /// Used in operators (internal flag).
-
const sal_uInt8 EXC_TOKCLASS_NONE = 0x00; /// 00-1F: Base tokens.
const sal_uInt8 EXC_TOKCLASS_REF = 0x20; /// 20-3F: Reference class tokens.
const sal_uInt8 EXC_TOKCLASS_VAL = 0x40; /// 40-5F: Value class tokens.
const sal_uInt8 EXC_TOKCLASS_ARR = 0x60; /// 60-7F: Array class tokens.
-const sal_uInt8 EXC_TOKCLASS_ANY_IN_REFOP = EXC_TOKCLASS_INOP_FLAG | EXC_TOKCLASS_NONE;
-const sal_uInt8 EXC_TOKCLASS_REF_IN_VALOP = EXC_TOKCLASS_INOP_FLAG | EXC_TOKCLASS_REF;
-const sal_uInt8 EXC_TOKCLASS_VAL_IN_VALOP = EXC_TOKCLASS_INOP_FLAG | EXC_TOKCLASS_VAL;
-const sal_uInt8 EXC_TOKCLASS_ARR_IN_VALOP = EXC_TOKCLASS_INOP_FLAG | EXC_TOKCLASS_ARR;
-
// Base tokens ----------------------------------------------------------------
const sal_uInt8 EXC_TOKID_MASK = 0x1F;
@@ -183,15 +176,120 @@ enum XclFormulaType
EXC_FMLATYPE_LISTVAL /// List (cell range) validation.
};
+// Function parameter info ====================================================
+
+/** Enumerates validity modes for a function parameter. */
+enum XclFuncParamValidity
+{
+ EXC_PARAM_NONE = 0, /// Default for an unspecified entry in a C-array.
+ EXC_PARAM_REGULAR, /// Parameter supported by Calc and Excel.
+ EXC_PARAM_CALCONLY, /// Parameter supported by Calc only.
+ EXC_PARAM_EXCELONLY /// Parameter supported by Excel only.
+};
+
+/** Enumerates different types of token class conversion in function parameters. */
+enum XclFuncParamConv
+{
+ EXC_PARAMCONV_ORG, /// Use original class of current token.
+ EXC_PARAMCONV_VAL, /// Convert tokens to VAL class.
+ EXC_PARAMCONV_ARR, /// Convert tokens to ARR class.
+ EXC_PARAMCONV_RPT, /// Repeat parent conversion in VALTYPE parameters.
+ EXC_PARAMCONV_RPX, /// Repeat parent conversion in REFTYPE parameters.
+ EXC_PARAMCONV_RPO /// Repeat parent conversion in operands of operators.
+};
+
+/** Structure that contains all needed information for a parameter in a
+ function.
+
+ The member meValid specifies which application supports the parameter. If
+ set to CALCONLY, import filters have to insert a default value for this
+ parameter, and export filters have to skip the parameter. If set to
+ EXCELONLY, import filters have to skip the parameter, and export filters
+ have to insert a default value for this parameter.
+
+ The member mbValType specifies whether the parameter requires tokens to be
+ of value type (VAL or ARR class).
+
+ If set to false, the parameter is called to be REFTYPE. Tokens with REF
+ default class can be inserted for the parameter (e.g. tAreaR tokens).
+
+ If set to true, the parameter is called to be VALTYPE. Tokens with REF
+ class need to be converted to VAL tokens first (e.g. tAreaR will be
+ converted to tAreaV), and further conversion is done according to this
+ new token class.
+
+ The member meConv specifies how to convert the current token class of the
+ token inserted for the parameter. If the token class is still REF this
+ means that the token has default REF class and the parameter is REFTYPE
+ (see member mbValType), the token will not be converted at all and remains
+ in REF class. Otherwise, token class conversion is depending on the actual
+ token class of the return value of the function containing this parameter.
+ The function may return REF class (tFuncR, tFuncVarR, tFuncCER), or it may
+ return VAL or ARR class (tFuncV, tFuncA, tFuncVarV, tFuncVarA, tFuncCEV,
+ tFuncCEA). Even if the function is able to return REF class, it may return
+ VAL or ARR class instead due to the VALTYPE data type of the parent
+ function parameter that calls the own function. Example: The INDIRECT
+ function returns REF class by default. But if called from a VALTYPE
+ function parameter, e.g. in the formula =ABS(INDIRECT("A1")), it returns
+ VAL or ARR class instead. Additionally, the repeating conversion types RPT
+ and RPX rely on the conversion executed for the function token class.
+
+ 1) ORG:
+ Use the original class of the token (VAL or ARR), regardless of any
+ conversion done for the function return class.
+
+ 2) VAL:
+ Convert ARR tokens to VAL class, regardless of any conversion done for
+ the function return class.
+
+ 3) ARR:
+ Convert VAL tokens to ARR class, regardless of any conversion done for
+ the function return class.
+
+ 4) RPT:
+ If the own function returns REF class (thus it is called from a REFTYPE
+ parameter, see above), and the parent conversion type (for the function
+ return class) was ORG, VAL, or ARR, ignore that conversion and always
+ use VAL conversion for the own token instead. If the parent conversion
+ type was RPT or RPX, repeat the conversion that would have been used if
+ the function would return value type.
+ If the own function returns value type (VAL or ARR class, see above),
+ and the parent conversion type (for the function return class) was ORG,
+ VAL, ARR, or RPT, repeat this conversion for the own token. If the
+ parent conversion type was RPX, always use ORG conversion type for the
+ own token instead.
+
+ 5) RPX:
+ This type of conversion only occurs in functions returning VAL class by
+ default. If the own token is value type, and the VAL return class of
+ the own function has been changed to ARR class (due to direct ARR
+ conversion, or due to ARR conversion repeated by RPT or RPX), set the
+ own token to ARR type. Otherwise use the original token type (VAL
+ conversion from parent parameter will not be repeated at all). If
+ nested functions have RPT or value-type RPX parameters, they will not
+ repeat this conversion type, but will use ORG conversion instead (see
+ description of RPT above).
+
+ 6) RPO:
+ This type of conversion is only used for the operands of all operators
+ (unary and binary arithmetic operators, comparison operators, and range
+ operators). It is not used for function parameters. On conversion, it
+ will be replaced by the last conversion type that was not the RPO
+ conversion. This leads to a slightly different behaviour than the RPT
+ conversion for operands in conjunction with a parent RPX conversion.
+ */
+struct XclFuncParamInfo
+{
+ XclFuncParamValidity meValid; /// Parameter validity.
+ XclFuncParamConv meConv; /// Token class conversion type.
+ bool mbValType; /// Data type (false = REFTYPE, true = VALTYPE).
+};
+
// Function data ==============================================================
const sal_uInt8 EXC_FUNC_MAXPARAM = 30; /// Maximum parameter count.
-const sal_uInt8 EXC_FUNC_PAR_CALCONLY = 0xFD; /// Placeholder for a parameter existing in Calc, but not in Excel.
-const sal_uInt8 EXC_FUNC_PAR_EXCELONLY = 0xFE; /// Placeholder for a parameter existing in Excel, but not in Calc.
-const sal_uInt8 EXC_FUNC_PAR_INVALID = 0xFF; /// Placeholder for an invalid token class.
-
-const sal_uInt8 EXC_FUNCINFO_CLASSCOUNT = 5; /// Number of token class entries.
+const size_t EXC_FUNCINFO_PARAMINFO_COUNT = 5; /// Number of parameter info entries.
const sal_uInt8 EXC_FUNCFLAG_VOLATILE = 0x01; /// Result is volatile (e.g. NOW() function).
const sal_uInt8 EXC_FUNCFLAG_IMPORTONLY = 0x02; /// Only used in import filter.
@@ -207,14 +305,11 @@ const sal_uInt16 EXC_FUNCID_EXTERNCALL = 255;
/** Represents information for a spreadsheet function for import and export.
- The member mpnParamClass contains an array of token classes for each
- parameter of the function. The last existing (non-null) value in this array
- is used for all following parameters used in a function. Additionally to
- the three actual token classes, this array may contain the special values
- EXC_FUNC_PAR_CALCONLY, EXC_FUNC_PAR_EXCELONLY, and EXC_FUNC_PAR_INVALID.
- The former two specify parameters only existing in one of the applications.
- EXC_FUNC_PAR_INVALID is simply a terminator for the array to prevent that
- the last token class or special value is repeated for additional parameters.
+ The member mpParamInfos points to an array of type information structures
+ for all parameters of the function. The last initialized structure
+ describing a regular parameter (member meValid == EXC_PARAMVALID_ALWAYS) in
+ this array is used repeatedly for all following parameters supported by a
+ function.
*/
struct XclFunctionInfo
{
@@ -223,12 +318,14 @@ struct XclFunctionInfo
sal_uInt8 mnMinParamCount; /// Minimum number of parameters.
sal_uInt8 mnMaxParamCount; /// Maximum number of parameters.
sal_uInt8 mnRetClass; /// Token class of the return value.
- sal_uInt8 mpnParamClass[ EXC_FUNCINFO_CLASSCOUNT ]; /// Expected token classes of parameters.
- sal_uInt8 mnFlags; /// Additional flags.
+ XclFuncParamInfo mpParamInfos[ EXC_FUNCINFO_PARAMINFO_COUNT ]; /// Information for all parameters.
+ sal_uInt8 mnFlags; /// Additional flags (EXC_FUNCFLAG_* constants).
const sal_Char* mpcMacroName; /// Function name, if simulated by a macro call (UTF-8).
/** Returns true, if the function is volatile. */
inline bool IsVolatile() const { return ::get_flag( mnFlags, EXC_FUNCFLAG_VOLATILE ); }
+ /** Returns true, if the function parameter count is fixed. */
+ inline bool IsFixedParamCount() const { return (mnXclFunc != EXC_FUNCID_EXTERNCALL) && (mnMinParamCount == mnMaxParamCount); }
/** Returns true, if the function is simulated by a macro call. */
inline bool IsMacroFunc() const { return mpcMacroName != 0; }
/** Returns the name of the external function as string. */
@@ -278,8 +375,9 @@ public:
/** Creates an empty token array. */
explicit XclTokenArray( bool bVolatile = false );
/** Creates a token array, swaps passed token vector into own data. */
- explicit XclTokenArray( ScfUInt8Vec& rTokVec, bool bVolatile = false,
- ScfUInt8Vec* pExtensionTokens = NULL);
+ explicit XclTokenArray( ScfUInt8Vec& rTokVec, bool bVolatile = false );
+ /** Creates a token array, swaps passed token vectors into own data. */
+ explicit XclTokenArray( ScfUInt8Vec& rTokVec, ScfUInt8Vec& rExtDataVec, bool bVolatile = false );
/** Returns true, if the token array is empty. */
inline bool Empty() const { return maTokVec.empty(); }
@@ -309,7 +407,7 @@ public:
private:
ScfUInt8Vec maTokVec; /// Byte vector containing token data.
- ScfUInt8Vec maExtensions; /// Byte vector of extensions (eg inline arrays)
+ ScfUInt8Vec maExtDataVec; /// Byte vector containing extended data (arrays, stacked NLRs).
bool mbVolatile; /// True = Formula contains volatile function.
};
@@ -326,10 +424,7 @@ XclExpStream& operator<<( XclExpStream& rStrm, const XclTokenArrayRef& rxTokArr
// ----------------------------------------------------------------------------
-namespace formula
-{
- class FormulaToken;
-}
+namespace formula { class FormulaToken; }
class ScTokenArray;
/** Special token array iterator for the Excel filters.
@@ -347,7 +442,7 @@ class XclTokenArrayIterator
public:
explicit XclTokenArrayIterator();
explicit XclTokenArrayIterator( const ScTokenArray& rScTokArr, bool bSkipSpaces );
- /** Copy constructor that allowa to change the skip-spaces mode. */
+ /** Copy constructor that allows to change the skip-spaces mode. */
explicit XclTokenArrayIterator( const XclTokenArrayIterator& rTokArrIt, bool bSkipSpaces );
void Init();
@@ -355,9 +450,9 @@ public:
inline bool Is() const { return mppScToken != 0; }
inline bool operator!() const { return !Is(); }
- inline const formula::FormulaToken* Get() const { return mppScToken ? *mppScToken : 0; }
- inline const formula::FormulaToken* operator->() const { return Get(); }
- inline const formula::FormulaToken& operator*() const { return *Get(); }
+ inline const ::formula::FormulaToken* Get() const { return mppScToken ? *mppScToken : 0; }
+ inline const ::formula::FormulaToken* operator->() const { return Get(); }
+ inline const ::formula::FormulaToken& operator*() const { return *Get(); }
XclTokenArrayIterator& operator++();
@@ -366,9 +461,9 @@ private:
void SkipSpaces();
private:
- const formula::FormulaToken*const* mppScTokenBeg; /// Pointer to first token pointer of token array.
- const formula::FormulaToken*const* mppScTokenEnd; /// Pointer behind last token pointer of token array.
- const formula::FormulaToken*const* mppScToken; /// Pointer to current token pointer of token array.
+ const ::formula::FormulaToken*const* mppScTokenBeg; /// Pointer to first token pointer of token array.
+ const ::formula::FormulaToken*const* mppScTokenEnd; /// Pointer behind last token pointer of token array.
+ const ::formula::FormulaToken*const* mppScToken; /// Pointer to current token pointer of token array.
bool mbSkipSpaces; /// true = Skip whitespace tokens.
};
@@ -407,14 +502,14 @@ public:
/** Returns the token class of the passed token ID. */
inline static sal_uInt8 GetTokenClass( sal_uInt8 nTokenId ) { return nTokenId & EXC_TOKCLASS_MASK; }
/** Changes the token class in the passed classified token ID. */
- inline static void ChangeTokenClass( sal_uInt8& rnTokenId, sal_uInt8 nTokenClass );
+ inline static void ChangeTokenClass( sal_uInt8& rnTokenId, sal_uInt8 nTokenClass );
// strings and string lists -----------------------------------------------
/** Tries to extract a string from the passed token.
@param rString (out-parameter) The string contained in the token.
@return true = Passed token is a string token, rString parameter is valid. */
- static bool GetTokenString( String& rString, const formula::FormulaToken& rScToken );
+ static bool GetTokenString( String& rString, const ::formula::FormulaToken& rScToken );
/** Parses the passed formula and tries to find a single string token, i.e. "abc".
@param rString (out-parameter) The string contained in the formula.
diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx
index 36056ead2fe2..8b0873b25475 100644
--- a/sc/source/filter/inc/xlroot.hxx
+++ b/sc/source/filter/inc/xlroot.hxx
@@ -36,6 +36,8 @@
#include "xlconst.hxx"
#include "xltools.hxx"
+namespace comphelper { class IDocPasswordVerifier; }
+
// Forward declarations of objects in public use ==============================
class DateTime;
@@ -92,6 +94,8 @@ struct XclRootData
ScDocument& mrDoc; /// The source or destination document.
String maDocUrl; /// Document URL of imported/exported file.
String maBasePath; /// Base path of imported/exported file (path of maDocUrl).
+ String maUserName; /// Current user name.
+ const String maDefPassword; /// The default password used for stream encryption.
rtl_TextEncoding meTextEnc; /// Text encoding to import/export byte strings.
LanguageType meSysLang; /// System language.
LanguageType meDocLang; /// Document language (import: from file, export: from system).
@@ -182,6 +186,13 @@ public:
inline const String& GetDocUrl() const { return mrData.maDocUrl; }
/** Returns the base path of the imported/exported file. */
inline const String& GetBasePath() const { return mrData.maBasePath; }
+ /** Returns the current user name. */
+ inline const String& GetUserName() const { return mrData.maUserName; }
+
+ /** Returns the default password used for stream encryption. */
+ inline const String& GetDefaultPassword() const { return mrData.maDefPassword; }
+ /** Requests and verifies a password from the medium or the user. */
+ String RequestPassword( ::comphelper::IDocPasswordVerifier& rVerifier ) const;
/** Returns the OLE2 root storage of the imported/exported file.
@return Pointer to root storage or 0, if the file is a simple stream. */
diff --git a/sc/source/filter/inc/xlstream.hxx b/sc/source/filter/inc/xlstream.hxx
index ffdd74d5f218..603a4cfab3fc 100644
--- a/sc/source/filter/inc/xlstream.hxx
+++ b/sc/source/filter/inc/xlstream.hxx
@@ -50,19 +50,6 @@ const sal_uInt16 EXC_ENCR_BLOCKSIZE = 1024;
const sal_uInt16 EXC_ID_UNKNOWN = SAL_MAX_UINT16;
const sal_uInt16 EXC_ID_CONT = 0x003C;
-// Encryption/decryption ======================================================
-
-/** Helper class for BIFF stream en-/decryption. */
-class XclCryptoHelper : ScfNoInstance
-{
-public:
- /** Returns the fixed password for workbook protection. */
- static const ByteString GetBiff5WbProtPassword();
-
- /** Returns the fixed password for workbook protection. */
- static const String GetBiff8WbProtPassword();
-};
-
// ============================================================================
#endif
diff --git a/sc/source/filter/inc/xlstyle.hxx b/sc/source/filter/inc/xlstyle.hxx
index 303da212d262..9613abfc8725 100644
--- a/sc/source/filter/inc/xlstyle.hxx
+++ b/sc/source/filter/inc/xlstyle.hxx
@@ -242,6 +242,14 @@ const sal_uInt8 EXC_STYLE_USERDEF = 0xFF; /// No built-in styl
const sal_uInt8 EXC_STYLE_LEVELCOUNT = 7; /// Number of outline level styles.
const sal_uInt8 EXC_STYLE_NOLEVEL = 0xFF; /// Default value for unused level.
+// (0x0892) STYLEEXT ----------------------------------------------------------
+
+const sal_uInt16 EXC_ID_STYLEEXT = 0x0892;
+
+const sal_uInt8 EXC_STYLEEXT_BUILTIN = 0x01;
+const sal_uInt8 EXC_STYLEEXT_HIDDEN = 0x02;
+const sal_uInt8 EXC_STYLEEXT_CUSTOM = 0x04;
+
// Structs and classes ========================================================
// Color data =================================================================
@@ -372,8 +380,8 @@ struct XclFontData
void SetApiHeight( float fPoint );
/** Sets the API font family. */
void SetApiFamily( sal_Int16 nApiFamily );
- /** Sets the API font text encoding. */
- void SetApiFontEncoding( sal_Int16 nApiFontEnc );
+//UNUSED2009-05 /** Sets the API font text encoding. */
+//UNUSED2009-05 void SetApiFontEncoding( sal_Int16 nApiFontEnc );
/** Sets the API font posture. */
void SetApiPosture( ::com::sun::star::awt::FontSlant eApiPosture );
/** Sets the API font weight. */
diff --git a/sc/source/filter/inc/xltools.hxx b/sc/source/filter/inc/xltools.hxx
index 459a5c9b3a78..392b0a2ae1fc 100644
--- a/sc/source/filter/inc/xltools.hxx
+++ b/sc/source/filter/inc/xltools.hxx
@@ -167,8 +167,8 @@ public:
@return The corresponding text encoding or RTL_TEXTENCODING_DONTKNOW. */
static rtl_TextEncoding GetTextEncoding( sal_uInt16 nCodePage );
-//UNUSED2008-05 /** Returns an Excel code page from a text encoding. */
-//UNUSED2008-05 static sal_uInt16 GetXclCodePage( rtl_TextEncoding eTextEnc );
+ /** Returns an Excel code page from a text encoding. */
+ static sal_uInt16 GetXclCodePage( rtl_TextEncoding eTextEnc );
// font names -------------------------------------------------------------
@@ -194,9 +194,12 @@ public:
/** Returns the specified built-in cell style name.
@param nStyleId The identifier of the built-in style.
+ @param rName Default name for unknown styles.
@param nLevel The zero-based outline level for RowLevel and ColLevel styles.
@return The style name or an empty string, if the parameters are not valid. */
- static String GetBuiltInStyleName( sal_uInt8 nStyleId, sal_uInt8 nLevel );
+ static String GetBuiltInStyleName( sal_uInt8 nStyleId, const String& rName, sal_uInt8 nLevel );
+ /** Returns the passed style name with a special built-in prefix. */
+ static String GetBuiltInStyleName( const String& rStyleName );
/** Returns true, if the passed string is a name of an Excel built-in style.
@param pnStyleId If not 0, the found style identifier will be returned here.
@param pnNextChar If not 0, the index of the char after the evaluated substring will be returned here. */
@@ -230,8 +233,10 @@ public:
// ------------------------------------------------------------------------
private:
static const String maDefNamePrefix; /// Prefix for built-in defined names.
- static const String maStyleNamePrefix; /// Prefix for built-in cell style names.
- static const String maCFStyleNamePrefix; /// Prefix for cond. formatting style names.
+ static const String maStyleNamePrefix1; /// Prefix for built-in cell style names.
+ static const String maStyleNamePrefix2; /// Prefix for built-in cell style names from OOX filter.
+ static const String maCFStyleNamePrefix1; /// Prefix for cond. formatting style names.
+ static const String maCFStyleNamePrefix2; /// Prefix for cond. formatting style names from OOX filter.
};
// read/write colors ----------------------------------------------------------
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index 92cb49e786eb..8759d21297f3 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -171,20 +171,20 @@ void OP_Label( SvStream& r, UINT16 n )
}
-void OP_Text( SvStream& r, UINT16 n ) // WK3
-{
- UINT16 nRow;
- BYTE nCol, nTab;
- sal_Char pText[ 256 ];
-
- r >> nRow >> nTab >> nCol;
- n -= 4;
-
- r.Read( pText, n );
- pText[ n ] = 0; // zur Sicherheit Nullterminator anhaengen
-
- PutFormString( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), static_cast<SCTAB> (nTab), pText );
-}
+//UNUSED2009-05 void OP_Text( SvStream& r, UINT16 n ) // WK3
+//UNUSED2009-05 {
+//UNUSED2009-05 UINT16 nRow;
+//UNUSED2009-05 BYTE nCol, nTab;
+//UNUSED2009-05 sal_Char pText[ 256 ];
+//UNUSED2009-05
+//UNUSED2009-05 r >> nRow >> nTab >> nCol;
+//UNUSED2009-05 n -= 4;
+//UNUSED2009-05
+//UNUSED2009-05 r.Read( pText, n );
+//UNUSED2009-05 pText[ n ] = 0; // zur Sicherheit Nullterminator anhaengen
+//UNUSED2009-05
+//UNUSED2009-05 PutFormString( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), static_cast<SCTAB> (nTab), pText );
+//UNUSED2009-05 }
void OP_Formula( SvStream& r, UINT16 /*n*/ )
diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx
index 52627c7848e4..5ea9efae2b3e 100644
--- a/sc/source/filter/qpro/qpro.cxx
+++ b/sc/source/filter/qpro/qpro.cxx
@@ -217,12 +217,6 @@ bool ScQProReader::recordsLeft()
return bValue;
}
-bool ScQProReader::IsEndOfFile()
-{
- bool bValue = ScBiffReader::mbEndOfFile;
- return bValue;
-}
-
bool ScQProReader::nextRecord()
{
bool bValue = ScBiffReader::nextRecord();
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index ac71dbb01fbb..608b13c49ac3 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -65,7 +65,6 @@
#include <svx/eeitem.hxx>
#include <svx/msoleexp.hxx>
-#include <svtools/useroptions.hxx>
#include <unotools/localedatawrapper.hxx>
#include <stdio.h>
@@ -1033,15 +1032,14 @@ void ExcEScenarioCell::SaveXml( XclExpXmlStream& rStrm )
-XclExpString ExcEScenario::sUsername;
-
-ExcEScenario::ExcEScenario( ScDocument& rDoc, SCTAB nTab )
+ExcEScenario::ExcEScenario( const XclExpRoot& rRoot, SCTAB nTab )
{
String sTmpName;
String sTmpComm;
Color aDummyCol;
USHORT nFlags;
+ ScDocument& rDoc = rRoot.GetDoc();
rDoc.GetName( nTab, sTmpName );
sName.Assign( sTmpName, EXC_STR_8BITLENGTH );
nRecLen = 8 + sName.GetBufferSize();
@@ -1052,14 +1050,8 @@ ExcEScenario::ExcEScenario( ScDocument& rDoc, SCTAB nTab )
nRecLen += sComment.GetSize();
nProtected = (nFlags & SC_SCENARIO_PROTECT) ? 1 : 0;
- if( !sUsername.Len() )
- {
- SvtUserOptions aUserOpt;
- sUsername.Assign( aUserOpt.GetLastName(), EXC_STR_DEFAULT, 255 );
- }
- if( !sUsername.Len() )
- sUsername.Assign( String::CreateFromAscii( "SC" ) );
- nRecLen += sUsername.GetSize();
+ sUserName.Assign( rRoot.GetUserName(), EXC_STR_DEFAULT, 255 );
+ nRecLen += sUserName.GetSize();
const ScRangeList* pRList = rDoc.GetScenarioRanges( nTab );
if( !pRList )
@@ -1118,11 +1110,11 @@ void ExcEScenario::SaveCont( XclExpStream& rStrm )
<< (UINT8) 0 // fHidden
<< (UINT8) sName.Len() // length of scen name
<< (UINT8) sComment.Len() // length of comment
- << (UINT8) sUsername.Len(); // length of user name
+ << (UINT8) sUserName.Len(); // length of user name
sName.WriteFlagField( rStrm );
sName.WriteBuffer( rStrm );
- rStrm << sUsername;
+ rStrm << sUserName;
if( sComment.Len() )
rStrm << sComment;
@@ -1154,7 +1146,7 @@ void ExcEScenario::SaveXml( XclExpXmlStream& rStrm )
XML_locked, XclXmlUtils::ToPsz( nProtected ),
// OOXTODO: XML_hidden,
XML_count, OString::valueOf( (sal_Int32) List::Count() ).getStr(),
- XML_user, XESTRING_TO_PSZ( sUsername ),
+ XML_user, XESTRING_TO_PSZ( sUserName ),
XML_comment, XESTRING_TO_PSZ( sComment ),
FSEND );
@@ -1167,9 +1159,10 @@ void ExcEScenario::SaveXml( XclExpXmlStream& rStrm )
-ExcEScenarioManager::ExcEScenarioManager( ScDocument& rDoc, SCTAB nTab ) :
+ExcEScenarioManager::ExcEScenarioManager( const XclExpRoot& rRoot, SCTAB nTab ) :
nActive( 0 )
{
+ ScDocument& rDoc = rRoot.GetDoc();
if( rDoc.IsScenario( nTab ) )
return;
@@ -1178,7 +1171,7 @@ ExcEScenarioManager::ExcEScenarioManager( ScDocument& rDoc, SCTAB nTab ) :
while( rDoc.IsScenario( nNewTab ) )
{
- Append( new ExcEScenario( rDoc, nNewTab ) );
+ Append( new ExcEScenario( rRoot, nNewTab ) );
if( rDoc.IsActiveScenario( nNewTab ) )
nActive = static_cast<sal_uInt16>(nNewTab - nFirstTab);
@@ -1453,67 +1446,15 @@ void XclExpFilePass::WriteBody( XclExpStream& rStrm )
// ============================================================================
-XclExpFnGroupCount::XclExpFnGroupCount() :
- XclExpRecord(0x009C, 2)
-{
-}
-
-XclExpFnGroupCount::~XclExpFnGroupCount()
-{
-}
-
-void XclExpFnGroupCount::WriteBody( XclExpStream& rStrm )
-{
- rStrm << static_cast<sal_uInt16>(14);
-}
-
-// ============================================================================
-
-XclExpInterfaceHdr::XclExpInterfaceHdr() :
- XclExpRecord(0x00E1, 2)
-{
-}
-
-XclExpInterfaceHdr::~XclExpInterfaceHdr()
+XclExpInterfaceHdr::XclExpInterfaceHdr( sal_uInt16 nCodePage ) :
+ XclExpUInt16Record( EXC_ID_INTERFACEHDR, nCodePage )
{
}
void XclExpInterfaceHdr::WriteBody( XclExpStream& rStrm )
{
- // The value must be the same value as the CODEPAGE record.
rStrm.DisableEncryption();
- rStrm << static_cast<sal_uInt16>(0x04B0);
-}
-
-// ============================================================================
-
-XclExpInterfaceEnd::XclExpInterfaceEnd() :
- XclExpRecord(0x00E2, 0)
-{
-}
-
-XclExpInterfaceEnd::~XclExpInterfaceEnd()
-{
-}
-
-void XclExpInterfaceEnd::WriteBody( XclExpStream& /*rStrm*/ )
-{
-}
-
-// ============================================================================
-
-XclExpMMS::XclExpMMS() :
- XclExpRecord(0x00C1, 2)
-{
-}
-
-XclExpMMS::~XclExpMMS()
-{
-}
-
-void XclExpMMS::WriteBody( XclExpStream& rStrm )
-{
- rStrm << static_cast<sal_uInt16>(0x0000);
+ rStrm << GetValue();
}
// ============================================================================
@@ -1552,35 +1493,25 @@ void XclExpWriteAccess::WriteBody( XclExpStream& rStrm )
// ============================================================================
-XclExpCodePage::XclExpCodePage() :
- XclExpRecord(0x0042, 2)
-{
-}
-
-XclExpCodePage::~XclExpCodePage()
-{
-}
-
-void XclExpCodePage::WriteBody( XclExpStream& rStrm )
-{
- // 0x04B0 : UTF-16 (BIFF8)
- rStrm << static_cast<sal_uInt16>(0x04B0);
-}
-
-// ============================================================================
-
-XclExpDSF::XclExpDSF() :
- XclExpRecord(0x0161, 2)
+XclExpFileSharing::XclExpFileSharing( const XclExpRoot& rRoot, sal_uInt16 nPasswordHash ) :
+ XclExpRecord( EXC_ID_FILESHARING ),
+ mnPasswordHash( nPasswordHash )
{
+ if( rRoot.GetBiff() <= EXC_BIFF5 )
+ maUserName.AssignByte( rRoot.GetUserName(), rRoot.GetTextEncoding(), EXC_STR_8BITLENGTH );
+ else
+ maUserName.Assign( rRoot.GetUserName() );
}
-XclExpDSF::~XclExpDSF()
+void XclExpFileSharing::Save( XclExpStream& rStrm )
{
+ if( mnPasswordHash != 0 )
+ XclExpRecord::Save( rStrm );
}
-void XclExpDSF::WriteBody( XclExpStream& rStrm )
+void XclExpFileSharing::WriteBody( XclExpStream& rStrm )
{
- rStrm << static_cast<sal_uInt16>(0x0000);
+ rStrm << sal_uInt16( 0 ) << mnPasswordHash << maUserName;
}
// ============================================================================
@@ -1617,21 +1548,6 @@ void XclExpProt4RevPass::WriteBody( XclExpStream& rStrm )
// ============================================================================
-XclExpExcel9File::XclExpExcel9File() :
- XclExpRecord(0x01C0, 0)
-{
-}
-
-XclExpExcel9File::~XclExpExcel9File()
-{
-}
-
-void XclExpExcel9File::WriteBody( XclExpStream& /*rStrm*/ )
-{
-}
-
-// ============================================================================
-
static const sal_uInt8 nDataRecalcId[] = {
0xC1, 0x01, 0x00, 0x00, 0x54, 0x8D, 0x01, 0x00
};
diff --git a/sc/source/filter/xml/XMLDDELinksContext.cxx b/sc/source/filter/xml/XMLDDELinksContext.cxx
index c0872ae07668..ce77178500bb 100644
--- a/sc/source/filter/xml/XMLDDELinksContext.cxx
+++ b/sc/source/filter/xml/XMLDDELinksContext.cxx
@@ -163,9 +163,20 @@ void ScXMLDDELinkContext::EndElement()
{
if (nPosition > -1 && nColumns && nRows && GetScImport().GetDocument())
{
+ bool bSizeMatch = (static_cast<size_t>(nColumns * nRows) == aDDELinkTable.size());
+ DBG_ASSERT( bSizeMatch, "ScXMLDDELinkContext::EndElement: matrix dimension doesn't match cells count");
+ // Excel writes bad ODF in that it does not write the
+ // table:number-columns-repeated attribute of the
+ // <table:table-column> element, but apparently uses the number of
+ // <table:table-cell> elements within a <table:table-row> element to
+ // determine the column count instead. Be lenient ...
+ if (!bSizeMatch && nColumns == 1)
+ {
+ nColumns = aDDELinkTable.size() / nRows;
+ DBG_ASSERT( static_cast<size_t>(nColumns * nRows) == aDDELinkTable.size(),
+ "ScXMLDDELinkContext::EndElement: adapted matrix dimension doesn't match either");
+ }
ScMatrixRef pMatrix = new ScMatrix( static_cast<SCSIZE>(nColumns), static_cast<SCSIZE>(nRows) );
-
- DBG_ASSERT(static_cast<sal_uInt32>(nColumns * nRows) == aDDELinkTable.size(), "there is a wrong cells count");
sal_Int32 nCol(0);
sal_Int32 nRow(-1);
sal_Int32 nIndex(0);
diff --git a/sc/source/filter/xml/XMLExportIterator.cxx b/sc/source/filter/xml/XMLExportIterator.cxx
index 72194c8be11c..c0b50a06b45a 100644
--- a/sc/source/filter/xml/XMLExportIterator.cxx
+++ b/sc/source/filter/xml/XMLExportIterator.cxx
@@ -130,6 +130,13 @@ void ScMyShapesContainer::SetCellData( ScMyCell& rMyCell )
rMyCell.bHasShape = !rMyCell.aShapeList.empty();
}
+void ScMyShapesContainer::SkipTable(SCTAB nSkip)
+{
+ ScMyShapeList::iterator aItr = aShapeList.begin();
+ while( (aItr != aShapeList.end()) && (aItr->aAddress.Tab() == nSkip) )
+ aItr = aShapeList.erase(aItr);
+}
+
void ScMyShapesContainer::Sort()
{
aShapeList.sort();
@@ -184,6 +191,13 @@ void ScMyNoteShapesContainer::SetCellData( ScMyCell& rMyCell )
}
}
+void ScMyNoteShapesContainer::SkipTable(SCTAB nSkip)
+{
+ ScMyNoteShapeList::iterator aItr = aNoteShapeList.begin();
+ while( (aItr != aNoteShapeList.end()) && (aItr->aPos.Tab() == nSkip) )
+ aItr = aNoteShapeList.erase(aItr);
+}
+
void ScMyNoteShapesContainer::Sort()
{
aNoteShapeList.sort();
@@ -269,6 +283,13 @@ void ScMyMergedRangesContainer::SetCellData( ScMyCell& rMyCell )
}
}
+void ScMyMergedRangesContainer::SkipTable(SCTAB nSkip)
+{
+ ScMyMergedRangeList::iterator aItr = aRangeList.begin();
+ while( (aItr != aRangeList.end()) && (aItr->aCellRange.Sheet == nSkip) )
+ aItr = aRangeList.erase(aItr);
+}
+
void ScMyMergedRangesContainer::Sort()
{
aRangeList.sort();
@@ -344,6 +365,13 @@ void ScMyAreaLinksContainer::SetCellData( ScMyCell& rMyCell )
}
}
+void ScMyAreaLinksContainer::SkipTable(SCTAB nSkip)
+{
+ ScMyAreaLinkList::iterator aItr = aAreaLinkList.begin();
+ while( (aItr != aAreaLinkList.end()) && (aItr->aDestRange.Sheet == nSkip) )
+ aItr = aAreaLinkList.erase(aItr);
+}
+
void ScMyAreaLinksContainer::Sort()
{
aAreaLinkList.sort();
@@ -417,6 +445,13 @@ void ScMyEmptyDatabaseRangesContainer::SetCellData( ScMyCell& rMyCell )
}
}
+void ScMyEmptyDatabaseRangesContainer::SkipTable(SCTAB nSkip)
+{
+ ScMyEmptyDatabaseRangeList::iterator aItr = aDatabaseList.begin();
+ while( (aItr != aDatabaseList.end()) && (aItr->Sheet == nSkip) )
+ aItr = aDatabaseList.erase(aItr);
+}
+
void ScMyEmptyDatabaseRangesContainer::Sort()
{
aDatabaseList.sort();
@@ -498,6 +533,13 @@ void ScMyDetectiveObjContainer::SetCellData( ScMyCell& rMyCell )
rMyCell.bHasDetectiveObj = (rMyCell.aDetectiveObjVec.size() != 0);
}
+void ScMyDetectiveObjContainer::SkipTable(SCTAB nSkip)
+{
+ ScMyDetectiveObjList::iterator aItr = aDetectiveObjList.begin();
+ while( (aItr != aDetectiveObjList.end()) && (aItr->aPosition.Sheet == nSkip) )
+ aItr = aDetectiveObjList.erase(aItr);
+}
+
void ScMyDetectiveObjContainer::Sort()
{
aDetectiveObjList.sort();
@@ -557,6 +599,13 @@ void ScMyDetectiveOpContainer::SetCellData( ScMyCell& rMyCell )
rMyCell.bHasDetectiveOp = (rMyCell.aDetectiveOpVec.size() != 0);
}
+void ScMyDetectiveOpContainer::SkipTable(SCTAB nSkip)
+{
+ ScMyDetectiveOpList::iterator aItr = aDetectiveOpList.begin();
+ while( (aItr != aDetectiveOpList.end()) && (aItr->aPosition.Sheet == nSkip) )
+ aItr = aDetectiveOpList.erase(aItr);
+}
+
void ScMyDetectiveOpContainer::Sort()
{
aDetectiveOpList.sort();
@@ -766,6 +815,27 @@ void ScMyNotEmptyCellsIterator::SetCurrentTable(const SCTAB nTable,
}
}
+void ScMyNotEmptyCellsIterator::SkipTable(SCTAB nSkip)
+{
+ // Skip entries for a sheet that is copied instead of saving normally.
+ // Cells (including aAnnotations) are handled separately in SetCurrentTable.
+
+ if( pShapes )
+ pShapes->SkipTable(nSkip);
+ if( pNoteShapes )
+ pNoteShapes->SkipTable(nSkip);
+ if( pEmptyDatabaseRanges )
+ pEmptyDatabaseRanges->SkipTable(nSkip);
+ if( pMergedRanges )
+ pMergedRanges->SkipTable(nSkip);
+ if( pAreaLinks )
+ pAreaLinks->SkipTable(nSkip);
+ if( pDetectiveObj )
+ pDetectiveObj->SkipTable(nSkip);
+ if( pDetectiveOp )
+ pDetectiveOp->SkipTable(nSkip);
+}
+
sal_Bool ScMyNotEmptyCellsIterator::GetNext(ScMyCell& aCell, ScFormatRangeStyles* pCellStyles)
{
table::CellAddress aAddress( nCurrentTable, MAXCOL + 1, MAXROW + 1 );
diff --git a/sc/source/filter/xml/XMLExportIterator.hxx b/sc/source/filter/xml/XMLExportIterator.hxx
index d15ef94f99e6..92c61ca060e9 100644
--- a/sc/source/filter/xml/XMLExportIterator.hxx
+++ b/sc/source/filter/xml/XMLExportIterator.hxx
@@ -96,6 +96,7 @@ public:
const ScMyShapeList* GetShapes() { return &aShapeList; }
virtual void SetCellData( ScMyCell& rMyCell );
virtual void Sort();
+ void SkipTable(SCTAB nSkip);
};
struct ScMyNoteShape
@@ -124,6 +125,7 @@ public:
const ScMyNoteShapeList* GetNotes() { return &aNoteShapeList; }
virtual void SetCellData( ScMyCell& rMyCell );
virtual void Sort();
+ void SkipTable(SCTAB nSkip);
};
//==============================================================================
@@ -152,6 +154,7 @@ public:
using ScMyIteratorBase::UpdateAddress;
virtual void SetCellData( ScMyCell& rMyCell );
virtual void Sort(); // + remove doublets
+ void SkipTable(SCTAB nSkip);
};
//==============================================================================
@@ -192,6 +195,7 @@ public:
using ScMyIteratorBase::UpdateAddress;
virtual void SetCellData( ScMyCell& rMyCell );
virtual void Sort();
+ void SkipTable(SCTAB nSkip);
};
//==============================================================================
@@ -218,6 +222,7 @@ public:
using ScMyIteratorBase::UpdateAddress;
virtual void SetCellData( ScMyCell& rMyCell );
virtual void Sort();
+ void SkipTable(SCTAB nSkip);
};
//==============================================================================
@@ -254,6 +259,7 @@ public:
using ScMyIteratorBase::UpdateAddress;
virtual void SetCellData( ScMyCell& rMyCell );
virtual void Sort();
+ void SkipTable(SCTAB nSkip);
};
//==============================================================================
@@ -284,6 +290,7 @@ public:
using ScMyIteratorBase::UpdateAddress;
virtual void SetCellData( ScMyCell& rMyCell );
virtual void Sort();
+ void SkipTable(SCTAB nSkip);
};
//==============================================================================
@@ -400,6 +407,7 @@ public:
void SetCurrentTable(const SCTAB nTable,
com::sun::star::uno::Reference<com::sun::star::sheet::XSpreadsheet>& rxTable);
+ void SkipTable(SCTAB nSkip);
sal_Bool GetNext(ScMyCell& aCell, ScFormatRangeStyles* pCellStyles);
};
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index 6482fe571b62..98100f4b3646 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -878,7 +878,7 @@ sal_Int32 ScFormatRangeStyles::GetIndexOfStyleName(const rtl::OUString& rString,
sal_Int32 nPrefixLength(rPrefix.getLength());
rtl::OUString sTemp(rString.copy(nPrefixLength));
sal_Int32 nIndex(sTemp.toInt32());
- if (aAutoStyleNames.at(nIndex - 1)->equals(rString))
+ if (nIndex > 0 && static_cast<size_t>(nIndex-1) < aAutoStyleNames.size() && aAutoStyleNames.at(nIndex - 1)->equals(rString))
{
bIsAutoStyle = sal_True;
return nIndex - 1;
@@ -1111,7 +1111,7 @@ sal_Int32 ScColumnRowStylesBase::GetIndexOfStyleName(const rtl::OUString& rStrin
sal_Int32 nPrefixLength(rPrefix.getLength());
rtl::OUString sTemp(rString.copy(nPrefixLength));
sal_Int32 nIndex(sTemp.toInt32());
- if (aStyleNames.at(nIndex - 1)->equals(rString))
+ if (nIndex > 0 && static_cast<size_t>(nIndex-1) < aStyleNames.size() && aStyleNames.at(nIndex - 1)->equals(rString))
return nIndex - 1;
else
{
diff --git a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx
index 48def752b038..f498faf93e5b 100644
--- a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx
+++ b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx
@@ -36,6 +36,8 @@
#include "drwlayer.hxx"
#include "xmlannoi.hxx"
#include "rangeutl.hxx"
+#include "docuno.hxx"
+#include "sheetdata.hxx"
#include <xmloff/nmspmap.hxx>
#include <xmloff/xmlnmspe.hxx>
#include <xmloff/xmluconv.hxx>
@@ -80,9 +82,11 @@ void XMLTableShapeImportHelper::finishShape(
const uno::Reference< xml::sax::XAttributeList >& xAttrList,
uno::Reference< drawing::XShapes >& rShapes )
{
+ bool bNote = false;
XMLShapeImportHelper::finishShape( rShape, xAttrList, rShapes );
static_cast<ScXMLImport&>(mrImporter).LockSolarMutex();
- if (rShapes == static_cast<ScXMLImport&>(mrImporter).GetTables().GetCurrentXShapes())
+ ScMyTables& rTables = static_cast<ScXMLImport&>(mrImporter).GetTables();
+ if (rShapes == rTables.GetCurrentXShapes())
{
if (!pAnnotationContext)
{
@@ -126,7 +130,7 @@ void XMLTableShapeImportHelper::finishShape(
if (!bOnTable)
{
- static_cast<ScXMLImport&>(mrImporter).GetTables().AddShape(rShape,
+ rTables.AddShape(rShape,
pRangeList, aStartCell, aEndCell, nEndX, nEndY);
SvxShape* pShapeImp = SvxShape::getImplementation(rShape);
if (pShapeImp)
@@ -145,7 +149,7 @@ void XMLTableShapeImportHelper::finishShape(
// -> call AddShape with invalid cell position (checked in ScMyShapeResizer::ResizeShapes)
table::CellAddress aInvalidPos( -1, -1, -1 );
- static_cast<ScXMLImport&>(mrImporter).GetTables().AddShape(rShape,
+ rTables.AddShape(rShape,
pRangeList, aInvalidPos, aInvalidPos, 0, 0);
}
@@ -160,7 +164,26 @@ void XMLTableShapeImportHelper::finishShape(
}
else // shape is annotation
{
- pAnnotationContext->SetShape(rShape, rShapes);
+ // get the style names for stream copying
+ rtl::OUString aStyleName;
+ rtl::OUString aTextStyle;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; ++i )
+ {
+ const rtl::OUString& rAttrName(xAttrList->getNameByIndex( i ));
+ rtl::OUString aLocalName;
+ sal_uInt16 nPrefix(static_cast<ScXMLImport&>(mrImporter).GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName ));
+ if(nPrefix == XML_NAMESPACE_DRAW)
+ {
+ if (IsXMLToken(aLocalName, XML_STYLE_NAME))
+ aStyleName = xAttrList->getValueByIndex( i );
+ else if (IsXMLToken(aLocalName, XML_TEXT_STYLE_NAME))
+ aTextStyle = xAttrList->getValueByIndex( i );
+ }
+ }
+
+ pAnnotationContext->SetShape(rShape, rShapes, aStyleName, aTextStyle);
+ bNote = true;
}
}
else //#99532# this are grouped shapes which should also get the layerid
@@ -183,5 +206,13 @@ void XMLTableShapeImportHelper::finishShape(
}
SetLayer(rShape, nLayerID, rShape->getShapeType());
}
+
+ if (!bNote)
+ {
+ // any shape other than a note prevents copying the sheet
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(mrImporter.GetModel())->GetSheetSaveData();
+ pSheetData->BlockSheet( rTables.GetCurrentSheet() );
+ }
+
static_cast<ScXMLImport&>(mrImporter).UnlockSolarMutex();
}
diff --git a/sc/source/filter/xml/XMLTableShapeImportHelper.hxx b/sc/source/filter/xml/XMLTableShapeImportHelper.hxx
index 4299649427e4..06d49dc4beed 100644
--- a/sc/source/filter/xml/XMLTableShapeImportHelper.hxx
+++ b/sc/source/filter/xml/XMLTableShapeImportHelper.hxx
@@ -57,6 +57,8 @@ public:
void SetCell (const ::com::sun::star::table::CellAddress& rAddress) { aStartCell = rAddress; }
void SetOnTable (const sal_Bool bTempOnTable) { bOnTable = bTempOnTable; }
void SetAnnotation(ScXMLAnnotationContext* pAnnotation) { pAnnotationContext = pAnnotation; }
+
+ ScXMLAnnotationContext* GetAnnotationContext() const { return pAnnotationContext; }
};
diff --git a/sc/source/filter/xml/XMLTableShapeResizer.cxx b/sc/source/filter/xml/XMLTableShapeResizer.cxx
index 88c5fbf248b1..ca6d23a6459a 100644
--- a/sc/source/filter/xml/XMLTableShapeResizer.cxx
+++ b/sc/source/filter/xml/XMLTableShapeResizer.cxx
@@ -106,6 +106,12 @@ void ScMyShapeResizer::CreateChartListener(ScDocument* pDoc,
//otherwise the charts keep their first visual representation which was created at a moment where the calc itself was not loaded completly and is incorect therefor
if( (rImport.getImportFlags() & IMPORT_ALL) == IMPORT_ALL )
pCL->SetDirty( TRUE );
+ else
+ {
+ // #i104899# If a formula cell is already dirty, further changes aren't propagated.
+ // This can happen easily now that row heights aren't updated for all sheets.
+ pDoc->InterpretDirtyCells( *pCL->GetRangeList() );
+ }
pCollection->Insert( pCL );
pCL->StartListeningTo();
diff --git a/sc/source/filter/xml/makefile.mk b/sc/source/filter/xml/makefile.mk
index 19d8a99f789c..c1e7e215e199 100644
--- a/sc/source/filter/xml/makefile.mk
+++ b/sc/source/filter/xml/makefile.mk
@@ -51,57 +51,8 @@ PROJECTPCHSOURCE=..\pch\filt_pch
# --- Files --------------------------------------------------------
-CXXFILES = \
- xmlwrap.cxx \
- xmlimprt.cxx \
- xmlexprt.cxx \
- xmlbodyi.cxx \
- xmltabi.cxx \
- xmlexternaltabi.cxx \
- xmlrowi.cxx \
- xmlcelli.cxx \
- xmlconti.cxx \
- xmlcoli.cxx \
- xmlsubti.cxx \
- xmlnexpi.cxx \
- xmldrani.cxx \
- xmlfilti.cxx \
- xmlsorti.cxx \
- xmlstyle.cxx \
- xmlstyli.cxx \
- xmldpimp.cxx \
- xmlannoi.cxx \
- xmlsceni.cxx \
- xmlcvali.cxx \
- XMLTableMasterPageExport.cxx \
- xmllabri.cxx \
- XMLTableHeaderFooterContext.cxx \
- XMLDetectiveContext.cxx \
- XMLCellRangeSourceContext.cxx \
- XMLConsolidationContext.cxx \
- XMLConverter.cxx \
- XMLExportIterator.cxx \
- XMLColumnRowGroupExport.cxx \
- XMLStylesExportHelper.cxx \
- XMLStylesImportHelper.cxx \
- XMLExportDataPilot.cxx \
- XMLExportDatabaseRanges.cxx \
- XMLTableShapeImportHelper.cxx \
- XMLTableShapesContext.cxx \
- XMLExportDDELinks.cxx \
- XMLDDELinksContext.cxx \
- XMLCalculationSettingsContext.cxx \
- XMLTableSourceContext.cxx \
- XMLTextPContext.cxx \
- XMLTableShapeResizer.cxx \
- XMLChangeTrackingExportHelper.cxx \
- xmlfonte.cxx \
- XMLChangeTrackingImportHelper.cxx \
- XMLTrackedChangesContext.cxx \
- XMLExportSharedData.cxx \
- XMLEmptyContext.cxx
-
SLOFILES = \
+ $(SLO)$/sheetdata.obj \
$(SLO)$/xmlwrap.obj \
$(SLO)$/xmlimprt.obj \
$(SLO)$/xmlexprt.obj \
diff --git a/sc/source/filter/xml/sheetdata.cxx b/sc/source/filter/xml/sheetdata.cxx
new file mode 100644
index 000000000000..a8b96eb6d768
--- /dev/null
+++ b/sc/source/filter/xml/sheetdata.cxx
@@ -0,0 +1,275 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: sheetdata.cxx,v $
+ * $Revision: 1.69.32.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+// INCLUDE ---------------------------------------------------------------
+
+#include <xmloff/families.hxx>
+#include <xmloff/xmlaustp.hxx>
+#include <xmloff/nmspmap.hxx>
+#include <tools/string.hxx>
+#include <tools/debug.hxx>
+
+#include "sheetdata.hxx"
+
+// -----------------------------------------------------------------------
+
+ScSheetSaveData::ScSheetSaveData() :
+ mnStartTab( -1 ),
+ mnStartOffset( -1 ),
+ maPreviousNote( rtl::OUString(), rtl::OUString(), ScAddress(ScAddress::INITIALIZE_INVALID) )
+{
+}
+
+ScSheetSaveData::~ScSheetSaveData()
+{
+}
+
+void ScSheetSaveData::AddCellStyle( const rtl::OUString& rName, const ScAddress& rCellPos )
+{
+ maCellStyles.push_back( ScCellStyleEntry( rName, rCellPos ) );
+}
+
+void ScSheetSaveData::AddColumnStyle( const rtl::OUString& rName, const ScAddress& rCellPos )
+{
+ maColumnStyles.push_back( ScCellStyleEntry( rName, rCellPos ) );
+}
+
+void ScSheetSaveData::AddRowStyle( const rtl::OUString& rName, const ScAddress& rCellPos )
+{
+ maRowStyles.push_back( ScCellStyleEntry( rName, rCellPos ) );
+}
+
+void ScSheetSaveData::AddTableStyle( const rtl::OUString& rName, const ScAddress& rCellPos )
+{
+ maTableStyles.push_back( ScCellStyleEntry( rName, rCellPos ) );
+}
+
+void ScSheetSaveData::HandleNoteStyles( const rtl::OUString& rStyleName, const rtl::OUString& rTextName, const ScAddress& rCellPos )
+{
+ // only consecutive duplicates (most common case) are filtered out here,
+ // the others are found when the styles are created
+
+ if ( rStyleName == maPreviousNote.maStyleName &&
+ rTextName == maPreviousNote.maTextStyle &&
+ rCellPos.Tab() == maPreviousNote.maCellPos.Tab() )
+ {
+ // already stored for the same sheet - ignore
+ return;
+ }
+
+ ScNoteStyleEntry aNewEntry( rStyleName, rTextName, rCellPos );
+ maPreviousNote = aNewEntry;
+ maNoteStyles.push_back( aNewEntry );
+}
+
+void ScSheetSaveData::AddNoteContentStyle( sal_uInt16 nFamily, const rtl::OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection )
+{
+ if ( nFamily == XML_STYLE_FAMILY_TEXT_PARAGRAPH )
+ maNoteParaStyles.push_back( ScTextStyleEntry( rName, rCellPos, rSelection ) );
+ else
+ maNoteTextStyles.push_back( ScTextStyleEntry( rName, rCellPos, rSelection ) );
+}
+
+void ScSheetSaveData::AddTextStyle( const rtl::OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection )
+{
+ maTextStyles.push_back( ScTextStyleEntry( rName, rCellPos, rSelection ) );
+}
+
+void ScSheetSaveData::BlockSheet( sal_Int32 nTab )
+{
+ if ( nTab >= (sal_Int32)maBlocked.size() )
+ maBlocked.resize( nTab + 1, false ); // fill vector with "false" entries
+
+ maBlocked[nTab] = true;
+}
+
+bool ScSheetSaveData::IsSheetBlocked( sal_Int32 nTab ) const
+{
+ if ( nTab < (sal_Int32)maBlocked.size() )
+ return maBlocked[nTab];
+ else
+ return false;
+}
+
+void ScSheetSaveData::AddStreamPos( sal_Int32 nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset )
+{
+ if ( nTab >= (sal_Int32)maStreamEntries.size() )
+ maStreamEntries.resize( nTab + 1 );
+
+ maStreamEntries[nTab] = ScStreamEntry( nStartOffset, nEndOffset );
+}
+
+void ScSheetSaveData::StartStreamPos( sal_Int32 nTab, sal_Int32 nStartOffset )
+{
+ DBG_ASSERT( mnStartTab < 0, "StartStreamPos without EndStreamPos" );
+
+ mnStartTab = nTab;
+ mnStartOffset = nStartOffset;
+}
+
+void ScSheetSaveData::EndStreamPos( sal_Int32 nEndOffset )
+{
+ if ( mnStartTab >= 0 )
+ {
+ AddStreamPos( mnStartTab, mnStartOffset, nEndOffset );
+ mnStartTab = -1;
+ mnStartOffset = -1;
+ }
+}
+
+void ScSheetSaveData::GetStreamPos( sal_Int32 nTab, sal_Int32& rStartOffset, sal_Int32& rEndOffset ) const
+{
+ if ( nTab < (sal_Int32)maStreamEntries.size() )
+ {
+ const ScStreamEntry& rEntry = maStreamEntries[nTab];
+ rStartOffset = rEntry.mnStartOffset;
+ rEndOffset = rEntry.mnEndOffset;
+ }
+ else
+ rStartOffset = rEndOffset = -1;
+}
+
+bool ScSheetSaveData::HasStreamPos( sal_Int32 nTab ) const
+{
+ sal_Int32 nStartOffset = -1;
+ sal_Int32 nEndOffset = -1;
+ GetStreamPos( nTab, nStartOffset, nEndOffset );
+ return ( nStartOffset >= 0 && nEndOffset >= 0 );
+}
+
+void ScSheetSaveData::ResetSaveEntries()
+{
+ maSaveEntries.clear();
+}
+
+void ScSheetSaveData::AddSavePos( sal_Int32 nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset )
+{
+ if ( nTab >= (sal_Int32)maSaveEntries.size() )
+ maSaveEntries.resize( nTab + 1 );
+
+ maSaveEntries[nTab] = ScStreamEntry( nStartOffset, nEndOffset );
+}
+
+void ScSheetSaveData::UseSaveEntries()
+{
+ maStreamEntries = maSaveEntries;
+}
+
+void ScSheetSaveData::StoreInitialNamespaces( const SvXMLNamespaceMap& rNamespaces )
+{
+ // the initial namespaces are just removed from the list of loaded namespaces,
+ // so only a hash_set of the prefixes is needed.
+
+ const NameSpaceHash& rNameHash = rNamespaces.GetAllEntries();
+ NameSpaceHash::const_iterator aIter = rNameHash.begin(), aEnd = rNameHash.end();
+ while (aIter != aEnd)
+ {
+ maInitialPrefixes.insert( aIter->first );
+ ++aIter;
+ }
+}
+
+void ScSheetSaveData::StoreLoadedNamespaces( const SvXMLNamespaceMap& rNamespaces )
+{
+ // store the loaded namespaces, so the prefixes in copied stream fragments remain valid
+
+ const NameSpaceHash& rNameHash = rNamespaces.GetAllEntries();
+ NameSpaceHash::const_iterator aIter = rNameHash.begin(), aEnd = rNameHash.end();
+ while (aIter != aEnd)
+ {
+ // ignore the initial namespaces
+ if ( maInitialPrefixes.find( aIter->first ) == maInitialPrefixes.end() )
+ {
+ const NameSpaceEntry& rEntry = aIter->second.getBody();
+ maLoadedNamespaces.push_back( ScLoadedNamespaceEntry( rEntry.sPrefix, rEntry.sName, rEntry.nKey ) );
+ }
+ ++aIter;
+ }
+}
+
+bool lcl_NameInHash( const NameSpaceHash& rNameHash, const rtl::OUString& rName )
+{
+ NameSpaceHash::const_iterator aIter = rNameHash.begin(), aEnd = rNameHash.end();
+ while (aIter != aEnd)
+ {
+ if ( aIter->second->sName == rName )
+ return true;
+
+ ++aIter;
+ }
+ return false; // not found
+}
+
+bool ScSheetSaveData::AddLoadedNamespaces( SvXMLNamespaceMap& rNamespaces ) const
+{
+ // Add the loaded namespaces to the name space map.
+
+ // first loop: only look for conflicts
+ // (if the loaded namespaces were added first, this might not be necessary)
+ const NameSpaceHash& rNameHash = rNamespaces.GetAllEntries();
+ std::vector<ScLoadedNamespaceEntry>::const_iterator aIter = maLoadedNamespaces.begin();
+ std::vector<ScLoadedNamespaceEntry>::const_iterator aEnd = maLoadedNamespaces.end();
+ while (aIter != aEnd)
+ {
+ NameSpaceHash::const_iterator aHashIter = rNameHash.find( aIter->maPrefix );
+ if ( aHashIter == rNameHash.end() )
+ {
+ if ( lcl_NameInHash( rNameHash, aIter->maName ) )
+ {
+ // a second prefix for the same name would confuse SvXMLNamespaceMap lookup,
+ // so this is also considered a conflict
+ return false;
+ }
+ }
+ else if ( aHashIter->second->sName != aIter->maName )
+ {
+ // same prefix, but different name: loaded namespaces can't be used
+ return false;
+ }
+ ++aIter;
+ }
+
+ // only if there were no conflicts, add the entries that aren't in the map already
+ // (the key is needed if the same namespace is added later within an element)
+ aIter = maLoadedNamespaces.begin();
+ while (aIter != aEnd)
+ {
+ NameSpaceHash::const_iterator aHashIter = rNameHash.find( aIter->maPrefix );
+ if ( aHashIter == rNameHash.end() )
+ rNamespaces.Add( aIter->maPrefix, aIter->maName, aIter->mnKey );
+ ++aIter;
+ }
+
+ return true; // success
+}
+
diff --git a/sc/source/filter/xml/xmlannoi.cxx b/sc/source/filter/xml/xmlannoi.cxx
index f8081b7b8f48..294a335033c1 100644
--- a/sc/source/filter/xml/xmlannoi.cxx
+++ b/sc/source/filter/xml/xmlannoi.cxx
@@ -207,9 +207,17 @@ void ScXMLAnnotationContext::EndElement()
pTableShapeImport->SetAnnotation(NULL);
}
-void ScXMLAnnotationContext::SetShape( const uno::Reference< drawing::XShape >& rxShape, const uno::Reference< drawing::XShapes >& rxShapes )
+void ScXMLAnnotationContext::SetShape( const uno::Reference< drawing::XShape >& rxShape, const uno::Reference< drawing::XShapes >& rxShapes,
+ const rtl::OUString& rStyleName, const rtl::OUString& rTextStyle )
{
mrAnnotationData.mxShape = rxShape;
mrAnnotationData.mxShapes = rxShapes;
+ mrAnnotationData.maStyleName = rStyleName;
+ mrAnnotationData.maTextStyle = rTextStyle;
+}
+
+void ScXMLAnnotationContext::AddContentStyle( sal_uInt16 nFamily, const rtl::OUString& rName, const ESelection& rSelection )
+{
+ mrAnnotationData.maContentStyles.push_back( ScXMLAnnotationStyleEntry( nFamily, rName, rSelection ) );
}
diff --git a/sc/source/filter/xml/xmlannoi.hxx b/sc/source/filter/xml/xmlannoi.hxx
index c509b72124ed..41b206bd4380 100644
--- a/sc/source/filter/xml/xmlannoi.hxx
+++ b/sc/source/filter/xml/xmlannoi.hxx
@@ -34,12 +34,27 @@
#include <xmloff/xmlictxt.hxx>
#include <xmloff/xmlimp.hxx>
#include <rtl/ustrbuf.hxx>
+#include <svx/editdata.hxx>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/drawing/XShapes.hpp>
class ScXMLImport;
class ScXMLTableRowCellContext;
+struct ScXMLAnnotationStyleEntry
+{
+ sal_uInt16 mnFamily;
+ rtl::OUString maName;
+ ESelection maSelection;
+
+ ScXMLAnnotationStyleEntry( sal_uInt16 nFam, const rtl::OUString& rNam, const ESelection& rSel ) :
+ mnFamily( nFam ),
+ maName( rNam ),
+ maSelection( rSel )
+ {
+ }
+};
+
struct ScXMLAnnotationData
{
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
@@ -49,8 +64,11 @@ struct ScXMLAnnotationData
::rtl::OUString maAuthor;
::rtl::OUString maCreateDate;
::rtl::OUString maSimpleText;
+ ::rtl::OUString maStyleName;
+ ::rtl::OUString maTextStyle;
bool mbUseShapePos;
bool mbShown;
+ std::vector<ScXMLAnnotationStyleEntry> maContentStyles;
explicit ScXMLAnnotationData();
~ScXMLAnnotationData();
@@ -82,7 +100,10 @@ public:
void SetShape(
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
- const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::rtl::OUString& rStyleName, const ::rtl::OUString& rTextStyle );
+
+ void AddContentStyle( sal_uInt16 nFamily, const rtl::OUString& rName, const ESelection& rSelection );
private:
ScXMLAnnotationData& mrAnnotationData;
diff --git a/sc/source/filter/xml/xmlbodyi.cxx b/sc/source/filter/xml/xmlbodyi.cxx
index 048f1ec0c549..a301ddbf27e6 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -36,6 +36,8 @@
#include <cstdio>
#include "document.hxx"
+#include "docuno.hxx"
+#include "sheetdata.hxx"
#include "xmlbodyi.hxx"
#include "xmltabi.hxx"
@@ -136,6 +138,14 @@ SvXMLImportContext *ScXMLBodyContext::CreateChildContext( USHORT nPrefix,
const ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList>& xAttrList )
{
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetScImport().GetModel())->GetSheetSaveData();
+ if ( pSheetData && pSheetData->HasStartPos() )
+ {
+ // stream part to copy ends before the next child element
+ sal_Int32 nEndOffset = GetScImport().GetByteOffset();
+ pSheetData->EndStreamPos( nEndOffset );
+ }
+
SvXMLImportContext *pContext = 0;
const SvXMLTokenMap& rTokenMap = GetScImport().GetBodyElemTokenMap();
@@ -218,8 +228,36 @@ SvXMLImportContext *ScXMLBodyContext::CreateChildContext( USHORT nPrefix,
return pContext;
}
+void ScXMLBodyContext::Characters( const OUString& )
+{
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetScImport().GetModel())->GetSheetSaveData();
+ if ( pSheetData && pSheetData->HasStartPos() )
+ {
+ // stream part to copy ends before any content (whitespace) within the spreadsheet element
+ sal_Int32 nEndOffset = GetScImport().GetByteOffset();
+ pSheetData->EndStreamPos( nEndOffset );
+ }
+ // otherwise ignore
+}
+
void ScXMLBodyContext::EndElement()
{
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetScImport().GetModel())->GetSheetSaveData();
+ if ( pSheetData && pSheetData->HasStartPos() )
+ {
+ // stream part to copy ends before the closing tag of spreadsheet element
+ sal_Int32 nEndOffset = GetScImport().GetByteOffset();
+ pSheetData->EndStreamPos( nEndOffset );
+ }
+
+ if ( pSheetData )
+ {
+ // store the loaded namespaces (for the office:spreadsheet element),
+ // so the prefixes in copied stream fragments remain valid
+ const SvXMLNamespaceMap& rNamespaces = GetImport().GetNamespaceMap();
+ pSheetData->StoreLoadedNamespaces( rNamespaces );
+ }
+
if (!bHadCalculationSettings)
{
// #111055#; set calculation settings defaults if there is no calculation settings element
diff --git a/sc/source/filter/xml/xmlbodyi.hxx b/sc/source/filter/xml/xmlbodyi.hxx
index d57af40eaf25..2c489418bfff 100644
--- a/sc/source/filter/xml/xmlbodyi.hxx
+++ b/sc/source/filter/xml/xmlbodyi.hxx
@@ -57,6 +57,7 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XAttributeList>& xAttrList );
virtual void EndElement();
+ virtual void Characters( const ::rtl::OUString& rChars );
};
#endif
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index f0a4569cc86e..6a42d505cdc8 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -44,6 +44,7 @@
#include "docuno.hxx"
#include "unonames.hxx"
#include "postit.hxx"
+#include "sheetdata.hxx"
#include "XMLTableShapeImportHelper.hxx"
#include "XMLTextPContext.hxx"
@@ -550,6 +551,11 @@ void ScXMLTableRowCellContext::SetContentValidation(com::sun::star::uno::Referen
}
}
xPropSet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_VALIXML)), uno::makeAny(xPropertySet));
+
+ // For now, any sheet with validity is blocked from stream-copying.
+ // Later, the validation names could be stored along with the style names.
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetImport().GetModel())->GetSheetSaveData();
+ pSheetData->BlockSheet( GetScImport().GetTables().GetCurrentSheet() );
}
}
}
@@ -676,6 +682,18 @@ void ScXMLTableRowCellContext::SetAnnotation(const table::CellAddress& aCellAddr
uno::Reference< drawing::XShape > xShape;
rXMLImport.GetShapeImport()->shapeWithZIndexAdded( xShape, xShapesIA->getCount() );
}
+
+ // store the style names for stream copying
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rXMLImport.GetModel())->GetSheetSaveData();
+ pSheetData->HandleNoteStyles( mxAnnotationData->maStyleName, mxAnnotationData->maTextStyle, aPos );
+
+ std::vector<ScXMLAnnotationStyleEntry>::const_iterator aIter = mxAnnotationData->maContentStyles.begin();
+ std::vector<ScXMLAnnotationStyleEntry>::const_iterator aEnd = mxAnnotationData->maContentStyles.end();
+ while (aIter != aEnd)
+ {
+ pSheetData->AddNoteContentStyle( aIter->mnFamily, aIter->maName, aPos, aIter->maSelection );
+ ++aIter;
+ }
}
// core implementation
diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx
index 31662f4e68dd..73c06f23a7bf 100644
--- a/sc/source/filter/xml/xmlcoli.cxx
+++ b/sc/source/filter/xml/xmlcoli.cxx
@@ -42,6 +42,7 @@
#include "document.hxx"
#include "docuno.hxx"
#include "olinetab.hxx"
+#include "sheetdata.hxx"
#include "unonames.hxx"
#include <xmloff/xmltkmap.hxx>
@@ -145,7 +146,7 @@ SvXMLImportContext *ScXMLTableColContext::CreateChildContext( USHORT nPrefix,
void ScXMLTableColContext::EndElement()
{
ScXMLImport& rXMLImport = GetScImport();
- //sal_Int32 nSheet = rXMLImport.GetTables().GetCurrentSheet();
+ sal_Int32 nSheet = rXMLImport.GetTables().GetCurrentSheet();
sal_Int32 nCurrentColumn = rXMLImport.GetTables().GetCurrentColumn();
uno::Reference<sheet::XSpreadsheet> xSheet(rXMLImport.GetTables().GetCurrentXSheet());
if(xSheet.is())
@@ -169,7 +170,16 @@ void ScXMLTableColContext::EndElement()
XMLTableStyleContext* pStyle = (XMLTableStyleContext *)pStyles->FindStyleChildContext(
XML_STYLE_FAMILY_TABLE_COLUMN, sStyleName, sal_True);
if (pStyle)
+ {
pStyle->FillPropertySet(xColumnProperties);
+
+ if ( nSheet != pStyle->GetLastSheet() )
+ {
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rXMLImport.GetModel())->GetSheetSaveData();
+ pSheetData->AddColumnStyle( sStyleName, ScAddress( (SCCOL)nCurrentColumn, 0, (SCTAB)nSheet ) );
+ pStyle->SetLastSheet(nSheet);
+ }
+ }
}
}
rtl::OUString sVisible(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLVIS));
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 98965cba07bc..df7e99955bfd 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -53,10 +53,12 @@
#include "XMLColumnRowGroupExport.hxx"
#include "XMLStylesExportHelper.hxx"
#include "XMLChangeTrackingExportHelper.hxx"
+#include "sheetdata.hxx"
#include "docoptio.hxx"
#include "XMLExportSharedData.hxx"
#include "chgviset.hxx"
#include "docuno.hxx"
+#include "textuno.hxx"
#include "chartlis.hxx"
#include "unoguard.hxx"
#include "scitems.hxx"
@@ -80,6 +82,7 @@
#include <xmloff/xmluconv.hxx>
#include <xmloff/txtparae.hxx>
#include <xmloff/xmlcnitm.hxx>
+#include <xmloff/xmlerror.hxx>
#include <rtl/ustring.hxx>
@@ -122,6 +125,8 @@
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/sheet/XSheetLinkable.hpp>
#include <com/sun/star/form/XFormsSupplier2.hpp>
+#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
@@ -452,6 +457,7 @@ ScXMLExport::ScXMLExport(
const sal_uInt16 nExportFlag)
: SvXMLExport( xServiceFactory, SvXMLUnitConverter::GetMapUnit(GetFieldUnit()), XML_SPREADSHEET, nExportFlag ),
pDoc(NULL),
+ nSourceStreamPos(0),
pNumberFormatAttributesExportHelper(NULL),
pSharedData(NULL),
pColumnStyles(NULL),
@@ -567,6 +573,45 @@ ScXMLExport::~ScXMLExport()
delete pNumberFormatAttributesExportHelper;
}
+void ScXMLExport::SetSourceStream( const uno::Reference<io::XInputStream>& xNewStream )
+{
+ xSourceStream = xNewStream;
+
+ if ( xSourceStream.is() )
+ {
+ // make sure it's a plain UTF-8 stream as written by OOo itself
+
+ const sal_Char pXmlHeader[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+ sal_Int32 nLen = strlen(pXmlHeader);
+
+ uno::Sequence<sal_Int8> aFileStart(nLen);
+ sal_Int32 nRead = xSourceStream->readBytes( aFileStart, nLen );
+
+ if ( nRead != nLen || rtl_compareMemory( aFileStart.getConstArray(), pXmlHeader, nLen ) != 0 )
+ {
+ // invalid - ignore stream, save normally
+ xSourceStream.clear();
+ }
+ else
+ {
+ // keep track of the bytes already read
+ nSourceStreamPos = nRead;
+
+ const ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
+ if (pSheetData)
+ {
+ // add the loaded namespaces to the name space map
+
+ if ( !pSheetData->AddLoadedNamespaces( _GetNamespaceMap() ) )
+ {
+ // conflicts in the namespaces - ignore the stream, save normally
+ xSourceStream.clear();
+ }
+ }
+ }
+ }
+}
+
sal_Int32 ScXMLExport::GetNumberFormatStyleIndex(sal_Int32 nNumFmt) const
{
NumberFormatIndexMap::const_iterator itr = aNumFmtIndexMap.find(nNumFmt);
@@ -803,7 +848,7 @@ void ScXMLExport::_ExportFontDecls()
SvXMLExport::_ExportFontDecls();
}
-table::CellRangeAddress ScXMLExport::GetEndAddress(uno::Reference<sheet::XSpreadsheet>& xTable, const sal_Int32 /* nTable */)
+table::CellRangeAddress ScXMLExport::GetEndAddress(const uno::Reference<sheet::XSpreadsheet>& xTable, const sal_Int32 /* nTable */)
{
table::CellRangeAddress aCellAddress;
uno::Reference<sheet::XSheetCellCursor> xCursor(xTable->createCursor());
@@ -1481,6 +1526,95 @@ void ScXMLExport::SetBodyAttributes()
}
}
+static bool lcl_CopyStreamElement( const uno::Reference< io::XInputStream >& xInput,
+ const uno::Reference< io::XOutputStream >& xOutput,
+ sal_Int32 nCount )
+{
+ const sal_Int32 nBufSize = 16*1024;
+ uno::Sequence<sal_Int8> aSequence(nBufSize);
+
+ sal_Int32 nRemaining = nCount;
+ bool bFirst = true;
+
+ while ( nRemaining > 0 )
+ {
+ sal_Int32 nRead = xInput->readBytes( aSequence, std::min( nRemaining, nBufSize ) );
+ if (bFirst)
+ {
+ // safety check: Make sure the copied part actually points to the start of an element
+ if ( nRead < 1 || aSequence[0] != static_cast<sal_Int8>('<') )
+ {
+ return false; // abort and set an error
+ }
+ bFirst = false;
+ }
+ if (nRead == nRemaining)
+ {
+ // safety check: Make sure the copied part also ends at the end of an element
+ if ( aSequence[nRead-1] != static_cast<sal_Int8>('>') )
+ {
+ return false; // abort and set an error
+ }
+ }
+
+ if ( nRead == nBufSize )
+ {
+ xOutput->writeBytes( aSequence );
+ nRemaining -= nRead;
+ }
+ else
+ {
+ if ( nRead > 0 )
+ {
+ uno::Sequence<sal_Int8> aTempBuf( aSequence.getConstArray(), nRead );
+ xOutput->writeBytes( aTempBuf );
+ }
+ nRemaining = 0;
+ }
+ }
+ return true; // successful
+}
+
+void ScXMLExport::CopySourceStream( sal_Int32 nStartOffset, sal_Int32 nEndOffset, sal_Int32& rNewStart, sal_Int32& rNewEnd )
+{
+ uno::Reference<xml::sax::XDocumentHandler> xHandler = GetDocHandler();
+ uno::Reference<io::XActiveDataSource> xDestSource( xHandler, uno::UNO_QUERY );
+ if ( xDestSource.is() )
+ {
+ uno::Reference<io::XOutputStream> xDestStream = xDestSource->getOutputStream();
+ uno::Reference<io::XSeekable> xDestSeek( xDestStream, uno::UNO_QUERY );
+ if ( xDestSeek.is() )
+ {
+ // temporary: set same stream again to clear buffer
+ xDestSource->setOutputStream( xDestStream );
+
+ if ( getExportFlags() & EXPORT_PRETTY )
+ {
+ ByteString aOutStr("\n ");
+ uno::Sequence<sal_Int8> aOutSeq( (sal_Int8*)aOutStr.GetBuffer(), aOutStr.Len() );
+ xDestStream->writeBytes( aOutSeq );
+ }
+
+ rNewStart = (sal_Int32)xDestSeek->getPosition();
+
+ if ( nStartOffset > nSourceStreamPos )
+ xSourceStream->skipBytes( nStartOffset - nSourceStreamPos );
+
+ if ( !lcl_CopyStreamElement( xSourceStream, xDestStream, nEndOffset - nStartOffset ) )
+ {
+ // If copying went wrong, set an error.
+ // ScXMLImportWrapper then resets all stream flags, so the next save attempt will use normal saving.
+
+ uno::Sequence<OUString> aEmptySeq;
+ SetError(XMLERROR_CANCEL|XMLERROR_FLAG_SEVERE, aEmptySeq);
+ }
+ nSourceStreamPos = nEndOffset;
+
+ rNewEnd = (sal_Int32)xDestSeek->getPosition();
+ }
+ }
+}
+
void ScXMLExport::_ExportContent()
{
nCurrentTable = 0;
@@ -1500,6 +1634,10 @@ void ScXMLExport::_ExportContent()
if ( !xSpreadDoc.is() )
return;
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(xSpreadDoc)->GetSheetSaveData();
+ if (pSheetData)
+ pSheetData->ResetSaveEntries();
+
uno::Reference<container::XIndexAccess> xIndex( xSpreadDoc->getSheets(), uno::UNO_QUERY );
if ( xIndex.is() )
{
@@ -1531,6 +1669,27 @@ void ScXMLExport::_ExportContent()
WriteTheLabelRanges( xSpreadDoc );
for (sal_Int32 nTable = 0; nTable < nTableCount; ++nTable)
{
+ sal_Int32 nStartOffset = -1;
+ sal_Int32 nEndOffset = -1;
+ if (pSheetData && pDoc && pDoc->IsStreamValid((SCTAB)nTable))
+ pSheetData->GetStreamPos( nTable, nStartOffset, nEndOffset );
+
+ if ( nStartOffset >= 0 && nEndOffset >= 0 && xSourceStream.is() )
+ {
+ sal_Int32 nNewStart = -1;
+ sal_Int32 nNewEnd = -1;
+ CopySourceStream( nStartOffset, nEndOffset, nNewStart, nNewEnd );
+
+ // store position of copied sheet in output
+ pSheetData->AddSavePos( nTable, nNewStart, nNewEnd );
+
+ // skip iterator entries for this sheet
+ pCellsItr->SkipTable(static_cast<SCTAB>(nTable));
+ }
+ else
+ {
+ //! indent after rebasing to m52
+
uno::Reference<sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY);
if (xTable.is())
{
@@ -1653,6 +1812,8 @@ void ScXMLExport::_ExportContent()
nEqualCells = 0;
}
}
+
+ }
IncrementProgressBar(sal_False);
}
}
@@ -1729,6 +1890,245 @@ void ScXMLExport::_ExportStyles( sal_Bool bUsed )
SvXMLExport::_ExportStyles(bUsed);
}
+void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& xProperties,
+ const uno::Reference<sheet::XSpreadsheet>& xTable,
+ sal_Int32 nTable, const rtl::OUString* pOldName)
+{
+ //! pass xCellRanges instead
+ uno::Reference<sheet::XSheetCellRanges> xCellRanges( xProperties, uno::UNO_QUERY );
+
+ rtl::OUString SC_SCELLPREFIX(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX));
+ rtl::OUString SC_NUMBERFORMAT(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_NUMFMT));
+
+ rtl::OUString sStyleName;
+ sal_Int32 nNumberFormat(-1);
+ sal_Int32 nValidationIndex(-1);
+ std::vector< XMLPropertyState > xPropStates(xCellStylesExportPropertySetMapper->Filter( xProperties ));
+ std::vector< XMLPropertyState >::iterator aItr(xPropStates.begin());
+ std::vector< XMLPropertyState >::iterator aEndItr(xPropStates.end());
+ sal_Int32 nCount(0);
+ while (aItr != aEndItr)
+ {
+ if (aItr->mnIndex != -1)
+ {
+ switch (xCellStylesPropertySetMapper->GetEntryContextId(aItr->mnIndex))
+ {
+ case CTF_SC_VALIDATION :
+ {
+ pValidationsContainer->AddValidation(aItr->maValue, nValidationIndex);
+ // this is not very slow, because it is most the last property or
+ // if it is not the last property it is the property before the last property,
+ // so in the worst case only one property has to be copied, but in the best case no
+ // property has to be copied
+ aItr = xPropStates.erase(aItr);
+ aEndItr = xPropStates.end(); // #120346# old aEndItr is invalidated!
+ }
+ break;
+ case CTF_SC_CELLSTYLE :
+ {
+ aItr->maValue >>= sStyleName;
+ aItr->mnIndex = -1;
+ ++aItr;
+ ++nCount;
+ }
+ break;
+ case CTF_SC_NUMBERFORMAT :
+ {
+ if (aItr->maValue >>= nNumberFormat)
+ addDataStyle(nNumberFormat);
+ ++aItr;
+ ++nCount;
+ }
+ break;
+ default:
+ {
+ ++aItr;
+ ++nCount;
+ }
+ break;
+ }
+ }
+ else
+ {
+ ++aItr;
+ ++nCount;
+ }
+ }
+ if (nCount == 1) // this is the CellStyle and should be removed if alone
+ xPropStates.clear();
+ if (nNumberFormat == -1)
+ xProperties->getPropertyValue(SC_NUMBERFORMAT) >>= nNumberFormat;
+ if (sStyleName.getLength())
+ {
+ if (xPropStates.size())
+ {
+ sal_Int32 nIndex;
+ if (pOldName)
+ {
+ if (GetAutoStylePool()->AddNamed(*pOldName, XML_STYLE_FAMILY_TABLE_CELL, sStyleName, xPropStates))
+ {
+ GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TABLE_CELL, *pOldName);
+ // add to pCellStyles, so the name is found for normal sheets
+ rtl::OUString* pTemp(new rtl::OUString(*pOldName));
+ if (!pCellStyles->AddStyleName(pTemp, nIndex))
+ delete pTemp;
+ }
+ }
+ else
+ {
+ rtl::OUString sName;
+ sal_Bool bIsAutoStyle(sal_True);
+ if (GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_CELL, sStyleName, xPropStates))
+ {
+ rtl::OUString* pTemp(new rtl::OUString(sName));
+ if (!pCellStyles->AddStyleName(pTemp, nIndex))
+ delete pTemp;
+ }
+ else
+ nIndex = pCellStyles->GetIndexOfStyleName(sName, SC_SCELLPREFIX, bIsAutoStyle);
+
+ uno::Sequence<table::CellRangeAddress> aAddresses(xCellRanges->getRangeAddresses());
+ table::CellRangeAddress* pAddresses(aAddresses.getArray());
+ sal_Bool bGetMerge(sal_True);
+ for (sal_Int32 i = 0; i < aAddresses.getLength(); ++i, ++pAddresses)
+ {
+ pSharedData->SetLastColumn(nTable, pAddresses->EndColumn);
+ pSharedData->SetLastRow(nTable, pAddresses->EndRow);
+ pCellStyles->AddRangeStyleName(*pAddresses, nIndex, bIsAutoStyle, nValidationIndex, nNumberFormat);
+ if (bGetMerge)
+ bGetMerge = GetMerged(pAddresses, xTable);
+ }
+ }
+ }
+ else
+ {
+ rtl::OUString* pTemp(new rtl::OUString(EncodeStyleName(sStyleName)));
+ sal_Int32 nIndex(0);
+ if (!pCellStyles->AddStyleName(pTemp, nIndex, sal_False))
+ {
+ delete pTemp;
+ pTemp = NULL;
+ }
+ if ( !pOldName )
+ {
+ uno::Sequence<table::CellRangeAddress> aAddresses(xCellRanges->getRangeAddresses());
+ table::CellRangeAddress* pAddresses(aAddresses.getArray());
+ sal_Bool bGetMerge(sal_True);
+ for (sal_Int32 i = 0; i < aAddresses.getLength(); ++i, ++pAddresses)
+ {
+ if (bGetMerge)
+ bGetMerge = GetMerged(pAddresses, xTable);
+ pCellStyles->AddRangeStyleName(*pAddresses, nIndex, sal_False, nValidationIndex, nNumberFormat);
+ if (!sStyleName.equalsAsciiL("Default", 7) || nValidationIndex != -1)
+ {
+ pSharedData->SetLastColumn(nTable, pAddresses->EndColumn);
+ pSharedData->SetLastRow(nTable, pAddresses->EndRow);
+ }
+ }
+ }
+ }
+ }
+}
+
+void ScXMLExport::AddStyleFromColumn(const uno::Reference<beans::XPropertySet>& xColumnProperties,
+ const rtl::OUString* pOldName, sal_Int32& rIndex, sal_Bool& rIsVisible)
+{
+ rtl::OUString SC_SCOLUMNPREFIX(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX));
+
+ std::vector<XMLPropertyState> xPropStates(xColumnStylesExportPropertySetMapper->Filter(xColumnProperties));
+ if(xPropStates.size())
+ {
+ std::vector< XMLPropertyState >::iterator aItr(xPropStates.begin());
+ std::vector< XMLPropertyState >::iterator aEndItr(xPropStates.end());
+ while (aItr != aEndItr)
+ {
+ if (xColumnStylesPropertySetMapper->GetEntryContextId(aItr->mnIndex) == CTF_SC_ISVISIBLE)
+ {
+ aItr->maValue >>= rIsVisible;
+ break;
+ }
+ ++aItr;
+ }
+
+ rtl::OUString sParent;
+ if (pOldName)
+ {
+ if (GetAutoStylePool()->AddNamed(*pOldName, XML_STYLE_FAMILY_TABLE_COLUMN, sParent, xPropStates))
+ {
+ GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TABLE_COLUMN, *pOldName);
+ // add to pColumnStyles, so the name is found for normal sheets
+ rtl::OUString* pTemp(new rtl::OUString(*pOldName));
+ rIndex = pColumnStyles->AddStyleName(pTemp);
+ }
+ }
+ else
+ {
+ rtl::OUString sName;
+ if (GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_COLUMN, sParent, xPropStates))
+ {
+ rtl::OUString* pTemp(new rtl::OUString(sName));
+ rIndex = pColumnStyles->AddStyleName(pTemp);
+ }
+ else
+ rIndex = pColumnStyles->GetIndexOfStyleName(sName, SC_SCOLUMNPREFIX);
+ }
+ }
+}
+
+void ScXMLExport::AddStyleFromRow(const uno::Reference<beans::XPropertySet>& xRowProperties,
+ const rtl::OUString* pOldName, sal_Int32& rIndex)
+{
+ rtl::OUString SC_SROWPREFIX(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX));
+
+ std::vector<XMLPropertyState> xPropStates(xRowStylesExportPropertySetMapper->Filter(xRowProperties));
+ if(xPropStates.size())
+ {
+ rtl::OUString sParent;
+ if (pOldName)
+ {
+ if (GetAutoStylePool()->AddNamed(*pOldName, XML_STYLE_FAMILY_TABLE_ROW, sParent, xPropStates))
+ {
+ GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TABLE_ROW, *pOldName);
+ // add to pRowStyles, so the name is found for normal sheets
+ rtl::OUString* pTemp(new rtl::OUString(*pOldName));
+ rIndex = pRowStyles->AddStyleName(pTemp);
+ }
+ }
+ else
+ {
+ rtl::OUString sName;
+ if (GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_ROW, sParent, xPropStates))
+ {
+ rtl::OUString* pTemp(new rtl::OUString(sName));
+ rIndex = pRowStyles->AddStyleName(pTemp);
+ }
+ else
+ rIndex = pRowStyles->GetIndexOfStyleName(sName, SC_SROWPREFIX);
+ }
+ }
+}
+
+uno::Any lcl_GetEnumerated( uno::Reference<container::XEnumerationAccess> xEnumAccess, sal_Int32 nIndex )
+{
+ uno::Any aRet;
+ uno::Reference<container::XEnumeration> xEnum( xEnumAccess->createEnumeration() );
+ try
+ {
+ sal_Int32 nSkip = nIndex;
+ while ( nSkip > 0 )
+ {
+ (void) xEnum->nextElement();
+ --nSkip;
+ }
+ aRet = xEnum->nextElement();
+ }
+ catch (container::NoSuchElementException&)
+ {
+ // leave aRet empty
+ }
+ return aRet;
+}
+
void ScXMLExport::_ExportAutoStyles()
{
if (GetModel().is())
@@ -1741,6 +2141,272 @@ void ScXMLExport::_ExportAutoStyles()
{
if (getExportFlags() & EXPORT_CONTENT)
{
+ // re-create automatic styles with old names from stored data
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(xSpreadDoc)->GetSheetSaveData();
+ if (pSheetData && pDoc)
+ {
+ // formulas have to be calculated now, to detect changed results
+ // (during normal save, they will be calculated anyway)
+ SCTAB nTabCount = pDoc->GetTableCount();
+ for (SCTAB nTab=0; nTab<nTabCount; ++nTab)
+ if (pDoc->IsStreamValid(nTab))
+ {
+ ScCellIterator aIter( pDoc, 0,0,nTab, MAXCOL,MAXROW,nTab );
+ ScBaseCell* pCell = aIter.GetFirst();
+ while (pCell)
+ {
+ if (pCell->GetCellType() == CELLTYPE_FORMULA)
+ static_cast<ScFormulaCell*>(pCell)->IsValue(); // interpret if dirty
+ pCell = aIter.GetNext();
+ }
+ }
+
+ // stored cell styles
+ const std::vector<ScCellStyleEntry>& rCellEntries = pSheetData->GetCellStyles();
+ std::vector<ScCellStyleEntry>::const_iterator aCellIter = rCellEntries.begin();
+ std::vector<ScCellStyleEntry>::const_iterator aCellEnd = rCellEntries.end();
+ while (aCellIter != aCellEnd)
+ {
+ ScAddress aPos = aCellIter->maCellPos;
+ sal_Int32 nTable = aPos.Tab();
+ bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) );
+ if (bCopySheet)
+ {
+ uno::Reference <sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY);
+ uno::Reference <beans::XPropertySet> xProperties(
+ xTable->getCellByPosition( aPos.Col(), aPos.Row() ), uno::UNO_QUERY );
+
+ AddStyleFromCells(xProperties, xTable, nTable, &aCellIter->maName);
+ }
+ ++aCellIter;
+ }
+
+ // stored column styles
+ const std::vector<ScCellStyleEntry>& rColumnEntries = pSheetData->GetColumnStyles();
+ std::vector<ScCellStyleEntry>::const_iterator aColumnIter = rColumnEntries.begin();
+ std::vector<ScCellStyleEntry>::const_iterator aColumnEnd = rColumnEntries.end();
+ while (aColumnIter != aColumnEnd)
+ {
+ ScAddress aPos = aColumnIter->maCellPos;
+ sal_Int32 nTable = aPos.Tab();
+ bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) );
+ if (bCopySheet)
+ {
+ uno::Reference<table::XColumnRowRange> xColumnRowRange(xIndex->getByIndex(nTable), uno::UNO_QUERY);
+ uno::Reference<table::XTableColumns> xTableColumns(xColumnRowRange->getColumns());
+ uno::Reference<beans::XPropertySet> xColumnProperties(xTableColumns->getByIndex( aPos.Col() ), uno::UNO_QUERY);
+
+ sal_Int32 nIndex(-1);
+ sal_Bool bIsVisible(sal_True);
+ AddStyleFromColumn( xColumnProperties, &aColumnIter->maName, nIndex, bIsVisible );
+ }
+ ++aColumnIter;
+ }
+
+ // stored row styles
+ const std::vector<ScCellStyleEntry>& rRowEntries = pSheetData->GetRowStyles();
+ std::vector<ScCellStyleEntry>::const_iterator aRowIter = rRowEntries.begin();
+ std::vector<ScCellStyleEntry>::const_iterator aRowEnd = rRowEntries.end();
+ while (aRowIter != aRowEnd)
+ {
+ ScAddress aPos = aRowIter->maCellPos;
+ sal_Int32 nTable = aPos.Tab();
+ bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) );
+ if (bCopySheet)
+ {
+ uno::Reference<table::XColumnRowRange> xColumnRowRange(xIndex->getByIndex(nTable), uno::UNO_QUERY);
+ uno::Reference<table::XTableRows> xTableRows(xColumnRowRange->getRows());
+ uno::Reference<beans::XPropertySet> xRowProperties(xTableRows->getByIndex( aPos.Row() ), uno::UNO_QUERY);
+
+ sal_Int32 nIndex(-1);
+ AddStyleFromRow( xRowProperties, &aRowIter->maName, nIndex );
+ }
+ ++aRowIter;
+ }
+
+ // stored table styles
+ const std::vector<ScCellStyleEntry>& rTableEntries = pSheetData->GetTableStyles();
+ std::vector<ScCellStyleEntry>::const_iterator aTableIter = rTableEntries.begin();
+ std::vector<ScCellStyleEntry>::const_iterator aTableEnd = rTableEntries.end();
+ while (aTableIter != aTableEnd)
+ {
+ ScAddress aPos = aTableIter->maCellPos;
+ sal_Int32 nTable = aPos.Tab();
+ bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) );
+ if (bCopySheet)
+ {
+ //! separate method AddStyleFromTable needed?
+ uno::Reference<beans::XPropertySet> xTableProperties(xIndex->getByIndex(nTable), uno::UNO_QUERY);
+ if (xTableProperties.is())
+ {
+ std::vector<XMLPropertyState> xPropStates(xTableStylesExportPropertySetMapper->Filter(xTableProperties));
+ rtl::OUString sParent;
+ rtl::OUString sName( aTableIter->maName );
+ GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TABLE_TABLE, sParent, xPropStates);
+ GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TABLE_TABLE, sName);
+ }
+ }
+ ++aTableIter;
+ }
+
+ // stored styles for notes
+
+ UniReference<SvXMLExportPropertyMapper> xShapeMapper = XMLShapeExport::CreateShapePropMapper( *this );
+ GetShapeExport(); // make sure the graphics styles family is added
+
+ const std::vector<ScNoteStyleEntry>& rNoteEntries = pSheetData->GetNoteStyles();
+ std::vector<ScNoteStyleEntry>::const_iterator aNoteIter = rNoteEntries.begin();
+ std::vector<ScNoteStyleEntry>::const_iterator aNoteEnd = rNoteEntries.end();
+ while (aNoteIter != aNoteEnd)
+ {
+ ScAddress aPos = aNoteIter->maCellPos;
+ sal_Int32 nTable = aPos.Tab();
+ bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) );
+ if (bCopySheet)
+ {
+ //! separate method AddStyleFromNote needed?
+
+ ScPostIt* pNote = pDoc->GetNote( aPos );
+ DBG_ASSERT( pNote, "note not found" );
+ if (pNote)
+ {
+ SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos );
+ // all uno shapes are created anyway in CollectSharedData
+ uno::Reference<beans::XPropertySet> xShapeProperties( pDrawObj->getUnoShape(), uno::UNO_QUERY );
+ if (xShapeProperties.is())
+ {
+ if ( aNoteIter->maStyleName.getLength() )
+ {
+ std::vector<XMLPropertyState> xPropStates(xShapeMapper->Filter(xShapeProperties));
+ rtl::OUString sParent;
+ rtl::OUString sName( aNoteIter->maStyleName );
+ GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_SD_GRAPHICS_ID, sParent, xPropStates);
+ GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_SD_GRAPHICS_ID, sName);
+ }
+ if ( aNoteIter->maTextStyle.getLength() )
+ {
+ std::vector<XMLPropertyState> xPropStates(
+ GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter(xShapeProperties));
+ rtl::OUString sParent;
+ rtl::OUString sName( aNoteIter->maTextStyle );
+ GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_PARAGRAPH, sParent, xPropStates);
+ GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_PARAGRAPH, sName);
+ }
+ }
+ }
+ }
+ ++aNoteIter;
+ }
+
+ // note paragraph styles
+
+ //UniReference<SvXMLExportPropertyMapper> xParaPropMapper = XMLTextParagraphExport::CreateParaExtPropMapper( *this );
+ UniReference<SvXMLExportPropertyMapper> xParaPropMapper = GetTextParagraphExport()->GetParagraphPropertyMapper();
+
+ const std::vector<ScTextStyleEntry>& rNoteParaEntries = pSheetData->GetNoteParaStyles();
+ std::vector<ScTextStyleEntry>::const_iterator aNoteParaIter = rNoteParaEntries.begin();
+ std::vector<ScTextStyleEntry>::const_iterator aNoteParaEnd = rNoteParaEntries.end();
+ while (aNoteParaIter != aNoteParaEnd)
+ {
+ ScAddress aPos = aNoteParaIter->maCellPos;
+ sal_Int32 nTable = aPos.Tab();
+ bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) );
+ if (bCopySheet)
+ {
+ ScPostIt* pNote = pDoc->GetNote( aPos );
+ DBG_ASSERT( pNote, "note not found" );
+ if (pNote)
+ {
+ SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos );
+ uno::Reference<container::XEnumerationAccess> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xParaProp(
+ lcl_GetEnumerated( xCellText, aNoteParaIter->maSelection.nStartPara ), uno::UNO_QUERY );
+ if ( xParaProp.is() )
+ {
+ std::vector<XMLPropertyState> xPropStates(xParaPropMapper->Filter(xParaProp));
+ rtl::OUString sParent;
+ rtl::OUString sName( aNoteParaIter->maName );
+ GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_PARAGRAPH, sParent, xPropStates);
+ GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_PARAGRAPH, sName);
+ }
+ }
+ }
+ ++aNoteParaIter;
+ }
+
+ // note text styles
+
+ UniReference<SvXMLExportPropertyMapper> xTextPropMapper = XMLTextParagraphExport::CreateCharExtPropMapper( *this );
+
+ const std::vector<ScTextStyleEntry>& rNoteTextEntries = pSheetData->GetNoteTextStyles();
+ std::vector<ScTextStyleEntry>::const_iterator aNoteTextIter = rNoteTextEntries.begin();
+ std::vector<ScTextStyleEntry>::const_iterator aNoteTextEnd = rNoteTextEntries.end();
+ while (aNoteTextIter != aNoteTextEnd)
+ {
+ ScAddress aPos = aNoteTextIter->maCellPos;
+ sal_Int32 nTable = aPos.Tab();
+ bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) );
+ if (bCopySheet)
+ {
+ ScPostIt* pNote = pDoc->GetNote( aPos );
+ DBG_ASSERT( pNote, "note not found" );
+ if (pNote)
+ {
+ SdrCaptionObj* pDrawObj = pNote->GetOrCreateCaption( aPos );
+ uno::Reference<text::XSimpleText> xCellText(pDrawObj->getUnoShape(), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xCursorProp(xCellText->createTextCursor(), uno::UNO_QUERY);
+ ScDrawTextCursor* pCursor = ScDrawTextCursor::getImplementation( xCursorProp );
+ if (pCursor)
+ {
+ pCursor->SetSelection( aNoteTextIter->maSelection );
+
+ std::vector<XMLPropertyState> xPropStates(xTextPropMapper->Filter(xCursorProp));
+ rtl::OUString sParent;
+ rtl::OUString sName( aNoteTextIter->maName );
+ GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_TEXT, sParent, xPropStates);
+ GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_TEXT, sName);
+ }
+ }
+ }
+ ++aNoteTextIter;
+ }
+
+ // stored text styles
+
+ //UniReference<SvXMLExportPropertyMapper> xTextPropMapper = XMLTextParagraphExport::CreateCharExtPropMapper( *this );
+
+ const std::vector<ScTextStyleEntry>& rTextEntries = pSheetData->GetTextStyles();
+ std::vector<ScTextStyleEntry>::const_iterator aTextIter = rTextEntries.begin();
+ std::vector<ScTextStyleEntry>::const_iterator aTextEnd = rTextEntries.end();
+ while (aTextIter != aTextEnd)
+ {
+ ScAddress aPos = aTextIter->maCellPos;
+ sal_Int32 nTable = aPos.Tab();
+ bool bCopySheet = pDoc->IsStreamValid( static_cast<SCTAB>(nTable) );
+ if (bCopySheet)
+ {
+ //! separate method AddStyleFromText needed?
+ //! cache sheet object
+
+ uno::Reference<table::XCellRange> xCellRange(xIndex->getByIndex(nTable), uno::UNO_QUERY);
+ uno::Reference<text::XSimpleText> xCellText(xCellRange->getCellByPosition(aPos.Col(), aPos.Row()), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xCursorProp(xCellText->createTextCursor(), uno::UNO_QUERY);
+ ScCellTextCursor* pCursor = ScCellTextCursor::getImplementation( xCursorProp );
+ if (pCursor)
+ {
+ pCursor->SetSelection( aTextIter->maSelection );
+
+ std::vector<XMLPropertyState> xPropStates(xTextPropMapper->Filter(xCursorProp));
+ rtl::OUString sParent;
+ rtl::OUString sName( aTextIter->maName );
+ GetAutoStylePool()->AddNamed(sName, XML_STYLE_FAMILY_TEXT_TEXT, sParent, xPropStates);
+ GetAutoStylePool()->RegisterName(XML_STYLE_FAMILY_TEXT_TEXT, sName);
+ }
+ }
+ ++aTextIter;
+ }
+ }
+
ExportExternalRefCacheStyles();
if (!pSharedData)
@@ -1751,18 +2417,18 @@ void ScXMLExport::_ExportAutoStyles()
CollectSharedData(nTableCount, nShapesCount, nCellCount);
//DBG_ERROR("no shared data setted");
}
- rtl::OUString SC_SCOLUMNPREFIX(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX));
- rtl::OUString SC_SROWPREFIX(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX));
- rtl::OUString SC_SCELLPREFIX(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX));
- rtl::OUString SC_NUMBERFORMAT(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_NUMFMT));
sal_Int32 nTableCount(xIndex->getCount());
pCellStyles->AddNewTable(nTableCount - 1);
CollectShapesAutoStyles(nTableCount);
for (sal_Int32 nTable = 0; nTable < nTableCount; ++nTable)
{
+ bool bUseStream = pSheetData && pDoc && pDoc->IsStreamValid((SCTAB)nTable) &&
+ pSheetData->HasStreamPos(nTable) && xSourceStream.is();
+
uno::Reference <sheet::XSpreadsheet> xTable(xIndex->getByIndex(nTable), uno::UNO_QUERY);
if (xTable.is())
{
+ // table styles array must be complete, including copied tables - Add should find the stored style
uno::Reference<beans::XPropertySet> xTableProperties(xTable, uno::UNO_QUERY);
if (xTableProperties.is())
{
@@ -1775,7 +2441,11 @@ void ScXMLExport::_ExportAutoStyles()
aTableStyles.push_back(sName);
}
}
- uno::Reference<sheet::XUniqueCellFormatRangesSupplier> xCellFormatRanges ( xTableProperties, uno::UNO_QUERY );
+ }
+ // collect other auto-styles only for non-copied sheets
+ if (xTable.is() && !bUseStream)
+ {
+ uno::Reference<sheet::XUniqueCellFormatRangesSupplier> xCellFormatRanges ( xTable, uno::UNO_QUERY );
if ( xCellFormatRanges.is() )
{
uno::Reference<container::XIndexAccess> xFormatRangesIndex(xCellFormatRanges->getUniqueCellFormatRanges());
@@ -1791,123 +2461,14 @@ void ScXMLExport::_ExportAutoStyles()
uno::Reference <beans::XPropertySet> xProperties (xCellRanges, uno::UNO_QUERY);
if (xProperties.is())
{
- rtl::OUString sStyleName;
- sal_Int32 nNumberFormat(-1);
- sal_Int32 nValidationIndex(-1);
- std::vector< XMLPropertyState > xPropStates(xCellStylesExportPropertySetMapper->Filter( xProperties ));
- std::vector< XMLPropertyState >::iterator aItr(xPropStates.begin());
- std::vector< XMLPropertyState >::iterator aEndItr(xPropStates.end());
- sal_Int32 nCount(0);
- while (aItr != aEndItr)
- {
- if (aItr->mnIndex != -1)
- {
- switch (xCellStylesPropertySetMapper->GetEntryContextId(aItr->mnIndex))
- {
- case CTF_SC_VALIDATION :
- {
- pValidationsContainer->AddValidation(aItr->maValue, nValidationIndex);
- // this is not very slow, because it is most the last property or
- // if it is not the last property it is the property before the last property,
- // so in the worst case only one property has to be copied, but in the best case no
- // property has to be copied
- aItr = xPropStates.erase(aItr);
- aEndItr = xPropStates.end(); // #120346# old aEndItr is invalidated!
- }
- break;
- case CTF_SC_CELLSTYLE :
- {
- aItr->maValue >>= sStyleName;
- aItr->mnIndex = -1;
- ++aItr;
- ++nCount;
- }
- break;
- case CTF_SC_NUMBERFORMAT :
- {
- if (aItr->maValue >>= nNumberFormat)
- addDataStyle(nNumberFormat);
- ++aItr;
- ++nCount;
- }
- break;
- default:
- {
- ++aItr;
- ++nCount;
- }
- break;
- }
- }
- else
- {
- ++aItr;
- ++nCount;
- }
- }
- if (nCount == 1) // this is the CellStyle and should be removed if alone
- xPropStates.clear();
- if (nNumberFormat == -1)
- xProperties->getPropertyValue(SC_NUMBERFORMAT) >>= nNumberFormat;
- if (sStyleName.getLength())
- {
- if (xPropStates.size())
- {
- sal_Int32 nIndex;
- rtl::OUString sName;
- sal_Bool bIsAutoStyle(sal_True);
- if (GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_CELL, sStyleName, xPropStates))
- {
- rtl::OUString* pTemp(new rtl::OUString(sName));
- if (!pCellStyles->AddStyleName(pTemp, nIndex))
- delete pTemp;
- }
- else
- nIndex = pCellStyles->GetIndexOfStyleName(sName, SC_SCELLPREFIX, bIsAutoStyle);
- uno::Sequence<table::CellRangeAddress> aAddresses(xCellRanges->getRangeAddresses());
- table::CellRangeAddress* pAddresses(aAddresses.getArray());
- sal_Bool bGetMerge(sal_True);
- for (sal_Int32 i = 0; i < aAddresses.getLength(); ++i, ++pAddresses)
- {
- pSharedData->SetLastColumn(nTable, pAddresses->EndColumn);
- pSharedData->SetLastRow(nTable, pAddresses->EndRow);
- pCellStyles->AddRangeStyleName(*pAddresses, nIndex, bIsAutoStyle, nValidationIndex, nNumberFormat);
- if (bGetMerge)
- bGetMerge = GetMerged(pAddresses, xTable);
- }
- }
- else
- {
- rtl::OUString* pTemp(new rtl::OUString(EncodeStyleName(sStyleName)));
- sal_Int32 nIndex(0);
- if (!pCellStyles->AddStyleName(pTemp, nIndex, sal_False))
- {
- delete pTemp;
- pTemp = NULL;
- }
- uno::Sequence<table::CellRangeAddress> aAddresses(xCellRanges->getRangeAddresses());
- table::CellRangeAddress* pAddresses(aAddresses.getArray());
- sal_Bool bGetMerge(sal_True);
- for (sal_Int32 i = 0; i < aAddresses.getLength(); ++i, ++pAddresses)
- {
- if (bGetMerge)
- bGetMerge = GetMerged(pAddresses, xTable);
- pCellStyles->AddRangeStyleName(*pAddresses, nIndex, sal_False, nValidationIndex, nNumberFormat);
- if (!sStyleName.equalsAsciiL("Default", 7) || nValidationIndex != -1)
- {
- pSharedData->SetLastColumn(nTable, pAddresses->EndColumn);
- pSharedData->SetLastRow(nTable, pAddresses->EndRow);
- }
- }
- }
- }
+ AddStyleFromCells(xProperties, xTable, nTable, NULL);
IncrementProgressBar(sal_False);
}
}
}
}
}
- uno::Reference<table::XColumnRowRange> xColumnRowRange (xTableProperties, uno::UNO_QUERY);
+ uno::Reference<table::XColumnRowRange> xColumnRowRange (xTable, uno::UNO_QUERY);
if (xColumnRowRange.is())
{
if (pDoc)
@@ -1935,31 +2496,9 @@ void ScXMLExport::_ExportAutoStyles()
uno::Reference <beans::XPropertySet> xColumnProperties(xTableColumns->getByIndex(nColumn), uno::UNO_QUERY);
if (xColumnProperties.is())
{
- std::vector<XMLPropertyState> xPropStates(xColumnStylesExportPropertySetMapper->Filter(xColumnProperties));
- if(xPropStates.size())
- {
- std::vector< XMLPropertyState >::iterator aItr(xPropStates.begin());
- std::vector< XMLPropertyState >::iterator aEndItr(xPropStates.end());
- while (aItr != aEndItr)
- {
- if (xColumnStylesPropertySetMapper->GetEntryContextId(aItr->mnIndex) == CTF_SC_ISVISIBLE)
- {
- aItr->maValue >>= bIsVisible;
- break;
- }
- ++aItr;
- }
- rtl::OUString sParent;
- rtl::OUString sName;
- if (GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_COLUMN, sParent, xPropStates))
- {
- rtl::OUString* pTemp(new rtl::OUString(sName));
- nIndex = pColumnStyles->AddStyleName(pTemp);
- }
- else
- nIndex = pColumnStyles->GetIndexOfStyleName(sName, SC_SCOLUMNPREFIX);
- pColumnStyles->AddFieldStyleName(nTable, nColumn, nIndex, bIsVisible);
- }
+ AddStyleFromColumn( xColumnProperties, NULL, nIndex, bIsVisible );
+ //if(xPropStates.size())
+ pColumnStyles->AddFieldStyleName(nTable, nColumn, nIndex, bIsVisible);
}
sal_Int32 nOld(nColumn);
nColumn = pDoc->GetNextDifferentChangedCol(sal::static_int_cast<SCTAB>(nTable), static_cast<USHORT>(nColumn));
@@ -1996,20 +2535,9 @@ void ScXMLExport::_ExportAutoStyles()
uno::Reference <beans::XPropertySet> xRowProperties(xTableRows->getByIndex(nRow), uno::UNO_QUERY);
if(xRowProperties.is())
{
- std::vector<XMLPropertyState> xPropStates(xRowStylesExportPropertySetMapper->Filter(xRowProperties));
- if(xPropStates.size())
- {
- rtl::OUString sParent;
- rtl::OUString sName;
- if (GetAutoStylePool()->Add(sName, XML_STYLE_FAMILY_TABLE_ROW, sParent, xPropStates))
- {
- rtl::OUString* pTemp(new rtl::OUString(sName));
- nIndex = pRowStyles->AddStyleName(pTemp);
- }
- else
- nIndex = pRowStyles->GetIndexOfStyleName(sName, SC_SROWPREFIX);
- pRowStyles->AddFieldStyleName(nTable, nRow, nIndex);
- }
+ AddStyleFromRow( xRowProperties, NULL, nIndex );
+ //if(xPropStates.size())
+ pRowStyles->AddFieldStyleName(nTable, nRow, nIndex);
}
sal_Int32 nOld(nRow);
nRow = pDoc->GetNextDifferentChangedRow(sal::static_int_cast<SCTAB>(nTable), static_cast<USHORT>(nRow), false);
@@ -2025,7 +2553,7 @@ void ScXMLExport::_ExportAutoStyles()
}
}
}
- uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery (xTableProperties, uno::UNO_QUERY);
+ uno::Reference<sheet::XCellRangesQuery> xCellRangesQuery (xTable, uno::UNO_QUERY);
if (xCellRangesQuery.is())
{
uno::Reference<sheet::XSheetCellRanges> xSheetCellRanges(xCellRangesQuery->queryContentCells(sheet::CellFlags::FORMATTED));
@@ -3374,7 +3902,7 @@ void ScXMLExport::WriteExternalRefCaches()
return;
ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
- pRefMgr->resetSrcFileData();
+ pRefMgr->resetSrcFileData(GetOrigFileName());
sal_uInt16 nCount = pRefMgr->getExternalFileCount();
for (sal_uInt16 nFileId = 0; nFileId < nCount; ++nFileId)
{
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index d38bd7b23970..b71886c1871e 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -38,6 +38,10 @@
#include <com/sun/star/drawing/XShapes.hpp>
#include <com/sun/star/table/XCellRange.hpp>
+namespace com { namespace sun { namespace star {
+ namespace beans { class XPropertySet; }
+} } }
+
#include <hash_map>
class ScOutlineArray;
@@ -72,6 +76,9 @@ class ScXMLExport : public SvXMLExport
com::sun::star::uno::Reference <com::sun::star::sheet::XSpreadsheet> xCurrentTable;
com::sun::star::uno::Reference <com::sun::star::table::XCellRange> xCurrentTableCellRange;
+ com::sun::star::uno::Reference<com::sun::star::io::XInputStream> xSourceStream;
+ sal_Int32 nSourceStreamPos;
+
UniReference < XMLPropertyHandlerFactory > xScPropHdlFactory;
UniReference < XMLPropertySetMapper > xCellStylesPropertySetMapper;
UniReference < XMLPropertySetMapper > xColumnStylesPropertySetMapper;
@@ -139,7 +146,7 @@ class ScXMLExport : public SvXMLExport
void CollectInternalShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
- com::sun::star::table::CellRangeAddress GetEndAddress(com::sun::star::uno::Reference<com::sun::star::sheet::XSpreadsheet>& xTable,
+ com::sun::star::table::CellRangeAddress GetEndAddress(const com::sun::star::uno::Reference<com::sun::star::sheet::XSpreadsheet>& xTable,
const sal_Int32 nTable);
// ScMyEmptyDatabaseRangesContainer GetEmptyDatabaseRanges();
void GetAreaLinks( com::sun::star::uno::Reference< com::sun::star::sheet::XSpreadsheetDocument>& xSpreadDoc, ScMyAreaLinksContainer& rAreaLinks );
@@ -207,7 +214,21 @@ class ScXMLExport : public SvXMLExport
void CollectUserDefinedNamespaces(const SfxItemPool* pPool, sal_uInt16 nAttrib);
+ void AddStyleFromCells(
+ const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xProperties,
+ const com::sun::star::uno::Reference< com::sun::star::sheet::XSpreadsheet >& xTable,
+ sal_Int32 nTable, const rtl::OUString* pOldName );
+ void AddStyleFromColumn(
+ const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xColumnProperties,
+ const rtl::OUString* pOldName, sal_Int32& rIndex, sal_Bool& rIsVisible );
+ void AddStyleFromRow(
+ const com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >& xRowProperties,
+ const rtl::OUString* pOldName, sal_Int32& rIndex );
+
void IncrementProgressBar(sal_Bool bEditCell, sal_Int32 nInc = 1);
+
+ void CopySourceStream( sal_Int32 nStartOffset, sal_Int32 nEndOffset, sal_Int32& rNewStart, sal_Int32& rNewEnd );
+
protected:
virtual SvXMLAutoStylePoolP* CreateAutoStylePool();
virtual XMLPageExport* CreatePageExport();
@@ -234,6 +255,8 @@ public:
UniReference < XMLPropertySetMapper > GetCellStylesPropertySetMapper() { return xCellStylesPropertySetMapper; }
UniReference < XMLPropertySetMapper > GetTableStylesPropertySetMapper() { return xTableStylesPropertySetMapper; }
+ void SetSourceStream( const com::sun::star::uno::Reference<com::sun::star::io::XInputStream>& xNewStream );
+
void GetChangeTrackViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rProps);
virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rProps);
virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rProps);
diff --git a/sc/source/filter/xml/xmlexternaltabi.cxx b/sc/source/filter/xml/xmlexternaltabi.cxx
index 7eabdff07b9b..b53431843a57 100644
--- a/sc/source/filter/xml/xmlexternaltabi.cxx
+++ b/sc/source/filter/xml/xmlexternaltabi.cxx
@@ -100,6 +100,32 @@ SvXMLImportContext* ScXMLExternalRefTabSourceContext::CreateChildContext(
return new SvXMLImportContext(GetImport(), nPrefix, rLocalName);
}
+/**
+ * Make sure the URL is a valid relative URL, mainly to avoid storing
+ * absolute URL as relative URL by accident. For now, we only check the first
+ * three characters which are assumed to be always '../', because the relative
+ * URL for an external document is always in reference to the content.xml
+ * fragment of the original document.
+ */
+static bool lcl_isValidRelativeURL(const OUString& rUrl)
+{
+ sal_Int32 n = ::std::min( rUrl.getLength(), static_cast<sal_Int32>(3));
+ if (n < 3)
+ return false;
+ const sal_Unicode* p = rUrl.getStr();
+ for (sal_Int32 i = 0; i < n; ++i)
+ {
+ sal_Unicode c = p[i];
+ if (i < 2 && c != '.')
+ // the path must begin with '..'
+ return false;
+ else if (i == 2 && c != '/')
+ // a '/' path separator must follow
+ return false;
+ }
+ return true;
+}
+
void ScXMLExternalRefTabSourceContext::EndElement()
{
ScDocument* pDoc = mrScImport.GetDocument();
@@ -107,7 +133,7 @@ void ScXMLExternalRefTabSourceContext::EndElement()
return;
ScExternalRefManager* pRefMgr = pDoc->GetExternalRefManager();
- if (!maRelativeUrl.equals(mrExternalRefInfo.maFileUrl))
+ if (lcl_isValidRelativeURL(maRelativeUrl))
pRefMgr->setRelativeFileName(mrExternalRefInfo.mnFileId, maRelativeUrl);
pRefMgr->setFilterData(mrExternalRefInfo.mnFileId, maFilterName, maFilterOptions);
}
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index 200e33743020..8e3f4b421a6c 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -71,6 +71,7 @@
#include "XMLChangeTrackingImportHelper.hxx"
#include "chgviset.hxx"
#include "XMLStylesImportHelper.hxx"
+#include "sheetdata.hxx"
#include "unonames.hxx"
#include "rangeutl.hxx"
#include "postit.hxx"
@@ -93,6 +94,7 @@
#include <com/sun/star/sheet/NamedRangeFlag.hpp>
#include <com/sun/star/sheet/XNamedRange.hpp>
#include <com/sun/star/sheet/XLabelRanges.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
#define SC_LOCALE "Locale"
#define SC_STANDARDFORMAT "StandardFormat"
@@ -2416,6 +2418,20 @@ void ScXMLImport::SetStyleToRanges()
pStyle->FillPropertySet(xProperties);
sal_Int32 nNumberFormat(pStyle->GetNumberFormat());
SetType(xProperties, nNumberFormat, nPrevCellType, sPrevCurrency);
+
+ // store first cell of first range for each style, once per sheet
+ uno::Sequence<table::CellRangeAddress> aAddresses(xSheetCellRanges->getRangeAddresses());
+ if ( aAddresses.getLength() > 0 )
+ {
+ const table::CellRangeAddress& rRange = aAddresses[0];
+ if ( rRange.Sheet != pStyle->GetLastSheet() )
+ {
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
+ pSheetData->AddCellStyle( sPrevStyleName,
+ ScAddress( (SCCOL)rRange.StartColumn, (SCROW)rRange.StartRow, (SCTAB)rRange.Sheet ) );
+ pStyle->SetLastSheet(rRange.Sheet);
+ }
+ }
}
else
{
@@ -2569,6 +2585,17 @@ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeE
if ( ( nFlags & IMPORT_CONTENT ) && !( nFlags & IMPORT_STYLES ) )
ExamineDefaultStyle();
+ if (getImportFlags() & IMPORT_CONTENT)
+ {
+ if (GetModel().is())
+ {
+ // store initial namespaces, to find the ones that were added from the file later
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
+ const SvXMLNamespaceMap& rNamespaces = GetNamespaceMap();
+ pSheetData->StoreInitialNamespaces(rNamespaces);
+ }
+ }
+
UnlockSolarMutex();
}
@@ -2772,6 +2799,19 @@ throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeE
GetProgressBarHelper()->End(); // make room for subsequent SfxProgressBars
if (pDoc)
pDoc->CompileXML();
+
+ if (pDoc && GetModel().is())
+ {
+ // set "valid stream" flags after loading (before UpdateRowHeights, so changed formula results
+ // in UpdateRowHeights can already clear the flags again)
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
+
+ SCTAB nTabCount = pDoc->GetTableCount();
+ for (SCTAB nTab=0; nTab<nTabCount; ++nTab)
+ if (!pSheetData->IsSheetBlocked( nTab ))
+ pDoc->SetStreamValid( nTab, TRUE );
+ }
+
aTables.UpdateRowHeights();
aTables.ResizeShapes();
}
@@ -2831,6 +2871,16 @@ void ScXMLImport::UnlockSolarMutex()
}
}
+sal_Int32 ScXMLImport::GetByteOffset()
+{
+ sal_Int32 nOffset = -1;
+ uno::Reference<xml::sax::XLocator> xLocator = GetLocator();
+ uno::Reference<io::XSeekable> xSeek( xLocator, uno::UNO_QUERY ); //! should use different interface
+ if ( xSeek.is() )
+ nOffset = (sal_Int32)xSeek->getPosition();
+ return nOffset;
+}
+
void ScXMLImport::SetRangeOverflowType(sal_uInt32 nType)
{
// #i31130# Overflow is stored in the document, because the ScXMLImport object
diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx
index f96d34c40ca5..c108642d0b68 100644
--- a/sc/source/filter/xml/xmlimprt.hxx
+++ b/sc/source/filter/xml/xmlimprt.hxx
@@ -980,6 +980,8 @@ public:
void LockSolarMutex();
void UnlockSolarMutex();
+ sal_Int32 GetByteOffset();
+
void SetRangeOverflowType(sal_uInt32 nType);
sal_Int32 GetRangeType(const rtl::OUString sRangeType) const;
diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index 079691944481..f62208cdd2ff 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -43,6 +43,7 @@
#include "document.hxx"
#include "docuno.hxx"
#include "olinetab.hxx"
+#include "sheetdata.hxx"
#include <xmloff/xmltkmap.hxx>
#include <xmloff/nmspmap.hxx>
@@ -170,6 +171,7 @@ void ScXMLTableRowContext::EndElement()
GetScImport().GetTables().AddRow();
DBG_ERRORFILE("it seems here is a nonvalid file; possible missing of table:table-cell element");
}
+ sal_Int32 nSheet = rXMLImport.GetTables().GetCurrentSheet();
sal_Int32 nCurrentRow(rXMLImport.GetTables().GetCurrentRow());
uno::Reference<sheet::XSpreadsheet> xSheet(rXMLImport.GetTables().GetCurrentXSheet());
if(xSheet.is())
@@ -196,7 +198,16 @@ void ScXMLTableRowContext::EndElement()
XMLTableStyleContext* pStyle((XMLTableStyleContext *)pStyles->FindStyleChildContext(
XML_STYLE_FAMILY_TABLE_ROW, sStyleName, sal_True));
if (pStyle)
+ {
pStyle->FillPropertySet(xRowProperties);
+
+ if ( nSheet != pStyle->GetLastSheet() )
+ {
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rXMLImport.GetModel())->GetSheetSaveData();
+ pSheetData->AddRowStyle( sStyleName, ScAddress( 0, (SCROW)nFirstRow, (SCTAB)nSheet ) );
+ pStyle->SetLastSheet(nSheet);
+ }
+ }
}
}
sal_Bool bVisible (sal_True);
diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx
index 79ba79f0e689..20158d1f13db 100644
--- a/sc/source/filter/xml/xmlstyli.cxx
+++ b/sc/source/filter/xml/xmlstyli.cxx
@@ -50,6 +50,11 @@
#include <tools/debug.hxx>
#include "XMLTableHeaderFooterContext.hxx"
#include "XMLConverter.hxx"
+#include "XMLTableShapeImportHelper.hxx"
+#include "sheetdata.hxx"
+#include "xmlannoi.hxx"
+#include "textuno.hxx"
+#include "cellsuno.hxx"
#include "docuno.hxx"
#include "unonames.hxx"
@@ -461,6 +466,7 @@ XMLTableStyleContext::XMLTableStyleContext( ScXMLImport& rImport,
sNumberFormat(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("NumberFormat"))),
pStyles(&rStyles),
nNumberFormat(-1),
+ nLastSheet(-1),
bConditionalFormatCreated(sal_False),
bParentSet(sal_False)
{
@@ -609,15 +615,22 @@ sal_Int32 XMLTableStyleContext::GetNumberFormat()
}
return nNumberFormat;
}
+
// ----------------------------------------------------------------------------
SvXMLStyleContext *XMLTableStylesContext::CreateStyleStyleChildContext(
sal_uInt16 nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
const uno::Reference< xml::sax::XAttributeList > & xAttrList )
{
- SvXMLStyleContext *pStyle(SvXMLStylesContext::CreateStyleStyleChildContext( nFamily, nPrefix,
- rLocalName,
- xAttrList ));
+ SvXMLStyleContext *pStyle;
+ // use own wrapper for text and paragraph, to record style usage
+ if (nFamily == XML_STYLE_FAMILY_TEXT_PARAGRAPH || nFamily == XML_STYLE_FAMILY_TEXT_TEXT)
+ pStyle = new ScCellTextStyleContext( GetImport(), nPrefix, rLocalName,
+ xAttrList, *this, nFamily );
+ else
+ pStyle = SvXMLStylesContext::CreateStyleStyleChildContext(
+ nFamily, nPrefix, rLocalName, xAttrList );
+
if (!pStyle)
{
switch( nFamily )
@@ -1013,3 +1026,56 @@ void ScMasterPageContext::Finish( sal_Bool bOverwrite )
ClearContent(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_PAGE_RIGHTHDRCON)));
}
+// ---------------------------------------------------------------------------
+
+ScCellTextStyleContext::ScCellTextStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const rtl::OUString& rLName, const uno::Reference<xml::sax::XAttributeList> & xAttrList,
+ SvXMLStylesContext& rStyles, sal_uInt16 nFamily, sal_Bool bDefaultStyle ) :
+ XMLTextStyleContext( rImport, nPrfx, rLName, xAttrList, rStyles, nFamily, bDefaultStyle ),
+ nLastSheet(-1)
+{
+}
+
+ScCellTextStyleContext::~ScCellTextStyleContext()
+{
+}
+
+void ScCellTextStyleContext::FillPropertySet( const uno::Reference<beans::XPropertySet>& xPropSet )
+{
+ XMLTextStyleContext::FillPropertySet( xPropSet );
+
+ ScXMLImport& rXMLImport = GetScImport();
+
+ ScCellTextCursor* pCellImp = ScCellTextCursor::getImplementation( xPropSet );
+ if (pCellImp)
+ {
+ ScAddress aPos = pCellImp->GetCellObj().GetPosition();
+ if ( static_cast<sal_Int32>(aPos.Tab()) != nLastSheet )
+ {
+ ESelection aSel = pCellImp->GetSelection();
+
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetImport().GetModel())->GetSheetSaveData();
+ pSheetData->AddTextStyle( GetName(), aPos, aSel );
+
+ nLastSheet = static_cast<sal_Int32>(aPos.Tab());
+ }
+ }
+ else if ( rXMLImport.GetTables().GetCurrentSheet() != nLastSheet )
+ {
+ ScDrawTextCursor* pDrawImp = ScDrawTextCursor::getImplementation( xPropSet );
+ if (pDrawImp)
+ {
+ XMLTableShapeImportHelper* pTableShapeImport = (XMLTableShapeImportHelper*)GetScImport().GetShapeImport().get();
+ ScXMLAnnotationContext* pAnnotationContext = pTableShapeImport->GetAnnotationContext();
+ if (pAnnotationContext)
+ {
+ pAnnotationContext->AddContentStyle( GetFamily(), GetName(), pDrawImp->GetSelection() );
+ nLastSheet = rXMLImport.GetTables().GetCurrentSheet();
+ }
+ }
+
+ // if it's a different shape, BlockSheet is called from XMLTableShapeImportHelper::finishShape
+ // formatted text in page headers/footers can be ignored
+ }
+}
+
diff --git a/sc/source/filter/xml/xmlstyli.hxx b/sc/source/filter/xml/xmlstyli.hxx
index 272ec0151134..c80ea8b5c92d 100644
--- a/sc/source/filter/xml/xmlstyli.hxx
+++ b/sc/source/filter/xml/xmlstyli.hxx
@@ -40,9 +40,12 @@
#include <xmloff/xmlimppr.hxx>
#include <xmloff/XMLTextMasterPageContext.hxx>
#include <xmloff/XMLTextMasterStylesContext.hxx>
+#include <xmloff/txtstyli.hxx>
#include <com/sun/star/sheet/ConditionOperator.hpp>
#include "xmlimprt.hxx"
+class ScSheetSaveData;
+
class ScXMLCellImportPropertyMapper : public SvXMLImportPropertyMapper
{
protected:
@@ -101,6 +104,7 @@ class XMLTableStyleContext : public XMLPropStyleContext
std::vector<ScXMLMapContent> aMaps;
com::sun::star::uno::Any aConditionalFormat;
sal_Int32 nNumberFormat;
+ sal_Int32 nLastSheet;
sal_Bool bConditionalFormatCreated;
sal_Bool bParentSet;
@@ -158,6 +162,9 @@ public:
sal_Int32 GetNumberFormat();// { return nNumberFormat; }
+ sal_Int32 GetLastSheet() const { return nLastSheet; }
+ void SetLastSheet(sal_Int32 nNew) { nLastSheet = nNew; }
+
private:
using XMLPropStyleContext::SetStyle;
};
@@ -298,5 +305,28 @@ public:
virtual void Finish( sal_Bool bOverwrite );
};
+class ScCellTextStyleContext : public XMLTextStyleContext
+{
+ sal_Int32 nLastSheet;
+
+ const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
+ ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
+
+public:
+ ScCellTextStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const ::rtl::OUString& rLName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+ SvXMLStylesContext& rStyles, sal_uInt16 nFamily,
+ sal_Bool bDefaultStyle = sal_False );
+ virtual ~ScCellTextStyleContext();
+
+ // overload FillPropertySet to store style information
+ virtual void FillPropertySet(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > & rPropSet );
+};
+
+
#endif
diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx
index 231839b9f946..0f980c4a9608 100644
--- a/sc/source/filter/xml/xmlsubti.cxx
+++ b/sc/source/filter/xml/xmlsubti.cxx
@@ -43,6 +43,7 @@
#include "docuno.hxx"
#include "cellsuno.hxx"
#include "XMLStylesImportHelper.hxx"
+#include "sheetdata.hxx"
#include "tabprotection.hxx"
#include <svx/svdpage.hxx>
@@ -269,7 +270,12 @@ void ScMyTables::NewSheet(const rtl::OUString& sTableName, const rtl::OUString&
XMLTableStyleContext* pStyle = (XMLTableStyleContext *)pStyles->FindStyleChildContext(
XML_STYLE_FAMILY_TABLE_TABLE, sStyleName, sal_True);
if (pStyle)
+ {
pStyle->FillPropertySet(xProperties);
+
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(rImport.GetModel())->GetSheetSaveData();
+ pSheetData->AddTableStyle( sStyleName, ScAddress( 0, 0, (SCTAB)nCurrentSheet ) );
+ }
}
}
}
@@ -609,7 +615,11 @@ void ScMyTables::UpdateRowHeights()
}
if (aUpdateSheets.GetSelectCount())
+ {
+ pDoc->LockStreamValid( true ); // ignore draw page size (but not formula results)
ScModelObj::getImplementation(rImport.GetModel())->UpdateAllRowHeights(&aUpdateSheets);
+ pDoc->LockStreamValid( false );
+ }
}
rImport.UnlockSolarMutex();
diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx
index cc95e01be821..8ea9701ecd32 100644
--- a/sc/source/filter/xml/xmltabi.cxx
+++ b/sc/source/filter/xml/xmltabi.cxx
@@ -50,6 +50,7 @@
#include "XMLStylesImportHelper.hxx"
#include "rangeutl.hxx"
#include "externalrefmgr.hxx"
+#include "sheetdata.hxx"
#include <xmloff/xmltkmap.hxx>
#include <xmloff/nmspmap.hxx>
@@ -147,9 +148,13 @@ ScXMLTableContext::ScXMLTableContext( ScXMLImport& rImport,
const sal_Int32 nSpannedCols) :
SvXMLImportContext( rImport, nPrfx, rLName ),
pExternalRefInfo(NULL),
+ nStartOffset(-1),
bStartFormPage(sal_False),
bPrintEntireSheet(sal_True)
{
+ // get start offset in file (if available)
+ nStartOffset = GetScImport().GetByteOffset();
+
if (!bTempIsSubTable)
{
sal_Bool bProtection(sal_False);
@@ -326,6 +331,9 @@ SvXMLImportContext *ScXMLTableContext::CreateChildContext( USHORT nPrefix,
void ScXMLTableContext::EndElement()
{
+ // get end offset in file (if available)
+// sal_Int32 nEndOffset = GetScImport().GetByteOffset();
+
GetScImport().LockSolarMutex();
GetScImport().GetStylesImportHelper()->EndTable();
ScDocument* pDoc(GetScImport().GetDocument());
@@ -386,6 +394,15 @@ void ScXMLTableContext::EndElement()
GetScImport().GetTables().DeleteTable();
GetScImport().ProgressBarIncrement(sal_False);
+
+ // store stream positions
+ if (!pExternalRefInfo.get() && nStartOffset >= 0 /* && nEndOffset >= 0 */)
+ {
+ ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetScImport().GetModel())->GetSheetSaveData();
+ sal_Int32 nTab = GetScImport().GetTables().GetCurrentSheet();
+ // pSheetData->AddStreamPos( nTab, nStartOffset, nEndOffset );
+ pSheetData->StartStreamPos( nTab, nStartOffset );
+ }
}
GetScImport().UnlockSolarMutex();
}
diff --git a/sc/source/filter/xml/xmltabi.hxx b/sc/source/filter/xml/xmltabi.hxx
index 7b8c9878f2d5..1a4438b28955 100644
--- a/sc/source/filter/xml/xmltabi.hxx
+++ b/sc/source/filter/xml/xmltabi.hxx
@@ -52,6 +52,7 @@ class ScXMLTableContext : public SvXMLImportContext
{
rtl::OUString sPrintRanges;
::std::auto_ptr<ScXMLExternalTabData> pExternalRefInfo;
+ sal_Int32 nStartOffset;
sal_Bool bStartFormPage;
sal_Bool bPrintEntireSheet;
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index 960d78ada163..7bc5396fcb5b 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -265,7 +265,24 @@ sal_uInt32 ScXMLImportWrapper::ImportFromComponent(uno::Reference<lang::XMultiSe
}
catch( xml::sax::SAXParseException& r )
{
- if( bEncrypted )
+ // sax parser sends wrapped exceptions,
+ // try to find the original one
+ xml::sax::SAXException aSaxEx = *(xml::sax::SAXException*)(&r);
+ sal_Bool bTryChild = sal_True;
+
+ while( bTryChild )
+ {
+ xml::sax::SAXException aTmp;
+ if ( aSaxEx.WrappedException >>= aTmp )
+ aSaxEx = aTmp;
+ else
+ bTryChild = sal_False;
+ }
+
+ packages::zip::ZipIOException aBrokenPackage;
+ if ( aSaxEx.WrappedException >>= aBrokenPackage )
+ return ERRCODE_IO_BROKENPACKAGE;
+ else if( bEncrypted )
nReturn = ERRCODE_SFX_WRONGPASSWORD;
else
{
@@ -298,7 +315,10 @@ sal_uInt32 ScXMLImportWrapper::ImportFromComponent(uno::Reference<lang::XMultiSe
}
catch( xml::sax::SAXException& r )
{
- if( bEncrypted )
+ packages::zip::ZipIOException aBrokenPackage;
+ if ( r.WrappedException >>= aBrokenPackage )
+ return ERRCODE_IO_BROKENPACKAGE;
+ else if( bEncrypted )
nReturn = ERRCODE_SFX_WRONGPASSWORD;
else
{
@@ -624,6 +644,25 @@ sal_Bool ScXMLImportWrapper::Import(sal_Bool bStylesOnly, ErrCode& nError)
return sal_False;
}
+bool lcl_HasValidStream(ScDocument& rDoc)
+{
+ SfxObjectShell* pObjSh = rDoc.GetDocumentShell();
+ if ( pObjSh->IsDocShared() )
+ return false; // never copy stream from shared file
+
+ // don't read remote file again
+ // (could instead re-use medium directly in that case)
+ SfxMedium* pSrcMed = rDoc.GetDocumentShell()->GetMedium();
+ if ( !pSrcMed || pSrcMed->IsRemote() )
+ return false;
+
+ SCTAB nTabCount = rDoc.GetTableCount();
+ for (SCTAB nTab=0; nTab<nTabCount; ++nTab)
+ if (rDoc.IsStreamValid(nTab))
+ return true;
+ return false;
+}
+
sal_Bool ScXMLImportWrapper::ExportToComponent(uno::Reference<lang::XMultiServiceFactory>& xServiceFactory,
uno::Reference<frame::XModel>& xModel, uno::Reference<uno::XInterface>& xWriter,
uno::Sequence<beans::PropertyValue>& aDescriptor, const rtl::OUString& sName,
@@ -691,7 +730,49 @@ sal_Bool ScXMLImportWrapper::ExportToComponent(uno::Reference<lang::XMultiServic
{
ScXMLExport* pExport = static_cast<ScXMLExport*>(SvXMLExport::getImplementation(xFilter));
pExport->SetSharedData(pSharedData);
- bRet = xFilter->filter( aDescriptor );
+
+ // if there are sheets to copy, get the source stream
+ if ( sName.equalsAscii("content.xml") && lcl_HasValidStream(rDoc) &&
+ ( pExport->getExportFlags() & EXPORT_OASIS ) )
+ {
+ // old stream is still in this file's storage - open read-only
+
+ SfxMedium* pSrcMed = rDoc.GetDocumentShell()->GetMedium();
+ String aSrcURL = pSrcMed->GetOrigURL();
+
+ // SfxMedium must not be read-only, or it will create a temp file in GetStorage
+ SfxMedium aTmpMedium( aSrcURL, STREAM_READWRITE, FALSE, NULL, NULL );
+ uno::Reference<embed::XStorage> xTmpStorage = aTmpMedium.GetStorage();
+ uno::Reference<io::XStream> xSrcStream;
+ uno::Reference<io::XInputStream> xSrcInput;
+ try
+ {
+ if (xTmpStorage.is())
+ xSrcStream = xTmpStorage->openStreamElement( sName, embed::ElementModes::READ );
+ if (xSrcStream.is())
+ xSrcInput = xSrcStream->getInputStream();
+ }
+ catch (uno::Exception&)
+ {
+ // stream not available (for example, password protected) - save normally (xSrcInput is null)
+ }
+
+ pExport->SetSourceStream( xSrcInput );
+ bRet = xFilter->filter( aDescriptor );
+ pExport->SetSourceStream( uno::Reference<io::XInputStream>() );
+
+ // If there was an error, reset all stream flags, so the next save attempt will use normal saving.
+ if (!bRet)
+ {
+ SCTAB nTabCount = rDoc.GetTableCount();
+ for (SCTAB nTab=0; nTab<nTabCount; nTab++)
+ if (rDoc.IsStreamValid(nTab))
+ rDoc.SetStreamValid(nTab, FALSE);
+ }
+ }
+ else
+ bRet = xFilter->filter( aDescriptor );
+
pSharedData = pExport->GetSharedData();
//stream is closed by SAX parser
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx
index 4e36c8df0196..4dbc47524276 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -371,7 +371,7 @@ ScDocument* ScAccessibleCell::GetDocument(ScTabViewShell* pViewShell)
::std::auto_ptr< SvxEditSource > ScAccessibleCell::CreateEditSource(ScTabViewShell* pViewShell, ScAddress aCell, ScSplitPos eSplitPos)
{
::std::auto_ptr < ScAccessibleTextData > pAccessibleCellTextData
- (new ScAccessibleCellTextData(pViewShell, aCell, eSplitPos));
+ ( new ScAccessibleCellTextData( pViewShell, aCell, eSplitPos, this ) );
::std::auto_ptr< SvxEditSource > pEditSource (new ScAccessibilityEditSource(pAccessibleCellTextData));
return pEditSource;
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index 7d66c19cfb79..a81f359f04c7 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -1906,40 +1906,40 @@ ScShapeChilds* ScAccessibleDocumentPagePreview::GetShapeChilds()
return mpShapeChilds;
}
-uno::Reference < XAccessible > ScAccessibleDocumentPagePreview::GetCurrentAccessibleTable()
-{
- if (!mpTable)
- {
- if ( mpViewShell )
- {
- const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
- ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() );
- //! order is background shapes, header, table or notes, footer, foreground shapes, controls
- sal_Int32 nIndex (aCount.nBackShapes + aCount.nHeaders);
-
- mpTable = new ScAccessiblePreviewTable( this, mpViewShell, nIndex );
- mpTable->acquire();
- mpTable->Init();
- }
- }
- return mpTable;
-}
-
-void ScAccessibleDocumentPagePreview::ChildCountChanged()
-{
- if (mpViewShell)
- {
- const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
- ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() );
- //! order is background shapes, header, table or notes, footer, foreground shapes, controls
- if(mpHeader)
- mpHeader->SetCurrentIndexInParent(aCount.nBackShapes);
- if (mpTable)
- mpTable->SetCurrentIndexInParent(aCount.nBackShapes + aCount.nHeaders);
- if (mpFooter)
- mpFooter->SetCurrentIndexInParent(aCount.nBackShapes + aCount.nHeaders + aCount.nTables + aCount.nNoteParagraphs);
-
- if (mpNotesChilds)
- mpNotesChilds->SetOffset(aCount.nBackShapes + aCount.nHeaders);
- }
-}
+//UNUSED2009-05 uno::Reference < XAccessible > ScAccessibleDocumentPagePreview::GetCurrentAccessibleTable()
+//UNUSED2009-05 {
+//UNUSED2009-05 if (!mpTable)
+//UNUSED2009-05 {
+//UNUSED2009-05 if ( mpViewShell )
+//UNUSED2009-05 {
+//UNUSED2009-05 const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
+//UNUSED2009-05 ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() );
+//UNUSED2009-05 //! order is background shapes, header, table or notes, footer, foreground shapes, controls
+//UNUSED2009-05 sal_Int32 nIndex (aCount.nBackShapes + aCount.nHeaders);
+//UNUSED2009-05
+//UNUSED2009-05 mpTable = new ScAccessiblePreviewTable( this, mpViewShell, nIndex );
+//UNUSED2009-05 mpTable->acquire();
+//UNUSED2009-05 mpTable->Init();
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 return mpTable;
+//UNUSED2009-05 }
+
+//UNUSED2009-05 void ScAccessibleDocumentPagePreview::ChildCountChanged()
+//UNUSED2009-05 {
+//UNUSED2009-05 if (mpViewShell)
+//UNUSED2009-05 {
+//UNUSED2009-05 const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
+//UNUSED2009-05 ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() );
+//UNUSED2009-05 //! order is background shapes, header, table or notes, footer, foreground shapes, controls
+//UNUSED2009-05 if(mpHeader)
+//UNUSED2009-05 mpHeader->SetCurrentIndexInParent(aCount.nBackShapes);
+//UNUSED2009-05 if (mpTable)
+//UNUSED2009-05 mpTable->SetCurrentIndexInParent(aCount.nBackShapes + aCount.nHeaders);
+//UNUSED2009-05 if (mpFooter)
+//UNUSED2009-05 mpFooter->SetCurrentIndexInParent(aCount.nBackShapes + aCount.nHeaders + aCount.nTables + aCount.nNoteParagraphs);
+//UNUSED2009-05
+//UNUSED2009-05 if (mpNotesChilds)
+//UNUSED2009-05 mpNotesChilds->SetOffset(aCount.nBackShapes + aCount.nHeaders);
+//UNUSED2009-05 }
+//UNUSED2009-05 }
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx
index 18470475cebf..feeae8c73023 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -37,6 +37,7 @@
#include <memory>
#include "AccessibleText.hxx"
+#include "AccessibleCell.hxx"
#include "tabvwsh.hxx"
#include "editutil.hxx"
#include "document.hxx"
@@ -54,6 +55,7 @@
#include <svx/editobj.hxx>
#include <svx/adjitem.hxx>
#include <svx/svdmodel.hxx>
+#include <svx/algitem.hxx>
// ============================================================================
@@ -753,13 +755,14 @@ void ScEditViewForwarder::SetInvalid()
// ScAccessibleCellTextData: shared data between sub objects of a accessible cell text object
ScAccessibleCellTextData::ScAccessibleCellTextData(ScTabViewShell* pViewShell,
- const ScAddress& rP, ScSplitPos eSplitPos)
+ const ScAddress& rP, ScSplitPos eSplitPos, ScAccessibleCell* pAccCell)
: ScAccessibleCellBaseTextData(GetDocShell(pViewShell), rP),
mpViewForwarder(NULL),
mpEditViewForwarder(NULL),
mpViewShell(pViewShell),
meSplitPos(eSplitPos),
- mbViewEditEngine(sal_False)
+ mbViewEditEngine(sal_False),
+ mpAccessibleCell( pAccCell )
{
}
@@ -792,7 +795,7 @@ void ScAccessibleCellTextData::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
ScAccessibleTextData* ScAccessibleCellTextData::Clone() const
{
- return new ScAccessibleCellTextData(mpViewShell, aCellPos, meSplitPos);
+ return new ScAccessibleCellTextData( mpViewShell, aCellPos, meSplitPos, mpAccessibleCell );
}
void ScAccessibleCellTextData::GetCellText(const ScAddress& rCellPos, String& rText)
@@ -866,7 +869,8 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
if (!bHasForwarder)*/
ScCellTextData::GetTextForwarder(); // creates Forwarder and EditEngine
- if (pEditEngine && mpViewShell)
+ ScDocument* pDoc = ( pDocShell ? pDocShell->GetDocument() : NULL );
+ if ( pDoc && pEditEngine && mpViewShell )
{
long nSizeX, nSizeY;
mpViewShell->GetViewData()->GetMergeSizePixel(
@@ -874,9 +878,39 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
Size aSize(nSizeX, nSizeY);
- Window* pWin = mpViewShell->GetWindowByPos(meSplitPos);
- if (pWin)
- aSize = pWin->PixelToLogic(aSize, pEditEngine->GetRefMapMode());
+ // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells
+ long nIndent = 0;
+ const SvxHorJustifyItem* pHorJustifyItem = static_cast< const SvxHorJustifyItem* >(
+ pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_HOR_JUSTIFY ) );
+ SvxCellHorJustify eHorJust = ( pHorJustifyItem ? static_cast< SvxCellHorJustify >( pHorJustifyItem->GetValue() ) : SVX_HOR_JUSTIFY_STANDARD );
+ if ( eHorJust == SVX_HOR_JUSTIFY_LEFT )
+ {
+ const SfxUInt16Item* pIndentItem = static_cast< const SfxUInt16Item* >(
+ pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_INDENT ) );
+ if ( pIndentItem )
+ {
+ nIndent = static_cast< long >( pIndentItem->GetValue() );
+ }
+ }
+
+ const SvxMarginItem* pMarginItem = static_cast< const SvxMarginItem* >(
+ pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_MARGIN ) );
+ ScViewData* pViewData = mpViewShell->GetViewData();
+ double nPPTX = ( pViewData ? pViewData->GetPPTX() : 0 );
+ double nPPTY = ( pViewData ? pViewData->GetPPTY() : 0 );
+ long nLeftM = ( pMarginItem ? static_cast< long >( ( pMarginItem->GetLeftMargin() + nIndent ) * nPPTX ) : 0 );
+ long nTopM = ( pMarginItem ? static_cast< long >( pMarginItem->GetTopMargin() * nPPTY ) : 0 );
+ long nRightM = ( pMarginItem ? static_cast< long >( pMarginItem->GetRightMargin() * nPPTX ) : 0 );
+ long nBottomM = ( pMarginItem ? static_cast< long >( pMarginItem->GetBottomMargin() * nPPTY ) : 0 );
+ long nWidth = aSize.getWidth() - nLeftM - nRightM;
+ aSize.setWidth( nWidth );
+ aSize.setHeight( aSize.getHeight() - nTopM - nBottomM );
+
+ Window* pWin = mpViewShell->GetWindowByPos( meSplitPos );
+ if ( pWin )
+ {
+ aSize = pWin->PixelToLogic( aSize, pEditEngine->GetRefMapMode() );
+ }
/* #i19430# Gnopernicus reads text partly if it sticks out of the cell
boundaries. This leads to wrong results in cases where the cell text
@@ -888,20 +922,94 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
return the size of the complete text then, which is used to expand
the cell bounding box in ScAccessibleCell::GetBoundingBox()
(see sc/source/ui/Accessibility/AccessibleCell.cxx). */
- if (pDocShell && pDocShell->GetDocument())
+ const SfxInt32Item* pItem = static_cast< const SfxInt32Item* >(
+ pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_ROTATE_VALUE ) );
+ if( pItem && (pItem->GetValue() != 0) )
+ {
+ pEditEngine->SetPaperSize( Size( LONG_MAX, aSize.getHeight() ) );
+ long nTxtWidth = static_cast< long >( pEditEngine->CalcTextWidth() );
+ aSize.setWidth( std::max( aSize.getWidth(), nTxtWidth + 2 ) );
+ }
+ else
{
- const SfxInt32Item* pItem = static_cast< const SfxInt32Item* >(
- pDocShell->GetDocument()->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_ROTATE_VALUE ) );
- if( pItem && (pItem->GetValue() != 0) )
+ // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells
+ const SfxBoolItem* pLineBreakItem = static_cast< const SfxBoolItem* >(
+ pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_LINEBREAK ) );
+ bool bLineBreak = ( pLineBreakItem && pLineBreakItem->GetValue() );
+ if ( !bLineBreak )
{
- pEditEngine->SetPaperSize( Size( LONG_MAX, aSize.getHeight() ) );
- long nTextWidth = static_cast< long >( pEditEngine->CalcTextWidth() );
- aSize.setWidth( std::max( aSize.getWidth(), nTextWidth + 2 ) );
+ long nTxtWidth = static_cast< long >( pEditEngine->CalcTextWidth() );
+ aSize.setWidth( ::std::max( aSize.getWidth(), nTxtWidth ) );
}
}
- // #i70916# Text in spread sheet cells return the wrong extents
- pEditEngine->SetPaperSize( Size( LONG_MAX, aSize.getHeight() ) );
+ pEditEngine->SetPaperSize( aSize );
+
+ // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells
+ if ( eHorJust == SVX_HOR_JUSTIFY_STANDARD && pDoc->HasValueData( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) )
+ {
+ pEditEngine->SetDefaultItem( SvxAdjustItem( SVX_ADJUST_RIGHT, EE_PARA_JUST ) );
+ }
+
+ Size aTextSize;
+ if ( pWin )
+ {
+ aTextSize = pWin->LogicToPixel( Size( pEditEngine->CalcTextWidth(), pEditEngine->GetTextHeight() ), pEditEngine->GetRefMapMode() );
+ }
+ long nTextWidth = aTextSize.Width();
+ long nTextHeight = aTextSize.Height();
+
+ long nOffsetX = nLeftM;
+ long nDiffX = nTextWidth - nWidth;
+ if ( nDiffX > 0 )
+ {
+ switch ( eHorJust )
+ {
+ case SVX_HOR_JUSTIFY_RIGHT:
+ {
+ nOffsetX -= nDiffX;
+ }
+ break;
+ case SVX_HOR_JUSTIFY_CENTER:
+ {
+ nOffsetX -= nDiffX / 2;
+ }
+ break;
+ default:
+ {
+ }
+ break;
+ }
+ }
+
+ long nOffsetY = 0;
+ const SvxVerJustifyItem* pVerJustifyItem = static_cast< const SvxVerJustifyItem* >(
+ pDoc->GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_VER_JUSTIFY ) );
+ SvxCellVerJustify eVerJust = ( pVerJustifyItem ? static_cast< SvxCellVerJustify >( pVerJustifyItem->GetValue() ) : SVX_VER_JUSTIFY_STANDARD );
+ switch ( eVerJust )
+ {
+ case SVX_VER_JUSTIFY_STANDARD:
+ case SVX_VER_JUSTIFY_BOTTOM:
+ {
+ nOffsetY = nSizeY - nBottomM - nTextHeight;
+ }
+ break;
+ case SVX_VER_JUSTIFY_CENTER:
+ {
+ nOffsetY = ( nSizeY - nTopM - nBottomM - nTextHeight ) / 2 + nTopM;
+ }
+ break;
+ default:
+ {
+ nOffsetY = nTopM;
+ }
+ break;
+ }
+
+ if ( mpAccessibleCell )
+ {
+ mpAccessibleCell->SetOffset( Point( nOffsetX, nOffsetY ) );
+ }
pEditEngine->SetNotifyHdl( LINK(this, ScAccessibleCellTextData, NotifyHdl) );
}
diff --git a/sc/source/ui/app/scmod2.cxx b/sc/source/ui/app/scmod2.cxx
index 2424b62c5414..4001ebe62036 100644
--- a/sc/source/ui/app/scmod2.cxx
+++ b/sc/source/ui/app/scmod2.cxx
@@ -37,7 +37,8 @@
#include <svx/unolingu.hxx>
#include <svtools/lingucfg.hxx>
-
+#include <i18npool/mslangid.hxx>
+#include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/linguistic2/XThesaurus.hpp>
#include <com/sun/star/lang/Locale.hpp>
@@ -62,9 +63,9 @@ void ScModule::GetSpellSettings( USHORT& rDefLang, USHORT& rCjkLang, USHORT& rCt
SvtLinguOptions aOptions;
aConfig.GetOptions( aOptions );
- rDefLang = aOptions.nDefaultLanguage;
- rCjkLang = aOptions.nDefaultLanguage_CJK;
- rCtlLang = aOptions.nDefaultLanguage_CTL;
+ rDefLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage, ::com::sun::star::i18n::ScriptType::LATIN);
+ rCjkLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CJK, ::com::sun::star::i18n::ScriptType::ASIAN);
+ rCtlLang = MsLangId::resolveSystemLanguageByScriptType(aOptions.nDefaultLanguage_CTL, ::com::sun::star::i18n::ScriptType::COMPLEX);
rAutoSpell = aOptions.bIsSpellAuto;
}
diff --git a/sc/source/ui/dbgui/csvtablebox.cxx b/sc/source/ui/dbgui/csvtablebox.cxx
index 2c7691bd7188..c3cfb97cd52c 100644
--- a/sc/source/ui/dbgui/csvtablebox.cxx
+++ b/sc/source/ui/dbgui/csvtablebox.cxx
@@ -42,16 +42,16 @@
// ============================================================================
-ScCsvTableBox::ScCsvTableBox( Window* pParent ) :
- ScCsvControl( pParent, maData, WB_BORDER | WB_TABSTOP | WB_DIALOGCONTROL ),
- maRuler( *this ),
- maGrid( *this ),
- maHScroll( this, WB_HORZ | WB_DRAG ),
- maVScroll( this, WB_VERT | WB_DRAG ),
- maScrollBox( this )
-{
- Init();
-}
+//UNUSED2009-05 ScCsvTableBox::ScCsvTableBox( Window* pParent ) :
+//UNUSED2009-05 ScCsvControl( pParent, maData, WB_BORDER | WB_TABSTOP | WB_DIALOGCONTROL ),
+//UNUSED2009-05 maRuler( *this ),
+//UNUSED2009-05 maGrid( *this ),
+//UNUSED2009-05 maHScroll( this, WB_HORZ | WB_DRAG ),
+//UNUSED2009-05 maVScroll( this, WB_VERT | WB_DRAG ),
+//UNUSED2009-05 maScrollBox( this )
+//UNUSED2009-05 {
+//UNUSED2009-05 Init();
+//UNUSED2009-05 }
ScCsvTableBox::ScCsvTableBox( Window* pParent, const ResId& rResId ) :
ScCsvControl( pParent, maData, rResId ),
@@ -225,24 +225,24 @@ void ScCsvTableBox::SetUniStrings(
EnableRepaint();
}
-void ScCsvTableBox::SetByteStrings(
- const ByteString* pTextLines, CharSet eCharSet,
- const String& rSepChars, sal_Unicode cTextSep, bool bMergeSep )
-{
- // assuming that pTextLines is a string array with size CSV_PREVIEW_LINES
- // -> will be dynamic sometime
- DisableRepaint();
- sal_Int32 nEndLine = GetFirstVisLine() + CSV_PREVIEW_LINES;
- const ByteString* pString = pTextLines;
- for( sal_Int32 nLine = GetFirstVisLine(); nLine < nEndLine; ++nLine, ++pString )
- {
- if( mbFixedMode )
- maGrid.ImplSetTextLineFix( nLine, String( *pString, eCharSet ) );
- else
- maGrid.ImplSetTextLineSep( nLine, String( *pString, eCharSet ), rSepChars, cTextSep, bMergeSep );
- }
- EnableRepaint();
-}
+//UNUSED2009-05 void ScCsvTableBox::SetByteStrings(
+//UNUSED2009-05 const ByteString* pTextLines, CharSet eCharSet,
+//UNUSED2009-05 const String& rSepChars, sal_Unicode cTextSep, bool bMergeSep )
+//UNUSED2009-05 {
+//UNUSED2009-05 // assuming that pTextLines is a string array with size CSV_PREVIEW_LINES
+//UNUSED2009-05 // -> will be dynamic sometime
+//UNUSED2009-05 DisableRepaint();
+//UNUSED2009-05 sal_Int32 nEndLine = GetFirstVisLine() + CSV_PREVIEW_LINES;
+//UNUSED2009-05 const ByteString* pString = pTextLines;
+//UNUSED2009-05 for( sal_Int32 nLine = GetFirstVisLine(); nLine < nEndLine; ++nLine, ++pString )
+//UNUSED2009-05 {
+//UNUSED2009-05 if( mbFixedMode )
+//UNUSED2009-05 maGrid.ImplSetTextLineFix( nLine, String( *pString, eCharSet ) );
+//UNUSED2009-05 else
+//UNUSED2009-05 maGrid.ImplSetTextLineSep( nLine, String( *pString, eCharSet ), rSepChars, cTextSep, bMergeSep );
+//UNUSED2009-05 }
+//UNUSED2009-05 EnableRepaint();
+//UNUSED2009-05 }
// column settings ------------------------------------------------------------
diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx
index e20542bfedf6..4d3c478d9068 100644
--- a/sc/source/ui/dbgui/fieldwnd.cxx
+++ b/sc/source/ui/dbgui/fieldwnd.cxx
@@ -31,12 +31,11 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sc.hxx"
-
-
#include <vcl/virdev.hxx>
#include <vcl/decoview.hxx>
#include <vcl/svapp.hxx>
-
+#include <vcl/mnemonic.hxx>
+#include <vcl/help.hxx>
#include <tools/debug.hxx>
#include "fieldwnd.hxx"
@@ -44,10 +43,7 @@
#include "pvglob.hxx"
#include "AccessibleDataPilotControl.hxx"
#include "scresid.hxx"
-#ifndef SC_SC_HRC
#include "sc.hrc"
-#endif
-#include <vcl/mnemonic.hxx>
const size_t INVALID_INDEX = static_cast< size_t >( -1 );
@@ -238,27 +234,44 @@ void ScDPFieldWindow::DrawBackground( OutputDevice& rDev )
}
void ScDPFieldWindow::DrawField(
- OutputDevice& rDev, const Rectangle& rRect, const String& rText, bool bFocus )
+ OutputDevice& rDev, const Rectangle& rRect, FieldString& rText, bool bFocus )
{
VirtualDevice aVirDev( rDev );
// #i97623# VirtualDevice is always LTR while other windows derive direction from parent
aVirDev.EnableRTL( IsRTLEnabled() );
+ String aText = rText.first;
Size aDevSize( rRect.GetSize() );
long nWidth = aDevSize.Width();
long nHeight = aDevSize.Height();
- long nLabelWidth = rDev.GetTextWidth( rText );
+ long nLabelWidth = rDev.GetTextWidth( aText );
long nLabelHeight = rDev.GetTextHeight();
- Point aLabelPos(
- ((nWidth > nLabelWidth + 6) ? (nWidth - nLabelWidth) / 2 : 3),
- ((nHeight > nLabelHeight + 6) ? (nHeight - nLabelHeight) / 2 : 3) );
+
+ // #i31600# if text is too long, cut and add ellipsis
+ rText.second = nLabelWidth + 6 <= nWidth;
+ if( !rText.second )
+ {
+ xub_StrLen nMinLen = 0;
+ xub_StrLen nMaxLen = aText.Len();
+ bool bFits = false;
+ do
+ {
+ xub_StrLen nCurrLen = (nMinLen + nMaxLen) / 2;
+ aText = String( rText.first, 0, nCurrLen ).AppendAscii( "..." );
+ nLabelWidth = rDev.GetTextWidth( aText );
+ bFits = nLabelWidth + 6 <= nWidth;
+ (bFits ? nMinLen : nMaxLen) = nCurrLen;
+ }
+ while( !bFits || (nMinLen + 1 < nMaxLen) );
+ }
+ Point aLabelPos( (nWidth - nLabelWidth) / 2, ::std::max< long >( (nHeight - nLabelHeight) / 2, 3 ) );
aVirDev.SetOutputSizePixel( aDevSize );
aVirDev.SetFont( rDev.GetFont() );
DecorationView aDecoView( &aVirDev );
aDecoView.DrawButton( Rectangle( Point( 0, 0 ), aDevSize ), bFocus ? BUTTON_DRAW_DEFAULT : 0 );
aVirDev.SetTextColor( aTextColor );
- aVirDev.DrawText( aLabelPos, rText );
+ aVirDev.DrawText( aLabelPos, aText );
rDev.DrawBitmap( rRect.TopLeft(), aVirDev.GetBitmap( Point( 0, 0 ), aDevSize ) );
}
@@ -292,7 +305,7 @@ void ScDPFieldWindow::Redraw()
if( HasFocus() && (nFieldSelected < aFieldArr.size()) )
{
long nFieldWidth = aFieldRect.GetWidth();
- long nSelectionWidth = Min( GetTextWidth( aFieldArr[ nFieldSelected ] ) + 4, nFieldWidth - 6 );
+ long nSelectionWidth = Min( GetTextWidth( aFieldArr[ nFieldSelected ].first ) + 4, nFieldWidth - 6 );
Rectangle aSelection(
GetFieldPosition( nFieldSelected ) + Point( (nFieldWidth - nSelectionWidth) / 2, 3 ),
Size( nSelectionWidth, aFieldRect.GetHeight() - 6 ) );
@@ -320,6 +333,11 @@ bool ScDPFieldWindow::IsExistingIndex( size_t nIndex ) const
return nIndex < aFieldArr.size();
}
+bool ScDPFieldWindow::IsShortenedText( size_t nIndex ) const
+{
+ return (nIndex < aFieldArr.size()) && !aFieldArr[ nIndex ].second;
+}
+
size_t ScDPFieldWindow::CalcNewFieldIndex( SCsCOL nDX, SCsROW nDY ) const
{
size_t nNewField = nFieldSelected;
@@ -513,6 +531,14 @@ void __EXPORT ScDPFieldWindow::MouseMove( const MouseEvent& rMEvt )
PointerStyle ePtr = pDlg->NotifyMouseMove( OutputToScreenPixel( rMEvt.GetPosPixel() ) );
SetPointer( Pointer( ePtr ) );
}
+ size_t nIndex = 0;
+ if( GetFieldIndex( rMEvt.GetPosPixel(), nIndex ) && IsShortenedText( nIndex ) )
+ {
+ Point aPos = OutputToScreenPixel( rMEvt.GetPosPixel() );
+ Rectangle aRect( aPos, GetSizePixel() );
+ String aHelpText = GetFieldText(nIndex);
+ Help::ShowQuickHelp( this, aRect, aHelpText );
+ }
}
void __EXPORT ScDPFieldWindow::KeyInput( const KeyEvent& rKEvt )
@@ -598,7 +624,7 @@ void ScDPFieldWindow::AddField( const String& rText, size_t nNewIndex )
DBG_ASSERT( nNewIndex == aFieldArr.size(), "ScDPFieldWindow::AddField - invalid index" );
if( IsValidIndex( nNewIndex ) )
{
- aFieldArr.push_back( rText );
+ aFieldArr.push_back( FieldString( rText, true ) );
if (pAccessible)
{
com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xTempAcc = xAccessible;
@@ -646,7 +672,7 @@ void ScDPFieldWindow::SetFieldText( const String& rText, size_t nIndex )
{
if( IsExistingIndex( nIndex ) )
{
- aFieldArr[ nIndex ] = rText;
+ aFieldArr[ nIndex ] = FieldString( rText, true );
Redraw();
if (pAccessible)
@@ -663,7 +689,7 @@ void ScDPFieldWindow::SetFieldText( const String& rText, size_t nIndex )
const String& ScDPFieldWindow::GetFieldText( size_t nIndex ) const
{
if( IsExistingIndex( nIndex ) )
- return aFieldArr[ nIndex ];
+ return aFieldArr[ nIndex ].first;
return EMPTY_STRING;
}
@@ -680,7 +706,7 @@ bool ScDPFieldWindow::AddField( const String& rText, const Point& rPos, size_t&
if( nNewIndex > aFieldArr.size() )
nNewIndex = aFieldArr.size();
- aFieldArr.insert( aFieldArr.begin() + nNewIndex, rText );
+ aFieldArr.insert( aFieldArr.begin() + nNewIndex, FieldString( rText, true ) );
nFieldSelected = nNewIndex;
Redraw();
rnIndex = nNewIndex;
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index 6bc96c13d5b6..773862088155 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -82,7 +82,7 @@ sal_Unicode lcl_CharFromCombo( ComboBox& rCombo, const String& rList )
xub_StrLen nCount = rList.GetTokenCount('\t');
for ( xub_StrLen i=0; i<nCount; i+=2 )
{
- if ( ScGlobal::GetpTransliteration()->isEqual( aStr, rList.GetToken(i,'\t') ) )//CHINA001 if ( ScGlobal::pTransliteration->isEqual( aStr, rList.GetToken(i,'\t') ) )
+ if ( ScGlobal::GetpTransliteration()->isEqual( aStr, rList.GetToken(i,'\t') ) )//CHINA001 if ( ScGlobal::GetpTransliteration()->isEqual( aStr, rList.GetToken(i,'\t') ) )
c = (sal_Unicode)rList.GetToken(i+1,'\t').ToInt32();
}
if (!c && aStr.Len())
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index a290a81d9078..fd3a562ecb42 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -63,6 +63,7 @@
#include "sc.hrc" //CHINA001
#include "scabstdlg.hxx" //CHINA001
+#include "clipparam.hxx"
struct AreaLink_Impl
{
@@ -354,12 +355,12 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
}
else
pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab ); // nur Zieltabelle
- pDoc->CopyToDocument( aOldRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc );
}
else // ohne Einfuegen
{
pUndoDoc->InitUndo( pDoc, nDestTab, nDestTab ); // nur Zieltabelle
- pDoc->CopyToDocument( aMaxRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( aMaxRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc );
}
}
@@ -369,7 +370,7 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
if (bDoInsert)
pDoc->FitBlock( aOldRange, aNewRange ); // incl. loeschen
else
- pDoc->DeleteAreaTab( aMaxRange, IDF_ALL );
+ pDoc->DeleteAreaTab( aMaxRange, IDF_ALL & ~IDF_NOTE );
// Daten kopieren
@@ -389,9 +390,8 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
aSourceMark.SelectOneTable( nSrcTab ); // selektieren fuer CopyToClip
aSourceMark.SetMarkArea( aTokenRange );
- pSrcDoc->CopyToClip( aTokenRange.aStart.Col(), aTokenRange.aStart.Row(),
- aTokenRange.aEnd.Col(), aTokenRange.aEnd.Row(),
- FALSE, &aClipDoc, FALSE, &aSourceMark );
+ ScClipParam aClipParam(aTokenRange, false);
+ pSrcDoc->CopyToClip(aClipParam, &aClipDoc, &aSourceMark);
if ( aClipDoc.HasAttrib( 0,0,nSrcTab, MAXCOL,MAXROW,nSrcTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ) )
@@ -426,7 +426,7 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter,
{
pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
pRedoDoc->InitUndo( pDoc, nDestTab, nDestTab );
- pDoc->CopyToDocument( aNewRange, IDF_ALL, FALSE, pRedoDoc );
+ pDoc->CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, FALSE, pRedoDoc );
pImpl->m_pDocSh->GetUndoManager()->AddUndoAction(
new ScUndoUpdateAreaLink( pImpl->m_pDocSh,
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index ae176868162e..09e4dd7aa4af 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -576,18 +576,21 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
if (bRecord)
{
+ // do not touch notes (ScUndoImportData does not support drawing undo)
+ sal_uInt16 nCopyFlags = IDF_ALL & ~IDF_NOTE;
+
// nFormulaCols is set only if column count is unchanged
pDoc->CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab,
- IDF_ALL, FALSE, pUndoDoc );
+ nCopyFlags, FALSE, pUndoDoc );
if ( rParam.nCol2 > nEndCol )
pDoc->CopyToDocument( nEndCol+1, rParam.nRow1, nTab,
nUndoEndCol, nUndoEndRow, nTab,
- IDF_ALL, FALSE, pUndoDoc );
+ nCopyFlags, FALSE, pUndoDoc );
if ( rParam.nRow2 > nEndRow )
pDoc->CopyToDocument( rParam.nCol1, nEndRow+1, nTab,
nUndoEndCol+nFormulaCols, nUndoEndRow, nTab,
- IDF_ALL, FALSE, pUndoDoc );
+ nCopyFlags, FALSE, pUndoDoc );
}
//
@@ -601,7 +604,7 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
ScRange aDelRange( rParam.nCol1, rParam.nRow1, nTab,
rParam.nCol2, rParam.nRow2, nTab );
- pDoc->DeleteAreaTab( aDelRange, IDF_ALL ); // ohne die Formeln
+ pDoc->DeleteAreaTab( aDelRange, IDF_ALL & ~IDF_NOTE ); // ohne die Formeln
ScRange aOld( rParam.nCol1, rParam.nRow1, nTab,
rParam.nCol2+nFormulaCols, rParam.nRow2, nTab );
@@ -611,10 +614,10 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
}
else if ( nEndCol < rParam.nCol2 ) // DeleteArea calls PutInOrder
pDoc->DeleteArea( nEndCol+1, rParam.nRow1, rParam.nCol2, rParam.nRow2,
- aNewMark, IDF_CONTENTS );
+ aNewMark, IDF_CONTENTS & ~IDF_NOTE );
// CopyToDocument doesn't remove contents
- pDoc->DeleteAreaTab( rParam.nCol1, rParam.nRow1, nEndCol, nEndRow, nTab, IDF_CONTENTS );
+ pDoc->DeleteAreaTab( rParam.nCol1, rParam.nRow1, nEndCol, nEndRow, nTab, IDF_CONTENTS & ~IDF_NOTE );
// #41216# remove each column from ImportDoc after copying to reduce memory usage
BOOL bOldAutoCalc = pDoc->GetAutoCalc();
@@ -671,7 +674,7 @@ BOOL ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
if (nFormulaCols > 0) // include filled formulas for redo
pDoc->CopyToDocument( rParam.nCol1, rParam.nRow1, nTab,
nEndCol+nFormulaCols, nEndRow, nTab,
- IDF_ALL, FALSE, pRedoDoc );
+ IDF_ALL & ~IDF_NOTE, FALSE, pRedoDoc );
ScDBData* pRedoDBData = pDBData ? new ScDBData( *pDBData ) : NULL;
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index ebb080a89cfa..cb5d2ead509f 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -94,6 +94,7 @@
#include "compiler.hxx"
#include "scui_def.hxx" //CHINA001
#include "tabprotection.hxx"
+#include "clipparam.hxx"
#include <memory>
@@ -113,6 +114,14 @@ IMPL_LINK( ScDocFunc, NotifyDrawUndo, SdrUndoAction*, pUndoAction )
else
rDocShell.GetUndoManager()->AddUndoAction( new ScUndoDraw( pUndoAction, &rDocShell ) );
rDocShell.SetDrawModified();
+
+ // the affected sheet isn't known, so all stream positions are invalidated
+ ScDocument* pDoc = rDocShell.GetDocument();
+ SCTAB nTabCount = pDoc->GetTableCount();
+ for (SCTAB nTab=0; nTab<nTabCount; nTab++)
+ if (pDoc->IsStreamValid(nTab))
+ pDoc->SetStreamValid(nTab, FALSE);
+
return 0;
}
@@ -1061,6 +1070,9 @@ bool ScDocFunc::ShowNote( const ScAddress& rPos, bool bShow )
if( rDoc.IsUndoEnabled() )
rDocShell.GetUndoManager()->AddUndoAction( new ScUndoShowHideNote( rDocShell, rPos, bShow ) );
+ if (rDoc.IsStreamValid(rPos.Tab()))
+ rDoc.SetStreamValid(rPos.Tab(), FALSE);
+
rDocShell.SetDocumentModified();
return true;
@@ -1089,6 +1101,9 @@ bool ScDocFunc::SetNoteText( const ScAddress& rPos, const String& rText, BOOL bA
//! Undo !!!
+ if (pDoc->IsStreamValid(rPos.Tab()))
+ pDoc->SetStreamValid(rPos.Tab(), FALSE);
+
rDocShell.PostPaintCell( rPos );
aModificator.SetDocumentModified();
@@ -1142,6 +1157,10 @@ bool ScDocFunc::ReplaceNote( const ScAddress& rPos, const String& rNoteText, con
// repaint cell (to make note marker visible)
rDocShell.PostPaintCell( rPos );
+
+ if (rDoc.IsStreamValid(rPos.Tab()))
+ rDoc.SetStreamValid(rPos.Tab(), FALSE);
+
aModificator.SetDocumentModified();
bDone = true;
}
@@ -1997,7 +2016,7 @@ BOOL ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
nScenarioCount ++;
pDoc->CopyToDocument( nUndoStartX, nUndoStartY, i, nUndoEndX, nUndoEndY, i+nScenarioCount,
- IDF_ALL, FALSE, pUndoDoc );
+ IDF_ALL | IDF_NOCAPTIONS, FALSE, pUndoDoc );
}
}
@@ -2258,8 +2277,8 @@ BOOL ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
}
ScDrawLayer::SetGlobalDrawPersist(aDragShellRef);
- pDoc->CopyToClip( nStartCol, nStartRow, nEndCol, nEndRow, bCut, pClipDoc,
- FALSE, &aSourceMark, bScenariosAdded, TRUE );
+ ScClipParam aClipParam(ScRange(nStartCol, nStartRow, 0, nEndCol, nEndRow, 0), bCut);
+ pDoc->CopyToClip(aClipParam, pClipDoc, &aSourceMark, false, bScenariosAdded, true);
ScDrawLayer::SetGlobalDrawPersist(NULL);
@@ -2766,42 +2785,42 @@ BOOL ScDocFunc::SetLayoutRTL( SCTAB nTab, BOOL bRTL, BOOL /* bApi */ )
return TRUE;
}
-BOOL ScDocFunc::SetGrammar( formula::FormulaGrammar::Grammar eGrammar )
-{
- ScDocument* pDoc = rDocShell.GetDocument();
-
- if ( pDoc->GetGrammar() == eGrammar )
- return TRUE;
-
- BOOL bUndo(pDoc->IsUndoEnabled());
- ScDocShellModificator aModificator( rDocShell );
-
- pDoc->SetGrammar( eGrammar );
-
- if (bUndo)
- {
- rDocShell.GetUndoManager()->AddUndoAction( new ScUndoSetGrammar( &rDocShell, eGrammar ) );
- }
-
- rDocShell.PostPaint( 0,0,0,MAXCOL,MAXROW,MAXTAB, PAINT_ALL );
-
- ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
- if (NULL != pViewSh)
- {
- pViewSh->UpdateInputHandler( FALSE, FALSE );
- }
-
- aModificator.SetDocumentModified();
-
- SfxBindings* pBindings = rDocShell.GetViewBindings();
- if (pBindings)
- {
- // erAck: 2006-09-07T22:19+0200 commented out in CWS scr1c1
- //pBindings->Invalidate( FID_TAB_USE_R1C1 );
- }
-
- return TRUE;
-}
+//UNUSED2009-05 BOOL ScDocFunc::SetGrammar( formula::FormulaGrammar::Grammar eGrammar )
+//UNUSED2009-05 {
+//UNUSED2009-05 ScDocument* pDoc = rDocShell.GetDocument();
+//UNUSED2009-05
+//UNUSED2009-05 if ( pDoc->GetGrammar() == eGrammar )
+//UNUSED2009-05 return TRUE;
+//UNUSED2009-05
+//UNUSED2009-05 BOOL bUndo(pDoc->IsUndoEnabled());
+//UNUSED2009-05 ScDocShellModificator aModificator( rDocShell );
+//UNUSED2009-05
+//UNUSED2009-05 pDoc->SetGrammar( eGrammar );
+//UNUSED2009-05
+//UNUSED2009-05 if (bUndo)
+//UNUSED2009-05 {
+//UNUSED2009-05 rDocShell.GetUndoManager()->AddUndoAction( new ScUndoSetGrammar( &rDocShell, eGrammar ) );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 rDocShell.PostPaint( 0,0,0,MAXCOL,MAXROW,MAXTAB, PAINT_ALL );
+//UNUSED2009-05
+//UNUSED2009-05 ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
+//UNUSED2009-05 if (NULL != pViewSh)
+//UNUSED2009-05 {
+//UNUSED2009-05 pViewSh->UpdateInputHandler( FALSE, FALSE );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 aModificator.SetDocumentModified();
+//UNUSED2009-05
+//UNUSED2009-05 SfxBindings* pBindings = rDocShell.GetViewBindings();
+//UNUSED2009-05 if (pBindings)
+//UNUSED2009-05 {
+//UNUSED2009-05 // erAck: 2006-09-07T22:19+0200 commented out in CWS scr1c1
+//UNUSED2009-05 //pBindings->Invalidate( FID_TAB_USE_R1C1 );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 return TRUE;
+//UNUSED2009-05 }
BOOL ScDocFunc::RenameTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL bApi )
{
@@ -3558,7 +3577,7 @@ BOOL ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
//! auch bei Undo selektierte Tabellen beruecksichtigen
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab );
- pDoc->CopyToDocument( rRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc );
}
// use TokenArray if given, string (and flags) otherwise
@@ -3646,7 +3665,7 @@ BOOL ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
//! auch bei Undo selektierte Tabellen beruecksichtigen
ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
pUndoDoc->InitUndo( pDoc, nStartTab, nEndTab );
- pDoc->CopyToDocument( rRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( rRange, IDF_ALL & ~IDF_NOTE, FALSE, pUndoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
new ScUndoTabOp( &rDocShell,
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index c62c2dc41fdf..f7d1e2ccae2f 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -120,6 +120,7 @@
#include "cfgids.hxx"
#include "warnpassword.hxx"
#include "optsolver.hxx"
+#include "sheetdata.hxx"
#include "tabprotection.hxx"
#include "docsh.hxx"
@@ -755,8 +756,13 @@ void __EXPORT ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
if ( IsDocShared() && !SC_MOD()->IsInSharedDocSaving() )
{
}
+ UseSheetSaveEntries(); // use positions from saved file for next saving
}
break;
+ case SFX_EVENT_SAVEASDOCDONE:
+ // new positions are used after "save" and "save as", but not "save to"
+ UseSheetSaveEntries(); // use positions from saved file for next saving
+ break;
default:
{
}
@@ -1850,38 +1856,28 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
aDocument.SetExtDocOptions( pExtDocOpt = new ScExtDocOptions );
pViewShell->GetViewData()->WriteExtOptions( *pExtDocOpt );
-#if ENABLE_SHEET_PROTECTION
- bool bNeedRetypePassDlg = ScPassHashHelper::needsPassHashRegen(aDocument, PASSHASH_XL);
- if (bNeedRetypePassDlg && !pViewShell->ExecuteRetypePassDlg(PASSHASH_XL))
+ /* #115980# #i104990# If the imported document contains a medium
+ password, determine if we can save it, otherwise ask the users
+ whether they want to save without it. */
+ if( !::sfx2::CheckMSPasswordCapabilityForExport( aFltName ) )
{
- SetError( ERRCODE_ABORT );
- return false;
- }
-#else
-
- do
- {
- SfxItemSet* pSet = rMed.GetItemSet();
- if (!pSet)
- break;
-
- const SfxPoolItem* pItem = NULL;
- if (SFX_ITEM_SET != pSet->GetItemState(SID_PASSWORD, sal_True, &pItem))
- // password is not set.
- break;
-
- /* #115980 #If the imported document contained an encrypted password -
- determine if we should save without it. */
- bDoSave = ScWarnPassword::WarningOnPassword( rMed );
-
- if (bDoSave)
+ SfxItemSet* pItemSet = rMed.GetItemSet();
+ const SfxPoolItem* pItem = 0;
+ if( pItemSet && pItemSet->GetItemState( SID_PASSWORD, sal_True, &pItem ) == SFX_ITEM_SET )
{
- // #i42858# warn only one time
- pSet->ClearItem(SID_PASSWORD);
+ bDoSave = ScWarnPassword::WarningOnPassword( rMed );
+ // #i42858# remove password from medium (warn only one time)
+ if( bDoSave )
+ pItemSet->ClearItem( SID_PASSWORD );
}
}
- while (false);
+#if ENABLE_SHEET_PROTECTION
+ if( bDoSave )
+ {
+ bool bNeedRetypePassDlg = ScPassHashHelper::needsPassHashRegen( aDocument, PASSHASH_XL );
+ bDoSave = !bNeedRetypePassDlg || pViewShell->ExecuteRetypePassDlg( PASSHASH_XL );
+ }
#endif
}
@@ -2212,6 +2208,7 @@ BOOL ScDocShell::HasAutomaticTableName( const String& rFilter ) // static
pPaintLockData ( NULL ), \
pOldJobSetup ( NULL ), \
pSolverSaveData ( NULL ), \
+ pSheetSaveData ( NULL ), \
pModificator ( NULL )
//------------------------------------------------------------------
@@ -2305,6 +2302,7 @@ __EXPORT ScDocShell::~ScDocShell()
delete pOldJobSetup; // gesetzt nur bei Fehler in StartJob()
delete pSolverSaveData;
+ delete pSheetSaveData;
delete pOldAutoDBRange;
if (pModificator)
@@ -2475,6 +2473,39 @@ void ScDocShell::SetSolverSaveData( const ScOptSolverSave& rData )
pSolverSaveData = new ScOptSolverSave( rData );
}
+ScSheetSaveData* ScDocShell::GetSheetSaveData()
+{
+ if (!pSheetSaveData)
+ pSheetSaveData = new ScSheetSaveData;
+
+ return pSheetSaveData;
+}
+
+void ScDocShell::UseSheetSaveEntries()
+{
+ if (pSheetSaveData)
+ {
+ pSheetSaveData->UseSaveEntries(); // use positions from saved file for next saving
+
+ bool bHasEntries = false;
+ SCTAB nTabCount = aDocument.GetTableCount();
+ SCTAB nTab;
+ for (nTab = 0; nTab < nTabCount; ++nTab)
+ if (pSheetSaveData->HasStreamPos(nTab))
+ bHasEntries = true;
+
+ if (!bHasEntries)
+ {
+ // if no positions were set (for example, export to other format),
+ // reset all "valid" flags
+
+ for (nTab = 0; nTab < nTabCount; ++nTab)
+ if (aDocument.IsStreamValid(nTab))
+ aDocument.SetStreamValid(nTab, FALSE);
+ }
+ }
+}
+
// --- ScDocShellModificator ------------------------------------------
ScDocShellModificator::ScDocShellModificator( ScDocShell& rDS )
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index fcbfb648ae14..380f4635cdcf 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -483,6 +483,10 @@ OutputDevice* ScDocShell::GetRefDevice()
USHORT ScDocShell::SetPrinter( SfxPrinter* pNewPrinter, USHORT nDiffFlags )
{
+ SfxPrinter *pOld = aDocument.GetPrinter( FALSE );
+ if ( pOld && pOld->IsPrinting() )
+ return SFX_PRINTERROR_BUSY;
+
if (nDiffFlags & SFX_PRINTER_PRINTER)
{
if ( aDocument.GetPrinter() != pNewPrinter )
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index d4df2863eec5..80b0c76a64be 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1300,6 +1300,13 @@ void ScDocShell::DoHardRecalc( BOOL /* bApi */ )
aDocument.BroadcastUno( SfxSimpleHint( SC_HINT_CALCALL ) );
aDocument.BroadcastUno( SfxSimpleHint( SFX_HINT_DATACHANGED ) );
+ // use hard recalc also to disable stream-copying of all sheets
+ // (somewhat consistent with charts)
+ SCTAB nTabCount = aDocument.GetTableCount();
+ for (SCTAB nTab=0; nTab<nTabCount; nTab++)
+ if (aDocument.IsStreamValid(nTab))
+ aDocument.SetStreamValid(nTab, FALSE);
+
PostPaintGridAll();
}
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 281f03ff3622..b7c726deeb71 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -406,6 +406,7 @@ void ScDocShell::UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore )
{
BOOL bIsUndoEnabled = aDocument.IsUndoEnabled();
aDocument.EnableUndo( FALSE );
+ aDocument.LockStreamValid( true ); // ignore draw page size (but not formula results)
if ( bBefore ) // check all sheets up to nUpdateTab
{
SCTAB nTabCount = aDocument.GetTableCount();
@@ -437,16 +438,10 @@ void ScDocShell::UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore )
aDocument.SetPendingRowHeights( nUpdateTab, FALSE );
}
}
+ aDocument.LockStreamValid( false );
aDocument.EnableUndo( bIsUndoEnabled );
}
-#if OLD_PIVOT_IMPLEMENTATION
-void ScDocShell::PivotUpdate( ScPivot*, ScPivot*, BOOL, BOOL )
-{
- DBG_ERRORFILE("PivotUpdate is obsolete!");
-}
-#endif
-
void ScDocShell::RefreshPivotTables( const ScRange& rSource )
{
//! rename to RefreshDataPilotTables?
diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx
index 149856b4aa6b..d58777b9b5d5 100644
--- a/sc/source/ui/docshell/docsh8.cxx
+++ b/sc/source/ui/docshell/docsh8.cxx
@@ -43,13 +43,14 @@
#include <ucbhelper/content.hxx>
#include <unotools/sharedunocomponent.hxx>
#include <comphelper/processfactory.hxx>
-#include <connectivity/dbcharset.hxx>
#include <svx/txenctab.hxx>
+#include <svx/dbcharsethelper.hxx>
#include <com/sun/star/sdb/CommandType.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
#include <com/sun/star/sdbc/XDriver.hpp>
+#include <com/sun/star/sdbc/XDriverAccess.hpp>
#include <com/sun/star/sdbc/XDriverManager.hpp>
#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
@@ -104,6 +105,61 @@ using namespace com::sun::star;
#define SC_ROWCOUNT_ERROR (-1)
+namespace
+{
+ ULONG lcl_getDBaseConnection(uno::Reference<sdbc::XDriverManager>& _rDrvMgr,uno::Reference<sdbc::XConnection>& _rConnection,String& _rTabName,const String& rFullFileName,rtl_TextEncoding eCharSet)
+ {
+ INetURLObject aURL;
+ aURL.SetSmartProtocol( INET_PROT_FILE );
+ aURL.SetSmartURL( rFullFileName );
+ _rTabName = aURL.getBase( INetURLObject::LAST_SEGMENT, true,
+ INetURLObject::DECODE_UNAMBIGUOUS );
+ String aExtension = aURL.getExtension();
+ aURL.removeSegment();
+ aURL.removeFinalSlash();
+ String aPath = aURL.GetMainURL(INetURLObject::NO_DECODE);
+ uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
+ if (!xFactory.is()) return SCERR_EXPORT_CONNECT;
+
+ _rDrvMgr.set( xFactory->createInstance(
+ rtl::OUString::createFromAscii( SC_SERVICE_DRVMAN ) ),
+ uno::UNO_QUERY);
+ DBG_ASSERT( _rDrvMgr.is(), "can't get DriverManager" );
+ if (!_rDrvMgr.is()) return SCERR_EXPORT_CONNECT;
+
+ // get connection
+
+ String aConnUrl = String::CreateFromAscii("sdbc:dbase:");
+ aConnUrl += aPath;
+
+ svxform::ODataAccessCharsetHelper aHelper;
+ ::std::vector< rtl_TextEncoding > aEncodings;
+ aHelper.getSupportedTextEncodings( aEncodings );
+ ::std::vector< rtl_TextEncoding >::iterator aIter = ::std::find(aEncodings.begin(),aEncodings.end(),(rtl_TextEncoding) eCharSet);
+ if ( aIter == aEncodings.end() )
+ {
+ DBG_ERRORFILE( "DBaseImport: dbtools::OCharsetMap doesn't know text encoding" );
+ return SCERR_IMPORT_CONNECT;
+ } // if ( aIter == aMap.end() )
+ rtl::OUString aCharSetStr;
+ if ( RTL_TEXTENCODING_DONTKNOW != *aIter )
+ { // it's not the virtual "system charset"
+ const char* pIanaName = rtl_getMimeCharsetFromTextEncoding( *aIter );
+ OSL_ENSURE( pIanaName, "invalid mime name!" );
+ if ( pIanaName )
+ aCharSetStr = ::rtl::OUString::createFromAscii( pIanaName );
+ }
+
+ uno::Sequence<beans::PropertyValue> aProps(2);
+ aProps[0].Name = rtl::OUString::createFromAscii(SC_DBPROP_EXTENSION);
+ aProps[0].Value <<= rtl::OUString( aExtension );
+ aProps[1].Name = rtl::OUString::createFromAscii(SC_DBPROP_CHARSET);
+ aProps[1].Value <<= aCharSetStr;
+
+ _rConnection = _rDrvMgr->getConnectionWithInfo( aConnUrl, aProps );
+ return 0L;
+ }
+}
// -----------------------------------------------------------------------
// MoveFile/KillFile/IsDocument: similar to SfxContentHelper
@@ -201,48 +257,13 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
try
{
- INetURLObject aURL;
- aURL.SetSmartProtocol( INET_PROT_FILE );
- aURL.SetSmartURL( rFullFileName );
- String aTabName = aURL.getBase( INetURLObject::LAST_SEGMENT, true,
- INetURLObject::DECODE_UNAMBIGUOUS );
- String aExtension = aURL.getExtension();
- aURL.removeSegment();
- aURL.removeFinalSlash();
- String aPath = aURL.GetMainURL(INetURLObject::NO_DECODE);
-
- uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
- if (!xFactory.is())
- return ERRCODE_IO_GENERAL;
-
- uno::Reference<sdbc::XDriverManager> xDrvMan( xFactory->createInstance(
- rtl::OUString::createFromAscii( SC_SERVICE_DRVMAN ) ),
- uno::UNO_QUERY);
- DBG_ASSERT( xDrvMan.is(), "can't get DriverManager" );
- if (!xDrvMan.is()) return SCERR_IMPORT_CONNECT;
-
- String aConnUrl = String::CreateFromAscii("sdbc:dbase:");
- aConnUrl += aPath;
-
- dbtools::OCharsetMap aMap;
- dbtools::OCharsetMap::CharsetIterator aIter = aMap.find( (rtl_TextEncoding) eCharSet );
- if ( aIter == aMap.end() )
- {
- DBG_ERRORFILE( "DBaseImport: dbtools::OCharsetMap doesn't know text encoding" );
- return SCERR_IMPORT_CONNECT;
- }
- rtl::OUString aCharSetStr = (*aIter).getIanaName();
-
- uno::Sequence<beans::PropertyValue> aProps(2);
- aProps[0].Name = rtl::OUString::createFromAscii(SC_DBPROP_EXTENSION);
- aProps[0].Value <<= rtl::OUString( aExtension );
- aProps[1].Name = rtl::OUString::createFromAscii(SC_DBPROP_CHARSET);
- aProps[1].Value <<= aCharSetStr;
-
- uno::Reference<sdbc::XConnection> xConnection =
- xDrvMan->getConnectionWithInfo( aConnUrl, aProps );
- DBG_ASSERT( xConnection.is(), "can't get Connection" );
- if (!xConnection.is()) return SCERR_IMPORT_CONNECT;
+ String aTabName;
+ uno::Reference<sdbc::XDriverManager> xDrvMan;
+ uno::Reference<sdbc::XConnection> xConnection;
+ ULONG nRet = lcl_getDBaseConnection(xDrvMan,xConnection,aTabName,rFullFileName,eCharSet);
+ if ( !xConnection.is() || !xDrvMan.is() )
+ return nRet;
+ ::utl::DisposableComponent aConnectionHelper(xConnection);
long nRowCount = 0;
if ( nRowCount < 0 )
@@ -252,10 +273,11 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
}
ScProgress aProgress( this, ScGlobal::GetRscString( STR_LOAD_DOC ), nRowCount );
-
+ uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
uno::Reference<sdbc::XRowSet> xRowSet( xFactory->createInstance(
rtl::OUString::createFromAscii( SC_SERVICE_ROWSET ) ),
uno::UNO_QUERY);
+ ::utl::DisposableComponent aRowSetHelper(xRowSet);
uno::Reference<beans::XPropertySet> xRowProp( xRowSet, uno::UNO_QUERY );
DBG_ASSERT( xRowProp.is(), "can't get RowSet" );
if (!xRowProp.is()) return SCERR_IMPORT_CONNECT;
@@ -369,9 +391,6 @@ ULONG ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet,
if ( nRowCount )
aProgress.SetStateOnPercent( nRow );
}
-
- comphelper::disposeComponent( xRowSet );
- comphelper::disposeComponent( xConnection );
}
catch ( sdbc::SQLException& )
{
@@ -733,91 +752,29 @@ ULONG ScDocShell::DBaseExport( const String& rFullFileName, CharSet eCharSet, BO
aColNames.getArray(), aColTypes.getArray(),
aColLengths.getArray(), aColScales.getArray(),
bHasMemo, eCharSet );
-
- INetURLObject aURL;
- aURL.SetSmartProtocol( INET_PROT_FILE );
- aURL.SetSmartURL( rFullFileName );
- String aTabName = aURL.getBase( INetURLObject::LAST_SEGMENT, true,
- INetURLObject::DECODE_UNAMBIGUOUS );
- String aExtension = aURL.getExtension();
- aURL.removeSegment();
- aURL.removeFinalSlash();
- String aPath = aURL.GetMainURL(INetURLObject::NO_DECODE);
-
// also needed for exception catch
SCROW nDocRow = 0;
ScFieldEditEngine aEditEngine( aDocument.GetEditPool() );
String aString;
+ String aTabName;
try
{
- uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
- if (!xFactory.is()) return SCERR_EXPORT_CONNECT;
-
- uno::Reference<sdbc::XDriverManager> xDrvMan( xFactory->createInstance(
- rtl::OUString::createFromAscii( SC_SERVICE_DRVMAN ) ),
- uno::UNO_QUERY);
- DBG_ASSERT( xDrvMan.is(), "can't get DriverManager" );
- if (!xDrvMan.is()) return SCERR_EXPORT_CONNECT;
-
- // get connection
-
- String aConnUrl = String::CreateFromAscii("sdbc:dbase:");
- aConnUrl += aPath;
-
- dbtools::OCharsetMap aMap;
- dbtools::OCharsetMap::CharsetIterator aIter = aMap.find( (rtl_TextEncoding) eCharSet );
- if ( aIter == aMap.end() )
- {
- DBG_ERRORFILE( "DBaseExport: dbtools::OCharsetMap doesn't know text encoding" );
- return SCERR_EXPORT_CONNECT;
- }
- rtl::OUString aCharSetStr = (*aIter).getIanaName();
-
- uno::Sequence<beans::PropertyValue> aProps(2);
- aProps[0].Name = rtl::OUString::createFromAscii(SC_DBPROP_EXTENSION);
- aProps[0].Value <<= rtl::OUString( aExtension );
- aProps[1].Name = rtl::OUString::createFromAscii(SC_DBPROP_CHARSET);
- aProps[1].Value <<= aCharSetStr;
-
- uno::Reference<sdbc::XConnection> xConnection =
- xDrvMan->getConnectionWithInfo( aConnUrl, aProps );
- DBG_ASSERT( xConnection.is(), "can't get Connection" );
- if (!xConnection.is()) return SCERR_EXPORT_CONNECT;
+ uno::Reference<sdbc::XDriverManager> xDrvMan;
+ uno::Reference<sdbc::XConnection> xConnection;
+ ULONG nRet = lcl_getDBaseConnection(xDrvMan,xConnection,aTabName,rFullFileName,eCharSet);
+ if ( !xConnection.is() || !xDrvMan.is() )
+ return nRet;
::utl::DisposableComponent aConnectionHelper(xConnection);
// get dBase driver
-
- uno::Reference<sdbc::XDriver> xDriver;
- BOOL bDriverFound = FALSE;
-
- uno::Reference<container::XEnumerationAccess> xEnAcc( xDrvMan, uno::UNO_QUERY );
- DBG_ASSERT( xEnAcc.is(), "can't get DriverManager EnumerationAccess" );
- if (!xEnAcc.is()) return SCERR_EXPORT_CONNECT;
-
- uno::Reference<container::XEnumeration> xEnum = xEnAcc->createEnumeration();
- DBG_ASSERT( xEnum.is(), "can't get DriverManager Enumeration" );
- if (!xEnum.is()) return SCERR_EXPORT_CONNECT;
-
- while ( xEnum->hasMoreElements() && !bDriverFound )
- {
- uno::Any aElement = xEnum->nextElement();
- if ( aElement >>= xDriver )
- if ( xDriver.is() && xDriver->acceptsURL( aConnUrl ) )
- bDriverFound = TRUE;
- }
-
- DBG_ASSERT( bDriverFound, "can't get dBase driver" );
- if (!bDriverFound) return SCERR_EXPORT_CONNECT;
+ uno::Reference< sdbc::XDriverAccess> xAccess(xDrvMan,uno::UNO_QUERY);
+ uno::Reference< sdbcx::XDataDefinitionSupplier > xDDSup( xAccess->getDriverByURL( xConnection->getMetaData()->getURL() ), uno::UNO_QUERY );
+ if ( !xDDSup.is() )
+ return SCERR_EXPORT_CONNECT;
// create table
-
- uno::Reference<sdbcx::XDataDefinitionSupplier> xDDSup( xDriver, uno::UNO_QUERY );
- DBG_ASSERT( xDDSup.is(), "can't get XDataDefinitionSupplier" );
- if (!xDDSup.is()) return SCERR_EXPORT_CONNECT;
-
- uno::Reference<sdbcx::XTablesSupplier> xTablesSupp =
- xDDSup->getDataDefinitionByConnection( xConnection );
+ uno::Reference<sdbcx::XTablesSupplier> xTablesSupp =xDDSup->getDataDefinitionByConnection( xConnection );
DBG_ASSERT( xTablesSupp.is(), "can't get Data Definition" );
if (!xTablesSupp.is()) return SCERR_EXPORT_CONNECT;
@@ -893,7 +850,7 @@ ULONG ScDocShell::DBaseExport( const String& rFullFileName, CharSet eCharSet, BO
// if (!xConnection.is()) return SCERR_EXPORT_CONNECT;
// get row set for writing
-
+ uno::Reference<lang::XMultiServiceFactory> xFactory = comphelper::getProcessServiceFactory();
uno::Reference<sdbc::XRowSet> xRowSet( xFactory->createInstance(
rtl::OUString::createFromAscii( SC_SERVICE_ROWSET ) ),
uno::UNO_QUERY);
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 9cc0b274028e..f74e8c519fb6 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -384,11 +384,6 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData(
return TokenArrayRef();
DocItem& rDoc = itrDoc->second;
- RangeArrayMap::const_iterator itrRange = rDoc.maRangeArrays.find(rRange);
- if (itrRange != rDoc.maRangeArrays.end())
- {
- return itrRange->second;
- }
TableNameIndexMap::iterator itrTabId = rDoc.maTableNameIndex.find(
ScGlobal::pCharClass->upper(rTabName));
@@ -410,6 +405,13 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData(
// not all tables are cached.
return TokenArrayRef();
+ ScRange aCacheRange( nCol1, nRow1, static_cast<SCTAB>(nTabFirstId), nCol2, nRow2, static_cast<SCTAB>(nTabLastId));
+ RangeArrayMap::const_iterator itrRange = rDoc.maRangeArrays.find( aCacheRange);
+ if (itrRange != rDoc.maRangeArrays.end())
+ {
+ return itrRange->second;
+ }
+
TokenArrayRef pArray(new ScTokenArray);
bool bFirstTab = true;
for (size_t nTab = nTabFirstId; nTab <= nTabLastId; ++nTab)
@@ -462,7 +464,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefCache::getCellRangeData(
bFirstTab = false;
}
- rDoc.maRangeArrays.insert(RangeArrayMap::value_type(rRange, pArray));
+ rDoc.maRangeArrays.insert( RangeArrayMap::value_type( aCacheRange, pArray));
return pArray;
}
@@ -545,13 +547,13 @@ void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRa
return;
}
- size_t nTab1 = itrTabName->second;
+ size_t nTabFirstId = itrTabName->second;
SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row();
SCCOL nCol1 = rRange.aStart.Col(), nCol2 = rRange.aEnd.Col();
vector<SingleRangeData>::const_iterator itrDataBeg = rData.begin(), itrDataEnd = rData.end();
for (vector<SingleRangeData>::const_iterator itrData = itrDataBeg; itrData != itrDataEnd; ++itrData)
{
- size_t i = nTab1 + ::std::distance(itrDataBeg, itrData);
+ size_t i = nTabFirstId + ::std::distance(itrDataBeg, itrData);
TableTypeRef& pTabData = rDoc.maTables[i];
if (!pTabData.get())
pTabData.reset(new Table);
@@ -575,7 +577,9 @@ void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRa
}
}
- rDoc.maRangeArrays.insert(RangeArrayMap::value_type(rRange, pArray));
+ size_t nTabLastId = nTabFirstId + rRange.aEnd.Tab() - rRange.aStart.Tab();
+ ScRange aCacheRange( nCol1, nRow1, static_cast<SCTAB>(nTabFirstId), nCol2, nRow2, static_cast<SCTAB>(nTabLastId));
+ rDoc.maRangeArrays.insert( RangeArrayMap::value_type( aCacheRange, pArray));
}
bool ScExternalRefCache::isDocInitialized(sal_uInt16 nFileId)
@@ -950,9 +954,18 @@ ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nF
ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nFileId, const String& rTabName, bool bCreateNew, size_t* pnIndex)
{
+ // In API, the index is transported as cached sheet ID of type sal_Int32 in
+ // sheet::SingleReference.Sheet or sheet::ComplexReference.Reference1.Sheet
+ // in a sheet::FormulaToken, choose a sensible value for N/A. Effectively
+ // being 0xffffffff
+ const size_t nNotAvailable = static_cast<size_t>( static_cast<sal_Int32>( -1));
+
DocItem* pDoc = getDocItem(nFileId);
if (!pDoc)
+ {
+ if (pnIndex) *pnIndex = nNotAvailable;
return TableTypeRef();
+ }
DocItem& rDoc = *pDoc;
@@ -966,7 +979,10 @@ ScExternalRefCache::TableTypeRef ScExternalRefCache::getCacheTable(sal_uInt16 nF
}
if (!bCreateNew)
+ {
+ if (pnIndex) *pnIndex = nNotAvailable;
return TableTypeRef();
+ }
// Specified table doesn't exist yet. Create one.
nIndex = rDoc.maTables.size();
@@ -1045,7 +1061,7 @@ void ScExternalRefLink::DataChanged(const String& /*rMimeType*/, const Any& /*rV
else
{
// The source document has changed.
- pMgr->switchSrcFile(mnFileId, aFile);
+ pMgr->switchSrcFile(mnFileId, aFile, aFilter);
maFilterName = aFilter;
}
}
@@ -1891,24 +1907,17 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri
if (!pFileData)
return NULL;
+ // Always load the document by using the path created from the relative
+ // path. If the referenced document is not there, simply exit. The
+ // original file name should be used only when the relative path is not
+ // given.
String aFile = pFileData->maFileName;
- if (!isFileLoadable(aFile))
- {
- // The original file path is not loadable. Try the relative path.
- // Note that the path is relative to the content.xml substream which
- // is one-level higher than the file itself.
+ maybeCreateRealFileName(nFileId);
+ if (pFileData->maRealFileName.Len())
+ aFile = pFileData->maRealFileName;
- if (!pFileData->maRelativeName.Len())
- return NULL;
-
- INetURLObject aBaseURL(getOwnDocumentName());
- aBaseURL.insertName(OUString::createFromAscii("content.xml"));
- bool bWasAbs = false;
- aFile = aBaseURL.smartRel2Abs(pFileData->maRelativeName, bWasAbs).GetMainURL(INetURLObject::NO_DECODE);
- if (!isFileLoadable(aFile))
- // Ok, I've tried both paths but no success. Bail out.
- return NULL;
- }
+ if (!isFileLoadable(aFile))
+ return NULL;
String aOptions;
ScDocumentLoader::GetFilterName(aFile, rFilter, aOptions, true, false);
@@ -1960,6 +1969,9 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri
bool ScExternalRefManager::isFileLoadable(const String& rFile) const
{
+ if (!rFile.Len())
+ return false;
+
if (isOwnDocument(rFile))
return false;
@@ -1994,6 +2006,32 @@ void ScExternalRefManager::maybeLinkExternalFile(sal_uInt16 nFileId)
maLinkedDocs.insert(LinkedDocMap::value_type(nFileId, true));
}
+void ScExternalRefManager::SrcFileData::maybeCreateRealFileName(const String& rOwnDocName)
+{
+ if (!maRelativeName.Len())
+ // No relative path given. Nothing to do.
+ return;
+
+ if (maRealFileName.Len())
+ // Real file name already created. Nothing to do.
+ return;
+
+ // Formulate the absolute file path from the relative path.
+ const String& rRelPath = maRelativeName;
+ INetURLObject aBaseURL(rOwnDocName);
+ aBaseURL.insertName(OUString::createFromAscii("content.xml"));
+ bool bWasAbs = false;
+ maRealFileName = aBaseURL.smartRel2Abs(rRelPath, bWasAbs).GetMainURL(INetURLObject::NO_DECODE);
+}
+
+void ScExternalRefManager::maybeCreateRealFileName(sal_uInt16 nFileId)
+{
+ if (nFileId >= maSrcFiles.size())
+ return;
+
+ maSrcFiles[nFileId].maybeCreateRealFileName(getOwnDocumentName());
+}
+
bool ScExternalRefManager::compileTokensByCell(const ScAddress& rCell)
{
ScBaseCell* pCell;
@@ -2064,12 +2102,20 @@ sal_uInt16 ScExternalRefManager::getExternalFileId(const String& rFile)
return static_cast<sal_uInt16>(maSrcFiles.size() - 1);
}
-const String* ScExternalRefManager::getExternalFileName(sal_uInt16 nFileId) const
+const String* ScExternalRefManager::getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal)
{
if (nFileId >= maSrcFiles.size())
return NULL;
- return &maSrcFiles[nFileId].maFileName;
+ if (bForceOriginal)
+ return &maSrcFiles[nFileId].maFileName;
+
+ maybeCreateRealFileName(nFileId);
+
+ if (maSrcFiles[nFileId].maRealFileName.Len())
+ return &maSrcFiles[nFileId].maRealFileName;
+ else
+ return &maSrcFiles[nFileId].maFileName;
}
bool ScExternalRefManager::hasExternalFile(sal_uInt16 nFileId) const
@@ -2138,10 +2184,17 @@ void ScExternalRefManager::breakLink(sal_uInt16 nFileId)
notifyAllLinkListeners(nFileId, LINK_BROKEN);
}
-void ScExternalRefManager::switchSrcFile(sal_uInt16 nFileId, const String& rNewFile)
+void ScExternalRefManager::switchSrcFile(sal_uInt16 nFileId, const String& rNewFile, const String& rNewFilter)
{
maSrcFiles[nFileId].maFileName = rNewFile;
maSrcFiles[nFileId].maRelativeName.Erase();
+ maSrcFiles[nFileId].maRealFileName.Erase();
+ if (!maSrcFiles[nFileId].maFilterName.Equals(rNewFilter))
+ {
+ // Filter type has changed.
+ maSrcFiles[nFileId].maFilterName = rNewFilter;
+ maSrcFiles[nFileId].maFilterOptions.Erase();
+ }
refreshNames(nFileId);
}
@@ -2175,19 +2228,18 @@ bool ScExternalRefManager::hasExternalData() const
return !maSrcFiles.empty();
}
-void ScExternalRefManager::resetSrcFileData()
+void ScExternalRefManager::resetSrcFileData(const String& rBaseFileUrl)
{
- INetURLObject aBaseURL(getOwnDocumentName());
- aBaseURL.insertName(OUString::createFromAscii("content.xml"));
- String aBaseUrlStr = aBaseURL.GetMainURL(INetURLObject::NO_DECODE);
for (vector<SrcFileData>::iterator itr = maSrcFiles.begin(), itrEnd = maSrcFiles.end();
itr != itrEnd; ++itr)
{
- if (!itr->maRelativeName.Len())
- {
- itr->maRelativeName = URIHelper::simpleNormalizedMakeRelative(
- aBaseUrlStr, itr->maFileName);
- }
+ // Re-generate relative file name from the absolute file name.
+ String aAbsName = itr->maRealFileName;
+ if (!aAbsName.Len())
+ aAbsName = itr->maFileName;
+
+ itr->maRelativeName = URIHelper::simpleNormalizedMakeRelative(
+ rBaseFileUrl, aAbsName);
}
}
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 67186f84a84a..1561e4c6efeb 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -253,7 +253,7 @@ BOOL ScImportExport::StartPaste()
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
pUndoDoc->InitUndo( pDoc, aRange.aStart.Tab(), aRange.aEnd.Tab() );
- pDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( aRange, IDF_ALL | IDF_NOCAPTIONS, FALSE, pUndoDoc );
}
return TRUE;
}
@@ -270,7 +270,7 @@ void ScImportExport::EndPaste()
{
ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
pRedoDoc->InitUndo( pDoc, aRange.aStart.Tab(), aRange.aEnd.Tab() );
- pDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pRedoDoc );
+ pDoc->CopyToDocument( aRange, IDF_ALL | IDF_NOCAPTIONS, FALSE, pRedoDoc );
ScMarkData aDestMark;
aDestMark.SelectOneTable( aRange.aStart.Tab() );
pDocSh->GetUndoManager()->AddUndoAction(
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 9f7c201c8aca..570d41f7885d 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -280,7 +280,7 @@ BOOL ScTableLink::Refresh(const String& rNewFile, const String& rNewFilter,
{
String aName;
pDoc->GetName( nTab, aName );
- if ( ScGlobal::pTransliteration->isEqual(
+ if ( ScGlobal::GetpTransliteration()->isEqual(
ScGlobal::GetDocTabName( aFileName, aTabName ), aName ) )
{
pDoc->RenameTab( nTab,
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 8c175f0cd3a9..d241843f9745 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -201,7 +201,7 @@ void __EXPORT ScDrawTextObjectBar::Execute( SfxRequest &rReq )
}
break;
- case FID_PASTE_CONTENTS:
+ case SID_PASTE_SPECIAL:
ExecutePasteContents( rReq );
break;
@@ -467,7 +467,7 @@ IMPL_LINK( ScDrawTextObjectBar, ClipboardChanged, TransferableDataHelper*, pData
SfxBindings& rBindings = pViewData->GetBindings();
rBindings.Invalidate( SID_PASTE );
- rBindings.Invalidate( FID_PASTE_CONTENTS );
+ rBindings.Invalidate( SID_PASTE_SPECIAL );
rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
}
return 0;
@@ -502,7 +502,7 @@ void __EXPORT ScDrawTextObjectBar::GetClipState( SfxItemSet& rSet )
switch (nWhich)
{
case SID_PASTE:
- case FID_PASTE_CONTENTS:
+ case SID_PASTE_SPECIAL:
if( !bPastePossible )
rSet.DisableItem( nWhich );
break;
diff --git a/sc/source/ui/drawfunc/drtxtob2.cxx b/sc/source/ui/drawfunc/drtxtob2.cxx
index a011de6fa0e9..d05e0568c1ca 100644
--- a/sc/source/ui/drawfunc/drtxtob2.cxx
+++ b/sc/source/ui/drawfunc/drtxtob2.cxx
@@ -91,7 +91,7 @@ void __EXPORT ScDrawTextObjectBar::ExecuteGlobal( SfxRequest &rReq )
break;
case SID_PASTE:
- case FID_PASTE_CONTENTS:
+ case SID_PASTE_SPECIAL:
case SID_CLIPBOARD_FORMAT_ITEMS:
case SID_HYPERLINK_SETLINK:
{
diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx
index 701a53aecfcc..2152abfd4f8b 100644
--- a/sc/source/ui/drawfunc/futext3.cxx
+++ b/sc/source/ui/drawfunc/futext3.cxx
@@ -110,6 +110,9 @@ void FuText::StopEditMode(BOOL /*bTextDirection*/)
}
}
+ if( pNote )
+ rDoc.LockStreamValid(true); // only the affected sheet is invalidated below
+
/* SdrObjEditView::SdrEndTextEdit() may try to delete the entire drawing
object, if it does not contain text and has invisible border and fill.
This must not happen for note caption objects. They will be removed
@@ -183,6 +186,11 @@ void FuText::StopEditMode(BOOL /*bTextDirection*/)
pAction->SetComment( ScGlobal::GetRscString( bNewNote ? STR_UNDO_INSERTNOTE : STR_UNDO_DELETENOTE ) );
}
}
+
+ // invalidate stream positions only for the affected sheet
+ rDoc.LockStreamValid(false);
+ if (rDoc.IsStreamValid(aNotePos.Tab()))
+ rDoc.SetStreamValid(aNotePos.Tab(), FALSE);
}
}
diff --git a/sc/source/ui/formdlg/privsplt.cxx b/sc/source/ui/formdlg/privsplt.cxx
index 2ea9636691d7..c6eedbc5f06e 100644
--- a/sc/source/ui/formdlg/privsplt.cxx
+++ b/sc/source/ui/formdlg/privsplt.cxx
@@ -232,24 +232,6 @@ void ScPrivatSplit::MouseMove( const MouseEvent& rMEvt )
}
/*************************************************************************
-#* Member: SetXRange Datum:14.10.97
-#*------------------------------------------------------------------------
-#*
-#* Klasse: ScPrivatSplit
-#*
-#* Funktion: Setzt den Range fuer die X- Verschiebung
-#*
-#* Input: neuer Bereich
-#*
-#* Output: ---
-#*
-#************************************************************************/
-void ScPrivatSplit::SetXRange(Range cRgeX)
-{
- aXMovingRange=cRgeX;
-}
-
-/*************************************************************************
#* Member: SetYRange Datum:14.10.97
#*------------------------------------------------------------------------
#*
diff --git a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx
index ba1b10dc4ccd..af871def7b65 100644
--- a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx
+++ b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx
@@ -116,10 +116,10 @@ public:
///===== internal ========================================================
- com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible >
- GetCurrentAccessibleTable();
+//UNUSED2009-05 com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible >
+//UNUSED2009-05 GetCurrentAccessibleTable();
- void ChildCountChanged();
+//UNUSED2009-05 void ChildCountChanged();
protected:
/// Return this object's description.
diff --git a/sc/source/ui/inc/AccessibleText.hxx b/sc/source/ui/inc/AccessibleText.hxx
index 63e263a12f8a..a1138e869d3b 100644
--- a/sc/source/ui/inc/AccessibleText.hxx
+++ b/sc/source/ui/inc/AccessibleText.hxx
@@ -46,6 +46,7 @@ class ScEditViewForwarder;
class ScPreviewShell;
class EditTextObject;
class ScCsvViewForwarder;
+class ScAccessibleCell;
// ============================================================================
@@ -103,7 +104,7 @@ class ScAccessibleCellTextData : public ScAccessibleCellBaseTextData
{
public:
ScAccessibleCellTextData(ScTabViewShell* pViewShell,
- const ScAddress& rP, ScSplitPos eSplitPos);
+ const ScAddress& rP, ScSplitPos eSplitPos, ScAccessibleCell* pAccCell);
virtual ~ScAccessibleCellTextData();
virtual ScAccessibleTextData* Clone() const;
@@ -123,6 +124,7 @@ private:
ScTabViewShell* mpViewShell;
ScSplitPos meSplitPos;
sal_Bool mbViewEditEngine;
+ ScAccessibleCell* mpAccessibleCell;
// prevent the using of this method of the base class
ScSharedCellEditSource* GetOriginalSource() { return NULL; }
diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx
index 74621d3ced41..9e2d833b27d0 100644
--- a/sc/source/ui/inc/anyrefdg.hxx
+++ b/sc/source/ui/inc/anyrefdg.hxx
@@ -128,7 +128,6 @@ private:
protected:
virtual BOOL DoClose( USHORT nId );
- void EnableSpreadsheets( BOOL bFlag = TRUE, BOOL bChilds = TRUE );
void SetDispatcherLock( BOOL bLock );
virtual long PreNotify( NotifyEvent& rNEvt );
diff --git a/sc/source/ui/inc/cellsh.hxx b/sc/source/ui/inc/cellsh.hxx
index 8e09b7350bb1..90adbe40d2d2 100644
--- a/sc/source/ui/inc/cellsh.hxx
+++ b/sc/source/ui/inc/cellsh.hxx
@@ -42,6 +42,7 @@ class SvxClipboardFmtItem;
class TransferableDataHelper;
class TransferableClipboardListener;
class AbstractScLinkedAreaDlg;
+class ScTabViewShell;
struct CellShell_Impl
{
@@ -101,6 +102,8 @@ public:
void ExecutePageSel( SfxRequest& rReq );
void ExecuteMove( SfxRequest& rReq );
void GetStateCursor( SfxItemSet& rSet );
+
+ static void PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTabViewShell, bool bShowDialog );
};
#endif
diff --git a/sc/source/ui/inc/csvtablebox.hxx b/sc/source/ui/inc/csvtablebox.hxx
index 544ec0aaecee..6e9c6b379ca9 100644
--- a/sc/source/ui/inc/csvtablebox.hxx
+++ b/sc/source/ui/inc/csvtablebox.hxx
@@ -77,7 +77,7 @@ private:
// ------------------------------------------------------------------------
public:
- explicit ScCsvTableBox( Window* pParent );
+//UNUSED2009-05 explicit ScCsvTableBox( Window* pParent );
explicit ScCsvTableBox( Window* pParent, const ResId& rResId );
// common table box handling ----------------------------------------------
@@ -112,10 +112,10 @@ public:
void SetUniStrings(
const String* pTextLines, const String& rSepChars,
sal_Unicode cTextSep, bool bMergeSep );
- /** Fills all cells of all lines with the passed texts (ByteStrings). */
- void SetByteStrings(
- const ByteString* pLineTexts, CharSet eCharSet,
- const String& rSepChars, sal_Unicode cTextSep, bool bMergeSep );
+//UNUSED2009-05 /** Fills all cells of all lines with the passed texts (ByteStrings). */
+//UNUSED2009-05 void SetByteStrings(
+//UNUSED2009-05 const ByteString* pLineTexts, CharSet eCharSet,
+//UNUSED2009-05 const String& rSepChars, sal_Unicode cTextSep, bool bMergeSep );
// column settings --------------------------------------------------------
public:
diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx
index 21e295a58fa4..3e9ff5258682 100644
--- a/sc/source/ui/inc/docfunc.hxx
+++ b/sc/source/ui/inc/docfunc.hxx
@@ -124,7 +124,7 @@ public:
BOOL SetLayoutRTL( SCTAB nTab, BOOL bRTL, BOOL bApi );
- BOOL SetGrammar( formula::FormulaGrammar::Grammar eGrammar );
+//UNUSED2009-05 BOOL SetGrammar( formula::FormulaGrammar::Grammar eGrammar );
SC_DLLPUBLIC BOOL SetWidthOrHeight( BOOL bWidth, SCCOLROW nRangeCnt, SCCOLROW* pRanges,
SCTAB nTab, ScSizeMode eMode, USHORT nSizeTwips,
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index b8b8d10f0c6e..9556b4ad8138 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -59,9 +59,6 @@ class INetURLObject;
class ScPaintItem;
class ScViewData;
class ScDocFunc;
-#if OLD_PIVOT_IMPLEMENTATION
-class ScPivot;
-#endif
class ScDrawLayer;
class ScTabViewShell;
class ScSbxDocHelper;
@@ -75,6 +72,7 @@ class VirtualDevice;
class ScImportOptions;
class ScDocShellModificator;
class ScOptSolverSave;
+class ScSheetSaveData;
namespace sfx2 { class FileDialogHelper; }
struct DocShell_Impl;
@@ -126,6 +124,7 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener
ScPaintLockData* pPaintLockData;
ScJobSetup* pOldJobSetup;
ScOptSolverSave* pSolverSaveData;
+ ScSheetSaveData* pSheetSaveData;
ScDocShellModificator* pModificator; // #109979#; is used to load XML (created in BeforeXMLLoading and destroyed in AfterXMLLoading)
@@ -170,6 +169,8 @@ class SC_DLLPUBLIC ScDocShell: public SfxObjectShell, public SfxListener
SC_DLLPRIVATE void EnableSharedSettings( bool bEnable );
SC_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > LoadSharedDocument();
+ SC_DLLPRIVATE void UseSheetSaveEntries();
+
protected:
virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
@@ -293,10 +294,6 @@ public:
void UpdateAllRowHeights( const ScMarkData* pTabMark = NULL );
void UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore = false );
-#if OLD_PIVOT_IMPLEMENTATION
- void PivotUpdate( ScPivot* pOldPivot, ScPivot* pNewPivot,
- BOOL bRecord = TRUE, BOOL bApi = FALSE );
-#endif
void RefreshPivotTables( const ScRange& rSource );
void DoConsolidate( const ScConsolidateParam& rParam, BOOL bRecord = TRUE );
void UseScenario( SCTAB nTab, const String& rName, BOOL bRecord = TRUE );
@@ -421,6 +418,8 @@ public:
const ScOptSolverSave* GetSolverSaveData() const { return pSolverSaveData; } // may be null
void SetSolverSaveData( const ScOptSolverSave& rData );
+
+ ScSheetSaveData* GetSheetSaveData();
};
SO2_DECL_REF(ScDocShell)
diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx
index 33d0f4adf95d..1890bb1247c4 100644
--- a/sc/source/ui/inc/drawview.hxx
+++ b/sc/source/ui/inc/drawview.hxx
@@ -143,7 +143,7 @@ public:
inline void UnlockInternalLayer() { LockInternalLayer( false ); }
SdrEndTextEditKind ScEndTextEdit(); // ruft SetDrawTextUndo(0)
- void CaptionTextDirection(USHORT nSlot);
+//UNUSED2009-05 void CaptionTextDirection(USHORT nSlot);
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CopyToTransferable();
};
diff --git a/sc/source/ui/inc/fieldwnd.hxx b/sc/source/ui/inc/fieldwnd.hxx
index 5b24b5fea3df..ae2dbf1ffb52 100644
--- a/sc/source/ui/inc/fieldwnd.hxx
+++ b/sc/source/ui/inc/fieldwnd.hxx
@@ -68,12 +68,14 @@ enum ScDPFieldType
class ScDPFieldWindow : public Control
{
private:
+ typedef ::std::pair< String, bool > FieldString; // true = text fits into button
+
String aName; /// name of the control, used in Accessibility
ScDPLayoutDlg* pDlg; /// Parent dialog.
Rectangle aWndRect; /// Area rectangle in pixels.
FixedText* pFtCaption; /// FixedText containing the name of the control.
Point aTextPos; /// Position of the caption text.
- std::vector< String > aFieldArr; /// Pointer to string array of the field names.
+ std::vector< FieldString > aFieldArr; /// String array of the field names and flags, if text fits into button.
ScDPFieldType eType; /// Type of this area.
Color aFaceColor; /// Color for dialog background.
Color aWinColor; /// Color for window background.
@@ -97,13 +99,16 @@ private:
void DrawField(
OutputDevice& rDev,
const Rectangle& rRect,
- const String& rText,
+ FieldString& rText,
bool bFocus );
/** @return TRUE, if the field index is inside of the control area. */
bool IsValidIndex( size_t nIndex ) const;
/** @return TRUE, if the field with the given index exists. */
bool IsExistingIndex( size_t nIndex ) const;
+ /** @return TRUE, if the field with the given index exists and the text is
+ too long for the button control. */
+ bool IsShortenedText( size_t nIndex ) const;
/** @return The new selection index after moving to the given direction. */
size_t CalcNewFieldIndex( SCsCOL nDX, SCsROW nDY ) const;
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 844d88055578..8b680daad6cb 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -37,6 +37,7 @@
#include "viewdata.hxx"
#include "cbutton.hxx"
#include <svx/sdr/overlay/overlayobject.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
#include <vector>
@@ -44,9 +45,6 @@
struct ScTableInfo;
class ScViewSelectionEngine;
-#if OLD_PIVOT_IMPLEMENTATION
-class ScPivot;
-#endif
class ScDPObject;
class ScOutputData;
class ScFilterListBox;
@@ -97,44 +95,7 @@ public:
// ---------------------------------------------------------------------------
// predefines
-class ScGridWindow;
-
-enum ScOverlayType { SC_OVERLAY_INVERT, SC_OVERLAY_SOLID, SC_OVERLAY_BORDER_TRANSPARENT };
-
-// #114409#
-namespace sdr
-{
- namespace overlay
- {
- // predefines
- class OverlayObjectList;
-
- // OverlayObjectCell - used for cell cursor, selection and AutoFill handle
-
- class OverlayObjectCell : public OverlayObject
- {
- public:
- typedef ::std::vector< basegfx::B2DRange > RangeVector;
-
- protected:
- basegfx::B2DPolyPolygon impGetOverlayPolyPolygon() const;
-
- private:
- ScOverlayType mePaintType;
- RangeVector maRectangles;
-
- // geometry creation for OverlayObject
- virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
-
- public:
- OverlayObjectCell( ScOverlayType eType, const Color& rColor, const RangeVector& rRects);
- virtual ~OverlayObjectCell();
- };
-
- } // end of namespace overlay
-} // end of namespace sdr
-
-// ---------------------------------------------------------------------------
+namespace sdr { namespace overlay { class OverlayObjectList; }}
class ScGridWindow : public Window, public DropTargetHelper, public DragSourceHelper
{
@@ -170,14 +131,6 @@ private:
BYTE nMouseStatus;
BYTE nNestedButtonState; // track nested button up/down calls
-#if OLD_PIVOT_IMPLEMENTATION
- BOOL bPivotMouse; // Pivot-D&D (alte Pivottabellen)
- ScPivot* pDragPivot;
- BOOL bPivotColField;
- SCCOL nPivotCol;
- SCCOL nPivotField;
-#endif
-
BOOL bDPMouse; // DataPilot-D&D (neue Pivottabellen)
long nDPField;
ScDPObject* pDragDPObj; //! name?
@@ -235,12 +188,6 @@ private:
BOOL DoPageFieldSelection( SCCOL nCol, SCROW nRow );
void DoPushButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt );
-#if OLD_PIVOT_IMPLEMENTATION
- void PivotMouseMove( const MouseEvent& rMEvt );
- void PivotMouseButtonUp( const MouseEvent& rMEvt );
- BOOL PivotTestMouse( const MouseEvent& rMEvt, BOOL bMove );
- void DoPivotDrop( BOOL bDelete, BOOL bToCols, SCSIZE nDestPos );
-#endif
void DPMouseMove( const MouseEvent& rMEvt );
void DPMouseButtonUp( const MouseEvent& rMEvt );
diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index da70a3465dc6..80da3d20982e 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -244,7 +244,9 @@ public:
void FindChanged();
void SetPagebreakMode( ScPageBreakData* pPageData );
+#ifdef OLD_SELECTION_PAINT
void DrawMark( Window* pWin );
+#endif
void DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
SCCOL nRefEndX, SCROW nRefEndY,
const Color& rColor, BOOL bHandle );
diff --git a/sc/source/ui/inc/privsplt.hxx b/sc/source/ui/inc/privsplt.hxx
index b8277a46c4f7..d3b7c9ad96b8 100644
--- a/sc/source/ui/inc/privsplt.hxx
+++ b/sc/source/ui/inc/privsplt.hxx
@@ -73,7 +73,6 @@ class ScPrivatSplit : public Control
virtual void CtrModified();
- void SetXRange(Range cRgeX);
void SetYRange(Range cRgeY);
void MoveSplitTo(Point aPos);
diff --git a/sc/source/ui/inc/refundo.hxx b/sc/source/ui/inc/refundo.hxx
index a796fcd611de..f3250e708b4c 100644
--- a/sc/source/ui/inc/refundo.hxx
+++ b/sc/source/ui/inc/refundo.hxx
@@ -37,9 +37,6 @@ class ScDocument;
class ScDBCollection;
class ScRangeName;
class ScPrintRangeSaver;
-#if OLD_PIVOT_IMPLEMENTATION
-class ScPivotCollection;
-#endif
class ScDPCollection;
class ScChartCollection;
class ScConditionalFormatList;
@@ -54,9 +51,6 @@ private:
ScDBCollection* pDBCollection;
ScRangeName* pRangeName;
ScPrintRangeSaver* pPrintRanges;
-#if OLD_PIVOT_IMPLEMENTATION
- ScPivotCollection* pPivotCollection;
-#endif
ScDPCollection* pDPCollection;
ScConditionalFormatList* pCondFormList;
ScDetOpList* pDetOpList;
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index d7b5e2a8260b..fe5da618e895 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -181,9 +181,6 @@ private:
BOOL bMoveIsShift;
BOOL bNewStartIfMarking;
- BOOL bOldSelection; // old style (inverting) of selection
-
-
void Init();
void DoAddWin( ScGridWindow* pWin );
@@ -227,7 +224,7 @@ protected:
public:
ScTabView( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell );
- ScTabView( Window* pParent, const ScTabView& rScTabView, ScTabViewShell* pViewShell );
+//UNUSED2009-05 ScTabView( Window* pParent, const ScTabView& rScTabView, ScTabViewShell* pViewShell );
~ScTabView();
void MakeDrawLayer();
@@ -528,9 +525,6 @@ public:
void SetBrushDocument( ScDocument* pNew, BOOL bLock );
void SetDrawBrushSet( SfxItemSet* pNew, BOOL bLock );
void ResetBrushDocument();
-
- void UpdateSelectionType();
- BOOL IsOldSelection() const { return bOldSelection; }
};
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 10224536bf0b..eede290aa8db 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -418,7 +418,7 @@ public:
void ExecuteCellFormatDlg ( SfxRequest& rReq, USHORT nTabPage = 0xffff );
- BOOL GetFunction( String& rFuncStr );
+ BOOL GetFunction( String& rFuncStr, sal_uInt16 nErrCode = 0 );
void StartSimpleRefDialog( const String& rTitle, const String& rInitVal,
BOOL bCloseOnButtonUp, BOOL bSingleCell, BOOL bMultiSelection );
diff --git a/sc/source/ui/inc/undotab.hxx b/sc/source/ui/inc/undotab.hxx
index 1eadf24041db..a7cf0d094d6b 100644
--- a/sc/source/ui/inc/undotab.hxx
+++ b/sc/source/ui/inc/undotab.hxx
@@ -493,26 +493,26 @@ private:
};
-class ScUndoSetGrammar : public ScSimpleUndo
-{
-public:
- TYPEINFO();
- ScUndoSetGrammar( ScDocShell* pShell,
- formula::FormulaGrammar::Grammar eGrammar );
- virtual ~ScUndoSetGrammar();
-
- virtual void Undo();
- virtual void Redo();
- virtual void Repeat(SfxRepeatTarget& rTarget);
- virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
-
- virtual String GetComment() const;
-
-private:
- formula::FormulaGrammar::Grammar meNewGrammar, meOldGrammar;
-
- void DoChange( formula::FormulaGrammar::Grammar eGrammar );
-};
+//UNUSED2009-05 class ScUndoSetGrammar : public ScSimpleUndo
+//UNUSED2009-05 {
+//UNUSED2009-05 public:
+//UNUSED2009-05 TYPEINFO();
+//UNUSED2009-05 ScUndoSetGrammar( ScDocShell* pShell,
+//UNUSED2009-05 formula::FormulaGrammar::Grammar eGrammar );
+//UNUSED2009-05 virtual ~ScUndoSetGrammar();
+//UNUSED2009-05
+//UNUSED2009-05 virtual void Undo();
+//UNUSED2009-05 virtual void Redo();
+//UNUSED2009-05 virtual void Repeat(SfxRepeatTarget& rTarget);
+//UNUSED2009-05 virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
+//UNUSED2009-05
+//UNUSED2009-05 virtual String GetComment() const;
+//UNUSED2009-05
+//UNUSED2009-05 private:
+//UNUSED2009-05 formula::FormulaGrammar::Grammar meNewGrammar, meOldGrammar;
+//UNUSED2009-05
+//UNUSED2009-05 void DoChange( formula::FormulaGrammar::Grammar eGrammar );
+//UNUSED2009-05 };
#endif
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 228c4b4c1489..066aadca817a 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -348,6 +348,11 @@ private:
void PasteRTF( SCCOL nCol, SCROW nStartRow,
const ::com::sun::star::uno::Reference<
::com::sun::star::datatransfer::XTransferable >& rxTransferable );
+ bool PasteMultiRangesFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc, sal_uInt16 nFunction,
+ bool bSkipEmpty, bool bTranspos, bool bAsLink, bool bAllowDialogs,
+ InsCellCmd eMoveMode, sal_uInt16 nCondFlags, sal_uInt16 nUndoFlags );
+ void PostPasteFromClip(const ScRange& rPasteRange, const ScMarkData& rMark);
+
USHORT GetOptimalColWidth( SCCOL nCol, SCTAB nTab, BOOL bFormula );
void StartFormatArea();
diff --git a/sc/source/ui/inc/viewutil.hxx b/sc/source/ui/inc/viewutil.hxx
index bfc24e36b464..e7e4e27f233c 100644
--- a/sc/source/ui/inc/viewutil.hxx
+++ b/sc/source/ui/inc/viewutil.hxx
@@ -106,8 +106,10 @@ public:
ScUpdateRect( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 );
void SetNew( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 );
BOOL GetDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
+#ifdef OLD_SELECTION_PAINT
BOOL GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, BOOL& rCont );
void GetContDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 );
+#endif
};
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index 2faf148e5ac1..76330036b1f5 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -2127,7 +2127,7 @@ IMPL_LINK( ScAcceptChgDlg, ColCompareHdl, SvSortData*, pSortData )
if(nRightKind == SV_ITEM_ID_LBOXSTRING &&
nLeftKind == SV_ITEM_ID_LBOXSTRING )
{
- eCompare= (StringCompare) ScGlobal::pCaseCollator->compareString(
+ eCompare= (StringCompare) ScGlobal::GetCaseCollator()->compareString(
((SvLBoxString*)pLeftItem)->GetText(),
((SvLBoxString*)pRightItem)->GetText());
diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx
index 874236075d9f..befabb51a17c 100644
--- a/sc/source/ui/miscdlgs/anyrefdg.cxx
+++ b/sc/source/ui/miscdlgs/anyrefdg.cxx
@@ -826,11 +826,6 @@ BOOL __EXPORT ScAnyRefDlg::DoClose( USHORT nId )
return TRUE;
}
-void ScAnyRefDlg::EnableSpreadsheets(BOOL bFlag, BOOL bChilds)
-{
- m_aHelper.EnableSpreadsheets(bFlag, bChilds);
-}
-
void ScAnyRefDlg::SetDispatcherLock( BOOL bLock )
{
m_aHelper.SetDispatcherLock( bLock );
diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx
index 5f38fbf5c049..08dbd00de0f9 100644
--- a/sc/source/ui/miscdlgs/solveroptions.cxx
+++ b/sc/source/ui/miscdlgs/solveroptions.cxx
@@ -66,7 +66,7 @@ struct ScSolverOptionsEntry
bool operator< (const ScSolverOptionsEntry& rOther) const
{
- return ( ScGlobal::pCollator->compareString( aDescription, rOther.aDescription ) == COMPARE_LESS );
+ return ( ScGlobal::GetCollator()->compareString( aDescription, rOther.aDescription ) == COMPARE_LESS );
}
};
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index a2db7e4e48f0..af3b5f0dee5e 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -71,6 +71,7 @@
#include "navicfg.hxx"
#include "navsett.hxx"
#include "postit.hxx"
+#include "clipparam.hxx"
using namespace com::sun::star;
@@ -1103,9 +1104,8 @@ void lcl_DoDragCells( ScDocShell* pSrcShell, const ScRange& rRange, USHORT nFlag
aMark ) )
{
ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP );
- pSrcDoc->CopyToClip( rRange.aStart.Col(), rRange.aStart.Row(),
- rRange.aEnd.Col(), rRange.aEnd.Row(),
- FALSE, pClipDoc, FALSE, &aMark );
+ ScClipParam aClipParam(rRange, false);
+ pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aMark);
// pClipDoc->ExtendMerge( rRange, TRUE );
TransferableObjectDescriptor aObjDesc;
diff --git a/sc/source/ui/navipi/navipi.src b/sc/source/ui/navipi/navipi.src
index f5eaeb56bae1..6d5baba4d075 100644
--- a/sc/source/ui/navipi/navipi.src
+++ b/sc/source/ui/navipi/navipi.src
@@ -320,7 +320,7 @@ String SCSTR_CONTENT_OLEOBJECT
};
String SCSTR_CONTENT_NOTE
{
- Text [ en-US ] = "Notes" ;
+ Text [ en-US ] = "Comments" ;
};
String SCSTR_CONTENT_AREALINK
{
diff --git a/sc/source/ui/pagedlg/pagedlg.src b/sc/source/ui/pagedlg/pagedlg.src
index a031fbe464c9..6db6b1c06cc7 100644
--- a/sc/source/ui/pagedlg/pagedlg.src
+++ b/sc/source/ui/pagedlg/pagedlg.src
@@ -175,7 +175,7 @@ TabPage RID_SCPAGE_TABLE
{
Pos = MAP_APPFONT ( 12 , 101 ) ;
Size = MAP_APPFONT ( 142 , 10 ) ;
- Text [ en-US ] = "~Notes" ;
+ Text [ en-US ] = "~Comments" ;
TabStop = TRUE ;
};
CheckBox BTN_OBJECTS
diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src
index c5b8cfd1a9e8..fb3890616aa0 100644
--- a/sc/source/ui/src/globstr.src
+++ b/sc/source/ui/src/globstr.src
@@ -304,23 +304,23 @@ Resource RID_GLOBSTR
};
String STR_UNDO_INSERTNOTE
{
- Text [ en-US ] = "Insert Note" ;
+ Text [ en-US ] = "Insert Comment" ;
};
String STR_UNDO_DELETENOTE
{
- Text [ en-US ] = "Delete Note" ;
+ Text [ en-US ] = "Delete Comment" ;
};
String STR_UNDO_SHOWNOTE
{
- Text [ en-US ] = "Show Note" ;
+ Text [ en-US ] = "Show Comment" ;
};
String STR_UNDO_HIDENOTE
{
- Text [ en-US ] = "Hide note" ;
+ Text [ en-US ] = "Hide Comment" ;
};
String STR_UNDO_EDITNOTE
{
- Text [ en-US ] = "Edit Note" ;
+ Text [ en-US ] = "Edit Comment" ;
};
String STR_UNDO_DEC_INDENT
{
@@ -1020,7 +1020,7 @@ Resource RID_GLOBSTR
};
String STR_NOTES
{
- Text [ en-US ] = "Notes" ;
+ Text [ en-US ] = "Comments" ;
};
String STR_QUERY_DELTAB
{
@@ -1260,7 +1260,7 @@ Resource RID_GLOBSTR
};
String STR_SCATTR_PAGE_NOTES
{
- Text [ en-US ] = "Notes" ;
+ Text [ en-US ] = "Comments" ;
};
String STR_SCATTR_PAGE_GRID
{
diff --git a/sc/source/ui/src/hdrcont.src b/sc/source/ui/src/hdrcont.src
index 6b80e2597b87..7ba7b6a1c8fe 100644
--- a/sc/source/ui/src/hdrcont.src
+++ b/sc/source/ui/src/hdrcont.src
@@ -136,8 +136,8 @@ Menu RID_POPUP_ROWHEADER
PART2
MenuItem
{
- Identifier = FID_PASTE_CONTENTS ;
- HelpId = FID_PASTE_CONTENTS ;
+ Identifier = SID_PASTE_SPECIAL ;
+ HelpId = SID_PASTE_SPECIAL ;
Text [ en-US ] = "P~aste Special..." ;
};
};
@@ -214,8 +214,8 @@ Menu RID_POPUP_COLHEADER
PART2
MenuItem
{
- Identifier = FID_PASTE_CONTENTS ;
- HelpId = FID_PASTE_CONTENTS ;
+ Identifier = SID_PASTE_SPECIAL ;
+ HelpId = SID_PASTE_SPECIAL ;
Text [ en-US ] = "Paste ~Special..." ;
};
};
diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src
index ed84da38b742..66e42d08dcef 100644
--- a/sc/source/ui/src/optdlg.src
+++ b/sc/source/ui/src/optdlg.src
@@ -363,7 +363,7 @@ TabPage RID_SCPAGE_CONTENT
{
Pos = MAP_APPFONT ( 139 , 40 ) ;
Size = MAP_APPFONT ( 112 , 10 ) ;
- Text [ en-US ] = "~Note indicator" ;
+ Text [ en-US ] = "~Comment indicator" ;
};
CheckBox CB_VALUE
{
diff --git a/sc/source/ui/src/popup.src b/sc/source/ui/src/popup.src
index 05d10b9813bd..b03c0c0ae135 100644
--- a/sc/source/ui/src/popup.src
+++ b/sc/source/ui/src/popup.src
@@ -86,19 +86,19 @@ Menu RID_POPUP_CELLS
{
Identifier = SID_INSERT_POSTIT ;
HelpId = SID_INSERT_POSTIT ;
- Text [ en-US ] = "Insert ~Note" ;
+ Text [ en-US ] = "Insert Co~mment" ;
};
MenuItem
{
Identifier = SID_DELETE_NOTE ;
HelpId = SID_DELETE_NOTE ;
- Text [ en-US ] = "D~elete Note" ;
+ Text [ en-US ] = "D~elete Comment" ;
};
MenuItem
{
Identifier = FID_NOTE_VISIBLE ;
HelpId = FID_NOTE_VISIBLE ;
- Text [ en-US ] = "Sho~w Note" ;
+ Text [ en-US ] = "Sho~w Comment" ;
};
//------------------------------
MenuItem { Separator = TRUE ; };
@@ -126,8 +126,8 @@ Menu RID_POPUP_CELLS
MenuItem
{
- Identifier = FID_PASTE_CONTENTS ;
- HelpId = FID_PASTE_CONTENTS ;
+ Identifier = SID_PASTE_SPECIAL ;
+ HelpId = SID_PASTE_SPECIAL ;
Text [ en-US ] = "P~aste Special..." ;
};
//------------------------------
@@ -524,7 +524,7 @@ Menu RID_POPUP_PAGEBREAK
{
Identifier = FID_NOTE_VISIBLE ;
HelpId = FID_NOTE_VISIBLE ;
- Text [ en-US ] = "Sho~w Note" ;
+ Text [ en-US ] = "Sho~w Comment" ;
};
};
};
diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src
index ed6273e26ae4..f05793872d4c 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -2691,7 +2691,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1
{
String 1 // Description
{
- Text [ en-US ] = "Raises a number to the power of another." ;
+ Text [ en-US ] = "Returns a^b, base a raised to the power of exponent b." ;
};
ExtraData =
{
@@ -2707,15 +2707,15 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS1
};
String 3 // Description of Parameter 1
{
- Text [ en-US ] = "The number that is to be raised to the power of another." ;
+ Text [ en-US ] = "The base a of the power a^b." ;
};
String 4 // Name of Parameter 2
{
- Text [ en-US ] = "Power" ;
+ Text [ en-US ] = "Exponent" ;
};
String 5 // Description of Parameter 2
{
- Text [ en-US ] = "The power by which the number is to be raised." ;
+ Text [ en-US ] = "The exponent b of the power a^b." ;
};
};
// -=*# Resource for function ANZAHLLEEREZELLEN #*=-
@@ -5718,7 +5718,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
0;
ID_FUNCTION_GRP_STATISTIC;
U2S( HID_FUNC_NORMVERT );
- 4; 0; 0; 0; 0;
+ 4; 0; 0; 0; 1;
0;
};
String 2 // Name of Parameter 1
@@ -5731,7 +5731,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 4 // Name of Parameter 2
{
- Text [ en-US ] = "mean" ;
+ Text [ en-US ] = "Mean" ;
};
String 5 // Description of Parameter 2
{
@@ -5751,7 +5751,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 9 // Description of Parameter 4
{
- Text [ en-US ] = "Cumulated. C=0 calculates the density function, C=1 the distribution." ;
+ Text [ en-US ] = "0 or FALSE calculates the probability density function. Any other value or TRUE or omitted calculates the cumulative distribution function." ;
};
};
// -=*# Resource for function NORMINV #*=-
@@ -5854,7 +5854,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
0;
ID_FUNCTION_GRP_STATISTIC;
U2S( HID_FUNC_LOGNORMVERT );
- 3; 0; 0; 0;
+ 4; 0; 1; 1; 1;
0;
};
String 2 // Name of Parameter 1
@@ -5871,7 +5871,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 5 // Description of Parameter 2
{
- Text [ en-US ] = "Mean value. The mean value of the log normal distribution." ;
+ Text [ en-US ] = "The mean value of the log normal distribution. It is set to 0 if omitted." ;
};
String 6 // Name of Parameter 3
{
@@ -5879,7 +5879,15 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 7 // Description of Parameter 3
{
- Text [ en-US ] = "Standard deviation. The standard deviation of the log normal distribution." ;
+ Text [ en-US ] = "The standard deviation of the log normal distribution. It is set to 1 if omitted." ;
+ };
+ String 8 // Name of Parameter 4
+ {
+ Text [ en-US] = "Cumulative";
+ };
+ String 9 // Description of Parameter 4
+ {
+ Text [ en-US] = "0 or FALSE calculates the probability density function. Any other value or TRUE or omitted calculates the cumulative distribution function." ;
};
};
// -=*# Resource for function LOGINV #*=-
@@ -6758,7 +6766,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
{
String 1 // Description
{
- Text [ en-US ] = "Returns the two-tailed P value of a z test." ;
+ Text [ en-US ] = "Calculates the probability of observing a z-statistic greater than the one computed based on a sample." ;
};
ExtraData =
{
@@ -6774,15 +6782,15 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 3 // Description of Parameter 1
{
- Text [ en-US ] = "The data array." ;
+ Text [ en-US ] = "The given sample, drawn from a normally distributed population." ;
};
String 4 // Name of Parameter 2
{
- Text [ en-US ] = "Number" ;
+ Text [ en-US ] = "mu" ;
};
String 5 // Description of Parameter 2
{
- Text [ en-US ] = "The value to be tested." ;
+ Text [ en-US ] = "The known mean of the population." ;
};
String 6 // Name of Parameter 3
{
@@ -6790,7 +6798,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 7 // Description of Parameter 3
{
- Text [ en-US ] = "The standard deviation of the population." ;
+ Text [ en-US ] = "The known standard deviation of the population. If omitted, the standard deviation of the given sample is used." ;
};
};
// -=*# Resource for function CHITEST #*=-
@@ -8906,7 +8914,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
ExtraData =
{
- 1; // TODO: implementation and unsuppress
+ 0;
ID_FUNCTION_GRP_TEXT;
U2S( HID_FUNC_UNICODE );
1; 0;
@@ -8929,7 +8937,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
ExtraData =
{
- 1; // TODO: implementation and unsuppress
+ 0;
ID_FUNCTION_GRP_TEXT;
U2S( HID_FUNC_UNICHAR );
1; 0;
diff --git a/sc/source/ui/undo/refundo.cxx b/sc/source/ui/undo/refundo.cxx
index 85bf65179bd8..8c72da7e7e25 100644
--- a/sc/source/ui/undo/refundo.cxx
+++ b/sc/source/ui/undo/refundo.cxx
@@ -66,10 +66,6 @@ ScRefUndoData::ScRefUndoData( const ScDocument* pDoc ) :
pPrintRanges = pDoc->CreatePrintRangeSaver(); // neu erzeugt
-#if OLD_PIVOT_IMPLEMENTATION
- ScPivotCollection* pOldPivot = pDoc->GetPivotCollection();
- pPivotCollection = pOldPivot ? new ScPivotCollection(*pOldPivot) : NULL;
-#endif
//! bei Pivot nur Bereiche merken ???
ScDPCollection* pOldDP = ((ScDocument*)pDoc)->GetDPCollection(); //! const
@@ -96,9 +92,6 @@ ScRefUndoData::~ScRefUndoData()
delete pDBCollection;
delete pRangeName;
delete pPrintRanges;
-#if OLD_PIVOT_IMPLEMENTATION
- delete pPivotCollection;
-#endif
delete pDPCollection;
delete pCondFormList;
delete pDetOpList;
@@ -130,15 +123,6 @@ void ScRefUndoData::DeleteUnchanged( const ScDocument* pDoc )
delete pNewRanges;
}
-#if OLD_PIVOT_IMPLEMENTATION
- if (pPivotCollection)
- {
- ScPivotCollection* pNewPivot = pDoc->GetPivotCollection();
- if ( pNewPivot && *pPivotCollection == *pNewPivot )
- DELETEZ(pPivotCollection);
- }
-#endif
-
if (pDPCollection)
{
ScDPCollection* pNewDP = ((ScDocument*)pDoc)->GetDPCollection(); //! const
@@ -195,11 +179,6 @@ void ScRefUndoData::DoUndo( ScDocument* pDoc, BOOL bUndoRefFirst )
if (pPrintRanges)
pDoc->RestorePrintRanges(*pPrintRanges);
-#if OLD_PIVOT_IMPLEMENTATION
- if (pPivotCollection)
- pDoc->SetPivotCollection( new ScPivotCollection(*pPivotCollection) );
-#endif
-
if (pDPCollection)
{
ScDPCollection* pDocDP = pDoc->GetDPCollection();
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index e44f5e7a6478..8cc45d41a2e6 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -64,6 +64,7 @@
#include "transobj.hxx"
#include "refundo.hxx"
#include "undoolk.hxx"
+#include "clipparam.hxx"
#include "sc.hrc"
@@ -441,7 +442,7 @@ void ScUndoDeleteCells::DoChange( const BOOL bUndo )
for( i=0; i<nCount && bUndo; i++ )
{
pRefUndoDoc->CopyToDocument( aEffRange.aStart.Col(), aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Col(), aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i],
- IDF_ALL, FALSE, pDoc );
+ IDF_ALL | IDF_NOCAPTIONS, FALSE, pDoc );
}
ScRange aWorkRange( aEffRange );
@@ -1316,9 +1317,8 @@ void __EXPORT ScUndoDragDrop::Redo()
aSourceMark.SelectTable( nTab, TRUE );
// do not clone objects and note captions into clipdoc (see above)
- pDoc->CopyToClip( aSrcRange.aStart.Col(), aSrcRange.aStart.Row(),
- aSrcRange.aEnd.Col(), aSrcRange.aEnd.Row(),
- bCut, pClipDoc, FALSE, &aSourceMark, bKeepScenarioFlags, FALSE, FALSE );
+ ScClipParam aClipParam(aSrcRange, bCut);
+ pDoc->CopyToClip(aClipParam, pClipDoc, &aSourceMark, false, bKeepScenarioFlags, false, false);
if (bCut)
{
@@ -1729,8 +1729,8 @@ void __EXPORT ScUndoEnterMatrix::Undo()
ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->DeleteAreaTab( aBlockRange, IDF_ALL );
- pUndoDoc->CopyToDocument( aBlockRange, IDF_ALL, FALSE, pDoc );
+ pDoc->DeleteAreaTab( aBlockRange, IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->CopyToDocument( aBlockRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
pDocShell->PostPaint( aBlockRange, PAINT_GRID );
pDocShell->PostDataChanged();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index ea1e303d6ae3..4a94827ed1ec 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -1340,8 +1340,8 @@ void __EXPORT ScUndoTabOp::Undo()
pDocShell->UpdatePaintExt( nExtFlags, aRange );
ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->DeleteAreaTab( aRange,IDF_ALL );
- pUndoDoc->CopyToDocument( aRange, IDF_ALL, FALSE, pDoc );
+ pDoc->DeleteAreaTab( aRange,IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->CopyToDocument( aRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
pDocShell->PostPaint( aRange, PAINT_GRID, nExtFlags );
pDocShell->PostDataChanged();
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
@@ -2023,14 +2023,14 @@ void ScUndoUpdateAreaLink::DoChange( const BOOL bUndo ) const
if ( bWithInsert )
{
pDoc->FitBlock( aNewRange, aOldRange );
- pDoc->DeleteAreaTab( aOldRange, IDF_ALL );
- pUndoDoc->UndoToDocument( aOldRange, IDF_ALL, FALSE, pDoc );
+ pDoc->DeleteAreaTab( aOldRange, IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->UndoToDocument( aOldRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
}
else
{
ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) );
- pDoc->DeleteAreaTab( aCopyRange, IDF_ALL );
- pUndoDoc->CopyToDocument( aCopyRange, IDF_ALL, FALSE, pDoc );
+ pDoc->DeleteAreaTab( aCopyRange, IDF_ALL & ~IDF_NOTE );
+ pUndoDoc->CopyToDocument( aCopyRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
}
}
else
@@ -2038,14 +2038,14 @@ void ScUndoUpdateAreaLink::DoChange( const BOOL bUndo ) const
if ( bWithInsert )
{
pDoc->FitBlock( aOldRange, aNewRange );
- pDoc->DeleteAreaTab( aNewRange, IDF_ALL );
- pRedoDoc->CopyToDocument( aNewRange, IDF_ALL, FALSE, pDoc );
+ pDoc->DeleteAreaTab( aNewRange, IDF_ALL & ~IDF_NOTE );
+ pRedoDoc->CopyToDocument( aNewRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
}
else
{
ScRange aCopyRange( aOldRange.aStart, ScAddress(nEndX,nEndY,nEndZ) );
- pDoc->DeleteAreaTab( aCopyRange, IDF_ALL );
- pRedoDoc->CopyToDocument( aCopyRange, IDF_ALL, FALSE, pDoc );
+ pDoc->DeleteAreaTab( aCopyRange, IDF_ALL & ~IDF_NOTE );
+ pRedoDoc->CopyToDocument( aCopyRange, IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
}
}
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index f16409b37239..7ab321ac0c1d 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -1302,8 +1302,8 @@ void __EXPORT ScUndoImportData::Undo()
for (SCCOL nCopyCol = nCol1; nCopyCol <= nCol2; nCopyCol++)
{
pDoc->CopyToDocument( nCopyCol,nRow1,nTab, nCopyCol,nRow2,nTab,
- IDF_CONTENTS, FALSE, pRedoDoc );
- pDoc->DeleteAreaTab( nCopyCol,nRow1, nCopyCol,nRow2, nTab, IDF_CONTENTS );
+ IDF_CONTENTS & ~IDF_NOTE, FALSE, pRedoDoc );
+ pDoc->DeleteAreaTab( nCopyCol,nRow1, nCopyCol,nRow2, nTab, IDF_CONTENTS & ~IDF_NOTE );
pDoc->DoColResize( nTab, nCopyCol, nCopyCol, 0 );
}
pDoc->SetAutoCalc( bOldAutoCalc );
@@ -1321,7 +1321,7 @@ void __EXPORT ScUndoImportData::Undo()
pRedoDBData->GetArea( aNew );
pDoc->DeleteAreaTab( aNew.aStart.Col(), aNew.aStart.Row(),
- aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL );
+ aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL & ~IDF_NOTE );
aOld.aEnd.SetCol( aOld.aEnd.Col() + nFormulaCols ); // FitBlock auch fuer Formeln
aNew.aEnd.SetCol( aNew.aEnd.Col() + nFormulaCols );
@@ -1329,11 +1329,11 @@ void __EXPORT ScUndoImportData::Undo()
}
else
pDoc->DeleteAreaTab( aImportParam.nCol1,aImportParam.nRow1,
- nEndCol,nEndRow, nTab, IDF_ALL );
+ nEndCol,nEndRow, nTab, IDF_ALL & ~IDF_NOTE );
pUndoDoc->CopyToDocument( aImportParam.nCol1,aImportParam.nRow1,nTab,
nEndCol+nFormulaCols,nEndRow,nTab,
- IDF_ALL, FALSE, pDoc );
+ IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
if (pCurrentData)
{
@@ -1395,16 +1395,16 @@ void __EXPORT ScUndoImportData::Redo()
pDoc->FitBlock( aOld, aNew );
pDoc->DeleteAreaTab( aNew.aStart.Col(), aNew.aStart.Row(),
- aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL );
+ aNew.aEnd.Col(), aNew.aEnd.Row(), nTab, IDF_ALL & ~IDF_NOTE );
- pRedoDoc->CopyToDocument( aNew, IDF_ALL, FALSE, pDoc ); // incl. Formeln
+ pRedoDoc->CopyToDocument( aNew, IDF_ALL & ~IDF_NOTE, FALSE, pDoc ); // incl. Formeln
}
else
{
pDoc->DeleteAreaTab( aImportParam.nCol1,aImportParam.nRow1,
- nEndCol,nEndRow, nTab, IDF_ALL );
+ nEndCol,nEndRow, nTab, IDF_ALL & ~IDF_NOTE );
pRedoDoc->CopyToDocument( aImportParam.nCol1,aImportParam.nRow1,nTab,
- nEndCol,nEndRow,nTab, IDF_ALL, FALSE, pDoc );
+ nEndCol,nEndRow,nTab, IDF_ALL & ~IDF_NOTE, FALSE, pDoc );
}
if (pCurrentData)
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index abd6f815abf9..ce428311d3f8 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -92,7 +92,7 @@ TYPEINIT1(ScUndoPrintRange, SfxUndoAction);
TYPEINIT1(ScUndoScenarioFlags, SfxUndoAction);
TYPEINIT1(ScUndoRenameObject, SfxUndoAction);
TYPEINIT1(ScUndoLayoutRTL, SfxUndoAction);
-TYPEINIT1(ScUndoSetGrammar, SfxUndoAction);
+//UNUSED2009-05 TYPEINIT1(ScUndoSetGrammar, SfxUndoAction);
// -----------------------------------------------------------------------
@@ -1611,59 +1611,54 @@ String ScUndoLayoutRTL::GetComment() const
// Set the grammar used for the sheet
//
-ScUndoSetGrammar::ScUndoSetGrammar( ScDocShell* pShell,
- formula::FormulaGrammar::Grammar eGrammar ) :
- ScSimpleUndo( pShell ),
- meNewGrammar( eGrammar )
-{
- meOldGrammar = pDocShell->GetDocument()->GetGrammar();
-}
-
-ScUndoSetGrammar::~ScUndoSetGrammar()
-{
-}
-
-void ScUndoSetGrammar::DoChange( formula::FormulaGrammar::Grammar eGrammar )
-{
- pDocShell->SetInUndo( TRUE );
- ScDocument* pDoc = pDocShell->GetDocument();
- pDoc->SetGrammar( eGrammar );
- pDocShell->SetDocumentModified();
- pDocShell->SetInUndo( FALSE );
-}
-
-void ScUndoSetGrammar::Undo()
-{
- DoChange( meOldGrammar );
-}
-
-void ScUndoSetGrammar::Redo()
-{
- DoChange( meNewGrammar );
-}
-
-void ScUndoSetGrammar::Repeat(SfxRepeatTarget& /* rTarget */)
-{
-#if 0
-// erAck: 2006-09-07T23:00+0200 commented out in CWS scr1c1
- if (rTarget.ISA(ScTabViewTarget))
- ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
- Execute( FID_TAB_USE_R1C1, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
-#endif
-}
-
-BOOL ScUndoSetGrammar::CanRepeat(SfxRepeatTarget& rTarget) const
-{
- return (rTarget.ISA(ScTabViewTarget));
-}
-
-String ScUndoSetGrammar::GetComment() const
-{
- return ScGlobal::GetRscString( STR_UNDO_TAB_R1C1 );
-}
-
-
-
-
-
+//UNUSED2009-05 ScUndoSetGrammar::ScUndoSetGrammar( ScDocShell* pShell,
+//UNUSED2009-05 formula::FormulaGrammar::Grammar eGrammar ) :
+//UNUSED2009-05 ScSimpleUndo( pShell ),
+//UNUSED2009-05 meNewGrammar( eGrammar )
+//UNUSED2009-05 {
+//UNUSED2009-05 meOldGrammar = pDocShell->GetDocument()->GetGrammar();
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 __EXPORT ScUndoSetGrammar::~ScUndoSetGrammar()
+//UNUSED2009-05 {
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 void ScUndoSetGrammar::DoChange( formula::FormulaGrammar::Grammar eGrammar )
+//UNUSED2009-05 {
+//UNUSED2009-05 pDocShell->SetInUndo( TRUE );
+//UNUSED2009-05 ScDocument* pDoc = pDocShell->GetDocument();
+//UNUSED2009-05 pDoc->SetGrammar( eGrammar );
+//UNUSED2009-05 pDocShell->SetDocumentModified();
+//UNUSED2009-05 pDocShell->SetInUndo( FALSE );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 void __EXPORT ScUndoSetGrammar::Undo()
+//UNUSED2009-05 {
+//UNUSED2009-05 DoChange( meOldGrammar );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 void __EXPORT ScUndoSetGrammar::Redo()
+//UNUSED2009-05 {
+//UNUSED2009-05 DoChange( meNewGrammar );
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 void __EXPORT ScUndoSetGrammar::Repeat(SfxRepeatTarget& /* rTarget */)
+//UNUSED2009-05 {
+//UNUSED2009-05 #if 0
+//UNUSED2009-05 // erAck: 2006-09-07T23:00+0200 commented out in CWS scr1c1
+//UNUSED2009-05 if (rTarget.ISA(ScTabViewTarget))
+//UNUSED2009-05 ((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
+//UNUSED2009-05 Execute( FID_TAB_USE_R1C1, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
+//UNUSED2009-05 #endif
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 BOOL __EXPORT ScUndoSetGrammar::CanRepeat(SfxRepeatTarget& rTarget) const
+//UNUSED2009-05 {
+//UNUSED2009-05 return (rTarget.ISA(ScTabViewTarget));
+//UNUSED2009-05 }
+//UNUSED2009-05
+//UNUSED2009-05 String __EXPORT ScUndoSetGrammar::GetComment() const
+//UNUSED2009-05 {
+//UNUSED2009-05 return ScGlobal::GetRscString( STR_UNDO_TAB_R1C1 );
+//UNUSED2009-05 }
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index cfe51aed6edc..f3418a84e2ef 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -1093,7 +1093,7 @@ BOOL lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
pUndoDoc->InitUndo( pDoc, nTab, nTab );
- pDoc->CopyToDocument( rRange, IDF_CONTENTS, FALSE, pUndoDoc );
+ pDoc->CopyToDocument( rRange, IDF_CONTENTS|IDF_NOCAPTIONS, FALSE, pUndoDoc );
}
pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS );
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index ccd1b558342b..07ed8709ab01 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -500,6 +500,10 @@ void Chart2Positioner::glueState()
ScRefTokenHelper::getDoubleRefDataFromToken(aData, *itr);
SCCOLROW n1 = aData.Ref1.nCol;
SCCOLROW n2 = aData.Ref2.nCol;
+ if (n1 > MAXCOL)
+ n1 = MAXCOL;
+ if (n2 > MAXCOL)
+ n2 = MAXCOL;
SCCOLROW nTmp = n2 - n1 + 1;
if (n1 < mnStartCol)
mnStartCol = static_cast<SCCOL>(n1);
@@ -510,14 +514,18 @@ void Chart2Positioner::glueState()
n1 = aData.Ref1.nRow;
n2 = aData.Ref2.nRow;
+ if (n1 > MAXROW)
+ n1 = MAXROW;
+ if (n2 > MAXROW)
+ n2 = MAXROW;
nTmp = n2 - n1 + 1;
if (n1 < mnStartRow)
- mnStartRow = static_cast<SCCOL>(n1);
+ mnStartRow = static_cast<SCROW>(n1);
if (n2 > nEndRow)
- nEndRow = static_cast<SCCOL>(n2);
+ nEndRow = static_cast<SCROW>(n2);
if (nTmp > nMaxRows)
- nMaxRows = static_cast<SCCOL>(nTmp);
+ nMaxRows = static_cast<SCROW>(nTmp);
}
// total column size ?
@@ -534,6 +542,14 @@ void Chart2Positioner::glueState()
meGlue = GLUETYPE_COLS;
return;
}
+ // #i103540# prevent invalid vector size
+ if ((nC <= 0) || (nR <= 0))
+ {
+ invalidateGlue();
+ mnStartCol = 0;
+ mnStartRow = 0;
+ return;
+ }
sal_uInt32 nCR = static_cast<sal_uInt32>(nC*nR);
const sal_uInt8 nHole = 0;
@@ -957,15 +973,6 @@ void lcl_convertTokensToString(OUString& rStr, const vector<ScSharedTokenRef>& r
func.getString(rStr);
}
-void lcl_convertTokenToString(OUString& rStr, const ScSharedTokenRef& rToken, ScDocument* pDoc,
- FormulaGrammar::Grammar eGrammar)
-{
- const sal_Unicode cRangeSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
- Tokens2RangeString func(pDoc, eGrammar, cRangeSep);
- func.operator() (rToken);
- func.getString(rStr);
-}
-
} // anonymous namespace
// DataProvider ==============================================================
@@ -995,44 +1002,6 @@ void ScChart2DataProvider::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint
}
}
-void lcl_SeperateOneColumnRange(ScRange aR, const ScAddress& rPos, ScRangeListRef& xRanges)
-{
- if (aR.aStart == rPos)
- {
- aR.aStart.SetRow(aR.aStart.Row() + 1);
- xRanges->Join(aR);
- }
- else if (aR.aEnd == rPos)
- {
- aR.aStart.SetRow(aR.aStart.Row() - 1);
- xRanges->Join(aR);
- }
- else
- {
- xRanges->Join(ScRange(aR.aStart, ScAddress(rPos.Col(), rPos.Row() - 1, rPos.Tab())));
- xRanges->Join(ScRange(ScAddress(rPos.Col(), rPos.Row() + 1, rPos.Tab()), aR.aEnd ));
- }
-}
-
-void lcl_SeperateOneRowRange(ScRange aR, const ScAddress& rPos, ScRangeListRef& xRanges)
-{
- if (aR.aStart == rPos)
- {
- aR.aStart.SetCol(aR.aStart.Col() + 1);
- xRanges->Join(aR);
- }
- else if (aR.aEnd == rPos)
- {
- aR.aStart.SetCol(aR.aStart.Col() - 1);
- xRanges->Join(aR);
- }
- else
- {
- xRanges->Join(ScRange(aR.aStart, ScAddress(rPos.Col() - 1, rPos.Row(), rPos.Tab())));
- xRanges->Join(ScRange(ScAddress(rPos.Col() + 1, rPos.Row(), rPos.Tab()), aR.aEnd ));
- }
-}
-
::sal_Bool SAL_CALL ScChart2DataProvider::createDataSourcePossible( const uno::Sequence< beans::PropertyValue >& aArguments )
throw (uno::RuntimeException)
{
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index d1c65e87ad9b..3c584a94a775 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -255,14 +255,19 @@ void SAL_CALL ScChartsObj::addNewByName( const rtl::OUString& aName,
xReceiver.set( xCompSupp->getComponent(), uno::UNO_QUERY );
if( xReceiver.is())
{
+ String sRangeStr;
+ xNewRanges->Format(sRangeStr, SCR_ABS_3D, pDoc);
+
// connect
- xReceiver->attachDataProvider( xDataProvider );
+ if( sRangeStr.Len() )
+ xReceiver->attachDataProvider( xDataProvider );
+ else
+ sRangeStr = String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM( "all" ) );
+
uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( pDocShell->GetModel(), uno::UNO_QUERY );
xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier );
// set arguments
- String sRangeStr;
- xNewRanges->Format(sRangeStr, SCR_ABS_3D, pDoc);
uno::Sequence< beans::PropertyValue > aArgs( 4 );
aArgs[0] = beans::PropertyValue(
::rtl::OUString::createFromAscii("CellRangeRepresentation"), -1,
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index c924205bdce5..3e2295d73471 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -60,6 +60,9 @@
#include <com/sun/star/script/XLibraryContainer.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/ServiceNotRegisteredException.hpp>
+#include <com/sun/star/document/XDocumentEventBroadcaster.hpp>
+#include <com/sun/star/script/XInvocation.hpp>
+#include <com/sun/star/reflection/XIdlClassProvider.hpp>
#include <comphelper/processfactory.hxx>
#include "docuno.hxx"
@@ -218,21 +221,37 @@ ScModelObj::ScModelObj( ScDocShell* pDocSh ) :
aPropSet( lcl_GetDocOptPropertyMap() ),
pDocShell( pDocSh ),
pPrintFuncCache( NULL ),
- maChangesListeners( m_aMutex )
+ maChangesListeners( m_aMutex ),
+ mnXlsWriteProtPass( 0 )
{
// pDocShell may be NULL if this is the base of a ScDocOptionsObj
if ( pDocShell )
{
pDocShell->GetDocument()->AddUnoObject(*this); // SfxModel is derived from SfxListener
+ }
+}
+
+ScModelObj::~ScModelObj()
+{
+ if (pDocShell)
+ pDocShell->GetDocument()->RemoveUnoObject(*this);
+
+ if (xNumberAgg.is())
+ xNumberAgg->setDelegator(uno::Reference<uno::XInterface>());
+
+ delete pPrintFuncCache;
+}
+uno::Reference< uno::XAggregation> ScModelObj::GetFormatter()
+{
+ if ( !xNumberAgg.is() )
+ {
// setDelegator veraendert den RefCount, darum eine Referenz selber halten
// (direkt am m_refCount, um sich beim release nicht selbst zu loeschen)
comphelper::increment( m_refCount );
-
// waehrend des queryInterface braucht man ein Ref auf das
// SvNumberFormatsSupplierObj, sonst wird es geloescht.
- uno::Reference<util::XNumberFormatsSupplier> xFormatter(new SvNumberFormatsSupplierObj(
- pDocShell->GetDocument()->GetFormatTable() ));
+ uno::Reference<util::XNumberFormatsSupplier> xFormatter(new SvNumberFormatsSupplierObj(pDocShell->GetDocument()->GetFormatTable() ));
{
xNumberAgg.set(uno::Reference<uno::XAggregation>( xFormatter, uno::UNO_QUERY ));
// extra block to force deletion of the temporary before setDelegator
@@ -243,20 +262,9 @@ ScModelObj::ScModelObj( ScDocShell* pDocSh ) :
if (xNumberAgg.is())
xNumberAgg->setDelegator( (cppu::OWeakObject*)this );
-
comphelper::decrement( m_refCount );
- }
-}
-
-ScModelObj::~ScModelObj()
-{
- if (pDocShell)
- pDocShell->GetDocument()->RemoveUnoObject(*this);
-
- if (xNumberAgg.is())
- xNumberAgg->setDelegator(uno::Reference<uno::XInterface>());
-
- delete pPrintFuncCache;
+ } // if ( !xNumberAgg.is() )
+ return xNumberAgg;
}
ScDocument* ScModelObj::GetDocument() const
@@ -277,13 +285,6 @@ void ScModelObj::UpdateAllRowHeights(const ScMarkData* pTabMark)
pDocShell->UpdateAllRowHeights(pTabMark);
}
-ScDrawLayer* ScModelObj::MakeDrawLayer()
-{
- if (pDocShell)
- return pDocShell->MakeDrawLayer();
- return NULL;
-}
-
void ScModelObj::BeforeXMLLoading()
{
if (pDocShell)
@@ -296,6 +297,13 @@ void ScModelObj::AfterXMLLoading(sal_Bool bRet)
pDocShell->AfterXMLLoading(bRet);
}
+ScSheetSaveData* ScModelObj::GetSheetSaveData()
+{
+ if (pDocShell)
+ return pDocShell->GetSheetSaveData();
+ return NULL;
+}
+
uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
throw(uno::RuntimeException)
{
@@ -316,8 +324,19 @@ uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
SC_QUERYINTERFACE( util::XChangesNotifier )
uno::Any aRet(SfxBaseModel::queryInterface( rType ));
- if ( !aRet.hasValue() && xNumberAgg.is() )
- aRet = xNumberAgg->queryAggregation( rType );
+ if ( !aRet.hasValue()
+ && rType != ::getCppuType((uno::Reference< com::sun::star::document::XDocumentEventBroadcaster>*)0)
+ && rType != ::getCppuType((uno::Reference< com::sun::star::frame::XController>*)0)
+ && rType != ::getCppuType((uno::Reference< com::sun::star::frame::XFrame>*)0)
+ && rType != ::getCppuType((uno::Reference< com::sun::star::script::XInvocation>*)0)
+ && rType != ::getCppuType((uno::Reference< com::sun::star::reflection::XIdlClassProvider>*)0)
+ && rType != ::getCppuType((uno::Reference< com::sun::star::beans::XFastPropertySet>*)0)
+ && rType != ::getCppuType((uno::Reference< com::sun::star::awt::XWindow>*)0))
+ {
+ GetFormatter();
+ if ( xNumberAgg.is() )
+ aRet = xNumberAgg->queryAggregation( rType );
+ }
return aRet;
}
@@ -342,7 +361,7 @@ uno::Sequence<uno::Type> SAL_CALL ScModelObj::getTypes() throw(uno::RuntimeExcep
const uno::Type* pParentPtr = aParentTypes.getConstArray();
uno::Sequence<uno::Type> aAggTypes;
- if ( xNumberAgg.is() )
+ if ( GetFormatter().is() )
{
const uno::Type& rProvType = ::getCppuType((uno::Reference<lang::XTypeProvider>*) 0);
uno::Any aNumProv(xNumberAgg->queryAggregation(rProvType));
@@ -433,7 +452,7 @@ void ScModelObj::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
// NumberFormatter-Pointer am Uno-Objekt neu setzen
- if (xNumberAgg.is())
+ if (GetFormatter().is())
{
SvNumberFormatsSupplierObj* pNumFmt =
SvNumberFormatsSupplierObj::getImplementation(
@@ -1430,6 +1449,14 @@ void SAL_CALL ScModelObj::setPropertyValue(
if ( aObjName.getLength() )
pDoc->RestoreChartListener( aObjName );
}
+ else if ( aString.EqualsAscii( "WriteProtectionPassword" ) )
+ {
+ /* This is a hack for #160550# to preserve the write-protection
+ password in an XLS roundtrip. This property MUST NOT be used
+ for any other purpose. This property will be deleted when the
+ feature "Write Protection With Password" will be implemented. */
+ aValue >>= mnXlsWriteProtPass;
+ }
if ( aNewOpt != rOldOpt )
{
@@ -1592,6 +1619,14 @@ uno::Any SAL_CALL ScModelObj::getPropertyValue( const rtl::OUString& aPropertyNa
{
ScUnoHelpFunctions::SetBoolInAny( aRet, (pDocShell->GetCreateMode() == SFX_CREATE_MODE_INTERNAL) );
}
+ else if ( aString.EqualsAscii( "WriteProtectionPassword" ) )
+ {
+ /* This is a hack for #160550# to preserve the write-protection
+ password in an XLS roundtrip. This property MUST NOT be used
+ for any other purpose. This property will be deleted when the
+ feature "Write Protection With Password" will be implemented. */
+ aRet <<= mnXlsWriteProtPass;
+ }
}
return aRet;
@@ -1760,7 +1795,7 @@ sal_Int64 SAL_CALL ScModelObj::getSomething(
if ( nRet )
return nRet;
- if ( xNumberAgg.is() )
+ if ( GetFormatter().is() )
{
const uno::Type& rTunnelType = ::getCppuType((uno::Reference<lang::XUnoTunnel>*) 0);
uno::Any aNumTunnel(xNumberAgg->queryAggregation(rTunnelType));
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index 1d9f3a1d9213..a50b4003b0ac 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -57,6 +57,7 @@
#include "patattr.hxx"
#include "docpool.hxx"
#include "attrib.hxx"
+#include "clipparam.hxx"
using namespace com::sun::star;
@@ -175,9 +176,8 @@ BOOL lcl_CopyData( ScDocument* pSrcDoc, const ScRange& rSrcRange,
ScMarkData aSourceMark;
aSourceMark.SelectOneTable( nSrcTab ); // for CopyToClip
aSourceMark.SetMarkArea( rSrcRange );
- pSrcDoc->CopyToClip( rSrcRange.aStart.Col(),rSrcRange.aStart.Row(),
- rSrcRange.aEnd.Col(),rSrcRange.aEnd.Row(),
- FALSE, pClipDoc, FALSE, &aSourceMark );
+ ScClipParam aClipParam(rSrcRange, false);
+ pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aSourceMark, false);
if ( pClipDoc->HasAttrib( 0,0,nSrcTab, MAXCOL,MAXROW,nSrcTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ) )
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index 1b17c2e130ac..6ed8181091ac 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -350,7 +350,7 @@ static BOOL lcl_IsAnyXMLFilter( const SfxFilter* pFilter )
// maybe that IsStorage() already created an error!
if ( bIsStorage )
{
- uno::Reference < embed::XStorage > xStorage(aMedium.GetStorage());
+ uno::Reference < embed::XStorage > xStorage(aMedium.GetStorage( sal_False ));
if ( aMedium.GetLastStorageCreationState() != ERRCODE_NONE )
{
// error during storage creation means _here_ that the medium
diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
index d4ef17e79a8d..47e1be008645 100644
--- a/sc/source/ui/unoobj/servuno.cxx
+++ b/sc/source/ui/unoobj/servuno.cxx
@@ -121,56 +121,72 @@ public:
};
//------------------------------------------------------------------------
+//
+struct ProvNamesId_Type
+{
+ const char * pName;
+ sal_uInt16 nType;
+};
-static const sal_Char* __FAR_DATA aProvNames[SC_SERVICE_COUNT] =
- {
- "com.sun.star.sheet.Spreadsheet", // SC_SERVICE_SHEET
- "com.sun.star.text.TextField.URL", // SC_SERVICE_URLFIELD
- "com.sun.star.text.TextField.PageNumber", // SC_SERVICE_PAGEFIELD
- "com.sun.star.text.TextField.PageCount", // SC_SERVICE_PAGESFIELD
- "com.sun.star.text.TextField.Date", // SC_SERVICE_DATEFIELD
- "com.sun.star.text.TextField.Time", // SC_SERVICE_TIMEFIELD
- "com.sun.star.text.TextField.DocumentTitle",// SC_SERVICE_TITLEFIELD
- "com.sun.star.text.TextField.FileName", // SC_SERVICE_FILEFIELD
- "com.sun.star.text.TextField.SheetName", // SC_SERVICE_SHEETFIELD
- "com.sun.star.style.CellStyle", // SC_SERVICE_CELLSTYLE
- "com.sun.star.style.PageStyle", // SC_SERVICE_PAGESTYLE
- "com.sun.star.sheet.TableAutoFormat", // SC_SERVICE_AUTOFORMAT
- "com.sun.star.sheet.SheetCellRanges", // SC_SERVICE_CELLRANGES
- "com.sun.star.drawing.GradientTable", // SC_SERVICE_GRADTAB
- "com.sun.star.drawing.HatchTable", // SC_SERVICE_HATCHTAB
- "com.sun.star.drawing.BitmapTable", // SC_SERVICE_BITMAPTAB
- "com.sun.star.drawing.TransparencyGradientTable", // SC_SERVICE_TRGRADTAB
- "com.sun.star.drawing.MarkerTable", // SC_SERVICE_MARKERTAB
- "com.sun.star.drawing.DashTable", // SC_SERVICE_DASHTAB
- "com.sun.star.text.NumberingRules", // SC_SERVICE_NUMRULES
- "com.sun.star.sheet.Defaults", // SC_SERVICE_DOCDEFLTS
- "com.sun.star.drawing.Defaults", // SC_SERVICE_DRAWDEFLTS
- "com.sun.star.comp.SpreadsheetSettings", // SC_SERVICE_DOCSPRSETT
- "com.sun.star.document.Settings", // SC_SERVICE_DOCCONF
- "com.sun.star.image.ImageMapRectangleObject",// SC_SERVICE_IMAP_RECT
- "com.sun.star.image.ImageMapCircleObject", // SC_SERVICE_IMAP_CIRC
- "com.sun.star.image.ImageMapPolygonObject", // SC_SERVICE_IMAP_POLY
+static const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
+{
+ { "com.sun.star.sheet.Spreadsheet", SC_SERVICE_SHEET },
+ { "com.sun.star.text.TextField.URL", SC_SERVICE_URLFIELD },
+ { "com.sun.star.text.TextField.PageNumber", SC_SERVICE_PAGEFIELD },
+ { "com.sun.star.text.TextField.PageCount", SC_SERVICE_PAGESFIELD },
+ { "com.sun.star.text.TextField.Date", SC_SERVICE_DATEFIELD },
+ { "com.sun.star.text.TextField.Time", SC_SERVICE_TIMEFIELD },
+ { "com.sun.star.text.TextField.DocumentTitle", SC_SERVICE_TITLEFIELD },
+ { "com.sun.star.text.TextField.FileName", SC_SERVICE_FILEFIELD },
+ { "com.sun.star.text.TextField.SheetName", SC_SERVICE_SHEETFIELD },
+ { "com.sun.star.style.CellStyle", SC_SERVICE_CELLSTYLE },
+ { "com.sun.star.style.PageStyle", SC_SERVICE_PAGESTYLE },
+ { "com.sun.star.sheet.TableAutoFormat", SC_SERVICE_AUTOFORMAT },
+ { "com.sun.star.sheet.SheetCellRanges", SC_SERVICE_CELLRANGES },
+ { "com.sun.star.drawing.GradientTable", SC_SERVICE_GRADTAB },
+ { "com.sun.star.drawing.HatchTable", SC_SERVICE_HATCHTAB },
+ { "com.sun.star.drawing.BitmapTable", SC_SERVICE_BITMAPTAB },
+ { "com.sun.star.drawing.TransparencyGradientTable", SC_SERVICE_TRGRADTAB },
+ { "com.sun.star.drawing.MarkerTable", SC_SERVICE_MARKERTAB },
+ { "com.sun.star.drawing.DashTable", SC_SERVICE_DASHTAB },
+ { "com.sun.star.text.NumberingRules", SC_SERVICE_NUMRULES },
+ { "com.sun.star.sheet.Defaults", SC_SERVICE_DOCDEFLTS },
+ { "com.sun.star.drawing.Defaults", SC_SERVICE_DRAWDEFLTS },
+ { "com.sun.star.comp.SpreadsheetSettings", SC_SERVICE_DOCSPRSETT },
+ { "com.sun.star.document.Settings", SC_SERVICE_DOCCONF },
+ { "com.sun.star.image.ImageMapRectangleObject", SC_SERVICE_IMAP_RECT },
+ { "com.sun.star.image.ImageMapCircleObject", SC_SERVICE_IMAP_CIRC },
+ { "com.sun.star.image.ImageMapPolygonObject", SC_SERVICE_IMAP_POLY },
// #100263# Support creation of GraphicObjectResolver and EmbeddedObjectResolver
- "com.sun.star.document.ExportGraphicObjectResolver", // SC_SERVICE_EXPORT_GOR
- "com.sun.star.document.ImportGraphicObjectResolver", // SC_SERVICE_IMPORT_GOR
- "com.sun.star.document.ExportEmbeddedObjectResolver", // SC_SERVICE_EXPORT_EOR
- "com.sun.star.document.ImportEmbeddedObjectResolver", // SC_SERVICE_IMPORT_EOR
-
- SC_SERVICENAME_VALBIND, // SC_SERVICE_VALBIND
- SC_SERVICENAME_LISTCELLBIND, // SC_SERVICE_LISTCELLBIND
- SC_SERVICENAME_LISTSOURCE, // SC_SERVICE_LISTSOURCE
- SC_SERVICENAME_CELLADDRESS, // SC_SERVICE_CELLADDRESS
- SC_SERVICENAME_RANGEADDRESS, // SC_SERVICE_RANGEADDRESS
-
- "com.sun.star.sheet.DocumentSettings", // SC_SERVICE_SHEETDOCSET
-
- SC_SERVICENAME_CHDATAPROV, // SC_SERVICE_CHDATAPROV
- SC_SERVICENAME_FORMULAPARS, // SC_SERVICE_FORMULAPARS
- SC_SERVICENAME_OPCODEMAPPER, // SC_SERVICE_OPCODEMAPPER
- "ooo.vba.VBACodeNameProvider", // SC_SERVICE_OPCODEMAPPER
- };
+ { "com.sun.star.document.ExportGraphicObjectResolver", SC_SERVICE_EXPORT_GOR },
+ { "com.sun.star.document.ImportGraphicObjectResolver", SC_SERVICE_IMPORT_GOR },
+ { "com.sun.star.document.ExportEmbeddedObjectResolver", SC_SERVICE_EXPORT_EOR },
+ { "com.sun.star.document.ImportEmbeddedObjectResolver", SC_SERVICE_IMPORT_EOR },
+
+ { SC_SERVICENAME_VALBIND, SC_SERVICE_VALBIND },
+ { SC_SERVICENAME_LISTCELLBIND, SC_SERVICE_LISTCELLBIND },
+ { SC_SERVICENAME_LISTSOURCE, SC_SERVICE_LISTSOURCE },
+ { SC_SERVICENAME_CELLADDRESS, SC_SERVICE_CELLADDRESS },
+ { SC_SERVICENAME_RANGEADDRESS, SC_SERVICE_RANGEADDRESS },
+
+ { "com.sun.star.sheet.DocumentSettings",SC_SERVICE_SHEETDOCSET },
+
+ { SC_SERVICENAME_CHDATAPROV, SC_SERVICE_CHDATAPROV },
+ { SC_SERVICENAME_FORMULAPARS, SC_SERVICE_FORMULAPARS },
+ { SC_SERVICENAME_OPCODEMAPPER, SC_SERVICE_OPCODEMAPPER },
+ { "ooo.vba.VBACodeNameProvider", SC_SERVICE_VBACODENAMEPROVIDER },
+
+ // case-correct versions of the service names (#i102468#)
+ { "com.sun.star.text.textfield.URL", SC_SERVICE_URLFIELD },
+ { "com.sun.star.text.textfield.PageNumber", SC_SERVICE_PAGEFIELD },
+ { "com.sun.star.text.textfield.PageCount", SC_SERVICE_PAGESFIELD },
+ { "com.sun.star.text.textfield.Date", SC_SERVICE_DATEFIELD },
+ { "com.sun.star.text.textfield.Time", SC_SERVICE_TIMEFIELD },
+ { "com.sun.star.text.textfield.DocumentTitle", SC_SERVICE_TITLEFIELD },
+ { "com.sun.star.text.textfield.FileName", SC_SERVICE_FILEFIELD },
+ { "com.sun.star.text.textfield.SheetName", SC_SERVICE_SHEETFIELD },
+};
//
// old service names that were in 567 still work in createInstance,
@@ -244,11 +260,17 @@ sal_uInt16 ScServiceProvider::GetProviderType(const String& rServiceName)
{
if (rServiceName.Len())
{
- USHORT i;
- for (i=0; i<SC_SERVICE_COUNT; i++)
- if (rServiceName.EqualsAscii( aProvNames[i] ))
- return i;
+ const sal_uInt16 nEntries =
+ sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
+ for (sal_uInt16 i = 0; i < nEntries; i++)
+ {
+ if (rServiceName.EqualsAscii( aProvNamesId[i].pName ))
+ {
+ return aProvNamesId[i].nType;
+ }
+ }
+ USHORT i;
for (i=0; i<SC_SERVICE_COUNT; i++)
{
DBG_ASSERT( aOldNames[i], "ScServiceProvider::GetProviderType: no oldname => crash");
@@ -441,10 +463,13 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
uno::Sequence<rtl::OUString> ScServiceProvider::GetAllServiceNames()
{
- uno::Sequence<rtl::OUString> aRet(SC_SERVICE_COUNT);
+ const sal_uInt16 nEntries = sizeof(aProvNamesId) / sizeof(aProvNamesId[0]);
+ uno::Sequence<rtl::OUString> aRet(nEntries);
rtl::OUString* pArray = aRet.getArray();
- for (sal_uInt16 i = 0; i < SC_SERVICE_COUNT; i++)
- pArray[i] = rtl::OUString::createFromAscii( aProvNames[i] );
+ for (sal_uInt16 i = 0; i < nEntries; i++)
+ {
+ pArray[i] = rtl::OUString::createFromAscii( aProvNamesId[i].pName );
+ }
return aRet;
}
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index bd481dfc49f0..a9e6a799e010 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -897,6 +897,47 @@ uno::Reference<text::XTextRange> SAL_CALL ScDrawTextCursor::getEnd() throw(uno::
return xRange;
}
+// XUnoTunnel
+
+sal_Int64 SAL_CALL ScDrawTextCursor::getSomething(
+ const uno::Sequence<sal_Int8 >& rId ) throw(uno::RuntimeException)
+{
+ if ( rId.getLength() == 16 &&
+ 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
+ rId.getConstArray(), 16 ) )
+ {
+ return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
+ }
+ return SvxUnoTextCursor::getSomething( rId );
+}
+
+// static
+const uno::Sequence<sal_Int8>& ScDrawTextCursor::getUnoTunnelId()
+{
+ static uno::Sequence<sal_Int8> * pSeq = 0;
+ if( !pSeq )
+ {
+ osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static uno::Sequence< sal_Int8 > aSeq( 16 );
+ rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
+ pSeq = &aSeq;
+ }
+ }
+ return *pSeq;
+}
+
+// static
+ScDrawTextCursor* ScDrawTextCursor::getImplementation( const uno::Reference<uno::XInterface> xObj )
+{
+ ScDrawTextCursor* pRet = NULL;
+ uno::Reference<lang::XUnoTunnel> xUT( xObj, uno::UNO_QUERY );
+ if (xUT.is())
+ pRet = reinterpret_cast<ScDrawTextCursor*>(sal::static_int_cast<sal_IntPtr>(xUT->getSomething(getUnoTunnelId())));
+ return pRet;
+}
+
//------------------------------------------------------------------------
ScSimpleEditSourceHelper::ScSimpleEditSourceHelper()
diff --git a/sc/source/ui/vba/makefile.mk b/sc/source/ui/vba/makefile.mk
index fb1cc00488b8..71727297d078 100644
--- a/sc/source/ui/vba/makefile.mk
+++ b/sc/source/ui/vba/makefile.mk
@@ -45,7 +45,7 @@ DLLPRE =
dummy:
@echo "not building vba..."
.ENDIF
-
+.IF "$(L10N_framework)"==""
INCPRE=$(INCCOM)$/$(TARGET)
# ------------------------------------------------------------------
@@ -135,11 +135,13 @@ SLOFILES= \
$(SLO)$/vbaspinbutton.obj \
$(SLO)$/vbaimage.obj \
$(SLO)$/service.obj
-
+.ENDIF
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
+.IF "$(L10N_framework)"==""
+
ALLTAR : \
$(MISC)$/$(TARGET).don \
@@ -149,3 +151,4 @@ $(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb
+$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@
echo $@
+.ENDIF
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 54c8ff12e189..c2d0f68fc6ef 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -206,7 +206,6 @@ void ScCellShell::GetBlockState( SfxItemSet& rSet )
break;
case SID_COPY: // Kopieren
- bDisable = (!bSimpleArea && eMarkType != SC_MARK_SIMPLE_FILTERED);
// nur wegen Matrix nicht editierbar? Matrix nicht zerreissen
//! schlaegt nicht zu, wenn geschuetzt UND Matrix, aber damit
//! muss man leben.. wird in Copy-Routine abgefangen, sonst
@@ -443,7 +442,7 @@ IMPL_LINK( ScCellShell, ClipboardChanged, TransferableDataHelper*, pDataHelper )
SfxBindings& rBindings = GetViewData()->GetBindings();
rBindings.Invalidate( SID_PASTE );
- rBindings.Invalidate( FID_PASTE_CONTENTS );
+ rBindings.Invalidate( SID_PASTE_SPECIAL );
rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
}
return 0;
@@ -453,7 +452,7 @@ IMPL_LINK( ScCellShell, ClipboardChanged, TransferableDataHelper*, pDataHelper )
void __EXPORT ScCellShell::GetClipState( SfxItemSet& rSet )
{
// SID_PASTE
-// FID_PASTE_CONTENTS
+// SID_PASTE_SPECIAL
// SID_CLIPBOARD_FORMAT_ITEMS
if ( !pImpl->m_pClipEvtLstnr )
@@ -490,7 +489,7 @@ void __EXPORT ScCellShell::GetClipState( SfxItemSet& rSet )
if (bDisable)
{
rSet.DisableItem( SID_PASTE );
- rSet.DisableItem( FID_PASTE_CONTENTS );
+ rSet.DisableItem( SID_PASTE_SPECIAL );
rSet.DisableItem( SID_CLIPBOARD_FORMAT_ITEMS );
}
else if ( rSet.GetItemState( SID_CLIPBOARD_FORMAT_ITEMS ) != SFX_ITEM_UNKNOWN )
@@ -670,15 +669,9 @@ void ScCellShell::GetState(SfxItemSet &rSet)
nErrCode = pFCell->GetErrCode();
}
- if ( nErrCode > 0 )
- rSet.Put( SfxStringItem( nWhich,
- ScGlobal::GetLongErrorString( nErrCode ) ) );
- else
- {
- String aFuncStr;
- if ( pTabViewShell->GetFunction( aFuncStr ) )
- rSet.Put( SfxStringItem( nWhich, aFuncStr ) );
- }
+ String aFuncStr;
+ if ( pTabViewShell->GetFunction( aFuncStr, nErrCode ) )
+ rSet.Put( SfxStringItem( nWhich, aFuncStr ) );
}
}
break;
diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx
index e5bb702402d8..f610e28b3fc5 100644
--- a/sc/source/ui/view/cellsh1.cxx
+++ b/sc/source/ui/view/cellsh1.cxx
@@ -104,6 +104,7 @@
#include "dpgroup.hxx" // for ScDPNumGroupInfo
#include "spellparam.hxx"
#include "postit.hxx"
+#include "clipparam.hxx"
#include "globstr.hrc"
#include "scui_def.hxx" //CHINA001
@@ -1182,41 +1183,9 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
case SID_PASTE:
{
- Window* pWin = GetViewData()->GetActiveWin();
- ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
- ScDocument* pThisDoc = GetViewData()->GetDocument();
- ScDPObject* pDPObj = pThisDoc->GetDPAtCursor( GetViewData()->GetCurX(),
- GetViewData()->GetCurY(), GetViewData()->GetTabNo() );
- if ( pOwnClip && pDPObj )
- {
- // paste from Calc into DataPilot table: sort (similar to drag & drop)
-
- ScDocument* pClipDoc = pOwnClip->GetDocument();
- SCTAB nSourceTab = pOwnClip->GetVisibleTab();
-
- SCCOL nClipStartX;
- SCROW nClipStartY;
- SCCOL nClipEndX;
- SCROW nClipEndY;
- pClipDoc->GetClipStart( nClipStartX, nClipStartY );
- pClipDoc->GetClipArea( nClipEndX, nClipEndY, TRUE );
- nClipEndX = nClipEndX + nClipStartX;
- nClipEndY = nClipEndY + nClipStartY; // GetClipArea returns the difference
-
- ScRange aSource( nClipStartX, nClipStartY, nSourceTab, nClipEndX, nClipEndY, nSourceTab );
- BOOL bDone = pTabViewShell->DataPilotMove( aSource, GetViewData()->GetCurPos() );
- if ( !bDone )
- pTabViewShell->ErrorMessage( STR_ERR_DATAPILOT_INPUT );
- }
- else
- {
- // normal paste
- WaitObject aWait( GetViewData()->GetDialogParent() );
- pTabViewShell->PasteFromSystem();
- }
+ PasteFromClipboard ( GetViewData(), pTabViewShell, true );
rReq.Done();
}
- pTabViewShell->CellContentChanged(); // => PasteFromSystem() ???
break;
case SID_CLIPBOARD_FORMAT_ITEMS:
@@ -1418,7 +1387,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
pTabViewShell->CellContentChanged(); // => PasteFromXXX ???
break;
- case FID_PASTE_CONTENTS:
+ case SID_PASTE_SPECIAL:
// Unterscheidung, ob eigene oder fremde Daten,
// dadurch FID_INS_CELL_CONTENTS ueberfluessig
{
@@ -1516,43 +1485,6 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq )
pTabViewShell->CellContentChanged(); // => PasteFromSystem() ???
break;
-#if 0
- // clipboard slots were used only for old basic:
-
- case SID_GET_CLPBRD_FORMAT_COUNT:
- rReq.SetReturnValue( SfxUInt16Item( nSlot, Clipboard::GetFormatCount() ) );
- break;
-
- case SID_GET_CLPBRD_FORMAT_BY_IDX:
- if (pReqArgs)
- {
- const SfxPoolItem* pItem;
- if ( pReqArgs->GetItemState(nSlot, TRUE, &pItem) == SFX_ITEM_SET &&
- pItem->ISA(SfxUInt16Item) )
- {
- USHORT nCount = Clipboard::GetFormatCount();
- USHORT nPos = ((const SfxUInt16Item*)pItem)->GetValue(); // 1-based
- if ( nPos && nPos <= nCount )
- rReq.SetReturnValue( SfxUInt32Item( nSlot, Clipboard::GetFormat(--nPos) ) );
- }
- }
- break;
-
- case SID_GET_CLPBRD_FORMAT_NAME:
- if (pReqArgs)
- {
- const SfxPoolItem* pItem;
- if ( pReqArgs->GetItemState(nSlot, TRUE, &pItem) == SFX_ITEM_SET &&
- pItem->ISA(SfxUInt32Item) )
- {
- String aName = Exchange::GetFormatName(
- ((const SfxUInt32Item*)pItem)->GetValue() );
- rReq.SetReturnValue( SfxStringItem( nSlot, aName ) );
- }
- }
- break;
-#endif
-
//
// sonstiges
//
@@ -2226,3 +2158,52 @@ IMPL_LINK( ScCellShell, DialogClosed, AbstractScLinkedAreaDlg*, EMPTYARG )
return 0;
}
+void ScCellShell::PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTabViewShell, bool bShowDialog )
+{
+ Window* pWin = pViewData->GetActiveWin();
+ ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
+ ScDocument* pThisDoc = pViewData->GetDocument();
+ ScDPObject* pDPObj = pThisDoc->GetDPAtCursor( pViewData->GetCurX(),
+ pViewData->GetCurY(), pViewData->GetTabNo() );
+ if ( pOwnClip && pDPObj )
+ {
+ // paste from Calc into DataPilot table: sort (similar to drag & drop)
+
+ ScDocument* pClipDoc = pOwnClip->GetDocument();
+ SCTAB nSourceTab = pOwnClip->GetVisibleTab();
+
+ SCCOL nClipStartX;
+ SCROW nClipStartY;
+ SCCOL nClipEndX;
+ SCROW nClipEndY;
+ pClipDoc->GetClipStart( nClipStartX, nClipStartY );
+ pClipDoc->GetClipArea( nClipEndX, nClipEndY, TRUE );
+ nClipEndX = nClipEndX + nClipStartX;
+ nClipEndY = nClipEndY + nClipStartY; // GetClipArea returns the difference
+
+ ScRange aSource( nClipStartX, nClipStartY, nSourceTab, nClipEndX, nClipEndY, nSourceTab );
+ BOOL bDone = pTabViewShell->DataPilotMove( aSource, pViewData->GetCurPos() );
+ if ( !bDone )
+ pTabViewShell->ErrorMessage( STR_ERR_DATAPILOT_INPUT );
+ }
+ else
+ {
+ // normal paste
+ WaitObject aWait( pViewData->GetDialogParent() );
+ if (!pOwnClip)
+ pTabViewShell->PasteFromSystem();
+ else
+ {
+ ScDocument* pClipDoc = pOwnClip->GetDocument();
+ sal_uInt16 nFlags = IDF_ALL;
+ if (pClipDoc->GetClipParam().isMultiRange())
+ // For multi-range paste, we paste values by default.
+ nFlags &= ~IDF_FORMULA;
+
+ pTabViewShell->PasteFromClip( nFlags, pClipDoc,
+ PASTE_NOFUNC, FALSE, FALSE, FALSE, INS_NONE, IDF_NONE,
+ bShowDialog ); // allow warning dialog
+ }
+ }
+ pTabViewShell->CellContentChanged(); // => PasteFromSystem() ???
+}
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index eabf33f3defc..039e4dc256ba 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -1235,22 +1235,6 @@ void __EXPORT ScCellShell::GetDBState( SfxItemSet& rSet )
bOk = pDBData->HasQueryParam() ||
pDBData->HasSortParam() ||
pDBData->HasSubTotalParam();
-#if OLD_PIVOT_IMPLEMENTATION
- if (!bOk)
- {
- // Pivottabelle mit den Daten als Quellbereich ?
- ScRange aDataRange;
- pDBData->GetArea(aDataRange);
- ScPivotCollection* pPivotCollection = pDoc->GetPivotCollection();
- USHORT nCount = pPivotCollection ? pPivotCollection->GetCount() : 0;
- for (USHORT i=0; i<nCount; i++)
- {
- ScPivot* pTemp = (*pPivotCollection)[i];
- if ( pTemp && pTemp->GetSrcArea().Intersects( aDataRange ) )
- bOk = TRUE;
- }
- }
-#endif
}
}
if (!bOk)
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index 0c59e083f0fe..ef68bbc9bd0c 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -828,28 +828,28 @@ void ScDrawView::MarkDropObj( SdrObject* pObj )
}
}
-void ScDrawView::CaptionTextDirection( USHORT nSlot )
-{
- if(nSlot != SID_TEXTDIRECTION_LEFT_TO_RIGHT && nSlot != SID_TEXTDIRECTION_TOP_TO_BOTTOM)
- return;
-
- SdrObject* pObject = GetTextEditObject();
- if ( ScDrawLayer::IsNoteCaption( pObject ) )
- {
- if( SdrCaptionObj* pCaption = dynamic_cast< SdrCaptionObj* >( pObject ) )
- {
- SfxItemSet aAttr(pCaption->GetMergedItemSet());
- aAttr.Put( SvxWritingModeItem(
- nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
- com::sun::star::text::WritingMode_LR_TB : com::sun::star::text::WritingMode_TB_RL,
- SDRATTR_TEXTDIRECTION ) );
- pCaption->SetMergedItemSet(aAttr);
- FuPoor* pPoor = pViewData->GetView()->GetDrawFuncPtr();
- if ( pPoor )
- {
- FuText* pText = static_cast<FuText*>(pPoor);
- pText->StopEditMode(TRUE);
- }
- }
- }
-}
+//UNUSED2009-05 void ScDrawView::CaptionTextDirection( USHORT nSlot )
+//UNUSED2009-05 {
+//UNUSED2009-05 if(nSlot != SID_TEXTDIRECTION_LEFT_TO_RIGHT && nSlot != SID_TEXTDIRECTION_TOP_TO_BOTTOM)
+//UNUSED2009-05 return;
+//UNUSED2009-05
+//UNUSED2009-05 SdrObject* pObject = GetTextEditObject();
+//UNUSED2009-05 if ( ScDrawLayer::IsNoteCaption( pObject ) )
+//UNUSED2009-05 {
+//UNUSED2009-05 if( SdrCaptionObj* pCaption = dynamic_cast< SdrCaptionObj* >( pObject ) )
+//UNUSED2009-05 {
+//UNUSED2009-05 SfxItemSet aAttr(pCaption->GetMergedItemSet());
+//UNUSED2009-05 aAttr.Put( SvxWritingModeItem(
+//UNUSED2009-05 nSlot == SID_TEXTDIRECTION_LEFT_TO_RIGHT ?
+//UNUSED2009-05 com::sun::star::text::WritingMode_LR_TB : com::sun::star::text::WritingMode_TB_RL,
+//UNUSED2009-05 SDRATTR_TEXTDIRECTION ) );
+//UNUSED2009-05 pCaption->SetMergedItemSet(aAttr);
+//UNUSED2009-05 FuPoor* pPoor = pViewData->GetView()->GetDrawFuncPtr();
+//UNUSED2009-05 if ( pPoor )
+//UNUSED2009-05 {
+//UNUSED2009-05 FuText* pText = static_cast<FuText*>(pPoor);
+//UNUSED2009-05 pText->StopEditMode(TRUE);
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 }
+//UNUSED2009-05 }
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index d9c19f02058a..022eabdc11cf 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -268,7 +268,7 @@ void ScEditShell::Execute( SfxRequest& rReq )
}
break;
- case FID_PASTE_CONTENTS:
+ case SID_PASTE_SPECIAL:
{
SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
SfxAbstractPasteDialog* pDlg = pFact->CreatePasteDialog( pViewData->GetDialogParent() );
@@ -714,7 +714,7 @@ IMPL_LINK( ScEditShell, ClipboardChanged, TransferableDataHelper*, pDataHelper )
SfxBindings& rBindings = pViewData->GetBindings();
rBindings.Invalidate( SID_PASTE );
- rBindings.Invalidate( FID_PASTE_CONTENTS );
+ rBindings.Invalidate( SID_PASTE_SPECIAL );
rBindings.Invalidate( SID_CLIPBOARD_FORMAT_ITEMS );
}
return 0;
@@ -742,7 +742,7 @@ void __EXPORT ScEditShell::GetClipState( SfxItemSet& rSet )
switch (nWhich)
{
case SID_PASTE:
- case FID_PASTE_CONTENTS:
+ case SID_PASTE_SPECIAL:
if( !bPastePossible )
rSet.DisableItem( nWhich );
break;
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index b2f3e12d1ee6..36f6c682832f 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -824,6 +824,11 @@ void __EXPORT ScFormatShell::ExecuteStyle( SfxRequest& rReq )
bNumFormatChanged, aOldSet, rNewSet ) )
pDoc->InvalidateTextWidth( NULL, NULL, bNumFormatChanged );
+ SCTAB nTabCount = pDoc->GetTableCount();
+ for (SCTAB nTab=0; nTab<nTabCount; nTab++)
+ if (pDoc->IsStreamValid(nTab))
+ pDoc->SetStreamValid(nTab, FALSE);
+
ULONG nOldFormat = ((const SfxUInt32Item&)aOldSet.
Get( ATTR_VALUE_FORMAT )).GetValue();
ULONG nNewFormat = ((const SfxUInt32Item&)rNewSet.
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 5397377b69cc..de2b962f3272 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -122,18 +122,11 @@
#include "tabprotection.hxx"
#include "postit.hxx"
-// #114409#
-#include <vcl/salbtype.hxx> // FRound
#include "drawview.hxx"
#include <svx/sdrpagewindow.hxx>
-#include <svx/sdrpaintwindow.hxx>
#include <svx/sdr/overlay/overlaymanager.hxx>
#include <vcl/svapp.hxx>
-
-#include <drawinglayer/primitive2d/invertprimitive2d.hxx>
-#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
-#include <drawinglayer/primitive2d/unifiedalphaprimitive2d.hxx>
-#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <svx/sdr/overlay/overlayselection.hxx>
using namespace com::sun::star;
using ::com::sun::star::uno::Sequence;
@@ -359,8 +352,7 @@ void lcl_UnLockComment( ScDrawView* pView, SdrPageView* pPV, SdrModel* pDrDoc, c
}
}
-//==================================================================
-
+// ---------------------------------------------------------------------------
// WB_DIALOGCONTROL noetig fuer UNO-Controls
ScGridWindow::ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhichPos )
: Window( pParent, WB_CLIPCHILDREN | WB_DIALOGCONTROL ),
@@ -383,9 +375,6 @@ ScGridWindow::ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhic
bEEMouse( FALSE ),
nMouseStatus( SC_GM_NONE ),
nNestedButtonState( SC_NESTEDBUTTON_NONE ),
-#if OLD_PIVOT_IMPLEMENTATION
- bPivotMouse( FALSE ),
-#endif
bDPMouse( FALSE ),
bRFMouse( FALSE ),
nPagebreakMouse( SC_PD_NONE ),
@@ -1844,15 +1833,6 @@ void __EXPORT ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
return;
}
-#if OLD_PIVOT_IMPLEMENTATION
- if (bPivotMouse)
- {
- PivotMouseButtonUp( rMEvt );
- bPivotMouse = FALSE;
- return;
- }
-#endif
-
if (bDPMouse)
{
DPMouseButtonUp( rMEvt ); // resets bDPMouse
@@ -2260,14 +2240,6 @@ void __EXPORT ScGridWindow::MouseMove( const MouseEvent& rMEvt )
return;
}
-#if OLD_PIVOT_IMPLEMENTATION
- if (bPivotMouse)
- {
- PivotMouseMove( rMEvt );
- return;
- }
-#endif
-
if (bDPMouse)
{
DPMouseMove( rMEvt );
@@ -2478,10 +2450,6 @@ void ScGridWindow::Tracking( const TrackingEvent& rTEvt )
{
if (!pViewData->GetView()->IsInActivatePart())
{
-#if OLD_PIVOT_IMPLEMENTATION
- if (bPivotMouse)
- bPivotMouse = FALSE; // gezeichnet wird per bDragRect
-#endif
if (bDPMouse)
bDPMouse = FALSE; // gezeichnet wird per bDragRect
if (bDragRect)
@@ -4890,7 +4858,6 @@ BOOL ScGridWindow::GetEditUrlOrError( BOOL bSpellErr, const Point& rPos,
MapMode aEditMode = pViewData->GetLogicMode(eWhich); // ohne Drawing-Skalierung
Rectangle aLogicEdit = PixelToLogic( aEditRect, aEditMode );
long nThisColLogic = aLogicEdit.Right() - aLogicEdit.Left() + 1;
-
Size aPaperSize = Size( 1000000, 1000000 );
if(pCell->GetCellType() == CELLTYPE_FORMULA)
{
@@ -5205,37 +5172,30 @@ void ScGridWindow::UpdateCursorOverlay()
}
}
- //
- // convert into logic units and create overlay object
- //
-
if ( aPixelRects.size() )
{
- sdr::overlay::OverlayObjectCell::RangeVector aRanges;
-
- std::vector<Rectangle>::const_iterator aPixelEnd( aPixelRects.end() );
- for ( std::vector<Rectangle>::const_iterator aPixelIter( aPixelRects.begin() );
- aPixelIter != aPixelEnd; ++aPixelIter )
- {
- Rectangle aLogic( PixelToLogic( *aPixelIter, aDrawMode ) );
-
- const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top());
- const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom());
- const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight);
-
- aRanges.push_back( a2DRange );
- }
-
// #i70788# get the OverlayManager safely
::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
if(pOverlayManager)
{
- BOOL bOld = pViewData->GetView()->IsOldSelection();
+ const Color aCursorColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
+ std::vector< basegfx::B2DRange > aRanges;
+ const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
- ScOverlayType eType = bOld ? SC_OVERLAY_INVERT : SC_OVERLAY_SOLID;
- Color aCursorColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
- sdr::overlay::OverlayObjectCell* pOverlay = new sdr::overlay::OverlayObjectCell( eType, aCursorColor, aRanges );
+ for(sal_uInt32 a(0); a < aPixelRects.size(); a++)
+ {
+ const Rectangle aRA(aPixelRects[a]);
+ basegfx::B2DRange aRB(aRA.Left(), aRA.Top(), aRA.Right() + 1, aRA.Bottom() + 1);
+ aRB.transform(aTransform);
+ aRanges.push_back(aRB);
+ }
+
+ sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
+ sdr::overlay::OVERLAY_SOLID,
+ aCursorColor,
+ aRanges,
+ false);
pOverlayManager->add(*pOverlay);
mpOOCursors = new ::sdr::overlay::OverlayObjectList;
@@ -5260,50 +5220,52 @@ void ScGridWindow::UpdateSelectionOverlay()
SetMapMode( aDrawMode );
DeleteSelectionOverlay();
-
std::vector<Rectangle> aPixelRects;
GetSelectionRects( aPixelRects );
if ( aPixelRects.size() && pViewData->IsActive() )
{
- SCTAB nTab = pViewData->GetTabNo();
- BOOL bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( nTab );
- BOOL bOld = pViewData->GetView()->IsOldSelection();
-
- sdr::overlay::OverlayObjectCell::RangeVector aRanges;
+ // #i70788# get the OverlayManager safely
+ ::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
- std::vector<Rectangle>::const_iterator aPixelEnd( aPixelRects.end() );
- for ( std::vector<Rectangle>::const_iterator aPixelIter( aPixelRects.begin() );
- aPixelIter != aPixelEnd; ++aPixelIter )
+ if(pOverlayManager)
{
- Rectangle aPixel( *aPixelIter );
- if ( !bOld )
+ std::vector< basegfx::B2DRange > aRanges;
+ const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
+
+ for(sal_uInt32 a(0); a < aPixelRects.size(); a++)
{
- // for transparent selection, add a pixel so the border is on the grid on all edges
- if ( bLayoutRTL )
- aPixel.Right() += 1;
- else
- aPixel.Left() -= 1;
- aPixel.Top() -= 1;
+ const Rectangle aRA(aPixelRects[a]);
+ basegfx::B2DRange aRB(aRA.Left() - 1, aRA.Top() - 1, aRA.Right(), aRA.Bottom());
+ aRB.transform(aTransform);
+ aRanges.push_back(aRB);
}
- Rectangle aLogic( PixelToLogic( aPixel, aDrawMode ) );
- const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top());
- const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom());
- const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight);
+ // #i97672# get the system's hilight color and limit it to the maximum
+ // allowed luminance. This is needed to react on too bright hilight colors
+ // which would otherwise vive a bad visualisation
+ Color aHighlight(GetSettings().GetStyleSettings().GetHighlightColor());
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ const basegfx::BColor aSelection(aHighlight.getBColor());
+ const double fLuminance(aSelection.luminance());
+ const double fMaxLum(aSvtOptionsDrawinglayer.GetSelectionMaximumLuminancePercent() / 100.0);
- aRanges.push_back( a2DRange );
- }
+ if(fLuminance > fMaxLum)
+ {
+ const double fFactor(fMaxLum / fLuminance);
+ const basegfx::BColor aNewSelection(
+ aSelection.getRed() * fFactor,
+ aSelection.getGreen() * fFactor,
+ aSelection.getBlue() * fFactor);
- // #i70788# get the OverlayManager safely
- ::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
+ aHighlight = Color(aNewSelection);
+ }
- if(pOverlayManager)
- {
- ScOverlayType eType = bOld ? SC_OVERLAY_INVERT : SC_OVERLAY_BORDER_TRANSPARENT;
- Color aHighlight( GetSettings().GetStyleSettings().GetHighlightColor() );
- sdr::overlay::OverlayObjectCell* pOverlay =
- new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges );
+ sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
+ sdr::overlay::OVERLAY_TRANSPARENT,
+ aHighlight,
+ aRanges,
+ true);
pOverlayManager->add(*pOverlay);
mpOOSelection = new ::sdr::overlay::OverlayObjectList;
@@ -5355,31 +5317,24 @@ void ScGridWindow::UpdateAutoFillOverlay()
aFillPos.Y() -= 2;
Rectangle aFillRect( aFillPos, Size(6,6) );
- //
- // convert into logic units
- //
-
- sdr::overlay::OverlayObjectCell::RangeVector aRanges;
-
- Rectangle aLogic( PixelToLogic( aFillRect, aDrawMode ) );
-
- const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top());
- const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom());
- const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight);
-
- aRanges.push_back( a2DRange );
-
// #i70788# get the OverlayManager safely
::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
if(pOverlayManager)
{
- BOOL bOld = pViewData->GetView()->IsOldSelection();
+ const Color aHandleColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
+ std::vector< basegfx::B2DRange > aRanges;
+ const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
+ basegfx::B2DRange aRB(aFillRect.Left(), aFillRect.Top(), aFillRect.Right() + 1, aFillRect.Bottom() + 1);
- ScOverlayType eType = bOld ? SC_OVERLAY_INVERT : SC_OVERLAY_SOLID;
- Color aHandleColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor );
- sdr::overlay::OverlayObjectCell* pOverlay =
- new sdr::overlay::OverlayObjectCell( eType, aHandleColor, aRanges );
+ aRB.transform(aTransform);
+ aRanges.push_back(aRB);
+
+ sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
+ sdr::overlay::OVERLAY_SOLID,
+ aHandleColor,
+ aRanges,
+ false);
pOverlayManager->add(*pOverlay);
mpOOAutoFill = new ::sdr::overlay::OverlayObjectList;
@@ -5490,34 +5445,28 @@ void ScGridWindow::UpdateDragRectOverlay()
aPixelRects.push_back( Rectangle( aRect.Left()+3, aRect.Bottom()-2, aRect.Right()-3, aRect.Bottom() ) );
}
- //
- // convert into logic units and create overlay object
- //
-
- sdr::overlay::OverlayObjectCell::RangeVector aRanges;
-
- std::vector<Rectangle>::const_iterator aPixelEnd( aPixelRects.end() );
- for ( std::vector<Rectangle>::const_iterator aPixelIter( aPixelRects.begin() );
- aPixelIter != aPixelEnd; ++aPixelIter )
- {
- Rectangle aLogic( PixelToLogic( *aPixelIter, aDrawMode ) );
-
- const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top());
- const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom());
- const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight);
-
- aRanges.push_back( a2DRange );
- }
-
// #i70788# get the OverlayManager safely
::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
if(pOverlayManager)
{
- ScOverlayType eType = SC_OVERLAY_INVERT;
- Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor();
- sdr::overlay::OverlayObjectCell* pOverlay =
- new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges );
+ // Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor();
+ std::vector< basegfx::B2DRange > aRanges;
+ const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
+
+ for(sal_uInt32 a(0); a < aPixelRects.size(); a++)
+ {
+ const Rectangle aRA(aPixelRects[a]);
+ basegfx::B2DRange aRB(aRA.Left(), aRA.Top(), aRA.Right() + 1, aRA.Bottom() + 1);
+ aRB.transform(aTransform);
+ aRanges.push_back(aRB);
+ }
+
+ sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
+ sdr::overlay::OVERLAY_INVERT,
+ Color(COL_BLACK),
+ aRanges,
+ false);
pOverlayManager->add(*pOverlay);
mpOODragRect = new ::sdr::overlay::OverlayObjectList;
@@ -5544,31 +5493,26 @@ void ScGridWindow::UpdateHeaderOverlay()
DeleteHeaderOverlay();
// Pixel rectangle is in aInvertRect
-
- //
- // convert into logic units and create overlay object
- //
-
if ( !aInvertRect.IsEmpty() )
{
- Rectangle aLogic( PixelToLogic( aInvertRect, aDrawMode ) );
-
- const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top());
- const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom());
- const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight);
-
- sdr::overlay::OverlayObjectCell::RangeVector aRanges;
- aRanges.push_back( a2DRange );
-
// #i70788# get the OverlayManager safely
::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
if(pOverlayManager)
{
- ScOverlayType eType = SC_OVERLAY_INVERT;
- Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor();
- sdr::overlay::OverlayObjectCell* pOverlay =
- new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges );
+ // Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor();
+ std::vector< basegfx::B2DRange > aRanges;
+ const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
+ basegfx::B2DRange aRB(aInvertRect.Left(), aInvertRect.Top(), aInvertRect.Right() + 1, aInvertRect.Bottom() + 1);
+
+ aRB.transform(aTransform);
+ aRanges.push_back(aRB);
+
+ sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
+ sdr::overlay::OVERLAY_INVERT,
+ Color(COL_BLACK),
+ aRanges,
+ false);
pOverlayManager->add(*pOverlay);
mpOOHeader = new ::sdr::overlay::OverlayObjectList;
@@ -5619,30 +5563,26 @@ void ScGridWindow::UpdateShrinkOverlay()
}
}
- //
- // convert into logic units and create overlay object
- //
-
if ( !aPixRect.IsEmpty() )
{
- Rectangle aLogic( PixelToLogic( aPixRect, aDrawMode ) );
-
- const basegfx::B2DPoint aTopLeft(aLogic.Left(), aLogic.Top());
- const basegfx::B2DPoint aBottomRight(aLogic.Right(), aLogic.Bottom());
- const basegfx::B2DRange a2DRange(aTopLeft, aBottomRight);
-
- sdr::overlay::OverlayObjectCell::RangeVector aRanges;
- aRanges.push_back( a2DRange );
-
// #i70788# get the OverlayManager safely
::sdr::overlay::OverlayManager* pOverlayManager = getOverlayManager();
if(pOverlayManager)
{
- ScOverlayType eType = SC_OVERLAY_INVERT;
- Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor();
- sdr::overlay::OverlayObjectCell* pOverlay =
- new sdr::overlay::OverlayObjectCell( eType, aHighlight, aRanges );
+ // Color aHighlight = GetSettings().GetStyleSettings().GetHighlightColor();
+ std::vector< basegfx::B2DRange > aRanges;
+ const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation());
+ basegfx::B2DRange aRB(aPixRect.Left(), aPixRect.Top(), aPixRect.Right() + 1, aPixRect.Bottom() + 1);
+
+ aRB.transform(aTransform);
+ aRanges.push_back(aRB);
+
+ sdr::overlay::OverlayObject* pOverlay = new sdr::overlay::OverlaySelection(
+ sdr::overlay::OVERLAY_INVERT,
+ Color(COL_BLACK),
+ aRanges,
+ false);
pOverlayManager->add(*pOverlay);
mpOOShrink = new ::sdr::overlay::OverlayObjectList;
@@ -5684,121 +5624,4 @@ void ScGridWindow::flushOverlayManager()
}
// ---------------------------------------------------------------------------
-
-// #114409#
-namespace sdr
-{
- namespace overlay
- {
- OverlayObjectCell::OverlayObjectCell( ScOverlayType eType, const Color& rColor, const RangeVector& rRects )
- : OverlayObject( rColor ),
- mePaintType( eType ),
- maRectangles( rRects )
- {
- // no AA for selection overlays
- allowAntiAliase(false);
- }
-
- OverlayObjectCell::~OverlayObjectCell()
- {
- }
-
- drawinglayer::primitive2d::Primitive2DSequence OverlayObjectCell::createOverlayObjectPrimitive2DSequence()
- {
- drawinglayer::primitive2d::Primitive2DSequence aRetval;
- const basegfx::BColor aRGBColor(getBaseColor().getBColor());
- const sal_uInt32 nCount(maRectangles.size());
-
- if(nCount)
- {
- // create fill primities for all rectangles
- // These ranges are meant as rectangles, so it is not sufficient to replace them
- // using the derived polygon. That would leave out the bottom and right lines
- // in a discrete width/height due to polygon painting conventions of leaving off those.
- // To solve, it is either possible to create a view-dependent rectangle primitive
- // handling this internally or to additionally create a hairline primitive to
- // cover these areas (which i will do here)
- const bool bIsTransparent(SC_OVERLAY_BORDER_TRANSPARENT == mePaintType);
- aRetval.realloc(nCount * 2);
-
- for(sal_uInt32 a(0);a < nCount; a++)
- {
- const basegfx::B2DRange& rRange(maRectangles[a]);
- const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(rRange));
-
- aRetval[a * 2] = drawinglayer::primitive2d::Primitive2DReference(
- new drawinglayer::primitive2d::PolyPolygonColorPrimitive2D(
- basegfx::B2DPolyPolygon(aPolygon),
- aRGBColor));
- aRetval[(a * 2) + 1] = drawinglayer::primitive2d::Primitive2DReference(
- new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D(
- basegfx::B2DPolyPolygon(aPolygon),
- aRGBColor));
- }
-
- if(SC_OVERLAY_INVERT == mePaintType)
- {
- // embed all in invert primitive
- const drawinglayer::primitive2d::Primitive2DReference aInvert(
- new drawinglayer::primitive2d::InvertPrimitive2D(
- aRetval));
-
- aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aInvert, 1);
- }
- else if(bIsTransparent)
- {
- // embed all rectangles in 75% transparent paint
- const drawinglayer::primitive2d::Primitive2DReference aUnifiedAlpha(
- new drawinglayer::primitive2d::UnifiedAlphaPrimitive2D(
- aRetval,
- 0.75));
-
- // prepare merged PolyPoygon selection outline
- const basegfx::B2DPolyPolygon aPolyPolygon(impGetOverlayPolyPolygon());
- const drawinglayer::primitive2d::Primitive2DReference aSelectionOutline(
- new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D(
- aPolyPolygon,
- aRGBColor));
-
- // add both to result
- aRetval.realloc(2);
- aRetval[0] = aUnifiedAlpha;
- aRetval[1] = aSelectionOutline;
- }
- }
-
- return aRetval;
- }
-
- basegfx::B2DPolyPolygon OverlayObjectCell::impGetOverlayPolyPolygon() const
- {
- PolyPolygon aPolyPoly;
- const sal_uInt32 nRectCount(maRectangles.size());
-
- for(sal_uInt32 nRect(0); nRect < nRectCount; ++nRect)
- {
- const basegfx::B2DRange& rRange(maRectangles[nRect]);
- const Rectangle aRectangle(
- FRound(rRange.getMinX()), FRound(rRange.getMinY()),
- FRound(rRange.getMaxX()), FRound(rRange.getMaxY()));
-
- if ( nRectCount == 1 || nRect+1 < nRectCount )
- {
- // simply add for all except the last rect
- aPolyPoly.Insert( Polygon( aRectangle ) );
- }
- else
- {
- PolyPolygon aTemp( aPolyPoly );
- aTemp.GetUnion( PolyPolygon( Polygon( aRectangle ) ), aPolyPoly );
- }
- }
-
- return aPolyPoly.getB2DPolyPolygon();
- }
- } // end of namespace overlay
-} // end of namespace sdr
-
-// ---------------------------------------------------------------------------
-
// eof
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 92743ef65524..643928a7c8aa 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -104,91 +104,6 @@ void ScGridWindow::DoPushButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt
ScDPObject* pDPObj = pDoc->GetDPAtCursor(nCol, nRow, nTab);
-#if OLD_PIVOT_IMPLEMENTATION
- ScPivotCollection* pPivotCollection = pDoc->GetPivotCollection();
- ScPivot* pPivot = pPivotCollection->GetPivotAtCursor(nCol, nRow, nTab);
-
- if (pPivot) // alte Pivottabellen
- {
- if (pPivot->IsFilterAtCursor(nCol, nRow, nTab))
- {
- ReleaseMouse(); // falls schon beim ButtonDown gecaptured, #44018#
-
- ScQueryParam aQueryParam;
- pPivot->GetQuery(aQueryParam);
- SCTAB nSrcTab = pPivot->GetSrcArea().aStart.Tab();
-
- SfxItemSet aArgSet( pViewData->GetViewShell()->GetPool(),
- SCITEM_QUERYDATA, SCITEM_QUERYDATA );
- aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA, pViewData, &aQueryParam ) );
-
- //CHINA001 ScPivotFilterDlg* pDlg = new ScPivotFilterDlg(
- //CHINA001 pViewData->GetViewShell()->GetDialogParent(),
- //CHINA001 aArgSet, nSrcTab );
- ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
- DBG_ASSERT(pFact, "ScAbstractFactory create fail!");//CHINA001
-
- AbstractScPivotFilterDlg* pDlg = pFact->CreateScPivotFilterDlg( pViewData->GetViewShell()->GetDialogParent(),
- aArgSet, nSrcTab,
- RID_SCDLG_PIVOTFILTER);
- DBG_ASSERT(pDlg, "Dialog create fail!");//CHINA001
- if ( pDlg->Execute() == RET_OK )
- {
- ScPivot* pNewPivot = pPivot->CreateNew();
-
- const ScQueryItem& rQueryItem = pDlg->GetOutputItem();
- pNewPivot->SetQuery(rQueryItem.GetQueryData());
-
- PivotField* pColArr = new PivotField[PIVOT_MAXFIELD];
- SCSIZE nColCount;
- pPivot->GetColFields( pColArr, nColCount );
- PivotField* pRowArr = new PivotField[PIVOT_MAXFIELD];
- SCSIZE nRowCount;
- pPivot->GetRowFields( pRowArr, nRowCount );
- PivotField* pDataArr = new PivotField[PIVOT_MAXFIELD];
- SCSIZE nDataCount;
- pPivot->GetDataFields( pDataArr, nDataCount );
-
- pNewPivot->SetColFields( pColArr, nColCount );
- pNewPivot->SetRowFields( pRowArr, nRowCount );
- pNewPivot->SetDataFields( pDataArr, nDataCount );
-
- pNewPivot->SetName( pPivot->GetName() );
- pNewPivot->SetTag( pPivot->GetTag() );
-
- pViewData->GetDocShell()->PivotUpdate( pPivot, pNewPivot );
- }
- delete pDlg;
- }
- else
- {
- SCCOL nField;
- if (pPivot->GetColFieldAtCursor(nCol, nRow, nTab, nField))
- {
- bPivotMouse = TRUE;
- nPivotField = nField;
- bPivotColField = TRUE;
- nPivotCol = nCol;
- pDragPivot = pPivot;
- PivotTestMouse( rMEvt, TRUE );
- // CaptureMouse();
- StartTracking();
- }
- else if (pPivot->GetRowFieldAtCursor(nCol, nRow, nTab, nField))
- {
- bPivotMouse = TRUE;
- nPivotField = nField;
- bPivotColField = FALSE;
- nPivotCol = nCol;
- pDragPivot = pPivot;
- PivotTestMouse( rMEvt, TRUE );
- // CaptureMouse();
- StartTracking();
- }
- }
- }
-#endif
-
if (pDPObj)
{
USHORT nOrient = sheet::DataPilotFieldOrientation_HIDDEN;
@@ -256,365 +171,6 @@ void ScGridWindow::DoPushButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt
}
}
-#if OLD_PIVOT_IMPLEMENTATION
-void ScGridWindow::DoPivotDrop( BOOL bDelete, BOOL bToCols, SCSIZE nDestPos )
-{
- if ( nPivotField == PIVOT_DATA_FIELD && bDelete )
- {
- pViewData->GetView()->ErrorMessage(STR_PIVOT_MOVENOTALLOWED);
- return;
- }
-
- if ( bPivotColField != bToCols && !bDelete )
- {
- SCSIZE nDestCount = bToCols ? pDragPivot->GetColFieldCount()
- : pDragPivot->GetRowFieldCount();
- if ( nDestCount >= PIVOT_MAXFIELD ) // schon voll?
- {
- // Versuch, mehr als PIVOT_MAXFIELD Eintraege zu erzeugen
- pViewData->GetView()->ErrorMessage(STR_PIVOT_ERROR);
- return;
- }
- }
-
- PivotField* pColArr = new PivotField[PIVOT_MAXFIELD];
- SCSIZE nColCount;
- pDragPivot->GetColFields( pColArr, nColCount );
-
- PivotField* pRowArr = new PivotField[PIVOT_MAXFIELD];
- SCSIZE nRowCount;
- pDragPivot->GetRowFields( pRowArr, nRowCount );
-
- PivotField* pDataArr = new PivotField[PIVOT_MAXFIELD];
- SCSIZE nDataCount;
- pDragPivot->GetDataFields( pDataArr, nDataCount );
-
- SCSIZE nOldPos = 0;
- PivotField aMoveField;
-
- PivotField* pSource = bPivotColField ? pColArr : pRowArr;
- SCSIZE& rCount = bPivotColField ? nColCount : nRowCount;
-
- BOOL bFound = FALSE;
- for (SCSIZE i=0; i<rCount && !bFound; i++)
- if (pSource[i].nCol == nPivotField)
- {
- nOldPos = i;
- aMoveField = pSource[i];
- --rCount;
- if (i<rCount)
- memmove( &pSource[i], &pSource[i+1], (rCount-i)*sizeof(PivotField) );
- if ( bPivotColField == bToCols )
- if (nDestPos > i)
- --nDestPos;
- bFound = TRUE;
- }
-
- if (bFound)
- {
- if (!bDelete)
- {
- PivotField* pDest = bToCols ? pColArr : pRowArr;
- SCSIZE& rDestCount = bToCols ? nColCount : nRowCount;
-
- if (nDestPos < rDestCount)
- memmove( &pDest[nDestPos+1], &pDest[nDestPos],
- (rDestCount-nDestPos)*sizeof(PivotField) );
- pDest[nDestPos] = aMoveField;
- ++rDestCount;
- }
-
- BOOL bEmpty = ( nColCount + nRowCount == 0 ||
- ( nColCount + nRowCount == 1 && nDataCount <= 1 ) );
-
- if ( bEmpty ) // Pivottabelle loeschen
- {
- pViewData->GetDocShell()->PivotUpdate( pDragPivot, NULL );
- }
- else
- {
- ScPivot* pNewPivot = pDragPivot->CreateNew();
- pNewPivot->SetColFields( pColArr, nColCount );
- pNewPivot->SetRowFields( pRowArr, nRowCount );
- pNewPivot->SetDataFields( pDataArr, nDataCount );
-
- pNewPivot->SetName( pDragPivot->GetName() );
- pNewPivot->SetTag( pDragPivot->GetTag() );
-
- pViewData->GetDocShell()->PivotUpdate( pDragPivot, pNewPivot );
- }
- pDragPivot = NULL;
- }
- else
- {
- DBG_ASSERT(0,"Pivot-Eintrag nicht gefunden");
- }
-
- delete[] pColArr;
- delete[] pRowArr;
- delete[] pDataArr;
-}
-
-BOOL ScGridWindow::PivotTestMouse( const MouseEvent& rMEvt, BOOL bMove )
-{
- BOOL bRet = FALSE;
- BOOL bTimer = FALSE;
- Point aPos = rMEvt.GetPosPixel();
-
- SCsCOL nDx = 0;
- SCsROW nDy = 0;
- if ( aPos.X() < 0 )
- nDx = -1;
- if ( aPos.Y() < 0 )
- nDy = -1;
- Size aSize = GetOutputSizePixel();
- if ( aPos.X() >= aSize.Width() )
- nDx = 1;
- if ( aPos.Y() >= aSize.Height() )
- nDy = 1;
- if ( nDx != 0 || nDy != 0 )
- {
- if (bDragRect)
- {
- // DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, FALSE );
- bDragRect = FALSE;
- UpdateDragRectOverlay();
- }
-
- if ( nDx != 0 )
- pViewData->GetView()->ScrollX( nDx, WhichH(eWhich) );
- if ( nDy != 0 )
- pViewData->GetView()->ScrollY( nDy, WhichV(eWhich) );
-
- bTimer = TRUE;
- }
-
- SCsCOL nPosX;
- SCsROW nPosY;
- pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
- BOOL bMouseLeft;
- BOOL bMouseTop;
- pViewData->GetMouseQuadrant( aPos, eWhich, nPosX, nPosY, bMouseLeft, bMouseTop );
-
- SCCOL nPiCol1;
- SCROW nPiRow1;
- SCCOL nPiCol2;
- SCROW nPiRow2;
- SCTAB nTab;
- pDragPivot->GetDestArea( nPiCol1, nPiRow1, nPiCol2, nPiRow2, nTab );
-
- if ( nPosX >= (SCsCOL) nPiCol1 && nPosX <= (SCsCOL) nPiCol2 &&
- nPosY >= (SCsROW) nPiRow1 && nPosY <= (SCsROW) nPiRow2 )
- {
- SCsROW nFilterAdd = 2; // Platz fuer Filter-Button
- SCsROW nColRows = 1; //! Ueberschrift: 0, wenn keine Zeilen, aber mehrere Datenfelder
- SCCOL nNewStartX;
- SCROW nNewStartY;
- SCCOL nNewEndX;
- SCROW nNewEndY;
-
- SCsCOL nRelX = nPosX - (SCsCOL) nPiCol1;
- SCsROW nRelY = nPosY - (SCsROW) nPiRow1 - nFilterAdd;
-
- PivotField* pFieldArr = new PivotField[PIVOT_MAXFIELD];
- SCSIZE nColCount;
- pDragPivot->GetColFields( pFieldArr, nColCount );
- SCSIZE nRowCount;
- pDragPivot->GetRowFields( pFieldArr, nRowCount );
- delete[] pFieldArr;
-
- BOOL bBefore;
- SCsCOL nColSize = static_cast<SCsCOL>(Max( nColCount, (SCSIZE) 1 ));
- SCsROW nRowSize = static_cast<SCsROW>(Max( nRowCount, (SCSIZE) 1 ));
-
- BOOL bToCols;
- if (nRelX < nColSize && nRelY >= nRowSize)
- bToCols = TRUE; // links
- else if (nRelY < nRowSize && nRelX >= nColSize)
- bToCols = FALSE; // oben
- else
- bToCols = ( nRelY-nRowSize > static_cast<SCsCOLROW>(nRelX-nColSize) );
-
- SCsCOL nDestCol = 0;
- SCsROW nDestRow = 0;
- BOOL bNothing = FALSE;
-
- if ( bToCols )
- {
- bBefore = bMouseLeft;
- nDestCol = nRelX;
- if (nDestCol < 0)
- {
- nDestCol = 0;
- bBefore = TRUE;
- }
- if (nDestCol >= static_cast<SCsCOL>(nColCount))
- {
- nDestCol = static_cast<SCsCOL>(nColCount)-1;
- bBefore = FALSE;
- }
-
- nNewStartY = nPiRow1 + nFilterAdd + static_cast<SCROW>(nRowCount) + nColRows;
- nNewEndY = nPiRow2 - 1;
- nNewStartX = nPiCol1 + (SCCOL) nDestCol;
- nNewEndX = nNewStartX;
-
- if ( !bPivotColField ) // von der anderen Seite
- {
- if (bBefore)
- nNewEndX = nNewStartX - 1; // vor dem Feld
- else
- nNewStartX = nNewEndX + 1; // hinter dem Feld
- }
- else
- {
- SCCOL nThisCol = (SCCOL) nPosX; // absolute Spalte ( == Maus )
- if ( nThisCol < nPivotCol )
- {
- nNewEndX = nNewStartX - 1; // vor dem Feld
- bBefore = TRUE;
- }
- else if ( nThisCol > nPivotCol )
- {
- nNewStartX = nNewEndX + 1; // hinter dem Feld
- bBefore = FALSE;
- }
- else
- bNothing = TRUE;
- }
- SetPointer( Pointer( POINTER_PIVOT_ROW ) );
- }
- else
- {
- if (nRelY <= 0 && static_cast<SCsCOLROW>(nRelX) < static_cast<SCsCOLROW>(nColCount)+static_cast<SCsCOLROW>(nRowCount))
- {
- nDestRow = static_cast<SCsCOLROW>(nRelX) - static_cast<SCsCOLROW>(nColCount);
- bBefore = bMouseLeft;
- }
- else
- {
- nDestRow = nRelY-1;
- bBefore = bMouseTop;
- }
- if (nDestRow < 0)
- {
- nDestRow = 0;
- bBefore = TRUE;
- }
- if (nDestRow >= static_cast<SCsROW>(nRowCount))
- {
- nDestRow = static_cast<SCsROW>(nRowCount)-1;
- bBefore = FALSE;
- }
-
- nNewStartX = nPiCol1 + (SCCOL) nColCount;
- nNewEndX = nPiCol2 - 1;
- nNewStartY = nPiRow1 + nFilterAdd + nDestRow + nColRows;
- nNewEndY = nNewStartY;
- if ( bPivotColField ) // von der anderen Seite
- {
- if (bBefore)
- nNewEndY = nNewStartY - 1; // vor dem Feld
- else
- nNewStartY = nNewEndY + 1; // hinter dem Feld
- }
- else
- {
- SCCOL nThisCol =
- static_cast<SCCOL>(static_cast<SCCOLROW>(nDestRow) +
- static_cast<SCCOLROW>(nColCount) + nPiCol1);
- // absolute Spalte
- if ( nThisCol < nPivotCol )
- {
- bBefore = TRUE;
- nNewEndY = nNewStartY - 1; // vor dem Feld
- }
- else if ( nThisCol > nPivotCol )
- {
- bBefore = FALSE;
- nNewStartY = nNewEndY + 1; // hinter dem Feld
- }
- else
- bNothing = TRUE;
- }
- SetPointer( Pointer( POINTER_PIVOT_COL ) );
- }
-
- if (bMove)
- {
- if ( nNewStartX != nDragStartX || nNewEndX != nDragEndX ||
- nNewStartY != nDragStartY || nNewEndY != nDragEndY || !bDragRect )
- {
- //if (bDragRect)
- // DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, FALSE );
-
- nDragStartX = nNewStartX;
- nDragStartY = nNewStartY;
- nDragEndX = nNewEndX;
- nDragEndY = nNewEndY;
- bDragRect = TRUE;
-
- // DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, FALSE );
-
- UpdateDragRectOverlay();
- }
- }
- else
- {
- if (bDragRect)
- {
- // DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, FALSE );
- bDragRect = FALSE;
- UpdateDragRectOverlay();
- }
-
- if (!bNothing)
- {
- SCSIZE nDestPos = bToCols ? static_cast<SCSIZE>(nDestCol) : static_cast<SCSIZE>(nDestRow);
- if (!bBefore)
- ++nDestPos;
- DoPivotDrop( FALSE, bToCols, nDestPos );
- }
- }
-
- bRet = TRUE;
- }
- else
- {
- if (bMove)
- SetPointer( Pointer( POINTER_PIVOT_DELETE ) );
- // if (bDragRect)
- // DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, FALSE );
- bDragRect = FALSE;
- UpdateDragRectOverlay();
-
- if (!bMove)
- DoPivotDrop( TRUE, FALSE,0 );
- }
-
- if (bTimer && bMove)
- pViewData->GetView()->SetTimer( this, rMEvt ); // Event wiederholen
- else
- pViewData->GetView()->ResetTimer();
-
- return bRet;
-}
-
-void ScGridWindow::PivotMouseMove( const MouseEvent& rMEvt )
-{
- PivotTestMouse( rMEvt, TRUE );
-}
-
-void ScGridWindow::PivotMouseButtonUp( const MouseEvent& rMEvt )
-{
- bPivotMouse = FALSE; // als erstes, falls PivotTestMouse eine Fehlermeldung bringt
- ReleaseMouse();
-
- PivotTestMouse( rMEvt, FALSE );
- SetPointer( Pointer( POINTER_ARROW ) );
-}
-#endif
-
// -----------------------------------------------------------------------
//
// Data Pilot interaction
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index b90e5d3e802e..d700ee606731 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -2045,8 +2045,6 @@ void ScGridWindow::DataChanged( const DataChangedEvent& rDCEvt )
// RepeatResize in case scroll bar sizes have changed
pView->RepeatResize();
-
- pView->UpdateSelectionType();
pView->UpdateAllOverlays();
// invalidate cell attribs in input handler, in case the
diff --git a/sc/source/ui/view/makefile.mk b/sc/source/ui/view/makefile.mk
index 9af8051b6613..466ab5dc8627 100644
--- a/sc/source/ui/view/makefile.mk
+++ b/sc/source/ui/view/makefile.mk
@@ -135,12 +135,10 @@ SLOFILES = \
$(SLO)$/viewfun4.obj \
$(SLO)$/viewfun2.obj
.ELIF "$(OS)$(COM)$(CPUNAME)"=="SOLARISC52INTEL"
-# tabcont can be removed if -xspace is no longer used (i99576, i99592)
NOOPTFILES=\
$(SLO)$/drawview.obj \
$(SLO)$/dbfunc2.obj \
- $(SLO)$/tabvwsh2.obj \
- $(SLO)$/tabcont.obj
+ $(SLO)$/tabvwsh2.obj
.ELSE
NOOPTFILES=\
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index b600600acb6b..9d2da303988c 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -1816,6 +1816,7 @@ void ScOutputData::FindChanged()
pDoc->DisableIdle( bWasIdleDisabled );
}
+#ifdef OLD_SELECTION_PAINT
void ScOutputData::DrawMark( Window* pWin )
{
Rectangle aRect;
@@ -1826,14 +1827,14 @@ void ScOutputData::DrawMark( Window* pWin )
for (SCSIZE nArrY=1; nArrY+1<nArrCount; nArrY++)
{
RowInfo* pThisRowInfo = &pRowInfo[nArrY];
- if ( pThisRowInfo->bChanged )
+ if (pThisRowInfo->bChanged)
{
long nPosX = nScrX;
- if ( bLayoutRTL )
+ if (bLayoutRTL)
nPosX += nMirrorW - 1; // always in pixels
aRect = Rectangle( Point( nPosX,nPosY ), Size(1, pThisRowInfo->nHeight) );
- if ( bLayoutRTL )
+ if (bLayoutRTL)
aRect.Left() = aRect.Right() + 1;
else
aRect.Right() = aRect.Left() - 1;
@@ -1841,12 +1842,12 @@ void ScOutputData::DrawMark( Window* pWin )
BOOL bOldMarked = FALSE;
for (SCCOL nX=nX1; nX<=nX2; nX++)
{
- if ( pThisRowInfo->pCellInfo[nX+1].bMarked != bOldMarked )
+ if (pThisRowInfo->pCellInfo[nX+1].bMarked != bOldMarked)
{
if (bOldMarked && aRect.Right() >= aRect.Left())
aInvert.AddRect( aRect );
- if ( bLayoutRTL )
+ if (bLayoutRTL)
aRect.Right() = nPosX;
else
aRect.Left() = nPosX;
@@ -1854,7 +1855,7 @@ void ScOutputData::DrawMark( Window* pWin )
bOldMarked = pThisRowInfo->pCellInfo[nX+1].bMarked;
}
- if ( bLayoutRTL )
+ if (bLayoutRTL)
{
nPosX -= pRowInfo[0].pCellInfo[nX+1].nWidth;
aRect.Left() = nPosX+1;
@@ -1871,6 +1872,7 @@ void ScOutputData::DrawMark( Window* pWin )
nPosY += pThisRowInfo->nHeight;
}
}
+#endif
void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY,
SCCOL nRefEndX, SCROW nRefEndY,
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index e41bd4941d9c..f5688171b145 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -94,7 +94,6 @@ const USHORT SC_SHRINKAGAIN_MAX = 7;
class ScDrawStringsVars
{
ScOutputData* pOutput; // Verbindung
- SvNumberFormatter* pFormatter;
const ScPatternAttr* pPattern; // Attribute
const SfxItemSet* pCondSet; // aus bedingter Formatierung
@@ -187,8 +186,6 @@ ScDrawStringsVars::ScDrawStringsVars(ScOutputData* pData, BOOL bPTL) :
bShrink ( FALSE ),
bPixelToLogic( bPTL )
{
- pFormatter = pData->pDoc->GetFormatTable();
-
ScModule* pScMod = SC_MOD();
// #105733# SvtAccessibilityOptions::GetIsForBorders is no longer used (always assumed TRUE)
bCellContrast = pOutput->bUseStyleColor &&
@@ -373,7 +370,7 @@ void ScDrawStringsVars::SetPattern( const ScPatternAttr* pNew, const SfxItemSet*
// Zahlenformat
// ULONG nOld = nValueFormat;
- nValueFormat = pPattern->GetNumberFormat( pFormatter, pCondSet );
+ nValueFormat = pPattern->GetNumberFormat( pOutput->pDoc->GetFormatTable(), pCondSet );
/* s.u.
if (nValueFormat != nOld)
@@ -414,7 +411,7 @@ void ScDrawStringsVars::SetPatternSimple( const ScPatternAttr* pNew, const SfxIt
const SfxPoolItem* pLangItem;
if ( !pCondSet || pCondSet->GetItemState(ATTR_LANGUAGE_FORMAT,TRUE,&pLangItem) != SFX_ITEM_SET )
pLangItem = &pPattern->GetItem(ATTR_LANGUAGE_FORMAT);
- nValueFormat = pFormatter->GetFormatForLanguageIfBuiltIn(
+ nValueFormat = pOutput->pDoc->GetFormatTable()->GetFormatForLanguageIfBuiltIn(
((SfxUInt32Item*)pFormItem)->GetValue(),
((SvxLanguageItem*)pLangItem)->GetLanguage() );
@@ -456,7 +453,7 @@ BOOL ScDrawStringsVars::SetText( ScBaseCell* pCell )
ULONG nFormat = GetValueFormat();
ScCellFormat::GetString( pCell,
nFormat, aString, &pColor,
- *pFormatter,
+ *pOutput->pDoc->GetFormatTable(),
pOutput->bShowNullValues,
pOutput->bShowFormulas,
ftCheck );
@@ -1358,11 +1355,13 @@ void ScOutputData::DrawStrings( BOOL bPixelToLogic )
}
if (bDoCell && !bNeedEdit)
{
- if ( pCell->GetCellType() == CELLTYPE_FORMULA )
+ BOOL bFormulaCell = (pCell->GetCellType() == CELLTYPE_FORMULA );
+ if ( bFormulaCell )
lcl_CreateInterpretProgress( bProgress, pDoc, (ScFormulaCell*)pCell );
if ( aVars.SetText(pCell) )
pOldPattern = NULL;
- bNeedEdit = aVars.HasEditCharacters();
+ bNeedEdit = aVars.HasEditCharacters() ||
+ (bFormulaCell && ((ScFormulaCell*)pCell)->IsMultilineResult());
}
if (bDoCell && !bNeedEdit)
{
@@ -1914,8 +1913,6 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
Size aMinSize = pRefDevice->PixelToLogic(Size(0,100)); // erst darueber wird ausgegeben
// UINT32 nMinHeight = aMinSize.Height() / 200; // 1/2 Pixel
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
-
ScModule* pScMod = SC_MOD();
sal_Int32 nConfBackColor = pScMod->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
// #105733# SvtAccessibilityOptions::GetIsForBorders is no longer used (always assumed TRUE)
@@ -2319,12 +2316,12 @@ void ScOutputData::DrawEdit(BOOL bPixelToLogic)
else
{
ULONG nFormat = pPattern->GetNumberFormat(
- pFormatter, pCondSet );
+ pDoc->GetFormatTable(), pCondSet );
String aString;
Color* pColor;
ScCellFormat::GetString( pCell,
nFormat,aString, &pColor,
- *pFormatter,
+ *pDoc->GetFormatTable(),
bShowNullValues,
bShowFormulas,
ftCheck );
@@ -2810,8 +2807,6 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
nRotMax = pRowInfo[nRotY].nRotMaxCol;
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
-
ScModule* pScMod = SC_MOD();
sal_Int32 nConfBackColor = pScMod->GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
// #105733# SvtAccessibilityOptions::GetIsForBorders is no longer used (always assumed TRUE)
@@ -3100,12 +3095,12 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
else
{
ULONG nFormat = pPattern->GetNumberFormat(
- pFormatter, pCondSet );
+ pDoc->GetFormatTable(), pCondSet );
String aString;
Color* pColor;
ScCellFormat::GetString( pCell,
nFormat,aString, &pColor,
- *pFormatter,
+ *pDoc->GetFormatTable(),
bShowNullValues,
bShowFormulas,
ftCheck );
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 3bfb8729cd37..db1a8952aeef 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -49,6 +49,7 @@
#include "sc.hrc"
#include "globstr.hrc"
#include "transobj.hxx"
+#include "clipparam.hxx"
// STATIC DATA -----------------------------------------------------------
@@ -447,7 +448,8 @@ void ScTabControl::DoDrag( const Region& /* rRegion */ )
aTabMark.SetMarkArea( ScRange(0,0,nTab,MAXCOL,MAXROW,nTab) );
ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP );
- pDoc->CopyToClip( 0,0, MAXCOL,MAXROW, FALSE, pClipDoc, FALSE, &aTabMark );
+ ScClipParam aClipParam(ScRange(0, 0, 0, MAXCOL, MAXROW, 0), false);
+ pDoc->CopyToClip(aClipParam, pClipDoc, &aTabMark, false);
TransferableObjectDescriptor aObjDesc;
pDocSh->FillTransferableObjectDescriptor( aObjDesc );
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index c51c81c36dd8..3077e852dbaf 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -384,8 +384,7 @@ BOOL lcl_HasRowOutline( const ScViewData& rViewData )
bInActivatePart( FALSE ), \
bInZoomUpdate( FALSE ), \
bMoveIsShift( FALSE ), \
- bNewStartIfMarking( FALSE ), \
- bOldSelection( FALSE )
+ bNewStartIfMarking( FALSE )
ScTabView::ScTabView( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ) :
@@ -398,22 +397,22 @@ ScTabView::ScTabView( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pView
Init();
}
-ScTabView::ScTabView( Window* pParent, const ScTabView& rScTabView, ScTabViewShell* pViewShell ) :
- pFrameWin( pParent ),
- aViewData( rScTabView.aViewData ),
- TABVIEW_INIT
-{
- RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScTabView::ScTabView" );
-
- aViewData.SetViewShell( pViewShell );
- Init();
-
- UpdateShow();
- if ( aViewData.GetActivePart() != SC_SPLIT_BOTTOMLEFT )
- pGridWin[SC_SPLIT_BOTTOMLEFT]->Show();
-
- InvalidateSplit();
-}
+//UNUSED2009-05 ScTabView::ScTabView( Window* pParent, const ScTabView& rScTabView, ScTabViewShell* pViewShell ) :
+//UNUSED2009-05 pFrameWin( pParent ),
+//UNUSED2009-05 aViewData( rScTabView.aViewData ),
+//UNUSED2009-05 TABVIEW_INIT
+//UNUSED2009-05 {
+//UNUSED2009-05 RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScTabView::ScTabView" );
+//UNUSED2009-05
+//UNUSED2009-05 aViewData.SetViewShell( pViewShell );
+//UNUSED2009-05 Init();
+//UNUSED2009-05
+//UNUSED2009-05 UpdateShow();
+//UNUSED2009-05 if ( aViewData.GetActivePart() != SC_SPLIT_BOTTOMLEFT )
+//UNUSED2009-05 pGridWin[SC_SPLIT_BOTTOMLEFT]->Show();
+//UNUSED2009-05
+//UNUSED2009-05 InvalidateSplit();
+//UNUSED2009-05 }
void ScTabView::InitScrollBar( ScrollBar& rScrollBar, long nMaxVal )
{
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 608658024d2b..a19760e4c277 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -422,7 +422,7 @@ void ScTabView::SelectionChanged()
rBindings.Invalidate( SID_CUT );
rBindings.Invalidate( SID_COPY );
rBindings.Invalidate( SID_PASTE );
- rBindings.Invalidate( FID_PASTE_CONTENTS );
+ rBindings.Invalidate( SID_PASTE_SPECIAL );
rBindings.Invalidate( FID_INS_ROW );
rBindings.Invalidate( FID_INS_COLUMN );
@@ -466,19 +466,9 @@ void ScTabView::CursorPosChanged()
// Broadcast, damit andere Views des Dokuments auch umschalten
ScDocument* pDoc = aViewData.GetDocument();
-#if OLD_PIVOT_IMPLEMENTATION
- BOOL bPivot = ( NULL != pDoc->GetPivotAtCursor( aViewData.GetCurX(),
- aViewData.GetCurY(),
- aViewData.GetTabNo() ) ||
- NULL != pDoc->GetDPAtCursor( aViewData.GetCurX(),
- aViewData.GetCurY(),
- aViewData.GetTabNo() ) );
- aViewData.GetViewShell()->SetPivotShell(bPivot);
-#else
bool bDP = NULL != pDoc->GetDPAtCursor(
aViewData.GetCurX(), aViewData.GetCurY(), aViewData.GetTabNo() );
aViewData.GetViewShell()->SetPivotShell(bDP);
-#endif
// UpdateInputHandler jetzt in CellContentChanged
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index c27524c83542..75e961d5eeec 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -148,16 +148,6 @@ void __EXPORT ScTabView::Init()
// Das gilt auch fuer ViewOptionsHasChanged()
TestHintWindow();
-
- UpdateSelectionType();
-}
-
-void ScTabView::UpdateSelectionType()
-{
- // old selection in high contrast mode, or if transparent drawing isn't supported
-
- bOldSelection = pFrameWin->GetSettings().GetStyleSettings().GetHighContrastMode() ||
- !pFrameWin->supportsOperation( OutDevSupport_TransparentRect );
}
__EXPORT ScTabView::~ScTabView()
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index d8449ebc3699..e34741ba4c6b 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1510,7 +1510,7 @@ BOOL ScTabViewShell::TabKeyInput(const KeyEvent& rKEvt)
// #51889# Spezialfall: Copy/Cut bei Mehrfachselektion -> Fehlermeldung
// (Slot ist disabled, SfxViewShell::KeyInput wuerde also kommentarlos verschluckt)
KeyFuncType eFunc = aCode.GetFunction();
- if ( eFunc == KEYFUNC_COPY || eFunc == KEYFUNC_CUT )
+ if ( eFunc == KEYFUNC_CUT )
{
ScRange aDummy;
ScMarkType eMarkType = GetViewData()->GetSimpleArea( aDummy );
@@ -1806,7 +1806,7 @@ void ScTabViewShell::Construct( BYTE nForceDesignMode )
{
SCTAB nInitTabCount = 3; //! konfigurierbar !!!
for (SCTAB i=1; i<nInitTabCount; i++)
- pDoc->MakeTable(i);
+ pDoc->MakeTable(i,false);
}
pDocSh->SetEmpty( FALSE ); // #i6232# make sure this is done only once
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 766785d5ffc8..9e844f970909 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -72,11 +72,23 @@
#include "compiler.hxx"
-BOOL ScTabViewShell::GetFunction( String& rFuncStr )
+BOOL ScTabViewShell::GetFunction( String& rFuncStr, sal_uInt16 nErrCode )
{
String aStr;
ScSubTotalFunc eFunc = (ScSubTotalFunc) SC_MOD()->GetAppOptions().GetStatusFunc();
+ ScViewData* pViewData = GetViewData();
+ ScMarkData& rMark = pViewData->GetMarkData();
+ bool bIgnoreError = (rMark.IsMarked() || rMark.IsMultiMarked());
+
+ if (bIgnoreError && (eFunc == SUBTOTAL_FUNC_CNT || eFunc == SUBTOTAL_FUNC_CNT2))
+ nErrCode = 0;
+
+ if (nErrCode)
+ {
+ rFuncStr = ScGlobal::GetLongErrorString(nErrCode);
+ return true;
+ }
USHORT nGlobStrId = 0;
switch (eFunc)
@@ -94,9 +106,7 @@ BOOL ScTabViewShell::GetFunction( String& rFuncStr )
}
if (nGlobStrId)
{
- ScViewData* pViewData = GetViewData();
ScDocument* pDoc = pViewData->GetDocument();
- ScMarkData& rMark = pViewData->GetMarkData();
SCCOL nPosX = pViewData->GetCurX();
SCROW nPosY = pViewData->GetCurY();
SCTAB nTab = pViewData->GetTabNo();
@@ -104,30 +114,38 @@ BOOL ScTabViewShell::GetFunction( String& rFuncStr )
aStr = ScGlobal::GetRscString(nGlobStrId);
aStr += '=';
- // Anzahl im Standardformat, die anderen nach Cursorposition
- sal_uInt32 nNumFmt = 0;
- SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
- if ( eFunc != SUBTOTAL_FUNC_CNT && eFunc != SUBTOTAL_FUNC_CNT2 )
- {
- // Zahlformat aus Attributen oder Formel
- pDoc->GetNumberFormat( nPosX, nPosY, nTab, nNumFmt );
- if ( (nNumFmt % SV_COUNTRY_LANGUAGE_OFFSET) == 0 )
- {
- ScBaseCell* pCell;
- pDoc->GetCell( nPosX, nPosY, nTab, pCell );
- if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA)
- nNumFmt = ((ScFormulaCell*)pCell)->GetStandardFormat(
- *pFormatter, nNumFmt );
- }
- }
ScAddress aCursor( nPosX, nPosY, nTab );
double nVal;
if ( pDoc->GetSelectionFunction( eFunc, aCursor, rMark, nVal ) )
{
- String aValStr;
- Color* pDummy;
- pFormatter->GetOutputString( nVal, nNumFmt, aValStr, &pDummy );
- aStr += aValStr;
+ if ( nVal == 0.0 )
+ aStr += '0';
+ else
+ {
+ // Anzahl im Standardformat, die anderen nach Cursorposition
+ SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
+ sal_uInt32 nNumFmt = 0;
+ if ( eFunc != SUBTOTAL_FUNC_CNT && eFunc != SUBTOTAL_FUNC_CNT2 )
+ {
+ // Zahlformat aus Attributen oder Formel
+ pDoc->GetNumberFormat( nPosX, nPosY, nTab, nNumFmt );
+ if ( (nNumFmt % SV_COUNTRY_LANGUAGE_OFFSET) == 0 )
+ {
+ ScBaseCell* pCell;
+ pDoc->GetCell( nPosX, nPosY, nTab, pCell );
+ if (pCell && pCell->GetCellType() == CELLTYPE_FORMULA)
+ {
+
+ nNumFmt = ((ScFormulaCell*)pCell)->GetStandardFormat(*pFormatter, nNumFmt );
+ }
+ }
+ }
+
+ String aValStr;
+ Color* pDummy;
+ pFormatter->GetOutputString( nVal, nNumFmt, aValStr, &pDummy );
+ aStr += aValStr;
+ }
}
rFuncStr = aStr;
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index f2bc65a66ba8..37dc2c11da7f 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -465,7 +465,10 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet)
case SID_INSERT_SOUND:
case SID_INSERT_VIDEO:
- if ( bOle || bTabProt || !SvxPluginFileDlg::IsAvailable(nWhich) || bShared )
+ /* #i102735# discussed with NN: removed for performance reasons
+ || !SvxPluginFileDlg::IsAvailable(nWhich)
+ */
+ if ( bOle || bTabProt || bShared )
rSet.DisableItem( nWhich );
break;
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 9dda9a097395..3065aa2fd4e1 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -212,6 +212,7 @@
#include "transobj.hxx"
#include "drwtrans.hxx"
#include "docuno.hxx"
+#include "clipparam.hxx"
using namespace com::sun::star;
@@ -312,10 +313,10 @@ BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi, BOOL bI
ScRange aRange;
ScMarkType eMarkType = GetViewData()->GetSimpleArea( aRange );
+ ScDocument* pDoc = GetViewData()->GetDocument();
+ ScMarkData& rMark = GetViewData()->GetMarkData();
if ( eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED )
{
- ScDocument* pDoc = GetViewData()->GetDocument();
- ScMarkData& rMark = GetViewData()->GetMarkData();
if ( !pDoc->HasSelectedBlockMatrixFragment(
aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(),
@@ -342,9 +343,8 @@ BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi, BOOL bI
ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) );
}
- pDoc->CopyToClip( aRange.aStart.Col(), aRange.aStart.Row(),
- aRange.aEnd.Col(), aRange.aEnd.Row(),
- bCut, pClipDoc, FALSE, &rMark, FALSE, bIncludeObjects );
+ ScClipParam aClipParam(aRange, bCut);
+ pDoc->CopyToClip(aClipParam, pClipDoc, &rMark, false, false, bIncludeObjects);
if (bSysClip)
{
ScDrawLayer::SetGlobalDrawPersist(NULL);
@@ -382,6 +382,124 @@ BOOL ScViewFunc::CopyToClip( ScDocument* pClipDoc, BOOL bCut, BOOL bApi, BOOL bI
ErrorMessage(STR_MATRIXFRAGMENTERR);
}
}
+ else if (eMarkType == SC_MARK_MULTI)
+ {
+ bool bSuccess = false;
+ ScClipParam aClipParam;
+ aClipParam.mbCutMode = false;
+ rMark.MarkToSimple();
+ rMark.FillRangeListWithMarks(&aClipParam.maRanges, false);
+
+ do
+ {
+ if (bCut)
+ // We con't support cutting of multi-selections.
+ break;
+
+ if (pClipDoc)
+ // TODO: What's this for?
+ break;
+
+ ::std::auto_ptr<ScDocument> pDocClip(new ScDocument(SCDOCMODE_CLIP));
+
+ // Check for geometrical feasibility of the ranges.
+ bool bValidRanges = true;
+ ScRangePtr p = aClipParam.maRanges.First();
+ SCCOL nPrevColDelta = 0;
+ SCROW nPrevRowDelta = 0;
+ SCCOL nPrevCol = p->aStart.Col();
+ SCROW nPrevRow = p->aStart.Row();
+ SCCOL nPrevColSize = p->aEnd.Col() - p->aStart.Col() + 1;
+ SCROW nPrevRowSize = p->aEnd.Row() - p->aStart.Row() + 1;
+ for (p = aClipParam.maRanges.Next(); p; p = aClipParam.maRanges.Next())
+ {
+ if (pDoc->HasSelectedBlockMatrixFragment(
+ p->aStart.Col(), p->aStart.Row(), p->aEnd.Col(), p->aEnd.Row(), rMark))
+ {
+ if (!bApi)
+ ErrorMessage(STR_MATRIXFRAGMENTERR);
+ return false;
+ }
+
+ SCCOL nColDelta = p->aStart.Col() - nPrevCol;
+ SCROW nRowDelta = p->aStart.Row() - nPrevRow;
+
+ if ((nColDelta && nRowDelta) || (nPrevColDelta && nRowDelta) || (nPrevRowDelta && nColDelta))
+ {
+ bValidRanges = false;
+ break;
+ }
+
+ if (aClipParam.meDirection == ScClipParam::Unspecified)
+ {
+ if (nColDelta)
+ aClipParam.meDirection = ScClipParam::Column;
+ if (nRowDelta)
+ aClipParam.meDirection = ScClipParam::Row;
+ }
+
+ SCCOL nColSize = p->aEnd.Col() - p->aStart.Col() + 1;
+ SCROW nRowSize = p->aEnd.Row() - p->aStart.Row() + 1;
+
+ if (aClipParam.meDirection == ScClipParam::Column && nRowSize != nPrevRowSize)
+ {
+ // column-oriented ranges must have identical row size.
+ bValidRanges = false;
+ break;
+ }
+ if (aClipParam.meDirection == ScClipParam::Row && nColSize != nPrevColSize)
+ {
+ // likewise, row-oriented ranges must have identical
+ // column size.
+ bValidRanges = false;
+ break;
+ }
+
+ nPrevCol = p->aStart.Col();
+ nPrevRow = p->aStart.Row();
+ nPrevColDelta = nColDelta;
+ nPrevRowDelta = nRowDelta;
+ nPrevColSize = nColSize;
+ nPrevRowSize = nRowSize;
+ }
+ if (!bValidRanges)
+ break;
+
+ pDoc->CopyToClip(aClipParam, pDocClip.get(), &rMark, false, false, bIncludeObjects);
+
+ ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ if ( pChangeTrack )
+ pChangeTrack->ResetLastCut(); // kein CutMode mehr
+
+ {
+ ScDocShell* pDocSh = GetViewData()->GetDocShell();
+ TransferableObjectDescriptor aObjDesc;
+ pDocSh->FillTransferableObjectDescriptor( aObjDesc );
+ aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
+ // maSize is set in ScTransferObj ctor
+
+ ScTransferObj* pTransferObj = new ScTransferObj( pDocClip.release(), aObjDesc );
+ uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
+
+ if ( ScGlobal::pDrawClipDocShellRef )
+ {
+ SfxObjectShellRef aPersistRef( &(*ScGlobal::pDrawClipDocShellRef) );
+ pTransferObj->SetDrawPersist( aPersistRef ); // keep persist for ole objects alive
+ }
+
+ pTransferObj->CopyToClipboard( GetActiveWin() ); // system clipboard
+ SC_MOD()->SetClipObject( pTransferObj, NULL ); // internal clipboard
+ }
+
+ bSuccess = true;
+ }
+ while (false);
+
+ if (!bSuccess && !bApi)
+ ErrorMessage(STR_NOMULTISELECT);
+
+ bDone = bSuccess;
+ }
else
{
if (!bApi)
@@ -408,9 +526,8 @@ ScTransferObj* ScViewFunc::CopyToTransferable()
BOOL bAnyOle = pDoc->HasOLEObjectsInArea( aRange, &rMark );
ScDrawLayer::SetGlobalDrawPersist( ScTransferObj::SetDrawClipDoc( bAnyOle ) );
- pDoc->CopyToClip( aRange.aStart.Col(), aRange.aStart.Row(),
- aRange.aEnd.Col(), aRange.aEnd.Row(),
- FALSE, pClipDoc, FALSE, &rMark, FALSE, TRUE );
+ ScClipParam aClipParam(aRange, false);
+ pDoc->CopyToClip(aClipParam, pClipDoc, &rMark, false, false, true);
ScDrawLayer::SetGlobalDrawPersist(NULL);
pClipDoc->ExtendMerge( aRange, TRUE );
@@ -739,6 +856,52 @@ BOOL lcl_SelHasAttrib( ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
// internes Paste
+namespace {
+
+class CursorSwitcher
+{
+public:
+ CursorSwitcher(ScViewFunc* pViewFunc) :
+ mpViewFunc(pViewFunc)
+ {
+ mpViewFunc->HideCursor();
+ }
+
+ ~CursorSwitcher()
+ {
+ mpViewFunc->ShowCursor();
+ }
+private:
+ ScViewFunc* mpViewFunc;
+};
+
+bool lcl_checkDestRangeForOverwrite(const ScRange& rDestRange, const ScDocument* pDoc, const ScMarkData& rMark, Window* pParentWnd)
+{
+ bool bIsEmpty = true;
+ SCTAB nTabCount = pDoc->GetTableCount();
+ for (SCTAB nTab=0; nTab < nTabCount && bIsEmpty; ++nTab)
+ {
+ if (!rMark.GetTableSelect(nTab))
+ continue;
+
+ bIsEmpty = pDoc->IsBlockEmpty(nTab, rDestRange.aStart.Col(), rDestRange.aStart.Row(),
+ rDestRange.aEnd.Col(), rDestRange.aEnd.Row());
+ }
+
+ if (!bIsEmpty)
+ {
+ ScReplaceWarnBox aBox(pParentWnd);
+ if (aBox.Execute() != RET_YES)
+ {
+ // changing the configuration is within the ScReplaceWarnBox
+ return false;
+ }
+ }
+ return true;
+}
+
+}
+
BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
USHORT nFunction, BOOL bSkipEmpty,
BOOL bTranspose, BOOL bAsLink,
@@ -764,6 +927,12 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
// do not copy note captions into undo document
nUndoFlags |= IDF_NOCAPTIONS;
+ ScClipParam& rClipParam = pClipDoc->GetClipParam();
+ if (rClipParam.isMultiRange())
+ return PasteMultiRangesFromClip(
+ nFlags, pClipDoc, nFunction, bSkipEmpty, bTranspose, bAsLink, bAllowDialogs,
+ eMoveMode, nContFlags, nUndoFlags);
+
BOOL bCutMode = pClipDoc->IsCutMode(); // if transposing, take from original clipdoc
BOOL bIncludeFiltered = bCutMode;
@@ -992,23 +1161,8 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
SC_MOD()->GetInputOptions().GetReplaceCellsWarn();
if ( bAskIfNotEmpty )
{
- BOOL bIsEmpty = TRUE;
- SCTAB nTabCount = pDoc->GetTableCount();
- for (SCTAB nTab=0; nTab<nTabCount && bIsEmpty; nTab++)
- if ( aFilteredMark.GetTableSelect(nTab) &&
- !pDoc->IsBlockEmpty( nTab, aUserRange.aStart.Col(), aUserRange.aStart.Row(),
- aUserRange.aEnd.Col(), aUserRange.aEnd.Row() ) )
- bIsEmpty = FALSE;
-
- if ( !bIsEmpty )
- {
- ScReplaceWarnBox aBox( GetViewData()->GetDialogParent() );
- if ( aBox.Execute() != RET_YES )
- {
- // changing the configuration is within the ScReplaceWarnBox
- return FALSE;
- }
- }
+ if (!lcl_checkDestRangeForOverwrite(aUserRange, pDoc, aFilteredMark, GetViewData()->GetDialogParent()))
+ return false;
}
}
@@ -1302,7 +1456,179 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
// AdjustBlockHeight has already been called above
aModificator.SetDocumentModified();
- pDocSh->UpdateOle(GetViewData());
+ PostPasteFromClip(aUserRange, rMark);
+ return TRUE;
+}
+
+bool ScViewFunc::PasteMultiRangesFromClip(
+ sal_uInt16 nFlags, ScDocument* pClipDoc, sal_uInt16 nFunction,
+ bool bSkipEmpty, bool bTranspose, bool bAsLink, bool bAllowDialogs,
+ InsCellCmd eMoveMode, sal_uInt16 /*nContFlags*/, sal_uInt16 nUndoFlags)
+{
+ ScViewData& rViewData = *GetViewData();
+ ScDocument* pDoc = rViewData.GetDocument();
+ ScDocShell* pDocSh = rViewData.GetDocShell();
+ ScMarkData aMark(rViewData.GetMarkData());
+ const ScAddress& rCurPos = rViewData.GetCurPos();
+ ScClipParam& rClipParam = pClipDoc->GetClipParam();
+ SCCOL nColSize = rClipParam.getPasteColSize();
+ SCROW nRowSize = rClipParam.getPasteRowSize();
+
+ if (bTranspose)
+ {
+ if (static_cast<SCROW>(rCurPos.Col()) + nRowSize-1 > static_cast<SCROW>(MAXCOL))
+ {
+ ErrorMessage(STR_PASTE_FULL);
+ return false;
+ }
+
+ ::std::auto_ptr<ScDocument> pTransClip(new ScDocument(SCDOCMODE_CLIP));
+ pClipDoc->TransposeClip(pTransClip.get(), nFlags, bAsLink);
+ pClipDoc = pTransClip.release();
+ SCCOL nTempColSize = nColSize;
+ nColSize = static_cast<SCCOL>(nRowSize);
+ nRowSize = static_cast<SCROW>(nTempColSize);
+ }
+
+ if (!ValidCol(rCurPos.Col()+nColSize-1) || !ValidRow(rCurPos.Row()+nRowSize-1))
+ {
+ ErrorMessage(STR_PASTE_FULL);
+ return false;
+ }
+
+ // Determine the first and last selected sheet numbers.
+ SCTAB nTab1 = aMark.GetFirstSelected();
+ SCTAB nTab2 = nTab1;
+ for (SCTAB i = nTab1+1; i <= MAXTAB; ++i)
+ if (aMark.GetTableSelect(i))
+ nTab2 = i;
+
+ ScDocShellModificator aModificator(*pDocSh);
+
+ // For multi-selection paste, we don't support cell duplication for larger
+ // destination range. In case the destination is marked, we reset it to
+ // the clip size.
+ ScRange aMarkedRange(rCurPos.Col(), rCurPos.Row(), nTab1,
+ rCurPos.Col()+nColSize-1, rCurPos.Row()+nRowSize-1, nTab2);
+
+ // Extend the marked range to account for filtered rows in the destination
+ // area.
+ if (ScViewUtil::HasFiltered(aMarkedRange, pDoc))
+ {
+ if (!ScViewUtil::FitToUnfilteredRows(aMarkedRange, pDoc, nRowSize))
+ return false;
+ }
+
+ bool bAskIfNotEmpty =
+ bAllowDialogs && (nFlags & IDF_CONTENTS) &&
+ nFunction == PASTE_NOFUNC && SC_MOD()->GetInputOptions().GetReplaceCellsWarn();
+
+ if (bAskIfNotEmpty)
+ {
+ if (!lcl_checkDestRangeForOverwrite(aMarkedRange, pDoc, aMark, rViewData.GetDialogParent()))
+ return false;
+ }
+
+ aMark.SetMarkArea(aMarkedRange);
+ MarkRange(aMarkedRange);
+
+ bool bInsertCells = (eMoveMode != INS_NONE);
+ if (bInsertCells)
+ {
+ if (!InsertCells(eMoveMode, pDoc->IsUndoEnabled(), true))
+ return false;
+ }
+
+ ::std::auto_ptr<ScDocument> pUndoDoc;
+ if (pDoc->IsUndoEnabled())
+ {
+ pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
+ pUndoDoc->InitUndoSelected(pDoc, aMark, false, false);
+ pDoc->CopyToDocument(aMarkedRange, nUndoFlags, false, pUndoDoc.get(), &aMark, true);
+ }
+
+ ::std::auto_ptr<ScDocument> pMixDoc;
+ if ( bSkipEmpty || nFunction )
+ {
+ if ( nFlags & IDF_CONTENTS )
+ {
+ pMixDoc.reset(new ScDocument(SCDOCMODE_UNDO));
+ pMixDoc->InitUndoSelected(pDoc, aMark, false, false);
+ pDoc->CopyToDocument(aMarkedRange, IDF_CONTENTS, false, pMixDoc.get(), &aMark, true);
+ }
+ }
+
+ /* Make draw layer and start drawing undo.
+ - Needed before AdjustBlockHeight to track moved drawing objects.
+ - Needed before pDoc->CopyFromClip to track inserted note caption objects.
+ */
+ if (nFlags & IDF_OBJECTS)
+ pDocSh->MakeDrawLayer();
+ if (pDoc->IsUndoEnabled())
+ pDoc->BeginDrawUndo();
+
+ CursorSwitcher aCursorSwitch(this);
+ sal_uInt16 nNoObjFlags = nFlags & ~IDF_OBJECTS;
+ pDoc->CopyMultiRangeFromClip(rCurPos, aMark, nNoObjFlags, pClipDoc,
+ true, bAsLink, false, bSkipEmpty);
+
+ if (pMixDoc.get())
+ pDoc->MixDocument(aMarkedRange, nFunction, bSkipEmpty, pMixDoc.get());
+
+ AdjustBlockHeight(); // update row heights before pasting objects
+
+ if (nFlags & IDF_OBJECTS)
+ {
+ // Paste the drawing objects after the row heights have been updated.
+ pDoc->CopyMultiRangeFromClip(rCurPos, aMark, IDF_OBJECTS, pClipDoc,
+ true, false, false, true);
+ }
+
+ pDocSh->PostPaint(
+ aMarkedRange.aStart.Col(), aMarkedRange.aStart.Row(), nTab1,
+ aMarkedRange.aEnd.Col(), aMarkedRange.aEnd.Row(), nTab1, PAINT_GRID);
+
+ if (pDoc->IsUndoEnabled())
+ {
+ SfxUndoManager* pUndoMgr = pDocSh->GetUndoManager();
+ String aUndo = ScGlobal::GetRscString(
+ pClipDoc->IsCutMode() ? STR_UNDO_CUT : STR_UNDO_COPY);
+ pUndoMgr->EnterListAction(aUndo, aUndo);
+
+ ScUndoPasteOptions aOptions; // store options for repeat
+ aOptions.nFunction = nFunction;
+ aOptions.bSkipEmpty = bSkipEmpty;
+ aOptions.bTranspose = bTranspose;
+ aOptions.bAsLink = bAsLink;
+ aOptions.eMoveMode = eMoveMode;
+
+ ScUndoPaste* pUndo = new ScUndoPaste(pDocSh,
+ aMarkedRange.aStart.Col(),
+ aMarkedRange.aStart.Row(),
+ aMarkedRange.aStart.Tab(),
+ aMarkedRange.aEnd.Col(),
+ aMarkedRange.aEnd.Row(),
+ aMarkedRange.aEnd.Tab(),
+ aMark, pUndoDoc.release(), NULL, nFlags|nUndoFlags, NULL, NULL, NULL, NULL, false, &aOptions);
+
+ if (bInsertCells)
+ pUndoMgr->AddUndoAction(new ScUndoWrapper(pUndo), true);
+ else
+ pUndoMgr->AddUndoAction(pUndo, false);
+
+ pUndoMgr->LeaveListAction();
+ }
+ aModificator.SetDocumentModified();
+ PostPasteFromClip(aMarkedRange, aMark);
+ return true;
+}
+
+void ScViewFunc::PostPasteFromClip(const ScRange& rPasteRange, const ScMarkData& rMark)
+{
+ ScViewData* pViewData = GetViewData();
+ ScDocShell* pDocSh = pViewData->GetDocShell();
+ ScDocument* pDoc = pViewData->GetDocument();
+ pDocSh->UpdateOle(pViewData);
SelectionChanged();
@@ -1316,7 +1642,7 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
{
if ( rMark.GetTableSelect( i ) )
{
- ScRange aChangeRange( aUserRange );
+ ScRange aChangeRange(rPasteRange);
aChangeRange.aStart.SetTab( i );
aChangeRange.aEnd.SetTab( i );
aChangeRanges.Append( aChangeRange );
@@ -1324,8 +1650,6 @@ BOOL ScViewFunc::PasteFromClip( USHORT nFlags, ScDocument* pClipDoc,
}
pModelObj->NotifyChanges( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cell-change" ) ), aChangeRanges );
}
-
- return TRUE;
}
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 0f3a1c812802..578f6c1fe733 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -155,7 +155,7 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
{
ScDocument* pRedoDoc = new ScDocument( SCDOCMODE_UNDO );
pRedoDoc->InitUndo( pDoc, nTab, nTab );
- pDoc->CopyToDocument( nStartCol,nStartRow,nTab, nStartCol,nEndRow,nTab, IDF_ALL, FALSE, pRedoDoc );
+ pDoc->CopyToDocument( nStartCol,nStartRow,nTab, nStartCol,nEndRow,nTab, IDF_ALL|IDF_NOCAPTIONS, FALSE, pRedoDoc );
ScMarkData aDestMark;
aDestMark.SelectOneTable( nTab );
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index f8b89a85e11c..35af3ee2a2e3 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -79,6 +79,7 @@
#include "asciiopt.hxx"
#include "scabstdlg.hxx"
+#include "clipparam.hxx"
#include <vcl/msgbox.hxx>
#include <sfx2/viewfrm.hxx>
#include <svx/dbaexchange.hxx>
@@ -163,12 +164,12 @@ BOOL ScViewFunc::PasteDataFormat( ULONG nFormatId,
if ( pSrcDoc->GetDataStart( nSrcTab, nFirstCol, nFirstRow ) )
pSrcDoc->GetCellArea( nSrcTab, nLastCol, nLastRow );
else
- {
+ {
nFirstCol = nLastCol = 0;
nFirstRow = nLastRow = 0;
- }
- pSrcDoc->CopyToClip( nFirstCol, nFirstRow, nLastCol, nLastRow,
- FALSE, pClipDoc, FALSE, &aSrcMark );
+ }
+ ScClipParam aClipParam(ScRange(nFirstCol, nFirstRow, 0, nLastCol, nLastRow, 0), false);
+ pSrcDoc->CopyToClip(aClipParam, pClipDoc, &aSrcMark);
ScGlobal::SetClipDocName( xDocShRef->GetTitle( SFX_TITLE_FULLNAME ) );
SetCursor( nPosX, nPosY );
diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx
index 83dd05c9d33c..d0a6f2acf015 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -481,12 +481,13 @@ BOOL ScUpdateRect::GetDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 )
return TRUE;
}
+#ifdef OLD_SELECTION_PAINT
BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, BOOL& rCont )
{
rCont = FALSE;
- if ( nNewStartX == nOldStartX && nNewEndX == nOldEndX &&
- nNewStartY == nOldStartY && nNewEndY == nOldEndY )
+ if (nNewStartX == nOldStartX && nNewEndX == nOldEndX &&
+ nNewStartY == nOldStartY && nNewEndY == nOldEndY)
{
rX1 = nNewStartX;
rY1 = nNewStartY;
@@ -500,14 +501,14 @@ BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, B
rX2 = Max(nNewEndX,nOldEndX);
rY2 = Max(nNewEndY,nOldEndY);
- if ( nNewStartX == nOldStartX && nNewEndX == nOldEndX ) // nur vertikal
+ if (nNewStartX == nOldStartX && nNewEndX == nOldEndX) // nur vertikal
{
- if ( nNewStartY == nOldStartY )
+ if (nNewStartY == nOldStartY)
{
rY1 = Min( nNewEndY, nOldEndY ) + 1;
rY2 = Max( nNewEndY, nOldEndY );
}
- else if ( nNewEndY == nOldEndY )
+ else if (nNewEndY == nOldEndY)
{
rY1 = Min( nNewStartY, nOldStartY );
rY2 = Max( nNewStartY, nOldStartY ) - 1;
@@ -523,14 +524,14 @@ BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, B
nContX2 = rX2;
}
}
- else if ( nNewStartY == nOldStartY && nNewEndY == nOldEndY ) // nur horizontal
+ else if (nNewStartY == nOldStartY && nNewEndY == nOldEndY) // nur horizontal
{
- if ( nNewStartX == nOldStartX )
+ if (nNewStartX == nOldStartX)
{
rX1 = Min( nNewEndX, nOldEndX ) + 1;
rX2 = Max( nNewEndX, nOldEndX );
}
- else if ( nNewEndX == nOldEndX )
+ else if (nNewEndX == nOldEndX)
{
rX1 = Min( nNewStartX, nOldStartX );
rX2 = Max( nNewStartX, nOldStartX ) - 1;
@@ -546,9 +547,9 @@ BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, B
nContY2 = rY2;
}
}
- else if ( nNewEndX == nOldEndX && nNewEndY == nOldEndY ) // links oben
+ else if (nNewEndX == nOldEndX && nNewEndY == nOldEndY) // links oben
{
- if ( (nNewStartX<nOldStartX) == (nNewStartY<nOldStartY) )
+ if ((nNewStartX<nOldStartX) == (nNewStartY<nOldStartY))
rX1 = Min( nNewStartX, nOldStartX );
else
rX1 = Max( nNewStartX, nOldStartX ); // Ecke weglassen
@@ -561,9 +562,9 @@ BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, B
nContX1 = Min( nNewStartX, nOldStartX ); // links
nContX2 = Max( nNewStartX, nOldStartX ) - 1;
}
- else if ( nNewStartX == nOldStartX && nNewEndY == nOldEndY ) // rechts oben
+ else if (nNewStartX == nOldStartX && nNewEndY == nOldEndY) // rechts oben
{
- if ( (nNewEndX<nOldEndX) != (nNewStartY<nOldStartY) )
+ if ((nNewEndX<nOldEndX) != (nNewStartY<nOldStartY))
rX2 = Max( nNewEndX, nOldEndX );
else
rX2 = Min( nNewEndX, nOldEndX ); // Ecke weglassen
@@ -576,9 +577,9 @@ BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, B
nContX1 = Min( nNewEndX, nOldEndX ) + 1; // rechts
nContX2 = Max( nNewEndX, nOldEndX );
}
- else if ( nNewEndX == nOldEndX && nNewStartY == nOldStartY ) // links unten
+ else if (nNewEndX == nOldEndX && nNewStartY == nOldStartY) // links unten
{
- if ( (nNewStartX<nOldStartX) != (nNewEndY<nOldEndY) )
+ if ((nNewStartX<nOldStartX) != (nNewEndY<nOldEndY))
rX1 = Min( nNewStartX, nOldStartX );
else
rX1 = Max( nNewStartX, nOldStartX ); // Ecke weglassen
@@ -591,9 +592,9 @@ BOOL ScUpdateRect::GetXorDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, B
nContX1 = Min( nNewStartX, nOldStartX ); // links
nContX2 = Max( nNewStartX, nOldStartX ) - 1;
}
- else if ( nNewStartX == nOldStartX && nNewStartY == nOldStartY ) // rechts unten
+ else if (nNewStartX == nOldStartX && nNewStartY == nOldStartY) // rechts unten
{
- if ( (nNewEndX<nOldEndX) == (nNewEndY<nOldEndY) )
+ if ((nNewEndX<nOldEndX) == (nNewEndY<nOldEndY))
rX2 = Max( nNewEndX, nOldEndX );
else
rX2 = Min( nNewEndX, nOldEndX ); // Ecke weglassen
@@ -629,6 +630,7 @@ void ScUpdateRect::GetContDiff( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 )
rX2 = nContX2;
rY2 = nContY2;
}
+#endif