diff options
Diffstat (limited to 'fpicker/source/office/OfficeControlAccess.cxx')
-rw-r--r-- | fpicker/source/office/OfficeControlAccess.cxx | 59 |
1 files changed, 25 insertions, 34 deletions
diff --git a/fpicker/source/office/OfficeControlAccess.cxx b/fpicker/source/office/OfficeControlAccess.cxx index 2096ccc0f178..6cde40fb48cd 100644 --- a/fpicker/source/office/OfficeControlAccess.cxx +++ b/fpicker/source/office/OfficeControlAccess.cxx @@ -31,6 +31,7 @@ #include <tools/debug.hxx> #include <algorithm> +#include <utility> namespace svt @@ -71,7 +72,6 @@ namespace svt { "AutoExtensionBox", CHECKBOX_AUTOEXTENSION, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX }, { "CancelButton", PUSHBUTTON_CANCEL, PROPERTY_FLAGS_COMMON | PropFlags::Text }, { "CurrentFolderText", FIXEDTEXT_CURRENTFOLDER, PROPERTY_FLAGS_COMMON | PropFlags::Text }, - { "DefaultLocationButton", TOOLBOXBUTOON_DEFAULT_LOCATION, PROPERTY_FLAGS_COMMON }, { "FileURLEdit", EDIT_FILEURL, PROPERTY_FLAGS_COMMON | PropFlags::Text }, { "FileURLEditLabel", EDIT_FILEURL_LABEL, PROPERTY_FLAGS_COMMON | PropFlags::Text }, { "FileView", CONTROL_FILEVIEW, PROPERTY_FLAGS_COMMON }, @@ -84,9 +84,9 @@ namespace svt { "ImageAnchorListLabel", LISTBOX_IMAGE_ANCHOR_LABEL, PROPERTY_FLAGS_COMMON | PropFlags::Text }, { "ImageTemplateList", LISTBOX_IMAGE_TEMPLATE, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_LISTBOX }, { "ImageTemplateListLabel", LISTBOX_IMAGE_TEMPLATE_LABEL, PROPERTY_FLAGS_COMMON | PropFlags::Text }, - { "LevelUpButton", TOOLBOXBUTOON_LEVEL_UP, PROPERTY_FLAGS_COMMON }, + { "LevelUpButton", TOOLBOXBUTTON_LEVEL_UP, PROPERTY_FLAGS_COMMON }, { "LinkBox", CHECKBOX_LINK, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX }, - { "NewFolderButton", TOOLBOXBUTOON_NEW_FOLDER, PROPERTY_FLAGS_COMMON }, + { "NewFolderButton", TOOLBOXBUTTON_NEW_FOLDER, PROPERTY_FLAGS_COMMON }, { "OkButton", PUSHBUTTON_OK , PROPERTY_FLAGS_COMMON | PropFlags::Text }, { "PasswordBox", CHECKBOX_PASSWORD, PROPERTY_FLAGS_COMMON | PROPERTY_FLAGS_CHECKBOX }, { "PlayButton", PUSHBUTTON_PLAY, PROPERTY_FLAGS_COMMON | PropFlags::Text }, @@ -140,8 +140,8 @@ namespace svt struct ControlPropertyLookup { OUString m_sLookup; - explicit ControlPropertyLookup(const OUString& rLookup) - : m_sLookup(rLookup) + explicit ControlPropertyLookup(OUString aLookup) + : m_sLookup(std::move(aLookup)) { } @@ -150,13 +150,6 @@ namespace svt return m_sLookup.equalsAscii(rProp.pPropertyName); } }; - - - void lcl_throwIllegalArgumentException( ) - { - throw IllegalArgumentException(); - // TODO: error message in the exception - } } OControlAccess::OControlAccess(IFilePickerController* pController, SvtFileView* pFileView) @@ -182,20 +175,19 @@ namespace svt if (aHID.GetProtocol() == INetProtocol::Hid) sHelpID = aHID.GetURLPath(); - // URLs should always be UTF8 encoded and escaped - OString sID( OUStringToOString( sHelpID, RTL_TEXTENCODING_UTF8 ) ); + // URLs should always be escaped if (IsFileViewWidget(pControl)) { // the file view "overrides" the SetHelpId - m_pFileView->set_help_id(sID); + m_pFileView->set_help_id(sHelpID); } else - pControl->set_help_id(sID); + pControl->set_help_id(sHelpID); } OUString OControlAccess::getHelpURL(weld::Widget const * pControl) const { - OString aHelpId = pControl->get_help_id(); + OUString aHelpId = pControl->get_help_id(); if (IsFileViewWidget(pControl)) { // the file view "overrides" the SetHelpId @@ -203,11 +195,10 @@ namespace svt } OUString sHelpURL; - OUString aTmp( OStringToOUString( aHelpId, RTL_TEXTENCODING_UTF8 ) ); - INetURLObject aHID( aTmp ); + INetURLObject aHID(aHelpId); if ( aHID.GetProtocol() == INetProtocol::NotValid ) sHelpURL = INET_HID_SCHEME; - sHelpURL += aTmp; + sHelpURL += aHelpId; return sHelpURL; } @@ -223,11 +214,11 @@ namespace svt ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( rControlProperty ) ); if ( aPropDesc == s_pPropertiesEnd ) // it's a completely unknown property - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); if ( !( nPropertyMask & aPropDesc->nPropertyId ) ) // it's a property which is known, but not allowed for this control - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); return implGetControlProperty( pControl, aPropDesc->nPropertyId ); } @@ -249,7 +240,7 @@ namespace svt // if not found 'til here, the name is invalid, or we do not have the control in the current mode if ( !pControl ) - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); // out parameters and outta here if ( _pId ) @@ -270,7 +261,7 @@ namespace svt // look up the property ControlPropertyIterator aPropDesc = ::std::find_if( s_pProperties, s_pPropertiesEnd, ControlPropertyLookup( rControlProperty ) ); if ( aPropDesc == s_pPropertiesEnd ) - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); // set the property implSetControlProperty( nControlId, pControl, aPropDesc->nPropertyId, rValue, false ); @@ -509,7 +500,7 @@ namespace svt if ( aTemplateList.hasElements() ) { - for ( const OUString& s : std::as_const(aTemplateList) ) + for (const OUString& s : aTemplateList) pListbox->append_text( s ); } } @@ -556,7 +547,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; @@ -570,7 +561,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; @@ -584,7 +575,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; @@ -598,7 +589,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; @@ -615,7 +606,7 @@ namespace svt pComboBox->clear(); // add the new ones - for (auto const & item : std::as_const(aItems)) + for (auto const& item : aItems) { pComboBox->append_text(item); } @@ -623,7 +614,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; @@ -640,7 +631,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; @@ -657,7 +648,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; @@ -674,7 +665,7 @@ namespace svt } else if ( !_bIgnoreIllegalArgument ) { - lcl_throwIllegalArgumentException(); + throw IllegalArgumentException(); } } break; |