From 137e4bd885a913cb201d92dfc7815b2821986d49 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 9 Jul 2013 17:11:15 +0100 Subject: convert version comment dialog to .ui format Change-Id: I7bbcc19062883932bf2e2fd68928f3f5624c4748 --- sfx2/UIConfig_sfx.mk | 3 +- sfx2/source/dialog/dialog.hrc | 2 +- sfx2/source/dialog/versdlg.cxx | 70 ++++++-------- sfx2/source/dialog/versdlg.src | 60 ------------ sfx2/source/inc/versdlg.hxx | 22 ++--- sfx2/uiconfig/ui/versioncommentdialog.ui | 160 +++++++++++++++++++++++++++++++ 6 files changed, 204 insertions(+), 113 deletions(-) create mode 100644 sfx2/uiconfig/ui/versioncommentdialog.ui (limited to 'sfx2') diff --git a/sfx2/UIConfig_sfx.mk b/sfx2/UIConfig_sfx.mk index 2adb858dc84c..b865a7161d59 100644 --- a/sfx2/UIConfig_sfx.mk +++ b/sfx2/UIConfig_sfx.mk @@ -13,6 +13,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\ sfx2/uiconfig/ui/checkin \ sfx2/uiconfig/ui/custominfopage \ sfx2/uiconfig/ui/descriptioninfopage \ + sfx2/uiconfig/ui/documentfontspage \ sfx2/uiconfig/ui/documentinfopage \ sfx2/uiconfig/ui/documentpropertiesdialog \ sfx2/uiconfig/ui/licensedialog \ @@ -23,7 +24,7 @@ $(eval $(call gb_UIConfig_add_uifiles,sfx,\ sfx2/uiconfig/ui/querysavedialog \ sfx2/uiconfig/ui/securityinfopage \ sfx2/uiconfig/ui/singletabdialog \ - sfx2/uiconfig/ui/documentfontspage \ + sfx2/uiconfig/ui/versioncommentdialog \ )) # vim: set noet sw=4 ts=4: diff --git a/sfx2/source/dialog/dialog.hrc b/sfx2/source/dialog/dialog.hrc index a0158afe6606..51c85a4a3bb5 100644 --- a/sfx2/source/dialog/dialog.hrc +++ b/sfx2/source/dialog/dialog.hrc @@ -48,7 +48,7 @@ #define MN_CONTEXT_TEMPLDLG ( RC_DIALOG_BEGIN + 46) #define DLG_VERSIONS ( RC_DIALOG_BEGIN + 69 ) -#define DLG_COMMENTS ( RC_DIALOG_BEGIN + 70 ) + #define STR_VIEWVERSIONCOMMENT ( RC_DIALOG_BEGIN + 71 ) #define MSG_ERROR_WRONG_CONFIRM ( RC_DIALOG_BEGIN + 76 ) diff --git a/sfx2/source/dialog/versdlg.cxx b/sfx2/source/dialog/versdlg.cxx index 41ade0fe68d1..d4976c4a2186 100644 --- a/sfx2/source/dialog/versdlg.cxx +++ b/sfx2/source/dialog/versdlg.cxx @@ -375,7 +375,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton ) { SfxVersionInfo aInfo; aInfo.aAuthor = SvtUserOptions().GetFullName(); - SfxViewVersionDialog_Impl* pDlg = new SfxViewVersionDialog_Impl( this, aInfo, sal_True ); + SfxViewVersionDialog_Impl* pDlg = new SfxViewVersionDialog_Impl(this, aInfo, true); short nRet = pDlg->Execute(); if ( nRet == RET_OK ) { @@ -409,7 +409,7 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton ) else if ( pButton == &aViewButton && pEntry ) { SfxVersionInfo* pInfo = (SfxVersionInfo*) pEntry->GetUserData(); - SfxViewVersionDialog_Impl* pDlg = new SfxViewVersionDialog_Impl( this, *pInfo, sal_False ); + SfxViewVersionDialog_Impl* pDlg = new SfxViewVersionDialog_Impl(this, *pInfo, false); pDlg->Execute(); delete pDlg; } @@ -435,54 +435,46 @@ IMPL_LINK( SfxVersionDialog, ButtonHdl_Impl, Button*, pButton ) return 0L; } -SfxViewVersionDialog_Impl::SfxViewVersionDialog_Impl ( Window *pParent, SfxVersionInfo& rInfo, sal_Bool bEdit ) - : SfxModalDialog( pParent, SfxResId( DLG_COMMENTS ) ) - , aDateTimeText( this, SfxResId( FT_DATETIME ) ) - , aSavedByText( this, SfxResId( FT_SAVEDBY ) ) - , aEdit( this, SfxResId( ME_VERSIONS ) ) - , aOKButton( this, SfxResId( PB_OK ) ) - , aCancelButton( this, SfxResId( PB_CANCEL ) ) - , aCloseButton( this, SfxResId( PB_CLOSE ) ) - , aHelpButton( this, SfxResId( PB_HELP ) ) - , pInfo( &rInfo ) +SfxViewVersionDialog_Impl::SfxViewVersionDialog_Impl(Window *pParent, SfxVersionInfo& rInfo, bool bEdit) + : SfxModalDialog(pParent, "VersionCommentDialog", "sfx/ui/versioncommentdialog.ui") + , m_rInfo(rInfo) { - FreeResource(); + get(m_pDateTimeText, "timestamp"); + get(m_pSavedByText, "author"); + get(m_pEdit, "textview"); + get(m_pOKButton, "ok"); + get(m_pCancelButton, "cancel"); + get(m_pCloseButton, "close"); const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() ); - aDateTimeText.SetText( aDateTimeText.GetText() + ConvertDateTime_Impl( pInfo->aCreationDate, rLocaleWrapper ) ); - aSavedByText.SetText( aSavedByText.GetText() + pInfo->aAuthor ); - aEdit.SetText( rInfo.aComment ); - - aCloseButton.SetClickHdl ( LINK( this, SfxViewVersionDialog_Impl, ButtonHdl ) ); - aOKButton.SetClickHdl ( LINK( this, SfxViewVersionDialog_Impl, ButtonHdl ) ); - - aEdit.GrabFocus(); - if ( !bEdit ) + m_pDateTimeText->SetText(m_pDateTimeText->GetText() + ConvertDateTime_Impl(rInfo.aCreationDate, rLocaleWrapper)); + m_pSavedByText->SetText(m_pSavedByText->GetText() + rInfo.aAuthor); + m_pEdit->SetText(rInfo.aComment); + m_pEdit->set_height_request(7 * m_pEdit->GetTextHeight()); + m_pEdit->set_width_request(40 * m_pEdit->approximate_char_width()); + m_pOKButton->SetClickHdl(LINK(this, SfxViewVersionDialog_Impl, ButtonHdl)); + + if (!bEdit) { - aOKButton.Hide(); - aCancelButton.Hide(); - aEdit.SetReadOnly( sal_True ); - SetText( SfxResId( STR_VIEWVERSIONCOMMENT ) ); + m_pOKButton->Hide(); + m_pCancelButton->Hide(); + m_pEdit->SetReadOnly(true); + SetText(SfxResId(STR_VIEWVERSIONCOMMENT)); + m_pCloseButton->GrabFocus(); } else { - aDateTimeText.Hide(); - aCloseButton.Hide(); + m_pDateTimeText->Hide(); + m_pCloseButton->Hide(); + m_pEdit->GrabFocus(); } } -IMPL_LINK( SfxViewVersionDialog_Impl, ButtonHdl, Button*, pButton ) +IMPL_LINK(SfxViewVersionDialog_Impl, ButtonHdl, Button*, pButton) { - if ( pButton == &aCloseButton ) - { - EndDialog( RET_CANCEL ); - } - else if ( pButton == &aOKButton ) - { - pInfo->aComment = aEdit.GetText(); - EndDialog( RET_OK ); - } - + assert(pButton == m_pOKButton); + m_rInfo.aComment = m_pEdit->GetText(); + EndDialog(RET_OK); return 0L; } diff --git a/sfx2/source/dialog/versdlg.src b/sfx2/source/dialog/versdlg.src index 8dbab6fee5ef..5b02a4b90a9b 100644 --- a/sfx2/source/dialog/versdlg.src +++ b/sfx2/source/dialog/versdlg.src @@ -126,66 +126,6 @@ ModalDialog DLG_VERSIONS }; Text [ en-US ] = "Versions of" ; }; -ModalDialog DLG_COMMENTS -{ - HelpID = "sfx2:ModalDialog:DLG_COMMENTS"; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 180 , 118 ) ; - SvLook = TRUE ; - Moveable = TRUE ; - FixedText FT_DATETIME - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 168 , 10 ) ; - Text [ en-US ] = "Date and time: " ; - }; - FixedText FT_SAVEDBY - { - Pos = MAP_APPFONT ( 6 , 19 ) ; - Size = MAP_APPFONT ( 168 , 10 ) ; - Text [ en-US ] = "Saved by " ; - }; - MultiLineEdit ME_VERSIONS - { - HelpID = "sfx2:MultiLineEdit:DLG_COMMENTS:ME_VERSIONS"; - Border = TRUE ; - Pos = MAP_APPFONT ( 6 , 32 ) ; - Size = MAP_APPFONT ( 168 , 60 ) ; - TabStop = TRUE ; - }; - OKButton PB_OK - { - Pos = MAP_APPFONT ( 15 , 98 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - DefButton = TRUE ; - }; - CancelButton PB_CANCEL - { - Pos = MAP_APPFONT ( 68 , 98 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - PushButton PB_CLOSE - { - HelpID = "sfx2:PushButton:DLG_COMMENTS:PB_CLOSE"; - Pos = MAP_APPFONT ( 68 , 98 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - Text [ en-US ] = "~Close" ; - }; - HelpButton PB_HELP - { - Pos = MAP_APPFONT ( 124 , 98 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - TabStop = TRUE ; - }; - Text [ en-US ] = "Insert Version Comment" ; -}; -String DLG_COMMENTS -{ - Text [ en-US ] = "Version comment" ; -}; String STR_VIEWVERSIONCOMMENT { Text [ en-US ] = "View Version Comment" ; diff --git a/sfx2/source/inc/versdlg.hxx b/sfx2/source/inc/versdlg.hxx index a81e8eab6207..1853a3d864ed 100644 --- a/sfx2/source/inc/versdlg.hxx +++ b/sfx2/source/inc/versdlg.hxx @@ -74,21 +74,19 @@ public: class SfxViewVersionDialog_Impl : public SfxModalDialog { - FixedText aDateTimeText; - FixedText aSavedByText; - MultiLineEdit aEdit; - OKButton aOKButton; - CancelButton aCancelButton; - PushButton aCloseButton; - HelpButton aHelpButton; - SfxVersionInfo* pInfo; + FixedText* m_pDateTimeText; + FixedText* m_pSavedByText; + VclMultiLineEdit* m_pEdit; + OKButton* m_pOKButton; + CancelButton* m_pCancelButton; + CloseButton* m_pCloseButton; + SfxVersionInfo& m_rInfo; - DECL_LINK( ButtonHdl, Button* ); + DECL_LINK(ButtonHdl, Button*); public: - SfxViewVersionDialog_Impl( Window *pParent, - SfxVersionInfo& rInfo, sal_Bool bEdit ); - }; + SfxViewVersionDialog_Impl(Window *pParent, SfxVersionInfo& rInfo, bool bEdit); +}; #endif diff --git a/sfx2/uiconfig/ui/versioncommentdialog.ui b/sfx2/uiconfig/ui/versioncommentdialog.ui new file mode 100644 index 000000000000..09671487ae8f --- /dev/null +++ b/sfx2/uiconfig/ui/versioncommentdialog.ui @@ -0,0 +1,160 @@ + + + + + False + 6 + Insert Version Comment + dialog + + + False + vertical + 12 + + + False + end + + + gtk-ok + True + True + True + True + True + True + + + False + True + 0 + + + + + gtk-close + True + True + True + True + True + True + + + False + True + 1 + + + + + gtk-cancel + True + True + True + True + + + False + True + 2 + + + + + gtk-help + True + True + True + True + + + False + True + 3 + + + + + False + True + end + 0 + + + + + True + False + True + True + 12 + + + True + False + 0 + Date and time: + + + 0 + 0 + 1 + 1 + + + + + True + False + 0 + Saved by: + + + 0 + 1 + 1 + 1 + + + + + True + True + True + True + in + + + True + True + True + True + + + + + 0 + 2 + 1 + 1 + + + + + False + True + 1 + + + + + + ok + close + cancel + help + + + -- cgit