summaryrefslogtreecommitdiffstats
path: root/svx/source/tbxctrls
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-11-19 16:32:49 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-11-22 12:57:32 +0100
commitf853ec317f6af1b8c65cc5bd758371689c75118d (patch)
treeb86d729bf9a9465ee619ead3b5635efa62a1804e /svx/source/tbxctrls
parenttdf#124513 let wizard reappear on tabbing back to document (diff)
downloadcore-f853ec317f6af1b8c65cc5bd758371689c75118d.tar.gz
core-f853ec317f6af1b8c65cc5bd758371689c75118d.zip
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 'svx/source/tbxctrls')
-rw-r--r--svx/source/tbxctrls/bulletsnumbering.cxx4
-rw-r--r--svx/source/tbxctrls/colrctrl.cxx3
-rw-r--r--svx/source/tbxctrls/fontworkgallery.cxx14
-rw-r--r--svx/source/tbxctrls/grafctrl.cxx16
-rw-r--r--svx/source/tbxctrls/layctrl.cxx7
-rw-r--r--svx/source/tbxctrls/linectrl.cxx8
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx20
7 files changed, 70 insertions, 2 deletions
diff --git a/svx/source/tbxctrls/bulletsnumbering.cxx b/svx/source/tbxctrls/bulletsnumbering.cxx
index 443b29ebdc20..9ec03e787958 100644
--- a/svx/source/tbxctrls/bulletsnumbering.cxx
+++ b/svx/source/tbxctrls/bulletsnumbering.cxx
@@ -22,6 +22,8 @@
#include <vcl/toolbox.hxx>
#include <vcl/settings.hxx>
+namespace {
+
class NumberingToolBoxControl;
class NumberingPopup : public svtools::ToolbarMenu
@@ -59,6 +61,8 @@ public:
using svt::ToolboxController::createPopupWindow;
};
+}
+
//class NumberingPopup
NumberingPopup::NumberingPopup( NumberingToolBoxControl& rController,
vcl::Window* pParent, NumberingPageType ePageType ) :
diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx
index 329931809c3a..65af6c136503 100644
--- a/svx/source/tbxctrls/colrctrl.cxx
+++ b/svx/source/tbxctrls/colrctrl.cxx
@@ -49,6 +49,7 @@
using namespace com::sun::star;
+namespace {
class SvxColorValueSetData : public TransferableHelper
{
@@ -68,6 +69,8 @@ public:
{}
};
+}
+
void SvxColorValueSetData::AddSupportedFormats()
{
AddFormat( SotClipboardFormatId::XFA );
diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index 1b2483f11e4e..3d22213ca065 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -263,6 +263,8 @@ IMPL_LINK_NOARG(FontWorkGalleryDialog, DoubleClickFavoriteHdl, SvtValueSet*, voi
m_xDialog->response(RET_OK);
}
+namespace {
+
class FontworkAlignmentWindow : public ToolbarMenu
{
public:
@@ -278,6 +280,8 @@ private:
void implSetAlignment( int nAlignmentMode, bool bEnabled );
};
+}
+
static const OUStringLiteral gsFontworkAlignment(".uno:FontworkAlignment");
FontworkAlignmentWindow::FontworkAlignmentWindow(svt::ToolboxController& rController, vcl::Window* pParentWindow)
@@ -348,6 +352,8 @@ IMPL_LINK_NOARG(FontworkAlignmentWindow, SelectHdl, ToolbarMenu*, void)
}
}
+namespace {
+
class FontworkAlignmentControl : public svt::PopupWindowController
{
public:
@@ -365,6 +371,7 @@ public:
using svt::PopupWindowController::createPopupWindow;
};
+}
FontworkAlignmentControl::FontworkAlignmentControl( const Reference< XComponentContext >& rxContext )
: svt::PopupWindowController( rxContext, Reference< css::frame::XFrame >(), ".uno:FontworkAlignment" )
@@ -412,6 +419,7 @@ com_sun_star_comp_svx_FontworkAlignmentControl_get_implementation(
return cppu::acquire(new FontworkAlignmentControl(xContext));
}
+namespace {
class FontworkCharacterSpacingWindow : public ToolbarMenu
{
@@ -428,6 +436,9 @@ private:
void implSetKernCharacterPairs( bool bEnabled );
};
+
+}
+
static const OUStringLiteral gsFontworkCharacterSpacing(".uno:FontworkCharacterSpacing");
static const OUStringLiteral gsFontworkKernCharacterPairs(".uno:FontworkKernCharacterPairs");
@@ -561,6 +572,8 @@ IMPL_LINK_NOARG(FontworkCharacterSpacingWindow, SelectHdl,ToolbarMenu*, void)
}
}
+namespace {
+
class FontworkCharacterSpacingControl : public svt::PopupWindowController
{
public:
@@ -578,6 +591,7 @@ public:
using svt::PopupWindowController::createPopupWindow;
};
+}
FontworkCharacterSpacingControl::FontworkCharacterSpacingControl( const Reference< XComponentContext >& rxContext )
: svt::PopupWindowController( rxContext, Reference< css::frame::XFrame >(), ".uno:FontworkCharacterSpacingFloater" )
diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx
index dee443327e08..a3095c8409c8 100644
--- a/svx/source/tbxctrls/grafctrl.cxx
+++ b/svx/source/tbxctrls/grafctrl.cxx
@@ -73,6 +73,8 @@ using namespace ::com::sun::star::lang;
#define TOOLBOX_NAME "colorbar"
#define RID_SVXSTR_UNDO_GRAFCROP RID_SVXSTR_GRAFCROP
+namespace {
+
class ImplGrafMetricField : public MetricField
{
using Window::Update;
@@ -94,6 +96,8 @@ public:
void Update( const SfxPoolItem* pItem );
};
+}
+
ImplGrafMetricField::ImplGrafMetricField( vcl::Window* pParent, const OUString& rCmd, const Reference< XFrame >& rFrame ) :
MetricField( pParent, WB_BORDER | WB_SPIN | WB_REPEAT | WB_3DLOOK ),
maCommand( rCmd ),
@@ -184,12 +188,16 @@ void ImplGrafMetricField::Update( const SfxPoolItem* pItem )
SetText( OUString() );
}
+namespace {
+
struct CommandToRID
{
const char* pCommand;
const char* sResId;
};
+}
+
static OUString ImplGetRID( const OUString& aCommand )
{
static const CommandToRID aImplCommandToResMap[] =
@@ -220,6 +228,8 @@ static OUString ImplGetRID( const OUString& aCommand )
return sRID;
}
+namespace {
+
class ImplGrafControl : public Control
{
using Window::Update;
@@ -242,6 +252,8 @@ public:
virtual void Resize() override;
};
+}
+
ImplGrafControl::ImplGrafControl(
vcl::Window* pParent,
const OUString& rCmd,
@@ -315,6 +327,8 @@ void ImplGrafControl::Resize()
Control::Resize();
}
+namespace {
+
class ImplGrafModeControl : public ListBox
{
using Window::Update;
@@ -333,6 +347,8 @@ public:
void Update( const SfxPoolItem* pItem );
};
+}
+
ImplGrafModeControl::ImplGrafModeControl( vcl::Window* pParent, const Reference< XFrame >& rFrame ) :
ListBox( pParent, WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL ),
mnCurPos( 0 ),
diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx
index 5e995a8f4833..14289e2fd704 100644
--- a/svx/source/tbxctrls/layctrl.cxx
+++ b/svx/source/tbxctrls/layctrl.cxx
@@ -47,6 +47,8 @@ using namespace ::com::sun::star::frame;
SFX_IMPL_TOOLBOX_CONTROL(SvxTableToolBoxControl,SfxUInt16Item);
SFX_IMPL_TOOLBOX_CONTROL(SvxColumnsToolBoxControl,SfxUInt16Item);
+namespace {
+
class TableWindow : public SfxPopupWindow
{
private:
@@ -93,6 +95,8 @@ private:
void CloseAndShowTableDialog();
};
+}
+
const long TableWindow::TABLE_CELLS_HORIZ = 10;
const long TableWindow::TABLE_CELLS_VERT = 15;
@@ -401,6 +405,8 @@ bool TableWindow::EventNotify( NotifyEvent& rNEvt )
return SfxPopupWindow::EventNotify( rNEvt );
}
+namespace {
+
class ColumnsWindow : public SfxPopupWindow
{
private:
@@ -431,6 +437,7 @@ public:
virtual void PopupModeEnd() override;
};
+}
ColumnsWindow::ColumnsWindow( sal_uInt16 nId, vcl::Window* pParent, const OUString& rCmd,
const OUString& rText, const Reference< XFrame >& rFrame ) :
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index 0704b88006dc..545c58eda1d1 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -244,6 +244,8 @@ VclPtr<vcl::Window> SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *p
return VclPtr<SvxMetricField>::Create( pParent, m_xFrame ).get();
}
+namespace {
+
class SvxLineEndWindow : public svtools::ToolbarPopup
{
private:
@@ -267,6 +269,8 @@ public:
virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
};
+}
+
static constexpr sal_uInt16 gnCols = 2;
SvxLineEndWindow::SvxLineEndWindow( svt::ToolboxController& rController, vcl::Window* pParentWindow )
@@ -458,6 +462,8 @@ void SvxLineEndWindow::GetFocus()
}
}
+namespace {
+
class SvxLineEndToolBoxControl : public svt::PopupWindowController
{
public:
@@ -475,6 +481,8 @@ private:
using svt::ToolboxController::createPopupWindow;
};
+}
+
SvxLineEndToolBoxControl::SvxLineEndToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext )
: svt::PopupWindowController( rContext, nullptr, OUString() )
{
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index dfb3bbd13c7a..e864878bf6e1 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -191,6 +191,8 @@ private:
DECL_STATIC_LINK(SvxStyleBox_Impl, ShowMoreHdl, void*, void);
};
+namespace {
+
class SvxFontNameBox_Impl : public FontNameBox
{
using Window::Update;
@@ -259,12 +261,16 @@ public:
};
+}
+
void SvxFrmValueSet_Impl::MouseButtonUp( const MouseEvent& rMEvt )
{
nModifier = rMEvt.GetModifier();
ValueSet::MouseButtonUp(rMEvt);
}
+namespace {
+
class SvxFrameWindow_Impl : public svtools::ToolbarPopup
{
private:
@@ -290,8 +296,6 @@ public:
virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
};
-namespace
-{
class LineListBox final : public ListBox
{
public:
@@ -606,6 +610,8 @@ namespace
}
}
+namespace {
+
class SvxLineWindow_Impl : public svtools::ToolbarPopup
{
private:
@@ -645,6 +651,8 @@ public:
virtual void dispose() override;
};
+}
+
class SvxStyleToolBoxControl;
class SfxStyleControllerItem_Impl : public SfxStatusListener
@@ -3303,6 +3311,8 @@ VclPtr<vcl::Window> SvxStyleToolBoxControl::CreateItemWindow( vcl::Window *pPare
return pBox.get();
}
+namespace {
+
class SvxFontNameToolBoxControl : public cppu::ImplInheritanceHelper< svt::ToolboxController,
css::lang::XServiceInfo >
{
@@ -3327,6 +3337,8 @@ private:
VclPtr<SvxFontNameBox_Impl> m_pBox;
};
+}
+
SvxFontNameToolBoxControl::SvxFontNameToolBoxControl()
{
}
@@ -3635,6 +3647,8 @@ com_sun_star_comp_svx_ColorToolBoxControl_get_implementation(
// class SvxFrameToolBoxControl --------------------------------------------
+namespace {
+
class SvxFrameToolBoxControl : public svt::PopupWindowController
{
public:
@@ -3652,6 +3666,8 @@ private:
using svt::ToolboxController::createPopupWindow;
};
+}
+
SvxFrameToolBoxControl::SvxFrameToolBoxControl( const css::uno::Reference< css::uno::XComponentContext >& rContext )
: svt::PopupWindowController( rContext, nullptr, OUString() )
{