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 /sw/source/ui/vba | |
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 'sw/source/ui/vba')
26 files changed, 154 insertions, 0 deletions
diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx index ed0a28863f3d..dc0ae39bb33c 100644 --- a/sw/source/ui/vba/vbaapplication.cxx +++ b/sw/source/ui/vba/vbaapplication.cxx @@ -55,6 +55,8 @@ using namespace ::ooo; using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class SwVbaApplicationOutgoingConnectionPoint : public cppu::WeakImplHelper<XConnectionPoint> { private: @@ -131,6 +133,8 @@ public: virtual css::uno::Any SAL_CALL AppCount() override; }; +} + SwVbaApplication::SwVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): SwVbaApplication_BASE( xContext ) { diff --git a/sw/source/ui/vba/vbabookmarks.cxx b/sw/source/ui/vba/vbabookmarks.cxx index ae0eaed5e89a..53c23f85e38d 100644 --- a/sw/source/ui/vba/vbabookmarks.cxx +++ b/sw/source/ui/vba/vbabookmarks.cxx @@ -31,6 +31,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class BookmarksEnumeration : public EnumerationHelperImpl { uno::Reference< frame::XModel > mxModel; @@ -108,6 +110,8 @@ public: } }; +} + SwVbaBookmarks::SwVbaBookmarks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xBookmarks, const uno::Reference< frame::XModel >& xModel ): SwVbaBookmarks_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new BookmarkCollectionHelper( xBookmarks ) ) ), mxModel( xModel ) { mxBookmarksSupplier.set( mxModel, uno::UNO_QUERY_THROW ); diff --git a/sw/source/ui/vba/vbaborders.cxx b/sw/source/ui/vba/vbaborders.cxx index f66b38426f82..aaea6f5c6486 100644 --- a/sw/source/ui/vba/vbaborders.cxx +++ b/sw/source/ui/vba/vbaborders.cxx @@ -41,6 +41,8 @@ static const sal_Int16 supportedIndexTable[] = { word::WdBorderType::wdBorderBot // Equiv widths in 1/100 mm const static sal_Int32 OOLineHairline = 2; +namespace { + class SwVbaBorder : public SwVbaBorder_Base { private: @@ -273,12 +275,16 @@ public: } }; +} + static uno::Reference< container::XIndexAccess > rangeToBorderIndexAccess( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, VbaPalette const & rPalette ) { return new RangeBorders( xRange, xContext, rPalette ); } +namespace { + class RangeBorderEnumWrapper : public EnumerationHelper_BASE { uno::Reference<container::XIndexAccess > m_xIndexAccess; @@ -298,6 +304,8 @@ public: } }; +} + // for Table borders SwVbaBorders::SwVbaBorders( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< table::XCellRange >& xRange, VbaPalette const & rPalette ): SwVbaBorders_BASE( xParent, xContext, rangeToBorderIndexAccess( xRange ,xContext, rPalette ) ) { diff --git a/sw/source/ui/vba/vbacells.cxx b/sw/source/ui/vba/vbacells.cxx index 953abac9148a..e8c5f558e284 100644 --- a/sw/source/ui/vba/vbacells.cxx +++ b/sw/source/ui/vba/vbacells.cxx @@ -26,6 +26,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class CellsEnumWrapper : public EnumerationHelper_BASE { uno::Reference< container::XIndexAccess > mxIndexAccess; @@ -103,6 +105,8 @@ public: } }; +} + SwVbaCells::SwVbaCells( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) : SwVbaCells_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new CellCollectionHelper( xParent, xContext, xTextTable, nLeft, nTop, nRight, nBottom ) ) ), mxTextTable( xTextTable ), mnTop( nTop ), mnBottom( nBottom ) { } diff --git a/sw/source/ui/vba/vbacolumns.cxx b/sw/source/ui/vba/vbacolumns.cxx index 7fda520b6579..04131262046d 100644 --- a/sw/source/ui/vba/vbacolumns.cxx +++ b/sw/source/ui/vba/vbacolumns.cxx @@ -28,6 +28,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class ColumnsEnumWrapper : public EnumerationHelper_BASE { uno::WeakReference< XHelperInterface > mxParent; @@ -56,6 +58,8 @@ public: } }; +} + SwVbaColumns::SwVbaColumns( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableColumns >& xTableColumns ) : SwVbaColumns_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableColumns, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ) { mnStartColumnIndex = 0; diff --git a/sw/source/ui/vba/vbadialog.cxx b/sw/source/ui/vba/vbadialog.cxx index 8ec16e181198..f47eff0e977b 100644 --- a/sw/source/ui/vba/vbadialog.cxx +++ b/sw/source/ui/vba/vbadialog.cxx @@ -22,12 +22,16 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + struct WordDialogTable { sal_Int32 const wdDialog; const sal_Char* ooDialog; }; +} + static const WordDialogTable aWordDialogTable[] = { { word::WdWordDialog::wdDialogFileNew, ".uno:NewDoc" }, diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx index 894bac0aa996..0883afe12374 100644 --- a/sw/source/ui/vba/vbadocument.cxx +++ b/sw/source/ui/vba/vbadocument.cxx @@ -67,6 +67,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class SwVbaDocumentOutgoingConnectionPoint : public cppu::WeakImplHelper<XConnectionPoint> { private: @@ -80,6 +82,8 @@ public: void SAL_CALL Unadvise( sal_uInt32 Cookie ) override; }; +} + SwVbaDocument::SwVbaDocument( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< frame::XModel > const & xModel ): SwVbaDocument_BASE( xParent, xContext, xModel ) { Initialize(); diff --git a/sw/source/ui/vba/vbadocumentproperties.cxx b/sw/source/ui/vba/vbadocumentproperties.cxx index f0d00352bbdd..5d1d570f5356 100644 --- a/sw/source/ui/vba/vbadocumentproperties.cxx +++ b/sw/source/ui/vba/vbadocumentproperties.cxx @@ -61,6 +61,8 @@ static sal_Int8 lcl_toMSOPropType( const uno::Type& aType ) return msoType; } +namespace { + class PropertGetSetHelper { protected: @@ -386,8 +388,12 @@ public: } }; +} + typedef std::unordered_map< sal_Int32, DocPropInfo > MSOIndexToOODocPropInfo; +namespace { + class BuiltInIndexHelper { MSOIndexToOODocPropInfo m_docPropInfoMap; @@ -433,8 +439,12 @@ public: MSOIndexToOODocPropInfo& getDocPropInfoMap() { return m_docPropInfoMap; } }; +} + typedef InheritedHelperInterfaceWeakImpl< ooo::vba::XDocumentProperty > SwVbaDocumentProperty_BASE; +namespace { + class SwVbaBuiltInDocumentProperty : public SwVbaDocumentProperty_BASE { protected: @@ -477,6 +487,8 @@ public: }; +} + SwVbaCustomDocumentProperty::SwVbaCustomDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo ) : SwVbaBuiltInDocumentProperty( xParent, xContext, rInfo ) { } @@ -630,6 +642,8 @@ typedef ::cppu::WeakImplHelper< css::container::XIndexAccess typedef std::unordered_map< sal_Int32, uno::Reference< XDocumentProperty > > DocProps; +namespace { + class DocPropEnumeration : public ::cppu::WeakImplHelper< css::container::XEnumeration > { DocProps mDocProps; @@ -649,8 +663,12 @@ public: } }; +} + typedef std::unordered_map< OUString, uno::Reference< XDocumentProperty > > DocPropsByName; +namespace { + class BuiltInPropertiesImpl : public PropertiesImpl_BASE { protected: @@ -725,6 +743,8 @@ protected: } }; +} + SwVbaBuiltinDocumentProperties::SwVbaBuiltinDocumentProperties( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaDocumentproperties_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new BuiltInPropertiesImpl( xParent, xContext, xModel ) ) ) { } @@ -774,6 +794,8 @@ SwVbaBuiltinDocumentProperties::getServiceNames() return aServiceNames; } +namespace { + class CustomPropertiesImpl : public PropertiesImpl_BASE { uno::Reference< XHelperInterface > m_xParent; @@ -862,6 +884,8 @@ public: }; +} + SwVbaCustomDocumentProperties::SwVbaCustomDocumentProperties( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaBuiltinDocumentProperties( xParent, xContext, xModel ) { // replace the m_xIndexAccess implementation ( we need a virtual init ) diff --git a/sw/source/ui/vba/vbadocuments.cxx b/sw/source/ui/vba/vbadocuments.cxx index 6748dc376fb9..057b25a519ce 100644 --- a/sw/source/ui/vba/vbadocuments.cxx +++ b/sw/source/ui/vba/vbadocuments.cxx @@ -51,6 +51,8 @@ getDocument( uno::Reference< uno::XComponentContext > const & xContext, const un return uno::Any( uno::Reference< word::XDocument > (pWb) ); } +namespace { + class DocumentEnumImpl : public EnumerationHelperImpl { uno::Any const m_aApplication; @@ -65,6 +67,8 @@ public: } }; +} + SwVbaDocuments::SwVbaDocuments( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) : SwVbaDocuments_BASE( xParent, xContext, VbaDocumentsBase::WORD_DOCUMENT ) { } diff --git a/sw/source/ui/vba/vbafield.cxx b/sw/source/ui/vba/vbafield.cxx index 49371d794b05..2c5495cf4224 100644 --- a/sw/source/ui/vba/vbafield.cxx +++ b/sw/source/ui/vba/vbafield.cxx @@ -68,6 +68,8 @@ SwVbaField::getServiceNames() return aServiceNames; } +namespace { + // FIXME? copy and paste code // the codes are copied from ww8par5.cxx class SwVbaReadFieldParams @@ -87,6 +89,8 @@ public: const OUString& GetFieldName()const { return aFieldName; } }; +} + SwVbaReadFieldParams::SwVbaReadFieldParams( const OUString& _rData ) : aData( _rData ), nLen( _rData.getLength() ), nNext( 0 ) { @@ -222,6 +226,8 @@ static uno::Any lcl_createField( const uno::Reference< XHelperInterface >& xPare return uno::makeAny( xField ); } +namespace { + class FieldEnumeration : public ::cppu::WeakImplHelper< css::container::XEnumeration > { uno::Reference< XHelperInterface > mxParent; @@ -298,6 +304,8 @@ public: } }; +} + SwVbaFields::SwVbaFields( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaFields_BASE( xParent, xContext , uno::Reference< container::XIndexAccess >( new FieldCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel ) { mxMSF.set( mxModel, uno::UNO_QUERY_THROW ); @@ -372,12 +380,16 @@ uno::Reference< text::XTextField > SwVbaFields::Create_Field_FileName( const OUS return xTextField; } +namespace { + struct DocPropertyTable { const char* sDocPropertyName; const char* sFieldService; }; +} + static const DocPropertyTable aDocPropertyTables[] = { { "Author", "com.sun.star.text.textfield.docinfo.CreateAuthor" }, diff --git a/sw/source/ui/vba/vbafont.cxx b/sw/source/ui/vba/vbafont.cxx index de61e8696b31..2c0b7ac09e3b 100644 --- a/sw/source/ui/vba/vbafont.cxx +++ b/sw/source/ui/vba/vbafont.cxx @@ -32,12 +32,16 @@ using namespace ::com::sun::star; const uno::Any aLongAnyTrue( sal_Int16(-1) ); const uno::Any aLongAnyFalse( sal_Int16( 0 ) ); +namespace { + struct MapPair { sal_Int32 nMSOConst; sal_Int32 nOOOConst; }; +} + static MapPair const UnderLineTable[] = { { word::WdUnderline::wdUnderlineNone, css::awt::FontUnderline::NONE }, { word::WdUnderline::wdUnderlineSingle, css::awt::FontUnderline::SINGLE }, @@ -60,6 +64,9 @@ static MapPair const UnderLineTable[] = { }; typedef std::unordered_map< sal_Int32, sal_Int32 > ConstToConst; + +namespace { + class UnderLineMapper { ConstToConst MSO2OOO; @@ -103,6 +110,8 @@ public: } }; +} + SwVbaFont::SwVbaFont( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xPalette, uno::Reference< css::beans::XPropertySet > const & xPropertySet ) : SwVbaFont_BASE( xParent, xContext, xPalette, xPropertySet ) { } diff --git a/sw/source/ui/vba/vbaframes.cxx b/sw/source/ui/vba/vbaframes.cxx index 3577bfff624e..f16c028698f2 100644 --- a/sw/source/ui/vba/vbaframes.cxx +++ b/sw/source/ui/vba/vbaframes.cxx @@ -27,6 +27,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class FramesEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration > { private: @@ -55,6 +57,8 @@ public: }; +} + SwVbaFrames::SwVbaFrames( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xFrames, const uno::Reference< frame::XModel >& xModel ): SwVbaFrames_BASE( xParent, xContext, xFrames ), mxModel( xModel ) { mxFramesSupplier.set( mxModel, uno::UNO_QUERY_THROW ); diff --git a/sw/source/ui/vba/vbaheadersfooters.cxx b/sw/source/ui/vba/vbaheadersfooters.cxx index 90fa4cf0fb7b..9eaafac3205c 100644 --- a/sw/source/ui/vba/vbaheadersfooters.cxx +++ b/sw/source/ui/vba/vbaheadersfooters.cxx @@ -24,6 +24,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + // I assume there is only one headersfooters in Writer class HeadersFootersIndexAccess : public ::cppu::WeakImplHelper<container::XIndexAccess > { @@ -78,6 +80,8 @@ public: } }; +} + SwVbaHeadersFooters::SwVbaHeadersFooters( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xPageStyleProps, bool isHeader ): SwVbaHeadersFooters_BASE( xParent, xContext, new HeadersFootersIndexAccess( xParent, xContext, xModel, xPageStyleProps, isHeader ) ), mxModel( xModel ), mxPageStyleProps( xPageStyleProps ), mbHeader( isHeader ) { } diff --git a/sw/source/ui/vba/vbalistgalleries.cxx b/sw/source/ui/vba/vbalistgalleries.cxx index bbe554c3900b..0a4c8084bed0 100644 --- a/sw/source/ui/vba/vbalistgalleries.cxx +++ b/sw/source/ui/vba/vbalistgalleries.cxx @@ -23,6 +23,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class ListGalleriesEnumWrapper : public EnumerationHelper_BASE { SwVbaListGalleries* pListGalleries; @@ -42,6 +44,8 @@ public: } }; +} + SwVbaListGalleries::SwVbaListGalleries( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xTextDoc ) : SwVbaListGalleries_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), mxTextDocument( xTextDoc ) { } diff --git a/sw/source/ui/vba/vbalistlevels.cxx b/sw/source/ui/vba/vbalistlevels.cxx index 7e49e3ab84ba..a83e6fe971dc 100644 --- a/sw/source/ui/vba/vbalistlevels.cxx +++ b/sw/source/ui/vba/vbalistlevels.cxx @@ -23,6 +23,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class ListLevelsEnumWrapper : public EnumerationHelper_BASE { SwVbaListLevels* pListLevels; @@ -42,6 +44,8 @@ public: } }; +} + SwVbaListLevels::SwVbaListLevels( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, SwVbaListHelperRef const & pHelper ) : SwVbaListLevels_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), pListHelper( pHelper ) { } diff --git a/sw/source/ui/vba/vbalisttemplates.cxx b/sw/source/ui/vba/vbalisttemplates.cxx index e4d3416f09a8..ffcef424b938 100644 --- a/sw/source/ui/vba/vbalisttemplates.cxx +++ b/sw/source/ui/vba/vbalisttemplates.cxx @@ -22,6 +22,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class ListTemplatesEnumWrapper : public EnumerationHelper_BASE { SwVbaListTemplates* pListTemplates; @@ -41,6 +43,8 @@ public: } }; +} + SwVbaListTemplates::SwVbaListTemplates( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nType ) : SwVbaListTemplates_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), mxTextDocument( xTextDoc ), mnGalleryType( nType ) { } diff --git a/sw/source/ui/vba/vbapalette.cxx b/sw/source/ui/vba/vbapalette.cxx index fa5dbe0218c7..d86235859b23 100644 --- a/sw/source/ui/vba/vbapalette.cxx +++ b/sw/source/ui/vba/vbapalette.cxx @@ -52,6 +52,8 @@ WdColor::wdColorGray25, // 16 typedef ::cppu::WeakImplHelper< container::XIndexAccess > XIndexAccess_BASE; +namespace { + class DefaultPalette : public XIndexAccess_BASE { public: @@ -82,6 +84,8 @@ public: }; +} + VbaPalette::VbaPalette() { mxPalette = new DefaultPalette(); diff --git a/sw/source/ui/vba/vbapanes.cxx b/sw/source/ui/vba/vbapanes.cxx index 9147111ab36a..a9e4373803f0 100644 --- a/sw/source/ui/vba/vbapanes.cxx +++ b/sw/source/ui/vba/vbapanes.cxx @@ -23,6 +23,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + // I assume there is only one pane in Writer class PanesIndexAccess : public ::cppu::WeakImplHelper<container::XIndexAccess > { @@ -74,6 +76,8 @@ public: } }; +} + SwVbaPanes::SwVbaPanes( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaPanes_BASE( xParent, xContext, new PanesIndexAccess( xParent, xContext, xModel ) ) { } diff --git a/sw/source/ui/vba/vbaparagraph.cxx b/sw/source/ui/vba/vbaparagraph.cxx index 957dd606ff77..b9bfe036be6d 100644 --- a/sw/source/ui/vba/vbaparagraph.cxx +++ b/sw/source/ui/vba/vbaparagraph.cxx @@ -71,6 +71,8 @@ SwVbaParagraph::getServiceNames() return aServiceNames; } +namespace { + class ParagraphCollectionHelper : public ::cppu::WeakImplHelper< container::XIndexAccess, container::XEnumerationAccess > { @@ -133,6 +135,8 @@ public: } }; +} + SwVbaParagraphs::SwVbaParagraphs( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDocument ) : SwVbaParagraphs_BASE( xParent, xContext, new ParagraphCollectionHelper( xDocument ) ), mxTextDocument( xDocument ) { } diff --git a/sw/source/ui/vba/vbarevisions.cxx b/sw/source/ui/vba/vbarevisions.cxx index a24a155484c2..2e022e35a81e 100644 --- a/sw/source/ui/vba/vbarevisions.cxx +++ b/sw/source/ui/vba/vbarevisions.cxx @@ -28,6 +28,8 @@ using namespace ::com::sun::star; typedef std::vector< uno::Reference< beans::XPropertySet > > RevisionMap; +namespace { + class RedlinesEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration > { RevisionMap mRevisionMap; @@ -75,6 +77,8 @@ RevisionCollectionHelper( const uno::Reference< frame::XModel >& xModel, const u } }; +} + RevisionCollectionHelper::RevisionCollectionHelper( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) { uno::Reference< text::XTextRangeCompare > xTRC( xTextRange->getText(), uno::UNO_QUERY_THROW ); @@ -91,6 +95,9 @@ RevisionCollectionHelper::RevisionCollectionHelper( const uno::Reference< frame: } } } + +namespace { + class RevisionsEnumeration : public EnumerationHelperImpl { uno::Reference< frame::XModel > m_xModel; @@ -106,6 +113,8 @@ public: }; +} + SwVbaRevisions::SwVbaRevisions( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ): SwVbaRevisions_BASE( xParent, xContext, new RevisionCollectionHelper( xModel, xTextRange ) ), mxModel( xModel ) { } diff --git a/sw/source/ui/vba/vbarows.cxx b/sw/source/ui/vba/vbarows.cxx index 2ed1d4a4b64c..6159b076a676 100644 --- a/sw/source/ui/vba/vbarows.cxx +++ b/sw/source/ui/vba/vbarows.cxx @@ -31,6 +31,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class RowsEnumWrapper : public EnumerationHelper_BASE { uno::WeakReference< XHelperInterface > mxParent; @@ -59,6 +61,8 @@ public: } }; +} + SwVbaRows::SwVbaRows( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableRows >& xTableRows ) : SwVbaRows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableRows, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableRows( xTableRows ) { mnStartRowIndex = 0; diff --git a/sw/source/ui/vba/vbasections.cxx b/sw/source/ui/vba/vbasections.cxx index 3e57eb65430a..78f4b9c1d296 100644 --- a/sw/source/ui/vba/vbasections.cxx +++ b/sw/source/ui/vba/vbasections.cxx @@ -30,6 +30,8 @@ using namespace ::com::sun::star; typedef std::vector< uno::Reference< beans::XPropertySet > > XSectionVec; +namespace { + class SectionEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration > { XSectionVec mxSections; @@ -132,6 +134,8 @@ public: } }; +} + SwVbaSections::SwVbaSections( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaSections_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new SectionCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel ) { } diff --git a/sw/source/ui/vba/vbastyles.cxx b/sw/source/ui/vba/vbastyles.cxx index 2c262a0f7c99..b3f927a01b5f 100644 --- a/sw/source/ui/vba/vbastyles.cxx +++ b/sw/source/ui/vba/vbastyles.cxx @@ -31,6 +31,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + struct BuiltinStyleTable { sal_Int32 const wdBuiltinStyle; @@ -38,6 +40,8 @@ struct BuiltinStyleTable sal_Int32 const wdStyleType; }; +} + static const BuiltinStyleTable aBuiltinStyleTable[] = { { word::WdBuiltinStyle::wdStyleBlockQuotation, "", word::WdStyleType::wdStyleTypeParagraph }, @@ -146,18 +150,24 @@ static const BuiltinStyleTable aBuiltinStyleTable[] = { 0, nullptr, 0 } }; +namespace { + struct MSOStyleNameTable { const sal_Char* pMSOStyleName; const sal_Char* pOOoStyleName; }; +} + static const MSOStyleNameTable aMSOStyleNameTable[] = { { "Normal", "Default" }, { nullptr, nullptr } }; +namespace { + class StyleCollectionHelper : public ::cppu::WeakImplHelper< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > @@ -264,6 +274,8 @@ public: } }; +} + SwVbaStyles::SwVbaStyles( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaStyles_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new StyleCollectionHelper( xModel ) ) ), mxModel( xModel ) { diff --git a/sw/source/ui/vba/vbatables.cxx b/sw/source/ui/vba/vbatables.cxx index 2efbe29ca4f3..286bb25a8325 100644 --- a/sw/source/ui/vba/vbatables.cxx +++ b/sw/source/ui/vba/vbatables.cxx @@ -61,6 +61,8 @@ static bool lcl_isInHeaderFooter( const uno::Reference< text::XTextTable >& xTab typedef std::vector< uno::Reference< text::XTextTable > > XTextTableVec; +namespace { + class TableCollectionHelper : public ::cppu::WeakImplHelper< container::XIndexAccess, container::XNameAccess > { @@ -154,6 +156,8 @@ public: }; +} + SwVbaTables::SwVbaTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument ) : SwVbaTables_BASE( xParent, xContext , uno::Reference< container::XIndexAccess >( new TableCollectionHelper( xDocument ) ) ), mxDocument( xDocument ) { } diff --git a/sw/source/ui/vba/vbatablesofcontents.cxx b/sw/source/ui/vba/vbatablesofcontents.cxx index ffc9503db46b..c6cc23e6e155 100644 --- a/sw/source/ui/vba/vbatablesofcontents.cxx +++ b/sw/source/ui/vba/vbatablesofcontents.cxx @@ -27,6 +27,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class TablesOfContentsEnumWrapper : public EnumerationHelper_BASE { uno::Reference< container::XIndexAccess > mxIndexAccess; @@ -104,6 +106,8 @@ public: } }; +} + SwVbaTablesOfContents::SwVbaTablesOfContents( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDoc ) : SwVbaTablesOfContents_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new TableOfContentsCollectionHelper( xParent, xContext, xDoc ) ) ), mxTextDocument( xDoc ) { } diff --git a/sw/source/ui/vba/vbatabstops.cxx b/sw/source/ui/vba/vbatabstops.cxx index e0c71c9e94e4..567ee1234a4f 100644 --- a/sw/source/ui/vba/vbatabstops.cxx +++ b/sw/source/ui/vba/vbatabstops.cxx @@ -43,6 +43,8 @@ static void lcl_setTabStops( const uno::Reference< beans::XPropertySet >& xParaP xParaProps->setPropertyValue("ParaTabStops", uno::makeAny( aSeq ) ); } +namespace { + class TabStopsEnumWrapper : public EnumerationHelper_BASE { uno::Reference< container::XIndexAccess > mxIndexAccess; @@ -108,6 +110,8 @@ public: } }; +} + SwVbaTabStops::SwVbaTabStops( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& xParaProps ) : SwVbaTabStops_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new TabStopCollectionHelper( xParent, xContext, xParaProps ) ) ), mxParaProps( xParaProps ) { } |