[PATCH] Sanitize/simplify some parameters of functions in dbaccess
Marcos Souza (via Code Review)
gerrit at gerrit.libreoffice.org
Tue Jan 15 17:20:54 PST 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/1707
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/07/1707/1
Sanitize/simplify some parameters of functions in dbaccess
Some functions have parameters of OUString, so, we don't need this type of junk:
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" )
and we can use directly:
"LayoutManager"
I believe this brings some simplification to the code, at first glance!
Also in this patch, changed some equalsAsciiL to ==, this simplifies more code yet.
Change-Id: I38b8076afb84d77ed51c7be407c7f899d80829ff
---
M dbaccess/source/core/dataaccess/documentdefinition.cxx
1 file changed, 25 insertions(+), 27 deletions(-)
diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx
index 120ffdb..e6cff05 100644
--- a/dbaccess/source/core/dataaccess/documentdefinition.cxx
+++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx
@@ -401,8 +401,7 @@
::rtl::OUString aEntryDocName;
if ( ( xObjConfig->getByName( aClassIDs[nInd] ) >>= xObjectProps ) && xObjectProps.is()
- && ( xObjectProps->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ObjectDocumentServiceName"))
- ) >>= aEntryDocName )
+ && ( xObjectProps->getByName("ObjectDocumentServiceName") >>= aEntryDocName )
&& aEntryDocName.equals( sResult ) )
{
_rClassId = aConfigHelper.GetSequenceClassIDRepresentation(aClassIDs[nInd]);
@@ -713,7 +712,7 @@
{
Reference< XPropertySet > xPropSet( xFrame, UNO_QUERY_THROW );
m_xLayoutManager.set(
- xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ) ) ),
+ xPropSet->getPropertyValue( "LayoutManager" ),
UNO_QUERY_THROW );
m_xLayoutManager->lock();
@@ -759,14 +758,14 @@
LayoutManagerLock aLockLayout( _rxController );
// setting of the visual properties
- xViewSettings->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowRulers")),makeAny(sal_True));
- xViewSettings->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowVertRuler")),makeAny(sal_True));
- xViewSettings->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowHoriRuler")),makeAny(sal_True));
- xViewSettings->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsRasterVisible")),makeAny(sal_True));
- xViewSettings->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsSnapToRaster")),makeAny(sal_True));
- xViewSettings->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ShowOnlineLayout")),makeAny(sal_True));
- xViewSettings->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RasterSubdivisionX")),makeAny(sal_Int32(5)));
- xViewSettings->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RasterSubdivisionY")),makeAny(sal_Int32(5)));
+ xViewSettings->setPropertyValue("ShowRulers",makeAny(sal_True));
+ xViewSettings->setPropertyValue("ShowVertRuler",makeAny(sal_True));
+ xViewSettings->setPropertyValue("ShowHoriRuler",makeAny(sal_True));
+ xViewSettings->setPropertyValue("IsRasterVisible",makeAny(sal_True));
+ xViewSettings->setPropertyValue("IsSnapToRaster",makeAny(sal_True));
+ xViewSettings->setPropertyValue("ShowOnlineLayout",makeAny(sal_True));
+ xViewSettings->setPropertyValue("RasterSubdivisionX",makeAny(sal_Int32(5)));
+ xViewSettings->setPropertyValue("RasterSubdivisionY",makeAny(sal_Int32(5)));
}
catch( const Exception& )
{
@@ -950,9 +949,9 @@
if ( xModule.is() )
{
if ( m_bForm )
- xModule->setIdentifier( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.FormDesign" ) ) );
+ xModule->setIdentifier( "com.sun.star.sdb.FormDesign" );
else if ( !xReportDefinition.is() )
- xModule->setIdentifier( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.sdb.TextReportDesign" ) ) );
+ xModule->setIdentifier( "com.sun.star.sdb.TextReportDesign" );
updateDocumentTitle();
}
@@ -993,9 +992,9 @@
{
Any aRet;
- sal_Bool bOpen = aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "open" ) );
- sal_Bool bOpenInDesign = aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "openDesign" ) );
- sal_Bool bOpenForMail = aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "openForMail" ) );
+ sal_Bool bOpen = aCommand.Name == "open";
+ sal_Bool bOpenInDesign = aCommand.Name == "openDesign";
+ sal_Bool bOpenForMail = aCommand.Name == "openForMail";
if ( bOpen || bOpenInDesign || bOpenForMail )
{
// opening the document involves a lot of VCL code, which is not thread-safe, but needs the SolarMutex locked.
@@ -1091,9 +1090,8 @@
aIni[0] >>= sURL;
onCommandInsert( sURL, Environment );
}
- else if ( aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "getdocumentinfo" ) ) // compatibility
- || aCommand.Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "getDocumentInfo" ) )
- )
+ else if ( aCommand.Name == "getdocumentinfo" // compatibility
+ || aCommand.Name == "getDocumentInfo" )
{
onCommandGetDocumentProperties( aRet );
}
@@ -1390,7 +1388,7 @@
try
{
Reference< XStorage> xStorage = getContainerStorage();
- const static ::rtl::OUString sBaseName(RTL_CONSTASCII_USTRINGPARAM("Obj"));
+ const static ::rtl::OUString sBaseName("Obj");
Reference<XNameAccess> xElements(xStorage,UNO_QUERY_THROW);
::rtl::OUString sPersistentName = ::dbtools::createUniqueName(xElements,sBaseName);
@@ -1630,7 +1628,7 @@
sDocumentService = GetDocumentServiceFromMediaType( getContentType(), m_aContext, aClassID );
// check if we are not a form and
// the com.sun.star.report.pentaho.SOReportJobFactory is not present.
- if ( !m_bForm && !sDocumentService.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.TextDocument")))
+ if ( !m_bForm && !(sDocumentService == "com.sun.star.text.TextDocument"))
{
// we seem to be a "new style" report, check if report extension is present.
Reference< XContentEnumerationAccess > xEnumAccess( m_aContext.getLegacyServiceFactory(), UNO_QUERY );
@@ -1779,8 +1777,8 @@
if ( xTransfer.is() )
{
DataFlavor aFlavor;
- aFlavor.MimeType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/png"));
- aFlavor.HumanPresentableName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Portable Network Graphics"));
+ aFlavor.MimeType = "image/png";
+ aFlavor.HumanPresentableName = "Portable Network Graphics";
aFlavor.DataType = ::getCppuType(static_cast< const Sequence < sal_Int8 >* >(NULL));
_rImage = xTransfer->getTransferData( aFlavor );
@@ -2085,10 +2083,10 @@
{
Sequence< Any > aArgs(2);
PropertyValue aValue;
- aValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextDocument" ) );
+ aValue.Name = "TextDocument";
aValue.Value <<= _rxComponent;
aArgs[0] <<= aValue;
- aValue.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ActiveConnection" ) );
+ aValue.Name = "ActiveConnection";
aValue.Value <<= _rxActiveConnection;
aArgs[1] <<= aValue;
@@ -2096,7 +2094,7 @@
{
Reference< XJobExecutor > xExecuteable(
_rContext.createComponentWithArguments( "com.sun.star.wizards.report.CallReportWizard", aArgs ), UNO_QUERY_THROW );
- xExecuteable->trigger( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "fill" ) ) );
+ xExecuteable->trigger( "fill" );
}
catch( const Exception& )
{
@@ -2122,7 +2120,7 @@
Reference< XTitle > xDatabaseDocumentModel(m_pImpl->m_pDataSource->getModel_noCreate(),uno::UNO_QUERY);
if ( xDatabaseDocumentModel.is() )
- sName = xDatabaseDocumentModel->getTitle() + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" : ")) + sName;
+ sName = xDatabaseDocumentModel->getTitle() + " : " + sName;
}
Reference< XTitle> xTitle(getComponent(),UNO_QUERY);
if ( xTitle.is() )
--
To view, visit https://gerrit.libreoffice.org/1707
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I38b8076afb84d77ed51c7be407c7f899d80829ff
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Marcos Souza <marcos.souza.org at gmail.com>
More information about the LibreOffice
mailing list