summaryrefslogtreecommitdiff
path: root/sw/source/core
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 /sw/source/core
parentf31d36966bceb90e261cbecd42634bde4448d527 (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/core')
-rw-r--r--sw/source/core/access/accmap.cxx24
-rw-r--r--sw/source/core/access/accpara.cxx8
-rw-r--r--sw/source/core/access/acctable.cxx12
-rw-r--r--sw/source/core/crsr/DateFormFieldButton.cxx3
-rw-r--r--sw/source/core/crsr/DropDownFormFieldButton.cxx3
-rw-r--r--sw/source/core/crsr/crsrsh.cxx4
-rw-r--r--sw/source/core/crsr/findattr.cxx8
-rw-r--r--sw/source/core/crsr/findcoll.cxx4
-rw-r--r--sw/source/core/crsr/findtxt.cxx8
-rw-r--r--sw/source/core/crsr/swcrsr.cxx4
-rw-r--r--sw/source/core/doc/doc.cxx4
-rw-r--r--sw/source/core/doc/docbm.cxx4
-rw-r--r--sw/source/core/doc/doccomp.cxx9
-rw-r--r--sw/source/core/doc/docedt.cxx4
-rw-r--r--sw/source/core/doc/doctxm.cxx4
-rw-r--r--sw/source/core/doc/gctable.cxx4
-rw-r--r--sw/source/core/doc/htmltbl.cxx4
-rw-r--r--sw/source/core/doc/number.cxx8
-rw-r--r--sw/source/core/doc/swstylemanager.cxx8
-rw-r--r--sw/source/core/doc/tblrwcl.cxx16
-rw-r--r--sw/source/core/docnode/ndcopy.cxx7
-rw-r--r--sw/source/core/docnode/ndtbl.cxx16
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx8
-rw-r--r--sw/source/core/docnode/nodes.cxx4
-rw-r--r--sw/source/core/docnode/section.cxx3
-rw-r--r--sw/source/core/docnode/swthreadmanager.cxx4
-rw-r--r--sw/source/core/draw/dcontact.cxx4
-rw-r--r--sw/source/core/draw/dflyobj.cxx12
-rw-r--r--sw/source/core/draw/dview.cxx4
-rw-r--r--sw/source/core/edit/acorrect.cxx4
-rw-r--r--sw/source/core/edit/edlingu.cxx8
-rw-r--r--sw/source/core/fields/ddefld.cxx4
-rw-r--r--sw/source/core/fields/reffld.cxx4
-rw-r--r--sw/source/core/frmedt/fetab.cxx4
-rw-r--r--sw/source/core/frmedt/tblsel.cxx7
-rw-r--r--sw/source/core/layout/anchoreddrawobject.cxx8
-rw-r--r--sw/source/core/layout/dbg_lay.cxx4
-rw-r--r--sw/source/core/layout/flycnt.cxx8
-rw-r--r--sw/source/core/layout/frmtool.cxx4
-rw-r--r--sw/source/core/layout/laycache.cxx4
-rw-r--r--sw/source/core/layout/objectformattertxtfrm.cxx4
-rw-r--r--sw/source/core/layout/paintfrm.cxx44
-rw-r--r--sw/source/core/layout/sectfrm.cxx4
-rw-r--r--sw/source/core/layout/sortedobjs.cxx3
-rw-r--r--sw/source/core/layout/trvlfrm.cxx4
-rw-r--r--sw/source/core/ole/ndole.cxx4
-rw-r--r--sw/source/core/swg/SwXMLBlockImport.cxx4
-rw-r--r--sw/source/core/swg/SwXMLSectionList.cxx3
-rw-r--r--sw/source/core/table/swnewtable.cxx4
-rw-r--r--sw/source/core/text/frmcrsr.cxx4
-rw-r--r--sw/source/core/text/frmform.cxx5
-rw-r--r--sw/source/core/text/frmpaint.cxx4
-rw-r--r--sw/source/core/text/itratr.cxx8
-rw-r--r--sw/source/core/text/itrform2.cxx4
-rw-r--r--sw/source/core/text/porfld.cxx4
-rw-r--r--sw/source/core/text/pormulti.cxx7
-rw-r--r--sw/source/core/text/txtdrop.cxx4
-rw-r--r--sw/source/core/text/txtftn.cxx4
-rw-r--r--sw/source/core/text/xmldump.cxx4
-rw-r--r--sw/source/core/txtnode/SwGrammarContact.cxx4
-rw-r--r--sw/source/core/txtnode/fmtatr2.cxx4
-rw-r--r--sw/source/core/txtnode/fntcache.cxx4
-rw-r--r--sw/source/core/txtnode/fntcap.cxx24
-rw-r--r--sw/source/core/txtnode/modeltoviewhelper.cxx8
-rw-r--r--sw/source/core/txtnode/thints.cxx4
-rw-r--r--sw/source/core/undo/docundo.cxx4
-rw-r--r--sw/source/core/undo/undobj.cxx4
-rw-r--r--sw/source/core/undo/unsect.cxx4
-rw-r--r--sw/source/core/undo/untbl.cxx18
-rw-r--r--sw/source/core/unocore/unocoll.cxx12
-rw-r--r--sw/source/core/unocore/unofield.cxx8
-rw-r--r--sw/source/core/unocore/unoframe.cxx12
-rw-r--r--sw/source/core/unocore/unoidx.cxx12
-rw-r--r--sw/source/core/unocore/unoobj2.cxx15
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx3
-rw-r--r--sw/source/core/unocore/unoportenum.cxx8
-rw-r--r--sw/source/core/unocore/unorefmk.cxx8
-rw-r--r--sw/source/core/unocore/unosect.cxx4
-rw-r--r--sw/source/core/unocore/unostyle.cxx18
-rw-r--r--sw/source/core/unocore/unotbl.cxx4
-rw-r--r--sw/source/core/unocore/unotext.cxx4
-rw-r--r--sw/source/core/view/pagepreviewlayout.cxx8
-rw-r--r--sw/source/core/view/vprint.cxx4
83 files changed, 566 insertions, 18 deletions
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 3a35b5c03e26..df641292b4f0 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -81,6 +81,8 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
using namespace ::sw::access;
+namespace {
+
struct SwFrameFunc
{
bool operator()( const SwFrame * p1, const SwFrame * p2) const
@@ -89,6 +91,8 @@ struct SwFrameFunc
}
};
+}
+
class SwAccessibleContextMap_Impl
{
public:
@@ -122,6 +126,8 @@ public:
iterator erase(const_iterator const & pos) { return maMap.erase(pos); }
};
+namespace {
+
class SwDrawModellListener_Impl : public SfxListener,
public ::cppu::WeakImplHelper< document::XShapeEventBroadcaster >
{
@@ -146,6 +152,8 @@ public:
void Dispose();
};
+}
+
SwDrawModellListener_Impl::SwDrawModellListener_Impl( SdrModel *pDrawModel ) :
maEventListeners( maListenerMutex ),
mpDrawModel( pDrawModel )
@@ -252,6 +260,8 @@ void SwDrawModellListener_Impl::Dispose()
mpDrawModel = nullptr;
}
+namespace {
+
struct SwShapeFunc
{
bool operator()( const SdrObject * p1, const SdrObject * p2) const
@@ -259,6 +269,9 @@ struct SwShapeFunc
return p1 < p2;
}
};
+
+}
+
typedef std::pair < const SdrObject *, ::rtl::Reference < ::accessibility::AccessibleShape > > SwAccessibleObjShape_Impl;
class SwAccessibleShapeMap_Impl
@@ -599,6 +612,8 @@ void SwAccessibleEventList_Impl::MoveMissingXAccToEnd()
assert(size() == nSize);
}
+namespace {
+
struct SwAccessibleChildFunc
{
bool operator()( const SwAccessibleChild& r1,
@@ -618,6 +633,8 @@ struct SwAccessibleChildFunc
}
};
+}
+
class SwAccessibleEventMap_Impl
{
public:
@@ -637,6 +654,8 @@ public:
iterator erase(const_iterator const & pos) { return maMap.erase(pos); }
};
+namespace {
+
struct SwAccessibleParaSelection
{
TextFrameIndex const nStartOfSelection;
@@ -658,6 +677,8 @@ struct SwXAccWeakRefComp
}
};
+}
+
class SwAccessibleSelectedParas_Impl
{
public:
@@ -791,6 +812,8 @@ void SwAccPreviewData::InvalidateSelection( const SwPageFrame* _pSelectedPageFra
assert(mpSelPage);
}
+namespace {
+
struct ContainsPredicate
{
const Point& mrPoint;
@@ -801,6 +824,7 @@ struct ContainsPredicate
}
};
+}
void SwAccPreviewData::AdjustMapMode( MapMode& rMapMode,
const Point& rPoint ) const
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index e50c0a3a9c7f..1df390906ce9 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1147,6 +1147,8 @@ css::uno::Sequence< css::style::TabStop > SwAccessibleParagraph::GetCurrentTabSt
return tabs;
}
+namespace {
+
struct IndexCompare
{
const PropertyValue* pValues;
@@ -1157,6 +1159,8 @@ struct IndexCompare
}
};
+}
+
OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex)
{
OUString strTypeName;
@@ -2694,6 +2698,8 @@ void SwAccessibleParagraph::deselectAccessibleChild(
// XAccessibleHypertext
+namespace {
+
class SwHyperlinkIter_Impl
{
SwTextFrame const& m_rFrame;
@@ -2709,6 +2715,8 @@ public:
TextFrameIndex endIdx() const { return m_nEnd; }
};
+}
+
SwHyperlinkIter_Impl::SwHyperlinkIter_Impl(const SwTextFrame & rTextFrame)
: m_rFrame(rTextFrame)
, m_Iter(rTextFrame)
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
index 6bb085d6a3bc..426d448327f3 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -59,6 +59,8 @@ typedef std::pair < sal_Int32, sal_Int32 > Int32Pair_Impl;
const unsigned int SELECTION_WITH_NUM = 10;
+namespace {
+
class SwAccTableSelHander_Impl
{
public:
@@ -68,6 +70,8 @@ protected:
~SwAccTableSelHander_Impl() {}
};
+}
+
class SwAccessibleTableData_Impl
{
SwAccessibleMap& mrAccMap;
@@ -474,6 +478,8 @@ void SwAccessibleTableData_Impl::GetRowColumnAndExtent(
rColumnExtent = nColumnEnd - rColumn;
}
+namespace {
+
class SwAccSingleTableSelHander_Impl : public SwAccTableSelHander_Impl
{
bool m_bSelected;
@@ -489,6 +495,8 @@ public:
virtual void Unselect( sal_Int32, sal_Int32 ) override;
};
+}
+
inline SwAccSingleTableSelHander_Impl::SwAccSingleTableSelHander_Impl() :
m_bSelected( true )
{
@@ -499,6 +507,8 @@ void SwAccSingleTableSelHander_Impl::Unselect( sal_Int32, sal_Int32 )
m_bSelected = false;
}
+namespace {
+
class SwAccAllTableSelHander_Impl : public SwAccTableSelHander_Impl
{
@@ -518,6 +528,8 @@ public:
virtual ~SwAccAllTableSelHander_Impl();
};
+}
+
SwAccAllTableSelHander_Impl::~SwAccAllTableSelHander_Impl()
{
}
diff --git a/sw/source/core/crsr/DateFormFieldButton.cxx b/sw/source/core/crsr/DateFormFieldButton.cxx
index 4ecaf15dbfba..d5c44f121f42 100644
--- a/sw/source/core/crsr/DateFormFieldButton.cxx
+++ b/sw/source/core/crsr/DateFormFieldButton.cxx
@@ -15,6 +15,8 @@
#include <tools/date.hxx>
#include <svl/zforlist.hxx>
+namespace
+{
class SwDatePickerDialog : public FloatingWindow
{
private:
@@ -30,6 +32,7 @@ public:
virtual ~SwDatePickerDialog() override;
virtual void dispose() override;
};
+}
SwDatePickerDialog::SwDatePickerDialog(SwEditWin* parent, sw::mark::DateFieldmark* pFieldmark,
SvNumberFormatter* pNumberFormatter)
diff --git a/sw/source/core/crsr/DropDownFormFieldButton.cxx b/sw/source/core/crsr/DropDownFormFieldButton.cxx
index 7a42bf7c853f..916d6ab1a8b7 100644
--- a/sw/source/core/crsr/DropDownFormFieldButton.cxx
+++ b/sw/source/core/crsr/DropDownFormFieldButton.cxx
@@ -18,6 +18,8 @@
#include <docsh.hxx>
#include <strings.hrc>
+namespace
+{
/**
* Popup dialog for drop-down form field showing the list items of the field.
* The user can select the item using this popup while filling in a form.
@@ -35,6 +37,7 @@ public:
virtual ~SwFieldDialog() override;
virtual void dispose() override;
};
+}
SwFieldDialog::SwFieldDialog(SwEditWin* parent, sw::mark::IFieldmark* fieldBM, long nMinListWidth)
: FloatingWindow(parent, WB_BORDER | WB_SYSTEMWINDOW)
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 967743a2a2dc..838159a28034 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1530,6 +1530,8 @@ static void lcl_CheckHiddenPara( SwPosition& rPos )
rPos = SwPosition( aTmp, SwIndex( pTextNd, 0 ) );
}
+namespace {
+
// #i27301# - helper class that notifies the accessibility about invalid text
// selections in its destructor
class SwNotifyAccAboutInvalidTextSelections
@@ -1548,6 +1550,8 @@ class SwNotifyAccAboutInvalidTextSelections
}
};
+}
+
void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
{
SET_CURR_SHELL( this );
diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx
index 7f35f3c37351..51518bccad35 100644
--- a/sw/source/core/crsr/findattr.cxx
+++ b/sw/source/core/crsr/findattr.cxx
@@ -174,6 +174,8 @@ static bool lcl_SearchAttr( const SwTextNode& rTextNd, SwPaM& rPam,
return false;
}
+namespace {
+
/// search for multiple text attributes
struct SwSrchChrAttr
{
@@ -221,6 +223,8 @@ public:
bool SetAttrBwd( const SwTextAttr& rAttr );
};
+}
+
SwAttrCheckArr::SwAttrCheckArr( const SfxItemSet& rSet, bool bFwd,
bool bNoCollections )
: m_nNodeStart(0)
@@ -1200,6 +1204,8 @@ static bool FindAttrsImpl(SwPaM & rSearchPam,
return bFound;
}
+namespace {
+
/// parameters for search for attributes
struct SwFindParaAttr : public SwFindParas
{
@@ -1227,6 +1233,8 @@ struct SwFindParaAttr : public SwFindParas
virtual bool IsReplaceMode() const override;
};
+}
+
int SwFindParaAttr::DoFind(SwPaM & rCursor, SwMoveFnCollection const & fnMove,
const SwPaM & rRegion, bool bInReadOnly)
{
diff --git a/sw/source/core/crsr/findcoll.cxx b/sw/source/core/crsr/findcoll.cxx
index ec033d6bb207..f80fff2c10ee 100644
--- a/sw/source/core/crsr/findcoll.cxx
+++ b/sw/source/core/crsr/findcoll.cxx
@@ -26,6 +26,8 @@
#include <SwRewriter.hxx>
#include <strings.hrc>
+namespace {
+
/// parameters for a search for FormatCollections
struct SwFindParaFormatColl : public SwFindParas
{
@@ -43,6 +45,8 @@ struct SwFindParaFormatColl : public SwFindParas
virtual bool IsReplaceMode() const override;
};
+}
+
int SwFindParaFormatColl::DoFind(SwPaM & rCursor, SwMoveFnCollection const & fnMove,
const SwPaM & rRegion, bool bInReadOnly)
{
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index 683904754e5a..d9658bc75335 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -54,6 +54,8 @@
using namespace ::com::sun::star;
using namespace util;
+namespace {
+
/// because the Find may be called on the View or the Model, we need an index
/// afflicted by multiple personality disorder
struct AmbiguousIndex
@@ -174,6 +176,8 @@ public:
}
};
+}
+
static OUString
lcl_CleanStr(const SwTextNode& rNd,
SwTextFrame const*const pFrame,
@@ -891,6 +895,8 @@ bool DoSearch(SwPaM & rSearchPam,
return bFound;
}
+namespace {
+
/// parameters for search and replace in text
struct SwFindParaText : public SwFindParas
{
@@ -915,6 +921,8 @@ struct SwFindParaText : public SwFindParas
virtual ~SwFindParaText();
};
+}
+
SwFindParaText::~SwFindParaText()
{
}
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 5509b9f33027..611430d7113b 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -58,6 +58,8 @@ using namespace ::com::sun::star::i18n;
static const sal_uInt16 coSrchRplcThreshold = 60000;
+namespace {
+
struct PercentHdl
{
SwDocShell* const pDSh;
@@ -115,6 +117,8 @@ struct PercentHdl
}
};
+}
+
SwCursor::SwCursor( const SwPosition &rPos, SwPaM* pRing )
: SwPaM( rPos, pRing )
, m_nRowSpanOffset(0)
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 246ffc1a5c8a..4ad631e560b2 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -461,6 +461,8 @@ void SwDoc::ChgDBData(const SwDBData& rNewData)
getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DatabaseName)->UpdateFields();
}
+namespace {
+
struct PostItField_ : public SetGetExpField
{
PostItField_( const SwNodeIndex& rNdIdx, const SwTextField* pField )
@@ -476,6 +478,8 @@ struct PostItField_ : public SetGetExpField
}
};
+}
+
sal_uInt16 PostItField_::GetPageNo(
const StringRangeEnumerator &rRangeEnum,
const std::set< sal_Int32 > &rPossiblePages,
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index c0c973904bf5..dec1b3d58654 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1117,6 +1117,8 @@ namespace sw { namespace mark
lcl_DebugMarks(m_vAllMarks);
}
+ namespace {
+
struct LazyFieldmarkDeleter : public IDocumentMarkAccess::ILazyDeleter
{
std::unique_ptr<Fieldmark> m_pFieldmark;
@@ -1136,6 +1138,8 @@ namespace sw { namespace mark
}
};
+ }
+
std::unique_ptr<IDocumentMarkAccess::ILazyDeleter>
MarkManager::deleteMark(const const_iterator_t& ppMark)
{
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 534f471e9310..e3562414907d 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -47,6 +47,8 @@ using namespace ::com::sun::star;
using std::vector;
+namespace {
+
class SwCompareLine
{
const SwNode& rNode;
@@ -307,8 +309,13 @@ struct CmpOptionsContainer
int nIgnoreLen;
bool bUseRsid;
};
+
+}
+
static CmpOptionsContainer CmpOptions;
+namespace {
+
class CommonSubseq
{
private:
@@ -372,6 +379,8 @@ public:
}
};
+}
+
CompareData::~CompareData()
{
if( pDelRing )
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 7ecb764e30b5..3cc2e8b6144c 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -721,6 +721,8 @@ uno::Any SwDoc::Spell( SwPaM& rPaM,
return aRet;
}
+namespace {
+
class SwHyphArgs : public SwInterHyphInfo
{
const SwNode *pStart;
@@ -744,6 +746,8 @@ public:
sal_uInt16 *GetPageSt() { return pPageSt; }
};
+}
+
SwHyphArgs::SwHyphArgs( const SwPaM *pPam, const Point &rCursorPos,
sal_uInt16* pPageCount, sal_uInt16* pPageStart )
: SwInterHyphInfo( rCursorPos ), pNode(nullptr),
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index d429af8bdf89..1526f0bd347e 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -192,6 +192,8 @@ void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark )
getIDocumentState().SetModified();
}
+namespace {
+
/// Travel between table of content Marks
class CompareNodeContent
{
@@ -219,6 +221,8 @@ public:
( nNode == rCmp.nNode && nContent >= rCmp.nContent); }
};
+}
+
const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark,
SwTOXSearch eDir, bool bInReadOnly )
{
diff --git a/sw/source/core/doc/gctable.cxx b/sw/source/core/doc/gctable.cxx
index 493ef4248c91..ddcf9e20c0f4 100644
--- a/sw/source/core/doc/gctable.cxx
+++ b/sw/source/core/doc/gctable.cxx
@@ -319,6 +319,8 @@ static void lcl_GC_Box_Border( const SwTableBox* pBox, SwGCLineBorder* pPara )
}
}
+namespace {
+
struct GCLinePara
{
SwTableLines* pLns;
@@ -329,6 +331,8 @@ struct GCLinePara
{}
};
+}
+
static bool lcl_MergeGCLine(SwTableLine* pLine, GCLinePara* pPara);
static bool lcl_MergeGCBox(SwTableBox* pTableBox, GCLinePara* pPara)
diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx
index 2873c98161e5..8e6f8ac1d446 100644
--- a/sw/source/core/doc/htmltbl.cxx
+++ b/sw/source/core/doc/htmltbl.cxx
@@ -48,6 +48,8 @@ using namespace ::com::sun::star;
#define COLFUZZY 20
#define MAX_TABWIDTH (USHRT_MAX - 2001)
+namespace {
+
class SwHTMLTableLayoutConstraints
{
sal_uInt16 const nRow; // start row
@@ -72,6 +74,8 @@ public:
sal_uInt16 GetColumn() const { return nCol; }
};
+}
+
SwHTMLTableLayoutCnts::SwHTMLTableLayoutCnts(const SwStartNode *pSttNd,
std::shared_ptr<SwHTMLTableLayout> const& rTab,
bool bNoBrTag,
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index f57933440278..44b59a283faf 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -1050,6 +1050,8 @@ void SwNumRule::SetGrabBagItem(const uno::Any& rVal)
namespace numfunc
{
+ namespace {
+
/** class containing default bullet list configuration data */
class SwDefBulletConfig : private utl::ConfigItem
{
@@ -1112,8 +1114,6 @@ namespace numfunc
std::unique_ptr<vcl::Font> mpFont;
};
- namespace
- {
class theSwDefBulletConfig
: public rtl::Static<SwDefBulletConfig, theSwDefBulletConfig>{};
}
@@ -1276,6 +1276,8 @@ namespace numfunc
return SwDefBulletConfig::getInstance().GetChar( nLevel );
}
+ namespace {
+
/** class containing configuration data about user interface behavior
regarding lists and list items.
configuration item about behavior of <TAB>/<SHIFT-TAB>-key at first
@@ -1312,8 +1314,6 @@ namespace numfunc
bool mbChangeIndentOnTabAtFirstPosOfFirstListItem;
};
- namespace
- {
class theSwNumberingUIBehaviorConfig : public rtl::Static<SwNumberingUIBehaviorConfig, theSwNumberingUIBehaviorConfig>{};
}
diff --git a/sw/source/core/doc/swstylemanager.cxx b/sw/source/core/doc/swstylemanager.cxx
index abb217bcf80b..3af1b80d7596 100644
--- a/sw/source/core/doc/swstylemanager.cxx
+++ b/sw/source/core/doc/swstylemanager.cxx
@@ -26,6 +26,8 @@
typedef std::unordered_map< OUString,
std::shared_ptr<SfxItemSet> > SwStyleNameCache;
+namespace {
+
class SwStyleCache
{
SwStyleNameCache mMap;
@@ -37,6 +39,8 @@ public:
std::shared_ptr<SfxItemSet> getByName( const OUString& rName ) { return mMap[rName]; }
};
+}
+
void SwStyleCache::addCompletePool( StylePool& rPool )
{
std::unique_ptr<IStylePoolIteratorAccess> pIter = rPool.createIterator();
@@ -49,6 +53,8 @@ void SwStyleCache::addCompletePool( StylePool& rPool )
}
}
+namespace {
+
class SwStyleManager : public IStyleAccess
{
StylePool aAutoCharPool;
@@ -74,6 +80,8 @@ public:
virtual void clearCaches() override;
};
+}
+
std::unique_ptr<IStyleAccess> createStyleManager( SfxItemSet const * pIgnorableParagraphItems )
{
return std::make_unique<SwStyleManager>( pIgnorableParagraphItems );
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 1c295d097a6a..dd150db18b2a 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -69,6 +69,8 @@ using namespace com::sun::star::uno;
#define CHECK_TABLE(t)
#endif
+namespace {
+
// In order to set the Frame Formats for the Boxes, it's enough to look
// up the current one in the array. If it's already there return the new one.
struct CpyTabFrame
@@ -121,6 +123,8 @@ struct CR_SetBoxWidth
}
};
+}
+
static bool lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam,
SwTwips nDist, bool bCheck );
static bool lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam,
@@ -161,6 +165,8 @@ typedef bool (*FN_lcl_SetBoxWidth)(SwTableLine*, CR_SetBoxWidth&, SwTwips, bool
#endif // DBG_UTIL
+namespace {
+
struct CR_SetLineHeight
{
SwTableNode* pTableNd;
@@ -183,6 +189,8 @@ struct CR_SetLineHeight
{}
};
+}
+
static bool lcl_SetSelLineHeight( SwTableLine* pLine, const CR_SetLineHeight& rParam,
SwTwips nDist, bool bCheck );
static bool lcl_SetOtherLineHeight( SwTableLine* pLine, const CR_SetLineHeight& rParam,
@@ -192,6 +200,8 @@ typedef bool (*FN_lcl_SetLineHeight)(SwTableLine*, CR_SetLineHeight&, SwTwips, b
typedef o3tl::sorted_vector<CpyTabFrame> CpyTabFrames;
+namespace {
+
struct CpyPara
{
std::shared_ptr< std::vector< std::vector< sal_uLong > > > pWidths;
@@ -233,6 +243,8 @@ struct CpyPara
{}
};
+}
+
static void lcl_CopyRow(FndLine_ & rFndLine, CpyPara *const pCpyPara);
static void lcl_CopyCol( FndBox_ & rFndBox, CpyPara *const pCpyPara)
@@ -1306,6 +1318,8 @@ static void lcl_CalcWidth( SwTableBox* pBox )
pFormat->ResetFormatAttr( RES_BOXATR_BEGIN, RES_BOXATR_END - 1 );
}
+namespace {
+
struct InsULPara
{
SwTableNode* pTableNd;
@@ -1331,6 +1345,8 @@ struct InsULPara
{ bUL_LR = true; bUL = false; if( pLine ) pInsLine = pLine; }
};
+}
+
static void lcl_Merge_MoveLine(FndLine_ & rFndLine, InsULPara *const pULPara);
static void lcl_Merge_MoveBox(FndBox_ & rFndBox, InsULPara *const pULPara)
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index e08835cf66e1..6f97cc44db57 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -38,6 +38,7 @@
#define CHECK_TABLE(t)
#endif
+namespace {
// Structure for the mapping from old and new frame formats to the
// boxes and lines of a table
@@ -50,6 +51,8 @@ struct MapTableFrameFormat
{}
};
+}
+
typedef std::vector<MapTableFrameFormat> MapTableFrameFormats;
SwContentNode* SwTextNode::MakeCopy(SwDoc* pDoc, const SwNodeIndex& rIdx, bool const bNewFrames) const
@@ -118,6 +121,8 @@ static bool lcl_SrchNew( const MapTableFrameFormat& rMap, SwFrameFormat** pPara
return false;
}
+namespace {
+
struct CopyTable
{
SwDoc* m_pDoc;
@@ -135,6 +140,8 @@ struct CopyTable
{}
};
+}
+
static void lcl_CopyTableLine( const SwTableLine* pLine, CopyTable* pCT );
static void lcl_CopyTableBox( SwTableBox* pBox, CopyTable* pCT )
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 00e249b9e0fb..c35ca9731936 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1485,6 +1485,8 @@ bool SwDoc::TableToText( const SwTableNode* pTableNd, sal_Unicode cCh )
return bRet;
}
+namespace {
+
/**
* Use the ForEach method from PtrArray to recreate Text from a Table.
* The Boxes can also contain Lines!
@@ -1500,6 +1502,8 @@ struct DelTabPara
pLastNd(nullptr), rNds( rNodes ), pUndo( pU ), cCh( cChar ) {}
};
+}
+
// Forward declare so that the Lines and Boxes can use recursion
static void lcl_DelBox( SwTableBox* pBox, DelTabPara* pDelPara );
@@ -2500,11 +2504,15 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCellFrame* pBoxFrame )
#define ROWFUZZY 25
+namespace {
+
struct FuzzyCompare
{
bool operator() ( long s1, long s2 ) const;
};
+}
+
bool FuzzyCompare::operator() ( long s1, long s2 ) const
{
return ( s1 < s2 && std::abs( s1 - s2 ) > ROWFUZZY );
@@ -3239,6 +3247,8 @@ static bool lcl_ChgTableSize( SwTable& rTable )
return true;
}
+namespace {
+
class SplitTable_Para
{
std::map<SwFrameFormat const *, SwFrameFormat*> aSrcDestMap;
@@ -3265,6 +3275,8 @@ public:
}
};
+}
+
static void lcl_SplitTable_CpyBox( SwTableBox* pBox, SplitTable_Para* pPara );
static void lcl_SplitTable_CpyLine( SwTableLine* pLn, SplitTable_Para* pPara )
@@ -3583,6 +3595,8 @@ bool SwNodes::MergeTable( const SwNodeIndex& rPos, bool bWithPrev,
return true;
}
+namespace {
+
// Use the PtrArray's ForEach method
struct SetAFormatTabPara
{
@@ -3598,6 +3612,8 @@ struct SetAFormatTabPara
{}
};
+}
+
// Forward declare so that the Lines and Boxes can use recursion
static bool lcl_SetAFormatBox(FndBox_ &, SetAFormatTabPara *pSetPara, bool bResetDirect);
static bool lcl_SetAFormatLine(FndLine_ &, SetAFormatTabPara *pPara, bool bResetDirect);
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index e1b1c14159bd..c8e9db3c41a8 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -57,6 +57,8 @@ using namespace ::com::sun::star;
static bool IsSame( long nA, long nB ) { return std::abs(nA-nB) <= COLFUZZY; }
+namespace {
+
// SwTableLine::ChgFrameFormat may delete old format which doesn't have writer listeners anymore.
// This may invalidate my pointers, and lead to use-after-free. For this reason, I register myself
// as a writer listener for the old format here, and take care to delete formats without listeners
@@ -75,6 +77,8 @@ private:
sal_Int16 const nType;
};
+}
+
SwTableFormatCmp::SwTableFormatCmp( SwFrameFormat *pO, SwFrameFormat *pN, sal_Int16 nT )
: pOld ( pO ), pNew ( pN ), nType( nT )
{
@@ -174,6 +178,8 @@ static bool lcl_IsAnLower( const SwTableLine *pLine, const SwTableLine *pAssumed
return false;
}
+namespace {
+
struct LinesAndTable
{
std::vector<SwTableLine*> &m_rLines;
@@ -184,6 +190,8 @@ struct LinesAndTable
m_rLines(rL), m_rTable(rTable), m_bInsertLines(true) {}
};
+}
+
static bool FindLine_( FndLine_ & rLine, LinesAndTable* pPara );
static bool FindBox_( FndBox_ & rBox, LinesAndTable* pPara )
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 2feef62276df..10cc05aec7af 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1395,12 +1395,16 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, sal_uLong nCnt )
}
}
+namespace {
+
struct HighLevel
{
sal_uInt16 nLevel, nTop;
explicit HighLevel( sal_uInt16 nLv ) : nLevel( nLv ), nTop( nLv ) {}
};
+}
+
static bool lcl_HighestLevel( const SwNodePtr& rpNode, void * pPara )
{
HighLevel * pHL = static_cast<HighLevel*>(pPara);
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 21e4247cfc62..5ee2c0cda4c1 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -65,6 +65,8 @@
using namespace ::com::sun::star;
+namespace {
+
class SwIntrnlSectRefLink : public SwBaseLink
{
SwSectionFormat& rSectFormat;
@@ -88,6 +90,7 @@ public:
}
};
+}
SwSectionData::SwSectionData(SectionType const eType, OUString const& rName)
: m_eType(eType)
diff --git a/sw/source/core/docnode/swthreadmanager.cxx b/sw/source/core/docnode/swthreadmanager.cxx
index cadbfda29887..4b646e8b22df 100644
--- a/sw/source/core/docnode/swthreadmanager.cxx
+++ b/sw/source/core/docnode/swthreadmanager.cxx
@@ -39,8 +39,12 @@ SwThreadManager::~SwThreadManager()
{
}
+namespace {
+
struct InitInstance : public rtl::Static<SwThreadManager, InitInstance> {};
+}
+
SwThreadManager& SwThreadManager::GetThreadManager()
{
return InitInstance::get();
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 5ffe5728fd49..82548ced5a6f 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -1992,6 +1992,8 @@ namespace sdr
{
namespace contact
{
+ namespace {
+
class VOCOfDrawVirtObj : public ViewObjectContactOfSdrObj
{
protected:
@@ -2035,6 +2037,8 @@ namespace sdr
return static_cast<SwDrawVirtObj&>(mrObject);
}
};
+
+ }
} // end of namespace contact
} // end of namespace sdr
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index e21f3f35b992..37778cfd9f86 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -75,6 +75,8 @@ namespace sdr
{
namespace contact
{
+ namespace {
+
/**
* @see #i95264#
*
@@ -100,6 +102,8 @@ namespace sdr
}
};
+ }
+
drawinglayer::primitive2d::Primitive2DContainer VCOfSwFlyDrawObj::createViewIndependentPrimitive2DSequence() const
{
// currently gets not visualized, return empty sequence
@@ -148,6 +152,8 @@ namespace drawinglayer
{
namespace primitive2d
{
+ namespace {
+
class SwVirtFlyDrawObjPrimitive : public BufferedDecompositionPrimitive2D
{
private:
@@ -182,6 +188,8 @@ namespace drawinglayer
/// provide unique ID
DeclPrimitive2DIDBlock()
};
+
+ }
} // end of namespace primitive2d
} // end of namespace drawinglayer
@@ -252,6 +260,8 @@ namespace sdr
{
namespace contact
{
+ namespace {
+
class VCOfSwVirtFlyDrawObj : public ViewContactOfVirtObj
{
protected:
@@ -274,6 +284,8 @@ namespace sdr
return static_cast<SwVirtFlyDrawObj&>(mrObject);
}
};
+
+ }
} // end of namespace contact
} // end of namespace sdr
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index c1a7b6a8cbbc..fd69be2ca96a 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -58,6 +58,8 @@
using namespace com::sun::star;
+namespace {
+
class SwSdrHdl : public SdrHdl
{
public:
@@ -66,6 +68,8 @@ public:
virtual bool IsFocusHdl() const override;
};
+}
+
bool SwSdrHdl::IsFocusHdl() const
{
if( SdrHdlKind::Anchor == eKind || SdrHdlKind::Anchor_TR == eKind )
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index da544315a9ff..95e3a7e98b69 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -36,6 +36,8 @@
using namespace ::com::sun::star;
+namespace {
+
class PaMIntoCursorShellRing
{
SwCursorShell& rSh;
@@ -49,6 +51,8 @@ public:
~PaMIntoCursorShellRing();
};
+}
+
PaMIntoCursorShellRing::PaMIntoCursorShellRing( SwCursorShell& rCSh,
SwPaM& rShCursor, SwPaM& rPam )
: rSh( rCSh ), rDelPam( rPam ), rCursor( rShCursor )
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index fa1078cdecf7..ef4c5af85743 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -60,6 +60,8 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::linguistic2;
+namespace {
+
class SwLinguIter
{
SwEditShell *pSh;
@@ -101,8 +103,12 @@ struct SpellContentPosition
sal_Int32 nRight;
};
+}
+
typedef std::vector<SpellContentPosition> SpellContentPositions;
+namespace {
+
class SwSpellIter : public SwLinguIter
{
uno::Reference< XSpellChecker1 > xSpeller;
@@ -172,6 +178,8 @@ public:
void ShowSelection();
};
+}
+
static SwSpellIter* g_pSpellIter = nullptr;
static SwConvIter* g_pConvIter = nullptr;
static SwHyphIter* g_pHyphIter = nullptr;
diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx
index e1e5ce3daf23..7d6c91d31d17 100644
--- a/sw/source/core/fields/ddefld.cxx
+++ b/sw/source/core/fields/ddefld.cxx
@@ -40,6 +40,8 @@ using namespace ::com::sun::star;
#define DDE_TXT_ENCODING osl_getThreadTextEncoding()
+namespace {
+
class SwIntrnlRefLink : public SwBaseLink
{
SwDDEFieldType& rFieldType;
@@ -57,6 +59,8 @@ public:
virtual bool IsInRange( sal_uLong nSttNd, sal_uLong nEndNd ) const override;
};
+}
+
::sfx2::SvBaseLink::UpdateResult SwIntrnlRefLink::DataChanged( const OUString& rMimeType,
const uno::Any & rValue )
{
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 19c258c86cd3..6ffe0c8000ec 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -1249,6 +1249,8 @@ SwTextNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const OUString& rRefMark
return pTextNd;
}
+namespace {
+
struct RefIdsMap
{
private:
@@ -1272,6 +1274,8 @@ public:
const OUString& GetName() const { return aName; }
};
+}
+
/// Get a sorted list of the field IDs from a document.
/// @param[in] rDoc The document to search.
/// @param[in,out] rIds The list of IDs found in the document.
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index f6bda8ebc469..41c0b9184207 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -68,6 +68,8 @@ using namespace ::com::sun::star;
static bool IsSame( long nA, long nB ) { return std::abs(nA-nB) <= COLFUZZY; }
+namespace {
+
class TableWait
{
const std::unique_ptr<SwWait> m_pWait;
@@ -81,6 +83,8 @@ public:
{ }
};
+}
+
void SwFEShell::ParkCursorInTab()
{
SwCursor * pSwCursor = GetSwCursor();
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 318453df4dd4..a020bb44170c 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -62,6 +62,8 @@
#undef DEL_ONLY_EMPTY_LINES
#undef DEL_EMPTY_BOXES_AT_START_AND_END
+namespace {
+
struct CmpLPt
{
Point aPos;
@@ -82,8 +84,11 @@ struct CmpLPt
long Y() const { return aPos.Y(); }
};
+}
+
typedef o3tl::sorted_vector<CmpLPt> MergePos;
+namespace {
struct Sort_CellFrame
{
@@ -93,6 +98,8 @@ struct Sort_CellFrame
: pFrame( &rCFrame ) {}
};
+}
+
static const SwLayoutFrame *lcl_FindCellFrame( const SwLayoutFrame *pLay )
{
while ( pLay && !pLay->IsCellFrame() )
diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx
index 079468fdf062..b28c9ebf317a 100644
--- a/sw/source/core/layout/anchoreddrawobject.cxx
+++ b/sw/source/core/layout/anchoreddrawobject.cxx
@@ -37,6 +37,8 @@
using namespace ::com::sun::star;
+namespace {
+
/// helper class for correct notification due to the positioning of
/// the anchored drawing object
class SwPosNotify
@@ -53,6 +55,8 @@ class SwPosNotify
Point const & LastObjPos() const;
};
+}
+
SwPosNotify::SwPosNotify( SwAnchoredDrawObject* _pAnchoredDrawObj ) :
mpAnchoredDrawObj( _pAnchoredDrawObj )
{
@@ -130,6 +134,8 @@ Point const & SwPosNotify::LastObjPos() const
return maOldObjRect.Pos();
}
+namespace {
+
// #i32795#
/// helper class for oscillation control on object positioning
class SwObjPosOscillationControl
@@ -145,6 +151,8 @@ class SwObjPosOscillationControl
bool OscillationDetected();
};
+}
+
SwObjPosOscillationControl::SwObjPosOscillationControl(
const SwAnchoredDrawObject& _rAnchoredDrawObj )
: mpAnchoredDrawObj( &_rAnchoredDrawObj )
diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx
index a7e727fc2669..ec09f8c4305c 100644
--- a/sw/source/core/layout/dbg_lay.cxx
+++ b/sw/source/core/layout/dbg_lay.cxx
@@ -177,6 +177,8 @@ public:
virtual void Leave(); // message when leaving
};
+namespace {
+
class SwSizeEnterLeave : public SwImplEnterLeave
{
long nFrameHeight;
@@ -209,6 +211,8 @@ public:
virtual void Leave() override; // message when resizing the Frame area
};
+}
+
void SwProtocol::Record( const SwFrame* pFrame, PROT nFunction, DbgAction nAct, void* pParam )
{
if( Start() )
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 1e449338331e..262357d8d2a2 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -201,6 +201,8 @@ void SwFlyAtContentFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pN
//We need some helper classes to monitor the oscillation and a few functions
//to not get lost.
+namespace {
+
// #i3317# - re-factoring of the position stack
class SwOszControl
{
@@ -220,6 +222,8 @@ public:
static bool IsInProgress( const SwFlyFrame *pFly );
};
+}
+
const SwFlyFrame *SwOszControl::pStack1 = nullptr;
const SwFlyFrame *SwOszControl::pStack2 = nullptr;
const SwFlyFrame *SwOszControl::pStack3 = nullptr;
@@ -539,6 +543,8 @@ bool SwFlyAtContentFrame::IsFormatPossible() const
!SwOszControl::IsInProgress( this );
}
+namespace {
+
class SwDistance
{
public:
@@ -552,6 +558,8 @@ public:
!rTwo.nSub || nSub <= rTwo.nSub ) ); }
};
+}
+
static const SwFrame * lcl_CalcDownDist( SwDistance &rRet,
const Point &rPt,
const SwContentFrame *pCnt )
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 44d1cd422c10..9c804b7c1ff8 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -3501,6 +3501,8 @@ const SwFrame* FindPage( const SwRect &rRect, const SwFrame *pPage )
return pPage;
}
+namespace {
+
class SwFrameHolder : private SfxListener
{
SwFrame* pFrame;
@@ -3514,6 +3516,8 @@ public:
bool IsSet() const { return bSet; }
};
+}
+
void SwFrameHolder::SetFrame( SwFrame* pHold )
{
bSet = true;
diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx
index 58a1fc3e3391..423d63699fc9 100644
--- a/sw/source/core/layout/laycache.cxx
+++ b/sw/source/core/layout/laycache.cxx
@@ -944,6 +944,8 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex )
return bRet;
}
+namespace {
+
struct SdrObjectCompare
{
bool operator()( const SdrObject* pF1, const SdrObject* pF2 ) const
@@ -960,6 +962,8 @@ struct FlyCacheCompare
}
};
+}
+
/**
* If a new page is inserted, the last page is analysed.
* If there are text frames with default position, the fly cache
diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx b/sw/source/core/layout/objectformattertxtfrm.cxx
index 9d25adc56f03..cc59fdd4e15c 100644
--- a/sw/source/core/layout/objectformattertxtfrm.cxx
+++ b/sw/source/core/layout/objectformattertxtfrm.cxx
@@ -33,6 +33,8 @@
using namespace ::com::sun::star;
+namespace {
+
// little helper class to forbid follow formatting for the given text frame
class SwForbidFollowFormat
{
@@ -57,6 +59,8 @@ public:
}
};
+}
+
SwObjectFormatterTextFrame::SwObjectFormatterTextFrame( SwTextFrame& _rAnchorTextFrame,
const SwPageFrame& _rPageFrame,
SwTextFrame* _pMasterAnchorTextFrame,
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 5e69b24d94c1..a7508171ecad 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -127,10 +127,10 @@ using ::drawinglayer::primitive2d::BorderLine;
using std::pair;
using std::make_pair;
-struct SwPaintProperties;
-
namespace {
+struct SwPaintProperties;
+
//Class declaration; here because they are only used in this file
enum class SubColFlags {
Page = 0x01, //Helplines of the page
@@ -145,6 +145,8 @@ namespace o3tl {
template<> struct typed_flags<SubColFlags> : is_typed_flags<SubColFlags, 0x39> {};
}
+namespace {
+
// Classes collecting the border lines and help lines
class SwLineRect : public SwRect
{
@@ -174,6 +176,8 @@ public:
bool MakeUnion( const SwRect &rRect, SwPaintProperties const &properties );
};
+}
+
#ifdef IOS
static void dummy_function()
{
@@ -182,6 +186,8 @@ static void dummy_function()
}
#endif
+namespace {
+
class SwLineRects
{
public:
@@ -232,6 +238,8 @@ public:
}
};
+}
+
// Default zoom factor
const static double aEdgeScale = 0.5;
@@ -246,6 +254,8 @@ Color* GetActiveRetoucheColor()
}
}
+namespace {
+
/**
* Container for static properties
*/
@@ -312,6 +322,8 @@ struct SwPaintProperties {
};
+}
+
static SwPaintProperties gProp;
static bool isSubsidiaryLinesFlysEnabled()
@@ -420,6 +432,8 @@ void SwCalcPixStatics( vcl::RenderContext const *pOut )
gProp.aSScaleY = double(rMap.GetScaleY());
}
+namespace {
+
/**
* To be able to save the statics so the paint is more or less reentrant
*/
@@ -430,6 +444,8 @@ public:
~SwSavePaintStatics();
};
+}
+
SwSavePaintStatics::SwSavePaintStatics()
{
// Saving globales
@@ -2221,6 +2237,8 @@ static void lcl_AdjustRectToPixelSize( SwRect& io_aSwRect, const vcl::RenderCont
// FUNCTIONS USED FOR COLLAPSING TABLE BORDER LINES START
+namespace {
+
struct SwLineEntry
{
SwTwips mnKey;
@@ -2240,6 +2258,8 @@ public:
OverlapType Overlaps( const SwLineEntry& rComp ) const;
};
+}
+
SwLineEntry::SwLineEntry( SwTwips nKey,
SwTwips nStartPos,
SwTwips nEndPos,
@@ -2300,6 +2320,8 @@ SwLineEntry::OverlapType SwLineEntry::Overlaps( const SwLineEntry& rNew ) const
return eRet;
}
+namespace {
+
struct lt_SwLineEntry
{
bool operator()( const SwLineEntry& e1, const SwLineEntry& e2 ) const
@@ -2308,9 +2330,13 @@ struct lt_SwLineEntry
}
};
+}
+
typedef std::set< SwLineEntry, lt_SwLineEntry > SwLineEntrySet;
typedef std::map< SwTwips, SwLineEntrySet > SwLineEntryMap;
+namespace {
+
class SwTabFramePainter
{
SwLineEntryMap maVertLines;
@@ -2331,6 +2357,8 @@ public:
void PaintLines( OutputDevice& rDev, const SwRect& rRect ) const;
};
+}
+
SwTabFramePainter::SwTabFramePainter( const SwTabFrame& rTabFrame )
: mrTabFrame( rTabFrame )
{
@@ -3284,6 +3312,8 @@ static void lcl_EmergencyFormatFootnoteCont( SwFootnoteContFrame *pCont )
}
}
+namespace {
+
class SwShortCut
{
SwRectDist fnCheck;
@@ -3294,6 +3324,8 @@ public:
{ return (rRect.*fnCheck)( nLimit ) > 0; }
};
+}
+
SwShortCut::SwShortCut( const SwFrame& rFrame, const SwRect& rRect )
{
bool bVert = rFrame.IsVertical();
@@ -3854,6 +3886,8 @@ void SwCellFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const&
SwLayoutFrame::PaintSwFrame( rRenderContext, rRect );
}
+namespace {
+
struct BorderLinesGuard
{
explicit BorderLinesGuard() : m_pBorderLines(std::move(gProp.pBLines))
@@ -3868,6 +3902,8 @@ private:
std::unique_ptr<BorderLines> m_pBorderLines;
};
+}
+
void SwFlyFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const& rRect, SwPrintData const*const) const
{
//optimize thumbnail generation and store procedure to improve odt saving performance, #i120030#
@@ -4483,6 +4519,8 @@ namespace drawinglayer
{
namespace primitive2d
{
+ namespace {
+
class SwBorderRectanglePrimitive2D : public BufferedDecompositionPrimitive2D
{
private:
@@ -4527,6 +4565,8 @@ namespace drawinglayer
DeclPrimitive2DIDBlock()
};
+ }
+
void SwBorderRectanglePrimitive2D::create2DDecomposition(
Primitive2DContainer& rContainer,
const geometry::ViewInformation2D& /*rViewInformation*/) const
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index f4bb297b6df5..ef1fa6a39ab2 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -1190,6 +1190,8 @@ void SwSectionFrame::SimpleFormat()
UnlockJoin();
}
+namespace {
+
// #i40147# - helper class to perform extra section format
// to position anchored objects and to keep the position of whose objects locked.
class ExtraFormatToPositionObjs
@@ -1322,6 +1324,8 @@ class ExtraFormatToPositionObjs
}
};
+}
+
/// "formats" the frame; Frame and PrtArea
void SwSectionFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttr )
{
diff --git a/sw/source/core/layout/sortedobjs.cxx b/sw/source/core/layout/sortedobjs.cxx
index 40d87c43b7bf..2e3df19104f0 100644
--- a/sw/source/core/layout/sortedobjs.cxx
+++ b/sw/source/core/layout/sortedobjs.cxx
@@ -70,7 +70,6 @@ namespace
return 1;
return 2;
}
-}
struct ObjAnchorOrder
{
@@ -198,6 +197,8 @@ struct ObjAnchorOrder
}
};
+}
+
bool SwSortedObjs::is_sorted() const
{
return std::is_sorted(maSortedObjLst.begin(), maSortedObjLst.end(), ObjAnchorOrder());
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 55c2eb66e6e1..369207a36221 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -105,6 +105,8 @@ namespace {
}
}
+namespace {
+
//For SwFlyFrame::GetCursorOfst
class SwCursorOszControl
{
@@ -140,6 +142,8 @@ public:
}
};
+}
+
static SwCursorOszControl g_OszCtrl = { nullptr, nullptr, nullptr };
/** Searches the ContentFrame owning the PrtArea containing the point. */
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index 9000d6ef1b9e..c66ff319ac93 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -64,6 +64,8 @@ using namespace utl;
using namespace com::sun::star::uno;
using namespace com::sun::star;
+namespace {
+
class SwOLELRUCache
: private utl::ConfigItem
{
@@ -86,6 +88,8 @@ public:
void RemoveObj( SwOLEObj& rObj );
};
+}
+
static std::shared_ptr<SwOLELRUCache> g_pOLELRU_Cache;
class SwOLEListener_Impl : public ::cppu::WeakImplHelper< embed::XStateChangeListener >
diff --git a/sw/source/core/swg/SwXMLBlockImport.cxx b/sw/source/core/swg/SwXMLBlockImport.cxx
index 05ad9d164281..14fe001096b7 100644
--- a/sw/source/core/swg/SwXMLBlockImport.cxx
+++ b/sw/source/core/swg/SwXMLBlockImport.cxx
@@ -43,6 +43,8 @@ using namespace css::xml::sax;
class SwXMLBlockListImport;
class SwXMLTextBlockImport;
+namespace {
+
class SwXMLBlockListContext : public SvXMLImportContext
{
private:
@@ -113,6 +115,8 @@ public:
virtual ~SwXMLTextBlockParContext() override;
};
+}
+
SwXMLTextBlockTokenHandler::SwXMLTextBlockTokenHandler()
{
}
diff --git a/sw/source/core/swg/SwXMLSectionList.cxx b/sw/source/core/swg/SwXMLSectionList.cxx
index 2f835bd606a3..2dfcb49e8457 100644
--- a/sw/source/core/swg/SwXMLSectionList.cxx
+++ b/sw/source/core/swg/SwXMLSectionList.cxx
@@ -26,6 +26,8 @@
using namespace ::com::sun::star;
using namespace ::xmloff::token;
+namespace {
+
class SvXMLSectionListContext : public SvXMLImportContext
{
private:
@@ -73,6 +75,7 @@ public:
}
};
+}
SwXMLSectionList::SwXMLSectionList(const css::uno::Reference< css::uno::XComponentContext >& rContext, std::vector<OUString> &rNewSectionList)
: SvXMLImport(rContext, "")
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index 04a2509b1e37..69b61fd8b447 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -2091,6 +2091,8 @@ void SwTable::CleanUpBottomRowSpan( sal_uInt16 nDelLines )
#ifdef DBG_UTIL
+namespace {
+
struct RowSpanCheck
{
long nRowSpan;
@@ -2098,6 +2100,8 @@ struct RowSpanCheck
SwTwips nRight;
};
+}
+
void SwTable::CheckConsistency() const
{
if( !IsNewModel() )
diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index 7eae6a55198e..d5252724679d 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -741,6 +741,8 @@ bool SwTextFrame::RightMargin(SwPaM *pPam, bool bAPI) const
// to the base class.
// The Cursor's horizontal justification is done afterwards by the CursorShell.
+namespace {
+
class SwSetToRightMargin
{
bool bRight;
@@ -750,6 +752,8 @@ public:
void SetRight( const bool bNew ) { bRight = bNew; }
};
+}
+
bool SwTextFrame::UnitUp_( SwPaM *pPam, const SwTwips nOffset,
bool bSetInReadOnly ) const
{
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 37543c700b76..751d9b94c59e 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -59,6 +59,8 @@
// Tolerance in formatting and text output
#define SLOPPY_TWIPS 5
+namespace {
+
class FormatLevel
{
static sal_uInt16 nLevel;
@@ -68,6 +70,9 @@ public:
static sal_uInt16 GetLevel() { return nLevel; }
static bool LastLevel() { return 10 < nLevel; }
};
+
+}
+
sal_uInt16 FormatLevel::nLevel = 0;
void ValidateText( SwFrame *pFrame ) // Friend of frame
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 393968dbd032..967925d5847c 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -59,6 +59,8 @@ using namespace ::com::sun::star;
static bool bInitFont = true;
+namespace {
+
class SwExtraPainter
{
SwSaveClip m_aClip;
@@ -93,6 +95,8 @@ public:
void PaintRedline( SwTwips nY, long nMax );
};
+}
+
SwExtraPainter::SwExtraPainter( const SwTextFrame *pFrame, SwViewShell *pVwSh,
const SwLineNumberInfo &rLnInf, const SwRect &rRct,
sal_Int16 eHor, bool bLineNum )
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index a27701186c1a..fd433adc724c 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -782,6 +782,8 @@ TextFrameIndex SwAttrIter::GetNextAttr() const
}
}
+namespace {
+
class SwMinMaxArgs
{
public:
@@ -800,6 +802,8 @@ public:
void NewWord() { nWordAdd = nWordWidth = 0; }
};
+}
+
static bool lcl_MinMaxString( SwMinMaxArgs& rArg, SwFont* pFnt, const OUString &rText,
sal_Int32 nIdx, sal_Int32 nEnd )
{
@@ -848,6 +852,8 @@ bool SwTextNode::IsSymbolAt(const sal_Int32 nBegin) const
return aIter.GetFnt()->IsSymbol( getIDocumentLayoutAccess().GetCurrentViewShell() );
}
+namespace {
+
class SwMinMaxNodeArgs
{
public:
@@ -861,6 +867,8 @@ public:
void Minimum( long nNew ) { if( nNew > nMinWidth ) nMinWidth = nNew; }
};
+}
+
static void lcl_MinMaxNode( SwFrameFormat* pNd, SwMinMaxNodeArgs* pIn )
{
const SwFormatAnchor& rFormatA = pNd->GetAnchor();
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 2a1b8432ac0e..d8fa076085fc 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -817,6 +817,8 @@ void SwTextFormatter::CalcAscent( SwTextFormatInfo &rInf, SwLinePortion *pPor )
}
}
+namespace {
+
class SwMetaPortion : public SwTextPortion
{
public:
@@ -824,6 +826,8 @@ public:
virtual void Paint( const SwTextPaintInfo &rInf ) const override;
};
+}
+
void SwMetaPortion::Paint( const SwTextPaintInfo &rInf ) const
{
if ( Width() )
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 11338d9a8c39..3c42df910be4 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -133,6 +133,8 @@ sal_uInt16 SwFieldPortion::GetViewWidth( const SwTextSizeInfo &rInf ) const
return m_nViewWidth;
}
+namespace {
+
/**
* Never just use SetLen(0)
*/
@@ -150,6 +152,8 @@ public:
~SwFieldSlot();
};
+}
+
SwFieldSlot::SwFieldSlot( const SwTextFormatInfo* pNew, const SwFieldPortion *pPor )
: pOldText(nullptr)
, nIdx(0)
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 260e1921ae1a..d2486329cbc0 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -810,6 +810,7 @@ static bool lcl_HasRotation(const SwTextAttr& rAttr,
}
namespace sw {
+ namespace {
// need to use a very special attribute iterator here that returns
// both the hints and the nodes, so that GetMultiCreator() can handle
@@ -833,6 +834,8 @@ namespace sw {
}
};
+ }
+
SwTextAttr const* MergedAttrIterMulti::NextAttr(SwTextNode const*& rpNode)
{
if (m_First)
@@ -1400,6 +1403,8 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex &
return nullptr;
}
+namespace {
+
// A little helper class to manage the spaceadd-arrays of the text adjustment
// during a PaintMultiPortion.
// The constructor prepares the array for the first line of multiportion,
@@ -1422,6 +1427,8 @@ public:
long GetSpaceAdd() const { return nSpaceAdd; }
};
+}
+
SwSpaceManipulator::SwSpaceManipulator( SwTextPaintInfo& rInf,
SwMultiPortion& rMult )
: rInfo(rInf)
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index 7588b20d4ad9..6fa6702baebc 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -64,6 +64,8 @@ static bool lcl_IsDropFlyInter( const SwTextFormatInfo &rInf,
return false;
}
+namespace {
+
class SwDropSave
{
SwTextPaintInfo* pInf;
@@ -77,6 +79,8 @@ public:
~SwDropSave();
};
+}
+
SwDropSave::SwDropSave( const SwTextPaintInfo &rInf ) :
pInf( const_cast<SwTextPaintInfo*>(&rInf) ), nIdx( rInf.GetIdx() ),
nLen( rInf.GetLen() ), nX( rInf.X() ), nY( rInf.Y() )
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index 4ca6938e82f3..5c17be3cbdb3 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -1241,6 +1241,8 @@ void SwTextFormatter::MakeDummyLine()
}
}
+namespace {
+
class SwFootnoteSave
{
SwTextSizeInfo *pInf;
@@ -1258,6 +1260,8 @@ public:
~SwFootnoteSave() COVERITY_NOEXCEPT_FALSE;
};
+}
+
SwFootnoteSave::SwFootnoteSave( const SwTextSizeInfo &rInf,
const SwTextFootnote* pTextFootnote,
const bool bApplyGivenScriptType,
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 20f61111126a..2f8fd90e1d62 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -30,6 +30,8 @@
#include <view.hxx>
#include <svx/svdobj.hxx>
+namespace {
+
class XmlPortionDumper:public SwPortionHandler
{
private:
@@ -226,8 +228,6 @@ class XmlPortionDumper:public SwPortionHandler
};
-namespace
-{
xmlTextWriterPtr lcl_createDefaultWriter()
{
xmlTextWriterPtr writer = xmlNewTextWriterFilename( "layout.xml", 0 );
diff --git a/sw/source/core/txtnode/SwGrammarContact.cxx b/sw/source/core/txtnode/SwGrammarContact.cxx
index 38f095cd1996..bb26450cc31b 100644
--- a/sw/source/core/txtnode/SwGrammarContact.cxx
+++ b/sw/source/core/txtnode/SwGrammarContact.cxx
@@ -27,6 +27,8 @@
#include <rootfrm.hxx>
#include <viewsh.hxx>
+namespace {
+
/*
* This class is responsible for the delayed display of grammar checks when a paragraph is edited
* It's a client of the paragraph the cursor points to.
@@ -59,6 +61,8 @@ protected:
virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override;
};
+}
+
SwGrammarContact::SwGrammarContact() : mbFinished( false )
{
aTimer.SetTimeout( 2000 ); // Repaint of grammar check after 'setChecked'
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index ef37d507efae..376908cdbc8a 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -786,6 +786,8 @@ MetaFieldManager::makeMetaField(SwFormatMeta * const i_pFormat,
return pMetaField;
}
+namespace {
+
struct IsInUndo
{
bool operator()(std::weak_ptr<MetaField> const & pMetaField) {
@@ -802,6 +804,8 @@ struct MakeUnoObject
}
};
+}
+
std::vector< uno::Reference<text::XTextField> >
MetaFieldManager::getMetaFields()
{
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 6fa6b159705a..7ced0397cd17 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -246,6 +246,8 @@ static bool lcl_IsFontAdjustNecessary( const vcl::RenderContext& rOutDev,
OUTDEV_PRINTER != rOutDev.GetOutDevType() );
}
+namespace {
+
struct CalcLinePosData
{
SwDrawTextInfo& rInf;
@@ -274,6 +276,8 @@ struct CalcLinePosData
}
};
+}
+
// Computes the start and end position of an underline. This function is called
// from the DrawText-method (for underlining misspelled words or smarttag terms).
static void lcl_calcLinePos( const CalcLinePosData &rData,
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index 171accf5ae5d..09695fa0c74d 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -36,6 +36,8 @@
using namespace ::com::sun::star::i18n;
+namespace {
+
// The information encapsulated in SwCapitalInfo is required
// by the ::Do functions. They contain the information about
// the original string, whereas rDo.GetInf() contains information
@@ -50,6 +52,8 @@ public:
TextFrameIndex nLen;
};
+}
+
// rFnt: required for CalcCaseMap
// rOrigString: The original string
// nOfst: Position of the substring in rOrigString
@@ -105,6 +109,8 @@ public:
void SetCapInf( SwCapitalInfo& rNew ) { pCapInf = &rNew; }
};
+namespace {
+
class SwDoGetCapitalSize : public SwDoCapitals
{
protected:
@@ -117,6 +123,8 @@ public:
const Size &GetSize() const { return aTextSize; }
};
+}
+
void SwDoGetCapitalSize::Init( SwFntObj *, SwFntObj * )
{
aTextSize.setHeight( 0 );
@@ -152,6 +160,8 @@ Size SwSubFont::GetCapitalSize( SwDrawTextInfo& rInf )
return aTextSize;
}
+namespace {
+
class SwDoGetCapitalBreak : public SwDoCapitals
{
protected:
@@ -170,6 +180,8 @@ public:
TextFrameIndex getBreak() const { return m_nBreak; }
};
+}
+
void SwDoGetCapitalBreak::Init( SwFntObj *, SwFntObj * )
{
}
@@ -231,6 +243,8 @@ TextFrameIndex SwFont::GetCapitalBreak( SwViewShell const * pSh, const OutputDev
return aDo.getBreak();
}
+namespace {
+
class SwDoDrawCapital : public SwDoCapitals
{
protected:
@@ -246,6 +260,8 @@ public:
void DrawSpace( Point &rPos );
};
+}
+
void SwDoDrawCapital::Init( SwFntObj *pUpperFont, SwFntObj *pLowerFont )
{
pUpperFnt = pUpperFont;
@@ -313,6 +329,8 @@ void SwSubFont::DrawCapital( SwDrawTextInfo &rInf )
DoOnCapitals( aDo );
}
+namespace {
+
class SwDoCapitalCursorOfst : public SwDoCapitals
{
protected:
@@ -331,6 +349,8 @@ public:
TextFrameIndex GetCursor() const { return nCursor; }
};
+}
+
void SwDoCapitalCursorOfst::Init( SwFntObj *pUpperFont, SwFntObj *pLowerFont )
{
pUpperFnt = pUpperFont;
@@ -386,6 +406,8 @@ TextFrameIndex SwSubFont::GetCapitalCursorOfst( SwDrawTextInfo& rInf )
return aDo.GetCursor();
}
+namespace {
+
class SwDoDrawStretchCapital : public SwDoDrawCapital
{
const TextFrameIndex nStrLen;
@@ -402,6 +424,8 @@ public:
{ }
};
+}
+
void SwDoDrawStretchCapital::Do()
{
SV_STAT( nDrawStretchText );
diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx
index 3bc3dbb59f21..c8c9726c9a6c 100644
--- a/sw/source/core/txtnode/modeltoviewhelper.cxx
+++ b/sw/source/core/txtnode/modeltoviewhelper.cxx
@@ -34,6 +34,8 @@
#include <set>
#include <vector>
+namespace {
+
struct FieldResult
{
sal_Int32 const m_nFieldPos;
@@ -53,8 +55,12 @@ public:
}
};
+}
+
typedef std::set<FieldResult, sortfieldresults> FieldResultSet;
+namespace {
+
struct block
{
sal_Int32 const m_nStart;
@@ -80,6 +86,8 @@ struct containsPos
}
};
+}
+
ModelToViewHelper::ModelToViewHelper(const SwTextNode &rNode,
SwRootFrame const*const pLayout, ExpandMode eMode)
{
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 35819fa8214d..f6c0b771b52a 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -2065,6 +2065,8 @@ static void lcl_MergeAttr_ExpandChrFormat( SfxItemSet& rSet, const SfxPoolItem&
rSet.Put( rAttr );
}
+namespace {
+
struct SwPoolItemEndPair
{
public:
@@ -2074,6 +2076,8 @@ public:
SwPoolItemEndPair() : mpItem( nullptr ), mnEndPos( 0 ) {};
};
+}
+
static void lcl_MergeListLevelIndentAsLRSpaceItem( const SwTextNode& rTextNode,
SfxItemSet& rSet )
{
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index 2b2d3450cb34..015cec4cebd7 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -546,6 +546,8 @@ void UndoManager::AddUndoAction(std::unique_ptr<SfxUndoAction> pAction, bool bTr
}
}
+namespace {
+
class CursorGuard
{
public:
@@ -570,6 +572,8 @@ private:
bool const m_bSaveCursor;
};
+}
+
bool UndoManager::impl_DoUndoRedo(UndoOrRedoType undoOrRedo)
{
SwDoc & rDoc(*GetUndoNodes().GetDoc());
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index e54290e941b0..bc6a4c5160e6 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -187,6 +187,8 @@ SwUndo::~SwUndo()
{
}
+namespace {
+
class UndoRedoRedlineGuard
{
public:
@@ -210,6 +212,8 @@ private:
RedlineFlags const m_eMode;
};
+}
+
void SwUndo::Undo()
{
assert(false); // SwUndo::Undo(): ERROR: must call UndoWithContext instead
diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx
index 127ba5a410eb..7e05ae0e9fd7 100644
--- a/sw/source/core/undo/unsect.cxx
+++ b/sw/source/core/undo/unsect.cxx
@@ -414,6 +414,8 @@ void SwUndoDelSection::RedoImpl(::sw::UndoRedoContext & rContext)
rDoc.DelSectionFormat( pNd->GetSection().GetFormat() );
}
+namespace {
+
class SwUndoUpdateSection
: public SwUndo
{
@@ -431,6 +433,8 @@ public:
virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
};
+}
+
std::unique_ptr<SwUndo>
MakeUndoUpdateSection(SwSectionFormat const& rFormat, bool const bOnlyAttr)
{
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index b3b2fdd34403..37f629c92c97 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -94,13 +94,17 @@ struct UndoTableCpyTable_Entry
explicit UndoTableCpyTable_Entry( const SwTableBox& rBox );
};
+namespace {
+
class SaveBox;
class SaveLine;
+}
+
class SaveTable
{
- friend class SaveBox;
- friend class SaveLine;
+ friend SaveBox;
+ friend SaveLine;
SfxItemSet m_aTableSet;
std::unique_ptr<SaveLine> m_pLine;
const SwTable* m_pSwTable;
@@ -129,9 +133,11 @@ public:
bool IsNewModel() const { return m_bNewModel; }
};
+namespace {
+
class SaveLine
{
- friend class SaveTable;
+ friend SaveTable;
friend class SaveBox;
SaveLine* pNext;
@@ -175,6 +181,8 @@ public:
void CreateNew( SwTable& rTable, SwTableLine& rParent, SaveTable& rSTable );
};
+}
+
#if OSL_DEBUG_LEVEL > 0
#include <shellio.hxx>
static void CheckTable( const SwTable& );
@@ -2177,6 +2185,8 @@ void SwUndoTableNumFormat::UndoImpl(::sw::UndoRedoContext & rContext)
pPam->GetPoint()->nContent.Assign( pTextNd, 0 );
}
+namespace {
+
/** switch the RedlineFlags on the given document, using
* SetRedlineFlags_intern. This class set the mode in the constructor,
* and changes it back in the destructor, i.e. it uses the
@@ -2196,6 +2206,8 @@ public:
~RedlineFlagsInternGuard();
};
+}
+
RedlineFlagsInternGuard::RedlineFlagsInternGuard(
SwDoc& rDoc,
RedlineFlags eNewRedlineFlags,
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 787f38918915..ffd3316faf7f 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -92,6 +92,8 @@ using namespace ::com::sun::star::lang;
#if HAVE_FEATURE_SCRIPTING
+namespace {
+
class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper< document::XCodeNameQuery >
{
SwDocShell* const mpDocShell;
@@ -168,8 +170,12 @@ public:
}
};
+}
+
typedef std::unordered_map< OUString, OUString > StringHashMap;
+namespace {
+
class SwVbaProjectNameProvider : public ::cppu::WeakImplHelper< container::XNameContainer >
{
StringHashMap mTemplateToProject;
@@ -268,14 +274,20 @@ public:
};
+}
+
#endif
+namespace {
+
struct ProvNamesId_Type
{
const char * pName;
SwServiceType const nType;
};
+}
+
// note: this thing is indexed as an array, so do not insert/remove entries!
const ProvNamesId_Type aProvNamesId[] =
{
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index b5b7f4e1a88e..90b014202640 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -128,12 +128,16 @@ static const sal_uInt16 aDocInfoSubTypeFromService[] =
DI_DOCNO //PROPERTY_MAP_FLDTYP_DOCINFO_REVISION
};
+namespace {
+
struct ServiceIdResId
{
SwFieldIds const nResId;
SwServiceType const nServiceId;
};
+}
+
static const ServiceIdResId aServiceToRes[] =
{
{SwFieldIds::DateTime, SwServiceType::FieldTypeDateTime },
@@ -1071,6 +1075,8 @@ OUString SwXFieldMaster::LocalizeFormula(
return rFormula;
}
+namespace {
+
struct SwFieldProperties_Impl
{
OUString sPar1;
@@ -1112,6 +1118,8 @@ struct SwFieldProperties_Impl
{}
};
+}
+
class SwXTextField::Impl
: public SvtListener
{
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 294db651c919..7dbd91d656d4 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -962,6 +962,8 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI
return bRet;
}
+namespace {
+
class SwFrameProperties_Impl : public BaseFrameProperties_Impl
{
public:
@@ -970,6 +972,8 @@ public:
bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) override;
};
+}
+
SwFrameProperties_Impl::SwFrameProperties_Impl():
BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME)*/ )
{
@@ -1026,6 +1030,8 @@ bool SwFrameProperties_Impl::AnyToItemSet(SwDoc *pDoc, SfxItemSet& rSet, SfxItem
return bRet;
}
+namespace {
+
class SwGraphicProperties_Impl : public BaseFrameProperties_Impl
{
public:
@@ -1034,6 +1040,8 @@ public:
virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) override;
};
+}
+
SwGraphicProperties_Impl::SwGraphicProperties_Impl( ) :
BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC)*/ )
{
@@ -1125,6 +1133,8 @@ bool SwGraphicProperties_Impl::AnyToItemSet(
return bRet;
}
+namespace {
+
class SwOLEProperties_Impl : public SwFrameProperties_Impl
{
public:
@@ -1134,6 +1144,8 @@ public:
virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) override;
};
+}
+
bool SwOLEProperties_Impl::AnyToItemSet(
SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound)
{
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index ae93e9c63b07..87e06e218d7d 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -245,6 +245,8 @@ public:
};
+namespace {
+
class SwDocIndexDescriptorProperties_Impl
{
private:
@@ -259,6 +261,8 @@ public:
void SetTypeName(const OUString& rSet) { m_sUserTOXTypeName = rSet; }
};
+}
+
SwDocIndexDescriptorProperties_Impl::SwDocIndexDescriptorProperties_Impl(
SwTOXType const*const pType)
{
@@ -1884,6 +1888,8 @@ SwXDocumentIndexMark::attach(
m_pImpl->m_bIsDescriptor = false;
}
+namespace {
+
template<typename T> struct NotContainedIn
{
std::vector<T> const& m_rVector;
@@ -1895,6 +1901,8 @@ template<typename T> struct NotContainedIn
}
};
+}
+
void SwXDocumentIndexMark::Impl::InsertTOXMark(
SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam,
SwXTextCursor const*const pTextCursor)
@@ -2639,11 +2647,15 @@ SwXDocumentIndex::TokenAccess_Impl::getSupportedServiceNames()
return { "com.sun.star.text.DocumentIndexLevelFormat" };
}
+namespace {
+
struct TokenType_ {
const char *pName;
enum FormTokenType const eTokenType;
};
+}
+
static const struct TokenType_ g_TokenTypes[] =
{
{ "TokenEntryNumber", TOKEN_ENTRY_NO },
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 502e2e74c2dd..e4a282212751 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -138,6 +138,8 @@ void DeepCopyPaM(SwPaM const & rSource, SwPaM & rTarget)
} // namespace sw
+namespace {
+
struct FrameClientSortListLess
{
bool operator() (FrameClientSortListEntry const& r1,
@@ -148,8 +150,6 @@ struct FrameClientSortListLess
}
};
-namespace
-{
void lcl_CollectFrameAtNodeWithLayout(const SwContentFrame* pCFrame,
FrameClientSortList_t& rFrames,
const RndStdIds nAnchorType)
@@ -399,6 +399,8 @@ void SwUnoCursorHelper::GetCursorAttr(SwPaM & rPam,
}
}
+namespace {
+
struct SwXParagraphEnumerationImpl final : public SwXParagraphEnumeration
{
uno::Reference< text::XText > const m_xParentText;
@@ -485,6 +487,8 @@ struct SwXParagraphEnumerationImpl final : public SwXParagraphEnumeration
bool IgnoreLastElement(SwUnoCursor& rCursor, bool bMovedFromTable);
};
+}
+
SwXParagraphEnumeration* SwXParagraphEnumeration::Create(
uno::Reference< text::XText > const& xParent,
const std::shared_ptr<SwUnoCursor>& pCursor,
@@ -1418,6 +1422,8 @@ SwXTextRange::makeRedline(
SwUnoCursorHelper::makeRedline( aPaM, rRedlineType, rRedlineProperties );
}
+namespace {
+
struct SwXTextRangesImpl final : public SwXTextRanges
{
@@ -1462,6 +1468,8 @@ struct SwXTextRangesImpl final : public SwXTextRanges
sw::UnoCursorPointer m_pUnoCursor;
};
+}
+
void SwXTextRangesImpl::MakeRanges()
{
if (GetCursor())
@@ -1540,6 +1548,8 @@ void SwUnoCursorHelper::SetString(SwCursor & rCursor, const OUString& rString)
pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr);
}
+namespace {
+
struct SwXParaFrameEnumerationImpl final : public SwXParaFrameEnumeration
{
// XServiceInfo
@@ -1584,6 +1594,7 @@ struct SwXParaFrameEnumerationImpl final : public SwXParaFrameEnumeration
::sw::UnoCursorPointer m_pUnoCursor;
};
+}
SwXParaFrameEnumeration* SwXParaFrameEnumeration::Create(const SwPaM& rPaM, const enum ParaFrameMode eParaFrameMode, SwFrameFormat* const pFormat)
{ return new SwXParaFrameEnumerationImpl(rPaM, eParaFrameMode, pFormat); }
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 2b632ab78e79..2d3e33922aa3 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -59,6 +59,7 @@
using namespace ::com::sun::star;
+namespace {
class SwParaSelection
{
@@ -68,6 +69,8 @@ public:
~SwParaSelection();
};
+}
+
SwParaSelection::SwParaSelection(SwCursor & rCursor)
: m_rCursor(rCursor)
{
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 42d4658138a1..9cba2c7d9dd4 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -685,6 +685,8 @@ static void lcl_ExportSoftPageBreak(
}
}
+namespace {
+
struct SwXRedlinePortion_Impl
{
const SwRangeRedline* m_pRedline;
@@ -703,9 +705,13 @@ struct SwXRedlinePortion_Impl
}
};
+}
+
typedef std::shared_ptr < SwXRedlinePortion_Impl >
SwXRedlinePortion_ImplSharedPtr;
+namespace {
+
struct RedlineCompareStruct
{
static const SwPosition& getPosition ( const SwXRedlinePortion_ImplSharedPtr &r )
@@ -720,6 +726,8 @@ struct RedlineCompareStruct
}
};
+}
+
typedef std::multiset < SwXRedlinePortion_ImplSharedPtr, RedlineCompareStruct >
SwXRedlinePortion_ImplList;
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index adab40c9d319..ee5756c761cd 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -187,6 +187,8 @@ SwXReferenceMark::getSupportedServiceNames()
};
}
+namespace {
+
template<typename T> struct NotContainedIn
{
std::vector<T> const& m_rVector;
@@ -198,6 +200,8 @@ template<typename T> struct NotContainedIn
}
};
+}
+
void SwXReferenceMark::Impl::InsertRefMark(SwPaM& rPam,
SwXTextCursor const*const pCursor)
{
@@ -492,6 +496,8 @@ void SAL_CALL SwXReferenceMark::removeVetoableChangeListener(
OSL_FAIL("SwXReferenceMark::removeVetoableChangeListener(): not implemented");
}
+namespace {
+
class SwXMetaText : public cppu::OWeakObject, public SwXText
{
private:
@@ -530,6 +536,8 @@ public:
};
+}
+
SwXMetaText::SwXMetaText(SwDoc & rDoc, SwXMeta & rMeta)
: SwXText(&rDoc, CursorType::Meta)
, m_rMeta(rMeta)
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 05c4ba13275a..ff12dc325695 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -67,6 +67,8 @@
using namespace ::com::sun::star;
+namespace {
+
struct SwTextSectionProperties_Impl
{
uno::Sequence<sal_Int8> m_Password;
@@ -103,6 +105,8 @@ struct SwTextSectionProperties_Impl
};
+}
+
class SwXTextSection::Impl
: public SvtListener
{
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 2169cb9cd285..acf2ae04d9f7 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -114,11 +114,11 @@
#include <set>
#include <limits>
+namespace {
+
class SwXStyle;
class SwStyleProperties_Impl;
-namespace
-{
struct StyleFamilyEntry
{
using GetCountOrName_t = std::function<sal_Int32 (const SwDoc&, OUString*, sal_Int32)>;
@@ -184,6 +184,8 @@ using namespace ::com::sun::star;
namespace sw
{
+ namespace {
+
class XStyleFamily : public cppu::WeakImplHelper
<
container::XNameContainer,
@@ -281,8 +283,11 @@ namespace sw
{ return { "com.sun.star.style.StyleFamily" }; }
};
+ }
}
+namespace {
+
class SwStyleBase_Impl;
class SwXStyle : public cppu::WeakImplHelper
<
@@ -454,6 +459,7 @@ public:
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
};
+}
using sw::XStyleFamily;
@@ -1114,6 +1120,8 @@ static const std::vector<ParagraphStyleCategoryEntry>* lcl_GetParagraphStyleCate
return our_pParagraphStyleCategoryEntries;
}
+namespace {
+
class SwStyleProperties_Impl
{
const PropertyEntryVector_t aPropertyEntries;
@@ -1168,6 +1176,8 @@ public:
}
};
+}
+
static SwGetPoolIdFromName lcl_GetSwEnumFromSfxEnum(SfxStyleFamily eFamily)
{
auto pEntries(lcl_GetStyleFamilyEntries());
@@ -1463,6 +1473,8 @@ void SwXStyle::ApplyDescriptorProperties()
m_pPropertiesImpl->Apply(*this);
}
+namespace {
+
class SwStyleBase_Impl
{
private:
@@ -1528,8 +1540,6 @@ public:
};
};
-namespace
-{
const char* STR_POOLPAGE_ARY[] =
{
// Page styles
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 1ad6dc454657..77330375aebf 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1805,6 +1805,8 @@ void SwXTextTableCursor::Notify( const SfxHint& rHint )
// SwXTextTable ===========================================================
+namespace {
+
class SwTableProperties_Impl
{
SwUnoCursorHelper::SwAnyMapHelper aAnyMap;
@@ -1819,6 +1821,8 @@ public:
void ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc);
};
+}
+
SwTableProperties_Impl::SwTableProperties_Impl()
{ }
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index d49b07e35cb9..7b528399a035 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -1777,6 +1777,8 @@ SwXText::convertToTextFrame(
return xRet;
}
+namespace {
+
// Move previously imported paragraphs into a new text table.
struct VerticallyMergedCell
{
@@ -1793,6 +1795,8 @@ struct VerticallyMergedCell
}
};
+}
+
#define COL_POS_FUZZY 2
static bool lcl_SimilarPosition( const sal_Int32 nPos1, const sal_Int32 nPos2 )
diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx
index 07fe504f9b9a..a47c59d71209 100644
--- a/sw/source/core/view/pagepreviewlayout.cxx
+++ b/sw/source/core/view/pagepreviewlayout.cxx
@@ -867,6 +867,8 @@ void SwPagePreviewLayout::CalcStartValuesForSelectedPageMove(
_orNewStartPos = aNewStartPos;
}
+namespace {
+
/** checks, if given position is inside a shown document page */
struct PreviewPosInsidePagePred
{
@@ -885,6 +887,8 @@ struct PreviewPosInsidePagePred
}
};
+}
+
bool SwPagePreviewLayout::IsPreviewPosInDocPreviewPage( const Point& rPreviewPos,
Point& _orDocPos,
bool& _obPosInEmptyPage,
@@ -1302,6 +1306,8 @@ void SwPagePreviewLayout::MarkNewSelectedPage( const sal_uInt16 _nSelectedPage )
// helper methods
+namespace {
+
/** get preview page by physical page number
OD 17.12.2002 #103492#
@@ -1318,6 +1324,8 @@ struct EqualsPageNumPred
}
};
+}
+
const PreviewPage* SwPagePreviewLayout::GetPreviewPageByPageNum( const sal_uInt16 _nPageNum ) const
{
auto aFoundPreviewPageIter =
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index 8f0600d59a1d..7828ad97adf1 100644
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -90,6 +90,8 @@ public:
SwQueuedPaint *SwPaintQueue::s_pPaintQueue = nullptr;
+namespace {
+
// saves some settings from the draw view
class SwDrawViewSave
{
@@ -100,6 +102,8 @@ public:
~SwDrawViewSave();
};
+}
+
void SwPaintQueue::Add( SwViewShell *pNew, const SwRect &rNew )
{
SwQueuedPaint *pPt;