diff options
Diffstat (limited to 'fpicker/source/office/RemoteFilesDialog.cxx')
-rw-r--r-- | fpicker/source/office/RemoteFilesDialog.cxx | 231 |
1 files changed, 92 insertions, 139 deletions
diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 30115abd93e8..80af593e4076 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -12,35 +12,35 @@ #include "fpsmartcontent.hxx" #include "QueryFolderName.hxx" #include "RemoteFilesDialog.hxx" -#include <fpsofficeResMgr.hxx> +#include <fpicker/fpsofficeResMgr.hxx> #include <fpicker/strings.hrc> #include <strings.hrc> #include <comphelper/docpasswordrequest.hxx> -#include <comphelper/stillreadwriteinteraction.hxx> #include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/task/PasswordContainer.hpp> #include <svtools/PlaceEditDialog.hxx> #include <tools/debug.hxx> -#include <ucbhelper/commandenvironment.hxx> +#include <unotools/ucbhelper.hxx> #include <vcl/errinf.hxx> #include <officecfg/Office/Common.hxx> using namespace ::svt; RemoteFilesDialog::RemoteFilesDialog( weld::Window* pParent, PickerFlags nBits ) - : SvtFileDialog_Base( pParent, "fps/ui/remotefilesdialog.ui", "RemoteFilesDialog" ) + : SvtFileDialog_Base( pParent, u"fps/ui/remotefilesdialog.ui"_ustr, u"RemoteFilesDialog"_ustr ) , m_xContext( comphelper::getProcessComponentContext() ) , m_xMasterPasswd( PasswordContainer::create( m_xContext ) ) , m_bIsInExecute( false ) - , m_xCancel_btn(m_xBuilder->weld_button("cancel")) - , m_xManageServices(m_xBuilder->weld_menu_button("add_service_btn")) - , m_xServices_lb(m_xBuilder->weld_combo_box("services_lb")) - , m_xPathContainer(m_xBuilder->weld_container("breadcrumb_container")) - , m_xNewFolder(m_xBuilder->weld_button("new_folder")) - , m_xListView_btn(m_xBuilder->weld_toggle_button("list_view")) - , m_xIconView_btn(m_xBuilder->weld_toggle_button("icon_view")) - , m_xFilter_lb(m_xBuilder->weld_combo_box("filter_lb")) - , m_xName_ed(new AutocompleteEdit(m_xBuilder->weld_entry("filename"))) + , m_xOk_btn(m_xBuilder->weld_button(u"ok"_ustr)) + , m_xCancel_btn(m_xBuilder->weld_button(u"cancel"_ustr)) + , m_xManageServices(m_xBuilder->weld_menu_button(u"add_service_btn"_ustr)) + , m_xServices_lb(m_xBuilder->weld_combo_box(u"services_lb"_ustr)) + , m_xPathContainer(m_xBuilder->weld_container(u"breadcrumb_container"_ustr)) + , m_xNewFolder(m_xBuilder->weld_button(u"new_folder"_ustr)) + , m_xListView_btn(m_xBuilder->weld_toggle_button(u"list_view"_ustr)) + , m_xIconView_btn(m_xBuilder->weld_toggle_button(u"icon_view"_ustr)) + , m_xFilter_lb(m_xBuilder->weld_combo_box(u"filter_lb"_ustr)) + , m_xName_ed(new AutocompleteEdit(m_xBuilder->weld_entry(u"filename"_ustr))) { m_eMode = ( nBits & PickerFlags::SaveAs ) ? REMOTEDLG_MODE_SAVE : REMOTEDLG_MODE_OPEN; m_eType = ( nBits & PickerFlags::PathDialog ) ? REMOTEDLG_TYPE_PATHDLG : REMOTEDLG_TYPE_FILEDLG; @@ -61,13 +61,11 @@ RemoteFilesDialog::RemoteFilesDialog( weld::Window* pParent, PickerFlags nBits ) if( m_eMode == REMOTEDLG_MODE_OPEN ) { - m_xOk_btn = m_xBuilder->weld_button("open"); - m_xNewFolder->hide(); } else { - m_xOk_btn = m_xBuilder->weld_button("save"); + m_xOk_btn->set_label(FpsResId(STR_EXPLORERFILE_BUTTONSAVE)); m_xNewFolder->connect_clicked( LINK( this, RemoteFilesDialog, NewFolderHdl ) ); } @@ -75,7 +73,6 @@ RemoteFilesDialog::RemoteFilesDialog( weld::Window* pParent, PickerFlags nBits ) m_xIconView_btn->connect_clicked( LINK( this, RemoteFilesDialog, IconViewHdl ) ); m_xListView_btn->connect_clicked( LINK( this, RemoteFilesDialog, ListViewHdl ) ); - m_xOk_btn->show(); m_xOk_btn->set_sensitive(false); m_xOk_btn->connect_clicked( LINK( this, RemoteFilesDialog, OkHdl ) ); @@ -86,12 +83,12 @@ RemoteFilesDialog::RemoteFilesDialog( weld::Window* pParent, PickerFlags nBits ) m_xPath->connect_clicked( LINK( this, RemoteFilesDialog, SelectBreadcrumbHdl ) ); m_xPath->SetMode( SvtBreadcrumbMode::ALL_VISITED ); - m_xContainer = m_xBuilder->weld_container("container"); + m_xContainer = m_xBuilder->weld_container(u"container"_ustr); m_xContainer->set_size_request(m_xContainer->get_approximate_digit_width() * 82, -1); m_xFileView.reset(new SvtFileView(m_xDialog.get(), - m_xBuilder->weld_tree_view("fileview"), - m_xBuilder->weld_icon_view("iconview"), + m_xBuilder->weld_tree_view(u"fileview"_ustr), + m_xBuilder->weld_icon_view(u"iconview"_ustr), REMOTEDLG_TYPE_PATHDLG == m_eType, bMultiselection, false)); @@ -99,7 +96,7 @@ RemoteFilesDialog::RemoteFilesDialog( weld::Window* pParent, PickerFlags nBits ) m_xFileView->SetSelectHdl( LINK( this, RemoteFilesDialog, SelectHdl ) ); m_xFileView->EnableDelete( true ); - m_xTreeView.reset(new FolderTree(m_xBuilder->weld_tree_view("foldertree"), m_xDialog.get())); + m_xTreeView.reset(new FolderTree(m_xBuilder->weld_tree_view(u"foldertree"_ustr), m_xDialog.get())); m_xTreeView->connect_changed(LINK(this, RemoteFilesDialog, TreeSelectHdl)); m_xContainer->set_sensitive(false); @@ -127,7 +124,7 @@ RemoteFilesDialog::~RemoteFilesDialog() if( !m_sIniKey.isEmpty() ) { SvtViewOptions aDlgOpt( EViewType::Dialog, m_sIniKey ); - aDlgOpt.SetWindowState(OStringToOUString(m_xDialog->get_window_state(WindowStateMask::All), RTL_TEXTENCODING_UTF8)); + aDlgOpt.SetWindowState(m_xDialog->get_window_state(vcl::WindowDataMask::All)); Size aSize(m_xDialog->get_size()); @@ -135,25 +132,27 @@ RemoteFilesDialog::~RemoteFilesDialog() sSize = sSize + OUString::number( aSize.Height() ) + "|"; OUString sUserData = m_xFileView->GetConfigString(); - aDlgOpt.SetUserItem( "UserData", - makeAny( sSize + sUserData ) ); + aDlgOpt.SetUserItem( u"UserData"_ustr, + Any( sSize + sUserData ) ); } // save services - std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create( m_xContext ) ); + std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create() ); officecfg::Office::Common::Misc::FilePickerLastService::set( m_sLastServiceUrl, batch ); if( m_bIsUpdated ) { Sequence< OUString > placesUrlsList( m_aServices.size() ); + auto placesUrlsListRange = asNonConstRange(placesUrlsList); Sequence< OUString > placesNamesList( m_aServices.size() ); + auto placesNamesListRange = asNonConstRange(placesNamesList); int i = 0; for (auto const& service : m_aServices) { - placesUrlsList[i] = service->GetUrl(); - placesNamesList[i] = service->GetName(); + placesUrlsListRange[i] = service->GetUrl(); + placesNamesListRange[i] = service->GetName(); ++i; } @@ -166,10 +165,10 @@ RemoteFilesDialog::~RemoteFilesDialog() void RemoteFilesDialog::EnableExtraMenuItems(bool bEnable) { - m_xManageServices->set_item_visible("change_password", bEnable); - m_xManageServices->set_item_visible("edit_service", bEnable); - m_xManageServices->set_item_visible("delete_service", bEnable); - m_xManageServices->set_item_visible("change_password", bEnable); + m_xManageServices->set_item_visible(u"change_password"_ustr, bEnable); + m_xManageServices->set_item_visible(u"edit_service"_ustr, bEnable); + m_xManageServices->set_item_visible(u"delete_service"_ustr, bEnable); + m_xManageServices->set_item_visible(u"change_password"_ustr, bEnable); } short RemoteFilesDialog::run() @@ -196,31 +195,29 @@ static OUString lcl_GetServiceType( const ServicePtr& pService ) INetProtocol aProtocol = pService->GetUrlObject().GetProtocol(); switch( aProtocol ) { - case INetProtocol::Ftp: - return "FTP"; case INetProtocol::Cmis: { OUString sHost = pService->GetUrlObject().GetHost( INetURLObject::DecodeMechanism::WithCharset ); if( sHost.startsWith( GDRIVE_BASE_URL ) ) - return "Google Drive"; + return u"Google Drive"_ustr; else if( sHost.startsWith( ALFRESCO_CLOUD_BASE_URL ) ) - return "Alfresco Cloud"; + return u"Alfresco Cloud"_ustr; else if( sHost.startsWith( ONEDRIVE_BASE_URL ) ) - return "OneDrive"; + return u"OneDrive"_ustr; - return "CMIS"; + return u"CMIS"_ustr; } case INetProtocol::Smb: - return "Windows Share"; + return u"Windows Share"_ustr; case INetProtocol::File: - return "SSH"; + return u"SSH"_ustr; case INetProtocol::Http: - return "WebDAV"; + return u"WebDAV"_ustr; case INetProtocol::Https: - return "WebDAV"; + return u"WebDAV"_ustr; case INetProtocol::Generic: - return "SSH"; + return u"SSH"_ustr; default: return OUString(); } @@ -237,9 +234,9 @@ void RemoteFilesDialog::InitSize() if( !aDlgOpt.Exists() ) return; - m_xDialog->set_window_state(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_UTF8)); + m_xDialog->set_window_state(aDlgOpt.GetWindowState()); - Any aUserData = aDlgOpt.GetUserItem( "UserData" ); + Any aUserData = aDlgOpt.GetUserItem( u"UserData"_ustr ); OUString sCfgStr; if( aUserData >>= sCfgStr ) { @@ -249,7 +246,7 @@ void RemoteFilesDialog::InitSize() sal_Int32 nPos2{ sCfgStr.indexOf('|', nPos1+1 ) }; if (nPos2<0) return; - m_xFileView->SetConfigString( sCfgStr.copy(nPos2+1) ); + m_xFileView->SetConfigString( sCfgStr.subView(nPos2+1) ); } } @@ -259,13 +256,13 @@ void RemoteFilesDialog::FillServicesListbox() m_aServices.clear(); // Load from user settings - Sequence< OUString > placesUrlsList( officecfg::Office::Common::Misc::FilePickerPlacesUrls::get( m_xContext ) ); - Sequence< OUString > placesNamesList( officecfg::Office::Common::Misc::FilePickerPlacesNames::get( m_xContext ) ); + Sequence< OUString > placesUrlsList( officecfg::Office::Common::Misc::FilePickerPlacesUrls::get() ); + Sequence< OUString > placesNamesList( officecfg::Office::Common::Misc::FilePickerPlacesNames::get() ); unsigned int nPos = 0; unsigned int i = 0; - m_sLastServiceUrl = officecfg::Office::Common::Misc::FilePickerLastService::get( m_xContext ); + m_sLastServiceUrl = officecfg::Office::Common::Misc::FilePickerLastService::get(); for( sal_Int32 nPlace = 0; nPlace < placesUrlsList.getLength() && nPlace < placesNamesList.getLength(); ++nPlace ) { @@ -326,13 +323,11 @@ int RemoteFilesDialog::GetSelectedServicePos() void RemoteFilesDialog::AddFilter( const OUString& rFilter, const OUString& rType ) { - OUString sName = rFilter; - m_aFilters.emplace_back( rFilter, rType ); if (rType.isEmpty()) - m_xFilter_lb->append_separator(""); + m_xFilter_lb->append_separator(u""_ustr); else - m_xFilter_lb->append_text(sName); + m_xFilter_lb->append_text(rFilter); if (m_xFilter_lb->get_active() == -1) m_xFilter_lb->set_active(0); @@ -366,7 +361,7 @@ void RemoteFilesDialog::OpenURL( OUString const & sURL ) m_pCurrentAsyncAction->execute( sURL, sFilter, -1, -1, GetDenyList() ); if( m_eMode != REMOTEDLG_MODE_SAVE ) - m_xName_ed->set_text( "" ); + m_xName_ed->set_text( u""_ustr ); m_xFileView->grab_focus(); } @@ -381,21 +376,18 @@ void RemoteFilesDialog::OpenURL( OUString const & sURL ) } } -void RemoteFilesDialog::AddFileExtension() +OUString RemoteFilesDialog::AddFileExtension(const OUString& rFileName) { if (m_nCurrentFilter == -1) - return; + return rFileName; OUString sExt = m_aFilters[m_nCurrentFilter].second; - OUString sFileName = m_xName_ed->get_text(); + sal_Int32 nDotPos = rFileName.lastIndexOf( '.' ); - sal_Int32 nDotPos = sFileName.lastIndexOf( '.' ); + if (nDotPos == -1) + return rFileName + sExt.subView( 1 ); // without '*' - if ( nDotPos == -1 ) - { - sFileName += sExt.subView( 1 ); // without '*' - m_xName_ed->set_text( sFileName ); - } + return rFileName; } void RemoteFilesDialog::EnableControls() @@ -406,7 +398,7 @@ void RemoteFilesDialog::EnableControls() if (m_xServices_lb->get_active() != -1) { - m_xManageServices->set_item_sensitive("change_password", false); + m_xManageServices->set_item_sensitive(u"change_password"_ustr, false); try { @@ -422,7 +414,7 @@ void RemoteFilesDialog::EnableControls() if( aURLEntries.UserList.hasElements() ) { - m_xManageServices->set_item_sensitive("change_password", true); + m_xManageServices->set_item_sensitive(u"change_password"_ustr, true); } } } @@ -570,9 +562,9 @@ IMPL_LINK_NOARG( RemoteFilesDialog, SelectServiceHdl, weld::ComboBox&, void ) } } -IMPL_LINK ( RemoteFilesDialog, EditServiceMenuHdl, const OString&, rIdent, void ) +IMPL_LINK ( RemoteFilesDialog, EditServiceMenuHdl, const OUString&, rIdent, void ) { - OString sIdent(rIdent); + OUString sIdent(rIdent); if( sIdent == "edit_service" && m_xServices_lb->get_count() > 0 ) { int nSelected = m_xServices_lb->get_active(); @@ -683,16 +675,14 @@ IMPL_LINK ( RemoteFilesDialog, EditServiceMenuHdl, const OString&, rIdent, void { OUString sUserName = aURLEntries.UserList[0].UserName; - ::comphelper::SimplePasswordRequest* pPasswordRequest + rtl::Reference<::comphelper::SimplePasswordRequest> pPasswordRequest = new ::comphelper::SimplePasswordRequest; - Reference< XInteractionRequest > rRequest( pPasswordRequest ); - xInteractionHandler->handle( rRequest ); + xInteractionHandler->handle( pPasswordRequest ); if ( pPasswordRequest->isPassword() ) { - OUString aNewPass = pPasswordRequest->getPassword(); - Sequence<OUString> aPasswd { aNewPass }; + Sequence<OUString> aPasswd { pPasswordRequest->getPassword() }; m_xMasterPasswd->addPersistent( sUrl, sUserName, aPasswd, xInteractionHandler ); @@ -716,7 +706,7 @@ IMPL_LINK_NOARG( RemoteFilesDialog, DoubleClickHdl, SvtFileView*, bool ) if (pData) { if (!pData->mbIsFolder) - m_xDialog->response(RET_OK); + OkHdl(*m_xOk_btn); else OpenURL(pData->maURL); } @@ -747,7 +737,7 @@ IMPL_LINK_NOARG( RemoteFilesDialog, SelectHdl, SvtFileView*, void ) if( m_eMode == REMOTEDLG_MODE_OPEN ) { m_sPath.clear(); - m_xName_ed->set_text( "" ); + m_xName_ed->set_text( u""_ustr ); } } @@ -828,18 +818,18 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, NewFolderHdl, weld::Button&, void ) IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl, weld::Button&, void ) { - OUString sNameNoExt = m_xName_ed->get_text(); - OUString sPathNoExt; - - // auto extension - if( m_eMode == REMOTEDLG_MODE_SAVE ) - AddFileExtension(); + OUString sUserSelectedPath; // check if file/path exists - OUString sCurrentPath = m_xFileView->GetViewURL(); OUString sSelectedItem = m_xFileView->GetCurrentURL(); - OUString sName = m_xName_ed->get_text(); + OUString sUserTypedName = m_xName_ed->get_text(); + OUString sFileName; + // auto extension + if( m_eMode == REMOTEDLG_MODE_SAVE ) + sFileName = AddFileExtension(sUserTypedName); + else + sFileName = sUserTypedName; bool bFileDlg = ( m_eType == REMOTEDLG_TYPE_FILEDLG ); bool bSelected = ( m_xFileView->GetSelectionCount() > 0 ); @@ -849,8 +839,8 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl, weld::Button&, void ) if( !bSelected ) { - m_sPath = sCurrentPath + INetURLObject::encode( sName, INetURLObject::PART_FPATH, INetURLObject::EncodeMechanism::All ); - sPathNoExt = sCurrentPath + INetURLObject::encode( sNameNoExt, INetURLObject::PART_FPATH, INetURLObject::EncodeMechanism::All ); + m_sPath = sCurrentPath + INetURLObject::encode(sFileName, INetURLObject::PART_FPATH, INetURLObject::EncodeMechanism::All); + sUserSelectedPath = sCurrentPath + INetURLObject::encode(sUserTypedName, INetURLObject::PART_FPATH, INetURLObject::EncodeMechanism::All); } else { @@ -866,6 +856,7 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl, weld::Button&, void ) aURL.SetUser( aCurrentURL.GetUser() ); m_sPath = aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ); + sUserSelectedPath = m_sPath; } bool bExists = false; @@ -880,7 +871,7 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl, weld::Button&, void ) if( m_eMode == REMOTEDLG_MODE_SAVE ) { OUString sMsg = FpsResId( STR_SVT_ALREADYEXISTOVERWRITE ); - sMsg = sMsg.replaceFirst( "$filename$", sName ); + sMsg = sMsg.replaceFirst("$filename$", sFileName); std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_xDialog.get(), VclMessageType::Question, VclButtonsType::YesNo, sMsg)); if (xBox->run() != RET_YES) @@ -889,10 +880,9 @@ IMPL_LINK_NOARG ( RemoteFilesDialog, OkHdl, weld::Button&, void ) } else { - if( ContentIsFolder( sPathNoExt ) ) + if (ContentIsFolder(sUserSelectedPath)) { - OpenURL( sPathNoExt ); - m_xName_ed->set_text( "" ); + OpenURL(sUserSelectedPath); if (!bSelected) m_xName_ed->grab_focus(); @@ -941,16 +931,6 @@ const css::uno::Sequence< OUString >& RemoteFilesDialog::GetDenyList() const return m_aDenyList; } -void RemoteFilesDialog::SetStandardDir( const OUString& rStdDir ) -{ - m_sStdDir = rStdDir; -} - -const OUString& RemoteFilesDialog::GetStandardDir() const -{ - return m_sStdDir; -} - void RemoteFilesDialog::SetPath( const OUString& rNewURL ) { m_sPath = rNewURL; @@ -1072,12 +1052,12 @@ void RemoteFilesDialog::UpdateControls( const OUString& rURL ) m_xTreeView->connect_changed(Link<weld::TreeView&,void>()); // read cached data for this url and fill the tree - const ::std::vector< SvtContentEntry >& rFolders = m_xFileView->GetContent(); + const ::std::vector< SvtContentEntry > aContentFolders = m_xFileView->GetContent(); ::std::vector< std::pair< OUString, OUString > > aFolders; m_xName_ed->ClearEntries(); - for(const auto & rFolder : rFolders) + for(const auto & rFolder : aContentFolders) { //WebDAV folders path ends in '/', so strip it OUString aFolderName = rFolder.maURL; @@ -1088,7 +1068,7 @@ void RemoteFilesDialog::UpdateControls( const OUString& rURL ) if( nTitleStart != -1 ) { OUString sTitle( INetURLObject::decode( - aFolderName.copy( nTitleStart + 1 ), + aFolderName.subView( nTitleStart + 1 ), INetURLObject::DecodeMechanism::WithCharset ) ); if( rFolder.mbIsFolder ) @@ -1145,57 +1125,30 @@ bool RemoteFilesDialog::ContentIsFolder( const OUString& rURL ) { try { - Reference< XInteractionHandler > xInteractionHandler( - InteractionHandler::createWithParent( m_xContext, nullptr ), UNO_QUERY_THROW ); - Reference< XCommandEnvironment > xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); - ::ucbhelper::Content aContent( rURL, xEnv, m_xContext ); - - return aContent.isFolder(); + ::ucbhelper::Content content(rURL, + ::utl::UCBContentHelper::getDefaultCommandEnvironment(), + m_xContext); + return content.isFolder(); } - catch( const Exception& ) + catch (css::uno::Exception const&) { - // a content doesn't exist + return false; } - - return false; } bool RemoteFilesDialog::ContentIsDocument( const OUString& rURL ) { try { - Reference< XInteractionHandler > xInteractionHandler( - InteractionHandler::createWithParent( m_xContext, nullptr ), UNO_QUERY_THROW ); - //check if WebDAV or not - if ( !INetURLObject( rURL ).isAnyKnownWebDAVScheme() ) - { - // no webdav, use the interaction handler as is - Reference< XCommandEnvironment > xEnv = new ::ucbhelper::CommandEnvironment( xInteractionHandler, Reference< XProgressHandler >() ); - ::ucbhelper::Content aContent( rURL, xEnv, m_xContext ); - - return aContent.isDocument(); - } - else - { - // It's a webdav URL, so use the same open sequence as in normal open process. - // Let's use a comphelper::StillReadWriteInteraction to trap errors here without showing the user. - // This sequence will result in an exception if the target URL resource is not present - comphelper::StillReadWriteInteraction* pInteraction = new comphelper::StillReadWriteInteraction(xInteractionHandler,xInteractionHandler); - css::uno::Reference< css::task::XInteractionHandler > xInteraction(static_cast< css::task::XInteractionHandler* >(pInteraction), css::uno::UNO_QUERY); - - Reference< XCommandEnvironment > xEnv = new ::ucbhelper::CommandEnvironment( xInteraction, Reference< XProgressHandler >() ); - ::ucbhelper::Content aContent( rURL, xEnv, m_xContext ); - - aContent.openStream(); - return aContent.isDocument(); - } + ::ucbhelper::Content content(rURL, + ::utl::UCBContentHelper::getDefaultCommandEnvironment(), + m_xContext); + return content.isDocument(); } - catch( const Exception& ) + catch (css::uno::Exception const&) { - // a content doesn't exist + return false; } - - return false; } sal_Int32 RemoteFilesDialog::getAvailableWidth() |