diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2009-09-18 15:39:21 +0000 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2009-09-18 15:39:21 +0000 |
commit | 108632dc97a720639df495de3b5d966ee286be95 (patch) | |
tree | 99de8dfff36b6296f135f3288fa400a884ec081c /sdext/source/presenter/PresenterHelpView.cxx | |
parent | ef43d23e180d94f8a060388460c988d6d4126c6b (diff) |
CWS-TOOLING: integrate CWS impressaccessibility3
2009-09-18 16:10:59 +0200 af r276289 : #i102525# Fixed some minor compilation problems.
2009-09-17 14:11:23 +0200 af r276243 : #i102525# Fixed F1 shortcut for help view.
2009-09-16 16:20:58 +0200 af r276205 : #i102525# Removing const to make Solaris linker happy.
2009-09-16 16:13:25 +0200 af r276204 : #i90690# Initializing variable to avoid compilation problem.
2009-09-15 19:10:04 +0200 af r276186 : #i90825# Replace edit source proxy when an outliner object is set.
2009-09-15 11:12:07 +0200 af r276160 : #i90690# Broadcast accessibility events when the current slide is changed.
2009-09-15 09:37:48 +0200 af r276148 : #i102525# Fixed Solaris compilation problem.
2009-09-14 18:12:40 +0200 af r276142 : #i102525# Added missing implementation for some font related functions.
2009-09-14 18:02:05 +0200 af r276139 : #i102525# Added accessibility support.
2009-09-14 17:30:13 +0200 af r276136 : #i102525# Added support for interface XPane2 to panes.
2009-09-14 17:00:27 +0200 af r276133 : #i102525# Added XPane2 interface.
2009-09-14 16:13:04 +0200 af r276131 : #i50376# Make the focus indicator visible when the slide sorter has the focus.
Diffstat (limited to 'sdext/source/presenter/PresenterHelpView.cxx')
-rw-r--r-- | sdext/source/presenter/PresenterHelpView.cxx | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/sdext/source/presenter/PresenterHelpView.cxx b/sdext/source/presenter/PresenterHelpView.cxx index 9b1137c09954..9b545a0f42bd 100644 --- a/sdext/source/presenter/PresenterHelpView.cxx +++ b/sdext/source/presenter/PresenterHelpView.cxx @@ -190,9 +190,7 @@ PresenterHelpView::PresenterHelpView ( mxCanvas, A2S("HelpViewCloser")); - mnMaximalWidth = (mxWindow->getPosSize().Width - 4*gnHorizontalGap) / 2; ReadHelpStrings(); - CheckFontSize(); Resize(); } catch (RuntimeException&) @@ -434,6 +432,10 @@ void PresenterHelpView::CheckFontSize (void) return; const awt::Rectangle aWindowBox (mxWindow->getPosSize()); + if (aWindowBox.Width<=0 || aWindowBox.Height<=0) + return; + + sal_Int32 nBestSize (6); // Scaling down and then reformatting can cause the text to be too large // still. So do this again and again until the text size is @@ -448,15 +450,25 @@ void PresenterHelpView::CheckFontSize (void) (*iBlock)->maLeft.GetHeight(), (*iBlock)->maRight.GetHeight()); - if (nY <= aWindowBox.Height-gnVerticalBorder) - break; + const double nHeightDifference (nY - (aWindowBox.Height-gnVerticalBorder)); + if (nHeightDifference <= 0 && nHeightDifference > -50) + { + // We have found a good font size that is large and leaves not + // too much space below the help text. + return; + } // Font is too large. Make it smaller. // Use a simple linear transformation to calculate initial guess of // a size that lets all help text be shown inside the window. - const double nScale (::std::min(0.95,double(aWindowBox.Height-gnVerticalBorder) / nY)); + const double nScale (double(aWindowBox.Height-gnVerticalBorder) / nY); + if (nScale > 0.95 && nScale <1.05) + break; + sal_Int32 nFontSizeGuess (::std::max(sal_Int32(1),sal_Int32(mpFont->mnSize * nScale))); + if (nHeightDifference<0 && mpFont->mnSize>nBestSize) + nBestSize = mpFont->mnSize; mpFont->mnSize = nFontSizeGuess; mpFont->mxFont = NULL; mpFont->PrepareFont(mxCanvas); @@ -465,6 +477,23 @@ void PresenterHelpView::CheckFontSize (void) for (iBlock=mpTextContainer->begin(); iBlock!=iBlockEnd; ++iBlock) (*iBlock)->Update(mpFont->mxFont, mnMaximalWidth); } + + if (nBestSize != mpFont->mnSize) + { + mpFont->mnSize = nBestSize; + mpFont->mxFont = NULL; + mpFont->PrepareFont(mxCanvas); + + // Reformat blocks. + for (TextContainer::iterator + iBlock (mpTextContainer->begin()), + iEnd (mpTextContainer->end()); + iBlock!=iEnd; + ++iBlock) + { + (*iBlock)->Update(mpFont->mxFont, mnMaximalWidth); + } + } } @@ -517,6 +546,7 @@ void PresenterHelpView::Resize (void) if (mpCloseButton.get() != NULL && mxWindow.is()) { const awt::Rectangle aWindowBox (mxWindow->getPosSize()); + mnMaximalWidth = (mxWindow->getPosSize().Width - 4*gnHorizontalGap) / 2; // Place vertical separator. mnSeparatorY = aWindowBox.Height @@ -525,6 +555,8 @@ void PresenterHelpView::Resize (void) mpCloseButton->SetCenter(geometry::RealPoint2D( aWindowBox.Width/2, aWindowBox.Height - mpCloseButton->GetSize().Height/2)); + + CheckFontSize(); } } @@ -753,7 +785,9 @@ void LineDescriptorList::FormatText ( } } if ( ! aLineDescriptor.IsEmpty()) + { mpLineDescriptors->push_back(aLineDescriptor); + } } |