[Libreoffice-commits] .: Branch 'libreoffice-3-5' - sfx2/source
Andras Timar
timar at kemper.freedesktop.org
Fri Feb 10 06:33:45 PST 2012
sfx2/source/dialog/alienwarn.cxx | 58 ++++++++++++++++++++++-----------------
1 file changed, 33 insertions(+), 25 deletions(-)
New commits:
commit e1fef2029dc2551470f356738ab45c43fd3f9d6c
Author: Tomcsik Bence <tomcsikbence at gmail.com>
Date: Fri Feb 10 13:35:23 2012 +0100
fdo#45330 Improving layout of Confirm File Format dialog
Although fdo#45330 was a duplicate of fdo#45117 which was fixed
earlier, this patch makes the layout look better when the button
text is very long, because it resizes the boundary boxes of fixed
text and ruler, too. I've changed the sequence of
the functions in InitSize() and the size calculations.
Signed-off-by: Andras Timar <atimar at suse.com>
diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx
index 3e99575..8ed0b71 100644
--- a/sfx2/source/dialog/alienwarn.cxx
+++ b/sfx2/source/dialog/alienwarn.cxx
@@ -119,13 +119,32 @@ void SfxAlienWarningDialog::InitSize()
m_aMoreInfoBtn.SetPosSizePixel( aNewPoint, aNewSize );
}
- // text of checkbox to wide -> add new line
- nTxtW = m_aWarningOnBox.GetCtrlTextWidth( m_aWarningOnBox.GetText() ) + IMPL_EXTRA_BUTTON_WIDTH;
+ // recalculate the size and position of the buttons
+ m_aMoreInfoBtn.Hide();
+ nTxtW = m_aKeepCurrentBtn.GetCtrlTextWidth( m_aKeepCurrentBtn.GetText() );
+ nTxtW += IMPL_EXTRA_BUTTON_WIDTH;
+ Size aNewSize = m_aKeepCurrentBtn.GetSizePixel();
+ aNewSize.Width() = nTxtW;
+ m_aKeepCurrentBtn.SetSizePixel( aNewSize );
+ Point aPos = m_aSaveODFBtn.GetPosPixel();
+ aPos.X() = AW_COL_3 + nTxtW;
+ m_aSaveODFBtn.SetPosPixel( aPos );
+ nTxtW = m_aSaveODFBtn.GetCtrlTextWidth( m_aSaveODFBtn.GetText() );
+ nTxtW += IMPL_EXTRA_BUTTON_WIDTH;
+ aNewSize = m_aSaveODFBtn.GetSizePixel();
+ aNewSize.Width() = nTxtW;
+ m_aSaveODFBtn.SetSizePixel( aNewSize );
+ long nBtnsWidthSize = m_aKeepCurrentBtn.GetSizePixel().Width() + m_aSaveODFBtn.GetSizePixel().Width() + AW_COL_3 + IMPL_EXTRA_BUTTON_WIDTH;
+
+ // resize + text of checkbox too wide -> add new line
+ aNewSize = m_aWarningOnBox.GetSizePixel();
+ aNewSize.Width() = nBtnsWidthSize - 4*IMPL_EXTRA_BUTTON_WIDTH;
+ m_aWarningOnBox.SetSizePixel( aNewSize );
+ nTxtW = m_aWarningOnBox.GetCtrlTextWidth( m_aWarningOnBox.GetText() );
nCtrlW = m_aWarningOnBox.GetSizePixel().Width();
if ( nTxtW >= nCtrlW )
{
long nTextHeight = m_aWarningOnBox.GetTextHeight();
- Size aNewSize = m_aWarningOnBox.GetSizePixel();
aNewSize.Height() += nTextHeight;
m_aWarningOnBox.SetSizePixel( aNewSize );
aNewSize = GetSizePixel();
@@ -133,15 +152,18 @@ void SfxAlienWarningDialog::InitSize()
SetSizePixel( aNewSize );
}
- // align the size of the information text control (FixedText) to its content
+ // resize + align the size of the information text control (FixedText) to its content
+ aNewSize = m_aInfoText.GetSizePixel();
+ aNewSize.Width() = nBtnsWidthSize - 4*IMPL_EXTRA_BUTTON_WIDTH;
+ m_aInfoText.SetSizePixel( aNewSize );
Size aMinSize = m_aInfoText.CalcMinimumSize( m_aInfoText.GetSizePixel().Width() );
long nTxtH = aMinSize.Height();
long nCtrlH = m_aInfoText.GetSizePixel().Height();
long nDelta = ( nCtrlH - nTxtH );
- Size aNewSize = m_aInfoText.GetSizePixel();
aNewSize.Height() -= nDelta;
m_aInfoText.SetSizePixel( aNewSize );
+
// new position for the succeeding windows
Window* pWins[] =
{
@@ -155,31 +177,17 @@ void SfxAlienWarningDialog::InitSize()
(*pCurrent)->SetPosPixel( aNewPos );
}
- // recalculate the size and position of the buttons
- m_aMoreInfoBtn.Hide();
- nTxtW = m_aKeepCurrentBtn.GetCtrlTextWidth( m_aKeepCurrentBtn.GetText() );
- nTxtW += IMPL_EXTRA_BUTTON_WIDTH;
- aNewSize = m_aKeepCurrentBtn.GetSizePixel();
- aNewSize.Width() = nTxtW;
- m_aKeepCurrentBtn.SetSizePixel( aNewSize );
- Point aPos = m_aSaveODFBtn.GetPosPixel();
- aPos.X() = AW_COL_3 + nTxtW;
- m_aSaveODFBtn.SetPosPixel( aPos );
- nTxtW = m_aSaveODFBtn.GetCtrlTextWidth( m_aSaveODFBtn.GetText() );
- nTxtW += IMPL_EXTRA_BUTTON_WIDTH;
- aNewSize = m_aSaveODFBtn.GetSizePixel();
- aNewSize.Width() = nTxtW;
- m_aSaveODFBtn.SetSizePixel( aNewSize );
-
// new size of the dialog
aNewSize = GetSizePixel();
aNewSize.Height() -= nDelta;
- if (aPos.X() + nTxtW + IMPL_EXTRA_BUTTON_WIDTH > aNewSize.Width())
- {
- aNewSize.Width() = aPos.X() + nTxtW + IMPL_EXTRA_BUTTON_WIDTH;
- }
+ aNewSize.Width() = nBtnsWidthSize;
SetSizePixel( aNewSize );
+ // resize the FixedLine
+ aNewSize = m_aOptionLine.GetSizePixel();
+ aNewSize.Width() = GetSizePixel().Width();
+ m_aOptionLine.SetSizePixel( aNewSize );
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list