Kaydet (Commit) ba88c3ae authored tarafından Matteo Casalin's avatar Matteo Casalin

Reduce OUString temporaries

Change-Id: I7ad78a1d7b544326570abac77122055a9cf3c57c
üst a72ba7b1
...@@ -360,11 +360,7 @@ SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos, ...@@ -360,11 +360,7 @@ SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos,
SwTxtNode* pHeadNd = GetNodes().MakeTxtNode( aIdx, SwTxtNode* pHeadNd = GetNodes().MakeTxtNode( aIdx,
getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) ); getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) );
OUString sNm( pNewSection->GetTOXName() ); SwSectionData headerData( TOX_HEADER_SECTION, pNewSection->GetTOXName()+"_Head" );
// ??Resource
sNm += "_Head";
SwSectionData headerData( TOX_HEADER_SECTION, sNm );
SwNodeIndex aStt( *pHeadNd ); --aIdx; SwNodeIndex aStt( *pHeadNd ); --aIdx;
SwSectionFmt* pSectFmt = MakeSectionFmt( 0 ); SwSectionFmt* pSectFmt = MakeSectionFmt( 0 );
...@@ -393,7 +389,7 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd ...@@ -393,7 +389,7 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( sal_uLong nSttNd, sal_uLong nEndNd
pSectNd = pSectNd->StartOfSectionNode()->FindSectionNode(); pSectNd = pSectNd->StartOfSectionNode()->FindSectionNode();
} }
OUString sSectNm = GetUniqueTOXBaseName(*rTOX.GetTOXType(), rTOX.GetTOXName()); const OUString sSectNm = GetUniqueTOXBaseName(*rTOX.GetTOXType(), rTOX.GetTOXName());
SwSectionData aSectionData( TOX_CONTENT_SECTION, sSectNm ); SwSectionData aSectionData( TOX_CONTENT_SECTION, sSectNm );
...@@ -683,15 +679,14 @@ bool SwDoc::SetTOXBaseName(const SwTOXBase& rTOXBase, const OUString& rName) ...@@ -683,15 +679,14 @@ bool SwDoc::SetTOXBaseName(const SwTOXBase& rTOXBase, const OUString& rName)
"no TOXBaseSection!" ); "no TOXBaseSection!" );
SwTOXBaseSection* pTOX = const_cast<SwTOXBaseSection*>(static_cast<const SwTOXBaseSection*>(&rTOXBase)); SwTOXBaseSection* pTOX = const_cast<SwTOXBaseSection*>(static_cast<const SwTOXBaseSection*>(&rTOXBase));
OUString sTmp = GetUniqueTOXBaseName(*rTOXBase.GetTOXType(), rName); if (GetUniqueTOXBaseName(*rTOXBase.GetTOXType(), rName) == rName)
bool bRet = sTmp == rName;
if(bRet)
{ {
pTOX->SetTOXName(rName); pTOX->SetTOXName(rName);
pTOX->SetSectionName(rName); pTOX->SetSectionName(rName);
getIDocumentState().SetModified(); getIDocumentState().SetModified();
return true;
} }
return bRet; return false;
} }
static const SwTxtNode* lcl_FindChapterNode( const SwNode& rNd, sal_uInt8 nLvl = 0 ) static const SwTxtNode* lcl_FindChapterNode( const SwNode& rNd, sal_uInt8 nLvl = 0 )
...@@ -900,11 +895,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, ...@@ -900,11 +895,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
GetTxtFmtColl( FORM_TITLE ) ); GetTxtFmtColl( FORM_TITLE ) );
pHeadNd->InsertText( GetTitle(), SwIndex( pHeadNd ) ); pHeadNd->InsertText( GetTitle(), SwIndex( pHeadNd ) );
OUString sNm( GetTOXName() ); SwSectionData headerData( TOX_HEADER_SECTION, GetTOXName()+"_Head" );
// ??Resource
sNm += "_Head";
SwSectionData headerData( TOX_HEADER_SECTION, sNm );
SwNodeIndex aStt( *pHeadNd ); --aIdx; SwNodeIndex aStt( *pHeadNd ); --aIdx;
SwSectionFmt* pSectFmt = pDoc->MakeSectionFmt( 0 ); SwSectionFmt* pSectFmt = pDoc->MakeSectionFmt( 0 );
...@@ -1048,7 +1039,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, ...@@ -1048,7 +1039,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
void SwTOXBaseSection::InsertAlphaDelimitter( const SwTOXInternational& rIntl ) void SwTOXBaseSection::InsertAlphaDelimitter( const SwTOXInternational& rIntl )
{ {
SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc(); SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc();
OUString sDeli, sLastDeli; OUString sLastDeli;
SwTOXSortTabBases::size_type i = 0; SwTOXSortTabBases::size_type i = 0;
while( i < aSortArr.size() ) while( i < aSortArr.size() )
{ {
...@@ -1060,7 +1051,7 @@ void SwTOXBaseSection::InsertAlphaDelimitter( const SwTOXInternational& rIntl ) ...@@ -1060,7 +1051,7 @@ void SwTOXBaseSection::InsertAlphaDelimitter( const SwTOXInternational& rIntl )
if( nLevel == FORM_ALPHA_DELIMITTER ) if( nLevel == FORM_ALPHA_DELIMITTER )
continue; continue;
sDeli = rIntl.GetIndexKey( aSortArr[i]->GetTxt(), const OUString sDeli = rIntl.GetIndexKey( aSortArr[i]->GetTxt(),
aSortArr[i]->GetLocale() ); aSortArr[i]->GetLocale() );
// Do we already have a Delimitter? // Do we already have a Delimitter?
...@@ -1239,7 +1230,7 @@ void SwTOXBaseSection::UpdateTemplate( const SwTxtNode* pOwnChapterNode ) ...@@ -1239,7 +1230,7 @@ void SwTOXBaseSection::UpdateTemplate( const SwTxtNode* pOwnChapterNode )
SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc(); SwDoc* pDoc = (SwDoc*)GetFmt()->GetDoc();
for(sal_uInt16 i = 0; i < MAXLEVEL; i++) for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
{ {
OUString sTmpStyleNames = GetStyleNames(i); const OUString sTmpStyleNames = GetStyleNames(i);
sal_uInt16 nTokenCount = comphelper::string::getTokenCount(sTmpStyleNames, TOX_STYLE_DELIMITER); sal_uInt16 nTokenCount = comphelper::string::getTokenCount(sTmpStyleNames, TOX_STYLE_DELIMITER);
for( sal_uInt16 nStyle = 0; nStyle < nTokenCount; ++nStyle ) for( sal_uInt16 nStyle = 0; nStyle < nTokenCount; ++nStyle )
{ {
...@@ -1296,9 +1287,9 @@ void SwTOXBaseSection::UpdateSequence( const SwTxtNode* pOwnChapterNode ) ...@@ -1296,9 +1287,9 @@ void SwTOXBaseSection::UpdateSequence( const SwTxtNode* pOwnChapterNode )
::lcl_FindChapterNode( rTxtNode, 0 ) == pOwnChapterNode ) ) ::lcl_FindChapterNode( rTxtNode, 0 ) == pOwnChapterNode ) )
{ {
const SwSetExpField& rSeqField = dynamic_cast<const SwSetExpField&>(*(pFmtFld->GetField())); const SwSetExpField& rSeqField = dynamic_cast<const SwSetExpField&>(*(pFmtFld->GetField()));
OUString sName = GetSequenceName(); const OUString sName = GetSequenceName()
sName += OUString( cSequenceMarkSeparator ); + OUString( cSequenceMarkSeparator )
sName += OUString::number( rSeqField.GetSeqNumber() ); + OUString::number( rSeqField.GetSeqNumber() );
SwTOXPara * pNew = new SwTOXPara( rTxtNode, nsSwTOXElement::TOX_SEQUENCE, 1, sName ); SwTOXPara * pNew = new SwTOXPara( rTxtNode, nsSwTOXElement::TOX_SEQUENCE, 1, sName );
// set indexes if the number or the reference text are to be displayed // set indexes if the number or the reference text are to be displayed
if( GetCaptionDisplay() == CAPTION_TEXT ) if( GetCaptionDisplay() == CAPTION_TEXT )
......
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