Kaydet (Commit) 6f599126 authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: prefix members of SwTableAutoFormat

Change-Id: I17515ea4e444986f50d554c864540a625a521970
Reviewed-on: https://gerrit.libreoffice.org/66984Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
üst 7545d180
...@@ -247,19 +247,19 @@ class SW_DLLPUBLIC SwTableAutoFormat ...@@ -247,19 +247,19 @@ class SW_DLLPUBLIC SwTableAutoFormat
css::uno::WeakReference<css::uno::XInterface> m_wXObject; css::uno::WeakReference<css::uno::XInterface> m_wXObject;
OUString m_aName; OUString m_aName;
sal_uInt16 nStrResId; sal_uInt16 m_nStrResId;
// Common flags of Calc and Writer. // Common flags of Calc and Writer.
bool bInclFont : 1; bool m_bInclFont : 1;
bool bInclJustify : 1; bool m_bInclJustify : 1;
bool bInclFrame : 1; bool m_bInclFrame : 1;
bool bInclBackground : 1; bool m_bInclBackground : 1;
bool bInclValueFormat : 1; bool m_bInclValueFormat : 1;
// Calc specific flags. // Calc specific flags.
bool bInclWidthHeight : 1; bool m_bInclWidthHeight : 1;
SwBoxAutoFormat* aBoxAutoFormat[ 16 ]; SwBoxAutoFormat* m_aBoxAutoFormat[ 16 ];
// Writer-specific options // Writer-specific options
SvxFormatBreakItem m_aBreak; SvxFormatBreakItem m_aBreak;
...@@ -285,7 +285,7 @@ public: ...@@ -285,7 +285,7 @@ public:
SwBoxAutoFormat& GetBoxFormat( sal_uInt8 nPos ); SwBoxAutoFormat& GetBoxFormat( sal_uInt8 nPos );
static const SwBoxAutoFormat& GetDefaultBoxFormat(); static const SwBoxAutoFormat& GetDefaultBoxFormat();
void SetName( const OUString& rNew ) { m_aName = rNew; nStrResId = USHRT_MAX; } void SetName( const OUString& rNew ) { m_aName = rNew; m_nStrResId = USHRT_MAX; }
const OUString& GetName() const { return m_aName; } const OUString& GetName() const { return m_aName; }
void UpdateFromSet( sal_uInt8 nPos, const SfxItemSet& rSet, void UpdateFromSet( sal_uInt8 nPos, const SfxItemSet& rSet,
...@@ -296,23 +296,23 @@ public: ...@@ -296,23 +296,23 @@ public:
void RestoreTableProperties(SwTable &table) const; void RestoreTableProperties(SwTable &table) const;
void StoreTableProperties(const SwTable &table); void StoreTableProperties(const SwTable &table);
bool IsFont() const { return bInclFont; } bool IsFont() const { return m_bInclFont; }
bool IsJustify() const { return bInclJustify; } bool IsJustify() const { return m_bInclJustify; }
bool IsFrame() const { return bInclFrame; } bool IsFrame() const { return m_bInclFrame; }
bool IsBackground() const { return bInclBackground; } bool IsBackground() const { return m_bInclBackground; }
bool IsValueFormat() const { return bInclValueFormat; } bool IsValueFormat() const { return m_bInclValueFormat; }
/// Check if style is hidden. /// Check if style is hidden.
bool IsHidden() const { return m_bHidden; } bool IsHidden() const { return m_bHidden; }
/// Check if style is defined by user. /// Check if style is defined by user.
bool IsUserDefined() const { return m_bUserDefined; } bool IsUserDefined() const { return m_bUserDefined; }
void SetFont( const bool bNew ) { bInclFont = bNew; } void SetFont( const bool bNew ) { m_bInclFont = bNew; }
void SetJustify( const bool bNew ) { bInclJustify = bNew; } void SetJustify( const bool bNew ) { m_bInclJustify = bNew; }
void SetFrame( const bool bNew ) { bInclFrame = bNew; } void SetFrame( const bool bNew ) { m_bInclFrame = bNew; }
void SetBackground( const bool bNew ) { bInclBackground = bNew; } void SetBackground( const bool bNew ) { m_bInclBackground = bNew; }
void SetValueFormat( const bool bNew ) { bInclValueFormat = bNew; } void SetValueFormat( const bool bNew ) { m_bInclValueFormat = bNew; }
void SetWidthHeight( const bool bNew ) { bInclWidthHeight = bNew; } void SetWidthHeight( const bool bNew ) { m_bInclWidthHeight = bNew; }
/// Set if style is hidden. /// Set if style is hidden.
void SetHidden(bool bHidden) { m_bHidden = bHidden; } void SetHidden(bool bHidden) { m_bHidden = bHidden; }
......
...@@ -1354,19 +1354,19 @@ void SwDocTest::testTableAutoFormats() ...@@ -1354,19 +1354,19 @@ void SwDocTest::testTableAutoFormats()
aTableAF.m_aShadow = aShadow; aTableAF.m_aShadow = aShadow;
//Set bInclFont //Set bInclFont
bool aIFont = false; bool aIFont = false;
aTableAF.bInclFont = aIFont; aTableAF.m_bInclFont = aIFont;
//Set bInclJustify //Set bInclJustify
bool aIJustify = false; bool aIJustify = false;
aTableAF.bInclJustify = aIJustify; aTableAF.m_bInclJustify = aIJustify;
//Set bInclFrame //Set bInclFrame
bool aIFrame = false; bool aIFrame = false;
aTableAF.bInclFrame = aIFrame; aTableAF.m_bInclFrame = aIFrame;
//Set bInclBackground //Set bInclBackground
bool aIBackground = false; bool aIBackground = false;
aTableAF.bInclBackground = aIBackground; aTableAF.m_bInclBackground = aIBackground;
//Set bInclValueFormat //Set bInclValueFormat
bool aIVFormat = false; bool aIVFormat = false;
aTableAF.bInclValueFormat = aIVFormat; aTableAF.m_bInclValueFormat = aIVFormat;
//set the box format to AutoFormat //set the box format to AutoFormat
aTableAF.SetBoxFormat( aBoxAF, sal_uInt8(0) ); aTableAF.SetBoxFormat( aBoxAF, sal_uInt8(0) );
...@@ -1492,15 +1492,15 @@ void SwDocTest::testTableAutoFormats() ...@@ -1492,15 +1492,15 @@ void SwDocTest::testTableAutoFormats()
//Get m_aShadow //Get m_aShadow
CPPUNIT_ASSERT( bool( pLoadAF->m_aShadow == aShadow ) ); CPPUNIT_ASSERT( bool( pLoadAF->m_aShadow == aShadow ) );
//Get bInclFont //Get bInclFont
CPPUNIT_ASSERT( bool( pLoadAF->bInclFont == aIFont ) ); CPPUNIT_ASSERT( bool( pLoadAF->m_bInclFont == aIFont ) );
//Get bInclJustify //Get bInclJustify
CPPUNIT_ASSERT( bool( pLoadAF->bInclJustify == aIJustify ) ); CPPUNIT_ASSERT( bool( pLoadAF->m_bInclJustify == aIJustify ) );
//Get bInclFrame //Get bInclFrame
CPPUNIT_ASSERT( bool( pLoadAF->bInclFrame == aIFrame ) ); CPPUNIT_ASSERT( bool( pLoadAF->m_bInclFrame == aIFrame ) );
//Get bInclBackground //Get bInclBackground
CPPUNIT_ASSERT( bool( pLoadAF->bInclBackground == aIBackground ) ); CPPUNIT_ASSERT( bool( pLoadAF->m_bInclBackground == aIBackground ) );
//Get bInclValueFormat //Get bInclValueFormat
CPPUNIT_ASSERT( bool( pLoadAF->bInclValueFormat == aIVFormat ) ); CPPUNIT_ASSERT( bool( pLoadAF->m_bInclValueFormat == aIVFormat ) );
} }
static OUString static OUString
......
...@@ -598,7 +598,7 @@ void SwBoxAutoFormat::SaveVersionNo( SvStream& rStream, sal_uInt16 fileVersion ) ...@@ -598,7 +598,7 @@ void SwBoxAutoFormat::SaveVersionNo( SvStream& rStream, sal_uInt16 fileVersion )
SwTableAutoFormat::SwTableAutoFormat( const OUString& rName ) SwTableAutoFormat::SwTableAutoFormat( const OUString& rName )
: m_aName( rName ) : m_aName( rName )
, nStrResId( USHRT_MAX ) , m_nStrResId( USHRT_MAX )
, m_aBreak( SvxBreak::NONE, RES_BREAK ) , m_aBreak( SvxBreak::NONE, RES_BREAK )
, m_aKeepWithNextPara( false, RES_KEEP ) , m_aKeepWithNextPara( false, RES_KEEP )
, m_aRepeatHeading( 0 ) , m_aRepeatHeading( 0 )
...@@ -609,14 +609,14 @@ SwTableAutoFormat::SwTableAutoFormat( const OUString& rName ) ...@@ -609,14 +609,14 @@ SwTableAutoFormat::SwTableAutoFormat( const OUString& rName )
, m_bHidden( false ) , m_bHidden( false )
, m_bUserDefined( true ) , m_bUserDefined( true )
{ {
bInclFont = true; m_bInclFont = true;
bInclJustify = true; m_bInclJustify = true;
bInclFrame = true; m_bInclFrame = true;
bInclBackground = true; m_bInclBackground = true;
bInclValueFormat = true; m_bInclValueFormat = true;
bInclWidthHeight = true; m_bInclWidthHeight = true;
memset( aBoxAutoFormat, 0, sizeof( aBoxAutoFormat ) ); memset( m_aBoxAutoFormat, 0, sizeof( m_aBoxAutoFormat ) );
} }
SwTableAutoFormat::SwTableAutoFormat( const SwTableAutoFormat& rNew ) SwTableAutoFormat::SwTableAutoFormat( const SwTableAutoFormat& rNew )
...@@ -624,7 +624,7 @@ SwTableAutoFormat::SwTableAutoFormat( const SwTableAutoFormat& rNew ) ...@@ -624,7 +624,7 @@ SwTableAutoFormat::SwTableAutoFormat( const SwTableAutoFormat& rNew )
, m_aKeepWithNextPara( false, RES_KEEP ) , m_aKeepWithNextPara( false, RES_KEEP )
, m_aShadow( RES_SHADOW ) , m_aShadow( RES_SHADOW )
{ {
for(SwBoxAutoFormat* & rp : aBoxAutoFormat) for(SwBoxAutoFormat* & rp : m_aBoxAutoFormat)
rp = nullptr; rp = nullptr;
*this = rNew; *this = rNew;
} }
...@@ -636,24 +636,24 @@ SwTableAutoFormat& SwTableAutoFormat::operator=( const SwTableAutoFormat& rNew ) ...@@ -636,24 +636,24 @@ SwTableAutoFormat& SwTableAutoFormat::operator=( const SwTableAutoFormat& rNew )
for( sal_uInt8 n = 0; n < 16; ++n ) for( sal_uInt8 n = 0; n < 16; ++n )
{ {
if( aBoxAutoFormat[ n ] ) if( m_aBoxAutoFormat[ n ] )
delete aBoxAutoFormat[ n ]; delete m_aBoxAutoFormat[ n ];
SwBoxAutoFormat* pFormat = rNew.aBoxAutoFormat[ n ]; SwBoxAutoFormat* pFormat = rNew.m_aBoxAutoFormat[ n ];
if( pFormat ) // if is set -> copy if( pFormat ) // if is set -> copy
aBoxAutoFormat[ n ] = new SwBoxAutoFormat( *pFormat ); m_aBoxAutoFormat[ n ] = new SwBoxAutoFormat( *pFormat );
else // else default else // else default
aBoxAutoFormat[ n ] = nullptr; m_aBoxAutoFormat[ n ] = nullptr;
} }
m_aName = rNew.m_aName; m_aName = rNew.m_aName;
nStrResId = rNew.nStrResId; m_nStrResId = rNew.m_nStrResId;
bInclFont = rNew.bInclFont; m_bInclFont = rNew.m_bInclFont;
bInclJustify = rNew.bInclJustify; m_bInclJustify = rNew.m_bInclJustify;
bInclFrame = rNew.bInclFrame; m_bInclFrame = rNew.m_bInclFrame;
bInclBackground = rNew.bInclBackground; m_bInclBackground = rNew.m_bInclBackground;
bInclValueFormat = rNew.bInclValueFormat; m_bInclValueFormat = rNew.m_bInclValueFormat;
bInclWidthHeight = rNew.bInclWidthHeight; m_bInclWidthHeight = rNew.m_bInclWidthHeight;
m_aBreak = rNew.m_aBreak; m_aBreak = rNew.m_aBreak;
m_aPageDesc = rNew.m_aPageDesc; m_aPageDesc = rNew.m_aPageDesc;
...@@ -671,7 +671,7 @@ SwTableAutoFormat& SwTableAutoFormat::operator=( const SwTableAutoFormat& rNew ) ...@@ -671,7 +671,7 @@ SwTableAutoFormat& SwTableAutoFormat::operator=( const SwTableAutoFormat& rNew )
SwTableAutoFormat::~SwTableAutoFormat() SwTableAutoFormat::~SwTableAutoFormat()
{ {
SwBoxAutoFormat** ppFormat = aBoxAutoFormat; SwBoxAutoFormat** ppFormat = m_aBoxAutoFormat;
for( sal_uInt8 n = 0; n < 16; ++n, ++ppFormat ) for( sal_uInt8 n = 0; n < 16; ++n, ++ppFormat )
if( *ppFormat ) if( *ppFormat )
delete *ppFormat; delete *ppFormat;
...@@ -681,18 +681,18 @@ void SwTableAutoFormat::SetBoxFormat( const SwBoxAutoFormat& rNew, sal_uInt8 nPo ...@@ -681,18 +681,18 @@ void SwTableAutoFormat::SetBoxFormat( const SwBoxAutoFormat& rNew, sal_uInt8 nPo
{ {
OSL_ENSURE( nPos < 16, "wrong area" ); OSL_ENSURE( nPos < 16, "wrong area" );
SwBoxAutoFormat* pFormat = aBoxAutoFormat[ nPos ]; SwBoxAutoFormat* pFormat = m_aBoxAutoFormat[ nPos ];
if( pFormat ) // if is set -> copy if( pFormat ) // if is set -> copy
*aBoxAutoFormat[ nPos ] = rNew; *m_aBoxAutoFormat[ nPos ] = rNew;
else // else set anew else // else set anew
aBoxAutoFormat[ nPos ] = new SwBoxAutoFormat( rNew ); m_aBoxAutoFormat[ nPos ] = new SwBoxAutoFormat( rNew );
} }
const SwBoxAutoFormat& SwTableAutoFormat::GetBoxFormat( sal_uInt8 nPos ) const const SwBoxAutoFormat& SwTableAutoFormat::GetBoxFormat( sal_uInt8 nPos ) const
{ {
OSL_ENSURE( nPos < 16, "wrong area" ); OSL_ENSURE( nPos < 16, "wrong area" );
SwBoxAutoFormat* pFormat = aBoxAutoFormat[ nPos ]; SwBoxAutoFormat* pFormat = m_aBoxAutoFormat[ nPos ];
if( pFormat ) // if is set -> copy if( pFormat ) // if is set -> copy
return *pFormat; return *pFormat;
else // else return the default else // else return the default
...@@ -708,7 +708,7 @@ SwBoxAutoFormat& SwTableAutoFormat::GetBoxFormat( sal_uInt8 nPos ) ...@@ -708,7 +708,7 @@ SwBoxAutoFormat& SwTableAutoFormat::GetBoxFormat( sal_uInt8 nPos )
{ {
SAL_WARN_IF(!(nPos < 16), "sw.core", "GetBoxFormat wrong area"); SAL_WARN_IF(!(nPos < 16), "sw.core", "GetBoxFormat wrong area");
SwBoxAutoFormat** pFormat = &aBoxAutoFormat[ nPos ]; SwBoxAutoFormat** pFormat = &m_aBoxAutoFormat[ nPos ];
if( !*pFormat ) if( !*pFormat )
{ {
// If default doesn't exist yet: // If default doesn't exist yet:
...@@ -734,11 +734,11 @@ void SwTableAutoFormat::UpdateFromSet( sal_uInt8 nPos, ...@@ -734,11 +734,11 @@ void SwTableAutoFormat::UpdateFromSet( sal_uInt8 nPos,
{ {
OSL_ENSURE( nPos < 16, "wrong area" ); OSL_ENSURE( nPos < 16, "wrong area" );
SwBoxAutoFormat* pFormat = aBoxAutoFormat[ nPos ]; SwBoxAutoFormat* pFormat = m_aBoxAutoFormat[ nPos ];
if( !pFormat ) // if is set -> copy if( !pFormat ) // if is set -> copy
{ {
pFormat = new SwBoxAutoFormat; pFormat = new SwBoxAutoFormat;
aBoxAutoFormat[ nPos ] = pFormat; m_aBoxAutoFormat[ nPos ] = pFormat;
} }
if( SwTableAutoFormatUpdateFlags::Char & eFlags ) if( SwTableAutoFormatUpdateFlags::Char & eFlags )
...@@ -980,23 +980,23 @@ bool SwTableAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions ) ...@@ -980,23 +980,23 @@ bool SwTableAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions )
m_aName = rStream.ReadUniOrByteString( eCharSet ); m_aName = rStream.ReadUniOrByteString( eCharSet );
if( AUTOFORMAT_DATA_ID_552 <= nVal ) if( AUTOFORMAT_DATA_ID_552 <= nVal )
{ {
rStream.ReadUInt16( nStrResId ); rStream.ReadUInt16( m_nStrResId );
// start from 3d because default is added via constructor // start from 3d because default is added via constructor
sal_uInt16 nId = RES_POOLTABLESTYLE_3D + nStrResId; sal_uInt16 nId = RES_POOLTABLESTYLE_3D + m_nStrResId;
if( RES_POOLTABLESTYLE_3D <= nId && if( RES_POOLTABLESTYLE_3D <= nId &&
nId < RES_POOLTABSTYLE_END ) nId < RES_POOLTABSTYLE_END )
{ {
m_aName = SwStyleNameMapper::GetUIName(nId, m_aName); m_aName = SwStyleNameMapper::GetUIName(nId, m_aName);
} }
else else
nStrResId = USHRT_MAX; m_nStrResId = USHRT_MAX;
} }
rStream.ReadCharAsBool( b ); bInclFont = b; rStream.ReadCharAsBool( b ); m_bInclFont = b;
rStream.ReadCharAsBool( b ); bInclJustify = b; rStream.ReadCharAsBool( b ); m_bInclJustify = b;
rStream.ReadCharAsBool( b ); bInclFrame = b; rStream.ReadCharAsBool( b ); m_bInclFrame = b;
rStream.ReadCharAsBool( b ); bInclBackground = b; rStream.ReadCharAsBool( b ); m_bInclBackground = b;
rStream.ReadCharAsBool( b ); bInclValueFormat = b; rStream.ReadCharAsBool( b ); m_bInclValueFormat = b;
rStream.ReadCharAsBool( b ); bInclWidthHeight = b; rStream.ReadCharAsBool( b ); m_bInclWidthHeight = b;
if (nVal >= AUTOFORMAT_DATA_ID_31005 && WriterSpecificBlockExists(rStream)) if (nVal >= AUTOFORMAT_DATA_ID_31005 && WriterSpecificBlockExists(rStream))
{ {
...@@ -1018,7 +1018,7 @@ bool SwTableAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions ) ...@@ -1018,7 +1018,7 @@ bool SwTableAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions )
SwBoxAutoFormat* pFormat = new SwBoxAutoFormat; SwBoxAutoFormat* pFormat = new SwBoxAutoFormat;
bRet = pFormat->Load( rStream, rVersions, nVal ); bRet = pFormat->Load( rStream, rVersions, nVal );
if( bRet ) if( bRet )
aBoxAutoFormat[ i ] = pFormat; m_aBoxAutoFormat[ i ] = pFormat;
else else
{ {
delete pFormat; delete pFormat;
...@@ -1036,13 +1036,13 @@ bool SwTableAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const ...@@ -1036,13 +1036,13 @@ bool SwTableAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
// --- from 680/dr25 on: store strings as UTF-8 // --- from 680/dr25 on: store strings as UTF-8
write_uInt16_lenPrefixed_uInt8s_FromOUString(rStream, m_aName, write_uInt16_lenPrefixed_uInt8s_FromOUString(rStream, m_aName,
RTL_TEXTENCODING_UTF8 ); RTL_TEXTENCODING_UTF8 );
rStream.WriteUInt16( nStrResId ); rStream.WriteUInt16( m_nStrResId );
rStream.WriteBool( bInclFont ); rStream.WriteBool( m_bInclFont );
rStream.WriteBool( bInclJustify ); rStream.WriteBool( m_bInclJustify );
rStream.WriteBool( bInclFrame ); rStream.WriteBool( m_bInclFrame );
rStream.WriteBool( bInclBackground ); rStream.WriteBool( m_bInclBackground );
rStream.WriteBool( bInclValueFormat ); rStream.WriteBool( m_bInclValueFormat );
rStream.WriteBool( bInclWidthHeight ); rStream.WriteBool( m_bInclWidthHeight );
{ {
WriterSpecificAutoFormatBlock block(rStream); WriterSpecificAutoFormatBlock block(rStream);
...@@ -1058,7 +1058,7 @@ bool SwTableAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const ...@@ -1058,7 +1058,7 @@ bool SwTableAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
for( int i = 0; bRet && i < 16; ++i ) for( int i = 0; bRet && i < 16; ++i )
{ {
SwBoxAutoFormat* pFormat = aBoxAutoFormat[ i ]; SwBoxAutoFormat* pFormat = m_aBoxAutoFormat[ i ];
if( !pFormat ) // if not set -> write default if( !pFormat ) // if not set -> write default
{ {
// If it doesn't exist yet: // If it doesn't exist yet:
...@@ -1075,7 +1075,7 @@ OUString SwTableAutoFormat::GetTableTemplateCellSubName(const SwBoxAutoFormat& r ...@@ -1075,7 +1075,7 @@ OUString SwTableAutoFormat::GetTableTemplateCellSubName(const SwBoxAutoFormat& r
{ {
sal_Int32 nIndex = 0; sal_Int32 nIndex = 0;
for (; nIndex < 16; ++nIndex) for (; nIndex < 16; ++nIndex)
if (aBoxAutoFormat[nIndex] == &rBoxFormat) break; if (m_aBoxAutoFormat[nIndex] == &rBoxFormat) break;
// box format doesn't belong to this table format // box format doesn't belong to this table format
if (16 <= nIndex) if (16 <= nIndex)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment