diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-11-19 16:32:49 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-11-22 12:57:32 +0100 |
commit | f853ec317f6af1b8c65cc5bd758371689c75118d (patch) | |
tree | b86d729bf9a9465ee619ead3b5635efa62a1804e /chart2/source | |
parent | f31d36966bceb90e261cbecd42634bde4448d527 (diff) |
Extend loplugin:external to warn about classes
...following up on 314f15bff08b76bf96acf99141776ef64d2f1355 "Extend
loplugin:external to warn about enums".
Cases where free functions were moved into an unnamed namespace along with a
class, to not break ADL, are in:
filter/source/svg/svgexport.cxx
sc/source/filter/excel/xelink.cxx
sc/source/filter/excel/xilink.cxx
svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
All other free functions mentioning moved classes appear to be harmless and not
give rise to (silent, even) ADL breakage. (One remaining TODO in
compilerplugins/clang/external.cxx is that derived classes are not covered by
computeAffectedTypes, even though they could also be affected by ADL-breakage---
but don't seem to be in any acutal case across the code base.)
For friend declarations using elaborate type specifiers, like
class C1 {};
class C2 { friend class C1; };
* If C2 (but not C1) is moved into an unnamed namespace, the friend declaration
must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see
C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither
qualified nor a template-id and the declaration is a function or an
elaborated-type-specifier, the lookup to determine whether the entity has been
previously declared shall not consider any scopes outside the innermost
enclosing namespace.")
* If C1 (but not C2) is moved into an unnamed namespace, the friend declaration
must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882>
"elaborated-type-specifier friend not looked up in unnamed namespace".
Apart from that, to keep changes simple and mostly mechanical (which should help
avoid regressions), out-of-line definitions of class members have been left in
the enclosing (named) namespace. But explicit specializations of class
templates had to be moved into the unnamed namespace to appease
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of
template from unnamed namespace using unqualified-id in enclosing namespace".
Also, accompanying declarations (of e.g. typedefs or static variables) that
could arguably be moved into the unnamed namespace too have been left alone.
And in some cases, mention of affected types in blacklists in other loplugins
needed to be adapted.
And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which
is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is
not moved into an unnamed namespace (because it is declared in
sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is. GCC warns about
such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler
doesn’t give this warning for types defined in the main .C file, as those are
unlikely to have multiple definitions."
(<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>) The
warned-about classes also don't have multiple definitions in the given test, so
disable the warning when including the .cxx.
Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4
Reviewed-on: https://gerrit.libreoffice.org/83239
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'chart2/source')
27 files changed, 215 insertions, 15 deletions
diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx index 5696d6b5c3f4..73811542998d 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx @@ -106,6 +106,8 @@ struct lcl_Operator } }; +namespace { + struct lcl_AllOperator : public lcl_Operator { explicit lcl_AllOperator( const Reference< XChartData >& xDataToApply ) @@ -365,6 +367,8 @@ struct lcl_DateCategoriesOperator : public lcl_Operator const Sequence< double >& m_rDates; }; +} + ChartDataWrapper::ChartDataWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : m_spChart2ModelContact(spChart2ModelContact) , m_aEventListenerContainer(m_aMutex) diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index 406df92db13a..cb3c49687f82 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -248,6 +248,8 @@ namespace chart namespace wrapper { +namespace { + //PROP_DOCUMENT_LABELS_IN_FIRST_ROW class WrappedDataSourceLabelsInFirstRowProperty : public WrappedProperty { @@ -265,6 +267,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedDataSourceLabelsInFirstRowProperty::WrappedDataSourceLabelsInFirstRowProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("DataSourceLabelsInFirstRow",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -335,6 +339,8 @@ Any WrappedDataSourceLabelsInFirstRowProperty::getPropertyDefault( const Referen return aRet; } +namespace { + //PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN class WrappedDataSourceLabelsInFirstColumnProperty : public WrappedProperty { @@ -352,6 +358,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedDataSourceLabelsInFirstColumnProperty::WrappedDataSourceLabelsInFirstColumnProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("DataSourceLabelsInFirstColumn",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -422,6 +430,8 @@ Any WrappedDataSourceLabelsInFirstColumnProperty::getPropertyDefault( const Refe return aRet; } +namespace { + //PROP_DOCUMENT_HAS_LEGEND class WrappedHasLegendProperty : public WrappedProperty { @@ -438,6 +448,8 @@ private: //member std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; }; +} + WrappedHasLegendProperty::WrappedHasLegendProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("HasLegend",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -495,6 +507,8 @@ Any WrappedHasLegendProperty::getPropertyDefault( const Reference< beans::XPrope return aRet; } +namespace { + //PROP_DOCUMENT_HAS_MAIN_TITLE class WrappedHasMainTitleProperty : public WrappedProperty { @@ -511,6 +525,8 @@ private: //member std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; }; +} + WrappedHasMainTitleProperty::WrappedHasMainTitleProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("HasMainTitle",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -557,6 +573,8 @@ Any WrappedHasMainTitleProperty::getPropertyDefault( const Reference< beans::XPr return aRet; } +namespace { + //PROP_DOCUMENT_HAS_SUB_TITLE class WrappedHasSubTitleProperty : public WrappedProperty { @@ -573,6 +591,8 @@ private: //member std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; }; +} + WrappedHasSubTitleProperty::WrappedHasSubTitleProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("HasSubTitle",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index 3ba2fe5323db..07d48ff4eb9d 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -1096,6 +1096,8 @@ void SAL_CALL DiagramWrapper::removeEventListener( m_aEventListenerContainer.removeInterface( aListener ); } +namespace { + //PROP_DIAGRAM_DATAROW_SOURCE class WrappedDataRowSourceProperty : public WrappedProperty { @@ -1113,6 +1115,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedDataRowSourceProperty::WrappedDataRowSourceProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("DataRowSource",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -1184,6 +1188,8 @@ Any WrappedDataRowSourceProperty::getPropertyDefault( const Reference< beans::XP return aRet; } +namespace { + //PROP_DIAGRAM_STACKED //PROP_DIAGRAM_DEEP //PROP_DIAGRAM_PERCENT_STACKED @@ -1207,6 +1213,8 @@ std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; mutable Any m_aOuterValue; }; +} + WrappedStackingProperty::WrappedStackingProperty(StackMode eStackMode, const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty(OUString(),OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -1285,6 +1293,8 @@ Any WrappedStackingProperty::getPropertyDefault( const Reference< beans::XProper return aRet; } +namespace { + //PROP_DIAGRAM_THREE_D class WrappedDim3DProperty : public WrappedProperty { @@ -1302,6 +1312,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedDim3DProperty::WrappedDim3DProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("Dim3D",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -1345,6 +1357,8 @@ Any WrappedDim3DProperty::getPropertyDefault( const Reference< beans::XPropertyS return aRet; } +namespace { + //PROP_DIAGRAM_VERTICAL class WrappedVerticalProperty : public WrappedProperty { @@ -1362,6 +1376,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedVerticalProperty::WrappedVerticalProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("Vertical",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -1410,6 +1426,8 @@ Any WrappedVerticalProperty::getPropertyDefault( const Reference< beans::XProper return aRet; } +namespace { + //PROP_DIAGRAM_NUMBER_OF_LINES class WrappedNumberOfLinesProperty : public WrappedProperty { @@ -1430,6 +1448,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedNumberOfLinesProperty::WrappedNumberOfLinesProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("NumberOfLines",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -1553,6 +1573,8 @@ Any WrappedNumberOfLinesProperty::getPropertyDefault( const Reference< beans::XP return aRet; } +namespace { + //PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS class WrappedAttributedDataPointsProperty : public WrappedProperty { @@ -1570,6 +1592,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedAttributedDataPointsProperty::WrappedAttributedDataPointsProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("AttributedDataPoints",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -1654,6 +1678,8 @@ Any WrappedAttributedDataPointsProperty::getPropertyDefault( const Reference< be return aRet; } +namespace { + //PROP_DIAGRAM_SOLIDTYPE class WrappedSolidTypeProperty : public WrappedProperty { @@ -1671,6 +1697,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedSolidTypeProperty::WrappedSolidTypeProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty( "SolidType", OUString() ) , m_spChart2ModelContact( spChart2ModelContact ) @@ -1717,6 +1745,8 @@ Any WrappedSolidTypeProperty::getPropertyDefault( const Reference< beans::XPrope return uno::Any( css::chart::ChartSolidType::RECTANGULAR_SOLID ); } +namespace { + class WrappedAutomaticSizeProperty : public WrappedProperty { public: @@ -1729,6 +1759,8 @@ public: virtual css::uno::Any getPropertyDefault( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override; }; +} + WrappedAutomaticSizeProperty::WrappedAutomaticSizeProperty() : WrappedProperty( "AutomaticSize", OUString() ) { @@ -1777,6 +1809,8 @@ Any WrappedAutomaticSizeProperty::getPropertyDefault( const Reference< beans::XP return aRet; } +namespace { + //PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS class WrappedIncludeHiddenCellsProperty : public WrappedProperty { @@ -1790,6 +1824,8 @@ private: //member std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; }; +} + WrappedIncludeHiddenCellsProperty::WrappedIncludeHiddenCellsProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("IncludeHiddenCells","IncludeHiddenCells") , m_spChart2ModelContact( spChart2ModelContact ) diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx index 994dfcd034e4..21da1f1c6ceb 100644 --- a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx @@ -49,6 +49,8 @@ using ::com::sun::star::uno::Sequence; namespace chart { +namespace { + class WrappedLegendAlignmentProperty : public WrappedProperty { public: @@ -62,6 +64,8 @@ protected: virtual Any convertOuterToInnerValue( const Any& rOuterValue ) const override; }; +} + WrappedLegendAlignmentProperty::WrappedLegendAlignmentProperty() : ::chart::WrappedProperty( "Alignment", "AnchorPosition" ) { diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx index 8a30633ac935..20495fc8e7e5 100644 --- a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx @@ -50,6 +50,8 @@ using ::com::sun::star::uno::Sequence; namespace chart { +namespace { + class WrappedTitleStringProperty : public WrappedProperty { public: @@ -63,6 +65,8 @@ protected: Reference< uno::XComponentContext > m_xContext; }; +} + WrappedTitleStringProperty::WrappedTitleStringProperty( const Reference< uno::XComponentContext >& xContext ) : ::chart::WrappedProperty( "String", OUString() ) , m_xContext( xContext ) @@ -101,12 +105,16 @@ Any WrappedTitleStringProperty::getPropertyDefault( const Reference< beans::XPro return uno::Any( OUString() );//default title is an empty String } +namespace { + class WrappedStackedTextProperty : public WrappedProperty { public: WrappedStackedTextProperty(); }; +} + WrappedStackedTextProperty::WrappedStackedTextProperty() : ::chart::WrappedProperty( "StackedText", "StackCharacters" ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx index 8ac56ce8c446..58e89e439b00 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx @@ -35,6 +35,8 @@ namespace chart namespace wrapper { +namespace { + class WrappedAutomaticPositionProperty : public WrappedProperty { public: @@ -45,6 +47,8 @@ public: virtual Any getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const override; }; +} + WrappedAutomaticPositionProperty::WrappedAutomaticPositionProperty() : ::chart::WrappedProperty( "AutomaticPosition" , OUString() ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx index ad349fa0275a..3949037a8a93 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx @@ -34,6 +34,8 @@ namespace chart namespace wrapper { +namespace { + class WrappedAxisAndGridExistenceProperty : public WrappedProperty { public: @@ -53,6 +55,8 @@ private: //member sal_Int32 m_nDimensionIndex; }; +} + void WrappedAxisAndGridExistenceProperties::addWrappedProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList , const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact ) { @@ -190,6 +194,8 @@ Any WrappedAxisAndGridExistenceProperty::getPropertyDefault( const Reference< be return aRet; } +namespace { + class WrappedAxisTitleExistenceProperty : public WrappedProperty { public: @@ -207,6 +213,8 @@ private: //member TitleHelper::eTitleType m_eTitleType; }; +} + void WrappedAxisTitleExistenceProperties::addWrappedProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList , const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact ) { @@ -292,6 +300,8 @@ Any WrappedAxisTitleExistenceProperty::getPropertyDefault( const Reference< bean return aRet; } +namespace { + class WrappedAxisLabelExistenceProperty : public WrappedProperty { public: @@ -310,6 +320,8 @@ private: //member sal_Int32 m_nDimensionIndex; }; +} + void WrappedAxisLabelExistenceProperties::addWrappedProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList , const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx index 6468d64acec8..4d9b77f29eb3 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx @@ -36,6 +36,9 @@ namespace chart namespace wrapper { +namespace +{ + class WrappedDataCaptionProperty : public WrappedSeriesOrDiagramProperty< sal_Int32 > { public: @@ -46,8 +49,6 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; -namespace -{ enum { //data caption properties diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx index 003c3b877514..047ad10740f1 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx @@ -37,6 +37,8 @@ namespace chart namespace wrapper { +namespace { + class WrappedScaleTextProperty : public WrappedProperty { public: @@ -50,6 +52,8 @@ private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; }; +} + WrappedScaleTextProperty::WrappedScaleTextProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : ::chart::WrappedProperty( "ScaleText" , OUString() ) , m_spChart2ModelContact( spChart2ModelContact ) diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx index ae114a30ea64..15645fa0c174 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx @@ -40,6 +40,9 @@ namespace chart namespace wrapper { +namespace +{ + //PROPERTYTYPE is the type of the outer property template< typename PROPERTYTYPE > @@ -167,8 +170,6 @@ public: virtual css::uno::Any convertOuterToInnerValue( const css::uno::Any& rOuterValue ) const override; }; -namespace -{ enum { //spline properties diff --git a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx index 954c61aba2ff..d5508eccef44 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx @@ -168,8 +168,6 @@ void lcl_ConvertRangeToXML( } } -}//anonymous namespace - template< typename PROPERTYTYPE > class WrappedStatisticProperty : public WrappedSeriesOrDiagramProperty< PROPERTYTYPE > { @@ -217,6 +215,8 @@ private: mutable Any m_aOuterValue; }; +}//anonymous namespace + WrappedConstantErrorLowProperty::WrappedConstantErrorLowProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -253,6 +253,8 @@ void WrappedConstantErrorLowProperty::setValueToSeries( const Reference< beans:: } } +namespace { + //PROP_CHART_STATISTIC_CONST_ERROR_HIGH class WrappedConstantErrorHighProperty : public WrappedStatisticProperty< double > { @@ -267,6 +269,8 @@ private: mutable Any m_aOuterValue; }; +} + WrappedConstantErrorHighProperty::WrappedConstantErrorHighProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -303,6 +307,8 @@ void WrappedConstantErrorHighProperty::setValueToSeries( const Reference< beans: } } +namespace { + //PROP_CHART_STATISTIC_MEAN_VALUE class WrappedMeanValueProperty : public WrappedStatisticProperty< bool > { @@ -314,6 +320,8 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; +} + WrappedMeanValueProperty::WrappedMeanValueProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -342,6 +350,8 @@ void WrappedMeanValueProperty::setValueToSeries( const Reference< beans::XProper } } +namespace { + //PROP_CHART_STATISTIC_ERROR_CATEGORY // deprecated, replaced by ErrorBarStyle class WrappedErrorCategoryProperty : public WrappedStatisticProperty< css::chart::ChartErrorCategory > @@ -354,6 +364,8 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; +} + WrappedErrorCategoryProperty::WrappedErrorCategoryProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -437,6 +449,8 @@ void WrappedErrorCategoryProperty::setValueToSeries( const Reference< beans::XPr } } +namespace { + //PROP_CHART_STATISTIC_PERCENT_ERROR class WrappedPercentageErrorProperty : public WrappedStatisticProperty< double > { @@ -451,6 +465,8 @@ private: mutable Any m_aOuterValue; }; +} + WrappedPercentageErrorProperty::WrappedPercentageErrorProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -487,6 +503,8 @@ void WrappedPercentageErrorProperty::setValueToSeries( const Reference< beans::X } } +namespace { + //PROP_CHART_STATISTIC_ERROR_MARGIN class WrappedErrorMarginProperty : public WrappedStatisticProperty< double > { @@ -501,6 +519,8 @@ private: mutable Any m_aOuterValue; }; +} + WrappedErrorMarginProperty::WrappedErrorMarginProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -537,6 +557,8 @@ void WrappedErrorMarginProperty::setValueToSeries( const Reference< beans::XProp } } +namespace { + //PROP_CHART_STATISTIC_ERROR_INDICATOR class WrappedErrorIndicatorProperty : public WrappedStatisticProperty< css::chart::ChartErrorIndicatorType > { @@ -548,6 +570,8 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; +} + WrappedErrorIndicatorProperty::WrappedErrorIndicatorProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -605,6 +629,8 @@ void WrappedErrorIndicatorProperty::setValueToSeries( const Reference< beans::XP } } +namespace { + //PROP_CHART_STATISTIC_ERROR_BAR_STYLE // this is the new constant group that replaces the deprecated enum ChartErrorCategory class WrappedErrorBarStyleProperty : public WrappedStatisticProperty< sal_Int32 > @@ -617,6 +643,8 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; +} + WrappedErrorBarStyleProperty::WrappedErrorBarStyleProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -648,6 +676,8 @@ void WrappedErrorBarStyleProperty::setValueToSeries( const Reference< beans::XPr } } +namespace { + //PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE class WrappedErrorBarRangePositiveProperty : public WrappedStatisticProperty< OUString > { @@ -659,6 +689,8 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; +} + WrappedErrorBarRangePositiveProperty::WrappedErrorBarRangePositiveProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -708,6 +740,8 @@ void WrappedErrorBarRangePositiveProperty::setValueToSeries( const Reference< be } } +namespace { + //PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE class WrappedErrorBarRangeNegativeProperty : public WrappedStatisticProperty< OUString > { @@ -719,6 +753,8 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; +} + WrappedErrorBarRangeNegativeProperty::WrappedErrorBarRangeNegativeProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -768,6 +804,8 @@ void WrappedErrorBarRangeNegativeProperty::setValueToSeries( const Reference< be } } +namespace { + //PROP_CHART_STATISTIC_REGRESSION_CURVES class WrappedRegressionCurvesProperty : public WrappedStatisticProperty< css::chart::ChartRegressionCurveType > { @@ -779,6 +817,8 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; +} + WrappedRegressionCurvesProperty::WrappedRegressionCurvesProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -815,6 +855,8 @@ void WrappedRegressionCurvesProperty::setValueToSeries( const Reference< beans:: } } +namespace { + //PROP_CHART_STATISTIC_REGRESSION_PROPERTIES //PROP_CHART_STATISTIC_ERROR_PROPERTIES //PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES @@ -840,6 +882,8 @@ private: PropertySetType m_eType; }; +} + WrappedStatisticPropertySetProperty::WrappedStatisticPropertySetProperty( PropertySetType ePropertySetType , std::shared_ptr< Chart2ModelContact > spChart2ModelContact diff --git a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx index 9123543d9036..3155a969102f 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx @@ -37,6 +37,8 @@ namespace chart namespace wrapper { +namespace { + class WrappedStockProperty : public WrappedProperty { public: @@ -56,6 +58,8 @@ protected: css::uno::Any m_aDefaultValue; }; +} + WrappedStockProperty::WrappedStockProperty( const OUString& rOuterName , const css::uno::Any& rDefaulValue , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact ) @@ -107,6 +111,8 @@ css::uno::Any WrappedStockProperty::getPropertyDefault( const css::uno::Referenc return m_aDefaultValue; } +namespace { + class WrappedVolumeProperty : public WrappedStockProperty { public: @@ -117,6 +123,8 @@ public: uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( bool bNewValue, const OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const override; }; +} + WrappedVolumeProperty::WrappedVolumeProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedStockProperty( "Volume", uno::Any(false) , spChart2ModelContact ) { @@ -172,6 +180,8 @@ uno::Reference< chart2::XChartTypeTemplate > WrappedVolumeProperty::getNewTempla return xTemplate; } +namespace { + class WrappedUpDownProperty : public WrappedStockProperty { public: @@ -182,6 +192,8 @@ public: uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( bool bNewValue, const OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const override; }; +} + WrappedUpDownProperty::WrappedUpDownProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedStockProperty( "UpDown", uno::Any(false) , spChart2ModelContact ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx index 20f9da101be9..79ed7047331c 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx @@ -43,6 +43,9 @@ namespace chart namespace wrapper { +namespace +{ + class WrappedSymbolTypeProperty : public WrappedSeriesOrDiagramProperty< sal_Int32 > { public: @@ -98,8 +101,6 @@ public: tSeriesOrDiagramPropertyType ePropertyType); }; -namespace -{ enum { //symbol properties diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx index 283357686553..7d5c4670b81c 100644 --- a/chart2/source/controller/dialogs/dlg_DataSource.cxx +++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx @@ -37,6 +37,8 @@ using ::com::sun::star::uno::Reference; namespace chart { +namespace { + class DocumentChartTypeTemplateProvider : public ChartTypeTemplateProvider { public: @@ -50,6 +52,8 @@ private: Reference< chart2::XChartTypeTemplate > m_xTemplate; }; +} + DocumentChartTypeTemplateProvider::DocumentChartTypeTemplateProvider( const Reference< chart2::XChartDocument > & xDoc ) { diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx index 8bb45729b6f4..39000a96949a 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx @@ -57,6 +57,8 @@ void LightButton::switchLightOn(bool bOn) m_xButton->set_from_icon_name(RID_SVXBMP_LAMP_OFF); } +namespace { + struct LightSource { Color nDiffuseColor; @@ -70,6 +72,8 @@ struct LightSource {} }; +} + struct LightSourceInfo { LightButton* pButton; diff --git a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx index 9a5d60ed3afd..bbe54492cbd9 100644 --- a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx @@ -44,8 +44,6 @@ ItemPropertyMapType & lcl_GetTitlePropertyMap() return aTitlePropertyMap; }; -} // anonymous namespace - class FormattedStringsConverter : public MultipleItemConverter { public: @@ -59,6 +57,8 @@ protected: virtual const sal_uInt16 * GetWhichPairs() const override; }; +} // anonymous namespace + FormattedStringsConverter::FormattedStringsConverter( const uno::Sequence< uno::Reference< chart2::XFormattedString > > & aStrings, SfxItemPool & rItemPool, diff --git a/chart2/source/controller/main/ConfigurationAccess.cxx b/chart2/source/controller/main/ConfigurationAccess.cxx index dc1ba9f657a6..2d1dcfcf9b6e 100644 --- a/chart2/source/controller/main/ConfigurationAccess.cxx +++ b/chart2/source/controller/main/ConfigurationAccess.cxx @@ -38,7 +38,6 @@ bool lcl_IsMetric() return ( eSys == MeasurementSystem::Metric ); } -}//end anonymous namespace class CalcConfigItem : public ::utl::ConfigItem { @@ -52,6 +51,8 @@ public: virtual void Notify( const uno::Sequence<OUString>& aPropertyNames) override; }; +}//end anonymous namespace + CalcConfigItem::CalcConfigItem() : ConfigItem( "Office.Calc/Layout" ) { diff --git a/chart2/source/model/main/UndoManager.cxx b/chart2/source/model/main/UndoManager.cxx index 023ab553b345..f295bc288eb2 100644 --- a/chart2/source/model/main/UndoManager.cxx +++ b/chart2/source/model/main/UndoManager.cxx @@ -122,6 +122,8 @@ namespace chart throw DisposedException( OUString(), getThis() ); } + namespace { + /** guard for public UNO methods of the UndoManager The only purpose of this guard is to check for the instance being disposed already. Everything else, @@ -155,6 +157,8 @@ namespace chart virtual void release() override { } }; + } + ::framework::IMutex& UndoManagerMethodGuard::getGuardedMutex() { static DummyMutex s_aDummyMutex; diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index b6652e25f11d..46036e5b9d3f 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -208,6 +208,8 @@ SplitCategoriesProvider::~SplitCategoriesProvider() { } +namespace { + class SplitCategoriesProvider_ForLabeledDataSequences : public SplitCategoriesProvider { public: @@ -230,6 +232,8 @@ private: ChartModel& mrModel; }; +} + sal_Int32 SplitCategoriesProvider_ForLabeledDataSequences::getLevelCount() const { return m_rSplitCategoriesList.getLength(); diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index efb87de74026..7257a6432605 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -230,6 +230,8 @@ static void removeShapesAtWrongRhythm( TickIter& rIter } } +namespace { + /** * If the labels are staggered and bInnerLine is true we iterate through * only those labels that are closer to the diagram. @@ -255,6 +257,8 @@ private: //member bool m_bInnerLine; }; +} + LabelIterator::LabelIterator( TickInfoArrayType& rTickInfoVector , const AxisLabelStaggering eAxisLabelStaggering , bool bInnerLine ) @@ -448,6 +452,8 @@ static void getAxisLabelProperties( rPropValues, rPropNames, rAxisProp.maLabelAlignment.meAlignment); } +namespace { + /** * Iterate through only 3 ticks including the one that has the longest text * length. When the first tick has the longest text, it iterates through @@ -468,6 +474,8 @@ private: size_t m_nCurrentIndex; }; +} + MaxLabelTickIter::MaxLabelTickIter( TickInfoArrayType& rTickInfoVector, size_t nLongestLabelIndex ) : m_rTickInfoVector(rTickInfoVector), m_nCurrentIndex(0) @@ -1152,6 +1160,9 @@ VCartesianAxis::ScreenPosAndLogicPos VCartesianAxis::getScreenPosAndLogicPos( do } typedef std::vector< VCartesianAxis::ScreenPosAndLogicPos > tScreenPosAndLogicPosList; + +namespace { + struct lcl_LessXPos { bool operator() ( const VCartesianAxis::ScreenPosAndLogicPos& rPos1, const VCartesianAxis::ScreenPosAndLogicPos& rPos2 ) @@ -1168,6 +1179,8 @@ struct lcl_GreaterYPos } }; +} + void VCartesianAxis::get2DAxisMainLine( B2DVector& rStart, B2DVector& rEnd, AxisLabelAlignment& rAlignment, double fCrossesOtherAxis ) const { diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx index f8cfe828d0ae..61050a12500f 100644 --- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx @@ -34,6 +34,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Reference; +namespace { + class TextualDataProvider : public ::cppu::WeakImplHelper< css::chart2::data::XTextualDataSequence > @@ -54,6 +56,8 @@ private: //member uno::Sequence< OUString > m_aTextSequence; }; +} + VCartesianCoordinateSystem::VCartesianCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys ) : VCoordinateSystem(xCooSys) { diff --git a/chart2/source/view/axes/VCartesianGrid.cxx b/chart2/source/view/axes/VCartesianGrid.cxx index 45df4131faff..36a143df4545 100644 --- a/chart2/source/view/axes/VCartesianGrid.cxx +++ b/chart2/source/view/axes/VCartesianGrid.cxx @@ -39,6 +39,8 @@ using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; +namespace { + struct GridLinePoints { Sequence< double > P0; @@ -54,6 +56,8 @@ struct GridLinePoints sal_Int32 m_nDimensionIndex; }; +} + GridLinePoints::GridLinePoints( const PlottingPositionHelper* pPosHelper, sal_Int32 nDimensionIndex , CuboidPlanePosition eLeftWallPos , CuboidPlanePosition eBackWallPos diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index e9c54add6c0f..ca2218087a43 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -581,8 +581,6 @@ void lcl_reorderSeries( std::vector< std::vector< VDataSeriesGroup > >& rZSlots rZSlots = std::move(aRet); } -}//anonymous namespace - //better performance for big data struct FormerPoint { @@ -601,6 +599,8 @@ struct FormerPoint double m_fZ; }; +}//anonymous namespace + void AreaChart::createShapes() { if( m_aZSlots.empty() ) //no series diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index 47c137b32ab4..e50fbe36ff74 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -385,6 +385,8 @@ void BarChart::addSeries( std::unique_ptr<VDataSeries> pSeries, sal_Int32 zSlot, VSeriesPlotter::addSeries( std::move(pSeries), zSlot, xSlot, ySlot ); } +namespace { + //better performance for big data struct FormerBarPoint { @@ -405,6 +407,8 @@ struct FormerBarPoint double m_fZ; }; +} + void BarChart::adaptOverlapAndGapwidthForGroupBarsPerAxis() { //adapt m_aOverlapSequence and m_aGapwidthSequence for the groupBarsPerAxis feature diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx index 1a0123f0c094..ef2a75934dfb 100644 --- a/chart2/source/view/charttypes/BubbleChart.cxx +++ b/chart2/source/view/charttypes/BubbleChart.cxx @@ -136,6 +136,8 @@ drawing::Direction3D BubbleChart::getPreferredDiagramAspectRatio() const return drawing::Direction3D(-1,-1,-1); } +namespace { + //better performance for big data struct FormerPoint { @@ -154,6 +156,8 @@ struct FormerPoint double m_fZ; }; +} + void BubbleChart::createShapes() { if( m_aZSlots.empty() ) //no series diff --git a/chart2/source/view/charttypes/ConfigAccess.cxx b/chart2/source/view/charttypes/ConfigAccess.cxx index 2e6e507408b4..964e58ce43f7 100644 --- a/chart2/source/view/charttypes/ConfigAccess.cxx +++ b/chart2/source/view/charttypes/ConfigAccess.cxx @@ -28,6 +28,8 @@ namespace chart { using namespace ::com::sun::star; +namespace +{ class ChartConfigItem : public ::utl::ConfigItem { private: @@ -39,6 +41,7 @@ public: bool getUseErrorRectangle(); virtual void Notify(const uno::Sequence<OUString>& aPropertyNames) override; }; +} ChartConfigItem::ChartConfigItem() : ConfigItem("Office.Chart/ErrorProperties") diff --git a/chart2/source/view/charttypes/NetChart.cxx b/chart2/source/view/charttypes/NetChart.cxx index 823004d2091a..2f99bece1cfc 100644 --- a/chart2/source/view/charttypes/NetChart.cxx +++ b/chart2/source/view/charttypes/NetChart.cxx @@ -293,8 +293,6 @@ void lcl_reorderSeries( std::vector< std::vector< VDataSeriesGroup > >& rZSlots rZSlots = std::move(aRet); } -}//anonymous namespace - //better performance for big data struct FormerPoint { @@ -313,6 +311,8 @@ struct FormerPoint double m_fZ; }; +}//anonymous namespace + void NetChart::createShapes() { if( m_aZSlots.empty() ) //no series |