From 19a2685ec04bd6ce882d4dd08d24c7248cf99a84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Tue, 4 Jun 2013 16:13:06 +0100 Subject: [PATCH] clip message box dialogs to some reasonable widths Change-Id: I7fc179865306ba5b593b090b1fdb8971ba6bd508 --- include/vcl/vclmedit.hxx | 2 ++ vcl/source/edit/vclmedit.cxx | 12 ++++++++++++ vcl/source/window/layout.cxx | 2 ++ 3 files changed, 16 insertions(+) diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx index 5b64bbbed4f7..a9ba11693704 100644 --- a/include/vcl/vclmedit.hxx +++ b/include/vcl/vclmedit.hxx @@ -81,6 +81,8 @@ public: virtual void SetMaxTextLen( xub_StrLen nMaxLen = 0 ); virtual xub_StrLen GetMaxTextLen() const; + void SetMaxTextWidth( sal_uLong nMaxWidth ); + virtual void SetSelection( const Selection& rSelection ); virtual const Selection& GetSelection() const; diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx index 9a2b03c54722..d1717d5ec0df 100644 --- a/vcl/source/edit/vclmedit.cxx +++ b/vcl/source/edit/vclmedit.cxx @@ -115,6 +115,8 @@ public: void SetMaxTextLen( xub_StrLen nLen ); xub_StrLen GetMaxTextLen() const; + void SetMaxTextWidth( sal_uLong nMaxWidth ); + sal_Bool IsInsertMode() const; void InsertText( const String& rStr ); @@ -400,6 +402,11 @@ String ImpVclMEdit::GetSelected( LineEnd aSeparator ) const return mpTextWindow->GetTextView()->GetSelected( aSeparator ); } +void ImpVclMEdit::SetMaxTextWidth( sal_uLong nMaxWidth ) +{ + mpTextWindow->GetTextEngine()->SetMaxTextWidth( nMaxWidth ); +} + void ImpVclMEdit::Resize() { size_t nIteration = 1; @@ -1113,6 +1120,11 @@ void VclMultiLineEdit::SetMaxTextLen( xub_StrLen nMaxLen ) pImpVclMEdit->SetMaxTextLen( nMaxLen ); } +void VclMultiLineEdit::SetMaxTextWidth( sal_uLong nMaxWidth ) +{ + pImpVclMEdit->SetMaxTextWidth(nMaxWidth ); +} + xub_StrLen VclMultiLineEdit::GetMaxTextLen() const { return pImpVclMEdit->GetMaxTextLen(); diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index dfd1098c2d2f..78d7e820ff2c 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1803,6 +1803,7 @@ short MessageDialog::Execute() m_pPrimaryMessage->set_hexpand(true); m_pPrimaryMessage->SetText(m_sPrimaryString); m_pPrimaryMessage->Show(!m_sPrimaryString.isEmpty()); + m_pPrimaryMessage->SetMaxTextWidth(m_pPrimaryMessage->approximate_char_width() * 60); m_pSecondaryMessage = new VclMultiLineEdit(m_pGrid, nWinStyle); m_pSecondaryMessage->SetPaintTransparent(true); @@ -1812,6 +1813,7 @@ short MessageDialog::Execute() m_pSecondaryMessage->set_hexpand(true); m_pSecondaryMessage->SetText(m_sSecondaryString); m_pSecondaryMessage->Show(!m_sSecondaryString.isEmpty()); + m_pSecondaryMessage->SetMaxTextWidth(m_pPrimaryMessage->approximate_char_width() * 80); VclButtonBox *pButtonBox = get_action_area(); assert(pButtonBox);