diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2014-12-17 15:47:01 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2014-12-17 16:39:33 +0100 |
commit | 0f5e9170248df98ef7c7c6d475ff7d2bb9fa2214 (patch) | |
tree | 484d55e20e414c16202163b766fdd87777ebb46d /sw/source/ui | |
parent | 0ba6360363fb73b5b200bbc486ed8eeac5f3d337 (diff) |
Introduce rtl::OUStringLiteral1
...to use single ASCII character literals "more directly" in the OUString API
(instead of having to go via an intermediary OUString ctor call). Especially
useful for character literals that are defined as const variables or via macros
("direct" uses of character literals in the OUString API can often simply be
replaced with single-character string literals, for improved readability).
(The functions overloaded for OUStringLiteral1 are those that are actually used
by the existing LO code; more could potentially be added. The asymmetry in the
operator ==/!= parameter types is by design, though---writing code like
'x' == s
is an abomination that shall not be abetted.)
Change-Id: Ic5264714be7439eed56b5dfca6ccaee277306f1f
Diffstat (limited to 'sw/source/ui')
-rw-r--r-- | sw/source/ui/dbui/dbinsdlg.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dialog/ascfldlg.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/frmdlg.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/index/cnttab.cxx | 12 | ||||
-rw-r--r-- | sw/source/ui/index/swuiidxmrk.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/misc/glosbib.cxx | 8 | ||||
-rw-r--r-- | sw/source/ui/misc/glossary.cxx | 12 | ||||
-rw-r--r-- | sw/source/ui/vba/vbalisthelper.cxx | 88 |
8 files changed, 64 insertions, 64 deletions
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 4bbcd590f175..e25749690afc 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -573,7 +573,7 @@ IMPL_LINK( SwInsertDBColAutoPilot, TblToFromHdl, Button*, pButton ) // first delete the existing selection aStr = aStr.replaceAt( nPos, nSel, "" ); - aFld = OUString(cDBFldStart) + aFld + OUString(cDBFldEnd); + aFld = OUStringLiteral1<cDBFldStart>() + aFld + OUStringLiteral1<cDBFldEnd>(); if( !aStr.isEmpty() ) { if( nPos ) // one blank in front diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index 90d09a5476a4..f097f0f89903 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -277,7 +277,7 @@ void SwAsciiFilterDlg::FillOptions( SwAsciiOptions& rOptions ) if( -1 != nEnd ) GetExtraData() = GetExtraData().replaceAt( nStt, nEnd - nStt + 1, "" ); } - GetExtraData() += sFindNm + sData + OUString(cDialogExtraDataClose); + GetExtraData() += sFindNm + sData + OUStringLiteral1<cDialogExtraDataClose>(); } } diff --git a/sw/source/ui/frmdlg/frmdlg.cxx b/sw/source/ui/frmdlg/frmdlg.cxx index 94f5b90ed8ae..fbea5bf60151 100644 --- a/sw/source/ui/frmdlg/frmdlg.cxx +++ b/sw/source/ui/frmdlg/frmdlg.cxx @@ -82,7 +82,7 @@ SwFrmDlg::SwFrmDlg( SfxViewFrame* pViewFrame, if(pStr) { - SetText(GetText() + SW_RESSTR(STR_COLL_HEADER) + *pStr + OUString(')')); + SetText(GetText() + SW_RESSTR(STR_COLL_HEADER) + *pStr + ")"); } m_nStdId = AddTabPage("type", SwFrmPage::Create, 0); diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 1703860b10d9..8bf0653b43d4 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -3536,9 +3536,9 @@ void SwTOXStylesTabPage::ActivatePage( const SfxItemSet& ) OUString aStr( SW_RES( STR_TITLE )); if( !m_pCurrentForm->GetTemplate( 0 ).isEmpty() ) { - aStr += " " + OUString(aDeliStart) + aStr += " " + OUStringLiteral1<aDeliStart>() + m_pCurrentForm->GetTemplate( 0 ) - + OUString(aDeliEnd); + + OUStringLiteral1<aDeliEnd>(); } m_pLevelLB->InsertEntry(aStr); @@ -3556,9 +3556,9 @@ void SwTOXStylesTabPage::ActivatePage( const SfxItemSet& ) } if( !m_pCurrentForm->GetTemplate( i ).isEmpty() ) { - aStr += " " + OUString(aDeliStart) + aStr += " " + OUStringLiteral1<aDeliStart>() + m_pCurrentForm->GetTemplate( i ) - + OUString(aDeliEnd); + + OUStringLiteral1<aDeliEnd>(); } m_pLevelLB->InsertEntry( aStr ); } @@ -3622,9 +3622,9 @@ IMPL_LINK_NOARG(SwTOXStylesTabPage, AssignHdl) nTemplPos != LISTBOX_ENTRY_NOTFOUND) { const OUString aStr(m_pLevelLB->GetEntry(nLevPos).getToken(0, aDeliStart) - + " " + OUString(aDeliStart) + + " " + OUStringLiteral1<aDeliStart>() + m_pParaLayLB->GetSelectEntry() - + OUString(aDeliEnd)); + + OUStringLiteral1<aDeliEnd>()); m_pCurrentForm->SetTemplate(nLevPos, m_pParaLayLB->GetSelectEntry()); diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index e70c697e8013..6e76ef318c5f 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -1214,7 +1214,7 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl) OUString sFields; for(int i = 0; i < AUTH_FIELD_END; i++) { - sFields += m_sFields[i] + OUString(TOX_STYLE_DELIMITER); + sFields += m_sFields[i] + OUStringLiteral1<TOX_STYLE_DELIMITER>(); } if(bNewEntry) { diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx index 6f93bc1e30ae..ca1eff0631ad 100644 --- a/sw/source/ui/misc/glosbib.cxx +++ b/sw/source/ui/misc/glosbib.cxx @@ -198,7 +198,7 @@ IMPL_LINK( SwGlossaryGroupDlg, SelectHdl, SvTabListBox*, EMPTYARG ) IMPL_LINK_NOARG(SwGlossaryGroupDlg, NewHdl) { OUString sGroup = m_pNameED->GetText() - + OUString(GLOS_DELIM) + + OUStringLiteral1<GLOS_DELIM>() + OUString::number(m_pPathLB->GetSelectEntryPos()); OSL_ENSURE(!pGlosHdl->FindGroupName(sGroup), "group already available!"); m_InsertedArr.push_back(sGroup); @@ -274,7 +274,7 @@ IMPL_LINK_NOARG(SwGlossaryGroupDlg, RenameHdl) const OUString sNewTitle(m_pNameED->GetText()); OUString sNewName = sNewTitle - + OUString(GLOS_DELIM) + + OUStringLiteral1<GLOS_DELIM>() + OUString::number(m_pPathLB->GetSelectEntryPos()); OSL_ENSURE(!pGlosHdl->FindGroupName(sNewName), "group already available!"); @@ -293,8 +293,8 @@ IMPL_LINK_NOARG(SwGlossaryGroupDlg, RenameHdl) } if(!bDone) { - sEntry += OUString(RENAME_TOKEN_DELIM) + sNewName - + OUString(RENAME_TOKEN_DELIM) + sNewTitle; + sEntry += OUStringLiteral1<RENAME_TOKEN_DELIM>() + sNewName + + OUStringLiteral1<RENAME_TOKEN_DELIM>() + sNewTitle; m_RenamedArr.push_back(sEntry); } delete (GlosBibUserData*)pEntry->GetUserData(); diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 2b9a3d536b13..db6123318cb7 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -245,7 +245,7 @@ IMPL_LINK( SwGlossaryDlg, GrpSelect, SvTreeListBox *, pBox ) SvTreeListEntry* pParent = pBox->GetParent(pEntry) ? pBox->GetParent(pEntry) : pEntry; GroupUserData* pGroupData = (GroupUserData*)pParent->GetUserData(); ::SetCurrGlosGroup(pGroupData->sGroupName - + OUString(GLOS_DELIM) + + OUStringLiteral1<GLOS_DELIM>() + OUString::number(pGroupData->nPathIdx)); pGlossaryHdl->SetCurGroup(::GetCurrGlosGroup()); // set current text block @@ -629,7 +629,7 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl) { GroupUserData* pGroupData = (GroupUserData*)pEntry->GetUserData(); const OUString sGroup = pGroupData->sGroupName - + OUString(GLOS_DELIM) + + OUStringLiteral1<GLOS_DELIM>() + OUString::number(pGroupData->nPathIdx); if(sGroup == sNewGroup) { @@ -901,7 +901,7 @@ DragDropMode SwGlTreeListBox::NotifyStartDrag( GroupUserData* pGroupData = (GroupUserData*)pParent->GetUserData(); OUString sEntry = pGroupData->sGroupName - + OUString(GLOS_DELIM) + + OUStringLiteral1<GLOS_DELIM>() + OUString::number(pGroupData->nPathIdx); sal_Int8 nDragOption = DND_ACTION_COPY; eRet = SV_DRAGDROP_CTRL_COPY; @@ -966,7 +966,7 @@ TriState SwGlTreeListBox::NotifyCopyingOrMoving( GroupUserData* pGroupData = (GroupUserData*)pSrcParent->GetUserData(); OUString sSourceGroup = pGroupData->sGroupName - + OUString(GLOS_DELIM) + + OUStringLiteral1<GLOS_DELIM>() + OUString::number(pGroupData->nPathIdx); pDlg->pGlossaryHdl->SetCurGroup(sSourceGroup); @@ -975,7 +975,7 @@ TriState SwGlTreeListBox::NotifyCopyingOrMoving( GroupUserData* pDestData = (GroupUserData*)pDestParent->GetUserData(); OUString sDestName = pDestData->sGroupName - + OUString(GLOS_DELIM) + + OUStringLiteral1<GLOS_DELIM>() + OUString::number(pDestData->nPathIdx); bRet = pDlg->pGlossaryHdl->CopyOrMove( sSourceGroup, sShortName, @@ -1001,7 +1001,7 @@ OUString SwGlossaryDlg::GetCurrGrpName() const pEntry = m_pCategoryBox->GetParent(pEntry) ? m_pCategoryBox->GetParent(pEntry) : pEntry; GroupUserData* pGroupData = (GroupUserData*)pEntry->GetUserData(); - return pGroupData->sGroupName + OUString(GLOS_DELIM) + OUString::number(pGroupData->nPathIdx); + return pGroupData->sGroupName + OUStringLiteral1<GLOS_DELIM>() + OUString::number(pGroupData->nPathIdx); } return OUString(); } diff --git a/sw/source/ui/vba/vbalisthelper.cxx b/sw/source/ui/vba/vbalisthelper.cxx index 542302e0ccc0..2cec7b34bcbf 100644 --- a/sw/source/ui/vba/vbalisthelper.cxx +++ b/sw/source/ui/vba/vbalisthelper.cxx @@ -151,7 +151,7 @@ void SwVbaListHelper::CreateBulletListTemplate() throw( css::uno::RuntimeExcepti } case 2: { - aBulletChar = OUString( sal_Unicode( CHAR_EMPTY_DOT ) ); + aBulletChar = OUStringLiteral1<CHAR_EMPTY_DOT>(); break; } case 3: @@ -204,43 +204,43 @@ void SwVbaListHelper::CreateNumberListTemplate() throw( css::uno::RuntimeExcepti case 1: { nNumberingType = style::NumberingType::ARABIC; - sSuffix = OUString( '.' ); + sSuffix = "."; break; } case 2: { nNumberingType = style::NumberingType::ARABIC; - sSuffix = OUString( ')' ); + sSuffix = ")"; break; } case 3: { nNumberingType = style::NumberingType::ROMAN_UPPER; - sSuffix = OUString( '.' ); + sSuffix = "."; break; } case 4: { nNumberingType = style::NumberingType::CHARS_UPPER_LETTER; - sSuffix = OUString( '.' ); + sSuffix = "."; break; } case 5: { nNumberingType = style::NumberingType::CHARS_LOWER_LETTER; - sSuffix = OUString( ')' ); + sSuffix = ")"; break; } case 6: { nNumberingType = style::NumberingType::CHARS_LOWER_LETTER; - sSuffix = OUString( '.' ); + sSuffix = "."; break; } case 7: { nNumberingType = style::NumberingType::ROMAN_LOWER; - sSuffix = OUString( '.' ); + sSuffix = "."; break; } default: @@ -319,56 +319,56 @@ void SwVbaListHelper::CreateOutlineNumberForType1() throw( css::uno::RuntimeExce { nNumberingType = style::NumberingType::ARABIC; sPrefix.clear(); - sSuffix = OUString( ')' ); + sSuffix = ")"; break; } case 2: { nNumberingType = style::NumberingType::ROMAN_LOWER; sPrefix.clear(); - sSuffix = OUString( ')' ); + sSuffix = ")"; break; } case 3: { nNumberingType = style::NumberingType::ARABIC; - sPrefix = OUString( '(' ); - sSuffix = OUString( ')' ); + sPrefix = "("; + sSuffix = ")"; break; } case 4: { nNumberingType = style::NumberingType::CHARS_LOWER_LETTER; - sPrefix = OUString( '(' ); - sSuffix = OUString( ')' ); + sPrefix = "("; + sSuffix = ")"; break; } case 5: { nNumberingType = style::NumberingType::ROMAN_LOWER; - sPrefix = OUString( '(' ); - sSuffix = OUString( ')' ); + sPrefix = "("; + sSuffix = ")"; break; } case 6: { nNumberingType = style::NumberingType::ARABIC; sPrefix.clear(); - sSuffix = OUString( '.' ); + sSuffix = "."; break; } case 7: { nNumberingType = style::NumberingType::CHARS_LOWER_LETTER; sPrefix.clear(); - sSuffix = OUString( '.' ); + sSuffix = "."; break; } case 8: { nNumberingType = style::NumberingType::ROMAN_LOWER; sPrefix.clear(); - sSuffix = OUString( '.' ); + sSuffix = "."; break; } } @@ -465,14 +465,14 @@ void SwVbaListHelper::CreateOutlineNumberForType4() throw( css::uno::RuntimeExce { nNumberingType = style::NumberingType::ROMAN_UPPER; sPrefix.clear(); - sSuffix = OUString( '.' ); + sSuffix = "."; break; } case 1: { nNumberingType = style::NumberingType::ARABIC; sPrefix.clear(); - sSuffix = OUString( '.' ); + sSuffix = "."; sal_Int16 nParentNumbering = 0; setOrAppendPropertyValue( aPropertyValues, OUString(UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) ); break; @@ -480,50 +480,50 @@ void SwVbaListHelper::CreateOutlineNumberForType4() throw( css::uno::RuntimeExce case 2: { nNumberingType = style::NumberingType::CHARS_LOWER_LETTER; - sPrefix = OUString( '(' ); - sSuffix = OUString( ')' ); + sPrefix = "("; + sSuffix = ")"; break; } case 3: { nNumberingType = style::NumberingType::ROMAN_LOWER; - sPrefix = OUString( '(' ); - sSuffix = OUString( ')' ); + sPrefix = "("; + sSuffix = ")"; break; } case 4: { nNumberingType = style::NumberingType::ARABIC; sPrefix.clear(); - sSuffix = OUString( ')' ); + sSuffix = ")"; break; } case 5: { nNumberingType = style::NumberingType::CHARS_LOWER_LETTER; sPrefix.clear(); - sSuffix = OUString( ')' ); + sSuffix = ")"; break; } case 6: { nNumberingType = style::NumberingType::ROMAN_LOWER; sPrefix.clear(); - sSuffix = OUString( ')' ); + sSuffix = ")"; break; } case 7: { nNumberingType = style::NumberingType::CHARS_LOWER_LETTER; sPrefix.clear(); - sSuffix = OUString( '.' ); + sSuffix = "."; break; } case 8: { nNumberingType = style::NumberingType::ROMAN_LOWER; sPrefix.clear(); - sSuffix = OUString( '.' ); + sSuffix = "."; break; } } @@ -569,63 +569,63 @@ void SwVbaListHelper::CreateOutlineNumberForType6() throw( css::uno::RuntimeExce { nNumberingType = style::NumberingType::ROMAN_UPPER; sPrefix.clear(); - sSuffix = OUString( '.' ); + sSuffix = "."; break; } case 1: { nNumberingType = style::NumberingType::CHARS_UPPER_LETTER; sPrefix.clear(); - sSuffix = OUString( '.' ); + sSuffix = "."; break; } case 2: { nNumberingType = style::NumberingType::ARABIC; sPrefix.clear(); - sSuffix = OUString( ')' ); + sSuffix = ")"; break; } case 3: { nNumberingType = style::NumberingType::CHARS_LOWER_LETTER; sPrefix.clear(); - sSuffix = OUString( ')' ); + sSuffix = ")"; break; } case 4: { nNumberingType = style::NumberingType::ARABIC; - sPrefix = OUString( '(' ); - sSuffix = OUString( ')' ); + sPrefix = "("; + sSuffix = ")"; break; } case 5: { nNumberingType = style::NumberingType::CHARS_LOWER_LETTER; - sPrefix = OUString( '(' ); - sSuffix = OUString( ')' ); + sPrefix = "("; + sSuffix = ")"; break; } case 6: { nNumberingType = style::NumberingType::ROMAN_LOWER; - sPrefix = OUString( '(' ); - sSuffix = OUString( ')' ); + sPrefix = "("; + sSuffix = ")"; break; } case 7: { nNumberingType = style::NumberingType::CHARS_LOWER_LETTER; - sPrefix = OUString( '(' ); - sSuffix = OUString( '.' ); + sPrefix = "("; + sSuffix = "."; break; } case 8: { nNumberingType = style::NumberingType::ROMAN_LOWER; - sPrefix = OUString( '(' ); - sSuffix = OUString( '.' ); + sPrefix = "("; + sSuffix = "."; break; } } |