diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-05-17 14:00:15 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-05-17 14:03:26 +0100 |
commit | 5dcf536b69848b56f1199b81e4b7ed87a0a3864d (patch) | |
tree | 86f28d6db1963680549b6111ca99f95ca580f763 /forms/source | |
parent | acd9cda35457f0a839bf9713c261022c39cd8269 (diff) |
merge the 5 ConstAsciiString duplicate classes together
a) merge them together and move it into comphelper
b) turn it into a POD rather than having vast amounts
of destructors registered into the cxa_atexit chain
Change-Id: I04d3b9d7804f8e233013c916df9d617a0f84f96a
Diffstat (limited to 'forms/source')
-rw-r--r-- | forms/source/component/Button.cxx | 2 | ||||
-rw-r--r-- | forms/source/component/DatabaseForm.cxx | 2 | ||||
-rw-r--r-- | forms/source/helper/formnavigation.cxx | 38 | ||||
-rw-r--r-- | forms/source/inc/frm_strings.hxx | 43 |
4 files changed, 24 insertions, 61 deletions
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 //.............................................................................. |