diff options
author | Niklas Nebel <nn@openoffice.org> | 2010-04-29 13:35:08 +0200 |
---|---|---|
committer | Niklas Nebel <nn@openoffice.org> | 2010-04-29 13:35:08 +0200 |
commit | 284da3a62f12258617bcb998dde18e79213429db (patch) | |
tree | 2bebb46229489daa230e57befef0f7eb16c60112 | |
parent | 719ec07a933e524ba595262e42b2a6612f5a2203 (diff) | |
parent | 4f7a90a20425a4319a0a06ca5b6716cac5f9e0cd (diff) |
calc53: merge with DEV300_m77
85 files changed, 1059 insertions, 1028 deletions
diff --git a/chart2/prj/build.lst b/chart2/prj/build.lst index 3cdc9a26e3f5..370eacebe0c2 100644 --- a/chart2/prj/build.lst +++ b/chart2/prj/build.lst @@ -24,3 +24,4 @@ ch chart2\source\controller\chartapiwrapper nmake - all ch_source_controlle ch chart2\source\controller\main nmake - all ch_source_controller_main ch_inc NULL ch chart2\source\controller\menus nmake - all ch_source_controller_menus ch_inc NULL ch chart2\prj get - all ch_prj NULL +ch chart2\qa\unoapi nmake - all ch_qa_unoapi NULL diff --git a/chart2/qa/unoapi/Test.java b/chart2/qa/unoapi/Test.java new file mode 100644 index 000000000000..c1b6fd05983d --- /dev/null +++ b/chart2/qa/unoapi/Test.java @@ -0,0 +1,51 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* 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. +************************************************************************/ + +package org.openoffice.chart2.qa.unoapi; + +import org.openoffice.Runner; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; + +public final class Test { + @org.junit.Before public void setUp() throws Exception { + connection.setUp(); + } + + @org.junit.After public void tearDown() + throws InterruptedException, com.sun.star.uno.Exception + { + connection.tearDown(); + } + + @org.junit.Test public void test() { + assertTrue( + Runner.run( + "-sce", "sch.sce", "-xcl", "knownissues.xcl", "-tdoc", + "testdocuments", "-cs", connection.getDescription())); + } + + private final OfficeConnection connection = new OfficeConnection(); +} diff --git a/chart2/qa/unoapi/makefile.mk b/chart2/qa/unoapi/makefile.mk index 517327aab0bf..de494ead5449 100644 --- a/chart2/qa/unoapi/makefile.mk +++ b/chart2/qa/unoapi/makefile.mk @@ -1,7 +1,6 @@ #************************************************************************* -# # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite @@ -22,21 +21,28 @@ # version 3 along with OpenOffice.org. If not, see # <http://www.openoffice.org/license.html> # for a copy of the LGPLv3 License. -# -#************************************************************************* +#***********************************************************************/ -EXTERNAL_WARNINGS_NOT_ERRORS := TRUE +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -PRJ=..$/.. +PRJ = ../.. +PRJNAME = chart2 +TARGET = qa_unoapi -PRJNAME=sch -TARGET=qa_unoapi +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = org/openoffice/chart2/qa/unoapi +JAVATESTFILES = Test.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END .INCLUDE: settings.mk - .INCLUDE: target.mk +.INCLUDE: installationtest.mk -ALLTAR : UNOAPI_TEST +ALLTAR : javatest -UNOAPI_TEST: - +$(SOLARENV)$/bin$/checkapi -sce sch.sce -xcl knownissues.xcl -tdoc $(PWD)$/testdocuments +.END diff --git a/chart2/source/controller/controller.map b/chart2/source/controller/controller.map deleted file mode 100644 index ac2c3750bfe0..000000000000 --- a/chart2/source/controller/controller.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_0_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/chart2/source/controller/makefile.mk b/chart2/source/controller/makefile.mk index 8fdd6000fbe1..b8a256181045 100644 --- a/chart2/source/controller/makefile.mk +++ b/chart2/source/controller/makefile.mk @@ -100,7 +100,7 @@ SHL1STDLIBS= $(CHARTTOOLS) \ #specifies the exported symbols for Windows only: SHL1DEF= $(MISC)$/$(SHL1TARGET).def -SHL1VERSIONMAP = controller.map +SHL1VERSIONMAP = $(SOLARENV)/src/component.map #--------definition file diff --git a/chart2/source/model/makefile.mk b/chart2/source/model/makefile.mk index 701f47fb94b5..dfb5522a7879 100644 --- a/chart2/source/model/makefile.mk +++ b/chart2/source/model/makefile.mk @@ -86,7 +86,7 @@ SHL1STDLIBS= $(CHARTTOOLS) \ #specifies the exported symbols for Windows only: SHL1DEF= $(MISC)$/$(SHL1TARGET).def -SHL1VERSIONMAP = model.map +SHL1VERSIONMAP = $(SOLARENV)/src/component.map #--------definition file diff --git a/chart2/source/model/model.map b/chart2/source/model/model.map deleted file mode 100644 index 07b1790d5754..000000000000 --- a/chart2/source/model/model.map +++ /dev/null @@ -1,8 +0,0 @@ -CHART_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/chart2/source/tools/tools.map b/chart2/source/tools/tools.map deleted file mode 100644 index 07b1790d5754..000000000000 --- a/chart2/source/tools/tools.map +++ /dev/null @@ -1,8 +0,0 @@ -CHART_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/chart2/source/view/view.map b/chart2/source/view/view.map deleted file mode 100644 index d86ffaa9bdd4..000000000000 --- a/chart2/source/view/view.map +++ /dev/null @@ -1,9 +0,0 @@ -CHART_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - - local: - *; -}; diff --git a/sc/addin/datefunc/makefile.mk b/sc/addin/datefunc/makefile.mk index 4e4966720261..f781b3835833 100644 --- a/sc/addin/datefunc/makefile.mk +++ b/sc/addin/datefunc/makefile.mk @@ -86,11 +86,7 @@ $(MISC)$/$(TARGET).lst : \ $(INCCOM)$/xlang.h \ ..$/inc$/$(TARGET).hrc \ ..$/inc$/addin.h -.IF "$(GUI)"=="UNX" || "$(USE_SHELL)"!="4nt" echo $< > $@ -.ELSE - echo $(<:+"\n":s/ //) > $@ -.ENDIF # --- Def-File --- diff --git a/sc/addin/makefile.mk b/sc/addin/makefile.mk index c9505e29d4d4..e716a8d8477a 100644 --- a/sc/addin/makefile.mk +++ b/sc/addin/makefile.mk @@ -41,10 +41,5 @@ TARGET=addin ALLTAR: $(MISC)$/cl2c.pl $(MISC)$/cl2c.pl: util/cl2c.pl -.IF "$(GUI)"=="UNX" || "$(USE_SHELL)"!="4nt" tr -d "\015" < util$/cl2c.pl > $@ chmod +rw $@ -.ELSE - @$(COPY) util$/cl2c.pl $@ -.ENDIF - diff --git a/sc/addin/rot13/exports.map b/sc/addin/rot13/exports.map index fa447824beda..c662c9148aba 100644 --- a/sc/addin/rot13/exports.map +++ b/sc/addin/rot13/exports.map @@ -1,4 +1,4 @@ -SC_1_0 { +UDK_3_0_0 { global: GetFunctionCount; GetFunctionData; diff --git a/sc/addin/rot13/makefile.mk b/sc/addin/rot13/makefile.mk index 128d8f10b6f8..a33c50d2a725 100644 --- a/sc/addin/rot13/makefile.mk +++ b/sc/addin/rot13/makefile.mk @@ -85,9 +85,4 @@ $(MISC)$/rot.lst : \ $(INCCOM)$/xlang.h \ ..$/inc$/rot13.hrc \ ..$/inc$/addin.h -.IF "$(GUI)"=="UNX" || "$(USE_SHELL)"!="4nt" @echo $< > $@ -.ELSE - @echo $(<:+"\n":s/ //) > $@ -.ENDIF - diff --git a/sc/addin/util/makefile.mk b/sc/addin/util/makefile.mk index e415cf7631d7..2bd75148f80a 100644 --- a/sc/addin/util/makefile.mk +++ b/sc/addin/util/makefile.mk @@ -37,13 +37,9 @@ TARGET=autil $(BIN)$/addin.zip : \ $(MISC)$/rot.lst \ $(MISC)$/dfa.lst -.IF "$(GUI)"=="UNX" || "$(USE_SHELL)"!="4nt" $(TYPE) $(MISC)$/rot.lst | tr -s " " "\n" | zip -@ -u -j -ll $(BIN)$/addin.zip $(CHECKZIPRESULT) $(TYPE) $(MISC)$/dfa.lst | tr -s " " "\n" | zip -@ -u -j -ll $(BIN)$/addin.zip $(CHECKZIPRESULT) chmod +rw $(BIN)$/addin.zip -.ELSE - $(TYPE) $< | zip -@ -u -j $(BIN)$/addin.zip $(CHECKZIPRESULT) -.ENDIF .INCLUDE: target.mk diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx index ffe248bb3f65..6cf3d59314ef 100644 --- a/sc/inc/chgtrack.hxx +++ b/sc/inc/chgtrack.hxx @@ -308,7 +308,6 @@ protected: GetDeletedInAddress(), p ); } BOOL RemoveDeletedIn( const ScChangeAction* ); - void RemoveAllDeletedIn(); void SetDeletedIn( ScChangeAction* ); ScChangeActionLinkEntry* AddDeleted( ScChangeAction* p ) @@ -414,6 +413,7 @@ public: { return IsDeleteType() || IsDeletedIn(); } BOOL IsDeletedIn( const ScChangeAction* ) const; BOOL IsDeletedInDelType( ScChangeActionType ) const; + void RemoveAllDeletedIn(); const ScChangeActionLinkEntry* GetFirstDeletedEntry() const { return pLinkDeleted; } diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 1d92962a56db..17ec77b0f9a7 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -896,10 +896,17 @@ public: USHORT GetErrCode( const ScAddress& ) const; - bool ShrinkToDataArea(SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow) const; + /** Shrink a range to only include data area. + This is not the actually used area within the + selection, but the bounds of the sheet's data area + instead. */ + bool ShrinkToDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const; + + /** Shrink a range to only include used data area. */ + bool ShrinkToUsedDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const; void GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, - SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld ); + SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld, bool bOnlyDown ); SC_DLLPUBLIC BOOL GetCellArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const; SC_DLLPUBLIC BOOL GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const; SC_DLLPUBLIC BOOL GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow, @@ -1095,7 +1102,8 @@ public: void UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, SCsCOL nDx, SCsROW nDy, SCsTAB nDz, - ScDocument* pUndoDoc = NULL, BOOL bIncludeDraw = TRUE ); + ScDocument* pUndoDoc = NULL, BOOL bIncludeDraw = TRUE, + bool bUpdateNoteCaptionPos = true ); SC_DLLPUBLIC void UpdateTranspose( const ScAddress& rDestPos, ScDocument* pClipDoc, const ScMarkData& rMark, ScDocument* pUndoDoc = NULL ); @@ -1651,7 +1659,7 @@ public: BOOL IsExpandRefs() { return bExpandRefs; } SC_DLLPUBLIC void IncSizeRecalcLevel( SCTAB nTab ); - SC_DLLPUBLIC void DecSizeRecalcLevel( SCTAB nTab ); + SC_DLLPUBLIC void DecSizeRecalcLevel( SCTAB nTab, bool bUpdateNoteCaptionPos = true ); ULONG GetXMLImportedFormulaCount() const { return nXMLImportedFormulaCount; } void IncXMLImportedFormulaCount( ULONG nVal ) diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx index 563cf768b5ae..7dd9903f82a1 100644 --- a/sc/inc/drwlayer.hxx +++ b/sc/inc/drwlayer.hxx @@ -110,9 +110,9 @@ private: void MoveAreaTwips( SCTAB nTab, const Rectangle& rArea, const Point& rMove, const Point& rTopLeft ); void MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2, - SCsCOL nDx,SCsROW nDy ); + SCsCOL nDx,SCsROW nDy, bool bUpdateNoteCaptionPos ); - void RecalcPos( SdrObject* pObj, const ScDrawObjData& rData, bool bNegativePage ); + void RecalcPos( SdrObject* pObj, const ScDrawObjData& rData, bool bNegativePage, bool bUpdateNoteCaptionPos ); public: ScDrawLayer( ScDocument* pDocument, const String& rName ); @@ -155,7 +155,7 @@ public: void AddCalcUndo( SdrUndoAction* pUndo ); void MoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2, - SCsCOL nDx,SCsROW nDy, BOOL bInsDel ); + SCsCOL nDx,SCsROW nDy, BOOL bInsDel, bool bUpdateNoteCaptionPos = true ); void WidthChanged( SCTAB nTab, SCCOL nCol, long nDifTwips ); void HeightChanged( SCTAB nTab, SCROW nRow, long nDifTwips ); @@ -173,7 +173,7 @@ public: SCTAB nSourceTab, const Rectangle& rSourceRange, const ScAddress& rDestPos, const Rectangle& rDestRange ); - void SetPageSize( USHORT nPageNo, const Size& rSize ); + void SetPageSize( USHORT nPageNo, const Size& rSize, bool bUpdateNoteCaptionPos = true ); // mirror or move between positive and negative positions for RTL void MirrorRTL( SdrObject* pObj ); diff --git a/sc/inc/eetext.hxx b/sc/inc/eetext.hxx deleted file mode 100644 index 28ee0d5f09b2..000000000000 --- a/sc/inc/eetext.hxx +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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_EETEXT_HXX -#define SC_EETEXT_HXX - -#endif - - diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx index ae37b710a074..f47d99097b39 100644 --- a/sc/inc/externalrefmgr.hxx +++ b/sc/inc/externalrefmgr.hxx @@ -141,7 +141,7 @@ public: ~Table(); SC_DLLPUBLIC void setCell(SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 nFmtIndex = 0); - TokenRef getCell(SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex = NULL) const; + SC_DLLPUBLIC TokenRef getCell(SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex = NULL) const; bool hasRow( SCROW nRow ) const; /** Set/clear referenced status flag only if current status is not REFERENCED_PERMANENT. */ @@ -152,8 +152,12 @@ public: bool isReferenced() const; /// Obtain a sorted vector of rows. void getAllRows(::std::vector<SCROW>& rRows) const; + /// Returns the half-open range of used rows in this table. Returns [0,0) if table is empty. + SC_DLLPUBLIC ::std::pair< SCROW, SCROW > getRowRange() const; /// Obtain a sorted vector of columns. void getAllCols(SCROW nRow, ::std::vector<SCCOL>& rCols) const; + /// Returns the half-open range of used columns in the specified row. Returns [0,0) if row is empty. + SC_DLLPUBLIC ::std::pair< SCCOL, SCCOL > getColRange( SCROW nRow ) const; void getAllNumberFormats(::std::vector<sal_uInt32>& rNumFmts) const; private: @@ -467,6 +471,13 @@ public: * @return shared_ptr to the cache table instance */ ScExternalRefCache::TableTypeRef getCacheTable(sal_uInt16 nFileId, const String& rTabName, bool bCreateNew, size_t* pnIndex = 0); + + /** Returns a vector containing all (real) table names and cache tables of + the specified file. + + The index in the returned vector corresponds to the table index used to + access the cache table, e.g. in getCacheTable(). + */ void getAllCachedTableNames(sal_uInt16 nFileId, ::std::vector<String>& rTabNames) const; /** diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 185113e77389..b85205741334 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -414,6 +414,29 @@ enum ScGetDBMode SC_DB_OLD // nicht neu anlegen }; +/// For ScDBFunc::GetDBData() +enum ScGetDBSelection +{ + /** Keep selection as is, expand to used data area if no selection. */ + SC_DBSEL_KEEP, + + /** Shrink selection to sheet's data area. */ + SC_DBSEL_SHRINK_TO_SHEET_DATA, + + /** Shrink selection to actually used data area within the selection. */ + SC_DBSEL_SHRINK_TO_USED_DATA, + + /** If only one row or portion thereof is selected, shrink row to used data + columns and select further rows down until end of data. If an area is + selected, shrink rows to actually used columns. Else, no selection, + expand to used data area. */ + SC_DBSEL_ROW_DOWN, + + /** Behave as if the range corresponding to a ScDBData area was selected, + for API use. */ + SC_DBSEL_FORCE_MARK +}; + enum ScLkUpdMode { //Verknuepfungen LM_ALWAYS, //immer aktualisieren diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx index 51555decaa5b..e00fce10da1c 100644 --- a/sc/inc/rangelst.hxx +++ b/sc/inc/rangelst.hxx @@ -40,6 +40,7 @@ class SC_DLLPUBLIC ScRangeList : public ScRangeListBase, public SvRefBase { private: using ScRangeListBase::operator==; + using ScRangeListBase::operator!=; public: ScRangeList() {} @@ -65,6 +66,7 @@ public: SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); ScRange* Find( const ScAddress& ) const; BOOL operator==( const ScRangeList& ) const; + BOOL operator!=( const ScRangeList& r ) const; BOOL Intersects( const ScRange& ) const; BOOL In( const ScRange& ) const; ULONG GetCellCount() const; diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 95cf8275cb59..c2bf3e96ed5c 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -262,6 +262,8 @@ #define HID_SC_RENAME_OBJECT ( HID_SC_TOOLBOX_START + 9 ) +#define HID_SC_REN_AFMT_DLG ( HID_SC_TOOLBOX_START + 10 ) + // Hilfe IDs fuer Submenus (max.50) ------------------------------------------ #define HID_SCMENU_EDIT ( HID_SC_MENU_START ) #define HID_SCMENU_FILL ( HID_SC_MENU_START + 1 ) diff --git a/sc/inc/scimpexpmsg.hxx b/sc/inc/scimpexpmsg.hxx deleted file mode 100644 index 5574edd12083..000000000000 --- a/sc/inc/scimpexpmsg.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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_SCIMPEXPMSG_HXX -#define SC_SCIMPEXPMSG_HXX - - -#include <tools/string.hxx> -#include <tools/solar.h> - -//UNUSED2008-05 enum ScImpExpMsg -//UNUSED2008-05 { -//UNUSED2008-05 SC_IMPEXPMSG_UNKNOWN -//UNUSED2008-05 }; -//UNUSED2008-05 -//UNUSED2008-05 -//UNUSED2008-05 class String; -//UNUSED2008-05 -//UNUSED2008-05 -//UNUSED2008-05 class ScImpExpLogMsg -//UNUSED2008-05 { -//UNUSED2008-05 private: -//UNUSED2008-05 ScImpExpMsg eId; -//UNUSED2008-05 String* pPos; -//UNUSED2008-05 String* pHint; -//UNUSED2008-05 protected: -//UNUSED2008-05 public: -//UNUSED2008-05 ScImpExpLogMsg( ScImpExpMsg eId ); -//UNUSED2008-05 ScImpExpLogMsg( ScImpExpMsg eId, const String& rPosition ); -//UNUSED2008-05 ScImpExpLogMsg( ScImpExpMsg eId, const String& rPosition, const String& rAdditionalHint ); -//UNUSED2008-05 ScImpExpLogMsg( const ScImpExpLogMsg& rCpy ); -//UNUSED2008-05 virtual ~ScImpExpLogMsg(); -//UNUSED2008-05 -//UNUSED2008-05 ScImpExpLogMsg& operator =( const ScImpExpLogMsg& rCpy ); -//UNUSED2008-05 -//UNUSED2008-05 void Set( ScImpExpMsg eId, const String* pPos = NULL, const String* pHint = NULL ); -//UNUSED2008-05 -//UNUSED2008-05 inline ScImpExpMsg GetId( void ) const; -//UNUSED2008-05 inline const String* GetPos( void ) const; -//UNUSED2008-05 inline const String* GetHint( void ) const; -//UNUSED2008-05 -//UNUSED2008-05 static String GetMsg( ScImpExpMsg eId ); -//UNUSED2008-05 inline String GetMsg( void ) const; -//UNUSED2008-05 }; -//UNUSED2008-05 -//UNUSED2008-05 -//UNUSED2008-05 -//UNUSED2008-05 -//UNUSED2008-05 inline ScImpExpLogMsg& ScImpExpLogMsg::operator =( const ScImpExpLogMsg& r ) -//UNUSED2008-05 { -//UNUSED2008-05 Set( r.eId, r.pPos, r.pHint ); -//UNUSED2008-05 return *this; -//UNUSED2008-05 } -//UNUSED2008-05 -//UNUSED2008-05 -//UNUSED2008-05 inline ScImpExpMsg ScImpExpLogMsg::GetId( void ) const -//UNUSED2008-05 { -//UNUSED2008-05 return eId; -//UNUSED2008-05 } -//UNUSED2008-05 -//UNUSED2008-05 -//UNUSED2008-05 inline const String* ScImpExpLogMsg::GetPos( void ) const -//UNUSED2008-05 { -//UNUSED2008-05 return pPos; -//UNUSED2008-05 } -//UNUSED2008-05 -//UNUSED2008-05 -//UNUSED2008-05 inline const String* ScImpExpLogMsg::GetHint( void ) const -//UNUSED2008-05 { -//UNUSED2008-05 return pHint; -//UNUSED2008-05 } -//UNUSED2008-05 -//UNUSED2008-05 -//UNUSED2008-05 inline String ScImpExpLogMsg::GetMsg( void ) const -//UNUSED2008-05 { -//UNUSED2008-05 return GetMsg( eId ); -//UNUSED2008-05 } - -#endif - - diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 0311c5093c4c..442e908542f3 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -380,7 +380,9 @@ public: SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow ); void GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, - BOOL bIncludeOld ); + BOOL bIncludeOld, bool bOnlyDown ) const; + + bool ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const; SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScDirection eDir ); @@ -422,11 +424,11 @@ public: void UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, SCsCOL nDx, SCsROW nDy, SCsTAB nDz, - ScDocument* pUndoDoc = NULL, BOOL bIncludeDraw = TRUE ); + ScDocument* pUndoDoc = NULL, BOOL bIncludeDraw = TRUE, bool bUpdateNoteCaptionPos = true ); void UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, - SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bUpdateNoteCaptionPos = true ); void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest, ScDocument* pUndoDoc ); @@ -660,8 +662,8 @@ public: void FindConditionalFormat( ULONG nKey, ScRangeList& rRanges ); - void IncRecalcLevel() { ++nRecalcLvl; } - void DecRecalcLevel() { if (!--nRecalcLvl) SetDrawPageSize(); } + void IncRecalcLevel() { ++nRecalcLvl; } + void DecRecalcLevel( bool bUpdateNoteCaptionPos = true ) { if (!--nRecalcLvl) SetDrawPageSize(true, bUpdateNoteCaptionPos); } BOOL IsSortCollatorGlobal() const; void InitSortCollator( const ScSortParam& rPar ); @@ -735,7 +737,7 @@ private: BOOL GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, BOOL bInSel, const ScMarkData& rMark) const; BOOL GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark ); - void SetDrawPageSize(bool bResetStreamValid = true); + void SetDrawPageSize( bool bResetStreamValid = true, bool bUpdateNoteCaptionPos = true ); BOOL TestTabRefAbs(SCTAB nTable); void CompileDBFormula(); void CompileDBFormula( BOOL bCreateFormulaString ); diff --git a/sc/prj/build.lst b/sc/prj/build.lst index 115e92990f3c..e32d8938afc4 100755 --- a/sc/prj/build.lst +++ b/sc/prj/build.lst @@ -48,3 +48,4 @@ sc sc\addin\datefunc nmake - all sc_addfu sc_add sc_sdi sc_inc NULL sc sc\addin\rot13 nmake - all sc_adrot sc_add sc_sdi sc_inc NULL sc sc\addin\util nmake - all sc_adutil sc_addfu sc_adrot sc_sdi sc_inc NULL sc sc\util nmake - all sc_util sc_addfu sc_adrot sc_adutil sc_app sc_attr sc_cctrl sc_cosrc sc_data sc_dbgui sc_dif sc_docsh sc_drfnc sc_excel sc_form sc_html sc_lotus sc_qpro sc_misc sc_name sc_nvipi sc_opt sc_page sc_rtf sc_scalc sc_style sc_tool sc_uisrc sc_undo sc_unobj sc_view sc_xcl97 sc_xml sc_acc sc_ftools sc_inc sc_vba NULL +sc sc\qa\unoapi nmake - all sc_qa_unoapi NULL diff --git a/sc/qa/unoapi/Test.java b/sc/qa/unoapi/Test.java new file mode 100644 index 000000000000..27d048b8bf51 --- /dev/null +++ b/sc/qa/unoapi/Test.java @@ -0,0 +1,51 @@ +/************************************************************************* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* 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. +************************************************************************/ + +package org.openoffice.sc.qa.unoapi; + +import org.openoffice.Runner; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; + +public final class Test { + @org.junit.Before public void setUp() throws Exception { + connection.setUp(); + } + + @org.junit.After public void tearDown() + throws InterruptedException, com.sun.star.uno.Exception + { + connection.tearDown(); + } + + @org.junit.Test public void test() { + assertTrue( + Runner.run( + "-sce", "sc.sce", "-xcl", "knownissues.xcl", "-tdoc", + "testdocuments", "-cs", connection.getDescription())); + } + + private final OfficeConnection connection = new OfficeConnection(); +} diff --git a/sc/qa/unoapi/knownissues.xcl b/sc/qa/unoapi/knownissues.xcl index d84379c1ac5b..e6863cd75cab 100644 --- a/sc/qa/unoapi/knownissues.xcl +++ b/sc/qa/unoapi/knownissues.xcl @@ -164,4 +164,30 @@ sc.ScAccessibleCsvGrid ### i91045 ### sc.ScAccessibleDocumentPagePreview -#-> disabled in sc.sce
\ No newline at end of file +#-> disabled in sc.sce + +### i109517 ### +sc.AccessibleEditableTextPara_PreviewCell::com::sun::star::accessibility::XAccessibleComponent +sc.ScAccessiblePageHeaderArea::com::sun::star::accessibility::XAccessibleEventBroadcaster +sc.ScAnnotationObj::com::sun::star::sheet::XSheetAnnotation +sc.ScAnnotationObj::com::sun::star::text::XSimpleText +sc.ScAnnotationObj::com::sun::star::text::XTextRange +sc.ScAnnotationShapeObj::com::sun::star::beans::XPropertySet +sc.ScAnnotationShapeObj::com::sun::star::drawing::CaptionShape +sc.ScAnnotationShapeObj::com::sun::star::drawing::LineProperties +sc.ScAnnotationShapeObj::com::sun::star::drawing::RotationDescriptor +sc.ScAnnotationShapeObj::com::sun::star::drawing::ShadowProperties +sc.ScAnnotationShapeObj::com::sun::star::drawing::Shape +sc.ScAnnotationShapeObj::com::sun::star::drawing::XShape +sc.ScAnnotationShapeObj::com::sun::star::drawing::XShapeDescriptor +sc.ScAnnotationShapeObj::com::sun::star::lang::XComponent +sc.ScAnnotationShapeObj::com::sun::star::style::CharacterProperties +sc.ScAnnotationShapeObj::com::sun::star::style::CharacterPropertiesAsian +sc.ScAnnotationShapeObj::com::sun::star::style::CharacterPropertiesComplex +sc.ScAnnotationShapeObj::com::sun::star::style::ParagraphPropertiesAsian +sc.ScAnnotationShapeObj::com::sun::star::style::ParagraphPropertiesComplex +sc.ScAnnotationShapeObj::com::sun::star::text::XSimpleText +sc.ScAnnotationShapeObj::com::sun::star::text::XTextRange +sc.ScAnnotationsObj::com::sun::star::container::XElementAccess +sc.ScCellObj::com::sun::star::sheet::XSheetAnnotationAnchor +sc.ScDataPilotFieldObj::com::sun::star::sheet::XDataPilotFieldGrouping diff --git a/sc/qa/unoapi/makefile.mk b/sc/qa/unoapi/makefile.mk index b5506881fb2a..a4781282a0b3 100644 --- a/sc/qa/unoapi/makefile.mk +++ b/sc/qa/unoapi/makefile.mk @@ -1,7 +1,6 @@ #************************************************************************* -# # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2000, 2010 Oracle and/or its affiliates. # # OpenOffice.org - a multi-platform office productivity suite @@ -22,19 +21,28 @@ # version 3 along with OpenOffice.org. If not, see # <http://www.openoffice.org/license.html> # for a copy of the LGPLv3 License. -# -#************************************************************************* +#***********************************************************************/ -PRJ=..$/.. +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE -PRJNAME=sc -TARGET=qa_unoapi +PRJ = ../.. +PRJNAME = sc +TARGET = qa_unoapi -.INCLUDE: settings.mk +.IF "$(OOO_JUNIT_JAR)" != "" +PACKAGE = org/openoffice/sc/qa/unoapi +JAVATESTFILES = Test.java +JAVAFILES = $(JAVATESTFILES) +JARFILES = OOoRunner.jar ridl.jar test.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) +.END +.INCLUDE: settings.mk .INCLUDE: target.mk +.INCLUDE: installationtest.mk -ALLTAR : UNOAPI_TEST +ALLTAR : javatest -UNOAPI_TEST: - +$(SOLARENV)$/bin$/checkapi -sce sc.sce -xcl knownissues.xcl -tdoc $(PWD)$/testdocuments +.END diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 1bd5b101f691..fd2b2f1fd309 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -785,7 +785,8 @@ void ScDocument::UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, SCsCOL nDx, SCsROW nDy, SCsTAB nDz, - ScDocument* pUndoDoc, BOOL bIncludeDraw ) + ScDocument* pUndoDoc, BOOL bIncludeDraw, + bool bUpdateNoteCaptionPos ) { PutInOrder( nCol1, nCol2 ); PutInOrder( nRow1, nRow2 ); @@ -829,7 +830,7 @@ void ScDocument::UpdateReference( UpdateRefMode eUpdateRefMode, if (pTab[i]) pTab[i]->UpdateReference( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, - nDx, nDy, nDz, pUndoDoc, bIncludeDraw ); + nDx, nDy, nDz, pUndoDoc, bIncludeDraw, bUpdateNoteCaptionPos ); if ( bIsEmbedded ) { @@ -1900,10 +1901,10 @@ void ScDocument::IncSizeRecalcLevel( SCTAB nTab ) pTab[nTab]->IncRecalcLevel(); } -void ScDocument::DecSizeRecalcLevel( SCTAB nTab ) +void ScDocument::DecSizeRecalcLevel( SCTAB nTab, bool bUpdateNoteCaptionPos ) { if ( ValidTab(nTab) && pTab[nTab] ) - pTab[nTab]->DecRecalcLevel(); + pTab[nTab]->DecRecalcLevel( bUpdateNoteCaptionPos ); } // Wang Xu Ming -- 2009-8-17 diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index ec6bba8cc33d..9da788fca01c 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -168,7 +168,7 @@ void ScDocument::InitDrawLayer( SfxObjectShell* pDocShell ) pTab[nTab]->GetName(aTabName); pDrawLayer->ScRenamePage( nTab, aTabName ); - pTab[nTab]->SetDrawPageSize(false); // #54782# set the right size immediately + pTab[nTab]->SetDrawPageSize(false,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 9cf68e3e309d..3f25ad5a310e 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -696,14 +696,22 @@ bool ScDocument::ShrinkToDataArea(SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow return true; // success! } +bool ScDocument::ShrinkToUsedDataArea( SCTAB nTab, SCCOL& rStartCol, + SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const +{ + if (!ValidTab(nTab) || !pTab[nTab]) + return false; + return pTab[nTab]->ShrinkToUsedDataArea( rStartCol, rStartRow, rEndCol, rEndRow, bColumnsOnly); +} + // zusammenhaengender Bereich void ScDocument::GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, - SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld ) + SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld, bool bOnlyDown ) { if (VALIDTAB(nTab)) if (pTab[nTab]) - pTab[nTab]->GetDataArea( rStartCol, rStartRow, rEndCol, rEndRow, bIncludeOld ); + pTab[nTab]->GetDataArea( rStartCol, rStartRow, rEndCol, rEndRow, bIncludeOld, bOnlyDown ); } @@ -953,7 +961,7 @@ void ScDocument::DeleteRow( SCCOL nStartCol, SCTAB nStartTab, { UpdateReference( URM_INSDEL, nStartCol, nStartRow+nSize, nTabRangeStart, nEndCol, MAXROW, nTabRangeEnd, - 0, -(static_cast<SCsROW>(nSize)), 0, pRefUndoDoc ); + 0, -(static_cast<SCsROW>(nSize)), 0, pRefUndoDoc, TRUE, false ); } while ( lcl_GetNextTabRange( nTabRangeStart, nTabRangeEnd, pTabMark ) ); } @@ -1054,7 +1062,7 @@ BOOL ScDocument::InsertCol( SCROW nStartRow, SCTAB nStartTab, { UpdateReference( URM_INSDEL, nStartCol, nStartRow, nTabRangeStart, MAXCOL, nEndRow, nTabRangeEnd, - static_cast<SCsCOL>(nSize), 0, 0, pRefUndoDoc ); + static_cast<SCsCOL>(nSize), 0, 0, pRefUndoDoc, TRUE, false ); } while ( lcl_GetNextTabRange( nTabRangeStart, nTabRangeEnd, pTabMark ) ); @@ -1143,7 +1151,7 @@ void ScDocument::DeleteCol(SCROW nStartRow, SCTAB nStartTab, SCROW nEndRow, SCTA { UpdateReference( URM_INSDEL, sal::static_int_cast<SCCOL>(nStartCol+nSize), nStartRow, nTabRangeStart, MAXCOL, nEndRow, nTabRangeEnd, - -static_cast<SCsCOL>(nSize), 0, 0, pRefUndoDoc ); + -static_cast<SCsCOL>(nSize), 0, 0, pRefUndoDoc, TRUE, false ); } while ( lcl_GetNextTabRange( nTabRangeStart, nTabRangeEnd, pTabMark ) ); } diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 69dee934ce66..3d7fc007818b 100755 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -456,7 +456,7 @@ inline BOOL IsInBlock( const ScAddress& rPos, SCCOL nCol1,SCROW nRow1, SCCOL nCo } void ScDrawLayer::MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2, - SCsCOL nDx,SCsROW nDy ) + SCsCOL nDx,SCsROW nDy, bool bUpdateNoteCaptionPos ) { SdrPage* pPage = GetPage(static_cast<sal_uInt16>(nTab)); DBG_ASSERT(pPage,"Page nicht gefunden"); @@ -492,13 +492,13 @@ void ScDrawLayer::MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SC if ( pObj->ISA( SdrRectObj ) && pData->maStart.IsValid() && pData->maEnd.IsValid() ) pData->maStart.PutInOrder( pData->maEnd ); AddCalcUndo( new ScUndoObjData( pObj, aOldStt, aOldEnd, pData->maStart, pData->maEnd ) ); - RecalcPos( pObj, *pData, bNegativePage ); + RecalcPos( pObj, *pData, bNegativePage, bUpdateNoteCaptionPos ); } } } } -void ScDrawLayer::SetPageSize( USHORT nPageNo, const Size& rSize ) +void ScDrawLayer::SetPageSize( USHORT nPageNo, const Size& rSize, bool bUpdateNoteCaptionPos ) { SdrPage* pPage = GetPage(nPageNo); if (pPage) @@ -521,34 +521,31 @@ void ScDrawLayer::SetPageSize( USHORT nPageNo, const Size& rSize ) SdrObject* pObj = pPage->GetObj( i ); ScDrawObjData* pData = GetObjDataTab( pObj, static_cast<SCTAB>(nPageNo) ); if( pData ) - RecalcPos( pObj, *pData, bNegativePage ); + RecalcPos( pObj, *pData, bNegativePage, bUpdateNoteCaptionPos ); } } } -void ScDrawLayer::RecalcPos( SdrObject* pObj, const ScDrawObjData& rData, bool bNegativePage ) +void ScDrawLayer::RecalcPos( SdrObject* pObj, const ScDrawObjData& rData, bool bNegativePage, bool bUpdateNoteCaptionPos ) { DBG_ASSERT( pDoc, "ScDrawLayer::RecalcPos - missing document" ); if( !pDoc ) return; - /* TODO CleanUp: Updating note position works just by chance currently... - When inserting rows/columns, this function is called after the - insertion, and the note is located at the new position contained in the - passed ScDrawObjData already. But when deleting rows/columns, this - function is called *before* the deletion, so the note is still at the - old cell position, and ScDocument::GetNote() will fail to get the note - or will get another note. But after the rows/columns are deleted, a - call to ScDrawLayer::SetPageSize() will call this function again, and - now the note is at the expected position in the document. */ if( rData.mbNote ) { DBG_ASSERT( rData.maStart.IsValid(), "ScDrawLayer::RecalcPos - invalid position for cell note" ); - /* When inside an undo action, there may be pending note captions - where cell note is already deleted. The caption will be deleted - later with drawing undo. */ - if( ScPostIt* pNote = pDoc->GetNote( rData.maStart ) ) - pNote->UpdateCaptionPos( rData.maStart ); + /* #i109372# On insert/remove rows/columns/cells: Updating the caption + position must not be done, if the cell containing the note has not + been moved yet in the document. The calling code now passes an + additional boolean stating if the cells are already moved. */ + if( bUpdateNoteCaptionPos ) + /* When inside an undo action, there may be pending note captions + where cell note is already deleted (thus document cannot find + the note object anymore). The caption will be deleted later + with drawing undo. */ + if( ScPostIt* pNote = pDoc->GetNote( rData.maStart ) ) + pNote->UpdateCaptionPos( rData.maStart ); return; } @@ -1020,7 +1017,7 @@ void ScDrawLayer::MoveAreaTwips( SCTAB nTab, const Rectangle& rArea, } void ScDrawLayer::MoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2, - SCsCOL nDx,SCsROW nDy, BOOL bInsDel ) + SCsCOL nDx,SCsROW nDy, BOOL bInsDel, bool bUpdateNoteCaptionPos ) { DBG_ASSERT( pDoc, "ScDrawLayer::MoveArea without document" ); if ( !pDoc ) @@ -1069,7 +1066,7 @@ void ScDrawLayer::MoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCR // Detektiv-Pfeile: Zellpositionen anpassen // - MoveCells( nTab, nCol1,nRow1, nCol2,nRow2, nDx,nDy ); + MoveCells( nTab, nCol1,nRow1, nCol2,nRow2, nDx,nDy, bUpdateNoteCaptionPos ); } void ScDrawLayer::WidthChanged( SCTAB nTab, SCCOL nCol, long nDifTwips ) diff --git a/sc/source/core/data/makefile.mk b/sc/source/core/data/makefile.mk index ab2160a93219..cf51e1e543a4 100755 --- a/sc/source/core/data/makefile.mk +++ b/sc/source/core/data/makefile.mk @@ -96,10 +96,8 @@ SLOFILES = \ $(SLO)$/olinetab.obj \ $(SLO)$/pagepar.obj \ $(SLO)$/patattr.obj \ - $(SLO)$/pivot.obj \ $(SLO)$/pivot2.obj \ $(SLO)$/poolhelp.obj \ - $(SLO)$/scimpexpmsg.obj \ $(SLO)$/sortparam.obj \ $(SLO)$/stlpool.obj \ $(SLO)$/stlsheet.obj \ diff --git a/sc/source/core/data/pivot.cxx b/sc/source/core/data/pivot.cxx deleted file mode 100644 index e63b228de703..000000000000 --- a/sc/source/core/data/pivot.cxx +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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" - - - -// ----------------------------------------------------------------------- - diff --git a/sc/source/core/data/scimpexpmsg.cxx b/sc/source/core/data/scimpexpmsg.cxx deleted file mode 100644 index 0d883fe5535a..000000000000 --- a/sc/source/core/data/scimpexpmsg.cxx +++ /dev/null @@ -1,113 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * 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 "document.hxx" -#include "scimpexpmsg.hxx" - -#include <tools/string.hxx> - -//UNUSED2008-05 ScImpExpLogMsg::ScImpExpLogMsg( ScImpExpMsg e ) : eId( e ), pPos( NULL ), pHint( NULL ) -//UNUSED2008-05 { -//UNUSED2008-05 } -//UNUSED2008-05 -//UNUSED2008-05 -//UNUSED2008-05 ScImpExpLogMsg::ScImpExpLogMsg( ScImpExpMsg e, const String& r ) : eId( e ), pHint( NULL ) -//UNUSED2008-05 { -//UNUSED2008-05 pPos = new String( r ); -//UNUSED2008-05 } -//UNUSED2008-05 -//UNUSED2008-05 -//UNUSED2008-05 ScImpExpLogMsg::ScImpExpLogMsg( ScImpExpMsg e, const String& rP, const String& rH ) : eId( e ) -//UNUSED2008-05 { -//UNUSED2008-05 pPos = new String( rP ); -//UNUSED2008-05 pHint = new String( rH ); -//UNUSED2008-05 } -//UNUSED2008-05 -//UNUSED2008-05 ScImpExpLogMsg::ScImpExpLogMsg( const ScImpExpLogMsg& r ) : eId( r.eId ) -//UNUSED2008-05 { -//UNUSED2008-05 if( r.pPos ) -//UNUSED2008-05 pPos = new String( *r.pPos ); -//UNUSED2008-05 else -//UNUSED2008-05 pPos = NULL; -//UNUSED2008-05 -//UNUSED2008-05 if( r.pHint ) -//UNUSED2008-05 pHint = new String( *r.pHint ); -//UNUSED2008-05 else -//UNUSED2008-05 pHint = NULL; -//UNUSED2008-05 } -//UNUSED2008-05 -//UNUSED2008-05 -//UNUSED2008-05 ScImpExpLogMsg::~ScImpExpLogMsg() -//UNUSED2008-05 { -//UNUSED2008-05 if( pPos ) -//UNUSED2008-05 delete pPos; -//UNUSED2008-05 -//UNUSED2008-05 if( pHint ) -//UNUSED2008-05 delete pHint; -//UNUSED2008-05 } -//UNUSED2008-05 -//UNUSED2008-05 -//UNUSED2008-05 void ScImpExpLogMsg::Set( ScImpExpMsg e, const String* pP, const String* pH ) -//UNUSED2008-05 { -//UNUSED2008-05 eId = e; -//UNUSED2008-05 if( pPos ) -//UNUSED2008-05 delete pPos; -//UNUSED2008-05 -//UNUSED2008-05 if( pHint ) -//UNUSED2008-05 delete pHint; -//UNUSED2008-05 -//UNUSED2008-05 if( pP ) -//UNUSED2008-05 pPos = new String( *pP ); -//UNUSED2008-05 else -//UNUSED2008-05 pPos = NULL; -//UNUSED2008-05 -//UNUSED2008-05 if( pH ) -//UNUSED2008-05 pHint = new String( *pH ); -//UNUSED2008-05 } -//UNUSED2008-05 -//UNUSED2008-05 -//UNUSED2008-05 String ScImpExpLogMsg::GetMsg( ScImpExpMsg e ) -//UNUSED2008-05 { -//UNUSED2008-05 const sal_Char* p; -//UNUSED2008-05 switch( e ) -//UNUSED2008-05 { -//UNUSED2008-05 case SC_IMPEXPMSG_UNKNOWN: p = "unknown log message"; break; -//UNUSED2008-05 default: p = "Not specified type of log message"; -//UNUSED2008-05 } -//UNUSED2008-05 -//UNUSED2008-05 String aRet; -//UNUSED2008-05 aRet.AssignAscii( p ); -//UNUSED2008-05 return aRet; -//UNUSED2008-05 } - diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index fc42cfaf720b..75b288272c1e 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -188,7 +188,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const String& rNewName, pDrawLayer->ScRenamePage( nTab, aName ); ULONG nx = (ULONG) ((double) (MAXCOL+1) * STD_COL_WIDTH * HMM_PER_TWIPS ); ULONG ny = (ULONG) ((double) (MAXROW+1) * ScGlobal::nStdRowHeight * HMM_PER_TWIPS ); - pDrawLayer->SetPageSize( static_cast<sal_uInt16>(nTab), Size( nx, ny ) ); + pDrawLayer->SetPageSize( static_cast<sal_uInt16>(nTab), Size( nx, ny ), false ); } } @@ -678,7 +678,7 @@ BOOL ScTable::GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const } void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, - BOOL bIncludeOld ) + BOOL bIncludeOld, bool bOnlyDown ) const { BOOL bLeft = FALSE; BOOL bRight = FALSE; @@ -693,26 +693,44 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S { bChanged = FALSE; - SCROW nStart = rStartRow; - SCROW nEnd = rEndRow; - if (nStart>0) --nStart; - if (nEnd<MAXROW) ++nEnd; + if (!bOnlyDown) + { + SCROW nStart = rStartRow; + SCROW nEnd = rEndRow; + if (nStart>0) --nStart; + if (nEnd<MAXROW) ++nEnd; - if (rEndCol < MAXCOL) - if (!aCol[rEndCol+1].IsEmptyBlock(nStart,nEnd)) - { - ++rEndCol; - bChanged = TRUE; - bRight = TRUE; - } + if (rEndCol < MAXCOL) + if (!aCol[rEndCol+1].IsEmptyBlock(nStart,nEnd)) + { + ++rEndCol; + bChanged = TRUE; + bRight = TRUE; + } - if (rStartCol > 0) - if (!aCol[rStartCol-1].IsEmptyBlock(nStart,nEnd)) + if (rStartCol > 0) + if (!aCol[rStartCol-1].IsEmptyBlock(nStart,nEnd)) + { + --rStartCol; + bChanged = TRUE; + bLeft = TRUE; + } + + if (rStartRow > 0) { - --rStartCol; - bChanged = TRUE; - bLeft = TRUE; + nTest = rStartRow-1; + bFound = FALSE; + for (i=rStartCol; i<=rEndCol && !bFound; i++) + if (aCol[i].HasDataAt(nTest)) + bFound = TRUE; + if (bFound) + { + --rStartRow; + bChanged = TRUE; + bTop = TRUE; + } } + } if (rEndRow < MAXROW) { @@ -728,21 +746,6 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S bBottom = TRUE; } } - - if (rStartRow > 0) - { - nTest = rStartRow-1; - bFound = FALSE; - for (i=rStartCol; i<=rEndCol && !bFound; i++) - if (aCol[i].HasDataAt(nTest)) - bFound = TRUE; - if (bFound) - { - --rStartRow; - bChanged = TRUE; - bTop = TRUE; - } - } } while( bChanged ); @@ -775,6 +778,77 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S } } + +bool ScTable::ShrinkToUsedDataArea( SCCOL& rStartCol, SCROW& rStartRow, + SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const +{ + bool bRet = false; + bool bChanged; + + do + { + bChanged = false; + + bool bCont = true; + while (rEndCol > 0 && bCont && rStartCol < rEndCol) + { + if (aCol[rEndCol].IsEmptyBlock( rStartRow, rEndRow)) + { + --rEndCol; + bChanged = true; + } + else + bCont = false; + } + + bCont = true; + while (rStartCol < MAXCOL && bCont && rStartCol < rEndCol) + { + if (aCol[rStartCol].IsEmptyBlock( rStartRow, rEndRow)) + { + ++rStartCol; + bChanged = true; + } + else + bCont = false; + } + + if (!bColumnsOnly) + { + if (rStartRow < MAXROW && rStartRow < rEndRow) + { + bool bFound = false; + for (SCCOL i=rStartCol; i<=rEndCol && !bFound; i++) + if (aCol[i].HasDataAt( rStartRow)) + bFound = true; + if (!bFound) + { + ++rStartRow; + bChanged = true; + } + } + + if (rEndRow > 0 && rStartRow < rEndRow) + { + bool bFound = false; + for (SCCOL i=rStartCol; i<=rEndCol && !bFound; i++) + if (aCol[i].HasDataAt( rEndRow)) + bFound = true; + if (!bFound) + { + --rEndRow; + bChanged = true; + } + } + } + + if (bChanged) + bRet = true; + } while( bChanged ); + return bRet; +} + + SCSIZE ScTable::GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScDirection eDir ) { @@ -1112,7 +1186,7 @@ BOOL ScTable::GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMa void ScTable::UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, - SCsCOL nDx, SCsROW nDy, SCsTAB nDz ) + SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bUpdateNoteCaptionPos ) { if ( nTab >= nTab1 && nTab <= nTab2 && nDz == 0 ) // only within the table { @@ -1128,14 +1202,14 @@ void ScTable::UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nR nRow2 = sal::static_int_cast<SCROW>( nRow2 - nDy ); } pDrawLayer->MoveArea( nTab, nCol1,nRow1, nCol2,nRow2, nDx,nDy, - (eUpdateRefMode == URM_INSDEL) ); + (eUpdateRefMode == URM_INSDEL), bUpdateNoteCaptionPos ); } } } void ScTable::UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, SCsCOL nDx, SCsROW nDy, SCsTAB nDz, - ScDocument* pUndoDoc, BOOL bIncludeDraw ) + ScDocument* pUndoDoc, BOOL bIncludeDraw, bool bUpdateNoteCaptionPos ) { SCCOL i; SCCOL iMax; @@ -1154,7 +1228,7 @@ void ScTable::UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nDx, nDy, nDz, pUndoDoc ); if ( bIncludeDraw ) - UpdateDrawRef( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz ); + UpdateDrawRef( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz, bUpdateNoteCaptionPos ); if ( nTab >= nTab1 && nTab <= nTab2 && nDz == 0 ) // print ranges: only within the table { diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 2163c3154d6a..4dc7dddcaba1 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -113,7 +113,7 @@ BOOL ScTable::TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCSIZE nSize ) void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize ) { - nRecalcLvl++; + IncRecalcLevel(); InitializeNoteCaptions(); if (nStartCol==0 && nEndCol==MAXCOL) { @@ -132,15 +132,14 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE for (SCCOL j=nStartCol; j<=nEndCol; j++) aCol[j].InsertRow( nStartRow, nSize ); - if( !--nRecalcLvl ) - SetDrawPageSize(); + DecRecalcLevel( false ); } void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize, BOOL* pUndoOutline ) { - nRecalcLvl++; + IncRecalcLevel(); InitializeNoteCaptions(); if (nStartCol==0 && nEndCol==MAXCOL) { @@ -160,8 +159,7 @@ void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE for (SCCOL j=nStartCol; j<=nEndCol; j++) aCol[j].DeleteRow( nStartRow, nSize ); } - if( !--nRecalcLvl ) - SetDrawPageSize(); + DecRecalcLevel(); } @@ -184,7 +182,7 @@ BOOL ScTable::TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) { - nRecalcLvl++; + IncRecalcLevel(); InitializeNoteCaptions(); if (nStartRow==0 && nEndRow==MAXROW) { @@ -227,15 +225,14 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE aCol[nStartCol+i].ClearItems( nStartRow, nEndRow, nWhichArray ); } } - if( !--nRecalcLvl ) - SetDrawPageSize(); + DecRecalcLevel(); } void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize, BOOL* pUndoOutline ) { - nRecalcLvl++; + IncRecalcLevel(); InitializeNoteCaptions(); if (nStartRow==0 && nEndRow==MAXROW) { @@ -270,8 +267,7 @@ void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE for (SCSIZE i=0; static_cast<SCCOL>(i+nSize)+nStartCol <= MAXCOL; i++) aCol[nStartCol + nSize + i].MoveTo(nStartRow, nEndRow, aCol[nStartCol + i]); } - if( !--nRecalcLvl ) - SetDrawPageSize(); + DecRecalcLevel(); } @@ -281,7 +277,7 @@ void ScTable::DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USH if (nRow2 > MAXROW) nRow2 = MAXROW; if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2)) { -// nRecalcLvl++; +// IncRecalcLevel(); { // scope for bulk broadcast ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM()); @@ -300,9 +296,7 @@ void ScTable::DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USH ApplyPatternArea( nCol1, nRow1, nCol2, nRow2, aPattern ); } -/* if( !--nRecalcLvl ) - SetDrawPageSize(); -*/ +// DecRecalcLevel(); } } @@ -389,7 +383,7 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if (nRow2 > MAXROW) nRow2 = MAXROW; if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2)) { - nRecalcLvl++; + IncRecalcLevel(); for ( i = nCol1; i <= nCol2; i++) aCol[i].CopyFromClip(nRow1, nRow2, nDy, nInsFlag, bAsLink, bSkipAttrForEmpty, pTable->aCol[i - nDx]); @@ -424,8 +418,7 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ApplyPatternArea( nCol1, nRow1, nCol2, nRow2, aPattern ); } } - if( !--nRecalcLvl ) - SetDrawPageSize(); + DecRecalcLevel(); } } @@ -691,7 +684,7 @@ void ScTable::UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, BOOL bHeight = (nCol1==0 && nCol2==MAXCOL && pRowHeight && pDestTab->pRowHeight); if (bWidth||bHeight) - nRecalcLvl++; + IncRecalcLevel(); for ( SCCOL i = 0; i <= MAXCOL; i++) { @@ -709,8 +702,7 @@ void ScTable::UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, pDestTab->pColWidth[i] = pColWidth[i]; if (bHeight) pDestTab->pRowHeight->CopyFrom( *pRowHeight, nRow1, nRow2); - if( !--nRecalcLvl ) - SetDrawPageSize(); + DecRecalcLevel(); } } } @@ -1960,14 +1952,13 @@ void ScTable::SetColWidth( SCCOL nCol, USHORT nNewWidth ) if ( nNewWidth != pColWidth[nCol] ) { - nRecalcLvl++; + IncRecalcLevel(); InitializeNoteCaptions(); ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer(); if (pDrawLayer) pDrawLayer->WidthChanged( nTab, nCol, ((long) nNewWidth) - (long) pColWidth[nCol] ); pColWidth[nCol] = nNewWidth; - if( !--nRecalcLvl ) - SetDrawPageSize(); + DecRecalcLevel(); } } else @@ -1990,14 +1981,13 @@ void ScTable::SetRowHeight( SCROW nRow, USHORT nNewHeight ) USHORT nOldHeight = pRowHeight->GetValue(nRow); if ( nNewHeight != nOldHeight ) { - nRecalcLvl++; + IncRecalcLevel(); InitializeNoteCaptions(); ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer(); if (pDrawLayer) pDrawLayer->HeightChanged( nTab, nRow, ((long) nNewHeight) - (long) nOldHeight ); pRowHeight->SetValue( nRow, nNewHeight); - if( !--nRecalcLvl ) - SetDrawPageSize(); + DecRecalcLevel(); } } else @@ -2013,7 +2003,7 @@ BOOL ScTable::SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, USHORT nNewHeig BOOL bChanged = FALSE; if (VALIDROW(nStartRow) && VALIDROW(nEndRow) && pRowHeight) { - nRecalcLvl++; + IncRecalcLevel(); InitializeNoteCaptions(); if (!nNewHeight) { @@ -2096,8 +2086,7 @@ BOOL ScTable::SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, USHORT nNewHeig } while (!bChanged && aIter.NextRange()); pRowHeight->SetValue( nStartRow, nEndRow, nNewHeight); } - if( !--nRecalcLvl ) - SetDrawPageSize(); + DecRecalcLevel(); } else { @@ -2280,7 +2269,7 @@ void ScTable::ShowCol(SCCOL nCol, BOOL bShow) BOOL bWasVis = ( pColFlags[nCol] & CR_HIDDEN ) == 0; if (bWasVis != bShow) { - nRecalcLvl++; + IncRecalcLevel(); InitializeNoteCaptions(); ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer(); if (pDrawLayer) @@ -2295,8 +2284,7 @@ void ScTable::ShowCol(SCCOL nCol, BOOL bShow) pColFlags[nCol] &= ~CR_HIDDEN; else pColFlags[nCol] |= CR_HIDDEN; - if( !--nRecalcLvl ) - SetDrawPageSize(); + DecRecalcLevel(); ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection(); if ( pCharts ) @@ -2318,7 +2306,7 @@ void ScTable::ShowRow(SCROW nRow, BOOL bShow) BOOL bWasVis = ( nFlags & CR_HIDDEN ) == 0; if (bWasVis != bShow) { - nRecalcLvl++; + IncRecalcLevel(); InitializeNoteCaptions(); ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer(); if (pDrawLayer) @@ -2333,8 +2321,7 @@ void ScTable::ShowRow(SCROW nRow, BOOL bShow) pRowFlags->SetValue( nRow, nFlags & ~(CR_HIDDEN | CR_FILTERED)); else pRowFlags->SetValue( nRow, nFlags | CR_HIDDEN); - if( !--nRecalcLvl ) - SetDrawPageSize(); + DecRecalcLevel(); ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection(); if ( pCharts ) @@ -2354,7 +2341,7 @@ void ScTable::DBShowRow(SCROW nRow, BOOL bShow) { BYTE nFlags = pRowFlags->GetValue(nRow); BOOL bWasVis = ( nFlags & CR_HIDDEN ) == 0; - nRecalcLvl++; + IncRecalcLevel(); InitializeNoteCaptions(); if (bWasVis != bShow) { @@ -2373,8 +2360,7 @@ void ScTable::DBShowRow(SCROW nRow, BOOL bShow) pRowFlags->SetValue( nRow, nFlags & ~(CR_HIDDEN | CR_FILTERED)); else pRowFlags->SetValue( nRow, nFlags | (CR_HIDDEN | CR_FILTERED)); - if( !--nRecalcLvl ) - SetDrawPageSize(); + DecRecalcLevel(); if (bWasVis != bShow) { @@ -2396,7 +2382,7 @@ void ScTable::DBShowRow(SCROW nRow, BOOL bShow) void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, BOOL bShow) { SCROW nStartRow = nRow1; - nRecalcLvl++; + IncRecalcLevel(); InitializeNoteCaptions(); while (nStartRow <= nRow2) { @@ -2441,15 +2427,14 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, BOOL bShow) if (pOutlineTable) UpdateOutlineRow( nRow1, nRow2, bShow ); - if( !--nRecalcLvl ) - SetDrawPageSize(); + DecRecalcLevel(); } void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, BOOL bShow) { SCROW nStartRow = nRow1; - nRecalcLvl++; + IncRecalcLevel(); InitializeNoteCaptions(); while (nStartRow <= nRow2) { @@ -2487,8 +2472,7 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, BOOL bShow) nStartRow = nEndRow + 1; } - if( !--nRecalcLvl ) - SetDrawPageSize(); + DecRecalcLevel(); } @@ -2854,7 +2838,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(bool bResetStreamValid) +void ScTable::SetDrawPageSize(bool bResetStreamValid, bool bUpdateNoteCaptionPos) { ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer(); if( pDrawLayer ) @@ -2867,7 +2851,7 @@ void ScTable::SetDrawPageSize(bool bResetStreamValid) if ( IsLayoutRTL() ) // IsNegativePage x = -x; - pDrawLayer->SetPageSize( static_cast<sal_uInt16>(nTab), Size( x, y ) ); + pDrawLayer->SetPageSize( static_cast<sal_uInt16>(nTab), Size( x, y ), bUpdateNoteCaptionPos ); } // #i102616# actions that modify the draw page size count as sheet modification diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 34aba14119a6..82dc5b3b168e 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -3105,7 +3105,7 @@ void ScInterpreter::ScColRowNameAuto() (SCROW&) aRefData.Ref1.nRow, (SCCOL&) aRefData.Ref2.nCol, (SCROW&) aRefData.Ref2.nRow, - TRUE ); + TRUE, false ); // DataArea im Ursprung begrenzen aRefData.Ref1.nCol = nStartCol; aRefData.Ref1.nRow = nStartRow; diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index a631ff3c3fbb..1ab978866c67 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -229,6 +229,11 @@ BOOL ScRangeList::operator==( const ScRangeList& r ) const return TRUE; } +BOOL ScRangeList::operator!=( const ScRangeList& r ) const +{ + return !operator==( r ); +} + BOOL ScRangeList::UpdateReference( UpdateRefMode eUpdateRefMode, ScDocument* pDoc, const ScRange& rWhere, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ) diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index 421a15b6da95..fcf738527025 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -43,7 +43,8 @@ using ::std::auto_ptr; using ::std::find_if; using ::std::vector; -using namespace formula; +using ::rtl::OUString; +using ::com::sun::star::uno::Any; // ============================================================================ // *** Helper classes *** @@ -166,105 +167,59 @@ private: // Cached external cells ====================================================== -/** Base class to store the contents of one external cell (record CRN). */ +/** Stores the contents of a consecutive row of external cells (record CRN). */ class XclExpCrn : public XclExpRecord { -protected: - /** @param nAddSize The size of additional data derived classes will write. */ - explicit XclExpCrn( SCCOL nScCol, SCROW nScRow, sal_uInt8 nId, sal_uInt32 nAddLen = 0 ); - -private: - /** Writes the start of the record that is equal in all CRN records and calls WriteAddData(). */ - virtual void WriteBody( XclExpStream& rStrm ); - - /** Called to write additional data following the common record contents. - @descr Derived classes should overwrite this function to write their data. */ - virtual void WriteAddData( XclExpStream& rStrm ) = 0; - -private: - sal_uInt16 mnXclCol; /// Column index of the external cell. - sal_uInt16 mnXclRow; /// Row index of the external cell. - sal_uInt8 mnId; /// Identifier for data type (EXC_CACHEDVAL_***). -}; - -// ---------------------------------------------------------------------------- - -/** Cached data of an external value cell. */ -class XclExpCrnDouble : public XclExpCrn -{ public: - explicit XclExpCrnDouble( SCCOL nScCol, SCROW nScRow, double fVal ); + explicit XclExpCrn( SCCOL nScCol, SCROW nScRow, const Any& rValue ); -private: - /** Writes the double value following the common record contents. */ - virtual void WriteAddData( XclExpStream& rStrm ); + /** Returns true, if the passed value could be appended to this record. */ + bool InsertValue( SCCOL nScCol, SCROW nScRow, const Any& rValue ); private: - double mfVal; /// Value of the cached cell. -}; - -// ---------------------------------------------------------------------------- + virtual void WriteBody( XclExpStream& rStrm ); -/** Cached data of an external text cell. */ -class XclExpCrnString : public XclExpCrn -{ -public: - explicit XclExpCrnString( SCCOL nScCol, SCROW nScRow, const String& rText ); + void WriteBool( XclExpStream& rStrm, bool bValue ); + void WriteDouble( XclExpStream& rStrm, double fValue ); + void WriteString( XclExpStream& rStrm, const OUString& rValue ); + void WriteError( XclExpStream& rStrm, sal_uInt8 nErrCode ); + void WriteEmpty( XclExpStream& rStrm ); private: - /** Writes the string following the common record contents. */ - virtual void WriteAddData( XclExpStream& rStrm ); + typedef ::std::vector< Any > CachedValues; -private: - XclExpString maText; /// Text of the cached cell. + CachedValues maValues; /// All cached values. + SCCOL mnScCol; /// Column index of the first external cell. + SCROW mnScRow; /// Row index of the external cells. }; // ---------------------------------------------------------------------------- -/// Cached data of an external Boolean cell. */ -class XclExpCrnBool : public XclExpCrn -{ -public: - explicit XclExpCrnBool( SCCOL nScCol, SCROW nScRow, bool bBoolVal ); - -private: - /** Writes the Boolean value following the common record contents. */ - virtual void WriteAddData( XclExpStream& rStrm ); - -private: - sal_uInt16 mnBool; /// Boolean value of the cached cell. -}; - -// Cached cells of a sheet ==================================================== - -/// Represents the record XCT which is the header record of a CRN record list. */ -class XclExpXct : public XclExpRecord +/** Represents the record XCT which is the header record of a CRN record list. + */ +class XclExpXct : public XclExpRecordBase, protected XclExpRoot { public: - explicit XclExpXct( const String& rTabName, sal_uInt16 nSBTab ); + explicit XclExpXct( const XclExpRoot& rRoot, + const String& rTabName, sal_uInt16 nSBTab, + ScExternalRefCache::TableTypeRef xCacheTable ); /** Returns the external sheet name. */ inline const XclExpString& GetTabName() const { return maTabName; } /** Stores all cells in the given range in the CRN list. */ - void StoreCellRange( const XclExpRoot& rRoot, const ScRange& rRange ); + void StoreCellRange( const ScRange& rRange ); - void StoreCell( const XclExpRoot& rRoot, const ScAddress& rCell, const formula::FormulaToken& rToken ); - void StoreCellRange( const XclExpRoot& rRoot, const ScRange& rRange, const formula::FormulaToken& rToken ); + void StoreCell( const ScAddress& rCell, const ::formula::FormulaToken& rToken ); + void StoreCellRange( const ScRange& rRange, const ::formula::FormulaToken& rToken ); /** Writes the XCT and all CRN records. */ virtual void Save( XclExpStream& rStrm ); private: - /** Writes the XCT record contents. */ - virtual void WriteBody( XclExpStream& rStrm ); - -private: - typedef XclExpRecordList< XclExpCrn > XclExpCrnList; - typedef XclExpCrnList::RecordRefType XclExpCrnRef; - - XclExpCrnList maCrnList; /// CRN records that follow this record. + ScExternalRefCache::TableTypeRef mxCacheTable; ScMarkData maUsedCells; /// Contains addresses of all stored cells. + ScRange maBoundRange; /// Bounding box of maUsedCells. XclExpString maTabName; /// Sheet name of the external sheet. sal_uInt16 mnSBTab; /// Referred sheet index in SUPBOOK record. }; @@ -353,14 +308,14 @@ public: /** Stores all cells in the given range in the CRN list of the specified SUPBOOK sheet. */ void StoreCellRange( const ScRange& rRange, sal_uInt16 nSBTab ); - void StoreCell( sal_uInt16 nSBTab, const ScAddress& rCell, const formula::FormulaToken& rToken ); - void StoreCellRange( sal_uInt16 nSBTab, const ScRange& rRange, const formula::FormulaToken& rToken ); + void StoreCell( sal_uInt16 nSBTab, const ScAddress& rCell, const ::formula::FormulaToken& rToken ); + void StoreCellRange( sal_uInt16 nSBTab, const ScRange& rRange, const ::formula::FormulaToken& rToken ); sal_uInt16 GetTabIndex( const String& rTabName ) const; sal_uInt16 GetTabCount() const; /** Inserts a new sheet name into the SUPBOOK and returns the SUPBOOK internal sheet index. */ - sal_uInt16 InsertTabName( const String& rTabName ); + sal_uInt16 InsertTabName( const String& rTabName, ScExternalRefCache::TableTypeRef xCacheTable ); /** Finds or inserts an EXTERNNAME record for add-ins. @return The 1-based EXTERNNAME record index; or 0, if the record list is full. */ sal_uInt16 InsertAddIn( const String& rName ); @@ -1006,6 +961,7 @@ void XclExpExtName::WriteAddData( XclExpStream& rStrm ) // range address. Excel just writes '02 00 1C 17' for all the other types // of external names. + using namespace ::formula; do { if (mpArray->GetLen() != 1) @@ -1162,209 +1118,200 @@ sal_uInt16 XclExpExtNameBuffer::AppendNew( XclExpExtNameBase* pExtName ) // Cached external cells ====================================================== -XclExpCrn::XclExpCrn( SCCOL nScCol, SCROW nScRow, sal_uInt8 nId, sal_uInt32 nAddLen ) : - XclExpRecord( EXC_ID_CRN, 5 + nAddLen ), - mnXclCol( static_cast< sal_uInt16 >( nScCol ) ), - mnXclRow( static_cast< sal_uInt16 >( nScRow ) ), - mnId( nId ) +XclExpCrn::XclExpCrn( SCCOL nScCol, SCROW nScRow, const Any& rValue ) : + XclExpRecord( EXC_ID_CRN, 4 ), + mnScCol( nScCol ), + mnScRow( nScRow ) { + maValues.push_back( rValue ); } -void XclExpCrn::WriteBody( XclExpStream& rStrm ) +bool XclExpCrn::InsertValue( SCCOL nScCol, SCROW nScRow, const Any& rValue ) { - rStrm << static_cast< sal_uInt8 >( mnXclCol ) - << static_cast< sal_uInt8 >( mnXclCol ) - << mnXclRow - << mnId; - WriteAddData( rStrm ); + if( (nScRow != mnScRow) || (nScCol != static_cast< SCCOL >( mnScCol + maValues.size() )) ) + return false; + maValues.push_back( rValue ); + return true; } -// ---------------------------------------------------------------------------- - -XclExpCrnDouble::XclExpCrnDouble( SCCOL nScCol, SCROW nScRow, double fVal ) : - XclExpCrn( nScCol, nScRow, EXC_CACHEDVAL_DOUBLE, 8 ), - mfVal( fVal ) +void XclExpCrn::WriteBody( XclExpStream& rStrm ) { + rStrm << static_cast< sal_uInt8 >( mnScCol + maValues.size() - 1 ) + << static_cast< sal_uInt8 >( mnScCol ) + << static_cast< sal_uInt16 >( mnScRow ); + for( CachedValues::iterator aIt = maValues.begin(), aEnd = maValues.end(); aIt != aEnd; ++aIt ) + { + if( aIt->has< bool >() ) + WriteBool( rStrm, aIt->get< bool >() ); + else if( aIt->has< double >() ) + WriteDouble( rStrm, aIt->get< double >() ); + else if( aIt->has< OUString >() ) + WriteString( rStrm, aIt->get< OUString >() ); + else + WriteEmpty( rStrm ); + } } -void XclExpCrnDouble::WriteAddData( XclExpStream& rStrm ) +void XclExpCrn::WriteBool( XclExpStream& rStrm, bool bValue ) { - rStrm << mfVal; + rStrm << EXC_CACHEDVAL_BOOL << sal_uInt8( bValue ? 1 : 0); + rStrm.WriteZeroBytes( 7 ); } -// ---------------------------------------------------------------------------- - -XclExpCrnString::XclExpCrnString( SCCOL nScCol, SCROW nScRow, const String& rText ) : - XclExpCrn( nScCol, nScRow, EXC_CACHEDVAL_STRING ), - maText( rText ) +void XclExpCrn::WriteDouble( XclExpStream& rStrm, double fValue ) { - // set correct size after maText is initialized - AddRecSize( maText.GetSize() ); + if( ::rtl::math::isNan( fValue ) ) + { + USHORT nScError = static_cast< USHORT >( reinterpret_cast< const sal_math_Double* >( &fValue )->nan_parts.fraction_lo ); + WriteError( rStrm, XclTools::GetXclErrorCode( nScError ) ); + } + else + { + rStrm << EXC_CACHEDVAL_DOUBLE << fValue; + } } -void XclExpCrnString::WriteAddData( XclExpStream& rStrm ) +void XclExpCrn::WriteString( XclExpStream& rStrm, const OUString& rValue ) { - rStrm << maText; + rStrm << EXC_CACHEDVAL_STRING << XclExpString( rValue ); } -// ---------------------------------------------------------------------------- - -XclExpCrnBool::XclExpCrnBool( SCCOL nScCol, SCROW nScRow, bool bBoolVal ) : - XclExpCrn( nScCol, nScRow, EXC_CACHEDVAL_BOOL, 8 ), - mnBool( bBoolVal ? 1 : 0 ) +void XclExpCrn::WriteError( XclExpStream& rStrm, sal_uInt8 nErrCode ) { + rStrm << EXC_CACHEDVAL_ERROR << nErrCode; + rStrm.WriteZeroBytes( 7 ); } -void XclExpCrnBool::WriteAddData( XclExpStream& rStrm ) +void XclExpCrn::WriteEmpty( XclExpStream& rStrm ) { - rStrm << mnBool; - rStrm.WriteZeroBytes( 6 ); + rStrm << EXC_CACHEDVAL_EMPTY; + rStrm.WriteZeroBytes( 8 ); } // Cached cells of a sheet ==================================================== -XclExpXct::XclExpXct( const String& rTabName, sal_uInt16 nSBTab ) : - XclExpRecord( EXC_ID_XCT, 4 ), +XclExpXct::XclExpXct( const XclExpRoot& rRoot, const String& rTabName, + sal_uInt16 nSBTab, ScExternalRefCache::TableTypeRef xCacheTable ) : + XclExpRoot( rRoot ), + mxCacheTable( xCacheTable ), + maBoundRange( ScAddress::INITIALIZE_INVALID ), maTabName( rTabName ), mnSBTab( nSBTab ) { } -void XclExpXct::StoreCellRange( const XclExpRoot& rRoot, const ScRange& rRange ) +void XclExpXct::StoreCellRange( const ScRange& rRange ) { // #i70418# restrict size of external range to prevent memory overflow if( (rRange.aEnd.Col() - rRange.aStart.Col()) * (rRange.aEnd.Row() - rRange.aStart.Row()) > 1024 ) return; - ScDocument& rDoc = rRoot.GetDoc(); - SvNumberFormatter& rFormatter = rRoot.GetFormatter(); - SCTAB nScTab = rRange.aStart.Tab(); - SCCOL nScLastCol = rRange.aEnd.Col(); - SCROW nScLastRow = rRange.aEnd.Row(); + maUsedCells.SetMultiMarkArea( rRange ); + maBoundRange.ExtendTo( rRange ); +} - for( SCROW nScRow = rRange.aStart.Row(); nScRow <= nScLastRow; ++nScRow ) - { - for( SCCOL nScCol = rRange.aStart.Col(); nScCol <= nScLastCol; ++nScCol ) - { - if( !maUsedCells.IsCellMarked( nScCol, nScRow, TRUE ) ) - { - XclExpCrnRef xCrn; - if( rDoc.HasValueData( nScCol, nScRow, nScTab ) ) - { - ScAddress aAddr( nScCol, nScRow, nScTab ); - double fVal = rDoc.GetValue( aAddr ); - ULONG nFormat = rDoc.GetNumberFormat( aAddr ); - short nType = rFormatter.GetType( nFormat ); - bool bIsBool = (nType == NUMBERFORMAT_LOGICAL); - - if( !bIsBool && ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0) && - (rDoc.GetCellType( aAddr ) == CELLTYPE_FORMULA) ) - if( ScFormulaCell* pCell = static_cast< ScFormulaCell* >( rDoc.GetCell( aAddr ) ) ) - bIsBool = (pCell->GetFormatType() == NUMBERFORMAT_LOGICAL); - - if( bIsBool && ((fVal == 0.0) || (fVal == 1.0)) ) - xCrn.reset( new XclExpCrnBool( nScCol, nScRow, (fVal == 1.0) ) ); - else - xCrn.reset( new XclExpCrnDouble( nScCol, nScRow, fVal ) ); - } - else - { - String aText; - rDoc.GetString( nScCol, nScRow, nScTab, aText ); - xCrn.reset( new XclExpCrnString( nScCol, nScRow, aText ) ); - } - maCrnList.AppendRecord( xCrn ); - } - } - } +void XclExpXct::StoreCell( const ScAddress& rCell, const ::formula::FormulaToken& rToken ) +{ + maUsedCells.SetMultiMarkArea( ScRange( rCell ) ); + maBoundRange.ExtendTo( ScRange( rCell ) ); + (void)rToken; +} +void XclExpXct::StoreCellRange( const ScRange& rRange, const ::formula::FormulaToken& rToken ) +{ maUsedCells.SetMultiMarkArea( rRange ); + maBoundRange.ExtendTo( rRange ); + (void)rToken; } -void XclExpXct::StoreCell( const XclExpRoot& /*rRoot*/, const ScAddress& rCell, const formula::FormulaToken& rToken ) +namespace { + +class XclExpCrnList : public XclExpRecordList< XclExpCrn > { - switch (rToken.GetType()) - { - case svString: - { - XclExpCrnRef xCrn( - new XclExpCrnString(rCell.Col(), rCell.Row(), rToken.GetString())); - maCrnList.AppendRecord(xCrn); - } - break; - case svDouble: - { - XclExpCrnRef xCrn( - new XclExpCrnDouble(rCell.Col(), rCell.Row(), rToken.GetDouble())); - maCrnList.AppendRecord(xCrn); - } - break; - case svEmptyCell: - { - XclExpCrnRef xCrn( - new XclExpCrnDouble(rCell.Col(), rCell.Row(), 0.0)); - maCrnList.AppendRecord(xCrn); - } - break; - default: - ; // nothing - } +public: + /** Inserts the passed value into an existing or new CRN record. + @return True = value inserted successfully, false = CRN list is full. */ + bool InsertValue( SCCOL nScCol, SCROW nScRow, const Any& rValue ); +}; + +bool XclExpCrnList::InsertValue( SCCOL nScCol, SCROW nScRow, const Any& rValue ) +{ + RecordRefType xLastRec = GetLastRecord(); + if( xLastRec.is() && xLastRec->InsertValue( nScCol, nScRow, rValue ) ) + return true; + if( GetSize() == SAL_MAX_UINT16 ) + return false; + AppendNewRecord( new XclExpCrn( nScCol, nScRow, rValue ) ); + return true; } -void XclExpXct::StoreCellRange( const XclExpRoot& /*rRoot*/, const ScRange& rRange, const formula::FormulaToken& rToken ) +} // namespace + +void XclExpXct::Save( XclExpStream& rStrm ) { - if (rToken.GetType() != svMatrix) + if( !mxCacheTable ) return; - if (rRange.aStart.Tab() != rRange.aEnd.Tab()) - // multi-table range is not supported here. + /* Get the range of used rows in the cache table. This may help to + optimize building the CRN record list if the cache table does not + contain all referred cells, e.g. if big empty ranges are used in the + formulas. */ + ::std::pair< SCROW, SCROW > aRowRange = mxCacheTable->getRowRange(); + if( aRowRange.first >= aRowRange.second ) return; - const ScMatrix* pMtx = static_cast<const ScToken*>(&rToken)->GetMatrix(); - if (!pMtx) + /* Crop the bounding range of used cells in this table to Excel limits. + Return if there is no external cell inside these limits. */ + if( !GetAddressConverter().ValidateRange( maBoundRange, false ) ) return; - SCSIZE nCols, nRows; - pMtx->GetDimensions(nCols, nRows); - const ScAddress& s = rRange.aStart; - const ScAddress& e = rRange.aEnd; - if (static_cast<SCCOL>(nCols) != e.Col() - s.Col() + 1 || - static_cast<SCROW>(nRows) != e.Row() - s.Row() + 1) - { - // size mis-match! + /* Find the resulting row range that needs to be processed. */ + SCROW nScRow1 = ::std::max( aRowRange.first, maBoundRange.aStart.Row() ); + SCROW nScRow2 = ::std::min( aRowRange.second - 1, maBoundRange.aEnd.Row() ); + if( nScRow1 > nScRow2 ) return; - } - for (SCCOL nCol = 0; nCol < static_cast< SCCOL >( nCols ); ++nCol) + /* Build and collect all CRN records before writing the XCT record. This + is needed to determine the total number of CRN records which must be + known when writing the XCT record (possibly encrypted, so seeking the + output strem back after writing the CRN records is not an option). */ + XclExpCrnList aCrnRecs; + SvNumberFormatter& rFormatter = GetFormatter(); + bool bValid = true; + for( SCROW nScRow = nScRow1; bValid && (nScRow <= nScRow2); ++nScRow ) { - for (SCROW nRow = 0; nRow < static_cast< SCROW >( nRows ); ++nRow) + ::std::pair< SCCOL, SCCOL > aColRange = mxCacheTable->getColRange( nScRow ); + for( SCCOL nScCol = aColRange.first; bValid && (nScCol < aColRange.second); ++nScCol ) { - if (pMtx->IsString(nCol, nRow)) + if( maUsedCells.IsCellMarked( nScCol, nScRow, TRUE ) ) { - XclExpCrnRef xCrn(new XclExpCrnString( - s.Col() + nCol, s.Row() + nRow, pMtx->GetString(nCol, nRow))); - maCrnList.AppendRecord(xCrn); - } - else if (pMtx->IsValueOrEmpty(nCol, nRow)) - { - XclExpCrnRef xCrn(new XclExpCrnDouble( - s.Col() + nCol, s.Row() + nRow, pMtx->GetDouble(nCol, nRow))); - maCrnList.AppendRecord(xCrn); + sal_uInt32 nScNumFmt = 0; + ScExternalRefCache::TokenRef xToken = mxCacheTable->getCell( nScCol, nScRow, &nScNumFmt ); + using namespace ::formula; + if( xToken.get() ) switch( xToken->GetType() ) + { + case svDouble: + bValid = (rFormatter.GetType( nScNumFmt ) == NUMBERFORMAT_LOGICAL) ? + aCrnRecs.InsertValue( nScCol, nScRow, Any( xToken->GetDouble() != 0 ) ) : + aCrnRecs.InsertValue( nScCol, nScRow, Any( xToken->GetDouble() ) ); + break; + case svString: + // do not save empty strings (empty cells) to cache + if( xToken->GetString().Len() > 0 ) + bValid = aCrnRecs.InsertValue( nScCol, nScRow, Any( OUString( xToken->GetString() ) ) ); + break; + default: + break; + } } } } -} -void XclExpXct::Save( XclExpStream& rStrm ) -{ - XclExpRecord::Save( rStrm ); - maCrnList.Save( rStrm ); -} - -void XclExpXct::WriteBody( XclExpStream& rStrm ) -{ - sal_uInt16 nCount = ulimit_cast< sal_uInt16 >( maCrnList.GetSize() ); - rStrm << nCount << mnSBTab; + // write the XCT record and the list of CRN records + rStrm.StartRecord( EXC_ID_XCT, 4 ); + rStrm << static_cast< sal_uInt16 >( aCrnRecs.GetSize() ) << mnSBTab; + rStrm.EndRecord(); + aCrnRecs.Save( rStrm ); } // External documents (EXTERNSHEET/SUPBOOK), base class ======================= @@ -1471,15 +1418,11 @@ XclExpSupbook::XclExpSupbook( const XclExpRoot& rRoot, const String& rUrl ) : // We need to create all tables up front to ensure the correct table order. ScExternalRefManager* pRefMgr = rRoot.GetDoc().GetExternalRefManager(); - sal_uInt16 nFileId = pRefMgr->getExternalFileId(rUrl); - vector<String> aTabNames; - pRefMgr->getAllCachedTableNames(nFileId, aTabNames); - if (aTabNames.empty()) - return; - - vector<String>::const_iterator itr = aTabNames.begin(), itrEnd = aTabNames.end(); - for (; itr != itrEnd; ++itr) - InsertTabName(*itr); + sal_uInt16 nFileId = pRefMgr->getExternalFileId( rUrl ); + ScfStringVec aTabNames; + pRefMgr->getAllCachedTableNames( nFileId, aTabNames ); + for( ScfStringVec::const_iterator aBeg = aTabNames.begin(), aIt = aBeg, aEnd = aTabNames.end(); aIt != aEnd; ++aIt ) + InsertTabName( *aIt, pRefMgr->getCacheTable( nFileId, aIt - aBeg ) ); } XclExpSupbook::XclExpSupbook( const XclExpRoot& rRoot, const String& rApplic, const String& rTopic ) : @@ -1513,31 +1456,22 @@ void XclExpSupbook::FillRefLogEntry( XclExpRefLogEntry& rRefLogEntry, void XclExpSupbook::StoreCellRange( const ScRange& rRange, sal_uInt16 nSBTab ) { - XclExpXctRef xXct = maXctList.GetRecord( nSBTab ); - if( xXct.is() ) - xXct->StoreCellRange( GetRoot(), rRange ); + if( XclExpXct* pXct = maXctList.GetRecord( nSBTab ).get() ) + pXct->StoreCellRange( rRange ); } void XclExpSupbook::StoreCell( sal_uInt16 nSBTab, const ScAddress& rCell, const formula::FormulaToken& rToken ) { - XclExpXctRef xXct = maXctList.GetRecord(nSBTab); - if (!xXct.is()) - return; - - xXct->StoreCell(GetRoot(), rCell, rToken); + if( XclExpXct* pXct = maXctList.GetRecord( nSBTab ).get() ) + pXct->StoreCell( rCell, rToken ); } void XclExpSupbook::StoreCellRange( sal_uInt16 nSBTab, const ScRange& rRange, const formula::FormulaToken& rToken ) { - if (rRange.aStart.Tab() != rRange.aEnd.Tab()) - // multi-table range is not allowed! - return; - - XclExpXctRef xXct = maXctList.GetRecord(nSBTab); - if (!xXct.is()) - return; - - xXct->StoreCellRange(GetRoot(), rRange, rToken); + // multi-table range is not allowed! + if( rRange.aStart.Tab() == rRange.aEnd.Tab() ) + if( XclExpXct* pXct = maXctList.GetRecord( nSBTab ).get() ) + pXct->StoreCellRange( rRange, rToken ); } sal_uInt16 XclExpSupbook::GetTabIndex( const String& rTabName ) const @@ -1558,11 +1492,11 @@ sal_uInt16 XclExpSupbook::GetTabCount() const return ulimit_cast<sal_uInt16>(maXctList.GetSize()); } -sal_uInt16 XclExpSupbook::InsertTabName( const String& rTabName ) +sal_uInt16 XclExpSupbook::InsertTabName( const String& rTabName, ScExternalRefCache::TableTypeRef xCacheTable ) { DBG_ASSERT( meType == EXC_SBTYPE_EXTERN, "XclExpSupbook::InsertTabName - don't insert sheet names here" ); sal_uInt16 nSBTab = ulimit_cast< sal_uInt16 >( maXctList.GetSize() ); - XclExpXctRef xXct( new XclExpXct( rTabName, nSBTab ) ); + XclExpXctRef xXct( new XclExpXct( GetRoot(), rTabName, nSBTab, xCacheTable ) ); AddRecSize( xXct->GetTabName().GetSize() ); maXctList.AppendRecord( xXct ); return nSBTab; @@ -1786,6 +1720,7 @@ void XclExpSupbookBuffer::StoreCellRange( sal_uInt16 nFileId, const String& rTab SCTAB nTabCount = rRange.aEnd.Tab() - rRange.aStart.Tab() + 1; // If this is a multi-table range, get token for each table. + using namespace ::formula; vector<FormulaToken*> aMatrixList; aMatrixList.reserve(nTabCount); diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx index 1afcba154c4a..ad04a1f3930c 100644 --- a/sc/source/filter/excel/xihelper.cxx +++ b/sc/source/filter/excel/xihelper.cxx @@ -837,7 +837,7 @@ XclImpCachedValue::~XclImpCachedValue() { } -USHORT XclImpCachedValue::GetError() const +USHORT XclImpCachedValue::GetScError() const { return (mnType == EXC_CACHEDVAL_ERROR) ? XclTools::GetScErrorCode( mnBoolErr ) : 0; } @@ -901,7 +901,7 @@ ScMatrixRef XclImpCachedMatrix::CreateScMatrix() const xScMatrix->PutBoolean( pValue->GetBool(), nScCol, nScRow ); break; case EXC_CACHEDVAL_ERROR: - xScMatrix->PutError( pValue->GetError(), nScCol, nScRow ); + xScMatrix->PutError( pValue->GetScError(), nScCol, nScRow ); break; default: DBG_ERRORFILE( "XclImpCachedMatrix::CreateScMatrix - unknown value type" ); diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index 1183b077b626..45eed0fd98a9 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -413,6 +413,11 @@ void XclImpSupbookTab::LoadCachedValues(ScExternalRefCache::TableTypeRef pCacheT switch (p->GetType()) { case EXC_CACHEDVAL_BOOL: + { + bool b = p->GetBool(); + ScExternalRefCache::TokenRef pToken(new formula::FormulaDoubleToken(b ? 1.0 : 0.0)); + pCacheTable->setCell(rAddr.mnCol, rAddr.mnRow, pToken); + } break; case EXC_CACHEDVAL_DOUBLE: { @@ -421,9 +426,12 @@ void XclImpSupbookTab::LoadCachedValues(ScExternalRefCache::TableTypeRef pCacheT pCacheTable->setCell(rAddr.mnCol, rAddr.mnRow, pToken); } break; - case EXC_CACHEDVAL_EMPTY: - break; case EXC_CACHEDVAL_ERROR: + { + double fError = XclTools::ErrorToDouble( p->GetXclError() ); + ScExternalRefCache::TokenRef pToken(new formula::FormulaDoubleToken(fError)); + pCacheTable->setCell(rAddr.mnCol, rAddr.mnRow, pToken); + } break; case EXC_CACHEDVAL_STRING: { diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index 4e0ff5079471..1559ef5530f5 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -701,7 +701,6 @@ void XclImpCellAlign::FillToItemSet( SfxItemSet& rItemSet, const XclImpFont* pFo sal_uInt8 nXclRot = (mnOrient == EXC_ORIENT_NONE) ? mnRotation : XclTools::GetXclRotFromOrient( mnOrient ); bool bStacked = (nXclRot == EXC_ROT_STACKED); ScfTools::PutItem( rItemSet, SfxBoolItem( ATTR_STACKED, bStacked ), bSkipPoolDefs ); - ScfTools::PutItem( rItemSet, SvxRotateModeItem( SVX_ROTATE_MODE_STANDARD, ATTR_ROTATE_MODE ), bSkipPoolDefs ); // set an angle in the range from -90 to 90 degrees sal_Int32 nAngle = XclTools::GetScRotation( nXclRot, 0 ); ScfTools::PutItem( rItemSet, SfxInt32Item( ATTR_ROTATE_VALUE, nAngle ), bSkipPoolDefs ); @@ -799,6 +798,15 @@ void XclImpCellBorder::FillFromCF8( sal_uInt16 nLineStyle, sal_uInt32 nLineColor mbDiagUsed = false; } +bool XclImpCellBorder::HasAnyOuterBorder() const +{ + return + (mbLeftUsed && (mnLeftLine != EXC_LINE_NONE)) || + (mbRightUsed && (mnRightLine != EXC_LINE_NONE)) || + (mbTopUsed && (mnTopLine != EXC_LINE_NONE)) || + (mbBottomUsed && (mnBottomLine != EXC_LINE_NONE)); +} + namespace { /** Converts the passed line style to a SvxBorderLine, or returns false, if style is "no line". */ @@ -1091,13 +1099,32 @@ const ScPatternAttr& XclImpXF::CreatePattern( bool bSkipPoolDefs ) // create new pattern attribute set mpPattern.reset( new ScPatternAttr( GetDoc().GetPool() ) ); SfxItemSet& rItemSet = mpPattern->GetItemSet(); + XclImpXF* pParentXF = IsCellXF() ? GetXFBuffer().GetXF( mnParent ) : 0; // parent cell style if( IsCellXF() && !mpStyleSheet ) { mpStyleSheet = GetXFBuffer().CreateStyleSheet( mnParent ); - if( XclImpXF* pParentXF = GetXFBuffer().GetXF( mnParent ) ) - UpdateUsedFlags( *pParentXF ); + + /* Enables mb***Used flags, if the formatting attributes differ from + the passed XF record. In cell XFs Excel uses the cell attributes, + if they differ from the parent style XF. + #109899# ...or if the respective flag is not set in parent style XF. */ + if( pParentXF ) + { + if( !mbProtUsed ) + mbProtUsed = !pParentXF->mbProtUsed || !(maProtection == pParentXF->maProtection); + if( !mbFontUsed ) + mbFontUsed = !pParentXF->mbFontUsed || (mnXclFont != pParentXF->mnXclFont); + if( !mbFmtUsed ) + mbFmtUsed = !pParentXF->mbFmtUsed || (mnXclNumFmt != pParentXF->mnXclNumFmt); + if( !mbAlignUsed ) + mbAlignUsed = !pParentXF->mbAlignUsed || !(maAlignment == pParentXF->maAlignment); + if( !mbBorderUsed ) + mbBorderUsed = !pParentXF->mbBorderUsed || !(maBorder == pParentXF->maBorder); + if( !mbAreaUsed ) + mbAreaUsed = !pParentXF->mbAreaUsed || !(maArea == pParentXF->maArea); + } } // cell protection @@ -1137,6 +1164,20 @@ const ScPatternAttr& XclImpXF::CreatePattern( bool bSkipPoolDefs ) maArea.mnPattern != EXC_PATT_SOLID); } + /* #i38709# Decide which rotation reference mode to use. If any outer + border line of the cell is set (either explicitly or via cell style), + and the cell contents are rotated, set rotation reference to bottom of + cell. This causes the borders to be painted rotated with the text. */ + if( mbAlignUsed || mbBorderUsed ) + { + SvxRotateMode eRotateMode = SVX_ROTATE_MODE_STANDARD; + const XclImpCellAlign* pAlign = mbAlignUsed ? &maAlignment : (pParentXF ? &pParentXF->maAlignment : 0); + const XclImpCellBorder* pBorder = mbBorderUsed ? &maBorder : (pParentXF ? &pParentXF->maBorder : 0); + if( pAlign && pBorder && (0 < pAlign->mnRotation) && (pAlign->mnRotation <= 180) && pBorder->HasAnyOuterBorder() ) + eRotateMode = SVX_ROTATE_MODE_BOTTOM; + ScfTools::PutItem( rItemSet, SvxRotateModeItem( eRotateMode, ATTR_ROTATE_MODE ), bSkipPoolDefs ); + } + return *mpPattern; } @@ -1180,26 +1221,6 @@ void XclImpXF::SetUsedFlags( sal_uInt8 nUsedFlags ) mbAreaUsed = (mbCellXF == ::get_flag( nUsedFlags, EXC_XF_DIFF_AREA )); } -void XclImpXF::UpdateUsedFlags( const XclImpXF& rParentXF ) -{ - /* Enables mb***Used flags, if the formatting attributes differ from - the passed XF record. In cell XFs Excel uses the cell attributes, - if they differ from the parent style XF. - #109899# ...or if the respective flag is not set in parent style XF. */ - if( !mbProtUsed ) - mbProtUsed = !rParentXF.mbProtUsed || !(maProtection == rParentXF.maProtection); - if( !mbFontUsed ) - mbFontUsed = !rParentXF.mbFontUsed || (mnXclFont != rParentXF.mnXclFont); - if( !mbFmtUsed ) - mbFmtUsed = !rParentXF.mbFmtUsed || (mnXclNumFmt != rParentXF.mnXclNumFmt); - if( !mbAlignUsed ) - mbAlignUsed = !rParentXF.mbAlignUsed || !(maAlignment == rParentXF.maAlignment); - if( !mbBorderUsed ) - mbBorderUsed = !rParentXF.mbBorderUsed || !(maBorder == rParentXF.maBorder); - if( !mbAreaUsed ) - mbAreaUsed = !rParentXF.mbAreaUsed || !(maArea == rParentXF.maArea); -} - // ---------------------------------------------------------------------------- XclImpStyle::XclImpStyle( const XclImpRoot& rRoot ) : diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx index c46df189ab74..d613f1279242 100644 --- a/sc/source/filter/excel/xlformula.cxx +++ b/sc/source/filter/excel/xlformula.cxx @@ -68,22 +68,28 @@ const sal_uInt8 A = EXC_TOKCLASS_ARR; #define VR_E { EXC_PARAM_EXCELONLY, EXC_PARAMCONV_RPT, true } #define C { EXC_PARAM_CALCONLY, EXC_PARAMCONV_ORG, false } +const sal_uInt16 NOID = SAL_MAX_UINT16; /// No BIFF/OOBIN function identifier available. +const sal_uInt8 MX = 30; /// Maximum parameter count. + +#define EXC_FUNCNAME( ascii ) "_xlfn." ascii +#define EXC_FUNCNAME_ODF( ascii ) "_xlfnodf." ascii + /** Functions new in BIFF2. */ static const XclFunctionInfo saFuncTable_2[] = { - { ocCount, 0, 0, 30, V, { RX }, 0, 0 }, + { ocCount, 0, 0, MX, 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 }, + { ocSum, 4, 0, MX, V, { RX }, 0, 0 }, + { ocAverage, 5, 1, MX, V, { RX }, 0, 0 }, + { ocMin, 6, 1, MX, V, { RX }, 0, 0 }, + { ocMax, 7, 1, MX, 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, { VR, RX }, 0, 0 }, - { ocStDev, 12, 1, 30, V, { RX }, 0, 0 }, + { ocNPV, 11, 2, MX, V, { VR, RX }, 0, 0 }, + { ocStDev, 12, 1, MX, 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 }, @@ -109,8 +115,8 @@ static const XclFunctionInfo saFuncTable_2[] = { 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, { RX }, 0, 0 }, - { ocOr, 37, 1, 30, V, { RX }, 0, 0 }, + { ocAnd, 36, 1, MX, V, { RX }, 0, 0 }, + { ocOr, 37, 1, MX, 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 }, @@ -119,7 +125,7 @@ static const XclFunctionInfo saFuncTable_2[] = { 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 }, + { ocVar, 46, 1, MX, 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 }, @@ -155,7 +161,7 @@ static const XclFunctionInfo saFuncTable_2[] = { 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 }, + { ocChose, 100, 2, MX, 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 }, @@ -191,13 +197,13 @@ static const XclFunctionInfo saFuncTable_2[] = { 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 }, + { ocCount2, 169, 0, MX, V, { RX }, 0, 0 }, + { ocProduct, 183, 0, MX, 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 }, + { ocStDevP, 193, 1, MX, V, { RX }, 0, 0 }, + { ocVarP, 194, 1, MX, 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 }, @@ -206,7 +212,7 @@ static const XclFunctionInfo saFuncTable_2[] = { 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 } + { ocExternal, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_IMPORTONLY, 0 } }; /** Functions new in BIFF3. */ @@ -221,8 +227,8 @@ static const XclFunctionInfo saFuncTable_3[] = { ocGetDiffDate360, 220, 2, 2, V, { VR, VR, C }, 0, 0 }, { ocGetActDate, 221, 0, 0, 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 }, + { ocMedian, 227, 1, MX, V, { RX }, 0, 0 }, + { ocSumProduct, 228, 1, MX, 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 }, @@ -245,7 +251,7 @@ static const XclFunctionInfo saFuncTable_4[] = { 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 }, + { ocAveDev, 269, 1, MX, 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 }, @@ -294,19 +300,19 @@ static const XclFunctionInfo saFuncTable_4[] = { 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 }, + { ocDevSq, 318, 1, MX, V, { RX }, 0, 0 }, + { ocGeoMean, 319, 1, MX, V, { RX }, 0, 0 }, + { ocHarMean, 320, 1, MX, V, { RX }, 0, 0 }, + { ocSumSQ, 321, 0, MX, V, { RX }, 0, 0 }, + { ocKurt, 322, 1, MX, V, { RX }, 0, 0 }, + { ocSchiefe, 323, 1, MX, 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 }, + { ocModalValue, 330, 1, MX, V, { VA }, 0, 0 }, { ocTrimMean, 331, 2, 2, V, { RX, VR }, 0, 0 }, { ocTInv, 332, 2, 2, V, { VR }, 0, 0 } }; @@ -318,13 +324,13 @@ static const XclFunctionInfo saFuncTable_5[] = { 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 }, + { ocMacro, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, 0 }, + { ocExternal, 255, 1, MX, R, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY, 0 }, + { ocConcat, 336, 0, MX, 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 }, + { ocSubTotal, 344, 2, MX, 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 }, @@ -335,66 +341,90 @@ static const XclFunctionInfo saFuncTable_5[] = { ocRoman, 354, 1, 2, V, { VR }, 0, 0 } }; -#define EXC_FUNCNAME_PREFIX "_xlfn." - -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, { RR, RR, VR }, 0, 0 }, + { ocGetPivotData, 358, 2, MX, 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 }, + { ocAverageA, 361, 1, MX, V, { RX }, 0, 0 }, + { ocMaxA, 362, 1, MX, V, { RX }, 0, 0 }, + { ocMinA, 363, 1, MX, V, { RX }, 0, 0 }, + { ocStDevPA, 364, 1, MX, V, { RX }, 0, 0 }, + { ocVarPA, 365, 1, MX, V, { RX }, 0, 0 }, + { ocStDevA, 366, 1, MX, V, { RX }, 0, 0 }, + { ocVarA, 367, 1, MX, 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" } }; +#define EXC_FUNCENTRY_ODF( opcode, minparam, maxparam, flags, asciiname ) \ + { opcode, NOID, minparam, maxparam, V, { VR }, EXC_FUNCFLAG_IMPORTONLY|(flags), EXC_FUNCNAME_ODF( asciiname ) }, \ + { opcode, 255, (minparam)+1, (maxparam)+1, V, { RO_E, RO }, EXC_FUNCFLAG_EXPORTONLY|(flags), EXC_FUNCNAME_ODF( asciiname ) } + +/** Functions defined by OpenFormula, but not supported by Calc (ocNoName) or by Excel (defined op-code). */ +static const XclFunctionInfo saFuncTable_Odf[] = +{ + EXC_FUNCENTRY_ODF( ocArabic, 1, 1, 0, "ARABIC" ), + EXC_FUNCENTRY_ODF( ocB, 3, 4, 0, "B" ), + EXC_FUNCENTRY_ODF( ocBase, 2, 3, 0, "BASE" ), + EXC_FUNCENTRY_ODF( ocNoName, 2, 2, 0, "BITAND" ), + EXC_FUNCENTRY_ODF( ocNoName, 2, 2, 0, "BITLSHIFT" ), + EXC_FUNCENTRY_ODF( ocNoName, 2, 2, 0, "BITOR" ), + EXC_FUNCENTRY_ODF( ocNoName, 2, 2, 0, "BITRSHIFT" ), + EXC_FUNCENTRY_ODF( ocNoName, 2, 2, 0, "BITXOR" ), + EXC_FUNCENTRY_ODF( ocChiSqDist, 2, 3, 0, "CHISQDIST" ), + EXC_FUNCENTRY_ODF( ocChiSqInv, 2, 2, 0, "CHISQINV" ), + EXC_FUNCENTRY_ODF( ocKombin2, 2, 2, 0, "COMBINA" ), + EXC_FUNCENTRY_ODF( ocGetDiffDate, 2, 2, 0, "DAYS" ), + EXC_FUNCENTRY_ODF( ocDecimal, 2, 2, 0, "DECIMAL" ), + EXC_FUNCENTRY_ODF( ocFDist, 3, 4, 0, "FDIST" ), + EXC_FUNCENTRY_ODF( ocFInv, 3, 3, 0, "FINV" ), + EXC_FUNCENTRY_ODF( ocFormula, 1, 1, 0, "FORMULA" ), + EXC_FUNCENTRY_ODF( ocGamma, 1, 1, 0, "GAMMA" ), + EXC_FUNCENTRY_ODF( ocGauss, 1, 1, 0, "GAUSS" ), + EXC_FUNCENTRY_ODF( ocNoName, 2, 2, 0, "IFNA" ), + EXC_FUNCENTRY_ODF( ocIsFormula, 1, 1, 0, "ISFORMULA" ), + EXC_FUNCENTRY_ODF( ocWeek, 1, 2, 0, "ISOWEEKNUM" ), + EXC_FUNCENTRY_ODF( ocMatrixUnit, 1, 1, 0, "MUNIT" ), + EXC_FUNCENTRY_ODF( ocNumberValue, 2, 2, 0, "NUMBERVALUE" ), + EXC_FUNCENTRY_ODF( ocLaufz, 3, 3, 0, "PDURATION" ), + EXC_FUNCENTRY_ODF( ocVariationen2, 2, 2, 0, "PERMUTATIONA" ), + EXC_FUNCENTRY_ODF( ocPhi, 1, 1, 0, "PHI" ), + EXC_FUNCENTRY_ODF( ocZGZ, 3, 3, 0, "RRI" ), + EXC_FUNCENTRY_ODF( ocTable, 1, 1, 0, "SHEET" ), + EXC_FUNCENTRY_ODF( ocTables, 0, 1, 0, "SHEETS" ), + EXC_FUNCENTRY_ODF( ocNoName, 1, MX, 0, "SKEWP" ), + EXC_FUNCENTRY_ODF( ocUnichar, 1, 1, 0, "UNICHAR" ), + EXC_FUNCENTRY_ODF( ocUnicode, 1, 1, 0, "UNICODE" ), + EXC_FUNCENTRY_ODF( ocNoName, 1, MX, 0, "XOR" ) +}; + +#undef EXC_FUNCENTRY_ODF + // ---------------------------------------------------------------------------- XclFunctionProvider::XclFunctionProvider( const XclRoot& rRoot ) { - XclBiff eBiff = rRoot.GetBiff(); + void (XclFunctionProvider::*pFillFunc)( const XclFunctionInfo*, const XclFunctionInfo* ) = + rRoot.IsImport() ? &XclFunctionProvider::FillXclFuncMap : &XclFunctionProvider::FillScFuncMap; - if( rRoot.IsImport() ) - { - /* Import: only read functions supported in the current BIFF version. - Function tables from later BIFF versions may overwrite single - functions from earlier tables. */ - if( eBiff >= EXC_BIFF2 ) - FillXclFuncMap( saFuncTable_2, STATIC_TABLE_END( saFuncTable_2 ) ); - if( eBiff >= EXC_BIFF3 ) - FillXclFuncMap( saFuncTable_3, STATIC_TABLE_END( saFuncTable_3 ) ); - if( eBiff >= EXC_BIFF4 ) - FillXclFuncMap( saFuncTable_4, STATIC_TABLE_END( saFuncTable_4 ) ); - if( eBiff >= EXC_BIFF5 ) - FillXclFuncMap( saFuncTable_5, STATIC_TABLE_END( saFuncTable_5 ) ); - if( eBiff >= EXC_BIFF8 ) - FillXclFuncMap( saFuncTable_8, STATIC_TABLE_END( saFuncTable_8 ) ); - } - else - { - /* Export: only write functions supported in the current BIFF version. - Function tables from later BIFF versions may overwrite single - functions from earlier tables. */ - if( eBiff >= EXC_BIFF2 ) - FillScFuncMap( saFuncTable_2, STATIC_TABLE_END( saFuncTable_2 ) ); - if( eBiff >= EXC_BIFF3 ) - FillScFuncMap( saFuncTable_3, STATIC_TABLE_END( saFuncTable_3 ) ); - if( eBiff >= EXC_BIFF4 ) - FillScFuncMap( saFuncTable_4, STATIC_TABLE_END( saFuncTable_4 ) ); - if( eBiff >= EXC_BIFF5 ) - FillScFuncMap( saFuncTable_5, STATIC_TABLE_END( saFuncTable_5 ) ); - if( eBiff >= EXC_BIFF8 ) - FillScFuncMap( saFuncTable_8, STATIC_TABLE_END( saFuncTable_8 ) ); - } + /* Only read/write functions supported in the current BIFF version. + Function tables from later BIFF versions may overwrite single functions + from earlier tables. */ + XclBiff eBiff = rRoot.GetBiff(); + if( eBiff >= EXC_BIFF2 ) + (this->*pFillFunc)( saFuncTable_2, STATIC_TABLE_END( saFuncTable_2 ) ); + if( eBiff >= EXC_BIFF3 ) + (this->*pFillFunc)( saFuncTable_3, STATIC_TABLE_END( saFuncTable_3 ) ); + if( eBiff >= EXC_BIFF4 ) + (this->*pFillFunc)( saFuncTable_4, STATIC_TABLE_END( saFuncTable_4 ) ); + if( eBiff >= EXC_BIFF5 ) + (this->*pFillFunc)( saFuncTable_5, STATIC_TABLE_END( saFuncTable_5 ) ); + if( eBiff >= EXC_BIFF8 ) + (this->*pFillFunc)( saFuncTable_8, STATIC_TABLE_END( saFuncTable_8 ) ); + (this->*pFillFunc)( saFuncTable_Odf, STATIC_TABLE_END( saFuncTable_Odf ) ); } const XclFunctionInfo* XclFunctionProvider::GetFuncInfoFromXclFunc( sal_uInt16 nXclFunc ) const diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx index 926eb3e54fdc..90393ae6a787 100644 --- a/sc/source/filter/excel/xltools.cxx +++ b/sc/source/filter/excel/xltools.cxx @@ -113,7 +113,12 @@ const XclGuid XclTools::maGuidFileMoniker( double XclTools::GetDoubleFromRK( sal_Int32 nRKValue ) { - double fVal = 0.0; + union + { + double fVal; + sal_math_Double smD; + }; + fVal = 0.0; if( ::get_flag( nRKValue, EXC_RK_INTFLAG ) ) { @@ -123,8 +128,7 @@ double XclTools::GetDoubleFromRK( sal_Int32 nRKValue ) } else { - sal_math_Double* pDouble = reinterpret_cast< sal_math_Double* >( &fVal ); - pDouble->w32_parts.msw = nRKValue & EXC_RK_VALUEMASK; + smD.w32_parts.msw = nRKValue & EXC_RK_VALUEMASK; } if( ::get_flag( nRKValue, EXC_RK_100FLAG ) ) @@ -161,50 +165,6 @@ bool XclTools::GetRKFromDouble( sal_Int32& rnRKValue, double fValue ) return false; } - -sal_uInt8 XclTools::GetXclErrorCode( USHORT nScError ) -{ - using namespace ScErrorCodes; - switch( nScError ) - { - case errIllegalArgument: return EXC_ERR_VALUE; - case errIllegalFPOperation: return EXC_ERR_NUM; // maybe DIV/0 or NUM... - case errDivisionByZero: return EXC_ERR_DIV0; - case errIllegalParameter: return EXC_ERR_VALUE; - case errPairExpected: return EXC_ERR_VALUE; - case errOperatorExpected: return EXC_ERR_VALUE; - case errVariableExpected: return EXC_ERR_VALUE; - case errParameterExpected: return EXC_ERR_VALUE; - case errNoValue: return EXC_ERR_VALUE; - case errCircularReference: return EXC_ERR_VALUE; - case errNoCode: return EXC_ERR_NULL; - case errNoRef: return EXC_ERR_REF; - case errNoName: return EXC_ERR_NAME; - case errNoAddin: return EXC_ERR_NAME; - case errNoMacro: return EXC_ERR_NAME; - case NOTAVAILABLE: return EXC_ERR_NA; - } - return EXC_ERR_NA; -} - -USHORT XclTools::GetScErrorCode( sal_uInt8 nXclError ) -{ - using namespace ScErrorCodes; - switch( nXclError ) - { - case EXC_ERR_NULL: return errNoCode; - case EXC_ERR_DIV0: return errDivisionByZero; - case EXC_ERR_VALUE: return errNoValue; - case EXC_ERR_REF: return errNoRef; - case EXC_ERR_NAME: return errNoName; - case EXC_ERR_NUM: return errIllegalFPOperation; - case EXC_ERR_NA: return NOTAVAILABLE; - default: DBG_ERRORFILE( "XclTools::GetScErrorCode - unknown error code" ); - } - return NOTAVAILABLE; -} - - sal_Int32 XclTools::GetScRotation( sal_uInt16 nXclRot, sal_Int32 nRotForStacked ) { if( nXclRot == EXC_ROT_STACKED ) @@ -252,6 +212,59 @@ sal_uInt8 XclTools::GetXclOrientFromRot( sal_uInt16 nXclRot ) return EXC_ORIENT_NONE; } +sal_uInt8 XclTools::GetXclErrorCode( USHORT nScError ) +{ + using namespace ScErrorCodes; + switch( nScError ) + { + case errIllegalArgument: return EXC_ERR_VALUE; + case errIllegalFPOperation: return EXC_ERR_NUM; // maybe DIV/0 or NUM... + case errDivisionByZero: return EXC_ERR_DIV0; + case errIllegalParameter: return EXC_ERR_VALUE; + case errPairExpected: return EXC_ERR_VALUE; + case errOperatorExpected: return EXC_ERR_VALUE; + case errVariableExpected: return EXC_ERR_VALUE; + case errParameterExpected: return EXC_ERR_VALUE; + case errNoValue: return EXC_ERR_VALUE; + case errCircularReference: return EXC_ERR_VALUE; + case errNoCode: return EXC_ERR_NULL; + case errNoRef: return EXC_ERR_REF; + case errNoName: return EXC_ERR_NAME; + case errNoAddin: return EXC_ERR_NAME; + case errNoMacro: return EXC_ERR_NAME; + case NOTAVAILABLE: return EXC_ERR_NA; + } + return EXC_ERR_NA; +} + +USHORT XclTools::GetScErrorCode( sal_uInt8 nXclError ) +{ + using namespace ScErrorCodes; + switch( nXclError ) + { + case EXC_ERR_NULL: return errNoCode; + case EXC_ERR_DIV0: return errDivisionByZero; + case EXC_ERR_VALUE: return errNoValue; + case EXC_ERR_REF: return errNoRef; + case EXC_ERR_NAME: return errNoName; + case EXC_ERR_NUM: return errIllegalFPOperation; + case EXC_ERR_NA: return NOTAVAILABLE; + default: DBG_ERRORFILE( "XclTools::GetScErrorCode - unknown error code" ); + } + return NOTAVAILABLE; +} + +double XclTools::ErrorToDouble( sal_uInt8 nXclError ) +{ + union + { + double fVal; + sal_math_Double smD; + }; + ::rtl::math::setNan( &fVal ); + smD.nan_parts.fraction_lo = GetScErrorCode( nXclError ); + return fVal; +} XclBoolError XclTools::ErrorToEnum( double& rfDblValue, sal_uInt8 bErrOrBool, sal_uInt8 nValue ) { @@ -281,7 +294,6 @@ XclBoolError XclTools::ErrorToEnum( double& rfDblValue, sal_uInt8 bErrOrBool, sa return eType; } - sal_uInt16 XclTools::GetTwipsFromInch( double fInches ) { return static_cast< sal_uInt16 >( diff --git a/sc/source/filter/inc/xihelper.hxx b/sc/source/filter/inc/xihelper.hxx index 9a836c8844db..05412c306c0c 100644 --- a/sc/source/filter/inc/xihelper.hxx +++ b/sc/source/filter/inc/xihelper.hxx @@ -320,13 +320,15 @@ public: /** Returns the type of the cached value (EXC_CACHEDVAL_*). */ inline sal_uInt8 GetType() const { return mnType; } /** Returns the cached string value, if this value is a string, else an empty string. */ - inline const String& GetString() const { return mxStr.get() ? *mxStr : EMPTY_STRING; } + inline const String& GetString() const { return mxStr.get() ? *mxStr : EMPTY_STRING; } /** Returns the cached number, if this value has number type, else 0.0. */ inline double GetValue() const { return mfValue; } /** Returns the cached Boolean value, if this value has Boolean type, else false. */ inline bool GetBool() const { return (mnType == EXC_CACHEDVAL_BOOL) && (mnBoolErr != 0); } /** Returns the cached Calc error code, if this value has Error type, else 0. */ - USHORT GetError() const; + inline sal_uInt8 GetXclError() const { return (mnType == EXC_CACHEDVAL_ERROR) ? mnBoolErr : EXC_ERR_NA; } + /** Returns the cached Calc error code, if this value has Error type, else 0. */ + USHORT GetScError() const; /** Returns the token array if this is a Boolean value or error value, else 0. */ inline const ScTokenArray* GetBoolErrFmla() const { return mxTokArr.get(); } diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx index 4a347062905c..104002542a17 100644 --- a/sc/source/filter/inc/xistyle.hxx +++ b/sc/source/filter/inc/xistyle.hxx @@ -316,6 +316,9 @@ struct XclImpCellBorder : public XclCellBorder /** Fills this struct with BIFF8 CF (conditional format) record data. */ void FillFromCF8( sal_uInt16 nLineStyle, sal_uInt32 nLineColor, sal_uInt32 nFlags ); + /** Returns true, if any of the outer border lines is visible. */ + bool HasAnyOuterBorder() const; + /** Inserts a box item representing this border style into the item set. @param bSkipPoolDefs true = Do not put items equal to pool default; false = Put all items. */ void FillToItemSet( @@ -423,8 +426,6 @@ private: @descr In cell XFs, a set bit represents "used", in style XFs it is a cleared bit. Therefore mbCellXF must be set correctly before calling this method. */ void SetUsedFlags( sal_uInt8 nUsedFlags ); - /** Sets own "attribute used" flags, if attributes are different from passed parent XF. */ - void UpdateUsedFlags( const XclImpXF& rParentXF ); private: typedef ::std::auto_ptr< ScPatternAttr > ScPatternAttrPtr; diff --git a/sc/source/filter/inc/xltools.hxx b/sc/source/filter/inc/xltools.hxx index b2519a51d156..e8ceed8248d6 100644 --- a/sc/source/filter/inc/xltools.hxx +++ b/sc/source/filter/inc/xltools.hxx @@ -121,6 +121,8 @@ public: /** Converts an Excel error code to a Calc error code. */ static USHORT GetScErrorCode( sal_uInt8 nXclError ); + /** Converts the passed BIFF error to a double containing the respective Calc error code. */ + static double ErrorToDouble( sal_uInt8 nXclError ); /** Gets a translated error code or Boolean value from Excel error codes. @param rfDblValue Returns 0.0 for error codes or the value of a Boolean (0.0 or 1.0). @param bErrorOrBool false = nError is a Boolean value; true = is an error value. diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 5ea8c4d78e0f..f6fc2cb27b71 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -768,8 +768,9 @@ __EXPORT ScTextWnd::~ScTextWnd() { delete pEditView; delete pEditEngine; - for( AccTextDataVector::reverse_iterator aIt = maAccTextDatas.rbegin(), aEnd = maAccTextDatas.rend(); aIt != aEnd; ++aIt ) - (*aIt)->Dispose(); + while (!maAccTextDatas.empty()) { + maAccTextDatas.back()->Dispose(); + } } void __EXPORT ScTextWnd::Paint( const Rectangle& rRec ) diff --git a/sc/source/ui/dbgui/pvfundlg.src b/sc/source/ui/dbgui/pvfundlg.src index 70bce3ed30e9..ed00f6a65fa5 100644 --- a/sc/source/ui/dbgui/pvfundlg.src +++ b/sc/source/ui/dbgui/pvfundlg.src @@ -227,8 +227,8 @@ ModalDialog RID_SCDLG_PIVOTSUBT }; CheckBox CB_SHOWALL { - Pos = MAP_APPFONT ( 12 , 127 ) ; - Size = MAP_APPFONT ( 140 , 10 ) ; + Pos = MAP_APPFONT ( 6 , 127 ) ; + Size = MAP_APPFONT ( 152 , 10 ) ; Text [ en-US ] = "Show it~ems without data"; TabStop = TRUE ; }; diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 2053cebc8ce5..9895f0f43610 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -593,7 +593,7 @@ BOOL ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam, if (pDestData) pNewData = pDestData; // Bereich vorhanden -> anpassen else // Bereich ab Cursor/Markierung wird angelegt - pNewData = rDocShell.GetDBData(aDestPos, SC_DB_MAKE, TRUE ); + pNewData = rDocShell.GetDBData(aDestPos, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); if (pNewData) { pNewData->SetArea( nTab, @@ -920,7 +920,7 @@ BOOL ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam, pNewData = rDocShell.GetDBData( ScRange( aLocalParam.nCol1, aLocalParam.nRow1, nDestTab, aLocalParam.nCol2, aLocalParam.nRow2, nDestTab ), - SC_DB_MAKE, TRUE ); + SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); if (pNewData) { diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index be856ec9240b..a073e50d105c 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -189,7 +189,7 @@ BOOL ScDBDocFunc::DoImportUno( const ScAddress& rPos, // create database range //! merge this with SID_SBA_IMPORT execute in docsh4.cxx - ScDBData* pDBData = rDocShell.GetDBData( ScRange(rPos), SC_DB_IMPORT, FALSE ); + ScDBData* pDBData = rDocShell.GetDBData( ScRange(rPos), SC_DB_IMPORT, SC_DBSEL_KEEP ); DBG_ASSERT(pDBData, "can't create DB data"); String sTarget = pDBData->GetName(); diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 7ff714c2cbdd..4709a065792f 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -1088,6 +1088,16 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck { aSourceRange = pDel->GetOverAllRange().MakeRange(); GetDocFunc().DeleteCells( aSourceRange, NULL, DEL_DELROWS, TRUE, FALSE ); + + // #i101099# [Collaboration] Changes are not correctly shown + if ( bShared ) + { + ScChangeAction* pAct = pThisTrack->GetLast(); + if ( pAct && pAct->GetType() == eSourceType && pAct->IsDeletedIn() && !pSourceAction->IsDeletedIn() ) + { + pAct->RemoveAllDeletedIn(); + } + } } } break; diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 26d61a82c6be..157b98497e83 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -264,7 +264,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) GetUndoManager()->EnterListAction( aStrImport, aStrImport ); } - ScDBData* pDBData = GetDBData( ScRange(aPos), SC_DB_IMPORT, FALSE ); + ScDBData* pDBData = GetDBData( ScRange(aPos), SC_DB_IMPORT, SC_DBSEL_KEEP ); DBG_ASSERT(pDBData, "kann DB-Daten nicht anlegen"); sTarget = pDBData->GetName(); } diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index 6fa6a5ac7863..1bbf9437bc1c 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -148,7 +148,7 @@ ScDBData* lcl_GetDBNearCursor( ScDBCollection* pColl, SCCOL nCol, SCROW nRow, SC return pNoNameData; // "unbenannt" nur zurueck, wenn sonst nichts gefunden } -ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, BOOL bForceMark ) +ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel ) { SCCOL nCol = rMarked.aStart.Col(); SCROW nRow = rMarked.aStart.Row(); @@ -169,7 +169,9 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, BOOL if (!pData) pData = lcl_GetDBNearCursor( aDocument.GetDBCollection(), nCol, nRow, nTab ); - BOOL bSelected = ( bForceMark || rMarked.aStart != rMarked.aEnd ); + BOOL bSelected = ( eSel == SC_DBSEL_FORCE_MARK || + (rMarked.aStart != rMarked.aEnd && eSel != SC_DBSEL_ROW_DOWN) ); + bool bOnlyDown = (!bSelected && eSel == SC_DBSEL_ROW_DOWN && rMarked.aStart.Row() == rMarked.aEnd.Row()); BOOL bUseThis = FALSE; if (pData) @@ -189,12 +191,21 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, BOOL bUseThis = TRUE; if ( bIsNoName && eMode == SC_DB_MAKE ) { - // wenn nichts markiert, "unbenannt" auf zusammenhaengenden Bereich anpassen + // If nothing marked or only one row marked, adapt + // "unbenannt"/"unnamed" to contiguous area. nStartCol = nCol; nStartRow = nRow; - nEndCol = nStartCol; - nEndRow = nStartRow; - aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE ); + if (bOnlyDown) + { + nEndCol = rMarked.aEnd.Col(); + nEndRow = rMarked.aEnd.Row(); + } + else + { + nEndCol = nStartCol; + nEndRow = nStartRow; + } + aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE, bOnlyDown ); if ( nOldCol1 != nStartCol || nOldCol2 != nEndCol || nOldRow1 != nStartRow ) bUseThis = FALSE; // passt gar nicht else if ( nOldRow2 != nEndRow ) @@ -242,9 +253,17 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, BOOL { // zusammenhaengender Bereich nStartCol = nCol; nStartRow = nRow; - nEndCol = nStartCol; - nEndRow = nStartRow; - aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE ); + if (bOnlyDown) + { + nEndCol = rMarked.aEnd.Col(); + nEndRow = rMarked.aEnd.Row(); + } + else + { + nEndCol = nStartCol; + nEndRow = nStartRow; + } + aDocument.GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE, bOnlyDown ); } BOOL bHasHeader = aDocument.HasColHeader( nStartCol,nStartRow, nEndCol,nEndRow, nTab ); diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 836d6cdf98e6..e7b04afa9c4f 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -238,6 +238,26 @@ void ScExternalRefCache::Table::getAllRows(vector<SCROW>& rRows) const rRows.swap(aRows); } +::std::pair< SCROW, SCROW > ScExternalRefCache::Table::getRowRange() const +{ + ::std::pair< SCROW, SCROW > aRange( 0, 0 ); + if( !maRows.empty() ) + { + // iterate over entire container (hash map is not sorted by key) + RowsDataType::const_iterator itr = maRows.begin(), itrEnd = maRows.end(); + aRange.first = itr->first; + aRange.second = itr->first + 1; + while( ++itr != itrEnd ) + { + if( itr->first < aRange.first ) + aRange.first = itr->first; + else if( itr->first >= aRange.second ) + aRange.second = itr->first + 1; + } + } + return aRange; +} + void ScExternalRefCache::Table::getAllCols(SCROW nRow, vector<SCCOL>& rCols) const { RowsDataType::const_iterator itrRow = maRows.find(nRow); @@ -257,6 +277,33 @@ void ScExternalRefCache::Table::getAllCols(SCROW nRow, vector<SCCOL>& rCols) con rCols.swap(aCols); } +::std::pair< SCCOL, SCCOL > ScExternalRefCache::Table::getColRange( SCROW nRow ) const +{ + ::std::pair< SCCOL, SCCOL > aRange( 0, 0 ); + + RowsDataType::const_iterator itrRow = maRows.find( nRow ); + if (itrRow == maRows.end()) + // this table doesn't have the specified row. + return aRange; + + const RowDataType& rRowData = itrRow->second; + if( !rRowData.empty() ) + { + // iterate over entire container (hash map is not sorted by key) + RowDataType::const_iterator itr = rRowData.begin(), itrEnd = rRowData.end(); + aRange.first = itr->first; + aRange.second = itr->first + 1; + while( ++itr != itrEnd ) + { + if( itr->first < aRange.first ) + aRange.first = itr->first; + else if( itr->first >= aRange.second ) + aRange.second = itr->first + 1; + } + } + return aRange; +} + void ScExternalRefCache::Table::getAllNumberFormats(vector<sal_uInt32>& rNumFmts) const { RowsDataType::const_iterator itrRow = maRows.begin(), itrRowEnd = maRows.end(); @@ -1942,6 +1989,9 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri if (aOptions.Len()) pSet->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, aOptions)); + // make medium hidden to prevent assertion from progress bar + pSet->Put( SfxBoolItem( SID_HIDDEN, TRUE ) ); + auto_ptr<SfxMedium> pMedium(new SfxMedium(aFile, STREAM_STD_READ, false, pFilter, pSet)); if (pMedium->GetError() != ERRCODE_NONE) return NULL; diff --git a/sc/source/ui/inc/dbfunc.hxx b/sc/source/ui/inc/dbfunc.hxx index be206b396733..baadae0a64dc 100644 --- a/sc/source/ui/inc/dbfunc.hxx +++ b/sc/source/ui/inc/dbfunc.hxx @@ -77,7 +77,7 @@ public: void GotoDBArea( const String& rDBName ); // DB-Bereich vom Cursor - ScDBData* GetDBData( BOOL bMarkArea = TRUE, ScGetDBMode eMode = SC_DB_MAKE, bool bShrinkToData = false ); + ScDBData* GetDBData( BOOL bMarkArea = TRUE, ScGetDBMode eMode = SC_DB_MAKE, ScGetDBSelection eSel = SC_DBSEL_KEEP ); void NotifyCloseDbNameDlg( const ScDBCollection& rNewColl, const List& rDelAreaList ); diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 88bbeb699539..09d34c661995 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -313,7 +313,7 @@ public: BOOL IsOle(); void DBAreaDeleted( SCTAB nTab, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 ); - ScDBData* GetDBData( const ScRange& rMarked, ScGetDBMode eMode, BOOL bForceMark ); + ScDBData* GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGetDBSelection eSel ); ScDBData* GetOldAutoDBRange(); // has to be deleted by caller! void CancelAutoDBRange(); // called when dialog is cancelled diff --git a/sc/source/ui/miscdlgs/scuiautofmt.cxx b/sc/source/ui/miscdlgs/scuiautofmt.cxx index 79d7c502921f..b2f837db4cb4 100644 --- a/sc/source/ui/miscdlgs/scuiautofmt.cxx +++ b/sc/source/ui/miscdlgs/scuiautofmt.cxx @@ -369,7 +369,7 @@ IMPL_LINK( ScAutoFormatDlg, RenameHdl, void *, EMPTYARG ) aStrRename, aStrLabel, aFormatName, - HID_SC_RENAME_AUTOFMT ); + HID_SC_REN_AFMT_DLG ); if( pDlg->Execute() == RET_OK ) { BOOL bFmtRenamed = FALSE; diff --git a/sc/source/ui/miscdlgs/strindlg.cxx b/sc/source/ui/miscdlgs/strindlg.cxx index aa6db3075b64..b8dc2e13538e 100644 --- a/sc/source/ui/miscdlgs/strindlg.cxx +++ b/sc/source/ui/miscdlgs/strindlg.cxx @@ -72,25 +72,21 @@ ScStringInputDlg::ScStringInputDlg( Window* pParent, // HelpId for Edit different for different uses - DBG_ASSERT( nHelpId == FID_TAB_APPEND || nHelpId == FID_TAB_RENAME || - nHelpId == HID_SC_ADD_AUTOFMT || nHelpId == HID_SC_RENAME_AUTOFMT || - nHelpId == SID_RENAME_OBJECT || - // #i68101# - nHelpId == SID_TITLE_DESCRIPTION_OBJECT, - "unknown ID" ); if ( nHelpId == FID_TAB_APPEND ) aEdInput.SetHelpId( HID_SC_APPEND_NAME ); else if ( nHelpId == FID_TAB_RENAME ) aEdInput.SetHelpId( HID_SC_RENAME_NAME ); else if ( nHelpId == HID_SC_ADD_AUTOFMT ) aEdInput.SetHelpId( HID_SC_AUTOFMT_NAME ); - else if ( nHelpId == HID_SC_RENAME_AUTOFMT ) + else if ( nHelpId == HID_SC_REN_AFMT_DLG ) aEdInput.SetHelpId( HID_SC_REN_AFMT_NAME ); else if ( nHelpId == SID_RENAME_OBJECT ) aEdInput.SetHelpId( HID_SC_RENAME_OBJECT ); // #i68101# else if ( nHelpId == SID_TITLE_DESCRIPTION_OBJECT ) aEdInput.SetHelpId( HID_SC_TITLE_DESCRIPTION_OBJECT ); + else + DBG_ERRORFILE( "unknown ID" ); //------------- FreeResource(); diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src index 139137cd201f..bbf20c436065 100644 --- a/sc/source/ui/src/globstr.src +++ b/sc/source/ui/src/globstr.src @@ -1017,7 +1017,7 @@ Resource RID_GLOBSTR }; String STR_QUERY_DELTAB { - Text [ en-US ] = "Are you sure you want to permanently delete the current sheet(s)?" ; + Text [ en-US ] = "Are you sure you want to delete the selected sheet(s)?" ; }; String STR_QUERY_DELSCENARIO { diff --git a/sc/source/ui/src/miscdlgs.src b/sc/source/ui/src/miscdlgs.src index ef9850f83652..06a19af7a8a7 100644 --- a/sc/source/ui/src/miscdlgs.src +++ b/sc/source/ui/src/miscdlgs.src @@ -228,7 +228,7 @@ ModalDialog RID_SCDLG_DELCONT { Pos = MAP_APPFONT ( 12 , 86 ) ; Size = MAP_APPFONT ( 83 , 10 ) ; - Text [ en-US ] = "Not~es" ; + Text [ en-US ] = "~Comments" ; TabStop = TRUE ; }; CheckBox BTN_DELOBJECTS @@ -321,14 +321,14 @@ ModalDialog RID_SCDLG_INSCONT { Pos = MAP_APPFONT ( 12 , 114 ) ; Size = MAP_APPFONT ( 84 , 10 ) ; - Text [ en-US ] = "O~bjects" ; + Text [ en-US ] = "~Objects" ; TabStop = TRUE ; }; CheckBox BTN_INSNOTES { Pos = MAP_APPFONT ( 12 , 86 ) ; Size = MAP_APPFONT ( 84 , 10 ) ; - Text [ en-US ] = "N~otes" ; + Text [ en-US ] = "~Comments" ; TabStop = TRUE ; }; FixedLine FL_FRAME @@ -353,7 +353,7 @@ ModalDialog RID_SCDLG_INSCONT { Pos = MAP_APPFONT ( 111 , 44 ) ; Size = MAP_APPFONT ( 83 , 10 ) ; - Text [ en-US ] = "S~ubtract" ; + Text [ en-US ] = "~Subtract" ; }; RadioButton BTN_OP_MUL { diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index c61a6443af99..4eddb447e8a9 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -5515,7 +5515,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScCellRangeObj::createSortDescripto if ( pDocSh ) { // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, TRUE ); + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK ); if (pData) { pData->GetSortParam(aParam); @@ -5546,7 +5546,7 @@ void SAL_CALL ScCellRangeObj::sort( const uno::Sequence<beans::PropertyValue>& a { USHORT i; ScSortParam aParam; - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_MAKE, TRUE ); // ggf. Bereich anlegen + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen if (pData) { // alten Einstellungen holen, falls nicht alles neu gesetzt wird @@ -5575,7 +5575,7 @@ void SAL_CALL ScCellRangeObj::sort( const uno::Sequence<beans::PropertyValue>& a aParam.nCol2 = aRange.aEnd.Col(); aParam.nRow2 = aRange.aEnd.Row(); - pDocSh->GetDBData( aRange, SC_DB_MAKE, TRUE ); // ggf. Bereich anlegen + pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen ScDBDocFunc aFunc(*pDocSh); // Bereich muss angelegt sein aFunc.Sort( nTab, aParam, TRUE, TRUE, TRUE ); @@ -5593,7 +5593,7 @@ uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFil if ( !bEmpty && pDocSh ) { // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, TRUE ); + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK ); if (pData) { ScQueryParam aParam; @@ -5675,7 +5675,7 @@ void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDe aParam.nCol2 = aRange.aEnd.Col(); aParam.nRow2 = aRange.aEnd.Row(); - pDocSh->GetDBData( aRange, SC_DB_MAKE, TRUE ); // ggf. Bereich anlegen + pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen //! keep source range in filter descriptor //! if created by createFilterDescriptorByObject ??? @@ -5762,7 +5762,7 @@ uno::Reference<sheet::XSubTotalDescriptor> SAL_CALL ScCellRangeObj::createSubTot if ( !bEmpty && pDocSh ) { // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, TRUE ); + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK ); if (pData) { ScSubTotalParam aParam; @@ -5825,7 +5825,7 @@ void SAL_CALL ScCellRangeObj::applySubTotals( aParam.nCol2 = aRange.aEnd.Col(); aParam.nRow2 = aRange.aEnd.Row(); - pDocSh->GetDBData( aRange, SC_DB_MAKE, TRUE ); // ggf. Bereich anlegen + pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen ScDBDocFunc aFunc(*pDocSh); aFunc.DoSubTotals( nTab, aParam, NULL, TRUE, TRUE ); // Bereich muss angelegt sein @@ -5840,7 +5840,7 @@ void SAL_CALL ScCellRangeObj::removeSubTotals() throw(uno::RuntimeException) if (pDocSh) { ScSubTotalParam aParam; - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, TRUE ); + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK ); if (pData) pData->GetSubTotalParam(aParam); // auch bei Remove die Feld-Eintraege behalten @@ -5852,7 +5852,7 @@ void SAL_CALL ScCellRangeObj::removeSubTotals() throw(uno::RuntimeException) aParam.nCol2 = aRange.aEnd.Col(); aParam.nRow2 = aRange.aEnd.Row(); - pDocSh->GetDBData( aRange, SC_DB_MAKE, TRUE ); // ggf. Bereich anlegen + pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen ScDBDocFunc aFunc(*pDocSh); aFunc.DoSubTotals( nTab, aParam, NULL, TRUE, TRUE ); // Bereich muss angelegt sein @@ -5868,7 +5868,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScCellRangeObj::createImportDescrip if ( !bEmpty && pDocSh ) { // DB-Bereich anlegen erst beim Ausfuehren, per API immer genau den Bereich - ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, TRUE ); + ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_OLD, SC_DBSEL_FORCE_MARK ); if (pData) pData->GetImportParam(aParam); } @@ -5897,7 +5897,7 @@ void SAL_CALL ScCellRangeObj::doImport( const uno::Sequence<beans::PropertyValue //! TODO: could we get passed a valid result set by any means? uno::Reference< sdbc::XResultSet > xResultSet; - pDocSh->GetDBData( aRange, SC_DB_MAKE, TRUE ); // ggf. Bereich anlegen + pDocSh->GetDBData( aRange, SC_DB_MAKE, SC_DBSEL_FORCE_MARK ); // ggf. Bereich anlegen ScDBDocFunc aFunc(*pDocSh); // Bereich muss angelegt sein aFunc.DoImport( nTab, aParam, xResultSet, NULL, TRUE, FALSE ); //! Api-Flag als Parameter diff --git a/sc/source/ui/unoobj/cursuno.cxx b/sc/source/ui/unoobj/cursuno.cxx index 39ed859aa574..daf075964a3a 100644 --- a/sc/source/ui/unoobj/cursuno.cxx +++ b/sc/source/ui/unoobj/cursuno.cxx @@ -133,7 +133,7 @@ void SAL_CALL ScCellCursorObj::collapseToCurrentRegion() throw(uno::RuntimeExcep SCTAB nTab = aOneRange.aStart.Tab(); pDocSh->GetDocument()->GetDataArea( - nTab, nStartCol, nStartRow, nEndCol, nEndRow, TRUE ); + nTab, nStartCol, nStartRow, nEndCol, nEndRow, TRUE, false ); ScRange aNew( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab ); SetNewRange( aNew ); @@ -331,7 +331,7 @@ void SAL_CALL ScCellCursorObj::gotoStart() throw(uno::RuntimeException) SCTAB nTab = aOneRange.aStart.Tab(); pDocSh->GetDocument()->GetDataArea( - nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE ); + nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE, false ); ScRange aNew( nStartCol, nStartRow, nTab ); SetNewRange( aNew ); @@ -359,7 +359,7 @@ void SAL_CALL ScCellCursorObj::gotoEnd() throw(uno::RuntimeException) SCTAB nTab = aOneRange.aStart.Tab(); pDocSh->GetDocument()->GetDataArea( - nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE ); + nTab, nStartCol, nStartRow, nEndCol, nEndRow, FALSE, false ); ScRange aNew( nEndCol, nEndRow, nTab ); SetNewRange( aNew ); diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx index 6d3f10e2ec5e..a461c54f255e 100644 --- a/sc/source/ui/view/cellsh.cxx +++ b/sc/source/ui/view/cellsh.cxx @@ -42,6 +42,7 @@ #include <svx/hlnkitem.hxx> #include <sfx2/app.hxx> #include <sfx2/bindings.hxx> +#include <sfx2/childwin.hxx> #include <sfx2/objface.hxx> #include <sfx2/request.hxx> #include <sfx2/viewfrm.hxx> @@ -970,6 +971,29 @@ void ScCellShell::GetState(SfxItemSet &rSet) } break; + case SID_SPELL_DIALOG: + { + if ( pDoc && pData && pDoc->IsTabProtected( pData->GetTabNo() ) ) + { + bool bVisible = false; + SfxViewFrame* pViewFrame = ( pTabViewShell ? pTabViewShell->GetViewFrame() : NULL ); + if ( pViewFrame && pViewFrame->HasChildWindow( nWhich ) ) + { + SfxChildWindow* pChild = pViewFrame->GetChildWindow( nWhich ); + Window* pWin = ( pChild ? pChild->GetWindow() : NULL ); + if ( pWin && pWin->IsVisible() ) + { + bVisible = true; + } + } + if ( !bVisible ) + { + rSet.DisableItem( nWhich ); + } + } + } + break; + } // switch ( nWitch ) nWhich = aIter.NextWhich(); } // while ( nWitch ) diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index c082c6da375d..086160263739 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -161,7 +161,7 @@ BOOL lcl_GetSortParam( const ScViewData* pData, ScSortParam& rSortParam ) SCCOL nStartCol = aExternalRange.aStart.Col(); SCROW nEndRow = aExternalRange.aEnd.Row(); SCCOL nEndCol = aExternalRange.aEnd.Col(); - pDoc->GetDataArea( aExternalRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow, FALSE ); + pDoc->GetDataArea( aExternalRange.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow, FALSE, false ); aExternalRange.aStart.SetRow( nStartRow ); aExternalRange.aStart.SetCol( nStartCol ); aExternalRange.aEnd.SetRow( nEndRow ); diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index 6f6c7057bddf..ed391f154892 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -244,7 +244,7 @@ void ScCellShell::Execute( SfxRequest& rReq ) { if (nSlot == FID_INPUTLINE_BLOCK) { - pTabViewShell->EnterBlock( String(), pData ); + pTabViewShell->EnterBlock( aString, pData ); } else if ( aString.Len() > 0 && ( aString.GetChar(0) == '=' || aString.GetChar(0) == '+' || aString.GetChar(0) == '-' ) ) { diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index 02dfd77f7460..1e5a6b9da4ae 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -104,7 +104,7 @@ void ScDBFunc::GotoDBArea( const String& rDBName ) // aktuellen Datenbereich fuer Sortieren / Filtern suchen -ScDBData* ScDBFunc::GetDBData( BOOL bMark, ScGetDBMode eMode, bool bShrinkToData ) +ScDBData* ScDBFunc::GetDBData( BOOL bMark, ScGetDBMode eMode, ScGetDBSelection eSel ) { ScDocShell* pDocSh = GetViewData()->GetDocShell(); ScDBData* pData = NULL; @@ -112,27 +112,72 @@ ScDBData* ScDBFunc::GetDBData( BOOL bMark, ScGetDBMode eMode, bool bShrinkToData ScMarkType eMarkType = GetViewData()->GetSimpleArea(aRange); if ( eMarkType == SC_MARK_SIMPLE || eMarkType == SC_MARK_SIMPLE_FILTERED ) { - if (bShrinkToData) + bool bShrinkColumnsOnly = false; + if (eSel == SC_DBSEL_ROW_DOWN) { - // Shrink the range to only include data area. - ScDocument* pDoc = pDocSh->GetDocument(); - SCCOL nCol1 = aRange.aStart.Col(), nCol2 = aRange.aEnd.Col(); - SCROW nRow1 = aRange.aStart.Row(), nRow2 = aRange.aEnd.Row(); - if (pDoc->ShrinkToDataArea(aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2)) + // Don't alter row range, additional rows may have been selected on + // purpose to append data, or to have a fake header row. + bShrinkColumnsOnly = true; + // Select further rows only if only one row or a portion thereof is + // selected. + if (aRange.aStart.Row() != aRange.aEnd.Row()) + { + // If an area is selected shrink that to the actual used + // columns, don't draw filter buttons for empty columns. + eSel = SC_DBSEL_SHRINK_TO_USED_DATA; + } + else if (aRange.aStart.Col() == aRange.aEnd.Col()) { - aRange.aStart.SetCol(nCol1); - aRange.aEnd.SetCol(nCol2); - aRange.aStart.SetRow(nRow1); - aRange.aEnd.SetRow(nRow2); + // One cell only, if it is not marked obtain entire used data + // area. + const ScMarkData& rMarkData = GetViewData()->GetMarkData(); + if (!(rMarkData.IsMarked() || rMarkData.IsMultiMarked())) + eSel = SC_DBSEL_KEEP; } } - pData = pDocSh->GetDBData( aRange, eMode, FALSE ); + switch (eSel) + { + case SC_DBSEL_SHRINK_TO_SHEET_DATA: + { + // Shrink the selection to sheet data area. + ScDocument* pDoc = pDocSh->GetDocument(); + SCCOL nCol1 = aRange.aStart.Col(), nCol2 = aRange.aEnd.Col(); + SCROW nRow1 = aRange.aStart.Row(), nRow2 = aRange.aEnd.Row(); + if (pDoc->ShrinkToDataArea( aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2)) + { + aRange.aStart.SetCol(nCol1); + aRange.aEnd.SetCol(nCol2); + aRange.aStart.SetRow(nRow1); + aRange.aEnd.SetRow(nRow2); + } + } + break; + case SC_DBSEL_SHRINK_TO_USED_DATA: + case SC_DBSEL_ROW_DOWN: + { + // Shrink the selection to actual used area. + ScDocument* pDoc = pDocSh->GetDocument(); + SCCOL nCol1 = aRange.aStart.Col(), nCol2 = aRange.aEnd.Col(); + SCROW nRow1 = aRange.aStart.Row(), nRow2 = aRange.aEnd.Row(); + if (pDoc->ShrinkToUsedDataArea( aRange.aStart.Tab(), nCol1, nRow1, nCol2, nRow2, bShrinkColumnsOnly)) + { + aRange.aStart.SetCol(nCol1); + aRange.aEnd.SetCol(nCol2); + aRange.aStart.SetRow(nRow1); + aRange.aEnd.SetRow(nRow2); + } + } + break; + default: + ; // nothing + } + pData = pDocSh->GetDBData( aRange, eMode, eSel ); } else if ( eMode != SC_DB_OLD ) pData = pDocSh->GetDBData( ScRange( GetViewData()->GetCurX(), GetViewData()->GetCurY(), GetViewData()->GetTabNo() ), - eMode, FALSE ); + eMode, SC_DBSEL_KEEP ); if ( pData && bMark ) { @@ -290,7 +335,7 @@ void ScDBFunc::ToggleAutoFilter() ScQueryParam aParam; ScDocument* pDoc = GetViewData()->GetDocument(); - ScDBData* pDBData = GetDBData( FALSE ); + ScDBData* pDBData = GetDBData( FALSE, SC_DB_MAKE, SC_DBSEL_ROW_DOWN ); pDBData->SetByRow( TRUE ); //! Undo, vorher abfragen ?? pDBData->GetQueryParam( aParam ); diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx index 8ff816263b4f..a178b0a0ada6 100644 --- a/sc/source/ui/view/spelldialog.cxx +++ b/sc/source/ui/view/spelldialog.cxx @@ -200,7 +200,12 @@ void ScSpellDialogChildWindow::Init() ScEditableTester aTester( mpDoc, rMarkData ); if( !aTester.IsEditable() ) { - mpViewShell->ErrorMessage( aTester.GetMessageId() ); + // #i85751# Don't show a ErrorMessage here, because the vcl + // parent of the InfoBox is not fully initialized yet. + // This leads to problems in the modality behaviour of the + // ScSpellDialogChildWindow. + + //mpViewShell->ErrorMessage( aTester.GetMessageId() ); return; } } diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 304a858fa21f..750e49ec2334 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -1423,7 +1423,7 @@ void ScTabView::MarkDataArea( BOOL bIncludeCursor ) SCCOL nEndCol = nStartCol; SCROW nEndRow = nStartRow; - pDoc->GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, bIncludeCursor ); + pDoc->GetDataArea( nTab, nStartCol, nStartRow, nEndCol, nEndRow, bIncludeCursor, false ); HideAllCursors(); DoneBlockMode(); diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 74a824a709d6..7d1cbb05761b 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -175,7 +175,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( SCITEM_QUERYDATA, SCITEM_QUERYDATA ); - ScDBData* pDBData = GetDBData(); + ScDBData* pDBData = GetDBData( TRUE, SC_DB_MAKE, SC_DBSEL_ROW_DOWN); pDBData->GetQueryParam( aQueryParam ); ScQueryItem aItem( SCITEM_QUERYDATA, GetViewData(), &aQueryParam ); @@ -200,7 +200,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( SCITEM_QUERYDATA, SCITEM_QUERYDATA ); - ScDBData* pDBData = GetDBData(); + ScDBData* pDBData = GetDBData( TRUE, SC_DB_MAKE, SC_DBSEL_ROW_DOWN); pDBData->GetQueryParam( aQueryParam ); aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA, diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 794ee488afed..9697cae3a57e 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -387,7 +387,7 @@ BOOL ScViewFunc::PasteDataFormat( ULONG nFormatId, // Creation of database area "Import1" isn't here, but in the DocShell // slot execute, so it can be added to the undo action - ScDBData* pDBData = pDocSh->GetDBData( ScRange(nPosX,nPosY,nTab), SC_DB_OLD, FALSE ); + ScDBData* pDBData = pDocSh->GetDBData( ScRange(nPosX,nPosY,nTab), SC_DB_OLD, SC_DBSEL_KEEP ); String sTarget; if (pDBData) sTarget = pDBData->GetName(); diff --git a/sc/util/hidother.src b/sc/util/hidother.src index 48dfebdf5c2c..ffdb5c329399 100644 --- a/sc/util/hidother.src +++ b/sc/util/hidother.src @@ -81,6 +81,7 @@ hidspecial HID_SC_APPEND_NAME { HelpID = HID_SC_APPEND_NAME; }; hidspecial HID_SC_AUTOFMT_NAME { HelpID = HID_SC_AUTOFMT_NAME; }; hidspecial HID_SC_ADD_AUTOFMT { HelpID = HID_SC_ADD_AUTOFMT; }; hidspecial HID_SC_REN_AFMT_NAME { HelpID = HID_SC_REN_AFMT_NAME; }; +hidspecial HID_SC_REN_AFMT_DLG { HelpID = HID_SC_REN_AFMT_DLG; }; hidspecial HID_SC_RENAME_AUTOFMT { HelpID = HID_SC_RENAME_AUTOFMT; }; hidspecial HID_PASSWD_TABLE { HelpID = HID_PASSWD_TABLE; }; hidspecial HID_PASSWD_DOC { HelpID = HID_PASSWD_DOC; }; diff --git a/sc/util/makefile.mk b/sc/util/makefile.mk index fa1361c9f794..275b3d22548a 100644 --- a/sc/util/makefile.mk +++ b/sc/util/makefile.mk @@ -139,7 +139,7 @@ LIB4FILES= \ SHL2TARGET= scd$(DLLPOSTFIX) SHL2IMPLIB= scdimp -SHL2VERSIONMAP= scd.map +SHL2VERSIONMAP=$(SOLARENV)/src/component.map SHL2DEF=$(MISC)$/$(SHL2TARGET).def DEF2NAME= $(SHL2TARGET) @@ -288,7 +288,7 @@ TARGET_VBA=vbaobj SHL9TARGET=$(TARGET_VBA)$(DLLPOSTFIX).uno SHL9IMPLIB= i$(TARGET_VBA) -SHL9VERSIONMAP=$(TARGET_VBA).map +SHL9VERSIONMAP=$(SOLARENV)/src/component.map SHL9DEF=$(MISC)$/$(SHL9TARGET).def DEF9NAME=$(SHL9TARGET) .IF "$(VBA_EXTENSION)"=="YES" diff --git a/sc/util/sc.map b/sc/util/sc.map deleted file mode 100644 index bfd1401a7685..000000000000 --- a/sc/util/sc.map +++ /dev/null @@ -1,8 +0,0 @@ -SC_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/sc/util/scd.map b/sc/util/scd.map deleted file mode 100644 index bfd1401a7685..000000000000 --- a/sc/util/scd.map +++ /dev/null @@ -1,8 +0,0 @@ -SC_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/sc/util/scfilt.map b/sc/util/scfilt.map index 589736f24eb1..642b8db15088 100644 --- a/sc/util/scfilt.map +++ b/sc/util/scfilt.map @@ -1,4 +1,4 @@ -SCFILT_1_0 { +UDK_3_0_0 { global: ScFilterCreate; local: diff --git a/sc/util/scui.map b/sc/util/scui.map index f40bd255fe1d..ad5e33836c7c 100644 --- a/sc/util/scui.map +++ b/sc/util/scui.map @@ -1,4 +1,4 @@ -SWUI_1_0 { +UDK_3_0_0 { global: CreateDialogFactory; local: diff --git a/sc/util/vbaobj.map b/sc/util/vbaobj.map deleted file mode 100644 index 737cddbfe3df..000000000000 --- a/sc/util/vbaobj.map +++ /dev/null @@ -1,9 +0,0 @@ -OOO_1.1 { - global: - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/scaddins/source/analysis/exports.map b/scaddins/source/analysis/exports.map deleted file mode 100644 index 50dda088ac94..000000000000 --- a/scaddins/source/analysis/exports.map +++ /dev/null @@ -1,10 +0,0 @@ -SC_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - - local: - *; -}; - diff --git a/scaddins/source/analysis/makefile.mk b/scaddins/source/analysis/makefile.mk index c476b1b32d72..d837d644dc21 100644 --- a/scaddins/source/analysis/makefile.mk +++ b/scaddins/source/analysis/makefile.mk @@ -109,7 +109,7 @@ SHL1STDLIBS= \ SHL1DEPN=makefile.mk -SHL1VERSIONMAP=exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/scaddins/source/datefunc/exports.map b/scaddins/source/datefunc/exports.map deleted file mode 100644 index 50dda088ac94..000000000000 --- a/scaddins/source/datefunc/exports.map +++ /dev/null @@ -1,10 +0,0 @@ -SC_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - - local: - *; -}; - diff --git a/scaddins/source/datefunc/makefile.mk b/scaddins/source/datefunc/makefile.mk index 5dd90bae6a4f..8a2805d76f7d 100644 --- a/scaddins/source/datefunc/makefile.mk +++ b/scaddins/source/datefunc/makefile.mk @@ -96,7 +96,7 @@ SHL1STDLIBS= \ SHL1DEPN=makefile.mk -SHL1VERSIONMAP=exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/sccomp/source/solver/exports.map b/sccomp/source/solver/exports.map deleted file mode 100644 index fe0280ec6c21..000000000000 --- a/sccomp/source/solver/exports.map +++ /dev/null @@ -1,9 +0,0 @@ -SOLVER_1_0 { - global: - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/sccomp/source/solver/makefile.mk b/sccomp/source/solver/makefile.mk index fc186ad61c1a..6b25f60c8762 100644 --- a/sccomp/source/solver/makefile.mk +++ b/sccomp/source/solver/makefile.mk @@ -60,7 +60,7 @@ SHL1STDLIBS= $(COMPHELPERLIB) \ SHL1DEPN= makefile.mk SHL1DEF= $(MISC)$/$(SHL1TARGET).def -SHL1VERSIONMAP= exports.map +SHL1VERSIONMAP= $(SOLARENV)/src/component.map DEF1NAME= $(SHL1TARGET) # --- Resources -------------------------------- |