diff options
43 files changed, 222 insertions, 422 deletions
diff --git a/comphelper/inc/comphelper/string.hxx b/comphelper/inc/comphelper/string.hxx index a64bad2cf4e8..dc3620d67307 100644 --- a/comphelper/inc/comphelper/string.hxx +++ b/comphelper/inc/comphelper/string.hxx @@ -439,6 +439,20 @@ COMPHELPER_DLLPUBLIC inline bool isalnumAscii(sal_Unicode c) return isalphaAscii(c) || isdigitAscii(c); } +//============================================================ +//= a helper for static ascii pseudo-unicode strings +//============================================================ +struct COMPHELPER_DLLPUBLIC ConstAsciiString +{ + const sal_Char* ascii; + sal_Int32 length; + + operator rtl::OUString() const + { + return rtl::OUString(ascii, length, RTL_TEXTENCODING_ASCII_US); + } +}; + } } #endif diff --git a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx index 4a72dbdd2a93..01d8cbd06268 100644 --- a/dbaccess/source/core/api/SingleSelectQueryComposer.cxx +++ b/dbaccess/source/core/api/SingleSelectQueryComposer.cxx @@ -322,7 +322,7 @@ void SAL_CALL OSingleSelectQueryComposer::disposing(void) clearCurrentCollections(); } IMPLEMENT_FORWARD_XINTERFACE3(OSingleSelectQueryComposer,OSubComponent,OSingleSelectQueryComposer_BASE,OPropertyContainer) -IMPLEMENT_SERVICE_INFO1(OSingleSelectQueryComposer,"org.openoffice.comp.dba.OSingleSelectQueryComposer",SERVICE_NAME_SINGLESELECTQUERYCOMPOSER) +IMPLEMENT_SERVICE_INFO1(OSingleSelectQueryComposer,"org.openoffice.comp.dba.OSingleSelectQueryComposer",SERVICE_NAME_SINGLESELECTQUERYCOMPOSER.ascii) IMPLEMENT_TYPEPROVIDER3(OSingleSelectQueryComposer,OSubComponent,OSingleSelectQueryComposer_BASE,OPropertyContainer) IMPLEMENT_PROPERTYCONTAINER_DEFAULTS(OSingleSelectQueryComposer) diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx index a1bf1fa9cf5e..34654282d632 100644 --- a/dbaccess/source/core/api/TableDeco.cxx +++ b/dbaccess/source/core/api/TableDeco.cxx @@ -352,17 +352,17 @@ void ODBTableDecorator::construct() Property* pEnd = pIter + aTableProps.getLength(); for (;pIter != pEnd ; ++pIter) { - if (0 == pIter->Name.compareToAscii(PROPERTY_CATALOGNAME)) + if (pIter->Name.equalsAsciiL(PROPERTY_CATALOGNAME.ascii, PROPERTY_CATALOGNAME.length)) pIter->Handle = PROPERTY_ID_CATALOGNAME; - else if (0 ==pIter->Name.compareToAscii(PROPERTY_SCHEMANAME)) + else if (pIter->Name.equalsAsciiL(PROPERTY_SCHEMANAME.ascii, PROPERTY_SCHEMANAME.length)) pIter->Handle = PROPERTY_ID_SCHEMANAME; - else if (0 ==pIter->Name.compareToAscii(PROPERTY_NAME)) + else if (pIter->Name.equalsAsciiL(PROPERTY_NAME.ascii, PROPERTY_NAME.length)) pIter->Handle = PROPERTY_ID_NAME; - else if (0 ==pIter->Name.compareToAscii(PROPERTY_DESCRIPTION)) + else if (pIter->Name.equalsAsciiL(PROPERTY_DESCRIPTION.ascii, PROPERTY_DESCRIPTION.length)) pIter->Handle = PROPERTY_ID_DESCRIPTION; - else if (0 ==pIter->Name.compareToAscii(PROPERTY_TYPE)) + else if (pIter->Name.equalsAsciiL(PROPERTY_TYPE.ascii, PROPERTY_TYPE.length)) pIter->Handle = PROPERTY_ID_TYPE; - else if (0 ==pIter->Name.compareToAscii(PROPERTY_PRIVILEGES)) + else if (pIter->Name.equalsAsciiL(PROPERTY_PRIVILEGES.ascii, PROPERTY_PRIVILEGES.length)) pIter->Handle = PROPERTY_ID_PRIVILEGES; } @@ -390,7 +390,7 @@ void ODBTableDecorator::construct() } // XServiceInfo -IMPLEMENT_SERVICE_INFO1(ODBTableDecorator, "com.sun.star.sdb.dbaccess.ODBTableDecorator", SERVICE_SDBCX_TABLE) +IMPLEMENT_SERVICE_INFO1(ODBTableDecorator, "com.sun.star.sdb.dbaccess.ODBTableDecorator", SERVICE_SDBCX_TABLE.ascii) Any SAL_CALL ODBTableDecorator::queryInterface( const Type & rType ) throw(RuntimeException) { diff --git a/dbaccess/source/core/api/query.cxx b/dbaccess/source/core/api/query.cxx index 274885c3920e..a64516f3f09d 100644 --- a/dbaccess/source/core/api/query.cxx +++ b/dbaccess/source/core/api/query.cxx @@ -228,7 +228,7 @@ void OQuery::rebuildColumns() } // XServiceInfo -IMPLEMENT_SERVICE_INFO3(OQuery, "com.sun.star.sdb.dbaccess.OQuery", SERVICE_SDB_DATASETTINGS, SERVICE_SDB_QUERY, SERVICE_SDB_QUERYDEFINITION) +IMPLEMENT_SERVICE_INFO3(OQuery, "com.sun.star.sdb.dbaccess.OQuery", SERVICE_SDB_DATASETTINGS.ascii, SERVICE_SDB_QUERY.ascii, SERVICE_SDB_QUERYDEFINITION.ascii) // ::com::sun::star::beans::XPropertyChangeListener void SAL_CALL OQuery::propertyChange( const PropertyChangeEvent& _rSource ) throw(RuntimeException) diff --git a/dbaccess/source/core/api/querycontainer.cxx b/dbaccess/source/core/api/querycontainer.cxx index dfa6a5edde9d..77e4a3e11963 100644 --- a/dbaccess/source/core/api/querycontainer.cxx +++ b/dbaccess/source/core/api/querycontainer.cxx @@ -149,7 +149,7 @@ void OQueryContainer::disposing() } // XServiceInfo -IMPLEMENT_SERVICE_INFO2(OQueryContainer, "com.sun.star.sdb.dbaccess.OQueryContainer", SERVICE_SDBCX_CONTAINER, SERVICE_SDB_QUERIES) +IMPLEMENT_SERVICE_INFO2(OQueryContainer, "com.sun.star.sdb.dbaccess.OQueryContainer", SERVICE_SDBCX_CONTAINER.ascii, SERVICE_SDB_QUERIES.ascii) // XDataDescriptorFactory Reference< XPropertySet > SAL_CALL OQueryContainer::createDataDescriptor( ) throw(RuntimeException) diff --git a/dbaccess/source/core/api/table.cxx b/dbaccess/source/core/api/table.cxx index 6452b1156271..284efec407ea 100644 --- a/dbaccess/source/core/api/table.cxx +++ b/dbaccess/source/core/api/table.cxx @@ -265,13 +265,13 @@ void ODBTable::construct() Property* pEnd = pIter + aProps.getLength(); for(;pIter != pEnd;++pIter) { - if (0 == pIter->Name.compareToAscii(PROPERTY_CATALOGNAME)) + if (pIter->Name.equalsAsciiL(PROPERTY_CATALOGNAME.ascii, PROPERTY_CATALOGNAME.length)) pIter->Attributes = PropertyAttribute::READONLY; - else if (0 == pIter->Name.compareToAscii(PROPERTY_SCHEMANAME)) + else if (pIter->Name.equalsAsciiL(PROPERTY_SCHEMANAME.ascii, PROPERTY_SCHEMANAME.length)) pIter->Attributes = PropertyAttribute::READONLY; - else if (0 == pIter->Name.compareToAscii(PROPERTY_DESCRIPTION)) + else if (pIter->Name.equalsAsciiL(PROPERTY_DESCRIPTION.ascii, PROPERTY_DESCRIPTION.length)) pIter->Attributes = PropertyAttribute::READONLY; - else if (0 == pIter->Name.compareToAscii(PROPERTY_NAME)) + else if (pIter->Name.equalsAsciiL(PROPERTY_NAME.ascii, PROPERTY_NAME.length)) pIter->Attributes = PropertyAttribute::READONLY; } } @@ -285,7 +285,7 @@ void ODBTable::construct() } // XServiceInfo -IMPLEMENT_SERVICE_INFO1(ODBTable, "com.sun.star.sdb.dbaccess.ODBTable", SERVICE_SDBCX_TABLE) +IMPLEMENT_SERVICE_INFO1(ODBTable, "com.sun.star.sdb.dbaccess.ODBTable", SERVICE_SDBCX_TABLE.ascii) Any SAL_CALL ODBTable::queryInterface( const Type & rType ) throw(RuntimeException) { diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx index 8a306e9f6d65..54ca2f77721c 100644 --- a/dbaccess/source/core/api/tablecontainer.cxx +++ b/dbaccess/source/core/api/tablecontainer.cxx @@ -151,7 +151,7 @@ void OTableContainer::removeMasterContainerListener() } // XServiceInfo -IMPLEMENT_SERVICE_INFO2(OTableContainer, "com.sun.star.sdb.dbaccess.OTableContainer", SERVICE_SDBCX_CONTAINER, SERVICE_SDBCX_TABLES) +IMPLEMENT_SERVICE_INFO2(OTableContainer, "com.sun.star.sdb.dbaccess.OTableContainer", SERVICE_SDBCX_CONTAINER.ascii, SERVICE_SDBCX_TABLES.ascii) namespace { diff --git a/dbaccess/source/core/api/viewcontainer.cxx b/dbaccess/source/core/api/viewcontainer.cxx index 4f004e1e70bf..105c5df7cfee 100644 --- a/dbaccess/source/core/api/viewcontainer.cxx +++ b/dbaccess/source/core/api/viewcontainer.cxx @@ -90,7 +90,7 @@ OViewContainer::~OViewContainer() } // XServiceInfo -IMPLEMENT_SERVICE_INFO2(OViewContainer, "com.sun.star.sdb.dbaccess.OViewContainer", SERVICE_SDBCX_CONTAINER, SERVICE_SDBCX_TABLES) +IMPLEMENT_SERVICE_INFO2(OViewContainer, "com.sun.star.sdb.dbaccess.OViewContainer", SERVICE_SDBCX_CONTAINER.ascii, SERVICE_SDBCX_TABLES.ascii) ObjectType OViewContainer::createObject(const ::rtl::OUString& _rName) { diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx index 8e959d9cae65..2bb580a59cbb 100644 --- a/dbaccess/source/core/dataaccess/ContentHelper.cxx +++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx @@ -326,11 +326,11 @@ void SAL_CALL OContentHelper::initialize( const Sequence< Any >& _aArguments ) t { m_xParentContainer.set(aValue.Value,UNO_QUERY); } - else if ( aValue.Name.equalsAscii(PROPERTY_NAME) ) + else if ( aValue.Name.equalsAsciiL(PROPERTY_NAME.ascii, PROPERTY_NAME.length) ) { aValue.Value >>= m_pImpl->m_aProps.aTitle; } - else if ( aValue.Name.equalsAscii(PROPERTY_PERSISTENT_NAME) ) + else if ( aValue.Name.equalsAsciiL(PROPERTY_PERSISTENT_NAME.ascii, PROPERTY_PERSISTENT_NAME.length) ) { aValue.Value >>= m_pImpl->m_aProps.sPersistentName; } diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index 85c615de2181..9f421f401a6c 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -320,11 +320,11 @@ Reference< XInterface > SAL_CALL ODocumentContainer::createInstanceWithArguments for(;pBegin != pEnd;++pBegin) { *pBegin >>= aValue; - if ( aValue.Name.equalsAscii(PROPERTY_NAME) ) + if ( aValue.Name.equalsAsciiL(PROPERTY_NAME.ascii, PROPERTY_NAME.length) ) { aValue.Value >>= sName; } - else if ( aValue.Name.equalsAscii(PROPERTY_EMBEDDEDOBJECT) ) + else if ( aValue.Name.equalsAsciiL(PROPERTY_EMBEDDEDOBJECT.ascii, PROPERTY_EMBEDDEDOBJECT.length) ) { xCopyFrom.set(aValue.Value,UNO_QUERY); } diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index f8393f17ebed..a6f3e73be15e 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -523,7 +523,7 @@ void SAL_CALL ODocumentDefinition::disposing() IMPLEMENT_TYPEPROVIDER3(ODocumentDefinition,OContentHelper,OPropertyStateContainer,ODocumentDefinition_Base); IMPLEMENT_FORWARD_XINTERFACE3( ODocumentDefinition,OContentHelper,OPropertyStateContainer,ODocumentDefinition_Base) -IMPLEMENT_SERVICE_INFO1(ODocumentDefinition,"com.sun.star.comp.dba.ODocumentDefinition",SERVICE_SDB_DOCUMENTDEFINITION) +IMPLEMENT_SERVICE_INFO1(ODocumentDefinition,"com.sun.star.comp.dba.ODocumentDefinition",SERVICE_SDB_DOCUMENTDEFINITION.ascii) void ODocumentDefinition::registerProperties() { diff --git a/dbaccess/source/inc/constasciistring.hxx b/dbaccess/source/inc/constasciistring.hxx index 2179e2d7ffdd..80ead8e75597 100644 --- a/dbaccess/source/inc/constasciistring.hxx +++ b/dbaccess/source/inc/constasciistring.hxx @@ -6,58 +6,14 @@ #error "don't include this file directly! use stringconstants.hrc instead!" #endif -// no namespaces. This file is included from several other files _within_ a namespace. - -//============================================================ -//= a helper for static ascii pseudo-unicode strings -//============================================================ -// string constants -struct ConstAsciiString -{ - const sal_Char* ascii; - sal_Int32 length; - - inline operator const ::rtl::OUString& () const; - inline operator const sal_Char* () const { return ascii; } - - inline ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength); - inline ~ConstAsciiString(); - -private: - mutable ::rtl::OUString* ustring; -}; -//------------------------------------------------------------ -inline ConstAsciiString::ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength) - :ascii(_pAsciiZeroTerminated) - ,length(_nLength) - ,ustring(NULL) -{ -} - -//------------------------------------------------------------ -inline ConstAsciiString::~ConstAsciiString() -{ - delete ustring; - ustring = NULL; -} - -//------------------------------------------------------------ -inline ConstAsciiString::operator const ::rtl::OUString& () const -{ - if (!ustring) - ustring = new ::rtl::OUString(ascii, length, RTL_TEXTENCODING_ASCII_US); - return *ustring; -} - -//============================================================ +// no namespaces. This file is included from several other files _within_ a namespace. #define DECLARE_CONSTASCII_USTRING( name ) \ extern const ConstAsciiString name #define IMPLEMENT_CONSTASCII_USTRING( name, string ) \ - const ConstAsciiString name(string, sizeof(string)-1) - + const ConstAsciiString name = {RTL_CONSTASCII_STRINGPARAM(string)} #endif // _DBASHARED_CONSTASCIISTRING_HXX_ diff --git a/dbaccess/source/inc/dbastrings.hrc b/dbaccess/source/inc/dbastrings.hrc index eb6b98d5bd8b..9a98721777df 100644 --- a/dbaccess/source/inc/dbastrings.hrc +++ b/dbaccess/source/inc/dbastrings.hrc @@ -27,9 +27,9 @@ #ifndef DBACCESS_SHARED_DBASTRINGS_HRC #define DBACCESS_SHARED_DBASTRINGS_HRC -#ifndef _RTL_USTRING_HXX_ #include <rtl/ustring.hxx> -#endif +#include <comphelper/string.hxx> +using comphelper::string::ConstAsciiString; namespace dbaccess { diff --git a/dbaccess/source/inc/dbustrings.hrc b/dbaccess/source/inc/dbustrings.hrc index aeef19d752dd..84e8c3021a4a 100644 --- a/dbaccess/source/inc/dbustrings.hrc +++ b/dbaccess/source/inc/dbustrings.hrc @@ -27,9 +27,9 @@ #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC #define DBACCESS_SHARED_DBUSTRINGS_HRC -#ifndef _RTL_USTRING_HXX_ #include <rtl/ustring.hxx> -#endif +#include <comphelper/string.hxx> +using comphelper::string::ConstAsciiString; namespace dbaui { diff --git a/dbaccess/source/inc/sdbtstrings.hrc b/dbaccess/source/inc/sdbtstrings.hrc index c4837f52bce1..f14854a7f596 100644 --- a/dbaccess/source/inc/sdbtstrings.hrc +++ b/dbaccess/source/inc/sdbtstrings.hrc @@ -27,9 +27,9 @@ #ifndef DBACCESS_SHARED_SDBTSTRINGS_HRC #define DBACCESS_SHARED_SDBTSTRINGS_HRC -#ifndef _RTL_USTRING_HXX_ #include <rtl/ustring.hxx> -#endif +#include <comphelper/string.hxx> +using comphelper::string::ConstAsciiString; namespace sdbtools { diff --git a/dbaccess/source/inc/xmlstrings.hrc b/dbaccess/source/inc/xmlstrings.hrc index db5a729e2ea6..e1e891e31f7d 100644 --- a/dbaccess/source/inc/xmlstrings.hrc +++ b/dbaccess/source/inc/xmlstrings.hrc @@ -27,9 +27,9 @@ #ifndef DBACCESS_SHARED_XMLSTRINGS_HRC #define DBACCESS_SHARED_XMLSTRINGS_HRC -#ifndef _RTL_USTRING_HXX_ #include <rtl/ustring.hxx> -#endif +#include <comphelper/string.hxx> +using comphelper::string::ConstAsciiString; namespace dbaxml { diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx index a3557049e853..0caddb29b98c 100644 --- a/dbaccess/source/ui/browser/dbloader.cxx +++ b/dbaccess/source/ui/browser/dbloader.cxx @@ -204,12 +204,12 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const :: { } } aImplementations[] = { - ServiceNameToImplName( URL_COMPONENT_FORMGRIDVIEW, "org.openoffice.comp.dbu.OFormGridView" ), - ServiceNameToImplName( URL_COMPONENT_DATASOURCEBROWSER, "org.openoffice.comp.dbu.ODatasourceBrowser" ), - ServiceNameToImplName( URL_COMPONENT_QUERYDESIGN, "org.openoffice.comp.dbu.OQueryDesign" ), - ServiceNameToImplName( URL_COMPONENT_TABLEDESIGN, "org.openoffice.comp.dbu.OTableDesign" ), - ServiceNameToImplName( URL_COMPONENT_RELATIONDESIGN, "org.openoffice.comp.dbu.ORelationDesign" ), - ServiceNameToImplName( URL_COMPONENT_VIEWDESIGN, "org.openoffice.comp.dbu.OViewDesign" ) + ServiceNameToImplName( URL_COMPONENT_FORMGRIDVIEW.ascii, "org.openoffice.comp.dbu.OFormGridView" ), + ServiceNameToImplName( URL_COMPONENT_DATASOURCEBROWSER.ascii, "org.openoffice.comp.dbu.ODatasourceBrowser" ), + ServiceNameToImplName( URL_COMPONENT_QUERYDESIGN.ascii, "org.openoffice.comp.dbu.OQueryDesign" ), + ServiceNameToImplName( URL_COMPONENT_TABLEDESIGN.ascii, "org.openoffice.comp.dbu.OTableDesign" ), + ServiceNameToImplName( URL_COMPONENT_RELATIONDESIGN.ascii, "org.openoffice.comp.dbu.ORelationDesign" ), + ServiceNameToImplName( URL_COMPONENT_VIEWDESIGN.ascii, "org.openoffice.comp.dbu.OViewDesign" ) }; INetURLObject aParser( rURL ); diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index 5e60e7ca24b0..ed2f8717ec7c 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -1162,18 +1162,18 @@ void adjustBrowseBoxColumnWidth( ::svt::EditBrowseBox* _pBox, sal_uInt16 _nColId // check if SQL92 name checking is enabled sal_Bool isSQL92CheckEnabled(const Reference<XConnection>& _xConnection) { - return ::dbtools::getBooleanDataSourceSetting( _xConnection, PROPERTY_ENABLESQL92CHECK ); + return ::dbtools::getBooleanDataSourceSetting( _xConnection, PROPERTY_ENABLESQL92CHECK.ascii ); } // ----------------------------------------------------------------------------- sal_Bool isAppendTableAliasEnabled(const Reference<XConnection>& _xConnection) { - return ::dbtools::getBooleanDataSourceSetting( _xConnection, INFO_APPEND_TABLE_ALIAS ); + return ::dbtools::getBooleanDataSourceSetting( _xConnection, INFO_APPEND_TABLE_ALIAS.ascii ); } // ----------------------------------------------------------------------------- sal_Bool generateAsBeforeTableAlias(const Reference<XConnection>& _xConnection) { - return ::dbtools::getBooleanDataSourceSetting( _xConnection, INFO_AS_BEFORE_CORRELATION_NAME ); + return ::dbtools::getBooleanDataSourceSetting( _xConnection, INFO_AS_BEFORE_CORRELATION_NAME.ascii ); } // ----------------------------------------------------------------------------- diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx index 751145add512..d6a28725ec37 100644 --- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx +++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx @@ -1055,7 +1055,7 @@ namespace aMulti.insert(::std::multimap<sal_Int32 , OTableWindow*>::value_type(aCountIter->second,aCountIter->first)); } - const sal_Bool bUseEscape = ::dbtools::getBooleanDataSourceSetting( _xConnection, PROPERTY_OUTERJOINESCAPE ); + const sal_Bool bUseEscape = ::dbtools::getBooleanDataSourceSetting( _xConnection, PROPERTY_OUTERJOINESCAPE.ascii ); ::std::multimap<sal_Int32 , OTableWindow*>::reverse_iterator aRIter = aMulti.rbegin(); ::std::multimap<sal_Int32 , OTableWindow*>::reverse_iterator aREnd = aMulti.rend(); for(;aRIter != aREnd;++aRIter) diff --git a/dbaccess/source/ui/uno/ColumnControl.cxx b/dbaccess/source/ui/uno/ColumnControl.cxx index 16dec735db19..9c240e448712 100644 --- a/dbaccess/source/ui/uno/ColumnControl.cxx +++ b/dbaccess/source/ui/uno/ColumnControl.cxx @@ -52,7 +52,7 @@ OColumnControl::OColumnControl(const Reference<XMultiServiceFactory>& _rxFactory { } // ----------------------------------------------------------------------------- -IMPLEMENT_SERVICE_INFO2_STATIC(OColumnControl,SERVICE_CONTROLDEFAULT,"com.sun.star.awt.UnoControl","com.sun.star.sdb.ColumnDescriptorControl") +IMPLEMENT_SERVICE_INFO2_STATIC(OColumnControl,SERVICE_CONTROLDEFAULT.ascii,"com.sun.star.awt.UnoControl","com.sun.star.sdb.ColumnDescriptorControl") // ----------------------------------------------------------------------------- ::rtl::OUString OColumnControl::GetComponentServiceName() { diff --git a/dbaccess/source/ui/uno/ColumnPeer.cxx b/dbaccess/source/ui/uno/ColumnPeer.cxx index 07902e808b81..4b583571bcc2 100644 --- a/dbaccess/source/ui/uno/ColumnPeer.cxx +++ b/dbaccess/source/ui/uno/ColumnPeer.cxx @@ -126,12 +126,12 @@ void OColumnPeer::setProperty( const ::rtl::OUString& _rPropertyName, const Any& { SolarMutexGuard aGuard; - if ( 0 == _rPropertyName.compareToAscii( PROPERTY_COLUMN ) ) + if (_rPropertyName.equalsAsciiL(PROPERTY_COLUMN.ascii, PROPERTY_COLUMN.length) ) { Reference<XPropertySet> xProp(Value,UNO_QUERY); setColumn(xProp); } - else if ( 0 == _rPropertyName.compareToAscii( PROPERTY_ACTIVE_CONNECTION ) ) + else if (_rPropertyName.equalsAsciiL(PROPERTY_ACTIVE_CONNECTION.ascii, PROPERTY_ACTIVE_CONNECTION.length) ) { Reference<XConnection> xCon(Value,UNO_QUERY); setConnection(xCon); @@ -144,11 +144,11 @@ Any OColumnPeer::getProperty( const ::rtl::OUString& _rPropertyName ) throw( Run { Any aProp; OFieldDescControl* pFieldControl = static_cast<OFieldDescControl*>( GetWindow() ); - if ( pFieldControl && 0 == _rPropertyName.compareToAscii( PROPERTY_COLUMN ) ) + if (pFieldControl && _rPropertyName.equalsAsciiL(PROPERTY_COLUMN.ascii, PROPERTY_COLUMN.length)) { aProp <<= m_xColumn; } - else if ( pFieldControl && 0 == _rPropertyName.compareToAscii( PROPERTY_ACTIVE_CONNECTION ) ) + else if (pFieldControl && _rPropertyName.equalsAsciiL(PROPERTY_ACTIVE_CONNECTION.ascii, PROPERTY_ACTIVE_CONNECTION.length)) { aProp <<= pFieldControl->getConnection(); } diff --git a/dbaccess/source/ui/uno/unoDirectSql.cxx b/dbaccess/source/ui/uno/unoDirectSql.cxx index 90219f268d31..931862f97287 100644 --- a/dbaccess/source/ui/uno/unoDirectSql.cxx +++ b/dbaccess/source/ui/uno/unoDirectSql.cxx @@ -80,7 +80,7 @@ DBG_NAME(ODirectSQLDialog) IMPLEMENT_IMPLEMENTATION_ID( ODirectSQLDialog ) //--------------------------------------------------------------------- - IMPLEMENT_SERVICE_INFO1_STATIC( ODirectSQLDialog, "com.sun.star.comp.sdb.DirectSQLDialog", SERVICE_SDB_DIRECTSQLDIALOG ) + IMPLEMENT_SERVICE_INFO1_STATIC( ODirectSQLDialog, "com.sun.star.comp.sdb.DirectSQLDialog", SERVICE_SDB_DIRECTSQLDIALOG.ascii ) //--------------------------------------------------------------------- IMPLEMENT_PROPERTYCONTAINER_DEFAULTS( ODirectSQLDialog ) diff --git a/extensions/source/propctrlr/stringdefine.hxx b/extensions/source/propctrlr/stringdefine.hxx index 2394c987fd3e..80294607f65c 100644 --- a/extensions/source/propctrlr/stringdefine.hxx +++ b/extensions/source/propctrlr/stringdefine.hxx @@ -30,52 +30,12 @@ #define _EXTENSIONS_FORMSCTRLR_STRINGDEFINE_HXX_ #include <rtl/ustring.hxx> +#include <comphelper/string.hxx> //............................................................................ namespace pcr { -//............................................................................ - - //============================================================ - //= a helper for static ascii pseudo-unicode strings - //============================================================ - struct ConstAsciiString - { - const sal_Char* ascii; - sal_Int32 length; - - inline operator const ::rtl::OUString& () const; - inline operator const sal_Char* () const { return ascii; } - - inline ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength); - inline ~ConstAsciiString(); - - private: - mutable ::rtl::OUString* ustring; - }; - - //------------------------------------------------------------ - inline ConstAsciiString::ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength) - :ascii(_pAsciiZeroTerminated) - ,length(_nLength) - ,ustring(NULL) - { - } - - //------------------------------------------------------------ - inline ConstAsciiString::~ConstAsciiString() - { - delete ustring; - ustring = NULL; - } - - //------------------------------------------------------------ - inline ConstAsciiString::operator const ::rtl::OUString& () const - { - if (!ustring) - ustring = new ::rtl::OUString(ascii, length, RTL_TEXTENCODING_ASCII_US); - return *ustring; - } + using comphelper::string::ConstAsciiString; //============================================================ @@ -88,7 +48,7 @@ namespace pcr #ifndef PCR_IMPLEMENT_STRINGS #define PCR_CONSTASCII_STRING(ident, string) extern const ConstAsciiString ident #else - #define PCR_CONSTASCII_STRING(ident, string) extern const ConstAsciiString ident(string, sizeof(string)-1) + #define PCR_CONSTASCII_STRING(ident, string) extern const ConstAsciiString ident = {RTL_CONSTASCII_STRINGPARAM(string)} #endif //............................................................................ diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx index b3ceefaf2493..8203be079877 100644 --- a/forms/source/component/Button.cxx +++ b/forms/source/component/Button.cxx @@ -665,7 +665,7 @@ namespace { const sal_Int32 nPrefixLen = URL_CONTROLLER_PREFIX.length; return ( _rURL.getLength() > nPrefixLen ) - && ( _rURL.compareToAscii( URL_CONTROLLER_PREFIX, nPrefixLen ) == 0 ); + && ( _rURL.compareToAscii( URL_CONTROLLER_PREFIX.ascii, nPrefixLen ) == 0 ); } } diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 287594d5ef14..58d5f40d5c7c 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -2372,7 +2372,7 @@ void ODatabaseForm::invlidateParameters() //------------------------------------------------------------------------------ void ODatabaseForm::_propertyChanged(const PropertyChangeEvent& evt) throw( RuntimeException ) { - if ((0 == evt.PropertyName.compareToAscii(PROPERTY_ACTIVE_CONNECTION)) && !m_bForwardingConnection) + if ((evt.PropertyName.equalsAsciiL(PROPERTY_ACTIVE_CONNECTION.ascii, PROPERTY_ACTIVE_CONNECTION.length)) && !m_bForwardingConnection) { // the rowset changed its active connection itself (without interaction from our side), so // we need to fire this event, too diff --git a/forms/source/helper/formnavigation.cxx b/forms/source/helper/formnavigation.cxx index 1a08bfce9803..63f059e75db5 100644 --- a/forms/source/helper/formnavigation.cxx +++ b/forms/source/helper/formnavigation.cxx @@ -427,25 +427,25 @@ namespace frm { static const FeatureURL s_aFeatureURLs[] = { - FeatureURL( FormFeature::MoveAbsolute, URL_FORM_POSITION ), - FeatureURL( FormFeature::TotalRecords, URL_FORM_RECORDCOUNT ), - FeatureURL( FormFeature::MoveToFirst, URL_RECORD_FIRST ), - FeatureURL( FormFeature::MoveToPrevious, URL_RECORD_PREV ), - FeatureURL( FormFeature::MoveToNext, URL_RECORD_NEXT ), - FeatureURL( FormFeature::MoveToLast, URL_RECORD_LAST ), - FeatureURL( FormFeature::SaveRecordChanges, URL_RECORD_SAVE ), - FeatureURL( FormFeature::UndoRecordChanges, URL_RECORD_UNDO ), - FeatureURL( FormFeature::MoveToInsertRow, URL_RECORD_NEW ), - FeatureURL( FormFeature::DeleteRecord, URL_RECORD_DELETE ), - FeatureURL( FormFeature::ReloadForm, URL_FORM_REFRESH ), - FeatureURL( FormFeature::RefreshCurrentControl, URL_FORM_REFRESH_CURRENT_CONTROL ), - FeatureURL( FormFeature::SortAscending, URL_FORM_SORT_UP ), - FeatureURL( FormFeature::SortDescending, URL_FORM_SORT_DOWN ), - FeatureURL( FormFeature::InteractiveSort, URL_FORM_SORT ), - FeatureURL( FormFeature::AutoFilter, URL_FORM_AUTO_FILTER ), - FeatureURL( FormFeature::InteractiveFilter, URL_FORM_FILTER ), - FeatureURL( FormFeature::ToggleApplyFilter, URL_FORM_APPLY_FILTER ), - FeatureURL( FormFeature::RemoveFilterAndSort, URL_FORM_REMOVE_FILTER ), + FeatureURL( FormFeature::MoveAbsolute, URL_FORM_POSITION.ascii ), + FeatureURL( FormFeature::TotalRecords, URL_FORM_RECORDCOUNT.ascii ), + FeatureURL( FormFeature::MoveToFirst, URL_RECORD_FIRST.ascii ), + FeatureURL( FormFeature::MoveToPrevious, URL_RECORD_PREV.ascii ), + FeatureURL( FormFeature::MoveToNext, URL_RECORD_NEXT.ascii ), + FeatureURL( FormFeature::MoveToLast, URL_RECORD_LAST.ascii ), + FeatureURL( FormFeature::SaveRecordChanges, URL_RECORD_SAVE.ascii ), + FeatureURL( FormFeature::UndoRecordChanges, URL_RECORD_UNDO.ascii ), + FeatureURL( FormFeature::MoveToInsertRow, URL_RECORD_NEW.ascii ), + FeatureURL( FormFeature::DeleteRecord, URL_RECORD_DELETE.ascii ), + FeatureURL( FormFeature::ReloadForm, URL_FORM_REFRESH.ascii ), + FeatureURL( FormFeature::RefreshCurrentControl, URL_FORM_REFRESH_CURRENT_CONTROL.ascii ), + FeatureURL( FormFeature::SortAscending, URL_FORM_SORT_UP.ascii ), + FeatureURL( FormFeature::SortDescending, URL_FORM_SORT_DOWN.ascii ), + FeatureURL( FormFeature::InteractiveSort, URL_FORM_SORT.ascii ), + FeatureURL( FormFeature::AutoFilter, URL_FORM_AUTO_FILTER.ascii ), + FeatureURL( FormFeature::InteractiveFilter, URL_FORM_FILTER.ascii ), + FeatureURL( FormFeature::ToggleApplyFilter, URL_FORM_APPLY_FILTER.ascii ), + FeatureURL( FormFeature::RemoveFilterAndSort, URL_FORM_REMOVE_FILTER.ascii ), FeatureURL( 0, NULL ) }; return s_aFeatureURLs; diff --git a/forms/source/inc/frm_strings.hxx b/forms/source/inc/frm_strings.hxx index b6c3e8fcce79..f74b411d4713 100644 --- a/forms/source/inc/frm_strings.hxx +++ b/forms/source/inc/frm_strings.hxx @@ -31,56 +31,19 @@ #include <sal/types.h> #include <rtl/ustring.hxx> +#include <comphelper/string.hxx> //.............................................................................. namespace frm { -//.............................................................................. - - struct ConstAsciiString - { - const sal_Char* ascii; - sal_Int32 length; - - inline operator ::rtl::OUString () const; - inline operator const sal_Char* () const { return ascii; } - - inline ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength); - inline ~ConstAsciiString(); - - private: - mutable ::rtl::OUString* ustring; - }; - - //------------------------------------------------------------ - inline ConstAsciiString::ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength) - :ascii(_pAsciiZeroTerminated) - ,length(_nLength) - ,ustring(NULL) - { - } - - //------------------------------------------------------------ - inline ConstAsciiString::~ConstAsciiString() - { - delete ustring; - ustring = NULL; - } - - //------------------------------------------------------------ - inline ConstAsciiString::operator ::rtl::OUString () const - { - if ( !ustring ) - ustring = new ::rtl::OUString( ascii, length, RTL_TEXTENCODING_ASCII_US ); - return *ustring; - } + using comphelper::string::ConstAsciiString; #ifndef FORMS_IMPLEMENT_STRINGS #define FORMS_CONSTASCII_STRING( ident, string ) \ extern const ConstAsciiString ident #else #define FORMS_CONSTASCII_STRING( ident, string ) \ - extern const ConstAsciiString ident( string, sizeof( string )-1 ) + extern const ConstAsciiString ident = {RTL_CONSTASCII_STRINGPARAM(string)} #endif //.............................................................................. diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx index 06119a604baf..dd142d48826a 100644 --- a/reportdesign/source/core/sdr/RptObject.cxx +++ b/reportdesign/source/core/sdr/RptObject.cxx @@ -188,7 +188,7 @@ namespace virtual ::com::sun::star::uno::Any operator() (const ::rtl::OUString& _sPropertyName,const ::com::sun::star::uno::Any& lhs) const { uno::Any aRet; - if ( _sPropertyName.equalsAscii(PROPERTY_PARAADJUST) ) + if (_sPropertyName.equalsAsciiL(PROPERTY_PARAADJUST.ascii, PROPERTY_PARAADJUST.length)) { sal_Int16 nTextAlign = 0; lhs >>= nTextAlign; diff --git a/reportdesign/source/filter/xml/xmlColumn.cxx b/reportdesign/source/filter/xml/xmlColumn.cxx index 5c5f76eecca2..0a584381fa16 100644 --- a/reportdesign/source/filter/xml/xmlColumn.cxx +++ b/reportdesign/source/filter/xml/xmlColumn.cxx @@ -142,8 +142,8 @@ void OXMLRowColumn::fillStyle(const ::rtl::OUString& _sStyleName) PropertySetInfo* pInfo = new PropertySetInfo(); static PropertyMapEntry pMap[] = { - {PROPERTY_WIDTH, static_cast<sal_uInt16>(PROPERTY_WIDTH.length), PROPERTY_ID_WIDTH, &::getCppuType(static_cast< sal_Int32* >( NULL )) ,PropertyAttribute::BOUND,0}, - {PROPERTY_HEIGHT, static_cast<sal_uInt16>(PROPERTY_HEIGHT.length), PROPERTY_ID_HEIGHT, &::getCppuType(static_cast< sal_Int32* >( NULL )) ,PropertyAttribute::BOUND,0}, + {PROPERTY_WIDTH.ascii, static_cast<sal_uInt16>(PROPERTY_WIDTH.length), PROPERTY_ID_WIDTH, &::getCppuType(static_cast< sal_Int32* >( NULL )) ,PropertyAttribute::BOUND,0}, + {PROPERTY_HEIGHT.ascii, static_cast<sal_uInt16>(PROPERTY_HEIGHT.length), PROPERTY_ID_HEIGHT, &::getCppuType(static_cast< sal_Int32* >( NULL )) ,PropertyAttribute::BOUND,0}, { NULL, 0, 0, NULL, 0, 0 } }; pInfo->add(pMap); diff --git a/reportdesign/source/filter/xml/xmlHelper.cxx b/reportdesign/source/filter/xml/xmlHelper.cxx index ea9bf597f284..7009fd062e94 100644 --- a/reportdesign/source/filter/xml/xmlHelper.cxx +++ b/reportdesign/source/filter/xml/xmlHelper.cxx @@ -122,7 +122,7 @@ const XMLPropertyHandler* OPropertyHandlerFactory::GetPropertyHandler(sal_Int32 #define MAP_CONST_ASCII( name, prefix, token, type, context ) { name, sizeof(name)-1, XML_NAMESPACE_##prefix, XML_##token, type|XML_TYPE_PROP_TEXT, context, SvtSaveOptions::ODFVER_010 } #define GMAP( name, prefix, token, type, context ) { name.ascii, name.length, XML_NAMESPACE_##prefix, XML_##token, type|XML_TYPE_PROP_GRAPHIC, context, SvtSaveOptions::ODFVER_010 } #define MAP_CONST_C_ASCII( name, prefix, token, type, context ) { name, sizeof(name)-1, XML_NAMESPACE_##prefix, XML_##token, type|XML_TYPE_PROP_TABLE_CELL, context, SvtSaveOptions::ODFVER_010 } -#define MAP_CONST_C( name, prefix, token, type, context ) { name, name.length, XML_NAMESPACE_##prefix, XML_##token, type|XML_TYPE_PROP_TABLE_CELL, context, SvtSaveOptions::ODFVER_010 } +#define MAP_CONST_C( name, prefix, token, type, context ) { name.ascii, name.length, XML_NAMESPACE_##prefix, XML_##token, type|XML_TYPE_PROP_TABLE_CELL, context, SvtSaveOptions::ODFVER_010 } #define MAP_END() { NULL, 0, 0, XML_TOKEN_INVALID, 0 ,0, SvtSaveOptions::ODFVER_010} // ----------------------------------------------------------------------------- UniReference < XMLPropertySetMapper > OXMLHelper::GetCellStylePropertyMap(bool _bOldFormat) @@ -275,22 +275,22 @@ void OXMLHelper::copyStyleElements(const bool _bOld,const ::rtl::OUString& _sSty ::com::sun::star::awt::FontDescriptor aFont; static comphelper::PropertyMapEntry pMap[] = { - {PROPERTY_FONTNAME, static_cast<sal_uInt16>(PROPERTY_FONTNAME.length), PROPERTY_ID_FONTNAME, &::getCppuType(&aFont.Name) ,PropertyAttribute::BOUND,0}, - {PROPERTY_CHARFONTHEIGHT, static_cast<sal_uInt16>(PROPERTY_CHARFONTHEIGHT.length), PROPERTY_ID_FONTHEIGHT, &::getCppuType(&aFont.Height) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTWIDTH, static_cast<sal_uInt16>(PROPERTY_FONTWIDTH.length), PROPERTY_ID_FONTWIDTH, &::getCppuType(&aFont.Width) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTSTYLENAME, static_cast<sal_uInt16>(PROPERTY_FONTSTYLENAME.length), PROPERTY_ID_FONTSTYLENAME, &::getCppuType(&aFont.StyleName) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTFAMILY, static_cast<sal_uInt16>(PROPERTY_FONTFAMILY.length), PROPERTY_ID_FONTFAMILY, &::getCppuType(&aFont.Family) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTCHARSET, static_cast<sal_uInt16>(PROPERTY_FONTCHARSET.length), PROPERTY_ID_FONTCHARSET, &::getCppuType(&aFont.CharSet) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTPITCH, static_cast<sal_uInt16>(PROPERTY_FONTPITCH.length), PROPERTY_ID_FONTPITCH, &::getCppuType(&aFont.Pitch) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTCHARWIDTH, static_cast<sal_uInt16>(PROPERTY_FONTCHARWIDTH.length), PROPERTY_ID_FONTCHARWIDTH, &::getCppuType(&aFont.CharacterWidth),PropertyAttribute::BOUND,0}, - {PROPERTY_FONTWEIGHT, static_cast<sal_uInt16>(PROPERTY_FONTWEIGHT.length), PROPERTY_ID_FONTWEIGHT, &::getCppuType(&aFont.Weight) ,PropertyAttribute::BOUND,0}, - {PROPERTY_CHARPOSTURE, static_cast<sal_uInt16>(PROPERTY_CHARPOSTURE.length), PROPERTY_ID_FONTSLANT, &::getCppuType(&aFont.Slant) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTUNDERLINE, static_cast<sal_uInt16>(PROPERTY_FONTUNDERLINE.length), PROPERTY_ID_FONTUNDERLINE, &::getCppuType(&aFont.Underline) ,PropertyAttribute::BOUND,0}, - {PROPERTY_CHARSTRIKEOUT, static_cast<sal_uInt16>(PROPERTY_CHARSTRIKEOUT.length), PROPERTY_ID_FONTSTRIKEOUT, &::getCppuType(&aFont.Strikeout) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTORIENTATION, static_cast<sal_uInt16>(PROPERTY_FONTORIENTATION.length), PROPERTY_ID_FONTORIENTATION, &::getCppuType(&aFont.Orientation) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTKERNING, static_cast<sal_uInt16>(PROPERTY_FONTKERNING.length), PROPERTY_ID_FONTKERNING, &::getCppuType(&aFont.Kerning) ,PropertyAttribute::BOUND,0}, - {PROPERTY_CHARWORDMODE, static_cast<sal_uInt16>(PROPERTY_CHARWORDMODE.length), PROPERTY_ID_FONTWORDLINEMODE, &::getCppuType(&aFont.WordLineMode) ,PropertyAttribute::BOUND,0}, - {PROPERTY_FONTTYPE, static_cast<sal_uInt16>(PROPERTY_FONTTYPE.length), PROPERTY_ID_FONTTYPE, &::getCppuType(&aFont.Type) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTNAME.ascii, static_cast<sal_uInt16>(PROPERTY_FONTNAME.length), PROPERTY_ID_FONTNAME, &::getCppuType(&aFont.Name) ,PropertyAttribute::BOUND,0}, + {PROPERTY_CHARFONTHEIGHT.ascii, static_cast<sal_uInt16>(PROPERTY_CHARFONTHEIGHT.length), PROPERTY_ID_FONTHEIGHT, &::getCppuType(&aFont.Height) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTWIDTH.ascii, static_cast<sal_uInt16>(PROPERTY_FONTWIDTH.length), PROPERTY_ID_FONTWIDTH, &::getCppuType(&aFont.Width) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTSTYLENAME.ascii, static_cast<sal_uInt16>(PROPERTY_FONTSTYLENAME.length), PROPERTY_ID_FONTSTYLENAME, &::getCppuType(&aFont.StyleName) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTFAMILY.ascii, static_cast<sal_uInt16>(PROPERTY_FONTFAMILY.length), PROPERTY_ID_FONTFAMILY, &::getCppuType(&aFont.Family) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTCHARSET.ascii, static_cast<sal_uInt16>(PROPERTY_FONTCHARSET.length), PROPERTY_ID_FONTCHARSET, &::getCppuType(&aFont.CharSet) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTPITCH.ascii, static_cast<sal_uInt16>(PROPERTY_FONTPITCH.length), PROPERTY_ID_FONTPITCH, &::getCppuType(&aFont.Pitch) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTCHARWIDTH.ascii, static_cast<sal_uInt16>(PROPERTY_FONTCHARWIDTH.length), PROPERTY_ID_FONTCHARWIDTH, &::getCppuType(&aFont.CharacterWidth),PropertyAttribute::BOUND,0}, + {PROPERTY_FONTWEIGHT.ascii, static_cast<sal_uInt16>(PROPERTY_FONTWEIGHT.length), PROPERTY_ID_FONTWEIGHT, &::getCppuType(&aFont.Weight) ,PropertyAttribute::BOUND,0}, + {PROPERTY_CHARPOSTURE.ascii, static_cast<sal_uInt16>(PROPERTY_CHARPOSTURE.length), PROPERTY_ID_FONTSLANT, &::getCppuType(&aFont.Slant) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTUNDERLINE.ascii, static_cast<sal_uInt16>(PROPERTY_FONTUNDERLINE.length), PROPERTY_ID_FONTUNDERLINE, &::getCppuType(&aFont.Underline) ,PropertyAttribute::BOUND,0}, + {PROPERTY_CHARSTRIKEOUT.ascii, static_cast<sal_uInt16>(PROPERTY_CHARSTRIKEOUT.length), PROPERTY_ID_FONTSTRIKEOUT, &::getCppuType(&aFont.Strikeout) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTORIENTATION.ascii, static_cast<sal_uInt16>(PROPERTY_FONTORIENTATION.length), PROPERTY_ID_FONTORIENTATION, &::getCppuType(&aFont.Orientation) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTKERNING.ascii, static_cast<sal_uInt16>(PROPERTY_FONTKERNING.length), PROPERTY_ID_FONTKERNING, &::getCppuType(&aFont.Kerning) ,PropertyAttribute::BOUND,0}, + {PROPERTY_CHARWORDMODE.ascii, static_cast<sal_uInt16>(PROPERTY_CHARWORDMODE.length), PROPERTY_ID_FONTWORDLINEMODE, &::getCppuType(&aFont.WordLineMode) ,PropertyAttribute::BOUND,0}, + {PROPERTY_FONTTYPE.ascii, static_cast<sal_uInt16>(PROPERTY_FONTTYPE.length), PROPERTY_ID_FONTTYPE, &::getCppuType(&aFont.Type) ,PropertyAttribute::BOUND,0}, { NULL, 0, 0, NULL, 0, 0 } }; try @@ -338,10 +338,10 @@ uno::Reference<beans::XPropertySet> OXMLHelper::createBorderPropertySet() { static comphelper::PropertyMapEntry pMap[] = { - {PROPERTY_BORDERLEFT, static_cast<sal_uInt16>(PROPERTY_BORDERLEFT.length), 0, &::getCppuType((const table::BorderLine*)0) ,PropertyAttribute::BOUND,0}, - {PROPERTY_BORDERRIGHT, static_cast<sal_uInt16>(PROPERTY_BORDERRIGHT.length), 1, &::getCppuType((const table::BorderLine*)0) ,PropertyAttribute::BOUND,0}, - {PROPERTY_BORDERTOP, static_cast<sal_uInt16>(PROPERTY_BORDERTOP.length), 2, &::getCppuType((const table::BorderLine*)0) ,PropertyAttribute::BOUND,0}, - {PROPERTY_BORDERBOTTOM, static_cast<sal_uInt16>(PROPERTY_BORDERBOTTOM.length), 3, &::getCppuType((const table::BorderLine*)0) ,PropertyAttribute::BOUND,0}, + {PROPERTY_BORDERLEFT.ascii, static_cast<sal_uInt16>(PROPERTY_BORDERLEFT.length), 0, &::getCppuType((const table::BorderLine*)0) ,PropertyAttribute::BOUND,0}, + {PROPERTY_BORDERRIGHT.ascii, static_cast<sal_uInt16>(PROPERTY_BORDERRIGHT.length), 1, &::getCppuType((const table::BorderLine*)0) ,PropertyAttribute::BOUND,0}, + {PROPERTY_BORDERTOP.ascii, static_cast<sal_uInt16>(PROPERTY_BORDERTOP.length), 2, &::getCppuType((const table::BorderLine*)0) ,PropertyAttribute::BOUND,0}, + {PROPERTY_BORDERBOTTOM.ascii, static_cast<sal_uInt16>(PROPERTY_BORDERBOTTOM.length), 3, &::getCppuType((const table::BorderLine*)0) ,PropertyAttribute::BOUND,0}, { NULL, 0, 0, NULL, 0, 0 } }; return comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(pMap)); diff --git a/reportdesign/source/inc/constasciistring.hxx b/reportdesign/source/inc/constasciistring.hxx index 157923d36b5c..f4d38af3f5f4 100644 --- a/reportdesign/source/inc/constasciistring.hxx +++ b/reportdesign/source/inc/constasciistring.hxx @@ -9,55 +9,12 @@ // no namespaces. This file is included from several other files _within_ a namespace. //============================================================ -//= a helper for static ascii pseudo-unicode strings -//============================================================ -// string constants -struct ConstAsciiString -{ - const sal_Char* ascii; - sal_Int32 length; - - inline operator const ::rtl::OUString& () const; - inline operator const sal_Char* () const { return ascii; } - - inline ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength); - inline ~ConstAsciiString(); - -private: - mutable ::rtl::OUString* ustring; -}; - -//------------------------------------------------------------ -inline ConstAsciiString::ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength) - :ascii(_pAsciiZeroTerminated) - ,length(_nLength) - ,ustring(NULL) -{ -} - -//------------------------------------------------------------ -inline ConstAsciiString::~ConstAsciiString() -{ - delete ustring; - ustring = NULL; -} - -//------------------------------------------------------------ -inline ConstAsciiString::operator const ::rtl::OUString& () const -{ - if (!ustring) - ustring = new ::rtl::OUString(ascii, length, RTL_TEXTENCODING_ASCII_US); - return *ustring; -} - -//============================================================ #define DECLARE_CONSTASCII_USTRING( name ) \ extern const ConstAsciiString name #define IMPLEMENT_CONSTASCII_USTRING( name, string ) \ - const ConstAsciiString name(string, sizeof(string)-1) - + const ConstAsciiString name = {RTL_CONSTASCII_STRINGPARAM(string)} #endif // _RPTSHARED_CONSTASCIISTRING_HXX_ diff --git a/reportdesign/source/inc/corestrings.hrc b/reportdesign/source/inc/corestrings.hrc index 42f9dd829ad4..0fb95ea0b364 100644 --- a/reportdesign/source/inc/corestrings.hrc +++ b/reportdesign/source/inc/corestrings.hrc @@ -27,9 +27,9 @@ #ifndef REPORTDESIGN_SHARED_CORESTRINGS_HRC #define REPORTDESIGN_SHARED_CORESTRINGS_HRC -#ifndef _RTL_USTRING_HXX_ #include <rtl/ustring.hxx> -#endif +#include <comphelper/string.hxx> +using comphelper::string::ConstAsciiString; namespace reportdesign { diff --git a/reportdesign/source/inc/uistrings.hrc b/reportdesign/source/inc/uistrings.hrc index 84807be6904e..b3543c37724e 100644 --- a/reportdesign/source/inc/uistrings.hrc +++ b/reportdesign/source/inc/uistrings.hrc @@ -27,9 +27,9 @@ #ifndef REPORTDESIGN_SHARED_UISTRINGS_HRC #define REPORTDESIGN_SHARED_UISTRINGS_HRC -#ifndef _RTL_USTRING_HXX_ #include <rtl/ustring.hxx> -#endif +#include <comphelper/string.hxx> +using comphelper::string::ConstAsciiString; namespace rptui { diff --git a/reportdesign/source/inc/xmlstrings.hrc b/reportdesign/source/inc/xmlstrings.hrc index 3f4a6f216174..8755a399c9f6 100644 --- a/reportdesign/source/inc/xmlstrings.hrc +++ b/reportdesign/source/inc/xmlstrings.hrc @@ -27,9 +27,9 @@ #ifndef REPORTDESIGN_SHARED_XMLSTRINGS_HRC #define REPORTDESIGN_SHARED_XMLSTRINGS_HRC -#ifndef _RTL_USTRING_HXX_ #include <rtl/ustring.hxx> -#endif +#include <comphelper/string.hxx> +using comphelper::string::ConstAsciiString; namespace rptxml { diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx index 34f6b8bf41cd..2286da7542e2 100644 --- a/reportdesign/source/ui/inspection/GeometryHandler.cxx +++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx @@ -1387,7 +1387,7 @@ inspection::InteractiveSelectionResult SAL_CALL GeometryHandler::onInteractivePr { if ( !_rxInspectorUI.is() ) throw lang::NullPointerException(); - if ( PropertyName.equalsAscii(PROPERTY_FILTER) ) + if (PropertyName.equalsAsciiL(PROPERTY_FILTER.ascii, PROPERTY_FILTER.length)) { ::osl::ClearableMutexGuard aGuard( m_aMutex ); @@ -1400,7 +1400,7 @@ inspection::InteractiveSelectionResult SAL_CALL GeometryHandler::onInteractivePr } return eResult; } - else if ( PropertyName.equalsAscii(PROPERTY_FONT) ) + else if (PropertyName.equalsAsciiL(PROPERTY_FONT.ascii, PROPERTY_FONT.length)) { ::osl::ClearableMutexGuard aGuard( m_aMutex ); @@ -1417,10 +1417,10 @@ inspection::InteractiveSelectionResult SAL_CALL GeometryHandler::onInteractivePr } return eResult; } - else if ( PropertyName.equalsAscii(PROPERTY_FORMULA) - || PropertyName.equalsAscii(PROPERTY_INITIALFORMULA) - || PropertyName.equalsAscii(PROPERTY_DATAFIELD) - || PropertyName.equalsAscii(PROPERTY_CONDITIONALPRINTEXPRESSION)) + else if ( PropertyName.equalsAsciiL(PROPERTY_FORMULA.ascii, PROPERTY_FORMULA.length) + || PropertyName.equalsAsciiL(PROPERTY_INITIALFORMULA.ascii, PROPERTY_INITIALFORMULA.length) + || PropertyName.equalsAsciiL(PROPERTY_DATAFIELD.ascii, PROPERTY_INITIALFORMULA.length) + || PropertyName.equalsAsciiL(PROPERTY_CONDITIONALPRINTEXPRESSION.ascii, PROPERTY_CONDITIONALPRINTEXPRESSION.length)) { ::osl::ClearableMutexGuard aGuard( m_aMutex ); @@ -1440,7 +1440,7 @@ inspection::InteractiveSelectionResult SAL_CALL GeometryHandler::onInteractivePr } return eResult; } - else if ( PropertyName.equalsAscii(PROPERTY_AREA) ) + else if (PropertyName.equalsAsciiL(PROPERTY_AREA.ascii, PROPERTY_AREA.length)) { ::osl::ClearableMutexGuard aGuard( m_aMutex ); diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index 75a4ad4800b7..cdddcf384918 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -818,28 +818,28 @@ void applyCharacterSettings( const uno::Reference< report::XReportControlFormat _rxReportControlFormat->setCharFontNameComplex( sTemp ); } - lcl_applyFontAttribute( aSettings, PROPERTY_CHARSHADOWED, _rxReportControlFormat, &report::XReportControlFormat::setCharShadowed ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARCONTOURED, _rxReportControlFormat, &report::XReportControlFormat::setCharContoured ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARUNDERLINECOLOR, _rxReportControlFormat, &report::XReportControlFormat::setCharUnderlineColor ); - lcl_applyFontAttribute( aSettings, PROPERTY_PARAADJUST, _rxReportControlFormat, &report::XReportControlFormat::setParaAdjust ); - lcl_applyFontAttribute( aSettings, PROPERTY_VERTICALALIGN, _rxReportControlFormat, &report::XReportControlFormat::setVerticalAlign ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARRELIEF, _rxReportControlFormat, &report::XReportControlFormat::setCharRelief ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARHIDDEN, _rxReportControlFormat, &report::XReportControlFormat::setCharHidden ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARAUTOKERNING, _rxReportControlFormat, &report::XReportControlFormat::setCharAutoKerning ); - lcl_applyFontAttribute( aSettings, PROPERTY_CONTROLBACKGROUND, _rxReportControlFormat, &report::XReportControlFormat::setControlBackground ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARFLASH, _rxReportControlFormat, &report::XReportControlFormat::setCharFlash ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHAREMPHASIS, _rxReportControlFormat, &report::XReportControlFormat::setCharEmphasis ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINEISON, _rxReportControlFormat, &report::XReportControlFormat::setCharCombineIsOn ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINEPREFIX, _rxReportControlFormat, &report::XReportControlFormat::setCharCombinePrefix ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINESUFFIX, _rxReportControlFormat, &report::XReportControlFormat::setCharCombineSuffix ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOLOR, _rxReportControlFormat, &report::XReportControlFormat::setCharColor ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARKERNING, _rxReportControlFormat, &report::XReportControlFormat::setCharKerning ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARCASEMAP, _rxReportControlFormat, &report::XReportControlFormat::setCharCaseMap ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALE, _rxReportControlFormat, &report::XReportControlFormat::setCharLocale ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARESCAPEMENT, _rxReportControlFormat, &report::XReportControlFormat::setCharEscapement ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARESCAPEMENTHEIGHT, _rxReportControlFormat, &report::XReportControlFormat::setCharEscapementHeight ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALEASIAN, _rxReportControlFormat, &report::XReportControlFormat::setCharLocaleAsian ); - lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALECOMPLEX, _rxReportControlFormat, &report::XReportControlFormat::setCharLocaleComplex ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARSHADOWED.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharShadowed ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARCONTOURED.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharContoured ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARUNDERLINECOLOR.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharUnderlineColor ); + lcl_applyFontAttribute( aSettings, PROPERTY_PARAADJUST.ascii, _rxReportControlFormat, &report::XReportControlFormat::setParaAdjust ); + lcl_applyFontAttribute( aSettings, PROPERTY_VERTICALALIGN.ascii, _rxReportControlFormat, &report::XReportControlFormat::setVerticalAlign ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARRELIEF.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharRelief ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARHIDDEN.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharHidden ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARAUTOKERNING.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharAutoKerning ); + lcl_applyFontAttribute( aSettings, PROPERTY_CONTROLBACKGROUND.ascii, _rxReportControlFormat, &report::XReportControlFormat::setControlBackground ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARFLASH.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharFlash ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHAREMPHASIS.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharEmphasis ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINEISON.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharCombineIsOn ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINEPREFIX.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharCombinePrefix ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOMBINESUFFIX.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharCombineSuffix ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARCOLOR.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharColor ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARKERNING.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharKerning ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARCASEMAP.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharCaseMap ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALE.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharLocale ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARESCAPEMENT.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharEscapement ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARESCAPEMENTHEIGHT.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharEscapementHeight ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALEASIAN.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharLocaleAsian ); + lcl_applyFontAttribute( aSettings, PROPERTY_CHARLOCALECOMPLEX.ascii, _rxReportControlFormat, &report::XReportControlFormat::setCharLocaleComplex ); } catch( const uno::Exception& ) { diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx index 4ed795be757c..de85ccfe1e42 100644 --- a/xmloff/source/forms/elementexport.cxx +++ b/xmloff/source/forms/elementexport.cxx @@ -193,7 +193,7 @@ namespace xmloff ::rtl::OUString sToWriteServiceName = sServiceName; #define CHECK_N_TRANSLATE( name ) \ - else if (0 == sServiceName.compareToAscii(SERVICE_PERSISTENT_COMPONENT_##name)) \ + else if (sServiceName.equalsAsciiL(SERVICE_PERSISTENT_COMPONENT_##name.ascii, SERVICE_PERSISTENT_COMPONENT_##name.length)) \ sToWriteServiceName = SERVICE_##name if (sal_False) @@ -218,8 +218,9 @@ namespace xmloff CHECK_N_TRANSLATE( HIDDENCONTROL ); CHECK_N_TRANSLATE( IMAGECONTROL ); CHECK_N_TRANSLATE( FORMATTEDFIELD ); - else if (0 == sServiceName.compareToAscii(SERVICE_PERSISTENT_COMPONENT_EDIT)) - { // special handling for the edit field: we have two controls using this as persistence service name + else if (sServiceName.equalsAsciiL(SERVICE_PERSISTENT_COMPONENT_EDIT.ascii, SERVICE_PERSISTENT_COMPONENT_EDIT.length)) + { + // special handling for the edit field: we have two controls using this as persistence service name sToWriteServiceName = SERVICE_EDIT; Reference< XServiceInfo > xSI(m_xProps, UNO_QUERY); if (xSI.is() && xSI->supportsService(SERVICE_FORMATTEDFIELD)) @@ -611,9 +612,9 @@ namespace xmloff { // attribute flags CCA_CURRENT_SELECTED, CCA_DISABLED, CCA_DROPDOWN, CCA_PRINTABLE, CCA_READONLY, CCA_SELECTED, CCA_TAB_STOP, CCA_ENABLEVISIBLE }; - static const ::rtl::OUString* pBooleanPropertyNames[] = + static const ConstAsciiString pBooleanPropertyNames[] = { // property names - &PROPERTY_STATE, &PROPERTY_ENABLED, &PROPERTY_DROPDOWN, &PROPERTY_PRINTABLE, &PROPERTY_READONLY, &PROPERTY_DEFAULT_STATE, &PROPERTY_TABSTOP, &PROPERTY_ENABLEVISIBLE + PROPERTY_STATE, PROPERTY_ENABLED, PROPERTY_DROPDOWN, PROPERTY_PRINTABLE, PROPERTY_READONLY, PROPERTY_DEFAULT_STATE, PROPERTY_TABSTOP, PROPERTY_ENABLEVISIBLE }; static sal_Bool nBooleanPropertyAttrFlags[] = { // attribute defaults @@ -632,7 +633,7 @@ namespace xmloff exportBooleanPropertyAttribute( OAttributeMetaData::getCommonControlAttributeNamespace(nBooleanPropertyAttributeIds[i]), OAttributeMetaData::getCommonControlAttributeName(nBooleanPropertyAttributeIds[i]), - *(pBooleanPropertyNames[i]), + pBooleanPropertyNames[i], nBooleanPropertyAttrFlags[i]); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking @@ -650,9 +651,9 @@ namespace xmloff { // attribute flags CCA_SIZE, CCA_TAB_INDEX }; - static const ::rtl::OUString* pIntegerPropertyNames[] = + static const ConstAsciiString pIntegerPropertyNames[] = { // property names - &PROPERTY_LINECOUNT, &PROPERTY_TABINDEX + PROPERTY_LINECOUNT, PROPERTY_TABINDEX }; static const sal_Int16 nIntegerPropertyAttrDefaults[] = { // attribute defaults @@ -675,7 +676,7 @@ namespace xmloff exportInt16PropertyAttribute( OAttributeMetaData::getCommonControlAttributeNamespace(nIntegerPropertyAttributeIds[i]), OAttributeMetaData::getCommonControlAttributeName(nIntegerPropertyAttributeIds[i]), - *(pIntegerPropertyNames[i]), + pIntegerPropertyNames[i], nIntegerPropertyAttrDefaults[i]); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking @@ -1013,10 +1014,10 @@ namespace xmloff SCA_VALIDATION, SCA_MULTI_LINE, SCA_AUTOMATIC_COMPLETION, SCA_MULTIPLE, SCA_DEFAULT_BUTTON, SCA_IS_TRISTATE, SCA_TOGGLE, SCA_FOCUS_ON_CLICK }; - static const ::rtl::OUString* pBooleanPropertyNames[] = + static const ConstAsciiString pBooleanPropertyNames[] = { // property names - &PROPERTY_STRICTFORMAT, &PROPERTY_MULTILINE, &PROPERTY_AUTOCOMPLETE, &PROPERTY_MULTISELECTION, &PROPERTY_DEFAULTBUTTON, &PROPERTY_TRISTATE, - &PROPERTY_TOGGLE, &PROPERTY_FOCUS_ON_CLICK + PROPERTY_STRICTFORMAT, PROPERTY_MULTILINE, PROPERTY_AUTOCOMPLETE, PROPERTY_MULTISELECTION, PROPERTY_DEFAULTBUTTON, PROPERTY_TRISTATE, + PROPERTY_TOGGLE, PROPERTY_FOCUS_ON_CLICK }; sal_Int32 nIdCount = SAL_N_ELEMENTS(nBooleanPropertyAttributeIds); #if OSL_DEBUG_LEVEL > 0 @@ -1025,15 +1026,14 @@ namespace xmloff "OControlExport::exportSpecialAttributes: somebody tampered with the maps (1)!"); #endif const sal_Int32* pAttributeId = nBooleanPropertyAttributeIds; - const ::rtl::OUString** pPropertyName = pBooleanPropertyNames; - for ( i = 0; i < nIdCount; ++i, ++pAttributeId, ++pPropertyName ) + for ( i = 0; i < nIdCount; ++i, ++pAttributeId ) { - if ( *pAttributeId& m_nIncludeSpecial) + if ( *pAttributeId & m_nIncludeSpecial) { exportBooleanPropertyAttribute( OAttributeMetaData::getSpecialAttributeNamespace( *pAttributeId ), OAttributeMetaData::getSpecialAttributeName( *pAttributeId ), - *(*pPropertyName), + pBooleanPropertyNames[i], ( *pAttributeId == SCA_FOCUS_ON_CLICK ) ? BOOLATTR_DEFAULT_TRUE : BOOLATTR_DEFAULT_FALSE ); #if OSL_DEBUG_LEVEL > 0 @@ -1051,9 +1051,9 @@ namespace xmloff { // attribute flags SCA_PAGE_STEP_SIZE }; - static const ::rtl::OUString* pIntegerPropertyNames[] = + static const ConstAsciiString pIntegerPropertyNames[] = { // property names - &PROPERTY_BLOCK_INCREMENT + PROPERTY_BLOCK_INCREMENT }; static const sal_Int32 nIntegerPropertyAttrDefaults[] = { // attribute defaults (XML defaults, not runtime defaults!) @@ -1075,7 +1075,7 @@ namespace xmloff exportInt32PropertyAttribute( OAttributeMetaData::getSpecialAttributeNamespace( nIntegerPropertyAttributeIds[i] ), OAttributeMetaData::getSpecialAttributeName( nIntegerPropertyAttributeIds[i] ), - *( pIntegerPropertyNames[i] ), + pIntegerPropertyNames[i], nIntegerPropertyAttrDefaults[i] ); #if OSL_DEBUG_LEVEL > 0 @@ -1206,9 +1206,9 @@ namespace xmloff { // attribute flags SCA_GROUP_NAME }; - static const ::rtl::OUString* pStringPropertyNames[] = + static const ConstAsciiString pStringPropertyNames[] = { // property names - &PROPERTY_GROUP_NAME + PROPERTY_GROUP_NAME }; sal_Int32 nIdCount = SAL_N_ELEMENTS( nStringPropertyAttributeIds ); @@ -1223,7 +1223,7 @@ namespace xmloff exportStringPropertyAttribute( OAttributeMetaData::getSpecialAttributeNamespace( nStringPropertyAttributeIds[i] ), OAttributeMetaData::getSpecialAttributeName( nStringPropertyAttributeIds[i] ), - *( pStringPropertyNames[i] ) + pStringPropertyNames[i] ); #if OSL_DEBUG_LEVEL > 0 // reset the bit for later checking @@ -2216,9 +2216,9 @@ namespace xmloff { faAllowDeletes, faAllowInserts, faAllowUpdates, faApplyFilter, faEscapeProcessing, faIgnoreResult }; - static const ::rtl::OUString* pBooleanPropertyNames[] = + static const ConstAsciiString pBooleanPropertyNames[] = { - &PROPERTY_ALLOWDELETES, &PROPERTY_ALLOWINSERTS, &PROPERTY_ALLOWUPDATES, &PROPERTY_APPLYFILTER, &PROPERTY_ESCAPEPROCESSING, &PROPERTY_IGNORERESULT + PROPERTY_ALLOWDELETES, PROPERTY_ALLOWINSERTS, PROPERTY_ALLOWUPDATES, PROPERTY_APPLYFILTER, PROPERTY_ESCAPEPROCESSING, PROPERTY_IGNORERESULT }; static sal_Int8 nBooleanPropertyAttrFlags[] = { @@ -2235,7 +2235,7 @@ namespace xmloff exportBooleanPropertyAttribute( OAttributeMetaData::getFormAttributeNamespace(eBooleanPropertyIds[i]), OAttributeMetaData::getFormAttributeName(eBooleanPropertyIds[i]), - *(pBooleanPropertyNames[i]), + pBooleanPropertyNames[i], nBooleanPropertyAttrFlags[i] ); } @@ -2247,7 +2247,7 @@ namespace xmloff { faEnctype, faMethod, faCommandType, faNavigationMode, faTabbingCycle }; - static const sal_Char* pEnumPropertyNames[] = + static const ConstAsciiString pEnumPropertyNames[] = { PROPERTY_SUBMIT_ENCODING, PROPERTY_SUBMIT_METHOD, PROPERTY_COMMAND_TYPE, PROPERTY_NAVIGATION, PROPERTY_CYCLE }; diff --git a/xmloff/source/forms/eventexport.cxx b/xmloff/source/forms/eventexport.cxx index 8a1f9e50026f..945375178c17 100644 --- a/xmloff/source/forms/eventexport.cxx +++ b/xmloff/source/forms/eventexport.cxx @@ -65,7 +65,7 @@ namespace xmloff sLocalMacroName = pEvents->ScriptCode; sLibrary = ::rtl::OUString(); - if ( 0 == pEvents->ScriptType.compareToAscii( EVENT_STARBASIC ) ) + if (pEvents->ScriptType.equalsAsciiL(EVENT_STARBASIC.ascii, EVENT_STARBASIC.length)) { // for StarBasic, the library name is part of the ScriptCode sal_Int32 nPrefixLen = sLocalMacroName.indexOf( ':' ); DBG_ASSERT( 0 <= nPrefixLen, "OEventDescriptorMapper::OEventDescriptorMapper: invalid script code prefix!" ); @@ -73,7 +73,7 @@ namespace xmloff { // the export handler for StarBasic expects "StarOffice", not "application" for application modules ... sLibrary = sLocalMacroName.copy( 0, nPrefixLen ); - if ( sLibrary.equalsAscii( EVENT_APPLICATION ) ) + if (sLibrary.equalsAsciiL(EVENT_APPLICATION.ascii, EVENT_APPLICATION.length)) sLibrary = EVENT_STAROFFICE; sLocalMacroName = sLocalMacroName.copy( nPrefixLen + 1 ); diff --git a/xmloff/source/forms/eventimport.cxx b/xmloff/source/forms/eventimport.cxx index 725d34ae12e3..748ec01b130f 100644 --- a/xmloff/source/forms/eventimport.cxx +++ b/xmloff/source/forms/eventimport.cxx @@ -80,18 +80,18 @@ namespace xmloff pEventDescriptionEnd = pEventDescription + aEvent->second.getLength(); for (;pEventDescription != pEventDescriptionEnd; ++pEventDescription) { - if ((0 == pEventDescription->Name.compareToAscii(EVENT_LOCALMACRONAME)) || - (0 == pEventDescription->Name.compareToAscii(EVENT_SCRIPTURL))) + if ((pEventDescription->Name.equalsAsciiL(EVENT_LOCALMACRONAME.ascii, EVENT_LOCALMACRONAME.length)) || + (pEventDescription->Name.equalsAsciiL(EVENT_SCRIPTURL.ascii, EVENT_SCRIPTURL.length))) pEventDescription->Value >>= pTranslated->ScriptCode; - else if (0 == pEventDescription->Name.compareToAscii(EVENT_TYPE)) + else if (pEventDescription->Name.equalsAsciiL(EVENT_TYPE.ascii, EVENT_TYPE.length)) pEventDescription->Value >>= pTranslated->ScriptType; - else if ( 0 == pEventDescription->Name.compareToAscii( EVENT_LIBRARY ) ) + else if (pEventDescription->Name.equalsAsciiL(EVENT_LIBRARY.ascii, EVENT_LIBRARY.length)) pEventDescription->Value >>= sLibrary; } - if ( 0 == pTranslated->ScriptType.compareToAscii( EVENT_STARBASIC ) ) + if (pTranslated->ScriptType.equalsAsciiL(EVENT_STARBASIC.ascii, EVENT_STARBASIC.length)) { - if ( 0 == sLibrary.compareToAscii( EVENT_STAROFFICE ) ) + if (sLibrary.equalsAsciiL(EVENT_STAROFFICE.ascii, EVENT_STAROFFICE.length)) sLibrary = EVENT_APPLICATION; if ( !sLibrary.isEmpty() ) diff --git a/xmloff/source/forms/propertyexport.cxx b/xmloff/source/forms/propertyexport.cxx index ecd9276ffc90..4cf9e772ab76 100644 --- a/xmloff/source/forms/propertyexport.cxx +++ b/xmloff/source/forms/propertyexport.cxx @@ -377,13 +377,12 @@ namespace xmloff //--------------------------------------------------------------------- void OPropertyExport::exportEnumPropertyAttribute( const sal_uInt16 _nNamespaceKey, const sal_Char* _pAttributeName, - const sal_Char* _pPropertyName, const SvXMLEnumMapEntry* _pValueMap, + const rtl::OUString &rPropertyName, const SvXMLEnumMapEntry* _pValueMap, const sal_Int32 _nDefault, const sal_Bool _bVoidDefault) { // get the value sal_Int32 nCurrentValue(_nDefault); - ::rtl::OUString sPropertyName(::rtl::OUString::createFromAscii(_pPropertyName)); - Any aValue = m_xProps->getPropertyValue(sPropertyName); + Any aValue = m_xProps->getPropertyValue(rPropertyName); if (aValue.hasValue()) { // we have a non-void current value @@ -407,7 +406,7 @@ namespace xmloff } // the property does not need to be handled anymore - exportedProperty(sPropertyName); + exportedProperty(rPropertyName); } //--------------------------------------------------------------------- diff --git a/xmloff/source/forms/propertyexport.hxx b/xmloff/source/forms/propertyexport.hxx index 1e3eaab55dd3..2067de0c41ba 100644 --- a/xmloff/source/forms/propertyexport.hxx +++ b/xmloff/source/forms/propertyexport.hxx @@ -215,7 +215,7 @@ namespace xmloff void exportEnumPropertyAttribute( const sal_uInt16 _nNamespaceKey, const sal_Char* _pAttributeName, - const sal_Char* _pPropertyName, + const rtl::OUString& _rPropertyName, const SvXMLEnumMapEntry* _pValueMap, const sal_Int32 _nDefault, const sal_Bool _bVoidDefault = sal_False); diff --git a/xmloff/source/forms/strings.hxx b/xmloff/source/forms/strings.hxx index b98cd42f43c7..ea5d8951cb65 100644 --- a/xmloff/source/forms/strings.hxx +++ b/xmloff/source/forms/strings.hxx @@ -29,67 +29,18 @@ #ifndef _XMLOFF_FORMS_STRINGS_HXX_ #define _XMLOFF_FORMS_STRINGS_HXX_ -#include <sal/types.h> -#include <rtl/ustring.hxx> +#include <comphelper/string.hxx> //......................................................................... namespace xmloff { + using comphelper::string::ConstAsciiString; //......................................................................... - //============================================================ - //= a helper for static ascii pseudo-unicode strings - //============================================================ - struct ConstAsciiString - { - const sal_Char* ascii; - sal_Int32 length; - - inline operator const ConstAsciiString* () const { return this; } - inline const ::rtl::OUString* operator& () const; - inline operator const ::rtl::OUString& () const { return *(&(*this)); } - inline operator const sal_Char* () const { return ascii; } - - inline ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength); - inline ~ConstAsciiString(); - - private: - mutable ::rtl::OUString* m_pString; - - private: - ConstAsciiString(); // never implemented - }; - - //------------------------------------------------------------ - inline ConstAsciiString::ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength) - :ascii( _pAsciiZeroTerminated ) - ,length( _nLength ) - ,m_pString( NULL ) - { - } - - //------------------------------------------------------------ - inline ConstAsciiString::~ConstAsciiString() - { - if ( m_pString ) - { - delete m_pString; - m_pString = NULL; - } - } - - //------------------------------------------------------------ - inline const ::rtl::OUString* ConstAsciiString::operator& () const - { - if ( !m_pString ) - m_pString = new ::rtl::OUString( ascii, length, RTL_TEXTENCODING_ASCII_US ); - return m_pString; - } - #ifndef XMLFORM_IMPLEMENT_STRINGS #define XMLFORM_CONSTASCII_STRING(ident, string) extern const ConstAsciiString ident #else - #define XMLFORM_CONSTASCII_STRING(ident, string) extern const ConstAsciiString ident(string, sizeof(string)-1) + #define XMLFORM_CONSTASCII_STRING(ident, string) extern const ConstAsciiString ident = {RTL_CONSTASCII_STRINGPARAM(string)} #endif //============================================================ diff --git a/xmloff/source/forms/valueproperties.cxx b/xmloff/source/forms/valueproperties.cxx index 6b7f9c16e144..a3a95316aeb9 100644 --- a/xmloff/source/forms/valueproperties.cxx +++ b/xmloff/source/forms/valueproperties.cxx @@ -52,50 +52,50 @@ namespace xmloff case FormComponentType::TEXTFIELD: if (OControlElement::FORMATTED_TEXT == _eType) { - _rpCurrentValuePropertyName = PROPERTY_EFFECTIVE_VALUE; - _rpValuePropertyName = PROPERTY_EFFECTIVE_DEFAULT; + _rpCurrentValuePropertyName = PROPERTY_EFFECTIVE_VALUE.ascii; + _rpValuePropertyName = PROPERTY_EFFECTIVE_DEFAULT.ascii; } else { if (OControlElement::PASSWORD != _eType) // no CurrentValue" for passwords - _rpCurrentValuePropertyName = PROPERTY_TEXT; - _rpValuePropertyName = PROPERTY_DEFAULT_TEXT; + _rpCurrentValuePropertyName = PROPERTY_TEXT.ascii; + _rpValuePropertyName = PROPERTY_DEFAULT_TEXT.ascii; } break; case FormComponentType::NUMERICFIELD: case FormComponentType::CURRENCYFIELD: - _rpCurrentValuePropertyName = PROPERTY_VALUE; - _rpValuePropertyName = PROPERTY_DEFAULT_VALUE; + _rpCurrentValuePropertyName = PROPERTY_VALUE.ascii; + _rpValuePropertyName = PROPERTY_DEFAULT_VALUE.ascii; break; case FormComponentType::PATTERNFIELD: case FormComponentType::FILECONTROL: case FormComponentType::COMBOBOX: - _rpValuePropertyName = PROPERTY_DEFAULT_TEXT; + _rpValuePropertyName = PROPERTY_DEFAULT_TEXT.ascii; // NO BREAK!! case FormComponentType::COMMANDBUTTON: - _rpCurrentValuePropertyName = PROPERTY_TEXT; + _rpCurrentValuePropertyName = PROPERTY_TEXT.ascii; break; case FormComponentType::CHECKBOX: case FormComponentType::RADIOBUTTON: - _rpValuePropertyName = PROPERTY_REFVALUE; + _rpValuePropertyName = PROPERTY_REFVALUE.ascii; break; case FormComponentType::HIDDENCONTROL: - _rpValuePropertyName = PROPERTY_HIDDEN_VALUE; + _rpValuePropertyName = PROPERTY_HIDDEN_VALUE.ascii; break; case FormComponentType::SCROLLBAR: - _rpCurrentValuePropertyName = PROPERTY_SCROLLVALUE; - _rpValuePropertyName = PROPERTY_SCROLLVALUE_DEFAULT; + _rpCurrentValuePropertyName = PROPERTY_SCROLLVALUE.ascii; + _rpValuePropertyName = PROPERTY_SCROLLVALUE_DEFAULT.ascii; break; case FormComponentType::SPINBUTTON: - _rpCurrentValuePropertyName = PROPERTY_SPINVALUE; - _rpValuePropertyName = PROPERTY_DEFAULT_SPINVALUE; + _rpCurrentValuePropertyName = PROPERTY_SPINVALUE.ascii; + _rpValuePropertyName = PROPERTY_DEFAULT_SPINVALUE.ascii; break; default: @@ -114,23 +114,23 @@ namespace xmloff { case FormComponentType::NUMERICFIELD: case FormComponentType::CURRENCYFIELD: - _rpMinValuePropertyName = PROPERTY_VALUE_MIN; - _rpMaxValuePropertyName = PROPERTY_VALUE_MAX; + _rpMinValuePropertyName = PROPERTY_VALUE_MIN.ascii; + _rpMaxValuePropertyName = PROPERTY_VALUE_MAX.ascii; break; case FormComponentType::TEXTFIELD: - _rpMinValuePropertyName = PROPERTY_EFFECTIVE_MIN; - _rpMaxValuePropertyName = PROPERTY_EFFECTIVE_MAX; + _rpMinValuePropertyName = PROPERTY_EFFECTIVE_MIN.ascii; + _rpMaxValuePropertyName = PROPERTY_EFFECTIVE_MAX.ascii; break; case FormComponentType::SCROLLBAR: - _rpMinValuePropertyName = PROPERTY_SCROLLVALUE_MIN; - _rpMaxValuePropertyName = PROPERTY_SCROLLVALUE_MAX; + _rpMinValuePropertyName = PROPERTY_SCROLLVALUE_MIN.ascii; + _rpMaxValuePropertyName = PROPERTY_SCROLLVALUE_MAX.ascii; break; case FormComponentType::SPINBUTTON: - _rpMinValuePropertyName = PROPERTY_SPINVALUE_MIN; - _rpMaxValuePropertyName = PROPERTY_SPINVALUE_MAX; + _rpMinValuePropertyName = PROPERTY_SPINVALUE_MIN.ascii; + _rpMaxValuePropertyName = PROPERTY_SPINVALUE_MAX.ascii; break; default: @@ -151,24 +151,24 @@ namespace xmloff case FormComponentType::TEXTFIELD: if (OControlElement::FORMATTED_TEXT == _eType) { - _rpValuePropertyName = PROPERTY_EFFECTIVE_VALUE; - _rpDefaultValuePropertyName = PROPERTY_EFFECTIVE_DEFAULT; + _rpValuePropertyName = PROPERTY_EFFECTIVE_VALUE.ascii; + _rpDefaultValuePropertyName = PROPERTY_EFFECTIVE_DEFAULT.ascii; } else { - _rpValuePropertyName = PROPERTY_TEXT; - _rpDefaultValuePropertyName = PROPERTY_DEFAULT_TEXT; + _rpValuePropertyName = PROPERTY_TEXT.ascii; + _rpDefaultValuePropertyName = PROPERTY_DEFAULT_TEXT.ascii; } break; case FormComponentType::DATEFIELD: - _rpValuePropertyName = PROPERTY_DATE; - _rpDefaultValuePropertyName = PROPERTY_DEFAULT_DATE; + _rpValuePropertyName = PROPERTY_DATE.ascii; + _rpDefaultValuePropertyName = PROPERTY_DEFAULT_DATE.ascii; break; case FormComponentType::TIMEFIELD: - _rpValuePropertyName = PROPERTY_TIME; - _rpDefaultValuePropertyName = PROPERTY_DEFAULT_TIME; + _rpValuePropertyName = PROPERTY_TIME.ascii; + _rpDefaultValuePropertyName = PROPERTY_DEFAULT_TIME.ascii; break; case FormComponentType::NUMERICFIELD: @@ -185,8 +185,8 @@ namespace xmloff case FormComponentType::CHECKBOX: case FormComponentType::RADIOBUTTON: - _rpValuePropertyName = PROPERTY_STATE; - _rpDefaultValuePropertyName = PROPERTY_DEFAULT_STATE; + _rpValuePropertyName = PROPERTY_STATE.ascii; + _rpDefaultValuePropertyName = PROPERTY_DEFAULT_STATE.ascii; break; } } |