diff options
author | Andras Timar <atimar@suse.com> | 2012-11-11 18:24:14 +0100 |
---|---|---|
committer | Andras Timar <atimar@suse.com> | 2012-11-11 18:24:14 +0100 |
commit | 06ec1c089519ef3249464aa09eadf03a8db93a39 (patch) | |
tree | 85b2eb6d8ba6ca95e18e1ff82151224cb14106f6 /sc | |
parent | 8e0d67bed54633d555a4601a5d79e2d5ba7ab2bb (diff) | |
parent | 3f899eae02eaad0b967de749fe09b869ba93ad6d (diff) |
Merge branch 'master' into feature/killsdf
Conflicts:
Repository.mk
RepositoryFixes.mk
connectivity/prj/build.lst
extensions/prj/build.lst
filter/prj/build.lst
fpicker/prj/build.lst
l10ntools/StaticLibrary_transex.mk
saxon/build.xml
shell/prj/build.lst
solenv/gbuild/AllLangResTarget.mk
solenv/gbuild/Configuration.mk
solenv/gbuild/UI.mk
ucb/source/ucp/webdav/webdavcontent.cxx
Diffstat (limited to 'sc')
164 files changed, 4102 insertions, 1557 deletions
diff --git a/sc/AllLangResTarget_sc.mk b/sc/AllLangResTarget_sc.mk index 2d3c64c89153..978f2fae7f6f 100644 --- a/sc/AllLangResTarget_sc.mk +++ b/sc/AllLangResTarget_sc.mk @@ -51,6 +51,7 @@ $(eval $(call gb_SrsTarget_set_include,sc/res,\ )) $(eval $(call gb_SrsTarget_add_files,sc/res,\ + sc/source/ui/src/iconsets.src \ sc/source/ui/src/optdlg.src \ sc/source/ui/src/popup.src \ sc/source/ui/src/autofmt.src \ diff --git a/sc/CppunitTest_sc_filters_test.mk b/sc/CppunitTest_sc_filters_test.mk index 5f4c1aa0cbd3..e058a5505d29 100644 --- a/sc/CppunitTest_sc_filters_test.mk +++ b/sc/CppunitTest_sc_filters_test.mk @@ -107,6 +107,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_filters_test,\ forms/util/frm \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ oox/util/oox \ package/source/xstor/xstor \ package/util/package2 \ diff --git a/sc/CppunitTest_sc_macros_test.mk b/sc/CppunitTest_sc_macros_test.mk index fca4947cef41..d6c812ccb5ae 100644 --- a/sc/CppunitTest_sc_macros_test.mk +++ b/sc/CppunitTest_sc_macros_test.mk @@ -92,6 +92,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_macros_test,\ forms/util/frm \ framework/util/fwk \ i18npool/util/i18npool \ + linguistic/source/lng \ oox/util/oox \ package/source/xstor/xstor \ package/util/package2 \ diff --git a/sc/CppunitTest_sc_subsequent_export_test.mk b/sc/CppunitTest_sc_subsequent_export_test.mk new file mode 100644 index 000000000000..41a6855d061f --- /dev/null +++ b/sc/CppunitTest_sc_subsequent_export_test.mk @@ -0,0 +1,144 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# Version: MPL 1.1 / GPLv3+ / LGPLv3+ +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License or as specified alternatively below. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# Major Contributor(s): +# Copyright (C) 2011 Red Hat, Inc., Caolán McNamara <caolanm@redhat.com> +# (initial developer) +# +# All Rights Reserved. +# +# For minor contributions see the git repository. +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 3 or later (the "GPLv3+"), or +# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), +# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable +# instead of those above. + +$(eval $(call gb_CppunitTest_CppunitTest,sc_subsequent_export_test)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sc_subsequent_export_test, \ + sc/qa/unit/subsequent_export-test \ +)) + +$(eval $(call gb_CppunitTest_use_externals,sc_subsequent_export_test, \ + mdds_headers \ + orcus \ +)) + +$(eval $(call gb_CppunitTest_use_libraries,sc_subsequent_export_test, \ + avmedia \ + basegfx \ + comphelper \ + cppu \ + cppuhelper \ + drawinglayer \ + editeng \ + fileacc \ + for \ + forui \ + i18nisolang1 \ + msfilter \ + oox \ + sal \ + salhelper \ + sax \ + sc \ + sfx \ + sot \ + svl \ + svt \ + svx \ + svxcore \ + test \ + tl \ + tk \ + ucbhelper \ + unotest \ + utl \ + vcl \ + xo \ + $(if $(filter $(OS),ANDROID), \ + lo-bootstrap \ + ) \ + $(gb_UWINAPI) \ +)) + +$(eval $(call gb_CppunitTest_set_include,sc_subsequent_export_test,\ + -I$(SRCDIR)/sc/source/ui/inc \ + -I$(SRCDIR)/sc/inc \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_CppunitTest_use_api,sc_subsequent_export_test,\ + offapi \ + udkapi \ +)) + +$(eval $(call gb_CppunitTest_use_ure,sc_subsequent_export_test)) + +$(eval $(call gb_CppunitTest_use_components,sc_subsequent_export_test,\ + chart2/source/controller/chartcontroller \ + chart2/source/chartcore \ + comphelper/util/comphelp \ + configmgr/source/configmgr \ + dbaccess/util/dba \ + embeddedobj/util/embobj \ + eventattacher/source/evtatt \ + fileaccess/source/fileacc \ + filter/source/config/cache/filterconfig1 \ + forms/util/frm \ + framework/util/fwk \ + i18npool/util/i18npool \ + i18npool/source/search/i18nsearch \ + oox/util/oox \ + package/source/xstor/xstor \ + package/util/package2 \ + sax/source/expatwrap/expwrap \ + sax/source/fastparser/fastsax \ + sc/util/sc \ + sc/util/scfilt \ + scaddins/source/analysis/analysis \ + scaddins/source/datefunc/date \ + sfx2/util/sfx \ + sot/util/sot \ + svl/util/svl \ + svtools/util/svt \ + toolkit/util/tk \ + ucb/source/core/ucb1 \ + ucb/source/ucp/file/ucpfile1 \ + ucb/source/ucp/tdoc/ucptdoc1 \ + unotools/util/utl \ + unoxml/source/rdf/unordf \ + unoxml/source/service/unoxml \ + xmlsecurity/util/xsec_fw \ + xmlsecurity/util/xmlsecurity \ +)) + +ifeq ($(OS),WNT) +$(eval $(call gb_CppunitTest_use_components,sc_subsequent_export_test,\ + xmlsecurity/util/xsec_xmlsec.windows \ +)) +else +ifneq ($(filter-out IOS ANDROID,$(OS)),) #FIXME: get nss&xmlsec building +$(eval $(call gb_CppunitTest_use_components,sc_subsequent_export_test,\ + xmlsecurity/util/xsec_xmlsec \ +)) +endif +endif + +$(eval $(call gb_CppunitTest_use_configuration,sc_subsequent_export_test)) + +$(eval $(call gb_CppunitTest_use_filter_configuration,sc_subsequent_export_test)) + +# vim: set noet sw=4 ts=4: diff --git a/sc/CppunitTest_sc_subsequent_filters_test.mk b/sc/CppunitTest_sc_subsequent_filters_test.mk index 613ff558c774..7092b315a56e 100644 --- a/sc/CppunitTest_sc_subsequent_filters_test.mk +++ b/sc/CppunitTest_sc_subsequent_filters_test.mk @@ -100,6 +100,8 @@ $(eval $(call gb_CppunitTest_use_components,sc_subsequent_filters_test,\ forms/util/frm \ framework/util/fwk \ i18npool/util/i18npool \ + i18npool/source/search/i18nsearch \ + linguistic/source/lng \ oox/util/oox \ package/source/xstor/xstor \ package/util/package2 \ diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index f4cdafa8dbb7..4ac291ec342e 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -113,8 +113,8 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/core/data/documen8 \ sc/source/core/data/documen9 \ sc/source/core/data/document \ - sc/source/core/data/dpcachetable \ sc/source/core/data/dpdimsave \ + sc/source/core/data/dpfilteredcache \ sc/source/core/data/dpgroup \ sc/source/core/data/dpitemdata \ sc/source/core/data/dpnumgroupinfo \ diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 649a6fca0b4f..7f4cf50aba71 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -44,9 +44,15 @@ endif $(eval $(call gb_Module_add_check_targets,sc,\ CppunitTest_sc_ucalc \ + CppunitTest_sc_filters_test \ CppunitTest_sc_rangelst_test \ )) +$(eval $(call gb_Module_add_slowcheck_targets,sc, \ + CppunitTest_sc_subsequent_filters_test \ + CppunitTest_sc_subsequent_export_test \ +)) + # Disabled to allow the check tinderbox execute the sd tests #CppunitTest_sc_chart_regression_test \ diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx index 6598341123ca..7379bbf6fd50 100644 --- a/sc/inc/attarray.hxx +++ b/sc/inc/attarray.hxx @@ -148,10 +148,13 @@ public: SCsROW GetNextUnprotected( SCsROW nRow, bool bUp ) const; /// May return -1 if not found - SCsROW SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle, - bool bUp, ScMarkArray* pMarkArray = NULL ); - bool SearchStyleRange( SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, - bool bUp, ScMarkArray* pMarkArray = NULL ); + SCsROW SearchStyle( + SCsROW nRow, const ScStyleSheet* pSearchStyle, bool bUp, + const ScMarkArray* pMarkArray = NULL) const; + + bool SearchStyleRange( + SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, bool bUp, + const ScMarkArray* pMarkArray = NULL) const; bool ApplyFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ); bool RemoveFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ); @@ -188,8 +191,8 @@ public: void DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex ); void DeleteArea( SCROW nStartRow, SCROW nEndRow ); void MoveTo( SCROW nStartRow, SCROW nEndRow, ScAttrArray& rAttrArray ); - void CopyArea( SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray, - sal_Int16 nStripFlags = 0 ); + void CopyArea( + SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray, sal_Int16 nStripFlags = 0) const; void DeleteHardAttr( SCROW nStartRow, SCROW nEndRow ); }; diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx index eb051fd8e1ac..af401d15d184 100644 --- a/sc/inc/attrib.hxx +++ b/sc/inc/attrib.hxx @@ -399,7 +399,6 @@ public: TYPEINFO(); explicit ScCondFormatItem(); - explicit ScCondFormatItem(sal_uInt32 nIndex); explicit ScCondFormatItem(const std::vector<sal_uInt32>& nIndex); virtual ~ScCondFormatItem(); diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx index 92f88f3359b4..5907c6ee15e0 100644 --- a/sc/inc/colorscale.hxx +++ b/sc/inc/colorscale.hxx @@ -179,6 +179,33 @@ struct SC_DLLPUBLIC ScDataBarFormatData boost::scoped_ptr<ScColorScaleEntry> mpLowerLimit; }; +enum ScIconSetType +{ + IconSet_3Arrows, + IconSet_3ArrowsGray, + IconSet_3Flags, + IconSet_3TrafficLights1, + IconSet_3TrafficLights2, + IconSet_3Signs, + IconSet_3Symbols, + IconSet_3Symbols2, + IconSet_4Arrows, + IconSet_4ArrowsGray, + IconSet_4RedToBlack, + IconSet_4Rating, + IconSet_4TrafficLights, + IconSet_5Arrows, + IconSet_5ArrowsGray, + IconSet_5Ratings, + IconSet_5Quarters +}; + +struct ScIconSetMap { + const char* pName; + ScIconSetType eType; + sal_Int32 nElements; +}; + class SC_DLLPUBLIC ScColorFormat : public ScFormatEntry { public: @@ -281,6 +308,54 @@ private: boost::scoped_ptr<ScDataBarFormatData> mpFormatData; }; +struct ScIconSetFormatData +{ + ScIconSetType eIconSetType; + boost::ptr_vector<ScColorScaleEntry> maEntries; +}; + +class SC_DLLPUBLIC ScIconSetFormat : public ScColorFormat +{ +public: + ScIconSetFormat(ScDocument* pDoc); + ScIconSetFormat(ScDocument* pDoc, const ScIconSetFormat& rFormat); + + virtual ScColorFormat* Clone(ScDocument* pDoc = NULL) const; + + ScIconSetInfo* GetIconSetInfo(const ScAddress& rAddr) const; + + void SetIconSetData( ScIconSetFormatData* pData ); + const ScIconSetFormatData* GetIconSetData() const; + + virtual void DataChanged(const ScRange& rRange); + virtual void UpdateMoveTab(SCTAB nOldTab, SCTAB nNewTab); + virtual void UpdateReference( UpdateRefMode eUpdateRefMode, + const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + + virtual condformat::ScFormatEntryType GetType() const; + + static ScIconSetMap* getIconSetMap(); + + typedef boost::ptr_vector<ScColorScaleEntry>::iterator iterator; + typedef boost::ptr_vector<ScColorScaleEntry>::const_iterator const_iterator; + + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; + +#if DUMP_FORMAT_INFO + virtual void dumpInfo(rtl::OUStringBuffer& rBuf) const; +#endif +private: + + double GetMinValue() const; + double GetMaxValue() const; + double CalcValue(double nMin, double nMax, ScIconSetFormat::const_iterator& itr) const; + + boost::scoped_ptr<ScIconSetFormatData> mpFormatData; +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 3206637e7cfe..402d62f774ed 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -117,17 +117,6 @@ friend class ScHorizontalCellIterator; friend class ScHorizontalAttrIterator; public: - static bool bDoubleAlloc; // for Import: double size for alloc - - class DoubleAllocSwitch - { - public: - DoubleAllocSwitch(bool bNewVal = true); - ~DoubleAllocSwitch(); - private: - bool mbOldVal; - }; -public: ScColumn(); ~ScColumn(); @@ -187,7 +176,7 @@ public: void DeleteRow( SCROW nStartRow, SCSIZE nSize ); void DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDelFlag ); void DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag ); - void CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags); + void CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags) const; void CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy, sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScColumn& rColumn); void StartListeningInArea( SCROW nRow1, SCROW nRow2 ); @@ -210,19 +199,20 @@ public: SCCOL GetCol() const { return nCol; } // UpdateSelectionFunction: multi-select - void UpdateSelectionFunction( const ScMarkData& rMark, - ScFunctionData& rData, - ScFlatBoolRowSegments& rHiddenRows, - bool bDoExclude, SCROW nExStartRow, SCROW nExEndRow ); - void UpdateAreaFunction( ScFunctionData& rData, - ScFlatBoolRowSegments& rHiddenRows, - SCROW nStartRow, SCROW nEndRow ); - - void CopyToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked, - ScColumn& rColumn, const ScMarkData* pMarkData = NULL, - bool bAsLink = false ); - void UndoToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked, - ScColumn& rColumn, const ScMarkData* pMarkData = NULL ); + void UpdateSelectionFunction( + const ScMarkData& rMark, ScFunctionData& rData, ScFlatBoolRowSegments& rHiddenRows, + bool bDoExclude, SCROW nExStartRow, SCROW nExEndRow ) const; + + void UpdateAreaFunction( + ScFunctionData& rData, ScFlatBoolRowSegments& rHiddenRows, SCROW nStartRow, SCROW nEndRow) const; + + void CopyToColumn( + SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked, + ScColumn& rColumn, const ScMarkData* pMarkData = NULL, bool bAsLink = false) const; + + void UndoToColumn( + SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked, + ScColumn& rColumn, const ScMarkData* pMarkData = NULL) const; void CopyScenarioFrom( const ScColumn& rSrcCol ); void CopyScenarioTo( ScColumn& rDestCol ) const; @@ -328,10 +318,13 @@ public: bool IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllStyles ) const; /// May return -1 if not found - SCsROW SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle, - bool bUp, bool bInSelection, const ScMarkData& rMark ); - bool SearchStyleRange( SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, - bool bUp, bool bInSelection, const ScMarkData& rMark ); + SCsROW SearchStyle( + SCsROW nRow, const ScStyleSheet* pSearchStyle, bool bUp, bool bInSelection, + const ScMarkData& rMark) const; + + bool SearchStyleRange( + SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, bool bUp, + bool bInSelection, const ScMarkData& rMark) const; bool ApplyFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ); bool RemoveFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ); @@ -345,20 +338,20 @@ public: void ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark ); void ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark ); - long GetNeededSize( SCROW nRow, OutputDevice* pDev, - double nPPTX, double nPPTY, - const Fraction& rZoomX, const Fraction& rZoomY, - bool bWidth, const ScNeededSizeOptions& rOptions ); - sal_uInt16 GetOptimalColWidth( OutputDevice* pDev, double nPPTX, double nPPTY, - const Fraction& rZoomX, const Fraction& rZoomY, - bool bFormula, sal_uInt16 nOldWidth, - const ScMarkData* pMarkData, - const ScColWidthParam* pParam ); - void GetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16* pHeight, - OutputDevice* pDev, - double nPPTX, double nPPTY, - const Fraction& rZoomX, const Fraction& rZoomY, - bool bShrink, sal_uInt16 nMinHeight, SCROW nMinStart ); + long GetNeededSize( + SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + bool bWidth, const ScNeededSizeOptions& rOptions) const; + + sal_uInt16 GetOptimalColWidth( + OutputDevice* pDev, double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + bool bFormula, sal_uInt16 nOldWidth, const ScMarkData* pMarkData, const ScColWidthParam* pParam) const; + + void GetOptimalHeight( + SCROW nStartRow, SCROW nEndRow, sal_uInt16* pHeight, OutputDevice* pDev, + double nPPTX, double nPPTY, const Fraction& rZoomX, const Fraction& rZoomY, + bool bShrink, sal_uInt16 nMinHeight, SCROW nMinStart) const; public: /// Including current, may return -1 @@ -390,7 +383,7 @@ public: SCROW nRowStart, SCROW nRowEnd ) const; private: - ScBaseCell* CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos); + ScBaseCell* CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos) const; SCROW FindNextVisibleRowWithContent(SCROW nRow, bool bForward) const; SCROW FindNextVisibleRow(SCROW nRow, bool bForward) const; diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index b9b24c44060e..afcfd0138d62 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -50,17 +50,11 @@ class ScFormulaCell; class ScTokenArray; -#define SC_COND_GROW 16 - // nOptions Flags #define SC_COND_NOBLANKS 1 #define DUMP_FORMAT_INFO 1 - -// ordering of ScConditionMode and ScQueryOp is equal, -// to facilitate the merging of both in the future - enum ScConditionMode { SC_COND_EQUAL, //done @@ -74,11 +68,24 @@ enum ScConditionMode SC_COND_DUPLICATE, SC_COND_NOTDUPLICATE, SC_COND_DIRECT, + SC_COND_TOP10, + SC_COND_BOTTOM10, + SC_COND_TOP_PERCENT, + SC_COND_BOTTOM_PERCENT, + SC_COND_ABOVE_AVERAGE, + SC_COND_BELOW_AVERAGE, + SC_COND_ERROR, + SC_COND_NOERROR, + SC_COND_BEGINS_WITH, + SC_COND_ENDS_WITH, + SC_COND_CONTAINS_TEXT, + SC_COND_NOT_CONTAINS_TEXT, SC_COND_NONE }; class ScConditionalFormat; struct ScDataBarInfo; +struct ScIconSetInfo; namespace condformat { @@ -87,7 +94,8 @@ enum ScFormatEntryType { CONDITION, COLORSCALE, - DATABAR + DATABAR, + ICONSET }; } @@ -96,10 +104,12 @@ struct ScCondFormatData { ScCondFormatData(): pColorScale(NULL), - pDataBar(NULL) {} + pDataBar(NULL), + pIconSet(NULL) {} Color* pColorScale; ScDataBarInfo* pDataBar; + ScIconSetInfo* pIconSet; rtl::OUString aStyleName; }; @@ -177,8 +187,8 @@ class SC_DLLPUBLIC ScConditionEntry : public ScFormatEntry bool bTextToReal ); void Interpret( const ScAddress& rPos ); - bool IsValid( double nArg, const ScAddress& rAddr ) const; - bool IsValidStr( const String& rArg, const ScAddress& rAddr ) const; + bool IsValid( double nArg, const ScAddress& rPos ) const; + bool IsValidStr( const rtl::OUString& rArg, const ScAddress& rPos ) const; public: ScConditionEntry( ScConditionMode eOper, @@ -248,7 +258,17 @@ protected: private: - bool IsDuplicate(double nArg, const rtl::OUString& rStr, const ScAddress& rAddr, const ScRangeList& rRanges) const; + bool IsDuplicate(double nArg, const rtl::OUString& rStr) const; + bool IsTopNElement( double nArg ) const; + bool IsTopNPercent( double nArg ) const; + bool IsBottomNElement( double nArg ) const; + bool IsBottomNPercent( double nArg ) const; + bool IsAboveAverage( double nArg ) const; + bool IsBelowAverage( double nArg ) const; + + bool IsError( const ScAddress& rPos ) const; + + void FillCache() const; struct ScConditionEntryCache { @@ -256,6 +276,12 @@ private: StringCacheType maStrings; typedef std::map<double, sal_Int32, approx_less> ValueCacheType; ValueCacheType maValues; + + // cache them for easier access + size_t nValueItems; + + ScConditionEntryCache(): + nValueItems(0) {} }; mutable boost::scoped_ptr<ScConditionEntryCache> mpCache; @@ -309,7 +335,6 @@ class SC_DLLPUBLIC ScConditionalFormat typedef boost::ptr_vector<ScFormatEntry> CondFormatContainer; CondFormatContainer maEntries; - bool bIsUsed; // temporary at Save ScRangeList maRanges; // Ranges for conditional format public: @@ -352,9 +377,6 @@ public: sal_uInt32 GetKey() const { return nKey; } void SetKey(sal_uInt32 nNew) { nKey = nNew; } // only if not inserted! - void SetUsed(bool bSet) { bIsUsed = bSet; } - bool IsUsed() const { return bIsUsed; } - bool MarkUsedExternalReferences() const; #if DUMP_FORMAT_INFO diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 390002e98664..f114ecb32365 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1718,9 +1718,6 @@ public: void SetExpandRefs( bool bVal ) { bExpandRefs = bVal; } bool IsExpandRefs() { return bExpandRefs; } - SC_DLLPUBLIC void IncSizeRecalcLevel( SCTAB nTab ); - SC_DLLPUBLIC void DecSizeRecalcLevel( SCTAB nTab, bool bUpdateNoteCaptionPos = true ); - sal_uLong GetXMLImportedFormulaCount() const { return nXMLImportedFormulaCount; } void IncXMLImportedFormulaCount( sal_uLong nVal ) { diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpfilteredcache.hxx index c55ec2605438..f72bbdfe7065 100644 --- a/sc/inc/dpcachetable.hxx +++ b/sc/inc/dpfilteredcache.hxx @@ -33,6 +33,7 @@ #include "osl/mutex.hxx" #include "global.hxx" #include "dpitemdata.hxx" +#include "dpmacros.hxx" #include <vector> #include <boost/unordered_set.hpp> @@ -48,13 +49,13 @@ struct ScDPValueData; struct ScQueryParam; /** - * Despite the name, this class is only a wrapper to the actual cache, to - * provide filtering on the raw data based on the query filter and/or page - * field filters. I will rename this class to a more appropriate name in the - * future. + * This class is only a wrapper to the actual cache, to provide filtering on + * the raw data based on the query filter and/or page field filters. */ -class SC_DLLPUBLIC ScDPCacheTable +class SC_DLLPUBLIC ScDPFilteredCache { + typedef mdds::flat_segment_tree<SCROW, bool> RowFlagType; + public: /** interface class used for filtering of rows. */ class FilterBase @@ -106,20 +107,16 @@ public: Criterion(); }; - ScDPCacheTable(const ScDPCache* pCache); - ~ScDPCacheTable(); + ScDPFilteredCache(const ScDPCache& rCache); + ~ScDPFilteredCache(); sal_Int32 getRowSize() const; sal_Int32 getColSize() const; const ScDPCache* getCache() const; - /** Fill the internal table from the cell range provided. This function - assumes that the first row is the column header. */ void fillTable(const ScQueryParam& rQuery, bool bIgnoreEmptyRows, bool bRepeatIfEmpty); - /** Fill the internal table from database connection object. This function - assumes that the first row is the column header. */ void fillTable(); /** Check whether a specified row is active or not. When a row is active, @@ -153,11 +150,15 @@ public: SCROW getOrder(long nDim, SCROW nIndex) const; void clear(); bool empty() const; - bool hasCache() const; + +#if DEBUG_PIVOT_TABLE + void dumpRowFlag(const RowFlagType& rFlag) const; + void dump() const; +#endif private: - ScDPCacheTable(); - ScDPCacheTable(const ScDPCacheTable&); + ScDPFilteredCache(); + ScDPFilteredCache(const ScDPFilteredCache&); /** * Check if a given row meets all specified criteria. @@ -168,7 +169,6 @@ private: bool isRowQualified(sal_Int32 nRow, const ::std::vector<Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rRepeatIfEmptyDims) const; private: - typedef mdds::flat_segment_tree<SCROW, bool> RowFlagType; /** unique field entires for each field (column). */ ::std::vector< ::std::vector<SCROW> > maFieldEntries; @@ -178,7 +178,7 @@ private: /** Rows visible by page dimension filtering. */ RowFlagType maShowByPage; - const ScDPCache* mpCache; + const ScDPCache& mrCache; }; #endif diff --git a/sc/inc/dpgroup.hxx b/sc/inc/dpgroup.hxx index afa3933efe48..1fb4aec84611 100644 --- a/sc/inc/dpgroup.hxx +++ b/sc/inc/dpgroup.hxx @@ -57,7 +57,7 @@ public: bool HasElement( const ScDPItemData& rData ) const; bool HasCommonElement( const ScDPGroupItem& rOther ) const; - void FillGroupFilter( ScDPCacheTable::GroupFilter& rFilter ) const; + void FillGroupFilter( ScDPFilteredCache::GroupFilter& rFilter ) const; }; typedef ::std::vector<ScDPGroupItem> ScDPGroupItemVec; @@ -84,7 +84,7 @@ public: long GetGroupDim() const { return nGroupDim; } const rtl::OUString& GetName() const { return aGroupName; } - const std::vector< SCROW >& GetColumnEntries( const ScDPCacheTable& rCacheTable ) const; + const std::vector< SCROW >& GetColumnEntries( const ScDPFilteredCache& rCacheTable ) const; const ScDPGroupItem* GetGroupForData( const ScDPItemData& rData ) const; // rData = entry in original dim. const ScDPGroupItem* GetGroupForName( const ScDPItemData& rName ) const; // rName = entry in group dim. const ScDPGroupItem* GetGroupByIndex( size_t nIndex ) const; @@ -145,7 +145,7 @@ class ScDPGroupTableData : public ScDPTableData bool IsNumGroupDimension( long nDimension ) const; void GetNumGroupInfo(long nDimension, ScDPNumGroupInfo& rInfo); - void ModifyFilterCriteria(::std::vector<ScDPCacheTable::Criterion>& rCriteria); + void ModifyFilterCriteria(::std::vector<ScDPFilteredCache::Criterion>& rCriteria); public: // takes ownership of pSource @@ -176,12 +176,12 @@ public: virtual bool IsRepeatIfEmpty(); virtual void CreateCacheTable(); - virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rDataDims); - virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + virtual void FilterCacheTable(const ::std::vector<ScDPFilteredCache::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rDataDims); + virtual void GetDrillDownData(const ::std::vector<ScDPFilteredCache::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rCatDims, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData); virtual void CalcResults(CalcInfo& rInfo, bool bAutoShow); - virtual const ScDPCacheTable& GetCacheTable() const; + virtual const ScDPFilteredCache& GetCacheTable() const; virtual void ReloadCacheTable(); virtual sal_Bool IsBaseForGroup(long nDim) const; diff --git a/sc/inc/dpoutput.hxx b/sc/inc/dpoutput.hxx index 22f18a64f124..1716d4a6f985 100644 --- a/sc/inc/dpoutput.hxx +++ b/sc/inc/dpoutput.hxx @@ -38,7 +38,7 @@ #include "global.hxx" #include "address.hxx" -#include "dpcachetable.hxx" +#include "dpfilteredcache.hxx" #include "dptypes.hxx" #include <vector> diff --git a/sc/inc/dpsdbtab.hxx b/sc/inc/dpsdbtab.hxx index 943bf8d94179..c1a0fc9f53cb 100644 --- a/sc/inc/dpsdbtab.hxx +++ b/sc/inc/dpsdbtab.hxx @@ -36,7 +36,7 @@ #include <vector> #include <boost/unordered_set.hpp> -class ScDPCacheTable; +class ScDPFilteredCache; class ScDocument; class ScDPCache; class ScDPDimensionSaveData; @@ -68,9 +68,9 @@ struct ScImportSourceDesc class ScDatabaseDPData : public ScDPTableData { private: - ScDPCacheTable aCacheTable; + ScDPFilteredCache aCacheTable; public: - ScDatabaseDPData(ScDocument* pDoc, const ScDPCache* pCache); + ScDatabaseDPData(ScDocument* pDoc, const ScDPCache& rCache); virtual ~ScDatabaseDPData(); virtual long GetColumnCount(); @@ -81,12 +81,12 @@ public: virtual void SetEmptyFlags( sal_Bool bIgnoreEmptyRows, sal_Bool bRepeatIfEmpty ); virtual void CreateCacheTable(); - virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rDataDims); - virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + virtual void FilterCacheTable(const ::std::vector<ScDPFilteredCache::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rDataDims); + virtual void GetDrillDownData(const ::std::vector<ScDPFilteredCache::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rCatDims, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData); virtual void CalcResults(CalcInfo& rInfo, bool bAutoShow); - virtual const ScDPCacheTable& GetCacheTable() const; + virtual const ScDPFilteredCache& GetCacheTable() const; virtual void ReloadCacheTable(); }; diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx index 0374123f2c68..9e1e0d49b8ec 100644 --- a/sc/inc/dpshttab.hxx +++ b/sc/inc/dpshttab.hxx @@ -104,10 +104,10 @@ private: bool bIgnoreEmptyRows; bool bRepeatIfEmpty; - ScDPCacheTable aCacheTable; + ScDPFilteredCache aCacheTable; public: - ScSheetDPData(ScDocument* pD, const ScSheetSourceDesc& rDesc, const ScDPCache* pCache); + ScSheetDPData(ScDocument* pD, const ScSheetSourceDesc& rDesc, const ScDPCache& rCache); virtual ~ScSheetDPData(); virtual long GetColumnCount(); @@ -121,12 +121,12 @@ public: virtual bool IsRepeatIfEmpty(); virtual void CreateCacheTable(); - virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rCatDims); - virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + virtual void FilterCacheTable(const ::std::vector<ScDPFilteredCache::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rCatDims); + virtual void GetDrillDownData(const ::std::vector<ScDPFilteredCache::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rCatDims, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData); virtual void CalcResults(CalcInfo& rInfo, bool bAutoShow); - virtual const ScDPCacheTable& GetCacheTable() const; + virtual const ScDPFilteredCache& GetCacheTable() const; virtual void ReloadCacheTable(); }; diff --git a/sc/inc/dptabdat.hxx b/sc/inc/dptabdat.hxx index 16b8ef323dbf..629a0e577a3f 100644 --- a/sc/inc/dptabdat.hxx +++ b/sc/inc/dptabdat.hxx @@ -31,7 +31,7 @@ #include "address.hxx" #include "dpoutput.hxx" -#include "dpcachetable.hxx" +#include "dpfilteredcache.hxx" #include "dpcache.hxx" #include "dpmacros.hxx" @@ -148,12 +148,12 @@ public: virtual bool IsRepeatIfEmpty(); virtual void CreateCacheTable() = 0; - virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rDataDims) = 0; - virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + virtual void FilterCacheTable(const ::std::vector<ScDPFilteredCache::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rDataDims) = 0; + virtual void GetDrillDownData(const ::std::vector<ScDPFilteredCache::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rCatDims, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData) = 0; virtual void CalcResults(CalcInfo& rInfo, bool bAutoShow) = 0; - virtual const ScDPCacheTable& GetCacheTable() const = 0; + virtual const ScDPFilteredCache& GetCacheTable() const = 0; virtual void ReloadCacheTable() = 0; // overloaded in ScDPGroupTableData: @@ -187,12 +187,12 @@ protected: ::std::vector<ScDPValueData> aValues; }; - void FillRowDataFromCacheTable(sal_Int32 nRow, const ScDPCacheTable& rCacheTable, const CalcInfo& rInfo, CalcRowData& rData); + void FillRowDataFromCacheTable(sal_Int32 nRow, const ScDPFilteredCache& rCacheTable, const CalcInfo& rInfo, CalcRowData& rData); void ProcessRowData(CalcInfo& rInfo, CalcRowData& rData, bool bAutoShow); - void CalcResultsFromCacheTable(const ScDPCacheTable& rCacheTable, CalcInfo& rInfo, bool bAutoShow); + void CalcResultsFromCacheTable(const ScDPFilteredCache& rCacheTable, CalcInfo& rInfo, bool bAutoShow); private: - void GetItemData(const ScDPCacheTable& rCacheTable, sal_Int32 nRow, + void GetItemData(const ScDPFilteredCache& rCacheTable, sal_Int32 nRow, const ::std::vector<long>& rDims, ::std::vector< SCROW >& rItemData); }; #endif diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx index 48a62b7f62f0..6a5a1dfeb3a5 100644 --- a/sc/inc/dptabres.hxx +++ b/sc/inc/dptabres.hxx @@ -30,7 +30,7 @@ #define SC_DPTABRES_HXX #include "global.hxx" -#include "dpcachetable.hxx" +#include "dpfilteredcache.hxx" #include <tools/string.hxx> #include <com/sun/star/sheet/MemberResult.hpp> @@ -656,7 +656,7 @@ public: ~ScDPResultVisibilityData(); void addVisibleMember(const String& rDimName, const ScDPItemData& rMemberItem); - void fillFieldFilters(::std::vector<ScDPCacheTable::Criterion>& rFilters) const; + void fillFieldFilters(::std::vector<ScDPFilteredCache::Criterion>& rFilters) const; private: struct MemberHash diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx index 9fced306c11b..c3ec63ed072a 100644 --- a/sc/inc/dptabsrc.hxx +++ b/sc/inc/dptabsrc.hxx @@ -152,7 +152,7 @@ private: * Set visibilities of individual rows in the cache table based on the * page field data. */ - void FilterCacheTableByPageDimensions(); + void FilterCacheByPageDimensions(); void SetDupCount( long nNew ); diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx index 838255ef1236..bbed41fc10f0 100644 --- a/sc/inc/fillinfo.hxx +++ b/sc/inc/fillinfo.hxx @@ -31,6 +31,7 @@ #include <svx/framelinkarray.hxx> #include "global.hxx" +#include "colorscale.hxx" class SfxItemSet; class SvxBrushItem; @@ -91,6 +92,12 @@ struct ScDataBarInfo } }; +struct ScIconSetInfo +{ + sal_Int32 nIconIndex; + ScIconSetType eIconSetType; +}; + struct CellInfo { ScBaseCell* pCell; @@ -99,6 +106,7 @@ struct CellInfo const SfxItemSet* pConditionSet; const Color* pColorScale; const ScDataBarInfo* pDataBar; + const ScIconSetInfo* pIconSet; const SvxBrushItem* pBackground; @@ -135,12 +143,14 @@ struct CellInfo CellInfo(): pColorScale(NULL), - pDataBar(NULL) {} + pDataBar(NULL), + pIconSet(NULL) {} ~CellInfo() { delete pColorScale; delete pDataBar; + delete pIconSet; } }; diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 44d8810ddd2d..5dfe54763375 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -632,9 +632,9 @@ public: @param cSep The character to separate the tokens. @param nSepCount Specifies how often cSep is inserted between two tokens. @param bForceSep true = Always insert separator; false = Only, if not at begin or end. */ - SC_DLLPUBLIC static void AddToken( - String& rTokenList, const String& rToken, - sal_Unicode cSep, xub_StrLen nSepCount = 1, + SC_DLLPUBLIC static OUString addToken( + const OUString& rTokenList, const OUString& rToken, + sal_Unicode cSep, sal_Int32 nSepCount = 1, bool bForceSep = false ); /** Returns true, if the first and last character of the string is cQuote. */ diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index 42d8c1eb64ee..ea2d87050601 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -594,15 +594,27 @@ #define STR_COND_CONDITION 469 #define STR_COND_COLORSCALE 470 #define STR_COND_DATABAR 471 -#define STR_COND_FORMULA 472 -#define STR_COND_BETWEEN 473 -#define STR_COND_NOTBETWEEN 474 -#define STR_COND_UNIQUE 475 -#define STR_COND_DUPLICATE 476 - -#define STR_ERR_CONDFORMAT_PROTECTED 477 - -#define STR_COUNT 478 - +#define STR_COND_ICONSET 472 +#define STR_COND_FORMULA 473 +#define STR_COND_BETWEEN 474 +#define STR_COND_NOTBETWEEN 475 +#define STR_COND_UNIQUE 476 +#define STR_COND_DUPLICATE 477 +#define STR_COND_TOP10 478 +#define STR_COND_BOTTOM10 479 +#define STR_COND_TOP_PERCENT 480 +#define STR_COND_BOTTOM_PERCENT 481 +#define STR_COND_ABOVE_AVERAGE 482 +#define STR_COND_BELOW_AVERAGE 483 +#define STR_COND_ERROR 484 +#define STR_COND_NOERROR 485 +#define STR_COND_BEGINS_WITH 486 +#define STR_COND_ENDS_WITH 487 +#define STR_COND_CONTAINS 488 +#define STR_COND_NOT_CONTAINS 489 + +#define STR_ERR_CONDFORMAT_PROTECTED 490 + +#define STR_COUNT 491 #endif diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx index 0db2a9fc1f69..907e67918a91 100644 --- a/sc/inc/postit.hxx +++ b/sc/inc/postit.hxx @@ -64,8 +64,8 @@ struct SC_DLLPUBLIC ScNoteData // ============================================================================ -/** An additional class held by an ScBaseCell instance containing all - information for a cell annotation. +/** + * Additional class containing cell annotation data. */ class SC_DLLPUBLIC ScPostIt { @@ -266,10 +266,11 @@ private: typedef std::map<ScAddress2D, ScPostIt*> ScNoteMap; ScNoteMap maNoteMap; + ScNotes(const ScNotes& rNotes); + ScNotes operator=(const ScNotes& rNotes); ScDocument* mpDoc; public: ScNotes(ScDocument* pDoc); - ScNotes(const ScNotes& rNotes); ~ScNotes(); typedef ScNoteMap::iterator iterator; @@ -306,7 +307,7 @@ public: void clear(); - ScNotes* clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bCloneNoteCaption, SCTAB nTab); + void clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bCloneNoteCaption, SCTAB nTab, ScNotes& rTarget); void CopyFromClip(const ScNotes& maNotes, ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy, SCTAB nTab, bool bCloneCaption); void erase(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bForgetCaption = false); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index c630cb743574..39c99f16b1eb 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -142,7 +142,6 @@ private: mutable SCROW nTableAreaY; SCTAB nTab; - sal_uInt16 nRecalcLvl; // recursion level Size-Recalc ScDocument* pDocument; utl::TextSearch* pSearchText; @@ -779,9 +778,6 @@ public: SCCOL nCol, SCROW nRowStart, SCROW nRowEnd ) const; - void IncRecalcLevel(); - void DecRecalcLevel( bool bUpdateNoteCaptionPos = true ); - bool IsSortCollatorGlobal() const; void InitSortCollator( const ScSortParam& rPar ); void DestroySortCollator(); diff --git a/sc/inc/xmlwrap.hxx b/sc/inc/xmlwrap.hxx index 2e378a4a1d09..7d03f56f27be 100644 --- a/sc/inc/xmlwrap.hxx +++ b/sc/inc/xmlwrap.hxx @@ -38,7 +38,7 @@ namespace com { namespace sun { namespace star { namespace uno { class XInterface; } namespace embed { class XStorage; } namespace xml { - namespace sax { struct InputSource; class XParser; } } + namespace sax { struct InputSource; class XParser; class XWriter; } } } } } class ScXMLImportWrapper @@ -59,7 +59,7 @@ class ScXMLImportWrapper sal_Bool ExportToComponent(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>& xServiceFactory, com::sun::star::uno::Reference<com::sun::star::frame::XModel>& xModel, - com::sun::star::uno::Reference<com::sun::star::uno::XInterface>& xWriter, + com::sun::star::uno::Reference<com::sun::star::xml::sax::XWriter>& xWriter, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aDescriptor, const rtl::OUString& sName, const rtl::OUString& sMediaType, const rtl::OUString& sComponentName, const sal_Bool bPlainText, com::sun::star::uno::Sequence<com::sun::star::uno::Any>& aArgs, diff --git a/sc/qa/unit/data/contentCSV/new_cond_format_test.csv b/sc/qa/unit/data/contentCSV/new_cond_format_test.csv new file mode 100644 index 000000000000..156f2a07b408 --- /dev/null +++ b/sc/qa/unit/data/contentCSV/new_cond_format_test.csv @@ -0,0 +1,22 @@ +,top n elements,,bottom n elements,,top n percent,,bottom n percent,,above average,,below average,,above equal average,,below equal average +,1,,1.00,,1,,1.00,,1,,1.00,,2,,2.00 +,2,,2.00,,2,,2.00,,2,,2.00,,3,,3.00 +,3,,3.00,,3,,3.00,,3,,3.00,,4,,4.00 +,4,,4.00,,4,,4,,4,,4.00,,5,,5.00 +,5,,5,,5,,5,,5,,5.00,,6,,6.00 +,6,,6,,6,,6,,6,,6.00,,7,,7.00 +,7,,7,,7,,7,,7,,7.00,,11.00,,11 +,10,,10,,10,,10,,10.00,,10,,10.00,,10.00 +,11,,11,,11,,11,,11.00,,11,,11.00,,11 +,12,,12,,12,,12,,12.00,,12,,12.00,,12 +,13,,13,,13,,13,,13.00,,13,,13.00,,13 +,14,,14,,14,,14,,14.00,,14,,14.00,,14 +,15.00,,15,,15,,15,,15.00,,15,,15.00,,15 +,16.00,,16,,16,,16,,16.00,,16,,16.00,,16 +,17.00,,17,,17,,17,,17.00,,17,,17.00,,17 +,18.00,,18,,18.00,,18,,18.00,,18,,18.00,,18 +,19.00,,19,,19.00,,19,,19.00,,19,,19.00,,19 +,20.00,,20,,20.00,,20,,20.00,,20,,20.00,,20 +,1,,1.00,,1,,1.00,,1,,1.00,,2,,2.00 +,2,,2.00,,2,,2.00,,2,,2.00,,2,,2.00 +,3,,3.00,,3,,3.00,,3,,3.00,,3,,3.00 diff --git a/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv b/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv index 6dbc97a3b8b5..b8ba29823d7d 100644 --- a/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv +++ b/sc/qa/unit/data/contentCSV/spreadsheet-functions.csv @@ -2,3 +2,4 @@ $C$2,$A$1,Sheet.B$2,Sheet!R2C2 2,4,4,5,6,15,15,6,9 1,3,4,4,2,2 2,4,7,8,4 +4,5,#N/A,8 diff --git a/sc/qa/unit/data/ods/formats.ods b/sc/qa/unit/data/ods/formats.ods Binary files differindex f944e34bd50f..cfe3bc84bf7b 100644 --- a/sc/qa/unit/data/ods/formats.ods +++ b/sc/qa/unit/data/ods/formats.ods diff --git a/sc/qa/unit/data/ods/functions.ods b/sc/qa/unit/data/ods/functions.ods Binary files differindex a90a224a1c7f..6dd969c90362 100644 --- a/sc/qa/unit/data/ods/functions.ods +++ b/sc/qa/unit/data/ods/functions.ods diff --git a/sc/qa/unit/data/xls/fail/CVE-2012-4233-4.xls b/sc/qa/unit/data/xls/fail/CVE-2012-4233-4.xls Binary files differnew file mode 100644 index 000000000000..7f8f89c5d569 --- /dev/null +++ b/sc/qa/unit/data/xls/fail/CVE-2012-4233-4.xls diff --git a/sc/qa/unit/data/xls/pass/EDB-22330-1.xls b/sc/qa/unit/data/xls/pass/EDB-22330-1.xls Binary files differnew file mode 100644 index 000000000000..a10c24de0be6 --- /dev/null +++ b/sc/qa/unit/data/xls/pass/EDB-22330-1.xls diff --git a/sc/qa/unit/data/xlsx/formats.xlsx b/sc/qa/unit/data/xlsx/formats.xlsx Binary files differindex e579fa5065ed..c75bbc786994 100644 --- a/sc/qa/unit/data/xlsx/formats.xlsx +++ b/sc/qa/unit/data/xlsx/formats.xlsx diff --git a/sc/qa/unit/data/xlsx/new_cond_format_test.xlsx b/sc/qa/unit/data/xlsx/new_cond_format_test.xlsx Binary files differnew file mode 100644 index 000000000000..f5a69774936a --- /dev/null +++ b/sc/qa/unit/data/xlsx/new_cond_format_test.xlsx diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index a7b050d24b71..b4a9fa129eb5 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -68,7 +68,7 @@ using namespace ::com::sun::star::uno; namespace { struct FileFormat { - const char* pName; const char* pFilterName; const char* pTypeName; sal_uLong nFormatType; + const char* pName; const char* pFilterName; const char* pTypeName; unsigned int nFormatType; }; FileFormat aFileFormats[] = { @@ -89,9 +89,13 @@ class ScFiltersTest public: ScFiltersTest(); - virtual bool load(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData); + virtual bool load( const rtl::OUString &rFilter, const rtl::OUString &rURL, + const rtl::OUString &rUserData, unsigned int nFilterFlags, + unsigned int nClipboardID, unsigned int nFilterVersion); + ScDocShellRef load(const rtl::OUString &rFilter, const rtl::OUString &rURL, - const rtl::OUString &rUserData, const rtl::OUString& rTypeName, sal_uLong nFormatType=0); + const rtl::OUString &rUserData, const rtl::OUString& rTypeName, + unsigned int nFilterFlags, unsigned int nClipboardID, unsigned int nFilterVersion); void createFileURL(const rtl::OUString& aFileBase, const rtl::OUString& aFileExtension, rtl::OUString& rFilePath); void createCSVPath(const rtl::OUString& aFileBase, rtl::OUString& rFilePath); @@ -142,20 +146,18 @@ private: }; ScDocShellRef ScFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL, - const rtl::OUString &rUserData, const rtl::OUString& rTypeName, sal_uLong nFormatType) + const rtl::OUString &rUserData, const rtl::OUString& rTypeName, + unsigned int nFilterFlags, unsigned int nClipboardID, unsigned int nFilterVersion) { - sal_uInt32 nFormat = 0; - if (nFormatType) - nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS; - SfxFilter* aFilter = new SfxFilter( + SfxFilter* pFilter = new SfxFilter( rFilter, - rtl::OUString(), nFormatType, nFormat, rTypeName, 0, rtl::OUString(), - rUserData, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc*")) ); - aFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); + rtl::OUString(), nFilterFlags, nClipboardID, rTypeName, 0, rtl::OUString(), + rUserData, rtl::OUString("private:factory/scalc*") ); + pFilter->SetVersion(nFilterVersion); ScDocShellRef xDocShRef = new ScDocShell; SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ); - pSrcMed->SetFilter(aFilter); + pSrcMed->SetFilter(pFilter); if (!xDocShRef->DoLoad(pSrcMed)) { xDocShRef->DoClose(); @@ -167,9 +169,11 @@ ScDocShellRef ScFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUStr } bool ScFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL, - const rtl::OUString &rUserData) + const rtl::OUString &rUserData, unsigned int nFilterFlags, + unsigned int nClipboardID, unsigned int nFilterVersion) { - ScDocShellRef xDocShRef = load(rFilter, rURL, rUserData, rtl::OUString()); + ScDocShellRef xDocShRef = load(rFilter, rURL, rUserData, + rtl::OUString(), nFilterFlags, nClipboardID, nFilterVersion); bool bLoaded = xDocShRef.Is(); //reference counting of ScDocShellRef is very confused. if (bLoaded) @@ -227,7 +231,11 @@ void ScFiltersTest::testDir(osl::Directory& rDir, sal_uInt32 nType) std::cout << "File: " << rtl::OUStringToOString(sURL, RTL_TEXTENCODING_UTF8).getStr() << std::endl; //rtl::OStringBuffer aMessage("Failed loading: "); //aMessage.append(rtl::OUStringToOString(sURL, RTL_TEXTENCODING_UTF8)); - ScDocShellRef xDocSh = load( aFilterName,sURL, rtl::OUString(),aFilterType, aFileFormats[nType].nFormatType); + + unsigned int nFormatType = aFileFormats[nType].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, sURL, rtl::OUString(), + aFilterType, nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); // use this only if you're sure that all files can be loaded // pay attention to lock files //CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), xDocSh.Is()); @@ -300,7 +308,10 @@ ScDocShellRef ScFiltersTest::loadDoc(const rtl::OUString& rName, sal_Int32 nForm rtl::OUString aFileName; createFileURL( rName, aFileExtension, aFileName ); rtl::OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8); - ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[nFormat].nFormatType); + unsigned int nFormatType = aFileFormats[nFormat].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); CPPUNIT_ASSERT(xDocSh.Is()); return xDocSh; } diff --git a/sc/qa/unit/helper/csv_handler.hxx b/sc/qa/unit/helper/csv_handler.hxx index dbb68cd30ca8..8493f104992e 100644 --- a/sc/qa/unit/helper/csv_handler.hxx +++ b/sc/qa/unit/helper/csv_handler.hxx @@ -44,6 +44,9 @@ rtl::OUString getConditionalFormatString(ScDocument* pDoc, SCCOL nCol, SCROW nRo rtl::OUString aString; Color* pColor; ScBaseCell* pCell = pDoc->GetCell(ScAddress(nCol, nRow, nTab)); + if(!pCell) + return aString; + const SfxItemSet* pCondSet = pDoc->GetCondResult( nCol, nRow, nTab ); const ScPatternAttr* pPattern = pDoc->GetPattern(nCol, nRow, nTab); SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); @@ -93,14 +96,12 @@ enum StringType { PureString, FormulaValue, StringValue }; class csv_handler { public: - - - csv_handler(ScDocument* pDoc, SCTAB nTab, StringType aType = StringValue): + csv_handler(ScDocument* pDoc, SCTAB nTab, StringType eType = StringValue): mpDoc(pDoc), mnCol(0), mnRow(0), mnTab(nTab), - maStringType(aType) {} + meStringType(eType) {} void begin_parse() {} @@ -119,7 +120,16 @@ public: #if DEBUG_CSV_HANDLER std::cout << "Col: " << mnCol << " Row: " << mnRow << std::endl; #endif //DEBUG_CSV_HANDLER - if (maStringType == PureString) + if (n == 0) + { + // Empty cell. + if (!mpDoc->GetString(mnCol, mnRow, mnTab).isEmpty()) + { + // cell in the document is not empty. + CPPUNIT_ASSERT_MESSAGE(createErrorMessage(mnCol, mnRow, mnTab).getStr(), false); + } + } + else if (meStringType == PureString) { rtl::OUString aCSVString(p, n, RTL_TEXTENCODING_UTF8); rtl::OUString aString; @@ -141,7 +151,7 @@ public: if (*pRemainingChars) { rtl::OUString aString; - switch (maStringType) + switch (meStringType) { case StringValue: mpDoc->GetString(mnCol, mnRow, mnTab, aString); @@ -174,7 +184,6 @@ public: } } ++mnCol; - } private: @@ -182,7 +191,7 @@ private: SCCOL mnCol; SCROW mnRow; SCTAB mnTab; - StringType maStringType; + StringType meStringType; }; diff --git a/sc/qa/unit/helper/debughelper.hxx b/sc/qa/unit/helper/debughelper.hxx index ee84f4ccd323..2a560c68085f 100644 --- a/sc/qa/unit/helper/debughelper.hxx +++ b/sc/qa/unit/helper/debughelper.hxx @@ -26,6 +26,9 @@ * instead of those above. */ +#ifndef SC_DEBUG_HELPER_HXX +#define SC_DEBUG_HELPER_HXX + /** * Print nicely formatted sheet content to stdout. Indispensable when * debugging the unit test code involving testing of sheet contents. @@ -161,4 +164,6 @@ private: MatrixType maMatrix; }; +#endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index e29415cdf6fa..32f7f7a59229 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -122,6 +122,12 @@ void testCondFile(rtl::OUString& aFileName, ScDocument* pDoc, SCTAB nTab) } +#define ASSERT_DOUBLES_EQUAL( expected, result ) \ + CPPUNIT_ASSERT_DOUBLES_EQUAL( (expected), (result), 1e-14 ) + +#define ASSERT_DOUBLES_EQUAL_MESSAGE( message, expected, result ) \ + CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE( (message), (expected), (result), 1e-14 ) + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx new file mode 100644 index 000000000000..d67224fb70cf --- /dev/null +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -0,0 +1,340 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/config.h> +#include <unotest/filters-test.hxx> +#include <test/bootstrapfixture.hxx> +#include <rtl/strbuf.hxx> +#include <osl/file.hxx> + +#include <sfx2/app.hxx> +#include <sfx2/docfilt.hxx> +#include <sfx2/docfile.hxx> +#include <sfx2/frame.hxx> +#include <sfx2/sfxmodelfactory.hxx> +#include <svl/stritem.hxx> + +#include <unotools/tempfile.hxx> +#include <comphelper/storagehelper.hxx> + +#define CALC_DEBUG_OUTPUT 0 +#define TEST_BUG_FILES 0 + +#include "helper/qahelper.hxx" + +#include "docsh.hxx" +#include "postit.hxx" +#include "patattr.hxx" +#include "scitems.hxx" +#include "document.hxx" +#include "cellform.hxx" + +#define ODS_FORMAT_TYPE 50331943 +#define XLS_FORMAT_TYPE 318767171 +#define XLSX_FORMAT_TYPE 268959811 +#define LOTUS123_FORMAT_TYPE 268435649 + +#define ODS 0 +#define XLS 1 +#define XLSX 2 +#define LOTUS123 3 + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +namespace { + +struct FileFormat { + const char* pName; const char* pFilterName; const char* pTypeName; unsigned int nFormatType; +}; + +FileFormat aFileFormats[] = { + { "ods" , "calc8", "", ODS_FORMAT_TYPE }, + { "xls" , "MS Excel 97", "calc_MS_EXCEL_97", XLS_FORMAT_TYPE }, + { "xlsx", "Calc MS Excel 2007 XML" , "MS Excel 2007 XML", XLSX_FORMAT_TYPE }, + { "123" , "Lotus", "calc_Lotus", LOTUS123_FORMAT_TYPE } +}; + +} + +class ScExportTest : public test::BootstrapFixture +{ +public: + ScExportTest(); + + virtual void setUp(); + virtual void tearDown(); + + ScDocShellRef saveAndReload( ScDocShell*, const rtl::OUString&, const rtl::OUString&, const rtl::OUString&, sal_uLong ); + ScDocShellRef saveAndReloadPassword( ScDocShell*, const rtl::OUString&, const rtl::OUString&, const rtl::OUString&, sal_uLong ); + + void test(); + void testPasswordExport(); + void testConditionalFormatExportXLSX(); + + CPPUNIT_TEST_SUITE(ScExportTest); + CPPUNIT_TEST(test); +#if !defined(MACOSX) && !defined(DRAGONFLY) && !defined(WNT) + CPPUNIT_TEST(testPasswordExport); +#endif + CPPUNIT_TEST(testConditionalFormatExportXLSX); + CPPUNIT_TEST_SUITE_END(); + +private: + rtl::OUString m_aBaseString; + uno::Reference<uno::XInterface> m_xCalcComponent; + + ScDocShellRef saveAndReload( ScDocShell* pShell, sal_Int32 nFormat ); + ScDocShellRef loadDocument( const rtl::OUString& rFileNameBase, sal_Int32 nFormat ); + void createFileURL( const rtl::OUString& aFileBase, const rtl::OUString& rFileExtension, rtl::OUString& rFilePath); + void createCSVPath(const rtl::OUString& rFileBase, rtl::OUString& rCSVPath); +}; + +void ScExportTest::createFileURL(const rtl::OUString& aFileBase, const rtl::OUString& aFileExtension, rtl::OUString& rFilePath) +{ + rtl::OUString aSep("/"); + rtl::OUStringBuffer aBuffer( getSrcRootURL() ); + aBuffer.append(m_aBaseString).append(aSep).append(aFileExtension); + aBuffer.append(aSep).append(aFileBase).append(aFileExtension); + rFilePath = aBuffer.makeStringAndClear(); +} + +void ScExportTest::createCSVPath(const rtl::OUString& aFileBase, rtl::OUString& rCSVPath) +{ + rtl::OUStringBuffer aBuffer(getSrcRootPath()); + aBuffer.append(m_aBaseString).append(rtl::OUString("/contentCSV/")); + aBuffer.append(aFileBase).append(rtl::OUString("csv")); + rCSVPath = aBuffer.makeStringAndClear(); +} + +ScDocShellRef ScExportTest::saveAndReloadPassword(ScDocShell* pShell, const rtl::OUString &rFilter, + const rtl::OUString &rUserData, const rtl::OUString& rTypeName, sal_uLong nFormatType) +{ + + utl::TempFile aTempFile; + aTempFile.EnableKillingFile(); + SfxMedium aStoreMedium( aTempFile.GetURL(), STREAM_STD_WRITE ); + sal_uInt32 nExportFormat = 0; + if (nFormatType) + nExportFormat = SFX_FILTER_EXPORT | SFX_FILTER_USESOPTIONS; + SfxFilter* pExportFilter = new SfxFilter( + rFilter, + rtl::OUString(), nFormatType, nExportFormat, rTypeName, 0, rtl::OUString(), + rUserData, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc*")) ); + pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); + aStoreMedium.SetFilter(pExportFilter); + SfxItemSet* pExportSet = aStoreMedium.GetItemSet(); + uno::Sequence< beans::NamedValue > aEncryptionData = comphelper::OStorageHelper::CreatePackageEncryptionData( rtl::OUString("test") ); + uno::Any xEncryptionData; + xEncryptionData <<= aEncryptionData; + pExportSet->Put(SfxUnoAnyItem(SID_ENCRYPTIONDATA, xEncryptionData)); + + uno::Reference< embed::XStorage > xMedStorage = aStoreMedium.GetStorage(); + ::comphelper::OStorageHelper::SetCommonStorageEncryptionData( xMedStorage, aEncryptionData ); + + pShell->DoSaveAs( aStoreMedium ); + pShell->DoClose(); + + //std::cout << "File: " << aTempFile.GetURL() << std::endl; + + sal_uInt32 nFormat = 0; + if (nFormatType) + nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS; + SfxFilter* pFilter = new SfxFilter( + rFilter, + rtl::OUString(), nFormatType, nFormat, rTypeName, 0, rtl::OUString(), + rUserData, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc*")) ); + pFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); + + ScDocShellRef xDocShRef = new ScDocShell; + SfxMedium* pSrcMed = new SfxMedium(aTempFile.GetURL(), STREAM_STD_READ); + SfxItemSet* pSet = pSrcMed->GetItemSet(); + pSet->Put(SfxStringItem(SID_PASSWORD, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("test")))); + pSrcMed->SetFilter(pFilter); + if (!xDocShRef->DoLoad(pSrcMed)) + { + xDocShRef->DoClose(); + // load failed. + xDocShRef.Clear(); + } + + return xDocShRef; +} + +ScDocShellRef ScExportTest::saveAndReload(ScDocShell* pShell, const rtl::OUString &rFilter, + const rtl::OUString &rUserData, const rtl::OUString& rTypeName, sal_uLong nFormatType) +{ + + utl::TempFile aTempFile; + aTempFile.EnableKillingFile(); + SfxMedium aStoreMedium( aTempFile.GetURL(), STREAM_STD_WRITE ); + sal_uInt32 nExportFormat = 0; + if (nFormatType) + nExportFormat = SFX_FILTER_EXPORT | SFX_FILTER_USESOPTIONS; + SfxFilter* pExportFilter = new SfxFilter( + rFilter, + rtl::OUString(), nFormatType, nExportFormat, rTypeName, 0, rtl::OUString(), + rUserData, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc*")) ); + pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); + aStoreMedium.SetFilter(pExportFilter); + pShell->DoSaveAs( aStoreMedium ); + pShell->DoClose(); + + //std::cout << "File: " << aTempFile.GetURL() << std::endl; + + sal_uInt32 nFormat = 0; + if (nFormatType) + nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS; + SfxFilter* pFilter = new SfxFilter( + rFilter, + rtl::OUString(), nFormatType, nFormat, rTypeName, 0, rtl::OUString(), + rUserData, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc*")) ); + pFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); + + ScDocShellRef xDocShRef = new ScDocShell; + SfxMedium* pSrcMed = new SfxMedium(aTempFile.GetURL(), STREAM_STD_READ); + pSrcMed->SetFilter(pFilter); + if (!xDocShRef->DoLoad(pSrcMed)) + { + xDocShRef->DoClose(); + // load failed. + xDocShRef.Clear(); + } + + return xDocShRef; +} + +ScDocShellRef ScExportTest::saveAndReload( ScDocShell* pShell, sal_Int32 nFormat ) +{ + rtl::OUString aFileExtension(aFileFormats[nFormat].pName, strlen(aFileFormats[nFormat].pName), RTL_TEXTENCODING_UTF8 ); + rtl::OUString aFilterName(aFileFormats[nFormat].pFilterName, strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ; + rtl::OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8); + ScDocShellRef xDocSh = saveAndReload(pShell, aFilterName, rtl::OUString(), aFilterType, aFileFormats[nFormat].nFormatType); + + CPPUNIT_ASSERT(xDocSh.Is()); + return xDocSh; +} + +ScDocShellRef ScExportTest::loadDocument(const rtl::OUString& rFileName, sal_Int32 nFormat) +{ + rtl::OUString aFileExtension(aFileFormats[nFormat].pName, strlen(aFileFormats[nFormat].pName), RTL_TEXTENCODING_UTF8 ); + rtl::OUString aFilterName(aFileFormats[nFormat].pFilterName, strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ; + rtl::OUString aFileName; + createFileURL( rFileName, aFileExtension, aFileName ); + rtl::OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8); + unsigned int nFormatType = aFileFormats[nFormat].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + + SfxFilter* pFilter = new SfxFilter( + aFilterName, + rtl::OUString(), nFormatType, nClipboardId, aFilterType, 0, rtl::OUString(), + rtl::OUString(), rtl::OUString("private:factory/scalc*") ); + pFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); + + ScDocShellRef xDocShRef = new ScDocShell; + SfxMedium* pSrcMed = new SfxMedium(aFileName, STREAM_STD_READ); + pSrcMed->SetFilter(pFilter); + if (!xDocShRef->DoLoad(pSrcMed)) + { + xDocShRef->DoClose(); + // load failed. + xDocShRef.Clear(); + } + + return xDocShRef; +} + +void ScExportTest::test() +{ + ScDocShell* pShell = new ScDocShell( + SFXMODEL_STANDARD | + SFXMODEL_DISABLE_EMBEDDED_SCRIPTS | + SFXMODEL_DISABLE_DOCUMENT_RECOVERY); + pShell->DoInitNew(); + + ScDocument* pDoc = pShell->GetDocument(); + + pDoc->SetValue(0,0,0, 1.0); + CPPUNIT_ASSERT(pDoc); + + ScDocShellRef xDocSh = saveAndReload( pShell, ODS ); + + CPPUNIT_ASSERT(xDocSh.Is()); + ScDocument* pLoadedDoc = xDocSh->GetDocument(); + double aVal = pLoadedDoc->GetValue(0,0,0); + CPPUNIT_ASSERT_DOUBLES_EQUAL(aVal, 1.0, 1e-8); +} + +void ScExportTest::testPasswordExport() +{ + ScDocShell* pShell = new ScDocShell( + SFXMODEL_STANDARD | + SFXMODEL_DISABLE_EMBEDDED_SCRIPTS | + SFXMODEL_DISABLE_DOCUMENT_RECOVERY); + pShell->DoInitNew(); + + ScDocument* pDoc = pShell->GetDocument(); + + pDoc->SetValue(0,0,0, 1.0); + CPPUNIT_ASSERT(pDoc); + + sal_Int32 nFormat = ODS; + rtl::OUString aFileExtension(aFileFormats[nFormat].pName, strlen(aFileFormats[nFormat].pName), RTL_TEXTENCODING_UTF8 ); + rtl::OUString aFilterName(aFileFormats[nFormat].pFilterName, strlen(aFileFormats[nFormat].pFilterName), RTL_TEXTENCODING_UTF8) ; + rtl::OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8); + ScDocShellRef xDocSh = saveAndReloadPassword(pShell, aFilterName, rtl::OUString(), aFilterType, aFileFormats[nFormat].nFormatType); + + CPPUNIT_ASSERT(xDocSh.Is()); + ScDocument* pLoadedDoc = xDocSh->GetDocument(); + double aVal = pLoadedDoc->GetValue(0,0,0); + CPPUNIT_ASSERT_DOUBLES_EQUAL(aVal, 1.0, 1e-8); +} + +void ScExportTest::testConditionalFormatExportXLSX() +{ + ScDocShellRef xShell = loadDocument("new_cond_format_test.", XLSX); + CPPUNIT_ASSERT(xShell.Is()); + + ScDocShellRef xDocSh = saveAndReload(&(*xShell), XLSX); + CPPUNIT_ASSERT(xDocSh.Is()); + ScDocument* pDoc = xDocSh->GetDocument(); + rtl::OUString aCSVFile("new_cond_format_test."); + rtl::OUString aCSVPath; + createCSVPath( aCSVFile, aCSVPath ); + testCondFile(aCSVPath, pDoc, 0); +} + +ScExportTest::ScExportTest() + : m_aBaseString(RTL_CONSTASCII_USTRINGPARAM("/sc/qa/unit/data")) +{ +} + +void ScExportTest::setUp() +{ + test::BootstrapFixture::setUp(); + + // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure, + // which is a private symbol to us, gets called + m_xCalcComponent = + getMultiServiceFactory()->createInstance(rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Calc.SpreadsheetDocument"))); + CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is()); +} + +void ScExportTest::tearDown() +{ + uno::Reference< lang::XComponent >( m_xCalcComponent, UNO_QUERY_THROW )->dispose(); + test::BootstrapFixture::tearDown(); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 10db9aeb80fc..fd49ed1229e3 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -83,7 +83,7 @@ using namespace ::com::sun::star::uno; namespace { struct FileFormat { - const char* pName; const char* pFilterName; const char* pTypeName; sal_uLong nFormatType; + const char* pName; const char* pFilterName; const char* pTypeName; unsigned int nFormatType; }; FileFormat aFileFormats[] = { @@ -105,9 +105,13 @@ class ScFiltersTest public: ScFiltersTest(); - virtual bool load(const rtl::OUString &rFilter, const rtl::OUString &rURL, const rtl::OUString &rUserData); + virtual bool load( const rtl::OUString &rFilter, const rtl::OUString &rURL, + const rtl::OUString &rUserData, unsigned int nFilterFlags, + unsigned int nClipboardID, unsigned int nFilterVersion); + ScDocShellRef load(const rtl::OUString &rFilter, const rtl::OUString &rURL, - const rtl::OUString &rUserData, const rtl::OUString& rTypeName, sal_uLong nFormatType=0); + const rtl::OUString &rUserData, const rtl::OUString& rTypeName, + unsigned int nFilterFlags, unsigned int nClipboardID, unsigned int nFilterVersion); void createFileURL(const rtl::OUString& aFileBase, const rtl::OUString& aFileExtension, rtl::OUString& rFilePath); void createCSVPath(const rtl::OUString& aFileBase, rtl::OUString& rFilePath); @@ -230,20 +234,18 @@ private: }; ScDocShellRef ScFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL, - const rtl::OUString &rUserData, const rtl::OUString& rTypeName, sal_uLong nFormatType) + const rtl::OUString &rUserData, const rtl::OUString& rTypeName, + unsigned int nFilterFlags, unsigned int nClipboardID, unsigned int nFilterVersion) { - sal_uInt32 nFormat = 0; - if (nFormatType) - nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS; - SfxFilter* aFilter = new SfxFilter( + SfxFilter* pFilter = new SfxFilter( rFilter, - rtl::OUString(), nFormatType, nFormat, rTypeName, 0, rtl::OUString(), - rUserData, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/scalc*")) ); - aFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT); + rtl::OUString(), nFilterFlags, nClipboardID, rTypeName, 0, rtl::OUString(), + rUserData, rtl::OUString("private:factory/scalc*") ); + pFilter->SetVersion(nFilterVersion); ScDocShellRef xDocShRef = new ScDocShell; SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ); - pSrcMed->SetFilter(aFilter); + pSrcMed->SetFilter(pFilter); if (!xDocShRef->DoLoad(pSrcMed)) { xDocShRef->DoClose(); @@ -255,9 +257,11 @@ ScDocShellRef ScFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUStr } bool ScFiltersTest::load(const rtl::OUString &rFilter, const rtl::OUString &rURL, - const rtl::OUString &rUserData) + const rtl::OUString &rUserData, unsigned int nFilterFlags, + unsigned int nClipboardID, unsigned int nFilterVersion) { - ScDocShellRef xDocShRef = load(rFilter, rURL, rUserData, rtl::OUString()); + ScDocShellRef xDocShRef = load(rFilter, rURL, rUserData, + rtl::OUString(), nFilterFlags, nClipboardID, nFilterVersion); bool bLoaded = xDocShRef.Is(); //reference counting of ScDocShellRef is very confused. if (bLoaded) @@ -272,7 +276,10 @@ ScDocShellRef ScFiltersTest::loadDoc(const rtl::OUString& rName, sal_Int32 nForm rtl::OUString aFileName; createFileURL( rName, aFileExtension, aFileName ); rtl::OUString aFilterType(aFileFormats[nFormat].pTypeName, strlen(aFileFormats[nFormat].pTypeName), RTL_TEXTENCODING_UTF8); - ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[nFormat].nFormatType); + unsigned int nFormatType = aFileFormats[nFormat].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); CPPUNIT_ASSERT(xDocSh.Is()); return xDocSh; } @@ -933,7 +940,10 @@ void ScFiltersTest::testBugFixesODS() createFileURL(aFileNameBase, aFileExtension, aFileName); rtl::OUString aFilterType(aFileFormats[0].pTypeName, strlen(aFileFormats[0].pTypeName), RTL_TEXTENCODING_UTF8); std::cout << aFileFormats[0].pName << " Test" << std::endl; - ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[0].nFormatType); + unsigned int nFormatType = aFileFormats[0].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); xDocSh->DoHardRecalc(true); CPPUNIT_ASSERT_MESSAGE("Failed to load bugFixes.ods", xDocSh.Is()); @@ -969,7 +979,10 @@ void ScFiltersTest::testBugFixesXLS() createFileURL(aFileNameBase, aFileExtension, aFileName); rtl::OUString aFilterType(aFileFormats[1].pTypeName, strlen(aFileFormats[1].pTypeName), RTL_TEXTENCODING_UTF8); std::cout << aFileFormats[1].pName << " Test" << std::endl; - ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[1].nFormatType); + unsigned int nFormatType = aFileFormats[1].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); xDocSh->DoHardRecalc(true); CPPUNIT_ASSERT_MESSAGE("Failed to load bugFixes.xls", xDocSh.Is()); @@ -987,7 +1000,10 @@ void ScFiltersTest::testBugFixesXLSX() createFileURL(aFileNameBase, aFileExtension, aFileName); rtl::OUString aFilterType(aFileFormats[2].pTypeName, strlen(aFileFormats[2].pTypeName), RTL_TEXTENCODING_UTF8); std::cout << aFileFormats[2].pName << " Test" << std::endl; - ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[2].nFormatType); + unsigned int nFormatType = aFileFormats[2].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); xDocSh->DoHardRecalc(true); CPPUNIT_ASSERT_MESSAGE("Failed to load bugFixes.xlsx", xDocSh.Is()); @@ -1211,7 +1227,11 @@ void ScFiltersTest::testBrokenQuotesCSV() createFileURL(aFileNameBase, aFileExtension, aFileName); rtl::OUString aFilterType(aFileFormats[CSV].pTypeName, strlen(aFileFormats[CSV].pTypeName), RTL_TEXTENCODING_UTF8); std::cout << aFileFormats[CSV].pName << " Test" << std::endl; - ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[CSV].nFormatType); + + unsigned int nFormatType = aFileFormats[CSV].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); CPPUNIT_ASSERT_MESSAGE("Failed to load fdo48621_broken_quotes.csv", xDocSh.Is()); ScDocument* pDoc = xDocSh->GetDocument(); @@ -1235,7 +1255,12 @@ void ScFiltersTest::testSharedFormulaXLSX() createFileURL(aFileNameBase, aFileExtension, aFileName); rtl::OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8); std::cout << aFileFormats[XLSX].pName << " Test" << std::endl; - ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[XLSX].nFormatType); + + unsigned int nFormatType = aFileFormats[XLSX].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); + xDocSh->DoHardRecalc(true); CPPUNIT_ASSERT_MESSAGE("Failed to load shared-formula.xlsx", xDocSh.Is()); @@ -1265,7 +1290,11 @@ void ScFiltersTest::testCellValueXLSX() createFileURL(aFileNameBase, aFileExtension, aFileName); rtl::OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8); std::cout << aFileFormats[XLSX].pName << " Test" << std::endl; - ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[XLSX].nFormatType); + + unsigned int nFormatType = aFileFormats[XLSX].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); CPPUNIT_ASSERT_MESSAGE("Failed to load cell-value.xlsx", xDocSh.Is()); ScDocument* pDoc = xDocSh->GetDocument(); @@ -1335,7 +1364,11 @@ void ScFiltersTest::testControlImport() createFileURL(aFileNameBase, aFileExtension, aFileName); rtl::OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8); std::cout << aFileFormats[XLSX].pName << " Test" << std::endl; - ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[XLSX].nFormatType); + + unsigned int nFormatType = aFileFormats[XLSX].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); CPPUNIT_ASSERT_MESSAGE("Failed to load cell-value.xlsx", xDocSh.Is()); @@ -1359,7 +1392,12 @@ void ScFiltersTest::testNumberFormatHTML() rtl::OUString aFileName; createFileURL(aFileNameBase, aFileExt, aFileName); - ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[HTML].nFormatType); + + unsigned int nFormatType = aFileFormats[HTML].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); + CPPUNIT_ASSERT_MESSAGE("Failed to load numberformat.html", xDocSh.Is()); ScDocument* pDoc = xDocSh->GetDocument(); @@ -1386,7 +1424,12 @@ void ScFiltersTest::testNumberFormatCSV() rtl::OUString aFileName; createFileURL(aFileNameBase, aFileExt, aFileName); - ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[CSV].nFormatType); + + unsigned int nFormatType = aFileFormats[CSV].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); + CPPUNIT_ASSERT_MESSAGE("Failed to load numberformat.html", xDocSh.Is()); ScDocument* pDoc = xDocSh->GetDocument(); @@ -1413,7 +1456,12 @@ void ScFiltersTest::testCellAnchoredShapesODS() rtl::OUString aFileName; createFileURL(aFileNameBase, aFileExt, aFileName); - ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[ODS].nFormatType); + + unsigned int nFormatType = aFileFormats[ODS].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); + CPPUNIT_ASSERT_MESSAGE("Failed to load cell-anchored-shapes.ods", xDocSh.Is()); // There are two cell-anchored objects on the first sheet. @@ -1468,7 +1516,12 @@ void ScFiltersTest::testPivotTableBasicODS() rtl::OUString aFileName; createFileURL(aFileNameBase, aFileExt, aFileName); - ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[ODS].nFormatType); + + unsigned int nFormatType = aFileFormats[ODS].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); + CPPUNIT_ASSERT_MESSAGE("Failed to load pivot-table-basic.ods", xDocSh.Is()); ScDocument* pDoc = xDocSh->GetDocument(); @@ -1570,7 +1623,11 @@ void ScFiltersTest::testColorScaleODS() createFileURL(aFileNameBase, aFileExtension, aFileName); rtl::OUString aFilterType(aFileFormats[ODS].pTypeName, strlen(aFileFormats[ODS].pTypeName), RTL_TEXTENCODING_UTF8); std::cout << aFileFormats[ODS].pName << " Test" << std::endl; - ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[ODS].nFormatType); + + unsigned int nFormatType = aFileFormats[ODS].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); CPPUNIT_ASSERT_MESSAGE("Failed to load colorScale.ods", xDocSh.Is()); @@ -1590,7 +1647,11 @@ void ScFiltersTest::testColorScaleXLSX() createFileURL(aFileNameBase, aFileExtension, aFileName); rtl::OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8); std::cout << aFileFormats[XLSX].pName << " Test" << std::endl; - ScDocShellRef xDocSh = load (aFilterName, aFileName, rtl::OUString(), aFilterType, aFileFormats[XLSX].nFormatType); + + unsigned int nFormatType = aFileFormats[XLSX].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); CPPUNIT_ASSERT_MESSAGE("Failed to load colorScale.xlsx", xDocSh.Is()); @@ -1603,12 +1664,31 @@ void ScFiltersTest::testColorScaleXLSX() void ScFiltersTest::testDataBarODS() { - } void ScFiltersTest::testNewCondFormat() { + const rtl::OUString aFileNameBase("new_cond_format_test."); + rtl::OUString aFileExtension(aFileFormats[XLSX].pName, strlen(aFileFormats[XLSX].pName), RTL_TEXTENCODING_UTF8 ); + rtl::OUString aFilterName(aFileFormats[XLSX].pFilterName, strlen(aFileFormats[XLSX].pFilterName), RTL_TEXTENCODING_UTF8) ; + rtl::OUString aFileName; + createFileURL(aFileNameBase, aFileExtension, aFileName); + rtl::OUString aFilterType(aFileFormats[XLSX].pTypeName, strlen(aFileFormats[XLSX].pTypeName), RTL_TEXTENCODING_UTF8); + std::cout << aFileFormats[XLSX].pName << " Test" << std::endl; + + unsigned int nFormatType = aFileFormats[XLSX].nFormatType; + unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0; + ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType, + nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT); + + CPPUNIT_ASSERT_MESSAGE("Failed to load new_cond_format_test.xlsx", xDocSh.Is()); + ScDocument* pDoc = xDocSh->GetDocument(); + + rtl::OUString aCSVFile("new_cond_format_test."); + rtl::OUString aCSVPath; + createCSVPath( aCSVFile, aCSVPath ); + testCondFile(aCSVPath, pDoc, 0); } ScFiltersTest::ScFiltersTest() diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 8eef4104ec99..59a70f8a5b45 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -62,6 +62,7 @@ #include "dpsave.hxx" #include "dpdimsave.hxx" #include "dpcache.hxx" +#include "dpfilteredcache.hxx" #include "calcconfig.hxx" #include "interpre.hxx" @@ -82,11 +83,13 @@ #include <com/sun/star/sheet/GeneralFunction.hpp> #include <iostream> +#include <sstream> #include <vector> #define CALC_DEBUG_OUTPUT 0 #include "helper/debughelper.hxx" +#include "helper/qahelper.hxx" const int indeterminate = 2; @@ -118,10 +121,12 @@ public: */ void testSheetsFunc(); void testVolatileFunc(); + void testFormulaDepTracking(); void testFuncParam(); void testNamedRange(); void testCSV(); void testMatrix(); + void testEnterMixedMatrix(); /** * Basic test for pivot tables. @@ -175,6 +180,12 @@ public: */ void testPivotTableCaseInsensitiveStrings(); + /** + * Test for pivot table's handling of double-precision numbers that are + * very close together. + */ + void testPivotTableNumStability(); + void testSheetCopy(); void testSheetMove(); void testExternalRef(); @@ -225,6 +236,9 @@ public: void testFindAreaPosColRight(); void testSort(); void testSortWithFormulaRefs(); + void testShiftCells(); + void testDeleteRow(); + void testDeleteCol(); CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testCollator); @@ -233,10 +247,12 @@ public: CPPUNIT_TEST(testCellFunctions); CPPUNIT_TEST(testSheetsFunc); CPPUNIT_TEST(testVolatileFunc); + CPPUNIT_TEST(testFormulaDepTracking); CPPUNIT_TEST(testFuncParam); CPPUNIT_TEST(testNamedRange); CPPUNIT_TEST(testCSV); CPPUNIT_TEST(testMatrix); + CPPUNIT_TEST(testEnterMixedMatrix); CPPUNIT_TEST(testPivotTable); CPPUNIT_TEST(testPivotTableLabels); CPPUNIT_TEST(testPivotTableDateLabels); @@ -250,6 +266,7 @@ public: CPPUNIT_TEST(testPivotTableEmptyRows); CPPUNIT_TEST(testPivotTableTextNumber); CPPUNIT_TEST(testPivotTableCaseInsensitiveStrings); + CPPUNIT_TEST(testPivotTableNumStability); CPPUNIT_TEST(testSheetCopy); CPPUNIT_TEST(testSheetMove); CPPUNIT_TEST(testExternalRef); @@ -275,6 +292,9 @@ public: CPPUNIT_TEST(testFindAreaPosColRight); CPPUNIT_TEST(testSort); CPPUNIT_TEST(testSortWithFormulaRefs); + CPPUNIT_TEST(testShiftCells); + CPPUNIT_TEST(testDeleteRow); + CPPUNIT_TEST(testDeleteCol); CPPUNIT_TEST_SUITE_END(); private: @@ -328,6 +348,45 @@ ScRange insertRangeData(ScDocument* pDoc, const ScAddress& rPos, const char* aDa return aRange; } +/** + * Temporarily switch on/off auto calculation mode. + */ +class AutoCalcSwitch +{ + ScDocument* mpDoc; + bool mbOldValue; +public: + AutoCalcSwitch(ScDocument* pDoc, bool bAutoCalc) : mpDoc(pDoc), mbOldValue(pDoc->GetAutoCalc()) + { + mpDoc->SetAutoCalc(bAutoCalc); + } + + ~AutoCalcSwitch() + { + mpDoc->SetAutoCalc(mbOldValue); + } +}; + +/** + * Temporarily set formula grammar. + */ +class FormulaGrammarSwitch +{ + ScDocument* mpDoc; + formula::FormulaGrammar::Grammar meOldGrammar; +public: + FormulaGrammarSwitch(ScDocument* pDoc, formula::FormulaGrammar::Grammar eGrammar) : + mpDoc(pDoc), meOldGrammar(pDoc->GetGrammar()) + { + mpDoc->SetGrammar(eGrammar); + } + + ~FormulaGrammarSwitch() + { + mpDoc->SetGrammar(meOldGrammar); + } +}; + Test::Test() : m_pDoc(0) { @@ -1056,6 +1115,114 @@ void Test::testVolatileFunc() m_pDoc->DeleteTab(0); } +void Test::testFormulaDepTracking() +{ + CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", m_pDoc->InsertTab (0, "foo")); + + AutoCalcSwitch aACSwitch(m_pDoc, true); // turn on auto calculation. + + // B2 listens on D2. + m_pDoc->SetString(1, 1, 0, "=D2"); + double val = -999.0; // dummy initial value + m_pDoc->GetValue(1, 1, 0, val); + CPPUNIT_ASSERT_MESSAGE("Referencing an empty cell should yield zero.", val == 0.0); + + // Changing the value of D2 should trigger recalculation of B2. + m_pDoc->SetValue(3, 1, 0, 1.1); + m_pDoc->GetValue(1, 1, 0, val); + CPPUNIT_ASSERT_MESSAGE("Failed to recalculate on value change.", val == 1.1); + + // And again. + m_pDoc->SetValue(3, 1, 0, 2.2); + m_pDoc->GetValue(1, 1, 0, val); + CPPUNIT_ASSERT_MESSAGE("Failed to recalculate on value change.", val == 2.2); + + clearRange(m_pDoc, ScRange(0, 0, 0, 10, 10, 0)); + + // Now, let's test the range dependency tracking. + + // B2 listens on D2:E6. + m_pDoc->SetString(1, 1, 0, "=SUM(D2:E6)"); + m_pDoc->GetValue(1, 1, 0, val); + CPPUNIT_ASSERT_MESSAGE("Summing an empty range should yield zero.", val == 0.0); + + // Set value to E3. This should trigger recalc on B2. + m_pDoc->SetValue(4, 2, 0, 2.4); + m_pDoc->GetValue(1, 1, 0, val); + CPPUNIT_ASSERT_MESSAGE("Failed to recalculate on single value change.", val == 2.4); + + // Set value to D5 to trigger recalc again. Note that this causes an + // addition of 1.2 + 2.4 which is subject to binary floating point + // rounding error. We need to use approxEqual to assess its value. + + m_pDoc->SetValue(3, 4, 0, 1.2); + m_pDoc->GetValue(1, 1, 0, val); + CPPUNIT_ASSERT_MESSAGE("Failed to recalculate on single value change.", rtl::math::approxEqual(val, 3.6)); + + // Change the value of D2 (boundary case). + m_pDoc->SetValue(3, 1, 0, 1.0); + m_pDoc->GetValue(1, 1, 0, val); + CPPUNIT_ASSERT_MESSAGE("Failed to recalculate on single value change.", rtl::math::approxEqual(val, 4.6)); + + // Change the value of E6 (another boundary case). + m_pDoc->SetValue(4, 5, 0, 2.0); + m_pDoc->GetValue(1, 1, 0, val); + CPPUNIT_ASSERT_MESSAGE("Failed to recalculate on single value change.", rtl::math::approxEqual(val, 6.6)); + + // Change the value of D6 (another boundary case). + m_pDoc->SetValue(3, 5, 0, 3.0); + m_pDoc->GetValue(1, 1, 0, val); + CPPUNIT_ASSERT_MESSAGE("Failed to recalculate on single value change.", rtl::math::approxEqual(val, 9.6)); + + // Change the value of E2 (another boundary case). + m_pDoc->SetValue(4, 1, 0, 0.4); + m_pDoc->GetValue(1, 1, 0, val); + CPPUNIT_ASSERT_MESSAGE("Failed to recalculate on single value change.", rtl::math::approxEqual(val, 10.0)); + + // Change the existing non-empty value cell (E2). + m_pDoc->SetValue(4, 1, 0, 2.4); + m_pDoc->GetValue(1, 1, 0, val); + CPPUNIT_ASSERT_MESSAGE("Failed to recalculate on single value change.", rtl::math::approxEqual(val, 12.0)); + + clearRange(m_pDoc, ScRange(0, 0, 0, 10, 10, 0)); + + // Now, column-based dependency tracking. We now switch to the R1C1 + // syntax which is easier to use for repeated relative references. + + FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1); + + val = 0.0; + for (SCROW nRow = 1; nRow <= 9; ++nRow) + { + // Static value in column 1. + m_pDoc->SetValue(0, nRow, 0, ++val); + + // Formula in column 2 that references cell to the left. + m_pDoc->SetString(1, nRow, 0, "=RC[-1]"); + + // Formula in column 3 that references cell to the left. + m_pDoc->SetString(2, nRow, 0, "=RC[-1]*2"); + } + + // Check formula values. + val = 0.0; + for (SCROW nRow = 1; nRow <= 9; ++nRow) + { + ++val; + CPPUNIT_ASSERT_MESSAGE("Unexpected formula value.", m_pDoc->GetValue(1, nRow, 0) == val); + CPPUNIT_ASSERT_MESSAGE("Unexpected formula value.", m_pDoc->GetValue(2, nRow, 0) == val*2.0); + } + + // Intentionally insert a formula in column 1. This will break column 1's + // uniformity of consisting only of static value cells. + m_pDoc->SetString(0, 4, 0, "=R2C3"); + CPPUNIT_ASSERT_MESSAGE("Unexpected formula value.", m_pDoc->GetValue(0, 4, 0) == 2.0); + CPPUNIT_ASSERT_MESSAGE("Unexpected formula value.", m_pDoc->GetValue(1, 4, 0) == 2.0); + CPPUNIT_ASSERT_MESSAGE("Unexpected formula value.", m_pDoc->GetValue(2, 4, 0) == 4.0); + + m_pDoc->DeleteTab(0); +} + void Test::testFuncParam() { rtl::OUString aTabName("foo"); @@ -1349,6 +1516,31 @@ void Test::testMatrix() checkMatrixElements<PartiallyFilledEmptyMatrix>(*pMat); } +void Test::testEnterMixedMatrix() +{ + m_pDoc->InsertTab(0, "foo"); + + // Insert the source values in A1:B2. + m_pDoc->SetString(0, 0, 0, "A"); + m_pDoc->SetString(1, 0, 0, "B"); + double val = 1.0; + m_pDoc->SetValue(0, 1, 0, val); + val = 2.0; + m_pDoc->SetValue(1, 1, 0, val); + + // Create a matrix range in A4:B5 referencing A1:B2. + ScMarkData aMark; + aMark.SelectOneTable(0); + m_pDoc->InsertMatrixFormula(0, 3, 1, 4, aMark, "=A1:B2", NULL); + + CPPUNIT_ASSERT_EQUAL(m_pDoc->GetString(0,0,0), m_pDoc->GetString(0,3,0)); + CPPUNIT_ASSERT_EQUAL(m_pDoc->GetString(1,0,0), m_pDoc->GetString(1,3,0)); + CPPUNIT_ASSERT_EQUAL(m_pDoc->GetValue(0,1,0), m_pDoc->GetValue(0,4,0)); + CPPUNIT_ASSERT_EQUAL(m_pDoc->GetValue(1,1,0), m_pDoc->GetValue(1,4,0)); + + m_pDoc->DeleteTab(0); +} + namespace { struct DPFieldDef @@ -1536,22 +1728,6 @@ ScRange refreshGroups(ScDPCollection* pDPs, ScDPObject* pDPObj) return refresh(pDPObj); } -class AutoCalcSwitch -{ - ScDocument* mpDoc; - bool mbOldValue; -public: - AutoCalcSwitch(ScDocument* pDoc, bool bAutoCalc) : mpDoc(pDoc), mbOldValue(pDoc->GetAutoCalc()) - { - mpDoc->SetAutoCalc(bAutoCalc); - } - - ~AutoCalcSwitch() - { - mpDoc->SetAutoCalc(mbOldValue); - } -}; - } void Test::testPivotTable() @@ -2283,6 +2459,29 @@ void Test::testPivotTableCache() } } + // Now, on to testing the filtered cache. + + { + // Non-filtered cache - everything should be visible. + ScDPFilteredCache aFilteredCache(aCache); + aFilteredCache.fillTable(); + + sal_Int32 nRows = aFilteredCache.getRowSize(); + CPPUNIT_ASSERT_MESSAGE("Wrong dimension.", nRows == 6 && aFilteredCache.getColSize() == 3); + + for (sal_Int32 i = 0; i < nRows; ++i) + { + if (!aFilteredCache.isRowActive(i)) + { + std::ostringstream os; + os << "Row " << i << " should be visible but it isn't."; + CPPUNIT_ASSERT_MESSAGE(os.str().c_str(), false); + } + } + } + + // TODO : Add test for filtered caches. + m_pDoc->DeleteTab(0); } @@ -3022,6 +3221,111 @@ void Test::testPivotTableCaseInsensitiveStrings() m_pDoc->DeleteTab(0); } +void Test::testPivotTableNumStability() +{ + FormulaGrammarSwitch aFGSwitch(m_pDoc, formula::FormulaGrammar::GRAM_ENGLISH_XL_R1C1); + + // Raw Data + const char* aData[][4] = { + { "Name", "Time Start", "Time End", "Total" }, + { "Sam", "07:48 AM", "09:00 AM", "=RC[-1]-RC[-2]" }, + { "Sam", "09:00 AM", "10:30 AM", "=RC[-1]-RC[-2]" }, + { "Sam", "10:30 AM", "12:30 PM", "=RC[-1]-RC[-2]" }, + { "Sam", "12:30 PM", "01:00 PM", "=RC[-1]-RC[-2]" }, + { "Sam", "01:00 PM", "01:30 PM", "=RC[-1]-RC[-2]" }, + { "Sam", "01:30 PM", "02:00 PM", "=RC[-1]-RC[-2]" }, + { "Sam", "02:00 PM", "07:15 PM", "=RC[-1]-RC[-2]" }, + { "Sam", "07:47 AM", "09:00 AM", "=RC[-1]-RC[-2]" }, + { "Sam", "09:00 AM", "10:00 AM", "=RC[-1]-RC[-2]" }, + { "Sam", "10:00 AM", "11:00 AM", "=RC[-1]-RC[-2]" }, + { "Sam", "11:00 AM", "11:30 AM", "=RC[-1]-RC[-2]" }, + { "Sam", "11:30 AM", "12:45 PM", "=RC[-1]-RC[-2]" }, + { "Sam", "12:45 PM", "01:15 PM", "=RC[-1]-RC[-2]" }, + { "Sam", "01:15 PM", "02:30 PM", "=RC[-1]-RC[-2]" }, + { "Sam", "02:30 PM", "02:45 PM", "=RC[-1]-RC[-2]" }, + { "Sam", "02:45 PM", "04:30 PM", "=RC[-1]-RC[-2]" }, + { "Sam", "04:30 PM", "06:00 PM", "=RC[-1]-RC[-2]" }, + { "Sam", "06:00 PM", "07:15 PM", "=RC[-1]-RC[-2]" }, + { "Mike", "06:15 AM", "08:30 AM", "=RC[-1]-RC[-2]" }, + { "Mike", "08:30 AM", "10:03 AM", "=RC[-1]-RC[-2]" }, + { "Mike", "10:03 AM", "12:00 PM", "=RC[-1]-RC[-2]" }, + { "Dennis", "11:00 AM", "01:00 PM", "=RC[-1]-RC[-2]" }, + { "Dennis", "01:00 PM", "02:00 PM", "=RC[-1]-RC[-2]" } + }; + + // Dimension definition + DPFieldDef aFields[] = { + { "Name", sheet::DataPilotFieldOrientation_ROW, 0 }, + { "Total", sheet::DataPilotFieldOrientation_DATA, sheet::GeneralFunction_SUM }, + }; + + m_pDoc->InsertTab(0, OUString("Data")); + m_pDoc->InsertTab(1, OUString("Table")); + + size_t nRowCount = SAL_N_ELEMENTS(aData); + ScAddress aPos(1,1,0); + ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, nRowCount); + + // Insert formulas to manually calculate sums for each name. + m_pDoc->SetString(aDataRange.aStart.Col(), aDataRange.aEnd.Row()+1, aDataRange.aStart.Tab(), "=SUMIF(R[-23]C:R[-1]C;\"Dennis\";R[-23]C[3]:R[-1]C[3])"); + m_pDoc->SetString(aDataRange.aStart.Col(), aDataRange.aEnd.Row()+2, aDataRange.aStart.Tab(), "=SUMIF(R[-24]C:R[-2]C;\"Mike\";R[-24]C[3]:R[-2]C[3])"); + m_pDoc->SetString(aDataRange.aStart.Col(), aDataRange.aEnd.Row()+3, aDataRange.aStart.Tab(), "=SUMIF(R[-25]C:R[-3]C;\"Sam\";R[-25]C[3]:R[-3]C[3])"); + + m_pDoc->CalcAll(); + + // Get correct sum values. + double fDennisTotal = m_pDoc->GetValue(aDataRange.aStart.Col(), aDataRange.aEnd.Row()+1, aDataRange.aStart.Tab()); + double fMikeTotal = m_pDoc->GetValue(aDataRange.aStart.Col(), aDataRange.aEnd.Row()+2, aDataRange.aStart.Tab()); + double fSamTotal = m_pDoc->GetValue(aDataRange.aStart.Col(), aDataRange.aEnd.Row()+3, aDataRange.aStart.Tab()); + + ScDPObject* pDPObj = createDPFromRange( + m_pDoc, aDataRange, aFields, SAL_N_ELEMENTS(aFields), false); + + ScDPCollection* pDPs = m_pDoc->GetDPCollection(); + bool bSuccess = pDPs->InsertNewTable(pDPObj); + + CPPUNIT_ASSERT_MESSAGE("failed to insert a new pivot table object into document.", bSuccess); + CPPUNIT_ASSERT_EQUAL_MESSAGE("there should be only one data pilot table.", + pDPs->GetCount(), static_cast<size_t>(1)); + pDPObj->SetName(pDPs->CreateNewName()); + + ScRange aOutRange = refresh(pDPObj); + + // Manually check the total value for each name. + // + // +--------------+----------------+ + // | Name | | + // +--------------+----------------+ + // | Dennis | <Dennis total> | + // +--------------+----------------+ + // | Mike | <Miks total> | + // +--------------+----------------+ + // | Sam | <Sam total> | + // +--------------+----------------+ + // | Total Result | ... | + // +--------------+----------------+ + + aPos = aOutRange.aStart; + aPos.IncCol(); + aPos.IncRow(); + double fTest = m_pDoc->GetValue(aPos); + CPPUNIT_ASSERT_MESSAGE("Incorrect value for Dennis.", rtl::math::approxEqual(fTest, fDennisTotal)); + aPos.IncRow(); + fTest = m_pDoc->GetValue(aPos); + CPPUNIT_ASSERT_MESSAGE("Incorrect value for Mike.", rtl::math::approxEqual(fTest, fMikeTotal)); + aPos.IncRow(); + fTest = m_pDoc->GetValue(aPos); + CPPUNIT_ASSERT_MESSAGE("Incorrect value for Sam.", rtl::math::approxEqual(fTest, fSamTotal)); + + pDPs->FreeTable(pDPObj); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no more tables.", pDPs->GetCount(), static_cast<size_t>(0)); + CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be any more cache stored.", + pDPs->GetSheetCaches().size(), static_cast<size_t>(0)); + + m_pDoc->DeleteTab(1); + m_pDoc->DeleteTab(0); +} + void Test::testSheetCopy() { OUString aTabName("TestTab"); @@ -3916,19 +4220,23 @@ void Test::testGraphicsInGroup() //Use a range of rows guaranteed to include all of the square m_pDoc->ShowRows(0, 100, 0, false); + m_pDoc->SetDrawPageSize(0); CPPUNIT_ASSERT_MESSAGE("Should not change when page anchored", aOrigRect == rNewRect); m_pDoc->ShowRows(0, 100, 0, true); + m_pDoc->SetDrawPageSize(0); CPPUNIT_ASSERT_MESSAGE("Should not change when page anchored", aOrigRect == rNewRect); ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *m_pDoc, 0); CPPUNIT_ASSERT_MESSAGE("That shouldn't change size or positioning", aOrigRect == rNewRect); m_pDoc->ShowRows(0, 100, 0, false); + m_pDoc->SetDrawPageSize(0); CPPUNIT_ASSERT_MESSAGE("Left and Right should be unchanged", aOrigRect.nLeft == rNewRect.nLeft && aOrigRect.nRight == rNewRect.nRight); CPPUNIT_ASSERT_MESSAGE("Height should be minimum allowed height", (rNewRect.nBottom - rNewRect.nTop) <= 1); m_pDoc->ShowRows(0, 100, 0, true); + m_pDoc->SetDrawPageSize(0); CPPUNIT_ASSERT_MESSAGE("Should not change when page anchored", aOrigRect == rNewRect); } @@ -3947,6 +4255,7 @@ void Test::testGraphicsInGroup() // Insert 2 rows at the top. This should push the circle object down. m_pDoc->InsertRow(0, 0, MAXCOL, 0, 0, 2); + m_pDoc->SetDrawPageSize(0); // Make sure the size of the circle is still identical. CPPUNIT_ASSERT_MESSAGE("Size of the circle has changed, but shouldn't!", @@ -3954,6 +4263,7 @@ void Test::testGraphicsInGroup() // Delete 2 rows at the top. This should bring the circle object to its original position. m_pDoc->DeleteRow(0, 0, MAXCOL, 0, 0, 2); + m_pDoc->SetDrawPageSize(0); CPPUNIT_ASSERT_MESSAGE("Failed to move back to its original position.", aOrigRect == rNewRect); } @@ -3977,6 +4287,7 @@ void Test::testGraphicsInGroup() // Insert 2 rows at the top and delete them immediately. m_pDoc->InsertRow(0, 0, MAXCOL, 0, 0, 2); m_pDoc->DeleteRow(0, 0, MAXCOL, 0, 0, 2); + m_pDoc->SetDrawPageSize(0); CPPUNIT_ASSERT_MESSAGE("Size of a line object changed after row insertion and removal.", aOrigRect == rNewRect); @@ -4071,7 +4382,7 @@ void Test::testPostIts() rtl::OUString aTabName2("Table2"); m_pDoc->InsertTab(0, aTabName); - ScAddress rAddr(2, 2, 0); + ScAddress rAddr(2, 2, 0); // cell C3 ScPostIt *pNote = m_pDoc->GetNotes(rAddr.Tab())->GetOrCreateNote(rAddr); pNote->SetText(rAddr, aHello); pNote->SetAuthor(aJimBob); @@ -4079,29 +4390,51 @@ void Test::testPostIts() ScPostIt *pGetNote = m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr); CPPUNIT_ASSERT_MESSAGE("note should be itself", pGetNote == pNote ); - bool bInsertRow = m_pDoc->InsertRow( 0, 0, 100, 0, 1, 1 ); + // Insert one row at row 1. + bool bInsertRow = m_pDoc->InsertRow(0, 0, MAXCOL, 0, 1, 1); CPPUNIT_ASSERT_MESSAGE("failed to insert row", bInsertRow ); CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == NULL); - rAddr.IncRow(); + rAddr.IncRow(); // cell C4 CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == pNote); - bool bInsertCol = m_pDoc->InsertCol( 0, 0, 100, 0, 1, 1 ); + // Insert column at column A. + bool bInsertCol = m_pDoc->InsertCol(0, 0, MAXROW, 0, 1, 1); CPPUNIT_ASSERT_MESSAGE("failed to insert column", bInsertCol ); CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == NULL); - rAddr.IncCol(); + rAddr.IncCol(); // cell D4 CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == pNote); + // Insert a new sheet to shift the current sheet to the right. m_pDoc->InsertTab(0, aTabName2); CPPUNIT_ASSERT_MESSAGE("note hasn't moved", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == NULL); - rAddr.IncTab(); + rAddr.IncTab(); // Move to the next sheet. CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == pNote); m_pDoc->DeleteTab(0); rAddr.IncTab(-1); CPPUNIT_ASSERT_MESSAGE("note not there", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == pNote); + // Insert cell at C4. This should NOT shift the note position. + bInsertRow = m_pDoc->InsertRow(2, 0, 2, 0, 3, 1); + CPPUNIT_ASSERT_MESSAGE("Failed to insert cell at C4.", bInsertRow); + CPPUNIT_ASSERT_MESSAGE("Note shouldn't have moved but it has.", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == pNote); + + // Delete cell at C4. Again, this should NOT shift the note position. + m_pDoc->DeleteRow(2, 0, 2, 0, 3, 1); + CPPUNIT_ASSERT_MESSAGE("Note shouldn't have moved but it has.", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == pNote); + + // Now, with the note at D4, delete cell D3. This should shift the note one cell up. + m_pDoc->DeleteRow(3, 0, 3, 0, 2, 1); + rAddr.IncRow(-1); // cell D3 + CPPUNIT_ASSERT_MESSAGE("Note at D4 should have shifted up to D3.", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == pNote); + + // Delete column C. This should shift the note one cell left. + m_pDoc->DeleteCol(0, 0, MAXROW, 0, 2, 1); + rAddr.IncCol(-1); // cell C3 + CPPUNIT_ASSERT_MESSAGE("Note at D3 should have shifted left to C3.", m_pDoc->GetNotes(rAddr.Tab())->findByAddress(rAddr) == pNote); + m_pDoc->DeleteTab(0); } @@ -4309,7 +4642,7 @@ void Test::testCopyPaste() double aValue = 0; m_pDoc->GetValue(1, 0, 0, aValue); std::cout << "Value: " << aValue << std::endl; - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("formula should return 8", aValue, 8, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("formula should return 8", aValue, 8); //copy Sheet1.A1:C1 to Sheet2.A2:C2 ScRange aRange(0,0,0,2,0,0); @@ -4334,7 +4667,7 @@ void Test::testCopyPaste() rtl::OUString aString; m_pDoc->GetValue(1,1,1, aValue); m_pDoc->GetFormula(1,1,1, aString); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("copied formula should return 2", aValue, 2, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("copied formula should return 2", aValue, 2); CPPUNIT_ASSERT_MESSAGE("formula string was not copied correctly", aString == aFormulaString); m_pDoc->GetValue(0,1,1, aValue); CPPUNIT_ASSERT_MESSAGE("copied value should be 1", aValue == 1); @@ -4352,13 +4685,13 @@ void Test::testCopyPaste() //check undo and redo pUndo->Undo(); m_pDoc->GetValue(1,1,1, aValue); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("after undo formula should return nothing", aValue, 0, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("after undo formula should return nothing", aValue, 0); m_pDoc->GetString(2,1,1, aString); CPPUNIT_ASSERT_MESSAGE("after undo string should be removed", aString.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(""))); pUndo->Redo(); m_pDoc->GetValue(1,1,1, aValue); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("formula should return 2 after redo", aValue, 2, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("formula should return 2 after redo", aValue, 2); m_pDoc->GetString(2,1,1, aString); CPPUNIT_ASSERT_MESSAGE("Cell Sheet2.C2 should contain: test", aString.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("test"))); m_pDoc->GetFormula(1,1,1, aString); @@ -4490,42 +4823,42 @@ void Test::testUpdateReference() double aValue; m_pDoc->GetValue(2,0,2, aValue); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("formula does not return correct result", aValue, 3, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("formula does not return correct result", aValue, 3); m_pDoc->GetValue(2,1,2, aValue); - CPPUNIT_ASSERT_MESSAGE("formula does not return correct result", aValue == 5); + ASSERT_DOUBLES_EQUAL_MESSAGE("formula does not return correct result", aValue, 5); //test deleting both sheets: one is not directly before the sheet, the other one is m_pDoc->DeleteTab(0); m_pDoc->GetValue(2,0,1, aValue); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting first sheet formula does not return correct result", aValue, 3, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting first sheet formula does not return correct result", aValue, 3); m_pDoc->GetValue(2,1,1, aValue); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting first sheet formula does not return correct result", aValue, 5, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting first sheet formula does not return correct result", aValue, 5); m_pDoc->DeleteTab(0); m_pDoc->GetValue(2,0,0, aValue); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting second sheet formula does not return correct result", aValue, 3, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting second sheet formula does not return correct result", aValue, 3); m_pDoc->GetValue(2,1,0, aValue); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting second sheet formula does not return correct result", aValue, 5, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting second sheet formula does not return correct result", aValue, 5); //test adding two sheets m_pDoc->InsertTab(0, aSheet2); m_pDoc->GetValue(2,0,1, aValue); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting first sheet formula does not return correct result", aValue, 3, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting first sheet formula does not return correct result", aValue, 3); m_pDoc->GetValue(2,1,1, aValue); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting first sheet formula does not return correct result", aValue, 5, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting first sheet formula does not return correct result", aValue, 5); m_pDoc->InsertTab(0, aSheet1); m_pDoc->GetValue(2,0,2, aValue); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting second sheet formula does not return correct result", aValue, 3, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting second sheet formula does not return correct result", aValue, 3); m_pDoc->GetValue(2,1,2, aValue); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting second sheet formula does not return correct result", aValue, 5, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting second sheet formula does not return correct result", aValue, 5); //test new DeleteTabs/InsertTabs methods m_pDoc->DeleteTabs(0, 2); m_pDoc->GetValue(2, 0, 0, aValue); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting sheets formula does not return correct result", aValue, 3, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting sheets formula does not return correct result", aValue, 3); m_pDoc->GetValue(2, 1, 0, aValue); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting sheets formula does not return correct result", aValue, 5, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("after deleting sheets formula does not return correct result", aValue, 5); std::vector<rtl::OUString> aSheets; aSheets.push_back(aSheet1); @@ -4536,9 +4869,9 @@ void Test::testUpdateReference() m_pDoc->GetFormula(2,0,2, aFormula); std::cout << "formel: " << rtl::OUStringToOString(aFormula, RTL_TEXTENCODING_UTF8).getStr() << std::endl; std::cout << std::endl << aValue << std::endl; - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting sheets formula does not return correct result", aValue, 3, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting sheets formula does not return correct result", aValue, 3); m_pDoc->GetValue(2, 1, 2, aValue); - CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting sheets formula does not return correct result", aValue, 5, 0.00000001); + ASSERT_DOUBLES_EQUAL_MESSAGE("after inserting sheets formula does not return correct result", aValue, 5); m_pDoc->DeleteTab(3); m_pDoc->DeleteTab(2); @@ -4642,7 +4975,7 @@ void Test::testAutoFill() m_pDoc->Fill( 0, 0, 0, 0, NULL, aMarkData, 5); for (SCROW i = 0; i< 6; ++i) - CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<double>(i+1.0), m_pDoc->GetValue(0, i, 0), 0.00000001); + ASSERT_DOUBLES_EQUAL(static_cast<double>(i+1.0), m_pDoc->GetValue(0, i, 0)); // check that hidden rows are not affected by autofill // set values for hidden rows @@ -4652,10 +4985,10 @@ void Test::testAutoFill() m_pDoc->SetRowHidden(1, 2, 0, true); m_pDoc->Fill( 0, 0, 0, 0, NULL, aMarkData, 8); - CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, m_pDoc->GetValue(0,1,0), 1e-08); - CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, m_pDoc->GetValue(0,2,0), 1e-08); + ASSERT_DOUBLES_EQUAL(10.0, m_pDoc->GetValue(0,1,0)); + ASSERT_DOUBLES_EQUAL(10.0, m_pDoc->GetValue(0,2,0)); for (SCROW i = 3; i< 8; ++i) - CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<double>(i-1.0), m_pDoc->GetValue(0, i, 0), 0.00000001); + ASSERT_DOUBLES_EQUAL(static_cast<double>(i-1.0), m_pDoc->GetValue(0, i, 0)); m_pDoc->Fill( 0, 0, 0, 8, NULL, aMarkData, 5, FILL_TO_RIGHT ); for (SCCOL i = 0; i < 5; ++i) @@ -4664,18 +4997,18 @@ void Test::testAutoFill() { if (j > 2) { - CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<double>(j-1+i), m_pDoc->GetValue(i, j, 0), 1e-8); + ASSERT_DOUBLES_EQUAL(static_cast<double>(j-1+i), m_pDoc->GetValue(i, j, 0)); } else if (j == 0) { - CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<double>(i+1), m_pDoc->GetValue(i, 0, 0), 1e-8); + ASSERT_DOUBLES_EQUAL(static_cast<double>(i+1), m_pDoc->GetValue(i, 0, 0)); } else if (j == 1 || j== 2) { if(i == 0) - CPPUNIT_ASSERT_DOUBLES_EQUAL(10.0, m_pDoc->GetValue(0,j,0), 1e-8); + ASSERT_DOUBLES_EQUAL(10.0, m_pDoc->GetValue(0,j,0)); else - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0, m_pDoc->GetValue(i,j,0), 1e-8); + ASSERT_DOUBLES_EQUAL(0.0, m_pDoc->GetValue(i,j,0)); } } } @@ -4712,15 +5045,15 @@ void Test::testCopyPasteFormulas() // to prevent ScEditableTester in ScDocFunc::MoveBlock m_pDoc->SetInTest(); - CPPUNIT_ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(0,0,0), 1.0, 1e-08); - CPPUNIT_ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(0,1,0), 1.0, 1e-08); + ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(0,0,0), 1.0); + ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(0,1,0), 1.0); ScDocFunc& rDocFunc = m_xDocShRef->GetDocFunc(); bool bMoveDone = rDocFunc.MoveBlock(ScRange(0,0,0,0,4,0), ScAddress( 10, 10, 0), false, false, false, true); // check that moving was succesful, mainly for editable tester CPPUNIT_ASSERT(bMoveDone); - CPPUNIT_ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(10,10,0), 1.0, 1e-8); - CPPUNIT_ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(10,11,0), 1.0, 1e-8); + ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(10,10,0), 1.0); + ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(10,11,0), 1.0); rtl::OUString aFormula; m_pDoc->GetFormula(10,10,0, aFormula); CPPUNIT_ASSERT_EQUAL(aFormula, rtl::OUString("=COLUMN($A$1)")); @@ -5021,7 +5354,7 @@ void Test::testSort() pDoc->Sort(0, aSortData, false, NULL); double nVal = pDoc->GetValue(1,0,0); - CPPUNIT_ASSERT_DOUBLES_EQUAL(nVal, 1.0, 1e-8); + ASSERT_DOUBLES_EQUAL(nVal, 1.0); // check that note is also moved pNote = m_pDoc->GetNotes(0)->findByAddress( 1, 0 ); @@ -5030,6 +5363,68 @@ void Test::testSort() pDoc->DeleteTab(0); } +void Test::testShiftCells() +{ + m_pDoc->InsertTab(0, "foo"); + + OUString aTestVal("Some Text"); + + // Text into cell E5. + m_pDoc->SetString(4, 3, 0, aTestVal); + + // Insert cell at D5. This should shift the string cell to right. + m_pDoc->InsertCol(3, 0, 3, 0, 3, 1); + OUString aStr = m_pDoc->GetString(5, 3, 0); + CPPUNIT_ASSERT_MESSAGE("We should have a string cell here.", aStr == aTestVal); + CPPUNIT_ASSERT_MESSAGE("D5 is supposed to be blank.", m_pDoc->IsBlockEmpty(0, 3, 4, 3, 4)); + + // Delete cell D5, to shift the text cell back into D5. + m_pDoc->DeleteCol(3, 0, 3, 0, 3, 1); + aStr = m_pDoc->GetString(4, 3, 0); + CPPUNIT_ASSERT_MESSAGE("We should have a string cell here.", aStr == aTestVal); + CPPUNIT_ASSERT_MESSAGE("E5 is supposed to be blank.", m_pDoc->IsBlockEmpty(0, 4, 4, 4, 4)); + + m_pDoc->DeleteTab(0); +} + +void Test::testDeleteRow() +{ + ScDocument* pDoc = m_xDocShRef->GetDocument(); + rtl::OUString aSheet1("Sheet1"); + pDoc->InsertTab(0, aSheet1); + + rtl::OUString aHello("Hello"); + rtl::OUString aJimBob("Jim Bob"); + ScAddress rAddr(1, 1, 0); + ScPostIt* pNote = m_pDoc->GetNotes(rAddr.Tab())->GetOrCreateNote(rAddr); + pNote->SetText(rAddr, aHello); + pNote->SetAuthor(aJimBob); + + pDoc->DeleteRow(0, 0, MAXCOL, 0, 1, 1); + + CPPUNIT_ASSERT(m_pDoc->GetNotes(0)->empty()); + pDoc->DeleteTab(0); +} + +void Test::testDeleteCol() +{ + ScDocument* pDoc = m_xDocShRef->GetDocument(); + rtl::OUString aSheet1("Sheet1"); + pDoc->InsertTab(0, aSheet1); + + rtl::OUString aHello("Hello"); + rtl::OUString aJimBob("Jim Bob"); + ScAddress rAddr(1, 1, 0); + ScPostIt* pNote = m_pDoc->GetNotes(rAddr.Tab())->GetOrCreateNote(rAddr); + pNote->SetText(rAddr, aHello); + pNote->SetAuthor(aJimBob); + + pDoc->DeleteCol(0, 0, MAXROW, 0, 1, 1); + + CPPUNIT_ASSERT(m_pDoc->GetNotes(0)->empty()); + pDoc->DeleteTab(0); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 39658902fd5c..3df0c7c42a3c 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -1320,7 +1320,8 @@ bool ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const else if ((SvxCellHorJustify)((const SvxHorJustifyItem&)pPattern-> GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SVX_HOR_JUSTIFY_BLOCK) bFound = true; - else if (((const SfxUInt32Item&)pPattern->GetItem( ATTR_CONDITIONAL )).GetValue()) + + else if (!static_cast<const ScCondFormatItem&>(pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData().empty()) bFound = true; else if (((const SfxInt32Item&)pPattern->GetItem( ATTR_ROTATE_VALUE )).GetValue()) bFound = true; @@ -2230,8 +2231,8 @@ void ScAttrArray::MoveTo(SCROW nStartRow, SCROW nEndRow, ScAttrArray& rAttrArray // copy between documents (Clipboard) -void ScAttrArray::CopyArea( SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray, - sal_Int16 nStripFlags ) +void ScAttrArray::CopyArea( + SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray, sal_Int16 nStripFlags) const { nStartRow -= nDy; // Source nEndRow -= nDy; @@ -2339,8 +2340,9 @@ void ScAttrArray::CopyAreaSafe( SCROW nStartRow, SCROW nEndRow, long nDy, ScAttr } -SCsROW ScAttrArray::SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle, - bool bUp, ScMarkArray* pMarkArray ) +SCsROW ScAttrArray::SearchStyle( + SCsROW nRow, const ScStyleSheet* pSearchStyle, bool bUp, + const ScMarkArray* pMarkArray) const { bool bFound = false; @@ -2402,8 +2404,9 @@ SCsROW ScAttrArray::SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle, } -bool ScAttrArray::SearchStyleRange( SCsROW& rRow, SCsROW& rEndRow, - const ScStyleSheet* pSearchStyle, bool bUp, ScMarkArray* pMarkArray ) +bool ScAttrArray::SearchStyleRange( + SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, bool bUp, + const ScMarkArray* pMarkArray) const { SCsROW nStartRow = SearchStyle( rRow, pSearchStyle, bUp, pMarkArray ); if (VALIDROW(nStartRow)) diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx index 6a29e52e6af8..d66622936f6d 100644 --- a/sc/source/core/data/attrib.cxx +++ b/sc/source/core/data/attrib.cxx @@ -1228,12 +1228,6 @@ ScCondFormatItem::ScCondFormatItem(): { } -ScCondFormatItem::ScCondFormatItem( sal_uInt32 nIndex ): - SfxPoolItem( ATTR_CONDITIONAL ) -{ - maIndex.push_back(nIndex); -} - ScCondFormatItem::ScCondFormatItem( const std::vector<sal_uInt32>& rIndex ): SfxPoolItem( ATTR_CONDITIONAL ), maIndex( rIndex ) diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 1f6779f7b0ea..4089bf919369 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -848,4 +848,214 @@ void ScDataBarFormat::dumpInfo(rtl::OUStringBuffer& rBuf) const } #endif +ScIconSetFormat::ScIconSetFormat(ScDocument* pDoc): + ScColorFormat(pDoc), + mpFormatData(new ScIconSetFormatData) +{ +} + +ScIconSetFormat::ScIconSetFormat(ScDocument* pDoc, const ScIconSetFormat& rFormat): + ScColorFormat(pDoc), + mpFormatData(new ScIconSetFormatData(*rFormat.mpFormatData)) +{ +} + +ScColorFormat* ScIconSetFormat::Clone( ScDocument* pDoc ) const +{ + return new ScIconSetFormat(pDoc, *this); +} + +void ScIconSetFormat::SetIconSetData( ScIconSetFormatData* pFormatData ) +{ + mpFormatData.reset( pFormatData ); +} + +const ScIconSetFormatData* ScIconSetFormat::GetIconSetData() const +{ + return mpFormatData.get(); +} + +ScIconSetInfo* ScIconSetFormat::GetIconSetInfo(const ScAddress& rAddr) const +{ + CellType eCellType = mpDoc->GetCellType(rAddr); + if(eCellType != CELLTYPE_VALUE && eCellType != CELLTYPE_FORMULA) + return NULL; + + if (eCellType == CELLTYPE_FORMULA) + { + if(!static_cast<ScFormulaCell*>(mpDoc->GetCell(rAddr))->IsValue()) + return NULL; + } + + ScIconSetInfo* pInfo = new ScIconSetInfo; + + // now we have for sure a value + double nVal = mpDoc->GetValue(rAddr); + + if (mpFormatData->maEntries.size() < 2) + return NULL; + + double nMin = GetMinValue(); + double nMax = GetMaxValue(); + + // this check is for safety + if(nMin >= nMax) + return NULL; + + sal_Int32 nIndex = 0; + const_iterator itr = begin(); + ++itr; + double nValMax = CalcValue(nMin, nMax, itr); + + ++itr; + while(itr != end() && nVal > nValMax) + { + ++nIndex; + nValMax = CalcValue(nMin, nMax, itr); + ++itr; + } + if(nVal > nValMax) + ++nIndex; + + pInfo->nIconIndex = nIndex; + pInfo->eIconSetType = mpFormatData->eIconSetType; + return pInfo; +} + +condformat::ScFormatEntryType ScIconSetFormat::GetType() const +{ + return condformat::ICONSET; +} + +void ScIconSetFormat::DataChanged( const ScRange& ) +{ + +} + +void ScIconSetFormat::UpdateMoveTab( SCTAB nOldTab, SCTAB nNewTab ) +{ + for(iterator itr = begin(); itr != end(); ++itr) + { + itr->UpdateMoveTab(nOldTab, nNewTab, 0); + } +} + +void ScIconSetFormat::UpdateReference( UpdateRefMode eUpdateRefMode, + const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ) +{ + for(iterator itr = begin(); itr != end(); ++itr) + { + itr->UpdateReference( eUpdateRefMode, rRange, nDx, nDy, nDz ); + } +} + +void ScIconSetFormat::dumpInfo( rtl::OUStringBuffer& rBuffer ) const +{ + rBuffer.append("IconSet: \n"); + for(const_iterator itr = begin(); itr != end(); ++itr) + { + itr->dumpInfo(rBuffer); + } +} + +ScIconSetFormat::iterator ScIconSetFormat::begin() +{ + return mpFormatData->maEntries.begin(); +} + +ScIconSetFormat::const_iterator ScIconSetFormat::begin() const +{ + return mpFormatData->maEntries.begin(); +} + +ScIconSetFormat::iterator ScIconSetFormat::end() +{ + return mpFormatData->maEntries.end(); +} + +ScIconSetFormat::const_iterator ScIconSetFormat::end() const +{ + return mpFormatData->maEntries.end(); +} + +double ScIconSetFormat::GetMinValue() const +{ + const_iterator itr = begin(); + + if(itr->GetType() == COLORSCALE_VALUE || itr->GetType() == COLORSCALE_FORMULA) + return itr->GetValue(); + else + { + return getMinValue(); + } +} + +double ScIconSetFormat::GetMaxValue() const +{ + boost::ptr_vector<ScColorScaleEntry>::const_reverse_iterator itr = mpFormatData->maEntries.rbegin(); + + if(itr->GetType() == COLORSCALE_VALUE || itr->GetType() == COLORSCALE_FORMULA) + return itr->GetValue(); + else + { + return getMaxValue(); + } +} + +double ScIconSetFormat::CalcValue(double nMin, double nMax, ScIconSetFormat::const_iterator& itr) const +{ + switch(itr->GetType()) + { + case COLORSCALE_PERCENT: + return nMin + (nMax-nMin)*(itr->GetValue()/100); + case COLORSCALE_MIN: + return nMin; + case COLORSCALE_MAX: + return nMax; + case COLORSCALE_PERCENTILE: + { + std::vector<double>& rValues = getValues(); + if(rValues.size() == 1) + return rValues[0]; + else + { + double fPercentile = itr->GetValue()/100.0; + return GetPercentile(rValues, fPercentile); + } + } + + default: + break; + } + + return itr->GetValue(); +} + +ScIconSetMap* ScIconSetFormat::getIconSetMap() +{ + + static ScIconSetMap aIconSetMap[] = { + { "3Arrows", IconSet_3Arrows, 3 }, + { "3ArrowsGray", IconSet_3ArrowsGray, 3 }, + { "3Flags", IconSet_3Flags, 3 }, + { "3TrafficLights1", IconSet_3TrafficLights1, 3 }, + { "3TrafficLights2", IconSet_3TrafficLights2, 3 }, + { "3Signs", IconSet_3Signs, 3 }, + { "3Symbols", IconSet_3Symbols, 3 }, + { "3Symbols2", IconSet_3Symbols2, 3 }, + { "4Arrows", IconSet_4Arrows, 4 }, + { "4ArrowsGray", IconSet_4ArrowsGray, 4 }, + { "4RedToBlack", IconSet_4RedToBlack, 4 }, + { "4Rating", IconSet_4Rating, 4 }, + { "4TrafficLights", IconSet_4TrafficLights, 4 }, + { "5Arrows", IconSet_5Arrows, 5 }, + { "5ArrowsGray", IconSet_5ArrowsGray, 5 }, + { "5Ratings", IconSet_5Ratings, 5 }, + { "5Quarters", IconSet_5Quarters, 5 }, + { NULL, IconSet_3Arrows, 0 } + }; + + return aIconSetMap; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 683f99dbc549..c2b2c1d72068 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -62,21 +62,6 @@ inline bool IsAmbiguousScriptNonZero( sal_uInt8 nScript ) nScript != 0 ); } -// ---------------------------------------------------------------------------- - -ScColumn::DoubleAllocSwitch::DoubleAllocSwitch(bool bNewVal) : - mbOldVal(ScColumn::bDoubleAlloc) -{ - ScColumn::bDoubleAlloc = bNewVal; -} - -ScColumn::DoubleAllocSwitch::~DoubleAllocSwitch() -{ - ScColumn::bDoubleAlloc = mbOldVal; -} - -// ---------------------------------------------------------------------------- - ScColumn::ScColumn() : nCol( 0 ), pAttrArray( NULL ), @@ -1187,7 +1172,7 @@ void ScColumn::InsertRow( SCROW nStartRow, SCSIZE nSize ) } -void ScColumn::CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags) +void ScColumn::CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags) const { pAttrArray->CopyArea( nRow1, nRow2, 0, *rColumn.pAttrArray, bKeepScenarioFlags ? (SC_MF_ALL & ~SC_MF_SCENARIO) : SC_MF_ALL ); @@ -1230,8 +1215,9 @@ void ScColumn::CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKee } -void ScColumn::CopyToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked, - ScColumn& rColumn, const ScMarkData* pMarkData, bool bAsLink ) +void ScColumn::CopyToColumn( + SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked, ScColumn& rColumn, + const ScMarkData* pMarkData, bool bAsLink) const { if (bMarked) { @@ -1324,8 +1310,9 @@ void ScColumn::CopyToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bM } -void ScColumn::UndoToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked, - ScColumn& rColumn, const ScMarkData* pMarkData ) +void ScColumn::UndoToColumn( + SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked, ScColumn& rColumn, + const ScMarkData* pMarkData) const { if (nRow1 > 0) CopyToColumn( 0, nRow1-1, IDF_FORMULA, false, rColumn ); @@ -1487,87 +1474,79 @@ void ScColumn::SwapCol(ScColumn& rCol) } } - void ScColumn::MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol) { pAttrArray->MoveTo(nStartRow, nEndRow, *rCol.pAttrArray); - if ( !maItems.empty() ) + if (maItems.empty()) + // No cells to move. + return; + + ::std::vector<SCROW> aRows; + SCSIZE i; + Search( nStartRow, i); // i points to start row or position thereafter + SCSIZE nStartPos = i; + // First, copy the cell instances to the new column. + for ( ; i < maItems.size() && maItems[i].nRow <= nEndRow; ++i) { - ::std::vector<SCROW> aRows; - bool bConsecutive = true; - SCSIZE i; - Search( nStartRow, i); // i points to start row or position thereafter - SCSIZE nStartPos = i; - for ( ; i < maItems.size() && maItems[i].nRow <= nEndRow; ++i) - { - SCROW nRow = maItems[i].nRow; - aRows.push_back( nRow); - rCol.Insert( nRow, maItems[i].pCell); - if (nRow != maItems[i].nRow) - { // Listener inserted - bConsecutive = false; - Search( nRow, i); - } - } - SCSIZE nStopPos = i; - if (nStartPos < nStopPos) + SCROW nRow = maItems[i].nRow; + aRows.push_back( nRow); + rCol.Insert( nRow, maItems[i].pCell); + } + SCSIZE nStopPos = i; + if (nStartPos < nStopPos) + { + // Create list of ranges of cell entry positions + typedef ::std::pair<SCSIZE,SCSIZE> PosPair; + typedef ::std::vector<PosPair> EntryPosPairs; + EntryPosPairs aEntries; { - // Create list of ranges of cell entry positions - typedef ::std::pair<SCSIZE,SCSIZE> PosPair; - typedef ::std::vector<PosPair> EntryPosPairs; - EntryPosPairs aEntries; - if (bConsecutive) - aEntries.push_back( PosPair(nStartPos, nStopPos)); - else + bool bFirst = true; + nStopPos = 0; + for (::std::vector<SCROW>::const_iterator it( aRows.begin()); + it != aRows.end() && nStopPos < maItems.size(); ++it, + ++nStopPos) { - bool bFirst = true; - nStopPos = 0; - for (::std::vector<SCROW>::const_iterator it( aRows.begin()); - it != aRows.end() && nStopPos < maItems.size(); ++it, - ++nStopPos) + if (!bFirst && *it != maItems[nStopPos].nRow) { - if (!bFirst && *it != maItems[nStopPos].nRow) - { - aEntries.push_back( PosPair(nStartPos, nStopPos)); - bFirst = true; - } - if (bFirst && Search( *it, nStartPos)) - { - bFirst = false; - nStopPos = nStartPos; - } - } - if (!bFirst && nStartPos < nStopPos) aEntries.push_back( PosPair(nStartPos, nStopPos)); - } - // Broadcast changes - ScAddress aAdr( nCol, 0, nTab ); - ScHint aHint( SC_HINT_DYING, aAdr, NULL ); // areas only - ScAddress& rAddress = aHint.GetAddress(); - ScNoteCell* pNoteCell = new ScNoteCell; // Dummy like in DeleteRange - - // must iterate backwards, because indexes of following cells become invalid - for (EntryPosPairs::reverse_iterator it( aEntries.rbegin()); - it != aEntries.rend(); ++it) - { - nStartPos = (*it).first; - nStopPos = (*it).second; - for (i=nStartPos; i<nStopPos; ++i) - maItems[i].pCell = pNoteCell; - for (i=nStartPos; i<nStopPos; ++i) + bFirst = true; + } + if (bFirst && Search( *it, nStartPos)) { - rAddress.SetRow( maItems[i].nRow ); - pDocument->AreaBroadcast( aHint ); + bFirst = false; + nStopPos = nStartPos; } - maItems.erase(maItems.begin() + nStartPos, maItems.begin() + nStopPos - 1); } - pNoteCell->Delete(); + if (!bFirst && nStartPos < nStopPos) + aEntries.push_back( PosPair(nStartPos, nStopPos)); } + // Broadcast changes + ScAddress aAdr( nCol, 0, nTab ); + ScHint aHint( SC_HINT_DYING, aAdr, NULL ); // areas only + ScAddress& rAddress = aHint.GetAddress(); + ScNoteCell* pNoteCell = new ScNoteCell; // Dummy like in DeleteRange + + // must iterate backwards, because indexes of following cells become invalid + for (EntryPosPairs::reverse_iterator it( aEntries.rbegin()); + it != aEntries.rend(); ++it) + { + nStartPos = (*it).first; + nStopPos = (*it).second; + for (i=nStartPos; i<nStopPos; ++i) + maItems[i].pCell = pNoteCell; // Assign the dumpy cell instance to all slots. + for (i=nStartPos; i<nStopPos; ++i) + { + rAddress.SetRow( maItems[i].nRow ); + pDocument->AreaBroadcast( aHint ); + } + // Erase the slots containing pointers to the dummy cell instance. + maItems.erase(maItems.begin() + nStartPos, maItems.begin() + nStopPos); + } + pNoteCell->Delete(); // Delete the dummy cell instance. } } - bool ScColumn::UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, SCsCOL nDx, SCsROW nDy, SCsTAB nDz, ScDocument* pUndoDoc ) @@ -2120,14 +2099,14 @@ bool ScColumn::HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst) const } -SCsROW ScColumn::SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle, - bool bUp, bool bInSelection, const ScMarkData& rMark ) +SCsROW ScColumn::SearchStyle( + SCsROW nRow, const ScStyleSheet* pSearchStyle, bool bUp, bool bInSelection, + const ScMarkData& rMark) const { if (bInSelection) { if (rMark.IsMultiMarked()) - return pAttrArray->SearchStyle( nRow, pSearchStyle, bUp, - (ScMarkArray*) rMark.GetArray()+nCol ); //! const + return pAttrArray->SearchStyle(nRow, pSearchStyle, bUp, rMark.GetArray()+nCol); else return -1; } @@ -2136,14 +2115,15 @@ SCsROW ScColumn::SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle, } -bool ScColumn::SearchStyleRange( SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, - bool bUp, bool bInSelection, const ScMarkData& rMark ) +bool ScColumn::SearchStyleRange( + SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, bool bUp, + bool bInSelection, const ScMarkData& rMark) const { if (bInSelection) { if (rMark.IsMultiMarked()) - return pAttrArray->SearchStyleRange( rRow, rEndRow, pSearchStyle, bUp, - (ScMarkArray*) rMark.GetArray()+nCol ); //! const + return pAttrArray->SearchStyleRange( + rRow, rEndRow, pSearchStyle, bUp, rMark.GetArray() + nCol); else return false; } diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 964f1d4fbe75..036f00fffa62 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -89,10 +89,10 @@ inline bool IsAmbiguousScript( sal_uInt8 nScript ) // ----------------------------------------------------------------------------------------- -long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev, - double nPPTX, double nPPTY, - const Fraction& rZoomX, const Fraction& rZoomY, - bool bWidth, const ScNeededSizeOptions& rOptions ) +long ScColumn::GetNeededSize( + SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + bool bWidth, const ScNeededSizeOptions& rOptions ) const { long nValue=0; SCSIZE nIndex; @@ -530,11 +530,9 @@ long ScColumn::GetNeededSize( SCROW nRow, OutputDevice* pDev, } -sal_uInt16 ScColumn::GetOptimalColWidth( OutputDevice* pDev, double nPPTX, double nPPTY, - const Fraction& rZoomX, const Fraction& rZoomY, - bool bFormula, sal_uInt16 nOldWidth, - const ScMarkData* pMarkData, - const ScColWidthParam* pParam ) +sal_uInt16 ScColumn::GetOptimalColWidth( + OutputDevice* pDev, double nPPTX, double nPPTY, const Fraction& rZoomX, const Fraction& rZoomY, + bool bFormula, sal_uInt16 nOldWidth, const ScMarkData* pMarkData, const ScColWidthParam* pParam) const { if ( maItems.empty() ) return nOldWidth; @@ -671,11 +669,10 @@ static sal_uInt16 lcl_GetAttribHeight( const ScPatternAttr& rPattern, sal_uInt16 // nMinHeight, nMinStart zur Optimierung: ab nRow >= nMinStart ist mindestens nMinHeight // (wird nur bei bStdAllowed ausgewertet) -void ScColumn::GetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16* pHeight, - OutputDevice* pDev, - double nPPTX, double nPPTY, - const Fraction& rZoomX, const Fraction& rZoomY, - bool bShrink, sal_uInt16 nMinHeight, SCROW nMinStart ) +void ScColumn::GetOptimalHeight( + SCROW nStartRow, SCROW nEndRow, sal_uInt16* pHeight, OutputDevice* pDev, + double nPPTX, double nPPTY, const Fraction& rZoomX, const Fraction& rZoomY, + bool bShrink, sal_uInt16 nMinHeight, SCROW nMinStart) const { ScAttrIterator aIter( pAttrArray, nStartRow, nEndRow ); @@ -711,9 +708,12 @@ void ScColumn::GetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16* pHe bStdOnly = !bBreak; // bedingte Formatierung: Zellen durchgehen - if ( bStdOnly && ((const SfxUInt32Item&)pPattern-> - GetItem(ATTR_CONDITIONAL)).GetValue() ) + if (bStdOnly && + !static_cast<const ScCondFormatItem&>(pPattern->GetItem( + ATTR_CONDITIONAL)).GetCondFormatData().empty()) + { bStdOnly = false; + } // gedrehter Text: Zellen durchgehen if ( bStdOnly && ((const SfxInt32Item&)pPattern-> @@ -1124,7 +1124,8 @@ bool ScColumn::IsEmptyVisData() const SCSIZE i; for (i=0; i<maItems.size() && !bVisData; i++) { - bVisData = true; + if(!maItems[i].pCell->IsBlank()) + bVisData = true; } return !bVisData; } @@ -1158,8 +1159,11 @@ SCROW ScColumn::GetLastVisDataPos() const for (i=maItems.size(); i>0 && !bFound; ) { --i; - bFound = true; - nRet = maItems[i].nRow; + if(!maItems[i].pCell->IsBlank()) + { + bFound = true; + nRet = maItems[i].nRow; + } } } return nRet; @@ -1633,7 +1637,7 @@ void ScColumn::CompileColRowNameFormula() } } -static void lcl_UpdateSubTotal( ScFunctionData& rData, ScBaseCell* pCell ) +static void lcl_UpdateSubTotal( ScFunctionData& rData, const ScBaseCell* pCell ) { double nValue = 0.0; bool bVal = false; @@ -1713,10 +1717,9 @@ static void lcl_UpdateSubTotal( ScFunctionData& rData, ScBaseCell* pCell ) } // Mehrfachselektion: -void ScColumn::UpdateSelectionFunction( const ScMarkData& rMark, - ScFunctionData& rData, - ScFlatBoolRowSegments& rHiddenRows, - bool bDoExclude, SCROW nExStartRow, SCROW nExEndRow ) +void ScColumn::UpdateSelectionFunction( + const ScMarkData& rMark, ScFunctionData& rData, ScFlatBoolRowSegments& rHiddenRows, + bool bDoExclude, SCROW nExStartRow, SCROW nExEndRow) const { SCSIZE nIndex; ScMarkedDataIter aDataIter(this, &rMark, false); @@ -1731,9 +1734,8 @@ void ScColumn::UpdateSelectionFunction( const ScMarkData& rMark, } // bei bNoMarked die Mehrfachselektion weglassen -void ScColumn::UpdateAreaFunction( ScFunctionData& rData, - ScFlatBoolRowSegments& rHiddenRows, - SCROW nStartRow, SCROW nEndRow ) +void ScColumn::UpdateAreaFunction( + ScFunctionData& rData, ScFlatBoolRowSegments& rHiddenRows, SCROW nStartRow, SCROW nEndRow) const { SCSIZE nIndex; Search( nStartRow, nIndex ); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index dff64c1f191f..c44de8e2b849 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -65,9 +65,6 @@ extern const ScFormulaCell* pLastFormulaTreeTop; // in cellform.cxx using namespace formula; // STATIC DATA ----------------------------------------------------------- -bool ScColumn::bDoubleAlloc = false; // fuer Import: Groesse beim Allozieren verdoppeln - - void ScColumn::Insert( SCROW nRow, ScBaseCell* pNewCell ) { sal_Bool bIsAppended = false; @@ -770,7 +767,8 @@ bool lclCanCloneValue( ScDocument& rDoc, const ScColumn& rCol, SCROW nRow, bool } // namespace -ScBaseCell* ScColumn::CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos) +ScBaseCell* ScColumn::CloneCell( + SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos) const { bool bCloneValue = (nFlags & IDF_VALUE) != 0; bool bCloneDateTime = (nFlags & IDF_DATETIME) != 0; @@ -1499,6 +1497,10 @@ void ScColumn::GetFilterEntries(SCROW nStartRow, SCROW nEndRow, std::vector<ScTy } break; + // skip broadcaster cells + case CELLTYPE_NOTE: + continue; + default: ; } diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index e72556f693bf..f164cc48aa40 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -768,10 +768,11 @@ static bool lcl_GetCellContent( ScBaseCell* pCell, bool bIsStr1, double& rArg, r return bVal; } -bool ScConditionEntry::IsDuplicate( double nArg, const rtl::OUString& rStr, const ScAddress& rAddr, const ScRangeList& rRanges ) const +void ScConditionEntry::FillCache() const { if(!mpCache) { + const ScRangeList& rRanges = pCondFormat->GetRange(); mpCache.reset(new ScConditionEntryCache); size_t nListCount = rRanges.size(); for( size_t i = 0; i < nListCount; i++ ) @@ -798,7 +799,7 @@ bool ScConditionEntry::IsDuplicate( double nArg, const rtl::OUString& rStr, cons double nVal = 0.0; ScBaseCell *pCell = NULL; - mpDoc->GetCell( c, r, rAddr.Tab(), pCell ); + mpDoc->GetCell( c, r, nTab, pCell ); if( !pCell ) continue; @@ -814,10 +815,17 @@ bool ScConditionEntry::IsDuplicate( double nArg, const rtl::OUString& rStr, cons std::pair<ScConditionEntryCache::ValueCacheType::iterator, bool> aResult = mpCache->maValues.insert(std::pair<double, sal_Int32>(nVal, (sal_Int32)1)); if(!aResult.second) aResult.first->second++; + + ++(mpCache->nValueItems); } } } } +} + +bool ScConditionEntry::IsDuplicate( double nArg, const rtl::OUString& rStr ) const +{ + FillCache(); if(rStr.isEmpty()) { @@ -845,19 +853,165 @@ bool ScConditionEntry::IsDuplicate( double nArg, const rtl::OUString& rStr, cons return false; } } +} + +bool ScConditionEntry::IsTopNElement( double nArg ) const +{ + FillCache(); + + if(mpCache->nValueItems <= nVal1) + return true; + + size_t nCells = 0; + for(ScConditionEntryCache::ValueCacheType::const_reverse_iterator itr = mpCache->maValues.rbegin(), + itrEnd = mpCache->maValues.rend(); itr != itrEnd; ++itr) + { + if(itr->first <= nArg) + return true; + if(nCells >= nVal1) + return false; + nCells += itr->second; + } + + return true; +} + +bool ScConditionEntry::IsBottomNElement( double nArg ) const +{ + FillCache(); + + if(mpCache->nValueItems <= nVal1) + return true; + + size_t nCells = 0; + for(ScConditionEntryCache::ValueCacheType::const_iterator itr = mpCache->maValues.begin(), + itrEnd = mpCache->maValues.end(); itr != itrEnd; ++itr) + { + if(itr->first >= nArg) + return true; + if(nCells >= nVal1) + return false; + nCells += itr->second; + } + + return true; +} + +bool ScConditionEntry::IsTopNPercent( double nArg ) const +{ + FillCache(); + + size_t nCells = 0; + size_t nLimitCells = static_cast<size_t>(mpCache->nValueItems*nVal1/100); + for(ScConditionEntryCache::ValueCacheType::const_reverse_iterator itr = mpCache->maValues.rbegin(), + itrEnd = mpCache->maValues.rend(); itr != itrEnd; ++itr) + { + if(itr->first <= nArg) + return true; + if(nCells >= nLimitCells) + return false; + nCells += itr->second; + } + + return true; +} + +bool ScConditionEntry::IsBottomNPercent( double nArg ) const +{ + FillCache(); + + size_t nCells = 0; + size_t nLimitCells = static_cast<size_t>(mpCache->nValueItems*nVal1/100); + for(ScConditionEntryCache::ValueCacheType::const_iterator itr = mpCache->maValues.begin(), + itrEnd = mpCache->maValues.end(); itr != itrEnd; ++itr) + { + if(itr->first >= nArg) + return true; + if(nCells >= nLimitCells) + return false; + nCells += itr->second; + } + + return true; +} + +bool ScConditionEntry::IsBelowAverage( double nArg ) const +{ + FillCache(); + + double nSum = 0; + for(ScConditionEntryCache::ValueCacheType::const_iterator itr = mpCache->maValues.begin(), + itrEnd = mpCache->maValues.end(); itr != itrEnd; ++itr) + { + nSum += itr->first * itr->second; + } + + if(nVal1) + return (nArg <= nSum/mpCache->nValueItems); + else + return (nArg < nSum/mpCache->nValueItems); +} + +bool ScConditionEntry::IsAboveAverage( double nArg ) const +{ + FillCache(); + + double nSum = 0; + for(ScConditionEntryCache::ValueCacheType::const_iterator itr = mpCache->maValues.begin(), + itrEnd = mpCache->maValues.end(); itr != itrEnd; ++itr) + { + nSum += itr->first * itr->second; + } + + if(nVal1) + return (nArg >= nSum/mpCache->nValueItems); + else + return (nArg > nSum/mpCache->nValueItems); +} + +bool ScConditionEntry::IsError( const ScAddress& rPos ) const +{ + ScBaseCell* pCell = mpDoc->GetCell(rPos); + if(!pCell) + return false; + switch(pCell->GetCellType()) + { + case CELLTYPE_VALUE: + return false; + case CELLTYPE_FORMULA: + { + ScFormulaCell* pFormulaCell = static_cast<ScFormulaCell*>(pCell); + if(pFormulaCell->GetErrCode()) + return true; + } + case CELLTYPE_STRING: + case CELLTYPE_EDIT: + return false; + default: + break; + } return false; } -bool ScConditionEntry::IsValid( double nArg, const ScAddress& rAddr ) const +bool ScConditionEntry::IsValid( double nArg, const ScAddress& rPos ) const { // Interpret muss schon gerufen sein if ( bIsStr1 ) { - // wenn auf String getestet wird, bei Zahlen immer sal_False, ausser bei "ungleich" - - return ( eOp == SC_COND_NOTEQUAL ); + switch( eOp ) + { + case SC_COND_BEGINS_WITH: + case SC_COND_ENDS_WITH: + case SC_COND_CONTAINS_TEXT: + case SC_COND_NOT_CONTAINS_TEXT: + break; + case SC_COND_NOTEQUAL: + return true; + default: + return false; + } } if ( eOp == SC_COND_BETWEEN || eOp == SC_COND_NOTBETWEEN ) @@ -911,8 +1065,7 @@ bool ScConditionEntry::IsValid( double nArg, const ScAddress& rAddr ) const case SC_COND_NOTDUPLICATE: if( pCondFormat ) { - const ScRangeList& aRanges = pCondFormat->GetRange(); - bValid = IsDuplicate( nArg, rtl::OUString(), rAddr, aRanges ); + bValid = IsDuplicate( nArg, rtl::OUString() ); if( eOp == SC_COND_NOTDUPLICATE ) bValid = !bValid; } @@ -920,6 +1073,71 @@ bool ScConditionEntry::IsValid( double nArg, const ScAddress& rAddr ) const case SC_COND_DIRECT: bValid = !::rtl::math::approxEqual( nComp1, 0.0 ); break; + case SC_COND_TOP10: + bValid = IsTopNElement( nArg ); + break; + case SC_COND_BOTTOM10: + bValid = IsBottomNElement( nArg ); + break; + case SC_COND_TOP_PERCENT: + bValid = IsTopNPercent( nArg ); + break; + case SC_COND_BOTTOM_PERCENT: + bValid = IsBottomNPercent( nArg ); + break; + case SC_COND_ABOVE_AVERAGE: + bValid = IsAboveAverage( nArg ); + break; + case SC_COND_BELOW_AVERAGE: + bValid = IsBelowAverage( nArg ); + break; + case SC_COND_ERROR: + case SC_COND_NOERROR: + bValid = IsError( rPos ); + if( eOp == SC_COND_NOERROR ) + bValid = !bValid; + break; + case SC_COND_BEGINS_WITH: + if(!aStrVal1.Len()) + { + rtl::OUString aStr = rtl::OUString::valueOf(nVal1); + rtl::OUString aStr2 = rtl::OUString::valueOf(nArg); + bValid = aStr2.indexOf(aStr) == 0; + } + else + { + rtl::OUString aStr2 = rtl::OUString::valueOf(nArg); + bValid = aStr2.indexOf(aStrVal1) == 0; + } + case SC_COND_ENDS_WITH: + if(!aStrVal1.Len()) + { + rtl::OUString aStr = rtl::OUString::valueOf(nVal1); + rtl::OUString aStr2 = rtl::OUString::valueOf(nArg); + bValid = aStr2.endsWith(aStr) == 0; + } + else + { + rtl::OUString aStr2 = rtl::OUString::valueOf(nArg); + bValid = aStr2.endsWith(aStrVal1) == 0; + } + case SC_COND_CONTAINS_TEXT: + case SC_COND_NOT_CONTAINS_TEXT: + if(!aStrVal1.Len()) + { + rtl::OUString aStr = rtl::OUString::valueOf(nVal1); + rtl::OUString aStr2 = rtl::OUString::valueOf(nArg); + bValid = aStr2.indexOf(aStr) != -1; + } + else + { + rtl::OUString aStr2 = rtl::OUString::valueOf(nArg); + bValid = aStr2.indexOf(aStrVal1) != -1; + } + + if( eOp == SC_COND_NOT_CONTAINS_TEXT ) + bValid = !bValid; + break; default: OSL_FAIL("unbekannte Operation bei ScConditionEntry"); break; @@ -927,7 +1145,7 @@ bool ScConditionEntry::IsValid( double nArg, const ScAddress& rAddr ) const return bValid; } -bool ScConditionEntry::IsValidStr( const String& rArg, const ScAddress& rAddr ) const +bool ScConditionEntry::IsValidStr( const rtl::OUString& rArg, const ScAddress& rPos ) const { bool bValid = false; // Interpret muss schon gerufen sein @@ -937,10 +1155,9 @@ bool ScConditionEntry::IsValidStr( const String& rArg, const ScAddress& rAddr ) if ( eOp == SC_COND_DUPLICATE || eOp == SC_COND_NOTDUPLICATE ) { - if( pCondFormat && rArg.Len() ) + if( pCondFormat && !rArg.isEmpty() ) { - const ScRangeList& aRanges = pCondFormat->GetRange(); - bValid = IsDuplicate( 0.0, rArg, rAddr, aRanges ); + bValid = IsDuplicate( 0.0, rArg ); if( eOp == SC_COND_NOTDUPLICATE ) bValid = !bValid; return bValid; @@ -949,14 +1166,14 @@ bool ScConditionEntry::IsValidStr( const String& rArg, const ScAddress& rAddr ) // Wenn Bedingung Zahl enthaelt, immer FALSE, ausser bei "ungleich" - if ( !bIsStr1 ) + if ( !bIsStr1 && (eOp != SC_COND_ERROR && eOp != SC_COND_NOERROR) ) return ( eOp == SC_COND_NOTEQUAL ); if ( eOp == SC_COND_BETWEEN || eOp == SC_COND_NOTBETWEEN ) if ( !bIsStr2 ) return false; - String aUpVal1( aStrVal1 ); //! als Member? (dann auch in Interpret setzen) - String aUpVal2( aStrVal2 ); + rtl::OUString aUpVal1( aStrVal1 ); //! als Member? (dann auch in Interpret setzen) + rtl::OUString aUpVal2( aStrVal2 ); if ( eOp == SC_COND_BETWEEN || eOp == SC_COND_NOTBETWEEN ) if ( ScGlobal::GetCollator()->compareString( aUpVal1, aUpVal2 ) @@ -976,6 +1193,31 @@ bool ScConditionEntry::IsValidStr( const String& rArg, const ScAddress& rAddr ) bValid = (ScGlobal::GetCollator()->compareString( rArg, aUpVal1 ) != COMPARE_EQUAL); break; + case SC_COND_TOP_PERCENT: + case SC_COND_BOTTOM_PERCENT: + case SC_COND_TOP10: + case SC_COND_BOTTOM10: + case SC_COND_ABOVE_AVERAGE: + case SC_COND_BELOW_AVERAGE: + return false; + case SC_COND_ERROR: + case SC_COND_NOERROR: + bValid = IsError( rPos ); + if(eOp == SC_COND_NOERROR) + bValid = !bValid; + break; + case SC_COND_BEGINS_WITH: + bValid = rArg.indexOf(aUpVal1) == 0; + break; + case SC_COND_ENDS_WITH: + bValid = rArg.endsWith(aUpVal1); + break; + case SC_COND_CONTAINS_TEXT: + case SC_COND_NOT_CONTAINS_TEXT: + bValid = rArg.indexOf(aUpVal1) != -1; + if(eOp == SC_COND_NOT_CONTAINS_TEXT) + bValid = !bValid; + break; default: { sal_Int32 nCompare = ScGlobal::GetCollator()->compareString( @@ -1501,6 +1743,11 @@ ScCondFormatData ScConditionalFormat::GetData( ScBaseCell* pCell, const ScAddres const ScDataBarFormat& rEntry = static_cast<const ScDataBarFormat&>(*itr); aData.pDataBar = rEntry.GetDataBarInfo(rPos); } + else if(itr->GetType() == condformat::ICONSET && !aData.pIconSet) + { + const ScIconSetFormat& rEntry = static_cast<const ScIconSetFormat&>(*itr); + aData.pIconSet = rEntry.GetIconSetInfo(rPos); + } } return aData; } diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index c0e94665a3fa..b623afd5af43 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -1004,11 +1004,12 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos, SfxObjectShell* pSrcShell = pSrcDoc ? pSrcDoc->GetDocumentShell() : NULL; if ( pSrcShell ) { - rtl::OUString aLibName(RTL_CONSTASCII_USTRINGPARAM("Standard")); + rtl::OUString aLibName("Standard"); const BasicManager *pBasicManager = pSrcShell->GetBasicManager(); - if (pBasicManager && pBasicManager->GetName().Len() > 0) + if (pBasicManager && !pBasicManager->GetName().isEmpty()) + { aLibName = pSrcShell->GetBasicManager()->GetName(); - + } rtl::OUString sCodeName; rtl::OUString sSource; uno::Reference< script::XLibraryContainer > xLibContainer = pSrcShell->GetBasicContainer(); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 54ce14f3a329..600bf607a42d 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -2088,16 +2088,4 @@ void ScDocument::ExtendPrintArea( OutputDevice* pDev, SCTAB nTab, maTabs[nTab]->ExtendPrintArea( pDev, nStartCol, nStartRow, rEndCol, nEndRow ); } -void ScDocument::IncSizeRecalcLevel( SCTAB nTab ) -{ - if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] ) - maTabs[nTab]->IncRecalcLevel(); -} - -void ScDocument::DecSizeRecalcLevel( SCTAB nTab, bool bUpdateNoteCaptionPos ) -{ - if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] ) - maTabs[nTab]->DecRecalcLevel( bUpdateNoteCaptionPos ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 3295106f40d1..69c68b08e705 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -700,7 +700,12 @@ const SfxItemSet* ScDocument::GetCondResult( SCCOL nCol, SCROW nRow, SCTAB nTab ScConditionalFormat* ScDocument::GetCondFormat( SCCOL nCol, SCROW nRow, SCTAB nTab ) const { - sal_uLong nIndex = ((const SfxUInt32Item*)GetAttr(nCol,nRow,nTab,ATTR_CONDITIONAL))->GetValue(); + sal_uInt32 nIndex = 0; + const std::vector<sal_uInt32>& rCondFormats = static_cast<const ScCondFormatItem*>(GetAttr(nCol, nRow, nTab, ATTR_CONDITIONAL))->GetCondFormatData(); + + if(!rCondFormats.empty()) + nIndex = rCondFormats[0]; + if (nIndex) { ScConditionalFormatList* pCondFormList = GetCondFormList(nTab); diff --git a/sc/source/core/data/documen6.cxx b/sc/source/core/data/documen6.cxx index 544950fd7181..4b14697a8c33 100644 --- a/sc/source/core/data/documen6.cxx +++ b/sc/source/core/data/documen6.cxx @@ -29,9 +29,10 @@ #include "scitems.hxx" #include <editeng/scripttypeitem.hxx> -#include <com/sun/star/i18n/XBreakIterator.hpp> +#include <com/sun/star/i18n/BreakIterator.hpp> #include <com/sun/star/i18n/ScriptType.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <comphelper/processfactory.hxx> #include "document.hxx" #include "cell.hxx" @@ -43,8 +44,6 @@ using namespace com::sun::star; -#define SC_BREAKITER_SERVICE "com.sun.star.i18n.BreakIterator" - // // this file is compiled with exceptions enabled // put functions here that need exceptions! @@ -58,10 +57,7 @@ const uno::Reference< i18n::XBreakIterator >& ScDocument::GetBreakIterator() pScriptTypeData = new ScScriptTypeData; if ( !pScriptTypeData->xBreakIter.is() ) { - uno::Reference< uno::XInterface > xInterface = xServiceManager->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( SC_BREAKITER_SERVICE )) ); - pScriptTypeData->xBreakIter = uno::Reference< i18n::XBreakIterator >( xInterface, uno::UNO_QUERY ); - OSL_ENSURE( pScriptTypeData->xBreakIter.is(), "can't get BreakIterator" ); + pScriptTypeData->xBreakIter = i18n::BreakIterator::create( comphelper::getComponentContext(xServiceManager) ); } return pScriptTypeData->xBreakIter; } diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 4b66d43b0031..4286cfd71794 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -1512,7 +1512,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp { OSL_ENSURE( rMultiMark.IsMultiMarked(), "TransliterateText: no selection" ); - utl::TransliterationWrapper aTranslitarationWrapper( xServiceManager, nType ); + utl::TransliterationWrapper aTranslitarationWrapper( comphelper::getComponentContext(xServiceManager), nType ); bool bConsiderLanguage = aTranslitarationWrapper.needLanguageForTheMode(); sal_uInt16 nLanguage = LANGUAGE_SYSTEM; diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 3715f45a3a0c..56a574ba092e 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2411,7 +2411,6 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar if ( *itr < aCBFCP.nTabStart ) aCBFCP.nTabStart = *itr; aCBFCP.nTabEnd = *itr; - maTabs[*itr]->IncRecalcLevel(); } ScRangeList aLocalRangeList; @@ -2423,12 +2422,6 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar bInsertingFromOtherDoc = true; // kein Broadcast/Listener aufbauen bei Insert - // bei mindestens 64 Zeilen wird in ScColumn::CopyFromClip voralloziert - bool bDoDouble = ( nYw < 64 && nAllRow2 - nAllRow1 > 64); - bool bOldDouble = ScColumn::bDoubleAlloc; - if (bDoDouble) - ScColumn::bDoubleAlloc = true; - SCCOL nClipStartCol = aClipRange.aStart.Col(); SCROW nClipStartRow = aClipRange.aStart.Row(); SCROW nClipEndRow = aClipRange.aEnd.Row(); @@ -2489,12 +2482,7 @@ void ScDocument::CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMar } while (nR1 <= nRow2); } - ScColumn::bDoubleAlloc = bOldDouble; - itr = rMark.begin(); - for (; itr != itrEnd && *itr < nMax; ++itr) - if (maTabs[*itr] ) - maTabs[*itr]->DecRecalcLevel(); bInsertingFromOtherDoc = false; @@ -2562,7 +2550,6 @@ void ScDocument::CopyMultiRangeFromClip( if ( *itr < aCBFCP.nTabStart ) aCBFCP.nTabStart = *itr; aCBFCP.nTabEnd = *itr; - maTabs[*itr]->IncRecalcLevel(); } } @@ -2626,9 +2613,6 @@ void ScDocument::CopyMultiRangeFromClip( } itr = rMark.begin(); - for (; itr != itrEnd && *itr < nMax; ++itr) - if (maTabs[*itr]) - maTabs[*itr]->DecRecalcLevel(); bInsertingFromOtherDoc = false; diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx index 89b409b4cef4..b5f7424065bb 100644 --- a/sc/source/core/data/dpcache.cxx +++ b/sc/source/core/data/dpcache.cxx @@ -168,6 +168,21 @@ struct Bucket maValue(rValue), mnOrderIndex(nOrder), mnDataIndex(nData), mnValueSortIndex(0) {} }; +#if DEBUG_PIVOT_TABLE +#include <iostream> +using std::cout; +using std::endl; + +struct PrintBucket : std::unary_function<Bucket, void> +{ + void operator() (const Bucket& v) const + { + cout << "value: " << v.maValue.GetValue() << " order index: " << v.mnOrderIndex << " data index: " << v.mnDataIndex << " value sort index: " << v.mnValueSortIndex << endl; + } +}; + +#endif + struct LessByValue : std::binary_function<Bucket, Bucket, bool> { bool operator() (const Bucket& left, const Bucket& right) const @@ -192,11 +207,11 @@ struct LessByDataIndex : std::binary_function<Bucket, Bucket, bool> } }; -struct EqualByValue : std::binary_function<Bucket, Bucket, bool> +struct EqualByOrderIndex : std::binary_function<Bucket, Bucket, bool> { bool operator() (const Bucket& left, const Bucket& right) const { - return left.maValue.IsCaseInsEqual(right.maValue); + return left.mnOrderIndex == right.mnOrderIndex; } }; @@ -272,7 +287,7 @@ void processBuckets(std::vector<Bucket>& aBuckets, ScDPCache::Field& rField) // Unique by value. std::vector<Bucket>::iterator itUniqueEnd = - std::unique(aBuckets.begin(), aBuckets.end(), EqualByValue()); + std::unique(aBuckets.begin(), aBuckets.end(), EqualByOrderIndex()); // Copy the unique values into items. std::vector<Bucket>::iterator itBeg = aBuckets.begin(); @@ -1100,10 +1115,6 @@ long ScDPCache::GetColumnCount() const #if DEBUG_PIVOT_TABLE -#include <iostream> -using std::cout; -using std::endl; - namespace { std::ostream& operator<< (::std::ostream& os, const rtl::OUString& str) @@ -1117,6 +1128,13 @@ void dumpItems(const ScDPCache& rCache, long nDim, const ScDPCache::ItemsType& r cout << " " << (i+nOffset) << ": " << rCache.GetFormattedString(nDim, rItems[i]) << endl; } +void dumpSourceData(const ScDPCache& rCache, long nDim, const ScDPCache::ItemsType& rItems, const ScDPCache::IndexArrayType& rArray) +{ + ScDPCache::IndexArrayType::const_iterator it = rArray.begin(), itEnd = rArray.end(); + for (; it != itEnd; ++it) + cout << " '" << rCache.GetFormattedString(nDim, rItems[*it]) << "'" << endl; +} + } void ScDPCache::Dump() const @@ -1135,6 +1153,9 @@ void ScDPCache::Dump() const cout << " group item count: " << fld.mpGroup->maItems.size() << endl; dumpItems(*this, i, fld.mpGroup->maItems, fld.maItems.size()); } + + cout << " source data (re-constructed):" << endl; + dumpSourceData(*this, i, fld.maItems, fld.maData); } } diff --git a/sc/source/core/data/dpcachetable.cxx b/sc/source/core/data/dpfilteredcache.cxx index 14f4e8e2e48e..5f4f2bd9680b 100644 --- a/sc/source/core/data/dpcachetable.cxx +++ b/sc/source/core/data/dpfilteredcache.cxx @@ -26,7 +26,7 @@ * ************************************************************************/ -#include "dpcachetable.hxx" +#include "dpfilteredcache.hxx" #include "document.hxx" #include "address.hxx" #include "cell.hxx" @@ -64,24 +64,24 @@ using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::sheet::DataPilotFieldFilter; -ScDPCacheTable::SingleFilter::SingleFilter(const ScDPItemData& rItem) : +ScDPFilteredCache::SingleFilter::SingleFilter(const ScDPItemData& rItem) : maItem(rItem) {} -bool ScDPCacheTable::SingleFilter::match(const ScDPItemData& rCellData) const +bool ScDPFilteredCache::SingleFilter::match(const ScDPItemData& rCellData) const { return maItem == rCellData; } -const ScDPItemData& ScDPCacheTable::SingleFilter::getMatchValue() const +const ScDPItemData& ScDPFilteredCache::SingleFilter::getMatchValue() const { return maItem; } -ScDPCacheTable::GroupFilter::GroupFilter() +ScDPFilteredCache::GroupFilter::GroupFilter() { } -bool ScDPCacheTable::GroupFilter::match(const ScDPItemData& rCellData) const +bool ScDPFilteredCache::GroupFilter::match(const ScDPItemData& rCellData) const { vector<ScDPItemData>::const_iterator it = maItems.begin(), itEnd = maItems.end(); for (; it != itEnd; ++it) @@ -93,19 +93,19 @@ bool ScDPCacheTable::GroupFilter::match(const ScDPItemData& rCellData) const return false; } -void ScDPCacheTable::GroupFilter::addMatchItem(const ScDPItemData& rItem) +void ScDPFilteredCache::GroupFilter::addMatchItem(const ScDPItemData& rItem) { maItems.push_back(rItem); } -size_t ScDPCacheTable::GroupFilter::getMatchItemCount() const +size_t ScDPFilteredCache::GroupFilter::getMatchItemCount() const { return maItems.size(); } // ---------------------------------------------------------------------------- -ScDPCacheTable::Criterion::Criterion() : +ScDPFilteredCache::Criterion::Criterion() : mnFieldIndex(-1), mpFilter(static_cast<FilterBase*>(NULL)) { @@ -113,36 +113,37 @@ ScDPCacheTable::Criterion::Criterion() : // ---------------------------------------------------------------------------- -ScDPCacheTable::ScDPCacheTable(const ScDPCache* pCache) : - maShowByFilter(0, MAXROW+1, false), maShowByPage(0, MAXROW+1, true), mpCache(pCache) +ScDPFilteredCache::ScDPFilteredCache(const ScDPCache& rCache) : + maShowByFilter(0, MAXROW+1, false), maShowByPage(0, MAXROW+1, true), mrCache(rCache) { } -ScDPCacheTable::~ScDPCacheTable() +ScDPFilteredCache::~ScDPFilteredCache() { } -sal_Int32 ScDPCacheTable::getRowSize() const +sal_Int32 ScDPFilteredCache::getRowSize() const { - return mpCache ? getCache()->GetRowCount() : 0; + return mrCache.GetRowCount(); } -sal_Int32 ScDPCacheTable::getColSize() const +sal_Int32 ScDPFilteredCache::getColSize() const { - return mpCache ? getCache()->GetColumnCount() : 0; + return mrCache.GetColumnCount(); } -void ScDPCacheTable::fillTable( +void ScDPFilteredCache::fillTable( const ScQueryParam& rQuery, bool bIgnoreEmptyRows, bool bRepeatIfEmpty) { SCROW nRowCount = getRowSize(); - SCROW nDataSize = mpCache->GetDataSize(); + SCROW nDataSize = mrCache.GetDataSize(); SCCOL nColCount = getColSize(); if (nRowCount <= 0 || nColCount <= 0) return; maShowByFilter.clear(); maShowByPage.clear(); + maShowByPage.build_tree(); // Process the non-empty data rows. for (SCROW nRow = 0; nRow < nDataSize; ++nRow) @@ -207,46 +208,49 @@ void ScDPCacheTable::fillTable( } } -void ScDPCacheTable::fillTable() +void ScDPFilteredCache::fillTable() { - SCROW nRowCount = getRowSize(); - SCCOL nColCount = getColSize(); - if (nRowCount <= 0 || nColCount <= 0) + SCROW nRowCount = getRowSize(); + SCCOL nColCount = getColSize(); + if (nRowCount <= 0 || nColCount <= 0) return; - maShowByFilter.clear(); - maShowByPage.clear(); - maShowByFilter.insert_front(0, nRowCount, true); - - // Initialize field entries container. - maFieldEntries.clear(); - maFieldEntries.reserve(nColCount); - - // Data rows - for (SCCOL nCol = 0; nCol < nColCount; ++nCol) - { - maFieldEntries.push_back( vector<SCROW>() ); - SCROW nMemCount = getCache()->GetDimMemberCount( nCol ); - if (!nMemCount) - continue; - - std::vector<SCROW> aAdded(nMemCount, -1); - - for (SCROW nRow = 0; nRow < nRowCount; ++nRow) - { - SCROW nIndex = getCache()->GetItemDataId(nCol, nRow, false); - SCROW nOrder = getOrder(nCol, nIndex); - aAdded[nOrder] = nIndex; - } - for (SCROW nRow = 0; nRow < nMemCount; ++nRow) - { - if (aAdded[nRow] != -1) - maFieldEntries.back().push_back(aAdded[nRow]); - } - } + maShowByPage.clear(); + maShowByPage.build_tree(); + + maShowByFilter.clear(); + maShowByFilter.insert_front(0, nRowCount, true); + maShowByFilter.build_tree(); + + // Initialize field entries container. + maFieldEntries.clear(); + maFieldEntries.reserve(nColCount); + + // Data rows + for (SCCOL nCol = 0; nCol < nColCount; ++nCol) + { + maFieldEntries.push_back( vector<SCROW>() ); + SCROW nMemCount = getCache()->GetDimMemberCount( nCol ); + if (!nMemCount) + continue; + + std::vector<SCROW> aAdded(nMemCount, -1); + + for (SCROW nRow = 0; nRow < nRowCount; ++nRow) + { + SCROW nIndex = getCache()->GetItemDataId(nCol, nRow, false); + SCROW nOrder = getOrder(nCol, nIndex); + aAdded[nOrder] = nIndex; + } + for (SCROW nRow = 0; nRow < nMemCount; ++nRow) + { + if (aAdded[nRow] != -1) + maFieldEntries.back().push_back(aAdded[nRow]); + } + } } -bool ScDPCacheTable::isRowActive(sal_Int32 nRow, sal_Int32* pLastRow) const +bool ScDPFilteredCache::isRowActive(sal_Int32 nRow, sal_Int32* pLastRow) const { bool bFilter = false, bPage = true; SCROW nLastRowFilter = MAXROW, nLastRowPage = MAXROW; @@ -262,7 +266,7 @@ bool ScDPCacheTable::isRowActive(sal_Int32 nRow, sal_Int32* pLastRow) const return bFilter && bPage; } -void ScDPCacheTable::filterByPageDimension(const vector<Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rRepeatIfEmptyDims) +void ScDPFilteredCache::filterByPageDimension(const vector<Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rRepeatIfEmptyDims) { SCROW nRowSize = getRowSize(); @@ -276,16 +280,13 @@ void ScDPCacheTable::filterByPageDimension(const vector<Criterion>& rCriteria, c maShowByPage.build_tree(); } -const ScDPItemData* ScDPCacheTable::getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const +const ScDPItemData* ScDPFilteredCache::getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const { - if (!mpCache) - return NULL; - - SCROW nId= getCache()->GetItemDataId(nCol, nRow, bRepeatIfEmpty); - return getCache()->GetItemDataById( nCol, nId ); + SCROW nId= mrCache.GetItemDataId(nCol, nRow, bRepeatIfEmpty); + return mrCache.GetItemDataById( nCol, nId ); } -void ScDPCacheTable::getValue( ScDPValueData& rVal, SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const +void ScDPFilteredCache::getValue( ScDPValueData& rVal, SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const { const ScDPItemData* pData = getCell( nCol, nRow, bRepeatIfEmpty ); @@ -298,15 +299,12 @@ void ScDPCacheTable::getValue( ScDPValueData& rVal, SCCOL nCol, SCROW nRow, boo rVal.Set(0.0, SC_VALTYPE_EMPTY); } -rtl::OUString ScDPCacheTable::getFieldName(SCCOL nIndex) const +rtl::OUString ScDPFilteredCache::getFieldName(SCCOL nIndex) const { - if (!mpCache) - return rtl::OUString(); - - return getCache()->GetDimensionName( nIndex ); + return mrCache.GetDimensionName(nIndex); } -const ::std::vector<SCROW>& ScDPCacheTable::getFieldEntries( sal_Int32 nColumn ) const +const ::std::vector<SCROW>& ScDPFilteredCache::getFieldEntries( sal_Int32 nColumn ) const { if (nColumn < 0 || static_cast<size_t>(nColumn) >= maFieldEntries.size()) { @@ -317,7 +315,7 @@ const ::std::vector<SCROW>& ScDPCacheTable::getFieldEntries( sal_Int32 nColumn return maFieldEntries[nColumn]; } -void ScDPCacheTable::filterTable(const vector<Criterion>& rCriteria, Sequence< Sequence<Any> >& rTabData, +void ScDPFilteredCache::filterTable(const vector<Criterion>& rCriteria, Sequence< Sequence<Any> >& rTabData, const boost::unordered_set<sal_Int32>& rRepeatIfEmptyDims) { sal_Int32 nRowSize = getRowSize(); @@ -383,29 +381,24 @@ void ScDPCacheTable::filterTable(const vector<Criterion>& rCriteria, Sequence< S rTabData[i] = tableData[i]; } -SCROW ScDPCacheTable::getOrder(long nDim, SCROW nIndex) const +SCROW ScDPFilteredCache::getOrder(long nDim, SCROW nIndex) const { - return mpCache->GetOrder(nDim, nIndex); + return mrCache.GetOrder(nDim, nIndex); } -void ScDPCacheTable::clear() +void ScDPFilteredCache::clear() { maFieldEntries.clear(); maShowByFilter.clear(); maShowByPage.clear(); } -bool ScDPCacheTable::empty() const +bool ScDPFilteredCache::empty() const { return maFieldEntries.empty(); } -bool ScDPCacheTable::hasCache() const -{ - return mpCache != NULL; -} - -bool ScDPCacheTable::isRowQualified(sal_Int32 nRow, const vector<Criterion>& rCriteria, +bool ScDPFilteredCache::isRowQualified(sal_Int32 nRow, const vector<Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rRepeatIfEmptyDims) const { sal_Int32 nColSize = getColSize(); @@ -426,9 +419,45 @@ bool ScDPCacheTable::isRowQualified(sal_Int32 nRow, const vector<Criterion>& rCr return true; } -const ScDPCache* ScDPCacheTable::getCache() const +const ScDPCache* ScDPFilteredCache::getCache() const { - return mpCache; + return &mrCache; } +#if DEBUG_PIVOT_TABLE +#include <iostream> +using std::cout; +using std::endl; + +void ScDPFilteredCache::dumpRowFlag(const RowFlagType& rFlag) const +{ + RowFlagType::const_iterator it = rFlag.begin(), itEnd = rFlag.end(); + bool bShow = it->second; + SCROW nRow1 = it->first; + for (++it; it != itEnd; ++it) + { + SCROW nRow2 = it->first; + cout << " * range " << nRow1 << "-" << nRow2 << ": " << (bShow ? "on" : "off") << endl; + bShow = it->second; + nRow1 = nRow2; + } +} + +void ScDPFilteredCache::dump() const +{ + cout << "--- pivot cache filter dump" << endl; + + cout << endl; + cout << "* show by filter" << endl; + dumpRowFlag(maShowByFilter); + + cout << endl; + cout << "* show by page dimensions" << endl; + dumpRowFlag(maShowByPage); + + cout << "---" << endl; +} + +#endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx index aba278556336..7ef663a2c600 100644 --- a/sc/source/core/data/dpgroup.cxx +++ b/sc/source/core/data/dpgroup.cxx @@ -30,7 +30,7 @@ #include "global.hxx" #include "document.hxx" -#include "dpcachetable.hxx" +#include "dpfilteredcache.hxx" #include "dptabsrc.hxx" #include "dptabres.hxx" #include "dpobject.hxx" @@ -63,7 +63,7 @@ using ::boost::shared_ptr; const sal_uInt16 SC_DP_LEAPYEAR = 1648; // arbitrary leap year for date calculations -class ScDPGroupNumFilter : public ScDPCacheTable::FilterBase +class ScDPGroupNumFilter : public ScDPFilteredCache::FilterBase { public: ScDPGroupNumFilter(const ScDPItemData& rValue, const ScDPNumGroupInfo& rInfo); @@ -103,7 +103,7 @@ bool ScDPGroupNumFilter::match(const ScDPItemData& rCellData) const return low <= rCellData.GetValue() && rCellData.GetValue() < high; } -class ScDPGroupDateFilter : public ScDPCacheTable::FilterBase +class ScDPGroupDateFilter : public ScDPFilteredCache::FilterBase { public: virtual ~ScDPGroupDateFilter() {} @@ -309,7 +309,7 @@ bool ScDPGroupItem::HasCommonElement( const ScDPGroupItem& rOther ) const return false; } -void ScDPGroupItem::FillGroupFilter( ScDPCacheTable::GroupFilter& rFilter ) const +void ScDPGroupItem::FillGroupFilter( ScDPFilteredCache::GroupFilter& rFilter ) const { ScDPItemDataVec::const_iterator itrEnd = aElements.end(); for (ScDPItemDataVec::const_iterator itr = aElements.begin(); itr != itrEnd; ++itr) @@ -361,7 +361,7 @@ void ScDPGroupDimension::SetGroupDim( long nDim ) } const std::vector<SCROW>& ScDPGroupDimension::GetColumnEntries( - const ScDPCacheTable& rCacheTable) const + const ScDPFilteredCache& rCacheTable) const { if (!maMemberEntries.empty()) return maMemberEntries; @@ -628,7 +628,7 @@ void ScDPGroupTableData::CreateCacheTable() pSourceData->CreateCacheTable(); } -void ScDPGroupTableData::ModifyFilterCriteria(vector<ScDPCacheTable::Criterion>& rCriteria) +void ScDPGroupTableData::ModifyFilterCriteria(vector<ScDPFilteredCache::Criterion>& rCriteria) { typedef boost::unordered_map<long, const ScDPGroupDimension*> GroupFieldMapType; GroupFieldMapType aGroupFieldIds; @@ -638,17 +638,17 @@ void ScDPGroupTableData::ModifyFilterCriteria(vector<ScDPCacheTable::Criterion>& aGroupFieldIds.insert( boost::unordered_map<long, const ScDPGroupDimension*>::value_type(itr->GetGroupDim(), &(*itr)) ); } - vector<ScDPCacheTable::Criterion> aNewCriteria; + vector<ScDPFilteredCache::Criterion> aNewCriteria; aNewCriteria.reserve(rCriteria.size() + aGroups.size()); // Go through all the filtered field names and process them appropriately. const ScDPCache* pCache = GetCacheTable().getCache(); - vector<ScDPCacheTable::Criterion>::const_iterator itrEnd = rCriteria.end(); + vector<ScDPFilteredCache::Criterion>::const_iterator itrEnd = rCriteria.end(); GroupFieldMapType::const_iterator itrGrpEnd = aGroupFieldIds.end(); - for (vector<ScDPCacheTable::Criterion>::const_iterator itr = rCriteria.begin(); itr != itrEnd; ++itr) + for (vector<ScDPFilteredCache::Criterion>::const_iterator itr = rCriteria.begin(); itr != itrEnd; ++itr) { - ScDPCacheTable::SingleFilter* pFilter = dynamic_cast<ScDPCacheTable::SingleFilter*>(itr->mpFilter.get()); + ScDPFilteredCache::SingleFilter* pFilter = dynamic_cast<ScDPFilteredCache::SingleFilter*>(itr->mpFilter.get()); if (!pFilter) // We expect this to be a single filter. continue; @@ -659,7 +659,7 @@ void ScDPGroupTableData::ModifyFilterCriteria(vector<ScDPCacheTable::Criterion>& if (IsNumGroupDimension(itr->mnFieldIndex)) { // internal number group field - ScDPCacheTable::Criterion aCri; + ScDPFilteredCache::Criterion aCri; aCri.mnFieldIndex = itr->mnFieldIndex; const ScDPNumGroupDimension& rNumGrpDim = pNumGroups[itr->mnFieldIndex]; const ScDPNumGroupInfo* pNumInfo = pCache->GetNumGroupInfo(itr->mnFieldIndex); @@ -701,7 +701,7 @@ void ScDPGroupTableData::ModifyFilterCriteria(vector<ScDPCacheTable::Criterion>& if (pGrpDim->IsDateDimension() && pNumInfo) { // external number group - ScDPCacheTable::Criterion aCri; + ScDPFilteredCache::Criterion aCri; aCri.mnFieldIndex = nSrcDim; // use the source dimension, not the group dimension. aCri.mpFilter.reset( new ScDPGroupDateFilter( @@ -723,11 +723,11 @@ void ScDPGroupTableData::ModifyFilterCriteria(vector<ScDPCacheTable::Criterion>& if (!pGrpItem || !pGrpItem->GetName().IsCaseInsEqual(aName)) continue; - ScDPCacheTable::Criterion aCri; + ScDPFilteredCache::Criterion aCri; aCri.mnFieldIndex = nSrcDim; - aCri.mpFilter.reset(new ScDPCacheTable::GroupFilter()); - ScDPCacheTable::GroupFilter* pGrpFilter = - static_cast<ScDPCacheTable::GroupFilter*>(aCri.mpFilter.get()); + aCri.mpFilter.reset(new ScDPFilteredCache::GroupFilter()); + ScDPFilteredCache::GroupFilter* pGrpFilter = + static_cast<ScDPFilteredCache::GroupFilter*>(aCri.mpFilter.get()); pGrpItem->FillGroupFilter(*pGrpFilter); aNewCriteria.push_back(aCri); @@ -738,16 +738,16 @@ void ScDPGroupTableData::ModifyFilterCriteria(vector<ScDPCacheTable::Criterion>& rCriteria.swap(aNewCriteria); } -void ScDPGroupTableData::FilterCacheTable(const vector<ScDPCacheTable::Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rCatDims) +void ScDPGroupTableData::FilterCacheTable(const vector<ScDPFilteredCache::Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rCatDims) { - vector<ScDPCacheTable::Criterion> aNewCriteria(rCriteria); + vector<ScDPFilteredCache::Criterion> aNewCriteria(rCriteria); ModifyFilterCriteria(aNewCriteria); pSourceData->FilterCacheTable(aNewCriteria, rCatDims); } -void ScDPGroupTableData::GetDrillDownData(const vector<ScDPCacheTable::Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rCatDims, Sequence< Sequence<Any> >& rData) +void ScDPGroupTableData::GetDrillDownData(const vector<ScDPFilteredCache::Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rCatDims, Sequence< Sequence<Any> >& rData) { - vector<ScDPCacheTable::Criterion> aNewCriteria(rCriteria); + vector<ScDPFilteredCache::Criterion> aNewCriteria(rCriteria); ModifyFilterCriteria(aNewCriteria); pSourceData->GetDrillDownData(aNewCriteria, rCatDims, rData); } @@ -758,7 +758,7 @@ void ScDPGroupTableData::CalcResults(CalcInfo& rInfo, bool bAutoShow) // getIsDataLayoutDimension and GetSourceDim are used, so it has to be called // with original rInfo, containing dimension indexes of the grouped data. - const ScDPCacheTable& rCacheTable = pSourceData->GetCacheTable(); + const ScDPFilteredCache& rCacheTable = pSourceData->GetCacheTable(); sal_Int32 nRowSize = rCacheTable.getRowSize(); for (sal_Int32 nRow = 0; nRow < nRowSize; ++nRow) { @@ -783,7 +783,7 @@ void ScDPGroupTableData::CalcResults(CalcInfo& rInfo, bool bAutoShow) } } -const ScDPCacheTable& ScDPGroupTableData::GetCacheTable() const +const ScDPFilteredCache& ScDPGroupTableData::GetCacheTable() const { return pSourceData->GetCacheTable(); } diff --git a/sc/source/core/data/dpitemdata.cxx b/sc/source/core/data/dpitemdata.cxx index c3a163c4ba7b..ba87d66bcc81 100644 --- a/sc/source/core/data/dpitemdata.cxx +++ b/sc/source/core/data/dpitemdata.cxx @@ -293,6 +293,8 @@ sal_uInt8 ScDPItemData::GetCellType() const } #if DEBUG_PIVOT_TABLE +#include <cstdio> + void ScDPItemData::Dump(const char* msg) const { printf("--- (%s)\n", msg); diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 81888fdfe6dc..cfd89aa31efe 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -595,7 +595,7 @@ ScDPTableData* ScDPObject::GetTableData() if (pCache) { pCache->AddReference(this); - pData.reset(new ScDatabaseDPData(pDoc, pCache)); + pData.reset(new ScDatabaseDPData(pDoc, *pCache)); } } else @@ -616,7 +616,7 @@ ScDPTableData* ScDPObject::GetTableData() if (pCache) { pCache->AddReference(this); - pData.reset(new ScSheetDPData(pDoc, *pSheetDesc, pCache)); + pData.reset(new ScSheetDPData(pDoc, *pSheetDesc, *pCache)); } } } diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 2abe79f7861a..0e4f11265a30 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -36,7 +36,7 @@ #include "dpoutput.hxx" #include "dptabsrc.hxx" -#include "dpcachetable.hxx" +#include "dpfilteredcache.hxx" #include "document.hxx" #include "patattr.hxx" #include "docpool.hxx" diff --git a/sc/source/core/data/dpsdbtab.cxx b/sc/source/core/data/dpsdbtab.cxx index 4cd86ca778ef..a75e394d66f0 100644 --- a/sc/source/core/data/dpsdbtab.cxx +++ b/sc/source/core/data/dpsdbtab.cxx @@ -29,7 +29,7 @@ #include "dpsdbtab.hxx" #include "global.hxx" #include "globstr.hrc" -#include "dpcachetable.hxx" +#include "dpfilteredcache.hxx" #include "dptabres.hxx" #include "document.hxx" #include "dpobject.hxx" @@ -72,9 +72,9 @@ const ScDPCache* ScImportSourceDesc::CreateCache(const ScDPDimensionSaveData* pD } ScDatabaseDPData::ScDatabaseDPData( - ScDocument* pDoc, const ScDPCache* pCache) : + ScDocument* pDoc, const ScDPCache& rCache) : ScDPTableData(pDoc), - aCacheTable(pCache) + aCacheTable(rCache) { } @@ -131,25 +131,17 @@ void ScDatabaseDPData::CreateCacheTable() // cache table already created. return; - if (!aCacheTable.hasCache()) - { - OSL_FAIL("Cache table should be created with a live data cache instance at all times."); - // This better not happen!! Cache table should be created with a live - // data cache instance at all times. - return; - } - aCacheTable.fillTable(); } -void ScDatabaseDPData::FilterCacheTable(const vector<ScDPCacheTable::Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rCatDims) +void ScDatabaseDPData::FilterCacheTable(const vector<ScDPFilteredCache::Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rCatDims) { CreateCacheTable(); aCacheTable.filterByPageDimension( rCriteria, (IsRepeatIfEmpty() ? rCatDims : boost::unordered_set<sal_Int32>())); } -void ScDatabaseDPData::GetDrillDownData(const vector<ScDPCacheTable::Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rCatDims, Sequence< Sequence<Any> >& rData) +void ScDatabaseDPData::GetDrillDownData(const vector<ScDPFilteredCache::Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rCatDims, Sequence< Sequence<Any> >& rData) { CreateCacheTable(); sal_Int32 nRowSize = aCacheTable.getRowSize(); @@ -166,7 +158,7 @@ void ScDatabaseDPData::CalcResults(CalcInfo& rInfo, bool bAutoShow) CalcResultsFromCacheTable( aCacheTable, rInfo, bAutoShow); } -const ScDPCacheTable& ScDatabaseDPData::GetCacheTable() const +const ScDPFilteredCache& ScDatabaseDPData::GetCacheTable() const { return aCacheTable; } diff --git a/sc/source/core/data/dpshttab.cxx b/sc/source/core/data/dpshttab.cxx index e2f680119f1a..ef46b2ce5408 100644 --- a/sc/source/core/data/dpshttab.cxx +++ b/sc/source/core/data/dpshttab.cxx @@ -32,7 +32,7 @@ #include "dptabres.hxx" #include "document.hxx" #include "cell.hxx" -#include "dpcachetable.hxx" +#include "dpfilteredcache.hxx" #include "dpobject.hxx" #include "globstr.hrc" #include "rangenam.hxx" @@ -51,12 +51,12 @@ using ::std::vector; // ----------------------------------------------------------------------- -ScSheetDPData::ScSheetDPData(ScDocument* pD, const ScSheetSourceDesc& rDesc, const ScDPCache* pCache) : +ScSheetDPData::ScSheetDPData(ScDocument* pD, const ScSheetSourceDesc& rDesc, const ScDPCache& rCache) : ScDPTableData(pD), aQuery ( rDesc.GetQueryParam() ), bIgnoreEmptyRows( false ), bRepeatIfEmpty(false), - aCacheTable(pCache) + aCacheTable(rCache) { SCSIZE nEntryCount( aQuery.GetEntryCount()); for (SCSIZE j = 0; j < nEntryCount; ++j) @@ -182,25 +182,17 @@ void ScSheetDPData::CreateCacheTable() // already cached. return; - if (!aCacheTable.hasCache()) - { - OSL_FAIL("Cache table should be created with a live data cache instance at all times."); - // This better not happen!! The cache table should be created with a - // live data cache at all times. - return; - } - aCacheTable.fillTable(aQuery, bIgnoreEmptyRows, bRepeatIfEmpty); } -void ScSheetDPData::FilterCacheTable(const vector<ScDPCacheTable::Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rCatDims) +void ScSheetDPData::FilterCacheTable(const vector<ScDPFilteredCache::Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rCatDims) { CreateCacheTable(); aCacheTable.filterByPageDimension( rCriteria, (IsRepeatIfEmpty() ? rCatDims : boost::unordered_set<sal_Int32>())); } -void ScSheetDPData::GetDrillDownData(const vector<ScDPCacheTable::Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rCatDims, Sequence< Sequence<Any> >& rData) +void ScSheetDPData::GetDrillDownData(const vector<ScDPFilteredCache::Criterion>& rCriteria, const boost::unordered_set<sal_Int32>& rCatDims, Sequence< Sequence<Any> >& rData) { CreateCacheTable(); sal_Int32 nRowSize = aCacheTable.getRowSize(); @@ -217,7 +209,7 @@ void ScSheetDPData::CalcResults(CalcInfo& rInfo, bool bAutoShow) CalcResultsFromCacheTable(aCacheTable, rInfo, bAutoShow); } -const ScDPCacheTable& ScSheetDPData::GetCacheTable() const +const ScDPFilteredCache& ScSheetDPData::GetCacheTable() const { return aCacheTable; } diff --git a/sc/source/core/data/dptabdat.cxx b/sc/source/core/data/dptabdat.cxx index f150d8d3ef23..3bf76db42a7c 100644 --- a/sc/source/core/data/dptabdat.cxx +++ b/sc/source/core/data/dptabdat.cxx @@ -29,7 +29,7 @@ #include "dptabdat.hxx" #include "global.hxx" -#include "dpcachetable.hxx" +#include "dpfilteredcache.hxx" #include "dptabres.hxx" #include "document.hxx" #include "dpobject.hxx" @@ -157,7 +157,7 @@ sal_Bool ScDPTableData::HasCommonElement( const ScDPItemData&, long, OSL_FAIL("HasCommonElement shouldn't be called for non-group data"); return false; } -void ScDPTableData::FillRowDataFromCacheTable(sal_Int32 nRow, const ScDPCacheTable& rCacheTable, +void ScDPTableData::FillRowDataFromCacheTable(sal_Int32 nRow, const ScDPFilteredCache& rCacheTable, const CalcInfo& rInfo, CalcRowData& rData) { // column dimensions @@ -216,7 +216,7 @@ void ScDPTableData::ProcessRowData(CalcInfo& rInfo, CalcRowData& rData, bool bAu } } -void ScDPTableData::CalcResultsFromCacheTable(const ScDPCacheTable& rCacheTable, CalcInfo& rInfo, bool bAutoShow) +void ScDPTableData::CalcResultsFromCacheTable(const ScDPFilteredCache& rCacheTable, CalcInfo& rInfo, bool bAutoShow) { sal_Int32 nRowSize = rCacheTable.getRowSize(); for (sal_Int32 nRow = 0; nRow < nRowSize; ++nRow) @@ -234,7 +234,7 @@ void ScDPTableData::CalcResultsFromCacheTable(const ScDPCacheTable& rCacheTable, } } -void ScDPTableData::GetItemData(const ScDPCacheTable& rCacheTable, sal_Int32 nRow, +void ScDPTableData::GetItemData(const ScDPFilteredCache& rCacheTable, sal_Int32 nRow, const vector<long>& rDims, vector<SCROW>& rItemData) { sal_Int32 nDimSize = rDims.size(); diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 3b34126107a6..b4dfa963f183 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -3849,7 +3849,7 @@ void ScDPResultVisibilityData::addVisibleMember(const String& rDimName, const Sc rMem.insert(rMemberItem); } -void ScDPResultVisibilityData::fillFieldFilters(vector<ScDPCacheTable::Criterion>& rFilters) const +void ScDPResultVisibilityData::fillFieldFilters(vector<ScDPFilteredCache::Criterion>& rFilters) const { typedef boost::unordered_map<String, long, ScStringHashCode> FieldNameMapType; FieldNameMapType aFieldNames; @@ -3866,7 +3866,7 @@ void ScDPResultVisibilityData::fillFieldFilters(vector<ScDPCacheTable::Criterion itr != itrEnd; ++itr) { const String& rDimName = itr->first; - ScDPCacheTable::Criterion aCri; + ScDPFilteredCache::Criterion aCri; FieldNameMapType::const_iterator itrField = aFieldNames.find(rDimName); if (itrField == aFieldNames.end()) // This should never happen! @@ -3874,10 +3874,10 @@ void ScDPResultVisibilityData::fillFieldFilters(vector<ScDPCacheTable::Criterion long nDimIndex = itrField->second; aCri.mnFieldIndex = static_cast<sal_Int32>(nDimIndex); - aCri.mpFilter.reset(new ScDPCacheTable::GroupFilter(/*mrSharedString*/)); + aCri.mpFilter.reset(new ScDPFilteredCache::GroupFilter(/*mrSharedString*/)); - ScDPCacheTable::GroupFilter* pGrpFilter = - static_cast<ScDPCacheTable::GroupFilter*>(aCri.mpFilter.get()); + ScDPFilteredCache::GroupFilter* pGrpFilter = + static_cast<ScDPFilteredCache::GroupFilter*>(aCri.mpFilter.get()); const VisibleMemberType& rMem = itr->second; for (VisibleMemberType::const_iterator itrMem = rMem.begin(), itrMemEnd = rMem.end(); diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index c3c12149d19e..ba904cb24104 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -431,7 +431,7 @@ Sequence< Sequence<Any> > SAL_CALL ScDPSource::getDrillDownData(const Sequence<s { long nColumnCount = GetData()->GetColumnCount(); - vector<ScDPCacheTable::Criterion> aFilterCriteria; + vector<ScDPFilteredCache::Criterion> aFilterCriteria; sal_Int32 nFilterCount = aFilters.getLength(); for (sal_Int32 i = 0; i < nFilterCount; ++i) { @@ -449,10 +449,10 @@ Sequence< Sequence<Any> > SAL_CALL ScDPSource::getDrillDownData(const Sequence<s { ScDPItemData aItem; pMembers->getByIndex(nIndex)->FillItemData( aItem ); - aFilterCriteria.push_back( ScDPCacheTable::Criterion() ); + aFilterCriteria.push_back( ScDPFilteredCache::Criterion() ); aFilterCriteria.back().mnFieldIndex = nCol; aFilterCriteria.back().mpFilter.reset( - new ScDPCacheTable::SingleFilter(aItem)); + new ScDPFilteredCache::SingleFilter(aItem)); } } } @@ -678,12 +678,13 @@ void ScDPSource::GetCategoryDimensionIndices(boost::unordered_set<sal_Int32>& rC rCatDims.swap(aCatDims); } -void ScDPSource::FilterCacheTableByPageDimensions() +void ScDPSource::FilterCacheByPageDimensions() { - // #i117661# Repeated calls to ScDPCacheTable::filterByPageDimension are invalid because - // rows are only hidden, never shown again. If FilterCacheTableByPageDimensions is called - // again, the cache table must be re-initialized. Currently, CreateRes_Impl always uses - // a fresh cache because ScDBDocFunc::DataPilotUpdate calls InvalidateData. + // #i117661# Repeated calls to ScDPFilteredCache::filterByPageDimension + // are invalid because rows are only hidden, never shown again. If + // FilterCacheByPageDimensions is called again, the cache table must + // be re-initialized. Currently, CreateRes_Impl always uses a fresh cache + // because ScDBDocFunc::DataPilotUpdate calls InvalidateData. if (bPageFiltered) { @@ -695,7 +696,7 @@ void ScDPSource::FilterCacheTableByPageDimensions() } // filter table by page dimensions. - vector<ScDPCacheTable::Criterion> aCriteria; + vector<ScDPFilteredCache::Criterion> aCriteria; for (long i = 0; i < nPageDimCount; ++i) { ScDPDimension* pDim = GetDimensionsObject()->getByIndex(nPageDims[i]); @@ -705,11 +706,11 @@ void ScDPSource::FilterCacheTableByPageDimensions() GetLevelsObject()->getByIndex(0)->GetMembersObject(); long nMemCount = pMems->getCount(); - ScDPCacheTable::Criterion aFilter; + ScDPFilteredCache::Criterion aFilter; aFilter.mnFieldIndex = static_cast<sal_Int32>(nField); - aFilter.mpFilter.reset(new ScDPCacheTable::GroupFilter(/*rSharedString*/)); - ScDPCacheTable::GroupFilter* pGrpFilter = - static_cast<ScDPCacheTable::GroupFilter*>(aFilter.mpFilter.get()); + aFilter.mpFilter.reset(new ScDPFilteredCache::GroupFilter(/*rSharedString*/)); + ScDPFilteredCache::GroupFilter* pGrpFilter = + static_cast<ScDPFilteredCache::GroupFilter*>(aFilter.mpFilter.get()); for (long j = 0; j < nMemCount; ++j) { ScDPMember* pMem = pMems->getByIndex(j); @@ -728,10 +729,10 @@ void ScDPSource::FilterCacheTableByPageDimensions() continue; const ScDPItemData& rData = pDim->GetSelectedData(); - aCriteria.push_back(ScDPCacheTable::Criterion()); - ScDPCacheTable::Criterion& r = aCriteria.back(); + aCriteria.push_back(ScDPFilteredCache::Criterion()); + ScDPFilteredCache::Criterion& r = aCriteria.back(); r.mnFieldIndex = static_cast<sal_Int32>(nField); - r.mpFilter.reset(new ScDPCacheTable::SingleFilter(rData)); + r.mpFilter.reset(new ScDPFilteredCache::SingleFilter(rData)); } if (!aCriteria.empty()) { @@ -913,7 +914,7 @@ void ScDPSource::CreateRes_Impl() return; } - FilterCacheTableByPageDimensions(); + FilterCacheByPageDimensions(); aInfo.aPageDims.reserve(nPageDimCount); for (i = 0; i < nPageDimCount; ++i) diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index a7c681e65d94..6606fc2b643e 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -49,6 +49,8 @@ #include "colorscale.hxx" #include "stlpool.hxx" +#include <iostream> + // ----------------------------------------------------------------------- const sal_uInt16 ROWINFO_MAX = 1024; @@ -532,7 +534,13 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX for(std::vector<sal_uInt32>::const_iterator itr = rCondFormats.begin(); itr != rCondFormats.end() && !bFound; ++itr) { + if(!pInfo->pCell) + continue; + ScConditionalFormat* pCondForm = pCondFormList->GetFormat(*itr); + if(!pCondForm) + continue; + ScCondFormatData aData = pCondForm->GetData( pInfo->pCell, ScAddress( nX, nCurRow, nTab ) ); if (!aData.aStyleName.isEmpty()) @@ -570,6 +578,11 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX pInfo->pDataBar = aData.pDataBar; bFound = true; } + if(aData.pIconSet) + { + pInfo->pIconSet = aData.pIconSet; + bFound = true; + } } } diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 4d269a1465dd..378a2d46bc7b 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -56,6 +56,7 @@ #include <i18npool/mslangid.hxx> #include <com/sun/star/lang/Locale.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <unotools/calendarwrapper.hxx> #include <unotools/collatorwrapper.hxx> #include <com/sun/star/i18n/CollatorOptions.hpp> @@ -806,11 +807,14 @@ const sal_Unicode* ScGlobal::UnicodeStrChr( const sal_Unicode* pStr, // ---------------------------------------------------------------------------- -void ScGlobal::AddToken( String& rTokenList, const String& rToken, sal_Unicode cSep, xub_StrLen nSepCount, bool bForceSep ) +OUString ScGlobal::addToken(const OUString& rTokenList, const OUString& rToken, + sal_Unicode cSep, sal_Int32 nSepCount, bool bForceSep) { - if( bForceSep || (rToken.Len() && rTokenList.Len()) ) - rTokenList.Expand( rTokenList.Len() + nSepCount, cSep ); - rTokenList.Append( rToken ); + rtl::OUStringBuffer aBuf(rTokenList); + if( bForceSep || (!rToken.isEmpty() && !rTokenList.isEmpty()) ) + comphelper::string::padToLength(aBuf, aBuf.getLength() + nSepCount, cSep); + aBuf.append(rToken); + return aBuf.makeStringAndClear(); } bool ScGlobal::IsQuoted( const String& rString, sal_Unicode cQuote ) @@ -1113,7 +1117,7 @@ utl::TransliterationWrapper* ScGlobal::GetpTransliteration() { const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage(); pTransliteration = new ::utl::TransliterationWrapper( - ::comphelper::getProcessServiceFactory(), SC_TRANSLITERATION_IGNORECASE ); + ::comphelper::getProcessComponentContext(), SC_TRANSLITERATION_IGNORECASE ); pTransliteration->loadModuleIfNeeded( eOfficeLanguage ); } OSL_ENSURE( @@ -1133,7 +1137,7 @@ CalendarWrapper* ScGlobal::GetCalendar() { if ( !pCalendar ) { - pCalendar = new CalendarWrapper( ::comphelper::getProcessServiceFactory() ); + pCalendar = new CalendarWrapper( ::comphelper::getProcessComponentContext() ); pCalendar->loadDefaultCalendar( *GetLocale() ); } return pCalendar; @@ -1161,7 +1165,7 @@ CollatorWrapper* ScGlobal::GetCaseCollator() if ( !pCaseTransliteration ) { const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage(); - pCaseTransliteration = new ::utl::TransliterationWrapper(::comphelper::getProcessServiceFactory(), SC_TRANSLITERATION_CASESENSE ); + pCaseTransliteration = new ::utl::TransliterationWrapper(::comphelper::getProcessComponentContext(), SC_TRANSLITERATION_CASESENSE ); pCaseTransliteration->loadModuleIfNeeded( eOfficeLanguage ); } return pCaseTransliteration; diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index 97ab523406a8..4f9c21a49e97 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -1057,9 +1057,9 @@ void ScNotes::clear() maNoteMap.clear(); } -ScNotes* ScNotes::clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bCloneNoteCaption, SCTAB nTab) +void ScNotes::clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bCloneNoteCaption, SCTAB nTab, ScNotes& rTarget) { - ScNotes* pNotes = new ScNotes(pDoc); + rTarget.clear(); for (ScNotes::iterator itr = maNoteMap.begin(); itr != maNoteMap.end(); ++itr) { SCCOL nCol = itr->first.first; @@ -1067,10 +1067,9 @@ ScNotes* ScNotes::clone(ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, if (nCol >= nCol1 && nCol <= nCol2 && nRow >= nRow1 && nRow <= nRow2) { - pNotes->insert(nCol, nRow, itr->second->Clone( ScAddress(nCol, nRow, nTab),*pDoc, ScAddress(nCol, nRow, nTab), bCloneNoteCaption)); + rTarget.insert(nCol, nRow, itr->second->Clone( ScAddress(nCol, nRow, nTab), *pDoc, ScAddress(nCol, nRow, nTab), bCloneNoteCaption)); } } - return pNotes; } void ScNotes::CopyFromClip(const ScNotes& rNotes, ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy, SCTAB nTab, bool bCloneCaption) diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 6d61bd7b4b23..4da2595f7e16 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -160,12 +160,10 @@ struct SetRowHeightRangeFunc : public OptimalHeightsFuncObjBase } }; -bool SetOptimalHeightsToRows( OptimalHeightsFuncObjBase& rFuncObj, ScTable* pTab, +bool SetOptimalHeightsToRows(OptimalHeightsFuncObjBase& rFuncObj, ScBitMaskCompressedArray<SCROW, sal_uInt8>* pRowFlags, SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtra, const vector<sal_uInt16>& aHeights, bool bForce) { - pTab->IncRecalcLevel(); // #i116460# avoid problems with Excel files - SCSIZE nCount = static_cast<SCSIZE>(nEndRow-nStartRow+1); bool bChanged = false; SCROW nRngStart = 0; @@ -222,8 +220,6 @@ bool SetOptimalHeightsToRows( OptimalHeightsFuncObjBase& rFuncObj, ScTable* pTab if (nLast) bChanged |= rFuncObj(nRngStart, nRngEnd, nLast); - pTab->DecRecalcLevel(); // #i116460# avoid problems with Excel files - return bChanged; } @@ -253,7 +249,6 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const rtl::OUString& rNewName pOutlineTable( NULL ), pSheetEvents( NULL ), nTab( nNewTab ), - nRecalcLvl( 0 ), pDocument( pDoc ), pSearchText ( NULL ), pSortCollator( NULL ), @@ -485,7 +480,7 @@ bool ScTable::SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtr SetRowHeightRangeFunc aFunc(this, nPPTX, nPPTY); bool bChanged = SetOptimalHeightsToRows( - aFunc, this, pRowFlags, nStartRow, nEndRow, nExtra, aHeights, bForce); + aFunc, pRowFlags, nStartRow, nEndRow, nExtra, aHeights, bForce); if ( pProgress != pOuterProgress ) delete pProgress; @@ -516,7 +511,7 @@ void ScTable::SetOptimalHeightOnly( SCROW nStartRow, SCROW nEndRow, sal_uInt16 n SetRowHeightOnlyFunc aFunc(this); SetOptimalHeightsToRows( - aFunc, this, pRowFlags, nStartRow, nEndRow, nExtra, aHeights, bForce); + aFunc, pRowFlags, nStartRow, nEndRow, nExtra, aHeights, bForce); if ( pProgress != pOuterProgress ) delete pProgress; diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index d016c6b41764..69e2f0243a55 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -134,8 +134,6 @@ bool ScTable::TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCSIZE nSize ) cons void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize ) { - IncRecalcLevel(); - InitializeNoteCaptions(); if (nStartCol==0 && nEndCol==MAXCOL) { if (mpRowHeights && pRowFlags) @@ -173,6 +171,7 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE for (SCCOL j=nStartCol; j<=nEndCol; j++) aCol[j].InsertRow( nStartRow, nSize ); + // Transfer those notes that will get shifted into another container. ScNotes aNotes(pDocument); ScNotes::iterator itr = maNotes.begin(); while( itr != maNotes.end() ) @@ -182,13 +181,14 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE ScPostIt* pPostIt = itr->second; ++itr; - if (nRow >= nStartRow) + if (nStartRow <= nRow && nStartCol <= nCol && nCol <= nEndCol) { aNotes.insert(nCol, nRow + nSize, pPostIt); maNotes.ReleaseNote(nCol, nRow); } } + // Re-insert the shifted notes. itr = aNotes.begin(); while( itr != aNotes.end() ) { @@ -201,8 +201,6 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE aNotes.ReleaseNote( nCol, nRow); } - DecRecalcLevel( false ); - InvalidatePageBreaks(); if (IsStreamValid()) @@ -215,8 +213,6 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize, bool* pUndoOutline ) { - IncRecalcLevel(); - InitializeNoteCaptions(); if (nStartCol==0 && nEndCol==MAXCOL) { if (pRowFlags) @@ -253,6 +249,7 @@ void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE } } + // Transfer those notes that will get shifted into another container. ScNotes aNotes(pDocument); ScNotes::iterator itr = maNotes.begin(); while( itr != maNotes.end() ) @@ -262,18 +259,22 @@ void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE ScPostIt* pPostIt = itr->second; ++itr; - if (nRow >= nStartRow) + if (nStartRow <= nRow && nStartCol <= nCol && nCol <= nEndCol) { - if(nRow - nStartRow > static_cast<SCROW>(nSize)) + SCROW nEndRow = nStartRow + nSize - 1; // last row of deleted region + if (nEndRow < nRow) { + // This note will get shifted. aNotes.insert(nCol, nRow - nSize, pPostIt); maNotes.ReleaseNote(nCol, nRow); } else + // Note is in the deleted area. Remove it. maNotes.erase(nCol, nRow); } } + // Re-insert the shifted notes. itr = aNotes.begin(); while( itr != aNotes.end() ) { @@ -291,7 +292,6 @@ void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE for (SCCOL j=nStartCol; j<=nEndCol; j++) aCol[j].DeleteRow( nStartRow, nSize ); } - DecRecalcLevel(); InvalidatePageBreaks(); @@ -321,8 +321,6 @@ bool ScTable::TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) cons void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) { - IncRecalcLevel(); - InitializeNoteCaptions(); if (nStartRow==0 && nEndRow==MAXROW) { if (pColWidth && pColFlags) @@ -368,6 +366,7 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE aCol[MAXCOL - nSize - i].MoveTo(nStartRow, nEndRow, aCol[MAXCOL - i]); } + // Transfer those notes that will get shifted into another container. ScNotes aNotes(pDocument); ScNotes::iterator itr = maNotes.begin(); while( itr != maNotes.end() ) @@ -377,13 +376,14 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE ScPostIt* pPostIt = itr->second; ++itr; - if (nCol - nStartCol >= nStartCol) + if (nStartCol <= nCol && nStartRow <= nRow && nRow <= nEndRow) { aNotes.insert(nCol + nSize, nRow, pPostIt); maNotes.ReleaseNote(nCol, nRow); } } + // Re-insert the shifted notes. itr = aNotes.begin(); while( itr != aNotes.end() ) { @@ -411,7 +411,6 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE aCol[nStartCol+i].ClearItems( nStartRow, nEndRow, nWhichArray ); } } - DecRecalcLevel(); InvalidatePageBreaks(); @@ -425,8 +424,6 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize, bool* pUndoOutline ) { - IncRecalcLevel(); - InitializeNoteCaptions(); if (nStartRow==0 && nEndRow==MAXROW) { if (pColWidth && pColFlags) @@ -477,6 +474,7 @@ void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE aCol[nStartCol + nSize + i].MoveTo(nStartRow, nEndRow, aCol[nStartCol + i]); } + // Transfer those notes that will get shifted into another container. ScNotes aNotes(pDocument); ScNotes::iterator itr = maNotes.begin(); while( itr != maNotes.end() ) @@ -486,18 +484,22 @@ void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE ScPostIt* pPostIt = itr->second; ++itr; - if (nCol >= nStartCol) + if (nStartCol <= nCol && nStartRow <= nRow && nRow <= nEndRow) { - if(nCol > static_cast<SCCOL>(nSize)) + SCCOL nEndCol = nStartCol + nSize - 1; + if (nEndCol < nCol) { + // This note will get shifted. aNotes.insert(nCol - nSize, nRow, pPostIt); maNotes.ReleaseNote(nCol, nRow); } else + // The note is in the deleted region. Remove it. maNotes.erase(nCol, nRow); } } + // Re-insert the shifted notes. itr = aNotes.begin(); while( itr != aNotes.end() ) { @@ -510,8 +512,6 @@ void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE aNotes.ReleaseNote( nCol, nRow); } - DecRecalcLevel(); - InvalidatePageBreaks(); if (IsStreamValid()) @@ -611,7 +611,7 @@ void ScTable::CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, pTable->mpRangeName = new ScRangeName(*mpRangeName); // notes - pTable->maNotes = *maNotes.clone(pTable->pDocument, nCol1, nRow1, nCol2, nRow2, bCloneNoteCaptions, nTab); + maNotes.clone(pTable->pDocument, nCol1, nRow1, nCol2, nRow2, bCloneNoteCaptions, nTab, pTable->maNotes); SCCOL i; @@ -736,7 +736,6 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2)) { - IncRecalcLevel(); for ( SCCOL i = nCol1; i <= nCol2; i++) aCol[i].CopyFromClip(nRow1, nRow2, nDy, nInsFlag, bAsLink, bSkipAttrForEmpty, pTable->aCol[i - nDx]); @@ -783,7 +782,6 @@ void ScTable::CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, // create deep copies for conditional formatting CopyConditionalFormat( nCol1, nRow1, nCol2, nRow2, nDx, nDy, pTable); } - DecRecalcLevel(); } } @@ -1026,8 +1024,6 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if (bWidth || bHeight) { - pDestTab->IncRecalcLevel(); - if (bWidth) { for (SCCOL i = nCol1; i <= nCol2; ++i) @@ -1092,7 +1088,6 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, } pDestTab->SetRowManualBreaks( maRowManualBreaks); } - pDestTab->DecRecalcLevel(); } if (bFlagChange) @@ -1111,9 +1106,6 @@ void ScTable::UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bWidth = (nRow1==0 && nRow2==MAXROW && pColWidth && pDestTab->pColWidth); bool bHeight = (nCol1==0 && nCol2==MAXCOL && mpRowHeights && pDestTab->mpRowHeights); - if (bWidth||bHeight) - IncRecalcLevel(); - for ( SCCOL i = 0; i <= MAXCOL; i++) { if ( i >= nCol1 && i <= nCol2 ) @@ -1147,7 +1139,6 @@ void ScTable::UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, pDestTab->CopyRowHeight(*this, nRow1, nRow2, 0); pDestTab->SetRowManualBreaks( maRowManualBreaks); } - DecRecalcLevel(); } } } @@ -2408,11 +2399,7 @@ void ScTable::SetColWidth( SCCOL nCol, sal_uInt16 nNewWidth ) if ( nNewWidth != pColWidth[nCol] ) { - IncRecalcLevel(); - InitializeNoteCaptions(); pColWidth[nCol] = nNewWidth; - DecRecalcLevel(); - InvalidatePageBreaks(); } } @@ -2786,11 +2773,7 @@ void ScTable::ShowCol(SCCOL nCol, bool bShow) bool bWasVis = !ColHidden(nCol); if (bWasVis != bShow) { - IncRecalcLevel(); - InitializeNoteCaptions(); - SetColHidden(nCol, nCol, !bShow); - DecRecalcLevel(); ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection(); if ( pCharts ) @@ -2891,8 +2874,6 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow) void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow) { SCROW nStartRow = nRow1; - IncRecalcLevel(); - InitializeNoteCaptions(); // #i116164# if there are no drawing objects within the row range, a single HeightChanged call is enough ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer(); @@ -2930,8 +2911,6 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow) if (bShow) SetRowFiltered(nRow1, nRow2, false); } - - DecRecalcLevel(); } bool ScTable::IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SCROW nRowEnd) const diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 8058e0a8d3c9..d84fe1fc552d 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -2306,16 +2306,4 @@ void ScTable::UpdateSelectionFunction( ScFunctionData& rData, aCol[nCol].UpdateAreaFunction( rData, *mpHiddenRows, nStartRow, nEndRow ); } -void ScTable::IncRecalcLevel() -{ - ++nRecalcLvl; -} - -void ScTable::DecRecalcLevel(bool bUpdateNoteCaptionPos) -{ - if (!--nRecalcLvl) - SetDrawPageSize(true, bUpdateNoteCaptionPos); -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx index e198b22f6962..54a1eb8072e3 100644 --- a/sc/source/core/data/table6.cxx +++ b/sc/source/core/data/table6.cxx @@ -480,10 +480,6 @@ bool ScTable::ReplaceAll( const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges, rtl::OUString& rUndoStr, ScDocument* pUndoDoc) { - bool bOldDouble = ScColumn::bDoubleAlloc; // sollte immer sal_False sein? - OSL_ENSURE(!bOldDouble,"bDoubleAlloc ???"); - ScColumn::bDoubleAlloc = true; // fuer Undo-Doc - SCCOL nCol = 0; SCROW nRow = -1; @@ -500,7 +496,6 @@ bool ScTable::ReplaceAll( else break; } - ScColumn::bDoubleAlloc = bOldDouble; return bEverFound; } diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx index 6736d74d4591..4ca1cffeb46f 100644 --- a/sc/source/core/tool/addincol.cxx +++ b/sc/source/core/tool/addincol.cxx @@ -38,7 +38,7 @@ #include <com/sun/star/lang/XSingleComponentFactory.hpp> #include <com/sun/star/reflection/XIdlClass.hpp> #include <com/sun/star/beans/XIntrospectionAccess.hpp> -#include <com/sun/star/beans/XIntrospection.hpp> +#include <com/sun/star/beans/Introspection.hpp> #include <com/sun/star/beans/MethodConcept.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/table/XCellRange.hpp> @@ -800,216 +800,209 @@ void ScUnoAddInCollection::ReadFromAddIn( const uno::Reference<uno::XInterface>& //! pass XIntrospection to ReadFromAddIn - uno::Reference<lang::XMultiServiceFactory> xManager = comphelper::getProcessServiceFactory(); - if ( xManager.is() ) + uno::Reference<uno::XComponentContext> xContext = comphelper::getProcessComponentContext(); + + uno::Reference<beans::XIntrospection> xIntro = beans::Introspection::create( xContext ); + uno::Any aObject; + aObject <<= xAddIn; + uno::Reference<beans::XIntrospectionAccess> xAcc = xIntro->inspect(aObject); + if (xAcc.is()) { - uno::Reference<beans::XIntrospection> xIntro( - xManager->createInstance(rtl::OUString("com.sun.star.beans.Introspection")), - uno::UNO_QUERY ); - if ( xIntro.is() ) + uno::Sequence< uno::Reference<reflection::XIdlMethod> > aMethods = + xAcc->getMethods( beans::MethodConcept::ALL ); + long nNewCount = aMethods.getLength(); + if ( nNewCount ) { - uno::Any aObject; - aObject <<= xAddIn; - uno::Reference<beans::XIntrospectionAccess> xAcc = xIntro->inspect(aObject); - if (xAcc.is()) + long nOld = nFuncCount; + nFuncCount = nNewCount+nOld; + if ( nOld ) + { + ScUnoAddInFuncData** ppNew = new ScUnoAddInFuncData*[nFuncCount]; + for (long i=0; i<nOld; i++) + ppNew[i] = ppFuncData[i]; + delete[] ppFuncData; + ppFuncData = ppNew; + } + else + ppFuncData = new ScUnoAddInFuncData*[nFuncCount]; + + //! TODO: adjust bucket count? + if ( !pExactHashMap ) + pExactHashMap = new ScAddInHashMap; + if ( !pNameHashMap ) + pNameHashMap = new ScAddInHashMap; + if ( !pLocalHashMap ) + pLocalHashMap = new ScAddInHashMap; + + const uno::Reference<reflection::XIdlMethod>* pArray = aMethods.getConstArray(); + for (long nFuncPos=0; nFuncPos<nNewCount; nFuncPos++) { - uno::Sequence< uno::Reference<reflection::XIdlMethod> > aMethods = - xAcc->getMethods( beans::MethodConcept::ALL ); - long nNewCount = aMethods.getLength(); - if ( nNewCount ) + ppFuncData[nFuncPos+nOld] = NULL; + + uno::Reference<reflection::XIdlMethod> xFunc = pArray[nFuncPos]; + if (xFunc.is()) { - long nOld = nFuncCount; - nFuncCount = nNewCount+nOld; - if ( nOld ) + // leave out internal functions + uno::Reference<reflection::XIdlClass> xClass = + xFunc->getDeclaringClass(); + sal_Bool bSkip = sal_True; + if ( xClass.is() ) { - ScUnoAddInFuncData** ppNew = new ScUnoAddInFuncData*[nFuncCount]; - for (long i=0; i<nOld; i++) - ppNew[i] = ppFuncData[i]; - delete[] ppFuncData; - ppFuncData = ppNew; + //! XIdlClass needs getType() method! + rtl::OUString sName = xClass->getName(); + bSkip = ( + IsTypeName( sName, + getCppuType((uno::Reference<uno::XInterface>*)0) ) || + IsTypeName( sName, + getCppuType((uno::Reference<lang::XServiceName>*)0) ) || + IsTypeName( sName, + getCppuType((uno::Reference<lang::XServiceInfo>*)0) ) || + IsTypeName( sName, + getCppuType((uno::Reference<sheet::XAddIn>*)0) ) ); } - else - ppFuncData = new ScUnoAddInFuncData*[nFuncCount]; - - //! TODO: adjust bucket count? - if ( !pExactHashMap ) - pExactHashMap = new ScAddInHashMap; - if ( !pNameHashMap ) - pNameHashMap = new ScAddInHashMap; - if ( !pLocalHashMap ) - pLocalHashMap = new ScAddInHashMap; - - const uno::Reference<reflection::XIdlMethod>* pArray = aMethods.getConstArray(); - for (long nFuncPos=0; nFuncPos<nNewCount; nFuncPos++) + if (!bSkip) { - ppFuncData[nFuncPos+nOld] = NULL; + uno::Reference<reflection::XIdlClass> xReturn = + xFunc->getReturnType(); + if ( !lcl_ValidReturnType( xReturn ) ) + bSkip = sal_True; + } + if (!bSkip) + { + rtl::OUString aFuncU = xFunc->getName(); + + // stored function name: (service name).(function) + rtl::OUStringBuffer aFuncNameBuffer( aServiceName.getLength()+1+aFuncU.getLength()); + aFuncNameBuffer.append(aServiceName); + aFuncNameBuffer.append('.'); + aFuncNameBuffer.append(aFuncU); + rtl::OUString aFuncName = aFuncNameBuffer.makeStringAndClear(); - uno::Reference<reflection::XIdlMethod> xFunc = pArray[nFuncPos]; - if (xFunc.is()) + sal_Bool bValid = sal_True; + long nVisibleCount = 0; + long nCallerPos = SC_CALLERPOS_NONE; + + uno::Sequence<reflection::ParamInfo> aParams = + xFunc->getParameterInfos(); + long nParamCount = aParams.getLength(); + const reflection::ParamInfo* pParArr = aParams.getConstArray(); + long nParamPos; + for (nParamPos=0; nParamPos<nParamCount; nParamPos++) { - // leave out internal functions - uno::Reference<reflection::XIdlClass> xClass = - xFunc->getDeclaringClass(); - sal_Bool bSkip = sal_True; - if ( xClass.is() ) + if ( pParArr[nParamPos].aMode != reflection::ParamMode_IN ) + bValid = false; + uno::Reference<reflection::XIdlClass> xParClass = + pParArr[nParamPos].aType; + ScAddInArgumentType eArgType = lcl_GetArgType( xParClass ); + if ( eArgType == SC_ADDINARG_NONE ) + bValid = false; + else if ( eArgType == SC_ADDINARG_CALLER ) + nCallerPos = nParamPos; + else + ++nVisibleCount; + } + if (bValid) + { + sal_uInt16 nCategory = lcl_GetCategory( + xAddIn->getProgrammaticCategoryName( aFuncU ) ); + + rtl::OString sHelpId = aHelpIdGenerator.GetHelpId( aFuncU ); + + ::rtl::OUString aLocalName; + try + { + aLocalName = xAddIn-> + getDisplayFunctionName( aFuncU ); + } + catch(uno::Exception&) + { + aLocalName = "###"; + } + + ::rtl::OUString aDescription; + try { - //! XIdlClass needs getType() method! - rtl::OUString sName = xClass->getName(); - bSkip = ( - IsTypeName( sName, - getCppuType((uno::Reference<uno::XInterface>*)0) ) || - IsTypeName( sName, - getCppuType((uno::Reference<lang::XServiceName>*)0) ) || - IsTypeName( sName, - getCppuType((uno::Reference<lang::XServiceInfo>*)0) ) || - IsTypeName( sName, - getCppuType((uno::Reference<sheet::XAddIn>*)0) ) ); + aDescription = xAddIn-> + getFunctionDescription( aFuncU ); } - if (!bSkip) + catch(uno::Exception&) { - uno::Reference<reflection::XIdlClass> xReturn = - xFunc->getReturnType(); - if ( !lcl_ValidReturnType( xReturn ) ) - bSkip = sal_True; + aDescription = "###"; } - if (!bSkip) + + ScAddInArgDesc* pVisibleArgs = NULL; + if ( nVisibleCount > 0 ) { - rtl::OUString aFuncU = xFunc->getName(); - - // stored function name: (service name).(function) - rtl::OUStringBuffer aFuncNameBuffer( aServiceName.getLength()+1+aFuncU.getLength()); - aFuncNameBuffer.append(aServiceName); - aFuncNameBuffer.append('.'); - aFuncNameBuffer.append(aFuncU); - rtl::OUString aFuncName = aFuncNameBuffer.makeStringAndClear(); - - sal_Bool bValid = sal_True; - long nVisibleCount = 0; - long nCallerPos = SC_CALLERPOS_NONE; - - uno::Sequence<reflection::ParamInfo> aParams = - xFunc->getParameterInfos(); - long nParamCount = aParams.getLength(); - const reflection::ParamInfo* pParArr = aParams.getConstArray(); - long nParamPos; + ScAddInArgDesc aDesc; + pVisibleArgs = new ScAddInArgDesc[nVisibleCount]; + long nDestPos = 0; for (nParamPos=0; nParamPos<nParamCount; nParamPos++) { - if ( pParArr[nParamPos].aMode != reflection::ParamMode_IN ) - bValid = false; uno::Reference<reflection::XIdlClass> xParClass = - pParArr[nParamPos].aType; + pParArr[nParamPos].aType; ScAddInArgumentType eArgType = lcl_GetArgType( xParClass ); - if ( eArgType == SC_ADDINARG_NONE ) - bValid = false; - else if ( eArgType == SC_ADDINARG_CALLER ) - nCallerPos = nParamPos; - else - ++nVisibleCount; - } - if (bValid) - { - sal_uInt16 nCategory = lcl_GetCategory( - xAddIn->getProgrammaticCategoryName( aFuncU ) ); - - rtl::OString sHelpId = aHelpIdGenerator.GetHelpId( aFuncU ); - - ::rtl::OUString aLocalName; - try - { - aLocalName = xAddIn-> - getDisplayFunctionName( aFuncU ); - } - catch(uno::Exception&) - { - aLocalName = "###"; - } - - ::rtl::OUString aDescription; - try - { - aDescription = xAddIn-> - getFunctionDescription( aFuncU ); - } - catch(uno::Exception&) - { - aDescription = "###"; - } - - ScAddInArgDesc* pVisibleArgs = NULL; - if ( nVisibleCount > 0 ) + if ( eArgType != SC_ADDINARG_CALLER ) { - ScAddInArgDesc aDesc; - pVisibleArgs = new ScAddInArgDesc[nVisibleCount]; - long nDestPos = 0; - for (nParamPos=0; nParamPos<nParamCount; nParamPos++) + rtl::OUString aArgName; + try { - uno::Reference<reflection::XIdlClass> xParClass = - pParArr[nParamPos].aType; - ScAddInArgumentType eArgType = lcl_GetArgType( xParClass ); - if ( eArgType != SC_ADDINARG_CALLER ) - { - rtl::OUString aArgName; - try - { - aArgName = xAddIn-> - getDisplayArgumentName( aFuncU, nParamPos ); - } - catch(uno::Exception&) - { - aArgName = "###"; - } - rtl::OUString aArgDesc; - try - { - aArgDesc = xAddIn-> - getArgumentDescription( aFuncU, nParamPos ); - } - catch(uno::Exception&) - { - aArgName = "###"; - } - - sal_Bool bOptional = - ( eArgType == SC_ADDINARG_VALUE_OR_ARRAY || - eArgType == SC_ADDINARG_VARARGS ); - - aDesc.eType = eArgType; - aDesc.aName = aArgName; - aDesc.aDescription = aArgDesc; - aDesc.bOptional = bOptional; - //! initialize aInternalName only from config? - aDesc.aInternalName = pParArr[nParamPos].aName; - - pVisibleArgs[nDestPos++] = aDesc; - } + aArgName = xAddIn-> + getDisplayArgumentName( aFuncU, nParamPos ); + } + catch(uno::Exception&) + { + aArgName = "###"; + } + rtl::OUString aArgDesc; + try + { + aArgDesc = xAddIn-> + getArgumentDescription( aFuncU, nParamPos ); + } + catch(uno::Exception&) + { + aArgName = "###"; } - OSL_ENSURE( nDestPos==nVisibleCount, "wrong count" ); - } - ppFuncData[nFuncPos+nOld] = new ScUnoAddInFuncData( - aFuncName, aLocalName, aDescription, - nCategory, sHelpId, - xFunc, aObject, - nVisibleCount, pVisibleArgs, nCallerPos ); - - const ScUnoAddInFuncData* pData = - ppFuncData[nFuncPos+nOld]; - pExactHashMap->insert( - ScAddInHashMap::value_type( - pData->GetOriginalName(), - pData ) ); - pNameHashMap->insert( - ScAddInHashMap::value_type( - pData->GetUpperName(), - pData ) ); - pLocalHashMap->insert( - ScAddInHashMap::value_type( - pData->GetUpperLocal(), - pData ) ); - - delete[] pVisibleArgs; + sal_Bool bOptional = + ( eArgType == SC_ADDINARG_VALUE_OR_ARRAY || + eArgType == SC_ADDINARG_VARARGS ); + + aDesc.eType = eArgType; + aDesc.aName = aArgName; + aDesc.aDescription = aArgDesc; + aDesc.bOptional = bOptional; + //! initialize aInternalName only from config? + aDesc.aInternalName = pParArr[nParamPos].aName; + + pVisibleArgs[nDestPos++] = aDesc; + } } + OSL_ENSURE( nDestPos==nVisibleCount, "wrong count" ); } + + ppFuncData[nFuncPos+nOld] = new ScUnoAddInFuncData( + aFuncName, aLocalName, aDescription, + nCategory, sHelpId, + xFunc, aObject, + nVisibleCount, pVisibleArgs, nCallerPos ); + + const ScUnoAddInFuncData* pData = + ppFuncData[nFuncPos+nOld]; + pExactHashMap->insert( + ScAddInHashMap::value_type( + pData->GetOriginalName(), + pData ) ); + pNameHashMap->insert( + ScAddInHashMap::value_type( + pData->GetUpperName(), + pData ) ); + pLocalHashMap->insert( + ScAddInHashMap::value_type( + pData->GetUpperLocal(), + pData ) ); + + delete[] pVisibleArgs; } } } @@ -1066,119 +1059,112 @@ void ScUnoAddInCollection::UpdateFromAddIn( const uno::Reference<uno::XInterface // only get the function information from Introspection - uno::Reference<lang::XMultiServiceFactory> xManager = comphelper::getProcessServiceFactory(); - if ( xManager.is() ) + uno::Reference<uno::XComponentContext> xContext = comphelper::getProcessComponentContext(); + + uno::Reference<beans::XIntrospection> xIntro = beans::Introspection::create(xContext); + uno::Any aObject; + aObject <<= xInterface; + uno::Reference<beans::XIntrospectionAccess> xAcc = xIntro->inspect(aObject); + if (xAcc.is()) { - uno::Reference<beans::XIntrospection> xIntro( - xManager->createInstance(rtl::OUString("com.sun.star.beans.Introspection")), - uno::UNO_QUERY ); - if ( xIntro.is() ) + uno::Sequence< uno::Reference<reflection::XIdlMethod> > aMethods = + xAcc->getMethods( beans::MethodConcept::ALL ); + long nMethodCount = aMethods.getLength(); + const uno::Reference<reflection::XIdlMethod>* pArray = aMethods.getConstArray(); + for (long nFuncPos=0; nFuncPos<nMethodCount; nFuncPos++) { - uno::Any aObject; - aObject <<= xInterface; - uno::Reference<beans::XIntrospectionAccess> xAcc = xIntro->inspect(aObject); - if (xAcc.is()) + uno::Reference<reflection::XIdlMethod> xFunc = pArray[nFuncPos]; + if (xFunc.is()) { - uno::Sequence< uno::Reference<reflection::XIdlMethod> > aMethods = - xAcc->getMethods( beans::MethodConcept::ALL ); - long nMethodCount = aMethods.getLength(); - const uno::Reference<reflection::XIdlMethod>* pArray = aMethods.getConstArray(); - for (long nFuncPos=0; nFuncPos<nMethodCount; nFuncPos++) + rtl::OUString aFuncU = xFunc->getName(); + + // stored function name: (service name).(function) + rtl::OUStringBuffer aFuncNameBuffer( rServiceName.getLength()+1+aFuncU.getLength()); + aFuncNameBuffer.append(rServiceName); + aFuncNameBuffer.append('.'); + aFuncNameBuffer.append(aFuncU); + rtl::OUString aFuncName = aFuncNameBuffer.makeStringAndClear(); + + // internal names are skipped because no FuncData exists + ScUnoAddInFuncData* pOldData = const_cast<ScUnoAddInFuncData*>( GetFuncData( aFuncName ) ); + if ( pOldData ) { - uno::Reference<reflection::XIdlMethod> xFunc = pArray[nFuncPos]; - if (xFunc.is()) + // Create new (complete) argument info. + // As in ReadFromAddIn, the reflection information is authoritative. + // Local names and descriptions from pOldData are looked up using the + // internal argument name. + + sal_Bool bValid = sal_True; + long nVisibleCount = 0; + long nCallerPos = SC_CALLERPOS_NONE; + + uno::Sequence<reflection::ParamInfo> aParams = + xFunc->getParameterInfos(); + long nParamCount = aParams.getLength(); + const reflection::ParamInfo* pParArr = aParams.getConstArray(); + long nParamPos; + for (nParamPos=0; nParamPos<nParamCount; nParamPos++) { - rtl::OUString aFuncU = xFunc->getName(); - - // stored function name: (service name).(function) - rtl::OUStringBuffer aFuncNameBuffer( rServiceName.getLength()+1+aFuncU.getLength()); - aFuncNameBuffer.append(rServiceName); - aFuncNameBuffer.append('.'); - aFuncNameBuffer.append(aFuncU); - rtl::OUString aFuncName = aFuncNameBuffer.makeStringAndClear(); - - // internal names are skipped because no FuncData exists - ScUnoAddInFuncData* pOldData = const_cast<ScUnoAddInFuncData*>( GetFuncData( aFuncName ) ); - if ( pOldData ) + if ( pParArr[nParamPos].aMode != reflection::ParamMode_IN ) + bValid = false; + uno::Reference<reflection::XIdlClass> xParClass = + pParArr[nParamPos].aType; + ScAddInArgumentType eArgType = lcl_GetArgType( xParClass ); + if ( eArgType == SC_ADDINARG_NONE ) + bValid = false; + else if ( eArgType == SC_ADDINARG_CALLER ) + nCallerPos = nParamPos; + else + ++nVisibleCount; + } + if (bValid) + { + ScAddInArgDesc* pVisibleArgs = NULL; + if ( nVisibleCount > 0 ) { - // Create new (complete) argument info. - // As in ReadFromAddIn, the reflection information is authoritative. - // Local names and descriptions from pOldData are looked up using the - // internal argument name. - - sal_Bool bValid = sal_True; - long nVisibleCount = 0; - long nCallerPos = SC_CALLERPOS_NONE; - - uno::Sequence<reflection::ParamInfo> aParams = - xFunc->getParameterInfos(); - long nParamCount = aParams.getLength(); - const reflection::ParamInfo* pParArr = aParams.getConstArray(); - long nParamPos; + ScAddInArgDesc aDesc; + pVisibleArgs = new ScAddInArgDesc[nVisibleCount]; + long nDestPos = 0; for (nParamPos=0; nParamPos<nParamCount; nParamPos++) { - if ( pParArr[nParamPos].aMode != reflection::ParamMode_IN ) - bValid = false; uno::Reference<reflection::XIdlClass> xParClass = - pParArr[nParamPos].aType; + pParArr[nParamPos].aType; ScAddInArgumentType eArgType = lcl_GetArgType( xParClass ); - if ( eArgType == SC_ADDINARG_NONE ) - bValid = false; - else if ( eArgType == SC_ADDINARG_CALLER ) - nCallerPos = nParamPos; - else - ++nVisibleCount; - } - if (bValid) - { - ScAddInArgDesc* pVisibleArgs = NULL; - if ( nVisibleCount > 0 ) + if ( eArgType != SC_ADDINARG_CALLER ) { - ScAddInArgDesc aDesc; - pVisibleArgs = new ScAddInArgDesc[nVisibleCount]; - long nDestPos = 0; - for (nParamPos=0; nParamPos<nParamCount; nParamPos++) + const ScAddInArgDesc* pOldArgDesc = + lcl_FindArgDesc( *pOldData, pParArr[nParamPos].aName ); + if ( pOldArgDesc ) { - uno::Reference<reflection::XIdlClass> xParClass = - pParArr[nParamPos].aType; - ScAddInArgumentType eArgType = lcl_GetArgType( xParClass ); - if ( eArgType != SC_ADDINARG_CALLER ) - { - const ScAddInArgDesc* pOldArgDesc = - lcl_FindArgDesc( *pOldData, pParArr[nParamPos].aName ); - if ( pOldArgDesc ) - { - aDesc.aName = pOldArgDesc->aName; - aDesc.aDescription = pOldArgDesc->aDescription; - } - else - aDesc.aName = aDesc.aDescription = "###"; + aDesc.aName = pOldArgDesc->aName; + aDesc.aDescription = pOldArgDesc->aDescription; + } + else + aDesc.aName = aDesc.aDescription = "###"; - sal_Bool bOptional = - ( eArgType == SC_ADDINARG_VALUE_OR_ARRAY || - eArgType == SC_ADDINARG_VARARGS ); + sal_Bool bOptional = + ( eArgType == SC_ADDINARG_VALUE_OR_ARRAY || + eArgType == SC_ADDINARG_VARARGS ); - aDesc.eType = eArgType; - aDesc.bOptional = bOptional; - //! initialize aInternalName only from config? - aDesc.aInternalName = pParArr[nParamPos].aName; + aDesc.eType = eArgType; + aDesc.bOptional = bOptional; + //! initialize aInternalName only from config? + aDesc.aInternalName = pParArr[nParamPos].aName; - pVisibleArgs[nDestPos++] = aDesc; - } - } - OSL_ENSURE( nDestPos==nVisibleCount, "wrong count" ); + pVisibleArgs[nDestPos++] = aDesc; } + } + OSL_ENSURE( nDestPos==nVisibleCount, "wrong count" ); + } - pOldData->SetFunction( xFunc, aObject ); - pOldData->SetArguments( nVisibleCount, pVisibleArgs ); - pOldData->SetCallerPos( nCallerPos ); + pOldData->SetFunction( xFunc, aObject ); + pOldData->SetArguments( nVisibleCount, pVisibleArgs ); + pOldData->SetCallerPos( nCallerPos ); - if ( pFunctionList ) - lcl_UpdateFunctionList( *pFunctionList, *pOldData ); + if ( pFunctionList ) + lcl_UpdateFunctionList( *pFunctionList, *pOldData ); - delete[] pVisibleArgs; - } - } + delete[] pVisibleArgs; } } } diff --git a/sc/source/core/tool/cellkeytranslator.cxx b/sc/source/core/tool/cellkeytranslator.cxx index ea63b57e6204..1a654b5627ee 100644 --- a/sc/source/core/tool/cellkeytranslator.cxx +++ b/sc/source/core/tool/cellkeytranslator.cxx @@ -179,7 +179,7 @@ void ScCellKeywordTranslator::transKeyword(rtl::OUString& rName, const Locale* p } ScCellKeywordTranslator::ScCellKeywordTranslator() : - maTransWrapper( ::comphelper::getProcessServiceFactory(), + maTransWrapper( ::comphelper::getProcessComponentContext(), i18n::TransliterationModules_LOWERCASE_UPPERCASE ) { init(); diff --git a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx index 48169c331191..35b6b9115c1a 100644 --- a/sc/source/core/tool/chartpos.cxx +++ b/sc/source/core/tool/chartpos.cxx @@ -470,7 +470,7 @@ void ScChartPositioner::CreatePositionMap() { sal_uLong nKey = it1->first; for (ColumnMap::const_iterator it2 = ++pCols->begin(); it2 != pCols->end(); ++it2 ) - it2->second->insert( RowMap::value_type( nKey, NULL )); // no data + it2->second->insert( RowMap::value_type( nKey, (ScAddress *)NULL )); // no data } } } diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index c8e317c6a5e7..9771136c5512 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -216,7 +216,7 @@ void ScCompiler::InitCharClassEnglish() OUString( RTL_CONSTASCII_USTRINGPARAM( "US")), OUString()); pCharClassEnglish = new CharClass( - ::comphelper::getProcessServiceFactory(), aLocale); + ::comphelper::getProcessComponentContext(), aLocale); } diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index 870d8211b011..b8918c817f69 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -660,7 +660,9 @@ String ScHeaderEditEngine::CalcFieldValue( const SvxFieldItem& rField, case text::textfield::Type::PAGES: aRet = lcl_GetNumStr( aData.nTotalPages,aData.eNumType ); break; + case text::textfield::Type::EXTENDED_TIME: case text::textfield::Type::TIME: + // For now, time field in the header / footer is always dynamic. aRet = ScGlobal::pLocaleData->getTime(aData.aTime); break; case text::textfield::Type::DOCINFO_TITLE: diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 3809aa4fee0a..3ff768e41d6e 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -3248,7 +3248,7 @@ void ScInterpreter::ScChar() static ::rtl::OUString lcl_convertIntoHalfWidth( const ::rtl::OUString & rStr ) { static bool bFirstASCCall = true; - static utl::TransliterationWrapper aTrans( ::comphelper::getProcessServiceFactory(), 0 ); + static utl::TransliterationWrapper aTrans( ::comphelper::getProcessComponentContext(), 0 ); if( bFirstASCCall ) { @@ -3263,7 +3263,7 @@ static ::rtl::OUString lcl_convertIntoHalfWidth( const ::rtl::OUString & rStr ) static ::rtl::OUString lcl_convertIntoFullWidth( const ::rtl::OUString & rStr ) { static bool bFirstJISCall = true; - static utl::TransliterationWrapper aTrans( ::comphelper::getProcessServiceFactory(), 0 ); + static utl::TransliterationWrapper aTrans( ::comphelper::getProcessComponentContext(), 0 ); if( bFirstJISCall ) { diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index fc899502d7d4..9e5056341ea1 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -26,6 +26,7 @@ * ************************************************************************/ +#include <comphelper/string.hxx> #include <sfx2/linkmgr.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/objsh.hxx> @@ -2602,7 +2603,14 @@ void ScInterpreter::ScRoman() { if( nDigit > 4 ) aRoman += pChars[ nIndex - 1 ]; - aRoman.Expand( aRoman.Len() + (nDigit % 5), pChars[ nIndex ] ); + sal_Int32 nPad = nDigit % 5; + if (nPad) + { + rtl::OUStringBuffer aBuf(aRoman); + comphelper::string::padToLength(aBuf, aBuf.getLength() + nPad, + pChars[nIndex]); + aRoman = aBuf.makeStringAndClear(); + } nVal %= pValues[ nIndex ]; } } diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 4eb288cbefd7..fc519c7c6e84 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -2998,9 +2998,13 @@ void ScInterpreter::ScExternal() uno::Reference<table::XCellRange> xObj = ScCellRangeObj::CreateRangeFromDoc( pDok, aRange ); if (xObj.is()) + { aParam <<= xObj; + } else + { SetError(errIllegalParameter); + } } break; default: @@ -3017,8 +3021,9 @@ void ScInterpreter::ScExternal() } while (nPar-- > 0) + { Pop(); // in case of error, remove remaining args - + } if ( !GetError() ) { aCall.ExecuteCall(); @@ -3026,8 +3031,9 @@ void ScInterpreter::ScExternal() if ( aCall.HasVarRes() ) // handle async functions { if ( pMyFormulaCell->GetCode()->IsRecalcModeNormal() ) + { pMyFormulaCell->GetCode()->SetRecalcModeOnLoad(); - + } uno::Reference<sheet::XVolatileResult> xRes = aCall.GetVarRes(); ScAddInListener* pLis = ScAddInListener::Get( xRes ); if ( !pLis ) @@ -3039,23 +3045,31 @@ void ScInterpreter::ScExternal() { pMyFormulaCell->StartListening( *pLis ); if ( !pLis->HasDocument( pDok ) ) + { pLis->AddDocument( pDok ); + } } aCall.SetResult( pLis->GetResult() ); // use result from async } if ( aCall.GetErrCode() ) + { PushError( aCall.GetErrCode() ); + } else if ( aCall.HasMatrix() ) { ScMatrixRef xMat = aCall.GetMatrix(); PushMatrix( xMat ); } else if ( aCall.HasString() ) + { PushString( aCall.GetString() ); + } else + { PushDouble( aCall.GetValue() ); + } } else // error... PushError( GetError()); @@ -3063,7 +3077,9 @@ void ScInterpreter::ScExternal() else { while( nParamCount-- > 0) + { Pop(); + } PushError( errNoAddin ); } } @@ -3091,24 +3107,27 @@ static uno::Any lcl_getSheetModule( const uno::Reference<table::XCellRange>& xCe BasicManager* pBasMgr = pDok->GetDocumentShell()->GetBasicManager(); uno::Reference< uno::XInterface > xIf; - if ( pBasMgr && pBasMgr->GetName().Len() ) + if ( pBasMgr && !pBasMgr->GetName().isEmpty() ) { String sProj = String( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); - if ( pDok->GetDocumentShell()->GetBasicManager()->GetName().Len() ) + if ( !pDok->GetDocumentShell()->GetBasicManager()->GetName().isEmpty() ) + { sProj = pDok->GetDocumentShell()->GetBasicManager()->GetName(); + } StarBASIC* pBasic = pDok->GetDocumentShell()->GetBasicManager()->GetLib( sProj ); if ( pBasic ) { SbModule* pMod = pBasic->FindModule( sCodeName ); if ( pMod ) + { xIf = pMod->GetUnoModule(); + } } } return uno::makeAny( xIf ); } -static bool -lcl_setVBARange( ScRange& aRange, ScDocument* pDok, SbxVariable* pPar ) +static bool lcl_setVBARange( ScRange& aRange, ScDocument* pDok, SbxVariable* pPar ) { bool bOk = false; try @@ -3186,10 +3205,13 @@ void ScInterpreter::ScMacro() aMacroStr += pMethod->GetName(); String aBasicStr; if (pObject->GetParent()) + { aBasicStr = pObject->GetParent()->GetName(); // Dokumentenbasic + } else + { aBasicStr = SFX_APP()->GetName(); // Applikationsbasic - + } // Parameter-Array zusammenbauen SbxArrayRef refPar = new SbxArray; @@ -3216,7 +3238,9 @@ void ScInterpreter::ScMacro() bOk = lcl_setVBARange( aRange, pDok, pPar ); } else + { bOk = SetSbxVariable( pPar, aAdr ); + } } break; case svDoubleRef: @@ -3283,15 +3307,21 @@ void ScInterpreter::ScMacro() nIdx[ 1 ] = static_cast<sal_Int32>(nMatCol+1); SbxVariable* p = refArray->Get32( nIdx ); if (pMat->IsString(nMatCol, nMatRow)) + { p->PutString( pMat->GetString(nMatCol, nMatRow) ); + } else + { p->PutDouble( pMat->GetDouble(nMatCol, nMatRow)); + } } } pPar->PutObject( refArray ); } else + { SetError( errIllegalParameter ); + } } break; default: @@ -3317,11 +3347,17 @@ void ScInterpreter::ScMacro() SbxDataType eResType = refRes->GetType(); if( pVar->GetError() ) + { SetError( errNoValue); + } if ( eRet != ERRCODE_NONE ) + { PushNoValue(); + } else if( eResType >= SbxINTEGER && eResType <= SbxDOUBLE ) + { PushDouble( refRes->GetDouble() ); + } else if ( eResType & SbxARRAY ) { SbxBase* pElemObj = refRes->GetObject(); @@ -3368,21 +3404,31 @@ void ScInterpreter::ScMacro() pV = pDimArray->Get32( nIdx ); eType = pV->GetType(); if ( eType >= SbxINTEGER && eType <= SbxDOUBLE ) + { pMat->PutDouble( pV->GetDouble(), i, j ); + } else - pMat->PutString( pV->GetString(), i, j ); + { + pMat->PutString( pV->GetOUString(), i, j ); + } } } PushMatrix( pMat ); } else + { PushIllegalArgument(); + } } else + { PushNoValue(); + } } else - PushString( refRes->GetString() ); + { + PushString( refRes->GetOUString() ); + } } if (bVolatileMacro && meVolatileType == NOT_VOLATILE) diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx index 46fd6fc1649b..faa0db59aca9 100644 --- a/sc/source/core/tool/interpr5.cxx +++ b/sc/source/core/tool/interpr5.cxx @@ -453,7 +453,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken nGlobalError = 0; } - if (nThisRow == nPrevRow + 1) + if (!aBucket.maNumVals.empty() && nThisRow == nPrevRow + 1) { // Secondary numbers. aBucket.maNumVals.push_back(fVal); @@ -475,7 +475,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken double fVal = CreateDoubleError( nGlobalError); nGlobalError = 0; - if (nThisRow == nPrevRow + 1) + if (!aBucket.maNumVals.empty() && nThisRow == nPrevRow + 1) { // Secondary numbers. aBucket.maNumVals.push_back(fVal); @@ -490,7 +490,7 @@ ScMatrixRef ScInterpreter::CreateMatrixFromDoubleRef( const FormulaToken* pToken } else { - if (nThisRow == nPrevRow + 1) + if (!aBucket.maStrVals.empty() && nThisRow == nPrevRow + 1) { // Secondary numbers. aBucket.maStrVals.push_back(aStr); diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx index 2b4dc058b162..f77779fb22ec 100644 --- a/sc/source/filter/excel/colrowst.cxx +++ b/sc/source/filter/excel/colrowst.cxx @@ -204,7 +204,6 @@ void XclImpColRowSettings::Convert( SCTAB nScTab ) return; ScDocument& rDoc = GetDoc(); - rDoc.IncSizeRecalcLevel( nScTab ); // column widths ---------------------------------------------------------- @@ -288,13 +287,11 @@ void XclImpColRowSettings::Convert( SCTAB nScTab ) // ------------------------------------------------------------------------ mbDirty = false; - rDoc.DecSizeRecalcLevel( nScTab ); } void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab ) { ScDocument& rDoc = GetDoc(); - rDoc.IncSizeRecalcLevel( nScTab ); // #i116460# performance with many hidden rows // hide the columns for( SCCOL nScCol = 0; nScCol <= MAXCOL; ++nScCol ) @@ -355,8 +352,6 @@ void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab ) // #i47438# if default row format is hidden, hide remaining rows if( ::get_flag( mnDefRowFlags, EXC_DEFROW_HIDDEN ) && (mnLastScRow < MAXROW) ) rDoc.ShowRows( mnLastScRow + 1, MAXROW, nScTab, false ); - - rDoc.DecSizeRecalcLevel( nScTab ); // #i116460# performance with many hidden rows } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index b25e4dc9633c..4eae1adfab31 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -245,7 +245,6 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList ) Add( new XclExpUInt16Record( EXC_ID_FNGROUPCOUNT, 14 ) ); // erst Namen- und Tabellen-Eintraege aufbauen - String aName; for( nC = 0 ; nC < nScTabCount ; nC++ ) if( rTabInfo.IsExportTab( nC ) ) diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index c73155be6518..557538e46871 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -824,7 +824,7 @@ const char* GetOperatorString(ScConditionMode eMode, bool& bFrmla2) break; case SC_COND_NONE: default: - pRet = ""; + pRet = "equal"; break; } return pRet; @@ -832,9 +832,69 @@ const char* GetOperatorString(ScConditionMode eMode, bool& bFrmla2) const char* GetTypeString(ScConditionMode eMode) { - if (eMode == SC_COND_DIRECT) - return "expression"; - return "cellIs"; + switch(eMode) + { + case SC_COND_DIRECT: + return "expression"; + case SC_COND_TOP10: + case SC_COND_TOP_PERCENT: + case SC_COND_BOTTOM10: + case SC_COND_BOTTOM_PERCENT: + return "top10"; + case SC_COND_ABOVE_AVERAGE: + case SC_COND_BELOW_AVERAGE: + return "aboveAverage"; + case SC_COND_NOTDUPLICATE: + return "uniqueValues"; + case SC_COND_DUPLICATE: + return "duplicateValues"; + case SC_COND_ERROR: + return "containsErrors"; + case SC_COND_NOERROR: + return "notContainsErrors"; + case SC_COND_BEGINS_WITH: + return "beginsWith"; + case SC_COND_ENDS_WITH: + return "endsWith"; + case SC_COND_CONTAINS_TEXT: + return "containsText"; + case SC_COND_NOT_CONTAINS_TEXT: + return "notContainsText"; + default: + return "cellIs"; + } +} + +bool IsTopBottomRule(ScConditionMode eMode) +{ + switch(eMode) + { + case SC_COND_TOP10: + case SC_COND_BOTTOM10: + case SC_COND_TOP_PERCENT: + case SC_COND_BOTTOM_PERCENT: + return true; + default: + break; + } + + return false; +} + +bool IsTextRule(ScConditionMode eMode) +{ + switch(eMode) + { + case SC_COND_BEGINS_WITH: + case SC_COND_ENDS_WITH: + case SC_COND_CONTAINS_TEXT: + case SC_COND_NOT_CONTAINS_TEXT: + return true; + default: + break; + } + + return false; } } @@ -842,21 +902,53 @@ const char* GetTypeString(ScConditionMode eMode) void XclExpCFImpl::SaveXml( XclExpXmlStream& rStrm ) { bool bFmla2 = false; + ScConditionMode eOperation = mrFormatEntry.GetOperation(); + sal_Int32 nAboveAverage = eOperation == SC_COND_ABOVE_AVERAGE; + sal_Int32 nBottom = eOperation == SC_COND_BOTTOM10 + || eOperation == SC_COND_BOTTOM_PERCENT; + sal_Int32 nPercent = eOperation == SC_COND_TOP_PERCENT || + eOperation == SC_COND_BOTTOM_PERCENT; + rtl::OString aRank("0"); + if(IsTopBottomRule(eOperation)) + { + // position and formula grammar are not important + // we only store a number there + aRank = XclXmlUtils::ToOString(mrFormatEntry.GetExpression(ScAddress(0,0,0), 0)); + } + rtl::OString aText; + if(IsTextRule(eOperation)) + { + // we need to write the text without quotes + // we have to actually get the string from + // the token array for that + ScTokenArray* pTokenArray = mrFormatEntry.CreateTokenArry(0); + if(pTokenArray->GetLen()) + aText = XclXmlUtils::ToOString(pTokenArray->First()->GetString()); + } + sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); rWorksheet->startElement( XML_cfRule, XML_type, GetTypeString( mrFormatEntry.GetOperation() ), XML_priority, OString::valueOf( mnPriority + 1 ).getStr(), XML_operator, GetOperatorString( mrFormatEntry.GetOperation(), bFmla2 ), + XML_aboveAverage, OString::valueOf( nAboveAverage ).getStr(), + XML_bottom, OString::valueOf( nBottom ).getStr(), + XML_percent, OString::valueOf( nPercent ).getStr(), + XML_rank, aRank.getStr(), + XML_text, aText.getStr(), XML_dxfId, OString::valueOf( GetDxfs().GetDxfId( mrFormatEntry.GetStyle() ) ).getStr(), FSEND ); - rWorksheet->startElement( XML_formula, FSEND ); - rWorksheet->write(XclXmlUtils::ToOUString( GetRoot().GetDoc(), mrFormatEntry.GetValidSrcPos(), mrFormatEntry.CreateTokenArry( 0 ) )); - rWorksheet->endElement( XML_formula ); - if (bFmla2) + if(!IsTextRule(eOperation) && !IsTopBottomRule(eOperation)) { rWorksheet->startElement( XML_formula, FSEND ); - rWorksheet->write(XclXmlUtils::ToOUString( GetRoot().GetDoc(), mrFormatEntry.GetValidSrcPos(), mrFormatEntry.CreateTokenArry( 1 ) )); + rWorksheet->write(XclXmlUtils::ToOUString( GetRoot().GetDoc(), mrFormatEntry.GetValidSrcPos(), mrFormatEntry.CreateTokenArry( 0 ) )); rWorksheet->endElement( XML_formula ); + if (bFmla2) + { + rWorksheet->startElement( XML_formula, FSEND ); + rWorksheet->write(XclXmlUtils::ToOUString( GetRoot().GetDoc(), mrFormatEntry.GetValidSrcPos(), mrFormatEntry.CreateTokenArry( 1 ) )); + rWorksheet->endElement( XML_formula ); + } } // OOXTODO: XML_extLst rWorksheet->endElement( XML_cfRule ); @@ -971,7 +1063,7 @@ void XclExpColScaleCol::SaveXml( XclExpXmlStream& rStrm ) // ---------------------------------------------------------------------------- -XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat& rCondFormat, XclExtLstRef xExtLst ) : +XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat& rCondFormat, XclExtLstRef xExtLst, sal_Int32& rIndex ) : XclExpRecord( EXC_ID_CONDFMT ), XclExpRoot( rRoot ) { @@ -983,11 +1075,13 @@ XclExpCondfmt::XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat if( const ScFormatEntry* pFormatEntry = rCondFormat.GetEntry( nIndex ) ) { if(pFormatEntry->GetType() == condformat::CONDITION) - maCFList.AppendNewRecord( new XclExpCF( GetRoot(), static_cast<const ScCondFormatEntry&>(*pFormatEntry), nIndex ) ); + maCFList.AppendNewRecord( new XclExpCF( GetRoot(), static_cast<const ScCondFormatEntry&>(*pFormatEntry), ++rIndex ) ); else if(pFormatEntry->GetType() == condformat::COLORSCALE) - maCFList.AppendNewRecord( new XclExpColorScale( GetRoot(), static_cast<const ScColorScaleFormat&>(*pFormatEntry), nIndex ) ); + maCFList.AppendNewRecord( new XclExpColorScale( GetRoot(), static_cast<const ScColorScaleFormat&>(*pFormatEntry), ++rIndex ) ); else if(pFormatEntry->GetType() == condformat::DATABAR) - maCFList.AppendNewRecord( new XclExpDataBar( GetRoot(), static_cast<const ScDataBarFormat&>(*pFormatEntry), nIndex, xExtLst ) ); + maCFList.AppendNewRecord( new XclExpDataBar( GetRoot(), static_cast<const ScDataBarFormat&>(*pFormatEntry), ++rIndex, xExtLst ) ); + else if(pFormatEntry->GetType() == condformat::ICONSET) + maCFList.AppendNewRecord( new XclExpIconSet( GetRoot(), static_cast<const ScIconSetFormat&>(*pFormatEntry), ++rIndex ) ); } aScRanges.Format( msSeqRef, SCA_VALID, NULL, formula::FormulaGrammar::CONV_XL_A1 ); } @@ -1173,6 +1267,63 @@ void XclExpDataBar::SaveXml( XclExpXmlStream& rStrm ) } +XclExpIconSet::XclExpIconSet( const XclExpRoot& rRoot, const ScIconSetFormat& rFormat, sal_Int32 nPriority ): + XclExpRecord(), + XclExpRoot( rRoot ), + mrFormat( rFormat ), + mnPriority( nPriority ) +{ + const ScRange* pRange = rFormat.GetRange().front(); + ScAddress aAddr = pRange->aStart; + for(ScIconSetFormat::const_iterator itr = rFormat.begin(); + itr != rFormat.end(); ++itr) + { + // exact position is not important, we allow only absolute refs + + XclExpCfvoList::RecordRefType xCfvo( new XclExpCfvo( GetRoot(), *itr, aAddr ) ); + maCfvoList.AppendRecord( xCfvo ); + } +} + +namespace { + +const char* getIconSetName( ScIconSetType eType ) +{ + ScIconSetMap* pMap = ScIconSetFormat::getIconSetMap(); + for(; pMap->pName; ++pMap) + { + if(pMap->eType == eType) + return pMap->pName; + } + + return ""; +} + +} + +void XclExpIconSet::SaveXml( XclExpXmlStream& rStrm ) +{ + sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream(); + + rWorksheet->startElement( XML_cfRule, + XML_type, "iconSet", + XML_priority, OString::valueOf( mnPriority + 1 ).getStr(), + FSEND ); + + const char* pIconSetName = getIconSetName(mrFormat.GetIconSetData()->eIconSetType); + rWorksheet->startElement( XML_iconSet, + XML_iconSet, pIconSetName, + FSEND ); + + maCfvoList.SaveXml( rStrm ); + + rWorksheet->endElement( XML_iconSet ); + rWorksheet->endElement( XML_cfRule ); + + // OOXTODO: XML_extLst + +} + // ---------------------------------------------------------------------------- XclExpCondFormatBuffer::XclExpCondFormatBuffer( const XclExpRoot& rRoot, XclExtLstRef xExtLst ) : @@ -1180,10 +1331,11 @@ XclExpCondFormatBuffer::XclExpCondFormatBuffer( const XclExpRoot& rRoot, XclExtL { if( const ScConditionalFormatList* pCondFmtList = GetDoc().GetCondFormList(GetCurrScTab()) ) { + sal_Int32 nIndex = 0; for( ScConditionalFormatList::const_iterator itr = pCondFmtList->begin(); itr != pCondFmtList->end(); ++itr) { - XclExpCondfmtList::RecordRefType xCondfmtRec( new XclExpCondfmt( GetRoot(), *itr, xExtLst ) ); + XclExpCondfmtList::RecordRefType xCondfmtRec( new XclExpCondfmt( GetRoot(), *itr, xExtLst, nIndex )); if( xCondfmtRec->IsValid() ) maCondfmtList.AppendRecord( xCondfmtRec ); } @@ -1600,7 +1752,7 @@ XclExpWebQuery::XclExpWebQuery( mbEntireDoc = ScfTools::IsHTMLDocName( aToken ); bExitLoop = mbEntireDoc || ScfTools::IsHTMLTablesName( aToken ); if( !bExitLoop && ScfTools::GetHTMLNameFromName( aToken, aAppendTable ) ) - ScGlobal::AddToken( aNewTables, aAppendTable, ',' ); + aNewTables = ScGlobal::addToken( aNewTables, aAppendTable, ',' ); } if( !bExitLoop ) // neither HTML_all nor HTML_tables found diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index 74bc82d532b9..b4e4aafe8c6c 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -1225,7 +1225,7 @@ XclExpNote::XclExpNote( const XclExpRoot& rRoot, const ScAddress& rScPos, mpNoteContents = XclExpStringHelper::CreateString( rRoot, *pEditObj ); } // append additional text - ScGlobal::AddToken( aNoteText, rAddText, '\n', 2 ); + aNoteText = ScGlobal::addToken( aNoteText, rAddText, '\n', 2 ); maOrigNoteText = aNoteText; // initialize record dependent on BIFF type diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index b2a68d467265..581c6142c9dd 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -320,7 +320,7 @@ rtl::OUString XclExpHyperlinkHelper::ProcessUrlField( const SvxURLField& rUrlFie aUrlRepr = *pRepr; // add URL to note text - ScGlobal::AddToken( maUrlList, rUrlField.GetURL(), '\n' ); + maUrlList = ScGlobal::addToken( maUrlList, rUrlField.GetURL(), '\n' ); } // no hyperlink representation from Excel HLINK record -> use it from text field @@ -879,7 +879,7 @@ void XclExpHFConverter::AppendPortion( const EditTextObject* pTextObj, sal_Unico aSel.nStartPos = aSel.nEndPos; } - ScGlobal::AddToken( aText, aParaText, '\n' ); + aText = ScGlobal::addToken( aText, aParaText, '\n' ); if( nParaHeight == 0 ) nParaHeight = aFontData.mnHeight * 20; // points -> twips nHeight += nParaHeight; diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index ac0bef940619..85e36e53dfad 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -547,7 +547,7 @@ void XclExpPCField::InsertNumDateGroupItems( const ScDPObject& rDPObj, const ScD if (!pCache) return; - ScSheetDPData aDPData(GetDocPtr(), *pSrcDesc, pCache); + ScSheetDPData aDPData(GetDocPtr(), *pSrcDesc, *pCache); long nDim = GetFieldIndex(); const std::vector< SCROW > aOrignial = aDPData.GetColumnEntries(nDim); // get the string collection with generated grouping elements diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 5a9d19a32cce..31bcafa1c069 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -756,7 +756,7 @@ rtl::OUString XclXmlUtils::GetStreamName( const char* sStreamDir, const char* sS OString XclXmlUtils::ToOString( const Color& rColor ) { char buf[9]; - sprintf( buf, "%.2X%.2X%.2X%.2X", rColor.GetTransparency(), rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue() ); + sprintf( buf, "%.2X%.2X%.2X%.2X", 0xFF-rColor.GetTransparency(), rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue() ); buf[8] = '\0'; return OString( buf ); } diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 339dd10df17b..d99c9fdcc8a3 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -3059,8 +3059,8 @@ void XclExpXmlStyleSheet::SaveXml( XclExpXmlStream& rStrm ) CreateRecord( EXC_ID_FORMATLIST )->SaveXml( rStrm ); CreateRecord( EXC_ID_FONTLIST )->SaveXml( rStrm ); CreateRecord( EXC_ID_XFLIST )->SaveXml( rStrm ); - CreateRecord( EXC_ID_PALETTE )->SaveXml( rStrm ); CreateRecord( EXC_ID_DXFS )->SaveXml( rStrm ); + CreateRecord( EXC_ID_PALETTE )->SaveXml( rStrm ); aStyleSheet->endElement( XML_styleSheet ); diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index bebb239e9289..04458d18e404 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2329,7 +2329,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : mxHyperlinkList->AppendRecord( aLinkHelper.GetLinkRecord() ); // add list of multiple URLs to the additional cell note text if( aLinkHelper.HasMultipleUrls() ) - ScGlobal::AddToken( aAddNoteText, aLinkHelper.GetUrlList(), '\n', 2 ); + aAddNoteText = ScGlobal::addToken( aAddNoteText, aLinkHelper.GetUrlList(), '\n', 2 ); } break; diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index c5f6dad50a6a..edd47173f524 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -947,12 +947,12 @@ void XclImpWebQuery::ReadWqtables( XclImpStream& rStrm ) String aToken( ScStringUtil::GetQuotedToken( aTables, 0, aQuotedPairs, ',', nStringIx ) ); sal_Int32 nTabNum = CharClass::isAsciiNumeric( aToken ) ? aToken.ToInt32() : 0; if( nTabNum > 0 ) - ScGlobal::AddToken( maTables, ScfTools::GetNameFromHTMLIndex( static_cast< sal_uInt32 >( nTabNum ) ), cSep ); + maTables = ScGlobal::addToken( maTables, ScfTools::GetNameFromHTMLIndex( static_cast< sal_uInt32 >( nTabNum ) ), cSep ); else { ScGlobal::EraseQuotes( aToken, '"', false ); if( aToken.Len() ) - ScGlobal::AddToken( maTables, ScfTools::GetNameFromHTMLName( aToken ), cSep ); + maTables = ScGlobal::addToken( maTables, ScfTools::GetNameFromHTMLName( aToken ), cSep ); } } } diff --git a/sc/source/filter/excel/xltoolbar.cxx b/sc/source/filter/excel/xltoolbar.cxx index f582ab89a300..2bb994e379fb 100644 --- a/sc/source/filter/excel/xltoolbar.cxx +++ b/sc/source/filter/excel/xltoolbar.cxx @@ -94,10 +94,6 @@ CTBS::CTBS() : bSignature(0), bVersion(0), reserved1(0), reserved2(0), reserved3 { } -ScCTB::ScCTB() : nViews( 0 ), ectbid(0) -{ -} - ScCTB::ScCTB(sal_uInt16 nNum ) : nViews( nNum ), ectbid(0) { } diff --git a/sc/source/filter/excel/xltoolbar.hxx b/sc/source/filter/excel/xltoolbar.hxx index cc9794331bd9..ed598d5311fa 100644 --- a/sc/source/filter/excel/xltoolbar.hxx +++ b/sc/source/filter/excel/xltoolbar.hxx @@ -74,7 +74,6 @@ class ScCTB : public TBBase std::vector< ScTBC > rTBC; bool ImportCustomToolBar_Impl( ScCTBWrapper&, CustomToolBarImportHelper& ); public: - ScCTB(); ScCTB(sal_uInt16); ~ScCTB(){} void Print( FILE* ); diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx index b75b1cc351b1..facda67aa573 100644 --- a/sc/source/filter/html/htmlimp.cxx +++ b/sc/source/filter/html/htmlimp.cxx @@ -238,7 +238,7 @@ String ScHTMLImport::GetHTMLRangeNameList( ScDocument* pDoc, const String& rOrig ScRange aRange; if( pRangeData->IsReference( aRange ) && !aRangeList.In( aRange ) ) { - ScGlobal::AddToken( aNewName, aToken, ';' ); + aNewName = ScGlobal::addToken(aNewName, aToken, ';'); aRangeList.Append( aRange ); } } @@ -247,7 +247,7 @@ String ScHTMLImport::GetHTMLRangeNameList( ScDocument* pDoc, const String& rOrig } } else - ScGlobal::AddToken( aNewName, aToken, ';' ); + aNewName = ScGlobal::addToken(aNewName, aToken, ';'); } return aNewName; } diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 7b412f3ddb21..d5ad5e7f3326 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -3082,7 +3082,7 @@ void ScHTMLQueryParser::FontOn( const ImportInfo& rInfo ) { // font list separator: VCL = ';' HTML = ',' String aFName = comphelper::string::strip(rFace.GetToken(0, ',', nPos), ' '); - ScGlobal::AddToken( aFontName, aFName, ';' ); + aFontName = ScGlobal::addToken(aFontName, aFName, ';'); } if ( aFontName.Len() ) mpCurrTable->PutItem( SvxFontItem( FAMILY_DONTKNOW, diff --git a/sc/source/filter/inc/condformatbuffer.hxx b/sc/source/filter/inc/condformatbuffer.hxx index 91521c6e83d6..568f09db4a4c 100644 --- a/sc/source/filter/inc/condformatbuffer.hxx +++ b/sc/source/filter/inc/condformatbuffer.hxx @@ -42,6 +42,8 @@ class ScColorScaleFormat; class ScDataBarFormat; struct ScDataBarFormatData; class ScConditionalFormat; +class ScIconSetFormat; +struct ScIconSetFormatData; namespace oox { namespace xls { @@ -135,6 +137,21 @@ private: boost::scoped_ptr<ColorScaleRuleModelEntry> mpLowerLimit; }; +class IconSetRule : public WorksheetHelper +{ +public: + IconSetRule( const CondFormat& rFormat ); + void importCfvo( const AttributeList& rAttribs ); + void importAttribs( const AttributeList& rAttribs ); + + void SetData( ScIconSetFormat* pFormat, ScDocument* pDoc, const ScAddress& rAddr ); + +private: + std::vector< ColorScaleRuleModelEntry > maEntries; + ScIconSetFormatData* mpFormatData; + rtl::OUString maIconSetType; +}; + // ============================================================================ @@ -161,6 +178,7 @@ public: ColorScaleRule* getColorScale(); DataBarRule* getDataBar(); + IconSetRule* getIconSet(); private: const CondFormat& mrCondFormat; @@ -168,6 +186,7 @@ private: ScConditionalFormat* mpFormat; boost::scoped_ptr<ColorScaleRule> mpColor; boost::scoped_ptr<DataBarRule> mpDataBar; + boost::scoped_ptr<IconSetRule> mpIconSet; }; typedef ::boost::shared_ptr< CondFormatRule > CondFormatRuleRef; @@ -235,6 +254,7 @@ public: /** Converts an OOXML condition operator token to the API constant. */ static sal_Int32 convertToApiOperator( sal_Int32 nToken ); + static sal_Int32 convertToInternalOperator( sal_Int32 nToken ); private: CondFormatRef createCondFormat(); diff --git a/sc/source/filter/inc/condformatcontext.hxx b/sc/source/filter/inc/condformatcontext.hxx index f5ebd8cad7ad..1078dce22de2 100644 --- a/sc/source/filter/inc/condformatcontext.hxx +++ b/sc/source/filter/inc/condformatcontext.hxx @@ -63,6 +63,17 @@ private: CondFormatRuleRef mxRule; }; +class IconSetContext : public WorksheetContextBase +{ +public: + explicit IconSetContext( CondFormatContext& rFormat, CondFormatRuleRef xRule ); + + virtual oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ); + virtual void onStartElement( const AttributeList& rAttribs ); +private: + CondFormatRuleRef mxRule; +}; + class CondFormatContext : public WorksheetContextBase { public: diff --git a/sc/source/filter/inc/xecontent.hxx b/sc/source/filter/inc/xecontent.hxx index 9417ab28b66b..7e94df92c52b 100644 --- a/sc/source/filter/inc/xecontent.hxx +++ b/sc/source/filter/inc/xecontent.hxx @@ -224,7 +224,7 @@ class ScConditionalFormat; class XclExpCondfmt : public XclExpRecord, protected XclExpRoot { public: - explicit XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat& rCondFormat, XclExtLstRef xExtLst ); + explicit XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat& rCondFormat, XclExtLstRef xExtLst, sal_Int32& rIndex ); virtual ~XclExpCondfmt(); /** Returns true, if this conditional format contains at least one cell range and CF record. */ @@ -277,6 +277,20 @@ private: rtl::OString maGuid; }; +class XclExpIconSet : public XclExpRecord, protected XclExpRoot +{ +public: + explicit XclExpIconSet( const XclExpRoot& rRoot, const ScIconSetFormat& rFormat, sal_Int32 nPriority ); + + virtual void SaveXml( XclExpXmlStream& rStrm ); +private: + typedef XclExpRecordList< XclExpCfvo > XclExpCfvoList; + + XclExpCfvoList maCfvoList; + const ScIconSetFormat& mrFormat; + sal_Int32 mnPriority; +}; + // ---------------------------------------------------------------------------- /** Contains all conditional formats of a specific sheet. */ diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx index 75fc18aa62fc..7840be18e145 100644 --- a/sc/source/filter/oox/condformatbuffer.cxx +++ b/sc/source/filter/oox/condformatbuffer.cxx @@ -141,50 +141,58 @@ void lclAppendProperty( ::std::vector< PropertyValue >& orProps, const OUString& orProps.back().Value <<= rValue; } -} // namespace +//------------------------------------------------------------------------------ -ColorScaleRule::ColorScaleRule( const CondFormat& rFormat ): - WorksheetHelper( rFormat ), - mnCfvo(0), - mnCol(0) +void SetCfvoData( ColorScaleRuleModelEntry* pEntry, const AttributeList& rAttribs ) { -} - -void ColorScaleRule::importCfvo( const AttributeList& rAttribs ) -{ - if(mnCfvo >= maColorScaleRuleEntries.size()) - maColorScaleRuleEntries.push_back(ColorScaleRuleModelEntry()); - rtl::OUString aType = rAttribs.getString( XML_type, rtl::OUString() ); double nVal = rAttribs.getDouble( XML_val, 0.0 ); - maColorScaleRuleEntries[mnCfvo].mnVal = nVal; + pEntry->mnVal = nVal; if (aType == "num") { // nothing to do } else if( aType == "min" ) { - maColorScaleRuleEntries[mnCfvo].mbMin = true; + pEntry->mbMin = true; } else if( aType == "max" ) { - maColorScaleRuleEntries[mnCfvo].mbMax = true; + pEntry->mbMax = true; } else if( aType == "percent" ) { - maColorScaleRuleEntries[mnCfvo].mbPercent = true; + pEntry->mbPercent = true; } else if( aType == "percentile" ) { - maColorScaleRuleEntries[mnCfvo].mbPercentile = true; + pEntry->mbPercentile = true; } else if( aType == "formula" ) { rtl::OUString aFormula = rAttribs.getString( XML_val, rtl::OUString() ); - maColorScaleRuleEntries[mnCfvo].maFormula = aFormula; + pEntry->maFormula = aFormula; } +} + +} + +ColorScaleRule::ColorScaleRule( const CondFormat& rFormat ): + WorksheetHelper( rFormat ), + mnCfvo(0), + mnCol(0) +{ +} + +void ColorScaleRule::importCfvo( const AttributeList& rAttribs ) +{ + if(mnCfvo >= maColorScaleRuleEntries.size()) + maColorScaleRuleEntries.push_back(ColorScaleRuleModelEntry()); + + SetCfvoData( &maColorScaleRuleEntries[mnCfvo], rAttribs ); + ++mnCfvo; } @@ -260,7 +268,7 @@ void ColorScaleRule::AddEntries( ScColorScaleFormat* pFormat, ScDocument* pDoc, } // ============================================================================ -// + DataBarRule::DataBarRule( const CondFormat& rFormat ): WorksheetHelper( rFormat ), mpFormat(new ScDataBarFormatData) @@ -297,35 +305,8 @@ void DataBarRule::importCfvo( const AttributeList& rAttribs ) mpUpperLimit.reset(new ColorScaleRuleModelEntry); pEntry = mpUpperLimit.get(); } - rtl::OUString aType = rAttribs.getString( XML_type, rtl::OUString() ); - double nVal = rAttribs.getDouble( XML_val, 0.0 ); - pEntry->mnVal = nVal; - if (aType == "num") - { - // nothing to do - } - else if( aType == "min" ) - { - pEntry->mbMin = true; - } - else if( aType == "max" ) - { - pEntry->mbMax = true; - } - else if( aType == "percent" ) - { - pEntry->mbPercent = true; - } - else if( aType == "percentile" ) - { - pEntry->mbPercentile = true; - } - else if( aType == "formula" ) - { - rtl::OUString aFormula = rAttribs.getString( XML_val, rtl::OUString() ); - pEntry->maFormula = aFormula; - } + SetCfvoData( pEntry, rAttribs ); } void DataBarRule::importAttribs( const AttributeList& rAttribs ) @@ -345,6 +326,49 @@ void DataBarRule::SetData( ScDataBarFormat* pFormat, ScDocument* pDoc, const ScA // ============================================================================ +IconSetRule::IconSetRule( const CondFormat& rFormat ): + WorksheetHelper( rFormat ), + mpFormatData( new ScIconSetFormatData ) +{ +} + +void IconSetRule::importCfvo( const AttributeList& rAttribs ) +{ + ColorScaleRuleModelEntry aNewEntry; + SetCfvoData(&aNewEntry, rAttribs); + + maEntries.push_back(aNewEntry); +} + +void IconSetRule::importAttribs( const AttributeList& rAttribs ) +{ + maIconSetType = rAttribs.getString( XML_iconSet, rtl::OUString("3TrafficLights1") ); +} + +void IconSetRule::SetData( ScIconSetFormat* pFormat, ScDocument* pDoc, const ScAddress& rPos ) +{ + for(size_t i = 0; i < maEntries.size(); ++i) + { + ScColorScaleEntry* pModelEntry = ConvertToModel( maEntries[i], pDoc, rPos ); + mpFormatData->maEntries.push_back(pModelEntry); + } + + ScIconSetType eIconSetType = IconSet_3TrafficLights1; + ScIconSetMap* pIconSetMap = ScIconSetFormat::getIconSetMap(); + for(size_t i = 0; pIconSetMap[i].pName; ++i) + { + if(rtl::OUString::createFromAscii(pIconSetMap[i].pName) == maIconSetType) + { + eIconSetType = pIconSetMap[i].eType; + break; + } + } + mpFormatData->eIconSetType = eIconSetType; + pFormat->SetIconSetData(mpFormatData); +} + +// ============================================================================ + CondFormatRuleModel::CondFormatRuleModel() : mnPriority( -1 ), mnType( XML_TOKEN_INVALID ), @@ -615,7 +639,7 @@ void CondFormatRule::importCfRule( SequenceInputStream& rStrm ) void CondFormatRule::finalizeImport() { - sal_Int32 eOperator = ::com::sun::star::sheet::ConditionOperator2::NONE; + ScConditionMode eOperator = SC_COND_NONE; /* Replacement formula for unsupported rule types (text comparison rules, time period rules, cell type rules). The replacement formulas below may @@ -639,31 +663,33 @@ void CondFormatRule::finalizeImport() switch( maModel.mnType ) { case XML_cellIs: - eOperator = CondFormatBuffer::convertToApiOperator( maModel.mnOperator ); + eOperator = static_cast<ScConditionMode>(CondFormatBuffer::convertToInternalOperator( maModel.mnOperator )); break; case XML_duplicateValues: - eOperator = CondFormatBuffer::convertToApiOperator( XML_duplicateValues ); - aReplaceFormula = " "; + eOperator = SC_COND_DUPLICATE; + break; + case XML_uniqueValues: + eOperator = SC_COND_NOTDUPLICATE; break; case XML_expression: - eOperator = ::com::sun::star::sheet::ConditionOperator2::FORMULA; + eOperator = SC_COND_DIRECT; break; case XML_containsText: OSL_ENSURE( maModel.mnOperator == XML_containsText, "CondFormatRule::finalizeImport - unexpected operator" ); - aReplaceFormula = "NOT(ISERROR(SEARCH(#T,#B)))"; + eOperator = SC_COND_CONTAINS_TEXT; break; case XML_notContainsText: // note: type XML_notContainsText vs. operator XML_notContains OSL_ENSURE( maModel.mnOperator == XML_notContains, "CondFormatRule::finalizeImport - unexpected operator" ); - aReplaceFormula = "ISERROR(SEARCH(#T,#B))"; + eOperator = SC_COND_NOT_CONTAINS_TEXT; break; case XML_beginsWith: OSL_ENSURE( maModel.mnOperator == XML_beginsWith, "CondFormatRule::finalizeImport - unexpected operator" ); - aReplaceFormula = "LEFT(#B,#L)=#T"; + eOperator = SC_COND_BEGINS_WITH; break; case XML_endsWith: OSL_ENSURE( maModel.mnOperator == XML_endsWith, "CondFormatRule::finalizeImport - unexpected operator" ); - aReplaceFormula = "RIGHT(#B,#L)=#T"; + eOperator = SC_COND_ENDS_WITH; break; case XML_timePeriod: switch( maModel.mnTimePeriod ) @@ -709,20 +735,32 @@ void CondFormatRule::finalizeImport() aReplaceFormula = "LEN(TRIM(#B))>0"; break; case XML_containsErrors: - aReplaceFormula = "ISERROR(#B)"; + eOperator = SC_COND_ERROR; break; case XML_notContainsErrors: - aReplaceFormula = "NOT(ISERROR(#B))"; + eOperator = SC_COND_NOERROR; break; case XML_top10: - if( maModel.mbPercent ) - aReplaceFormula = "RANK(#B,#R,#M)/COUNT(#R)<=#K%"; + if(maModel.mbPercent) + { + if(maModel.mbBottom) + eOperator = SC_COND_BOTTOM_PERCENT; + else + eOperator = SC_COND_TOP_PERCENT; + } else - aReplaceFormula = "RANK(#B,#R,#M)<=#K"; + { + if(maModel.mbBottom) + eOperator = SC_COND_BOTTOM10; + else + eOperator = SC_COND_TOP10; + } break; case XML_aboveAverage: - if( maModel.mnStdDev == 0 ) - aReplaceFormula = "#B#CAVERAGE(#R)"; + if(maModel.mbAboveAverage) + eOperator = SC_COND_ABOVE_AVERAGE; + else + eOperator = SC_COND_BELOW_AVERAGE; break; case XML_colorScale: break; @@ -741,36 +779,6 @@ void CondFormatRule::finalizeImport() aAddress = FormulaProcessorBase::generateAddress2dString( mrCondFormat.getRanges().getBaseAddress(), false ); aReplaceFormula = aReplaceFormula.replaceAt( nStrPos, 2, aAddress ); break; - case 'R': // range list of conditional formatting - if( aRanges.isEmpty() ) - aRanges = FormulaProcessorBase::generateRangeList2dString( mrCondFormat.getRanges(), true, ',', true ); - aReplaceFormula = aReplaceFormula.replaceAt( nStrPos, 2, aRanges ); - break; - case 'T': // comparison text - if( aText.isEmpty() ) - // quote the comparison text, and handle embedded quote characters - aText = FormulaProcessorBase::generateApiString( maModel.maText ); - aReplaceFormula = aReplaceFormula.replaceAt( nStrPos, 2, aText ); - break; - case 'L': // length of comparison text - aReplaceFormula = aReplaceFormula.replaceAt( nStrPos, 2, - OUString::valueOf( maModel.maText.getLength() ) ); - break; - case 'K': // top-10 rank - aReplaceFormula = aReplaceFormula.replaceAt( nStrPos, 2, - OUString::valueOf( maModel.mnRank ) ); - break; - case 'M': // top-10 top/bottom flag - aReplaceFormula = aReplaceFormula.replaceAt( nStrPos, 2, - OUString::valueOf( static_cast< sal_Int32 >( maModel.mbBottom ? 1 : 0 ) ) ); - break; - case 'C': // average comparison operator - if( aComp.isEmpty() ) - aComp = maModel.mbAboveAverage ? - (maModel.mbEqualAverage ? OUString( ">=" ) : OUString( ">" ) ) : - (maModel.mbEqualAverage ? OUString( "<=" ) : OUString( "<" ) ); - aReplaceFormula = aReplaceFormula.replaceAt( nStrPos, 2, aComp ); - break; default: OSL_FAIL( "CondFormatRule::finalizeImport - unknown placeholder" ); } @@ -779,14 +787,31 @@ void CondFormatRule::finalizeImport() // set the replacement formula maModel.maFormulas.clear(); appendFormula( aReplaceFormula ); - if( eOperator != ::com::sun::star::sheet::ConditionOperator2::DUPLICATE ) - eOperator = ::com::sun::star::sheet::ConditionOperator2::FORMULA; + eOperator = SC_COND_DIRECT; } CellAddress aBaseAddr = mrCondFormat.getRanges().getBaseAddress(); ScAddress aPos; ScUnoConversion::FillScAddress( aPos, aBaseAddr ); - if( (eOperator != ::com::sun::star::sheet::ConditionOperator2::NONE) && !maModel.maFormulas.empty() ) + + if( eOperator == SC_COND_ERROR || eOperator == SC_COND_NOERROR ) + { + ScDocument& rDoc = getScDocument(); + OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId ); + ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, NULL, NULL, &rDoc, aPos, aStyleName ); + mpFormat->AddEntry(pNewEntry); + } + else if( eOperator == SC_COND_BEGINS_WITH || eOperator == SC_COND_ENDS_WITH || + eOperator == SC_COND_CONTAINS_TEXT || eOperator == SC_COND_NOT_CONTAINS_TEXT ) + { + ScDocument& rDoc = getScDocument(); + ScTokenArray aTokenArray; + aTokenArray.AddString(maModel.maText); + OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId ); + ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, &aTokenArray, NULL, &rDoc, aPos, aStyleName ); + mpFormat->AddEntry(pNewEntry); + } + else if( (eOperator != SC_COND_NONE) && !maModel.maFormulas.empty() ) { ScDocument& rDoc = getScDocument(); boost::scoped_ptr<ScTokenArray> pTokenArray2; @@ -799,10 +824,38 @@ void CondFormatRule::finalizeImport() ScTokenArray aTokenArray; OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId ); ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, maModel.maFormulas[ 0 ] ); - ScCondFormatEntry* pNewEntry = new ScCondFormatEntry(ScCondFormatEntry::GetModeFromApi(eOperator), + ScCondFormatEntry* pNewEntry = new ScCondFormatEntry(eOperator, &aTokenArray, pTokenArray2.get(), &rDoc, aPos, aStyleName); mpFormat->AddEntry(pNewEntry); } + else if ( eOperator == SC_COND_TOP10 || eOperator == SC_COND_BOTTOM10 || + eOperator == SC_COND_TOP_PERCENT || eOperator == SC_COND_BOTTOM_PERCENT ) + { + ScDocument& rDoc = getScDocument(); + ScTokenArray aTokenArray; + aTokenArray.AddDouble( maModel.mnRank ); + OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId ); + ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, &aTokenArray, NULL, &rDoc, aPos, aStyleName ); + mpFormat->AddEntry(pNewEntry); + } + else if( eOperator == SC_COND_ABOVE_AVERAGE || eOperator == SC_COND_BELOW_AVERAGE ) + { + ScDocument& rDoc = getScDocument(); + ScTokenArray aTokenArrayEqual; + aTokenArrayEqual.AddDouble( maModel.mbEqualAverage ); + ScTokenArray aTokenArrayDev; + aTokenArrayDev.AddDouble( maModel.mnStdDev ); + OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId ); + ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, &aTokenArrayEqual, &aTokenArrayDev, &rDoc, aPos, aStyleName ); + mpFormat->AddEntry(pNewEntry); + } + else if( eOperator == SC_COND_DUPLICATE || eOperator == SC_COND_NOTDUPLICATE ) + { + ScDocument& rDoc = getScDocument(); + OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId ); + ScCondFormatEntry* pNewEntry = new ScCondFormatEntry( eOperator, NULL, NULL, &rDoc, aPos, aStyleName ); + mpFormat->AddEntry(pNewEntry); + } else if( mpColor ) { ScDocument& rDoc = getScDocument(); @@ -821,6 +874,14 @@ void CondFormatRule::finalizeImport() mpDataBar->SetData( pFormatEntry, &rDoc, aPos ); } + else if(mpIconSet) + { + ScDocument& rDoc = getScDocument(); + ScIconSetFormat* pFormatEntry = new ScIconSetFormat(&rDoc); + + mpFormat->AddEntry(pFormatEntry); + mpIconSet->SetData( pFormatEntry, &rDoc, aPos ); + } } ColorScaleRule* CondFormatRule::getColorScale() @@ -839,6 +900,14 @@ DataBarRule* CondFormatRule::getDataBar() return mpDataBar.get(); } +IconSetRule* CondFormatRule::getIconSet() +{ + if(!mpIconSet) + mpIconSet.reset( new IconSetRule(mrCondFormat) ); + + return mpIconSet.get(); +} + // ============================================================================ CondFormatModel::CondFormatModel() : @@ -955,6 +1024,24 @@ sal_Int32 CondFormatBuffer::convertToApiOperator( sal_Int32 nToken ) return ConditionOperator2::NONE; } +sal_Int32 CondFormatBuffer::convertToInternalOperator( sal_Int32 nToken ) +{ + switch( nToken ) + { + case XML_between: return SC_COND_BETWEEN; + case XML_equal: return SC_COND_EQUAL; + case XML_greaterThan: return SC_COND_GREATER; + case XML_greaterThanOrEqual: return SC_COND_EQGREATER; + case XML_lessThan: return SC_COND_LESS; + case XML_lessThanOrEqual: return SC_COND_EQLESS; + case XML_notBetween: return SC_COND_NOTBETWEEN; + case XML_notEqual: return SC_COND_NOTEQUAL; + case XML_duplicateValues: return SC_COND_DUPLICATE; + case XML_uniqueValues: return SC_COND_NOTDUPLICATE; + } + return ConditionOperator2::NONE; +} + // private -------------------------------------------------------------------- CondFormatRef CondFormatBuffer::createCondFormat() diff --git a/sc/source/filter/oox/condformatcontext.cxx b/sc/source/filter/oox/condformatcontext.cxx index 85f4da51223d..cef08e135a79 100644 --- a/sc/source/filter/oox/condformatcontext.cxx +++ b/sc/source/filter/oox/condformatcontext.cxx @@ -88,7 +88,7 @@ ContextHandlerRef DataBarContext::onCreateContext( sal_Int32 nElement, const Att switch( getCurrentElement() ) { case XLS_TOKEN( cfRule ): - return (nElement == XLS_TOKEN( colorScale )) ? this : 0; + return (nElement == XLS_TOKEN( dataBar )) ? this : 0; case XLS_TOKEN( dataBar ): if (nElement == XLS_TOKEN( cfvo )) return this; @@ -118,6 +118,42 @@ void DataBarContext::onStartElement( const AttributeList& rAttribs ) // ============================================================================ +IconSetContext::IconSetContext( CondFormatContext& rFragment, CondFormatRuleRef xRule ) : + WorksheetContextBase( rFragment ), + mxRule( xRule ) +{ +} + +ContextHandlerRef IconSetContext::onCreateContext( sal_Int32 nElement, const AttributeList& ) +{ + switch( getCurrentElement() ) + { + case XLS_TOKEN( cfRule ): + return (nElement == XLS_TOKEN( iconSet )) ? this : 0; + case XLS_TOKEN( iconSet ): + if (nElement == XLS_TOKEN( cfvo )) + return this; + else + return 0; + } + return 0; +} + +void IconSetContext::onStartElement( const AttributeList& rAttribs ) +{ + switch( getCurrentElement() ) + { + case XLS_TOKEN( iconSet ): + mxRule->getIconSet()->importAttribs( rAttribs ); + break; + case XLS_TOKEN( cfvo ): + mxRule->getIconSet()->importCfvo( rAttribs ); + break; + } +} + +// ============================================================================ + CondFormatContext::CondFormatContext( WorksheetFragmentBase& rFragment ) : WorksheetContextBase( rFragment ) { @@ -136,6 +172,8 @@ ContextHandlerRef CondFormatContext::onCreateContext( sal_Int32 nElement, const return new ColorScaleContext( *this, mxRule ); else if (nElement == XLS_TOKEN( dataBar ) ) return new DataBarContext( *this, mxRule ); + else if (nElement == XLS_TOKEN( iconSet ) ) + return new IconSetContext( *this, mxRule ); else if (nElement == XLS_TOKEN( extLst ) ) return new ExtLstLocalContext( *this, mxRule->getDataBar()->getDataBarFormatData() ); else diff --git a/sc/source/filter/oox/numberformatsbuffer.cxx b/sc/source/filter/oox/numberformatsbuffer.cxx index dc7162f50f41..e9a242de4f5a 100644 --- a/sc/source/filter/oox/numberformatsbuffer.cxx +++ b/sc/source/filter/oox/numberformatsbuffer.cxx @@ -1960,8 +1960,9 @@ void NumberFormat::writeToPropertyMap( PropertyMap& rPropMap ) const // ============================================================================ -NumberFormatsBuffer::NumberFormatsBuffer( const WorkbookHelper& rHelper ) : - WorkbookHelper( rHelper ) +NumberFormatsBuffer::NumberFormatsBuffer( const WorkbookHelper& rHelper ) + : WorkbookHelper(rHelper) + , mnHighestId(0) { // get the current locale // try user-defined locale setting diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx index 32da418570c6..3fec8889bc03 100644 --- a/sc/source/filter/oox/worksheethelper.cxx +++ b/sc/source/filter/oox/worksheethelper.cxx @@ -1543,7 +1543,14 @@ void WorksheetHelper::putString( const CellAddress& rAddress, const OUString& rT { ScAddress aAddress; ScUnoConversion::FillScAddress( aAddress, rAddress ); - getScDocument().SetString( aAddress.Col(), aAddress.Row(), aAddress.Tab(), rText ); + ScBaseCell* pNewCell = NULL; + ScDocument& rDoc = getScDocument(); + if ( !rText.isEmpty() ) + pNewCell = ScBaseCell::CreateTextCell( rText, &rDoc ); + if ( pNewCell ) + rDoc.PutCell( aAddress, pNewCell ); + else + rDoc.SetString( aAddress.Col(), aAddress.Row(), aAddress.Tab(), rText ); } void WorksheetHelper::putRichString( const CellAddress& rAddress, const RichString& rString, const Font* pFirstPortionFont ) const diff --git a/sc/source/filter/xml/xmlcondformat.cxx b/sc/source/filter/xml/xmlcondformat.cxx index 9733bd28e9a1..5c9bbe430d5c 100644 --- a/sc/source/filter/xml/xmlcondformat.cxx +++ b/sc/source/filter/xml/xmlcondformat.cxx @@ -65,10 +65,6 @@ SvXMLImportContext* ScXMLConditionalFormatsContext::CreateChildContext( sal_uInt return pContext; } -void ScXMLConditionalFormatsContext::EndElement() -{ -} - ScXMLConditionalFormatContext::ScXMLConditionalFormatContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList): SvXMLImportContext( rImport, nPrfx, rLName ) @@ -121,6 +117,9 @@ SvXMLImportContext* ScXMLConditionalFormatContext::CreateChildContext( sal_uInt1 case XML_TOK_CONDFORMAT_DATABAR: pContext = new ScXMLDataBarFormatContext( GetScImport(), nPrefix, rLocalName, xAttrList, mpFormat ); break; + case XML_TOK_CONDFORMAT_ICONSET: + pContext = new ScXMLIconSetFormatContext( GetScImport(), nPrefix, rLocalName, xAttrList, mpFormat ); + break; default: break; } @@ -168,11 +167,6 @@ SvXMLImportContext* ScXMLColorScaleFormatContext::CreateChildContext( sal_uInt16 return pContext; } -void ScXMLColorScaleFormatContext::EndElement() -{ - -} - ScXMLDataBarFormatContext::ScXMLDataBarFormatContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList, ScConditionalFormat* pFormat): @@ -271,14 +265,26 @@ SvXMLImportContext* ScXMLDataBarFormatContext::CreateChildContext( sal_uInt16 nP const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) { - const SvXMLTokenMap& rTokenMap = GetScImport().GetDataBarTokenMap(); + const SvXMLTokenMap& rTokenMap = GetScImport().GetFormattingTokenMap(); sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName); SvXMLImportContext* pContext = NULL; switch (nToken) { + case XML_TOK_FORMATTING_ENTRY: case XML_TOK_DATABAR_DATABARENTRY: - pContext = new ScXMLDataBarFormatEntryContext( GetScImport(), nPrefix, rLocalName, xAttrList, mpFormatData ); - break; + { + ScColorScaleEntry* pEntry(0); + pContext = new ScXMLFormattingEntryContext( GetScImport(), nPrefix, rLocalName, xAttrList, pEntry ); + if(mpFormatData->mpLowerLimit) + { + mpFormatData->mpUpperLimit.reset(pEntry); + } + else + { + mpFormatData->mpLowerLimit.reset(pEntry); + } + } + break; default: break; } @@ -286,8 +292,77 @@ SvXMLImportContext* ScXMLDataBarFormatContext::CreateChildContext( sal_uInt16 nP return pContext; } -void ScXMLDataBarFormatContext::EndElement() +ScXMLIconSetFormatContext::ScXMLIconSetFormatContext(ScXMLImport& rImport, sal_uInt16 nPrfx, + const ::rtl::OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + ScConditionalFormat* pFormat): + SvXMLImportContext( rImport, nPrfx, rLName ) { + rtl::OUString aIconSetType; + sal_Int16 nAttrCount(xAttrList.is() ? xAttrList->getLength() : 0); + const SvXMLTokenMap& rAttrTokenMap = GetScImport().GetIconSetAttrMap(); + for( sal_Int16 i=0; i < nAttrCount; ++i ) + { + const rtl::OUString& sAttrName(xAttrList->getNameByIndex( i )); + rtl::OUString aLocalName; + sal_uInt16 nPrefix(GetScImport().GetNamespaceMap().GetKeyByAttrName( + sAttrName, &aLocalName )); + const rtl::OUString& sValue(xAttrList->getValueByIndex( i )); + + switch( rAttrTokenMap.Get( nPrefix, aLocalName ) ) + { + case XML_TOK_ICONSET_TYPE: + aIconSetType = sValue; + break; + default: + break; + } + } + + ScIconSetMap* pMap = ScIconSetFormat::getIconSetMap(); + ScIconSetType eType = IconSet_3Arrows; + for(; pMap->pName; ++pMap) + { + rtl::OUString aName = rtl::OUString::createFromAscii(pMap->pName); + if(aName ==aIconSetType) + { + eType = pMap->eType; + break; + } + } + + ScIconSetFormat* pIconSetFormat = new ScIconSetFormat(GetScImport().GetDocument()); + ScIconSetFormatData* pIconSetFormatData = new ScIconSetFormatData; + pIconSetFormatData->eIconSetType = eType; + pIconSetFormat->SetIconSetData(pIconSetFormatData); + pFormat->AddEntry(pIconSetFormat); + + mpFormatData = pIconSetFormatData; +} + +SvXMLImportContext* ScXMLIconSetFormatContext::CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ) +{ + const SvXMLTokenMap& rTokenMap = GetScImport().GetFormattingTokenMap(); + sal_uInt16 nToken = rTokenMap.Get(nPrefix, rLocalName); + SvXMLImportContext* pContext = NULL; + switch (nToken) + { + case XML_TOK_FORMATTING_ENTRY: + { + ScColorScaleEntry* pEntry(0); + pContext = new ScXMLFormattingEntryContext( GetScImport(), nPrefix, rLocalName, xAttrList, pEntry ); + mpFormatData->maEntries.push_back(pEntry); + } + break; + default: + break; + } + + return pContext; } namespace { @@ -358,6 +433,78 @@ void GetConditionData(const rtl::OUString& rValue, ScConditionMode& eMode, rtl:: rExpr1 = ScXMLConditionHelper::getExpression( pStart, pEnd, ')'); eMode = SC_COND_DIRECT; } + else if(rValue.indexOf("top-elements") == 0) + { + const sal_Unicode* pStr = rValue.getStr(); + const sal_Unicode* pStart = pStr + 13; + const sal_Unicode* pEnd = pStr + rValue.getLength(); + rExpr1 = ScXMLConditionHelper::getExpression( pStart, pEnd, ')'); + eMode = SC_COND_TOP10; + } + else if(rValue.indexOf("bottom-elements") == 0) + { + const sal_Unicode* pStr = rValue.getStr(); + const sal_Unicode* pStart = pStr + 16; + const sal_Unicode* pEnd = pStr + rValue.getLength(); + rExpr1 = ScXMLConditionHelper::getExpression( pStart, pEnd, ')'); + eMode = SC_COND_BOTTOM10; + } + else if(rValue.indexOf("top-percent") == 0) + { + const sal_Unicode* pStr = rValue.getStr(); + const sal_Unicode* pStart = pStr + 11; + const sal_Unicode* pEnd = pStr + rValue.getLength(); + rExpr1 = ScXMLConditionHelper::getExpression( pStart, pEnd, ')'); + eMode = SC_COND_TOP_PERCENT; + } + else if(rValue.indexOf("bottom-percent") == 0) + { + const sal_Unicode* pStr = rValue.getStr(); + const sal_Unicode* pStart = pStr + 15; + const sal_Unicode* pEnd = pStr + rValue.getLength(); + rExpr1 = ScXMLConditionHelper::getExpression( pStart, pEnd, ')'); + eMode = SC_COND_BOTTOM_PERCENT; + } + else if(rValue.indexOf("is-error") == 0) + { + eMode = SC_COND_ERROR; + } + else if(rValue.indexOf("is-no-error") == 0) + { + eMode = SC_COND_NOERROR; + } + else if(rValue.indexOf("begins-with") == 0) + { + eMode = SC_COND_BEGINS_WITH; + const sal_Unicode* pStr = rValue.getStr(); + const sal_Unicode* pStart = pStr + 12; + const sal_Unicode* pEnd = pStr + rValue.getLength(); + rExpr1 = ScXMLConditionHelper::getExpression( pStart, pEnd, ')'); + } + else if(rValue.indexOf("ends-with") == 0) + { + eMode = SC_COND_ENDS_WITH; + const sal_Unicode* pStr = rValue.getStr(); + const sal_Unicode* pStart = pStr + 10; + const sal_Unicode* pEnd = pStr + rValue.getLength(); + rExpr1 = ScXMLConditionHelper::getExpression( pStart, pEnd, ')'); + } + else if(rValue.indexOf("contains-text") == 0) + { + eMode = SC_COND_CONTAINS_TEXT; + const sal_Unicode* pStr = rValue.getStr(); + const sal_Unicode* pStart = pStr + 14; + const sal_Unicode* pEnd = pStr + rValue.getLength(); + rExpr1 = ScXMLConditionHelper::getExpression( pStart, pEnd, ')'); + } + else if(rValue.indexOf("not-contains-text") == 0) + { + eMode = SC_COND_NOT_CONTAINS_TEXT; + const sal_Unicode* pStr = rValue.getStr(); + const sal_Unicode* pStart = pStr + 18; + const sal_Unicode* pEnd = pStr + rValue.getLength(); + rExpr1 = ScXMLConditionHelper::getExpression( pStart, pEnd, ')'); + } else eMode = SC_COND_NONE; } @@ -411,11 +558,6 @@ ScXMLCondContext::ScXMLCondContext( ScXMLImport& rImport, sal_uInt16 nPrfx, pFormat->AddEntry(pFormatEntry); } -void ScXMLCondContext::EndElement() -{ - -} - namespace { void setColorEntryType(const rtl::OUString& rType, ScColorScaleEntry* pEntry, const rtl::OUString rFormula, @@ -494,13 +636,9 @@ ScXMLColorScaleFormatEntryContext::ScXMLColorScaleFormatEntryContext( ScXMLImpor pFormat->AddEntry(mpFormatEntry); } -void ScXMLColorScaleFormatEntryContext::EndElement() -{ -} - -ScXMLDataBarFormatEntryContext::ScXMLDataBarFormatEntryContext( ScXMLImport& rImport, sal_uInt16 nPrfx, +ScXMLFormattingEntryContext::ScXMLFormattingEntryContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList, - ScDataBarFormatData* pData): + ScColorScaleEntry*& pColorScaleEntry): SvXMLImportContext( rImport, nPrfx, rLName ) { rtl::OUString sVal; @@ -533,19 +671,8 @@ ScXMLDataBarFormatEntryContext::ScXMLDataBarFormatEntryContext( ScXMLImport& rIm if(!sVal.isEmpty()) sax::Converter::convertDouble(nVal, sVal); - ScColorScaleEntry* pEntry = new ScColorScaleEntry(nVal, Color()); - setColorEntryType(sType, pEntry, sVal, GetScImport()); - if(pData->mpLowerLimit) - { - pData->mpUpperLimit.reset(pEntry); - } - else - { - pData->mpLowerLimit.reset(pEntry); - } + pColorScaleEntry = new ScColorScaleEntry(nVal, Color()); + setColorEntryType(sType, pColorScaleEntry, sVal, GetScImport()); } -void ScXMLDataBarFormatEntryContext::EndElement() -{ -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/xml/xmlcondformat.hxx b/sc/source/filter/xml/xmlcondformat.hxx index a31bdff6d2d7..45513ce83d88 100644 --- a/sc/source/filter/xml/xmlcondformat.hxx +++ b/sc/source/filter/xml/xmlcondformat.hxx @@ -35,6 +35,7 @@ class ScColorScaleEntry; class ScDataBarFormat; struct ScDataBarFormatData; class ScConditionalFormat; +struct ScIconSetFormatData; class ScXMLConditionalFormatsContext : public SvXMLImportContext { @@ -50,8 +51,6 @@ public: const ::rtl::OUString& rLocalName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); - - virtual void EndElement(); }; class ScXMLConditionalFormatContext : public SvXMLImportContext @@ -72,7 +71,6 @@ public: ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); virtual void EndElement(); - private: ScConditionalFormat* mpFormat; @@ -96,9 +94,6 @@ public: const ::rtl::OUString& rLocalName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); - - virtual void EndElement(); - private: ScColorScaleFormat* pColorScaleFormat; @@ -122,9 +117,6 @@ public: const ::rtl::OUString& rLocalName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); - - virtual void EndElement(); - private: ScDataBarFormat* mpDataBarFormat; @@ -132,6 +124,29 @@ private: }; +class ScXMLIconSetFormatContext : public SvXMLImportContext +{ + const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } + ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } + + ScIconSetFormatData* mpFormatData; +public: + + ScXMLIconSetFormatContext( ScXMLImport& rImport, sal_uInt16 nPrfx, + const ::rtl::OUString& rLName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList, + ScConditionalFormat* pFormat); + + virtual ~ScXMLIconSetFormatContext() {} + + + virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, + const ::rtl::OUString& rLocalName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::xml::sax::XAttributeList>& xAttrList ); +}; + class ScXMLColorScaleFormatEntryContext : public SvXMLImportContext { const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } @@ -144,28 +159,23 @@ public: ScColorScaleFormat* pFormat); virtual ~ScXMLColorScaleFormatEntryContext() {} - - virtual void EndElement(); - private: ScColorScaleEntry* mpFormatEntry; }; -class ScXMLDataBarFormatEntryContext : public SvXMLImportContext +class ScXMLFormattingEntryContext : public SvXMLImportContext { const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); } public: - ScXMLDataBarFormatEntryContext( ScXMLImport& rImport, sal_uInt16 nPrfx, + ScXMLFormattingEntryContext( ScXMLImport& rImport, sal_uInt16 nPrfx, const ::rtl::OUString& rLName, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList>& xAttrList, - ScDataBarFormatData* pData); + ScColorScaleEntry*& pData); - virtual ~ScXMLDataBarFormatEntryContext() {} - - virtual void EndElement(); + virtual ~ScXMLFormattingEntryContext() {} }; class ScXMLCondContext : public SvXMLImportContext @@ -180,8 +190,6 @@ public: ScConditionalFormat* pFormat); virtual ~ScXMLCondContext() {} - - virtual void EndElement(); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 46d35bf8c35c..0249852afec2 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -3810,6 +3810,22 @@ rtl::OUString getCondFormatEntryType(const ScColorScaleEntry& rEntry, bool bFirs return rtl::OUString(); } +rtl::OUString getIconSetName(ScIconSetType eType) +{ + const char* pName = NULL; + ScIconSetMap* pMap = ScIconSetFormat::getIconSetMap(); + for(;pMap->pName;++pMap) + { + if(pMap->eType == eType) + { + pName = pMap->pName; + break; + } + } + assert(pName); + return rtl::OUString::createFromAscii(pName); +} + } void ScXMLExport::ExportConditionalFormat(SCTAB nTab) @@ -3892,8 +3908,56 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab) aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); aCond.append(')'); break; + case SC_COND_TOP10: + aCond.append("top-elements("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; + case SC_COND_BOTTOM10: + aCond.append("bottom-elements("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; + case SC_COND_TOP_PERCENT: + aCond.append("top-percent("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; + case SC_COND_BOTTOM_PERCENT: + aCond.append("bottom-percent("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; + case SC_COND_ERROR: + aCond.append("is-error"); + break; + case SC_COND_NOERROR: + aCond.append("is-no-error"); + break; + case SC_COND_BEGINS_WITH: + aCond.append("begins-with("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; + case SC_COND_ENDS_WITH: + aCond.append("ends-with("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; + case SC_COND_CONTAINS_TEXT: + aCond.append("contains-text("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; + case SC_COND_NOT_CONTAINS_TEXT: + aCond.append("not-contains-text("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; case SC_COND_NONE: continue; + default: + SAL_WARN("sc", "unimplemented conditional format export"); } rtl::OUString sStyle = pEntry->GetStyle(); AddAttribute(XML_NAMESPACE_CALC_EXT, XML_APPLY_STYLE_NAME, sStyle); @@ -3980,7 +4044,7 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab) else AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, rtl::OUString::valueOf(pFormatData->mpLowerLimit->GetValue())); AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpLowerLimit, true)); - SvXMLElementExport aElementDataBarEntryLower(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_BAR_ENTRY, true, true); + SvXMLElementExport aElementDataBarEntryLower(*this, XML_NAMESPACE_CALC_EXT, XML_FORMATTING_ENTRY, true, true); } { @@ -3992,7 +4056,28 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab) else AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, rtl::OUString::valueOf(pFormatData->mpUpperLimit->GetValue())); AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpUpperLimit, false)); - SvXMLElementExport aElementDataBarEntryUpper(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_BAR_ENTRY, true, true); + SvXMLElementExport aElementDataBarEntryUpper(*this, XML_NAMESPACE_CALC_EXT, XML_FORMATTING_ENTRY, true, true); + } + } + else if(pFormatEntry->GetType() == condformat::ICONSET) + { + const ScIconSetFormat& mrIconSet = static_cast<const ScIconSetFormat&>(*pFormatEntry); + rtl::OUString aIconSetName = getIconSetName(mrIconSet.GetIconSetData()->eIconSetType); + AddAttribute( XML_NAMESPACE_CALC_EXT, XML_ICON_SET_TYPE, aIconSetName ); + SvXMLElementExport aElementColorScale(*this, XML_NAMESPACE_CALC_EXT, XML_ICON_SET, true, true); + for(ScIconSetFormat::const_iterator it = mrIconSet.begin(); + it != mrIconSet.end(); ++it) + { + if(it->GetType() == COLORSCALE_FORMULA) + { + rtl::OUString sFormula = it->GetFormula(formula::FormulaGrammar::GRAM_ODFF); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, sFormula); + } + else + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, rtl::OUString::valueOf(it->GetValue())); + + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*it)); + SvXMLElementExport aElementColorScaleEntry(*this, XML_NAMESPACE_CALC_EXT, XML_FORMATTING_ENTRY, true, true); } } } diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 872c967f9a88..0fed4f5980ff 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -618,6 +618,7 @@ const SvXMLTokenMap& ScXMLImport::GetCondFormatTokenMap() { XML_NAMESPACE_CALC_EXT, XML_COLOR_SCALE, XML_TOK_CONDFORMAT_COLORSCALE }, { XML_NAMESPACE_CALC_EXT, XML_DATA_BAR, XML_TOK_CONDFORMAT_DATABAR }, { XML_NAMESPACE_CALC_EXT, XML_CONDITION, XML_TOK_CONDFORMAT_CONDITION }, + { XML_NAMESPACE_CALC_EXT, XML_ICON_SET, XML_TOK_CONDFORMAT_ICONSET }, XML_TOKEN_MAP_END }; @@ -695,13 +696,14 @@ const SvXMLTokenMap& ScXMLImport::GetColorScaleEntryAttrMap() return *pColorScaleEntryAttrTokenMap; } -const SvXMLTokenMap& ScXMLImport::GetDataBarTokenMap() +const SvXMLTokenMap& ScXMLImport::GetFormattingTokenMap() { if( !pDataBarTokenMap ) { static SvXMLTokenMapEntry aDataBarElemTokenMap[] = { { XML_NAMESPACE_CALC_EXT, XML_DATA_BAR_ENTRY, XML_TOK_DATABAR_DATABARENTRY }, + { XML_NAMESPACE_CALC_EXT, XML_FORMATTING_ENTRY, XML_TOK_FORMATTING_ENTRY }, XML_TOKEN_MAP_END }; @@ -732,9 +734,25 @@ const SvXMLTokenMap& ScXMLImport::GetDataBarAttrMap() return *pDataBarAttrMap; } +const SvXMLTokenMap& ScXMLImport::GetIconSetAttrMap() +{ + if( !pIconSetAttrMap ) + { + static SvXMLTokenMapEntry aIconSetAttrTokenMap[] = + { + { XML_NAMESPACE_CALC_EXT, XML_ICON_SET_TYPE, XML_TOK_ICONSET_TYPE }, + XML_TOKEN_MAP_END + }; + + pIconSetAttrMap = new SvXMLTokenMap( aIconSetAttrTokenMap ); + } + + return *pIconSetAttrMap; +} + const SvXMLTokenMap& ScXMLImport::GetDataBarEntryAttrMap() { - if( !pDataBarEntryAttrMap ) + if( !pFormattingEntryAttrMap ) { static SvXMLTokenMapEntry aDataBarAttrEntryTokenMap[] = { @@ -743,10 +761,10 @@ const SvXMLTokenMap& ScXMLImport::GetDataBarEntryAttrMap() XML_TOKEN_MAP_END }; - pDataBarEntryAttrMap = new SvXMLTokenMap( aDataBarAttrEntryTokenMap ); + pFormattingEntryAttrMap = new SvXMLTokenMap( aDataBarAttrEntryTokenMap ); } - return *pDataBarEntryAttrMap; + return *pFormattingEntryAttrMap; } const SvXMLTokenMap& ScXMLImport::GetLabelRangesElemTokenMap() @@ -1873,7 +1891,8 @@ ScXMLImport::ScXMLImport( pColorScaleEntryAttrTokenMap( 0 ), pDataBarTokenMap( 0 ), pDataBarAttrMap( 0 ), - pDataBarEntryAttrMap( 0 ), + pFormattingEntryAttrMap( 0 ), + pIconSetAttrMap( 0 ), pLabelRangesElemTokenMap( 0 ), pLabelRangeAttrTokenMap( 0 ), pTableElemTokenMap( 0 ), @@ -2010,7 +2029,7 @@ ScXMLImport::~ScXMLImport() throw() delete pColorScaleEntryAttrTokenMap; delete pDataBarTokenMap; delete pDataBarAttrMap; - delete pDataBarEntryAttrMap; + delete pFormattingEntryAttrMap; delete pLabelRangesElemTokenMap; delete pLabelRangeAttrTokenMap; delete pTableElemTokenMap; diff --git a/sc/source/filter/xml/xmlimprt.hxx b/sc/source/filter/xml/xmlimprt.hxx index f3706d9854cf..1f6a5d997718 100644 --- a/sc/source/filter/xml/xmlimprt.hxx +++ b/sc/source/filter/xml/xmlimprt.hxx @@ -159,7 +159,8 @@ enum ScXMLCondFormatTokens { XML_TOK_CONDFORMAT_COLORSCALE, XML_TOK_CONDFORMAT_DATABAR, - XML_TOK_CONDFORMAT_CONDITION + XML_TOK_CONDFORMAT_CONDITION, + XML_TOK_CONDFORMAT_ICONSET }; enum ScXMLCondFormatAttrTokens @@ -186,9 +187,10 @@ enum ScXMLColorScaleEntryAttrTokens XML_TOK_COLORSCALEENTRY_COLOR }; -enum ScXMLDataBarFormatTokens +enum ScXMLFormattingFormatTokens { - XML_TOK_DATABAR_DATABARENTRY + XML_TOK_DATABAR_DATABARENTRY, + XML_TOK_FORMATTING_ENTRY }; enum ScXMLDataBarAttrTokens @@ -207,6 +209,11 @@ enum ScXMLDataBarEntryAttrTokens XML_TOK_DATABARENTRY_VALUE }; +enum ScXMLIconSetAttrTokens +{ + XML_TOK_ICONSET_TYPE +}; + enum ScXMLLabelRangesElemTokens { XML_TOK_LABEL_RANGE_ELEM @@ -777,7 +784,8 @@ class ScXMLImport: public SvXMLImport SvXMLTokenMap *pColorScaleEntryAttrTokenMap; SvXMLTokenMap *pDataBarTokenMap; SvXMLTokenMap *pDataBarAttrMap; - SvXMLTokenMap *pDataBarEntryAttrMap; + SvXMLTokenMap *pFormattingEntryAttrMap; + SvXMLTokenMap *pIconSetAttrMap; SvXMLTokenMap *pLabelRangesElemTokenMap; SvXMLTokenMap *pLabelRangeAttrTokenMap; SvXMLTokenMap *pTableElemTokenMap; @@ -938,9 +946,10 @@ public: const SvXMLTokenMap& GetConditionAttrMap(); const SvXMLTokenMap& GetColorScaleTokenMap(); const SvXMLTokenMap& GetColorScaleEntryAttrMap(); - const SvXMLTokenMap& GetDataBarTokenMap(); + const SvXMLTokenMap& GetFormattingTokenMap(); const SvXMLTokenMap& GetDataBarAttrMap(); const SvXMLTokenMap& GetDataBarEntryAttrMap(); + const SvXMLTokenMap& GetIconSetAttrMap(); const SvXMLTokenMap& GetLabelRangesElemTokenMap(); const SvXMLTokenMap& GetLabelRangeAttrTokenMap(); const SvXMLTokenMap& GetTableElemTokenMap(); diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index 4d513fe3ce83..d059e86ad4b4 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -45,6 +45,7 @@ #include <com/sun/star/xml/sax/InputSource.hpp> #include <com/sun/star/xml/sax/XDTDHandler.hpp> #include <com/sun/star/xml/sax/Parser.hpp> +#include <com/sun/star/xml/sax/Writer.hpp> #include <com/sun/star/io/XActiveDataSource.hpp> #include <com/sun/star/io/XActiveDataControl.hpp> #include <com/sun/star/frame/XModel.hpp> @@ -622,7 +623,7 @@ static bool lcl_HasValidStream(ScDocument& rDoc) } sal_Bool ScXMLImportWrapper::ExportToComponent(uno::Reference<lang::XMultiServiceFactory>& xServiceFactory, - uno::Reference<frame::XModel>& xModel, uno::Reference<uno::XInterface>& xWriter, + uno::Reference<frame::XModel>& xModel, uno::Reference<xml::sax::XWriter>& xWriter, uno::Sequence<beans::PropertyValue>& aDescriptor, const rtl::OUString& sName, const rtl::OUString& sMediaType, const rtl::OUString& sComponentName, const sal_Bool bPlainText, uno::Sequence<uno::Any>& aArgs, ScMySharedData*& pSharedData) @@ -667,8 +668,7 @@ sal_Bool ScXMLImportWrapper::ExportToComponent(uno::Reference<lang::XMultiServic xInfoSet->setPropertyValue( sPropName, uno::makeAny( sName ) ); } - uno::Reference<io::XActiveDataSource> xSrc( xWriter, uno::UNO_QUERY ); - xSrc->setOutputStream( xOut ); + xWriter->setOutputStream( xOut ); uno::Reference<document::XFilter> xFilter( xServiceFactory->createInstanceWithArguments( sComponentName , aArgs ), @@ -742,21 +742,16 @@ sal_Bool ScXMLImportWrapper::Export(sal_Bool bStylesOnly) RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "sb99857", "ScXMLImportWrapper::Export" ); uno::Reference<lang::XMultiServiceFactory> xServiceFactory(comphelper::getProcessServiceFactory()); + uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext()); OSL_ENSURE( xServiceFactory.is(), "got no service manager" ); if( !xServiceFactory.is() ) return false; - uno::Reference<uno::XInterface> xWriter(xServiceFactory->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.sax.Writer" )) )); - OSL_ENSURE( xWriter.is(), "com.sun.star.xml.sax.Writer service missing" ); - if(!xWriter.is()) - return false; + uno::Reference<xml::sax::XWriter> xWriter = xml::sax::Writer::create(xContext); if ( !xStorage.is() && pMedium ) xStorage = pMedium->GetOutputStorage(); - uno::Reference<xml::sax::XDocumentHandler> xHandler( xWriter, uno::UNO_QUERY ); - OUString sFileName; OUString sTextMediaType(RTL_CONSTASCII_USTRINGPARAM("text/xml")); if (pMedium) @@ -841,7 +836,7 @@ sal_Bool ScXMLImportWrapper::Export(sal_Bool bStylesOnly) uno::Sequence<uno::Any> aMetaArgs(3); uno::Any* pMetaArgs = aMetaArgs.getArray(); pMetaArgs[0] <<= xInfoSet; - pMetaArgs[1] <<= xHandler; + pMetaArgs[1] <<= xWriter; pMetaArgs[2] <<= xStatusIndicator; RTL_LOGFILE_CONTEXT_TRACE( aLog, "meta export start" ); @@ -882,7 +877,7 @@ sal_Bool ScXMLImportWrapper::Export(sal_Bool bStylesOnly) pStylesArgs[0] <<= xInfoSet; pStylesArgs[1] <<= xGrfContainer; pStylesArgs[2] <<= xStatusIndicator; - pStylesArgs[3] <<= xHandler; + pStylesArgs[3] <<= xWriter; pStylesArgs[4] <<= xObjectResolver; RTL_LOGFILE_CONTEXT_TRACE( aLog, "styles export start" ); @@ -906,7 +901,7 @@ sal_Bool ScXMLImportWrapper::Export(sal_Bool bStylesOnly) pDocArgs[0] <<= xInfoSet; pDocArgs[1] <<= xGrfContainer; pDocArgs[2] <<= xStatusIndicator; - pDocArgs[3] <<= xHandler; + pDocArgs[3] <<= xWriter; pDocArgs[4] <<= xObjectResolver; RTL_LOGFILE_CONTEXT_TRACE( aLog, "content export start" ); @@ -934,7 +929,7 @@ sal_Bool ScXMLImportWrapper::Export(sal_Bool bStylesOnly) uno::Sequence<uno::Any> aSettingsArgs(3); uno::Any* pSettingsArgs = aSettingsArgs.getArray(); pSettingsArgs[0] <<= xInfoSet; - pSettingsArgs[1] <<= xHandler; + pSettingsArgs[1] <<= xWriter; pSettingsArgs[2] <<= xStatusIndicator; RTL_LOGFILE_CONTEXT_TRACE( aLog, "settings export start" ); diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index b8647d4cab1c..c0fb8ab73b68 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * 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. - * - ************************************************************************/ + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ #include <com/sun/star/embed/XTransactedObject.hpp> #include <com/sun/star/embed/XEmbedPersist.hpp> @@ -434,9 +425,9 @@ sal_Bool ScDrawTransferObj::GetData( const ::com::sun::star::datatransfer::DataF OSL_ENSURE( pPv, "pPv not there..." ); aView.MarkAllObj( pPv ); if ( nFormat == SOT_FORMAT_GDIMETAFILE ) - bOK = SetGDIMetaFile( aView.GetAllMarkedMetaFile( sal_True ), rFlavor ); + bOK = SetGDIMetaFile( aView.GetMarkedObjMetaFile(true), rFlavor ); else - bOK = SetBitmap( aView.GetAllMarkedBitmap( sal_True ), rFlavor ); + bOK = SetBitmap( aView.GetMarkedObjBitmapEx(true).GetBitmap(), rFlavor ); } else if ( nFormat == SOT_FORMATSTR_ID_SVXB ) { diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 2b74872eafb8..3a9ff2f50946 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -2043,7 +2043,10 @@ SfxItemSet* ScModule::CreateItemSet( sal_uInt16 nId ) // TP_USERLISTS if ( pUL ) + { aULItem.SetUserList( *pUL ); + pRet->Put(aULItem); + } // TP_COMPATIBILITY pRet->Put( SfxUInt16Item( SID_SC_OPT_KEY_BINDING_COMPAT, diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index d82329d51296..96708d55fdc3 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -914,6 +914,9 @@ ScCheckListMenuWindow::ScCheckListMenuWindow(Window* pParent, ScDocument* pDoc) maTabStopCtrls.push_back(&maBtnUnselectSingle); maTabStopCtrls.push_back(&maBtnOk); maTabStopCtrls.push_back(&maBtnCancel); + + // Enable type-ahead search in the check list box. + maChecks.SetStyle(maChecks.GetStyle() | WB_QUICK_SEARCH); } ScCheckListMenuWindow::~ScCheckListMenuWindow() @@ -1354,7 +1357,18 @@ void ScCheckListMenuWindow::launch(const Rectangle& rRect) // We need to have at least one member selected. maBtnOk.Enable(maChecks.GetCheckedEntryCount() != 0); - StartPopupMode(rRect, (FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_GRABFOCUS)); + Rectangle aRect(rRect); + if (maWndSize.Width() < aRect.GetWidth()) + { + // Target rectangle (i.e. cell width) is wider than the window. + // Simulate right-aligned launch by modifying the target rectangle + // size. + long nDiff = aRect.GetWidth() - maWndSize.Width(); + aRect.Left() += nDiff; + } + + StartPopupMode(aRect, (FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_GRABFOCUS)); + cycleFocus(); // Set initial focus to the check list box. } void ScCheckListMenuWindow::close(bool bOK) diff --git a/sc/source/ui/condformat/colorformat.cxx b/sc/source/ui/condformat/colorformat.cxx index 79835917816e..8d77b8a3e390 100644 --- a/sc/source/ui/condformat/colorformat.cxx +++ b/sc/source/ui/condformat/colorformat.cxx @@ -36,39 +36,6 @@ #include <svx/drawitem.hxx> #include <vcl/msgbox.hxx> -ScDataBarSettingsDlg::ScDataBarSettingsDlg(Window* pWindow, ScDocument* pDoc, const ScAddress& rPos): - ModalDialog( pWindow, ScResId( RID_SCDLG_DATABAR ) ), - maBtnOk( this, ScResId( BTN_OK ) ), - maBtnCancel( this, ScResId( BTN_CANCEL ) ), - maFlBarColors( this, ScResId( FL_BAR_COLORS ) ), - maFlAxes( this, ScResId( FL_AXIS ) ), - maFlValues( this, ScResId( FL_VALUES ) ), - maFtMin( this, ScResId( FT_MINIMUM ) ), - maFtMax( this, ScResId( FT_MAXIMUM ) ), - maFtPositive( this, ScResId( FT_POSITIVE ) ), - maFtNegative( this, ScResId( FT_NEGATIVE ) ), - maFtPosition( this, ScResId( FT_POSITION ) ), - maFtAxisColor( this, ScResId( FT_COLOR_AXIS ) ), - maLbPos( this, ScResId( LB_POS ) ), - maLbNeg( this, ScResId( LB_NEG ) ), - maLbAxisCol( this, ScResId( LB_COL_AXIS ) ), - maLbTypeMin( this, ScResId( LB_TYPE ) ), - maLbTypeMax( this, ScResId( LB_TYPE ) ), - maLbAxisPos( this, ScResId( LB_AXIS_POSITION ) ), - maEdMin( this, ScResId( ED_MIN ) ), - maEdMax( this, ScResId( ED_MAX ) ), - mpNumberFormatter( pDoc->GetFormatTable() ), - mpDoc(pDoc), - maPos(rPos) -{ - Init(); - FreeResource(); - - maLbTypeMin.SelectEntryPos(0); - maLbTypeMax.SelectEntryPos(0); - maLbAxisPos.SelectEntryPos(0); -} - namespace { void SetType(const ScColorScaleEntry* pEntry, ListBox& rLstBox) diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index bf4f8b20b762..8ef887c3a928 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -74,7 +74,14 @@ ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocum switch(pEntry->GetType()) { case condformat::CONDITION: - maEntries.push_back(new ScConditionFrmtEntry( this, mpDoc, maPos, static_cast<const ScCondFormatEntry*>( pEntry ) ) ); + { + const ScCondFormatEntry* pConditionEntry = static_cast<const ScCondFormatEntry*>( pEntry ); + if(pConditionEntry->GetOperation() != SC_COND_DIRECT) + maEntries.push_back(new ScConditionFrmtEntry( this, mpDoc, maPos, pConditionEntry ) ); + else + maEntries.push_back(new ScFormulaFrmtEntry( this, mpDoc, maPos, pConditionEntry ) ); + + } break; case condformat::COLORSCALE: maEntries.push_back(new ScColorScale3FrmtEntry( this, mpDoc, maPos, static_cast<const ScColorScaleFormat*>( pEntry ) ) ); @@ -82,6 +89,8 @@ ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocum case condformat::DATABAR: maEntries.push_back(new ScDataBarFrmtEntry( this, mpDoc, maPos, static_cast<const ScDataBarFormat*>( pEntry ) ) ); break; + case condformat::ICONSET: + break; } } } @@ -102,6 +111,7 @@ ScCondFormatList::ScCondFormatList(Window* pParent, const ResId& rResId, ScDocum break; } } + RecalcAll(); if (!maEntries.empty()) maEntries.begin()->SetActive(); diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index 58f59bb18940..817da0b999dc 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -158,6 +158,7 @@ ScConditionFrmtEntry::ScConditionFrmtEntry( Window* pParent, ScDocument* pDoc, c StyleSelectHdl(NULL); ScConditionMode eMode = pFormatEntry->GetOperation(); maEdVal1.SetText(pFormatEntry->GetExpression(maPos, 0)); + maEdVal2.Hide(); switch(eMode) { case SC_COND_EQUAL: @@ -179,10 +180,12 @@ ScConditionFrmtEntry::ScConditionFrmtEntry( Window* pParent, ScDocument* pDoc, c maLbCondType.SelectEntryPos(5); break; case SC_COND_BETWEEN: + maEdVal2.Show(); maEdVal2.SetText(pFormatEntry->GetExpression(maPos, 1)); maLbCondType.SelectEntryPos(6); break; case SC_COND_NOTBETWEEN: + maEdVal2.Show(); maEdVal2.SetText(pFormatEntry->GetExpression(maPos, 1)); maLbCondType.SelectEntryPos(7); break; @@ -193,8 +196,49 @@ ScConditionFrmtEntry::ScConditionFrmtEntry( Window* pParent, ScDocument* pDoc, c maLbCondType.SelectEntryPos(9); break; case SC_COND_DIRECT: + assert(false); //maLbType.SelectEntryPos(2); break; + case SC_COND_TOP10: + maLbCondType.SelectEntryPos(10); + break; + case SC_COND_BOTTOM10: + maLbCondType.SelectEntryPos(11); + break; + case SC_COND_TOP_PERCENT: + maLbCondType.SelectEntryPos(12); + break; + case SC_COND_BOTTOM_PERCENT: + maLbCondType.SelectEntryPos(13); + break; + case SC_COND_ABOVE_AVERAGE: + maEdVal1.Hide(); + maLbCondType.SelectEntryPos(14); + break; + case SC_COND_BELOW_AVERAGE: + maEdVal1.Hide(); + maLbCondType.SelectEntryPos(15); + break; + case SC_COND_ERROR: + maEdVal1.Hide(); + maLbCondType.SelectEntryPos(16); + break; + case SC_COND_NOERROR: + maEdVal1.Hide(); + maLbCondType.SelectEntryPos(17); + break; + case SC_COND_BEGINS_WITH: + maLbCondType.SelectEntryPos(18); + break; + case SC_COND_ENDS_WITH: + maLbCondType.SelectEntryPos(19); + break; + case SC_COND_CONTAINS_TEXT: + maLbCondType.SelectEntryPos(20); + break; + case SC_COND_NOT_CONTAINS_TEXT: + maLbCondType.SelectEntryPos(21); + break; case SC_COND_NONE: break; } @@ -275,6 +319,42 @@ ScFormatEntry* ScConditionFrmtEntry::createConditionEntry() const case 9: eMode = SC_COND_NOTDUPLICATE; break; + case 10: + eMode = SC_COND_TOP10; + break; + case 11: + eMode = SC_COND_BOTTOM10; + break; + case 12: + eMode = SC_COND_TOP_PERCENT; + break; + case 13: + eMode = SC_COND_BOTTOM_PERCENT; + break; + case 14: + eMode = SC_COND_ABOVE_AVERAGE; + break; + case 15: + eMode = SC_COND_BELOW_AVERAGE; + break; + case 16: + eMode = SC_COND_ERROR; + break; + case 17: + eMode = SC_COND_NOERROR; + break; + case 18: + eMode = SC_COND_BEGINS_WITH; + break; + case 19: + eMode = SC_COND_ENDS_WITH; + break; + case 20: + eMode = SC_COND_CONTAINS_TEXT; + break; + case 21: + eMode = SC_COND_NOT_CONTAINS_TEXT; + break; default: assert(false); // this cannot happen return NULL; @@ -552,8 +632,6 @@ void SetColorScaleEntry( ScColorScaleEntry* pEntry, const ListBox& rType, const case COLORSCALE_MIN: case COLORSCALE_MAX: break; - break; - break; case COLORSCALE_PERCENTILE: case COLORSCALE_VALUE: case COLORSCALE_PERCENT: @@ -912,12 +990,26 @@ IMPL_LINK( ScColorScale3FrmtEntry, EntryTypeHdl, ListBox*, pBox ) IMPL_LINK_NOARG( ScConditionFrmtEntry, ConditionTypeSelectHdl ) { - if(maLbCondType.GetSelectEntryPos() == 6 || maLbCondType.GetSelectEntryPos() == 7) + sal_Int32 nSelectPos = maLbCondType.GetSelectEntryPos(); + if(nSelectPos == 6 || nSelectPos == 7) { + maEdVal1.Show(); maEdVal2.Show(); } + else if(nSelectPos == 8 || nSelectPos == 9) + { + maEdVal2.Hide(); + maEdVal1.Hide(); + } + else if(nSelectPos <= 5 || (nSelectPos >= 10 && nSelectPos <= 13) + || nSelectPos >= 18) + { + maEdVal1.Show(); + maEdVal2.Hide(); + } else { + maEdVal1.Hide(); maEdVal2.Hide(); } diff --git a/sc/source/ui/condformat/condformathelper.cxx b/sc/source/ui/condformat/condformathelper.cxx index 1f658e326456..09eaa24859df 100644 --- a/sc/source/ui/condformat/condformathelper.cxx +++ b/sc/source/ui/condformat/condformathelper.cxx @@ -25,6 +25,8 @@ rtl::OUString getTextForType(ScCondFormatEntryType eType) return ScGlobal::GetRscString(STR_COND_DATABAR); case FORMULA: return ScGlobal::GetRscString(STR_COND_FORMULA); + case ICONSET: + return ScGlobal::GetRscString(STR_COND_ICONSET); default: break; } @@ -56,6 +58,32 @@ rtl::OUString getExpression(sal_Int32 nIndex) return ScGlobal::GetRscString(STR_COND_DUPLICATE); case 9: return ScGlobal::GetRscString(STR_COND_UNIQUE); + case 10: + assert(false); + case 11: + return ScGlobal::GetRscString(STR_COND_TOP10); + case 12: + return ScGlobal::GetRscString(STR_COND_BOTTOM10); + case 13: + return ScGlobal::GetRscString(STR_COND_TOP_PERCENT); + case 14: + return ScGlobal::GetRscString(STR_COND_BOTTOM_PERCENT); + case 15: + return ScGlobal::GetRscString(STR_COND_ABOVE_AVERAGE); + case 16: + return ScGlobal::GetRscString(STR_COND_BELOW_AVERAGE); + case 17: + return ScGlobal::GetRscString(STR_COND_ERROR); + case 18: + return ScGlobal::GetRscString(STR_COND_NOERROR); + case 19: + return ScGlobal::GetRscString(STR_COND_BEGINS_WITH); + case 20: + return ScGlobal::GetRscString(STR_COND_ENDS_WITH); + case 21: + return ScGlobal::GetRscString(STR_COND_CONTAINS); + case 22: + return ScGlobal::GetRscString(STR_COND_NOT_CONTAINS); } return rtl::OUString(); } @@ -91,7 +119,7 @@ rtl::OUString ScCondFormatHelper::GetExpression(const ScConditionalFormat& rForm aBuffer.append(rtl::OUString(" and ")); aBuffer.append(pEntry->GetExpression(rPos, 1)); } - else if(eMode <= SC_COND_NOTEQUAL) + else if(eMode <= SC_COND_NOTEQUAL || eMode >= SC_COND_BEGINS_WITH) { aBuffer.append(pEntry->GetExpression(rPos, 0)); } @@ -105,6 +133,9 @@ rtl::OUString ScCondFormatHelper::GetExpression(const ScConditionalFormat& rForm case condformat::COLORSCALE: aBuffer.append(getTextForType(COLORSCALE)); break; + case condformat::ICONSET: + aBuffer.append(getTextForType(ICONSET)); + break; } } return aBuffer.makeStringAndClear(); @@ -118,7 +149,7 @@ rtl::OUString ScCondFormatHelper::GetExpression( ScCondFormatEntryType eType, sa if(eType == CONDITION) { aBuffer.append(getExpression(nIndex)); - if(nIndex <= 7) + if(nIndex <= 7 || nIndex >= 19) { aBuffer.append(" ").append(aStr1); if(nIndex == 6 || nIndex == 7) diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx index dc5bb8b3d6fe..6b3a48ed0dab 100644 --- a/sc/source/ui/condformat/condformatmgr.cxx +++ b/sc/source/ui/condformat/condformatmgr.cxx @@ -87,8 +87,8 @@ void ScCondFormatManagerWindow::Init() for(ScConditionalFormatList::iterator itr = mpFormatList->begin(); itr != mpFormatList->end(); ++itr) { - SvLBoxEntry* pEntry = InsertEntryToColumn( createEntryString(*itr), LIST_APPEND, 0xffff ); - maMapLBoxEntryToCondIndex.insert(std::pair<SvLBoxEntry*,sal_Int32>(pEntry,itr->GetKey())); + SvTreeListEntry* pEntry = InsertEntryToColumn( createEntryString(*itr), LIST_APPEND, 0xffff ); + maMapLBoxEntryToCondIndex.insert(std::pair<SvTreeListEntry*,sal_Int32>(pEntry,itr->GetKey())); } SetUpdateMode(true); } @@ -97,7 +97,7 @@ void ScCondFormatManagerWindow::DeleteSelection() { if(GetSelectionCount()) { - for(SvLBoxEntry* pEntry = FirstSelected(); pEntry != NULL; pEntry = NextSelected(pEntry)) + for(SvTreeListEntry* pEntry = FirstSelected(); pEntry != NULL; pEntry = NextSelected(pEntry)) { sal_Int32 nIndex = maMapLBoxEntryToCondIndex.find(pEntry)->second; mpFormatList->erase(nIndex); @@ -108,7 +108,7 @@ void ScCondFormatManagerWindow::DeleteSelection() ScConditionalFormat* ScCondFormatManagerWindow::GetSelection() { - SvLBoxEntry* pEntry = FirstSelected(); + SvTreeListEntry* pEntry = FirstSelected(); if(!pEntry) return NULL; diff --git a/sc/source/ui/dbgui/subtdlg.cxx b/sc/source/ui/dbgui/subtdlg.cxx index eb49b7517c5f..6be149efe12a 100644 --- a/sc/source/ui/dbgui/subtdlg.cxx +++ b/sc/source/ui/dbgui/subtdlg.cxx @@ -35,7 +35,7 @@ ScSubTotalDlg::ScSubTotalDlg( Window* pParent, SfxTabDialog( pParent, ScResId( RID_SCDLG_SUBTOTALS ), pArgSet ), - aBtnRemove ( this, ScResId( BTN_REMOVE ) ) + aBtnRemove ( m_pActionArea, ScResId( BTN_REMOVE ) ) { AddTabPage( PAGE_GROUP1, ScTpSubTotalGroup1::Create, 0 ); AddTabPage( PAGE_GROUP2, ScTpSubTotalGroup2::Create, 0 ); diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx index 84084d7e721d..5de7f744d5b6 100644 --- a/sc/source/ui/dbgui/tpsort.cxx +++ b/sc/source/ui/dbgui/tpsort.cxx @@ -285,9 +285,11 @@ sal_Bool ScTabPageSortFields::FillItemSet( SfxItemSet& rArgSet ) // ----------------------------------------------------------------------- -// for data exchange without dialogue detour: (still TODO!) -void ScTabPageSortFields::ActivatePage() +// for data exchange without dialogue detour: +void ScTabPageSortFields::ActivatePage( const SfxItemSet& rSet ) { + // Refresh local copy with shared data + aSortData = static_cast<const ScSortItem&>(rSet.Get( SCITEM_SORTDATA )).GetSortData(); if ( pDlg ) { if ( bHasHeader != pDlg->GetHeaders() @@ -765,9 +767,11 @@ sal_Bool ScTabPageSortOptions::FillItemSet( SfxItemSet& rArgSet ) // ----------------------------------------------------------------------- -// for data exchange without dialogue detour: (still TODO!) -void ScTabPageSortOptions::ActivatePage() +// for data exchange without dialogue detour: +void ScTabPageSortOptions::ActivatePage( const SfxItemSet& rSet ) { + // Refresh local copy with shared data + aSortData = static_cast<const ScSortItem&>(rSet.Get( SCITEM_SORTDATA )).GetSortData(); if ( pDlg ) { if ( aBtnHeader.IsChecked() != pDlg->GetHeaders() ) diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx index ea24d6c5f039..6651afa23daf 100644 --- a/sc/source/ui/dbgui/tpsubt.cxx +++ b/sc/source/ui/dbgui/tpsubt.cxx @@ -275,20 +275,19 @@ void ScTpSubTotalGroup::FillListBoxes() SCTAB nTab = pViewData->GetTabNo(); SCCOL nMaxCol = rSubTotalData.nCol2; SCCOL col; - sal_uInt16 i=0; rtl::OUString aFieldName; aLbGroup.Clear(); aLbColumns.Clear(); aLbGroup.InsertEntry( aStrNone, 0 ); - i=0; + sal_uInt16 i=0; for ( col=nFirstCol; col<=nMaxCol && i<SC_MAXFIELDS; col++ ) { pDoc->GetString( col, nFirstRow, nTab, aFieldName ); if ( aFieldName.isEmpty() ) { - rtl::OUStringBuffer aBuf; + rtl::OUStringBuffer aBuf; aBuf.append(aStrColumn); aFieldName = aBuf.makeStringAndClear().replaceAll("%1", ScColToAlpha( col )); } @@ -406,7 +405,7 @@ IMPL_LINK( ScTpSubTotalGroup, CheckHdl, ListBox *, pLb ) { if ( ((SvxCheckListBox*)pLb) == &aLbColumns ) { - SvLBoxEntry* pEntry = aLbColumns.GetHdlEntry(); + SvTreeListEntry* pEntry = aLbColumns.GetHdlEntry(); if ( pEntry ) { diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index 390ad1743e63..ea12ad189296 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -269,7 +269,7 @@ void lclGetFormulaFromStringList( String& rFmlaStr, const String& rStringList, s { String aToken( rStringList.GetToken( 0, '\n', nStringIx ) ); ScGlobal::AddQuotes( aToken, '"' ); - ScGlobal::AddToken( rFmlaStr, aToken, cFmlaSep ); + rFmlaStr = ScGlobal::addToken(rFmlaStr, aToken, cFmlaSep); } if( !rFmlaStr.Len() ) rFmlaStr.AssignAscii( "\"\"" ); @@ -300,7 +300,7 @@ bool lclGetStringListFromFormula( String& rStringList, const String& rFmlaStr, s if( bIsStringList ) { ScGlobal::EraseQuotes( aToken, '"' ); - ScGlobal::AddToken( rStringList, aToken, '\n', 1, bTokenAdded ); + rStringList = ScGlobal::addToken(rStringList, aToken, '\n', 1, bTokenAdded); bTokenAdded = true; } } diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index c3be6648b2e2..8b76aeeebbc9 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -201,7 +201,6 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, // ImportDoc - also used for Redo ScDocument* pImportDoc = new ScDocument( SCDOCMODE_UNDO ); pImportDoc->InitUndo( pDoc, nTab, nTab ); - ScColumn::DoubleAllocSwitch aAllocSwitch(true); // // get data from database into import document diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 188259354fb3..2c53a44e2a8c 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1499,6 +1499,8 @@ sal_Bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMa itr = aMark.begin(); for (; itr != itrEnd && nTabCount; ++itr) { + pDoc->InitializeNoteCaptions(*itr); + i = *itr; if( pDoc->HasAttrib( nMergeTestStartX, nMergeTestStartY, i, nMergeTestEndX, nMergeTestEndY, i, HASATTR_MERGED | HASATTR_OVERLAPPED ) ) { @@ -1721,6 +1723,8 @@ sal_Bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMa for (; itr != itrEnd && *itr < nTabCount; ++itr) { i = *itr; + pDoc->SetDrawPageSize(i); + if (bNeedRefresh) pDoc->ExtendMerge( nMergeTestStartX, nMergeTestStartY, nMergeTestEndX, nMergeTestEndY, i, sal_True ); else @@ -1904,6 +1908,8 @@ sal_Bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMa itr = aMark.begin(); for (; itr != itrEnd && *itr < nTabCount; ++itr) { + pDoc->InitializeNoteCaptions(*itr); + SCTAB i = *itr; if ( pDoc->HasAttrib( nUndoStartX, nUndoStartY, i, nMergeTestEndX, nMergeTestEndY, i, HASATTR_MERGED | HASATTR_OVERLAPPED )) { @@ -2227,6 +2233,8 @@ sal_Bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMa itr = aMark.begin(), itrEnd = aMark.end(); for (; itr != itrEnd && *itr < nTabCount; ++itr) { + pDoc->SetDrawPageSize(*itr); + if ( eCmd == DEL_DELCOLS || eCmd == DEL_DELROWS ) pDoc->UpdatePageBreaks( *itr ); @@ -2643,9 +2651,11 @@ void VBA_InsertModule( ScDocument& rDoc, SCTAB nTab, const rtl::OUString& sModul uno::Reference< container::XNameContainer > xLib; if( xLibContainer.is() ) { - String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); - if ( rDocSh.GetBasicManager() && rDocSh.GetBasicManager()->GetName().Len() ) + String aLibName( "Standard" ); + if ( rDocSh.GetBasicManager() && !rDocSh.GetBasicManager()->GetName().isEmpty() ) + { aLibName = rDocSh.GetBasicManager()->GetName(); + } uno::Any aLibAny = xLibContainer->getByName( aLibName ); aLibAny >>= xLib; } @@ -2689,9 +2699,11 @@ void VBA_DeleteModule( ScDocShell& rDocSh, const rtl::OUString& sModuleName ) uno::Reference< container::XNameContainer > xLib; if( xLibContainer.is() ) { - String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); - if ( rDocSh.GetBasicManager() && rDocSh.GetBasicManager()->GetName().Len() ) + String aLibName( "Standard" ); + if ( rDocSh.GetBasicManager() && !rDocSh.GetBasicManager()->GetName().isEmpty() ) + { aLibName = rDocSh.GetBasicManager()->GetName(); + } uno::Any aLibAny = xLibContainer->getByName( aLibName ); aLibAny >>= xLib; } diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 645911d8e5a5..eab9a7453f70 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -273,9 +273,6 @@ void ScDocShell::BeforeXMLLoading() aDocument.EnableUndo( false ); // prevent unnecessary broadcasts and "half way listeners" aDocument.SetInsertingFromOtherDoc( sal_True ); - - if (GetCreateMode() != SFX_CREATE_MODE_ORGANIZER) - ScColumn::bDoubleAlloc = sal_True; } void ScDocShell::AfterXMLLoading(sal_Bool bRet) @@ -358,7 +355,6 @@ void ScDocShell::AfterXMLLoading(sal_Bool bRet) } } } - ScColumn::bDoubleAlloc = false; } else aDocument.SetInsertingFromOtherDoc( false ); @@ -1084,10 +1080,8 @@ sal_Bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) sItStr = ScGlobal::GetCharsetString( RTL_TEXTENCODING_IBM_437 ); } - ScColumn::bDoubleAlloc = sal_True; FltError eError = ScFormatFilter::Get().ScImportLotus123( rMedium, &aDocument, ScGlobal::GetCharsetValue(sItStr)); - ScColumn::bDoubleAlloc = false; if (eError != eERR_OK) { if (!GetError()) @@ -1117,9 +1111,7 @@ sal_Bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) MakeDrawLayer(); //! im Filter CalcOutputFactor(); // prepare update of row height - ScColumn::bDoubleAlloc = true; FltError eError = ScFormatFilter::Get().ScImportExcel( rMedium, &aDocument, eFormat ); - ScColumn::bDoubleAlloc = false; aDocument.UpdateFontCharSet(); if ( aDocument.IsChartListenerCollectionNeedsUpdate() ) aDocument.UpdateChartListenerCollection(); //! fuer alle Importe? @@ -1316,9 +1308,7 @@ sal_Bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) } else if (aFltName.EqualsAscii(pFilterQPro6)) { - ScColumn::bDoubleAlloc = sal_True; FltError eError = ScFormatFilter::Get().ScImportQuattroPro( rMedium, &aDocument); - ScColumn::bDoubleAlloc = false; if (eError != eERR_OK) { if (!GetError()) diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 6453631f570a..f93c2554163a 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -317,7 +317,6 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet return ERRCODE_IO_GENERAL; #else - ScColumn::DoubleAllocSwitch aAllocSwitch(true); sal_uLong nErr = eERR_OK; long i; @@ -395,7 +394,6 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet //! add type descriptions aProgress.SetState( 0 ); - ScColumn::bDoubleAlloc = true; // row count isn't readily available in advance vector<long> aScales(nColCount, -1); for (i=0; i<nColCount; i++) @@ -487,7 +485,6 @@ sal_uLong ScDocShell::DBaseImport( const String& rFullFileName, CharSet eCharSet nErr = ERRCODE_IO_GENERAL; } - ScColumn::bDoubleAlloc = false; if ( nColCount > 0 ) aDocument.DoColResize( 0, 0, static_cast<SCCOL>(nColCount) - 1, 0 ); diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 05521e20ecd8..6e65a15c0cbf 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -28,6 +28,7 @@ #include "sc.hrc" +#include <comphelper/processfactory.hxx> #include <i18npool/mslangid.hxx> #include <sot/formats.hxx> #include <sfx2/mieclip.hxx> @@ -1272,8 +1273,6 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) rStrm.Seek( nOldPos ); rStrm.StartReadingUnicodeText( rStrm.GetStreamCharSet() ); - ScColumn::DoubleAllocSwitch aAllocSwitch(true); - SCCOL nStartCol = aRange.aStart.Col(); SCCOL nEndCol = aRange.aEnd.Col(); SCROW nStartRow = aRange.aStart.Row(); @@ -1294,9 +1293,9 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) // For date recognition ::utl::TransliterationWrapper aTransliteration( - pDoc->GetServiceManager(), SC_TRANSLITERATION_IGNORECASE ); + comphelper::getComponentContext(pDoc->GetServiceManager()), SC_TRANSLITERATION_IGNORECASE ); aTransliteration.loadModuleIfNeeded( eDocLang ); - CalendarWrapper aCalendar( pDoc->GetServiceManager() ); + CalendarWrapper aCalendar( comphelper::getComponentContext(pDoc->GetServiceManager()) ); aCalendar.loadDefaultCalendar( MsLangId::convertLanguageToLocale( eDocLang ) ); ::utl::TransliterationWrapper* pEnglishTransliteration = NULL; @@ -1304,9 +1303,9 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) if ( eDocLang != LANGUAGE_ENGLISH_US ) { pEnglishTransliteration = new ::utl::TransliterationWrapper ( - pDoc->GetServiceManager(), SC_TRANSLITERATION_IGNORECASE ); + comphelper::getComponentContext(pDoc->GetServiceManager()), SC_TRANSLITERATION_IGNORECASE ); aTransliteration.loadModuleIfNeeded( LANGUAGE_ENGLISH_US ); - pEnglishCalendar = new CalendarWrapper ( pDoc->GetServiceManager() ); + pEnglishCalendar = new CalendarWrapper ( comphelper::getComponentContext(pDoc->GetServiceManager()) ); pEnglishCalendar->loadDefaultCalendar( MsLangId::convertLanguageToLocale( LANGUAGE_ENGLISH_US ) ); } diff --git a/sc/source/ui/docshell/macromgr.cxx b/sc/source/ui/docshell/macromgr.cxx index f873b8c26942..40bdb2ef40d9 100644 --- a/sc/source/ui/docshell/macromgr.cxx +++ b/sc/source/ui/docshell/macromgr.cxx @@ -143,12 +143,14 @@ void ScMacroManager::InitUserFuncData() { // Clear boost::unordered_map mhFuncToVolatile.clear(); - String sProjectName( RTL_CONSTASCII_USTRINGPARAM("Standard") ); + OUString sProjectName("Standard"); Reference< container::XContainer > xModuleContainer; SfxObjectShell* pShell = mpDoc->GetDocumentShell(); - if ( pShell && pShell->GetBasicManager()->GetName().Len() > 0 ) + if (pShell && !pShell->GetBasicManager()->GetName().isEmpty()) + { sProjectName = pShell->GetBasicManager()->GetName(); + } try { Reference< script::XLibraryContainer > xLibraries( pShell->GetBasicContainer(), uno::UNO_QUERY_THROW ); diff --git a/sc/source/ui/docshell/olinefun.cxx b/sc/source/ui/docshell/olinefun.cxx index 667daf3c14fc..aa032110ef8f 100644 --- a/sc/source/ui/docshell/olinefun.cxx +++ b/sc/source/ui/docshell/olinefun.cxx @@ -383,8 +383,6 @@ sal_Bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, sal_Bool bColumns, sal_uInt1 bColumns, nLevel ) ); } - pDoc->IncSizeRecalcLevel( nTab ); - pDoc->InitializeNoteCaptions(nTab); ScSubOutlineIterator aIter( pArray ); // alle Eintraege ScOutlineEntry* pEntry; @@ -426,7 +424,6 @@ sal_Bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, sal_Bool bColumns, sal_uInt1 } } - pDoc->DecSizeRecalcLevel( nTab ); pDoc->SetDrawPageSize(nTab); pDoc->UpdatePageBreaks( nTab ); @@ -481,7 +478,7 @@ sal_Bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, sal_Bool b pUndoDoc, pUndoTab, sal_True ) ); } - pDoc->IncSizeRecalcLevel( nTab ); + pDoc->InitializeNoteCaptions(nTab); // Spalten @@ -534,7 +531,6 @@ sal_Bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, sal_Bool b i = nFilterEnd; } - pDoc->DecSizeRecalcLevel( nTab ); pDoc->SetDrawPageSize(nTab); pDoc->UpdatePageBreaks( nTab ); @@ -601,7 +597,7 @@ sal_Bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, sal_Bool b pUndoDoc, pUndoTab, false ) ); } - pDoc->IncSizeRecalcLevel( nTab ); + pDoc->InitializeNoteCaptions(nTab); // Spalten @@ -629,7 +625,7 @@ sal_Bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, sal_Bool b HideOutline( nTab, false, nRowLevel, i, false, false, bApi ); } - pDoc->DecSizeRecalcLevel( nTab ); + pDoc->SetDrawPageSize(nTab); pDoc->UpdatePageBreaks( nTab ); rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PAINT_GRID | PAINT_LEFT | PAINT_TOP ); @@ -680,8 +676,6 @@ sal_Bool ScOutlineDocFunc::ShowOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1 bColumns, nLevel, nEntry, sal_True ) ); } - pDoc->IncSizeRecalcLevel( nTab ); - pDoc->InitializeNoteCaptions(nTab); pEntry->SetHidden(false); SCCOLROW i; @@ -767,8 +761,6 @@ sal_Bool ScOutlineDocFunc::HideOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1 bColumns, nLevel, nEntry, false ) ); } - pDoc->IncSizeRecalcLevel( nTab ); - pDoc->InitializeNoteCaptions(nTab); pEntry->SetHidden(true); SCCOLROW i; @@ -780,7 +772,6 @@ sal_Bool ScOutlineDocFunc::HideOutline( SCTAB nTab, sal_Bool bColumns, sal_uInt1 pArray->SetVisibleBelow( nLevel, nEntry, false ); - pDoc->DecSizeRecalcLevel( nTab ); pDoc->SetDrawPageSize(nTab); pDoc->InvalidatePageBreaks(nTab); pDoc->UpdatePageBreaks( nTab ); diff --git a/sc/source/ui/inc/acredlin.hxx b/sc/source/ui/inc/acredlin.hxx index 385c969f2ad6..fd2ed6bdf159 100644 --- a/sc/source/ui/inc/acredlin.hxx +++ b/sc/source/ui/inc/acredlin.hxx @@ -181,31 +181,31 @@ protected: rtl::OUString* MakeTypeString(ScChangeActionType eType); - SvLBoxEntry* InsertChangeAction( + SvTreeListEntry* InsertChangeAction( const ScChangeAction* pScChangeAction,ScChangeActionState eState, - SvLBoxEntry* pParent=NULL,bool bDelMaster = false, + SvTreeListEntry* pParent=NULL,bool bDelMaster = false, bool bDisabled = false,sal_uLong nPos = LIST_APPEND); - SvLBoxEntry* InsertFilteredAction( + SvTreeListEntry* InsertFilteredAction( const ScChangeAction* pScChangeAction,ScChangeActionState eState, - SvLBoxEntry* pParent = NULL,bool bDelMaster = false, + SvTreeListEntry* pParent = NULL,bool bDelMaster = false, bool bDisabled = false, sal_uLong nPos = LIST_APPEND); - SvLBoxEntry* InsertChangeActionContent(const ScChangeActionContent* pScChangeAction, - SvLBoxEntry* pParent,sal_uLong nSpecial); + SvTreeListEntry* InsertChangeActionContent(const ScChangeActionContent* pScChangeAction, + SvTreeListEntry* pParent,sal_uLong nSpecial); void GetDependents( const ScChangeAction* pScChangeAction, ScChangeActionMap& aActionMap, - SvLBoxEntry* pEntry); + SvTreeListEntry* pEntry); - bool InsertContentChildren( ScChangeActionMap* pActionMap, SvLBoxEntry* pParent ); + bool InsertContentChildren( ScChangeActionMap* pActionMap, SvTreeListEntry* pParent ); - bool InsertAcceptedORejected(SvLBoxEntry* pParent); + bool InsertAcceptedORejected(SvTreeListEntry* pParent); bool InsertDeletedChildren( const ScChangeAction* pChangeAction, ScChangeActionMap* pActionMap, - SvLBoxEntry* pParent); + SvTreeListEntry* pParent); - bool InsertChildren( ScChangeActionMap* pActionMap, SvLBoxEntry* pParent ); + bool InsertChildren( ScChangeActionMap* pActionMap, SvTreeListEntry* pParent ); void AppendChanges(ScChangeTrack* pChanges,sal_uLong nStartAction, sal_uLong nEndAction, sal_uLong nPos=LIST_APPEND); @@ -217,7 +217,7 @@ protected: void ClearView(); bool Expand(ScChangeTrack* pChanges,const ScChangeAction* pScChangeAction, - SvLBoxEntry* pEntry, bool bFilter = false); + SvTreeListEntry* pEntry, bool bFilter = false); public: ScAcceptChgDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx index 247edc018a24..8b66f68f2a05 100644 --- a/sc/source/ui/inc/anyrefdg.hxx +++ b/sc/source/ui/inc/anyrefdg.hxx @@ -62,7 +62,7 @@ class ScFormulaReferenceHelper SfxBindings* m_pBindings; ::std::auto_ptr<Accelerator> pAccel; // for Enter/Escape - sal_Bool* pHiddenMarks; // Mark field for hidden Controls + bool* pHiddenMarks; // Mark field for hidden Controls SCTAB nRefTab; // used for ShowReference String sOldDialogText; // Original title of the dialog window @@ -72,9 +72,9 @@ class ScFormulaReferenceHelper Point aOldButtonPos; // Original position of the button Window* mpOldEditParent; // Original parent of the edit field and the button - sal_Bool bEnableColorRef; - sal_Bool bHighLightRef; - sal_Bool bAccInserted; + bool bEnableColorRef; + bool bHighLightRef; + bool bAccInserted; DECL_LINK( AccelSelectHdl, Accelerator* ); @@ -89,25 +89,25 @@ public: void ShowReference( const XubString& rStr ); void ReleaseFocus( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL ); - void HideReference( sal_Bool bDoneRefMode = sal_True ); + void HideReference( bool bDoneRefMode = true ); void RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL ); - void RefInputDone( sal_Bool bForced = false ); + void RefInputDone( bool bForced = false ); void ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL ); inline void SetWindow(Window* _pWindow) { m_pWindow = _pWindow; } - sal_Bool DoClose( sal_uInt16 nId ); - void SetDispatcherLock( sal_Bool bLock ); - void EnableSpreadsheets( sal_Bool bFlag = sal_True, sal_Bool bChildren = sal_True ); + bool DoClose( sal_uInt16 nId ); + void SetDispatcherLock( bool bLock ); + void EnableSpreadsheets( bool bFlag = true, bool bChildren = true ); void ViewShellChanged( ScTabViewShell* pScViewShell ); - static void enableInput(sal_Bool _bInput); + static void enableInput(bool _bInput); protected: Window * GetWindow(){ return m_pWindow; } public: bool CanInputStart( const formula::RefEdit *pEdit ){ return !!pEdit; } - bool CanInputDone( sal_Bool bForced ){ return pRefEdit && (bForced || !pRefBtn); } + bool CanInputDone( bool bForced ){ return pRefEdit && (bForced || !pRefBtn); } }; //============================================================================ @@ -139,7 +139,7 @@ private: protected: virtual sal_Bool DoClose( sal_uInt16 nId ); - void SetDispatcherLock( sal_Bool bLock ); + void SetDispatcherLock( bool bLock ); //Overwrite TWindow will implemented by ScRefHdlrImplBase //virtual long PreNotify( NotifyEvent& rNEvt ); diff --git a/sc/source/ui/inc/colorformat.hxx b/sc/source/ui/inc/colorformat.hxx index 3c58131a411d..13bb74bcf978 100644 --- a/sc/source/ui/inc/colorformat.hxx +++ b/sc/source/ui/inc/colorformat.hxx @@ -75,7 +75,6 @@ private: void Init(); public: - ScDataBarSettingsDlg(Window* pParent, ScDocument* pDoc, const ScAddress& rPos); ScDataBarSettingsDlg(Window* pParent, const ScDataBarFormatData& rData, ScDocument* pDoc, const ScAddress& rPos); ScDataBarFormatData* GetData(); diff --git a/sc/source/ui/inc/condformathelper.hxx b/sc/source/ui/inc/condformathelper.hxx index 297d032d88ad..c674df4fcf64 100644 --- a/sc/source/ui/inc/condformathelper.hxx +++ b/sc/source/ui/inc/condformathelper.hxx @@ -18,6 +18,7 @@ enum ScCondFormatEntryType COLORSCALE, DATABAR, FORMULA, + ICONSET, COLLAPSED }; diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx index 5b0d1e8a9f82..cb41d20b0900 100644 --- a/sc/source/ui/inc/condformatmgr.hxx +++ b/sc/source/ui/inc/condformatmgr.hxx @@ -51,7 +51,7 @@ private: ScDocument* mpDoc; ScConditionalFormatList* mpFormatList; const ScAddress& mrPos; - std::map<SvLBoxEntry*, sal_Int32> maMapLBoxEntryToCondIndex; + std::map<SvTreeListEntry*, sal_Int32> maMapLBoxEntryToCondIndex; DECL_LINK( HeaderEndDragHdl, void* ); diff --git a/sc/source/ui/inc/conflictsdlg.hxx b/sc/source/ui/inc/conflictsdlg.hxx index b2b3739c355e..00c050c1c45a 100644 --- a/sc/source/ui/inc/conflictsdlg.hxx +++ b/sc/source/ui/inc/conflictsdlg.hxx @@ -178,7 +178,7 @@ private: String GetActionString( const ScChangeAction* pAction, ScDocument* pDoc ); void HandleListBoxSelection( bool bSelectHandle ); - void SetConflictAction( SvLBoxEntry* pRootEntry, ScConflictAction eConflictAction ); + void SetConflictAction( SvTreeListEntry* pRootEntry, ScConflictAction eConflictAction ); void KeepHandler( bool bMine ); void KeepAllHandler( bool bMine ); diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx index f6f757fc783f..08722981ddee 100644 --- a/sc/source/ui/inc/content.hxx +++ b/sc/source/ui/inc/content.hxx @@ -56,7 +56,7 @@ class ScContentTree : public SvTreeListBox { ScNavigatorDlg* pParentWindow; ImageList aEntryImages; - SvLBoxEntry* pRootNodes[SC_CONTENT_COUNT]; + SvTreeListEntry* pRootNodes[SC_CONTENT_COUNT]; sal_uInt16 nRootType; // set as Root String aManualDoc; // Switched in Navigator (Title) sal_Bool bHiddenDoc; // Hidden active? @@ -97,12 +97,12 @@ class ScContentTree : public SvTreeListBox @param rnRootIndex Root index of specified entry is returned. @param rnChildIndex Index of the entry inside its root is returned (or SC_CONTENT_NOCHILD if entry is root). @param pEntry The entry to examine. */ - void GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChildIndex, SvLBoxEntry* pEntry ) const; + void GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChildIndex, SvTreeListEntry* pEntry ) const; /** Returns the child index of the specified listbox entry. @param pEntry The entry to examine or NULL for the selected entry. @return Index of the entry inside its root or SC_CONTENT_NOCHILD if entry is root. */ - sal_uLong GetChildIndex( SvLBoxEntry* pEntry ) const; + sal_uLong GetChildIndex( SvTreeListEntry* pEntry ) const; void DoDrag(); diff --git a/sc/source/ui/inc/iconsets.hrc b/sc/source/ui/inc/iconsets.hrc new file mode 100644 index 000000000000..2173fd2da289 --- /dev/null +++ b/sc/source/ui/inc/iconsets.hrc @@ -0,0 +1,31 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + + +#define BMP_GREEN_CIRCLE 999 +#define BMP_YELLOW_CIRCLE 998 +#define BMP_RED_CIRCLE 997 +#define BMP_BLACK_CIRCLE 991 +#define BMP_BLACK_CIRCLE_EMPTY 990 +#define BMP_BLACK_CIRCLE_HALF 989 +#define BMP_BLACK_CIRCLE_1_4TH 988 +#define BMP_BLACK_CIRCLE_3_4TH 987 +#define BMP_ARROW_GREEN_UP 996 +#define BMP_ARROW_RED_DOWN 995 +#define BMP_ARROW_YELLOW_RIGHT 994 +#define BMP_ARROW_YELLOW_UP_RIGHT 993 +#define BMP_ARROW_YELLOW_DOWN_RIGHT 992 +#define BMP_GREEN_TRIANGLE_UP 986 +#define BMP_BLACK_MINUS 985 +#define BMP_RED_TRIANGLE_DOWN 984 +#define BMP_SIGN 983 +#define BMP_EXCLAMATION_MARK 982 +#define BMP_CANCEL 981 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/namemgrtable.hxx b/sc/source/ui/inc/namemgrtable.hxx index 3646164a7d5e..f4c37c89ce59 100644 --- a/sc/source/ui/inc/namemgrtable.hxx +++ b/sc/source/ui/inc/namemgrtable.hxx @@ -71,10 +71,10 @@ private: // for performance, save which entries already have the formula entry // otherwise opening the dialog with a lot of range names is extremelly slow because // we would calculate all formula strings during opening - std::map<SvLBoxEntry*, bool> maCalculatedFormulaEntries; + std::map<SvTreeListEntry*, bool> maCalculatedFormulaEntries; const ScAddress maPos; - void GetLine(ScRangeNameLine& aLine, SvLBoxEntry* pEntry); + void GetLine(ScRangeNameLine& aLine, SvTreeListEntry* pEntry); void Init(); void CheckForFormulaString(); const ScRangeData* findRangeData(const ScRangeNameLine& rLine); diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index 4d2a540966af..218c506b4fb5 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -192,7 +192,7 @@ private: void UpdateVarZoom(); static void SetScrollBar( ScrollBar& rScroll, long nRangeMax, long nVisible, long nPos, bool bLayoutRTL ); - static long GetScrollBarPos( ScrollBar& rScroll, bool bLayoutRTL ); + static long GetScrollBarPos( ScrollBar& rScroll ); void GetPageMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, SCsCOL& rPageX, SCsROW& rPageY); void GetAreaMoveEndPosition(SCsCOL nMovX, SCsROW nMovY, ScFollowMode eMode, diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx index e8c208acdba6..b6fb49390fbd 100644 --- a/sc/source/ui/inc/tpsort.hxx +++ b/sc/source/ui/inc/tpsort.hxx @@ -69,11 +69,9 @@ public: virtual void Reset ( const SfxItemSet& rArgSet ); protected: -// for data exchange (TODO: should be changed!) -// virtual void ActivatePage ( const SfxItemSet& rSet ); + virtual void ActivatePage ( const SfxItemSet& rSet ); using SfxTabPage::ActivatePage; using SfxTabPage::DeactivatePage; - virtual void ActivatePage (); virtual int DeactivatePage ( SfxItemSet* pSet = 0); private: @@ -130,11 +128,9 @@ public: virtual void Reset ( const SfxItemSet& rArgSet ); protected: -// for data exchange (TODO: should be changed!) -// virtual void ActivatePage ( const SfxItemSet& rSet ); + virtual void ActivatePage ( const SfxItemSet& rSet ); using SfxTabPage::ActivatePage; using SfxTabPage::DeactivatePage; - virtual void ActivatePage (); virtual int DeactivatePage ( SfxItemSet* pSet = 0); private: diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index 326e80f7f8fa..dfc0f93ec620 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -178,7 +178,7 @@ ScAcceptChgDlg::ScAcceptChgDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pP aAcceptChgCtr.SetMinSizeHdl( LINK( this, ScAcceptChgDlg, MinSizeHandle )); UpdateView(); - SvLBoxEntry* pEntry=pTheView->First(); + SvTreeListEntry* pEntry=pTheView->First(); if(pEntry!=NULL) { pTheView->Select(pEntry); @@ -376,15 +376,15 @@ bool ScAcceptChgDlg::IsValidAction(const ScChangeAction* pScChangeAction) return bFlag; } -SvLBoxEntry* ScAcceptChgDlg::InsertChangeAction( +SvTreeListEntry* ScAcceptChgDlg::InsertChangeAction( const ScChangeAction* pScChangeAction, ScChangeActionState /*eState*/, - SvLBoxEntry* pParent, bool bDelMaster,bool bDisabled, sal_uLong nPos) + SvTreeListEntry* pParent, bool bDelMaster,bool bDisabled, sal_uLong nPos) { ScChangeTrack* pChanges=pDoc->GetChangeTrack(); if(pScChangeAction==NULL || pChanges==NULL) return NULL; - SvLBoxEntry* pEntry=NULL; + SvTreeListEntry* pEntry=NULL; bool bFlag = false; @@ -509,11 +509,11 @@ SvLBoxEntry* ScAcceptChgDlg::InsertChangeAction( { pEntry = pTheView->InsertEntry( aBuf.makeStringAndClear(), pNewData, Color(COL_GREEN), pParent, nPos); - SvLBoxEntry* pExpEntry=pParent; + SvTreeListEntry* pExpEntry=pParent; while(pExpEntry!=NULL && !pTheView->IsExpanded(pExpEntry)) { - SvLBoxEntry* pTmpEntry=pTheView->GetParent(pExpEntry); + SvTreeListEntry* pTmpEntry=pTheView->GetParent(pExpEntry); if(pTmpEntry!=NULL) pTheView->Expand(pExpEntry); @@ -528,9 +528,9 @@ SvLBoxEntry* ScAcceptChgDlg::InsertChangeAction( return pEntry; } -SvLBoxEntry* ScAcceptChgDlg::InsertFilteredAction( +SvTreeListEntry* ScAcceptChgDlg::InsertFilteredAction( const ScChangeAction* pScChangeAction, ScChangeActionState eState, - SvLBoxEntry* pParent, bool bDelMaster, bool bDisabled, sal_uLong nPos) + SvTreeListEntry* pParent, bool bDelMaster, bool bDisabled, sal_uLong nPos) { ScChangeTrack* pChanges=pDoc->GetChangeTrack(); @@ -539,7 +539,7 @@ SvLBoxEntry* ScAcceptChgDlg::InsertFilteredAction( bool bIsGenerated = pChanges->IsGenerated(pScChangeAction->GetActionNumber()); - SvLBoxEntry* pEntry=NULL; + SvTreeListEntry* pEntry=NULL; bool bFlag = false; @@ -654,11 +654,11 @@ SvLBoxEntry* ScAcceptChgDlg::InsertFilteredAction( return pEntry; } -SvLBoxEntry* ScAcceptChgDlg::InsertChangeActionContent(const ScChangeActionContent* pScChangeAction, - SvLBoxEntry* pParent, sal_uLong nSpecial) +SvTreeListEntry* ScAcceptChgDlg::InsertChangeActionContent(const ScChangeActionContent* pScChangeAction, + SvTreeListEntry* pParent, sal_uLong nSpecial) { ScChangeTrack* pChanges=pDoc->GetChangeTrack(); - SvLBoxEntry* pEntry=NULL; + SvTreeListEntry* pEntry=NULL; if(pScChangeAction==NULL || pChanges==NULL) return NULL; @@ -799,7 +799,7 @@ long ScAcceptChgDlg::PreNotify( NotifyEvent& rNEvt ) void ScAcceptChgDlg::UpdateView() { bNeedsUpdate=false; - SvLBoxEntry* pParent=NULL; + SvTreeListEntry* pParent=NULL; ScChangeTrack* pChanges=NULL; const ScChangeAction* pScChangeAction=NULL; bAcceptEnableFlag=true; @@ -878,19 +878,19 @@ void ScAcceptChgDlg::UpdateView() { pParent=pTheView->InsertEntry( aStrAllAccepted, static_cast< RedlinData * >(NULL), - static_cast< SvLBoxEntry * >(NULL)); + static_cast< SvTreeListEntry * >(NULL)); pParent->EnableChildrenOnDemand(true); } if(nRejectCount>0) { pParent=pTheView->InsertEntry( aStrAllRejected, static_cast< RedlinData * >(NULL), - static_cast< SvLBoxEntry * >(NULL)); + static_cast< SvTreeListEntry * >(NULL)); pParent->EnableChildrenOnDemand(true); } pTheView->SetUpdateMode(true); SetPointer(Pointer(POINTER_ARROW)); - SvLBoxEntry* pEntry=pTheView->First(); + SvTreeListEntry* pEntry=pTheView->First(); if(pEntry!=NULL) pTheView->Select(pEntry); } @@ -998,7 +998,7 @@ IMPL_LINK( ScAcceptChgDlg, RejectHandle, SvxTPView*, pRef ) if(pRef!=NULL) { - SvLBoxEntry* pEntry=pTheView->FirstSelected(); + SvTreeListEntry* pEntry=pTheView->FirstSelected(); while(pEntry!=NULL) { ScRedlinData *pEntryData=(ScRedlinData *)(pEntry->GetUserData()); @@ -1035,7 +1035,7 @@ IMPL_LINK( ScAcceptChgDlg, AcceptHandle, SvxTPView*, pRef ) bIgnoreMsg=true; if(pRef!=NULL) { - SvLBoxEntry* pEntry=pTheView->FirstSelected(); + SvTreeListEntry* pEntry=pTheView->FirstSelected(); while(pEntry!=NULL) { ScRedlinData *pEntryData=(ScRedlinData *)(pEntry->GetUserData()); @@ -1172,11 +1172,11 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, SelectHandle) void ScAcceptChgDlg::GetDependents( const ScChangeAction* pScChangeAction, ScChangeActionMap& aActionMap, - SvLBoxEntry* pEntry) + SvTreeListEntry* pEntry) { ScChangeTrack* pChanges=pDoc->GetChangeTrack(); - SvLBoxEntry* pParent=pTheView->GetParent(pEntry); + SvTreeListEntry* pParent=pTheView->GetParent(pEntry); if(pParent!=NULL) { ScRedlinData *pParentData=(ScRedlinData *)(pParent->GetUserData()); @@ -1194,7 +1194,7 @@ void ScAcceptChgDlg::GetDependents( const ScChangeAction* pScChangeAction, aActionMap, pScChangeAction->IsMasterDelete() ); } -bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap,SvLBoxEntry* pParent) +bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap,SvTreeListEntry* pParent) { bool bTheTestFlag = true; ScRedlinData *pEntryData=(ScRedlinData *)(pParent->GetUserData()); @@ -1212,7 +1212,7 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap,SvLBoxE const_cast<ScChangeAction*>( pScChangeAction ) ) ); bParentInserted = true; } - SvLBoxEntry* pEntry=NULL; + SvTreeListEntry* pEntry=NULL; ScChangeActionMap::iterator itChangeAction = pActionMap->begin(); while( itChangeAction != pActionMap->end() ) @@ -1225,7 +1225,7 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap,SvLBoxE if( itChangeAction == pActionMap->end() ) return true; - SvLBoxEntry* pOriginal = InsertChangeActionContent( + SvTreeListEntry* pOriginal = InsertChangeActionContent( dynamic_cast<const ScChangeActionContent*>( itChangeAction->second ), pParent, RD_SPECIAL_CONTENT ); @@ -1273,7 +1273,7 @@ bool ScAcceptChgDlg::InsertContentChildren(ScChangeActionMap* pActionMap,SvLBoxE } -bool ScAcceptChgDlg::InsertAcceptedORejected(SvLBoxEntry* pParent) +bool ScAcceptChgDlg::InsertAcceptedORejected(SvTreeListEntry* pParent) { ScChangeTrack* pChanges=pDoc->GetChangeTrack(); bool bTheTestFlag = true; @@ -1301,11 +1301,11 @@ bool ScAcceptChgDlg::InsertAcceptedORejected(SvLBoxEntry* pParent) return bTheTestFlag; } -bool ScAcceptChgDlg::InsertChildren(ScChangeActionMap* pActionMap,SvLBoxEntry* pParent) +bool ScAcceptChgDlg::InsertChildren(ScChangeActionMap* pActionMap,SvTreeListEntry* pParent) { ScChangeTrack* pChanges=pDoc->GetChangeTrack(); bool bTheTestFlag = true; - SvLBoxEntry* pEntry=NULL; + SvTreeListEntry* pEntry=NULL; ScChangeActionMap::iterator itChangeAction; for( itChangeAction = pActionMap->begin(); itChangeAction != pActionMap->end(); ++itChangeAction ) @@ -1329,11 +1329,11 @@ bool ScAcceptChgDlg::InsertChildren(ScChangeActionMap* pActionMap,SvLBoxEntry* p } bool ScAcceptChgDlg::InsertDeletedChildren(const ScChangeAction* pScChangeAction, - ScChangeActionMap* pActionMap,SvLBoxEntry* pParent) + ScChangeActionMap* pActionMap,SvTreeListEntry* pParent) { ScChangeTrack* pChanges=pDoc->GetChangeTrack(); bool bTheTestFlag = true; - SvLBoxEntry* pEntry=NULL; + SvTreeListEntry* pEntry=NULL; ScChangeActionMap::iterator itChangeAction; for( itChangeAction = pActionMap->begin(); itChangeAction != pActionMap->end(); ++itChangeAction ) @@ -1362,7 +1362,7 @@ bool ScAcceptChgDlg::InsertDeletedChildren(const ScChangeAction* pScChangeAction bool ScAcceptChgDlg::Expand( ScChangeTrack* pChanges, const ScChangeAction* pScChangeAction, - SvLBoxEntry* pEntry, bool bFilter) + SvTreeListEntry* pEntry, bool bFilter) { bool bTheTestFlag = true; @@ -1408,7 +1408,7 @@ IMPL_LINK( ScAcceptChgDlg, ExpandingHandle, SvxRedlinTable*, pTable ) if(pTable!=NULL && pChanges!=NULL) { ScChangeActionMap aActionMap; - SvLBoxEntry* pEntry=pTheView->GetHdlEntry(); + SvTreeListEntry* pEntry=pTheView->GetHdlEntry(); if(pEntry!=NULL) { ScRedlinData *pEntryData=(ScRedlinData *)(pEntry->GetUserData()); @@ -1469,7 +1469,7 @@ void ScAcceptChgDlg::AppendChanges(ScChangeTrack* pChanges,sal_uLong nStartActio { if(pChanges!=NULL) { - SvLBoxEntry* pParent=NULL; + SvTreeListEntry* pParent=NULL; const ScChangeAction* pScChangeAction=NULL; bAcceptEnableFlag=true; bRejectEnableFlag=true; @@ -1551,7 +1551,7 @@ void ScAcceptChgDlg::RemoveEntrys(sal_uLong nStartAction,sal_uLong nEndAction) pTheView->SetUpdateMode(false); - SvLBoxEntry* pEntry=pTheView->GetCurEntry(); + SvTreeListEntry* pEntry=pTheView->GetCurEntry(); ScRedlinData *pEntryData=NULL; @@ -1581,7 +1581,7 @@ void ScAcceptChgDlg::RemoveEntrys(sal_uLong nStartAction,sal_uLong nEndAction) } - SvLBoxEntry* pPrevEntry = pTheView->Prev(pEntry); + SvTreeListEntry* pPrevEntry = pTheView->Prev(pEntry); if(bRemove) pTheView->RemoveEntry(pEntry); @@ -1600,9 +1600,9 @@ void ScAcceptChgDlg::UpdateEntrys(ScChangeTrack* pChgTrack, sal_uLong nStartActi bool bRemove = false; - SvLBoxEntry* pEntry=pTheView->First(); - SvLBoxEntry* pNextEntry = (pEntry ? pTheView->NextSibling(pEntry) : NULL); - SvLBoxEntry* pLastEntry=NULL; + SvTreeListEntry* pEntry=pTheView->First(); + SvTreeListEntry* pNextEntry = (pEntry ? pTheView->NextSibling(pEntry) : NULL); + SvTreeListEntry* pLastEntry=NULL; while(pEntry!=NULL) { bRemove=false; @@ -1712,7 +1712,7 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, UpdateSelectionHdl) bool bContMark = false; pTabView->DoneBlockMode(); // clears old marking - SvLBoxEntry* pEntry = pTheView->FirstSelected(); + SvTreeListEntry* pEntry = pTheView->FirstSelected(); while( pEntry ) { ScRedlinData* pEntryData = (ScRedlinData*) pEntry->GetUserData(); @@ -1764,7 +1764,7 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, CommandHdl) aPopup.SetMenuFlags(MENU_FLAG_HIDEDISABLEDENTRIES); - SvLBoxEntry* pEntry=pTheView->GetCurEntry(); + SvTreeListEntry* pEntry=pTheView->GetCurEntry(); if(pEntry!=NULL) { pTheView->Select(pEntry); @@ -1944,8 +1944,8 @@ IMPL_LINK( ScAcceptChgDlg, ColCompareHdl, SvSortData*, pSortData ) if(pSortData) { - SvLBoxEntry* pLeft = (SvLBoxEntry*)(pSortData->pLeft ); - SvLBoxEntry* pRight = (SvLBoxEntry*)(pSortData->pRight ); + SvTreeListEntry* pLeft = (SvTreeListEntry*)(pSortData->pLeft ); + SvTreeListEntry* pRight = (SvTreeListEntry*)(pSortData->pRight ); if(CALC_DATE==nSortCol) { diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 8ebb1c3e21ca..3b4e9a485ac6 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -76,14 +76,14 @@ ScFormulaReferenceHelper::~ScFormulaReferenceHelper() // common cleanup for ScAnyRefDlg and ScFormulaDlg is done here HideReference(); - enableInput( sal_True ); + enableInput( true ); ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl(); if ( pInputHdl ) pInputHdl->ResetDelayTimer(); // stop the timer for disabling the input line } // ----------------------------------------------------------------------------- -void ScFormulaReferenceHelper::enableInput( sal_Bool bEnable ) +void ScFormulaReferenceHelper::enableInput( bool bEnable ) { TypeId aType(TYPE(ScDocShell)); ScDocShell* pDocShell = (ScDocShell*)SfxObjectShell::GetFirst(&aType); @@ -105,8 +105,8 @@ void ScFormulaReferenceHelper::enableInput( sal_Bool bEnable ) Window *pParent=pWin->GetParent(); if(pParent) { - pParent->EnableInput(bEnable,sal_True /* sal_False */); - if(sal_True /*bChildren*/) + pParent->EnableInput(bEnable,true /* sal_False */); + if(true /*bChildren*/) pViewSh->EnableRefInput(bEnable); } } @@ -123,7 +123,7 @@ void ScFormulaReferenceHelper::ShowSimpleReference( const XubString& rStr ) { if( bEnableColorRef ) { - bHighLightRef=sal_True; + bHighLightRef=true; ScViewData* pViewData=ScDocShell::GetViewData(); if ( pViewData ) { @@ -183,7 +183,7 @@ void ScFormulaReferenceHelper::ShowFormulaReference( const XubString& rStr ) { if( /*!pRefEdit &&*/ bEnableColorRef) { - bHighLightRef=sal_True; + bHighLightRef=true; ScViewData* pViewData=ScDocShell::GetViewData(); if ( pViewData && pRefComp.get() ) { @@ -208,7 +208,7 @@ void ScFormulaReferenceHelper::ShowFormulaReference( const XubString& rStr ) while(pToken!=NULL) { - sal_Bool bDoubleRef=(pToken->GetType()==formula::svDoubleRef); + bool bDoubleRef=(pToken->GetType()==formula::svDoubleRef); if(pToken->GetType()==formula::svSingleRef || bDoubleRef) @@ -240,7 +240,7 @@ void ScFormulaReferenceHelper::ShowFormulaReference( const XubString& rStr ) } } // ----------------------------------------------------------------------------- -void ScFormulaReferenceHelper::HideReference( sal_Bool bDoneRefMode ) +void ScFormulaReferenceHelper::HideReference( bool bDoneRefMode ) { ScViewData* pViewData=ScDocShell::GetViewData(); @@ -310,7 +310,7 @@ void ScFormulaReferenceHelper::ReleaseFocus( formula::RefEdit* pEdit, formula::R pViewShell->MoveCursorAbs( pRange->aStart.Col(), pRange->aStart.Row(), SC_FOLLOW_JUMP, false, false ); pViewShell->MoveCursorAbs( pRange->aEnd.Col(), - pRange->aEnd.Row(), SC_FOLLOW_JUMP, sal_True, false ); + pRange->aEnd.Row(), SC_FOLLOW_JUMP, true, false ); m_pDlg->SetReference( *pRange, pDoc ); } } @@ -333,7 +333,7 @@ void ScFormulaReferenceHelper::Init() pRefCell.reset( new ScFormulaCell( pDoc, aCursorPos, rStrExp ) ); pRefComp.reset( new ScCompiler( pDoc, aCursorPos) ); pRefComp->SetGrammar( pDoc->GetGrammar() ); - pRefComp->SetCompileForFAP(sal_True); + pRefComp->SetCompileForFAP(true); nRefTab = nTab; } @@ -350,13 +350,13 @@ IMPL_LINK( ScFormulaReferenceHelper, AccelSelectHdl, Accelerator *, pSelAccel ) case KEY_ESCAPE: if( pRefEdit ) pRefEdit->GrabFocus(); - m_pDlg->RefInputDone( sal_True ); + m_pDlg->RefInputDone( true ); break; } - return sal_True; + return true; } //---------------------------------------------------------------------------- -void ScFormulaReferenceHelper::RefInputDone( sal_Bool bForced ) +void ScFormulaReferenceHelper::RefInputDone( bool bForced ) { if ( CanInputDone( bForced ) ) { @@ -428,7 +428,7 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula:: // Alle Elemente ausser EditCell und Button verstecken sal_uInt16 nChildren = m_pWindow->GetChildCount(); - pHiddenMarks = new sal_Bool [nChildren]; + pHiddenMarks = new bool [nChildren]; for (sal_uInt16 i = 0; i < nChildren; i++) { pHiddenMarks[i] = false; @@ -442,7 +442,7 @@ void ScFormulaReferenceHelper::RefInputStart( formula::RefEdit* pEdit, formula:: ; // do nothing else if (pWin->IsVisible()) { - pHiddenMarks[i] = sal_True; + pHiddenMarks[i] = true; pWin->Hide(); } } @@ -498,11 +498,11 @@ void ScFormulaReferenceHelper::ToggleCollapsed( formula::RefEdit* pEdit, formula if( pRefEdit == pEdit ) // is this the active ref edit field? { pRefEdit->GrabFocus(); // before RefInputDone() - m_pDlg->RefInputDone( sal_True ); // finish ref input + m_pDlg->RefInputDone( true ); // finish ref input } else { - m_pDlg->RefInputDone( sal_True ); // another active ref edit? + m_pDlg->RefInputDone( true ); // another active ref edit? m_pDlg->RefInputStart( pEdit, pButton ); // start ref input // pRefEdit might differ from pEdit after RefInputStart() (i.e. ScFormulaDlg) if( pRefEdit ) @@ -511,7 +511,7 @@ void ScFormulaReferenceHelper::ToggleCollapsed( formula::RefEdit* pEdit, formula } } // ----------------------------------------------------------------------------- -sal_Bool ScFormulaReferenceHelper::DoClose( sal_uInt16 nId ) +bool ScFormulaReferenceHelper::DoClose( sal_uInt16 nId ) { SfxApplication* pSfxApp = SFX_APP(); @@ -545,11 +545,11 @@ sal_Bool ScFormulaReferenceHelper::DoClose( sal_uInt16 nId ) ScTabViewShell* pScViewShell = ScTabViewShell::GetActiveViewShell(); if ( pScViewShell ) - pScViewShell->UpdateInputHandler(sal_True); + pScViewShell->UpdateInputHandler(true); - return sal_True; + return true; } -void ScFormulaReferenceHelper::SetDispatcherLock( sal_Bool bLock ) +void ScFormulaReferenceHelper::SetDispatcherLock( bool bLock ) { // lock / unlock only the dispatchers of Calc documents @@ -580,7 +580,7 @@ void ScFormulaReferenceHelper::ViewShellChanged(ScTabViewShell* /* pScViewShell EnableSpreadsheets(); } -void ScFormulaReferenceHelper::EnableSpreadsheets(sal_Bool bFlag, sal_Bool bChildren) +void ScFormulaReferenceHelper::EnableSpreadsheets(bool bFlag, bool bChildren) { TypeId aType(TYPE(ScDocShell)); ScDocShell* pDocShell = (ScDocShell*)SfxObjectShell::GetFirst(&aType); @@ -824,7 +824,7 @@ sal_Bool ScRefHandler::DoClose( sal_uInt16 nId ) return sal_True; } -void ScRefHandler::SetDispatcherLock( sal_Bool bLock ) +void ScRefHandler::SetDispatcherLock( bool bLock ) { m_aHelper.SetDispatcherLock( bLock ); } diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx index 58d20e24611f..ada696d07441 100644 --- a/sc/source/ui/miscdlgs/conflictsdlg.cxx +++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx @@ -460,7 +460,7 @@ ScConflictsDlg::ScConflictsDlg( Window* pParent, ScViewData* pViewData, ScDocume UpdateView(); - SvLBoxEntry* pEntry = maLbConflicts.First(); + SvTreeListEntry* pEntry = maLbConflicts.First(); if ( pEntry != NULL ) { maLbConflicts.Select( pEntry ); @@ -519,7 +519,7 @@ String ScConflictsDlg::GetActionString( const ScChangeAction* pAction, ScDocumen void ScConflictsDlg::HandleListBoxSelection( bool bSelectHandle ) { - SvLBoxEntry* pSelEntry = maLbConflicts.GetCurEntry(); + SvTreeListEntry* pSelEntry = maLbConflicts.GetCurEntry(); if ( !pSelEntry ) { pSelEntry = maLbConflicts.FirstSelected(); @@ -529,7 +529,7 @@ void ScConflictsDlg::HandleListBoxSelection( bool bSelectHandle ) return; } - SvLBoxEntry* pRootEntry = maLbConflicts.GetRootLevelParent( pSelEntry ); + SvTreeListEntry* pRootEntry = maLbConflicts.GetRootLevelParent( pSelEntry ); if ( pRootEntry ) { if ( bSelectHandle ) @@ -540,7 +540,7 @@ void ScConflictsDlg::HandleListBoxSelection( bool bSelectHandle ) { maLbConflicts.Select( pRootEntry ); } - SvLBoxEntry* pEntry = maLbConflicts.FirstChild( pRootEntry ); + SvTreeListEntry* pEntry = maLbConflicts.FirstChild( pRootEntry ); while ( pEntry ) { if ( !maLbConflicts.IsSelected( pEntry ) ) @@ -591,7 +591,7 @@ IMPL_LINK_NOARG(ScConflictsDlg, UpdateSelectionHdl) ScTabView* pTabView = mpViewData->GetView(); pTabView->DoneBlockMode(); sal_Bool bContMark = false; - SvLBoxEntry* pEntry = maLbConflicts.FirstSelected(); + SvTreeListEntry* pEntry = maLbConflicts.FirstSelected(); while ( pEntry ) { if ( pEntry != maLbConflicts.GetRootLevelParent( pEntry ) ) @@ -619,7 +619,7 @@ IMPL_LINK_NOARG(ScConflictsDlg, UpdateSelectionHdl) return 0; } -void ScConflictsDlg::SetConflictAction( SvLBoxEntry* pRootEntry, ScConflictAction eConflictAction ) +void ScConflictsDlg::SetConflictAction( SvTreeListEntry* pRootEntry, ScConflictAction eConflictAction ) { RedlinData* pUserData = static_cast< RedlinData* >( pRootEntry ? pRootEntry->GetUserData() : NULL ); ScConflictsListEntry* pConflictEntry = static_cast< ScConflictsListEntry* >( pUserData ? pUserData->pData : NULL ); @@ -631,8 +631,8 @@ void ScConflictsDlg::SetConflictAction( SvLBoxEntry* pRootEntry, ScConflictActio void ScConflictsDlg::KeepHandler( bool bMine ) { - SvLBoxEntry* pEntry = maLbConflicts.FirstSelected(); - SvLBoxEntry* pRootEntry = ( pEntry ? maLbConflicts.GetRootLevelParent( pEntry ) : NULL ); + SvTreeListEntry* pEntry = maLbConflicts.FirstSelected(); + SvTreeListEntry* pRootEntry = ( pEntry ? maLbConflicts.GetRootLevelParent( pEntry ) : NULL ); if ( !pRootEntry ) { return; @@ -650,8 +650,8 @@ void ScConflictsDlg::KeepHandler( bool bMine ) void ScConflictsDlg::KeepAllHandler( bool bMine ) { - SvLBoxEntry* pEntry = maLbConflicts.First(); - SvLBoxEntry* pRootEntry = ( pEntry ? maLbConflicts.GetRootLevelParent( pEntry ) : NULL ); + SvTreeListEntry* pEntry = maLbConflicts.First(); + SvTreeListEntry* pRootEntry = ( pEntry ? maLbConflicts.GetRootLevelParent( pEntry ) : NULL ); if ( !pRootEntry ) { return; @@ -770,7 +770,7 @@ void ScConflictsDlg::UpdateView() { RedlinData* pRootUserData = new RedlinData(); pRootUserData->pData = static_cast< void* >( pConflictEntry ); - SvLBoxEntry* pRootEntry = maLbConflicts.InsertEntry( GetConflictString( *aItr ), pRootUserData ); + SvTreeListEntry* pRootEntry = maLbConflicts.InsertEntry( GetConflictString( *aItr ), pRootUserData ); ScChangeActionList::const_iterator aEndShared = aItr->maSharedActions.end(); for ( ScChangeActionList::const_iterator aItrShared = aItr->maSharedActions.begin(); aItrShared != aEndShared; ++aItrShared ) diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 4465052cbb9f..f86808b00766 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -72,7 +72,7 @@ class ScSolverOptionsString : public SvLBoxString sal_Int32 mnIntValue; public: - ScSolverOptionsString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rStr ) : + ScSolverOptionsString( SvTreeListEntry* pEntry, sal_uInt16 nFlags, const String& rStr ) : SvLBoxString( pEntry, nFlags, rStr ), mbIsDouble( false ), mfDoubleValue( 0.0 ), @@ -85,10 +85,10 @@ public: void SetDoubleValue( double fNew ) { mbIsDouble = true; mfDoubleValue = fNew; } void SetIntValue( sal_Int32 nNew ) { mbIsDouble = false; mnIntValue = nNew; } - virtual void Paint( const Point& rPos, SvTreeListBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry ); + virtual void Paint( const Point& rPos, SvTreeListBox& rDev, sal_uInt16 nFlags, SvTreeListEntry* pEntry ); }; -void ScSolverOptionsString::Paint( const Point& rPos, SvTreeListBox& rDev, sal_uInt16, SvLBoxEntry* /* pEntry */ ) +void ScSolverOptionsString::Paint( const Point& rPos, SvTreeListBox& rDev, sal_uInt16, SvTreeListEntry* /* pEntry */ ) { //! move position? (SvxLinguTabPage: aPos.X() += 20) String aNormalStr( GetText() ); @@ -194,13 +194,13 @@ const uno::Sequence<beans::PropertyValue>& ScSolverOptionsDialog::GetProperties( // update maProperties from list box content // order of entries in list box and maProperties is the same sal_Int32 nEntryCount = maProperties.getLength(); - SvLBoxTreeList* pModel = maLbSettings.GetModel(); + SvTreeList* pModel = maLbSettings.GetModel(); if ( nEntryCount == (sal_Int32)pModel->GetEntryCount() ) { for (sal_Int32 nEntryPos=0; nEntryPos<nEntryCount; ++nEntryPos) { uno::Any& rValue = maProperties[nEntryPos].Value; - SvLBoxEntry* pEntry = pModel->GetEntry(nEntryPos); + SvTreeListEntry* pEntry = pModel->GetEntry(nEntryPos); bool bHasData = false; sal_uInt16 nItemCount = pEntry->ItemCount(); @@ -267,8 +267,8 @@ void ScSolverOptionsDialog::FillListBox() if (!mpCheckButtonData) mpCheckButtonData = new SvLBoxButtonData( &maLbSettings ); - SvLBoxTreeList* pModel = maLbSettings.GetModel(); - SvLBoxEntry* pEntry = NULL; + SvTreeList* pModel = maLbSettings.GetModel(); + SvTreeListEntry* pEntry = NULL; for (sal_Int32 nPos=0; nPos<nCount; nPos++) { @@ -279,7 +279,7 @@ void ScSolverOptionsDialog::FillListBox() if ( eClass == uno::TypeClass_BOOLEAN ) { // check box entry - pEntry = new SvLBoxEntry; + pEntry = new SvTreeListEntry; SvLBoxButton* pButton = new SvLBoxButton( pEntry, SvLBoxButtonKind_enabledCheckbox, 0, mpCheckButtonData ); if ( ScUnoHelpFunctions::GetBoolFromAny( aValue ) ) pButton->SetStateChecked(); @@ -292,7 +292,7 @@ void ScSolverOptionsDialog::FillListBox() else { // value entry - pEntry = new SvLBoxEntry; + pEntry = new SvTreeListEntry; pEntry->AddItem( new SvLBoxString( pEntry, 0, sEmpty ) ); // empty column pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0 ) ); ScSolverOptionsString* pItem = new ScSolverOptionsString( pEntry, 0, aVisName ); @@ -323,7 +323,7 @@ void ScSolverOptionsDialog::ReadFromComponent() void ScSolverOptionsDialog::EditOption() { - SvLBoxEntry* pEntry = maLbSettings.GetCurEntry(); + SvTreeListEntry* pEntry = maLbSettings.GetCurEntry(); if (pEntry) { sal_uInt16 nItemCount = pEntry->ItemCount(); @@ -394,7 +394,7 @@ IMPL_LINK_NOARG(ScSolverOptionsDialog, SettingsSelHdl) { sal_Bool bCheckbox = false; - SvLBoxEntry* pEntry = maLbSettings.GetCurEntry(); + SvTreeListEntry* pEntry = maLbSettings.GetCurEntry(); if (pEntry) { SvLBoxItem* pItem = pEntry->GetFirstItem(SV_ITEM_ID_LBOXBUTTON); diff --git a/sc/source/ui/namedlg/namemgrtable.cxx b/sc/source/ui/namedlg/namemgrtable.cxx index 941002c42250..30f4685633e2 100644 --- a/sc/source/ui/namedlg/namemgrtable.cxx +++ b/sc/source/ui/namedlg/namemgrtable.cxx @@ -107,18 +107,18 @@ ScRangeManagerTable::~ScRangeManagerTable() void ScRangeManagerTable::addEntry(const ScRangeNameLine& rLine, bool bSetCurEntry) { - SvLBoxEntry* pEntry = InsertEntryToColumn( createEntryString(rLine), LIST_APPEND, 0xffff); + SvTreeListEntry* pEntry = InsertEntryToColumn( createEntryString(rLine), LIST_APPEND, 0xffff); if (bSetCurEntry) SetCurEntry(pEntry); } void ScRangeManagerTable::GetCurrentLine(ScRangeNameLine& rLine) { - SvLBoxEntry* pCurrentEntry = GetCurEntry(); + SvTreeListEntry* pCurrentEntry = GetCurEntry(); GetLine(rLine, pCurrentEntry); } -void ScRangeManagerTable::GetLine(ScRangeNameLine& rLine, SvLBoxEntry* pEntry) +void ScRangeManagerTable::GetLine(ScRangeNameLine& rLine, SvTreeListEntry* pEntry) { rLine.aName = GetEntryText( pEntry, 0); rLine.aExpression = GetEntryText(pEntry, 1); @@ -166,9 +166,9 @@ const ScRangeData* ScRangeManagerTable::findRangeData(const ScRangeNameLine& rLi void ScRangeManagerTable::CheckForFormulaString() { - for (SvLBoxEntry* pEntry = GetFirstEntryInView(); pEntry ; pEntry = GetNextEntryInView(pEntry)) + for (SvTreeListEntry* pEntry = GetFirstEntryInView(); pEntry ; pEntry = GetNextEntryInView(pEntry)) { - std::map<SvLBoxEntry*, bool>::const_iterator itr = maCalculatedFormulaEntries.find(pEntry); + std::map<SvTreeListEntry*, bool>::const_iterator itr = maCalculatedFormulaEntries.find(pEntry); if (itr == maCalculatedFormulaEntries.end() || itr->second == false) { ScRangeNameLine aLine; @@ -177,7 +177,7 @@ void ScRangeManagerTable::CheckForFormulaString() rtl::OUString aFormulaString; pData->GetSymbol(aFormulaString, maPos); SetEntryText(aFormulaString, pEntry, 1); - maCalculatedFormulaEntries.insert( std::pair<SvLBoxEntry*, bool>(pEntry, true) ); + maCalculatedFormulaEntries.insert( std::pair<SvTreeListEntry*, bool>(pEntry, true) ); } } @@ -199,13 +199,13 @@ std::vector<ScRangeNameLine> ScRangeManagerTable::GetSelectedEntries() std::vector<ScRangeNameLine> aSelectedEntries; if (GetSelectionCount()) { - for (SvLBoxEntry* pEntry = FirstSelected(); pEntry != LastSelected(); pEntry = NextSelected(pEntry)) + for (SvTreeListEntry* pEntry = FirstSelected(); pEntry != LastSelected(); pEntry = NextSelected(pEntry)) { ScRangeNameLine aLine; GetLine( aLine, pEntry ); aSelectedEntries.push_back(aLine); } - SvLBoxEntry* pEntry = LastSelected(); + SvTreeListEntry* pEntry = LastSelected(); ScRangeNameLine aLine; GetLine( aLine, pEntry ); aSelectedEntries.push_back(aLine); @@ -215,7 +215,7 @@ std::vector<ScRangeNameLine> ScRangeManagerTable::GetSelectedEntries() void ScRangeManagerTable::SetEntry(const ScRangeNameLine& rLine) { - for (SvLBoxEntry* pEntry = First(); pEntry; pEntry = Next(pEntry)) + for (SvTreeListEntry* pEntry = First(); pEntry; pEntry = Next(pEntry)) { if (rLine.aName == rtl::OUString(GetEntryText(pEntry, 0)) && rLine.aScope == rtl::OUString(GetEntryText(pEntry, 2))) diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index aa9cee00238e..14a2d47b3378 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -164,7 +164,7 @@ void ScContentTree::InitRoot( sal_uInt16 nType ) String aName( ScResId( SCSTR_CONTENT_ROOT + nType ) ); // wieder an die richtige Position: sal_uInt16 nPos = nRootType ? 0 : pPosList[nType]-1; - SvLBoxEntry* pNew = InsertEntry( aName, rImage, rImage, NULL, false, nPos ); + SvTreeListEntry* pNew = InsertEntry( aName, rImage, rImage, NULL, false, nPos ); pRootNodes[nType] = pNew; } @@ -182,7 +182,7 @@ void ScContentTree::ClearType(sal_uInt16 nType) ClearAll(); else { - SvLBoxEntry* pParent = pRootNodes[nType]; + SvTreeListEntry* pParent = pRootNodes[nType]; if ( !pParent || GetChildCount(pParent) ) // nicht, wenn ohne Children schon da { if (pParent) @@ -200,7 +200,7 @@ void ScContentTree::InsertContent( sal_uInt16 nType, const String& rValue ) return; } - SvLBoxEntry* pParent = pRootNodes[nType]; + SvTreeListEntry* pParent = pRootNodes[nType]; if (pParent) InsertEntry( rValue, pParent ); else @@ -209,7 +209,7 @@ void ScContentTree::InsertContent( sal_uInt16 nType, const String& rValue ) } } -void ScContentTree::GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChildIndex, SvLBoxEntry* pEntry ) const +void ScContentTree::GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChildIndex, SvTreeListEntry* pEntry ) const { rnRootIndex = SC_CONTENT_ROOT; rnChildIndex = SC_CONTENT_NOCHILD; @@ -217,7 +217,7 @@ void ScContentTree::GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChild if( !pEntry ) return; - SvLBoxEntry* pParent = GetParent( pEntry ); + SvTreeListEntry* pParent = GetParent( pEntry ); bool bFound = false; for( sal_uInt16 nRoot = 1; !bFound && (nRoot < SC_CONTENT_COUNT); ++nRoot ) { @@ -233,7 +233,7 @@ void ScContentTree::GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChild // search the entry in all child entries of the parent sal_uLong nEntry = 0; - SvLBoxEntry* pIterEntry = FirstChild( pParent ); + SvTreeListEntry* pIterEntry = FirstChild( pParent ); while( !bFound && pIterEntry ) { if ( pEntry == pIterEntry ) @@ -250,7 +250,7 @@ void ScContentTree::GetEntryIndexes( sal_uInt16& rnRootIndex, sal_uLong& rnChild } } -sal_uLong ScContentTree::GetChildIndex( SvLBoxEntry* pEntry ) const +sal_uLong ScContentTree::GetChildIndex( SvTreeListEntry* pEntry ) const { sal_uInt16 nRoot; sal_uLong nChild; @@ -279,7 +279,7 @@ IMPL_LINK_NOARG(ScContentTree, ContentDoubleClickHdl) { sal_uInt16 nType; sal_uLong nChild; - SvLBoxEntry* pEntry = GetCurEntry(); + SvTreeListEntry* pEntry = GetCurEntry(); GetEntryIndexes( nType, nChild, pEntry ); if( pEntry && (nType != SC_CONTENT_ROOT) && (nChild != SC_CONTENT_NOCHILD) ) @@ -370,7 +370,7 @@ void ScContentTree::KeyInput( const KeyEvent& rKEvt ) break; case 0: { - SvLBoxEntry* pEntry = GetCurEntry(); + SvTreeListEntry* pEntry = GetCurEntry(); if( pEntry ) { sal_uInt16 nType; @@ -518,12 +518,12 @@ void ScContentTree::RequestHelp( const HelpEvent& rHEvt ) if( rHEvt.GetMode() & HELPMODE_QUICK ) { Point aPos( ScreenToOutputPixel( rHEvt.GetMousePosPixel() )); - SvLBoxEntry* pEntry = GetEntry( aPos ); + SvTreeListEntry* pEntry = GetEntry( aPos ); if ( pEntry ) { sal_Bool bRet = false; String aHelpText; - SvLBoxEntry* pParent = GetParent(pEntry); + SvTreeListEntry* pParent = GetParent(pEntry); if ( !pParent ) // Top-Level ? { aHelpText = String::CreateFromInt32( GetChildCount(pEntry) ); @@ -916,11 +916,11 @@ sal_Bool ScContentTree::NoteStringsChanged() if (!pDoc) return false; - SvLBoxEntry* pParent = pRootNodes[SC_CONTENT_NOTE]; + SvTreeListEntry* pParent = pRootNodes[SC_CONTENT_NOTE]; if (!pParent) return false; - SvLBoxEntry* pEntry = FirstChild( pParent ); + SvTreeListEntry* pEntry = FirstChild( pParent ); bool bEqual = true; SCTAB nTabCount = pDoc->GetTableCount(); @@ -956,11 +956,11 @@ sal_Bool ScContentTree::DrawNamesChanged( sal_uInt16 nType ) if (!pDoc) return false; - SvLBoxEntry* pParent = pRootNodes[nType]; + SvTreeListEntry* pParent = pRootNodes[nType]; if (!pParent) return false; - SvLBoxEntry* pEntry = FirstChild( pParent ); + SvTreeListEntry* pEntry = FirstChild( pParent ); // iterate in flat mode for groups SdrIterMode eIter = ( nType == SC_CONTENT_DRAWING ) ? IM_FLAT : IM_DEEPNOGROUPS; @@ -1120,7 +1120,7 @@ void ScContentTree::DoDrag() sal_uInt16 nType; sal_uLong nChild; - SvLBoxEntry* pEntry = GetCurEntry(); + SvTreeListEntry* pEntry = GetCurEntry(); GetEntryIndexes( nType, nChild, pEntry ); if( pEntry && @@ -1329,10 +1329,10 @@ void ScContentTree::ToggleRoot() // nach Selektion sal_uInt16 nNew = SC_CONTENT_ROOT; if ( nRootType == SC_CONTENT_ROOT ) { - SvLBoxEntry* pEntry = GetCurEntry(); + SvTreeListEntry* pEntry = GetCurEntry(); if (pEntry) { - SvLBoxEntry* pParent = GetParent(pEntry); + SvTreeListEntry* pParent = GetParent(pEntry); for (sal_uInt16 i=1; i<SC_CONTENT_COUNT; i++) if ( pEntry == pRootNodes[i] || pParent == pRootNodes[i] ) nNew = i; @@ -1462,7 +1462,7 @@ void ScContentTree::ApplySettings() // select if( nRootSel == nEntry ) { - SvLBoxEntry* pEntry = NULL; + SvTreeListEntry* pEntry = NULL; if( bExp && (nChildSel != SC_CONTENT_NOCHILD) ) pEntry = GetEntry( pRootNodes[ nEntry ], nChildSel ); Select( pEntry ? pEntry : pRootNodes[ nEntry ] ); diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx index c4df06a4c1a6..2a7d0ef89c79 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.cxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx @@ -42,10 +42,10 @@ public: OptionString(const rtl::OUString& rDesc, const rtl::OUString& rValue) : maDesc(rDesc), maValue(rValue) {} - virtual void Paint(const Point& rPos, SvTreeListBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry); + virtual void Paint(const Point& rPos, SvTreeListBox& rDev, sal_uInt16 nFlags, SvTreeListEntry* pEntry); }; -void OptionString::Paint(const Point& rPos, SvTreeListBox& rDev, sal_uInt16 /*nFlags*/, SvLBoxEntry* /*pEntry*/) +void OptionString::Paint(const Point& rPos, SvTreeListBox& rDev, sal_uInt16 /*nFlags*/, SvTreeListEntry* /*pEntry*/) { Point aPos = rPos; rtl::OUString aDesc = maDesc + rtl::OUString(": "); @@ -135,11 +135,11 @@ void ScCalcOptionsDialog::FillOptionsList() maLbSettings.SetUpdateMode(false); maLbSettings.Clear(); - SvLBoxTreeList* pModel = maLbSettings.GetModel(); + SvTreeList* pModel = maLbSettings.GetModel(); { // Syntax for INDIRECT function. - SvLBoxEntry* pEntry = new SvLBoxEntry; + SvTreeListEntry* pEntry = new SvTreeListEntry; pEntry->AddItem(new SvLBoxString(pEntry, 0, rtl::OUString())); pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, Image(), Image(), 0)); OptionString* pItem = new OptionString( @@ -150,7 +150,7 @@ void ScCalcOptionsDialog::FillOptionsList() { // Treat empty string as zero. - SvLBoxEntry* pEntry = new SvLBoxEntry; + SvTreeListEntry* pEntry = new SvTreeListEntry; pEntry->AddItem(new SvLBoxString(pEntry, 0, rtl::OUString())); pEntry->AddItem(new SvLBoxContextBmp(pEntry, 0, Image(), Image(), 0)); OptionString* pItem = new OptionString( @@ -235,8 +235,8 @@ void ScCalcOptionsDialog::ListOptionValueChanged() maLbSettings.SetUpdateMode(false); - SvLBoxTreeList* pModel = maLbSettings.GetModel(); - SvLBoxEntry* pEntry = pModel->GetEntry(NULL, 0); + SvTreeList* pModel = maLbSettings.GetModel(); + SvTreeListEntry* pEntry = pModel->GetEntry(NULL, 0); if (!pEntry) return; @@ -263,8 +263,8 @@ void ScCalcOptionsDialog::RadioValueChanged() maConfig.mbEmptyStringAsZero = maBtnTrue.IsChecked(); maLbSettings.SetUpdateMode(false); - SvLBoxTreeList* pModel = maLbSettings.GetModel(); - SvLBoxEntry* pEntry = pModel->GetEntry(NULL, 1); + SvTreeList* pModel = maLbSettings.GetModel(); + SvTreeListEntry* pEntry = pModel->GetEntry(NULL, 1); if (!pEntry) return; diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index a4f7428a836d..092b24f6ca52 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -96,6 +96,7 @@ ScTpUserLists::ScTpUserLists( Window* pParent, { SetExchangeSupport(); Init(); + Reset(rCoreAttrs); FreeResource(); } @@ -153,6 +154,7 @@ void ScTpUserLists::Init() aFtCopyFrom.Disable(); aEdCopyFrom.Disable(); } + } // ----------------------------------------------------------------------- diff --git a/sc/source/ui/src/condformatdlg.src b/sc/source/ui/src/condformatdlg.src index 5bd45a05d6ef..8318cc1ebee3 100644 --- a/sc/source/ui/src/condformatdlg.src +++ b/sc/source/ui/src/condformatdlg.src @@ -126,7 +126,7 @@ Control RID_COND_ENTRY ListBox LB_CELLIS_TYPE { Pos = MAP_APPFONT( 90, 15 ); - Size = MAP_APPFONT( 80, 40 ); + Size = MAP_APPFONT( 80, 80 ); Border = TRUE; DropDown = TRUE; StringList [ en-US ] = @@ -141,6 +141,18 @@ Control RID_COND_ENTRY "not between"; "duplicate"; "not duplicate"; + "top 10 elements"; + "bottom 10 elements"; + "top 10 percent"; + "bottom 10 percent"; + "above average"; + "below average"; + "Error"; + "No Error"; + "Begins with"; + "Ends with"; + "Contains"; + "Not Contains"; }; }; Edit ED_VAL1 diff --git a/sc/source/ui/src/globstr.src b/sc/source/ui/src/globstr.src index a58f5b68d292..226bb1ab920d 100644 --- a/sc/source/ui/src/globstr.src +++ b/sc/source/ui/src/globstr.src @@ -1875,6 +1875,10 @@ Resource RID_GLOBSTR { Text [ en-US ] = "DataBar"; }; + String STR_COND_ICONSET + { + Text [ en-US ] = "IconSet"; + }; String STR_COND_BETWEEN { Text [ en-US ] = "between"; @@ -1895,6 +1899,54 @@ Resource RID_GLOBSTR { Text [ en-US ] = "Formula is"; }; + String STR_COND_TOP10 + { + Text [ en-US ] = "Top Elements"; + }; + String STR_COND_BOTTOM10 + { + Text [ en-US ] = "Bottom Elements"; + }; + String STR_COND_TOP_PERCENT + { + Text [ en-US ] = "Top Percent"; + }; + String STR_COND_BOTTOM_PERCENT + { + Text [ en-US ] = "Bottom Percent"; + }; + String STR_COND_ABOVE_AVERAGE + { + Text [ en-US ] = "Above Average"; + }; + String STR_COND_BELOW_AVERAGE + { + Text [ en-US ] = "Below Average"; + }; + String STR_COND_ERROR + { + Text [ en-US ] = "an Error code"; + }; + String STR_COND_NOERROR + { + Text [ en-US ] = "not an Error code"; + }; + String STR_COND_BEGINS_WITH + { + Text [ en-US ] = "Begins with"; + }; + String STR_COND_ENDS_WITH + { + Text [ en-US ] = "Ends with"; + }; + String STR_COND_CONTAINS + { + Text [ en-US ] = "Contains"; + }; + String STR_COND_NOT_CONTAINS + { + Text [ en-US ] = "Not Contains"; + }; String STR_ERR_CONDFORMAT_PROTECTED { Text [ en-US ] = "Conditional Formats can not be created, deleted or changed in protected sheets!"; diff --git a/sc/source/ui/src/iconsets.src b/sc/source/ui/src/iconsets.src new file mode 100644 index 000000000000..4a7df5b314e3 --- /dev/null +++ b/sc/source/ui/src/iconsets.src @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "iconsets.hrc" + +Bitmap BMP_GREEN_CIRCLE +{ + File = "green_circle.png"; +}; +Bitmap BMP_YELLOW_CIRCLE +{ + File = "yellow_circle.png"; +}; +Bitmap BMP_RED_CIRCLE +{ + File = "red_circle.png"; +}; +Bitmap BMP_BLACK_CIRCLE +{ + File = "black_circle_full.png"; +}; +Bitmap BMP_BLACK_CIRCLE_EMPTY +{ + File = "black_circle_empty.png"; +}; +Bitmap BMP_BLACK_CIRCLE_HALF +{ + File = "black_circle_half.png"; +}; +Bitmap BMP_BLACK_CIRCLE_1_4TH +{ + File = "black_circle_1_4th.png"; +}; +Bitmap BMP_BLACK_CIRCLE_3_4TH +{ + File = "black_circle_3_4th.png"; +}; +Bitmap BMP_ARROW_GREEN_UP +{ + File = "green_arrow_up.png"; +}; +Bitmap BMP_ARROW_YELLOW_RIGHT +{ + File = "yellow_arrow_right.png"; +}; +Bitmap BMP_ARROW_RED_DOWN +{ + File = "red_arrow_down.png"; +}; +Bitmap BMP_ARROW_YELLOW_UP_RIGHT +{ + File = "yellow_arrow_up_right.png"; +}; +Bitmap BMP_ARROW_YELLOW_DOWN_RIGHT +{ + File = "yellow_arrow_down_right.png"; +}; +Bitmap BMP_GREEN_TRIANGLE_UP +{ + File = "triangle_up_green.png"; +}; +Bitmap BMP_BLACK_MINUS +{ + File = "minus.png"; +}; +Bitmap BMP_RED_TRIANGLE_DOWN +{ + File = "triangle_down_red.png"; +}; +Bitmap BMP_SIGN +{ + File = "sign.png"; +}; +Bitmap BMP_EXCLAMATION_MARK +{ + File = "exclamation_mark.png"; +}; +Bitmap BMP_CANCEL +{ + File = "cancel.png"; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index 3fe71b181e82..754aed1a8b36 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -284,6 +284,10 @@ void ScUndoInsertCells::Undo() BeginUndo(); DoChange( sal_True ); EndUndo(); + + ScDocument* pDoc = pDocShell->GetDocument(); + for (SCTAB i = 0; i < nCount; ++i) + pDoc->SetDrawPageSize(pTabs[i]); } void ScUndoInsertCells::Redo() @@ -295,6 +299,10 @@ void ScUndoInsertCells::Redo() if ( pPasteUndo ) pPasteUndo->Redo(); // redo paste last + + ScDocument* pDoc = pDocShell->GetDocument(); + for (SCTAB i = 0; i < nCount; ++i) + pDoc->SetDrawPageSize(pTabs[i]); } void ScUndoInsertCells::Repeat(SfxRepeatTarget& rTarget) @@ -519,6 +527,10 @@ void ScUndoDeleteCells::Undo() pViewShell->MarkRange( ScRange(aEffRange.aStart.Col(), aEffRange.aStart.Row(), pTabs[i], aEffRange.aEnd.Col(), aEffRange.aEnd.Row(), pTabs[i]+pScenarios[i]) ); } } + + ScDocument* pDoc = pDocShell->GetDocument(); + for (SCTAB i = 0; i < nCount; ++i) + pDoc->SetDrawPageSize(pTabs[i]); } void ScUndoDeleteCells::Redo() @@ -532,6 +544,10 @@ void ScUndoDeleteCells::Redo() ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) pViewShell->DoneBlockMode(); // current way + + ScDocument* pDoc = pDocShell->GetDocument(); + for (SCTAB i = 0; i < nCount; ++i) + pDoc->SetDrawPageSize(pTabs[i]); } void ScUndoDeleteCells::Repeat(SfxRepeatTarget& rTarget) diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index a5752a70cb5c..f74dfdcfdf0e 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1192,11 +1192,6 @@ static sal_Bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, pDoc->DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, IDF_CONTENTS ); - /* #164410# Use double allocation, which will speed up import filters - using XCellRangeData::setDataArray() significantly. */ - bool bDoubleAlloc = ScColumn::bDoubleAlloc; - ScColumn::bDoubleAlloc = true; - sal_Bool bError = false; SCROW nDocRow = nStartRow; for (long nRow=0; nRow<nRows; nRow++) @@ -1247,7 +1242,6 @@ static sal_Bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange, ++nDocRow; } - ScColumn::bDoubleAlloc = bDoubleAlloc; sal_Bool bHeight = rDocShell.AdjustRowHeight( nStartRow, nEndRow, nTab ); diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index c28ad1a13bd3..a8ef1eda642b 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -2121,7 +2121,10 @@ void ScTabViewObj::RangeSelDone( const String& rText ) aEvent.Source.set(static_cast<cppu::OWeakObject*>(this)); aEvent.RangeDescriptor = rtl::OUString( rText ); - BOOST_FOREACH(const XRangeSelectionListenerUnoRef rListener, aRangeSelListeners) + // copy on the stack because listener could remove itself + XRangeSelectionListenerVector const listeners(aRangeSelListeners); + + BOOST_FOREACH(const XRangeSelectionListenerUnoRef rListener, listeners) rListener->done( aEvent ); } @@ -2131,7 +2134,10 @@ void ScTabViewObj::RangeSelAborted( const String& rText ) aEvent.Source.set(static_cast<cppu::OWeakObject*>(this)); aEvent.RangeDescriptor = rtl::OUString( rText ); - BOOST_FOREACH(const XRangeSelectionListenerUnoRef rListener, aRangeSelListeners) + // copy on the stack because listener could remove itself + XRangeSelectionListenerVector const listeners(aRangeSelListeners); + + BOOST_FOREACH(const XRangeSelectionListenerUnoRef rListener, listeners) rListener->aborted( aEvent ); } @@ -2141,7 +2147,10 @@ void ScTabViewObj::RangeSelChanged( const String& rText ) aEvent.Source.set(static_cast<cppu::OWeakObject*>(this)); aEvent.RangeDescriptor = rtl::OUString( rText ); - BOOST_FOREACH(const XRangeSelectionChangeListenerUnoRef rListener, aRangeChgListeners) + // copy on the stack because listener could remove itself + XRangeSelectionChangeListenerVector const listener(aRangeChgListeners); + + BOOST_FOREACH(const XRangeSelectionChangeListenerUnoRef rListener, listener) rListener->descriptorChanged( aEvent ); } diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index edb088a907db..d8b6a17be27d 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -1296,7 +1296,7 @@ ScVbaApplication::Caller( const uno::Any& /*aIndex*/ ) throw ( uno::RuntimeExcep SbxVariableRef refTemp = pMeth; // forces a broadcast SbxVariableRef pNew = new SbxMethod( *((SbxMethod*)pMeth)); - OSL_TRACE("pNew has type %d and string value %s", pNew->GetType(), rtl::OUStringToOString( pNew->GetString(), RTL_TEXTENCODING_UTF8 ).getStr() ); + OSL_TRACE("pNew has type %d and string value %s", pNew->GetType(), rtl::OUStringToOString( pNew->GetOUString(), RTL_TEXTENCODING_UTF8 ).getStr() ); aRet = sbxToUnoValue( pNew ); } return aRet; diff --git a/sc/source/ui/vba/vbahelper.cxx b/sc/source/ui/vba/vbahelper.cxx index ce5e680f1c26..947e6a8491f9 100644 --- a/sc/source/ui/vba/vbahelper.cxx +++ b/sc/source/ui/vba/vbahelper.cxx @@ -36,7 +36,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/beans/XIntrospection.hpp> +#include <com/sun/star/beans/Introspection.hpp> #include <comphelper/processfactory.hxx> @@ -82,8 +82,8 @@ getIntrospectionAccess( const uno::Any& aObject ) throw (uno::RuntimeException) static uno::Reference< beans::XIntrospection > xIntrospection; if( !xIntrospection.is() ) { - uno::Reference< lang::XMultiServiceFactory > xFactory( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - xIntrospection.set( xFactory->createInstance( rtl::OUString( "com.sun.star.beans.Introspection" ) ), uno::UNO_QUERY_THROW ); + uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + xIntrospection.set( beans::Introspection::create(xContext) ); } return xIntrospection->inspect( aObject ); } diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index c0c4ad9f908e..967bb8f91d4e 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -109,9 +109,6 @@ void ScCellShell::Execute( SfxRequest& rReq ) switch ( nSlot ) { - - - case SID_ATTR_SIZE://XXX ??? break; diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 24b4fca77e41..81af7baaf2c8 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -71,7 +71,14 @@ #include "appoptio.hxx" #include "postit.hxx" +#include "scresid.hxx" +#include "iconsets.hrc" +#include "colorscale.hxx" + #include <math.h> +#include <map> +#include <utility> +#include <iostream> using namespace com::sun::star; @@ -86,6 +93,56 @@ static ColorData nAuthorColor[ SC_AUTHORCOLORCOUNT ] = { COL_GREEN, COL_RED, COL_BLUE, COL_BROWN, COL_MAGENTA, COL_CYAN }; +sal_Int32 a3TrafficLights1[] = { + BMP_RED_CIRCLE, BMP_YELLOW_CIRCLE, BMP_GREEN_CIRCLE +}; + +sal_Int32 a3Arrows[] = { + BMP_ARROW_RED_DOWN, BMP_ARROW_YELLOW_RIGHT, BMP_ARROW_GREEN_UP +}; + +sal_Int32 a4Arrows[] = { + BMP_ARROW_RED_DOWN, BMP_ARROW_YELLOW_DOWN_RIGHT, BMP_ARROW_YELLOW_UP_RIGHT, BMP_ARROW_GREEN_UP +}; + +sal_Int32 a5Arrows[] = { + BMP_ARROW_RED_DOWN, BMP_ARROW_YELLOW_DOWN_RIGHT, BMP_ARROW_YELLOW_RIGHT, BMP_ARROW_YELLOW_UP_RIGHT, BMP_ARROW_GREEN_UP +}; + +sal_Int32 a4TrafficLights[] = { + BMP_BLACK_CIRCLE, BMP_RED_CIRCLE, BMP_YELLOW_CIRCLE, BMP_GREEN_CIRCLE +}; + +sal_Int32 a5Quarters[] = { + BMP_BLACK_CIRCLE_EMPTY, BMP_BLACK_CIRCLE_1_4TH, BMP_BLACK_CIRCLE_HALF, BMP_BLACK_CIRCLE_3_4TH, BMP_BLACK_CIRCLE +}; + +sal_Int32 a3Symbols1[] = { + BMP_CANCEL, BMP_EXCLAMATION_MARK, BMP_SIGN +}; + +struct ScIconSetBitmapMap { + ScIconSetType eType; + sal_Int32* nBitmaps; +}; + +static ScIconSetBitmapMap aBitmapMap[] = { + { IconSet_3TrafficLights1, a3TrafficLights1 }, + { IconSet_3TrafficLights2, a3TrafficLights1 }, + { IconSet_3Arrows, a3Arrows }, + { IconSet_3ArrowsGray, a3Arrows }, + { IconSet_3Symbols, a3Symbols1 }, + { IconSet_3Symbols2, a3Symbols1 }, + { IconSet_4Arrows, a4Arrows }, + { IconSet_4ArrowsGray, a4Arrows }, + { IconSet_4TrafficLights, a4TrafficLights }, + { IconSet_5Arrows, a5Arrows }, + { IconSet_5ArrowsGray, a5Arrows }, + { IconSet_5Quarters, a5Quarters } +}; + +static std::map< sal_Int32, BitmapEx > aIconSetBitmaps; + // Hilfsklasse, fuer die Farbzuordnung, // um nicht mehrfach hintereinander denselben User aus der Liste zu suchen @@ -778,6 +835,13 @@ static sal_Bool lcl_EqualBack( const RowInfo& rFirst, const RowInfo& rOther, if (pInfo1 && (*pInfo1 != *pInfo2)) return false; + + // each cell with an icon set should be painted the same way + const ScIconSetInfo* pIconSet1 = rFirst.pCellInfo[nX+1].pIconSet; + const ScIconSetInfo* pIconSet2 = rOther.pCellInfo[nX+1].pIconSet; + + if(pIconSet1 || pIconSet2) + return false; } return sal_True; @@ -870,14 +934,50 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, OutputDevice* pDev, con } } +BitmapEx& getIcon( ScIconSetType eType, sal_Int32 nIndex ) +{ + sal_Int32 nBitmap = -1; + + for(size_t i = 0; i < SAL_N_ELEMENTS(aBitmapMap); ++i) + { + if(aBitmapMap[i].eType == eType) + { + nBitmap = *(aBitmapMap[i].nBitmaps + nIndex); + } + } + + assert( nBitmap != -1 ); + + std::map<sal_Int32, BitmapEx>::iterator itr = aIconSetBitmaps.find( nBitmap ); + if(itr != aIconSetBitmaps.end()) + return itr->second; + + BitmapEx aBitmap = BitmapEx(ScResId(nBitmap)); + std::pair<sal_Int32, BitmapEx> aPair( nBitmap, aBitmap ); + std::pair<std::map<sal_Int32, BitmapEx>::iterator, bool> itrNew = aIconSetBitmaps.insert(aPair); + assert(itrNew.second); + + return itrNew.first->second; +} + +void drawIconSets( const ScIconSetInfo* pOldIconSetInfo, OutputDevice* pDev, const Rectangle& rRect ) +{ + long nSize = 16; + ScIconSetType eType = pOldIconSetInfo->eIconSetType; + sal_Int32 nIndex = pOldIconSetInfo->nIconIndex; + BitmapEx& rIcon = getIcon( eType, nIndex ); + pDev->DrawBitmapEx( Point( rRect.Left() +2, rRect.Top() + 2 ), Size( nSize, nSize ), rIcon ); +} + void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color*& pOldColor, const SvxBrushItem*& pOldBackground, - Rectangle& rRect, long nPosX, long nSignedOneX, OutputDevice* pDev, const ScDataBarInfo* pDataBarInfo, const ScDataBarInfo*& pOldDataBarInfo) + Rectangle& rRect, long nPosX, long nSignedOneX, OutputDevice* pDev, const ScDataBarInfo* pDataBarInfo, const ScDataBarInfo*& pOldDataBarInfo, + const ScIconSetInfo* pIconSetInfo, const ScIconSetInfo*& pOldIconSetInfo) { // need to paint if old color scale has been used and now // we have a different color or a style based background // we can here fall back to pointer comparison - if (pOldColor && (pBackground || pOldColor != pColor || pOldDataBarInfo || pDataBarInfo)) + if (pOldColor && (pBackground || pOldColor != pColor || pOldDataBarInfo || pDataBarInfo || pIconSetInfo || pOldIconSetInfo)) { rRect.Right() = nPosX-nSignedOneX; if( !pOldColor->GetTransparency() ) @@ -887,10 +987,13 @@ void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color } if( pOldDataBarInfo ) drawDataBars( pOldDataBarInfo, pDev, rRect ); + if( pOldIconSetInfo ) + drawIconSets( pOldIconSetInfo, pDev, rRect ); + rRect.Left() = nPosX - nSignedOneX; } - if ( pOldBackground && (pColor ||pBackground != pOldBackground || pOldDataBarInfo || pDataBarInfo) ) + if ( pOldBackground && (pColor ||pBackground != pOldBackground || pOldDataBarInfo || pDataBarInfo || pIconSetInfo || pOldIconSetInfo) ) { rRect.Right() = nPosX-nSignedOneX; if (pOldBackground) // ==0 if hidden @@ -904,10 +1007,13 @@ void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color } if( pOldDataBarInfo ) drawDataBars( pOldDataBarInfo, pDev, rRect ); + if( pOldIconSetInfo ) + drawIconSets( pOldIconSetInfo, pDev, rRect ); + rRect.Left() = nPosX - nSignedOneX; } - if (!pOldBackground && !pOldColor && pDataBarInfo) + if (!pOldBackground && !pOldColor && (pDataBarInfo || pIconSetInfo)) { rRect.Right() = nPosX -nSignedOneX; rRect.Left() = nPosX - nSignedOneX; @@ -931,6 +1037,11 @@ void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color pOldDataBarInfo = pDataBarInfo; else pOldDataBarInfo = NULL; + + if(pIconSetInfo) + pOldIconSetInfo = pIconSetInfo; + else + pOldIconSetInfo = NULL; } } @@ -992,6 +1103,7 @@ void ScOutputData::DrawBackground() const Color* pOldColor = NULL; const Color* pColor = NULL; const ScDataBarInfo* pOldDataBarInfo = NULL; + const ScIconSetInfo* pOldIconSetInfo = NULL; for (SCCOL nX=nX1; nX<=nX2; nX++) { CellInfo* pInfo = &pThisRowInfo->pCellInfo[nX+1]; @@ -1032,11 +1144,12 @@ void ScOutputData::DrawBackground() pColor = pInfo->pColorScale; const ScDataBarInfo* pDataBarInfo = pInfo->pDataBar; - drawCells( pColor, pBackground, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, pDataBarInfo, pOldDataBarInfo ); + const ScIconSetInfo* pIconSetInfo = pInfo->pIconSet; + drawCells( pColor, pBackground, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo ); nPosX += pRowInfo[0].pCellInfo[nX+1].nWidth * nLayoutSign; } - drawCells( NULL, NULL, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, NULL, pOldDataBarInfo ); + drawCells( NULL, NULL, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, NULL, pOldDataBarInfo, NULL, pOldIconSetInfo ); nArrY += nSkip; } diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index a9e85e368595..6752ad29c1f6 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -282,6 +282,8 @@ void ScTabView::InitScrollBar( ScrollBar& rScrollBar, long nMaxVal ) rScrollBar.SetScrollHdl( LINK(this, ScTabView, ScrollHdl) ); rScrollBar.SetEndScrollHdl( LINK(this, ScTabView, EndScrollHdl) ); + + rScrollBar.EnableRTL( aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() ) ); } // Scroll-Timer @@ -1035,15 +1037,14 @@ IMPL_LINK( ScTabView, EndScrollHdl, ScrollBar*, pScroll ) if ( pScroll == &aHScrollLeft || pScroll == &aHScrollRight ) { - bool bMirror = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() ) != Application::GetSettings().GetLayoutRTL(); ScHSplitPos eWhich = (pScroll == &aHScrollLeft) ? SC_SPLIT_LEFT : SC_SPLIT_RIGHT; - long nDelta = GetScrollBarPos( *pScroll, bMirror ) + nScrollMin - aViewData.GetPosX(eWhich); + long nDelta = GetScrollBarPos( *pScroll ) + nScrollMin - aViewData.GetPosX(eWhich); if (nDelta) ScrollX( nDelta, eWhich ); } else // VScroll... { ScVSplitPos eWhich = (pScroll == &aVScrollTop) ? SC_SPLIT_TOP : SC_SPLIT_BOTTOM; - long nDelta = GetScrollBarPos( *pScroll, false ) + nScrollMin - aViewData.GetPosY(eWhich); + long nDelta = GetScrollBarPos( *pScroll ) + nScrollMin - aViewData.GetPosY(eWhich); if (nDelta) ScrollY( nDelta, eWhich ); } } @@ -1066,7 +1067,6 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll ) SC_SPLIT_TOP : SC_SPLIT_BOTTOM ); bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() ); - bool bMirror = bHoriz && (bLayoutRTL != Application::GetSettings().GetLayoutRTL()); ScrollType eType = pScroll->GetType(); if ( eType == SCROLL_DRAG ) @@ -1104,7 +1104,7 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll ) nScrollMin = aViewData.GetFixPosX(); if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom ) nScrollMin = aViewData.GetFixPosY(); - long nScrollPos = GetScrollBarPos( *pScroll, bMirror ) + nScrollMin; + long nScrollPos = GetScrollBarPos( *pScroll ) + nScrollMin; String aHelpStr; Rectangle aRect; @@ -1139,21 +1139,6 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll ) if ( bOnlineScroll || eType != SCROLL_DRAG ) { - if ( bMirror ) - { - // change scroll type so visible/previous cells calculation below remains the same - switch ( eType ) - { - case SCROLL_LINEUP: eType = SCROLL_LINEDOWN; break; - case SCROLL_LINEDOWN: eType = SCROLL_LINEUP; break; - case SCROLL_PAGEUP: eType = SCROLL_PAGEDOWN; break; - case SCROLL_PAGEDOWN: eType = SCROLL_PAGEUP; break; - default: - { - // added to avoid warnings - } - } - } long nDelta = pScroll->GetDelta(); switch ( eType ) { @@ -1188,7 +1173,7 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll ) if ( aViewData.GetVSplitMode()==SC_SPLIT_FIX && pScroll == &aVScrollBottom ) nScrollMin = aViewData.GetFixPosY(); - long nScrollPos = GetScrollBarPos( *pScroll, bMirror ) + nScrollMin; + long nScrollPos = GetScrollBarPos( *pScroll ) + nScrollMin; nDelta = nScrollPos - nViewPos; if ( nScrollPos > nPrevDragPos ) { diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx index 342880ac1ea9..311ef3ca436a 100644 --- a/sc/source/ui/view/tabview4.cxx +++ b/sc/source/ui/view/tabview4.cxx @@ -330,30 +330,16 @@ void ScTabView::SetScrollBar( ScrollBar& rScroll, long nRangeMax, long nVisible, if ( nVisible == 0 ) nVisible = 1; // #i59893# don't use visible size 0 - // RTL layout uses a negative range to simulate a mirrored scroll bar. - // SetScrollBar/GetScrollBarPos hide this so outside of these functions normal cell - // addresses can be used. + rScroll.SetRange( Range( 0, nRangeMax ) ); + rScroll.SetVisibleSize( nVisible ); + rScroll.SetThumbPos( nPos ); - if ( bLayoutRTL ) - { - rScroll.SetRange( Range( -nRangeMax, 0 ) ); - rScroll.SetVisibleSize( nVisible ); - rScroll.SetThumbPos( -nPos - nVisible ); - } - else - { - rScroll.SetRange( Range( 0, nRangeMax ) ); - rScroll.SetVisibleSize( nVisible ); - rScroll.SetThumbPos( nPos ); - } + rScroll.EnableRTL( bLayoutRTL ); } -long ScTabView::GetScrollBarPos( ScrollBar& rScroll, bool bLayoutRTL ) +long ScTabView::GetScrollBarPos( ScrollBar& rScroll ) { - if ( bLayoutRTL ) - return -rScroll.GetThumbPos() - rScroll.GetVisibleSize(); - else - return rScroll.GetThumbPos(); + return rScroll.GetThumbPos(); } // UpdateScrollBars - sichtbaren Bereich und Scrollweite der Scrollbars einstellen @@ -393,7 +379,7 @@ void ScTabView::UpdateScrollBars() sal_Bool bRight = ( aViewData.GetHSplitMode() != SC_SPLIT_NONE ); ScDocument* pDoc = aViewData.GetDocument(); SCTAB nTab = aViewData.GetTabNo(); - sal_Bool bMirror = pDoc->IsLayoutRTL( nTab ) != Application::GetSettings().GetLayoutRTL(); + bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); SCCOL nUsedX; SCROW nUsedY; pDoc->GetTableArea( nTab, nUsedX, nUsedY ); //! cachen !!!!!!!!!!!!!!! @@ -412,24 +398,24 @@ void ScTabView::UpdateScrollBars() nVisXL = aViewData.VisibleCellsX( SC_SPLIT_LEFT ); long nMaxXL = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_LEFT), nVisXL, MAXCOL, 0 ); - SetScrollBar( aHScrollLeft, nMaxXL, nVisXL, aViewData.GetPosX( SC_SPLIT_LEFT ), bMirror ); + SetScrollBar( aHScrollLeft, nMaxXL, nVisXL, aViewData.GetPosX( SC_SPLIT_LEFT ), bLayoutRTL ); nVisYB = aViewData.VisibleCellsY( SC_SPLIT_BOTTOM ); long nMaxYB = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_BOTTOM), nVisYB, MAXROW, nStartY ); - SetScrollBar( aVScrollBottom, nMaxYB, nVisYB, aViewData.GetPosY( SC_SPLIT_BOTTOM ) - nStartY, false ); + SetScrollBar( aVScrollBottom, nMaxYB, nVisYB, aViewData.GetPosY( SC_SPLIT_BOTTOM ) - nStartY, bLayoutRTL ); if (bRight) { nVisXR = aViewData.VisibleCellsX( SC_SPLIT_RIGHT ); long nMaxXR = lcl_GetScrollRange( nUsedX, aViewData.GetPosX(SC_SPLIT_RIGHT), nVisXR, MAXCOL, nStartX ); - SetScrollBar( aHScrollRight, nMaxXR, nVisXR, aViewData.GetPosX( SC_SPLIT_RIGHT ) - nStartX, bMirror ); + SetScrollBar( aHScrollRight, nMaxXR, nVisXR, aViewData.GetPosX( SC_SPLIT_RIGHT ) - nStartX, bLayoutRTL ); } if (bTop) { nVisYT = aViewData.VisibleCellsY( SC_SPLIT_TOP ); long nMaxYT = lcl_GetScrollRange( nUsedY, aViewData.GetPosY(SC_SPLIT_TOP), nVisYT, MAXROW, 0 ); - SetScrollBar( aVScrollTop, nMaxYT, nVisYT, aViewData.GetPosY( SC_SPLIT_TOP ), false ); + SetScrollBar( aVScrollTop, nMaxYT, nVisYT, aViewData.GetPosY( SC_SPLIT_TOP ), bLayoutRTL ); } // Bereich testen diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 6ef470ac9d23..bb9aa7b48097 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -207,7 +207,7 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( { const ScRangeList& rCondFormatRange = pCondFormat->GetRange(); if(rCondFormatRange == aRangeList) - pResult = new ScCondFormatDlg( pB, pCW, pParent, pDoc, NULL, rCondFormatRange, aPos, condformat::dialog::NONE ); + pResult = new ScCondFormatDlg( pB, pCW, pParent, pDoc, pCondFormat, rCondFormatRange, aPos, condformat::dialog::NONE ); } if(!pResult) diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 667f726d191a..dd91f588c443 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -461,7 +461,7 @@ void ScViewData::InsertTab( SCTAB nTab ) if( nTab >= static_cast<SCTAB>(maTabData.size())) maTabData.resize(nTab+1, NULL); else - maTabData.insert( maTabData.begin() + nTab, NULL ); + maTabData.insert( maTabData.begin() + nTab, (ScViewDataTable *)NULL ); CreateTabData( nTab ); UpdateCurrentTab(); @@ -524,7 +524,7 @@ void ScViewData::CopyTab( SCTAB nSrcTab, SCTAB nDestTab ) if ( maTabData[nSrcTab] ) maTabData.insert(maTabData.begin() + nDestTab, new ScViewDataTable( *maTabData[nSrcTab] )); else - maTabData.insert(maTabData.begin() + nDestTab, NULL); + maTabData.insert(maTabData.begin() + nDestTab, (ScViewDataTable *)NULL); UpdateCurrentTab(); mpMarkData->InsertTab( nDestTab ); diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml index 621586ea85e1..901dedadf8a7 100644 --- a/sc/uiconfig/scalc/menubar/menubar.xml +++ b/sc/uiconfig/scalc/menubar/menubar.xml @@ -13,6 +13,9 @@ <menu:menuitem menu:id=".uno:SaveAs"/> <menu:menuitem menu:id=".uno:SaveAsTemplate"/> <menu:menuitem menu:id=".uno:SaveAll"/> + <menu:menuitem menu:id=".uno:CheckOut"/> + <menu:menuitem menu:id=".uno:CancelCheckOut"/> + <menu:menuitem menu:id=".uno:CheckIn"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:Reload"/> <menu:menuitem menu:id=".uno:VersionDialog"/> diff --git a/sc/uiconfig/scalc/toolbar/graphicobjectbar.xml b/sc/uiconfig/scalc/toolbar/graphicobjectbar.xml index 25eca7950842..d041e0c82f55 100644 --- a/sc/uiconfig/scalc/toolbar/graphicobjectbar.xml +++ b/sc/uiconfig/scalc/toolbar/graphicobjectbar.xml @@ -1,8 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd"> <toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar"> - <toolbar:toolbaritem xlink:href=".uno:InsertGraphic" toolbar:helpid="10241"/> - <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:GraphicFilterToolbox" toolbar:helpid="helpid:10469" toolbar:style="dropdown" /> <toolbar:toolbarseparator/> <toolbar:toolbaritem xlink:href=".uno:GrafMode" toolbar:helpid="helpid:10871" /> diff --git a/sc/uiconfig/scalc/ui/printeroptions.ui b/sc/uiconfig/scalc/ui/printeroptions.ui index e65686f5d670..2c9fb5672ddf 100644 --- a/sc/uiconfig/scalc/ui/printeroptions.ui +++ b/sc/uiconfig/scalc/ui/printeroptions.ui @@ -37,7 +37,9 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="label" translatable="yes">Pages</property> - <property name="use_markup">True</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> </object> </child> </object> |