[Libreoffice-commits] core.git: 4 commits - sw/inc sw/source
Michael Stahl
mstahl at redhat.com
Tue Apr 21 11:45:16 PDT 2015
sw/inc/fldbas.hxx | 47 +++++++++--------
sw/source/core/fields/fldbas.cxx | 101 ++++++++++++++++++--------------------
sw/source/uibase/fldui/fldmgr.cxx | 6 +-
sw/source/uibase/utlui/initui.cxx | 2
4 files changed, 79 insertions(+), 77 deletions(-)
New commits:
commit d6d5a22b43f8610f67a4b5924d7d12a82cbdd2c9
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Apr 21 17:43:22 2015 +0200
sw: assert that SwField::m_pType is not null
Change-Id: Ifb59810b11db05f4fbbd815ff00efc70cfac03af
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index f2132be..f2d34ad 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -198,7 +198,7 @@ SwField::SwField(
, m_nFormat( nFormat )
, m_pType( pType )
{
- OSL_ENSURE( pType, "SwField: no SwFieldType" );
+ assert(m_pType);
}
SwField::~SwField()
@@ -210,7 +210,7 @@ SwField::~SwField()
#ifdef DBG_UTIL
sal_uInt16 SwField::Which() const
{
- OSL_ENSURE(m_pType, "SwField: No FieldType");
+ assert(m_pType);
return m_pType->Which();
}
#endif
@@ -346,8 +346,7 @@ bool SwField::PutValue( const uno::Any& rVal, sal_uInt16 nWhichId )
*/
SwFieldType* SwField::ChgTyp( SwFieldType* pNewType )
{
- OSL_ENSURE( pNewType && pNewType->Which() == m_pType->Which(),
- "no or different type" );
+ assert(pNewType && pNewType->Which() == m_pType->Which());
SwFieldType* pOld = m_pType;
m_pType = pNewType;
commit bbc1fc161d1f6aeb476970aa04534bd5480e757c
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Apr 21 17:41:03 2015 +0200
sw: prefix members of SwValueFieldType/SwValueField/SwFormulaField
Change-Id: Ibadb4fb3a56c271bb045790ea0544bfa35b327b6
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 8cc63af..cc365ed 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -381,19 +381,20 @@ inline sal_uInt16 SwField::GetLanguage() const
/// Fields containing values that have to be formatted via number formatter.
class SwValueFieldType : public SwFieldType
{
- SwDoc* pDoc;
- bool bUseFormat; ///< Use number formatter.
+private:
+ SwDoc* m_pDoc;
+ bool m_bUseFormat; ///< Use number formatter.
protected:
SwValueFieldType( SwDoc* pDocPtr, sal_uInt16 nWhichId );
SwValueFieldType( const SwValueFieldType& rTyp );
public:
- inline SwDoc* GetDoc() const { return pDoc; }
- inline void SetDoc(SwDoc* pNewDoc) { pDoc = pNewDoc; }
+ inline SwDoc* GetDoc() const { return m_pDoc; }
+ inline void SetDoc(SwDoc* pNewDoc) { m_pDoc = pNewDoc; }
- inline bool UseFormat() const { return bUseFormat; }
- inline void EnableFormat(bool bFormat = true) { bUseFormat = bFormat; }
+ inline bool UseFormat() const { return m_bUseFormat; }
+ inline void EnableFormat(bool bFormat = true) { m_bUseFormat = bFormat; }
OUString ExpandValue(const double& rVal, sal_uInt32 nFmt, sal_uInt16 nLng=0) const;
OUString DoubleToString(const double &rVal, LanguageType eLng) const;
@@ -402,7 +403,8 @@ public:
class SW_DLLPUBLIC SwValueField : public SwField
{
- double fValue;
+private:
+ double m_fValue;
protected:
SwValueField( SwValueFieldType* pFldType, sal_uInt32 nFmt = 0, sal_uInt16 nLang = LANGUAGE_SYSTEM, const double fVal = 0.0 );
@@ -427,7 +429,8 @@ public:
class SW_DLLPUBLIC SwFormulaField : public SwValueField
{
- OUString sFormula;
+private:
+ OUString m_sFormula;
protected:
SwFormulaField( SwValueFieldType* pFldType, sal_uInt32 nFmt = 0, const double fVal = 0.0 );
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index a9e6b71..f2132be 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -466,17 +466,17 @@ OUString FormatNumber(sal_uInt32 nNum, sal_uInt32 nFormat)
return aNumber.GetNumStr(nNum);
}
-SwValueFieldType::SwValueFieldType( SwDoc* pDocPtr, sal_uInt16 nWhichId )
- : SwFieldType(nWhichId),
- pDoc(pDocPtr),
- bUseFormat(true)
+SwValueFieldType::SwValueFieldType(SwDoc *const pDoc, sal_uInt16 const nWhichId)
+ : SwFieldType(nWhichId)
+ , m_pDoc(pDoc)
+ , m_bUseFormat(true)
{
}
SwValueFieldType::SwValueFieldType( const SwValueFieldType& rTyp )
- : SwFieldType(rTyp.Which()),
- pDoc(rTyp.GetDoc()),
- bUseFormat(rTyp.UseFormat())
+ : SwFieldType(rTyp.Which())
+ , m_pDoc(rTyp.GetDoc())
+ , m_bUseFormat(rTyp.UseFormat())
{
}
@@ -488,7 +488,7 @@ OUString SwValueFieldType::ExpandValue( const double& rVal,
return SwViewShell::GetShellRes()->aCalc_Error;
OUString sExpand;
- SvNumberFormatter* pFormatter = pDoc->GetNumberFormatter();
+ SvNumberFormatter* pFormatter = m_pDoc->GetNumberFormatter();
Color* pCol = 0;
// Bug #60010
@@ -535,7 +535,7 @@ OUString SwValueFieldType::ExpandValue( const double& rVal,
OUString SwValueFieldType::DoubleToString(const double &rVal,
sal_uInt32 nFmt) const
{
- SvNumberFormatter* pFormatter = pDoc->GetNumberFormatter();
+ SvNumberFormatter* pFormatter = m_pDoc->GetNumberFormatter();
const SvNumberformat* pEntry = pFormatter->GetEntry(nFmt);
if (!pEntry)
@@ -547,7 +547,7 @@ OUString SwValueFieldType::DoubleToString(const double &rVal,
OUString SwValueFieldType::DoubleToString( const double &rVal,
sal_uInt16 nLng ) const
{
- SvNumberFormatter* pFormatter = pDoc->GetNumberFormatter();
+ SvNumberFormatter* pFormatter = m_pDoc->GetNumberFormatter();
// Bug #60010
if( nLng == LANGUAGE_NONE )
@@ -560,14 +560,14 @@ OUString SwValueFieldType::DoubleToString( const double &rVal,
SwValueField::SwValueField( SwValueFieldType* pFldType, sal_uInt32 nFmt,
sal_uInt16 nLng, const double fVal )
- : SwField(pFldType, nFmt, nLng),
- fValue(fVal)
+ : SwField(pFldType, nFmt, nLng)
+ , m_fValue(fVal)
{
}
SwValueField::SwValueField( const SwValueField& rFld )
- : SwField(rFld),
- fValue(rFld.GetValue())
+ : SwField(rFld)
+ , m_fValue(rFld.GetValue())
{
}
@@ -675,12 +675,12 @@ void SwValueField::SetLanguage( sal_uInt16 nLng )
double SwValueField::GetValue() const
{
- return fValue;
+ return m_fValue;
}
void SwValueField::SetValue( const double& rVal )
{
- fValue = rVal;
+ m_fValue = rVal;
}
SwFormulaField::SwFormulaField( SwValueFieldType* pFldType, sal_uInt32 nFmt, const double fVal)
@@ -696,12 +696,12 @@ SwFormulaField::SwFormulaField( const SwFormulaField& rFld )
OUString SwFormulaField::GetFormula() const
{
- return sFormula;
+ return m_sFormula;
}
void SwFormulaField::SetFormula(const OUString& rStr)
{
- sFormula = rStr;
+ m_sFormula = rStr;
sal_uLong nFmt(GetFormat());
@@ -728,11 +728,11 @@ void SwFormulaField::SetExpandedFormula( const OUString& rStr )
{
SwValueField::SetValue(fTmpValue);
- sFormula = static_cast<SwValueFieldType *>(GetTyp())->DoubleToString(fTmpValue, nFmt);
+ m_sFormula = static_cast<SwValueFieldType *>(GetTyp())->DoubleToString(fTmpValue, nFmt);
return;
}
}
- sFormula = rStr;
+ m_sFormula = rStr;
}
OUString SwFormulaField::GetExpandedFormula() const
commit 824229a55e5f5bf0e7bd8e2917635175c9c82dc4
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Apr 21 17:32:10 2015 +0200
sw: prefix members of SwField
Change-Id: If81d5a2ab499837f9e4a38665b0daf2a6bba1269
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 61cf2b5..8cc63af 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -284,17 +284,17 @@ private:
mutable OUString m_Cache; ///< Cached expansion (for clipboard).
bool m_bUseFieldValueCache; /// control the usage of the cached field value
- sal_uInt16 nLang; ///< Always change via SetLanguage!
- bool bIsAutomaticLanguage;
- sal_uInt32 nFormat;
+ sal_uInt16 m_nLang; ///< Always change via SetLanguage!
+ bool m_bIsAutomaticLanguage;
+ sal_uInt32 m_nFormat;
- SwFieldType* pType;
+ SwFieldType* m_pType;
virtual OUString Expand() const = 0;
virtual SwField* Copy() const = 0;
protected:
- void SetFormat(sal_uInt32 nSet) {nFormat = nSet;}
+ void SetFormat(sal_uInt32 const nSet) { m_nFormat = nSet; }
SwField( SwFieldType* pTyp,
sal_uInt32 nFmt = 0,
@@ -331,7 +331,7 @@ public:
#ifdef DBG_UTIL
; // implemented in fldbas.cxx
#else
- { return pType->Which(); }
+ { return m_pType->Which(); }
#endif
// TYP_ID
@@ -361,8 +361,8 @@ public:
bool HasClickHdl() const;
bool IsFixed() const;
- bool IsAutomaticLanguage() const { return bIsAutomaticLanguage;}
- void SetAutomaticLanguage(bool bSet){bIsAutomaticLanguage = bSet;}
+ bool IsAutomaticLanguage() const { return m_bIsAutomaticLanguage;}
+ void SetAutomaticLanguage(bool const bSet) {m_bIsAutomaticLanguage = bSet;}
virtual OUString GetDescription() const;
/// Is this field clickable?
@@ -370,13 +370,13 @@ public:
};
inline SwFieldType* SwField::GetTyp() const
- { return pType; }
+ { return m_pType; }
inline sal_uInt32 SwField::GetFormat() const
- { return nFormat; }
+ { return m_nFormat; }
inline sal_uInt16 SwField::GetLanguage() const
- { return nLang; }
+ { return m_nLang; }
/// Fields containing values that have to be formatted via number formatter.
class SwValueFieldType : public SwFieldType
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index beec78f..a9e6b71 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -187,18 +187,18 @@ void SwFldTypes::dumpAsXml(xmlTextWriterPtr pWriter) const
// Base class for all fields.
// A field (multiple can exist) references a field type (can exists only once)
SwField::SwField(
- SwFieldType* pTyp,
- sal_uInt32 nFmt,
- sal_uInt16 nLng,
- bool bUseFieldValueCache )
+ SwFieldType* pType,
+ sal_uInt32 nFormat,
+ sal_uInt16 nLang,
+ bool bUseFieldValueCache)
: m_Cache()
, m_bUseFieldValueCache( bUseFieldValueCache )
- , nLang( nLng )
- , bIsAutomaticLanguage( true )
- , nFormat( nFmt )
- , pType( pTyp )
+ , m_nLang( nLang )
+ , m_bIsAutomaticLanguage( true )
+ , m_nFormat( nFormat )
+ , m_pType( pType )
{
- OSL_ENSURE( pTyp, "SwField: no SwFieldType" );
+ OSL_ENSURE( pType, "SwField: no SwFieldType" );
}
SwField::~SwField()
@@ -210,8 +210,8 @@ SwField::~SwField()
#ifdef DBG_UTIL
sal_uInt16 SwField::Which() const
{
- OSL_ENSURE(pType, "SwField: No FieldType");
- return pType->Which();
+ OSL_ENSURE(m_pType, "SwField: No FieldType");
+ return m_pType->Which();
}
#endif
@@ -219,7 +219,7 @@ sal_uInt16 SwField::GetTypeId() const
{
sal_uInt16 nRet;
- switch( pType->Which() )
+ switch (m_pType->Which())
{
case RES_DATETIMEFLD:
if (GetSubType() & FIXEDFLD)
@@ -255,7 +255,7 @@ sal_uInt16 SwField::GetTypeId() const
break;
default:
- nRet = aTypeTab[ pType->Which() ];
+ nRet = aTypeTab[ m_pType->Which() ];
}
return nRet;
}
@@ -312,7 +312,7 @@ bool SwField::QueryValue( uno::Any& rVal, sal_uInt16 nWhichId ) const
switch( nWhichId )
{
case FIELD_PROP_BOOL4:
- rVal <<= !bIsAutomaticLanguage;
+ rVal <<= !m_bIsAutomaticLanguage;
break;
default:
OSL_FAIL("illegal property");
@@ -328,7 +328,7 @@ bool SwField::PutValue( const uno::Any& rVal, sal_uInt16 nWhichId )
{
bool bFixed = false;
if(rVal >>= bFixed)
- bIsAutomaticLanguage = !bFixed;
+ m_bIsAutomaticLanguage = !bFixed;
}
break;
default:
@@ -346,11 +346,11 @@ bool SwField::PutValue( const uno::Any& rVal, sal_uInt16 nWhichId )
*/
SwFieldType* SwField::ChgTyp( SwFieldType* pNewType )
{
- OSL_ENSURE( pNewType && pNewType->Which() == pType->Which(),
+ OSL_ENSURE( pNewType && pNewType->Which() == m_pType->Which(),
"no or different type" );
- SwFieldType* pOld = pType;
- pType = pNewType;
+ SwFieldType* pOld = m_pType;
+ m_pType = pNewType;
return pOld;
}
@@ -358,7 +358,7 @@ SwFieldType* SwField::ChgTyp( SwFieldType* pNewType )
bool SwField::HasClickHdl() const
{
bool bRet = false;
- switch( pType->Which() )
+ switch (m_pType->Which())
{
case RES_INTERNETFLD:
case RES_JUMPEDITFLD:
@@ -376,20 +376,20 @@ bool SwField::HasClickHdl() const
return bRet;
}
-void SwField::SetLanguage(sal_uInt16 nLng)
+void SwField::SetLanguage(sal_uInt16 const nLang)
{
- nLang = nLng;
+ m_nLang = nLang;
}
-void SwField::ChangeFormat(sal_uInt32 n)
+void SwField::ChangeFormat(sal_uInt32 const nFormat)
{
- nFormat = n;
+ m_nFormat = nFormat;
}
bool SwField::IsFixed() const
{
bool bRet = false;
- switch( pType->Which() )
+ switch (m_pType->Which())
{
case RES_FIXDATEFLD:
case RES_FIXTIMEFLD:
commit 84a6758609fc9472c7cb5a2e449860bcc554ed58
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Apr 21 17:23:34 2015 +0200
sw: prefix members of SwFieldType
Change-Id: Ib07a3c15cb48998d0acb5bfae4e902a2d729b648
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index c5967c6..61cf2b5 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -237,10 +237,10 @@ class SW_DLLPUBLIC SwFieldType : public SwModify
::com::sun::star::uno::WeakReference<
::com::sun::star::beans::XPropertySet> m_wXFieldMaster;
- sal_uInt16 nWhich;
+ sal_uInt16 m_nWhich;
friend void _FinitUI(); ///< In order to delete pointer!
- static std::vector<OUString>* pFldNames;
+ static std::vector<OUString>* s_pFldNames;
static void _GetFldName(); ///< Sets up FldNames; fldmgr.cxx!
@@ -265,7 +265,7 @@ public:
virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const;
virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich );
- sal_uInt16 Which() const { return nWhich; }
+ sal_uInt16 Which() const { return m_nWhich; }
inline void UpdateFlds() const;
};
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index dc0e6d5..beec78f 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -73,7 +73,7 @@ static sal_uInt16 lcl_GetLanguageOfFormat( sal_uInt16 nLng, sal_uLong nFmt,
// Globals
/// field names
-std::vector<OUString>* SwFieldType::pFldNames = 0;
+std::vector<OUString>* SwFieldType::s_pFldNames = nullptr;
namespace
{
@@ -125,18 +125,18 @@ namespace
OUString SwFieldType::GetTypeStr(sal_uInt16 nTypeId)
{
- if( !pFldNames )
+ if (!s_pFldNames)
_GetFldName();
- if( nTypeId < SwFieldType::pFldNames->size() )
- return (*SwFieldType::pFldNames)[nTypeId];
+ if (nTypeId < SwFieldType::s_pFldNames->size())
+ return (*SwFieldType::s_pFldNames)[nTypeId];
return OUString();
}
// each field refences a field type that is unique for each document
SwFieldType::SwFieldType( sal_uInt16 nWhichId )
- : SwModify(0),
- nWhich( nWhichId )
+ : SwModify(nullptr)
+ , m_nWhich(nWhichId)
{
}
diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx
index 18483c6..7d4420a 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -1604,12 +1604,12 @@ void SwFieldType::_GetFldName()
};
// insert infos for fields
- SwFieldType::pFldNames = new std::vector<OUString>;
- SwFieldType::pFldNames->reserve(SAL_N_ELEMENTS(coFldNms));
+ SwFieldType::s_pFldNames = new std::vector<OUString>;
+ SwFieldType::s_pFldNames->reserve(SAL_N_ELEMENTS(coFldNms));
for( sal_uInt16 nIdx = 0; nIdx < SAL_N_ELEMENTS(coFldNms); ++nIdx )
{
const OUString aTmp(SW_RES( coFldNms[ nIdx ] ));
- SwFieldType::pFldNames->push_back(MnemonicGenerator::EraseAllMnemonicChars( aTmp ));
+ SwFieldType::s_pFldNames->push_back(MnemonicGenerator::EraseAllMnemonicChars( aTmp ));
}
}
diff --git a/sw/source/uibase/utlui/initui.cxx b/sw/source/uibase/utlui/initui.cxx
index 94d7a8d..1874455 100644
--- a/sw/source/uibase/utlui/initui.cxx
+++ b/sw/source/uibase/utlui/initui.cxx
@@ -155,7 +155,7 @@ void _FinitUI()
DELETEZ(pGlossaries);
- delete SwFieldType::pFldNames;
+ delete SwFieldType::s_pFldNames;
ClearStringCache();
delete pGlossaryList;
More information about the Libreoffice-commits
mailing list