sfx2: Use appropriate OUString functions on string constants
Change-Id: I28ca30da980b81dbf3328495291916afca654999
This commit is contained in:
@@ -64,7 +64,7 @@ void SAL_CALL HelpDispatch_Impl::dispatch(
|
||||
const PropertyValue* pEnd = pBegin + aArgs.getLength();
|
||||
for ( ; pBegin != pEnd; ++pBegin )
|
||||
{
|
||||
if ( pBegin->Name.equalsAscii( "HelpKeyword" ) )
|
||||
if ( pBegin->Name == "HelpKeyword" )
|
||||
{
|
||||
OUString sHelpKeyword;
|
||||
if ( ( pBegin->Value >>= sHelpKeyword ) && !sHelpKeyword.isEmpty() )
|
||||
|
@@ -290,7 +290,7 @@ SfxStatusDispatcher::SfxStatusDispatcher()
|
||||
void SAL_CALL SfxStatusDispatcher::addStatusListener(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > & aListener, const ::com::sun::star::util::URL& aURL) throw ( ::com::sun::star::uno::RuntimeException, std::exception )
|
||||
{
|
||||
aListeners.addInterface( aURL.Complete, aListener );
|
||||
if ( aURL.Complete.equalsAscii(".uno:LifeTime") )
|
||||
if ( aURL.Complete == ".uno:LifeTime" )
|
||||
{
|
||||
::com::sun::star::frame::FeatureStateEvent aEvent;
|
||||
aEvent.FeatureURL = aURL;
|
||||
|
@@ -161,7 +161,7 @@ uno::Reference<rdf::XURI> createBaseURI(
|
||||
xBaseURI.set( xPkgURI, uno::UNO_SET_THROW );
|
||||
}
|
||||
OUStringBuffer buf;
|
||||
if (!xBaseURI->getUriReference().endsWithAsciiL("/", 1))
|
||||
if (!xBaseURI->getUriReference().endsWith("/"))
|
||||
{
|
||||
const sal_Int32 count( xBaseURI->getPathSegmentCount() );
|
||||
if (count > 0)
|
||||
@@ -552,8 +552,7 @@ readStream(struct DocumentMetadataAccess_Impl & i_rImpl,
|
||||
xDirProps->getPropertyValue(
|
||||
utl::MediaDescriptor::PROP_MEDIATYPE() )
|
||||
>>= mimeType;
|
||||
if (mimeType.matchAsciiL(s_odfmime, sizeof(s_odfmime) - 1))
|
||||
{
|
||||
if (mimeType.startsWith(s_odfmime)) {
|
||||
OSL_TRACE("readStream: "
|
||||
"refusing to recurse into embedded document");
|
||||
return;
|
||||
@@ -655,7 +654,7 @@ writeStream(struct DocumentMetadataAccess_Impl & i_rImpl,
|
||||
xDirProps->getPropertyValue(
|
||||
utl::MediaDescriptor::PROP_MEDIATYPE() )
|
||||
>>= mimeType;
|
||||
if (mimeType.matchAsciiL(s_odfmime, sizeof(s_odfmime) - 1)) {
|
||||
if (mimeType.startsWith(s_odfmime)) {
|
||||
OSL_TRACE("writeStream: "
|
||||
"refusing to recurse into embedded document");
|
||||
return;
|
||||
@@ -695,8 +694,6 @@ retry:
|
||||
i_rImpl.m_xRepository.set(rdf::Repository::create(i_rImpl.m_xContext),
|
||||
uno::UNO_SET_THROW);
|
||||
|
||||
const OUString manifest (
|
||||
OUString::createFromAscii(s_manifest));
|
||||
const OUString baseURI( i_xBaseURI->getStringValue() );
|
||||
// try to delay raising errors until after initialization is done
|
||||
uno::Any rterr;
|
||||
@@ -704,9 +701,9 @@ retry:
|
||||
bool err(false);
|
||||
|
||||
const uno::Reference <rdf::XURI> xManifest(
|
||||
getURIForStream(i_rImpl, manifest));
|
||||
getURIForStream(i_rImpl, s_manifest));
|
||||
try {
|
||||
readStream(i_rImpl, i_xStorage, manifest, baseURI);
|
||||
readStream(i_rImpl, i_xStorage, s_manifest, baseURI);
|
||||
} catch (const ucb::InteractiveAugmentedIOException & e) {
|
||||
// no manifest.rdf: this is not an error in ODF < 1.2
|
||||
if (!(ucb::IOErrorCode_NOT_EXISTING_PATH == e.Code)) {
|
||||
@@ -754,8 +751,7 @@ static void init(struct DocumentMetadataAccess_Impl & i_rImpl)
|
||||
try {
|
||||
|
||||
i_rImpl.m_xManifest.set(i_rImpl.m_xRepository->createGraph(
|
||||
getURIForStream(i_rImpl,
|
||||
OUString::createFromAscii(s_manifest))),
|
||||
getURIForStream(i_rImpl, s_manifest)),
|
||||
uno::UNO_SET_THROW);
|
||||
|
||||
// insert the document statement
|
||||
@@ -769,12 +765,10 @@ static void init(struct DocumentMetadataAccess_Impl & i_rImpl)
|
||||
}
|
||||
|
||||
// add top-level content files
|
||||
if (!addContentOrStylesFileImpl(i_rImpl,
|
||||
OUString::createFromAscii(s_content))) {
|
||||
if (!addContentOrStylesFileImpl(i_rImpl, s_content)) {
|
||||
throw uno::RuntimeException();
|
||||
}
|
||||
if (!addContentOrStylesFileImpl(i_rImpl,
|
||||
OUString::createFromAscii(s_styles))) {
|
||||
if (!addContentOrStylesFileImpl(i_rImpl, s_styles)) {
|
||||
throw uno::RuntimeException();
|
||||
}
|
||||
}
|
||||
@@ -796,8 +790,8 @@ DocumentMetadataAccess::DocumentMetadataAccess(
|
||||
: m_pImpl(new DocumentMetadataAccess_Impl(i_xContext, i_rRegistrySupplier))
|
||||
{
|
||||
OSL_ENSURE(!i_rURI.isEmpty(), "DMA::DMA: no URI given!");
|
||||
OSL_ENSURE(i_rURI.endsWithAsciiL("/", 1), "DMA::DMA: URI without / given!");
|
||||
if (!i_rURI.endsWithAsciiL("/", 1)) throw uno::RuntimeException();
|
||||
OSL_ENSURE(i_rURI.endsWith("/"), "DMA::DMA: URI without / given!");
|
||||
if (!i_rURI.endsWith("/")) throw uno::RuntimeException();
|
||||
m_pImpl->m_xBaseURI.set(rdf::URI::create(m_pImpl->m_xContext, i_rURI));
|
||||
m_pImpl->m_xRepository.set(rdf::Repository::create(m_pImpl->m_xContext),
|
||||
uno::UNO_SET_THROW);
|
||||
@@ -1092,7 +1086,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
|
||||
"DocumentMetadataAccess::loadMetadataFromStorage: "
|
||||
"base URI not absolute", *this, 1);
|
||||
}
|
||||
if (baseURI.isEmpty() || !baseURI.endsWithAsciiL("/", 1)) {
|
||||
if (!baseURI.endsWith("/")) {
|
||||
throw lang::IllegalArgumentException(
|
||||
"DocumentMetadataAccess::loadMetadataFromStorage: "
|
||||
"base URI does not end with slash", *this, 1);
|
||||
@@ -1116,8 +1110,6 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
|
||||
const uno::Reference<rdf::XURI> xMetadataFile(
|
||||
getURI<rdf::URIs::PKG_METADATAFILE>(m_pImpl->m_xContext));
|
||||
const sal_Int32 len( baseURI.getLength() );
|
||||
const OUString manifest (
|
||||
OUString::createFromAscii(s_manifest));
|
||||
for (::std::vector< uno::Reference< rdf::XURI > >::const_iterator it
|
||||
= parts.begin();
|
||||
it != parts.end(); ++it) {
|
||||
@@ -1129,7 +1121,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
|
||||
continue;
|
||||
}
|
||||
const OUString relName( name.copy(len) );
|
||||
if (relName == manifest) {
|
||||
if (relName == s_manifest) {
|
||||
OSL_TRACE("loadMetadataFromStorage: "
|
||||
"found ourselves a recursive manifest!");
|
||||
continue;
|
||||
@@ -1193,13 +1185,11 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
|
||||
}
|
||||
|
||||
// export manifest
|
||||
const OUString manifest (
|
||||
OUString::createFromAscii(s_manifest));
|
||||
const uno::Reference <rdf::XURI> xManifest(
|
||||
getURIForStream(*m_pImpl, manifest) );
|
||||
getURIForStream(*m_pImpl, s_manifest) );
|
||||
const OUString baseURI( m_pImpl->m_xBaseURI->getStringValue() );
|
||||
try {
|
||||
writeStream(*m_pImpl, i_xStorage, xManifest, manifest, baseURI);
|
||||
writeStream(*m_pImpl, i_xStorage, xManifest, s_manifest, baseURI);
|
||||
} catch (const uno::RuntimeException &) {
|
||||
throw;
|
||||
} catch (const io::IOException & e) {
|
||||
@@ -1225,7 +1215,7 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
|
||||
continue;
|
||||
}
|
||||
const OUString relName( name.copy(len) );
|
||||
if (relName == manifest) {
|
||||
if (relName == s_manifest) {
|
||||
continue;
|
||||
}
|
||||
if (!isFileNameValid(relName) || isReservedFile(relName)) {
|
||||
|
@@ -2542,9 +2542,9 @@ void SfxDocTplService_Impl::addFsysGroup( GroupList_Impl& rList,
|
||||
if ( rUITitle.isEmpty() )
|
||||
{
|
||||
// reserved FS names that should not be used
|
||||
if ( rTitle.equalsAscii( "wizard" ) )
|
||||
if ( rTitle == "wizard" )
|
||||
return;
|
||||
else if ( rTitle.equalsAscii( "internal" ) )
|
||||
else if ( rTitle == "internal" )
|
||||
return;
|
||||
|
||||
aTitle = getLongName( rTitle );
|
||||
@@ -2607,7 +2607,7 @@ void SfxDocTplService_Impl::addFsysGroup( GroupList_Impl& rList,
|
||||
OUString aType;
|
||||
OUString aHierURL;
|
||||
|
||||
if ( aChildTitle.equalsAscii( "sfx.tlx" ) || aChildTitle == "groupuinames.xml" )
|
||||
if ( aChildTitle == "sfx.tlx" || aChildTitle == "groupuinames.xml" )
|
||||
continue;
|
||||
|
||||
bool bDocHasTitle = false;
|
||||
|
@@ -335,7 +335,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
|
||||
const beans::PropertyValue &rProp = rPrinter.getConstArray()[n];
|
||||
|
||||
// Name-Property?
|
||||
if ( rProp.Name.equalsAscii( "Name" ) )
|
||||
if ( rProp.Name == "Name" )
|
||||
{
|
||||
OUString aPrinterName;
|
||||
if ( ! ( rProp.Value >>= aPrinterName ) )
|
||||
@@ -360,7 +360,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
|
||||
const beans::PropertyValue &rProp = rPrinter.getConstArray()[i];
|
||||
|
||||
// PaperOrientation-Property?
|
||||
if ( rProp.Name.equalsAscii( "PaperOrientation" ) )
|
||||
if ( rProp.Name == "PaperOrientation" )
|
||||
{
|
||||
view::PaperOrientation eOrient;
|
||||
if ( !( rProp.Value >>= eOrient ) )
|
||||
@@ -378,7 +378,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
|
||||
}
|
||||
|
||||
// PaperFormat-Property?
|
||||
else if ( rProp.Name.equalsAscii( "PaperFormat" ) )
|
||||
else if ( rProp.Name == "PaperFormat" )
|
||||
{
|
||||
if ( !( rProp.Value >>= nPaperFormat ) )
|
||||
{
|
||||
@@ -395,7 +395,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
|
||||
}
|
||||
|
||||
// PaperSize-Property?
|
||||
else if ( rProp.Name.equalsAscii( "PaperSize" ) )
|
||||
else if ( rProp.Name == "PaperSize" )
|
||||
{
|
||||
awt::Size aTempSize ;
|
||||
if ( !( rProp.Value >>= aTempSize ) )
|
||||
@@ -409,7 +409,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
|
||||
}
|
||||
|
||||
// PrinterTray-Property
|
||||
else if ( rProp.Name.equalsAscii( "PrinterPaperTray" ) )
|
||||
else if ( rProp.Name == "PrinterPaperTray" )
|
||||
{
|
||||
OUString aTmp;
|
||||
if ( !( rProp.Value >>= aTmp ) )
|
||||
@@ -620,7 +620,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
|
||||
const beans::PropertyValue &rProp = rOptions.getConstArray()[n];
|
||||
|
||||
// FileName-Property?
|
||||
if ( rProp.Name.equalsAscii( "FileName" ) )
|
||||
if ( rProp.Name == "FileName" )
|
||||
{
|
||||
// unpack th URL and check for a valid and well known protocol
|
||||
OUString sTemp;
|
||||
@@ -695,7 +695,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
|
||||
}
|
||||
|
||||
// CopyCount-Property
|
||||
else if ( rProp.Name.equalsAscii( "CopyCount" ) )
|
||||
else if ( rProp.Name == "CopyCount" )
|
||||
{
|
||||
sal_Int32 nCopies = 0;
|
||||
if ( !( rProp.Value >>= nCopies ) )
|
||||
@@ -707,8 +707,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
|
||||
|
||||
// Collate-Property
|
||||
// Sort-Property (deprecated)
|
||||
else if ( rProp.Name.equalsAscii( "Collate" ) ||
|
||||
rProp.Name.equalsAscii( "Sort" ) )
|
||||
else if ( rProp.Name == "Collate" || rProp.Name == "Sort" )
|
||||
{
|
||||
bool bTemp;
|
||||
if ( rProp.Value >>= bTemp )
|
||||
@@ -721,7 +720,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
|
||||
}
|
||||
|
||||
// Pages-Property
|
||||
else if ( rProp.Name.equalsAscii( "Pages" ) )
|
||||
else if ( rProp.Name == "Pages" )
|
||||
{
|
||||
OUString sTemp;
|
||||
if( rProp.Value >>= sTemp )
|
||||
@@ -734,7 +733,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
|
||||
}
|
||||
|
||||
// MonitorVisible
|
||||
else if ( rProp.Name.equalsAscii( "MonitorVisible" ) )
|
||||
else if ( rProp.Name == "MonitorVisible" )
|
||||
{
|
||||
if( !(rProp.Value >>= bMonitor) )
|
||||
throw ::com::sun::star::lang::IllegalArgumentException();
|
||||
@@ -743,7 +742,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
|
||||
}
|
||||
|
||||
// Wait
|
||||
else if ( rProp.Name.equalsAscii( "Wait" ) )
|
||||
else if ( rProp.Name == "Wait" )
|
||||
{
|
||||
if ( !(rProp.Value >>= bWaitUntilEnd) )
|
||||
throw ::com::sun::star::lang::IllegalArgumentException();
|
||||
@@ -751,7 +750,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
|
||||
aCheckedArgs[nProps++].Value <<= bWaitUntilEnd;
|
||||
}
|
||||
|
||||
else if ( rProp.Name.equalsAscii( "DuplexMode" ) )
|
||||
else if ( rProp.Name == "DuplexMode" )
|
||||
{
|
||||
if ( !(rProp.Value >>= nDuplexMode ) )
|
||||
throw ::com::sun::star::lang::IllegalArgumentException();
|
||||
|
@@ -289,7 +289,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument
|
||||
}
|
||||
uri = xContent->getIdentifier()->getContentIdentifier();
|
||||
OSL_ENSURE(!uri.isEmpty(), "GetDMA: empty uri?");
|
||||
if (!uri.isEmpty() && !uri.endsWithAsciiL("/", 1))
|
||||
if (!uri.isEmpty() && !uri.endsWith("/"))
|
||||
{
|
||||
uri = uri + "/";
|
||||
}
|
||||
|
@@ -152,17 +152,17 @@ bool SvxZoomItem::PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMem
|
||||
sal_Int16 nConvertedCount( 0 );
|
||||
for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ )
|
||||
{
|
||||
if ( aSeq[i].Name.equalsAscii( ZOOM_PARAM_VALUE ))
|
||||
if ( aSeq[i].Name == ZOOM_PARAM_VALUE )
|
||||
{
|
||||
bAllConverted &= ( aSeq[i].Value >>= nValueTmp );
|
||||
++nConvertedCount;
|
||||
}
|
||||
else if ( aSeq[i].Name.equalsAscii( ZOOM_PARAM_VALUESET ))
|
||||
else if ( aSeq[i].Name == ZOOM_PARAM_VALUESET )
|
||||
{
|
||||
bAllConverted &= ( aSeq[i].Value >>= nValueSetTmp );
|
||||
++nConvertedCount;
|
||||
}
|
||||
else if ( aSeq[i].Name.equalsAscii( ZOOM_PARAM_TYPE ))
|
||||
else if ( aSeq[i].Name == ZOOM_PARAM_TYPE )
|
||||
{
|
||||
bAllConverted &= ( aSeq[i].Value >>= nTypeTmp );
|
||||
++nConvertedCount;
|
||||
|
@@ -325,7 +325,7 @@ OUString CommandInfoProvider::GetCommandLabel (const OUString& rsCommandName)
|
||||
const Sequence<beans::PropertyValue> aProperties (GetCommandProperties(rsCommandName));
|
||||
for (sal_Int32 nIndex=0; nIndex<aProperties.getLength(); ++nIndex)
|
||||
{
|
||||
if (aProperties[nIndex].Name.equalsAscii("Name"))
|
||||
if (aProperties[nIndex].Name == "Name")
|
||||
{
|
||||
OUString sLabel;
|
||||
aProperties[nIndex].Value >>= sLabel;
|
||||
|
@@ -51,11 +51,11 @@ Context::Context (
|
||||
sal_Int32 Context::EvaluateMatch (
|
||||
const Context& rOther) const
|
||||
{
|
||||
const bool bApplicationNameIsAny (rOther.msApplication.equalsAscii(AnyApplicationName));
|
||||
const bool bApplicationNameIsAny (rOther.msApplication == AnyApplicationName);
|
||||
if (rOther.msApplication.equals(msApplication) || bApplicationNameIsAny)
|
||||
{
|
||||
// Application name matches.
|
||||
const bool bContextNameIsAny (rOther.msContext.equalsAscii(AnyContextName));
|
||||
const bool bContextNameIsAny (rOther.msContext == AnyContextName);
|
||||
if (rOther.msContext.equals(msContext) || bContextNameIsAny)
|
||||
{
|
||||
// Context name matches.
|
||||
|
@@ -382,7 +382,7 @@ void ResourceManager::ReadContextList (
|
||||
: sValue.getToken(0, ',', nCharacterIndex).trim());
|
||||
const OUString sMenuCommand (
|
||||
sMenuCommandOverride.getLength()>0
|
||||
? (sMenuCommandOverride.equalsAscii("none")
|
||||
? (sMenuCommandOverride == "none"
|
||||
? OUString()
|
||||
: sMenuCommandOverride)
|
||||
: rsDefaultMenuCommand);
|
||||
@@ -398,15 +398,15 @@ void ResourceManager::ReadContextList (
|
||||
{
|
||||
// Handle some special names: abbreviations that make
|
||||
// context descriptions more readable.
|
||||
if (sApplicationName.equalsAscii("Writer"))
|
||||
if (sApplicationName == "Writer")
|
||||
aApplications.push_back(EnumContext::Application_Writer);
|
||||
else if (sApplicationName.equalsAscii("Calc"))
|
||||
else if (sApplicationName == "Calc")
|
||||
aApplications.push_back(EnumContext::Application_Calc);
|
||||
else if (sApplicationName.equalsAscii("Draw"))
|
||||
else if (sApplicationName == "Draw")
|
||||
aApplications.push_back(EnumContext::Application_Draw);
|
||||
else if (sApplicationName.equalsAscii("Impress"))
|
||||
else if (sApplicationName == "Impress")
|
||||
aApplications.push_back(EnumContext::Application_Impress);
|
||||
else if (sApplicationName.equalsAscii("DrawImpress"))
|
||||
else if (sApplicationName == "DrawImpress")
|
||||
{
|
||||
// A special case among the special names: it is
|
||||
// common to use the same context descriptions for
|
||||
@@ -415,7 +415,7 @@ void ResourceManager::ReadContextList (
|
||||
aApplications.push_back(EnumContext::Application_Draw);
|
||||
aApplications.push_back(EnumContext::Application_Impress);
|
||||
}
|
||||
else if (sApplicationName.equalsAscii("WriterVariants"))
|
||||
else if (sApplicationName == "WriterVariants")
|
||||
{
|
||||
// Another special case for all Writer variants.
|
||||
aApplications.push_back(EnumContext::Application_Writer);
|
||||
@@ -448,9 +448,9 @@ void ResourceManager::ReadContextList (
|
||||
// Setup the flag that controls whether a deck/pane is
|
||||
// initially visible/expanded.
|
||||
bool bIsInitiallyVisible;
|
||||
if (sInitialState.equalsAscii("visible"))
|
||||
if (sInitialState == "visible")
|
||||
bIsInitiallyVisible = true;
|
||||
else if (sInitialState.equalsAscii("hidden"))
|
||||
else if (sInitialState == "hidden")
|
||||
bIsInitiallyVisible = false;
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user