diff options
Diffstat (limited to 'sc')
87 files changed, 571 insertions, 24 deletions
diff --git a/sc/qa/extras/scddelinkobj.cxx b/sc/qa/extras/scddelinkobj.cxx index 49a8fda8c244..a64104e661f1 100644 --- a/sc/qa/extras/scddelinkobj.cxx +++ b/sc/qa/extras/scddelinkobj.cxx @@ -45,6 +45,8 @@ static utl::TempFile createTempCopy(OUString const& url) return tmp; } +namespace +{ struct TempFileBase { utl::TempFile m_TempFile; @@ -53,6 +55,7 @@ struct TempFileBase { } }; +} class ScDDELinkObj : public CalcUnoApiTest, public TempFileBase, diff --git a/sc/qa/extras/scuniquecellformatsenumeration.cxx b/sc/qa/extras/scuniquecellformatsenumeration.cxx index c0a8f9cdf8fa..ea6a76e7680d 100644 --- a/sc/qa/extras/scuniquecellformatsenumeration.cxx +++ b/sc/qa/extras/scuniquecellformatsenumeration.cxx @@ -30,6 +30,8 @@ using namespace css::uno; namespace sc_apitest { +namespace +{ struct RGBColor { int m_nRed; @@ -45,6 +47,7 @@ struct RGBColor sal_Int32 hashCode() const { return (255 << 24) | (m_nRed << 16) | (m_nGreen << 8) | m_nBlue; } }; +} class ScUniqueCellFormatsEnumeration : public CalcUnoApiTest, public apitest::XEnumeration { diff --git a/sc/qa/unit/mark_test.cxx b/sc/qa/unit/mark_test.cxx index f6c2e81ef356..6c2d3e870370 100644 --- a/sc/qa/unit/mark_test.cxx +++ b/sc/qa/unit/mark_test.cxx @@ -16,10 +16,20 @@ #include <markdata.hxx> #include "../../source/core/data/markarr.cxx" #include "../../source/core/data/markmulti.cxx" +#if defined __GNUC__ && !defined __clang__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsubobject-linkage" + // automatically suppressed in the main .cxx, but not in this included one +#endif #include "../../source/core/data/segmenttree.cxx" +#if defined __GNUC__ && !defined __clang__ +#pragma GCC diagnostic push +#endif #include <utility> +namespace { + struct MarkTestData // To represent a single rectangle part of a multiselection { ScRange aRange; @@ -80,6 +90,8 @@ struct MultiMarkTestData std::vector<std::pair<SCCOL,SCCOL>> aColsWithUnequalMarksList; }; +} + class Test : public CppUnit::TestFixture { public: diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 9110505667fc..e3c7bfae4d82 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -1015,6 +1015,8 @@ void ScFiltersTest::testBorderODS() xDocSh->DoClose(); } +namespace { + struct Border { sal_Int16 column; @@ -1049,6 +1051,8 @@ struct Border lStyle(static_cast<SvxBorderLineStyle>(lSt)), tStyle(static_cast<SvxBorderLineStyle>(tSt)), rStyle(static_cast<SvxBorderLineStyle>(rSt)), bStyle(static_cast<SvxBorderLineStyle>(bSt)) {}; }; +} + void ScFiltersTest::testBordersOoo33() { std::vector<Border> borders; diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index ae28aadeae31..5f5e79cb7933 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1677,6 +1677,8 @@ static void checkMatrixElements(const ScMatrix& rMat) } } +namespace { + struct AllZeroMatrix { void operator() (SCSIZE /*nCol*/, SCSIZE /*nRow*/, const ScMatrixValue& rVal) const @@ -1743,6 +1745,8 @@ struct PartiallyFilledEmptyMatrix } }; +} + void Test::testMatrix() { svl::SharedStringPool& rPool = m_pDoc->GetSharedStringPool(); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 6bbe59d067ea..a8a98ce2fa44 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -5437,11 +5437,15 @@ void Test::testFuncVLOOKUP() m_pDoc->DeleteTab(0); } +namespace { + struct StrStrCheck { const char* pVal; const char* pRes; }; +} + template<size_t DataSize, size_t FormulaSize, int Type> static void runTestMATCH(ScDocument* pDoc, const char* aData[DataSize], const StrStrCheck aChecks[FormulaSize]) { diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 7cb85e8c9bbf..b67880171d63 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -599,6 +599,8 @@ void Test::testSharedFormulasRefUpdateRange() m_pDoc->DeleteTab(0); } +namespace { + struct SortByArea { bool operator ()( const sc::AreaListener& rLeft, const sc::AreaListener& rRight ) const @@ -622,6 +624,8 @@ struct SortByArea } }; +} + void Test::testSharedFormulasRefUpdateRangeDeleteRow() { sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc. diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx index c904ad716bd1..227a6d751e63 100644 --- a/sc/source/core/data/bcaslot.cxx +++ b/sc/source/core/data/bcaslot.cxx @@ -53,6 +53,8 @@ constexpr int BCA_SLOTS = BCA_SLOTS_COL * BCA_SLOTS_ROW; // anyway, once you reached these values... static_assert(BCA_SLOTS <= 268435456, "DOOMed"); +namespace { + struct ScSlotData { SCROW const nStartRow; // first row of this segment @@ -62,6 +64,9 @@ struct ScSlotData ScSlotData( SCROW r1, SCROW r2, SCSIZE s, SCSIZE c ) : nStartRow(r1), nStopRow(r2), nSlice(s), nCumulated(c) {} }; + +} + typedef ::std::vector< ScSlotData > ScSlotDistribution; // Logarithmic or any other distribution. // Upper sheet part usually is more populated and referenced and gets fine diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 90a0dcec43aa..18f505f45bd2 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -93,6 +93,8 @@ void ScColumn::BroadcastRows( SCROW nStartRow, SCROW nEndRow, SfxHintId nHint ) BroadcastCells(aRows, nHint); } +namespace { + struct DirtyCellInterpreter { void operator() (size_t, ScFormulaCell* p) @@ -102,6 +104,8 @@ struct DirtyCellInterpreter } }; +} + void ScColumn::InterpretDirtyCells( SCROW nRow1, SCROW nRow2 ) { if (!ValidRow(nRow1) || !ValidRow(nRow2) || nRow1 > nRow2) diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index ac2a1e786939..c4e6c06327ed 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -143,8 +143,6 @@ void collectUIInformation(const std::map<OUString, OUString>& aParameters, const UITestLogger::getInstance().logEvent(aDescription); } -} - struct ScDefaultAttr { const ScPatternAttr* pAttr; @@ -161,6 +159,8 @@ struct ScLessDefaultAttr } }; +} + typedef std::set<ScDefaultAttr, ScLessDefaultAttr> ScDefaultAttrSet; void ScDocument::MakeTable( SCTAB nTab,bool _bNeedsNameCheck ) diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx index 0327dcb5c44f..026d1a2639b7 100644 --- a/sc/source/core/data/dpgroup.cxx +++ b/sc/source/core/data/dpgroup.cxx @@ -43,6 +43,8 @@ using ::std::shared_ptr; const sal_uInt16 SC_DP_LEAPYEAR = 1648; // arbitrary leap year for date calculations +namespace { + class ScDPGroupNumFilter : public ScDPFilteredCache::FilterBase { public: @@ -55,6 +57,8 @@ private: ScDPNumGroupInfo const maNumInfo; }; +} + ScDPGroupNumFilter::ScDPGroupNumFilter(const std::vector<ScDPItemData>& rValues, const ScDPNumGroupInfo& rInfo) : maValues(rValues), maNumInfo(rInfo) {} @@ -99,6 +103,8 @@ std::vector<ScDPItemData> ScDPGroupNumFilter::getMatchValues() const return std::vector<ScDPItemData>(); } +namespace { + class ScDPGroupDateFilter : public ScDPFilteredCache::FilterBase { public: @@ -114,6 +120,8 @@ private: ScDPNumGroupInfo const maNumInfo; }; +} + ScDPGroupDateFilter::ScDPGroupDateFilter( const std::vector<ScDPItemData>& rValues, const Date& rNullDate, const ScDPNumGroupInfo& rNumInfo) : maValues(rValues), diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 67f742dece8b..43fb34e75e7d 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -129,8 +129,6 @@ public: } }; -} - // function objects for sorting of the column and row members: class ScDPRowMembersOrder @@ -165,6 +163,8 @@ public: bool operator()( sal_Int32 nIndex1, sal_Int32 nIndex2 ) const; }; +} + static bool lcl_IsLess( const ScDPDataMember* pDataMember1, const ScDPDataMember* pDataMember2, long nMeasure, bool bAscending ) { // members can be NULL if used for rows @@ -2677,6 +2677,8 @@ void ScDPDataMember::Dump(int nIndent) const // Helper class to select the members to include in // ScDPResultDimension::InitFrom or LateInitFrom if groups are used +namespace { + class ScDPGroupCompare { private: @@ -2693,6 +2695,8 @@ public: bool TestIncluded( const ScDPMember& rMember ); }; +} + ScDPGroupCompare::ScDPGroupCompare( const ScDPResultData* pData, const ScDPInitState& rState, long nDimension ) : pResultData( pData ), rInitState( rState ), diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index f656370a5686..caadfb5bc458 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -1848,6 +1848,8 @@ ScDPLevel* ScDPLevels::getByIndex(long nIndex) const return nullptr; //TODO: exception? } +namespace { + class ScDPGlobalMembersOrder { ScDPLevel& rLevel; @@ -1862,6 +1864,8 @@ public: bool operator()( sal_Int32 nIndex1, sal_Int32 nIndex2 ) const; }; +} + bool ScDPGlobalMembersOrder::operator()( sal_Int32 nIndex1, sal_Int32 nIndex2 ) const { sal_Int32 nCompare = 0; diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index acfe85bd332b..d07619e07fc4 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -4247,8 +4247,6 @@ int splitup(int N, int K, int& A) return num_parts; } -} // anonymous namespace - struct ScDependantsCalculator { ScDocument& mrDoc; @@ -4558,6 +4556,8 @@ struct ScDependantsCalculator } }; +} // anonymous namespace + bool ScFormulaCell::InterpretFormulaGroup(SCROW nStartOffset, SCROW nEndOffset) { if (!mxGroup || !pCode) diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx index abeccaba4b9f..690c033abf7c 100644 --- a/sc/source/core/data/funcdesc.cxx +++ b/sc/source/core/data/funcdesc.cxx @@ -38,6 +38,8 @@ #include <memory> +namespace { + struct ScFuncDescCore { /* @@ -88,6 +90,8 @@ struct ScFuncDescCore sal_uInt8 const aOptionalArgs[7]; }; +} + static void ScFuncRes(const ScFuncDescCore &rEntry, ScFuncDesc*, bool& rbSuppressed); // class ScFuncDesc: diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx index b47f1e7b9f3c..3e7bfd9aca48 100644 --- a/sc/source/core/data/segmenttree.cxx +++ b/sc/source/core/data/segmenttree.cxx @@ -27,6 +27,8 @@ using ::std::numeric_limits; +namespace { + template<typename ValueType_, typename ExtValueType_ = ValueType_> class ScFlatSegmentsImpl { @@ -72,6 +74,8 @@ private: bool mbTreeSearchEnabled:1; }; +} + template<typename ValueType_, typename ExtValueType_> ScFlatSegmentsImpl<ValueType_, ExtValueType_>::ScFlatSegmentsImpl(SCCOLROW nMax, ValueType nDefault) : maSegments(0, nMax+1, nDefault), diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 41a130d65f6c..9f4eeb59e6a7 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -219,12 +219,16 @@ static short Compare( const OUString &sInput1, const OUString &sInput2, } +namespace { + struct ScSortInfo final { ScRefCellValue maCell; SCCOLROW nOrg; }; +} + class ScSortInfoArray { public: @@ -1894,6 +1898,8 @@ static void lcl_RemoveNumberFormat( ScTable* pTab, SCCOL nCol, SCROW nRow ) } } +namespace { + struct RowEntry { sal_uInt16 nGroupNo; @@ -1903,6 +1909,7 @@ struct RowEntry SCROW nFuncEnd; }; +} static const char* lcl_GetSubTotalStrId(int id) { diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 24815b4937b1..12eb62bbe1eb 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -345,6 +345,8 @@ size_t VectorRef::Marshal( cl_kernel k, int argno, int, cl_program ) /// automatically disables use of OpenCL for a formula group. If at some point there are resources /// to drain the OpenCL swamp, this should go away. +namespace { + class ConstStringArgument : public DynamicKernelArgument { public: @@ -875,6 +877,8 @@ public: virtual size_t Marshal( cl_kernel, int, int, cl_program ) override; }; +} + /// Marshal a string vector reference size_t DynamicKernelStringArgument::Marshal( cl_kernel k, int argno, int, cl_program ) { @@ -964,6 +968,8 @@ size_t DynamicKernelStringArgument::Marshal( cl_kernel k, int argno, int, cl_pro return 1; } +namespace { + /// A mixed string/numeric vector class DynamicKernelMixedArgument : public VectorRef { @@ -1304,6 +1310,8 @@ private: std::vector<DynamicKernelArgumentRef> mParams; }; +} + void SymbolTable::Marshal( cl_kernel k, int nVectorWidth, cl_program pProgram ) { int i = 1; //The first argument is reserved for results @@ -1313,6 +1321,8 @@ void SymbolTable::Marshal( cl_kernel k, int nVectorWidth, cl_program pProgram ) } } +namespace { + /// Handling a Double Vector that is used as a sliding window input /// Performs parallel reduction based on given operator template<class Base> @@ -2316,7 +2326,7 @@ public: } virtual std::string BinFuncName() const override { return "fsop"; } }; -namespace { + struct SumIfsArgs { explicit SumIfsArgs(cl_mem x) : mCLMem(x), mConst(0.0) { } @@ -2324,7 +2334,6 @@ struct SumIfsArgs cl_mem mCLMem; double mConst; }; -} /// Helper functions that have multiple buffers class DynamicKernelSoPArguments : public DynamicKernelArgument @@ -2619,6 +2628,8 @@ private: cl_mem mpClmem2; }; +} + static DynamicKernelArgumentRef SoPHelper( const ScCalcConfig& config, const std::string& ts, const FormulaTreeNodeRef& ft, SlidingFunctionBase* pCodeGen, int nResultSize ) @@ -3793,6 +3804,8 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, } } +namespace { + class DynamicKernel : public CompiledFormula { public: @@ -3833,6 +3846,8 @@ private: int const mnResultSize; }; +} + DynamicKernel::DynamicKernel( const ScCalcConfig& config, const FormulaTreeNodeRef& r, int nResultSize ) : mCalcConfig(config), mpRoot(r), diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index d750f377d1ad..b943edf34af1 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -705,6 +705,8 @@ static bool lcl_getLastTabName( OUString& rTabName2, const OUString& rTabName1, return true; } +namespace { + struct Convention_A1 : public ScCompiler::Convention { explicit Convention_A1( FormulaGrammar::AddressConvention eConv ) : ScCompiler::Convention( eConv ) { } @@ -737,6 +739,8 @@ struct Convention_A1 : public ScCompiler::Convention } }; +} + void Convention_A1::MakeColStr( OUStringBuffer& rBuffer, SCCOL nCol ) { if ( !ValidCol( nCol) ) @@ -753,6 +757,8 @@ void Convention_A1::MakeRowStr( OUStringBuffer& rBuffer, SCROW nRow ) rBuffer.append(sal_Int32(nRow + 1)); } +namespace { + struct ConventionOOO_A1 : public Convention_A1 { ConventionOOO_A1() : Convention_A1 (FormulaGrammar::CONV_OOO) { } @@ -1549,6 +1555,8 @@ struct ConventionXL_OOX : public ConventionXL_A1 } }; +} + static void r1c1_add_col( OUStringBuffer &rBuf, const ScSingleRefData& rRef, const ScAddress& rAbsRef ) { @@ -1577,6 +1585,8 @@ r1c1_add_row( OUStringBuffer &rBuf, const ScSingleRefData& rRef, const ScAddress rBuf.append( OUString::number( rAbsRef.Row() + 1 ) ); } +namespace { + struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL { ConventionXL_R1C1() : ScCompiler::Convention( FormulaGrammar::CONV_XL_R1C1 ) { } @@ -1764,6 +1774,8 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL } }; +} + ScCompiler::ScCompiler( sc::CompileFormulaContext& rCxt, const ScAddress& rPos, ScTokenArray& rArr, bool bComputeII, bool bMatrixFlag, const ScInterpreterContext* pContext ) : FormulaCompiler(rArr, bComputeII, bMatrixFlag), diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index 3ea84ef59bbf..b253e6c4bbbb 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -114,6 +114,8 @@ public: sal_uInt16 GetMaxLevel() const { return nMaxLevel; } }; +namespace { + class ScCommentData { public: @@ -126,6 +128,8 @@ private: SfxItemSet aCaptionSet; }; +} + Color ScDetectiveFunc::nArrowColor = Color(0); Color ScDetectiveFunc::nErrorColor = Color(0); Color ScDetectiveFunc::nCommentColor = Color(0); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 9069138c3013..a62e6885c0eb 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -8937,11 +8937,15 @@ void ScInterpreter::ScLeft() } } +namespace { + struct UBlockScript { UBlockCode const from; UBlockCode const to; }; +} + static const UBlockScript scriptList[] = { {UBLOCK_HANGUL_JAMO, UBLOCK_HANGUL_JAMO}, {UBLOCK_CJK_RADICALS_SUPPLEMENT, UBLOCK_HANGUL_SYLLABLES}, diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index f219beca9386..31dee4ce707e 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -51,6 +51,8 @@ using namespace formula; const double ScInterpreter::fMaxGammaArgument = 171.624376956302; // found experimental const double fMachEps = ::std::numeric_limits<double>::epsilon(); +namespace { + class ScDistFunc { public: @@ -60,6 +62,8 @@ protected: ~ScDistFunc() {} }; +} + // iteration for inverse distributions //template< class T > double lcl_IterateInverse( const T& rFunction, double x0, double x1, bool& rConvError ) @@ -4765,6 +4769,8 @@ static SCSIZE lcl_bitReverse(SCSIZE nIn, SCSIZE nBound) return nOut; } +namespace { + // Computes and stores twiddle factors for computing DFT later. struct ScTwiddleFactors { @@ -4790,6 +4796,8 @@ struct ScTwiddleFactors bool mbInverse; }; +} + void ScTwiddleFactors::Compute() { mfWReal.resize(mnN); @@ -4905,6 +4913,8 @@ void ScTwiddleFactors::Compute() } } +namespace { + // A radix-2 decimation in time FFT algorithm for complex valued input. class ScComplexFFT2 { @@ -4995,6 +5005,8 @@ private: bool mbSubSampleTFs:1; }; +} + void ScComplexFFT2::prepare() { SCSIZE nPoints = mnPoints; @@ -5094,6 +5106,8 @@ void ScComplexFFT2::Compute() lcl_normalize(mrArray, mbPolar); } +namespace { + // Bluestein's algorithm or chirp z-transform algorithm that can be used to // compute DFT of a complex valued input of any length N in O(N lgN) time. class ScComplexBluesteinFFT @@ -5123,6 +5137,8 @@ private: bool mbDisableNormalize:1; }; +} + void ScComplexBluesteinFFT::Compute() { std::vector<double> aRealScalars(mnPoints); @@ -5213,6 +5229,8 @@ void ScComplexBluesteinFFT::Compute() lcl_normalize(mrArray, mbPolar); } +namespace { + // Computes DFT of an even length(N) real-valued input by using a // ScComplexFFT2 if N == 2^k for some k or else by using a ScComplexBluesteinFFT // with a complex valued input of length = N/2. @@ -5239,6 +5257,8 @@ private: bool mbPolar:1; }; +} + void ScRealFFT::Compute() { // input length has to be even to do this optimization. @@ -5338,6 +5358,8 @@ void ScRealFFT::Compute() using ScMatrixGenerator = ScMatrixRef(SCSIZE, SCSIZE, std::vector<double>&); +namespace { + // Generic FFT class that decides which FFT implementation to use. class ScFFT { @@ -5361,6 +5383,8 @@ private: bool mbPolar:1; }; +} + ScMatrixRef ScFFT::Compute(const std::function<ScMatrixGenerator>& rMatGenFunc) { std::vector<double> aArray; diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx index c2655fceb3d7..7038e4de1f81 100644 --- a/sc/source/core/tool/interpr6.cxx +++ b/sc/source/core/tool/interpr6.cxx @@ -203,6 +203,8 @@ double ScInterpreter::GetGammaDist( double fX, double fAlpha, double fLambda ) return GetLowRegIGamma( fAlpha, fX / fLambda); } +namespace { + class NumericCellAccumulator { double mfFirst; @@ -399,6 +401,8 @@ public: sal_uInt32 getNumberFormat() const { return mnNumFmt; } }; +} + static void IterateMatrix( const ScMatrixRef& pMat, ScIterFunc eFunc, bool bTextAsZero, sal_uLong& rCount, SvNumFormatType& rFuncFmtType, double& fRes, double& fMem ) diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx index 9738c2ce7421..39706cf7882c 100644 --- a/sc/source/core/tool/interpr8.cxx +++ b/sc/source/core/tool/interpr8.cxx @@ -23,6 +23,8 @@ using namespace formula; +namespace { + struct DataPoint { double X, Y; @@ -30,6 +32,8 @@ struct DataPoint DataPoint( double rX, double rY ) : X( rX ), Y( rY ) {}; }; +} + static bool lcl_SortByX( const DataPoint &lhs, const DataPoint &rhs ) { return lhs.X < rhs.X; } /* @@ -70,6 +74,9 @@ static bool lcl_SortByX( const DataPoint &lhs, const DataPoint &rhs ) { return l * Intervals for Future Values * */ + +namespace { + class ScETSForecastCalculation { private: @@ -128,6 +135,8 @@ public: void GetETSPredictionIntervals( const ScMatrixRef& rTMat, const ScMatrixRef& rPIMat, double fPILevel ); }; +} + ScETSForecastCalculation::ScETSForecastCalculation( SCSIZE nSize, SvNumberFormatter* pFormatter ) : mpFormatter(pFormatter) , mnSmplInPrd(0) diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 90bda2d1f9dc..76b68d1a1b27 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -1243,6 +1243,8 @@ ScRangePairList* ScRangePairList::Clone() const return pNew; } +namespace { + class ScRangePairList_sortNameCompare { public: @@ -1319,6 +1321,8 @@ private: ScDocument * const mpDoc; }; +} + void ScRangePairList::Join( const ScRangePair& r, bool bIsInList ) { if ( maPairs.empty() ) diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index 34ee65302349..3e5bb647db9f 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -55,6 +55,8 @@ using std::endl; using ::std::pair; using ::std::advance; +namespace { + /** * Custom string trait struct to tell mdds::multi_type_matrix about the * custom string type and how to handle blocks storing them. @@ -67,6 +69,8 @@ struct matrix_trait typedef mdds::mtv::custom_block_func1<sc::string_block> element_block_func; }; +} + typedef mdds::multi_type_matrix<matrix_trait> MatrixImplType; namespace { @@ -2194,6 +2198,8 @@ void ScMatrixImpl::MergeDoubleArrayMultiply( std::vector<double>& rArray ) const namespace Op { +namespace { + template<typename T> struct return_type { @@ -2214,6 +2220,10 @@ struct return_type<char> } +} + +namespace { + template<typename T, typename U, typename return_type> struct wrapped_iterator { @@ -2320,8 +2330,6 @@ public: } }; -namespace { - MatrixImplType::position_type increment_position(const MatrixImplType::position_type& pos, size_t n) { MatrixImplType::position_type ret = pos; @@ -2343,8 +2351,6 @@ MatrixImplType::position_type increment_position(const MatrixImplType::position_ return ret; } -} - template<typename T> struct MatrixOpWrapper { @@ -2419,6 +2425,8 @@ public: } }; +} + template<typename T> void ScMatrixImpl::ApplyOperation(T aOp, ScMatrixImpl& rMat) { @@ -3281,6 +3289,8 @@ void ScMatrix::MergeDoubleArrayMultiply( std::vector<double>& rArray ) const namespace matop { +namespace { + /** * COp struct is used in MatOp class to provide (through template specialization) * different actions for empty entries in a matrix. @@ -3288,6 +3298,8 @@ namespace matop { template <typename T, typename S> struct COp {}; +} + template <typename T> struct COp<T, svl::SharedString> { @@ -3306,6 +3318,8 @@ struct COp<T, double> } }; +namespace { + /** A template for operations where operands are supposed to be numeric. A non-numeric (string) operand leads to the configured conversion to number method being called if in interpreter context and a FormulaError::NoValue DoubleError @@ -3371,6 +3385,8 @@ public: } +} + void ScMatrix::NotOp( const ScMatrix& rMat) { auto not_ = [](double a, double){return double(a == 0.0);}; diff --git a/sc/source/core/tool/stylehelper.cxx b/sc/source/core/tool/stylehelper.cxx index 6e42c06a5df1..61ec2a3c37a1 100644 --- a/sc/source/core/tool/stylehelper.cxx +++ b/sc/source/core/tool/stylehelper.cxx @@ -44,12 +44,16 @@ #define SC_PIVOT_STYLE_PROG_FIELDNAME "Pivot Table Field" #define SC_PIVOT_STYLE_PROG_TOP "Pivot Table Corner" +namespace { + struct ScDisplayNameMap { OUString aDispName; OUString aProgName; }; +} + static const ScDisplayNameMap* lcl_GetStyleNameMap( SfxStyleFamily nType ) { if ( nType == SfxStyleFamily::Para ) diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 95d2d0fb94c8..67520923d96f 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -65,6 +65,8 @@ using namespace ::comphelper; //OleNameOverrideContainer +namespace { + class OleNameOverrideContainer : public ::cppu::WeakImplHelper< container::XNameContainer > { private: @@ -127,8 +129,6 @@ public: } }; -namespace { - /** Future Record Type header. @return whether read rt matches nRecordID */ diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 98079cd96345..f0cb4cd2646f 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -63,6 +63,8 @@ using ::com::sun::star::sheet::XAreaLink; // Shared string table ======================================================== +namespace { + /** A single string entry in the hash table. */ struct XclExpHashEntry { @@ -79,6 +81,8 @@ struct XclExpHashEntrySWO { return *rLeft.mpString < *rRight.mpString; } }; +} + /** Implementation of the SST export. @descr Stores all passed strings in a hash table and prevents repeated insertion of equal strings. */ diff --git a/sc/source/filter/excel/xedbdata.cxx b/sc/source/filter/excel/xedbdata.cxx index 6eacd6ef1a61..043c1791acf6 100644 --- a/sc/source/filter/excel/xedbdata.cxx +++ b/sc/source/filter/excel/xedbdata.cxx @@ -16,6 +16,8 @@ using namespace oox; +namespace { + /** (So far) dummy implementation of table export for BIFF5/BIFF7. */ class XclExpTablesImpl5 : public XclExpTables { @@ -36,6 +38,7 @@ public: virtual void SaveXml( XclExpXmlStream& rStrm ) override; }; +} XclExpTablesImpl5::XclExpTablesImpl5( const XclExpRoot& rRoot ) : XclExpTables( rRoot ) diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index 4142ae5e625e..3dd30eb9a9fa 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -49,6 +49,8 @@ using namespace oox; // External names ============================================================= +namespace { + /** This is a base class for any external name (i.e. add-in names or DDE links). @descr Derived classes implement creation and export of the external names. */ class XclExpExtNameBase : public XclExpRecord, protected XclExpRoot @@ -190,7 +192,7 @@ private: SCROW mnScRow; /// Row index of the external cells. }; -namespace { class XclExpCrnList; } +class XclExpCrnList; /** Represents the record XCT which is the header record of a CRN record list. */ @@ -387,7 +389,7 @@ struct XclExpXti { rStrm << mnSupbook << mnFirstSBTab << mnLastSBTab; } }; -static bool operator==( const XclExpXti& rLeft, const XclExpXti& rRight ) +bool operator==( const XclExpXti& rLeft, const XclExpXti& rRight ) { return (rLeft.mnSupbook == rRight.mnSupbook) && @@ -483,6 +485,8 @@ private: sal_uInt16 mnAddInSB; /// Index to add-in SUPBOOK. }; +} + // Export link manager ======================================================== /** Abstract base class for implementation classes of the link manager. */ @@ -535,6 +539,8 @@ protected: explicit XclExpLinkManagerImpl( const XclExpRoot& rRoot ); }; +namespace { + /** Implementation of the link manager for BIFF5/BIFF7. */ class XclExpLinkManagerImpl5 : public XclExpLinkManagerImpl { @@ -658,6 +664,8 @@ private: XclExpXtiVec maXtiVec; /// List of XTI structures for the EXTERNSHEET record. }; +} + // *** Implementation *** // Excel sheet indexes ======================================================== @@ -869,6 +877,8 @@ void XclExpTabInfo::CalcXclIndexes() typedef ::std::pair< OUString, SCTAB > XclExpTabName; +namespace { + struct XclExpTabNameSort { bool operator ()( const XclExpTabName& rArg1, const XclExpTabName& rArg2 ) { @@ -877,6 +887,8 @@ struct XclExpTabNameSort { } }; +} + void XclExpTabInfo::CalcSortedIndexes() { ScDocument& rDoc = GetDoc(); diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index 67a1fd3464df..01b778eb044b 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -40,6 +40,8 @@ using namespace ::oox; // *** Helper classes *** +namespace { + /** Represents an internal defined name, supports writing it to a NAME record. */ class XclExpName : public XclExpRecord, protected XclExpRoot { @@ -107,6 +109,8 @@ private: sal_uInt16 mnXclTab; /// The 1-based Excel sheet index for local names. }; +} + /** Implementation class of the name manager. */ class XclExpNameManagerImpl : protected XclExpRoot { diff --git a/sc/source/filter/excel/xepage.cxx b/sc/source/filter/excel/xepage.cxx index 9783ea5e5fc0..41c531264b15 100644 --- a/sc/source/filter/excel/xepage.cxx +++ b/sc/source/filter/excel/xepage.cxx @@ -335,6 +335,8 @@ XclExpPageSettings::XclExpPageSettings( const XclExpRoot& rRoot ) : maData.maVerPageBreaks.push_back(rColBreak); } +namespace { + class XclExpXmlStartHeaderFooterElementRecord : public XclExpXmlElementRecord { public: @@ -344,6 +346,8 @@ public: virtual void SaveXml( XclExpXmlStream& rStrm ) override; }; +} + void XclExpXmlStartHeaderFooterElementRecord::SaveXml(XclExpXmlStream& rStrm) { // OOXTODO: we currently only emit oddHeader/oddFooter elements, and diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 7b6a3b5a5665..2ee1648432a8 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -1309,6 +1309,8 @@ size_t XclExpFontBuffer::Find( const XclFontData& rFontData ) // FORMAT record - number formats ============================================= +namespace { + /** Predicate for search algorithm. */ struct XclExpNumFmtPred { @@ -1318,6 +1320,8 @@ struct XclExpNumFmtPred { return rFormat.mnScNumFmt == mnScNumFmt; } }; +} + void XclExpNumFmt::SaveXml( XclExpXmlStream& rStrm ) { sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream(); @@ -2346,6 +2350,8 @@ XclExpXFBuffer::XclExpBuiltInInfo::XclExpBuiltInInfo() : { } +namespace { + /** Predicate for search algorithm. */ struct XclExpBorderPred { @@ -2355,6 +2361,8 @@ struct XclExpBorderPred bool operator()( const XclExpCellBorder& rBorder ) const; }; +} + bool XclExpBorderPred::operator()( const XclExpCellBorder& rBorder ) const { return @@ -2377,6 +2385,8 @@ bool XclExpBorderPred::operator()( const XclExpCellBorder& rBorder ) const mrBorder.mnDiagColorId == rBorder.mnDiagColorId; } +namespace { + struct XclExpFillPred { const XclExpCellArea& @@ -2385,6 +2395,8 @@ struct XclExpFillPred bool operator()( const XclExpCellArea& rFill ) const; }; +} + bool XclExpFillPred::operator()( const XclExpCellArea& rFill ) const { return diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 4604b860172f..132f48c2f44b 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2149,6 +2149,8 @@ void XclExpRowBuffer::CreateRows( SCROW nFirstFreeScRow ) GetOrCreateRow( ::std::max ( nFirstFreeScRow - 1, GetMaxPos().Row() ), true ); } +namespace { + class RowFinalizeTask : public comphelper::ThreadTask { bool mbProgress; @@ -2170,6 +2172,8 @@ public: } }; +} + void XclExpRowBuffer::Finalize( XclExpDefaultRowData& rDefRowData, const ScfUInt16Vec& rColXFIndexes ) { // *** Finalize all rows *** ---------------------------------------------- diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index fe59a3495ba4..47ca45d10f25 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -3559,6 +3559,8 @@ void XclImpDffConverter::ProcessClientAnchor2( SvStream& rDffStrm, } } +namespace { + struct XclImpDrawObjClientData : public SvxMSDffClientData { const XclImpDrawObjBase* m_pTopLevelObj; @@ -3570,6 +3572,8 @@ struct XclImpDrawObjClientData : public SvxMSDffClientData virtual void NotifyFreeObj(SdrObject*) override {} }; +} + SdrObject* XclImpDffConverter::ProcessObj( SvStream& rDffStrm, DffObjData& rDffObjData, SvxMSDffClientData& rClientData, tools::Rectangle& /*rTextRect*/, SdrObject* pOldSdrObj ) { diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index 40128838a629..3e86e5bea064 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -38,6 +38,8 @@ // Cached external cells ====================================================== +namespace { + /** * Contains the address and value of an external referenced cell. * Note that this is non-copyable, so cannot be used in most stl/boost containers. @@ -80,6 +82,8 @@ private: OUString maTabName; /// Name of the external sheet. }; +} + // External document (SUPBOOK) ================================================ /** This class represents an external linked document (record SUPBOOK). @@ -134,6 +138,8 @@ private: // Import link manager ======================================================== +namespace { + /** Contains the SUPBOOK index and sheet indexes of an external link. @descr It is possible to enter a formula like =SUM(Sheet1:Sheet3!A1), therefore here occurs a sheet range. */ @@ -145,7 +151,7 @@ struct XclImpXti explicit XclImpXti() : mnSupbook( SAL_MAX_UINT16 ), mnSBTabFirst( SAL_MAX_UINT16 ), mnSBTabLast( SAL_MAX_UINT16 ) {} }; -static XclImpStream& operator>>( XclImpStream& rStrm, XclImpXti& rXti ) +XclImpStream& operator>>( XclImpStream& rStrm, XclImpXti& rXti ) { rXti.mnSupbook = rStrm.ReaduInt16(); rXti.mnSBTabFirst = rStrm.ReaduInt16(); @@ -153,6 +159,8 @@ static XclImpStream& operator>>( XclImpStream& rStrm, XclImpXti& rXti ) return rStrm; } +} + /** Implementation of the link manager. */ class XclImpLinkManagerImpl : protected XclImpRoot { diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index dea7ab2886c5..66d7429b6c6a 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -80,6 +80,8 @@ using namespace ::com::sun::star; typedef ::cppu::WeakImplHelper< container::XIndexAccess > XIndexAccess_BASE; typedef ::std::vector< Color > ColorVec; +namespace { + class PaletteIndex : public XIndexAccess_BASE { public: @@ -111,6 +113,8 @@ private: ColorVec maColor; }; +} + void XclImpPalette::ExportPalette() { diff --git a/sc/source/filter/excel/xltoolbar.cxx b/sc/source/filter/excel/xltoolbar.cxx index cd3a355f252a..c65e1919541e 100644 --- a/sc/source/filter/excel/xltoolbar.cxx +++ b/sc/source/filter/excel/xltoolbar.cxx @@ -21,6 +21,8 @@ using namespace com::sun::star; typedef std::map< sal_Int16, OUString > IdToString; +namespace { + class MSOExcelCommandConvertor : public MSOCommandConvertor { IdToString msoToOOcmd; @@ -31,6 +33,8 @@ public: virtual OUString MSOTCIDToOOCommand( sal_Int16 key ) override; }; +} + MSOExcelCommandConvertor::MSOExcelCommandConvertor() { /* diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index ae46949e4b21..3da6e228d0e8 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -1768,6 +1768,8 @@ ScHTMLTable* ScHTMLTableMap::CreateTable( const HtmlImportInfo& rInfo, bool bPre return pTable; } +namespace { + /** Simplified forward iterator for convenience. Before the iterator can be dereferenced, it must be tested with the is() @@ -1791,6 +1793,8 @@ private: const ScHTMLTableMap* mpTableMap; }; +} + ScHTMLTableIterator::ScHTMLTableIterator( const ScHTMLTableMap* pTableMap ) : mpTableMap(pTableMap) { diff --git a/sc/source/filter/oox/formulaparser.cxx b/sc/source/filter/oox/formulaparser.cxx index 0426e3c433e1..d44c7a9407f9 100644 --- a/sc/source/filter/oox/formulaparser.cxx +++ b/sc/source/filter/oox/formulaparser.cxx @@ -1168,6 +1168,8 @@ OUString FormulaParserImpl::resolveDefinedName( sal_Int32 nTokenIndex ) const // OOXML/BIFF12 parser implementation ========================================= +namespace { + class OoxFormulaParserImpl : public FormulaParserImpl { public: @@ -1219,6 +1221,8 @@ private: bool mbNeedExtRefs; /// True = parser needs initialization of external reference info. }; +} + OoxFormulaParserImpl::OoxFormulaParserImpl( const FormulaParser& rParent ) : FormulaParserImpl( rParent ), maApiParser( rParent.getBaseFilter().getModelFactory(), rParent ), diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx index 14e4f9baaf82..dc92ad40ca11 100644 --- a/sc/source/filter/oox/pagesettings.cxx +++ b/sc/source/filter/oox/pagesettings.cxx @@ -353,8 +353,6 @@ enum HFPortionId HF_COUNT }; -} - struct HFPortionInfo { Reference<text::XText> mxText; /// XText interface of this portion. @@ -366,6 +364,8 @@ struct HFPortionInfo bool initialize( const Reference<text::XText>& rxText ); }; +} + bool HFPortionInfo::initialize( const Reference<text::XText>& rxText ) { mfTotalHeight = mfCurrHeight = 0.0; diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index efd7f55a73e3..f7c8a5177e04 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -298,6 +298,8 @@ orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet( return maSheets.back().get(); } +namespace { + class FindSheetByIndex { SCTAB const mnTab; @@ -309,6 +311,8 @@ public: } }; +} + orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::get_sheet(const char* sheet_name, size_t sheet_name_length) { OUString aTabName(sheet_name, sheet_name_length, maGlobalSettings.getTextEncoding()); diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx index 9a7ee2fa7392..e80aed2267da 100644 --- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx @@ -1366,6 +1366,8 @@ void ExcXmlRecord::Save( XclExpStream& ) // Do nothing; ignored for BIFF output. } +namespace { + class EndXmlElement : public ExcXmlRecord { sal_Int32 mnElement; @@ -1374,6 +1376,8 @@ public: virtual void SaveXml( XclExpXmlStream& rStrm ) override; }; +} + void EndXmlElement::SaveXml( XclExpXmlStream& rStrm ) { sax_fastparser::FSHelperPtr pStream = rStrm.GetCurrentStream(); diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index da91d360aee3..d05afbf27334 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -565,6 +565,8 @@ void XclObjComment::Save( XclExpStream& rStrm ) XclObj::Save( rStrm ); } +namespace { + class VmlCommentExporter : public VMLExport { ScAddress maScPos; @@ -583,6 +585,8 @@ protected: virtual void EndShape( sal_Int32 nShapeElement ) override; }; +} + VmlCommentExporter::VmlCommentExporter( const sax_fastparser::FSHelperPtr& p, const ScAddress& aScPos, SdrCaptionObj* pCaption, bool bVisible, const tools::Rectangle &aFrom, const tools::Rectangle &aTo ) : VMLExport( p ) @@ -1537,12 +1541,16 @@ std::size_t ExcEScenarioManager::GetLen() const return 8; } +namespace { + struct XclExpTabProtectOption { ScTableProtection::Option eOption; sal_uInt16 nMask; }; +} + XclExpSheetProtectOptions::XclExpSheetProtectOptions( const XclExpRoot& rRoot, SCTAB nTab ) : XclExpRecord( 0x0867, 23 ) { diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx index c8e652f4522b..2b0e2afa0171 100644 --- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx +++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx @@ -39,6 +39,8 @@ using namespace com::sun::star; using namespace xmloff::token; +namespace { + class ScXMLChangeInfoContext : public ScXMLImportContext { ScMyActionInfo aInfo; @@ -348,6 +350,8 @@ public: virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override; }; +} + ScXMLTrackedChangesContext::ScXMLTrackedChangesContext( ScXMLImport& rImport, const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList, ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) : diff --git a/sc/source/filter/xml/xmlcvali.cxx b/sc/source/filter/xml/xmlcvali.cxx index 78dc7fd49597..cff9a046c0da 100644 --- a/sc/source/filter/xml/xmlcvali.cxx +++ b/sc/source/filter/xml/xmlcvali.cxx @@ -33,6 +33,8 @@ using namespace com::sun::star; using namespace xmloff::token; using namespace ::formula; +namespace { + class ScXMLContentValidationContext : public ScXMLImportContext { OUString sName; @@ -136,6 +138,8 @@ public: virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override; }; +} + ScXMLContentValidationsContext::ScXMLContentValidationsContext( ScXMLImport& rImport ) : ScXMLImportContext( rImport ) { diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index a1fdf72f53b1..4e98d40ddb45 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -303,6 +303,8 @@ Calc_XMLOasisSettingsExporter_get_implementation(css::uno::XComponentContext* co return cppu::acquire(new ScXMLExport(context, "com.sun.star.comp.Calc.XMLOasisSettingsExporter", SvXMLExportFlags::SETTINGS|SvXMLExportFlags::OASIS)); } +namespace { + class ScXMLShapeExport : public XMLShapeExport { public: @@ -312,6 +314,8 @@ public: virtual void onExport( const uno::Reference < drawing::XShape >& xShape ) override; }; +} + void ScXMLShapeExport::onExport( const uno::Reference < drawing::XShape >& xShape ) { uno::Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY ); diff --git a/sc/source/filter/xml/xmlfonte.cxx b/sc/source/filter/xml/xmlfonte.cxx index 773848bfdf47..22b31e73f27e 100644 --- a/sc/source/filter/xml/xmlfonte.cxx +++ b/sc/source/filter/xml/xmlfonte.cxx @@ -30,6 +30,8 @@ #include <stlpool.hxx> #include <attrib.hxx> +namespace { + class ScXMLFontAutoStylePool_Impl: public XMLFontAutoStylePool { private: @@ -43,6 +45,8 @@ public: virtual ~ScXMLFontAutoStylePool_Impl() override; }; +} + void ScXMLFontAutoStylePool_Impl::AddFontItems(const sal_uInt16* pWhichIds, sal_uInt8 nIdCount, const SfxItemPool* pItemPool, const bool bExportDefaults) { for( sal_uInt16 i=0; i < nIdCount; ++i ) diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index f97b06884261..08e01b8cf7cd 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -222,6 +222,8 @@ const SvXMLTokenMap& ScXMLImport::GetTableRowCellAttrTokenMap() return *pTableRowCellAttrTokenMap; } +namespace { + // NB: virtually inherit so we can multiply inherit properly // in ScXMLFlatDocContext_Impl class ScXMLDocContext_Impl : public virtual SvXMLImportContext @@ -248,11 +250,15 @@ public: virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; }; +} + ScXMLDocContext_Impl::ScXMLDocContext_Impl( ScXMLImport& rImport ) : SvXMLImportContext( rImport ) { } +namespace { + // context for flat file xml format class ScXMLFlatDocContext_Impl : public ScXMLDocContext_Impl, public SvXMLMetaDocumentContext @@ -274,6 +280,8 @@ public: const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) override; }; +} + ScXMLFlatDocContext_Impl::ScXMLFlatDocContext_Impl( ScXMLImport& i_rImport, const uno::Reference<document::XDocumentProperties>& i_xDocProps) : SvXMLImportContext(i_rImport), @@ -308,6 +316,8 @@ void SAL_CALL ScXMLFlatDocContext_Impl::characters(const OUString& rChars) SvXMLMetaDocumentContext::characters(rChars); } +namespace { + class ScXMLBodyContext_Impl : public ScXMLImportContext { public: @@ -318,6 +328,8 @@ public: const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) override; }; +} + ScXMLBodyContext_Impl::ScXMLBodyContext_Impl( ScXMLImport& rImport ) : ScXMLImportContext( rImport ) { diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx index 792e59594bc7..1a92449707ec 100644 --- a/sc/source/filter/xml/xmlstyli.cxx +++ b/sc/source/filter/xml/xmlstyli.cxx @@ -260,6 +260,8 @@ void ScXMLRowImportPropertyMapper::finished(::std::vector< XMLPropertyState >& r // don't access pointers to rProperties elements after push_back! } +namespace { + class XMLTableCellPropsContext : public SvXMLPropertySetContext { using SvXMLPropertySetContext::CreateChildContext; @@ -279,6 +281,8 @@ class XMLTableCellPropsContext : public SvXMLPropertySetContext const XMLPropertyState& rProp ) override; }; +} + XMLTableCellPropsContext::XMLTableCellPropsContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, @@ -329,6 +333,8 @@ SvXMLImportContextRef XMLTableCellPropsContext::CreateChildContext( sal_uInt16 n return SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName, xAttrList, rProperties, rProp ); } +namespace { + class ScXMLMapContext : public SvXMLImportContext { OUString msApplyStyle; @@ -346,6 +352,8 @@ public: ScCondFormatEntry* CreateConditionEntry(); }; +} + ScXMLMapContext::ScXMLMapContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< xml::sax::XAttributeList > & xAttrList ) : SvXMLImportContext( rImport, nPrfx, rLName ) diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index 836106cf193e..74d0b60ffe52 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -86,6 +86,8 @@ using namespace ::com::sun::star::accessibility; //===== internal ======================================================== +namespace { + struct ScAccessibleShapeData { ScAccessibleShapeData(css::uno::Reference< css::drawing::XShape > xShape_); @@ -100,6 +102,8 @@ struct ScAccessibleShapeData boost::optional<sal_Int32> mxZOrder; }; +} + ScAccessibleShapeData::ScAccessibleShapeData(css::uno::Reference< css::drawing::XShape > xShape_) : xShape(xShape_), bSelected(false), bSelectable(true) @@ -128,6 +132,8 @@ ScAccessibleShapeData::~ScAccessibleShapeData() } } +namespace { + struct ScShapeDataLess { static void ConvertLayerId(sal_Int16& rLayerID) // changes the number of the LayerId so it the accessibility order @@ -193,6 +199,8 @@ struct ScShapeDataLess } }; +} + class ScChildrenShapes : public SfxListener, public ::accessibility::IAccessibleParent { diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx index a6d7f5f08169..f887784bd92d 100644 --- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx @@ -61,6 +61,8 @@ using namespace ::com::sun::star::accessibility; typedef std::vector< uno::Reference< XAccessible > > ScXAccVector; +namespace { + struct ScAccNote { OUString maNoteText; @@ -78,6 +80,8 @@ struct ScAccNote } }; +} + class ScNotesChildren { public: @@ -120,6 +124,8 @@ ScNotesChildren::ScNotesChildren(ScPreviewShell* pViewShell, ScAccessibleDocumen { } +namespace { + struct DeleteAccNote { void operator()(ScAccNote& rNote) @@ -129,6 +135,8 @@ struct DeleteAccNote } }; +} + ScNotesChildren::~ScNotesChildren() { std::for_each(maNotes.begin(), maNotes.end(), DeleteAccNote()); @@ -196,6 +204,8 @@ void ScNotesChildren::Init(const tools::Rectangle& rVisRect, sal_Int32 nOffset) } } +namespace { + struct ScParaFound { sal_Int32 mnIndex; @@ -211,6 +221,8 @@ struct ScParaFound } }; +} + uno::Reference<XAccessible> ScNotesChildren::GetChild(sal_Int32 nIndex) const { uno::Reference<XAccessible> xAccessible; @@ -252,6 +264,8 @@ uno::Reference<XAccessible> ScNotesChildren::GetChild(sal_Int32 nIndex) const return xAccessible; } +namespace { + struct ScPointFound { tools::Rectangle const maPoint; @@ -268,6 +282,8 @@ struct ScPointFound } }; +} + uno::Reference<XAccessible> ScNotesChildren::GetAt(const awt::Point& rPoint) const { uno::Reference<XAccessible> xAccessible; @@ -410,6 +426,8 @@ sal_Int32 ScNotesChildren::CheckChanges(const ScPreviewLocationData& rData, return nParagraphs; } +namespace { + struct ScChildGone { ScAccessibleDocumentPagePreview* const mpAccDoc; @@ -446,6 +464,8 @@ struct ScChildNew } }; +} + void ScNotesChildren::DataChanged(const tools::Rectangle& rVisRect) { if (mpViewShell && mpAccDoc) @@ -472,6 +492,8 @@ inline ScDocument* ScNotesChildren::GetDocument() const return pDoc; } +namespace { + class ScIAccessibleViewForwarder : public ::accessibility::IAccessibleViewForwarder { public: @@ -492,6 +514,8 @@ private: MapMode maMapMode; }; +} + ScIAccessibleViewForwarder::ScIAccessibleViewForwarder() : mpViewShell(nullptr), mpAccDoc(nullptr) { @@ -548,6 +572,8 @@ Size ScIAccessibleViewForwarder::LogicToPixel (const Size& rSize) const return aSize; } +namespace { + struct ScShapeChild { ScShapeChild() @@ -560,6 +586,8 @@ struct ScShapeChild sal_Int32 mnRangeId; }; +} + ScShapeChild::~ScShapeChild() { if (mpAccShape.is()) @@ -568,6 +596,8 @@ ScShapeChild::~ScShapeChild() } } +namespace { + struct ScShapeChildLess { bool operator()(const ScShapeChild& rChild1, const ScShapeChild& rChild2) const @@ -579,8 +609,12 @@ struct ScShapeChildLess } }; +} + typedef std::vector<ScShapeChild> ScShapeChildVec; +namespace { + struct ScShapeRange { ScShapeChildVec maBackShapes; @@ -589,6 +623,8 @@ struct ScShapeRange ScIAccessibleViewForwarder maViewForwarder; }; +} + typedef std::vector<ScShapeRange> ScShapeRangeVec; class ScShapeChildren : public ::accessibility::IAccessibleParent @@ -856,6 +892,8 @@ uno::Reference<XAccessible> ScShapeChildren::GetControl(sal_Int32 nIndex) const return xAccessible; } +namespace { + struct ScShapePointFound { Point const maPoint; @@ -869,6 +907,8 @@ struct ScShapePointFound } }; +} + uno::Reference<XAccessible> ScShapeChildren::GetForegroundShapeAt(const awt::Point& rPoint) const //inclusive Controls { uno::Reference<XAccessible> xAcc; @@ -1016,6 +1056,8 @@ SdrPage* ScShapeChildren::GetDrawPage() const return pDrawPage; } +namespace { + struct ScPagePreviewCountData { // order is background shapes, header, table or notes, footer, foreground shapes, controls @@ -1038,6 +1080,8 @@ struct ScPagePreviewCountData } }; +} + ScPagePreviewCountData::ScPagePreviewCountData( const ScPreviewLocationData& rData, const vcl::Window* pSizeWindow, const ScNotesChildren* pNotesChildren, const ScShapeChildren* pShapeChildren) : diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 2fa6f42415c7..0c167403cac6 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -249,48 +249,64 @@ void ScPreviewViewForwarder::SetInvalid() mpViewShell = nullptr; } +namespace { + class ScPreviewHeaderFooterViewForwarder : public ScPreviewViewForwarder { public: ScPreviewHeaderFooterViewForwarder(ScPreviewShell* pViewShell); }; +} + ScPreviewHeaderFooterViewForwarder::ScPreviewHeaderFooterViewForwarder(ScPreviewShell* pViewShell) : ScPreviewViewForwarder(pViewShell) { } +namespace { + class ScPreviewCellViewForwarder : public ScPreviewViewForwarder { public: ScPreviewCellViewForwarder(ScPreviewShell* pViewShell); }; +} + ScPreviewCellViewForwarder::ScPreviewCellViewForwarder(ScPreviewShell* pViewShell) : ScPreviewViewForwarder(pViewShell) { } +namespace { + class ScPreviewHeaderCellViewForwarder : public ScPreviewViewForwarder { public: ScPreviewHeaderCellViewForwarder(ScPreviewShell* pViewShell); }; +} + ScPreviewHeaderCellViewForwarder::ScPreviewHeaderCellViewForwarder(ScPreviewShell* pViewShell) : ScPreviewViewForwarder(pViewShell) { } +namespace { + class ScPreviewNoteViewForwarder : public ScPreviewViewForwarder { public: ScPreviewNoteViewForwarder(ScPreviewShell* pViewShell); }; +} + ScPreviewNoteViewForwarder::ScPreviewNoteViewForwarder(ScPreviewShell* pViewShell) : ScPreviewViewForwarder(pViewShell) diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index 1275113c7f29..5d3500097e24 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -49,6 +49,8 @@ #include <editutil.hxx> // *** edit engine *** +namespace { + struct Func_SetType { sal_Int32 const mnType; @@ -65,6 +67,8 @@ struct Func_Select { rState.Select( mbSelect ); } }; +} + ScCsvGrid::ScCsvGrid(const ScCsvLayoutData& rData, std::unique_ptr<weld::Menu> xPopup, ScCsvTableBox* pTableBox) : ScCsvControl(rData) , mpTableBox(pTableBox) diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index 722ffee83bdc..3f2592516319 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -36,8 +36,12 @@ #include <dbnamdlg.hxx> #include <dbdocfun.hxx> +namespace { + class DBSaveData; +} + static DBSaveData* pSaveObj = nullptr; namespace @@ -49,7 +53,6 @@ namespace rString)); xBox->run(); } -} // class DBSaveData @@ -94,6 +97,8 @@ private: bool bDirty:1; }; +} + void DBSaveData::Save() { aArea = rCurArea; diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 6ce6664c024d..7b6794f2445d 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1099,6 +1099,8 @@ void ScDocFunc::NotifyInputHandler( const ScAddress& rPos ) } } + namespace { + struct ScMyRememberItem { sal_Int32 const nIndex; @@ -1108,6 +1110,8 @@ void ScDocFunc::NotifyInputHandler( const ScAddress& rPos ) nIndex(nTempIndex), aItemSet(rItemSet) {} }; + } + typedef ::std::vector<std::unique_ptr<ScMyRememberItem>> ScMyRememberItemVector; void ScDocFunc::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine, bool bApi ) diff --git a/sc/source/ui/docshell/macromgr.cxx b/sc/source/ui/docshell/macromgr.cxx index 6f262bc5b35b..832dc35917b9 100644 --- a/sc/source/ui/docshell/macromgr.cxx +++ b/sc/source/ui/docshell/macromgr.cxx @@ -102,6 +102,8 @@ ScMacroManager::~ScMacroManager() typedef ::cppu::WeakImplHelper< css::container::XContainerListener > ContainerListenerHelper; +namespace { + class VBAProjectListener : public ContainerListenerHelper { ScMacroManager* mpMacroMgr; @@ -123,6 +125,8 @@ public: }; +} + void ScMacroManager::InitUserFuncData() { // Clear unordered_map diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index ce9f4f6d7c66..9e6333db4679 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -35,6 +35,8 @@ using namespace com::sun::star; +namespace { + /// Helper for sorting properties struct ScSolverOptionsEntry { @@ -49,6 +51,8 @@ struct ScSolverOptionsEntry } }; +} + ScSolverOptionsDialog::ScSolverOptionsDialog(weld::Window* pParent, const uno::Sequence<OUString>& rImplNames, const uno::Sequence<OUString>& rDescriptions, diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 45df3be40ddc..8696bda0a8ff 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -138,6 +138,8 @@ using namespace com::sun::star; +namespace { + class ScNamedEntry { OUString aName; @@ -151,6 +153,8 @@ public: const ScRange& GetRange() const { return aRange; } }; +} + // The names in the maps must be sorted according to strcmp! //! Instead of Which-ID 0 use special IDs and do not compare via names! @@ -9071,6 +9075,8 @@ void ScUniqueCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) // Fill the list of formats from the document +namespace { + // hash code to access the range lists by ScPatternAttr pointer struct ScPatternHashCode { @@ -9080,11 +9086,15 @@ struct ScPatternHashCode } }; +} + // Hash map to find a range by its start row typedef std::unordered_map< SCROW, ScRange > ScRowRangeHashMap; typedef std::vector<ScRange> ScRangeVector; +namespace { + // Hash map entry. // The Join method depends on the column-wise order of ScAttrRectIterator class ScUniqueFormatsEntry @@ -9105,6 +9115,8 @@ public: void Clear() { aReturnRanges.clear(); } // aJoinedRanges and aCompletedRanges are cleared in GetRanges }; +} + void ScUniqueFormatsEntry::Join( const ScRange& rNewRange ) { // Special-case handling for single range @@ -9192,6 +9204,8 @@ const ScRangeList& ScUniqueFormatsEntry::GetRanges() typedef std::unordered_map< const ScPatternAttr*, ScUniqueFormatsEntry, ScPatternHashCode > ScUniqueFormatsHashMap; +namespace { + // function object to sort the range lists by start of first range struct ScUniqueFormatsOrder { @@ -9205,6 +9219,8 @@ struct ScUniqueFormatsOrder } }; +} + ScUniqueCellFormatsObj::ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange& rRange) : pDocShell( pDocSh ), aTotalRange( rRange ), diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index 4e6b6332be89..331b38de448a 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -157,8 +157,6 @@ enum ScUnoCollectMode SC_UNO_COLLECT_FINDPOS }; -} - /** * This class exists solely to allow searching through field items. TODO: * Look into providing the same functionality directly in EditEngine, to @@ -189,6 +187,8 @@ public: sal_Int32 GetFieldPos() const { return nFieldPos; } }; +} + ScUnoEditEngine::ScUnoEditEngine(ScEditEngineDefaulter* pSource) : ScEditEngineDefaulter(*pSource) , eMode(SC_UNO_COLLECT_NONE) diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 128811bf1ae7..b65b34d168e7 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -57,6 +57,8 @@ using namespace com::sun::star; // helper to use cached document if not in use, temporary document otherwise +namespace { + class ScTempDocSource { private: @@ -72,6 +74,8 @@ public: ScDocument* GetDocument(); }; +} + ScDocument* ScTempDocSource::CreateDocument() { ScDocument* pDoc = new ScDocument( SCDOCMODE_FUNCTIONACCESS ); @@ -312,6 +316,8 @@ static void lcl_AddRef( ScTokenArray& rArray, long nStartRow, long nColCount, lo rArray.AddDoubleReference(aRef); } +namespace { + class SimpleVisitor { protected: @@ -439,6 +445,8 @@ static void processSequences( ScDocument* pDoc, const uno::Any& rArg, ScTokenArr } }; +} + uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName, const uno::Sequence<uno::Any>& aArguments ) { diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx index 23c7c4b93d27..ac0409d1cf15 100644 --- a/sc/source/ui/unoobj/servuno.cxx +++ b/sc/source/ui/unoobj/servuno.cxx @@ -81,6 +81,8 @@ static bool isInVBAMode( ScDocShell& rDocSh ) #endif +namespace { + class ScVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper< container::XNameAccess > { uno::Any maWorkbook; @@ -240,8 +242,6 @@ public: } }; -namespace { - using Type = ScServiceProvider::Type; struct ProvNamesId_Type diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx index 3a1e025bd717..b1f98144fd93 100644 --- a/sc/source/ui/vba/excelvbahelper.cxx +++ b/sc/source/ui/vba/excelvbahelper.cxx @@ -110,6 +110,8 @@ void implSetZoom( const uno::Reference< frame::XModel >& xModel, sal_Int16 nZoom const OUString REPLACE_CELLS_WARNING( "ReplaceCellsWarning"); +namespace { + class PasteCellsWarningReseter { private: @@ -154,6 +156,8 @@ public: } }; +} + void implnPaste( const uno::Reference< frame::XModel>& xModel ) { diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index 4c09ace2e90c..877020e061c5 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -115,6 +115,8 @@ ScVbaAppSettings::ScVbaAppSettings() : { } +namespace { + struct ScVbaStaticAppSettings : public ::rtl::Static< ScVbaAppSettings, ScVbaStaticAppSettings > {}; class ScVbaApplicationOutgoingConnectionPoint : public cppu::WeakImplHelper<XConnectionPoint> @@ -130,6 +132,8 @@ public: void SAL_CALL Unadvise( sal_uInt32 Cookie ) override; }; +} + sal_uInt32 ScVbaApplication::AddSink( const uno::Reference< XSink >& xSink ) { diff --git a/sc/source/ui/vba/vbaborders.cxx b/sc/source/ui/vba/vbaborders.cxx index 815f007676fa..406cea8a410b 100644 --- a/sc/source/ui/vba/vbaborders.cxx +++ b/sc/source/ui/vba/vbaborders.cxx @@ -49,6 +49,8 @@ const static sal_Int32 OOLineMedium = 88; const static sal_Int32 OOLineThick = 141; const static sal_Int32 OOLineHairline = 2; +namespace { + class ScVbaBorder : public ScVbaBorder_Base { private: @@ -350,12 +352,16 @@ public: } }; +} + static uno::Reference< container::XIndexAccess > rangeToBorderIndexAccess( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, const ScVbaPalette& rPalette ) { return new RangeBorders( xRange, xContext, rPalette ); } +namespace { + class RangeBorderEnumWrapper : public EnumerationHelper_BASE { uno::Reference<container::XIndexAccess > m_xIndexAccess; @@ -375,6 +381,8 @@ public: } }; +} + ScVbaBorders::ScVbaBorders( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< table::XCellRange >& xRange, diff --git a/sc/source/ui/vba/vbachartobjects.cxx b/sc/source/ui/vba/vbachartobjects.cxx index 1ded0545c49e..dabe9a1a06dd 100644 --- a/sc/source/ui/vba/vbachartobjects.cxx +++ b/sc/source/ui/vba/vbachartobjects.cxx @@ -35,6 +35,8 @@ using namespace ::com::sun::star; using namespace ::ooo::vba; +namespace { + class ChartObjectEnumerationImpl : public EnumerationHelperImpl { uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier; @@ -76,6 +78,8 @@ public: } }; +} + ScVbaChartObjects::ScVbaChartObjects( const css::uno::Reference< ov::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const css::uno::Reference< css::table::XTableCharts >& _xTableCharts, const uno::Reference< drawing::XDrawPageSupplier >& _xDrawPageSupplier ) : ChartObjects_BASE(_xParent, _xContext, css::uno::Reference< css::container::XIndexAccess >( _xTableCharts, css::uno::UNO_QUERY ) ), xTableCharts( _xTableCharts ) , xDrawPageSupplier( _xDrawPageSupplier ) { diff --git a/sc/source/ui/vba/vbacomments.cxx b/sc/source/ui/vba/vbacomments.cxx index a1b2001c522a..b8d933fc8378 100644 --- a/sc/source/ui/vba/vbacomments.cxx +++ b/sc/source/ui/vba/vbacomments.cxx @@ -38,6 +38,8 @@ static uno::Any AnnotationToComment( const uno::Any& aSource, const uno::Referen new ScVbaComment( uno::Reference< XHelperInterface >(), xContext, xModel, xCellRange ) ) ); } +namespace { + class CommentEnumeration : public EnumerationHelperImpl { css::uno::Reference< css::frame::XModel > mxModel; @@ -59,6 +61,8 @@ public: }; +} + ScVbaComments::ScVbaComments( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, diff --git a/sc/source/ui/vba/vbafiledialogitems.cxx b/sc/source/ui/vba/vbafiledialogitems.cxx index 66d6ea976b2a..14c7853ee178 100644 --- a/sc/source/ui/vba/vbafiledialogitems.cxx +++ b/sc/source/ui/vba/vbafiledialogitems.cxx @@ -21,6 +21,8 @@ using namespace ::com::sun::star; using namespace ::ooo::vba; +namespace { + class FileDialogItemEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration > { std::vector< OUString > m_sItems; @@ -40,6 +42,8 @@ public: } }; +} + ScVbaFileDialogSelectedItems::ScVbaFileDialogSelectedItems( const css::uno::Reference< ov::XHelperInterface >& xParent ,const css::uno::Reference< css::uno::XComponentContext >& xContext diff --git a/sc/source/ui/vba/vbamenubars.cxx b/sc/source/ui/vba/vbamenubars.cxx index c521cf562920..5e84e72139c0 100644 --- a/sc/source/ui/vba/vbamenubars.cxx +++ b/sc/source/ui/vba/vbamenubars.cxx @@ -15,6 +15,8 @@ using namespace com::sun::star; using namespace ooo::vba; +namespace { + class MenuBarEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration > { uno::Reference< XHelperInterface > m_xParent; @@ -41,6 +43,8 @@ public: } }; +} + ScVbaMenuBars::ScVbaMenuBars( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBars >& xCommandBars ) : MenuBars_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBars( xCommandBars ) { } diff --git a/sc/source/ui/vba/vbamenuitems.cxx b/sc/source/ui/vba/vbamenuitems.cxx index c64fefb9e6a1..fb7271ef3f21 100644 --- a/sc/source/ui/vba/vbamenuitems.cxx +++ b/sc/source/ui/vba/vbamenuitems.cxx @@ -18,6 +18,8 @@ using namespace ooo::vba; typedef ::cppu::WeakImplHelper< container::XEnumeration > MenuEnumeration_BASE; +namespace { + class MenuEnumeration : public MenuEnumeration_BASE { uno::Reference< XHelperInterface > m_xParent; @@ -55,6 +57,8 @@ public: } }; +} + ScVbaMenuItems::ScVbaMenuItems( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBarControls >& xCommandBarControls ) : MenuItems_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBarControls( xCommandBarControls ) { } diff --git a/sc/source/ui/vba/vbamenus.cxx b/sc/source/ui/vba/vbamenus.cxx index 84c001d9adec..f6b33fd89603 100644 --- a/sc/source/ui/vba/vbamenus.cxx +++ b/sc/source/ui/vba/vbamenus.cxx @@ -17,6 +17,8 @@ using namespace ooo::vba; typedef ::cppu::WeakImplHelper< container::XEnumeration > MenuEnumeration_BASE; +namespace { + class MenuEnumeration : public MenuEnumeration_BASE { uno::Reference< XHelperInterface > m_xParent; @@ -49,6 +51,8 @@ public: } }; +} + ScVbaMenus::ScVbaMenus( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBarControls >& xCommandBarControls ) : Menus_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBarControls( xCommandBarControls ) { } diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx index 357067363074..6f2c2c5a255a 100644 --- a/sc/source/ui/vba/vbanames.cxx +++ b/sc/source/ui/vba/vbanames.cxx @@ -37,6 +37,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class NamesEnumeration : public EnumerationHelperImpl { uno::Reference< frame::XModel > m_xModel; @@ -53,6 +55,8 @@ public: }; +} + ScVbaNames::ScVbaNames(const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XNamedRanges >& xNames, diff --git a/sc/source/ui/vba/vbapagebreaks.cxx b/sc/source/ui/vba/vbapagebreaks.cxx index 3da93b39c235..6fafa9ec1420 100644 --- a/sc/source/ui/vba/vbapagebreaks.cxx +++ b/sc/source/ui/vba/vbapagebreaks.cxx @@ -29,6 +29,8 @@ using namespace ::com::sun::star; using namespace ::ooo::vba; +namespace { + class RangePageBreaks : public ::cppu::WeakImplHelper<container::XIndexAccess > { private: @@ -102,6 +104,8 @@ public: } }; +} + /** @TODO Unlike MS Excel this method only considers the pagebreaks that intersect the used range * To become completely compatible the print area has to be considered. As far as I found out this printarea * also considers the position and sizes of shapes and manually inserted page breaks @@ -184,6 +188,8 @@ uno::Any RangePageBreaks::Add( const css::uno::Any& Before ) return uno::makeAny( uno::Reference< excel::XHPageBreak >( new ScVbaHPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) )); } +namespace { + class RangePageBreaksEnumWrapper : public EnumerationHelper_BASE { uno::Reference<container::XIndexAccess > m_xIndexAccess; @@ -203,6 +209,8 @@ public: } }; +} + ScVbaHPageBreaks::ScVbaHPageBreaks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSheetPageBreak >& xSheetPageBreak): diff --git a/sc/source/ui/vba/vbapalette.cxx b/sc/source/ui/vba/vbapalette.cxx index 36b658a2e596..86bbc1031f15 100644 --- a/sc/source/ui/vba/vbapalette.cxx +++ b/sc/source/ui/vba/vbapalette.cxx @@ -51,6 +51,8 @@ static const Color spnDefColorTable8[] = typedef ::cppu::WeakImplHelper< container::XIndexAccess > XIndexAccess_BASE; +namespace { + class DefaultPalette : public XIndexAccess_BASE { public: @@ -81,6 +83,8 @@ public: }; +} + ScVbaPalette::ScVbaPalette( const uno::Reference< frame::XModel >& rxModel ) : m_pShell( excel::getDocShell( rxModel ) ) { diff --git a/sc/source/ui/vba/vbapivottables.cxx b/sc/source/ui/vba/vbapivottables.cxx index 383faf3ee2b9..8dad4b638624 100644 --- a/sc/source/ui/vba/vbapivottables.cxx +++ b/sc/source/ui/vba/vbapivottables.cxx @@ -30,6 +30,8 @@ static uno::Any DataPilotToPivotTable( const uno::Any& aSource, const uno::Refer return uno::makeAny( uno::Reference< excel::XPivotTable > ( new ScVbaPivotTable( xContext, xTable ) ) ); } +namespace { + class PivotTableEnumeration : public EnumerationHelperImpl { public: @@ -43,6 +45,8 @@ public: }; +} + ScVbaPivotTables::ScVbaPivotTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ): ScVbaPivotTables_BASE( xParent, xContext, xIndexAccess ) { } diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 7b049cb1c6ca..6233f5c5aaa0 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -269,6 +269,8 @@ void ScVbaRange::fireChangeEvent() } } +namespace { + class SingleRangeEnumeration : public EnumerationHelper_BASE { uno::Reference< table::XCellRange > m_xRange; @@ -347,6 +349,8 @@ public: }; +} + uno::Reference< container::XEnumeration > SAL_CALL ScVbaRangeAreas::createEnumeration() { @@ -472,6 +476,8 @@ const ScRangeList& ScVbaRange::getScRangeList( const uno::Reference< excel::XRan throw uno::RuntimeException("Cannot obtain VBA range implementation object" ); } +namespace { + class NumFormatHelper { uno::Reference< util::XNumberFormatsSupplier > mxSupplier; @@ -576,9 +582,13 @@ sal_Int32 const m_nCol; sal_Int32 const m_nArea; }; +} + typedef ::cppu::WeakImplHelper< container::XEnumeration > CellsEnumeration_BASE; typedef ::std::vector< CellPos > vCellPos; +namespace { + // #FIXME - QUICK // we could probably could and should modify CellsEnumeration below // to handle rows and columns (but I do this separately for now @@ -661,6 +671,8 @@ public: } }; +} + static const char ISVISIBLE[] = "IsVisible"; static const char EQUALS[] = "="; static const char NOTEQUALS[] = "<>"; @@ -671,6 +683,8 @@ static const char LESSTHANEQUALS[] = "<="; static const char STR_ERRORMESSAGE_APPLIESTOSINGLERANGEONLY[] = "The command you chose cannot be performed with multiple selections.\nSelect a single range and click the command again"; static const char CELLSTYLE[] = "CellStyle"; +namespace { + class CellValueSetter : public ValueSetter { protected: @@ -682,6 +696,8 @@ public: }; +} + CellValueSetter::CellValueSetter( const uno::Any& aValue ): maValue( aValue ) {} void @@ -765,6 +781,8 @@ CellValueSetter::processValue( const uno::Any& aValue, const uno::Reference< tab } +namespace { + class CellValueGetter : public ValueGetter { protected: @@ -777,6 +795,8 @@ public: }; +} + void CellValueGetter::processValue( const uno::Any& aValue ) { @@ -833,6 +853,8 @@ void CellValueGetter::visitNode( sal_Int32 /*x*/, sal_Int32 /*y*/, const uno::Re processValue( aValue ); } +namespace { + class CellFormulaValueSetter : public CellValueSetter { private: @@ -946,8 +968,12 @@ public: }; +} + static const char sNA[] = "#N/A"; +namespace { + class Dim1ArrayValueSetter : public ArrayVisitor { uno::Sequence< uno::Any > aMatrix; @@ -1117,6 +1143,8 @@ public: }; +} + bool ScVbaRange::getCellRangesForAddress( ScRefFlags& rResFlags, const OUString& sAddress, ScDocShell* pDocSh, ScRangeList& rCellRanges, formula::FormulaGrammar::AddressConvention eConv, char cDelimiter ) { diff --git a/sc/source/ui/vba/vbasheetobjects.cxx b/sc/source/ui/vba/vbasheetobjects.cxx index 2d8568526039..672c638c37c1 100644 --- a/sc/source/ui/vba/vbasheetobjects.cxx +++ b/sc/source/ui/vba/vbasheetobjects.cxx @@ -267,6 +267,8 @@ void ScVbaObjectContainer::implOnShapeCreated( const uno::Reference< drawing::XS { } +namespace { + class ScVbaObjectEnumeration : public SimpleEnumerationBase { public: @@ -277,6 +279,8 @@ private: ScVbaObjectContainerRef mxContainer; }; +} + ScVbaObjectEnumeration::ScVbaObjectEnumeration( const ScVbaObjectContainerRef& rxContainer ) : SimpleEnumerationBase( rxContainer.get() ), mxContainer( rxContainer ) @@ -362,6 +366,8 @@ uno::Any SAL_CALL ScVbaGraphicObjectsBase::Add( const uno::Any& rLeft, const uno // Drawing controls +namespace { + class ScVbaControlContainer : public ScVbaObjectContainer { public: @@ -391,6 +397,8 @@ protected: sal_Int16 /* css::form::FormComponentType */ meType; }; +} + ScVbaControlContainer::ScVbaControlContainer( const uno::Reference< XHelperInterface >& rxParent, const uno::Reference< uno::XComponentContext >& rxContext, @@ -475,6 +483,8 @@ void ScVbaControlContainer::implOnShapeCreated( const uno::Reference< drawing::X // Push button +namespace { + class ScVbaButtonContainer : public ScVbaControlContainer { bool mbOptionButtons; @@ -492,6 +502,8 @@ protected: virtual bool implCheckProperties( const uno::Reference< beans::XPropertySet >& rxModelProps ) const override; }; +} + ScVbaButtonContainer::ScVbaButtonContainer( const uno::Reference< XHelperInterface >& rxParent, const uno::Reference< uno::XComponentContext >& rxContext, diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index fd07496d5f1a..34e2e95d54b3 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -62,6 +62,8 @@ typedef ::cppu::WeakImplHelper< container::XEnumerationAccess , css::container::XNameAccess > SelectedSheets_BASE; +namespace { + class SelectedSheetsEnum : public ::cppu::WeakImplHelper< container::XEnumeration > { public: @@ -182,6 +184,8 @@ public: }; +} + ScVbaWindow::ScVbaWindow( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, diff --git a/sc/source/ui/vba/vbawindows.cxx b/sc/source/ui/vba/vbawindows.cxx index 648109031e46..b9b869f60412 100644 --- a/sc/source/ui/vba/vbawindows.cxx +++ b/sc/source/ui/vba/vbawindows.cxx @@ -51,6 +51,9 @@ static uno::Any ComponentToWindow( const uno::Any& aSource, const uno::Reference } typedef std::vector < uno::Reference< sheet::XSpreadsheetDocument > > Components; + +namespace { + // #TODO more or less the same as class in workwindows ( code sharing needed ) class WindowComponentEnumImpl : public EnumerationHelper_BASE { @@ -106,11 +109,15 @@ public: } }; +} + typedef ::cppu::WeakImplHelper< container::XEnumerationAccess , css::container::XIndexAccess , css::container::XNameAccess > WindowsAccessImpl_BASE; +namespace { + class WindowsAccessImpl : public WindowsAccessImpl_BASE { uno::Reference< uno::XComponentContext > m_xContext; @@ -192,6 +199,8 @@ public: }; +} + ScVbaWindows::ScVbaWindows( const uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : ScVbaWindows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess > ( new WindowsAccessImpl( xContext ) ) ) { } diff --git a/sc/source/ui/vba/vbaworkbooks.cxx b/sc/source/ui/vba/vbaworkbooks.cxx index b5a53c772930..61edd810ba9c 100644 --- a/sc/source/ui/vba/vbaworkbooks.cxx +++ b/sc/source/ui/vba/vbaworkbooks.cxx @@ -56,6 +56,8 @@ getWorkbook( const uno::Reference< uno::XComponentContext >& xContext, return uno::Any( uno::Reference< excel::XWorkbook > (pWb) ); } +namespace { + class WorkBookEnumImpl : public EnumerationHelperImpl { public: @@ -70,6 +72,8 @@ public: }; +} + ScVbaWorkbooks::ScVbaWorkbooks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext >& xContext ) : ScVbaWorkbooks_BASE( xParent, xContext, VbaDocumentsBase::EXCEL_DOCUMENT ) { } diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx index d2c6a882658c..5e6e384433c5 100644 --- a/sc/source/ui/vba/vbaworksheets.cxx +++ b/sc/source/ui/vba/vbaworksheets.cxx @@ -49,6 +49,8 @@ typedef std::vector< uno::Reference< sheet::XSpreadsheet > > SheetMap; // #FIXME #TODO the implementation of the Sheets collections sucks, // e.g. there is no support for tracking sheets added/removed from the collection +namespace { + class WorkSheetsEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration > { SheetMap mSheetMap; @@ -155,6 +157,8 @@ public: }; +} + ScVbaWorksheets::ScVbaWorksheets( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xSheets, const uno::Reference< frame::XModel >& xModel ): ScVbaWorksheets_BASE( xParent, xContext, xSheets ), mxModel( xModel ), m_xSheets( uno::Reference< sheet::XSpreadsheets >( xSheets, uno::UNO_QUERY ) ) { } diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index d25183400750..07a61bf4fc64 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -1619,6 +1619,8 @@ static void lcl_MoveToEnd( ScDPSaveDimension& rDim, const OUString& rItemName ) // puts it to the end of the list even if it was in the list before. } +namespace { + struct ScOUStringCollate { CollatorWrapper* const mpCollator; @@ -1631,6 +1633,8 @@ struct ScOUStringCollate } }; +} + void ScDBFunc::DataPilotSort(ScDPObject* pDPObj, long nDimIndex, bool bAscending, const sal_uInt16* pUserListId) { if (!pDPObj) diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index 992e716e0657..74d054f092a0 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -1147,6 +1147,8 @@ namespace sdr { namespace contact { + namespace { + class ObjectContactOfScDrawView final : public ObjectContactOfPageView { private: @@ -1168,6 +1170,8 @@ namespace sdr const basegfx::B2DRange& rB2DRange) const override; }; + } + ObjectContactOfScDrawView::ObjectContactOfScDrawView( const ScDrawView& rScDrawView, SdrPageWindow& rPageWindow, diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index e5b7d9e8756e..f6b63b2186da 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -306,6 +306,8 @@ void ScFilterListBox::SelectHdl() } } +namespace { + // use a System floating window for the above filter listbox class ScFilterFloatingWindow : public FloatingWindow { @@ -315,6 +317,8 @@ public: virtual void dispose() override; }; +} + ScFilterFloatingWindow::ScFilterFloatingWindow( vcl::Window* pParent, WinBits nStyle ) : FloatingWindow( pParent, nStyle|WB_SYSTEMWINDOW ) // make it a system floater {} diff --git a/sc/source/ui/view/scextopt.cxx b/sc/source/ui/view/scextopt.cxx index 167b75d721ab..4f8fa5eae9dc 100644 --- a/sc/source/ui/view/scextopt.cxx +++ b/sc/source/ui/view/scextopt.cxx @@ -50,6 +50,8 @@ ScExtTabSettings::ScExtTabSettings() : { } +namespace { + /** A container for ScExtTabSettings objects. @descr Internally, a std::map with shared pointers to ScExtTabSettings is used. The copy constructor and assignment operator make deep copies of the @@ -76,6 +78,8 @@ private: ScExtTabSettingsMap maMap; }; +} + ScExtTabSettingsCont::ScExtTabSettingsCont() { } diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index 76c330dadc50..8f3e89b2b50a 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -93,6 +93,8 @@ void ScTabViewShell::ConnectObject( const SdrOle2Obj* pObj ) } } +namespace { + class PopupCallback : public cppu::WeakImplHelper<css::awt::XCallback> { ScTabViewShell* m_pViewShell; @@ -134,6 +136,8 @@ public: } }; +} + void ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb ) { // Do not leave the hint message box on top of the object |