diff options
Diffstat (limited to 'svtools/source/control/ctrlbox.cxx')
-rw-r--r-- | svtools/source/control/ctrlbox.cxx | 71 |
1 files changed, 45 insertions, 26 deletions
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index c9d035f1cfa7..8e397e4de9cc 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -118,8 +118,18 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeColorListBox(vcl::Wind ColorListBox::~ColorListBox() { - ImplDestroyColorEntries(); - delete pColorList; + disposeOnce(); +} + +void ColorListBox::dispose() +{ + if ( pColorList ) + { + ImplDestroyColorEntries(); + delete pColorList; + pColorList = NULL; + } + ListBox::dispose(); } sal_Int32 ColorListBox::InsertEntry( const OUString& rStr, sal_Int32 nPos ) @@ -660,8 +670,8 @@ void LineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance, } // Linien malen - aSize = aVirDev.PixelToLogic( aSize ); - long nPix = aVirDev.PixelToLogic( Size( 0, 1 ) ).Height(); + aSize = aVirDev->PixelToLogic( aSize ); + long nPix = aVirDev->PixelToLogic( Size( 0, 1 ) ).Height(); sal_uInt32 n1 = nLine1; sal_uInt32 n2 = nLine2; long nDist = nDistance; @@ -680,24 +690,24 @@ void LineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance, // negative width should not be drawn if ( aSize.Width() > 0 ) { - Size aVirSize = aVirDev.LogicToPixel( aSize ); - if ( aVirDev.GetOutputSizePixel() != aVirSize ) - aVirDev.SetOutputSizePixel( aVirSize ); - aVirDev.SetFillColor( aColorDist ); - aVirDev.DrawRect( Rectangle( Point(), aSize ) ); + Size aVirSize = aVirDev->LogicToPixel( aSize ); + if ( aVirDev->GetOutputSizePixel() != aVirSize ) + aVirDev->SetOutputSizePixel( aVirSize ); + aVirDev->SetFillColor( aColorDist ); + aVirDev->DrawRect( Rectangle( Point(), aSize ) ); - aVirDev.SetFillColor( aColor1 ); + aVirDev->SetFillColor( aColor1 ); double y1 = double( n1 ) / 2; - svtools::DrawLine( aVirDev, basegfx::B2DPoint( 0, y1 ), basegfx::B2DPoint( aSize.Width( ), y1 ), n1, nStyle ); + svtools::DrawLine( *aVirDev.get(), basegfx::B2DPoint( 0, y1 ), basegfx::B2DPoint( aSize.Width( ), y1 ), n1, nStyle ); if ( n2 ) { double y2 = n1 + nDist + double( n2 ) / 2; - aVirDev.SetFillColor( aColor2 ); - svtools::DrawLine( aVirDev, basegfx::B2DPoint( 0, y2 ), basegfx::B2DPoint( aSize.Width(), y2 ), n2, table::BorderLineStyle::SOLID ); + aVirDev->SetFillColor( aColor2 ); + svtools::DrawLine( *aVirDev.get(), basegfx::B2DPoint( 0, y2 ), basegfx::B2DPoint( aSize.Width(), y2 ), n2, table::BorderLineStyle::SOLID ); } - rBmp = aVirDev.GetBitmap( Point(), Size( aSize.Width(), n1+nDist+n2 ) ); + rBmp = aVirDev->GetBitmap( Point(), Size( aSize.Width(), n1+nDist+n2 ) ); } } @@ -709,8 +719,8 @@ void LineListBox::ImplInit() eUnit = FUNIT_POINT; eSourceUnit = FUNIT_POINT; - aVirDev.SetLineColor(); - aVirDev.SetMapMode( MapMode( MAP_TWIP ) ); + aVirDev->SetLineColor(); + aVirDev->SetMapMode( MapMode( MAP_TWIP ) ); UpdatePaintLineColor(); } @@ -719,6 +729,7 @@ LineListBox::LineListBox( vcl::Window* pParent, WinBits nWinStyle ) : ListBox( pParent, nWinStyle ), m_nWidth( 5 ), m_sNone( ), + aVirDev( new VirtualDevice ), aColor( COL_BLACK ), maPaintCol( COL_BLACK ) { @@ -739,6 +750,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLineListBox(vcl::Windo LineListBox::~LineListBox() { + disposeOnce(); +} + +void LineListBox::dispose() +{ for ( size_t i = 0, n = pLineList->size(); i < n; ++i ) { if ( (*pLineList)[ i ] ) { delete (*pLineList)[ i ]; @@ -746,6 +762,7 @@ LineListBox::~LineListBox() } pLineList->clear(); delete pLineList; + ListBox::dispose(); } sal_Int32 LineListBox::GetStylePos( sal_Int32 nListPos, long nWidth ) @@ -936,8 +953,17 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFontNameBox(vcl::Windo FontNameBox::~FontNameBox() { - SaveMRUEntries (maFontMRUEntriesFile); - ImplDestroyFontList(); + disposeOnce(); +} + +void FontNameBox::dispose() +{ + if (mpFontList) + { + SaveMRUEntries (maFontMRUEntriesFile); + ImplDestroyFontList(); + } + ComboBox::dispose(); } void FontNameBox::SaveMRUEntries( const OUString& aFontMRUEntriesFile, sal_Unicode cSep ) const @@ -999,6 +1025,7 @@ void FontNameBox::InitFontMRUEntriesFile() void FontNameBox::ImplDestroyFontList() { delete mpFontList; + mpFontList = NULL; } void FontNameBox::Fill( const FontList* pList ) @@ -1312,10 +1339,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFontStyleBox(vcl::Wind return pListBox; } -FontStyleBox::~FontStyleBox() -{ -} - void FontStyleBox::Select() { // keep text over fill operation @@ -1512,10 +1535,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFontSizeBox(vcl::Windo return pListBox; } -FontSizeBox::~FontSizeBox() -{ -} - void FontSizeBox::ImplInit() { EnableAutocomplete( false ); |