[Libreoffice-commits] .: cui/source forms/source sc/source sd/source tools/inc
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jan 22 03:26:59 PST 2013
cui/source/dialogs/scriptdlg.cxx | 5 +++--
cui/source/options/opthtml.cxx | 14 +++++++-------
forms/source/solar/control/navtoolbar.cxx | 2 +-
sc/source/ui/app/inputwin.cxx | 4 ++--
sc/source/ui/dbgui/dbnamdlg.cxx | 6 +++---
sd/source/ui/dlg/paragr.cxx | 2 +-
tools/inc/tools/string.hxx | 22 ++++++++++++++++++++++
7 files changed, 39 insertions(+), 16 deletions(-)
New commits:
commit fea25896a87aa5826eb243069d34aae7d0333a4c
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon Jan 21 21:42:46 2013 +0100
tools/string.hxx: add operator==/!= for OUString/String
This has the disadvantage that it makes comparisons involving fast
OUString concatenation via operator+ ambiguous, as can be seen in
scriptdlg.cxx, but it allows comparing String and OUString wihout
explicit conversion, which is nice for incrementally converting code.
Change-Id: Ibfc728bdb161a01e0f8311915c97bcbba8b58c0b
Reviewed-on: https://gerrit.libreoffice.org/1803
Reviewed-by: LuboÅ¡ LuÅák <l.lunak at suse.cz>
Tested-by: LuboÅ¡ LuÅák <l.lunak at suse.cz>
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index f4b1e94..944ca6f 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -910,7 +910,7 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry )
}
for( sal_Int32 index = 0; index < childNodes.getLength(); index++ )
{
- if ( (aNewName+extn) == childNodes[index]->getName() )
+ if (OUString(aNewName+extn) == childNodes[index]->getName())
{
bFound = sal_True;
break;
@@ -939,7 +939,8 @@ void SvxScriptOrgDialog::createEntry( SvTreeListEntry* pEntry )
bValid = sal_True;
for( sal_Int32 index = 0; index < childNodes.getLength(); index++ )
{
- if ( (aUserSuppliedName+extn) == childNodes[index]->getName() )
+ if (OUString(aUserSuppliedName+extn)
+ == childNodes[index]->getName())
{
bValid = sal_False;
String aError( m_createErrStr );
diff --git a/cui/source/options/opthtml.cxx b/cui/source/options/opthtml.cxx
index 49a57fc..9993030 100644
--- a/cui/source/options/opthtml.cxx
+++ b/cui/source/options/opthtml.cxx
@@ -111,19 +111,19 @@ SfxTabPage* OfaHtmlTabPage::Create( Window* pParent,
sal_Bool OfaHtmlTabPage::FillItemSet( SfxItemSet& )
{
SvxHtmlOptions& rHtmlOpt = SvxHtmlOptions::Get();
- if(OUString(aSize1NF.GetSavedValue()) != aSize1NF.GetText())
+ if(aSize1NF.GetSavedValue() != aSize1NF.GetText())
rHtmlOpt.SetFontSize(0, (sal_uInt16)aSize1NF.GetValue());
- if(OUString(aSize2NF.GetSavedValue()) != aSize2NF.GetText())
+ if(aSize2NF.GetSavedValue() != aSize2NF.GetText())
rHtmlOpt.SetFontSize(1, (sal_uInt16)aSize2NF.GetValue());
- if(OUString(aSize3NF.GetSavedValue()) != aSize3NF.GetText())
+ if(aSize3NF.GetSavedValue() != aSize3NF.GetText())
rHtmlOpt.SetFontSize(2, (sal_uInt16)aSize3NF.GetValue());
- if(OUString(aSize4NF.GetSavedValue()) != aSize4NF.GetText())
+ if(aSize4NF.GetSavedValue() != aSize4NF.GetText())
rHtmlOpt.SetFontSize(3, (sal_uInt16)aSize4NF.GetValue());
- if(OUString(aSize5NF.GetSavedValue()) != aSize5NF.GetText())
+ if(aSize5NF.GetSavedValue() != aSize5NF.GetText())
rHtmlOpt.SetFontSize(4, (sal_uInt16)aSize5NF.GetValue());
- if(OUString(aSize6NF.GetSavedValue()) != aSize6NF.GetText())
+ if(aSize6NF.GetSavedValue() != aSize6NF.GetText())
rHtmlOpt.SetFontSize(5, (sal_uInt16)aSize6NF.GetValue());
- if(OUString(aSize7NF.GetSavedValue()) != aSize7NF.GetText())
+ if(aSize7NF.GetSavedValue() != aSize7NF.GetText())
rHtmlOpt.SetFontSize(6, (sal_uInt16)aSize7NF.GetValue());
if(aNumbersEnglishUSCB.IsChecked() != aNumbersEnglishUSCB.GetSavedValue())
diff --git a/forms/source/solar/control/navtoolbar.cxx b/forms/source/solar/control/navtoolbar.cxx
index a356a7f..f146a7e 100644
--- a/forms/source/solar/control/navtoolbar.cxx
+++ b/forms/source/solar/control/navtoolbar.cxx
@@ -685,7 +685,7 @@ namespace frm
//---------------------------------------------------------------------
void RecordPositionInput::FirePosition( sal_Bool _bForce )
{
- if ( _bForce || ( GetText() != OUString(GetSavedValue()) ) )
+ if ( _bForce || (GetText() != GetSavedValue()) )
{
sal_Int64 nRecord = GetValue();
if ( nRecord < GetMin() || nRecord > GetMax() )
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 64be1b4..79b71d8 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1373,7 +1373,7 @@ void ScMultiTextWnd::InitEditEngine()
pEditEngine->SetUpdateMode( sal_True );
// aString ist die Wahrheit...
- if ( bFilled && pEditEngine->GetText() == OUString(aString) )
+ if (bFilled && pEditEngine->GetText() == aString)
Invalidate(); // Repaint fuer (hinterlegte) Felder
else
pEditEngine->SetText(aString); // dann wenigstens den richtigen Text
@@ -1754,7 +1754,7 @@ void ScTextWnd::StartEditEngine()
pEditEngine->SetUpdateMode( sal_True );
// aString ist die Wahrheit...
- if ( bFilled && pEditEngine->GetText() == OUString(aString) )
+ if (bFilled && pEditEngine->GetText() == aString)
Invalidate(); // Repaint fuer (hinterlegte) Felder
else
pEditEngine->SetText(aString); // dann wenigstens den richtigen Text
diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx
index 24a1fce..e958bf9 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -601,7 +601,7 @@ IMPL_LINK_NOARG(ScDbNameDlg, NameModifyHdl)
if ( theName.isEmpty() )
{
- if ( aBtnAdd.GetText() != OUString(aStrAdd) )
+ if (aBtnAdd.GetText() != aStrAdd)
aBtnAdd.SetText( aStrAdd );
aBtnAdd .Disable();
aBtnRemove .Disable();
@@ -624,7 +624,7 @@ IMPL_LINK_NOARG(ScDbNameDlg, NameModifyHdl)
{
if ( bNameFound )
{
- if ( aBtnAdd.GetText() != OUString(aStrModify) )
+ if (aBtnAdd.GetText() != aStrModify)
aBtnAdd.SetText( aStrModify );
if(!bSaved)
@@ -636,7 +636,7 @@ IMPL_LINK_NOARG(ScDbNameDlg, NameModifyHdl)
}
else
{
- if ( aBtnAdd.GetText() != OUString(aStrAdd) )
+ if (aBtnAdd.GetText() != aStrAdd)
aBtnAdd.SetText( aStrAdd );
bSaved=false;
diff --git a/sd/source/ui/dlg/paragr.cxx b/sd/source/ui/dlg/paragr.cxx
index 8cb3b77..1029bae 100644
--- a/sd/source/ui/dlg/paragr.cxx
+++ b/sd/source/ui/dlg/paragr.cxx
@@ -97,7 +97,7 @@ sal_Bool SdParagraphNumTabPage::FillItemSet( SfxItemSet& rSet )
{
if(maNewStartCB.GetState() != maNewStartCB.GetSavedValue() ||
maNewStartNumberCB.GetState() != maNewStartNumberCB.GetSavedValue()||
- maNewStartNF.GetText() != OUString(maNewStartNF.GetSavedValue()))
+ maNewStartNF.GetText() != maNewStartNF.GetSavedValue())
{
mbModified = true;
sal_Bool bNewStartChecked = STATE_CHECK == maNewStartCB.GetState();
diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx
index 03276c1..0adf08c 100644
--- a/tools/inc/tools/string.hxx
+++ b/tools/inc/tools/string.hxx
@@ -333,6 +333,28 @@ struct ToStringHelper< UniString >
#endif
+// some compare operators, so that conversions from String to OUString don't
+// have to insert conversions all over the place
+inline bool operator==(UniString const& rLeft, ::rtl::OUString const& rRight)
+{
+ return ::rtl::OUString(rLeft) == rRight;
+}
+
+inline bool operator==(::rtl::OUString const& rLeft, UniString const& rRight)
+{
+ return rLeft == ::rtl::OUString(rRight);
+}
+
+inline bool operator!=(UniString const& rLeft, ::rtl::OUString const& rRight)
+{
+ return ::rtl::OUString(rLeft) != rRight;
+}
+
+inline bool operator!=(::rtl::OUString const& rLeft, UniString const& rRight)
+{
+ return rLeft != ::rtl::OUString(rRight);
+}
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list