summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-02-21 11:04:33 +0000
committerCaolán McNamara <caolanm@redhat.com>2019-02-21 16:33:03 +0100
commita9eb7df678655bd71f062ba404b7d6b6f9cc18d4 (patch)
tree5ee99fab0ef7a242eac4b2b5b65d48d24c37c9a5
parent47e03f30dc34371b9421a0179d047b85539a8494 (diff)
weld RecoveryDialog
Change-Id: Iaa755aca2468a23465a3ab8d8115ee19e3b05f6d Reviewed-on: https://gerrit.libreoffice.org/68155 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/vcl/weld.hxx2
-rw-r--r--svx/source/dialog/docrecovery.cxx383
-rw-r--r--svx/source/inc/docrecovery.hxx161
-rw-r--r--svx/source/unodraw/recoveryui.cxx47
-rw-r--r--svx/uiconfig/ui/docrecoveryrecoverdialog.ui203
-rw-r--r--svx/uiconfig/ui/docrecoverysavedialog.ui4
-rw-r--r--vcl/source/app/salvtables.cxx37
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx96
8 files changed, 343 insertions, 590 deletions
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 7524d777a909..527167f2f5c8 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -281,6 +281,7 @@ public:
virtual Size get_size() const = 0;
virtual Point get_position() const = 0;
virtual bool has_toplevel_focus() const = 0;
+ virtual void present() = 0;
virtual void set_window_state(const OString& rStr) = 0;
virtual OString get_window_state(WindowStateMask nMask) const = 0;
@@ -553,6 +554,7 @@ public:
virtual void set_id(int row, const OUString& rId) = 0;
virtual void set_toggle(int row, bool bOn, int col) = 0;
virtual bool get_toggle(int row, int col) const = 0;
+ virtual void set_image(int row, const OUString& rImage, int col) = 0;
virtual void set_top_entry(int pos) = 0;
virtual std::vector<int> get_selected_rows() const = 0;
virtual void set_font_color(int pos, const Color& rColor) const = 0;
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
index accb44c5172d..3867e579e84d 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -426,7 +426,6 @@ void SAL_CALL RecoveryCore::statusChanged(const css::frame::FeatureStateEvent& a
sURL = aNew.TemplateURL;
INetURLObject aURL(sURL);
aNew.StandardImageId = SvFileInformationManager::GetFileImageId(aURL);
- aNew.StandardImage = SvFileInformationManager::GetFileImage(aURL);
/* set the right UI state for this item to NOT_RECOVERED_YET... because nDocState shows the state of
the last emergency save operation before and is interesting for the used recovery core service only...
@@ -498,149 +497,55 @@ css::util::URL RecoveryCore::impl_getParsedURL(const OUString& sURL)
return aURL;
}
-PluginProgressWindow::PluginProgressWindow( vcl::Window* pParent ,
- const css::uno::Reference< css::lang::XComponent >& xProgress)
- : Window (pParent )
- , m_xProgress(xProgress)
-{
- Show();
- Size aParentSize = pParent->GetSizePixel();
- // align the progressbar to its parent
- setPosSizePixel( -9, 0, aParentSize.Width() + 15, aParentSize.Height() - 4 );
-}
-
-PluginProgressWindow::~PluginProgressWindow()
-{
- disposeOnce();
-}
-
-void PluginProgressWindow::dispose()
-{
- if (m_xProgress.is())
- m_xProgress->dispose();
- vcl::Window::dispose();
-}
-
-
-PluginProgress::PluginProgress( vcl::Window* pParent,
- const css::uno::Reference< css::uno::XComponentContext >& xContext )
+PluginProgress::PluginProgress(weld::ProgressBar* pProgressBar)
+ : m_pProgressBar(pProgressBar)
+ , m_nRange(100)
{
- m_pPlugProgressWindow = VclPtr<PluginProgressWindow>::Create(pParent, static_cast< css::lang::XComponent* >(this));
- css::uno::Reference< css::awt::XWindow > xProgressWindow = VCLUnoHelper::GetInterface(m_pPlugProgressWindow);
- m_xProgressFactory = css::task::StatusIndicatorFactory::createWithWindow(xContext, xProgressWindow, false/*DisableReschedule*/, true/*AllowParentShow*/);
- m_xProgress = m_xProgressFactory->createStatusIndicator();
}
-
PluginProgress::~PluginProgress()
{
}
-
void SAL_CALL PluginProgress::dispose()
{
- // m_pPluginProgressWindow was deleted...
- // So the internal pointer of this progress
- // will be dead!
- m_xProgress.clear();
+ m_pProgressBar = nullptr;
}
-
void SAL_CALL PluginProgress::addEventListener(const css::uno::Reference< css::lang::XEventListener >& )
{
}
-
void SAL_CALL PluginProgress::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& )
{
}
-
-void SAL_CALL PluginProgress::start(const OUString&,
- sal_Int32 nRange)
-{
- if (m_xProgress.is())
- m_xProgress->start(OUString(), nRange);
-}
-
-
-void SAL_CALL PluginProgress::end()
-{
- if (m_xProgress.is())
- m_xProgress->end();
-}
-
-
-void SAL_CALL PluginProgress::setText(const OUString& sText)
-{
- if (m_xProgress.is())
- m_xProgress->setText(sText);
-}
-
-
-void SAL_CALL PluginProgress::setValue(sal_Int32 nValue)
-{
- if (m_xProgress.is())
- m_xProgress->setValue(nValue);
-}
-
-
-void SAL_CALL PluginProgress::reset()
-{
- if (m_xProgress.is())
- m_xProgress->reset();
-}
-
-WeldPluginProgress::WeldPluginProgress(weld::ProgressBar* pProgressBar)
- : m_pProgressBar(pProgressBar)
- , m_nRange(100)
-{
-}
-
-WeldPluginProgress::~WeldPluginProgress()
-{
-}
-
-void SAL_CALL WeldPluginProgress::dispose()
-{
- m_pProgressBar = nullptr;
-}
-
-void SAL_CALL WeldPluginProgress::addEventListener(const css::uno::Reference< css::lang::XEventListener >& )
-{
-}
-
-
-void SAL_CALL WeldPluginProgress::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& )
-{
-}
-
-void SAL_CALL WeldPluginProgress::start(const OUString&, sal_Int32 nRange)
+void SAL_CALL PluginProgress::start(const OUString&, sal_Int32 nRange)
{
m_nRange = nRange;
if (m_pProgressBar)
m_pProgressBar->set_percentage(0);
}
-void SAL_CALL WeldPluginProgress::end()
+void SAL_CALL PluginProgress::end()
{
if (m_pProgressBar)
m_pProgressBar->set_percentage(m_nRange);
}
-void SAL_CALL WeldPluginProgress::setText(const OUString& rText)
+void SAL_CALL PluginProgress::setText(const OUString& rText)
{
if (m_pProgressBar)
m_pProgressBar->set_text(rText);
}
-void SAL_CALL WeldPluginProgress::setValue(sal_Int32 nValue)
+void SAL_CALL PluginProgress::setValue(sal_Int32 nValue)
{
if (m_pProgressBar)
m_pProgressBar->set_percentage((nValue * 100) / m_nRange);
}
-void SAL_CALL WeldPluginProgress::reset()
+void SAL_CALL PluginProgress::reset()
{
if (m_pProgressBar)
m_pProgressBar->set_percentage(0);
@@ -696,7 +601,7 @@ SaveProgressDialog::SaveProgressDialog(weld::Window* pParent, RecoveryCore* pCor
, m_xProgressBar(m_xBuilder->weld_progress_bar("progress"))
{
m_xProgressBar->set_size_request(m_xProgressBar->get_approximate_digit_width() * 50, -1);
- WeldPluginProgress* pProgress = new WeldPluginProgress(m_xProgressBar.get());
+ PluginProgress* pProgress = new PluginProgress(m_xProgressBar.get());
m_xProgress.set(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW);
}
@@ -739,96 +644,6 @@ void SaveProgressDialog::end()
m_xDialog->response(DLG_RET_OK);
}
-RecovDocListEntry::RecovDocListEntry( const OUString& sText )
- : SvLBoxString( sText )
-{
-}
-
-void RecovDocListEntry::Paint(const Point& aPos, SvTreeListBox& aDevice, vcl::RenderContext& rRenderContext,
- const SvViewDataEntry* /*pView*/, const SvTreeListEntry& rEntry)
-{
- const Image* pImg = nullptr;
- const OUString* pTxt = nullptr;
- RecovDocList* pList = static_cast<RecovDocList*>(&aDevice);
-
- TURLInfo* pInfo = static_cast<TURLInfo*>(rEntry.GetUserData());
- switch (pInfo->RecoveryState)
- {
- case E_SUCCESSFULLY_RECOVERED:
- {
- pImg = &pList->m_aGreenCheckImg;
- pTxt = &pList->m_aSuccessRecovStr;
- }
- break;
-
- case E_ORIGINAL_DOCUMENT_RECOVERED: // TODO must be renamed into ORIGINAL DOCUMENT recovered! Because its marked as yellow
- {
- pImg = &pList->m_aYellowCheckImg;
- pTxt = &pList->m_aOrigDocRecovStr;
- }
- break;
-
- case E_RECOVERY_FAILED:
- {
- pImg = &pList->m_aRedCrossImg;
- pTxt = &pList->m_aRecovFailedStr;
- }
- break;
-
- case E_RECOVERY_IS_IN_PROGRESS:
- {
- pImg = nullptr;
- pTxt = &pList->m_aRecovInProgrStr;
- }
- break;
-
- case E_NOT_RECOVERED_YET:
- {
- pImg = nullptr;
- pTxt = &pList->m_aNotRecovYetStr;
- }
- break;
- }
-
- if (pImg)
- rRenderContext.DrawImage(aPos, *pImg);
-
- if (pTxt)
- {
- Point aPnt(aPos);
- aPnt.AdjustX(pList->m_aGreenCheckImg.GetSizePixel().Width() );
- aPnt.AdjustX(10 );
- rRenderContext.DrawText(aPnt, *pTxt);
- }
-}
-
-RecovDocList::RecovDocList(SvSimpleTableContainer& rParent)
- : SvSimpleTable ( rParent )
- , m_aGreenCheckImg (StockImage::Yes, RID_SVXBMP_GREENCHECK)
- , m_aYellowCheckImg (StockImage::Yes, RID_SVXBMP_YELLOWCHECK)
- , m_aRedCrossImg (StockImage::Yes, RID_SVXBMP_REDCROSS)
- , m_aSuccessRecovStr (SvxResId(RID_SVXSTR_SUCCESSRECOV))
- , m_aOrigDocRecovStr (SvxResId(RID_SVXSTR_ORIGDOCRECOV))
- , m_aRecovFailedStr (SvxResId(RID_SVXSTR_RECOVFAILED))
- , m_aRecovInProgrStr (SvxResId(RID_SVXSTR_RECOVINPROGR))
- , m_aNotRecovYetStr (SvxResId(RID_SVXSTR_NOTRECOVYET))
-{
-}
-
-void RecovDocList::InitEntry(SvTreeListEntry* pEntry,
- const OUString& rText,
- const Image& rImage1,
- const Image& rImage2,
- SvLBoxButtonKind eButtonKind)
-{
- SvTabListBox::InitEntry(pEntry, rText, rImage1, rImage2, eButtonKind);
- DBG_ASSERT( TabCount() == 2, "*RecovDocList::InitEntry(): structure mismatch" );
-
- SvLBoxString& rCol = static_cast<SvLBoxString&>(pEntry->GetItem(2));
- pEntry->ReplaceItem(std::make_unique<RecovDocListEntry>(rCol.GetText()), 2);
-}
-
-
static short impl_askUserForWizardCancel(weld::Widget* pParent, const char* pRes)
{
std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(pParent,
@@ -839,9 +654,8 @@ static short impl_askUserForWizardCancel(weld::Widget* pParent, const char* pRes
return DLG_RET_CANCEL;
}
-RecoveryDialog::RecoveryDialog(vcl::Window* pParent, RecoveryCore* pCore)
- : Dialog(pParent, "DocRecoveryRecoverDialog",
- "svx/ui/docrecoveryrecoverdialog.ui")
+RecoveryDialog::RecoveryDialog(weld::Window* pParent, RecoveryCore* pCore)
+ : GenericDialogController(pParent, "svx/ui/docrecoveryrecoverdialog.ui", "DocRecoveryRecoverDialog")
, m_aTitleRecoveryInProgress(SvxResId(RID_SVXSTR_RECOVERY_INPROGRESS))
, m_aRecoveryOnlyFinish (SvxResId(RID_SVXSTR_RECOVERYONLY_FINISH))
, m_aRecoveryOnlyFinishDescr(SvxResId(RID_SVXSTR_RECOVERYONLY_FINISH_DESCR))
@@ -849,63 +663,56 @@ RecoveryDialog::RecoveryDialog(vcl::Window* pParent, RecoveryCore* pCore)
, m_eRecoveryState(RecoveryDialog::E_RECOVERY_PREPARED)
, m_bWaitForCore(false)
, m_bWasRecoveryStarted(false)
+ , m_aGreenCheckImg(RID_SVXBMP_GREENCHECK)
+ , m_aYellowCheckImg(RID_SVXBMP_YELLOWCHECK)
+ , m_aRedCrossImg(RID_SVXBMP_REDCROSS)
+ , m_aSuccessRecovStr(SvxResId(RID_SVXSTR_SUCCESSRECOV))
+ , m_aOrigDocRecovStr(SvxResId(RID_SVXSTR_ORIGDOCRECOV))
+ , m_aRecovFailedStr(SvxResId(RID_SVXSTR_RECOVFAILED))
+ , m_aRecovInProgrStr(SvxResId(RID_SVXSTR_RECOVINPROGR))
+ , m_aNotRecovYetStr(SvxResId(RID_SVXSTR_NOTRECOVYET))
+ , m_xDescrFT(m_xBuilder->weld_label("desc"))
+ , m_xProgressBar(m_xBuilder->weld_progress_bar("progress"))
+ , m_xFileListLB(m_xBuilder->weld_tree_view("filelist"))
+ , m_xNextBtn(m_xBuilder->weld_button("next"))
+ , m_xCancelBtn(m_xBuilder->weld_button("cancel"))
{
- get(m_pDescrFT, "desc");
- get(m_pProgrParent, "progress");
- get(m_pNextBtn, "next");
- get(m_pCancelBtn, "cancel");
-
- constexpr int RECOV_CONTROLWIDTH = 278;
- SvSimpleTableContainer* pFileListLBContainer = get<SvSimpleTableContainer>("filelist");
- Size aSize(LogicToPixel(Size(RECOV_CONTROLWIDTH, 68), MapMode(MapUnit::MapAppFont)));
- pFileListLBContainer->set_height_request(aSize.Height());
- m_pFileListLB = VclPtr<RecovDocList>::Create(*pFileListLBContainer);
-
- static long aTabPositions[] = { 0, 40*RECOV_CONTROLWIDTH/100 };
- m_pFileListLB->SetTabs( SAL_N_ELEMENTS(aTabPositions), aTabPositions );
- m_pFileListLB->InsertHeaderEntry(get<FixedText>("nameft")->GetText() + "\t" + get<FixedText>("statusft")->GetText());
-
- PluginProgress* pProgress = new PluginProgress(m_pProgrParent, pCore->getComponentContext());
+ const auto nWidth = m_xFileListLB->get_approximate_digit_width() * 70;
+ m_xFileListLB->set_size_request(nWidth, m_xFileListLB->get_height_rows(10));
+ m_xProgressBar->set_size_request(m_xProgressBar->get_approximate_digit_width() * 50, -1);
+ PluginProgress* pProgress = new PluginProgress(m_xProgressBar.get());
m_xProgress.set(static_cast< css::task::XStatusIndicator* >(pProgress), css::uno::UNO_QUERY_THROW);
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- m_pFileListLB->SetBackground( rStyleSettings.GetDialogColor() );
+ std::vector<int> aWidths;
+ aWidths.push_back(m_xFileListLB->get_checkbox_column_width());
+ aWidths.push_back(60 * nWidth / 100);
+ aWidths.push_back(m_xFileListLB->get_checkbox_column_width());
+ m_xFileListLB->set_column_fixed_widths(aWidths);
- m_pNextBtn->Enable();
- m_pNextBtn->SetClickHdl( LINK( this, RecoveryDialog, NextButtonHdl ) );
- m_pCancelBtn->SetClickHdl( LINK( this, RecoveryDialog, CancelButtonHdl ) );
+ m_xNextBtn->set_sensitive(true);
+ m_xNextBtn->connect_clicked( LINK( this, RecoveryDialog, NextButtonHdl ) );
+ m_xCancelBtn->connect_clicked( LINK( this, RecoveryDialog, CancelButtonHdl ) );
// fill list box first time
- TURLList& rURLList = m_pCore->getURLListAccess();
- for (const TURLInfo& rInfo : rURLList)
+ TURLList& rURLList = m_pCore->getURLListAccess();
+ for (size_t i = 0, nCount = rURLList.size(); i < nCount; ++i)
{
- OUString sName( rInfo.DisplayName );
- sName += "\t";
- sName += impl_getStatusString( rInfo );
- SvTreeListEntry* pEntry = m_pFileListLB->InsertEntry(sName, rInfo.StandardImage, rInfo.StandardImage);
- pEntry->SetUserData(const_cast<TURLInfo *>(&rInfo));
+ const TURLInfo& rInfo = rURLList[i];
+ m_xFileListLB->append();
+ m_xFileListLB->set_id(i, OUString::number(reinterpret_cast<sal_IntPtr>(&rInfo)));
+ m_xFileListLB->set_image(i, rInfo.StandardImageId, 0);
+ m_xFileListLB->set_text(i, rInfo.DisplayName, 1);
+ m_xFileListLB->set_image(i, impl_getStatusImage(rInfo), 2);
+ m_xFileListLB->set_text(i, impl_getStatusString(rInfo), 3);
}
// mark first item
- SvTreeListEntry* pFirst = m_pFileListLB->First();
- if (pFirst)
- m_pFileListLB->SetCursor(pFirst, true);
+ if (m_xFileListLB->n_children())
+ m_xFileListLB->set_cursor(0);
}
RecoveryDialog::~RecoveryDialog()
{
- disposeOnce();
-}
-
-void RecoveryDialog::dispose()
-{
- m_pFileListLB.disposeAndClear();
- m_pDescrFT.clear();
- m_pProgrParent.clear();
- m_pNextBtn.clear();
- m_pCancelBtn.clear();
- Dialog::dispose();
}
short RecoveryDialog::execute()
@@ -920,9 +727,9 @@ short RecoveryDialog::execute()
m_bWasRecoveryStarted = true;
// do it asynchronous (to allow repaints)
// and wait for this asynchronous operation.
- m_pDescrFT->SetText( m_aTitleRecoveryInProgress );
- m_pNextBtn->Enable(false);
- m_pCancelBtn->Enable(false);
+ m_xDescrFT->set_label( m_aTitleRecoveryInProgress );
+ m_xNextBtn->set_sensitive(false);
+ m_xCancelBtn->set_sensitive(false);
m_pCore->setProgressHandler(m_xProgress);
m_pCore->setUpdateListener(this);
m_pCore->doRecovery();
@@ -940,10 +747,10 @@ short RecoveryDialog::execute()
{
// the core finished it's task.
// let the user decide the next step.
- m_pDescrFT->SetText(m_aRecoveryOnlyFinishDescr);
- m_pNextBtn->SetText(m_aRecoveryOnlyFinish);
- m_pNextBtn->Enable();
- m_pCancelBtn->Enable(false);
+ m_xDescrFT->set_label(m_aRecoveryOnlyFinishDescr);
+ m_xNextBtn->set_label(m_aRecoveryOnlyFinish);
+ m_xNextBtn->set_sensitive(true);
+ m_xCancelBtn->set_sensitive(false);
return 0;
}
@@ -955,7 +762,7 @@ short RecoveryDialog::execute()
// failed recovery documents. They must be saved to
// a user selected directory.
short nRet = DLG_RET_UNKNOWN;
- BrokenRecoveryDialog aBrokenRecoveryDialog(GetFrameWeld(), m_pCore, !m_bWasRecoveryStarted);
+ BrokenRecoveryDialog aBrokenRecoveryDialog(m_xDialog.get(), m_pCore, !m_bWasRecoveryStarted);
OUString sSaveDir = aBrokenRecoveryDialog.getSaveDirURL(); // get the default dir
if (aBrokenRecoveryDialog.isExecutionNeeded())
{
@@ -1023,7 +830,7 @@ short RecoveryDialog::execute()
// If no temp files exists or user decided to ignore it ...
// we have to remove all recovery/session data anyway!
short nRet = DLG_RET_UNKNOWN;
- BrokenRecoveryDialog aBrokenRecoveryDialog(GetFrameWeld(), m_pCore, !m_bWasRecoveryStarted);
+ BrokenRecoveryDialog aBrokenRecoveryDialog(m_xDialog.get(), m_pCore, !m_bWasRecoveryStarted);
OUString sSaveDir = aBrokenRecoveryDialog.getSaveDirURL(); // get the default save location
// dialog itself checks if there is a need to copy files for this mode.
@@ -1082,45 +889,31 @@ void RecoveryDialog::start()
void RecoveryDialog::updateItems()
{
- sal_uIntPtr c = m_pFileListLB->GetEntryCount();
- sal_uIntPtr i = 0;
- for ( i=0; i<c; ++i )
+ int c = m_xFileListLB->n_children();
+ for (int i = 0; i < c; ++i)
{
- SvTreeListEntry* pEntry = m_pFileListLB->GetEntry(i);
- if ( !pEntry )
- continue;
-
- TURLInfo* pInfo = static_cast<TURLInfo*>(pEntry->GetUserData());
+ TURLInfo* pInfo = reinterpret_cast<TURLInfo*>(m_xFileListLB->get_id(i).toInt64());
if ( !pInfo )
continue;
+ m_xFileListLB->set_image(i, impl_getStatusImage(*pInfo), 2);
OUString sStatus = impl_getStatusString( *pInfo );
- if ( !sStatus.isEmpty() )
- m_pFileListLB->SetEntryText( sStatus, pEntry, 1 );
+ if (!sStatus.isEmpty())
+ m_xFileListLB->set_text(i, sStatus, 3);
}
-
- m_pFileListLB->Invalidate();
- m_pFileListLB->Update();
}
void RecoveryDialog::stepNext(TURLInfo* pItem)
{
- sal_uIntPtr c = m_pFileListLB->GetEntryCount();
- sal_uIntPtr i = 0;
- for (i=0; i<c; ++i)
+ int c = m_xFileListLB->n_children();
+ for (int i=0; i < c; ++i)
{
- SvTreeListEntry* pEntry = m_pFileListLB->GetEntry(i);
- if (!pEntry)
- continue;
-
- TURLInfo* pInfo = static_cast<TURLInfo*>(pEntry->GetUserData());
+ TURLInfo* pInfo = reinterpret_cast<TURLInfo*>(m_xFileListLB->get_id(i).toInt64());
if (pInfo->ID != pItem->ID)
continue;
- m_pFileListLB->SetCursor(pEntry, true);
- m_pFileListLB->MakeVisible(pEntry);
- m_pFileListLB->Invalidate();
- m_pFileListLB->Update();
+ m_xFileListLB->set_cursor(i);
+ m_xFileListLB->scroll_to_row(i);
break;
}
}
@@ -1130,7 +923,7 @@ void RecoveryDialog::end()
m_bWaitForCore = false;
}
-IMPL_LINK_NOARG(RecoveryDialog, NextButtonHdl, Button*, void)
+IMPL_LINK_NOARG(RecoveryDialog, NextButtonHdl, weld::Button&, void)
{
switch (m_eRecoveryState)
{
@@ -1146,16 +939,16 @@ IMPL_LINK_NOARG(RecoveryDialog, NextButtonHdl, Button*, void)
if (m_eRecoveryState == RecoveryDialog::E_RECOVERY_HANDLED)
{
- EndDialog(DLG_RET_OK);
+ m_xDialog->response(DLG_RET_OK);
}
}
-IMPL_LINK_NOARG(RecoveryDialog, CancelButtonHdl, Button*, void)
+IMPL_LINK_NOARG(RecoveryDialog, CancelButtonHdl, weld::Button&, void)
{
switch (m_eRecoveryState)
{
case RecoveryDialog::E_RECOVERY_PREPARED:
- if (impl_askUserForWizardCancel(GetFrameWeld(), RID_SVXSTR_QUERY_EXIT_RECOVERY) != DLG_RET_CANCEL)
+ if (impl_askUserForWizardCancel(m_xDialog.get(), RID_SVXSTR_QUERY_EXIT_RECOVERY) != DLG_RET_CANCEL)
{
m_eRecoveryState = RecoveryDialog::E_RECOVERY_CANCELED;
execute();
@@ -1169,7 +962,7 @@ IMPL_LINK_NOARG(RecoveryDialog, CancelButtonHdl, Button*, void)
if (m_eRecoveryState == RecoveryDialog::E_RECOVERY_HANDLED)
{
- EndDialog();
+ m_xDialog->response(RET_CANCEL);
}
}
@@ -1179,19 +972,39 @@ OUString RecoveryDialog::impl_getStatusString( const TURLInfo& rInfo ) const
switch ( rInfo.RecoveryState )
{
case E_SUCCESSFULLY_RECOVERED :
- sStatus = m_pFileListLB->m_aSuccessRecovStr;
+ sStatus = m_aSuccessRecovStr;
break;
case E_ORIGINAL_DOCUMENT_RECOVERED :
- sStatus = m_pFileListLB->m_aOrigDocRecovStr;
+ sStatus = m_aOrigDocRecovStr;
break;
case E_RECOVERY_FAILED :
- sStatus = m_pFileListLB->m_aRecovFailedStr;
+ sStatus = m_aRecovFailedStr;
break;
case E_RECOVERY_IS_IN_PROGRESS :
- sStatus = m_pFileListLB->m_aRecovInProgrStr;
+ sStatus = m_aRecovInProgrStr;
break;
case E_NOT_RECOVERED_YET :
- sStatus = m_pFileListLB->m_aNotRecovYetStr;
+ sStatus = m_aNotRecovYetStr;
+ break;
+ default:
+ break;
+ }
+ return sStatus;
+}
+
+OUString RecoveryDialog::impl_getStatusImage( const TURLInfo& rInfo ) const
+{
+ OUString sStatus;
+ switch ( rInfo.RecoveryState )
+ {
+ case E_SUCCESSFULLY_RECOVERED :
+ sStatus = m_aGreenCheckImg;
+ break;
+ case E_ORIGINAL_DOCUMENT_RECOVERED :
+ sStatus = m_aYellowCheckImg;
+ break;
+ case E_RECOVERY_FAILED :
+ sStatus = m_aRedCrossImg;
break;
default:
break;
diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx
index 698882acbdc2..880af077be32 100644
--- a/svx/source/inc/docrecovery.hxx
+++ b/svx/source/inc/docrecovery.hxx
@@ -20,17 +20,8 @@
#ifndef INCLUDED_SVX_SOURCE_INC_DOCRECOVERY_HXX
#define INCLUDED_SVX_SOURCE_INC_DOCRECOVERY_HXX
-#include <vcl/dialog.hxx>
-#include <vcl/button.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/tabdlg.hxx>
-#include <vcl/tabpage.hxx>
#include <vcl/weld.hxx>
-#include <svtools/simptabl.hxx>
-#include <vcl/svlbitm.hxx>
#include <svtools/svmedit2.hxx>
-#include <vcl/treelistbox.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <cppuhelper/implbase.hxx>
@@ -146,7 +137,6 @@ struct TURLInfo
ERecoveryState RecoveryState;
/// standard icon
- Image StandardImage;
OUString StandardImageId;
public:
@@ -294,68 +284,7 @@ class RecoveryCore : public ::cppu::WeakImplHelper< css::frame::XStatusListener
css::util::URL impl_getParsedURL(const OUString& sURL);
};
-
-class PluginProgressWindow : public vcl::Window
-{
- private:
- css::uno::Reference< css::lang::XComponent > m_xProgress;
- public:
- PluginProgressWindow( vcl::Window* pParent ,
- const css::uno::Reference< css::lang::XComponent >& xProgress);
- virtual ~PluginProgressWindow() override;
- virtual void dispose() override;
-};
-
-class PluginProgress : public ::cppu::WeakImplHelper< css::task::XStatusIndicator ,
- css::lang::XComponent >
-{
- // member
- private:
- /** @short TODO */
- css::uno::Reference< css::task::XStatusIndicatorFactory > m_xProgressFactory;
-
- css::uno::Reference< css::task::XStatusIndicator > m_xProgress;
-
- VclPtr<PluginProgressWindow> m_pPlugProgressWindow;
-
-
- // native interface
- public:
- /** @short TODO */
- PluginProgress( vcl::Window* pParent,
- const css::uno::Reference< css::uno::XComponentContext >& xContext );
-
-
- /** @short TODO */
- virtual ~PluginProgress() override;
-
-
- // uno interface
- public:
-
-
- // XStatusIndicator
- virtual void SAL_CALL start(const OUString& sText ,
- sal_Int32 nRange) override;
-
- virtual void SAL_CALL end() override;
-
- virtual void SAL_CALL setText(const OUString& sText) override;
-
- virtual void SAL_CALL setValue(sal_Int32 nValue) override;
-
- virtual void SAL_CALL reset() override;
-
-
- // XComponent
- virtual void SAL_CALL dispose() override;
-
- virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener >& xListener) override;
-
- virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener) override;
-};
-
-class WeldPluginProgress : public ::cppu::WeakImplHelper<css::task::XStatusIndicator, css::lang::XComponent>
+class PluginProgress : public ::cppu::WeakImplHelper<css::task::XStatusIndicator, css::lang::XComponent>
{
// member
private:
@@ -364,8 +293,8 @@ private:
// native interface
public:
- WeldPluginProgress(weld::ProgressBar* pProgressBar);
- virtual ~WeldPluginProgress() override;
+ PluginProgress(weld::ProgressBar* pProgressBar);
+ virtual ~PluginProgress() override;
// uno interface
public:
@@ -454,64 +383,11 @@ class SaveProgressDialog : public weld::GenericDialogController
virtual void end() override;
};
-
-class RecovDocListEntry : public SvLBoxString
-{
-public:
-
- /** @short TODO */
- RecovDocListEntry( const OUString& sText );
-
-
- /** @short TODO */
- virtual void Paint(const Point& rPos, SvTreeListBox& rOutDev, vcl::RenderContext& rRenderContext,
- const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) override;
-};
-
-
-class RecovDocList : public SvSimpleTable
-{
-
- // member
- public:
-
- Image m_aGreenCheckImg;
- Image m_aYellowCheckImg;
- Image m_aRedCrossImg;
-
- OUString m_aSuccessRecovStr;
- OUString m_aOrigDocRecovStr;
- OUString m_aRecovFailedStr;
- OUString m_aRecovInProgrStr;
- OUString m_aNotRecovYetStr;
-
-
- // interface
- public:
-
-
- /** @short TODO */
- RecovDocList(SvSimpleTableContainer& rParent);
-
- /** @short TODO */
- virtual void InitEntry(SvTreeListEntry* pEntry,
- const OUString& rText,
- const Image& rImage1,
- const Image& rImage2,
- SvLBoxButtonKind eButtonKind) override;
-};
-
-
-class RecoveryDialog : public Dialog
+class RecoveryDialog : public weld::GenericDialogController
, public IRecoveryUpdateListener
{
// member
private:
- VclPtr<FixedText> m_pDescrFT;
- VclPtr<vcl::Window> m_pProgrParent;
- VclPtr<RecovDocList> m_pFileListLB;
- VclPtr<PushButton> m_pNextBtn;
- VclPtr<PushButton> m_pCancelBtn;
OUString const m_aTitleRecoveryInProgress;
OUString const m_aRecoveryOnlyFinish;
OUString const m_aRecoveryOnlyFinishDescr;
@@ -533,14 +409,29 @@ class RecoveryDialog : public Dialog
bool m_bWaitForCore;
bool m_bWasRecoveryStarted;
+ OUString m_aGreenCheckImg;
+ OUString m_aYellowCheckImg;
+ OUString m_aRedCrossImg;
+
+ OUString m_aSuccessRecovStr;
+ OUString m_aOrigDocRecovStr;
+ OUString m_aRecovFailedStr;
+ OUString m_aRecovInProgrStr;
+ OUString m_aNotRecovYetStr;
+
+ std::unique_ptr<weld::Label> m_xDescrFT;
+ std::unique_ptr<weld::ProgressBar> m_xProgressBar;
+ std::unique_ptr<weld::TreeView> m_xFileListLB;
+ std::unique_ptr<weld::Button> m_xNextBtn;
+ std::unique_ptr<weld::Button> m_xCancelBtn;
+
// member
public:
/** @short TODO */
- RecoveryDialog(vcl::Window* pParent,
- RecoveryCore* pCore );
+ RecoveryDialog(weld::Window* pParent,
+ RecoveryCore* pCore);
virtual ~RecoveryDialog() override;
- virtual void dispose() override;
// IRecoveryUpdateListener
virtual void updateItems() override;
@@ -552,13 +443,11 @@ class RecoveryDialog : public Dialog
// helper
private:
- /** @short TODO */
- DECL_LINK(NextButtonHdl, Button*, void);
- DECL_LINK(CancelButtonHdl, Button*, void);
+ DECL_LINK(NextButtonHdl, weld::Button&, void);
+ DECL_LINK(CancelButtonHdl, weld::Button&, void);
-
- /** @short TODO */
OUString impl_getStatusString( const TURLInfo& rInfo ) const;
+ OUString impl_getStatusImage( const TURLInfo& rInfo ) const;
};
diff --git a/svx/source/unodraw/recoveryui.cxx b/svx/source/unodraw/recoveryui.cxx
index 05d9c223f669..54f0047e50df 100644
--- a/svx/source/unodraw/recoveryui.cxx
+++ b/svx/source/unodraw/recoveryui.cxx
@@ -65,13 +65,13 @@ class RecoveryUI : public ::cppu::WeakImplHelper< css::lang::XServiceInfo
css::uno::Reference< css::uno::XComponentContext > m_xContext;
/** @short TODO */
- VclPtr<vcl::Window> m_pParentWindow;
+ weld::Window* m_pParentWindow;
/** @short TODO */
RecoveryUI::EJob m_eJob;
// Active dialog
- VclPtr<Dialog> m_pDialog;
+ weld::Dialog* m_pDialog;
// interface
public:
@@ -92,6 +92,10 @@ class RecoveryUI : public ::cppu::WeakImplHelper< css::lang::XServiceInfo
virtual css::uno::Any SAL_CALL dispatchWithReturnValue(const css::util::URL& aURL,
const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) override;
+ void SetActiveDialog(weld::Dialog* pDialog)
+ {
+ m_pDialog = pDialog;
+ }
// helper
private:
@@ -108,9 +112,10 @@ class RecoveryUI : public ::cppu::WeakImplHelper< css::lang::XServiceInfo
};
RecoveryUI::RecoveryUI(const css::uno::Reference< css::uno::XComponentContext >& xContext)
- : m_xContext (xContext )
- , m_pParentWindow(nullptr )
- , m_eJob (RecoveryUI::E_JOB_UNKNOWN)
+ : m_xContext(xContext)
+ , m_pParentWindow(nullptr)
+ , m_eJob(RecoveryUI::E_JOB_UNKNOWN)
+ , m_pDialog(nullptr)
{
}
@@ -231,14 +236,17 @@ RecoveryUI::EJob RecoveryUI::impl_classifyJob(const css::util::URL& aURL)
struct DialogReleaseGuard
{
- VclPtr<Dialog>& m_rDialog;
- template <class DialogPtrClass>
- DialogReleaseGuard(VclPtr<Dialog>& rDialog, DialogPtrClass& p)
- : m_rDialog(rDialog)
+ RecoveryUI& m_rRecoveryUI;
+
+ DialogReleaseGuard(RecoveryUI& rRecoveryUI, weld::Dialog* p)
+ : m_rRecoveryUI(rRecoveryUI)
{
- m_rDialog.set(p.get());
+ m_rRecoveryUI.SetActiveDialog(p);
+ }
+ ~DialogReleaseGuard()
+ {
+ m_rRecoveryUI.SetActiveDialog(nullptr);
}
- ~DialogReleaseGuard() { m_rDialog.reset(); }
};
bool RecoveryUI::impl_doEmergencySave()
@@ -247,10 +255,11 @@ bool RecoveryUI::impl_doEmergencySave()
rtl::Reference<svxdr::RecoveryCore> pCore = new svxdr::RecoveryCore(m_xContext, true);
// create dialog for this operation and bind it to the used core service
- svxdr::SaveDialog aDialog(m_pParentWindow ? m_pParentWindow->GetFrameWeld() : nullptr, pCore.get());
+ std::unique_ptr<svxdr::SaveDialog> xDialog(new svxdr::SaveDialog(m_pParentWindow, pCore.get()));
+ DialogReleaseGuard dialogReleaseGuard(*this, xDialog->getDialog());
// start the dialog
- short nRet = aDialog.run();
+ short nRet = xDialog->run();
return (nRet==DLG_RET_OK_AUTOLUNCH);
}
@@ -261,11 +270,11 @@ bool RecoveryUI::impl_doRecovery()
// create all needed dialogs for this operation
// and bind it to the used core service
- ScopedVclPtrInstance<svxdr::RecoveryDialog> xDialog(m_pParentWindow, pCore.get());
- DialogReleaseGuard dialogReleaseGuard(m_pDialog, xDialog);
+ std::unique_ptr<svxdr::RecoveryDialog> xDialog(new svxdr::RecoveryDialog(m_pParentWindow, pCore.get()));
+ DialogReleaseGuard dialogReleaseGuard(*this, xDialog->getDialog());
// start the dialog
- short nRet = xDialog->Execute();
+ short nRet = xDialog->run();
impl_showAllRecoveredDocs();
@@ -308,11 +317,9 @@ void RecoveryUI::impl_showAllRecoveredDocs()
bool RecoveryUI::impl_doBringToFront()
{
- VclPtr<Dialog> pDialog(m_pDialog);
- if (!pDialog || !pDialog->IsVisible())
+ if (!m_pDialog || !m_pDialog->get_visible())
return false;
-
- pDialog->ToTop(ToTopFlags::RestoreWhenMin | ToTopFlags::ForegroundTask);
+ m_pDialog->present();
return true;
}
diff --git a/svx/uiconfig/ui/docrecoveryrecoverdialog.ui b/svx/uiconfig/ui/docrecoveryrecoverdialog.ui
index 41a5abcb1fd9..d0f02a24299a 100644
--- a/svx/uiconfig/ui/docrecoveryrecoverdialog.ui
+++ b/svx/uiconfig/ui/docrecoveryrecoverdialog.ui
@@ -1,13 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
+<!-- Generated with glade 3.22.1 -->
<interface domain="svx">
<requires lib="gtk+" version="3.18"/>
- <requires lib="LibreOffice" version="1.0"/>
+ <object class="GtkTreeStore" id="liststore1">
+ <columns>
+ <!-- column-name image -->
+ <column type="GdkPixbuf"/>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name image2 -->
+ <column type="GdkPixbuf"/>
+ <!-- column-name text1 -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkDialog" id="DocRecoveryRecoverDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="title" translatable="yes" context="docrecoveryrecoverdialog|DocRecoveryRecoverDialog">%PRODUCTNAME %PRODUCTVERSION Document Recovery</property>
+ <property name="modal">True</property>
+ <property name="default_width">0</property>
+ <property name="default_height">0</property>
<property name="type_hint">dialog</property>
+ <child>
+ <placeholder/>
+ </child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
@@ -57,141 +76,121 @@
</packing>
</child>
<child>
- <object class="GtkGrid" id="bgrid1">
+ <object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="row_spacing">12</property>
+ <property name="row_spacing">10</property>
+ <child>
+ <object class="GtkLabel" id="desc">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="docrecoveryrecoverdialog|desc">%PRODUCTNAME will attempt to recover the state of the files you were working on before it crashed. Click 'Start' to begin the process, or click 'Discard' to cancel the recovery.</property>
+ <property name="wrap">True</property>
+ <property name="width_chars">70</property>
+ <property name="max_width_chars">70</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
<child>
- <object class="GtkGrid" id="grid1">
+ <object class="GtkProgressBar" id="progress">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes" context="docrecoveryrecoverdialog|label2">Status of recovered documents:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">filelist</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="row_spacing">10</property>
+ <property name="shadow_type">in</property>
<child>
- <object class="GtkLabel" id="desc">
+ <object class="GtkTreeView" id="filelist">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="docrecoveryrecoverdialog|desc">%PRODUCTNAME will attempt to recover the state of the files you were working on before it crashed. Click 'Start' to begin the process, or click 'Discard' to cancel the recovery.</property>
- <property name="wrap">True</property>
- <property name="max_width_chars">87</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkGrid" id="grid2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes" context="docrecoveryrecoverdialog|label2">Status of recovered documents:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">filelist:border</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
+ <property name="model">liststore1</property>
+ <property name="headers_clickable">False</property>
+ <property name="headers_visible">True</property>
+ <property name="search_column">0</property>
+ <property name="show_expanders">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection2"/>
</child>
<child>
- <object class="svtlo-SvSimpleTableContainer" id="filelist:border">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection"/>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn0">
+ <child>
+ <object class="GtkCellRendererPixbuf" id="cellrenderertext9"/>
+ <attributes>
+ <attribute name="pixbuf">0</attribute>
+ </attributes>
</child>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
</child>
<child>
- <object class="GtkGrid" id="grid4">
- <property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="hexpand">True</property>
- <property name="column_spacing">12</property>
- <property name="column_homogeneous">True</property>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <property name="title" translatable="yes" context="docrecoveryrecoverdialog|nameft">Document Name</property>
<child>
- <object class="GtkLabel" id="nameft">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="label" translatable="yes" context="docrecoveryrecoverdialog|nameft">Document Name</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
+ <object class="GtkCellRendererText" id="cellrenderertext2"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
</child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn2">
<child>
- <object class="GtkLabel" id="statusft">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="label" translatable="yes" context="docrecoveryrecoverdialog|statusft">Status</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- </packing>
+ <object class="GtkCellRendererPixbuf" id="cellrenderertext4"/>
+ <attributes>
+ <attribute name="pixbuf">2</attribute>
+ </attributes>
</child>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
</child>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkGrid" id="grid3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
<child>
- <object class="GtkHBox" id="progress">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn3">
+ <property name="title" translatable="yes" context="docrecoveryrecoverdialog|statusft">Status</property>
<child>
- <placeholder/>
+ <object class="GtkCellRendererText" id="cellrenderertext3"/>
+ <attributes>
+ <attribute name="text">3</attribute>
+ </attributes>
</child>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
- </packing>
</child>
</object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- </packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="top_attach">3</property>
</packing>
</child>
</object>
diff --git a/svx/uiconfig/ui/docrecoverysavedialog.ui b/svx/uiconfig/ui/docrecoverysavedialog.ui
index df6fb307a5c9..3025ac4ef406 100644
--- a/svx/uiconfig/ui/docrecoverysavedialog.ui
+++ b/svx/uiconfig/ui/docrecoverysavedialog.ui
@@ -75,8 +75,8 @@
<property name="can_focus">False</property>
<property name="label" translatable="yes" context="docrecoverysavedialog|label1">Due to an unexpected error, %PRODUCTNAME crashed. All the files you were working on will now be saved. The next time %PRODUCTNAME is launched, your files will be recovered automatically.</property>
<property name="wrap">True</property>
- <property name="width_chars">80</property>
- <property name="max_width_chars">80</property>
+ <property name="width_chars">70</property>
+ <property name="max_width_chars">70</property>
<property name="xalign">0</property>
</object>
<packing>
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 76650b141e0a..d865351bec06 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -639,6 +639,8 @@ namespace
{
Image createImage(const OUString& rImage)
{
+ if (rImage.isEmpty())
+ return Image();
if (rImage.lastIndexOf('.') != rImage.getLength() - 4)
{
assert((rImage == "dialog-warning" || rImage == "dialog-error" || rImage == "dialog-information") && "unknown stock image");
@@ -898,6 +900,11 @@ public:
return m_xWindow->HasChildPathFocus();
}
+ virtual void present() override
+ {
+ m_xWindow->ToTop(ToTopFlags::RestoreWhenMin | ToTopFlags::ForegroundTask);
+ }
+
virtual void set_window_state(const OString& rStr) override
{
SystemWindow* pSysWin = dynamic_cast<SystemWindow*>(m_xWindow.get());
@@ -2484,6 +2491,36 @@ public:
m_xTreeView->ModelHasEntryInvalidated(pEntry);
}
+ virtual void set_image(int pos, const OUString& rImage, int col) override
+ {
+ SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
+
+ ++col; //skip dummy/expander column
+
+ // blank out missing entries
+ for (int i = pEntry->ItemCount(); i < col ; ++i)
+ pEntry->AddItem(std::make_unique<SvLBoxString>(""));
+
+ Image aImage(createImage(rImage));
+ if (static_cast<size_t>(col) == pEntry->ItemCount())
+ {
+ pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage, false));
+ SvViewDataEntry* pViewData = m_xTreeView->GetViewDataEntry(pEntry);
+ m_xTreeView->InitViewData(pViewData, pEntry);
+ }
+ else
+ {
+ assert(col >= 0 && static_cast<size_t>(col) < pEntry->ItemCount());
+ SvLBoxItem& rItem = pEntry->GetItem(col);
+ assert(dynamic_cast<SvLBoxContextBmp*>(&rItem));
+ static_cast<SvLBoxContextBmp&>(rItem).SetBitmap1(aImage);
+ static_cast<SvLBoxContextBmp&>(rItem).SetBitmap2(aImage);
+ }
+
+ m_xTreeView->ModelHasEntryInvalidated(pEntry);
+
+ }
+
const OUString* getEntryData(int index) const
{
SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, index);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index e6ab4936dcfa..cd00ff5a9e8c 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2152,6 +2152,11 @@ public:
return gtk_window_has_toplevel_focus(m_pWindow);
}
+ virtual void present() override
+ {
+ gtk_window_present(m_pWindow);
+ }
+
virtual void set_window_state(const OString& rStr) override
{
WindowStateData aData;
@@ -5016,6 +5021,34 @@ namespace
return found;
}
+ GdkPixbuf* getPixbuf(const OUString& rIconName)
+ {
+ if (rIconName.isEmpty())
+ return nullptr;
+
+ GdkPixbuf* pixbuf = nullptr;
+
+ if (rIconName.lastIndexOf('.') != rIconName.getLength() - 4)
+ {
+ assert((rIconName== "dialog-warning" || rIconName== "dialog-error" || rIconName== "dialog-information") &&
+ "unknown stock image");
+
+ GError *error = nullptr;
+ GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
+ pixbuf = gtk_icon_theme_load_icon(icon_theme, OUStringToOString(rIconName, RTL_TEXTENCODING_UTF8).getStr(),
+ 16, GTK_ICON_LOOKUP_USE_BUILTIN, &error);
+ }
+ else
+ {
+ const AllSettings& rSettings = Application::GetSettings();
+ pixbuf = load_icon_by_name(rIconName,
+ rSettings.GetStyleSettings().DetermineIconTheme(),
+ rSettings.GetUILanguageTag().getBcp47());
+ }
+
+ return pixbuf;
+ }
+
void insert_row(GtkListStore* pListStore, GtkTreeIter& iter, int pos, const OUString* pId, const OUString& rText, const OUString* pIconName, const VirtualDevice* pDevice)
{
if (!pIconName && !pDevice)
@@ -5029,25 +5062,7 @@ namespace
{
if (pIconName)
{
- GdkPixbuf* pixbuf = nullptr;
-
- if (pIconName->lastIndexOf('.') != pIconName->getLength() - 4)
- {
- assert((*pIconName== "dialog-warning" || *pIconName== "dialog-error" ||*pIconName== "dialog-information") &&
- "unknown stock image");
-
- GError *error = nullptr;
- GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
- pixbuf = gtk_icon_theme_load_icon(icon_theme, OUStringToOString(*pIconName, RTL_TEXTENCODING_UTF8).getStr(),
- 16, GTK_ICON_LOOKUP_USE_BUILTIN, &error);
- }
- else
- {
- const AllSettings& rSettings = Application::GetSettings();
- pixbuf = load_icon_by_name(*pIconName,
- rSettings.GetStyleSettings().DetermineIconTheme(),
- rSettings.GetUILanguageTag().getBcp47());
- }
+ GdkPixbuf* pixbuf = getPixbuf(*pIconName);
gtk_list_store_insert_with_values(pListStore, &iter, pos,
0, OUStringToOString(rText, RTL_TEXTENCODING_UTF8).getStr(),
@@ -5082,32 +5097,6 @@ namespace
}
}
}
-
- GdkPixbuf* getPixbuf(const OUString& rIconName)
- {
- GdkPixbuf* pixbuf = nullptr;
-
- if (rIconName.lastIndexOf('.') != rIconName.getLength() - 4)
- {
- assert((rIconName== "dialog-warning" || rIconName== "dialog-error" || rIconName== "dialog-information") &&
- "unknown stock image");
-
- GError *error = nullptr;
- GtkIconTheme *icon_theme = gtk_icon_theme_get_default();
- pixbuf = gtk_icon_theme_load_icon(icon_theme, OUStringToOString(rIconName, RTL_TEXTENCODING_UTF8).getStr(),
- 16, GTK_ICON_LOOKUP_USE_BUILTIN, &error);
- }
- else
- {
- const AllSettings& rSettings = Application::GetSettings();
- pixbuf = load_icon_by_name(rIconName,
- rSettings.GetStyleSettings().DetermineIconTheme(),
- rSettings.GetUILanguageTag().getBcp47());
- }
-
- return pixbuf;
- }
-
}
namespace
@@ -5816,6 +5805,23 @@ public:
return set(pos, col, bOn);
}
+ virtual void set_image(int pos, const OUString& rImage, int col) override
+ {
+ col = get_model_col(col);
+
+ GdkPixbuf* pixbuf = getPixbuf(rImage);
+
+ GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
+ GtkTreeIter iter;
+ if (gtk_tree_model_iter_nth_child(pModel, &iter, nullptr, pos))
+ {
+ gtk_tree_store_set(m_pTreeStore, &iter, col, pixbuf, -1);
+ }
+
+ if (pixbuf)
+ g_object_unref(pixbuf);
+ }
+
virtual OUString get_id(int pos) const override
{
return get(pos, m_nIdCol);