summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-12-12 17:52:18 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-12-12 17:52:18 +0100
commitb733f5c4f4b3f92f5ba0f36575093bb3bc7fc7ec (patch)
tree54dfb0a093532b2145832f3bb712f947be6fe1dd /framework
parent4fbdcb8c051ce9a3a32fc93a9e5df0a76ea63595 (diff)
framework: Use appropriate OUString functions on string constants
Change-Id: I72bb5ff2ab8a55061072fde567fcc1c4a8e20a2f
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/jobs/joburl.hxx3
-rw-r--r--framework/source/fwe/classes/actiontriggercontainer.cxx6
-rw-r--r--framework/source/fwe/classes/addonmenu.cxx4
-rw-r--r--framework/source/fwe/classes/rootactiontriggercontainer.cxx6
-rw-r--r--framework/source/fwe/xml/statusbardocumenthandler.cxx10
-rw-r--r--framework/source/fwe/xml/toolboxdocumenthandler.cxx17
-rw-r--r--framework/source/jobs/joburl.cxx8
-rw-r--r--framework/source/services/desktop.cxx4
-rw-r--r--framework/source/services/frame.cxx4
-rw-r--r--framework/source/services/sessionlistener.cxx4
-rw-r--r--framework/source/uielement/generictoolbarcontroller.cxx6
-rw-r--r--framework/source/uielement/menubarmanager.cxx48
12 files changed, 46 insertions, 74 deletions
diff --git a/framework/inc/jobs/joburl.hxx b/framework/inc/jobs/joburl.hxx
index afbd15e90856..ac816c3e3e13 100644
--- a/framework/inc/jobs/joburl.hxx
+++ b/framework/inc/jobs/joburl.hxx
@@ -27,9 +27,6 @@
namespace framework{
-#define JOBURL_PROTOCOL_STR "vnd.sun.star.job:"
-#define JOBURL_PROTOCOL_LEN 17
-
#define JOBURL_EVENT_STR "event="
#define JOBURL_EVENT_LEN 6
diff --git a/framework/source/fwe/classes/actiontriggercontainer.cxx b/framework/source/fwe/classes/actiontriggercontainer.cxx
index 27acc50a2af2..1ba4a54f1099 100644
--- a/framework/source/fwe/classes/actiontriggercontainer.cxx
+++ b/framework/source/fwe/classes/actiontriggercontainer.cxx
@@ -73,11 +73,11 @@ void ActionTriggerContainer::release() throw()
Reference< XInterface > SAL_CALL ActionTriggerContainer::createInstance( const OUString& aServiceSpecifier )
throw ( ::com::sun::star::uno::Exception, RuntimeException, std::exception)
{
- if ( aServiceSpecifier.equalsAscii( SERVICENAME_ACTIONTRIGGER ))
+ if ( aServiceSpecifier == SERVICENAME_ACTIONTRIGGER )
return (OWeakObject *)( new ActionTriggerPropertySet());
- else if ( aServiceSpecifier.equalsAscii( SERVICENAME_ACTIONTRIGGERCONTAINER ))
+ else if ( aServiceSpecifier == SERVICENAME_ACTIONTRIGGERCONTAINER )
return (OWeakObject *)( new ActionTriggerContainer());
- else if ( aServiceSpecifier.equalsAscii( SERVICENAME_ACTIONTRIGGERSEPARATOR ))
+ else if ( aServiceSpecifier == SERVICENAME_ACTIONTRIGGERSEPARATOR )
return (OWeakObject *)( new ActionTriggerSeparatorPropertySet());
else
throw com::sun::star::uno::RuntimeException("Unknown service specifier!", (OWeakObject *)this );
diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx
index 836caa87af46..4638d0aa444e 100644
--- a/framework/source/fwe/classes/addonmenu.cxx
+++ b/framework/source/fwe/classes/addonmenu.cxx
@@ -70,9 +70,7 @@ AddonMenu::~AddonMenu()
// Check if command URL string has the unique prefix to identify addon popup menus
bool AddonPopupMenu::IsCommandURLPrefix( const OUString& aCmdURL )
{
- const char aPrefixCharBuf[] = ADDONSPOPUPMENU_URL_PREFIX_STR;
-
- return aCmdURL.matchAsciiL( aPrefixCharBuf, sizeof( aPrefixCharBuf )-1, 0 );
+ return aCmdURL.startsWith( ADDONSPOPUPMENU_URL_PREFIX_STR );
}
AddonPopupMenu::AddonPopupMenu( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& rFrame ) :
diff --git a/framework/source/fwe/classes/rootactiontriggercontainer.cxx b/framework/source/fwe/classes/rootactiontriggercontainer.cxx
index fe5196b20cc4..152699c81f22 100644
--- a/framework/source/fwe/classes/rootactiontriggercontainer.cxx
+++ b/framework/source/fwe/classes/rootactiontriggercontainer.cxx
@@ -92,11 +92,11 @@ void SAL_CALL RootActionTriggerContainer::release() throw ()
Reference< XInterface > SAL_CALL RootActionTriggerContainer::createInstance( const OUString& aServiceSpecifier )
throw ( Exception, RuntimeException, std::exception )
{
- if ( aServiceSpecifier.equalsAscii( SERVICENAME_ACTIONTRIGGER ))
+ if ( aServiceSpecifier == SERVICENAME_ACTIONTRIGGER )
return (OWeakObject *)( new ActionTriggerPropertySet());
- else if ( aServiceSpecifier.equalsAscii( SERVICENAME_ACTIONTRIGGERCONTAINER ))
+ else if ( aServiceSpecifier == SERVICENAME_ACTIONTRIGGERCONTAINER )
return (OWeakObject *)( new ActionTriggerContainer());
- else if ( aServiceSpecifier.equalsAscii( SERVICENAME_ACTIONTRIGGERSEPARATOR ))
+ else if ( aServiceSpecifier == SERVICENAME_ACTIONTRIGGERSEPARATOR )
return (OWeakObject *)( new ActionTriggerSeparatorPropertySet());
else
throw com::sun::star::uno::RuntimeException("Unknown service specifier!", (OWeakObject *)this );
diff --git a/framework/source/fwe/xml/statusbardocumenthandler.cxx b/framework/source/fwe/xml/statusbardocumenthandler.cxx
index ca170df325c5..a3bd46b246a5 100644
--- a/framework/source/fwe/xml/statusbardocumenthandler.cxx
+++ b/framework/source/fwe/xml/statusbardocumenthandler.cxx
@@ -98,24 +98,24 @@ static void ExtractStatusbarItemParameters(
{
for ( sal_Int32 i = 0; i < rProp.getLength(); i++ )
{
- if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_COMMANDURL ))
+ if ( rProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL )
{
rProp[i].Value >>= rCommandURL;
rCommandURL = rCommandURL.intern();
}
- else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_HELPURL ))
+ else if ( rProp[i].Name == ITEM_DESCRIPTOR_HELPURL )
{
rProp[i].Value >>= rHelpURL;
}
- else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_OFFSET ))
+ else if ( rProp[i].Name == ITEM_DESCRIPTOR_OFFSET )
{
rProp[i].Value >>= rOffset;
}
- else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_STYLE ))
+ else if ( rProp[i].Name == ITEM_DESCRIPTOR_STYLE )
{
rProp[i].Value >>= rStyle;
}
- else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_WIDTH ))
+ else if ( rProp[i].Name == ITEM_DESCRIPTOR_WIDTH )
{
rProp[i].Value >>= rWidth;
}
diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
index 265581e11575..e6065a140470 100644
--- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx
+++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx
@@ -54,7 +54,6 @@ static const char ITEM_DESCRIPTOR_LABEL[] = "Label";
static const char ITEM_DESCRIPTOR_TYPE[] = "Type";
static const char ITEM_DESCRIPTOR_STYLE[] = "Style";
static const char ITEM_DESCRIPTOR_VISIBLE[] = "IsVisible";
-static const char ITEM_DESCRIPTOR_WIDTH[] = "Width";
static void ExtractToolbarParameters( const Sequence< PropertyValue >& rProp,
OUString& rCommandURL,
@@ -68,24 +67,24 @@ static void ExtractToolbarParameters( const Sequence< PropertyValue >& rProp,
{
for ( sal_Int32 i = 0; i < rProp.getLength(); i++ )
{
- if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_COMMANDURL ))
+ if ( rProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL )
{
rProp[i].Value >>= rCommandURL;
rCommandURL = rCommandURL.intern();
}
- else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_HELPURL ))
+ else if ( rProp[i].Name == ITEM_DESCRIPTOR_HELPURL )
rProp[i].Value >>= rHelpURL;
- else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_TOOLTIP ))
+ else if ( rProp[i].Name == ITEM_DESCRIPTOR_TOOLTIP )
rProp[i].Value >>= rTooltip;
- else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_LABEL ))
+ else if ( rProp[i].Name == ITEM_DESCRIPTOR_LABEL )
rProp[i].Value >>= rLabel;
- else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_TYPE ))
+ else if ( rProp[i].Name == ITEM_DESCRIPTOR_TYPE )
rProp[i].Value >>= rType;
- else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_VISIBLE ))
+ else if ( rProp[i].Name == ITEM_DESCRIPTOR_VISIBLE )
rProp[i].Value >>= rVisible;
- else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_WIDTH ))
+ else if ( rProp[i].Name == "Width" )
rProp[i].Value >>= rWidth;
- else if ( rProp[i].Name.equalsAscii( ITEM_DESCRIPTOR_STYLE ))
+ else if ( rProp[i].Name == ITEM_DESCRIPTOR_STYLE )
rProp[i].Value >>= rStyle;
}
}
diff --git a/framework/source/jobs/joburl.cxx b/framework/source/jobs/joburl.cxx
index 2dacc370893b..3078d0386e31 100644
--- a/framework/source/jobs/joburl.cxx
+++ b/framework/source/jobs/joburl.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cstring>
+
#include <jobs/joburl.hxx>
#include <general.h>
@@ -47,9 +51,9 @@ JobURL::JobURL( /*IN*/ const OUString& sURL )
// syntax: vnd.sun.star.job:{[event=<name>],[alias=<name>],[service=<name>]}
// check for "vnd.sun.star.job:"
- if (sURL.matchIgnoreAsciiCaseAsciiL(JOBURL_PROTOCOL_STR,JOBURL_PROTOCOL_LEN,0))
+ if (sURL.startsWithIgnoreAsciiCase("vnd.sun.star.job:"))
{
- sal_Int32 t = JOBURL_PROTOCOL_LEN;
+ sal_Int32 t = std::strlen("vnd.sun.star.job:");
do
{
// separate all token of "{[event=<name>],[alias=<name>],[service=<name>]}"
diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx
index 2896cb6e0f18..43f73fb0177a 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -637,8 +637,6 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL Desktop::queryDispatch( co
const OUString& sTargetFrameName ,
sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException, std::exception )
{
- const char UNO_PROTOCOL[] = ".uno:";
-
/* UNSAFE AREA --------------------------------------------------------------------------------------------- */
// Register transaction and reject wrong calls.
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
@@ -646,7 +644,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL Desktop::queryDispatch( co
// Remove uno and cmd protocol part as we want to support both of them. We store only the command part
// in our hash map. All other protocols are stored with the protocol part.
OUString aCommand( aURL.Main );
- if ( aURL.Protocol.equalsIgnoreAsciiCaseAsciiL( UNO_PROTOCOL, sizeof( UNO_PROTOCOL )-1 ))
+ if ( aURL.Protocol.equalsIgnoreAsciiCase(".uno:") )
aCommand = aURL.Path;
// Make boost::unordered_map lookup if the current URL is in the disabled list
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index 1138184a2f55..2890392abcc8 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -2205,8 +2205,6 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL Frame::queryDispatch( cons
const OUString& sTargetFrameName,
sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException, std::exception )
{
- const char UNO_PROTOCOL[] = ".uno:";
-
// Don't check incoming parameter here! Our helper do it for us and it is not a good idea to do it more than ones!
// But look for rejected calls!
TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
@@ -2214,7 +2212,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL Frame::queryDispatch( cons
// Remove uno and cmd protocol part as we want to support both of them. We store only the command part
// in our hash map. All other protocols are stored with the protocol part.
OUString aCommand( aURL.Main );
- if ( aURL.Protocol.equalsIgnoreAsciiCaseAsciiL( UNO_PROTOCOL, sizeof( UNO_PROTOCOL )-1 ))
+ if ( aURL.Protocol.equalsIgnoreAsciiCase(".uno:") )
aCommand = aURL.Path;
// Make boost::unordered_map lookup if the current URL is in the disabled list
diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx
index 5820f212fad1..ecf0e49b7657 100644
--- a/framework/source/services/sessionlistener.cxx
+++ b/framework/source/services/sessionlistener.cxx
@@ -277,13 +277,13 @@ void SAL_CALL SessionListener::statusChanged(const frame::FeatureStateEvent& eve
SAL_INFO("fwk.session", "SessionListener::statusChanged");
if ( event.FeatureURL.Complete == "vnd.sun.star.autorecovery:/doSessionRestore" )
{
- if (event.FeatureDescriptor.equalsAscii("update"))
+ if (event.FeatureDescriptor == "update")
m_bRestored = true; // a document was restored
}
else if ( event.FeatureURL.Complete == "vnd.sun.star.autorecovery:/doSessionSave" )
{
- if (event.FeatureDescriptor.equalsAscii("stop"))
+ if (event.FeatureDescriptor == "stop")
{
if (m_rSessionManager.is())
m_rSessionManager->saveDone(this); // done with save
diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx
index bdd48d8345dc..c7a5a86df447 100644
--- a/framework/source/uielement/generictoolbarcontroller.cxx
+++ b/framework/source/uielement/generictoolbarcontroller.cxx
@@ -224,20 +224,20 @@ throw ( RuntimeException, std::exception )
else
{
// Replacement for place holders
- if ( aStrValue.matchAsciiL( "($1)", 4 ))
+ if ( aStrValue.startsWith("($1)") )
{
OUString aTmp(FwkResId(STR_UPDATEDOC));
aTmp += " ";
aTmp += aStrValue.copy( 4 );
aStrValue = aTmp;
}
- else if ( aStrValue.matchAsciiL( "($2)", 4 ))
+ else if ( aStrValue.startsWith("($2)") )
{
OUString aTmp(FWK_RESSTR(STR_CLOSEDOC_ANDRETURN));
aTmp += aStrValue.copy( 4 );
aStrValue = aTmp;
}
- else if ( aStrValue.matchAsciiL( "($3)", 4 ))
+ else if ( aStrValue.startsWith("($3)") )
{
OUString aTmp(FWK_RESSTR(STR_SAVECOPYDOC));
aTmp += aStrValue.copy( 4 );
diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx
index 72c7ff0cc06b..23e0c27e4e2e 100644
--- a/framework/source/uielement/menubarmanager.cxx
+++ b/framework/source/uielement/menubarmanager.cxx
@@ -97,28 +97,6 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::ui;
-static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL";
-static const char ITEM_DESCRIPTOR_HELPURL[] = "HelpURL";
-static const char ITEM_DESCRIPTOR_CONTAINER[] = "ItemDescriptorContainer";
-static const char ITEM_DESCRIPTOR_LABEL[] = "Label";
-static const char ITEM_DESCRIPTOR_TYPE[] = "Type";
-static const char ITEM_DESCRIPTOR_MODULEIDENTIFIER[] = "ModuleIdentifier";
-static const char ITEM_DESCRIPTOR_DISPATCHPROVIDER[] = "DispatchProvider";
-static const char ITEM_DESCRIPTOR_STYLE[] = "Style";
-static const char ITEM_DESCRIPTOR_ISVISIBLE[] = "IsVisible";
-static const char ITEM_DESCRIPTOR_ENABLED[] = "Enabled";
-
-static const sal_Int32 LEN_DESCRIPTOR_COMMANDURL = 10;
-static const sal_Int32 LEN_DESCRIPTOR_HELPURL = 7;
-static const sal_Int32 LEN_DESCRIPTOR_CONTAINER = 23;
-static const sal_Int32 LEN_DESCRIPTOR_LABEL = 5;
-static const sal_Int32 LEN_DESCRIPTOR_TYPE = 4;
-static const sal_Int32 LEN_DESCRIPTOR_MODULEIDENTIFIER = 16;
-static const sal_Int32 LEN_DESCRIPTOR_DISPATCHPROVIDER = 16;
-static const sal_Int32 LEN_DESCRIPTOR_STYLE = 5;
-static const sal_Int32 LEN_DESCRIPTOR_ISVISIBLE = 9;
-static const sal_Int32 LEN_DESCRIPTOR_ENABLED = 7;
-
const sal_uInt16 ADDONMENU_MERGE_ITEMID_START = 1500;
namespace framework
@@ -479,20 +457,20 @@ throw ( RuntimeException, std::exception )
else if ( Event.State >>= aItemText )
{
// Replacement for place holders
- if ( aItemText.matchAsciiL( "($1)", 4 ))
+ if ( aItemText.startsWith("($1)") )
{
OUString aTmp(FWK_RESSTR(STR_UPDATEDOC));
aTmp += " ";
aTmp += aItemText.copy( 4 );
aItemText = aTmp;
}
- else if ( aItemText.matchAsciiL( "($2)", 4 ))
+ else if ( aItemText.startsWith("($2)") )
{
OUString aTmp(FWK_RESSTR(STR_CLOSEDOC_ANDRETURN));
aTmp += aItemText.copy( 4 );
aItemText = aTmp;
}
- else if ( aItemText.matchAsciiL( "($3)", 4 ))
+ else if ( aItemText.startsWith("($3)") )
{
OUString aTmp(FWK_RESSTR(STR_SAVECOPYDOC));
aTmp += aItemText.copy( 4 );
@@ -1655,25 +1633,25 @@ void MenuBarManager::FillMenu(
for ( int i = 0; i < aProp.getLength(); i++ )
{
OUString aPropName = aProp[i].Name;
- if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_COMMANDURL, LEN_DESCRIPTOR_COMMANDURL ))
+ if ( aPropName == "CommandURL" )
aProp[i].Value >>= aCommandURL;
- else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_HELPURL, LEN_DESCRIPTOR_HELPURL ))
+ else if ( aPropName == "HelpURL" )
aProp[i].Value >>= aHelpURL;
- else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_CONTAINER, LEN_DESCRIPTOR_CONTAINER ))
+ else if ( aPropName == "ItemDescriptorContainer" )
aProp[i].Value >>= xIndexContainer;
- else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_LABEL, LEN_DESCRIPTOR_LABEL ))
+ else if ( aPropName == "Label" )
aProp[i].Value >>= aLabel;
- else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_TYPE, LEN_DESCRIPTOR_TYPE ))
+ else if ( aPropName == "Type" )
aProp[i].Value >>= nType;
- else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_MODULEIDENTIFIER, LEN_DESCRIPTOR_MODULEIDENTIFIER ))
+ else if ( aPropName == "ModuleIdentifier" )
aProp[i].Value >>= aModuleIdentifier;
- else if ( aPropName.equalsAsciiL( ITEM_DESCRIPTOR_DISPATCHPROVIDER, LEN_DESCRIPTOR_DISPATCHPROVIDER ))
+ else if ( aPropName == "DispatchProvider" )
aProp[i].Value >>= xDispatchProvider;
- else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_STYLE, LEN_DESCRIPTOR_STYLE ))
+ else if ( aPropName == "Style" )
aProp[i].Value >>= nStyle;
- else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_ISVISIBLE, LEN_DESCRIPTOR_ISVISIBLE ))
+ else if ( aPropName == "IsVisible" )
aProp[i].Value >>= bShow;
- else if ( aProp[i].Name.equalsAsciiL( ITEM_DESCRIPTOR_ENABLED, LEN_DESCRIPTOR_ENABLED ))
+ else if ( aPropName == "Enabled" )
aProp[i].Value >>= bEnabled;
}