sw: prefix members of SwFmDrawPage, SwNumRule, SwTableAutoFormat and ...

... WriterSpecificAutoFormatBlock

See tdf#94879 for motivation.

Change-Id: Ie740f07e1c65a6def6ba673529144d0e111b056e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100610
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Miklos Vajna
2020-08-12 17:43:59 +02:00
parent 50c6fba059
commit 29eaf5c012
7 changed files with 49 additions and 50 deletions

View File

@@ -105,11 +105,11 @@ public:
private: private:
friend void FinitCore(); friend void FinitCore();
static SwNumFormat* maBaseFormats [ RULE_END ][ MAXLEVEL ]; static SwNumFormat* saBaseFormats [ RULE_END ][ MAXLEVEL ];
static const sal_uInt16 maDefNumIndents[ MAXLEVEL ]; static const sal_uInt16 saDefNumIndents[ MAXLEVEL ];
/// default list level properties for position-and-space mode LABEL_ALIGNMENT /// default list level properties for position-and-space mode LABEL_ALIGNMENT
static SwNumFormat* maLabelAlignmentBaseFormats [ RULE_END ][ MAXLEVEL ]; static SwNumFormat* saLabelAlignmentBaseFormats [ RULE_END ][ MAXLEVEL ];
static sal_uInt16 mnRefCount; static sal_uInt16 snRefCount;
std::unique_ptr<SwNumFormat> maFormats[ MAXLEVEL ]; std::unique_ptr<SwNumFormat> maFormats[ MAXLEVEL ];

View File

@@ -153,7 +153,7 @@ class SW_DLLPUBLIC SwTableAutoFormat
{ {
friend class SwDocTest; friend class SwDocTest;
friend void FinitCore(); // To destroy default pointer. friend void FinitCore(); // To destroy default pointer.
static SwBoxAutoFormat* pDfltBoxAutoFormat; static SwBoxAutoFormat* s_pDefaultBoxAutoFormat;
css::uno::WeakReference<css::uno::XInterface> m_wXObject; css::uno::WeakReference<css::uno::XInterface> m_wXObject;

View File

@@ -43,7 +43,7 @@ class SwXShape;
class SwFmDrawPage final : public SvxFmDrawPage class SwFmDrawPage final : public SvxFmDrawPage
{ {
SdrPageView* pPageView; SdrPageView* m_pPageView;
std::vector<SwXShape*> m_vShapes; std::vector<SwXShape*> m_vShapes;
public: public:
SwFmDrawPage( SdrPage* pPage ); SwFmDrawPage( SdrPage* pPage );

View File

@@ -681,7 +681,7 @@ void FinitCore()
delete pCaseCollator; delete pCaseCollator;
// destroy default TableAutoFormat // destroy default TableAutoFormat
delete SwTableAutoFormat::pDfltBoxAutoFormat; delete SwTableAutoFormat::s_pDefaultBoxAutoFormat;
delete SwSelPaintRects::s_pMapMode; delete SwSelPaintRects::s_pMapMode;
delete SwFntObj::pPixMap; delete SwFntObj::pPixMap;

View File

@@ -57,14 +57,14 @@
using namespace ::com::sun::star; using namespace ::com::sun::star;
sal_uInt16 SwNumRule::mnRefCount = 0; sal_uInt16 SwNumRule::snRefCount = 0;
SwNumFormat* SwNumRule::maBaseFormats[ RULE_END ][ MAXLEVEL ] = { SwNumFormat* SwNumRule::saBaseFormats[ RULE_END ][ MAXLEVEL ] = {
{nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr } }; {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr } };
SwNumFormat* SwNumRule::maLabelAlignmentBaseFormats[ RULE_END ][ MAXLEVEL ] = { SwNumFormat* SwNumRule::saLabelAlignmentBaseFormats[ RULE_END ][ MAXLEVEL ] = {
{nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr } }; {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr } };
const sal_uInt16 SwNumRule::maDefNumIndents[ MAXLEVEL ] = { const sal_uInt16 SwNumRule::saDefNumIndents[ MAXLEVEL ] = {
//inch: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0 //inch: 0,5 1,0 1,5 2,0 2,5 3,0 3,5 4,0 4,5 5,0
1440/4, 1440/2, 1440*3/4, 1440, 1440*5/4, 1440*3/2, 1440*7/4, 1440*2, 1440/4, 1440/2, 1440*3/4, 1440, 1440*5/4, 1440*3/2, 1440*7/4, 1440*2,
1440*9/4, 1440*5/2 1440*9/4, 1440*5/2
@@ -81,8 +81,8 @@ const SwNumFormat& SwNumRule::Get( sal_uInt16 i ) const
return maFormats[ i ] return maFormats[ i ]
? *maFormats[ i ] ? *maFormats[ i ]
: ( meDefaultNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION : ( meDefaultNumberFormatPositionAndSpaceMode == SvxNumberFormat::LABEL_WIDTH_AND_POSITION
? *maBaseFormats[ meRuleType ][ i ] ? *saBaseFormats[ meRuleType ][ i ]
: *maLabelAlignmentBaseFormats[ meRuleType ][ i ] ); : *saLabelAlignmentBaseFormats[ meRuleType ][ i ] );
} }
const SwNumFormat* SwNumRule::GetNumFormat( sal_uInt16 i ) const const SwNumFormat* SwNumRule::GetNumFormat( sal_uInt16 i ) const
@@ -160,13 +160,13 @@ void SwNumRule::SetNumRuleMap(std::unordered_map<OUString, SwNumRule *> *
sal_uInt16 SwNumRule::GetNumIndent( sal_uInt8 nLvl ) sal_uInt16 SwNumRule::GetNumIndent( sal_uInt8 nLvl )
{ {
OSL_ENSURE( MAXLEVEL > nLvl, "NumLevel is out of range" ); OSL_ENSURE( MAXLEVEL > nLvl, "NumLevel is out of range" );
return maDefNumIndents[ nLvl ]; return saDefNumIndents[ nLvl ];
} }
sal_uInt16 SwNumRule::GetBullIndent( sal_uInt8 nLvl ) sal_uInt16 SwNumRule::GetBullIndent( sal_uInt8 nLvl )
{ {
OSL_ENSURE( MAXLEVEL > nLvl, "NumLevel is out of range" ); OSL_ENSURE( MAXLEVEL > nLvl, "NumLevel is out of range" );
return maDefNumIndents[ nLvl ]; return saDefNumIndents[ nLvl ];
} }
static void lcl_SetRuleChgd( SwTextNode& rNd, sal_uInt8 nLevel ) static void lcl_SetRuleChgd( SwTextNode& rNd, sal_uInt8 nLevel )
@@ -371,7 +371,7 @@ SwNumRule::SwNumRule( const OUString& rNm,
meDefaultNumberFormatPositionAndSpaceMode( eDefaultNumberFormatPositionAndSpaceMode ), meDefaultNumberFormatPositionAndSpaceMode( eDefaultNumberFormatPositionAndSpaceMode ),
msDefaultListId() msDefaultListId()
{ {
if( !mnRefCount++ ) // for the first time, initialize if( !snRefCount++ ) // for the first time, initialize
{ {
SwNumFormat* pFormat; SwNumFormat* pFormat;
sal_uInt8 n; sal_uInt8 n;
@@ -387,7 +387,7 @@ SwNumRule::SwNumRule( const OUString& rNm,
pFormat->SetFirstLineOffset( lNumberFirstLineOffset ); pFormat->SetFirstLineOffset( lNumberFirstLineOffset );
pFormat->SetSuffix( "." ); pFormat->SetSuffix( "." );
pFormat->SetBulletChar( numfunc::GetBulletChar(n)); pFormat->SetBulletChar( numfunc::GetBulletChar(n));
SwNumRule::maBaseFormats[ NUM_RULE ][ n ] = pFormat; SwNumRule::saBaseFormats[ NUM_RULE ][ n ] = pFormat;
} }
// position-and-space mode LABEL_ALIGNMENT // position-and-space mode LABEL_ALIGNMENT
// first line indent of general numbering in inch: -0,25 inch // first line indent of general numbering in inch: -0,25 inch
@@ -410,7 +410,7 @@ SwNumRule::SwNumRule( const OUString& rNm,
pFormat->SetIndentAt( cIndentAt[ n ] ); pFormat->SetIndentAt( cIndentAt[ n ] );
pFormat->SetSuffix( "." ); pFormat->SetSuffix( "." );
pFormat->SetBulletChar( numfunc::GetBulletChar(n)); pFormat->SetBulletChar( numfunc::GetBulletChar(n));
SwNumRule::maLabelAlignmentBaseFormats[ NUM_RULE ][ n ] = pFormat; SwNumRule::saLabelAlignmentBaseFormats[ NUM_RULE ][ n ] = pFormat;
} }
// outline: // outline:
@@ -423,7 +423,7 @@ SwNumRule::SwNumRule( const OUString& rNm,
pFormat->SetStart( 1 ); pFormat->SetStart( 1 );
pFormat->SetCharTextDistance( lOutlineMinTextDistance ); pFormat->SetCharTextDistance( lOutlineMinTextDistance );
pFormat->SetBulletChar( numfunc::GetBulletChar(n)); pFormat->SetBulletChar( numfunc::GetBulletChar(n));
SwNumRule::maBaseFormats[ OUTLINE_RULE ][ n ] = pFormat; SwNumRule::saBaseFormats[ OUTLINE_RULE ][ n ] = pFormat;
} }
// position-and-space mode LABEL_ALIGNMENT: // position-and-space mode LABEL_ALIGNMENT:
for( n = 0; n < MAXLEVEL; ++n ) for( n = 0; n < MAXLEVEL; ++n )
@@ -434,7 +434,7 @@ SwNumRule::SwNumRule( const OUString& rNm,
pFormat->SetStart( 1 ); pFormat->SetStart( 1 );
pFormat->SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT ); pFormat->SetPositionAndSpaceMode( SvxNumberFormat::LABEL_ALIGNMENT );
pFormat->SetBulletChar( numfunc::GetBulletChar(n)); pFormat->SetBulletChar( numfunc::GetBulletChar(n));
SwNumRule::maLabelAlignmentBaseFormats[ OUTLINE_RULE ][ n ] = pFormat; SwNumRule::saLabelAlignmentBaseFormats[ OUTLINE_RULE ][ n ] = pFormat;
} }
} }
OSL_ENSURE( !msName.isEmpty(), "NumRule without a name!" ); OSL_ENSURE( !msName.isEmpty(), "NumRule without a name!" );
@@ -459,7 +459,7 @@ SwNumRule::SwNumRule( const SwNumRule& rNumRule )
meDefaultNumberFormatPositionAndSpaceMode( rNumRule.meDefaultNumberFormatPositionAndSpaceMode ), meDefaultNumberFormatPositionAndSpaceMode( rNumRule.meDefaultNumberFormatPositionAndSpaceMode ),
msDefaultListId( rNumRule.msDefaultListId ) msDefaultListId( rNumRule.msDefaultListId )
{ {
++mnRefCount; ++snRefCount;
for( sal_uInt16 n = 0; n < MAXLEVEL; ++n ) for( sal_uInt16 n = 0; n < MAXLEVEL; ++n )
if( rNumRule.maFormats[ n ] ) if( rNumRule.maFormats[ n ] )
Set( n, *rNumRule.maFormats[ n ] ); Set( n, *rNumRule.maFormats[ n ] );
@@ -475,10 +475,10 @@ SwNumRule::~SwNumRule()
mpNumRuleMap->erase(GetName()); mpNumRuleMap->erase(GetName());
} }
if( !--mnRefCount ) // the last one closes the door (?) if( !--snRefCount ) // the last one closes the door (?)
{ {
// Numbering: // Numbering:
SwNumFormat** ppFormats = &SwNumRule::maBaseFormats[0][0]; SwNumFormat** ppFormats = &SwNumRule::saBaseFormats[0][0];
int n; int n;
for( n = 0; n < MAXLEVEL; ++n, ++ppFormats ) for( n = 0; n < MAXLEVEL; ++n, ++ppFormats )
@@ -494,7 +494,7 @@ SwNumRule::~SwNumRule()
*ppFormats = nullptr; *ppFormats = nullptr;
} }
ppFormats = &SwNumRule::maLabelAlignmentBaseFormats[0][0]; ppFormats = &SwNumRule::saLabelAlignmentBaseFormats[0][0];
for( n = 0; n < MAXLEVEL; ++n, ++ppFormats ) for( n = 0; n < MAXLEVEL; ++n, ++ppFormats )
{ {
delete *ppFormats; delete *ppFormats;

View File

@@ -95,7 +95,7 @@ const sal_uInt16 AUTOFORMAT_ID = AUTOFORMAT_ID_31005;
const sal_uInt16 AUTOFORMAT_DATA_ID = AUTOFORMAT_DATA_ID_31005; const sal_uInt16 AUTOFORMAT_DATA_ID = AUTOFORMAT_DATA_ID_31005;
const sal_uInt16 AUTOFORMAT_FILE_VERSION= SOFFICE_FILEFORMAT_50; const sal_uInt16 AUTOFORMAT_FILE_VERSION= SOFFICE_FILEFORMAT_50;
SwBoxAutoFormat* SwTableAutoFormat::pDfltBoxAutoFormat = nullptr; SwBoxAutoFormat* SwTableAutoFormat::s_pDefaultBoxAutoFormat = nullptr;
#define AUTOTABLE_FORMAT_NAME "autotbl.fmt" #define AUTOTABLE_FORMAT_NAME "autotbl.fmt"
@@ -139,21 +139,20 @@ namespace
class WriterSpecificAutoFormatBlock class WriterSpecificAutoFormatBlock
{ {
public: public:
explicit WriterSpecificAutoFormatBlock(SvStream &rStream) : _rStream(rStream), _whereToWriteEndOfBlock(BeginSwBlock(rStream)) explicit WriterSpecificAutoFormatBlock(SvStream& rStream)
: mrStream(rStream)
, mnWhereToWriteEndOfBlock(BeginSwBlock(rStream))
{ {
} }
~WriterSpecificAutoFormatBlock() ~WriterSpecificAutoFormatBlock() { EndSwBlock(mrStream, mnWhereToWriteEndOfBlock); }
{
EndSwBlock(_rStream, _whereToWriteEndOfBlock);
}
private: private:
WriterSpecificAutoFormatBlock(WriterSpecificAutoFormatBlock const&) = delete; WriterSpecificAutoFormatBlock(WriterSpecificAutoFormatBlock const&) = delete;
WriterSpecificAutoFormatBlock& operator=(WriterSpecificAutoFormatBlock const&) = delete; WriterSpecificAutoFormatBlock& operator=(WriterSpecificAutoFormatBlock const&) = delete;
SvStream &_rStream; SvStream& mrStream;
sal_uInt64 _whereToWriteEndOfBlock; sal_uInt64 mnWhereToWriteEndOfBlock;
}; };
/// Checks whether a writer-specific block exists (i.e. size is not zero) /// Checks whether a writer-specific block exists (i.e. size is not zero)
@@ -464,9 +463,9 @@ const SwBoxAutoFormat& SwTableAutoFormat::GetBoxFormat( sal_uInt8 nPos ) const
else // else return the default else // else return the default
{ {
// If it doesn't exist yet: // If it doesn't exist yet:
if( !pDfltBoxAutoFormat ) if( !s_pDefaultBoxAutoFormat )
pDfltBoxAutoFormat = new SwBoxAutoFormat; s_pDefaultBoxAutoFormat = new SwBoxAutoFormat;
return *pDfltBoxAutoFormat; return *s_pDefaultBoxAutoFormat;
} }
} }
@@ -478,19 +477,19 @@ SwBoxAutoFormat& SwTableAutoFormat::GetBoxFormat( sal_uInt8 nPos )
if( !*pFormat ) if( !*pFormat )
{ {
// If default doesn't exist yet: // If default doesn't exist yet:
if( !pDfltBoxAutoFormat ) if( !s_pDefaultBoxAutoFormat )
pDfltBoxAutoFormat = new SwBoxAutoFormat(); s_pDefaultBoxAutoFormat = new SwBoxAutoFormat();
*pFormat = new SwBoxAutoFormat(*pDfltBoxAutoFormat); *pFormat = new SwBoxAutoFormat(*s_pDefaultBoxAutoFormat);
} }
return **pFormat; return **pFormat;
} }
const SwBoxAutoFormat& SwTableAutoFormat::GetDefaultBoxFormat() const SwBoxAutoFormat& SwTableAutoFormat::GetDefaultBoxFormat()
{ {
if(!pDfltBoxAutoFormat) if(!s_pDefaultBoxAutoFormat)
pDfltBoxAutoFormat = new SwBoxAutoFormat(); s_pDefaultBoxAutoFormat = new SwBoxAutoFormat();
return *pDfltBoxAutoFormat; return *s_pDefaultBoxAutoFormat;
} }
void SwTableAutoFormat::UpdateFromSet( sal_uInt8 nPos, void SwTableAutoFormat::UpdateFromSet( sal_uInt8 nPos,
@@ -839,9 +838,9 @@ bool SwTableAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const
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:
if( !pDfltBoxAutoFormat ) if( !s_pDefaultBoxAutoFormat )
pDfltBoxAutoFormat = new SwBoxAutoFormat; s_pDefaultBoxAutoFormat = new SwBoxAutoFormat;
pFormat = pDfltBoxAutoFormat; pFormat = s_pDefaultBoxAutoFormat;
} }
bRet = pFormat->Save( rStream, fileVersion ); bRet = pFormat->Save( rStream, fileVersion );
} }

View File

@@ -249,7 +249,7 @@ public:
}; };
SwFmDrawPage::SwFmDrawPage( SdrPage* pPage ) : SwFmDrawPage::SwFmDrawPage( SdrPage* pPage ) :
SvxFmDrawPage( pPage ), pPageView(nullptr) SvxFmDrawPage( pPage ), m_pPageView(nullptr)
{ {
} }
@@ -274,16 +274,16 @@ void SwFmDrawPage::PreUnGroup(const uno::Reference< drawing::XShapeGroup >& rSh
SdrPageView* SwFmDrawPage::GetPageView() SdrPageView* SwFmDrawPage::GetPageView()
{ {
if(!pPageView) if(!m_pPageView)
pPageView = mpView->ShowSdrPage( mpPage ); m_pPageView = mpView->ShowSdrPage( mpPage );
return pPageView; return m_pPageView;
} }
void SwFmDrawPage::RemovePageView() void SwFmDrawPage::RemovePageView()
{ {
if(pPageView && mpView) if(m_pPageView && mpView)
mpView->HideSdrPage(); mpView->HideSdrPage();
pPageView = nullptr; m_pPageView = nullptr;
} }
uno::Reference<drawing::XShape> SwFmDrawPage::GetShape(SdrObject* pObj) uno::Reference<drawing::XShape> SwFmDrawPage::GetShape(SdrObject* pObj)