[Libreoffice-commits] core.git: include/svx svx/inc svx/source svx/uiconfig svx/UIConfig_svx.mk
Caolán McNamara
caolanm at redhat.com
Sat May 24 10:08:14 PDT 2014
include/svx/dialogs.hrc | 1
svx/UIConfig_svx.mk | 1
svx/inc/helpid.hrc | 2
svx/source/dialog/docrecovery.cxx | 82 ++++-----------
svx/source/dialog/docrecovery.hrc | 11 --
svx/source/dialog/docrecovery.src | 57 -----------
svx/source/inc/docrecovery.hxx | 35 ------
svx/source/unodraw/recoveryui.cxx | 18 ---
svx/uiconfig/ui/docrecoverysavedialog.ui | 159 +++++++++++++++++++++++++++++++
9 files changed, 192 insertions(+), 174 deletions(-)
New commits:
commit 1413d6bc9902a536c0c67f42d2cb16ea45174fe4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat May 24 17:11:09 2014 +0100
convert doc recovery save page to .ui
and a wizard with one page is just a dialog, so make
that simplification and conversion too
Change-Id: I9f6335007609893308d57d693a18a313bcbb9244
diff --git a/include/svx/dialogs.hrc b/include/svx/dialogs.hrc
index 2756267..aaec27c 100644
--- a/include/svx/dialogs.hrc
+++ b/include/svx/dialogs.hrc
@@ -1008,7 +1008,6 @@
#define RID_SVX_TABDLG_DOCRECOVERY ( RID_SVX_START + 0 )
-#define RID_SVXPAGE_DOCRECOVERY_SAVE ( RID_SVX_START + 8 )
#define RID_SVXPAGE_DOCRECOVERY_RECOVER ( RID_SVX_START + 9 )
// !!!! double defined ID's (see below) !!!
diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index 8f30b32..5388669 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
svx/uiconfig/ui/compressgraphicdialog \
svx/uiconfig/ui/deleteheaderdialog \
svx/uiconfig/ui/deletefooterdialog \
+ svx/uiconfig/ui/docrecoverysavedialog \
svx/uiconfig/ui/extrustiondepthdialog \
svx/uiconfig/ui/findreplacedialog \
svx/uiconfig/ui/fontworkgallerydialog \
diff --git a/svx/inc/helpid.hrc b/svx/inc/helpid.hrc
index bc6d484..c32f8be 100644
--- a/svx/inc/helpid.hrc
+++ b/svx/inc/helpid.hrc
@@ -136,8 +136,6 @@
#define HID_SVX_MDLG_DOCRECOVERY_PROGR "SVX_HID_SVX_MDLG_DOCRECOVERY_PROGR"
#define HID_SVX_TABDLG_DOCRECOVERY "SVX_HID_SVX_TABDLG_DOCRECOVERY"
#define HID_SVX_TP_DOCRECOVERY_RECOVER "SVX_HID_SVX_TP_DOCRECOVERY_RECOVER"
-#define HID_SVX_TP_DOCRECOVERY_SAVE "SVX_HID_SVX_TP_DOCRECOVERY_SAVE"
-
#define HID_VALUESET_EXTRUSION_DIRECTION "SVX_HID_VALUESET_EXTRUSION_DIRECTION"
#define HID_VALUESET_EXTRUSION_LIGHTING "SVX_HID_VALUESET_EXTRUSION_LIGHTING"
#define HID_XMLSEC_CALL "SVX_HID_XMLSEC_CALL"
diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx
index 10ff3a7..e2c9b40 100644
--- a/svx/source/dialog/docrecovery.cxx
+++ b/svx/source/dialog/docrecovery.cxx
@@ -678,20 +678,15 @@ void SAL_CALL PluginProgress::reset()
}
-SaveDialog::SaveDialog(Window* pParent,
- RecoveryCore* pCore )
- : IExtendedTabPage( pParent, SVX_RES( RID_SVXPAGE_DOCRECOVERY_SAVE ) )
- , m_aTitleFT ( this , SVX_RES ( FT_SAVE_TITLE ) )
- , m_aTitleWin ( this , SVX_RES ( WIN_SAVE_TITLE ) )
- , m_aTitleFL ( this , SVX_RES ( FL_SAVE_TITLE ) )
- , m_aDescrFT ( this , SVX_RES ( FT_SAVE_DESCR ) )
- , m_aFileListFT ( this , SVX_RES ( FT_SAVE_FILELIST ) )
- , m_aFileListLB ( this , SVX_RES ( LB_SAVE_FILELIST ) )
- , m_aBottomFL ( this , SVX_RES ( FL_SAVE_BOTTOM ) )
- , m_aOkBtn ( this , SVX_RES ( BT_SAVE_OK ) )
- , m_pCore ( pCore )
+SaveDialog::SaveDialog(Window* pParent, RecoveryCore* pCore)
+ : Dialog(pParent, "DocRecoverySaveDialog", "svx/ui/docrecoverysavedialog.ui")
+ , m_pCore(pCore)
{
- FreeResource();
+ get(m_pTitleFT, "title");
+ get(m_pFileListLB, "filelist");
+ m_pFileListLB->set_height_request(m_pFileListLB->GetTextHeight() * 10);
+ m_pFileListLB->set_width_request(m_pFileListLB->approximate_char_width() * 72);
+ get(m_pOkBtn, "ok");
// Prepare the office for the following crash save step.
// E.g. hide all open widows so the user can't influence our
@@ -699,19 +694,14 @@ SaveDialog::SaveDialog(Window* pParent,
m_pCore->doEmergencySavePrepare();
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- Wallpaper aBackground(rStyleSettings.GetWindowColor());
- m_aTitleWin.SetBackground(aBackground);
- m_aTitleFT.SetBackground (aBackground);
-
- Font aFont(m_aTitleFT.GetFont());
- aFont.SetWeight(WEIGHT_BOLD);
- m_aTitleFT.SetFont(aFont);
+ m_pTitleFT->SetBackground(rStyleSettings.GetWindowColor());
+ m_pTitleFT->set_height_request(m_pTitleFT->get_preferred_size().Height() + 48);
- m_aOkBtn.SetClickHdl( LINK( this, SaveDialog, OKButtonHdl ) );
- m_aFileListLB.SetControlBackground( rStyleSettings.GetDialogColor() );
+ m_pOkBtn->SetClickHdl( LINK( this, SaveDialog, OKButtonHdl ) );
+ m_pFileListLB->SetControlBackground( rStyleSettings.GetDialogColor() );
// fill listbox with current open documents
- m_aFileListLB.Clear();
+ m_pFileListLB->Clear();
TURLList* pURLs = m_pCore->getURLListAccess();
TURLList::const_iterator pIt;
@@ -721,54 +711,26 @@ SaveDialog::SaveDialog(Window* pParent,
++pIt )
{
const TURLInfo& rInfo = *pIt;
- m_aFileListLB.InsertEntry( rInfo.DisplayName, rInfo.StandardImage );
+ m_pFileListLB->InsertEntry( rInfo.DisplayName, rInfo.StandardImage );
}
}
-
-SaveDialog::~SaveDialog()
-{
-}
-
-
IMPL_LINK_NOARG(SaveDialog, OKButtonHdl)
{
- m_nResult = DLG_RET_OK;
- return 0;
-}
-
-
-short SaveDialog::execute()
-{
- ::SolarMutexGuard aLock;
-
- // wait for user input "OK"
- m_nResult = DLG_RET_UNKNOWN;
- while(m_nResult == DLG_RET_UNKNOWN)
- Application::Yield();
-
// start crash-save with progress
- if (m_nResult == DLG_RET_OK)
- {
- SaveProgressDialog* pProgress = new SaveProgressDialog(this, m_pCore);
- m_nResult = pProgress->Execute();
- delete pProgress;
- }
+ SaveProgressDialog* pProgress = new SaveProgressDialog(this, m_pCore);
+ short nResult = pProgress->Execute();
+ delete pProgress;
+
// if "CANCEL" => return "CANCEL"
// if "OK" => "AUTOLUNCH" always !
- if (m_nResult == DLG_RET_OK)
- m_nResult = DLG_RET_OK_AUTOLUNCH;
+ if (nResult == DLG_RET_OK)
+ nResult = DLG_RET_OK_AUTOLUNCH;
- return m_nResult;
-}
-
-
-void SaveDialog::setDefButton()
-{
- m_aOkBtn.GrabFocus();
+ EndDialog(nResult);
+ return 0;
}
-
SaveProgressDialog::SaveProgressDialog(Window* pParent,
RecoveryCore* pCore )
: ModalDialog ( pParent , SVX_RES( RID_SVX_MDLG_DOCRECOVERY_PROGR ) )
diff --git a/svx/source/dialog/docrecovery.hrc b/svx/source/dialog/docrecovery.hrc
index 7ede136..a74b30b 100644
--- a/svx/source/dialog/docrecovery.hrc
+++ b/svx/source/dialog/docrecovery.hrc
@@ -30,17 +30,6 @@
#define TABDLG_WIDTH 290
#define TABDLG_HEIGHT 238
-// TabPage CrashSave
-
-#define WIN_SAVE_TITLE 1
-#define FT_SAVE_TITLE 2
-#define FL_SAVE_TITLE 3
-#define FT_SAVE_DESCR 4
-#define FT_SAVE_FILELIST 5
-#define LB_SAVE_FILELIST 6
-#define FL_SAVE_BOTTOM 8
-#define BT_SAVE_OK 9
-
#define SAVE_WIDTH 290
#define SAVE_HEIGHT 238
#define SAVE_TITLEWINHEIGHT 36
diff --git a/svx/source/dialog/docrecovery.src b/svx/source/dialog/docrecovery.src
index 1900be6..2b676d4 100644
--- a/svx/source/dialog/docrecovery.src
+++ b/svx/source/dialog/docrecovery.src
@@ -33,63 +33,6 @@ TabDialog RID_SVX_TABDLG_DOCRECOVERY
Text = "%PRODUCTNAME %PRODUCTVERSION";
};
-TabPage RID_SVXPAGE_DOCRECOVERY_SAVE
-{
- Size = MAP_APPFONT( SAVE_WIDTH, SAVE_HEIGHT );
- HelpId = HID_SVX_TP_DOCRECOVERY_SAVE;
- OutputSize = TRUE;
- SVLook = TRUE;
- Hide = TRUE;
- Window WIN_SAVE_TITLE
- {
- Pos = MAP_APPFONT( 0 , 0 );
- Size = MAP_APPFONT( SAVE_WIDTH, SAVE_ROW1 );
- };
- FixedText FT_SAVE_TITLE
- {
- Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW0 );
- Size = MAP_APPFONT( SAVE_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
- Text[ en-US ] = "%PRODUCTNAME Document Recovery";
- };
- FixedLine FL_SAVE_TITLE
- {
- Pos = MAP_APPFONT( 0 , SAVE_ROW1 );
- Size = MAP_APPFONT( SAVE_WIDTH, 2 );
- };
- FixedText FT_SAVE_DESCR
- {
- Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW2 );
- Size = MAP_APPFONT( SAVE_CONTROLWIDTH, (SAVE_ROW3-SAVE_ROW2-RSC_SP_CTRL_DESC_Y) );
- WordBreak = TRUE;
- Text[ en-US ] = "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.";
- };
- FixedText FT_SAVE_FILELIST
- {
- Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW3 );
- Size = MAP_APPFONT( SAVE_CONTROLWIDTH, RSC_CD_FIXEDTEXT_HEIGHT );
- Text[ en-US ] = "The following files will be recovered:";
- };
- ListBox LB_SAVE_FILELIST
- {
- HelpID = "svx:ListBox:RID_SVXPAGE_DOCRECOVERY_SAVE:LB_SAVE_FILELIST";
- Pos = MAP_APPFONT( SAVE_COL0 , SAVE_ROW4 );
- Size = MAP_APPFONT( SAVE_CONTROLWIDTH, SAVE_FILELISTHEIGHT );
- Border = TRUE;
- TabStop = TRUE;
- };
- FixedLine FL_SAVE_BOTTOM
- {
- Pos = MAP_APPFONT( 0 , SAVE_ROW7 );
- Size = MAP_APPFONT( SAVE_WIDTH, RSC_CD_FIXEDLINE_HEIGHT );
- };
- OKButton BT_SAVE_OK
- {
- Pos = MAP_APPFONT( SAVE_COL1 , SAVE_ROW8 );
- Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
- DefButton = TRUE;
- };
-};
-
ModalDialog RID_SVX_MDLG_DOCRECOVERY_PROGR
{
Size = MAP_APPFONT( SAVEPROGR_WIDTH, SAVEPROGR_HEIGHT );
diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx
index 15443e3..523e749 100644
--- a/svx/source/inc/docrecovery.hxx
+++ b/svx/source/inc/docrecovery.hxx
@@ -428,28 +428,17 @@ class TabDialog4Recovery : public TabDialog
};
-class SaveDialog : public IExtendedTabPage
+class SaveDialog : public Dialog
{
-
// member
private:
-
- FixedText m_aTitleFT;
- Window m_aTitleWin;
- FixedLine m_aTitleFL;
- FixedText m_aDescrFT;
- FixedText m_aFileListFT;
- ListBox m_aFileListLB;
- FixedLine m_aBottomFL;
- OKButton m_aOkBtn;
-
+ FixedText* m_pTitleFT;
+ ListBox* m_pFileListLB;
+ OKButton* m_pOkBtn;
RecoveryCore* m_pCore;
-
// interface
public:
-
-
/** @short create all child controls of this dialog.
@descr The dialog isn't shown nor it starts any
@@ -465,25 +454,11 @@ class SaveDialog : public IExtendedTabPage
and the current list of open documents,
which should be shown inside this dialog.
*/
- SaveDialog(Window* pParent,
- RecoveryCore* pCore );
-
-
- /** @short free all controls and used memory. */
- virtual ~SaveDialog();
-
-
- /** @short TODO*/
- virtual short execute() SAL_OVERRIDE;
-
-
- /** @short TODO*/
- virtual void setDefButton() SAL_OVERRIDE;
+ SaveDialog(Window* pParent, RecoveryCore* pCore);
DECL_LINK(OKButtonHdl, void*);
};
-
class SaveProgressDialog : public ModalDialog
, public IRecoveryUpdateListener
{
diff --git a/svx/source/unodraw/recoveryui.cxx b/svx/source/unodraw/recoveryui.cxx
index 1855098..445f04c 100644
--- a/svx/source/unodraw/recoveryui.cxx
+++ b/svx/source/unodraw/recoveryui.cxx
@@ -274,29 +274,21 @@ RecoveryUI::EJob RecoveryUI::impl_classifyJob(const css::util::URL& aURL)
return m_eJob;
}
-
bool RecoveryUI::impl_doEmergencySave()
{
// create core service, which implements the real "emergency save" algorithm.
svxdr::RecoveryCore* pCore = new svxdr::RecoveryCore(m_xContext, true);
css::uno::Reference< css::frame::XStatusListener > xCore(pCore);
- // create all needed dialogs for this operation
- // and bind it to the used core service
- svxdr::TabDialog4Recovery* pWizard = new svxdr::TabDialog4Recovery(m_pParentWindow);
- svxdr::IExtendedTabPage* pPage1 = new svxdr::SaveDialog (pWizard, pCore );
- pWizard->addTabPage(pPage1);
-
- // start the wizard
- short nRet = pWizard->Execute();
-
- delete pPage1 ;
- delete pWizard;
+ // create dialog for this operation and bind it to the used core service
+ Dialog* pDialog = new svxdr::SaveDialog(m_pParentWindow, pCore);
+ // start the dialog
+ short nRet = pDialog->Execute();
+ delete pDialog;
return (nRet==DLG_RET_OK_AUTOLUNCH);
}
-
void RecoveryUI::impl_doRecovery()
{
// create core service, which implements the real "emergency save" algorithm.
diff --git a/svx/uiconfig/ui/docrecoverysavedialog.ui b/svx/uiconfig/ui/docrecoverysavedialog.ui
new file mode 100644
index 0000000..599957d
--- /dev/null
+++ b/svx/uiconfig/ui/docrecoverysavedialog.ui
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
+<interface>
+ <requires lib="gtk+" version="3.0"/>
+ <object class="GtkDialog" id="DocRecoverySaveDialog">
+ <property name="can_focus">False</property>
+ <property name="border_width">6</property>
+ <property name="title" translatable="yes">%PRODUCTNAME %PRODUCTVERSION</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="ok">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="has_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="bgrid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">12</property>
+ <child>
+ <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">24</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">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="max_width_chars">87</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid2">
+ <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">6</property>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">The following files will be recovered:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">filelist:border</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTreeView" 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"/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="title">
+ <property name="name">12</property>
+ <property name="height_request">-1</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">%PRODUCTNAME Document Recovery</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">ok</action-widget>
+ </action-widgets>
+ </object>
+</interface>
More information about the Libreoffice-commits
mailing list