summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndras Timar <atimar@suse.com>2012-03-09 22:34:08 +0100
committerTor Lillqvist <tlillqvist@suse.com>2012-03-19 08:55:28 +0200
commit0449662bb3f493730ea977a1864afbc82ee16d12 (patch)
tree081d1718506b260e961a27517522d23207917483
parent4d3eaff534a7c97dc4d296f6b3cea4578db24182 (diff)
fix semantic error in layout calculation
(cherry picked from commit cc32ce47cef1a72a820a9475a9a2753490a019f2) Signed-off-by: Tor Lillqvist <tlillqvist@suse.com>
-rw-r--r--sfx2/source/dialog/alienwarn.cxx41
1 files changed, 12 insertions, 29 deletions
diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx
index 8ed0b716f302..1dfecd0fe96c 100644
--- a/sfx2/source/dialog/alienwarn.cxx
+++ b/sfx2/source/dialog/alienwarn.cxx
@@ -96,49 +96,32 @@ SfxAlienWarningDialog::~SfxAlienWarningDialog()
void SfxAlienWarningDialog::InitSize()
{
- // if the button text is too wide, then broaden the button
- long nTxtW = m_aMoreInfoBtn.GetCtrlTextWidth( m_aMoreInfoBtn.GetText() );
- long nCtrlW = m_aMoreInfoBtn.GetSizePixel().Width();
- if ( nTxtW >= nCtrlW )
- {
- long nDelta = nTxtW - nCtrlW;
- nDelta += IMPL_EXTRA_BUTTON_WIDTH;
- Point aNextPoint = m_aKeepCurrentBtn.GetPosPixel();
- aNextPoint.X() += m_aKeepCurrentBtn.GetSizePixel().Width();
- Point aNewPoint = m_aMoreInfoBtn.GetPosPixel();
- aNewPoint.X() -= nDelta;
- if ( aNextPoint.X() >= aNewPoint.X() )
- {
- long nSpace = aNextPoint.X() - aNewPoint.X();
- nSpace += 2;
- nDelta -= nSpace;
- aNewPoint.X() += nSpace;
- }
- Size aNewSize = m_aMoreInfoBtn.GetSizePixel();
- aNewSize.Width() += nDelta;
- m_aMoreInfoBtn.SetPosSizePixel( aNewPoint, aNewSize );
- }
+ const long nExtraButtonWidth = LogicToPixel( Size(IMPL_EXTRA_BUTTON_WIDTH,1), MapMode(MAP_APPFONT) ).getWidth();
+ const long nAwCol2 = LogicToPixel( Size(AW_COL_2,1), MapMode(MAP_APPFONT) ).getWidth();
+ long nTxtW, nCtrlW;
- // recalculate the size and position of the buttons
+ // layout calculations should be re-done, when More Info button is enabled
m_aMoreInfoBtn.Hide();
+
+ // recalculate the size and position of the buttons
nTxtW = m_aKeepCurrentBtn.GetCtrlTextWidth( m_aKeepCurrentBtn.GetText() );
- nTxtW += IMPL_EXTRA_BUTTON_WIDTH;
+ nTxtW += nExtraButtonWidth;
Size aNewSize = m_aKeepCurrentBtn.GetSizePixel();
aNewSize.Width() = nTxtW;
m_aKeepCurrentBtn.SetSizePixel( aNewSize );
Point aPos = m_aSaveODFBtn.GetPosPixel();
- aPos.X() = AW_COL_3 + nTxtW;
+ aPos.X() = nAwCol2 + nTxtW + nExtraButtonWidth;
m_aSaveODFBtn.SetPosPixel( aPos );
nTxtW = m_aSaveODFBtn.GetCtrlTextWidth( m_aSaveODFBtn.GetText() );
- nTxtW += IMPL_EXTRA_BUTTON_WIDTH;
+ nTxtW += nExtraButtonWidth;
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;
+ long nBtnsWidthSize = m_aKeepCurrentBtn.GetSizePixel().Width() + m_aSaveODFBtn.GetSizePixel().Width() + nAwCol2 + 2*nExtraButtonWidth;
// resize + text of checkbox too wide -> add new line
aNewSize = m_aWarningOnBox.GetSizePixel();
- aNewSize.Width() = nBtnsWidthSize - 4*IMPL_EXTRA_BUTTON_WIDTH;
+ aNewSize.Width() = nBtnsWidthSize - 2*nExtraButtonWidth;
m_aWarningOnBox.SetSizePixel( aNewSize );
nTxtW = m_aWarningOnBox.GetCtrlTextWidth( m_aWarningOnBox.GetText() );
nCtrlW = m_aWarningOnBox.GetSizePixel().Width();
@@ -154,7 +137,7 @@ void SfxAlienWarningDialog::InitSize()
// 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;
+ aNewSize.Width() = nBtnsWidthSize - 2*nExtraButtonWidth;
m_aInfoText.SetSizePixel( aNewSize );
Size aMinSize = m_aInfoText.CalcMinimumSize( m_aInfoText.GetSizePixel().Width() );
long nTxtH = aMinSize.Height();