summaryrefslogtreecommitdiff
path: root/sw/source/uibase
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-09-15 19:13:19 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-09-17 09:05:38 +0200
commit206b5b2661be37efdff3c6aedb6f248c4636be79 (patch)
treeaf385e5b4725dcfea23988d9113cced8e9ccaf3c /sw/source/uibase
parenta85d3ba1c0de313b60324b9ecfa488bb99d69d06 (diff)
New loplugin:external
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r--sw/source/uibase/app/apphdl.cxx2
-rw-r--r--sw/source/uibase/app/swmodul1.cxx2
-rw-r--r--sw/source/uibase/docvw/AnnotationMenuButton.cxx2
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx4
-rw-r--r--sw/source/uibase/fldui/fldmgr.cxx2
-rw-r--r--sw/source/uibase/misc/glosdoc.cxx2
-rw-r--r--sw/source/uibase/sidebar/PageStylesPanel.cxx4
-rw-r--r--sw/source/uibase/uiview/viewport.cxx4
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx2
-rw-r--r--sw/source/uibase/uno/unomailmerge.cxx2
-rw-r--r--sw/source/uibase/utlui/uitool.cxx6
11 files changed, 17 insertions, 15 deletions
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index cd8b77dd87ae..89a99f79d727 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -208,7 +208,7 @@ void SwModule::StateOther(SfxItemSet &rSet)
}
// start field dialog
-void NewXForms( SfxRequest& rReq ); // implementation: below
+static void NewXForms( SfxRequest& rReq ); // implementation: below
std::shared_ptr<SwMailMergeConfigItem> SwView::EnsureMailMergeConfigItem(const SfxItemSet* pArgs)
{
diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx
index e23635f8485e..d366ba6d0066 100644
--- a/sw/source/uibase/app/swmodul1.cxx
+++ b/sw/source/uibase/app/swmodul1.cxx
@@ -439,7 +439,7 @@ static Color lcl_GetAuthorColor(std::size_t nPos)
}
/// Returns a JSON representation of a redline author.
-boost::property_tree::ptree lcl_AuthorToJson(const OUString& rAuthor, std::size_t nIndex)
+static boost::property_tree::ptree lcl_AuthorToJson(const OUString& rAuthor, std::size_t nIndex)
{
boost::property_tree::ptree aRet;
aRet.put("index", nIndex);
diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.cxx b/sw/source/uibase/docvw/AnnotationMenuButton.cxx
index 6f81e9912c70..1b4a19171f28 100644
--- a/sw/source/uibase/docvw/AnnotationMenuButton.cxx
+++ b/sw/source/uibase/docvw/AnnotationMenuButton.cxx
@@ -36,7 +36,7 @@
namespace sw { namespace annotation {
-Color ColorFromAlphaColor(const sal_uInt8 aTransparency, const Color& aFront, const Color& aBack)
+static Color ColorFromAlphaColor(const sal_uInt8 aTransparency, const Color& aFront, const Color& aBack)
{
return Color(sal_uInt8(aFront.GetRed() * aTransparency / 255.0 + aBack.GetRed() * (1 - aTransparency / 255.0)),
sal_uInt8(aFront.GetGreen() * aTransparency / 255.0 + aBack.GetGreen() * (1 - aTransparency / 255.0)),
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 393b3af5c4ad..c0d838e3a982 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -313,7 +313,7 @@ struct QuickHelpData
#define HIT_PIX 2 /* hit tolerance in pixel */
#define MIN_MOVE 4
-inline bool IsMinMove(const Point &rStartPos, const Point &rLPt)
+static inline bool IsMinMove(const Point &rStartPos, const Point &rLPt)
{
return std::abs(rStartPos.X() - rLPt.X()) > MIN_MOVE ||
std::abs(rStartPos.Y() - rLPt.Y()) > MIN_MOVE;
@@ -325,7 +325,7 @@ inline bool IsMinMove(const Point &rStartPos, const Point &rLPt)
* in selecting, with DrawObjects; at SwgFlys to trigger
* hyperlinks if applicable (Download/NewWindow!)
*/
-inline bool IsDrawObjSelectable( const SwWrtShell& rSh, const Point& rPt )
+static inline bool IsDrawObjSelectable( const SwWrtShell& rSh, const Point& rPt )
{
bool bRet = true;
SdrObject* pObj;
diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx
index 4fe742b92cf6..6a5dc759e14d 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -364,7 +364,7 @@ static SwWrtShell* lcl_GetShell()
return nullptr;
}
-inline sal_uInt16 GetPackCount() { return SAL_N_ELEMENTS(aSwFields); }
+static inline sal_uInt16 GetPackCount() { return SAL_N_ELEMENTS(aSwFields); }
// FieldManager controls inserting and updating of fields
SwFieldMgr::SwFieldMgr(SwWrtShell* pSh ) :
diff --git a/sw/source/uibase/misc/glosdoc.cxx b/sw/source/uibase/misc/glosdoc.cxx
index c0d17e3cc95e..60a9bdcb6aa6 100644
--- a/sw/source/uibase/misc/glosdoc.cxx
+++ b/sw/source/uibase/misc/glosdoc.cxx
@@ -337,7 +337,7 @@ SwGlossaries::SwGlossaries()
}
// set new path and recreate internal array
-OUString lcl_makePath(const std::vector<OUString>& rPaths)
+static OUString lcl_makePath(const std::vector<OUString>& rPaths)
{
std::vector<OUString>::const_iterator aIt(rPaths.begin());
const std::vector<OUString>::const_iterator aEnd(rPaths.end());
diff --git a/sw/source/uibase/sidebar/PageStylesPanel.cxx b/sw/source/uibase/sidebar/PageStylesPanel.cxx
index 94a5d99c46cc..971ba20ae919 100644
--- a/sw/source/uibase/sidebar/PageStylesPanel.cxx
+++ b/sw/source/uibase/sidebar/PageStylesPanel.cxx
@@ -58,7 +58,7 @@ const SvxPageUsage aArr[] =
};
-sal_uInt16 PageUsageToPos_Impl( SvxPageUsage nUsage )
+static sal_uInt16 PageUsageToPos_Impl( SvxPageUsage nUsage )
{
for ( sal_uInt16 i = 0; i < SAL_N_ELEMENTS(aArr); ++i )
if ( aArr[i] == nUsage )
@@ -67,7 +67,7 @@ sal_uInt16 PageUsageToPos_Impl( SvxPageUsage nUsage )
}
-SvxPageUsage PosToPageUsage_Impl( sal_uInt16 nPos )
+static SvxPageUsage PosToPageUsage_Impl( sal_uInt16 nPos )
{
if ( nPos >= SAL_N_ELEMENTS(aArr) )
return SvxPageUsage::NONE;
diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx
index 2896dbd653cd..061ae5dc1bbc 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -50,6 +50,8 @@
#include <comphelper/lok.hxx>
#include <vcl/weld.hxx>
+#include "viewfunc.hxx"
+
// The SetVisArea of the DocShell must not be called from InnerResizePixel.
// But our adjustments must take place.
static bool bProtectDocShellVisArea = false;
@@ -68,7 +70,7 @@ bool SwView::IsDocumentBorder()
SvxZoomType::PAGEWIDTH_NOBORDER == m_pWrtShell->GetViewOptions()->GetZoomType();
}
-inline long GetLeftMargin( SwView const &rView )
+static inline long GetLeftMargin( SwView const &rView )
{
SvxZoomType eType = rView.GetWrtShell().GetViewOptions()->GetZoomType();
long lRet = rView.GetWrtShell().GetAnyCurRect(CurRectType::PagePrt).Left();
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index a823ec0c4705..d996777be209 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -183,7 +183,7 @@ static void lcl_Scale(long& nVal, long nScale)
nVal >>= 8;
}
-void ResizeFrameCols(SwFormatCol& rCol,
+static void ResizeFrameCols(SwFormatCol& rCol,
long nOldWidth,
long nNewWidth,
long nLeftDelta )
diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx
index 2816b6a0aa70..cdbd0ff171d5 100644
--- a/sw/source/uibase/uno/unomailmerge.cxx
+++ b/sw/source/uibase/uno/unomailmerge.cxx
@@ -81,7 +81,7 @@ using namespace SWUnoHelper;
typedef ::utl::SharedUNOComponent< XInterface > SharedComponent;
-osl::Mutex & GetMailMergeMutex()
+static osl::Mutex & GetMailMergeMutex()
{
static osl::Mutex aMutex;
return aMutex;
diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx
index 2bac72c751fc..e2a3276464f1 100644
--- a/sw/source/uibase/utlui/uitool.cxx
+++ b/sw/source/uibase/utlui/uitool.cxx
@@ -179,7 +179,7 @@ void ConvertAttrGenToChar(SfxItemSet& rSet, const SfxItemSet& rOrigSet)
// Fill header footer
-void FillHdFt(SwFrameFormat* pFormat, const SfxItemSet& rSet)
+static void FillHdFt(SwFrameFormat* pFormat, const SfxItemSet& rSet)
{
SwAttrSet aSet(pFormat->GetAttrSet());
aSet.Put(rSet);
@@ -196,7 +196,7 @@ void FillHdFt(SwFrameFormat* pFormat, const SfxItemSet& rSet)
}
/// Convert from UseOnPage to SvxPageUsage.
-SvxPageUsage lcl_convertUseToSvx(UseOnPage nUse)
+static SvxPageUsage lcl_convertUseToSvx(UseOnPage nUse)
{
SvxPageUsage nRet = SvxPageUsage::NONE;
if (nUse & UseOnPage::Left)
@@ -211,7 +211,7 @@ SvxPageUsage lcl_convertUseToSvx(UseOnPage nUse)
}
/// Convert from SvxPageUsage to UseOnPage.
-UseOnPage lcl_convertUseFromSvx(SvxPageUsage nUse)
+static UseOnPage lcl_convertUseFromSvx(SvxPageUsage nUse)
{
UseOnPage nRet = UseOnPage::NONE;
if (nUse == SvxPageUsage::Left)