summaryrefslogtreecommitdiffstats
path: root/vcl/source/app/salvtables.cxx
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 /vcl/source/app/salvtables.cxx
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 'vcl/source/app/salvtables.cxx')
-rw-r--r--vcl/source/app/salvtables.cxx109
1 files changed, 102 insertions, 7 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index e84c989841fa..c55b15367fde 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -235,6 +235,8 @@ SalMenuItem::~SalMenuItem()
class SalInstanceBuilder;
+namespace {
+
class SalInstanceWidget : public virtual weld::Widget
{
protected:
@@ -735,6 +737,8 @@ public:
}
};
+}
+
void SalInstanceWidget::HandleEventListener(VclWindowEvent& rEvent)
{
if (rEvent.GetId() == VclEventId::WindowGetFocus)
@@ -856,6 +860,8 @@ namespace
}
}
+namespace {
+
class SalInstanceMenu : public weld::Menu
{
private:
@@ -927,12 +933,16 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceMenu, SelectMenuHdl, ::Menu*, bool)
{
signal_activate(m_xMenu->GetCurItemIdent());
return true;
}
+namespace {
+
class SalInstanceToolbar : public SalInstanceWidget, public virtual weld::Toolbar
{
private:
@@ -1062,6 +1072,8 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceToolbar, ClickHdl, ToolBox*, void)
{
sal_uInt16 nItemId = m_xToolBox->GetCurItemId();
@@ -1074,6 +1086,8 @@ IMPL_LINK_NOARG(SalInstanceToolbar, DropdownClick, ToolBox*, void)
set_item_active(m_xToolBox->GetItemCommand(nItemId).toUtf8(), true);
}
+namespace {
+
class SalInstanceSizeGroup : public weld::SizeGroup
{
private:
@@ -1156,6 +1170,8 @@ public:
}
};
+}
+
std::unique_ptr<weld::Container> SalInstanceWidget::weld_parent() const
{
vcl::Window* pParent = m_xWidget->GetParent();
@@ -1164,6 +1180,8 @@ std::unique_ptr<weld::Container> SalInstanceWidget::weld_parent() const
return std::make_unique<SalInstanceContainer>(pParent, m_pBuilder, false);
}
+namespace {
+
class SalInstanceBox : public SalInstanceContainer, public virtual weld::Box
{
public:
@@ -1179,8 +1197,6 @@ public:
}
};
-namespace
-{
void CollectChildren(const vcl::Window& rCurrent, const basegfx::B2IPoint& rTopLeft, weld::ScreenShotCollection& rControlDataCollection)
{
if (rCurrent.IsVisible())
@@ -1205,7 +1221,6 @@ namespace
}
}
}
-}
class SalInstanceWindow : public SalInstanceContainer, public virtual weld::Window
{
@@ -1395,6 +1410,8 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceWindow, HelpHdl, vcl::Window&, bool)
{
help();
@@ -1424,7 +1441,6 @@ namespace
}
}
}
-}
class SalInstanceDialog : public SalInstanceWindow, public virtual weld::Dialog
{
@@ -1616,6 +1632,8 @@ public:
};
+}
+
IMPL_LINK(SalInstanceDialog, PopupScreenShotMenuHdl, const CommandEvent&, rCEvt, bool)
{
if (CommandEventId::ContextMenu == rCEvt.GetCommand())
@@ -1657,6 +1675,8 @@ IMPL_LINK(SalInstanceDialog, PopupScreenShotMenuHdl, const CommandEvent&, rCEvt,
return false;
}
+namespace {
+
class SalInstanceMessageDialog : public SalInstanceDialog, public virtual weld::MessageDialog
{
private:
@@ -1929,6 +1949,8 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceAssistant, OnRoadmapItemSelected, LinkParamNone*, void)
{
if (notify_events_disabled())
@@ -1961,6 +1983,8 @@ IMPL_LINK_NOARG(SalInstanceAssistant, UpdateRoadmap_Hdl, Timer*, void)
enable_notify_events();
}
+namespace {
+
class SalInstanceFrame : public SalInstanceContainer, public virtual weld::Frame
{
private:
@@ -2201,6 +2225,8 @@ public:
}
};
+}
+
IMPL_LINK(SalInstanceScrolledWindow, VscrollHdl, ScrollBar*, pScrollBar, void)
{
signal_vadjustment_changed();
@@ -2215,6 +2241,8 @@ IMPL_LINK_NOARG(SalInstanceScrolledWindow, HscrollHdl, ScrollBar*, void)
m_aOrigHScrollHdl.Call(&m_xScrolledWindow->getHorzScrollBar());
}
+namespace {
+
class SalInstanceNotebook : public SalInstanceContainer, public virtual weld::Notebook
{
private:
@@ -2330,6 +2358,8 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceNotebook, DeactivatePageHdl, TabControl*, bool)
{
return !m_aLeavePageHdl.IsSet() || m_aLeavePageHdl.Call(get_current_page_ident());
@@ -2340,6 +2370,8 @@ IMPL_LINK_NOARG(SalInstanceNotebook, ActivatePageHdl, TabControl*, void)
m_aEnterPageHdl.Call(get_current_page_ident());
}
+namespace {
+
class SalInstanceVerticalNotebook : public SalInstanceContainer, public virtual weld::Notebook
{
private:
@@ -2436,6 +2468,8 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceVerticalNotebook, DeactivatePageHdl, VerticalTabControl*, bool)
{
return !m_aLeavePageHdl.IsSet() || m_aLeavePageHdl.Call(get_current_page_ident());
@@ -2446,6 +2480,8 @@ IMPL_LINK_NOARG(SalInstanceVerticalNotebook, ActivatePageHdl, VerticalTabControl
m_aEnterPageHdl.Call(get_current_page_ident());
}
+namespace {
+
class SalInstanceButton : public SalInstanceContainer, public virtual weld::Button
{
private:
@@ -2508,6 +2544,8 @@ public:
}
};
+}
+
IMPL_LINK(SalInstanceButton, ClickHdl, ::Button*, pButton, void)
{
//if there's no handler set, disengage our intercept and
@@ -2547,6 +2585,8 @@ weld::Button* SalInstanceAssistant::weld_widget_for_response(int nResponse)
return nullptr;
}
+namespace {
+
class SalInstanceMenuButton : public SalInstanceButton, public virtual weld::MenuButton
{
private:
@@ -2676,6 +2716,8 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceMenuButton, MenuSelectHdl, ::MenuButton*, void)
{
signal_selected(m_xMenuButton->GetCurItemIdent());
@@ -2688,6 +2730,8 @@ IMPL_LINK_NOARG(SalInstanceMenuButton, ActivateHdl, ::MenuButton*, void)
signal_toggled();
}
+namespace {
+
class SalInstanceLinkButton : public SalInstanceContainer, public virtual weld::LinkButton
{
private:
@@ -2730,6 +2774,8 @@ public:
}
};
+}
+
IMPL_LINK(SalInstanceLinkButton, ClickHdl, FixedHyperlink&, rButton, void)
{
bool bConsumed = signal_activate_link();
@@ -2737,6 +2783,8 @@ IMPL_LINK(SalInstanceLinkButton, ClickHdl, FixedHyperlink&, rButton, void)
m_aOrigClickHdl.Call(rButton);
}
+namespace {
+
class SalInstanceRadioButton : public SalInstanceButton, public virtual weld::RadioButton
{
private:
@@ -2800,6 +2848,8 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceRadioButton, ToggleHdl, ::RadioButton&, void)
{
if (notify_events_disabled())
@@ -2807,6 +2857,8 @@ IMPL_LINK_NOARG(SalInstanceRadioButton, ToggleHdl, ::RadioButton&, void)
signal_toggled();
}
+namespace {
+
class SalInstanceToggleButton : public SalInstanceButton, public virtual weld::ToggleButton
{
private:
@@ -2859,6 +2911,8 @@ public:
}
};
+}
+
IMPL_LINK(SalInstanceToggleButton, ToggleListener, VclWindowEvent&, rEvent, void)
{
if (notify_events_disabled())
@@ -2867,6 +2921,8 @@ IMPL_LINK(SalInstanceToggleButton, ToggleListener, VclWindowEvent&, rEvent, void
signal_toggled();
}
+namespace {
+
class SalInstanceCheckButton : public SalInstanceButton, public virtual weld::CheckButton
{
private:
@@ -2913,6 +2969,8 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceCheckButton, ToggleHdl, CheckBox&, void)
{
if (notify_events_disabled())
@@ -2921,6 +2979,8 @@ IMPL_LINK_NOARG(SalInstanceCheckButton, ToggleHdl, CheckBox&, void)
signal_toggled();
}
+namespace {
+
class SalInstanceScale : public SalInstanceWidget, public virtual weld::Scale
{
private:
@@ -2957,11 +3017,15 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceScale, SlideHdl, Slider*, void)
{
signal_value_changed();
}
+namespace {
+
class SalInstanceSpinner : public SalInstanceWidget, public virtual weld::Spinner
{
private:
@@ -3075,6 +3139,8 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceCalendar, SelectHdl, ::Calendar*, void)
{
if (notify_events_disabled())
@@ -3113,7 +3179,6 @@ namespace
return sText;
}
};
-}
class SalInstanceEntry : public SalInstanceWidget, public virtual weld::Entry
{
@@ -3282,6 +3347,8 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceEntry, ChangeHdl, Edit&, void)
{
signal_changed();
@@ -3300,6 +3367,8 @@ IMPL_LINK_NOARG(SalInstanceEntry, ActivateHdl, Edit&, bool)
return m_aActivateHdl.Call(*this);
}
+namespace {
+
struct SalInstanceTreeIter : public weld::TreeIter
{
SalInstanceTreeIter(const SalInstanceTreeIter* pOrig)
@@ -3317,8 +3386,6 @@ struct SalInstanceTreeIter : public weld::TreeIter
SvTreeListEntry* iter;
};
-namespace
-{
TriState get_toggle(SvTreeListEntry* pEntry, int col)
{
++col; //skip dummy/expander column
@@ -4939,6 +5006,8 @@ IMPL_LINK_NOARG(SalInstanceIconView, DoubleClickHdl, SvTreeListBox*, bool)
return !signal_item_activated();
}
+namespace {
+
class SalInstanceSpinButton : public SalInstanceEntry, public virtual weld::SpinButton
{
private:
@@ -5046,6 +5115,8 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceSpinButton, ActivateHdl, Edit&, bool)
{
// tdf#122348 return pressed to end dialog
@@ -5077,6 +5148,8 @@ IMPL_LINK(SalInstanceSpinButton, InputHdl, sal_Int64*, pResult, TriState)
return eRet;
}
+namespace {
+
class SalInstanceFormattedSpinButton : public SalInstanceEntry, public virtual weld::FormattedSpinButton
{
private:
@@ -5181,6 +5254,8 @@ public:
}
};
+}
+
std::unique_ptr<weld::Label> SalInstanceFrame::weld_label_widget() const
{
FixedText* pLabel = dynamic_cast<FixedText*>(m_xFrame->get_label_widget());
@@ -5189,6 +5264,8 @@ std::unique_ptr<weld::Label> SalInstanceFrame::weld_label_widget() const
return std::make_unique<SalInstanceLabel>(pLabel, m_pBuilder, false);
}
+namespace {
+
class SalInstanceTextView : public SalInstanceContainer, public virtual weld::TextView
{
private:
@@ -5312,6 +5389,8 @@ public:
}
};
+}
+
IMPL_LINK(SalInstanceTextView, VscrollHdl, ScrollBar*, pScrollBar, void)
{
signal_vadjustment_changed();
@@ -5331,6 +5410,8 @@ IMPL_LINK(SalInstanceTextView, CursorListener, VclWindowEvent&, rEvent, void)
signal_cursor_position();
}
+namespace {
+
class SalInstanceExpander : public SalInstanceContainer, public virtual weld::Expander
{
private:
@@ -5362,11 +5443,15 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceExpander, ExpandedHdl, VclExpander&, void)
{
signal_expanded();
}
+namespace {
+
class SalInstanceDrawingArea : public SalInstanceWidget, public virtual weld::DrawingArea
{
private:
@@ -5522,6 +5607,8 @@ public:
}
};
+}
+
IMPL_LINK(SalInstanceDrawingArea, PaintHdl, target_and_area, aPayload, void)
{
m_aDrawHdl.Call(aPayload);
@@ -5575,6 +5662,8 @@ IMPL_LINK(SalInstanceDrawingArea, QueryTooltipHdl, tools::Rectangle&, rHelpArea,
return m_aQueryTooltipHdl.Call(rHelpArea);
}
+namespace {
+
//ComboBox and ListBox have similar apis, ComboBoxes in LibreOffice have an edit box and ListBoxes
//don't. This distinction isn't there in Gtk. Use a template to sort this problem out.
template <class vcl_type>
@@ -5831,11 +5920,15 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceComboBoxWithoutEdit, SelectHdl, ListBox&, void)
{
return signal_changed();
}
+namespace {
+
class SalInstanceComboBoxWithEdit : public SalInstanceComboBox<ComboBox>
{
private:
@@ -5941,6 +6034,8 @@ public:
}
};
+}
+
IMPL_LINK_NOARG(SalInstanceComboBoxWithEdit, ChangeHdl, Edit&, void)
{
signal_changed();