diff options
Diffstat (limited to 'svx/source/dialog/dlgctrl.cxx')
-rw-r--r-- | svx/source/dialog/dlgctrl.cxx | 194 |
1 files changed, 105 insertions, 89 deletions
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 29d6b9b407f1..72f98cc363cc 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -41,7 +41,6 @@ #include <svx/svdopath.hxx> #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx> #include <svx/sdr/contact/displayinfo.hxx> -#include <linectrl.hrc> #include <vcl/bmpacc.hxx> #include <svx/xbtmpit.hxx> @@ -993,9 +992,9 @@ void HatchingLB::Fill( const XHatchListRef &pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetHatch( i ); - Bitmap* pBitmap = pList->GetBitmap( i ); - if( pBitmap ) - InsertEntry( pEntry->GetName(), *pBitmap ); + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) + InsertEntry( pEntry->GetName(), aBitmap ); else InsertEntry( pEntry->GetName() ); } @@ -1075,9 +1074,9 @@ void FillAttrLB::Fill( const XHatchListRef &pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetHatch( i ); - Bitmap* pBitmap = pList->GetBitmap( i ); - if( pBitmap ) - ListBox::InsertEntry( pEntry->GetName(), *pBitmap ); + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) + ListBox::InsertEntry( pEntry->GetName(), aBitmap ); else InsertEntry( pEntry->GetName() ); } @@ -1134,9 +1133,9 @@ void GradientLB::Fill( const XGradientListRef &pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetGradient( i ); - Bitmap* pBitmap = pList->GetBitmap( i ); - if( pBitmap ) - InsertEntry( pEntry->GetName(), *pBitmap ); + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) + InsertEntry( pEntry->GetName(), aBitmap ); else InsertEntry( pEntry->GetName() ); } @@ -1253,9 +1252,9 @@ void FillAttrLB::Fill( const XGradientListRef &pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetGradient( i ); - Bitmap* pBitmap = pList->GetBitmap( i ); - if( pBitmap ) - ListBox::InsertEntry( pEntry->GetName(), *pBitmap ); + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) + ListBox::InsertEntry( pEntry->GetName(), aBitmap ); else InsertEntry( pEntry->GetName() ); } @@ -1271,28 +1270,32 @@ BitmapLB::BitmapLB(Window* pParent, ResId Id, bool bUserDraw /*= false*/ ) mpList(NULL), mbUserDraw(bUserDraw) { - maVD.SetOutputSizePixel(Size(32, 16)); EnableUserDraw(mbUserDraw); } /************************************************************************/ -void BitmapLB::SetVirtualDevice() +void BitmapLB::SetVirtualDevice(const Size& rSize) { + maVD.SetOutputSizePixel(rSize); + if(maBitmapEx.GetSizePixel().Width() > 8 || maBitmapEx.GetSizePixel().Height() > 8) { - maVD.DrawBitmapEx(Point(0, 0), Size(32, 16), maBitmapEx); + maVD.DrawBitmapEx(Point(0, 0), rSize, maBitmapEx); } else { - maVD.DrawBitmapEx(Point(0, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(8, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(16, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(24, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(0, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(8, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(16, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(24, 8), maBitmapEx); + const Size aBitmapSize(maBitmapEx.GetSizePixel()); + + for(sal_uInt32 y(0); y < rSize.Height(); y += aBitmapSize.Height()) + { + for(sal_uInt32 x(0); x < rSize.Width(); x += aBitmapSize.Width()) + { + maVD.DrawBitmapEx( + Point(x, y), + maBitmapEx); + } + } } } @@ -1322,8 +1325,12 @@ void BitmapLB::Fill( const XBitmapListRef &pList ) { pEntry = pList->GetBitmap(i); maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); - SetVirtualDevice(); - InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12))); + const Size aSize(pList->getUiBitmapWidth(), pList->getUiBitmapHeight()); + SetVirtualDevice(aSize); + InsertEntry( + pEntry->GetName(), + maVD.GetBitmap(Point(0, 0), + aSize)); } } @@ -1374,64 +1381,73 @@ void BitmapLB::UserDraw(const UserDrawEvent& rUDEvt) /************************************************************************/ -void BitmapLB::Append(XBitmapEntry* pEntry, BitmapEx* pBmpEx) +void BitmapLB::Append(const Size& rSize, const XBitmapEntry& rEntry, BitmapEx* pBmpEx) { if(pBmpEx) { - maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); - SetVirtualDevice(); - InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12))); + maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx(); + SetVirtualDevice(rSize); + InsertEntry( + rEntry.GetName(), + maVD.GetBitmap(Point(0, 0), + rSize)); } else { - InsertEntry(pEntry->GetName()); + InsertEntry(rEntry.GetName()); } } /************************************************************************/ -void BitmapLB::Modify(XBitmapEntry* pEntry, sal_uInt16 nPos, BitmapEx* pBmpEx) +void BitmapLB::Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_uInt16 nPos, BitmapEx* pBmpEx) { RemoveEntry(nPos); if(pBmpEx) { - maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); - SetVirtualDevice(); - InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12)), nPos); + maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx(); + SetVirtualDevice(rSize); + InsertEntry( + rEntry.GetName(), + maVD.GetBitmap(Point(0, 0), rSize), + nPos); } else { - InsertEntry(pEntry->GetName()); + InsertEntry(rEntry.GetName()); } } FillAttrLB::FillAttrLB(Window* pParent, WinBits aWB) : ColorListBox(pParent, aWB) { - maVD.SetOutputSizePixel(Size(32, 16)); } /************************************************************************/ -void FillAttrLB::SetVirtualDevice() +void FillAttrLB::SetVirtualDevice(const Size& rSize) { + maVD.SetOutputSizePixel(rSize); maVD.Erase(); if(maBitmapEx.GetSizePixel().Width() > 8 || maBitmapEx.GetSizePixel().Height() > 8) { - maVD.DrawBitmapEx(Point(0, 0), Size(32, 16), maBitmapEx); + maVD.DrawBitmapEx(Point(0, 0), rSize, maBitmapEx); } else { - maVD.DrawBitmapEx(Point(0, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(8, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(16, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(24, 0), maBitmapEx); - maVD.DrawBitmapEx(Point(0, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(8, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(16, 8), maBitmapEx); - maVD.DrawBitmapEx(Point(24, 8), maBitmapEx); + const Size aBitmapSize(maBitmapEx.GetSizePixel()); + + for(sal_uInt32 y(0); y < rSize.Height(); y += aBitmapSize.Height()) + { + for(sal_uInt32 x(0); x < rSize.Width(); x += aBitmapSize.Width()) + { + maVD.DrawBitmapEx( + Point(x, y), + maBitmapEx); + } + } } } @@ -1448,8 +1464,12 @@ void FillAttrLB::Fill( const XBitmapListRef &pList ) { pEntry = pList->GetBitmap( i ); maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx(); - SetVirtualDevice(); - ListBox::InsertEntry(pEntry->GetName(), maVD.GetBitmap(Point(0, 2), Size(32, 12))); + const Size aSize(pList->getUiBitmapWidth(), pList->getUiBitmapHeight()); + SetVirtualDevice(aSize); + ListBox::InsertEntry( + pEntry->GetName(), + maVD.GetBitmap(Point(0, 0), + aSize)); } ListBox::SetUpdateMode(true); @@ -1470,6 +1490,16 @@ void FillTypeLB::Fill() void LineLB::Fill( const XDashListRef &pList ) { + Clear(); + + // entry for 'none' + InsertEntry(pList->GetStringForUiNoLine()); + + // entry for solid line + InsertEntry(pList->GetStringForUiSolidLine(), pList->GetBitmapForUISolidLine()); + + // entries for dashed lines + if( !pList.is() ) return; @@ -1480,11 +1510,10 @@ void LineLB::Fill( const XDashListRef &pList ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetDash( i ); - Bitmap* pBitmap = pList->CreateBitmapForUI( i ); - if( pBitmap ) + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) { - InsertEntry( pEntry->GetName(), *pBitmap ); - delete pBitmap; + InsertEntry( pEntry->GetName(), aBitmap ); } else InsertEntry( pEntry->GetName() ); @@ -1492,33 +1521,9 @@ void LineLB::Fill( const XDashListRef &pList ) SetUpdateMode( sal_True ); } -void LineLB::FillStyles() -{ - ResMgr& rMgr = DIALOG_MGR(); - - // Line Styles - Clear(); - InsertEntry( String( ResId( RID_SVXSTR_INVISIBLE, rMgr ) ) ); - - const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); - Bitmap aBitmap ( SVX_RES ( RID_SVXCTRL_LINECTRL ) ); - Color aSourceColors[2]; - Color aDestColors[2]; - - aSourceColors[0] = Color( COL_WHITE ); - aSourceColors[1] = Color( COL_BLACK ); - - aDestColors[0] = rStyles.GetFieldColor(); - aDestColors[1] = rStyles.GetFieldTextColor(); - - aBitmap.Replace ( aSourceColors, aDestColors, 2 ); - Image aSolidLine ( aBitmap ); - InsertEntry( String( ResId( RID_SVXSTR_SOLID, rMgr ) ), aSolidLine ); -} - /************************************************************************/ -void LineLB::Append( XDashEntry* pEntry, Bitmap* pBmp ) +void LineLB::Append( XDashEntry* pEntry, const Bitmap* pBmp ) { if( pBmp ) InsertEntry( pEntry->GetName(), *pBmp ); @@ -1528,7 +1533,7 @@ void LineLB::Append( XDashEntry* pEntry, Bitmap* pBmp ) /************************************************************************/ -void LineLB::Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp ) +void LineLB::Modify( XDashEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp ) { RemoveEntry( nPos ); @@ -1540,6 +1545,20 @@ void LineLB::Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp ) // Fills the listbox (provisional) with strings +LineEndLB::LineEndLB( Window* pParent, ResId Id ) + : ListBox( pParent, Id ) +{ +} + +LineEndLB::LineEndLB( Window* pParent, WinBits aWB ) + : ListBox( pParent, aWB ) +{ +} + +LineEndLB::~LineEndLB(void) +{ +} + void LineEndLB::Fill( const XLineEndListRef &pList, sal_Bool bStart ) { if( !pList.is() ) @@ -1553,17 +1572,16 @@ void LineEndLB::Fill( const XLineEndListRef &pList, sal_Bool bStart ) for( long i = 0; i < nCount; i++ ) { pEntry = pList->GetLineEnd( i ); - Bitmap* pBitmap = pList->CreateBitmapForUI( i ); - if( pBitmap ) + const Bitmap aBitmap = pList->GetUiBitmap( i ); + if( !aBitmap.IsEmpty() ) { - Size aBmpSize( pBitmap->GetSizePixel() ); + Size aBmpSize( aBitmap.GetSizePixel() ); aVD.SetOutputSizePixel( aBmpSize, sal_False ); - aVD.DrawBitmap( Point(), *pBitmap ); + aVD.DrawBitmap( Point(), aBitmap ); InsertEntry( pEntry->GetName(), aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ), Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ) ); - - delete pBitmap; + //delete pBitmap; } else InsertEntry( pEntry->GetName() ); @@ -1573,8 +1591,7 @@ void LineEndLB::Fill( const XLineEndListRef &pList, sal_Bool bStart ) /************************************************************************/ -void LineEndLB::Append( XLineEndEntry* pEntry, Bitmap* pBmp, - sal_Bool bStart ) +void LineEndLB::Append( XLineEndEntry* pEntry, const Bitmap* pBmp, sal_Bool bStart ) { if( pBmp ) { @@ -1593,8 +1610,7 @@ void LineEndLB::Append( XLineEndEntry* pEntry, Bitmap* pBmp, /************************************************************************/ -void LineEndLB::Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp, - sal_Bool bStart ) +void LineEndLB::Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, const Bitmap* pBmp, sal_Bool bStart ) { RemoveEntry( nPos ); |