Kaydet (Commit) 135ad9ab authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: prefix members of SwLabRec

Change-Id: I5a2f882a51c60229414bc29522d27adbbe37fd62
Reviewed-on: https://gerrit.libreoffice.org/44663Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst e61a1b8d
......@@ -40,31 +40,31 @@
void SwLabRec::SetFromItem( const SwLabItem& rItem )
{
lHDist = rItem.m_lHDist;
lVDist = rItem.m_lVDist;
lWidth = rItem.m_lWidth;
lHeight = rItem.m_lHeight;
lLeft = rItem.m_lLeft;
lUpper = rItem.m_lUpper;
nCols = rItem.m_nCols;
nRows = rItem.m_nRows;
lPWidth = rItem.m_lPWidth;
lPHeight = rItem.m_lPHeight;
bCont = rItem.m_bCont;
m_nHDist = rItem.m_lHDist;
m_nVDist = rItem.m_lVDist;
m_nWidth = rItem.m_lWidth;
m_nHeight = rItem.m_lHeight;
m_nLeft = rItem.m_lLeft;
m_nUpper = rItem.m_lUpper;
m_nCols = rItem.m_nCols;
m_nRows = rItem.m_nRows;
m_nPWidth = rItem.m_lPWidth;
m_nPHeight = rItem.m_lPHeight;
m_bCont = rItem.m_bCont;
}
void SwLabRec::FillItem( SwLabItem& rItem ) const
{
rItem.m_lHDist = lHDist;
rItem.m_lVDist = lVDist;
rItem.m_lWidth = lWidth;
rItem.m_lHeight = lHeight;
rItem.m_lLeft = lLeft;
rItem.m_lUpper = lUpper;
rItem.m_nCols = nCols;
rItem.m_lPWidth = lPWidth;
rItem.m_lPHeight = lPHeight;
rItem.m_nRows = nRows;
rItem.m_lHDist = m_nHDist;
rItem.m_lVDist = m_nVDist;
rItem.m_lWidth = m_nWidth;
rItem.m_lHeight = m_nHeight;
rItem.m_lLeft = m_nLeft;
rItem.m_lUpper = m_nUpper;
rItem.m_nCols = m_nCols;
rItem.m_lPWidth = m_nPWidth;
rItem.m_lPHeight = m_nPHeight;
rItem.m_nRows = m_nRows;
}
void SwLabDlg::ReplaceGroup_( const OUString &rMake )
......@@ -131,15 +131,15 @@ SwLabDlg::SwLabDlg(vcl::Window* pParent, const SfxItemSet& rSet,
// Read user label from writer.cfg
SwLabItem aItem(static_cast<const SwLabItem&>(rSet.Get( FN_LABEL )));
std::unique_ptr<SwLabRec> pRec(new SwLabRec);
pRec->aMake = pRec->aType = SwResId(STR_CUSTOM_LABEL);
pRec->m_aMake = pRec->m_aType = SwResId(STR_CUSTOM_LABEL);
pRec->SetFromItem( aItem );
bool bDouble = false;
for (std::unique_ptr<SwLabRec> & i : *m_pRecs)
{
if (pRec->aMake == i->aMake &&
pRec->aType == i->aType)
if (pRec->m_aMake == i->m_aMake &&
pRec->m_aType == i->m_aType)
{
bDouble = true;
break;
......@@ -208,8 +208,8 @@ SwLabRec* SwLabDlg::GetRecord(const OUString &rRecName, bool bCont)
for (size_t i = 0; i < nCount; ++i)
{
pRec = Recs()[i].get();
if (pRec->aType != sCustom &&
rRecName == pRec->aType && bCont == pRec->bCont)
if (pRec->m_aType != sCustom &&
rRecName == pRec->m_aType && bCont == pRec->m_bCont)
{
bFound = true;
break;
......@@ -382,14 +382,14 @@ IMPL_LINK_NOARG(SwLabPage, MakeHdl, ListBox&, void)
//insert the entries into the sorted list box
for ( size_t i = 0; i < nCount; ++i )
{
const OUString aType(GetParentSwLabDlg()->Recs()[i]->aType);
const OUString aType(GetParentSwLabDlg()->Recs()[i]->m_aType);
bool bInsert = false;
if (GetParentSwLabDlg()->Recs()[i]->aType == sCustom)
if (GetParentSwLabDlg()->Recs()[i]->m_aType == sCustom)
{
bInsert = true;
m_pTypeBox->InsertEntry(aType );
}
else if (GetParentSwLabDlg()->Recs()[i]->bCont == bCont)
else if (GetParentSwLabDlg()->Recs()[i]->m_bCont == bCont)
{
if ( m_pHiddenSortTypeBox->GetEntryPos(aType) == LISTBOX_ENTRY_NOTFOUND )
{
......@@ -431,18 +431,18 @@ void SwLabPage::DisplayFormat()
aField->SetMax (LONG_MAX);
SwLabRec* pRec = GetSelectedEntryPos();
aItem.m_aLstType = pRec->aType;
SETFLDVAL(*aField.get(), pRec->lWidth);
aItem.m_aLstType = pRec->m_aType;
SETFLDVAL(*aField.get(), pRec->m_nWidth);
aField->Reformat();
const OUString aWString = aField->GetText();
SETFLDVAL(*aField.get(), pRec->lHeight);
SETFLDVAL(*aField.get(), pRec->m_nHeight);
aField->Reformat();
OUString aText = pRec->aType + ": " + aWString +
OUString aText = pRec->m_aType + ": " + aWString +
" x " + aField->GetText() +
" (" + OUString::number( pRec->nCols ) +
" x " + OUString::number( pRec->nRows ) + ")";
" (" + OUString::number( pRec->m_nCols ) +
" x " + OUString::number( pRec->m_nRows ) + ")";
m_pFormatInfo->SetText(aText);
}
......
......@@ -505,16 +505,16 @@ void SwLabFormatPage::FillItem(SwLabItem& rItem)
rItem.m_aMake = rItem.m_aType = SwResId(STR_CUSTOM_LABEL);
SwLabRec& rRec = *GetParentSwLabDlg()->Recs()[0];
rItem.m_lHDist = rRec.lHDist = static_cast< long >(GETFLDVAL(*m_pHDistField ));
rItem.m_lVDist = rRec.lVDist = static_cast< long >(GETFLDVAL(*m_pVDistField ));
rItem.m_lWidth = rRec.lWidth = static_cast< long >(GETFLDVAL(*m_pWidthField ));
rItem.m_lHeight = rRec.lHeight = static_cast< long >(GETFLDVAL(*m_pHeightField));
rItem.m_lLeft = rRec.lLeft = static_cast< long >(GETFLDVAL(*m_pLeftField ));
rItem.m_lUpper = rRec.lUpper = static_cast< long >(GETFLDVAL(*m_pUpperField ));
rItem.m_nCols = rRec.nCols = static_cast< sal_Int32 >(m_pColsField->GetValue());
rItem.m_nRows = rRec.nRows = static_cast< sal_Int32 >(m_pRowsField->GetValue());
rItem.m_lPWidth = rRec.lPWidth = static_cast< long >(GETFLDVAL(*m_pPWidthField ));
rItem.m_lPHeight = rRec.lPHeight = static_cast< long >(GETFLDVAL(*m_pPHeightField));
rItem.m_lHDist = rRec.m_nHDist = static_cast< long >(GETFLDVAL(*m_pHDistField ));
rItem.m_lVDist = rRec.m_nVDist = static_cast< long >(GETFLDVAL(*m_pVDistField ));
rItem.m_lWidth = rRec.m_nWidth = static_cast< long >(GETFLDVAL(*m_pWidthField ));
rItem.m_lHeight = rRec.m_nHeight = static_cast< long >(GETFLDVAL(*m_pHeightField));
rItem.m_lLeft = rRec.m_nLeft = static_cast< long >(GETFLDVAL(*m_pLeftField ));
rItem.m_lUpper = rRec.m_nUpper = static_cast< long >(GETFLDVAL(*m_pUpperField ));
rItem.m_nCols = rRec.m_nCols = static_cast< sal_Int32 >(m_pColsField->GetValue());
rItem.m_nRows = rRec.m_nRows = static_cast< sal_Int32 >(m_pRowsField->GetValue());
rItem.m_lPWidth = rRec.m_nPWidth = static_cast< long >(GETFLDVAL(*m_pPWidthField ));
rItem.m_lPHeight = rRec.m_nPHeight = static_cast< long >(GETFLDVAL(*m_pPHeightField));
}
}
......@@ -562,17 +562,17 @@ void SwLabFormatPage::Reset(const SfxItemSet* )
IMPL_LINK_NOARG(SwLabFormatPage, SaveHdl, Button*, void)
{
SwLabRec aRec;
aRec.lHDist = static_cast< long >(GETFLDVAL(*m_pHDistField));
aRec.lVDist = static_cast< long >(GETFLDVAL(*m_pVDistField ));
aRec.lWidth = static_cast< long >(GETFLDVAL(*m_pWidthField ));
aRec.lHeight = static_cast< long >(GETFLDVAL(*m_pHeightField));
aRec.lLeft = static_cast< long >(GETFLDVAL(*m_pLeftField ));
aRec.lUpper = static_cast< long >(GETFLDVAL(*m_pUpperField ));
aRec.nCols = static_cast< sal_Int32 >(m_pColsField->GetValue());
aRec.nRows = static_cast< sal_Int32 >(m_pRowsField->GetValue());
aRec.lPWidth = static_cast< long >(GETFLDVAL(*m_pPWidthField ));
aRec.lPHeight = static_cast< long >(GETFLDVAL(*m_pPHeightField));
aRec.bCont = aItem.m_bCont;
aRec.m_nHDist = static_cast< long >(GETFLDVAL(*m_pHDistField));
aRec.m_nVDist = static_cast< long >(GETFLDVAL(*m_pVDistField ));
aRec.m_nWidth = static_cast< long >(GETFLDVAL(*m_pWidthField ));
aRec.m_nHeight = static_cast< long >(GETFLDVAL(*m_pHeightField));
aRec.m_nLeft = static_cast< long >(GETFLDVAL(*m_pLeftField ));
aRec.m_nUpper = static_cast< long >(GETFLDVAL(*m_pUpperField ));
aRec.m_nCols = static_cast< sal_Int32 >(m_pColsField->GetValue());
aRec.m_nRows = static_cast< sal_Int32 >(m_pRowsField->GetValue());
aRec.m_nPWidth = static_cast< long >(GETFLDVAL(*m_pPWidthField ));
aRec.m_nPHeight = static_cast< long >(GETFLDVAL(*m_pPHeightField));
aRec.m_bCont = aItem.m_bCont;
ScopedVclPtrInstance< SwSaveLabelDlg > pSaveDlg(this, aRec);
pSaveDlg->SetLabel(aItem.m_aLstMake, aItem.m_aLstType);
pSaveDlg->Execute();
......@@ -653,7 +653,7 @@ IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl, Button*, void)
if (RET_YES != aQuery->Execute())
return;
}
rLabRec.aType = sType;
rLabRec.m_aType = sType;
rCfg.SaveLabel(sMake, sType, rLabRec);
bSuccess = true;
EndDialog(RET_OK);
......@@ -670,16 +670,16 @@ bool SwSaveLabelDlg::GetLabel(SwLabItem& rItem)
{
rItem.m_aMake = m_pMakeCB->GetText();
rItem.m_aType = m_pTypeED->GetText();
rItem.m_lHDist = rLabRec.lHDist;
rItem.m_lVDist = rLabRec.lVDist;
rItem.m_lWidth = rLabRec.lWidth;
rItem.m_lHeight = rLabRec.lHeight;
rItem.m_lLeft = rLabRec.lLeft;
rItem.m_lUpper = rLabRec.lUpper;
rItem.m_nCols = rLabRec.nCols;
rItem.m_nRows = rLabRec.nRows;
rItem.m_lPWidth = rLabRec.lPWidth;
rItem.m_lPHeight = rLabRec.lPHeight;
rItem.m_lHDist = rLabRec.m_nHDist;
rItem.m_lVDist = rLabRec.m_nVDist;
rItem.m_lWidth = rLabRec.m_nWidth;
rItem.m_lHeight = rLabRec.m_nHeight;
rItem.m_lLeft = rLabRec.m_nLeft;
rItem.m_lUpper = rLabRec.m_nUpper;
rItem.m_nCols = rLabRec.m_nCols;
rItem.m_nRows = rLabRec.m_nRows;
rItem.m_lPWidth = rLabRec.m_nPWidth;
rItem.m_lPHeight = rLabRec.m_nPHeight;
}
return bSuccess;
}
......
......@@ -177,10 +177,10 @@ void SwLabelConfig::Notify( const css::uno::Sequence< OUString >& ) {}
static std::unique_ptr<SwLabRec> lcl_CreateSwLabRec(const OUString& rType, const OUString& rMeasure, const OUString& rManufacturer)
{
std::unique_ptr<SwLabRec> pNewRec(new SwLabRec);
pNewRec->aMake = rManufacturer;
pNewRec->lPWidth = 0;
pNewRec->lPHeight = 0;
pNewRec->aType = rType;
pNewRec->m_aMake = rManufacturer;
pNewRec->m_nPWidth = 0;
pNewRec->m_nPHeight = 0;
pNewRec->m_aType = rType;
//all values are contained as colon-separated 1/100 mm values
//except for the continuous flag ('C'/'S') and nCols, nRows (sal_Int32)
sal_uInt16 nTokenCount = comphelper::string::getTokenCount(rMeasure, ';');
......@@ -190,25 +190,25 @@ static std::unique_ptr<SwLabRec> lcl_CreateSwLabRec(const OUString& rType, const
int nVal = sToken.toInt32();
switch(i)
{
case 0 : pNewRec->bCont = sToken[0] == 'C'; break;
case 1 : pNewRec->lHDist = convertMm100ToTwip(nVal); break;
case 2 : pNewRec->lVDist = convertMm100ToTwip(nVal); break;
case 3 : pNewRec->lWidth = convertMm100ToTwip(nVal); break;
case 4 : pNewRec->lHeight = convertMm100ToTwip(nVal); break;
case 5 : pNewRec->lLeft = convertMm100ToTwip(nVal); break;
case 6 : pNewRec->lUpper = convertMm100ToTwip(nVal); break;
case 7 : pNewRec->nCols = nVal; break;
case 8 : pNewRec->nRows = nVal; break;
case 9 : pNewRec->lPWidth = convertMm100ToTwip(nVal); break;
case 10 : pNewRec->lPHeight = convertMm100ToTwip(nVal); break;
case 0 : pNewRec->m_bCont = sToken[0] == 'C'; break;
case 1 : pNewRec->m_nHDist = convertMm100ToTwip(nVal); break;
case 2 : pNewRec->m_nVDist = convertMm100ToTwip(nVal); break;
case 3 : pNewRec->m_nWidth = convertMm100ToTwip(nVal); break;
case 4 : pNewRec->m_nHeight = convertMm100ToTwip(nVal); break;
case 5 : pNewRec->m_nLeft = convertMm100ToTwip(nVal); break;
case 6 : pNewRec->m_nUpper = convertMm100ToTwip(nVal); break;
case 7 : pNewRec->m_nCols = nVal; break;
case 8 : pNewRec->m_nRows = nVal; break;
case 9 : pNewRec->m_nPWidth = convertMm100ToTwip(nVal); break;
case 10 : pNewRec->m_nPHeight = convertMm100ToTwip(nVal); break;
}
}
// lines added for compatibility with custom label definitions saved before patch fdo#44516
if (pNewRec->lPWidth == 0 || pNewRec->lPHeight == 0)
if (pNewRec->m_nPWidth == 0 || pNewRec->m_nPHeight == 0)
{
// old style definition (no paper dimensions), calculate probable values
pNewRec->lPWidth = 2 * pNewRec->lLeft + (pNewRec->nCols - 1) * pNewRec->lHDist + pNewRec->lWidth;
pNewRec->lPHeight = ( pNewRec->bCont ? pNewRec->nRows * pNewRec->lVDist : 2 * pNewRec->lUpper + (pNewRec->nRows - 1) * pNewRec->lVDist + pNewRec->lHeight );
pNewRec->m_nPWidth = 2 * pNewRec->m_nLeft + (pNewRec->m_nCols - 1) * pNewRec->m_nHDist + pNewRec->m_nWidth;
pNewRec->m_nPHeight = ( pNewRec->m_bCont ? pNewRec->m_nRows * pNewRec->m_nVDist : 2 * pNewRec->m_nUpper + (pNewRec->m_nRows - 1) * pNewRec->m_nVDist + pNewRec->m_nHeight );
}
return pNewRec;
}
......@@ -226,21 +226,21 @@ static Sequence<PropertyValue> lcl_CreateProperties(
pValues[nProp].Name = pNames[nProp];
switch(nProp)
{
case 0: pValues[nProp].Value <<= rRec.aType; break;
case 0: pValues[nProp].Value <<= rRec.m_aType; break;
case 1:
{
rMeasure.clear();
rMeasure += rRec.bCont ? OUString( "C" ) : OUString( "S" ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.lHDist ) ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.lVDist ) ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.lWidth ) ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.lHeight ) ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.lLeft ) ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.lUpper ) ); rMeasure += sColon;
rMeasure += OUString::number( rRec.nCols ); rMeasure += sColon;
rMeasure += OUString::number( rRec.nRows ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.lPWidth ) ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.lPHeight ) );
rMeasure += rRec.m_bCont ? OUString( "C" ) : OUString( "S" ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.m_nHDist ) ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.m_nVDist ) ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.m_nWidth ) ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.m_nHeight ) ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.m_nLeft ) ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.m_nUpper ) ); rMeasure += sColon;
rMeasure += OUString::number( rRec.m_nCols ); rMeasure += sColon;
rMeasure += OUString::number( rRec.m_nRows ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.m_nPWidth ) ); rMeasure += sColon;
rMeasure += OUString::number( convertTwipToMm100( rRec.m_nPHeight ) );
pValues[nProp].Value <<= rMeasure;
}
break;
......
......@@ -28,24 +28,24 @@ class SwLabItem;
class SwLabRec
{
public:
SwLabRec(): lHDist(0), lVDist(0), lWidth(0), lHeight(0), lLeft(0), lUpper(0), lPWidth(0), lPHeight(0), nCols(0), nRows(0), bCont(false) {}
SwLabRec(): m_nHDist(0), m_nVDist(0), m_nWidth(0), m_nHeight(0), m_nLeft(0), m_nUpper(0), m_nPWidth(0), m_nPHeight(0), m_nCols(0), m_nRows(0), m_bCont(false) {}
void SetFromItem( const SwLabItem& rItem );
void FillItem( SwLabItem& rItem ) const;
OUString aMake;
OUString aType;
long lHDist;
long lVDist;
long lWidth;
long lHeight;
long lLeft;
long lUpper;
long lPWidth;
long lPHeight;
sal_Int32 nCols;
sal_Int32 nRows;
bool bCont;
OUString m_aMake;
OUString m_aType;
long m_nHDist;
long m_nVDist;
long m_nWidth;
long m_nHeight;
long m_nLeft;
long m_nUpper;
long m_nPWidth;
long m_nPHeight;
sal_Int32 m_nCols;
sal_Int32 m_nRows;
bool m_bCont;
};
typedef std::vector<std::unique_ptr<SwLabRec>> SwLabRecs;
......
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