summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2010-09-30 16:28:25 +0100
committerCaolán McNamara <caolanm@redhat.com>2010-09-30 16:28:25 +0100
commit3d55593cdf7df0e429947a71d8663347613a5626 (patch)
treeccc2154a7e7d201d0b885ed5b7fb41d8b3c06c87
parentab1d54371ada41e122ccba03f6dc7c0982a3e4ac (diff)
#i108246# fix crash in Appearance config dialog
-rw-r--r--cui/source/options/optcolor.cxx38
1 files changed, 26 insertions, 12 deletions
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index 90befc998e01..8be166e8ad53 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -249,6 +249,9 @@ class ColorConfigWindow_Impl : public Window
virtual void Command( const CommandEvent& rCEvt );
virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ // calculate position behind last chapter
+ sal_Int32 impl_getPosBehindLastChapter() const;
+
public:
ColorConfigWindow_Impl(Window* pParent, const ResId& rResId);
~ColorConfigWindow_Impl();
@@ -386,7 +389,7 @@ sal_Int16 lcl_getGroup( sal_Int32 _nFeature )
/* -----------------------------25.03.2002 17:05------------------------------
- ---------------------------------------------------------------------------*/
+---------------------------------------------------------------------------*/
ColorConfigWindow_Impl::ColorConfigWindow_Impl(Window* pParent, const ResId& rResId) :
Window(pParent, rResId),
aGeneralBackWN(this),
@@ -697,14 +700,14 @@ ColorConfigWindow_Impl::ColorConfigWindow_Impl(Window* pParent, const ResId& rRe
aChapters[GROUP_CALC ]->SetGroupHeight( aChapters[GROUP_DRAW]->GetPosPixel().Y() - aChapters[GROUP_CALC]->GetPosPixel().Y() );
aChapters[GROUP_DRAW ]->SetGroupHeight( aChapters[GROUP_BASIC]->GetPosPixel().Y() - aChapters[GROUP_DRAW]->GetPosPixel().Y() );
aChapters[GROUP_BASIC ]->SetGroupHeight( aChapters[GROUP_SQL]->GetPosPixel().Y() - aChapters[GROUP_BASIC]->GetPosPixel().Y() );
+ aChapters[GROUP_SQL]->SetGroupHeight(impl_getPosBehindLastChapter()
+ - aChapters[GROUP_SQL]->GetPosPixel().Y());
ExtendedColorConfig aExtConfig;
sal_Int32 nExtCount = aExtConfig.GetComponentCount();
if ( nExtCount )
{
- // calculate position behind last chapter
- sal_Int32 nLastY = aSQLCommentWN.GetPosPixel().Y() + aSQLCommentWN.GetSizePixel().Height();
- nLastY = nLastY + LogicToPixel( Size( 0, 3 ), MAP_APPFONT ).Height();
+ const sal_Int32 nLastY(impl_getPosBehindLastChapter());
// to calculate the number of lines
sal_Int32 nHeight = LogicToPixel( Size( 0, _LINE_HEIGHT ), MAP_APPFONT ).Height();
sal_Int32 nLineNum = nLastY / nHeight;
@@ -886,6 +889,15 @@ ColorConfigWindow_Impl::~ColorConfigWindow_Impl()
aChapterWins.clear();
::std::vector< Window*>().swap(aChapterWins);
}
+
+sal_Int32
+ColorConfigWindow_Impl::impl_getPosBehindLastChapter() const
+{
+ sal_Int32 nLastY = aSQLCommentWN.GetPosPixel().Y() + aSQLCommentWN.GetSizePixel().Height();
+ nLastY = nLastY + LogicToPixel( Size( 0, 3 ), MAP_APPFONT ).Height();
+ return nLastY;
+}
+
/* -----------------------------2002/06/20 12:48------------------------------
---------------------------------------------------------------------------*/
@@ -1163,9 +1175,9 @@ void ColorConfigCtrl_Impl::Update()
/* -----------------------------26.03.2002 12:55------------------------------
---------------------------------------------------------------------------*/
-sal_Bool lcl_MoveAndShow(Window* pWindow, long nOffset, long nMaxVisible, bool _bShow)
+sal_Bool lcl_MoveAndShow(Window* pWindow, long nOffset, long nMaxVisible, sal_Bool _bShow)
{
- BOOL bHide = TRUE;
+ sal_Bool bHide = TRUE;
if(pWindow)
{
Point aPos = pWindow->GetPosPixel();
@@ -1194,12 +1206,14 @@ IMPL_LINK(ColorConfigCtrl_Impl, ScrollHdl, ScrollBar*, pScrollBar)
continue;
Point aPos;
//controls outside of the view need to be hidden to speed up accessibility tools
- bool bShowCtrl = ( lcl_isGroupVisible(
+ sal_Bool bShowCtrl = ( lcl_isGroupVisible(
lcl_getGroup(i), aScrollWindow.GetModuleOptions() ) != sal_False );
- lcl_MoveAndShow(aScrollWindow.aCheckBoxes[i], nOffset, nWindowHeight, bShowCtrl);
- lcl_MoveAndShow(aScrollWindow.aFixedTexts[i], nOffset, nWindowHeight, bShowCtrl);
- lcl_MoveAndShow(aScrollWindow.aWindows[i] , nOffset, nWindowHeight, bShowCtrl);
- BOOL bShow = lcl_MoveAndShow(aScrollWindow.aColorBoxes[i], nOffset, nWindowHeight, bShowCtrl);
+ // if any of the items on the current line is visible, the
+ // whole line should be visible
+ sal_Bool bShow(lcl_MoveAndShow(aScrollWindow.aCheckBoxes[i], nOffset, nWindowHeight, bShowCtrl));
+ bShow = lcl_MoveAndShow(aScrollWindow.aFixedTexts[i], nOffset, nWindowHeight, bShowCtrl) || bShow;
+ bShow = lcl_MoveAndShow(aScrollWindow.aWindows[i] , nOffset, nWindowHeight, bShowCtrl) || bShow;
+ bShow = lcl_MoveAndShow(aScrollWindow.aColorBoxes[i], nOffset, nWindowHeight, bShowCtrl) || bShow;
if(bShow)
{
if(nFirstVisible == -1)
@@ -1211,7 +1225,7 @@ IMPL_LINK(ColorConfigCtrl_Impl, ScrollHdl, ScrollBar*, pScrollBar)
//show the one prior to the first visible and the first after the last visble control
//to enable KEY_TAB travelling
- if(nFirstVisible)
+ if(nFirstVisible > 0)
{
//skip gaps where no controls exist for the related ColorConfigEntry
do