sc/inc/bulkdatahint.hxx | 13 sc/inc/calcconfig.hxx | 24 - sc/inc/celltextattr.hxx | 7 sc/inc/cellvalues.hxx | 53 +-- sc/inc/chartarr.hxx | 20 - sc/inc/clipoptions.hxx | 5 sc/inc/columniterator.hxx | 10 sc/inc/columnset.hxx | 7 sc/inc/datamapper.hxx | 10 sc/inc/datastreamgettime.hxx | 8 sc/inc/documentstreamaccess.hxx | 15 sc/inc/dpfilteredcache.hxx | 35 +- sc/inc/dpresfilter.hxx | 24 - sc/inc/edittextiterator.hxx | 7 sc/inc/formulaiter.hxx | 5 sc/inc/generalfunction.hxx | 14 sc/inc/listenercontext.hxx | 27 - sc/inc/listenerquery.hxx | 21 - sc/inc/macromgr.hxx | 8 sc/inc/mid.h | 8 sc/inc/numformat.hxx | 9 sc/inc/pageuno.hxx | 6 sc/inc/reffind.hxx | 8 sc/inc/refreshtimerprotector.hxx | 4 sc/inc/scdllapi.h | 4 sc/inc/scopetools.hxx | 25 - sc/inc/segmenttree.hxx | 49 +- sc/inc/stylehelper.hxx | 4 sc/inc/tokenstringcontext.hxx | 21 - sc/inc/unitconv.hxx | 17 - sc/inc/userlist.hxx | 20 - sc/inc/zforauto.hxx | 12 sc/qa/extras/check_data_pilot_field.cxx | 61 +-- sc/qa/extras/recordchanges-test.cxx | 27 - sc/qa/extras/sccellrangesobj.cxx | 39 +- sc/qa/extras/scmodelobj.cxx | 25 - sc/qa/extras/scoutlineobj.cxx | 17 - sc/qa/extras/scsubtotalfieldobj.cxx | 29 - sc/qa/unit/dataproviders_test.cxx | 45 +- sc/qa/unit/test_ScChartListenerCollection.cxx | 38 +- sc/source/core/data/table5.cxx | 279 ++++++++--------- sc/source/core/inc/arraysumfunctor.hxx | 13 sc/source/core/inc/cellkeytranslator.hxx | 12 sc/source/core/inc/doubleref.hxx | 19 - sc/source/core/inc/scrdata.hxx | 7 sc/source/core/tool/addincfg.cxx | 19 - sc/source/core/tool/math.cxx | 27 - sc/source/core/tool/subtotal.cxx | 52 +-- sc/source/filter/excel/xltracer.cxx | 66 +--- sc/source/filter/inc/optab.h | 10 sc/source/filter/inc/qpro.hxx | 10 sc/source/filter/inc/qproform.hxx | 19 - sc/source/filter/inc/sharedformulagroups.hxx | 13 sc/source/filter/inc/xepivotxml.hxx | 25 - sc/source/filter/lotus/memory.cxx | 14 sc/source/filter/xml/XMLChangeTrackingExportHelper.hxx | 10 sc/source/filter/xml/XMLEmptyContext.hxx | 9 sc/source/filter/xml/XMLExportDatabaseRanges.hxx | 7 sc/source/filter/xml/XMLTrackedChangesContext.hxx | 18 - sc/source/filter/xml/importcontext.hxx | 5 sc/source/filter/xml/pivotsource.hxx | 29 - sc/source/filter/xml/xmlcvali.hxx | 8 sc/source/ui/Accessibility/AccessibleDocumentBase.cxx | 9 sc/source/ui/attrdlg/scuiexp.cxx | 19 - sc/source/ui/cctrl/cbnumberformat.cxx | 11 sc/source/ui/dataprovider/htmldataprovider.hxx | 7 sc/source/ui/dbgui/PivotLayoutTreeList.cxx | 18 - sc/source/ui/formdlg/formdata.cxx | 9 sc/source/ui/inc/AccessibleDocumentBase.hxx | 7 sc/source/ui/inc/IAnyRefDialog.hxx | 12 sc/source/ui/inc/PivotLayoutTreeListBase.hxx | 7 sc/source/ui/inc/PivotLayoutTreeListLabel.hxx | 3 sc/source/ui/inc/attrdlg.hxx | 6 sc/source/ui/inc/chartsh.hxx | 5 sc/source/ui/inc/condformatdlgitem.hxx | 18 - sc/source/ui/inc/dapitype.hxx | 10 sc/source/ui/inc/dataproviderdlg.hxx | 11 sc/source/ui/inc/datastreamdlg.hxx | 11 sc/source/ui/inc/delcodlg.hxx | 12 sc/source/ui/inc/fudraw.hxx | 18 - sc/source/ui/inc/namedefdlg.hxx | 30 - sc/source/ui/inc/namedlg.hxx | 45 +- sc/source/ui/inc/protectiondlg.hxx | 12 sc/source/ui/inc/retypepassdlg.hxx | 20 - sc/source/ui/inc/shtabdlg.hxx | 9 sc/source/ui/inc/sortkeydlg.hxx | 5 sc/source/ui/inc/textdlgs.hxx | 9 sc/source/ui/inc/tpformula.hxx | 22 - sc/source/ui/inc/uiobject.hxx | 11 sc/source/ui/inc/undoconvert.hxx | 7 sc/source/ui/miscdlgs/crdlg.cxx | 7 sc/source/ui/miscdlgs/datastreamdlg.cxx | 57 +-- sc/source/ui/miscdlgs/delcldlg.cxx | 22 - sc/source/ui/miscdlgs/inscldlg.cxx | 16 sc/source/ui/miscdlgs/mergecellsdialog.cxx | 12 sc/source/ui/miscdlgs/mvtabdlg.cxx | 56 +-- sc/source/ui/miscdlgs/namecrea.cxx | 14 sc/source/ui/miscdlgs/retypepassdlg.cxx | 52 --- sc/source/ui/miscdlgs/shtabdlg.cxx | 14 sc/source/ui/miscdlgs/warnbox.cxx | 10 sc/source/ui/namedlg/namemgrtable.cxx | 29 - sc/source/ui/namedlg/namepast.cxx | 29 - sc/source/ui/sidebar/CellLineStyleValueSet.hxx | 11 sc/source/ui/undo/target.cxx | 4 sc/source/ui/undo/undoolk.cxx | 20 - sc/source/ui/unoobj/convuno.cxx | 14 sc/source/ui/unoobj/exceldetect.hxx | 10 sc/source/ui/unoobj/listenercalls.cxx | 18 - sc/source/ui/vba/vbacondition.cxx | 44 +- sc/source/ui/vba/vbafont.hxx | 40 +- sc/source/ui/vba/vbaoleobjects.hxx | 15 sc/source/ui/vba/vbapagebreaks.hxx | 36 +- sc/source/ui/vba/vbapagesetup.hxx | 57 +-- sc/source/ui/vba/vbapivottable.hxx | 10 sc/source/ui/vba/vbatextframe.hxx | 8 sc/source/ui/view/dbfunc4.cxx | 20 - sc/source/ui/view/pgbrksh.cxx | 17 - sc/source/ui/view/tabvwshd.cxx | 8 scaddins/source/analysis/bessel.hxx | 14 solenv/clang-format/excludelist | 120 ------- 120 files changed, 1201 insertions(+), 1398 deletions(-)
New commits: commit 6ceb1d0f2e23749fe03fab08ec338ba4d7782173 Author: Philipp Hofer <philipp.ho...@protonmail.com> AuthorDate: Thu Nov 12 13:12:24 2020 +0100 Commit: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> CommitDate: Thu Nov 19 01:36:55 2020 +0100 tdf#123936 Formatting files in module sc with clang-format Change-Id: I66cafda863e3e1e4559a57289c09925d68b0719c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105701 Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> Tested-by: Jenkins diff --git a/sc/inc/bulkdatahint.hxx b/sc/inc/bulkdatahint.hxx index 6ff94227484a..d587472b5eb2 100644 --- a/sc/inc/bulkdatahint.hxx +++ b/sc/inc/bulkdatahint.hxx @@ -15,8 +15,8 @@ class ScDocument; -namespace sc { - +namespace sc +{ class ColumnSpanSet; class BulkDataHint final : public SfxHint @@ -24,19 +24,18 @@ class BulkDataHint final : public SfxHint struct Impl; std::unique_ptr<Impl> mpImpl; - BulkDataHint( const BulkDataHint& ) = delete; - BulkDataHint& operator= ( const BulkDataHint& ) = delete; + BulkDataHint(const BulkDataHint&) = delete; + BulkDataHint& operator=(const BulkDataHint&) = delete; public: - BulkDataHint( ScDocument& rDoc, SfxHintId nHintId ); + BulkDataHint(ScDocument& rDoc, SfxHintId nHintId); virtual ~BulkDataHint() override; - void setSpans( const ColumnSpanSet* pSpans ); + void setSpans(const ColumnSpanSet* pSpans); const ColumnSpanSet* getSpans() const; ScDocument& getDoc(); }; - } #endif diff --git a/sc/inc/calcconfig.hxx b/sc/inc/calcconfig.hxx index 29d926c459c4..9781aa7414fc 100644 --- a/sc/inc/calcconfig.hxx +++ b/sc/inc/calcconfig.hxx @@ -45,22 +45,22 @@ struct SC_DLLPUBLIC ScCalcConfig // from most stringent to most relaxed enum class StringConversion { - ILLEGAL, ///< =1+"1" or =1+"x" give #VALUE! - ZERO, ///< =1+"1" or =1+"x" give 1 - UNAMBIGUOUS, ///< =1+"1" gives 2, but =1+"1.000" or =1+"x" give #VALUE! - LOCALE ///< =1+"1.000" may be 2 or 1001 ... =1+"x" gives #VALUE! + ILLEGAL, ///< =1+"1" or =1+"x" give #VALUE! + ZERO, ///< =1+"1" or =1+"x" give 1 + UNAMBIGUOUS, ///< =1+"1" gives 2, but =1+"1.000" or =1+"x" give #VALUE! + LOCALE ///< =1+"1.000" may be 2 or 1001 ... =1+"x" gives #VALUE! }; formula::FormulaGrammar::AddressConvention meStringRefAddressSyntax; StringConversion meStringConversion; - bool mbEmptyStringAsZero:1; - bool mbHasStringRefSyntax:1; + bool mbEmptyStringAsZero : 1; + bool mbHasStringRefSyntax : 1; static bool isOpenCLEnabled(); static bool isThreadingEnabled(); static ForceCalculationType getForceCalculationType(); - bool mbOpenCLSubsetOnly:1; - bool mbOpenCLAutoSelect:1; + bool mbOpenCLSubsetOnly : 1; + bool mbOpenCLAutoSelect : 1; OUString maOpenCLDevice; sal_Int32 mnOpenCLMinimumFormulaGroupSize; @@ -73,11 +73,11 @@ struct SC_DLLPUBLIC ScCalcConfig void setOpenCLConfigToDefault(); void reset(); - void MergeDocumentSpecific( const ScCalcConfig& r ); - void SetStringRefSyntax( formula::FormulaGrammar::AddressConvention eConv ); + void MergeDocumentSpecific(const ScCalcConfig& r); + void SetStringRefSyntax(formula::FormulaGrammar::AddressConvention eConv); - bool operator== (const ScCalcConfig& r) const; - bool operator!= (const ScCalcConfig& r) const; + bool operator==(const ScCalcConfig& r) const; + bool operator!=(const ScCalcConfig& r) const; }; OUString ScOpCodeSetToSymbolicString(const ScCalcConfig::OpCodeSet& rOpCodes); diff --git a/sc/inc/celltextattr.hxx b/sc/inc/celltextattr.hxx index 0e9c34c4cf24..eb24101b3d0f 100644 --- a/sc/inc/celltextattr.hxx +++ b/sc/inc/celltextattr.hxx @@ -13,16 +13,15 @@ #include <sal/types.h> #include <svl/languageoptions.hxx> -namespace sc { - +namespace sc +{ struct CellTextAttr { - sal_uInt16 mnTextWidth; + sal_uInt16 mnTextWidth; SvtScriptType mnScriptType; CellTextAttr(); }; - } #endif diff --git a/sc/inc/cellvalues.hxx b/sc/inc/cellvalues.hxx index 5a405779328f..ff9088b211f2 100644 --- a/sc/inc/cellvalues.hxx +++ b/sc/inc/cellvalues.hxx @@ -17,14 +17,13 @@ class ScColumn; class ScFormulaCell; -namespace svl { - +namespace svl +{ class SharedString; - } -namespace sc { - +namespace sc +{ struct CellValuesImpl; struct CellValueSpan @@ -32,7 +31,7 @@ struct CellValueSpan SCROW mnRow1; SCROW mnRow2; - CellValueSpan( SCROW nRow1, SCROW nRow2 ); + CellValueSpan(SCROW nRow1, SCROW nRow2); }; /** @@ -43,8 +42,8 @@ class CellValues { std::unique_ptr<CellValuesImpl> mpImpl; - CellValues( const CellValues& ) = delete; - CellValues& operator= ( const CellValues& ) = delete; + CellValues(const CellValues&) = delete; + CellValues& operator=(const CellValues&) = delete; public: CellValues(); @@ -58,27 +57,27 @@ public: * @param nRow top row position in the source column. * @param nLen length of the segment to transfer. */ - void transferFrom( ScColumn& rCol, SCROW nRow, size_t nLen ); + void transferFrom(ScColumn& rCol, SCROW nRow, size_t nLen); - void copyTo( ScColumn& rCol, SCROW nRow ) const; - void swapNonEmpty( ScColumn& rCol ); + void copyTo(ScColumn& rCol, SCROW nRow) const; + void swapNonEmpty(ScColumn& rCol); - void assign( const std::vector<double>& rVals ); - void assign( const std::vector<ScFormulaCell*>& rVals ); + void assign(const std::vector<double>& rVals); + void assign(const std::vector<ScFormulaCell*>& rVals); size_t size() const; - void reset( size_t nSize ); - void setValue( size_t nRow, double fVal ); - void setValue( size_t nRow, const svl::SharedString& rStr ); + void reset(size_t nSize); + void setValue(size_t nRow, double fVal); + void setValue(size_t nRow, const svl::SharedString& rStr); - void swap( CellValues& r ); + void swap(CellValues& r); std::vector<CellValueSpan> getNonEmptySpans() const; private: - void copyCellsTo( ScColumn& rCol, SCROW nRow ) const; - void copyCellTextAttrsTo( ScColumn& rCol, SCROW nRow ) const; + void copyCellsTo(ScColumn& rCol, SCROW nRow) const; + void copyCellTextAttrsTo(ScColumn& rCol, SCROW nRow) const; }; /** @@ -90,13 +89,12 @@ class TableValues std::unique_ptr<Impl> mpImpl; - TableValues( const TableValues& ) = delete; - TableValues& operator= ( const TableValues& ) = delete; + TableValues(const TableValues&) = delete; + TableValues& operator=(const TableValues&) = delete; public: - TableValues(); - TableValues( const ScRange& rRange ); + TableValues(const ScRange& rRange); ~TableValues(); const ScRange& getRange() const; @@ -104,18 +102,17 @@ public: /** * Swap the entire column. */ - void swap( SCTAB nTab, SCCOL nCol, CellValues& rColValue ); + void swap(SCTAB nTab, SCCOL nCol, CellValues& rColValue); /** * Swap non-empty blocks with the column storage. */ - void swapNonEmpty( SCTAB nTab, SCCOL nCol, ScColumn& rCol ); + void swapNonEmpty(SCTAB nTab, SCCOL nCol, ScColumn& rCol); - std::vector<CellValueSpan> getNonEmptySpans( SCTAB nTab, SCCOL nCol ) const; + std::vector<CellValueSpan> getNonEmptySpans(SCTAB nTab, SCCOL nCol) const; - void swap( TableValues& rOther ); + void swap(TableValues& rOther); }; - } #endif diff --git a/sc/inc/chartarr.hxx b/sc/inc/chartarr.hxx index c35fc4a6e66e..94bfabcd55c1 100644 --- a/sc/inc/chartarr.hxx +++ b/sc/inc/chartarr.hxx @@ -50,12 +50,15 @@ public: const OUString& GetColText(SCCOL nCol) const { return pColText[nCol]; } const OUString& GetRowText(SCROW nRow) const { return pRowText[nRow]; } double GetData(SCCOL nCol, SCROW nRow) const { return pData[nCol * nRowCnt + nRow]; } - void SetData(SCCOL nCol, SCROW nRow, const double& rVal) { pData[nCol * nRowCnt + nRow] = rVal; } + void SetData(SCCOL nCol, SCROW nRow, const double& rVal) + { + pData[nCol * nRowCnt + nRow] = rVal; + } void SetColText(SCCOL nCol, const OUString& rText) { pColText[nCol] = rText; } void SetRowText(SCROW nRow, const OUString& rText) { pRowText[nRow] = rText; } }; -class ScChartArray // only parameter-struct +class ScChartArray // only parameter-struct { ScDocument& rDocument; ScChartPositioner aPositioner; @@ -63,15 +66,16 @@ class ScChartArray // only parameter-struct private: std::unique_ptr<ScMemChart> CreateMemChartSingle(); std::unique_ptr<ScMemChart> CreateMemChartMulti(); + public: - ScChartArray( ScDocument& rDoc, const ScRangeListRef& rRangeList ); + ScChartArray(ScDocument& rDoc, const ScRangeListRef& rRangeList); - const ScRangeListRef& GetRangeList() const { return aPositioner.GetRangeList(); } - const ScChartPositionMap* GetPositionMap() { return aPositioner.GetPositionMap(); } + const ScRangeListRef& GetRangeList() const { return aPositioner.GetRangeList(); } + const ScChartPositionMap* GetPositionMap() { return aPositioner.GetPositionMap(); } - void SetHeaders(bool bCol, bool bRow) { aPositioner.SetHeaders(bCol, bRow); } - bool HasColHeaders() const { return aPositioner.HasColHeaders(); } - bool HasRowHeaders() const { return aPositioner.HasRowHeaders(); } + void SetHeaders(bool bCol, bool bRow) { aPositioner.SetHeaders(bCol, bRow); } + bool HasColHeaders() const { return aPositioner.HasColHeaders(); } + bool HasRowHeaders() const { return aPositioner.HasRowHeaders(); } std::unique_ptr<ScMemChart> CreateMemChart(); }; diff --git a/sc/inc/clipoptions.hxx b/sc/inc/clipoptions.hxx index 3a16e4109ec3..081a1a46d679 100644 --- a/sc/inc/clipoptions.hxx +++ b/sc/inc/clipoptions.hxx @@ -13,7 +13,10 @@ #include "scdllapi.h" #include <com/sun/star/uno/Reference.h> -namespace com::sun::star::document { class XDocumentProperties; } +namespace com::sun::star::document +{ +class XDocumentProperties; +} /// Stores options which are only relevant for clipboard documents. class SC_DLLPUBLIC ScClipOptions diff --git a/sc/inc/columniterator.hxx b/sc/inc/columniterator.hxx index 46350afc32e9..3dbe76106ea2 100644 --- a/sc/inc/columniterator.hxx +++ b/sc/inc/columniterator.hxx @@ -32,7 +32,8 @@ class ScColumnTextWidthIterator public: ScColumnTextWidthIterator(const ScColumnTextWidthIterator&) = delete; const ScColumnTextWidthIterator& operator=(const ScColumnTextWidthIterator&) = delete; - ScColumnTextWidthIterator(const ScDocument& rDoc, ScColumn& rCol, SCROW nStartRow, SCROW nEndRow); + ScColumnTextWidthIterator(const ScDocument& rDoc, ScColumn& rCol, SCROW nStartRow, + SCROW nEndRow); /** * @param rDoc document instance. @@ -56,8 +57,8 @@ private: void checkEndRow(); }; -namespace sc { - +namespace sc +{ /** * This iterator lets you iterate over cells over specified range in a * single column. It does not modify the state of the cells, and therefore @@ -70,7 +71,7 @@ class ColumnIterator bool mbComplete; public: - ColumnIterator( const CellStoreType& rCells, SCROW nRow1, SCROW nRow2 ); + ColumnIterator(const CellStoreType& rCells, SCROW nRow1, SCROW nRow2); ~ColumnIterator(); void next(); @@ -83,7 +84,6 @@ public: ScRefCellValue getCell() const; }; - } #endif diff --git a/sc/inc/columnset.hxx b/sc/inc/columnset.hxx index d7d9a4de5ec6..2ae8ab01060b 100644 --- a/sc/inc/columnset.hxx +++ b/sc/inc/columnset.hxx @@ -15,8 +15,8 @@ #include <unordered_map> #include <vector> -namespace sc { - +namespace sc +{ /** * Simple container to keep track of sheet - column pair. */ @@ -29,10 +29,9 @@ class ColumnSet public: void set(SCTAB nTab, SCCOL nCol); void getColumns(SCTAB nTab, std::vector<SCCOL>& rCols) const; - bool hasTab( SCTAB nTab ) const; + bool hasTab(SCTAB nTab) const; bool empty() const; }; - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/datamapper.hxx b/sc/inc/datamapper.hxx index c3284cf1ddfa..0972931fd28d 100644 --- a/sc/inc/datamapper.hxx +++ b/sc/inc/datamapper.hxx @@ -20,8 +20,8 @@ class ScDocument; -namespace sc { - +namespace sc +{ class ScDBDataManager; class DataProvider; class DataTransformation; @@ -29,7 +29,6 @@ class DataTransformation; class SC_DLLPUBLIC ExternalDataSource { private: - /** * The URL for the external data provider. The URL * will be passed to the data provider together with @@ -72,9 +71,7 @@ private: ScDocument* mpDoc; public: - - ExternalDataSource(const OUString& rURL, - const OUString& rProvider, ScDocument* pDoc); + ExternalDataSource(const OUString& rURL, const OUString& rProvider, ScDocument* pDoc); void setUpdateFrequency(double nUpdateFrequency); @@ -113,7 +110,6 @@ public: const std::vector<ExternalDataSource>& getDataSources() const; std::vector<ExternalDataSource>& getDataSources(); }; - } #endif diff --git a/sc/inc/datastreamgettime.hxx b/sc/inc/datastreamgettime.hxx index 632cf8723159..b44c1db5d49e 100644 --- a/sc/inc/datastreamgettime.hxx +++ b/sc/inc/datastreamgettime.hxx @@ -22,9 +22,10 @@ #include <sal/config.h> -namespace sc { - -enum class DebugTime { +namespace sc +{ +enum class DebugTime +{ Import, Recalc, Render, @@ -32,7 +33,6 @@ enum class DebugTime { }; double datastream_get_time(DebugTime nIdx); - } #endif diff --git a/sc/inc/documentstreamaccess.hxx b/sc/inc/documentstreamaccess.hxx index 0108958e475c..c3e2f5155589 100644 --- a/sc/inc/documentstreamaccess.hxx +++ b/sc/inc/documentstreamaccess.hxx @@ -17,8 +17,8 @@ class ScDocument; class ScAddress; class ScRange; -namespace sc { - +namespace sc +{ struct DocumentStreamAccessImpl; /** @@ -30,11 +30,11 @@ class DocumentStreamAccess std::unique_ptr<DocumentStreamAccessImpl> mpImpl; public: - DocumentStreamAccess( ScDocument& rDoc ); + DocumentStreamAccess(ScDocument& rDoc); ~DocumentStreamAccess(); - void setNumericCell( const ScAddress& rPos, double fVal ); - void setStringCell( const ScAddress& rPos, const OUString& rStr ); + void setNumericCell(const ScAddress& rPos, double fVal); + void setStringCell(const ScAddress& rPos, const OUString& rStr); /** * Clear its internal state, and more importantly all the block position @@ -46,15 +46,14 @@ public: * Pop the top row inside specified range, shift all the other rows up by * one, then set the bottom row empty. */ - void shiftRangeUp( const ScRange& rRange ); + void shiftRangeUp(const ScRange& rRange); /** * Top the bottom row inside specified range, shift all the other rows * above downward by one by inserting an empty row at the top. */ - void shiftRangeDown( const ScRange& rRange ); + void shiftRangeDown(const ScRange& rRange); }; - } #endif diff --git a/sc/inc/dpfilteredcache.hxx b/sc/inc/dpfilteredcache.hxx index 43e6ca0ced5f..aa40da4a11cf 100644 --- a/sc/inc/dpfilteredcache.hxx +++ b/sc/inc/dpfilteredcache.hxx @@ -31,8 +31,14 @@ #include <mdds/flat_segment_tree.hpp> -namespace com::sun::star::uno { class Any; } -namespace com::sun::star::uno { template <typename > class Sequence; } +namespace com::sun::star::uno +{ +class Any; +} +namespace com::sun::star::uno +{ +template <typename> class Sequence; +} class ScDPCache; struct ScDPValue; @@ -54,7 +60,7 @@ public: virtual ~FilterBase() {} /** returns true if the matching condition is met for a single cell value, or false otherwise. */ - virtual bool match( const ScDPItemData& rCellData ) const = 0; + virtual bool match(const ScDPItemData& rCellData) const = 0; virtual std::vector<ScDPItemData> getMatchValues() const = 0; }; @@ -63,7 +69,7 @@ public: class SingleFilter final : public FilterBase { public: - explicit SingleFilter(const ScDPItemData &rItem); + explicit SingleFilter(const ScDPItemData& rItem); virtual bool match(const ScDPItemData& rCellData) const override; virtual std::vector<ScDPItemData> getMatchValues() const override; @@ -101,7 +107,7 @@ public: sal_Int32 getRowSize() const; sal_Int32 getColSize() const; - const ScDPCache& getCache() const { return mrCache;} + const ScDPCache& getCache() const { return mrCache; } void fillTable(const ScQueryParam& rQuery, bool bIgnoreEmptyRows, bool bRepeatIfEmpty); @@ -114,32 +120,33 @@ public: /** Set filter on/off flag to each row to control visibility. The caller must ensure that the table is filled before calling this function. */ - void filterByPageDimension(const std::vector<Criterion>& rCriteria, const std::unordered_set<sal_Int32>& rRepeatIfEmptyDims); + void filterByPageDimension(const std::vector<Criterion>& rCriteria, + const std::unordered_set<sal_Int32>& rRepeatIfEmptyDims); /** Get the cell instance at specified location within the data grid. Note that the data grid doesn't include the header row. Don't delete the returned object! */ const ScDPItemData* getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const; - void getValue( ScDPValue& rVal, SCCOL nCol, SCROW nRow) const; + void getValue(ScDPValue& rVal, SCCOL nCol, SCROW nRow) const; OUString getFieldName(SCCOL nIndex) const; - /** Get the unique entries for a field specified by index. The caller must + /** Get the unique entries for a field specified by index. The caller must make sure that the table is filled before calling function, or it will get an empty collection. */ - const ::std::vector<SCROW>& getFieldEntries( sal_Int32 nColumn ) const; + const ::std::vector<SCROW>& getFieldEntries(sal_Int32 nColumn) const; /** Filter the table based on the specified criteria, and copy the result to rTabData. This method is used, for example, to generate a drill-down data table. */ void filterTable(const std::vector<Criterion>& rCriteria, - css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& rTabData, + css::uno::Sequence<css::uno::Sequence<css::uno::Any>>& rTabData, const std::unordered_set<sal_Int32>& rRepeatIfEmptyDims); void clear(); bool empty() const; #if DUMP_PIVOT_TABLE - static void dumpRowFlag( const RowFlagType& rFlag ); + static void dumpRowFlag(const RowFlagType& rFlag); void dump() const; #endif @@ -152,12 +159,12 @@ private: * @param nRow index of row to be tested. * @param rCriteria a list of criteria */ - bool isRowQualified(sal_Int32 nRow, const ::std::vector<Criterion>& rCriteria, const std::unordered_set<sal_Int32>& rRepeatIfEmptyDims) const; + bool isRowQualified(sal_Int32 nRow, const ::std::vector<Criterion>& rCriteria, + const std::unordered_set<sal_Int32>& rRepeatIfEmptyDims) const; private: - /** unique field entries for each field (column). */ - ::std::vector< ::std::vector<SCROW> > maFieldEntries; + ::std::vector<::std::vector<SCROW>> maFieldEntries; /** Rows visible by standard filter query. */ RowFlagType maShowByFilter; diff --git a/sc/inc/dpresfilter.hxx b/sc/inc/dpresfilter.hxx index 5b68fdb28daa..c9f32b99c890 100644 --- a/sc/inc/dpresfilter.hxx +++ b/sc/inc/dpresfilter.hxx @@ -19,8 +19,14 @@ #include <vector> #include <unordered_map> -namespace com::sun::star::uno { template <typename > class Sequence; } -namespace com::sun::star::sheet { struct DataPilotFieldFilter; } +namespace com::sun::star::uno +{ +template <typename> class Sequence; +} +namespace com::sun::star::sheet +{ +struct DataPilotFieldFilter; +} struct ScDPResultFilter { @@ -28,8 +34,8 @@ struct ScDPResultFilter OUString maValueName; OUString maValue; - bool mbHasValue:1; - bool mbDataLayout:1; + bool mbHasValue : 1; + bool mbDataLayout : 1; ScDPResultFilter(const OUString& rDimName, bool bDataLayout); }; @@ -54,9 +60,8 @@ public: typedef std::vector<double> ValuesType; private: - struct MemberNode; - typedef std::map<OUString, std::shared_ptr<MemberNode> > MembersType; + typedef std::map<OUString, std::shared_ptr<MemberNode>> MembersType; struct DimensionNode { @@ -92,7 +97,7 @@ private: struct NamePairHash { - size_t operator() (const NamePairType& rPair) const; + size_t operator()(const NamePairType& rPair) const; }; typedef std::unordered_map<NamePairType, double, NamePairHash> LeafValuesType; LeafValuesType maLeafValues; @@ -101,7 +106,6 @@ private: std::unique_ptr<MemberNode> mpRoot; public: - ScDPResultTree(); ScDPResultTree(const ScDPResultTree&) = delete; const ScDPResultTree& operator=(const ScDPResultTree&) = delete; @@ -120,8 +124,8 @@ public: bool empty() const; void clear(); - const ValuesType* getResults( - const css::uno::Sequence< css::sheet::DataPilotFieldFilter>& rFilters) const; + const ValuesType* + getResults(const css::uno::Sequence<css::sheet::DataPilotFieldFilter>& rFilters) const; double getLeafResult(const css::sheet::DataPilotFieldFilter& rFilter) const; diff --git a/sc/inc/edittextiterator.hxx b/sc/inc/edittextiterator.hxx index 354719adcea7..3f2ad4a16244 100644 --- a/sc/inc/edittextiterator.hxx +++ b/sc/inc/edittextiterator.hxx @@ -17,8 +17,8 @@ class ScTable; class ScDocument; class EditTextObject; -namespace sc { - +namespace sc +{ /** * Iterate through all edit text cells in a given sheet. The caller must * check the validity of the sheet index passed to its constructor. @@ -46,12 +46,11 @@ class EditTextIterator void init(); public: - EditTextIterator( const ScDocument& rDoc, SCTAB nTab ); + EditTextIterator(const ScDocument& rDoc, SCTAB nTab); const EditTextObject* first(); const EditTextObject* next(); }; - } #endif diff --git a/sc/inc/formulaiter.hxx b/sc/inc/formulaiter.hxx index f49ca5c423a8..6f0838d76382 100644 --- a/sc/inc/formulaiter.hxx +++ b/sc/inc/formulaiter.hxx @@ -35,9 +35,10 @@ private: const ScDocument& mrDoc; formula::FormulaTokenArrayPlainIterator maIter; ScAddress aPos; + public: - ScDetectiveRefIter( const ScDocument& rDoc, ScFormulaCell* pCell ); - bool GetNextRef( ScRange& rRange ); + ScDetectiveRefIter(const ScDocument& rDoc, ScFormulaCell* pCell); + bool GetNextRef(ScRange& rRange); formula::FormulaToken* GetNextRefToken(); }; diff --git a/sc/inc/generalfunction.hxx b/sc/inc/generalfunction.hxx index fa0ae390d906..862667dbe726 100644 --- a/sc/inc/generalfunction.hxx +++ b/sc/inc/generalfunction.hxx @@ -32,64 +32,52 @@ enum class ScGeneralFunction */ NONE = int(css::sheet::GeneralFunction_NONE), - /** function is determined automatically. <p>If the values are all numerical, SUM is used, otherwise COUNT.</p> */ AUTO = int(css::sheet::GeneralFunction_AUTO), - /** sum of all numerical values is calculated. */ SUM = int(css::sheet::GeneralFunction_SUM), - /** all values, including non-numerical values, are counted. */ COUNT = int(css::sheet::GeneralFunction_COUNT), - /** average of all numerical values is calculated. */ AVERAGE = int(css::sheet::GeneralFunction_AVERAGE), - /** maximum value of all numerical values is calculated. */ MAX = int(css::sheet::GeneralFunction_MAX), - /** minimum value of all numerical values is calculated. */ MIN = int(css::sheet::GeneralFunction_MIN), - /** product of all numerical values is calculated. */ PRODUCT = int(css::sheet::GeneralFunction_PRODUCT), - /** numerical values are counted. */ COUNTNUMS = int(css::sheet::GeneralFunction_COUNTNUMS), - /** standard deviation is calculated based on a sample. */ STDEV = int(css::sheet::GeneralFunction_STDEV), - /** standard deviation is calculated based on the entire population. */ STDEVP = int(css::sheet::GeneralFunction_STDEVP), - /** variance is calculated based on a sample. */ VAR = int(css::sheet::GeneralFunction_VAR), - /** variance is calculated based on the entire population. */ VARP = int(css::sheet::GeneralFunction_VARP), @@ -98,7 +86,7 @@ enum class ScGeneralFunction * median of all numerical values is calculated. * @since LibreOffice 5.3 */ - MEDIAN = css::sheet::GeneralFunction2::MEDIAN + MEDIAN = css::sheet::GeneralFunction2::MEDIAN }; #endif diff --git a/sc/inc/listenercontext.hxx b/sc/inc/listenercontext.hxx index 8d62022c28bc..616af5d7a3c2 100644 --- a/sc/inc/listenercontext.hxx +++ b/sc/inc/listenercontext.hxx @@ -19,8 +19,8 @@ class ScDocument; class ScTokenArray; -namespace sc { - +namespace sc +{ class ColumnSet; class StartListeningContext @@ -28,14 +28,15 @@ class StartListeningContext ScDocument& mrDoc; std::shared_ptr<ColumnBlockPositionSet> mpSet; std::shared_ptr<const ColumnSet> mpColSet; + public: StartListeningContext(const StartListeningContext&) = delete; const StartListeningContext& operator=(const StartListeningContext&) = delete; StartListeningContext(ScDocument& rDoc); StartListeningContext(ScDocument& rDoc, const std::shared_ptr<ColumnBlockPositionSet>& pSet); - void setColumnSet( const std::shared_ptr<const ColumnSet>& pColSet ); + void setColumnSet(const std::shared_ptr<const ColumnSet>& pColSet); const std::shared_ptr<const ColumnSet>& getColumnSet() const; - ScDocument& getDoc() { return mrDoc;} + ScDocument& getDoc() { return mrDoc; } ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol); }; @@ -52,13 +53,14 @@ public: EndListeningContext(const EndListeningContext&) = delete; const EndListeningContext& operator=(const EndListeningContext&) = delete; EndListeningContext(ScDocument& rDoc, ScTokenArray* pOldCode = nullptr); - EndListeningContext(ScDocument& rDoc, const std::shared_ptr<ColumnBlockPositionSet>& pSet, ScTokenArray* pOldCode = nullptr); + EndListeningContext(ScDocument& rDoc, const std::shared_ptr<ColumnBlockPositionSet>& pSet, + ScTokenArray* pOldCode = nullptr); - void setPositionDelta( const ScAddress& rDelta ); + void setPositionDelta(const ScAddress& rDelta); - ScDocument& getDoc() { return mrDoc;} - ScTokenArray* getOldCode() { return mpOldCode;} - ScAddress getOldPosition( const ScAddress& rPos ) const; + ScDocument& getDoc() { return mrDoc; } + ScTokenArray* getOldCode() { return mpOldCode; } + ScAddress getOldPosition(const ScAddress& rPos) const; ColumnBlockPosition* getBlockPosition(SCTAB nTab, SCCOL nCol); @@ -74,12 +76,11 @@ class PurgeListenerAction final : public ColumnSpanSet::Action public: PurgeListenerAction(const PurgeListenerAction&) = delete; const PurgeListenerAction& operator=(const PurgeListenerAction&) = delete; - PurgeListenerAction( ScDocument& rDoc ); + PurgeListenerAction(ScDocument& rDoc); - virtual void startColumn( SCTAB nTab, SCCOL nCol ) override; - virtual void execute( const ScAddress& rPos, SCROW nLength, bool bVal ) override; + virtual void startColumn(SCTAB nTab, SCCOL nCol) override; + virtual void execute(const ScAddress& rPos, SCROW nLength, bool bVal) override; }; - } #endif diff --git a/sc/inc/listenerquery.hxx b/sc/inc/listenerquery.hxx index 9148211ed73c..095e65f762b3 100644 --- a/sc/inc/listenerquery.hxx +++ b/sc/inc/listenerquery.hxx @@ -17,8 +17,8 @@ #include <unordered_map> #include <vector> -namespace sc { - +namespace sc +{ /** * Used to collect positions of formula cells that belong to a formula * group. @@ -27,14 +27,14 @@ class RefQueryFormulaGroup final : public SvtListener::QueryBase { public: typedef std::vector<SCROW> ColType; - typedef std::unordered_map<SCCOL,ColType> ColsType; - typedef std::unordered_map<SCTAB,ColsType> TabsType; + typedef std::unordered_map<SCCOL, ColType> ColsType; + typedef std::unordered_map<SCTAB, ColsType> TabsType; RefQueryFormulaGroup(); virtual ~RefQueryFormulaGroup() override; - void setSkipRange( const ScRange& rRange ); - void add( const ScAddress& rPos ); + void setSkipRange(const ScRange& rRange); + void add(const ScAddress& rPos); /** * Row positions in each column may contain duplicates. Caller must @@ -51,18 +51,17 @@ class QueryRange final : public SvtListener::QueryBase { ScRangeList maRanges; - QueryRange( const QueryRange& ) = delete; - QueryRange& operator= ( const QueryRange& ) = delete; + QueryRange(const QueryRange&) = delete; + QueryRange& operator=(const QueryRange&) = delete; public: QueryRange(); virtual ~QueryRange() override; - void add( const ScRange& rRange ); + void add(const ScRange& rRange); - void swapRanges( ScRangeList& rRanges ); + void swapRanges(ScRangeList& rRanges); }; - } #endif diff --git a/sc/inc/macromgr.hxx b/sc/inc/macromgr.hxx index f8e905957692..bd2877095291 100644 --- a/sc/inc/macromgr.hxx +++ b/sc/inc/macromgr.hxx @@ -29,17 +29,17 @@ public: ~ScMacroManager(); SC_DLLPUBLIC void InitUserFuncData(); - SC_DLLPUBLIC void SetUserFuncVolatile( const OUString& sName, bool isVolatile ); - SC_DLLPUBLIC bool GetUserFuncVolatile( const OUString& sName ); + SC_DLLPUBLIC void SetUserFuncVolatile(const OUString& sName, bool isVolatile); + SC_DLLPUBLIC bool GetUserFuncVolatile(const OUString& sName); void AddDependentCell(const OUString& aModuleName, ScFormulaCell* pCell); void RemoveDependentCell(const ScFormulaCell* pCell); void BroadcastModuleUpdate(const OUString& aModuleName); private: - typedef std::unordered_map< OUString, bool > NameBoolMap; + typedef std::unordered_map<OUString, bool> NameBoolMap; NameBoolMap mhFuncToVolatile; - css::uno::Reference< css::container::XContainerListener > mxContainerListener; + css::uno::Reference<css::container::XContainerListener> mxContainerListener; ::std::unique_ptr<ScUserMacroDepTracker> mpDepTracker; ScDocument& mrDoc; diff --git a/sc/inc/mid.h b/sc/inc/mid.h index 441f004c7358..614bcf91ee02 100644 --- a/sc/inc/mid.h +++ b/sc/inc/mid.h @@ -20,10 +20,10 @@ #ifndef SC_MID_H #define SC_MID_H -#define MID_1 1 -#define MID_2 2 -#define MID_3 3 -#define MID_4 4 +#define MID_1 1 +#define MID_2 2 +#define MID_3 3 +#define MID_4 4 #endif diff --git a/sc/inc/numformat.hxx b/sc/inc/numformat.hxx index 739c7f1d9329..cfd365386119 100644 --- a/sc/inc/numformat.hxx +++ b/sc/inc/numformat.hxx @@ -16,8 +16,8 @@ class ScPatternAttr; class ScDocument; -namespace sc { - +namespace sc +{ class SC_DLLPUBLIC NumFmtUtil { public: @@ -25,11 +25,10 @@ public: * Check if the attribute pattern has a number format that only produces * latin script output. */ - static bool isLatinScript( const ScPatternAttr& rPat, ScDocument& rDoc ); + static bool isLatinScript(const ScPatternAttr& rPat, ScDocument& rDoc); - static bool isLatinScript( sal_uLong nFormat, ScDocument& rDoc ); + static bool isLatinScript(sal_uLong nFormat, ScDocument& rDoc); }; - } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/pageuno.hxx b/sc/inc/pageuno.hxx index 25da0d7d2ff5..987bb5e9c30b 100644 --- a/sc/inc/pageuno.hxx +++ b/sc/inc/pageuno.hxx @@ -30,11 +30,11 @@ public: ScPageObj(SdrPage* pPage); virtual ~ScPageObj() throw() override; - virtual css::uno::Reference<css::drawing::XShape> CreateShape(SdrObject *pObj) const override; + virtual css::uno::Reference<css::drawing::XShape> CreateShape(SdrObject* pObj) const override; - // XServiceInfo + // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; - virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override; + virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override; virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; }; diff --git a/sc/inc/reffind.hxx b/sc/inc/reffind.hxx index 9defa2986a8b..212650fd4956 100644 --- a/sc/inc/reffind.hxx +++ b/sc/inc/reffind.hxx @@ -35,9 +35,9 @@ class ScRefFinder sal_Int32 mnSelEnd; public: - ScRefFinder( - const OUString& rFormula, const ScAddress& rPos, ScDocument& rDoc, - formula::FormulaGrammar::AddressConvention eConvP = formula::FormulaGrammar::CONV_OOO ); + ScRefFinder(const OUString& rFormula, const ScAddress& rPos, ScDocument& rDoc, + formula::FormulaGrammar::AddressConvention eConvP + = formula::FormulaGrammar::CONV_OOO); ~ScRefFinder(); const OUString& GetText() const { return maFormula; } @@ -45,7 +45,7 @@ public: sal_Int32 GetSelStart() const { return mnSelStart; } sal_Int32 GetSelEnd() const { return mnSelEnd; } - void ToggleRel( sal_Int32 nStartPos, sal_Int32 nEndPos ); + void ToggleRel(sal_Int32 nStartPos, sal_Int32 nEndPos); }; #endif diff --git a/sc/inc/refreshtimerprotector.hxx b/sc/inc/refreshtimerprotector.hxx index 9fcb50421096..5ded7aa07fb8 100644 --- a/sc/inc/refreshtimerprotector.hxx +++ b/sc/inc/refreshtimerprotector.hxx @@ -18,10 +18,10 @@ class ScRefreshTimerControl; class SC_DLLPUBLIC ScRefreshTimerProtector { - std::unique_ptr<ScRefreshTimerControl> const & m_rpControl; + std::unique_ptr<ScRefreshTimerControl> const& m_rpControl; public: - ScRefreshTimerProtector( std::unique_ptr<ScRefreshTimerControl> const & rp ); + ScRefreshTimerProtector(std::unique_ptr<ScRefreshTimerControl> const& rp); ~ScRefreshTimerProtector(); }; diff --git a/sc/inc/scdllapi.h b/sc/inc/scdllapi.h index 2e88ef197444..a7b914ee77a9 100644 --- a/sc/inc/scdllapi.h +++ b/sc/inc/scdllapi.h @@ -23,9 +23,9 @@ #include <sal/types.h> #if defined(SC_DLLIMPLEMENTATION) -#define SC_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#define SC_DLLPUBLIC SAL_DLLPUBLIC_EXPORT #else -#define SC_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#define SC_DLLPUBLIC SAL_DLLPUBLIC_IMPORT #endif #endif // INCLUDED_SC_INC_SCDLLAPI_H diff --git a/sc/inc/scopetools.hxx b/sc/inc/scopetools.hxx index eb2941f15777..950ac699bc8e 100644 --- a/sc/inc/scopetools.hxx +++ b/sc/inc/scopetools.hxx @@ -14,22 +14,25 @@ class ScDocument; class ScColumn; -namespace vcl { class Window; } - -namespace sc { +namespace vcl +{ +class Window; +} +namespace sc +{ /** * Temporarily switch on/off auto calculation mode. */ class SC_DLLPUBLIC AutoCalcSwitch { ScDocument& mrDoc; - bool mbOldValue; + bool mbOldValue; - AutoCalcSwitch(AutoCalcSwitch const &) = delete; - AutoCalcSwitch(AutoCalcSwitch &&) = delete; - AutoCalcSwitch & operator =(AutoCalcSwitch const &) = delete; - AutoCalcSwitch & operator =(AutoCalcSwitch &&) = delete; + AutoCalcSwitch(AutoCalcSwitch const&) = delete; + AutoCalcSwitch(AutoCalcSwitch&&) = delete; + AutoCalcSwitch& operator=(AutoCalcSwitch const&) = delete; + AutoCalcSwitch& operator=(AutoCalcSwitch&&) = delete; public: AutoCalcSwitch(ScDocument& rDoc, bool bAutoCalc); @@ -40,6 +43,7 @@ class ExpandRefsSwitch { ScDocument& mrDoc; bool mbOldValue; + public: ExpandRefsSwitch(ScDocument& rDoc, bool bExpandRefs); ~ExpandRefsSwitch(); @@ -49,6 +53,7 @@ class SC_DLLPUBLIC UndoSwitch { ScDocument& mrDoc; bool mbOldValue; + public: UndoSwitch(ScDocument& rDoc, bool bUndo); ~UndoSwitch(); @@ -58,6 +63,7 @@ class IdleSwitch { ScDocument& mrDoc; bool mbOldValue; + public: IdleSwitch(ScDocument& rDoc, bool bEnableIdle); ~IdleSwitch(); @@ -68,6 +74,7 @@ class DelayFormulaGroupingSwitch { ScDocument& mrDoc; bool const mbOldValue; + public: DelayFormulaGroupingSwitch(ScDocument& rDoc, bool delay); ~DelayFormulaGroupingSwitch() COVERITY_NOEXCEPT_FALSE; @@ -79,6 +86,7 @@ class DelayStartListeningFormulaCells { ScColumn& mColumn; bool const mbOldValue; + public: DelayStartListeningFormulaCells(ScColumn& column, bool delay); DelayStartListeningFormulaCells(ScColumn& column); @@ -86,7 +94,6 @@ public: ~DelayStartListeningFormulaCells(); void set(); }; - } #endif diff --git a/sc/inc/segmenttree.hxx b/sc/inc/segmenttree.hxx index f37a3d3facd6..58e59e60cd84 100644 --- a/sc/inc/segmenttree.hxx +++ b/sc/inc/segmenttree.hxx @@ -32,9 +32,9 @@ class ScFlatBoolRowSegments public: struct RangeData { - SCROW mnRow1; - SCROW mnRow2; - bool mbValue; + SCROW mnRow1; + SCROW mnRow2; + bool mbValue; }; class ForwardIterator @@ -42,26 +42,26 @@ public: public: explicit ForwardIterator(ScFlatBoolRowSegments& rSegs); - [[nodiscard]] - bool getValue(SCROW nPos, bool& rVal); - SCROW getLastPos() const { return mnLastPos;} + [[nodiscard]] bool getValue(SCROW nPos, bool& rVal); + SCROW getLastPos() const { return mnLastPos; } private: - ScFlatBoolRowSegments& mrSegs; + ScFlatBoolRowSegments& mrSegs; - SCROW mnCurPos; - SCROW mnLastPos; - bool mbCurValue; + SCROW mnCurPos; + SCROW mnLastPos; + bool mbCurValue; }; class RangeIterator { public: - explicit RangeIterator(ScFlatBoolRowSegments const & rSegs); + explicit RangeIterator(ScFlatBoolRowSegments const& rSegs); bool getFirst(RangeData& rRange); bool getNext(RangeData& rRange); + private: - ScFlatBoolRowSegments const & mrSegs; + ScFlatBoolRowSegments const& mrSegs; }; ScFlatBoolRowSegments(SCROW nMaxRow); @@ -88,9 +88,9 @@ class ScFlatBoolColSegments public: struct RangeData { - SCCOL mnCol1; - SCCOL mnCol2; - bool mbValue; + SCCOL mnCol1; + SCCOL mnCol2; + bool mbValue; }; ScFlatBoolColSegments(SCCOL nMaxCol); ScFlatBoolColSegments(const ScFlatBoolColSegments& r); @@ -115,9 +115,9 @@ class ScFlatUInt16RowSegments public: struct RangeData { - SCROW mnRow1; - SCROW mnRow2; - sal_uInt16 mnValue; + SCROW mnRow1; + SCROW mnRow2; + sal_uInt16 mnValue; }; class ForwardIterator @@ -126,14 +126,14 @@ public: explicit ForwardIterator(ScFlatUInt16RowSegments& rSegs); bool getValue(SCROW nPos, sal_uInt16& rVal); - SCROW getLastPos() const { return mnLastPos;} + SCROW getLastPos() const { return mnLastPos; } private: - ScFlatUInt16RowSegments& mrSegs; + ScFlatUInt16RowSegments& mrSegs; - SCROW mnCurPos; - SCROW mnLastPos; - sal_uInt16 mnCurValue; + SCROW mnCurPos; + SCROW mnLastPos; + sal_uInt16 mnCurValue; }; ScFlatUInt16RowSegments(SCROW nMaxRow, sal_uInt16 nDefault); @@ -141,7 +141,8 @@ public: ~ScFlatUInt16RowSegments(); void setValue(SCROW nRow1, SCROW nRow2, sal_uInt16 nValue); - void setValueIf(SCROW nRow1, SCROW nRow2, sal_uInt16 nValue, const std::function<bool(sal_uInt16)>& rPredicate); + void setValueIf(SCROW nRow1, SCROW nRow2, sal_uInt16 nValue, + const std::function<bool(sal_uInt16)>& rPredicate); sal_uInt16 getValue(SCROW nRow); sal_uInt32 getSumValue(SCROW nRow1, SCROW nRow2); bool getRangeData(SCROW nRow, RangeData& rData); diff --git a/sc/inc/stylehelper.hxx b/sc/inc/stylehelper.hxx index 81252653c7a4..68e6d252b03c 100644 --- a/sc/inc/stylehelper.hxx +++ b/sc/inc/stylehelper.hxx @@ -27,8 +27,8 @@ enum class SfxStyleFamily; class ScStyleNameConversion { public: - static OUString DisplayToProgrammaticName( const OUString& rDispName, SfxStyleFamily nType ); - static OUString ProgrammaticToDisplayName( const OUString& rProgName, SfxStyleFamily nType ); + static OUString DisplayToProgrammaticName(const OUString& rDispName, SfxStyleFamily nType); + static OUString ProgrammaticToDisplayName(const OUString& rProgName, SfxStyleFamily nType); }; #endif diff --git a/sc/inc/tokenstringcontext.hxx b/sc/inc/tokenstringcontext.hxx index 34d9bc99b50f..b44ab8bf087d 100644 --- a/sc/inc/tokenstringcontext.hxx +++ b/sc/inc/tokenstringcontext.hxx @@ -16,8 +16,8 @@ class ScDocument; -namespace sc { - +namespace sc +{ /** * Context for creating string from an array of formula tokens, used in * ScTokenArray::CreateString(). You can re-use the same string context @@ -27,7 +27,7 @@ namespace sc { struct SC_DLLPUBLIC TokenStringContext { typedef std::unordered_map<sal_uInt16, OUString> IndexNameMapType; - typedef std::unordered_map<size_t, std::vector<OUString> > IndexNamesMapType; + typedef std::unordered_map<size_t, std::vector<OUString>> IndexNamesMapType; typedef std::unordered_map<SCTAB, IndexNameMapType> TabIndexMapType; formula::FormulaGrammar::Grammar meGram; @@ -43,7 +43,7 @@ struct SC_DLLPUBLIC TokenStringContext std::vector<OUString> maExternalFileNames; IndexNamesMapType maExternalCachedTabNames; - TokenStringContext( const ScDocument& rDoc, formula::FormulaGrammar::Grammar eGram ); + TokenStringContext(const ScDocument& rDoc, formula::FormulaGrammar::Grammar eGram); }; class SC_DLLPUBLIC CompileFormulaContext @@ -55,17 +55,16 @@ class SC_DLLPUBLIC CompileFormulaContext void updateTabNames(); public: - CompileFormulaContext( ScDocument& rDoc ); - CompileFormulaContext( ScDocument& rDoc, formula::FormulaGrammar::Grammar eGram ); + CompileFormulaContext(ScDocument& rDoc); + CompileFormulaContext(ScDocument& rDoc, formula::FormulaGrammar::Grammar eGram); - formula::FormulaGrammar::Grammar getGrammar() const { return meGram;} - void setGrammar( formula::FormulaGrammar::Grammar eGram ); + formula::FormulaGrammar::Grammar getGrammar() const { return meGram; } + void setGrammar(formula::FormulaGrammar::Grammar eGram); - const std::vector<OUString>& getTabNames() const { return maTabNames;} + const std::vector<OUString>& getTabNames() const { return maTabNames; } - ScDocument& getDoc() { return mrDoc;} + ScDocument& getDoc() { return mrDoc; } }; - } #endif diff --git a/sc/inc/unitconv.hxx b/sc/inc/unitconv.hxx index c4baa1cf9764..d16ee89391e1 100644 --- a/sc/inc/unitconv.hxx +++ b/sc/inc/unitconv.hxx @@ -30,16 +30,14 @@ class ScUnitConverterData double mfValue; public: - ScUnitConverterData( const OUString& rFromUnit, - const OUString& rToUnit, double fValue ); - ScUnitConverterData( const ScUnitConverterData& ) = default; - ScUnitConverterData& operator=( const ScUnitConverterData& ) = delete; + ScUnitConverterData(const OUString& rFromUnit, const OUString& rToUnit, double fValue); + ScUnitConverterData(const ScUnitConverterData&) = default; + ScUnitConverterData& operator=(const ScUnitConverterData&) = delete; - double GetValue() const { return mfValue;} - const OUString& GetIndexString() const { return maIndexString;} + double GetValue() const { return mfValue; } + const OUString& GetIndexString() const { return maIndexString; } - static OUString BuildIndexString( - const OUString& rFromUnit, const OUString& rToUnit ); + static OUString BuildIndexString(const OUString& rFromUnit, const OUString& rToUnit); }; class ScUnitConverter @@ -53,8 +51,7 @@ public: const ScUnitConverter& operator=(const ScUnitConverter&) = delete; ~ScUnitConverter(); - bool GetValue( - double& fValue, const OUString& rFromUnit, const OUString& rToUnit ) const; + bool GetValue(double& fValue, const OUString& rFromUnit, const OUString& rToUnit) const; }; #endif diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx index af9fe70ebdb3..ba3ac290153a 100644 --- a/sc/inc/userlist.hxx +++ b/sc/inc/userlist.hxx @@ -39,12 +39,13 @@ public: OUString maUpper; SubStr(const OUString& rReal, const OUString& rUpper); }; + private: typedef std::vector<SubStr> SubStringsType; SubStringsType maSubStrings; OUString aStr; - SAL_DLLPRIVATE void InitTokens(); + SAL_DLLPRIVATE void InitTokens(); public: ScUserListData(const OUString& rStr); @@ -65,8 +66,9 @@ public: */ class SC_DLLPUBLIC ScUserList { - typedef std::vector< std::unique_ptr<ScUserListData> > DataType; + typedef std::vector<std::unique_ptr<ScUserListData>> DataType; DataType maData; + public: typedef DataType::iterator iterator; typedef DataType::const_iterator const_iterator; @@ -74,15 +76,15 @@ public: ScUserList(); ScUserList(const ScUserList& r); - const ScUserListData* GetData( const OUString& rSubStr ) const; + const ScUserListData* GetData(const OUString& rSubStr) const; /// If the list in rStr is already inserted - bool HasEntry( const OUString& rStr ) const; + bool HasEntry(const OUString& rStr) const; - const ScUserListData& operator[](size_t nIndex) const; - ScUserListData& operator[](size_t nIndex); - ScUserList& operator= ( const ScUserList& r ); - bool operator==( const ScUserList& r ) const; - bool operator!=( const ScUserList& r ) const; + const ScUserListData& operator[](size_t nIndex) const; + ScUserListData& operator[](size_t nIndex); + ScUserList& operator=(const ScUserList& r); + bool operator==(const ScUserList& r) const; + bool operator!=(const ScUserList& r) const; iterator begin(); const_iterator begin() const; diff --git a/sc/inc/zforauto.hxx b/sc/inc/zforauto.hxx index d62498df2464..540ac208d18d 100644 --- a/sc/inc/zforauto.hxx +++ b/sc/inc/zforauto.hxx @@ -31,18 +31,18 @@ class ScNumFormatAbbrev OUString sFormatstring; LanguageType eLanguage; LanguageType eSysLanguage; + public: ScNumFormatAbbrev(); ScNumFormatAbbrev(sal_uInt32 nFormat, const SvNumberFormatter& rFormatter); - void Load( SvStream& rStream, rtl_TextEncoding eByteStrSet ); // loading of the numberformats - void Save( SvStream& rStream, rtl_TextEncoding eByteStrSet ) const; // saving of the numberformats + void Load(SvStream& rStream, rtl_TextEncoding eByteStrSet); // loading of the numberformats + void Save(SvStream& rStream, rtl_TextEncoding eByteStrSet) const; // saving of the numberformats void PutFormatIndex(sal_uInt32 nFormat, const SvNumberFormatter& rFormatter); - sal_uInt32 GetFormatIndex( SvNumberFormatter& rFormatter); + sal_uInt32 GetFormatIndex(SvNumberFormatter& rFormatter); bool operator==(const ScNumFormatAbbrev& rNumFormat) const { - return ((sFormatstring == rNumFormat.sFormatstring) - && (eLanguage == rNumFormat.eLanguage) - && (eSysLanguage == rNumFormat.eSysLanguage)); + return ((sFormatstring == rNumFormat.sFormatstring) && (eLanguage == rNumFormat.eLanguage) + && (eSysLanguage == rNumFormat.eSysLanguage)); } LanguageType GetLanguage() const { return eLanguage; } }; diff --git a/sc/qa/extras/check_data_pilot_field.cxx b/sc/qa/extras/check_data_pilot_field.cxx index 3445245ade2b..bde647232839 100644 --- a/sc/qa/extras/check_data_pilot_field.cxx +++ b/sc/qa/extras/check_data_pilot_field.cxx @@ -27,17 +27,19 @@ using namespace css; using namespace css::lang; -namespace sc_apitest { - -class CheckDataPilotField : public CalcUnoApiTest, public apitest::XNamed, public apitest::XPropertySet +namespace sc_apitest +{ +class CheckDataPilotField : public CalcUnoApiTest, + public apitest::XNamed, + public apitest::XPropertySet { - public: +public: CheckDataPilotField(); virtual void setUp() override; virtual void tearDown() override; - uno::Reference< uno::XInterface > init() override; + uno::Reference<uno::XInterface> init() override; CPPUNIT_TEST_SUITE(CheckDataPilotField); @@ -53,7 +55,6 @@ class CheckDataPilotField : public CalcUnoApiTest, public apitest::XNamed, publi CPPUNIT_TEST_SUITE_END(); protected: - virtual bool isPropertyIgnored(const OUString& rName) override; private: @@ -64,19 +65,17 @@ private: bool CheckDataPilotField::isPropertyIgnored(const OUString& rName) { - return rName == "Function" - || rName == "Subtotals" - || rName == "Function2" - || rName == "Subtotals2"; + return rName == "Function" || rName == "Subtotals" || rName == "Function2" + || rName == "Subtotals2"; } CheckDataPilotField::CheckDataPilotField() - : CalcUnoApiTest("/sc/qa/extras/testdocuments"), - apitest::XNamed("Col1") + : CalcUnoApiTest("/sc/qa/extras/testdocuments") + , apitest::XNamed("Col1") { } -uno::Reference< uno::XInterface > CheckDataPilotField::init() +uno::Reference<uno::XInterface> CheckDataPilotField::init() { // create a calc document if (!mxComponent.is()) @@ -85,14 +84,14 @@ uno::Reference< uno::XInterface > CheckDataPilotField::init() else return mxObject; - uno::Reference< sheet::XSpreadsheetDocument > xSheetDoc(mxComponent, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheetDocument> xSheetDoc(mxComponent, uno::UNO_QUERY_THROW); // the cell range table::CellRangeAddress sCellRangeAdress; sCellRangeAdress.Sheet = 0; sCellRangeAdress.StartColumn = 1; sCellRangeAdress.StartRow = 0; - sCellRangeAdress.EndColumn = mMaxFieldIndex-1; + sCellRangeAdress.EndColumn = mMaxFieldIndex - 1; sCellRangeAdress.EndRow = mMaxFieldIndex - 1; // position of the data pilot table @@ -101,17 +100,17 @@ uno::Reference< uno::XInterface > CheckDataPilotField::init() sCellAdress.Column = 7; sCellAdress.Row = 8; // Getting spreadsheet - uno::Reference< sheet::XSpreadsheets > xSpreadsheets = xSheetDoc->getSheets(); - uno::Reference< container::XIndexAccess > oIndexAccess(xSpreadsheets, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheets> xSpreadsheets = xSheetDoc->getSheets(); + uno::Reference<container::XIndexAccess> oIndexAccess(xSpreadsheets, uno::UNO_QUERY_THROW); // Per default there's now just one sheet, make sure we have at least two, then xSpreadsheets->insertNewByName("Some Sheet", 0); uno::Any aAny = oIndexAccess->getByIndex(0); - uno::Reference< sheet::XSpreadsheet > oSheet; + uno::Reference<sheet::XSpreadsheet> oSheet; CPPUNIT_ASSERT(aAny >>= oSheet); uno::Any aAny2 = oIndexAccess->getByIndex(1); - uno::Reference< sheet::XSpreadsheet > oSheet2; + uno::Reference<sheet::XSpreadsheet> oSheet2; CPPUNIT_ASSERT(aAny2 >>= oSheet2); //Filling a table @@ -129,33 +128,33 @@ uno::Reference< uno::XInterface > CheckDataPilotField::init() { oSheet->getCellByPosition(i, j)->setValue(i * (j + 1)); oSheet2->getCellByPosition(i, j)->setValue(i * (j + 2)); - } + } } // change a value of a cell and check the change in the data pilot // cell of data uno::Any oChangeCell; - oChangeCell<<= oSheet->getCellByPosition(1, 5); + oChangeCell <<= oSheet->getCellByPosition(1, 5); int x = sCellAdress.Column; int y = sCellAdress.Row + 3; // cell of the data pilot output uno::Any oCheckCell; - oCheckCell<<= oSheet->getCellByPosition(x, y); + oCheckCell <<= oSheet->getCellByPosition(x, y); // create the test objects - uno::Reference< sheet::XDataPilotTablesSupplier> DPTS(oSheet, uno::UNO_QUERY_THROW); - uno::Reference< sheet::XDataPilotTables> DPT = DPTS->getDataPilotTables(); - uno::Reference< sheet::XDataPilotDescriptor> DPDsc = DPT->createDataPilotDescriptor(); + uno::Reference<sheet::XDataPilotTablesSupplier> DPTS(oSheet, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XDataPilotTables> DPT = DPTS->getDataPilotTables(); + uno::Reference<sheet::XDataPilotDescriptor> DPDsc = DPT->createDataPilotDescriptor(); DPDsc->setSourceRange(sCellRangeAdress); uno::Any oDataPilotField = DPDsc->getDataPilotFields()->getByIndex(0); - uno::Reference<beans::XPropertySet> fieldPropSet(oDataPilotField, uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> fieldPropSet(oDataPilotField, uno::UNO_QUERY_THROW); uno::Any sum; - sum<<= sheet::GeneralFunction_SUM; - fieldPropSet->setPropertyValue("Function", sum ); + sum <<= sheet::GeneralFunction_SUM; + fieldPropSet->setPropertyValue("Function", sum); uno::Any data; - data<<= sheet::DataPilotFieldOrientation_DATA; + data <<= sheet::DataPilotFieldOrientation_DATA; fieldPropSet->setPropertyValue("Orientation", data); //Insert the DataPilotTable @@ -163,7 +162,7 @@ uno::Reference< uno::XInterface > CheckDataPilotField::init() DPT->removeByName("DataPilotField"); DPT->insertNewByName("DataPilotTField", sCellAdress, DPDsc); - uno::Reference< container::XIndexAccess > IA = DPDsc->getDataPilotFields(); + uno::Reference<container::XIndexAccess> IA = DPDsc->getDataPilotFields(); uno::Reference<uno::XInterface> xDataPilotFieldObject; data = IA->getByIndex(0); CPPUNIT_ASSERT(data >>= xDataPilotFieldObject); @@ -172,7 +171,6 @@ uno::Reference< uno::XInterface > CheckDataPilotField::init() return xDataPilotFieldObject; } - void CheckDataPilotField::setUp() { CalcUnoApiTest::setUp(); @@ -187,7 +185,6 @@ void CheckDataPilotField::tearDown() } CPPUNIT_TEST_SUITE_REGISTRATION(CheckDataPilotField); - } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/qa/extras/recordchanges-test.cxx b/sc/qa/extras/recordchanges-test.cxx index 357023e0d361..709a80238af6 100644 --- a/sc/qa/extras/recordchanges-test.cxx +++ b/sc/qa/extras/recordchanges-test.cxx @@ -31,22 +31,21 @@ public: CPPUNIT_TEST(testSetRecordChanges); CPPUNIT_TEST(testCheckRecordChangesProtection); CPPUNIT_TEST_SUITE_END(); - }; void ScRecordChangesTest::testSetRecordChanges() { + uno::Reference<css::lang::XComponent> xComponent = loadFromDesktop("private:factory/scalc"); - uno::Reference< css::lang::XComponent > xComponent = loadFromDesktop("private:factory/scalc"); - - uno::Reference< sheet::XSpreadsheetDocument > xDoc(xComponent, UNO_QUERY_THROW); - uno::Reference< beans::XPropertySet > xDocSettingsPropSet (xDoc, UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheetDocument> xDoc(xComponent, UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xDocSettingsPropSet(xDoc, UNO_QUERY_THROW); bool recordChangesValue = true; bool protectionValue = true; CPPUNIT_ASSERT(xDocSettingsPropSet->getPropertyValue("RecordChanges") >>= recordChangesValue); - CPPUNIT_ASSERT(xDocSettingsPropSet->getPropertyValue("IsRecordChangesProtected") >>= protectionValue); + CPPUNIT_ASSERT(xDocSettingsPropSet->getPropertyValue("IsRecordChangesProtected") + >>= protectionValue); CPPUNIT_ASSERT_MESSAGE("a new document does not record changes", !recordChangesValue); CPPUNIT_ASSERT_MESSAGE("a new document does not protect record changes", !protectionValue); @@ -66,17 +65,18 @@ void ScRecordChangesTest::testCheckRecordChangesProtection() { // test with protected changes OUString aFileName; - createFileURL( "RecordChangesProtected.ods", aFileName); - uno::Reference< css::lang::XComponent > xComponent = loadFromDesktop(aFileName); + createFileURL("RecordChangesProtected.ods", aFileName); + uno::Reference<css::lang::XComponent> xComponent = loadFromDesktop(aFileName); - uno::Reference< sheet::XSpreadsheetDocument > xDoc(xComponent, UNO_QUERY_THROW); - uno::Reference< beans::XPropertySet > xDocSettingsPropSet (xDoc, UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheetDocument> xDoc(xComponent, UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xDocSettingsPropSet(xDoc, UNO_QUERY_THROW); bool recordChangesValue = false; bool protectionValue = false; CPPUNIT_ASSERT(xDocSettingsPropSet->getPropertyValue("RecordChanges") >>= recordChangesValue); - CPPUNIT_ASSERT(xDocSettingsPropSet->getPropertyValue("IsRecordChangesProtected") >>= protectionValue); + CPPUNIT_ASSERT(xDocSettingsPropSet->getPropertyValue("IsRecordChangesProtected") + >>= protectionValue); CPPUNIT_ASSERT_MESSAGE("the document should be recording changes", recordChangesValue); CPPUNIT_ASSERT_MESSAGE("the protection should be active", protectionValue); @@ -87,7 +87,8 @@ void ScRecordChangesTest::testCheckRecordChangesProtection() xDocSettingsPropSet->setPropertyValue("RecordChanges", aValue); CPPUNIT_ASSERT(xDocSettingsPropSet->getPropertyValue("RecordChanges") >>= recordChangesValue); - CPPUNIT_ASSERT(xDocSettingsPropSet->getPropertyValue("IsRecordChangesProtected") >>= protectionValue); + CPPUNIT_ASSERT(xDocSettingsPropSet->getPropertyValue("IsRecordChangesProtected") + >>= protectionValue); // this document should still record changes as protection is set CPPUNIT_ASSERT_MESSAGE("the document should still be recording changes", recordChangesValue); @@ -97,7 +98,7 @@ void ScRecordChangesTest::testCheckRecordChangesProtection() } ScRecordChangesTest::ScRecordChangesTest() - : UnoApiTest("/sc/qa/extras/testdocuments") + : UnoApiTest("/sc/qa/extras/testdocuments") { } diff --git a/sc/qa/extras/sccellrangesobj.cxx b/sc/qa/extras/sccellrangesobj.cxx index 174552d9c598..e87f6792e9e9 100644 --- a/sc/qa/extras/sccellrangesobj.cxx +++ b/sc/qa/extras/sccellrangesobj.cxx @@ -28,8 +28,8 @@ using namespace css; using namespace css::uno; -namespace sc_apitest { - +namespace sc_apitest +{ class ScCellRangesObj : public CalcUnoApiTest, public apitest::SheetCellRanges, public apitest::XEnumerationAccess, @@ -45,8 +45,8 @@ public: virtual void setUp() override; virtual void tearDown() override; - virtual uno::Reference< uno::XInterface > getXSpreadsheet() override; - virtual uno::Reference< uno::XInterface > init() override; + virtual uno::Reference<uno::XInterface> getXSpreadsheet() override; + virtual uno::Reference<uno::XInterface> init() override; CPPUNIT_TEST_SUITE(ScCellRangesObj); @@ -80,23 +80,25 @@ public: CPPUNIT_TEST_SUITE_END(); private: - uno::Reference< lang::XComponent > mxComponent; + uno::Reference<lang::XComponent> mxComponent; }; -ScCellRangesObj::ScCellRangesObj(): - CalcUnoApiTest("/sc/qa/extras/testdocuments"), - apitest::XFormulaQuery(table::CellRangeAddress(0, 4, 1, 5, 4), table::CellRangeAddress(0, 4, 1, 5, 4)) +ScCellRangesObj::ScCellRangesObj() + : CalcUnoApiTest("/sc/qa/extras/testdocuments") + , apitest::XFormulaQuery(table::CellRangeAddress(0, 4, 1, 5, 4), + table::CellRangeAddress(0, 4, 1, 5, 4)) { } -uno::Reference< uno::XInterface > ScCellRangesObj::init() +uno::Reference<uno::XInterface> ScCellRangesObj::init() { - uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW); - uno::Reference< container::XIndexAccess > xIndexAccess(xDoc->getSheets(), uno::UNO_QUERY_THROW); - uno::Reference< sheet::XSpreadsheet > xSheet(xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW); - uno::Reference< lang::XMultiServiceFactory > xMSF(xDoc, uno::UNO_QUERY_THROW); - uno::Reference< container::XNameContainer > xRanges(xMSF->createInstance("com.sun.star.sheet.SheetCellRanges"), uno::UNO_QUERY_THROW); + uno::Reference<container::XIndexAccess> xIndexAccess(xDoc->getSheets(), uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet(xIndexAccess->getByIndex(0), uno::UNO_QUERY_THROW); + uno::Reference<lang::XMultiServiceFactory> xMSF(xDoc, uno::UNO_QUERY_THROW); + uno::Reference<container::XNameContainer> xRanges( + xMSF->createInstance("com.sun.star.sheet.SheetCellRanges"), uno::UNO_QUERY_THROW); uno::Any xCellRange; xCellRange <<= xSheet->getCellRangeByName("C1:D4"); @@ -108,9 +110,9 @@ uno::Reference< uno::XInterface > ScCellRangesObj::init() xCellRange <<= xSheet->getCellRangeByName("I7:J8"); xRanges->insertByName("Range4", xCellRange); - for ( int i = 0; i < 10; i++ ) + for (int i = 0; i < 10; i++) { - for ( int j = 5; j < 10; j++ ) + for (int j = 5; j < 10; j++) { xSheet->getCellByPosition(i, j)->setValue(i + j); } @@ -121,9 +123,9 @@ uno::Reference< uno::XInterface > ScCellRangesObj::init() uno::Reference<uno::XInterface> ScCellRangesObj::getXSpreadsheet() { - uno::Reference< sheet::XSpreadsheetDocument > xSheetDoc(mxComponent, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheetDocument> xSheetDoc(mxComponent, uno::UNO_QUERY_THROW); - uno::Reference<sheet::XSpreadsheets> xSheets (xSheetDoc->getSheets(), UNO_SET_THROW); + uno::Reference<sheet::XSpreadsheets> xSheets(xSheetDoc->getSheets(), UNO_SET_THROW); uno::Reference<container::XIndexAccess> xIndex(xSheets, UNO_QUERY_THROW); uno::Reference<sheet::XSpreadsheet> xSheet(xIndex->getByIndex(0), UNO_QUERY_THROW); @@ -146,7 +148,6 @@ void ScCellRangesObj::tearDown() } CPPUNIT_TEST_SUITE_REGISTRATION(ScCellRangesObj); - } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/qa/extras/scmodelobj.cxx b/sc/qa/extras/scmodelobj.cxx index 48b050b1134b..8c4a67f963ab 100644 --- a/sc/qa/extras/scmodelobj.cxx +++ b/sc/qa/extras/scmodelobj.cxx @@ -28,8 +28,8 @@ using namespace css; using namespace css::uno; -namespace sc_apitest { - +namespace sc_apitest +{ class ScModelObj : public UnoApiTest, public apitest::SpreadsheetDocumentSettings, public apitest::XCalculatable, @@ -42,8 +42,8 @@ public: virtual void setUp() override; virtual void tearDown() override; - virtual uno::Reference< uno::XInterface > init() override; - virtual uno::Reference< uno::XInterface > getXMSF() override; + virtual uno::Reference<uno::XInterface> init() override; + virtual uno::Reference<uno::XInterface> getXMSF() override; virtual uno::Sequence<uno::Reference<table::XCell>> getXCells() override; ScModelObj(); @@ -74,16 +74,16 @@ public: CPPUNIT_TEST_SUITE_END(); private: - uno::Reference< lang::XComponent > mxComponent; + uno::Reference<lang::XComponent> mxComponent; uno::Sequence<uno::Reference<table::XCell>> m_xCells; }; ScModelObj::ScModelObj() - : UnoApiTest("/sc/qa/extras/testdocuments") + : UnoApiTest("/sc/qa/extras/testdocuments") { } -uno::Reference< uno::XInterface > ScModelObj::init() +uno::Reference<uno::XInterface> ScModelObj::init() { uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW); @@ -104,15 +104,9 @@ uno::Reference< uno::XInterface > ScModelObj::init() return xModel; } -uno::Reference<uno::XInterface> ScModelObj::getXMSF() -{ - return getMultiServiceFactory(); -} +uno::Reference<uno::XInterface> ScModelObj::getXMSF() { return getMultiServiceFactory(); } -uno::Sequence<uno::Reference<table::XCell>> ScModelObj::getXCells() -{ - return m_xCells; -} +uno::Sequence<uno::Reference<table::XCell>> ScModelObj::getXCells() { return m_xCells; } void ScModelObj::setUp() { @@ -130,7 +124,6 @@ void ScModelObj::tearDown() } CPPUNIT_TEST_SUITE_REGISTRATION(ScModelObj); - } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/qa/extras/scoutlineobj.cxx b/sc/qa/extras/scoutlineobj.cxx index fba63ff98a65..8133cdb25614 100644 --- a/sc/qa/extras/scoutlineobj.cxx +++ b/sc/qa/extras/scoutlineobj.cxx @@ -17,8 +17,8 @@ using namespace css; using namespace css::uno; -namespace sc_apitest { - +namespace sc_apitest +{ class ScOutlineObj : public CalcUnoApiTest, public apitest::XSheetOutline { public: @@ -27,7 +27,7 @@ public: virtual void setUp() override; virtual void tearDown() override; - virtual uno::Reference< uno::XInterface > init() override; + virtual uno::Reference<uno::XInterface> init() override; CPPUNIT_TEST_SUITE(ScOutlineObj); @@ -43,7 +43,7 @@ public: CPPUNIT_TEST_SUITE_END(); private: - uno::Reference< lang::XComponent > mxComponent; + uno::Reference<lang::XComponent> mxComponent; }; ScOutlineObj::ScOutlineObj() @@ -51,13 +51,13 @@ ScOutlineObj::ScOutlineObj() { } -uno::Reference< uno::XInterface > ScOutlineObj::init() +uno::Reference<uno::XInterface> ScOutlineObj::init() { // get the first sheet - uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW); - uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), UNO_QUERY_THROW); - uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), UNO_QUERY_THROW); + uno::Reference<container::XIndexAccess> xIndex(xDoc->getSheets(), UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet(xIndex->getByIndex(0), UNO_QUERY_THROW); return xSheet; } @@ -78,7 +78,6 @@ void ScOutlineObj::tearDown() } CPPUNIT_TEST_SUITE_REGISTRATION(ScOutlineObj); - } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/qa/extras/scsubtotalfieldobj.cxx b/sc/qa/extras/scsubtotalfieldobj.cxx index 2667f28a4098..991ee7bed436 100644 --- a/sc/qa/extras/scsubtotalfieldobj.cxx +++ b/sc/qa/extras/scsubtotalfieldobj.cxx @@ -28,14 +28,14 @@ using namespace css; using namespace css::uno; using namespace com::sun::star; -namespace sc_apitest { - +namespace sc_apitest +{ class ScSubTotalFieldObj : public CalcUnoApiTest, public apitest::XSubTotalField { public: ScSubTotalFieldObj(); - virtual uno::Reference< uno::XInterface > init() override; + virtual uno::Reference<uno::XInterface> init() override; virtual void setUp() override; virtual void tearDown() override; @@ -48,8 +48,7 @@ public: CPPUNIT_TEST_SUITE_END(); private: - uno::Reference< lang::XComponent > mxComponent; - + uno::Reference<lang::XComponent> mxComponent; }; ScSubTotalFieldObj::ScSubTotalFieldObj() @@ -57,24 +56,25 @@ ScSubTotalFieldObj::ScSubTotalFieldObj() { } -uno::Reference< uno::XInterface > ScSubTotalFieldObj::init() +uno::Reference<uno::XInterface> ScSubTotalFieldObj::init() { - uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, uno::UNO_QUERY_THROW); - uno::Reference< container::XIndexAccess > xIndex(xDoc->getSheets(), uno::UNO_QUERY_THROW); - uno::Reference< sheet::XSpreadsheet > xSheet(xIndex->getByIndex(0), uno::UNO_QUERY_THROW); + uno::Reference<container::XIndexAccess> xIndex(xDoc->getSheets(), uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSpreadsheet> xSheet(xIndex->getByIndex(0), uno::UNO_QUERY_THROW); - uno::Reference< sheet::XSubTotalCalculatable > xSubTotalCalc(xSheet, uno::UNO_QUERY_THROW); - uno::Reference< sheet::XSubTotalDescriptor > xSubTotalDesc = xSubTotalCalc->createSubTotalDescriptor(true); + uno::Reference<sheet::XSubTotalCalculatable> xSubTotalCalc(xSheet, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSubTotalDescriptor> xSubTotalDesc + = xSubTotalCalc->createSubTotalDescriptor(true); - uno::Sequence< sheet::SubTotalColumn > xCols; + uno::Sequence<sheet::SubTotalColumn> xCols; xCols.realloc(1); xCols[0].Column = 5; xCols[0].Function = sheet::GeneralFunction_SUM; xSubTotalDesc->addNew(xCols, 1); - uno::Reference< container::XIndexAccess > xDescIndex(xSubTotalDesc, uno::UNO_QUERY_THROW); - uno::Reference< sheet::XSubTotalField > xSTF(xDescIndex->getByIndex(0), uno::UNO_QUERY_THROW); + uno::Reference<container::XIndexAccess> xDescIndex(xSubTotalDesc, uno::UNO_QUERY_THROW); + uno::Reference<sheet::XSubTotalField> xSTF(xDescIndex->getByIndex(0), uno::UNO_QUERY_THROW); return xSTF; } @@ -84,7 +84,6 @@ void ScSubTotalFieldObj::setUp() CalcUnoApiTest::setUp(); // create a calc document mxComponent = loadFromDesktop("private:factory/scalc"); - } void ScSubTotalFieldObj::tearDown() diff --git a/sc/qa/unit/dataproviders_test.cxx b/sc/qa/unit/dataproviders_test.cxx index a9b6b1142c7f..1f83c620c58d 100644 --- a/sc/qa/unit/dataproviders_test.cxx +++ b/sc/qa/unit/dataproviders_test.cxx @@ -22,7 +22,6 @@ class ScDataProvidersTest : public ScBootstrapFixture { public: - ScDataProvidersTest(); virtual void setUp() override; @@ -44,13 +43,14 @@ public: private: ScDocShellRef m_xDocShell; - ScDocument *m_pDoc; + ScDocument* m_pDoc; }; void ScDataProvidersTest::testCSVImport() { ScDBData* pDBData = new ScDBData("testDB", 0, 0, 0, 10, 10); - bool bInserted = m_pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr<ScDBData>(pDBData)); + bool bInserted + = m_pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr<ScDBData>(pDBData)); CPPUNIT_ASSERT(bInserted); OUString aFileURL; @@ -58,7 +58,6 @@ void ScDataProvidersTest::testCSVImport() sc::ExternalDataSource aDataSource(aFileURL, "org.libreoffice.calc.csv", m_pDoc); aDataSource.setDBData(pDBData->GetName()); - m_pDoc->GetExternalDataMapper().insertDataSource(aDataSource); auto& rDataSources = m_pDoc->GetExternalDataMapper().getDataSources(); CPPUNIT_ASSERT(!rDataSources.empty()); @@ -78,7 +77,8 @@ void ScDataProvidersTest::testCSVImport() void ScDataProvidersTest::testDataLargerThanDB() { ScDBData* pDBData = new ScDBData("testDB", 0, 0, 0, 1, 1); - bool bInserted = m_pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr<ScDBData>(pDBData)); + bool bInserted + = m_pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr<ScDBData>(pDBData)); CPPUNIT_ASSERT(bInserted); OUString aFileURL; @@ -86,7 +86,6 @@ void ScDataProvidersTest::testDataLargerThanDB() sc::ExternalDataSource aDataSource(aFileURL, "org.libreoffice.calc.csv", m_pDoc); aDataSource.setDBData(pDBData->GetName()); - m_pDoc->GetExternalDataMapper().insertDataSource(aDataSource); auto& rDataSources = m_pDoc->GetExternalDataMapper().getDataSources(); CPPUNIT_ASSERT(!rDataSources.empty()); @@ -106,7 +105,8 @@ void ScDataProvidersTest::testDataLargerThanDB() void ScDataProvidersTest::testHTMLImport() { ScDBData* pDBData = new ScDBData("testDB", 0, 0, 0, 10, 10); - bool bInserted = m_pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr<ScDBData>(pDBData)); + bool bInserted + = m_pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr<ScDBData>(pDBData)); CPPUNIT_ASSERT(bInserted); OUString aFileURL; @@ -115,7 +115,6 @@ void ScDataProvidersTest::testHTMLImport() aDataSource.setID("//table"); aDataSource.setDBData(pDBData->GetName()); - m_pDoc->GetExternalDataMapper().insertDataSource(aDataSource); auto& rDataSources = m_pDoc->GetExternalDataMapper().getDataSources(); CPPUNIT_ASSERT(!rDataSources.empty()); @@ -123,11 +122,12 @@ void ScDataProvidersTest::testHTMLImport() rDataSources[0].refresh(m_pDoc, true); Scheduler::ProcessEventsToIdle(); - - std::vector<OUString> aCarManufacturers = {"Audi", "GM", "Nissan", "Ferrari", "Peugeot"}; - std::vector<OUString> aCities = {"Berlin", "San Francisco", "Tokyo", "Rome", "Paris"}; - std::vector<double> aFirstCol = {1, 10, -100, -0.11111, 1}; - std::vector<double> aSecondCol = {2, 2.1, 40179, 2, 2,}; // 40179 is equal to 2010-1-1 + std::vector<OUString> aCarManufacturers = { "Audi", "GM", "Nissan", "Ferrari", "Peugeot" }; + std::vector<OUString> aCities = { "Berlin", "San Francisco", "Tokyo", "Rome", "Paris" }; + std::vector<double> aFirstCol = { 1, 10, -100, -0.11111, 1 }; + std::vector<double> aSecondCol = { + 2, 2.1, 40179, 2, 2, + }; // 40179 is equal to 2010-1-1 CPPUNIT_ASSERT_EQUAL(OUString("Col1"), m_pDoc->GetString(0, 0, 0)); CPPUNIT_ASSERT_EQUAL(OUString("Col2"), m_pDoc->GetString(1, 0, 0)); @@ -146,14 +146,15 @@ void ScDataProvidersTest::testHTMLImport() void ScDataProvidersTest::testXMLImport() { ScDBData* pDBData = new ScDBData("testDB", 0, 0, 0, 10, 10); - bool bInserted = m_pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr<ScDBData>(pDBData)); + bool bInserted + = m_pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr<ScDBData>(pDBData)); CPPUNIT_ASSERT(bInserted); OUString aFileURL; ScOrcusImportXMLParam aParam; ScOrcusImportXMLParam::RangeLink aRangeLink; - aRangeLink.maPos = ScAddress(0,0,0); + aRangeLink.maPos = ScAddress(0, 0, 0); aRangeLink.maFieldPaths.push_back("/bookstore/book/title"); aRangeLink.maFieldPaths.push_back("/bookstore/book/author"); aRangeLink.maRowGroups.push_back("/bookstore/book"); @@ -164,7 +165,6 @@ void ScDataProvidersTest::testXMLImport() aDataSource.setDBData("testDB"); aDataSource.setXMLImportParam(aParam); - m_pDoc->GetExternalDataMapper().insertDataSource(aDataSource); auto& rDataSources = m_pDoc->GetExternalDataMapper().getDataSources(); CPPUNIT_ASSERT(!rDataSources.empty()); @@ -208,9 +208,9 @@ void ScDataProvidersTest::testBaseImport() } */ -ScDataProvidersTest::ScDataProvidersTest() : - ScBootstrapFixture( "sc/qa/unit/data/dataprovider" ), - m_pDoc(nullptr) +ScDataProvidersTest::ScDataProvidersTest() + : ScBootstrapFixture("sc/qa/unit/data/dataprovider") + , m_pDoc(nullptr) { } @@ -219,10 +219,9 @@ void ScDataProvidersTest::setUp() ScBootstrapFixture::setUp(); ScDLL::Init(); - m_xDocShell = new ScDocShell( - SfxModelFlags::EMBEDDED_OBJECT | - SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | - SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); + m_xDocShell + = new ScDocShell(SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS + | SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); m_xDocShell->SetIsInUcalc(); m_xDocShell->DoInitUnitTest(); diff --git a/sc/qa/unit/test_ScChartListenerCollection.cxx b/sc/qa/unit/test_ScChartListenerCollection.cxx index ba2e93c7223c..67f2f045c7bf 100644 --- a/sc/qa/unit/test_ScChartListenerCollection.cxx +++ b/sc/qa/unit/test_ScChartListenerCollection.cxx @@ -13,16 +13,15 @@ #include <chartlis.hxx> #include <scdll.hxx> -namespace { - +namespace +{ const ScRange RANGE_1(10, 10, 0, 19, 10, 0); const ScRange RANGE_2(20, 10, 0, 29, 10, 0); const ScRange RANGE_INTERSECTING_1_AND_2(10, 10, 0, 29, 10, 0); - -class ChartListenerCollectionTest : public test::BootstrapFixture { - +class ChartListenerCollectionTest : public test::BootstrapFixture +{ public: virtual void setUp() override { @@ -47,21 +46,21 @@ private: CPPUNIT_TEST(ListenersStopListeningIndependently); CPPUNIT_TEST_SUITE_END(); - }; -struct MockedHiddenRangeListener : public ScChartHiddenRangeListener { +struct MockedHiddenRangeListener : public ScChartHiddenRangeListener +{ unsigned mNotifyCount; MockedHiddenRangeListener() - : mNotifyCount(0) { + : mNotifyCount(0) + { } - void notify() override { - mNotifyCount++; - } + void notify() override { mNotifyCount++; } }; -void ChartListenerCollectionTest::ListenerGetsNotifiedWhenItsRangeIsSetDirty() { +void ChartListenerCollectionTest::ListenerGetsNotifiedWhenItsRangeIsSetDirty() +{ MockedHiddenRangeListener listener; ScDocument aDoc; ScChartListenerCollection sut(aDoc); @@ -72,7 +71,8 @@ void ChartListenerCollectionTest::ListenerGetsNotifiedWhenItsRangeIsSetDirty() { CPPUNIT_ASSERT_EQUAL(1u, listener.mNotifyCount); } -void ChartListenerCollectionTest::ListenerGetsNotifiedTwiceWhenRegisteredTwoTimes() { +void ChartListenerCollectionTest::ListenerGetsNotifiedTwiceWhenRegisteredTwoTimes() +{ MockedHiddenRangeListener listener; ScDocument aDoc; ScChartListenerCollection sut(aDoc); @@ -84,7 +84,8 @@ void ChartListenerCollectionTest::ListenerGetsNotifiedTwiceWhenRegisteredTwoTime CPPUNIT_ASSERT_EQUAL(2u, listener.mNotifyCount); } -void ChartListenerCollectionTest::ListenerDoesNotGetNotifiedWhenListeningStops() { +void ChartListenerCollectionTest::ListenerDoesNotGetNotifiedWhenListeningStops() +{ MockedHiddenRangeListener listener; ScDocument aDoc; ScChartListenerCollection sut(aDoc); @@ -94,10 +95,10 @@ void ChartListenerCollectionTest::ListenerDoesNotGetNotifiedWhenListeningStops() sut.SetRangeDirty(RANGE_INTERSECTING_1_AND_2); CPPUNIT_ASSERT_EQUAL(0u, listener.mNotifyCount); - } -void ChartListenerCollectionTest::ListenerStopsListeningForAllRanges() { +void ChartListenerCollectionTest::ListenerStopsListeningForAllRanges() +{ MockedHiddenRangeListener listener; ScDocument aDoc; ScChartListenerCollection sut(aDoc); @@ -110,7 +111,8 @@ void ChartListenerCollectionTest::ListenerStopsListeningForAllRanges() { CPPUNIT_ASSERT_EQUAL(0u, listener.mNotifyCount); } -void ChartListenerCollectionTest::ListenersStopListeningIndependently() { +void ChartListenerCollectionTest::ListenersStopListeningIndependently() +{ MockedHiddenRangeListener listener1; MockedHiddenRangeListener listener2; ScDocument aDoc; @@ -125,12 +127,10 @@ void ChartListenerCollectionTest::ListenersStopListeningIndependently() { CPPUNIT_ASSERT_EQUAL(0u, listener1.mNotifyCount); CPPUNIT_ASSERT_EQUAL(1u, listener2.mNotifyCount); } - } CPPUNIT_TEST_SUITE_REGISTRATION(ChartListenerCollectionTest); - CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index 34c49a281f33..31171f72e4ce 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -47,9 +47,9 @@ using ::com::sun::star::uno::Sequence; using ::com::sun::star::sheet::TablePageBreakData; using ::std::set; -void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) +void ScTable::UpdatePageBreaks(const ScRange* pUserArea) { - if ( rDocument.IsImportingXML() ) + if (rDocument.IsImportingXML()) return; // pUserArea != NULL -> print area is specified. We need to force-update @@ -65,9 +65,9 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) return; } - SfxStyleSheetBase* pStyle = rDocument.GetStyleSheetPool()-> - Find( aPageStyle, SfxStyleFamily::Page ); - if ( !pStyle ) + SfxStyleSheetBase* pStyle + = rDocument.GetStyleSheetPool()->Find(aPageStyle, SfxStyleFamily::Page); + if (!pStyle) { OSL_FAIL("UpdatePageBreaks: Style not found"); return; @@ -89,20 +89,20 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) else { sal_uInt16 nAreaCount = GetPrintRangeCount(); - if ( nAreaCount > 1 ) + if (nAreaCount > 1) { // Show nothing, when multiple ranges for (SCCOL nX : GetColumnsRange(0, rDocument.MaxCol())) RemoveColBreak(nX, true, false); - RemoveRowPageBreaks(0, rDocument.MaxRow()-1); + RemoveRowPageBreaks(0, rDocument.MaxRow() - 1); return; } - else if ( nAreaCount == 1 ) + else if (nAreaCount == 1) { - const ScRange* pArea = GetPrintRange( 0 ); + const ScRange* pArea = GetPrintRange(0); if (pArea) { nStartCol = pArea->aStart.Col(); @@ -110,7 +110,7 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) nEndCol = pArea->aEnd.Col(); nEndRow = pArea->aEnd.Row(); } - } // otherwise show everything + } // otherwise show everything } // get bSkipColBreaks/bSkipRowBreaks flags: @@ -122,48 +122,50 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) if (!mbForceBreaks) { - if ( pStyleSet->GetItemState( ATTR_PAGE_SCALETOPAGES, false, &pItem ) == SfxItemState::SET ) - { - OSL_ENSURE( dynamic_cast<const SfxUInt16Item*>( pItem) != nullptr, "invalid Item" ); - bSkipColBreaks = bSkipRowBreaks = static_cast<const SfxUInt16Item*>(pItem)->GetValue() > 0; - } - - if ( !bSkipColBreaks && pStyleSet->GetItemState(ATTR_PAGE_SCALETO, false, &pItem) == SfxItemState::SET ) - { - // #i54993# when fitting to width or height, ignore only manual breaks in that direction - const ScPageScaleToItem* pScaleToItem = static_cast<const ScPageScaleToItem*>(pItem); - if ( pScaleToItem->GetWidth() > 0 ) - bSkipColBreaks = true; - if ( pScaleToItem->GetHeight() > 0 ) - bSkipRowBreaks = true; - } + if (pStyleSet->GetItemState(ATTR_PAGE_SCALETOPAGES, false, &pItem) == SfxItemState::SET) + { + OSL_ENSURE(dynamic_cast<const SfxUInt16Item*>(pItem) != nullptr, "invalid Item"); + bSkipColBreaks = bSkipRowBreaks + = static_cast<const SfxUInt16Item*>(pItem)->GetValue() > 0; + } + + if (!bSkipColBreaks + && pStyleSet->GetItemState(ATTR_PAGE_SCALETO, false, &pItem) == SfxItemState::SET) + { + // #i54993# when fitting to width or height, ignore only manual breaks in that direction + const ScPageScaleToItem* pScaleToItem = static_cast<const ScPageScaleToItem*>(pItem); + if (pScaleToItem->GetWidth() > 0) + bSkipColBreaks = true; + if (pScaleToItem->GetHeight() > 0) + bSkipRowBreaks = true; + } } tools::Long nPageSizeX = aPageSizeTwips.Width(); tools::Long nPageSizeY = aPageSizeTwips.Height(); - // Beginning: Remove breaks + // Beginning: Remove breaks - for (SCCOL nX : GetColumnsRange(0, nStartCol-1)) + for (SCCOL nX : GetColumnsRange(0, nStartCol - 1)) RemoveColBreak(nX, true, false); - RemoveRowPageBreaks(0, nStartRow-1); + RemoveRowPageBreaks(0, nStartRow - 1); if (nStartCol > 0) - SetColBreak(nStartCol, true, false); // AREABREAK + SetColBreak(nStartCol, true, false); // AREABREAK if (nStartRow > 0) - SetRowBreak(nStartRow, true, false); // AREABREAK + SetRowBreak(nStartRow, true, false); // AREABREAK - // Middle part: Distribute breaks + // Middle part: Distribute breaks - bool bRepeatCol = ( nRepeatStartX != SCCOL_REPEAT_NONE ); + bool bRepeatCol = (nRepeatStartX != SCCOL_REPEAT_NONE); bool bColFound = false; tools::Long nSizeX = 0; - for (SCCOL nX=nStartCol; nX<=nEndCol; nX++) + for (SCCOL nX = nStartCol; nX <= nEndCol; nX++) { bool bStartOfPage = false; tools::Long nThisX = ColHidden(nX) ? 0 : mpColWidth->GetValue(nX); bool bManualBreak = HasColManualBreak(nX); - if ( (nSizeX+nThisX > nPageSizeX) || (bManualBreak && !bSkipColBreaks) ) + if ((nSizeX + nThisX > nPageSizeX) || (bManualBreak && !bSkipColBreaks)) { SetColBreak(nX, true, false); nSizeX = 0; @@ -174,12 +176,12 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) else bStartOfPage = true; - if ( bStartOfPage && bRepeatCol && nX>nRepeatStartX && !bColFound ) + if (bStartOfPage && bRepeatCol && nX > nRepeatStartX && !bColFound) { // subtract size of repeat columns from page size - for (SCCOL i=nRepeatStartX; i<=nRepeatEndX; i++) + for (SCCOL i = nRepeatStartX; i <= nRepeatEndX; i++) nPageSizeX -= ColHidden(i) ? 0 : mpColWidth->GetValue(i); - while (nX<=nRepeatEndX) + while (nX <= nRepeatEndX) RemoveColBreak(++nX, true, false); bColFound = true; } @@ -188,10 +190,10 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) } // Remove all page breaks in range. - RemoveRowPageBreaks(nStartRow+1, nEndRow); + RemoveRowPageBreaks(nStartRow + 1, nEndRow); // And set new page breaks. - bool bRepeatRow = ( nRepeatStartY != SCROW_REPEAT_NONE ); + bool bRepeatRow = (nRepeatStartY != SCROW_REPEAT_NONE); bool bRowFound = false; tools::Long nSizeY = 0; ScFlatBoolRowSegments::ForwardIterator aIterHidden(*mpHiddenRows); @@ -202,7 +204,8 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) bool bStartOfPage = false; bool bThisRowHidden = false; const bool bHasValue = aIterHidden.getValue(nY, bThisRowHidden); - assert(bHasValue); (void)bHasValue; + assert(bHasValue); + (void)bHasValue; tools::Long nThisY = 0; if (!bThisRowHidden) { @@ -219,10 +222,10 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) bManualBreak = (nY == nNextManualBreak); if (nY >= nNextManualBreak) // Query the next manual break position. - nNextManualBreak = GetNextManualBreak(nY+1); + nNextManualBreak = GetNextManualBreak(nY + 1); } - if ( (nSizeY+nThisY > nPageSizeY) || (bManualBreak && !bSkipRowBreaks) ) + if ((nSizeY + nThisY > nPageSizeY) || (bManualBreak && !bSkipRowBreaks)) { SetRowBreak(nY, true, false); nSizeY = 0; @@ -233,7 +236,7 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) else bStartOfPage = true; - if ( bStartOfPage && bRepeatRow && nY>nRepeatStartY && !bRowFound ) + if (bStartOfPage && bRepeatRow && nY > nRepeatStartY && !bRowFound) { // subtract size of repeat rows from page size tools::ULong nHeights = GetTotalRowHeight(nRepeatStartY, nRepeatEndY); @@ -252,7 +255,7 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) // Hidden row range. Skip them unless there is a manual break. SCROW nLastCommon = aIterHidden.getLastPos(); if (nNextManualBreak >= 0) - nLastCommon = ::std::min(nLastCommon, nNextManualBreak-1); + nLastCommon = ::std::min(nLastCommon, nNextManualBreak - 1); nY = nLastCommon; } else @@ -263,7 +266,7 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) SCROW nLastHeight = aIterHeights.getLastPos(); SCROW nLastCommon = ::std::min(nLastHidden, nLastHeight); if (nNextManualBreak >= 0) - nLastCommon = ::std::min(nLastCommon, nNextManualBreak-1); + nLastCommon = ::std::min(nLastCommon, nNextManualBreak - 1); if (nLastCommon > nY) { @@ -282,21 +285,22 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) nSizeY += nThisY; } - // End: Remove Break + // End: Remove Break if (nEndCol < rDocument.MaxCol()) { - SetColBreak(nEndCol+1, true, false); // AREABREAK + SetColBreak(nEndCol + 1, true, false); // AREABREAK for (SCCOL nCol : GetColumnsRange(nEndCol + 2, rDocument.MaxCol())) RemoveColBreak(nCol, true, false); } if (nEndRow < rDocument.MaxRow()) { - SetRowBreak(nEndRow+1, true, false); // AREABREAK - if (nEndRow+2 <= rDocument.MaxRow()) - RemoveRowPageBreaks(nEndRow+2, rDocument.MaxRow()); + SetRowBreak(nEndRow + 1, true, false); // AREABREAK + if (nEndRow + 2 <= rDocument.MaxRow()) + RemoveRowPageBreaks(nEndRow + 2, rDocument.MaxRow()); } - mbPageBreaksValid = !pUserArea; // #i116881# the valid flag can only apply to the "no user area" case + mbPageBreaksValid + = !pUserArea; // #i116881# the valid flag can only apply to the "no user area" case } void ScTable::RemoveManualBreaks() @@ -313,14 +317,14 @@ bool ScTable::HasManualBreaks() const return !maRowManualBreaks.empty() || !maColManualBreaks.empty(); } -void ScTable::SetRowManualBreaks( const ::std::set<SCROW>& rBreaks ) +void ScTable::SetRowManualBreaks(const ::std::set<SCROW>& rBreaks) { maRowManualBreaks = rBreaks; InvalidatePageBreaks(); SetStreamValid(false); } -void ScTable::SetColManualBreaks( const ::std::set<SCCOL>& rBreaks ) +void ScTable::SetColManualBreaks(const ::std::set<SCCOL>& rBreaks) { maColManualBreaks = rBreaks; InvalidatePageBreaks(); @@ -335,7 +339,8 @@ void ScTable::GetAllRowBreaks(set<SCROW>& rBreaks, bool bPage, bool bManual) con if (bManual) { using namespace std; - copy(maRowManualBreaks.begin(), maRowManualBreaks.end(), inserter(rBreaks, rBreaks.begin())); + copy(maRowManualBreaks.begin(), maRowManualBreaks.end(), + inserter(rBreaks, rBreaks.begin())); } } @@ -347,7 +352,8 @@ void ScTable::GetAllColBreaks(set<SCCOL>& rBreaks, bool bPage, bool bManual) con if (bManual) { using namespace std; - copy(maColManualBreaks.begin(), maColManualBreaks.end(), inserter(rBreaks, rBreaks.begin())); + copy(maColManualBreaks.begin(), maColManualBreaks.end(), + inserter(rBreaks, rBreaks.begin())); } } @@ -396,7 +402,7 @@ void ScTable::RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow) if (!ValidRow(nStartRow) || !ValidRow(nEndRow)) return; - set<SCROW>::iterator low = maRowPageBreaks.lower_bound(nStartRow); + set<SCROW>::iterator low = maRowPageBreaks.lower_bound(nStartRow); set<SCROW>::iterator high = maRowPageBreaks.upper_bound(nEndRow); maRowPageBreaks.erase(low, high); } @@ -467,7 +473,8 @@ Sequence<TablePageBreakData> ScTable::GetRowBreakData() const using ::std::inserter; set<SCROW> aRowBreaks = maRowPageBreaks; - copy(maRowManualBreaks.begin(), maRowManualBreaks.end(), inserter(aRowBreaks, aRowBreaks.begin())); + copy(maRowManualBreaks.begin(), maRowManualBreaks.end(), + inserter(aRowBreaks, aRowBreaks.begin())); sal_Int32 i = 0; Sequence<TablePageBreakData> aSeq(aRowBreaks.size()); @@ -610,12 +617,12 @@ bool ScTable::SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden) { SetStreamValid(false); - { // Scoped bulk broadcast. + { // Scoped bulk broadcast. // Only subtotal formula cells will accept the notification of // SfxHintId::ScHiddenRowsChanged, leaving the bulk will track // those and broadcast SfxHintId::ScDataChanged to notify all // dependents. - ScBulkBroadcast aBulkBroadcast( rDocument.GetBASM(), SfxHintId::ScDataChanged); + ScBulkBroadcast aBulkBroadcast(rDocument.GetBASM(), SfxHintId::ScDataChanged); for (SCCOL i = 0; i < aCol.size(); i++) { aCol[i].BroadcastRows(nStartRow, nEndRow, SfxHintId::ScHiddenRowsChanged); @@ -689,7 +696,8 @@ void ScTable::CopyRowHidden(const ScTable& rTable, SCROW nStartRow, SCROW nEndRo } } -void ScTable::CopyRowHeight(const ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset) +void ScTable::CopyRowHeight(const ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, + SCROW nSrcOffset) { SCROW nRow = nStartRow; ScFlatUInt16RowSegments::RangeData aSrcData; @@ -775,7 +783,7 @@ SCROW ScTable::CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const return nCount; } -sal_uInt32 ScTable::GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow, bool bHiddenAsZero ) const +sal_uInt32 ScTable::GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow, bool bHiddenAsZero) const { sal_uInt32 nHeight = 0; SCROW nRow = nStartRow; @@ -788,7 +796,7 @@ sal_uInt32 ScTable::GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow, bool bHidd if (aData.mnRow2 > nEndRow) aData.mnRow2 = nEndRow; - if ( !( bHiddenAsZero && aData.mbValue ) ) + if (!(bHiddenAsZero && aData.mbValue)) // visible row range. nHeight += mpRowHeights->getSumValue(nRow, aData.mnRow2); @@ -805,7 +813,7 @@ SCCOLROW ScTable::LastHiddenColRow(SCCOLROW nPos, bool bCol) const SCCOL nCol = static_cast<SCCOL>(nPos); if (ColHidden(nCol)) { - for (SCCOL i = nCol+1; i <= rDocument.MaxCol(); ++i) + for (SCCOL i = nCol + 1; i <= rDocument.MaxCol(); ++i) { if (!ColHidden(i)) return i - 1; @@ -990,17 +998,19 @@ bool ScTable::IsManualRowHeight(SCROW nRow) const return bool(pRowFlags->GetValue(nRow) & CRFlags::ManualSize); } -namespace { - -void lcl_syncFlags(const ScDocument* pDocument, ScFlatBoolColSegments& rColSegments, const ScFlatBoolRowSegments& rRowSegments, - ScBitMaskCompressedArray<SCCOL, CRFlags>* pColFlags, ScBitMaskCompressedArray< SCROW, CRFlags>* pRowFlags, const CRFlags nFlagMask) +namespace +{ +void lcl_syncFlags(const ScDocument* pDocument, ScFlatBoolColSegments& rColSegments, + const ScFlatBoolRowSegments& rRowSegments, + ScBitMaskCompressedArray<SCCOL, CRFlags>* pColFlags, + ScBitMaskCompressedArray<SCROW, CRFlags>* pRowFlags, const CRFlags nFlagMask) { using ::sal::static_int_cast; CRFlags nFlagMaskComplement = ~nFlagMask; pRowFlags->AndValue(0, pDocument->MaxRow(), nFlagMaskComplement); - pColFlags->AndValue(0, pDocument->MaxCol()+1, nFlagMaskComplement); + pColFlags->AndValue(0, pDocument->MaxCol() + 1, nFlagMaskComplement); { // row hidden flags. @@ -1036,7 +1046,6 @@ void lcl_syncFlags(const ScDocument* pDocument, ScFlatBoolColSegments& rColSegme } } } - } void ScTable::SyncColRowFlags() @@ -1045,7 +1054,7 @@ void ScTable::SyncColRowFlags() // Manual breaks. pRowFlags->AndValue(0, rDocument.MaxRow(), nManualBreakComplement); - mpColFlags->AndValue(0, rDocument.MaxCol()+1, nManualBreakComplement); + mpColFlags->AndValue(0, rDocument.MaxCol() + 1, nManualBreakComplement); for (const auto& rBreakPos : maRowManualBreaks) pRowFlags->OrValue(rBreakPos, CRFlags::ManualBreak); @@ -1054,13 +1063,15 @@ void ScTable::SyncColRowFlags() mpColFlags->OrValue(rBreakPos, CRFlags::ManualBreak); // Hidden flags. - lcl_syncFlags(&rDocument, *mpHiddenCols, *mpHiddenRows, mpColFlags.get(), pRowFlags.get(), CRFlags::Hidden); - lcl_syncFlags(&rDocument, *mpFilteredCols, *mpFilteredRows, mpColFlags.get(), pRowFlags.get(), CRFlags::Filtered); + lcl_syncFlags(&rDocument, *mpHiddenCols, *mpHiddenRows, mpColFlags.get(), pRowFlags.get(), + CRFlags::Hidden); + lcl_syncFlags(&rDocument, *mpFilteredCols, *mpFilteredRows, mpColFlags.get(), pRowFlags.get(), + CRFlags::Filtered); } -void ScTable::SetPageSize( const Size& rSize ) +void ScTable::SetPageSize(const Size& rSize) { - if ( !rSize.IsEmpty() ) + if (!rSize.IsEmpty()) { if (aPageSizeTwips != rSize) InvalidatePageBreaks(); @@ -1072,10 +1083,7 @@ void ScTable::SetPageSize( const Size& rSize ) bPageSizeValid = false; } -bool ScTable::IsProtected() const -{ - return pTabProtection && pTabProtection->isProtected(); -} +bool ScTable::IsProtected() const { return pTabProtection && pTabProtection->isProtected(); } void ScTable::SetProtection(const ScTableProtection* pProtect) { @@ -1087,49 +1095,48 @@ void ScTable::SetProtection(const ScTableProtection* pProtect) SetStreamValid(false); } -ScTableProtection* ScTable::GetProtection() -{ - return pTabProtection.get(); -} +ScTableProtection* ScTable::GetProtection() { return pTabProtection.get(); } Size ScTable::GetPageSize() const { - if ( bPageSizeValid ) + if (bPageSizeValid) return aPageSizeTwips; else - return Size(); // blank + return Size(); // blank } -void ScTable::SetRepeatArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow ) +void ScTable::SetRepeatArea(SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow) { // #i117952# page break calculation uses these values (set from ScPrintFunc), not pRepeatColRange/pRepeatRowRange - if ( nStartCol != nRepeatStartX || nEndCol != nRepeatEndX || nStartRow != nRepeatStartY || nEndRow != nRepeatEndY ) + if (nStartCol != nRepeatStartX || nEndCol != nRepeatEndX || nStartRow != nRepeatStartY + || nEndRow != nRepeatEndY) InvalidatePageBreaks(); nRepeatStartX = nStartCol; - nRepeatEndX = nEndCol; + nRepeatEndX = nEndCol; nRepeatStartY = nStartRow; - nRepeatEndY = nEndRow; + nRepeatEndY = nEndRow; } -void ScTable::StartListening( const ScAddress& rAddress, SvtListener* pListener ) +void ScTable::StartListening(const ScAddress& rAddress, SvtListener* pListener) { if (!ValidCol(rAddress.Col())) return; - CreateColumnIfNotExists(rAddress.Col()).StartListening( *pListener, rAddress.Row() ); + CreateColumnIfNotExists(rAddress.Col()).StartListening(*pListener, rAddress.Row()); } -void ScTable::EndListening( const ScAddress& rAddress, SvtListener* pListener ) +void ScTable::EndListening(const ScAddress& rAddress, SvtListener* pListener) { if (!ValidCol(rAddress.Col())) return; if (rAddress.Col() < aCol.size()) - aCol[rAddress.Col()].EndListening( *pListener, rAddress.Row() ); + aCol[rAddress.Col()].EndListening(*pListener, rAddress.Row()); } -void ScTable::StartListening( sc::StartListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener ) +void ScTable::StartListening(sc::StartListeningContext& rCxt, const ScAddress& rAddress, + SvtListener& rListener) { if (!ValidCol(rAddress.Col())) return; @@ -1137,7 +1144,8 @@ void ScTable::StartListening( sc::StartListeningContext& rCxt, const ScAddress& CreateColumnIfNotExists(rAddress.Col()).StartListening(rCxt, rAddress, rListener); } -void ScTable::EndListening( sc::EndListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rListener ) +void ScTable::EndListening(sc::EndListeningContext& rCxt, const ScAddress& rAddress, + SvtListener& rListener) { if (!ValidCol(rAddress.Col())) return; @@ -1145,62 +1153,63 @@ void ScTable::EndListening( sc::EndListeningContext& rCxt, const ScAddress& rAdd aCol[rAddress.Col()].EndListening(rCxt, rAddress, rListener); } -void ScTable::SetPageStyle( const OUString& rName ) +void ScTable::SetPageStyle(const OUString& rName) { - if ( aPageStyle == rName ) + if (aPageStyle == rName) return; - OUString aStrNew = rName; - SfxStyleSheetBasePool* pStylePool = rDocument.GetStyleSheetPool(); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits