summaryrefslogtreecommitdiff
path: root/cui/source/dialogs/cuigaldlg.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source/dialogs/cuigaldlg.cxx')
-rw-r--r--cui/source/dialogs/cuigaldlg.cxx56
1 files changed, 27 insertions, 29 deletions
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index aa2ccd0767c1..9a1a2e26a4ed 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -24,12 +24,14 @@
#include <algorithm>
#include <cassert>
+#include <utility>
#include <vcl/errinf.hxx>
#include <ucbhelper/content.hxx>
#include <vcl/svapp.hxx>
#include <vcl/weld.hxx>
#include <avmedia/mediawindow.hxx>
#include <unotools/pathoptions.hxx>
+#include <sfx2/filedlghelper.hxx>
#include <sfx2/opengrf.hxx>
#include <vcl/graphicfilter.hxx>
#include <svx/gallery1.hxx>
@@ -45,12 +47,13 @@
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/ucb/ContentCreationException.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
-#include <com/sun/star/ui/dialogs/FolderPicker.hpp>
#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp>
#include <dialmgr.hxx>
#include <strings.hrc>
#include <svx/dialmgr.hxx>
#include <svx/strings.hrc>
+#include <osl/diagnose.h>
+#include <o3tl/string_view.hxx>
using namespace ::ucbhelper;
using namespace ::cppu;
@@ -63,11 +66,11 @@ using namespace ::com::sun::star::uno;
SearchThread::SearchThread(SearchProgress* pProgress,
TPGalleryThemeProperties* pBrowser,
- const INetURLObject& rStartURL)
+ INetURLObject aStartURL)
: Thread("cuiSearchThread")
, mpProgress(pProgress)
, mpBrowser(pBrowser)
- , maStartURL(rStartURL)
+ , maStartURL(std::move(aStartURL))
{
}
@@ -186,9 +189,9 @@ void SearchThread::ImplSearch( const INetURLObject& rStartURL,
}
}
-SearchProgress::SearchProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage, const INetURLObject& rStartURL)
+SearchProgress::SearchProgress(weld::Window* pParent, TPGalleryThemeProperties* pTabPage, INetURLObject aStartURL)
: GenericDialogController(pParent, "cui/ui/gallerysearchprogress.ui", "GallerySearchProgress")
- , startUrl_(rStartURL)
+ , startUrl_(std::move(aStartURL))
, m_pTabPage(pTabPage)
, m_xFtSearchDir(m_xBuilder->weld_label("dir"))
, m_xFtSearchType(m_xBuilder->weld_label("file"))
@@ -333,11 +336,7 @@ IMPL_LINK_NOARG(TakeProgress, CleanUpHdl, void*, void)
if( !aRemoveEntries[ i ] )
aRemainingVector.push_back( m_pTabPage->aFoundList[i] );
- m_pTabPage->aFoundList.clear();
-
- for( i = 0, nCount = aRemainingVector.size(); i < nCount; ++i )
- m_pTabPage->aFoundList.push_back( aRemainingVector[ i ] );
-
+ std::swap(m_pTabPage->aFoundList, aRemainingVector);
aRemainingVector.clear();
// refill list box
@@ -346,10 +345,8 @@ IMPL_LINK_NOARG(TakeProgress, CleanUpHdl, void*, void)
aRemainingVector.push_back(m_pTabPage->m_xLbxFound->get_text(i));
m_pTabPage->m_xLbxFound->clear();
-
for( i = 0, nCount = aRemainingVector.size(); i < nCount; ++i )
m_pTabPage->m_xLbxFound->append_text(aRemainingVector[i]);
-
aRemainingVector.clear();
m_pTabPage->m_xLbxFound->thaw();
@@ -460,7 +457,7 @@ IMPL_LINK_NOARG(GalleryIdDialog, ClickOkHdl, weld::Button&, void)
if ((pInfo->GetId() == nId) && (pInfo->GetThemeName() != m_pThm->GetName()))
{
- OUString aStr = CuiResId( RID_SVXSTR_GALLERY_ID_EXISTS ) +
+ OUString aStr = CuiResId( RID_CUISTR_GALLERY_ID_EXISTS ) +
" (" + pInfo->GetThemeName() + ")";
std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
@@ -490,12 +487,12 @@ GalleryThemeProperties::GalleryThemeProperties(weld::Widget* pParent,
OUString aText = m_xDialog->get_title().replaceFirst( "%1", pData->pTheme->GetName() );
if (pData->pTheme->IsReadOnly())
- aText += " " + CuiResId( RID_SVXSTR_GALLERY_READONLY );
+ aText += " " + CuiResId( RID_CUISTR_GALLERY_READONLY );
m_xDialog->set_title(aText);
}
-void GalleryThemeProperties::PageCreated(const OString& rId, SfxTabPage &rPage)
+void GalleryThemeProperties::PageCreated(const OUString& rId, SfxTabPage &rPage)
{
if (rId == "general")
static_cast<TPGalleryThemeGeneral&>( rPage ).SetXChgData( pData );
@@ -521,7 +518,7 @@ void TPGalleryThemeGeneral::SetXChgData( ExchangeData* _pData )
GalleryTheme* pThm = pData->pTheme;
OUString aOutStr( OUString::number(pThm->GetObjectCount()) );
- OUString aObjStr( CuiResId( RID_SVXSTR_GALLERYPROPS_OBJECT ) );
+ OUString aObjStr( CuiResId( RID_CUISTR_GALLERYPROPS_OBJECT ) );
OUString aAccess;
OUString aType( SvxResId( RID_SVXSTR_GALLERYPROPS_GALTHEME ) );
bool bReadOnly = pThm->IsReadOnly();
@@ -531,7 +528,7 @@ void TPGalleryThemeGeneral::SetXChgData( ExchangeData* _pData )
m_xEdtMSName->set_sensitive(!bReadOnly);
if( pThm->IsReadOnly() )
- aType += CuiResId( RID_SVXSTR_GALLERY_READONLY );
+ aType += CuiResId( RID_CUISTR_GALLERY_READONLY );
m_xFtMSShowType->set_label(aType);
m_xFtMSShowPath->set_label(pThm->getThemeURL().GetMainURL(INetURLObject::DecodeMechanism::Unambiguous));
@@ -581,6 +578,7 @@ std::unique_ptr<SfxTabPage> TPGalleryThemeGeneral::Create(weld::Container* pPage
TPGalleryThemeProperties::TPGalleryThemeProperties(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet)
: SfxTabPage(pPage, pController, "cui/ui/galleryfilespage.ui", "GalleryFilesPage", &rSet)
, pData(nullptr)
+ , aPreviewTimer("cui TPGalleryThemeProperties aPreviewTimer")
, bEntriesFound(false)
, bInputAllowed(true)
, bTakeAll(false)
@@ -613,7 +611,7 @@ void TPGalleryThemeProperties::SetXChgData( ExchangeData* _pData )
m_xCbbFileType->connect_changed(LINK(this, TPGalleryThemeProperties, SelectFileTypeHdl));
m_xLbxFound->connect_row_activated(LINK(this, TPGalleryThemeProperties, DClickFoundHdl));
m_xLbxFound->connect_changed(LINK(this, TPGalleryThemeProperties, SelectFoundHdl));
- m_xLbxFound->append_text(CuiResId(RID_SVXSTR_GALLERY_NOFILES));
+ m_xLbxFound->append_text(CuiResId(RID_CUISTR_GALLERY_NOFILES));
m_xLbxFound->show();
FillFilterList();
@@ -623,7 +621,7 @@ void TPGalleryThemeProperties::SetXChgData( ExchangeData* _pData )
m_xCbxPreview->set_sensitive(false);
}
-void TPGalleryThemeProperties::StartSearchFiles( const OUString& _rFolderURL, short _nDlgResult )
+void TPGalleryThemeProperties::StartSearchFiles( std::u16string_view _rFolderURL, short _nDlgResult )
{
if ( RET_OK == _nDlgResult )
{
@@ -709,7 +707,7 @@ void TPGalleryThemeProperties::FillFilterList()
#if HAVE_FEATURE_AVMEDIA
// media filters
- static constexpr OUStringLiteral aWildcard = u"*.";
+ static constexpr OUString aWildcard = u"*."_ustr;
::avmedia::FilterNameVector aFilters= ::avmedia::MediaWindow::getMediaFilters();
for(const std::pair<OUString,OUString> & aFilter : aFilters)
@@ -758,9 +756,9 @@ void TPGalleryThemeProperties::FillFilterList()
{
if ( !aExtensions.isEmpty() )
aExtensions += ";";
- aExtensions += aWildcard + aFilter.second.getToken( 0, ';', nIndex );
+ aExtensions += OUString::Concat(aWildcard) + o3tl::getToken(aFilter.second, 0, ';', nIndex );
}
- }
+ }
#endif
#if defined(_WIN32)
@@ -769,7 +767,7 @@ void TPGalleryThemeProperties::FillFilterList()
#endif
std::unique_ptr<FilterEntry> pFilterEntry(new FilterEntry);
- pFilterEntry->aFilterName = CuiResId(RID_SVXSTR_GALLERY_ALLFILES);
+ pFilterEntry->aFilterName = CuiResId(RID_CUISTR_GALLERY_ALLFILES);
pFilterEntry->aFilterName = addExtension(pFilterEntry->aFilterName, aExtensions);
m_xCbbFileType->insert_text(0, pFilterEntry->aFilterName);
m_xCbbFileType->set_active(0);
@@ -816,7 +814,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickSearchHdl, weld::Button&, void)
{
// setup folder picker
css::uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- xFolderPicker = FolderPicker::create(xContext);
+ xFolderPicker = sfx2::createFolderPicker(xContext, GetFrameWeld());
OUString aDlgPathName( SvtPathOptions().GetGraphicPath() );
xFolderPicker->setDisplayDirectory(aDlgPathName);
@@ -825,7 +823,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickSearchHdl, weld::Button&, void)
css::uno::Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY );
if ( xAsyncDlg.is() )
- xAsyncDlg->startExecuteModal( xDialogListener.get() );
+ xAsyncDlg->startExecuteModal( xDialogListener );
else
{
if( xFolderPicker->execute() == RET_OK )
@@ -848,7 +846,7 @@ void TPGalleryThemeProperties::TakeFiles()
{
auto xTakeProgress = std::make_shared<TakeProgress>(GetFrameWeld(), this);
xTakeProgress->LaunchThread();
- weld::DialogController::runAsync(xTakeProgress, [=](sal_Int32 /*nResult*/) {
+ weld::DialogController::runAsync(xTakeProgress, [](sal_Int32 /*nResult*/) {
/* no postprocessing needed, pTakeProgress
will be disposed in TakeProgress::CleanupHdl */
});
@@ -856,7 +854,7 @@ void TPGalleryThemeProperties::TakeFiles()
}
}
-IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickPreviewHdl, weld::ToggleButton&, void)
+IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickPreviewHdl, weld::Toggleable&, void)
{
if ( !bInputAllowed )
return;
@@ -911,7 +909,7 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickTakeHdl, weld::Button&, void)
if (!m_xLbxFound->count_selected_rows() || !bEntriesFound)
{
- SvxOpenGraphicDialog aDlg(CuiResId(RID_SVXSTR_KEY_GALLERY_DIR), GetFrameWeld());
+ SvxOpenGraphicDialog aDlg(CuiResId(RID_CUISTR_KEY_GALLERY_DIR), GetFrameWeld());
aDlg.EnableLink(false);
aDlg.AsLink(false);
@@ -993,7 +991,7 @@ void TPGalleryThemeProperties::EndSearchProgressHdl(sal_Int32 /*nResult*/)
}
else
{
- m_xLbxFound->append_text(CuiResId(RID_SVXSTR_GALLERY_NOFILES));
+ m_xLbxFound->append_text(CuiResId(RID_CUISTR_GALLERY_NOFILES));
m_xBtnTakeAll->set_sensitive(false);
m_xCbxPreview->set_sensitive(false);
bEntriesFound = false;