diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-07-09 17:11:15 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-07-10 09:50:06 +0100 |
commit | 137e4bd885a913cb201d92dfc7815b2821986d49 (patch) | |
tree | a3a1e007ee2c294dc794f5a7d941936c4fcb7bab /sfx2/source | |
parent | c6de82163e990478aa6448cf5b6537bcca1b80b5 (diff) |
convert version comment dialog to .ui format
Change-Id: I7bbcc19062883932bf2e2fd68928f3f5624c4748
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/dialog/dialog.hrc | 2 | ||||
-rw-r--r-- | sfx2/source/dialog/versdlg.cxx | 70 | ||||
-rw-r--r-- | sfx2/source/dialog/versdlg.src | 60 | ||||
-rw-r--r-- | sfx2/source/inc/versdlg.hxx | 22 |
4 files changed, 42 insertions, 112 deletions
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 |