xref: /aoo41x/main/svx/source/dialog/dlgctrl.cxx (revision f6e50924)
1*f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f6e50924SAndrew Rist  * distributed with this work for additional information
6*f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9*f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f6e50924SAndrew Rist  *
11*f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f6e50924SAndrew Rist  *
13*f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15*f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f6e50924SAndrew Rist  * specific language governing permissions and limitations
18*f6e50924SAndrew Rist  * under the License.
19*f6e50924SAndrew Rist  *
20*f6e50924SAndrew Rist  *************************************************************/
21*f6e50924SAndrew Rist 
22*f6e50924SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svx.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // include ---------------------------------------------------------------
28cdf0e10cSrcweir #include <tools/shl.hxx>
29cdf0e10cSrcweir #ifndef _APP_HXX //autogen
30cdf0e10cSrcweir #include <vcl/svapp.hxx>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <svx/xtable.hxx>
34cdf0e10cSrcweir #include <svx/xpool.hxx>
35cdf0e10cSrcweir 
36cdf0e10cSrcweir #include <svx/dialogs.hrc>
37cdf0e10cSrcweir #include "accessibility.hrc"
38cdf0e10cSrcweir #include <svx/dlgctrl.hxx>
39cdf0e10cSrcweir #include <svx/dialmgr.hxx>
40cdf0e10cSrcweir #include <tools/poly.hxx>
41cdf0e10cSrcweir #include <vcl/region.hxx>
42cdf0e10cSrcweir #include <vcl/gradient.hxx>
43cdf0e10cSrcweir #include <vcl/hatch.hxx>
44cdf0e10cSrcweir #include <svtools/colorcfg.hxx>
45cdf0e10cSrcweir 
46cdf0e10cSrcweir #include "svxrectctaccessiblecontext.hxx"
47cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
48cdf0e10cSrcweir #include <basegfx/point/b2dpoint.hxx>
49cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
50cdf0e10cSrcweir #include <svx/svdorect.hxx>
51cdf0e10cSrcweir 
52cdf0e10cSrcweir #include <svx/svdmodel.hxx>
53cdf0e10cSrcweir #include <svx/svdopath.hxx>
54cdf0e10cSrcweir #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
55cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx>
56cdf0e10cSrcweir #include "linectrl.hrc"
57cdf0e10cSrcweir 
58cdf0e10cSrcweir #define OUTPUT_DRAWMODE_COLOR		(DRAWMODE_DEFAULT)
59cdf0e10cSrcweir #define OUTPUT_DRAWMODE_CONTRAST	(DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT)
60cdf0e10cSrcweir 
61cdf0e10cSrcweir using namespace ::com::sun::star::uno;
62cdf0e10cSrcweir using namespace ::com::sun::star::lang;
63cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 
66cdf0e10cSrcweir /*************************************************************************
67cdf0e10cSrcweir |*
68cdf0e10cSrcweir |*	Control zur Darstellung und Auswahl der Eckpunkte (und Mittelpunkt)
69cdf0e10cSrcweir |*	eines Objekts
70cdf0e10cSrcweir |*
71cdf0e10cSrcweir \************************************************************************/
72cdf0e10cSrcweir 
73cdf0e10cSrcweir Bitmap& SvxRectCtl::GetRectBitmap( void )
74cdf0e10cSrcweir {
75cdf0e10cSrcweir 	if( !pBitmap )
76cdf0e10cSrcweir 		InitRectBitmap();
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 	return *pBitmap;
79cdf0e10cSrcweir }
80cdf0e10cSrcweir 
81cdf0e10cSrcweir SvxRectCtl::SvxRectCtl( Window* pParent, const ResId& rResId, RECT_POINT eRpt,
82cdf0e10cSrcweir 						sal_uInt16 nBorder, sal_uInt16 nCircle, CTL_STYLE eStyle ) :
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 	Control( pParent, rResId ),
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	pAccContext	( NULL ),
87cdf0e10cSrcweir     nBorderWidth( nBorder ),
88cdf0e10cSrcweir     nRadius     ( nCircle),
89cdf0e10cSrcweir     eDefRP      ( eRpt ),
90cdf0e10cSrcweir     eCS         ( eStyle ),
91cdf0e10cSrcweir 	pBitmap		( NULL ),
92cdf0e10cSrcweir     m_nState    ( 0 ),
93cdf0e10cSrcweir     mbCompleteDisable(sal_False)
94cdf0e10cSrcweir {
95cdf0e10cSrcweir 	SetMapMode( MAP_100TH_MM );
96cdf0e10cSrcweir     Resize_Impl();
97cdf0e10cSrcweir }
98cdf0e10cSrcweir 
99cdf0e10cSrcweir // -----------------------------------------------------------------------
100cdf0e10cSrcweir 
101cdf0e10cSrcweir SvxRectCtl::~SvxRectCtl()
102cdf0e10cSrcweir {
103cdf0e10cSrcweir 	delete pBitmap;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	if( pAccContext )
106cdf0e10cSrcweir 		pAccContext->release();
107cdf0e10cSrcweir }
108cdf0e10cSrcweir 
109cdf0e10cSrcweir // -----------------------------------------------------------------------
110cdf0e10cSrcweir void SvxRectCtl::Resize()
111cdf0e10cSrcweir {
112cdf0e10cSrcweir     Resize_Impl();
113cdf0e10cSrcweir     Control::Resize();
114cdf0e10cSrcweir }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir // -----------------------------------------------------------------------
117cdf0e10cSrcweir 
118cdf0e10cSrcweir void SvxRectCtl::Resize_Impl()
119cdf0e10cSrcweir {
120cdf0e10cSrcweir     aSize = GetOutputSize();
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	switch( eCS )
123cdf0e10cSrcweir 	{
124cdf0e10cSrcweir 		case CS_RECT:
125cdf0e10cSrcweir 		case CS_ANGLE:
126cdf0e10cSrcweir 		case CS_SHADOW:
127cdf0e10cSrcweir 			aPtLT = Point( 0 + nBorderWidth,  0 + nBorderWidth );
128cdf0e10cSrcweir 			aPtMT = Point( aSize.Width() / 2, 0 + nBorderWidth );
129cdf0e10cSrcweir 			aPtRT = Point( aSize.Width() - nBorderWidth, 0 + nBorderWidth );
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 			aPtLM = Point( 0 + nBorderWidth,  aSize.Height() / 2 );
132cdf0e10cSrcweir 			aPtMM = Point( aSize.Width() / 2, aSize.Height() / 2 );
133cdf0e10cSrcweir 			aPtRM = Point( aSize.Width() - nBorderWidth, aSize.Height() / 2 );
134cdf0e10cSrcweir 
135cdf0e10cSrcweir 			aPtLB = Point( 0 + nBorderWidth,	aSize.Height() - nBorderWidth );
136cdf0e10cSrcweir 			aPtMB = Point( aSize.Width() / 2,	aSize.Height() - nBorderWidth );
137cdf0e10cSrcweir 			aPtRB = Point( aSize.Width() - nBorderWidth, aSize.Height() - nBorderWidth );
138cdf0e10cSrcweir 		break;
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 		case CS_LINE:
141cdf0e10cSrcweir 			aPtLT = Point( 0 + 3 * nBorderWidth,  0 + nBorderWidth );
142cdf0e10cSrcweir 			aPtMT = Point( aSize.Width() / 2, 0 + nBorderWidth );
143cdf0e10cSrcweir 			aPtRT = Point( aSize.Width() - 3 * nBorderWidth, 0 + nBorderWidth );
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 			aPtLM = Point( 0 + 3 * nBorderWidth,  aSize.Height() / 2 );
146cdf0e10cSrcweir 			aPtMM = Point( aSize.Width() / 2, aSize.Height() / 2 );
147cdf0e10cSrcweir 			aPtRM = Point( aSize.Width() - 3 * nBorderWidth, aSize.Height() / 2 );
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 			aPtLB = Point( 0 + 3 * nBorderWidth,	aSize.Height() - nBorderWidth );
150cdf0e10cSrcweir 			aPtMB = Point( aSize.Width() / 2,	aSize.Height() - nBorderWidth );
151cdf0e10cSrcweir 			aPtRB = Point( aSize.Width() - 3 * nBorderWidth, aSize.Height() - nBorderWidth );
152cdf0e10cSrcweir 		break;
153cdf0e10cSrcweir 	}
154cdf0e10cSrcweir 	Reset();
155cdf0e10cSrcweir 	InitSettings( sal_True, sal_True );
156cdf0e10cSrcweir }
157cdf0e10cSrcweir // -----------------------------------------------------------------------
158cdf0e10cSrcweir 
159cdf0e10cSrcweir void SvxRectCtl::InitRectBitmap( void )
160cdf0e10cSrcweir {
161cdf0e10cSrcweir 	if( pBitmap )
162cdf0e10cSrcweir 		delete pBitmap;
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 	const StyleSettings&	rStyles = Application::GetSettings().GetStyleSettings();
165cdf0e10cSrcweir 	svtools::ColorConfig aColorConfig;
166cdf0e10cSrcweir 
167cdf0e10cSrcweir 	pBitmap = new Bitmap( SVX_RES( RID_SVXCTRL_RECTBTNS ) );
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 	// set bitmap-colors
170cdf0e10cSrcweir 	Color	aColorAry1[7];
171cdf0e10cSrcweir 	Color	aColorAry2[7];
172cdf0e10cSrcweir 	aColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 );	// light-gray
173cdf0e10cSrcweir 	aColorAry1[1] = Color( 0xFF, 0xFF, 0x00 );	// yellow
174cdf0e10cSrcweir 	aColorAry1[2] = Color( 0xFF, 0xFF, 0xFF );	// white
175cdf0e10cSrcweir 	aColorAry1[3] = Color( 0x80, 0x80, 0x80 );	// dark-gray
176cdf0e10cSrcweir 	aColorAry1[4] = Color( 0x00, 0x00, 0x00 );  // black
177cdf0e10cSrcweir 	aColorAry1[5] = Color( 0x00, 0xFF, 0x00 );	// green
178cdf0e10cSrcweir 	aColorAry1[6] = Color( 0x00, 0x00, 0xFF );	// blue
179cdf0e10cSrcweir 	aColorAry2[0] = rStyles.GetDialogColor();		// background
180cdf0e10cSrcweir 	aColorAry2[1] = rStyles.GetWindowColor();
181cdf0e10cSrcweir 	aColorAry2[2] = rStyles.GetLightColor();
182cdf0e10cSrcweir 	aColorAry2[3] = rStyles.GetShadowColor();
183cdf0e10cSrcweir 	aColorAry2[4] = rStyles.GetDarkShadowColor();
184cdf0e10cSrcweir 	aColorAry2[5] = Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
185cdf0e10cSrcweir 	aColorAry2[6] = rStyles.GetDialogColor();
186cdf0e10cSrcweir 
187cdf0e10cSrcweir #ifdef DBG_UTIL
188cdf0e10cSrcweir 	static sal_Bool		bModify = sal_False;
189cdf0e10cSrcweir 	sal_Bool&			rModify = bModify;
190cdf0e10cSrcweir 	if( rModify )
191cdf0e10cSrcweir 	{
192cdf0e10cSrcweir 		static int		n = 0;
193cdf0e10cSrcweir 		static sal_uInt8	r = 0xFF;
194cdf0e10cSrcweir 		static sal_uInt8	g = 0x00;
195cdf0e10cSrcweir 		static sal_uInt8	b = 0xFF;
196cdf0e10cSrcweir 		int&			rn = n;
197cdf0e10cSrcweir 		sal_uInt8&			rr = r;
198cdf0e10cSrcweir 		sal_uInt8&			rg = g;
199cdf0e10cSrcweir 		sal_uInt8&			rb = b;
200cdf0e10cSrcweir 		aColorAry2[ rn ] = Color( rr, rg, rb );
201cdf0e10cSrcweir 	}
202cdf0e10cSrcweir #endif
203cdf0e10cSrcweir 
204cdf0e10cSrcweir 	pBitmap->Replace( aColorAry1, aColorAry2, 7, NULL );
205cdf0e10cSrcweir }
206cdf0e10cSrcweir 
207cdf0e10cSrcweir // -----------------------------------------------------------------------
208cdf0e10cSrcweir 
209cdf0e10cSrcweir void SvxRectCtl::InitSettings( sal_Bool bForeground, sal_Bool bBackground )
210cdf0e10cSrcweir {
211cdf0e10cSrcweir 	const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
212cdf0e10cSrcweir 
213cdf0e10cSrcweir 	if( bForeground )
214cdf0e10cSrcweir 	{
215cdf0e10cSrcweir 		svtools::ColorConfig aColorConfig;
216cdf0e10cSrcweir 		Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 		if ( IsControlForeground() )
219cdf0e10cSrcweir 			aTextColor = GetControlForeground();
220cdf0e10cSrcweir 		SetTextColor( aTextColor );
221cdf0e10cSrcweir 	}
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 	if( bBackground )
224cdf0e10cSrcweir 	{
225cdf0e10cSrcweir 		if ( IsControlBackground() )
226cdf0e10cSrcweir 			SetBackground( GetControlBackground() );
227cdf0e10cSrcweir 		else
228cdf0e10cSrcweir 			SetBackground( rStyleSettings.GetWindowColor() );
229cdf0e10cSrcweir 	}
230cdf0e10cSrcweir 
231cdf0e10cSrcweir 	delete pBitmap;
232cdf0e10cSrcweir 	pBitmap = NULL;		// forces new creating of bitmap
233cdf0e10cSrcweir 
234cdf0e10cSrcweir 	Invalidate();
235cdf0e10cSrcweir }
236cdf0e10cSrcweir 
237cdf0e10cSrcweir /*************************************************************************
238cdf0e10cSrcweir |*
239cdf0e10cSrcweir |*	Das angeklickte Rechteck (3 x 3) wird ermittelt und der Parent (Dialog)
240cdf0e10cSrcweir |*	wird benachrichtigt, dass der Punkt geaendert wurde
241cdf0e10cSrcweir |*
242cdf0e10cSrcweir \************************************************************************/
243cdf0e10cSrcweir 
244cdf0e10cSrcweir void SvxRectCtl::MouseButtonDown( const MouseEvent& rMEvt )
245cdf0e10cSrcweir {
246cdf0e10cSrcweir 	// #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
247cdf0e10cSrcweir 	if(!IsCompletelyDisabled())
248cdf0e10cSrcweir 	{
249cdf0e10cSrcweir 		Point aPtLast = aPtNew;
250cdf0e10cSrcweir 
251cdf0e10cSrcweir 		aPtNew = GetApproxLogPtFromPixPt( rMEvt.GetPosPixel() );
252cdf0e10cSrcweir 
253cdf0e10cSrcweir 		if( aPtNew == aPtMM && ( eCS == CS_SHADOW || eCS == CS_ANGLE ) )
254cdf0e10cSrcweir 		{
255cdf0e10cSrcweir 			aPtNew = aPtLast;
256cdf0e10cSrcweir 		}
257cdf0e10cSrcweir 		else
258cdf0e10cSrcweir 		{
259cdf0e10cSrcweir 			Invalidate( Rectangle( aPtLast - Point( nRadius, nRadius ),
260cdf0e10cSrcweir 								   aPtLast + Point( nRadius, nRadius ) ) );
261cdf0e10cSrcweir 			Invalidate( Rectangle( aPtNew - Point( nRadius, nRadius ),
262cdf0e10cSrcweir 								   aPtNew + Point( nRadius, nRadius ) ) );
263cdf0e10cSrcweir 			eRP = GetRPFromPoint( aPtNew );
264cdf0e10cSrcweir 
265cdf0e10cSrcweir 			SetActualRP( eRP );
266cdf0e10cSrcweir 
267cdf0e10cSrcweir 			if( WINDOW_TABPAGE == GetParent()->GetType() )
268cdf0e10cSrcweir 				( (SvxTabPage*) GetParent() )->PointChanged( this, eRP );
269cdf0e10cSrcweir 		}
270cdf0e10cSrcweir 	}
271cdf0e10cSrcweir }
272cdf0e10cSrcweir 
273cdf0e10cSrcweir // -----------------------------------------------------------------------
274cdf0e10cSrcweir 
275cdf0e10cSrcweir void SvxRectCtl::KeyInput( const KeyEvent& rKeyEvt )
276cdf0e10cSrcweir {
277cdf0e10cSrcweir 	// #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
278cdf0e10cSrcweir 	if(!IsCompletelyDisabled())
279cdf0e10cSrcweir 	{
280cdf0e10cSrcweir 		RECT_POINT eNewRP = eRP;
281cdf0e10cSrcweir 		sal_Bool bUseMM = (eCS != CS_SHADOW) && (eCS != CS_ANGLE);
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 		switch( rKeyEvt.GetKeyCode().GetCode() )
284cdf0e10cSrcweir 		{
285cdf0e10cSrcweir 			case KEY_DOWN:
286cdf0e10cSrcweir 			{
287cdf0e10cSrcweir 				if( !(m_nState & CS_NOVERT) )
288cdf0e10cSrcweir 					switch( eNewRP )
289cdf0e10cSrcweir 					{
290cdf0e10cSrcweir 						case RP_LT: eNewRP = RP_LM; break;
291cdf0e10cSrcweir 						case RP_MT: eNewRP = bUseMM ? RP_MM : RP_MB; break;
292cdf0e10cSrcweir 						case RP_RT: eNewRP = RP_RM; break;
293cdf0e10cSrcweir 						case RP_LM: eNewRP = RP_LB; break;
294cdf0e10cSrcweir 						case RP_MM: eNewRP = RP_MB; break;
295cdf0e10cSrcweir 						case RP_RM: eNewRP = RP_RB; break;
296cdf0e10cSrcweir                         default: ; //prevent warning
297cdf0e10cSrcweir                     }
298cdf0e10cSrcweir 			}
299cdf0e10cSrcweir 			break;
300cdf0e10cSrcweir 			case KEY_UP:
301cdf0e10cSrcweir 			{
302cdf0e10cSrcweir 				if( !(m_nState & CS_NOVERT) )
303cdf0e10cSrcweir 					switch( eNewRP )
304cdf0e10cSrcweir 					{
305cdf0e10cSrcweir 						case RP_LM: eNewRP = RP_LT; break;
306cdf0e10cSrcweir 						case RP_MM: eNewRP = RP_MT; break;
307cdf0e10cSrcweir 						case RP_RM: eNewRP = RP_RT; break;
308cdf0e10cSrcweir 						case RP_LB: eNewRP = RP_LM; break;
309cdf0e10cSrcweir 						case RP_MB: eNewRP = bUseMM ? RP_MM : RP_MT; break;
310cdf0e10cSrcweir 						case RP_RB: eNewRP = RP_RM; break;
311cdf0e10cSrcweir                         default: ; //prevent warning
312cdf0e10cSrcweir                     }
313cdf0e10cSrcweir 			}
314cdf0e10cSrcweir 			break;
315cdf0e10cSrcweir 			case KEY_LEFT:
316cdf0e10cSrcweir 			{
317cdf0e10cSrcweir 				if( !(m_nState & CS_NOHORZ) )
318cdf0e10cSrcweir 					switch( eNewRP )
319cdf0e10cSrcweir 					{
320cdf0e10cSrcweir 						case RP_MT: eNewRP = RP_LT; break;
321cdf0e10cSrcweir 						case RP_RT: eNewRP = RP_MT; break;
322cdf0e10cSrcweir 						case RP_MM: eNewRP = RP_LM; break;
323cdf0e10cSrcweir 						case RP_RM: eNewRP = bUseMM ? RP_MM : RP_LM; break;
324cdf0e10cSrcweir 						case RP_MB: eNewRP = RP_LB; break;
325cdf0e10cSrcweir 						case RP_RB: eNewRP = RP_MB; break;
326cdf0e10cSrcweir                         default: ; //prevent warning
327cdf0e10cSrcweir                     }
328cdf0e10cSrcweir 			}
329cdf0e10cSrcweir 			break;
330cdf0e10cSrcweir 			case KEY_RIGHT:
331cdf0e10cSrcweir 			{
332cdf0e10cSrcweir 				if( !(m_nState & CS_NOHORZ) )
333cdf0e10cSrcweir 					switch( eNewRP )
334cdf0e10cSrcweir 					{
335cdf0e10cSrcweir 						case RP_LT: eNewRP = RP_MT; break;
336cdf0e10cSrcweir 						case RP_MT: eNewRP = RP_RT; break;
337cdf0e10cSrcweir 						case RP_LM: eNewRP = bUseMM ? RP_MM : RP_RM; break;
338cdf0e10cSrcweir 						case RP_MM: eNewRP = RP_RM; break;
339cdf0e10cSrcweir 						case RP_LB: eNewRP = RP_MB; break;
340cdf0e10cSrcweir 						case RP_MB: eNewRP = RP_RB; break;
341cdf0e10cSrcweir                         default: ; //prevent warning
342cdf0e10cSrcweir                     }
343cdf0e10cSrcweir 			}
344cdf0e10cSrcweir 			break;
345cdf0e10cSrcweir 			default:
346cdf0e10cSrcweir 				Control::KeyInput( rKeyEvt );
347cdf0e10cSrcweir 				return;
348cdf0e10cSrcweir 		}
349cdf0e10cSrcweir 		if( eNewRP != eRP )
350cdf0e10cSrcweir 		{
351cdf0e10cSrcweir 			SetActualRP( eNewRP );
352cdf0e10cSrcweir 
353cdf0e10cSrcweir 			if( WINDOW_TABPAGE == GetParent()->GetType() )
354cdf0e10cSrcweir 				( (SvxTabPage*) GetParent() )->PointChanged( this, eRP );
355cdf0e10cSrcweir 
356cdf0e10cSrcweir 			SetFocusRect();
357cdf0e10cSrcweir 		}
358cdf0e10cSrcweir 	}
359cdf0e10cSrcweir }
360cdf0e10cSrcweir 
361cdf0e10cSrcweir // -----------------------------------------------------------------------
362cdf0e10cSrcweir 
363cdf0e10cSrcweir void SvxRectCtl::StateChanged( StateChangedType nType )
364cdf0e10cSrcweir {
365cdf0e10cSrcweir 	if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
366cdf0e10cSrcweir 		InitSettings( sal_True, sal_False );
367cdf0e10cSrcweir 	else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
368cdf0e10cSrcweir 		InitSettings( sal_False, sal_True );
369cdf0e10cSrcweir 
370cdf0e10cSrcweir 	Window::StateChanged( nType );
371cdf0e10cSrcweir }
372cdf0e10cSrcweir 
373cdf0e10cSrcweir // -----------------------------------------------------------------------
374cdf0e10cSrcweir 
375cdf0e10cSrcweir void SvxRectCtl::DataChanged( const DataChangedEvent& rDCEvt )
376cdf0e10cSrcweir {
377cdf0e10cSrcweir 	if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
378cdf0e10cSrcweir 		InitSettings( sal_True, sal_True );
379cdf0e10cSrcweir 	else
380cdf0e10cSrcweir 		Window::DataChanged( rDCEvt );
381cdf0e10cSrcweir }
382cdf0e10cSrcweir 
383cdf0e10cSrcweir /*************************************************************************
384cdf0e10cSrcweir |*
385cdf0e10cSrcweir |*	Zeichnet das Control (Rechteck mit 9 Kreisen)
386cdf0e10cSrcweir |*
387cdf0e10cSrcweir \************************************************************************/
388cdf0e10cSrcweir 
389cdf0e10cSrcweir void SvxRectCtl::Paint( const Rectangle& )
390cdf0e10cSrcweir {
391cdf0e10cSrcweir 	Point	aPtDiff( PixelToLogic( Point( 1, 1 ) ) );
392cdf0e10cSrcweir 
393cdf0e10cSrcweir 	const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
394cdf0e10cSrcweir 
395cdf0e10cSrcweir 	SetLineColor( rStyles.GetDialogColor() );
396cdf0e10cSrcweir 	SetFillColor( rStyles.GetDialogColor() );
397cdf0e10cSrcweir 	DrawRect( Rectangle( Point(0,0), GetOutputSize() ) );
398cdf0e10cSrcweir 
399cdf0e10cSrcweir 	if( IsEnabled() )
400cdf0e10cSrcweir 		SetLineColor( rStyles.GetLabelTextColor() );
401cdf0e10cSrcweir 	else
402cdf0e10cSrcweir 		SetLineColor( rStyles.GetShadowColor() );
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 	SetFillColor();
405cdf0e10cSrcweir 
406cdf0e10cSrcweir 	switch( eCS )
407cdf0e10cSrcweir 	{
408cdf0e10cSrcweir 
409cdf0e10cSrcweir 		case CS_RECT:
410cdf0e10cSrcweir 		case CS_SHADOW:
411cdf0e10cSrcweir 			if( !IsEnabled() )
412cdf0e10cSrcweir 			{
413cdf0e10cSrcweir 				Color aOldCol = GetLineColor();
414cdf0e10cSrcweir 				SetLineColor( rStyles.GetLightColor() );
415cdf0e10cSrcweir 				DrawRect( Rectangle( aPtLT + aPtDiff, aPtRB + aPtDiff ) );
416cdf0e10cSrcweir 				SetLineColor( aOldCol );
417cdf0e10cSrcweir 			}
418cdf0e10cSrcweir 			DrawRect( Rectangle( aPtLT, aPtRB ) );
419cdf0e10cSrcweir 		break;
420cdf0e10cSrcweir 
421cdf0e10cSrcweir 		case CS_LINE:
422cdf0e10cSrcweir 			if( !IsEnabled() )
423cdf0e10cSrcweir 			{
424cdf0e10cSrcweir 				Color aOldCol = GetLineColor();
425cdf0e10cSrcweir 				SetLineColor( rStyles.GetLightColor() );
426cdf0e10cSrcweir 				DrawLine( aPtLM - Point( 2 * nBorderWidth, 0) + aPtDiff,
427cdf0e10cSrcweir 						  aPtRM + Point( 2 * nBorderWidth, 0 ) + aPtDiff );
428cdf0e10cSrcweir 				SetLineColor( aOldCol );
429cdf0e10cSrcweir 			}
430cdf0e10cSrcweir 			DrawLine( aPtLM - Point( 2 * nBorderWidth, 0),
431cdf0e10cSrcweir 					  aPtRM + Point( 2 * nBorderWidth, 0 ) );
432cdf0e10cSrcweir 		break;
433cdf0e10cSrcweir 
434cdf0e10cSrcweir 		case CS_ANGLE:
435cdf0e10cSrcweir 			if( !IsEnabled() )
436cdf0e10cSrcweir 			{
437cdf0e10cSrcweir 				Color aOldCol = GetLineColor();
438cdf0e10cSrcweir 				SetLineColor( rStyles.GetLightColor() );
439cdf0e10cSrcweir 				DrawLine( aPtLT + aPtDiff, aPtRB + aPtDiff );
440cdf0e10cSrcweir 				DrawLine( aPtLB + aPtDiff, aPtRT + aPtDiff );
441cdf0e10cSrcweir 				DrawLine( aPtLM + aPtDiff, aPtRM + aPtDiff );
442cdf0e10cSrcweir 				DrawLine( aPtMT + aPtDiff, aPtMB + aPtDiff );
443cdf0e10cSrcweir 				SetLineColor( aOldCol );
444cdf0e10cSrcweir 			}
445cdf0e10cSrcweir 			DrawLine( aPtLT, aPtRB );
446cdf0e10cSrcweir 			DrawLine( aPtLB, aPtRT );
447cdf0e10cSrcweir 			DrawLine( aPtLM, aPtRM );
448cdf0e10cSrcweir 			DrawLine( aPtMT, aPtMB );
449cdf0e10cSrcweir 		break;
450cdf0e10cSrcweir 
451cdf0e10cSrcweir 		default:
452cdf0e10cSrcweir 			break;
453cdf0e10cSrcweir 	}
454cdf0e10cSrcweir 	SetFillColor( GetBackground().GetColor() );
455cdf0e10cSrcweir 
456cdf0e10cSrcweir 	Size aBtnSize( 11, 11 );
457cdf0e10cSrcweir 	Size aDstBtnSize(  PixelToLogic( aBtnSize ) );
458cdf0e10cSrcweir 	Point aToCenter( aDstBtnSize.Width() >> 1, aDstBtnSize.Height() >> 1);
459cdf0e10cSrcweir 	Point aBtnPnt1( IsEnabled()?0:22,0 );
460cdf0e10cSrcweir 	Point aBtnPnt2( 11,0 );
461cdf0e10cSrcweir 	Point aBtnPnt3( 22,0 );
462cdf0e10cSrcweir 
463cdf0e10cSrcweir 	sal_Bool bNoHorz = (m_nState & CS_NOHORZ) != 0;
464cdf0e10cSrcweir 	sal_Bool bNoVert = (m_nState & CS_NOVERT) != 0;
465cdf0e10cSrcweir 
466cdf0e10cSrcweir 	Bitmap&			rBitmap = GetRectBitmap();
467cdf0e10cSrcweir 
468cdf0e10cSrcweir 	// #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
469cdf0e10cSrcweir 	if(IsCompletelyDisabled())
470cdf0e10cSrcweir 	{
471cdf0e10cSrcweir 		DrawBitmap( aPtLT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
472cdf0e10cSrcweir 		DrawBitmap( aPtMT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
473cdf0e10cSrcweir 		DrawBitmap( aPtRT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
474cdf0e10cSrcweir 		DrawBitmap( aPtLM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
475cdf0e10cSrcweir 		if( eCS == CS_RECT || eCS == CS_LINE )
476cdf0e10cSrcweir 			DrawBitmap( aPtMM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
477cdf0e10cSrcweir 		DrawBitmap( aPtRM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
478cdf0e10cSrcweir 		DrawBitmap( aPtLB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
479cdf0e10cSrcweir 		DrawBitmap( aPtMB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
480cdf0e10cSrcweir 		DrawBitmap( aPtRB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
481cdf0e10cSrcweir 	}
482cdf0e10cSrcweir 	else
483cdf0e10cSrcweir 	{
484cdf0e10cSrcweir 		DrawBitmap( aPtLT - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
485cdf0e10cSrcweir 		DrawBitmap( aPtMT - aToCenter, aDstBtnSize, bNoVert?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
486cdf0e10cSrcweir 		DrawBitmap( aPtRT - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
487cdf0e10cSrcweir 
488cdf0e10cSrcweir 		DrawBitmap( aPtLM - aToCenter, aDstBtnSize, bNoHorz?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
489cdf0e10cSrcweir 
490cdf0e10cSrcweir 		// Mittelpunkt bei Rechteck und Linie
491cdf0e10cSrcweir 		if( eCS == CS_RECT || eCS == CS_LINE )
492cdf0e10cSrcweir 			DrawBitmap( aPtMM - aToCenter, aDstBtnSize, aBtnPnt1, aBtnSize, rBitmap );
493cdf0e10cSrcweir 
494cdf0e10cSrcweir 		DrawBitmap( aPtRM - aToCenter, aDstBtnSize, bNoHorz?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
495cdf0e10cSrcweir 
496cdf0e10cSrcweir 		DrawBitmap( aPtLB - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
497cdf0e10cSrcweir 		DrawBitmap( aPtMB - aToCenter, aDstBtnSize, bNoVert?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
498cdf0e10cSrcweir 		DrawBitmap( aPtRB - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
499cdf0e10cSrcweir 	}
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 	// draw active button, avoid center pos for angle
502cdf0e10cSrcweir 	// #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
503cdf0e10cSrcweir 	if(!IsCompletelyDisabled())
504cdf0e10cSrcweir 	{
505cdf0e10cSrcweir 		if( IsEnabled() && (eCS != CS_ANGLE || aPtNew != aPtMM) )
506cdf0e10cSrcweir 		{
507cdf0e10cSrcweir 			Point		aCenterPt( aPtNew );
508cdf0e10cSrcweir 			aCenterPt -= aToCenter;
509cdf0e10cSrcweir 
510cdf0e10cSrcweir 			DrawBitmap( aCenterPt, aDstBtnSize, aBtnPnt2, aBtnSize, rBitmap );
511cdf0e10cSrcweir 		}
512cdf0e10cSrcweir 	}
513cdf0e10cSrcweir }
514cdf0e10cSrcweir 
515cdf0e10cSrcweir /*************************************************************************
516cdf0e10cSrcweir |*
517cdf0e10cSrcweir |*	Konvertiert RECT_POINT in Point
518cdf0e10cSrcweir |*
519cdf0e10cSrcweir \************************************************************************/
520cdf0e10cSrcweir 
521cdf0e10cSrcweir Point SvxRectCtl::GetPointFromRP( RECT_POINT _eRP) const
522cdf0e10cSrcweir {
523cdf0e10cSrcweir     switch( _eRP )
524cdf0e10cSrcweir 	{
525cdf0e10cSrcweir 		case RP_LT: return aPtLT;
526cdf0e10cSrcweir 		case RP_MT: return aPtMT;
527cdf0e10cSrcweir 		case RP_RT: return aPtRT;
528cdf0e10cSrcweir 		case RP_LM: return aPtLM;
529cdf0e10cSrcweir 		case RP_MM: return aPtMM;
530cdf0e10cSrcweir 		case RP_RM: return aPtRM;
531cdf0e10cSrcweir 		case RP_LB: return aPtLB;
532cdf0e10cSrcweir 		case RP_MB: return aPtMB;
533cdf0e10cSrcweir 		case RP_RB: return aPtRB;
534cdf0e10cSrcweir 	}
535cdf0e10cSrcweir 	return( aPtMM ); // default
536cdf0e10cSrcweir }
537cdf0e10cSrcweir 
538cdf0e10cSrcweir 
539cdf0e10cSrcweir void SvxRectCtl::SetFocusRect( const Rectangle* pRect )
540cdf0e10cSrcweir {
541cdf0e10cSrcweir 	HideFocus();
542cdf0e10cSrcweir 
543cdf0e10cSrcweir 	if( pRect )
544cdf0e10cSrcweir 		ShowFocus( *pRect );
545cdf0e10cSrcweir 	else
546cdf0e10cSrcweir 		ShowFocus( CalculateFocusRectangle() );
547cdf0e10cSrcweir }
548cdf0e10cSrcweir 
549cdf0e10cSrcweir Point SvxRectCtl::SetActualRPWithoutInvalidate( RECT_POINT eNewRP )
550cdf0e10cSrcweir {
551cdf0e10cSrcweir 	Point aPtLast = aPtNew;
552cdf0e10cSrcweir 	aPtNew = GetPointFromRP( eNewRP );
553cdf0e10cSrcweir 
554cdf0e10cSrcweir 	if( (m_nState & CS_NOHORZ) != 0 )
555cdf0e10cSrcweir 		aPtNew.X() = aPtMM.X();
556cdf0e10cSrcweir 
557cdf0e10cSrcweir 	if( (m_nState & CS_NOVERT) != 0 )
558cdf0e10cSrcweir 		aPtNew.Y() = aPtMM.Y();
559cdf0e10cSrcweir 
560cdf0e10cSrcweir 	eNewRP = GetRPFromPoint( aPtNew );
561cdf0e10cSrcweir 
562cdf0e10cSrcweir 	eDefRP = eNewRP;
563cdf0e10cSrcweir 	eRP = eNewRP;
564cdf0e10cSrcweir 
565cdf0e10cSrcweir 	return aPtLast;
566cdf0e10cSrcweir }
567cdf0e10cSrcweir 
568cdf0e10cSrcweir void SvxRectCtl::GetFocus()
569cdf0e10cSrcweir {
570cdf0e10cSrcweir 	SetFocusRect();
571cdf0e10cSrcweir }
572cdf0e10cSrcweir 
573cdf0e10cSrcweir 
574cdf0e10cSrcweir void SvxRectCtl::LoseFocus()
575cdf0e10cSrcweir {
576cdf0e10cSrcweir 	HideFocus();
577cdf0e10cSrcweir }
578cdf0e10cSrcweir 
579cdf0e10cSrcweir 
580cdf0e10cSrcweir Point SvxRectCtl::GetApproxLogPtFromPixPt( const Point& rPt ) const
581cdf0e10cSrcweir {
582cdf0e10cSrcweir 	Point	aPt = PixelToLogic( rPt );
583cdf0e10cSrcweir 	long	x;
584cdf0e10cSrcweir 	long	y;
585cdf0e10cSrcweir 
586cdf0e10cSrcweir 	if( ( m_nState & CS_NOHORZ ) == 0 )
587cdf0e10cSrcweir 	{
588cdf0e10cSrcweir 		if( aPt.X() < aSize.Width() / 3 )
589cdf0e10cSrcweir 			x = aPtLT.X();
590cdf0e10cSrcweir 		else if( aPt.X() < aSize.Width() * 2 / 3 )
591cdf0e10cSrcweir 			x = aPtMM.X();
592cdf0e10cSrcweir 		else
593cdf0e10cSrcweir 			x = aPtRB.X();
594cdf0e10cSrcweir 	}
595cdf0e10cSrcweir 	else
596cdf0e10cSrcweir 		x = aPtMM.X();
597cdf0e10cSrcweir 
598cdf0e10cSrcweir 	if( ( m_nState & CS_NOVERT ) == 0 )
599cdf0e10cSrcweir 	{
600cdf0e10cSrcweir 		if( aPt.Y() < aSize.Height() / 3 )
601cdf0e10cSrcweir 			y = aPtLT.Y();
602cdf0e10cSrcweir 		else if( aPt.Y() < aSize.Height() * 2 / 3 )
603cdf0e10cSrcweir 			y = aPtMM.Y();
604cdf0e10cSrcweir 		else
605cdf0e10cSrcweir 			y = aPtRB.Y();
606cdf0e10cSrcweir 	}
607cdf0e10cSrcweir 	else
608cdf0e10cSrcweir 			y = aPtMM.Y();
609cdf0e10cSrcweir 
610cdf0e10cSrcweir 	return Point( x, y );
611cdf0e10cSrcweir }
612cdf0e10cSrcweir 
613cdf0e10cSrcweir 
614cdf0e10cSrcweir /*************************************************************************
615cdf0e10cSrcweir |*
616cdf0e10cSrcweir |*	Konvertiert Point in RECT_POINT
617cdf0e10cSrcweir |*
618cdf0e10cSrcweir \************************************************************************/
619cdf0e10cSrcweir 
620cdf0e10cSrcweir RECT_POINT SvxRectCtl::GetRPFromPoint( Point aPt ) const
621cdf0e10cSrcweir {
622cdf0e10cSrcweir 	if	   ( aPt == aPtLT) return RP_LT;
623cdf0e10cSrcweir 	else if( aPt == aPtMT) return RP_MT;
624cdf0e10cSrcweir 	else if( aPt == aPtRT) return RP_RT;
625cdf0e10cSrcweir 	else if( aPt == aPtLM) return RP_LM;
626cdf0e10cSrcweir 	else if( aPt == aPtRM) return RP_RM;
627cdf0e10cSrcweir 	else if( aPt == aPtLB) return RP_LB;
628cdf0e10cSrcweir 	else if( aPt == aPtMB) return RP_MB;
629cdf0e10cSrcweir 	else if( aPt == aPtRB) return RP_RB;
630cdf0e10cSrcweir 
631cdf0e10cSrcweir 	else
632cdf0e10cSrcweir 		return RP_MM; // default
633cdf0e10cSrcweir }
634cdf0e10cSrcweir 
635cdf0e10cSrcweir /*************************************************************************
636cdf0e10cSrcweir |*
637cdf0e10cSrcweir |*	Bewirkt den Ursprungszustand des Controls
638cdf0e10cSrcweir |*
639cdf0e10cSrcweir \************************************************************************/
640cdf0e10cSrcweir 
641cdf0e10cSrcweir void SvxRectCtl::Reset()
642cdf0e10cSrcweir {
643cdf0e10cSrcweir 	aPtNew = GetPointFromRP( eDefRP );
644cdf0e10cSrcweir 	eRP = eDefRP;
645cdf0e10cSrcweir 	Invalidate();
646cdf0e10cSrcweir }
647cdf0e10cSrcweir 
648cdf0e10cSrcweir /*************************************************************************
649cdf0e10cSrcweir |*
650cdf0e10cSrcweir |*	Gibt den aktuell ausgewaehlten RECT_POINT zur�ck
651cdf0e10cSrcweir |*
652cdf0e10cSrcweir \************************************************************************/
653cdf0e10cSrcweir 
654cdf0e10cSrcweir RECT_POINT SvxRectCtl::GetActualRP() const
655cdf0e10cSrcweir {
656cdf0e10cSrcweir 	return( eRP );
657cdf0e10cSrcweir }
658cdf0e10cSrcweir 
659cdf0e10cSrcweir /*************************************************************************
660cdf0e10cSrcweir |*
661cdf0e10cSrcweir |*	Gibt den aktuell ausgewaehlten RECT_POINT zur�ck
662cdf0e10cSrcweir |*
663cdf0e10cSrcweir \************************************************************************/
664cdf0e10cSrcweir 
665cdf0e10cSrcweir void SvxRectCtl::SetActualRP( RECT_POINT eNewRP )
666cdf0e10cSrcweir {
667cdf0e10cSrcweir 	Point aPtLast( SetActualRPWithoutInvalidate( eNewRP ) );
668cdf0e10cSrcweir 
669cdf0e10cSrcweir 	Invalidate( Rectangle( aPtLast - Point( nRadius, nRadius ), aPtLast + Point( nRadius, nRadius ) ) );
670cdf0e10cSrcweir 	Invalidate( Rectangle( aPtNew - Point( nRadius, nRadius ), aPtNew + Point( nRadius, nRadius ) ) );
671cdf0e10cSrcweir 
672cdf0e10cSrcweir 	// notify accessibility object about change
673cdf0e10cSrcweir 	if( pAccContext )
674cdf0e10cSrcweir 		pAccContext->selectChild( eNewRP );
675cdf0e10cSrcweir }
676cdf0e10cSrcweir 
677cdf0e10cSrcweir void SvxRectCtl::SetState( CTL_STATE nState )
678cdf0e10cSrcweir {
679cdf0e10cSrcweir 	m_nState = nState;
680cdf0e10cSrcweir 
681cdf0e10cSrcweir 	Point aPtLast( GetPointFromRP( eRP ) );
682cdf0e10cSrcweir     Point _aPtNew( aPtLast );
683cdf0e10cSrcweir 
684cdf0e10cSrcweir 	if( (m_nState & CS_NOHORZ) != 0 )
685cdf0e10cSrcweir         _aPtNew.X() = aPtMM.X();
686cdf0e10cSrcweir 
687cdf0e10cSrcweir 	if( (m_nState & CS_NOVERT) != 0 )
688cdf0e10cSrcweir         _aPtNew.Y() = aPtMM.Y();
689cdf0e10cSrcweir 
690cdf0e10cSrcweir     eRP = GetRPFromPoint( _aPtNew );
691cdf0e10cSrcweir 	Invalidate();
692cdf0e10cSrcweir 
693cdf0e10cSrcweir 	if( WINDOW_TABPAGE == GetParent()->GetType() )
694cdf0e10cSrcweir 		( (SvxTabPage*) GetParent() )->PointChanged( this, eRP );
695cdf0e10cSrcweir }
696cdf0e10cSrcweir 
697cdf0e10cSrcweir sal_uInt8 SvxRectCtl::GetNumOfChilds( void ) const
698cdf0e10cSrcweir {
699cdf0e10cSrcweir 	return ( eCS == CS_ANGLE )? 8 : 9;
700cdf0e10cSrcweir }
701cdf0e10cSrcweir 
702cdf0e10cSrcweir Rectangle SvxRectCtl::CalculateFocusRectangle( void ) const
703cdf0e10cSrcweir {
704cdf0e10cSrcweir 	Size		aDstBtnSize( PixelToLogic( Size( 15, 15 ) ) );
705cdf0e10cSrcweir 	return Rectangle( aPtNew - Point( aDstBtnSize.Width() >> 1, aDstBtnSize.Height() >> 1 ), aDstBtnSize );
706cdf0e10cSrcweir }
707cdf0e10cSrcweir 
708cdf0e10cSrcweir Rectangle SvxRectCtl::CalculateFocusRectangle( RECT_POINT eRectPoint ) const
709cdf0e10cSrcweir {
710cdf0e10cSrcweir 	Rectangle	aRet;
711cdf0e10cSrcweir 	RECT_POINT	eOldRectPoint = GetActualRP();
712cdf0e10cSrcweir 
713cdf0e10cSrcweir 	if( eOldRectPoint == eRectPoint )
714cdf0e10cSrcweir 		aRet = CalculateFocusRectangle();
715cdf0e10cSrcweir 	else
716cdf0e10cSrcweir 	{
717cdf0e10cSrcweir 		SvxRectCtl*	pThis = const_cast< SvxRectCtl* >( this );
718cdf0e10cSrcweir 
719cdf0e10cSrcweir 		pThis->SetActualRPWithoutInvalidate( eRectPoint );		// no invalidation because it's only temporary!
720cdf0e10cSrcweir 		aRet = CalculateFocusRectangle();
721cdf0e10cSrcweir 
722cdf0e10cSrcweir 		pThis->SetActualRPWithoutInvalidate( eOldRectPoint );	// no invalidation because nothing has changed!
723cdf0e10cSrcweir 	}
724cdf0e10cSrcweir 
725cdf0e10cSrcweir 	return aRet;
726cdf0e10cSrcweir }
727cdf0e10cSrcweir 
728cdf0e10cSrcweir Reference< XAccessible > SvxRectCtl::CreateAccessible()
729cdf0e10cSrcweir {
730cdf0e10cSrcweir 	Window*						pParent = GetAccessibleParentWindow();
731cdf0e10cSrcweir 
732cdf0e10cSrcweir 	DBG_ASSERT( pParent, "-SvxRectCtl::CreateAccessible(): No Parent!" );
733cdf0e10cSrcweir 
734cdf0e10cSrcweir 	Reference< XAccessible >	xAccParent  = pParent->GetAccessible();
735cdf0e10cSrcweir 	if( xAccParent.is() )
736cdf0e10cSrcweir 	{
737cdf0e10cSrcweir 		pAccContext = new SvxRectCtlAccessibleContext( xAccParent, *this );
738cdf0e10cSrcweir 		pAccContext->acquire();
739cdf0e10cSrcweir 
740cdf0e10cSrcweir         SetActualRP( GetActualRP() );
741cdf0e10cSrcweir 
742cdf0e10cSrcweir 		return pAccContext;
743cdf0e10cSrcweir 	}
744cdf0e10cSrcweir 	else
745cdf0e10cSrcweir 		return Reference< XAccessible >();
746cdf0e10cSrcweir }
747cdf0e10cSrcweir 
748cdf0e10cSrcweir RECT_POINT SvxRectCtl::GetApproxRPFromPixPt( const ::com::sun::star::awt::Point& r ) const
749cdf0e10cSrcweir {
750cdf0e10cSrcweir 	return GetRPFromPoint( GetApproxLogPtFromPixPt( Point( r.X, r.Y ) ) );
751cdf0e10cSrcweir }
752cdf0e10cSrcweir 
753cdf0e10cSrcweir // #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
754cdf0e10cSrcweir void SvxRectCtl::DoCompletelyDisable(sal_Bool bNew)
755cdf0e10cSrcweir {
756cdf0e10cSrcweir 	mbCompleteDisable = bNew;
757cdf0e10cSrcweir 	Invalidate();
758cdf0e10cSrcweir }
759cdf0e10cSrcweir 
760cdf0e10cSrcweir /*************************************************************************
761cdf0e10cSrcweir |*
762cdf0e10cSrcweir |* Konstruktor ohne Size-Parameter
763cdf0e10cSrcweir |*
764cdf0e10cSrcweir \************************************************************************/
765cdf0e10cSrcweir 
766cdf0e10cSrcweir SvxAngleCtl::SvxAngleCtl( Window* pParent, const ResId& rResId ) :
767cdf0e10cSrcweir 
768cdf0e10cSrcweir 	SvxRectCtl( pParent, rResId ),
769cdf0e10cSrcweir 
770cdf0e10cSrcweir 	aFont( Application::GetSettings().GetStyleSettings().GetAppFont() )
771cdf0e10cSrcweir {
772cdf0e10cSrcweir 	aFontSize = Size( 250, 400 );
773cdf0e10cSrcweir 	Initialize();
774cdf0e10cSrcweir }
775cdf0e10cSrcweir 
776cdf0e10cSrcweir /*************************************************************************
777cdf0e10cSrcweir |*
778cdf0e10cSrcweir |* Konstruktor mit Size-Parameter
779cdf0e10cSrcweir |*
780cdf0e10cSrcweir \************************************************************************/
781cdf0e10cSrcweir 
782cdf0e10cSrcweir SvxAngleCtl::SvxAngleCtl( Window* pParent, const ResId& rResId, Size _aSize ) :
783cdf0e10cSrcweir 
784cdf0e10cSrcweir 	SvxRectCtl( pParent, rResId ),
785cdf0e10cSrcweir 
786cdf0e10cSrcweir 	aFont( Application::GetSettings().GetStyleSettings().GetAppFont() )
787cdf0e10cSrcweir {
788cdf0e10cSrcweir     aFontSize = _aSize;
789cdf0e10cSrcweir 	Initialize();
790cdf0e10cSrcweir }
791cdf0e10cSrcweir 
792cdf0e10cSrcweir /*************************************************************************
793cdf0e10cSrcweir |*
794cdf0e10cSrcweir |* Initialisierung
795cdf0e10cSrcweir |*
796cdf0e10cSrcweir \************************************************************************/
797cdf0e10cSrcweir 
798cdf0e10cSrcweir void SvxAngleCtl::Initialize()
799cdf0e10cSrcweir {
800cdf0e10cSrcweir 	bPositive = sal_True;
801cdf0e10cSrcweir 
802cdf0e10cSrcweir 	// aFont.SetName( "Helvetica" );
803cdf0e10cSrcweir 	aFont.SetSize( aFontSize );
804cdf0e10cSrcweir 	aFont.SetWeight( WEIGHT_NORMAL );
805cdf0e10cSrcweir 	aFont.SetTransparent( sal_False );
806cdf0e10cSrcweir 
807cdf0e10cSrcweir 	SetFont( aFont );
808cdf0e10cSrcweir }
809cdf0e10cSrcweir 
810cdf0e10cSrcweir /*************************************************************************
811cdf0e10cSrcweir |*
812cdf0e10cSrcweir |*	Zeichnet das (Mini-)Koordinatensystem
813cdf0e10cSrcweir |*
814cdf0e10cSrcweir \************************************************************************/
815cdf0e10cSrcweir 
816cdf0e10cSrcweir void SvxAngleCtl::Paint( const Rectangle& )
817cdf0e10cSrcweir {
818cdf0e10cSrcweir 	SetLineColor( Color( COL_BLACK ) ); 	// PEN_DOT ???
819cdf0e10cSrcweir 	DrawLine( aPtLT - Point( 0, 0), aPtRB + Point( 0, 0 ) );
820cdf0e10cSrcweir 	DrawLine( aPtLB - Point( 0, 0), aPtRT + Point( 0, 0 ) );
821cdf0e10cSrcweir 
822cdf0e10cSrcweir 	SetLineColor( Color( COL_BLACK ) );
823cdf0e10cSrcweir 	DrawLine( aPtLM - Point( 0, 0), aPtRM + Point( 0, 0 ) );
824cdf0e10cSrcweir 	DrawLine( aPtMT - Point( 0, 0), aPtMB + Point( 0, 0 ) );
825cdf0e10cSrcweir 
826cdf0e10cSrcweir 	Point aDiff(aFontSize.Width() / 2, aFontSize.Height() / 2);
827cdf0e10cSrcweir 
828cdf0e10cSrcweir 	DrawText( aPtLT - aDiff, UniString::CreateFromAscii(
829cdf0e10cSrcweir 		                     RTL_CONSTASCII_STRINGPARAM( "135" ) ) );
830cdf0e10cSrcweir 	DrawText( aPtLM - aDiff, UniString::CreateFromAscii(
831cdf0e10cSrcweir 		                     RTL_CONSTASCII_STRINGPARAM( "180" ) ) );
832cdf0e10cSrcweir 
833cdf0e10cSrcweir 	if ( bPositive )
834cdf0e10cSrcweir 		DrawText( aPtLB - aDiff, UniString::CreateFromAscii(
835cdf0e10cSrcweir 		                         RTL_CONSTASCII_STRINGPARAM( "225" ) ) );
836cdf0e10cSrcweir 	else
837cdf0e10cSrcweir 		DrawText( aPtLB - aDiff, UniString::CreateFromAscii(
838cdf0e10cSrcweir 		                         RTL_CONSTASCII_STRINGPARAM( "-135" ) ) );
839cdf0e10cSrcweir 
840cdf0e10cSrcweir 	aDiff.X() = aFontSize.Width();
841cdf0e10cSrcweir 	DrawText( aPtMT - aDiff, UniString::CreateFromAscii(
842cdf0e10cSrcweir 		                     RTL_CONSTASCII_STRINGPARAM( "90" ) ) );
843cdf0e10cSrcweir 	DrawText( aPtRT - aDiff, UniString::CreateFromAscii(
844cdf0e10cSrcweir 		                     RTL_CONSTASCII_STRINGPARAM( "45" ) ) );
845cdf0e10cSrcweir 	aDiff.X() = aDiff .X() * 3 / 2;
846cdf0e10cSrcweir 
847cdf0e10cSrcweir 	if ( bPositive )
848cdf0e10cSrcweir 		DrawText( aPtMB - aDiff, UniString::CreateFromAscii(
849cdf0e10cSrcweir 		                         RTL_CONSTASCII_STRINGPARAM( "270" ) ) );
850cdf0e10cSrcweir 	else
851cdf0e10cSrcweir 		DrawText( aPtMB - aDiff, UniString::CreateFromAscii(
852cdf0e10cSrcweir 		                         RTL_CONSTASCII_STRINGPARAM( "-90" ) ) );
853cdf0e10cSrcweir 
854cdf0e10cSrcweir 	DrawText( aPtRM - Point( 0, aDiff.Y() ), UniString::CreateFromAscii(
855cdf0e10cSrcweir 		                                     RTL_CONSTASCII_STRINGPARAM( "0" ) ) );
856cdf0e10cSrcweir 	aDiff.X() = aFontSize.Width() * 2;
857cdf0e10cSrcweir 
858cdf0e10cSrcweir 	if ( bPositive )
859cdf0e10cSrcweir 		DrawText( aPtRB - aDiff, UniString::CreateFromAscii(
860cdf0e10cSrcweir 		                         RTL_CONSTASCII_STRINGPARAM( "315" ) ) );
861cdf0e10cSrcweir 	else
862cdf0e10cSrcweir 		DrawText( aPtRB - aDiff, UniString::CreateFromAscii(
863cdf0e10cSrcweir 		                         RTL_CONSTASCII_STRINGPARAM( "-45" ) ) );
864cdf0e10cSrcweir }
865cdf0e10cSrcweir 
866cdf0e10cSrcweir /*************************************************************************
867cdf0e10cSrcweir |*
868cdf0e10cSrcweir |*	Control zum Editieren von Bitmaps
869cdf0e10cSrcweir |*
870cdf0e10cSrcweir \************************************************************************/
871cdf0e10cSrcweir 
872cdf0e10cSrcweir SvxPixelCtl::SvxPixelCtl( Window* pParent, const ResId& rResId, sal_uInt16 nNumber ) :
873cdf0e10cSrcweir 						Control		( pParent, rResId ),
874cdf0e10cSrcweir 						nLines		( nNumber ),
875cdf0e10cSrcweir 						bPaintable	( sal_True )
876cdf0e10cSrcweir {
877cdf0e10cSrcweir 	// SetMapMode( MAP_100TH_MM );
878cdf0e10cSrcweir 	aRectSize = GetOutputSize();
879cdf0e10cSrcweir 
880cdf0e10cSrcweir 	SetPixelColor( Color( COL_BLACK ) );
881cdf0e10cSrcweir 	SetBackgroundColor( Color( COL_WHITE ) );
882cdf0e10cSrcweir 	SetLineColor( Application::GetSettings().GetStyleSettings().GetShadowColor() );
883cdf0e10cSrcweir 
884cdf0e10cSrcweir 	nSquares = nLines * nLines;
885cdf0e10cSrcweir 	pPixel = new sal_uInt16[ nSquares ];
886cdf0e10cSrcweir 	rtl_zeroMemory(pPixel, nSquares * sizeof(sal_uInt16));
887cdf0e10cSrcweir }
888cdf0e10cSrcweir 
889cdf0e10cSrcweir /*************************************************************************
890cdf0e10cSrcweir |*
891cdf0e10cSrcweir |*	Destruktor dealociert dyn. Array
892cdf0e10cSrcweir |*
893cdf0e10cSrcweir \************************************************************************/
894cdf0e10cSrcweir 
895cdf0e10cSrcweir SvxPixelCtl::~SvxPixelCtl( )
896cdf0e10cSrcweir {
897cdf0e10cSrcweir 	delete []pPixel;
898cdf0e10cSrcweir }
899cdf0e10cSrcweir 
900cdf0e10cSrcweir /*************************************************************************
901cdf0e10cSrcweir |*
902cdf0e10cSrcweir |*	Wechselt die Vordergrund- ,bzw. Hintergrundfarbe
903cdf0e10cSrcweir |*
904cdf0e10cSrcweir \************************************************************************/
905cdf0e10cSrcweir 
906cdf0e10cSrcweir void SvxPixelCtl::ChangePixel( sal_uInt16 nPixel )
907cdf0e10cSrcweir {
908cdf0e10cSrcweir 	if( *( pPixel + nPixel) == 0 )
909cdf0e10cSrcweir 		*( pPixel + nPixel) = 1; // koennte erweitert werden auf mehrere Farben
910cdf0e10cSrcweir 	else
911cdf0e10cSrcweir 		*( pPixel + nPixel) = 0;
912cdf0e10cSrcweir }
913cdf0e10cSrcweir 
914cdf0e10cSrcweir /*************************************************************************
915cdf0e10cSrcweir |*
916cdf0e10cSrcweir |*	Das angeklickte Rechteck wird ermittelt um die Farbe zu wechseln
917cdf0e10cSrcweir |*
918cdf0e10cSrcweir \************************************************************************/
919cdf0e10cSrcweir 
920cdf0e10cSrcweir void SvxPixelCtl::MouseButtonDown( const MouseEvent& rMEvt )
921cdf0e10cSrcweir {
922cdf0e10cSrcweir 	Point aPt = PixelToLogic( rMEvt.GetPosPixel() );
923cdf0e10cSrcweir 	Point aPtTl, aPtBr;
924cdf0e10cSrcweir 	sal_uInt16	nX, nY;
925cdf0e10cSrcweir 
926cdf0e10cSrcweir 	nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() );
927cdf0e10cSrcweir 	nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() );
928cdf0e10cSrcweir 
929cdf0e10cSrcweir 	ChangePixel( nX + nY * nLines );
930cdf0e10cSrcweir 
931cdf0e10cSrcweir 	aPtTl.X() = aRectSize.Width() * nX / nLines + 1;
932cdf0e10cSrcweir 	aPtBr.X() = aRectSize.Width() * (nX + 1) / nLines - 1;
933cdf0e10cSrcweir 	aPtTl.Y() = aRectSize.Height() * nY / nLines + 1;
934cdf0e10cSrcweir 	aPtBr.Y() = aRectSize.Height() * (nY + 1) / nLines - 1;
935cdf0e10cSrcweir 
936cdf0e10cSrcweir 	Invalidate( Rectangle( aPtTl, aPtBr ) );
937cdf0e10cSrcweir 
938cdf0e10cSrcweir 	if( WINDOW_TABPAGE == GetParent()->GetType() )
939cdf0e10cSrcweir 		( (SvxTabPage*) GetParent() )->PointChanged( this, RP_MM ); // RectPoint ist dummy
940cdf0e10cSrcweir }
941cdf0e10cSrcweir 
942cdf0e10cSrcweir /*************************************************************************
943cdf0e10cSrcweir |*
944cdf0e10cSrcweir |*	Zeichnet das Control (Rechteck mit 9 Kreisen)
945cdf0e10cSrcweir |*
946cdf0e10cSrcweir \************************************************************************/
947cdf0e10cSrcweir 
948cdf0e10cSrcweir void SvxPixelCtl::Paint( const Rectangle& )
949cdf0e10cSrcweir {
950cdf0e10cSrcweir 	sal_uInt16	i, j, nTmp;
951cdf0e10cSrcweir 	Point	aPtTl, aPtBr;
952cdf0e10cSrcweir 
953cdf0e10cSrcweir 	if( bPaintable )
954cdf0e10cSrcweir 	{
955cdf0e10cSrcweir 		// Linien Zeichnen
956cdf0e10cSrcweir 		Control::SetLineColor( aLineColor );
957cdf0e10cSrcweir 		for( i = 1; i < nLines; i++)
958cdf0e10cSrcweir 		{
959cdf0e10cSrcweir 			// horizontal
960cdf0e10cSrcweir 			nTmp = (sal_uInt16) ( aRectSize.Height() * i / nLines );
961cdf0e10cSrcweir 			DrawLine( Point( 0, nTmp ), Point( aRectSize.Width(), nTmp ) );
962cdf0e10cSrcweir 			// vertikal
963cdf0e10cSrcweir 			nTmp = (sal_uInt16) ( aRectSize.Width() * i / nLines );
964cdf0e10cSrcweir 			DrawLine( Point( nTmp, 0 ), Point( nTmp, aRectSize.Height() ) );
965cdf0e10cSrcweir 		}
966cdf0e10cSrcweir 
967cdf0e10cSrcweir 		// Rechtecke (Quadrate) zeichnen
968cdf0e10cSrcweir 		Control::SetLineColor();
969cdf0e10cSrcweir 		sal_uInt16 nLastPixel = *pPixel ? 0 : 1;
970cdf0e10cSrcweir 
971cdf0e10cSrcweir 		for( i = 0; i < nLines; i++)
972cdf0e10cSrcweir 		{
973cdf0e10cSrcweir 			aPtTl.Y() = aRectSize.Height() * i / nLines + 1;
974cdf0e10cSrcweir 			aPtBr.Y() = aRectSize.Height() * (i + 1) / nLines - 1;
975cdf0e10cSrcweir 
976cdf0e10cSrcweir 			for( j = 0; j < nLines; j++)
977cdf0e10cSrcweir 			{
978cdf0e10cSrcweir 				aPtTl.X() = aRectSize.Width() * j / nLines + 1;
979cdf0e10cSrcweir 				aPtBr.X() = aRectSize.Width() * (j + 1) / nLines - 1;
980cdf0e10cSrcweir 
981cdf0e10cSrcweir 				if ( *( pPixel + i * nLines + j ) != nLastPixel )
982cdf0e10cSrcweir 				{
983cdf0e10cSrcweir 					nLastPixel = *( pPixel + i * nLines + j );
984cdf0e10cSrcweir 					// Farbe wechseln: 0 -> Hintergrundfarbe
985cdf0e10cSrcweir 					SetFillColor( nLastPixel ? aPixelColor : aBackgroundColor );
986cdf0e10cSrcweir 				}
987cdf0e10cSrcweir 				DrawRect( Rectangle( aPtTl, aPtBr ) );
988cdf0e10cSrcweir 			}
989cdf0e10cSrcweir 		}
990cdf0e10cSrcweir 	} // bPaintable
991cdf0e10cSrcweir 	else
992cdf0e10cSrcweir 	{
993cdf0e10cSrcweir 		SetBackground( Wallpaper( Color( COL_LIGHTGRAY ) ) );
994cdf0e10cSrcweir 		Control::SetLineColor( Color( COL_LIGHTRED ) );
995cdf0e10cSrcweir 		DrawLine( Point( 0, 0 ), Point( aRectSize.Width(), aRectSize.Height() ) );
996cdf0e10cSrcweir 		DrawLine( Point( 0, aRectSize.Height() ), Point( aRectSize.Width(), 0 ) );
997cdf0e10cSrcweir 	}
998cdf0e10cSrcweir }
999cdf0e10cSrcweir 
1000cdf0e10cSrcweir /*************************************************************************
1001cdf0e10cSrcweir |*
1002cdf0e10cSrcweir |*
1003cdf0e10cSrcweir |*
1004cdf0e10cSrcweir \************************************************************************/
1005cdf0e10cSrcweir 
1006cdf0e10cSrcweir void SvxPixelCtl::SetXBitmap( const XOBitmap& rXBmp )
1007cdf0e10cSrcweir {
1008cdf0e10cSrcweir 	if( rXBmp.GetBitmapType() == XBITMAP_8X8 )
1009cdf0e10cSrcweir 	{
1010cdf0e10cSrcweir 		aPixelColor = rXBmp.GetPixelColor();
1011cdf0e10cSrcweir 		aBackgroundColor = rXBmp.GetBackgroundColor();
1012cdf0e10cSrcweir 
1013cdf0e10cSrcweir 		sal_uInt16* pArray = rXBmp.GetPixelArray();
1014cdf0e10cSrcweir 
1015cdf0e10cSrcweir 		for( sal_uInt16 i = 0; i < nSquares; i++ )
1016cdf0e10cSrcweir 			*( pPixel + i ) = *( pArray + i );
1017cdf0e10cSrcweir 	}
1018cdf0e10cSrcweir }
1019cdf0e10cSrcweir 
1020cdf0e10cSrcweir /*************************************************************************
1021cdf0e10cSrcweir |*
1022cdf0e10cSrcweir |*	Gibt ein bestimmtes Pixel zurueck
1023cdf0e10cSrcweir |*
1024cdf0e10cSrcweir \************************************************************************/
1025cdf0e10cSrcweir 
1026cdf0e10cSrcweir sal_uInt16 SvxPixelCtl::GetBitmapPixel( const sal_uInt16 nPixel )
1027cdf0e10cSrcweir {
1028cdf0e10cSrcweir 	return( *( pPixel + nPixel ) );
1029cdf0e10cSrcweir }
1030cdf0e10cSrcweir 
1031cdf0e10cSrcweir /*************************************************************************
1032cdf0e10cSrcweir |*
1033cdf0e10cSrcweir |*	Bewirkt den Ursprungszustand des Controls
1034cdf0e10cSrcweir |*
1035cdf0e10cSrcweir \************************************************************************/
1036cdf0e10cSrcweir 
1037cdf0e10cSrcweir void SvxPixelCtl::Reset()
1038cdf0e10cSrcweir {
1039cdf0e10cSrcweir 	// clear pixel area
1040cdf0e10cSrcweir 	rtl_zeroMemory(pPixel, nSquares * sizeof(sal_uInt16));
1041cdf0e10cSrcweir 	Invalidate();
1042cdf0e10cSrcweir }
1043cdf0e10cSrcweir 
1044cdf0e10cSrcweir /*************************************************************************
1045cdf0e10cSrcweir |*
1046cdf0e10cSrcweir |*	Ctor: BitmapCtl fuer SvxPixelCtl
1047cdf0e10cSrcweir |*
1048cdf0e10cSrcweir \************************************************************************/
1049cdf0e10cSrcweir 
1050cdf0e10cSrcweir SvxBitmapCtl::SvxBitmapCtl( Window* /*pParent*/, const Size& rSize )
1051cdf0e10cSrcweir {
1052cdf0e10cSrcweir 	aSize = rSize;
1053cdf0e10cSrcweir 	// aVD.SetOutputSizePixel( aSize );
1054cdf0e10cSrcweir }
1055cdf0e10cSrcweir 
1056cdf0e10cSrcweir /*************************************************************************
1057cdf0e10cSrcweir |*
1058cdf0e10cSrcweir |*	Dtor
1059cdf0e10cSrcweir |*
1060cdf0e10cSrcweir \************************************************************************/
1061cdf0e10cSrcweir 
1062cdf0e10cSrcweir SvxBitmapCtl::~SvxBitmapCtl()
1063cdf0e10cSrcweir {
1064cdf0e10cSrcweir }
1065cdf0e10cSrcweir 
1066cdf0e10cSrcweir /*************************************************************************
1067cdf0e10cSrcweir |*
1068cdf0e10cSrcweir |*	BitmapCtl:	Gibt die Bitmap zurueck
1069cdf0e10cSrcweir |*
1070cdf0e10cSrcweir \************************************************************************/
1071cdf0e10cSrcweir 
1072cdf0e10cSrcweir XOBitmap SvxBitmapCtl::GetXBitmap()
1073cdf0e10cSrcweir {
1074cdf0e10cSrcweir 	XOBitmap aXOBitmap( pBmpArray, aPixelColor, aBackgroundColor );
1075cdf0e10cSrcweir 
1076cdf0e10cSrcweir 	return( aXOBitmap );
1077cdf0e10cSrcweir }
1078cdf0e10cSrcweir 
1079cdf0e10cSrcweir /*************************************************************************
1080cdf0e10cSrcweir |*
1081cdf0e10cSrcweir |*	Fuellt die Listbox mit Farben und Strings
1082cdf0e10cSrcweir |*
1083cdf0e10cSrcweir \************************************************************************/
1084cdf0e10cSrcweir 
1085cdf0e10cSrcweir void ColorLB::Fill( const XColorTable* pColorTab )
1086cdf0e10cSrcweir {
1087cdf0e10cSrcweir 	long nCount = pColorTab->Count();
1088cdf0e10cSrcweir 	XColorEntry* pEntry;
1089cdf0e10cSrcweir 	SetUpdateMode( sal_False );
1090cdf0e10cSrcweir 
1091cdf0e10cSrcweir 	for( long i = 0; i < nCount; i++ )
1092cdf0e10cSrcweir 	{
1093cdf0e10cSrcweir         pEntry = pColorTab->GetColor( i );
1094cdf0e10cSrcweir 		InsertEntry( pEntry->GetColor(), pEntry->GetName() );
1095cdf0e10cSrcweir 	}
1096cdf0e10cSrcweir 	SetUpdateMode( sal_True );
1097cdf0e10cSrcweir }
1098cdf0e10cSrcweir 
1099cdf0e10cSrcweir /************************************************************************/
1100cdf0e10cSrcweir 
1101cdf0e10cSrcweir void ColorLB::Append( XColorEntry* pEntry, Bitmap* )
1102cdf0e10cSrcweir {
1103cdf0e10cSrcweir 	InsertEntry( pEntry->GetColor(), pEntry->GetName() );
1104cdf0e10cSrcweir }
1105cdf0e10cSrcweir 
1106cdf0e10cSrcweir /************************************************************************/
1107cdf0e10cSrcweir 
1108cdf0e10cSrcweir void ColorLB::Modify( XColorEntry* pEntry, sal_uInt16 nPos, Bitmap*  )
1109cdf0e10cSrcweir {
1110cdf0e10cSrcweir 	RemoveEntry( nPos );
1111cdf0e10cSrcweir 	InsertEntry( pEntry->GetColor(), pEntry->GetName(), nPos );
1112cdf0e10cSrcweir }
1113cdf0e10cSrcweir 
1114cdf0e10cSrcweir /*************************************************************************
1115cdf0e10cSrcweir |*
1116cdf0e10cSrcweir |*	Fuellt die Listbox mit Farben und Strings
1117cdf0e10cSrcweir |*
1118cdf0e10cSrcweir \************************************************************************/
1119cdf0e10cSrcweir 
1120cdf0e10cSrcweir void FillAttrLB::Fill( const XColorTable* pColorTab )
1121cdf0e10cSrcweir {
1122cdf0e10cSrcweir 	long nCount = pColorTab->Count();
1123cdf0e10cSrcweir 	XColorEntry* pEntry;
1124cdf0e10cSrcweir 	SetUpdateMode( sal_False );
1125cdf0e10cSrcweir 
1126cdf0e10cSrcweir 	for( long i = 0; i < nCount; i++ )
1127cdf0e10cSrcweir 	{
1128cdf0e10cSrcweir         pEntry = pColorTab->GetColor( i );
1129cdf0e10cSrcweir 		InsertEntry( pEntry->GetColor(), pEntry->GetName() );
1130cdf0e10cSrcweir 	}
1131cdf0e10cSrcweir 	SetUpdateMode( sal_True );
1132cdf0e10cSrcweir }
1133cdf0e10cSrcweir 
1134cdf0e10cSrcweir /*************************************************************************
1135cdf0e10cSrcweir |*
1136cdf0e10cSrcweir |*	Fuellt die Listbox (vorlaeufig) mit Strings
1137cdf0e10cSrcweir |*
1138cdf0e10cSrcweir \************************************************************************/
1139cdf0e10cSrcweir 
1140cdf0e10cSrcweir HatchingLB::HatchingLB( Window* pParent, ResId Id, sal_Bool bUserDraw /*= sal_True*/ )
1141cdf0e10cSrcweir : ListBox( pParent, Id ),
1142cdf0e10cSrcweir   mpList ( NULL ),
1143cdf0e10cSrcweir   mbUserDraw( bUserDraw )
1144cdf0e10cSrcweir {
1145cdf0e10cSrcweir 	EnableUserDraw( mbUserDraw );
1146cdf0e10cSrcweir }
1147cdf0e10cSrcweir 
1148cdf0e10cSrcweir HatchingLB::HatchingLB( Window* pParent, WinBits aWB, sal_Bool bUserDraw /*= sal_True*/ )
1149cdf0e10cSrcweir : ListBox( pParent, aWB ),
1150cdf0e10cSrcweir   mpList ( NULL ),
1151cdf0e10cSrcweir   mbUserDraw( bUserDraw )
1152cdf0e10cSrcweir {
1153cdf0e10cSrcweir 	EnableUserDraw( mbUserDraw );
1154cdf0e10cSrcweir }
1155cdf0e10cSrcweir 
1156cdf0e10cSrcweir void HatchingLB::Fill( const XHatchList* pList )
1157cdf0e10cSrcweir {
1158cdf0e10cSrcweir 	mpList = (XHatchList*)pList;
1159cdf0e10cSrcweir 	XHatchEntry* pEntry;
1160cdf0e10cSrcweir 	long nCount = pList->Count();
1161cdf0e10cSrcweir 
1162cdf0e10cSrcweir 	SetUpdateMode( sal_False );
1163cdf0e10cSrcweir 
1164cdf0e10cSrcweir 	if( mbUserDraw )
1165cdf0e10cSrcweir 	{
1166cdf0e10cSrcweir 		for( long i = 0; i < nCount; i++ )
1167cdf0e10cSrcweir             InsertEntry( pList->GetHatch( i )->GetName() );
1168cdf0e10cSrcweir 	}
1169cdf0e10cSrcweir 	else
1170cdf0e10cSrcweir 	{
1171cdf0e10cSrcweir 		for( long i = 0; i < nCount; i++ )
1172cdf0e10cSrcweir 		{
1173cdf0e10cSrcweir             pEntry = pList->GetHatch( i );
1174cdf0e10cSrcweir 			Bitmap* pBitmap = pList->GetBitmap( i );
1175cdf0e10cSrcweir 			if( pBitmap )
1176cdf0e10cSrcweir 				InsertEntry( pEntry->GetName(), *pBitmap );
1177cdf0e10cSrcweir 			else
1178cdf0e10cSrcweir 				InsertEntry( pEntry->GetName() );
1179cdf0e10cSrcweir 		}
1180cdf0e10cSrcweir 	}
1181cdf0e10cSrcweir 
1182cdf0e10cSrcweir 	SetUpdateMode( sal_True );
1183cdf0e10cSrcweir }
1184cdf0e10cSrcweir 
1185cdf0e10cSrcweir void HatchingLB::UserDraw( const UserDrawEvent& rUDEvt )
1186cdf0e10cSrcweir {
1187cdf0e10cSrcweir 	if( mpList != NULL )
1188cdf0e10cSrcweir 	{
1189cdf0e10cSrcweir 		// Draw gradient with borderrectangle
1190cdf0e10cSrcweir 		const Rectangle& rDrawRect = rUDEvt.GetRect();
1191cdf0e10cSrcweir 		Rectangle aRect( rDrawRect.nLeft+1, rDrawRect.nTop+1, rDrawRect.nLeft+33, rDrawRect.nBottom-1 );
1192cdf0e10cSrcweir 
1193cdf0e10cSrcweir         sal_Int32 nId = rUDEvt.GetItemId();
1194cdf0e10cSrcweir 		if( nId >= 0 && nId <= mpList->Count() )
1195cdf0e10cSrcweir 		{
1196cdf0e10cSrcweir 			OutputDevice* pDevice = rUDEvt.GetDevice();
1197cdf0e10cSrcweir 
1198cdf0e10cSrcweir 			sal_uIntPtr nOldDrawMode = pDevice->GetDrawMode();
1199cdf0e10cSrcweir 		    pDevice->SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
1200cdf0e10cSrcweir 
1201cdf0e10cSrcweir             XHatch& rXHatch = mpList->GetHatch( rUDEvt.GetItemId() )->GetHatch();
1202cdf0e10cSrcweir 			MapMode aMode( MAP_100TH_MM );
1203cdf0e10cSrcweir 			Hatch aHatch( (HatchStyle) rXHatch.GetHatchStyle(),
1204cdf0e10cSrcweir 						  rXHatch.GetColor(),
1205cdf0e10cSrcweir 						  rUDEvt.GetDevice()->LogicToPixel( Point( rXHatch.GetDistance(), 0 ), aMode ).X(),
1206cdf0e10cSrcweir 						  (sal_uInt16)rXHatch.GetAngle() );
1207cdf0e10cSrcweir 			const Polygon aPolygon( aRect );
1208cdf0e10cSrcweir 			const PolyPolygon aPolypoly( aPolygon );
1209cdf0e10cSrcweir 			pDevice->DrawHatch( aPolypoly, aHatch );
1210cdf0e10cSrcweir 
1211cdf0e10cSrcweir 			pDevice->SetLineColor( COL_BLACK );
1212cdf0e10cSrcweir 			pDevice->SetFillColor();
1213cdf0e10cSrcweir 			pDevice->DrawRect( aRect );
1214cdf0e10cSrcweir 
1215cdf0e10cSrcweir 			pDevice->SetDrawMode( nOldDrawMode );
1216cdf0e10cSrcweir 
1217cdf0e10cSrcweir 			// Draw name
1218cdf0e10cSrcweir             pDevice->DrawText( Point( aRect.nRight+7, aRect.nTop-1 ), mpList->GetHatch( rUDEvt.GetItemId() )->GetName() );
1219cdf0e10cSrcweir 		}
1220cdf0e10cSrcweir 	}
1221cdf0e10cSrcweir }
1222cdf0e10cSrcweir 
1223cdf0e10cSrcweir /************************************************************************/
1224cdf0e10cSrcweir 
1225cdf0e10cSrcweir void HatchingLB::Append( XHatchEntry* pEntry, Bitmap* pBmp )
1226cdf0e10cSrcweir {
1227cdf0e10cSrcweir 	if( pBmp )
1228cdf0e10cSrcweir 		InsertEntry( pEntry->GetName(), *pBmp );
1229cdf0e10cSrcweir 	else
1230cdf0e10cSrcweir 		InsertEntry( pEntry->GetName() );
1231cdf0e10cSrcweir }
1232cdf0e10cSrcweir 
1233cdf0e10cSrcweir /************************************************************************/
1234cdf0e10cSrcweir 
1235cdf0e10cSrcweir void HatchingLB::Modify( XHatchEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp )
1236cdf0e10cSrcweir {
1237cdf0e10cSrcweir 	RemoveEntry( nPos );
1238cdf0e10cSrcweir 
1239cdf0e10cSrcweir 	if( pBmp )
1240cdf0e10cSrcweir 		InsertEntry( pEntry->GetName(), *pBmp, nPos );
1241cdf0e10cSrcweir 	else
1242cdf0e10cSrcweir 		InsertEntry( pEntry->GetName(), nPos );
1243cdf0e10cSrcweir }
1244cdf0e10cSrcweir 
1245cdf0e10cSrcweir /************************************************************************/
1246cdf0e10cSrcweir 
1247cdf0e10cSrcweir void HatchingLB::SelectEntryByList( const XHatchList* pList, const String& rStr,
1248cdf0e10cSrcweir 									const XHatch& rHatch, sal_uInt16 nDist )
1249cdf0e10cSrcweir {
1250cdf0e10cSrcweir 	long nCount = pList->Count();
1251cdf0e10cSrcweir 	XHatchEntry* pEntry;
1252cdf0e10cSrcweir 	sal_Bool bFound = sal_False;
1253cdf0e10cSrcweir 	String aStr;
1254cdf0e10cSrcweir 
1255cdf0e10cSrcweir 	long i;
1256cdf0e10cSrcweir 	for( i = 0; i < nCount && !bFound; i++ )
1257cdf0e10cSrcweir 	{
1258cdf0e10cSrcweir         pEntry = pList->GetHatch( i );
1259cdf0e10cSrcweir 
1260cdf0e10cSrcweir 		aStr = pEntry->GetName();
1261cdf0e10cSrcweir 
1262cdf0e10cSrcweir 		if( rStr == aStr && rHatch == pEntry->GetHatch() )
1263cdf0e10cSrcweir 			bFound = sal_True;
1264cdf0e10cSrcweir 	}
1265cdf0e10cSrcweir 	if( bFound )
1266cdf0e10cSrcweir 		SelectEntryPos( (sal_uInt16) ( i - 1 + nDist ) );
1267cdf0e10cSrcweir }
1268cdf0e10cSrcweir 
1269cdf0e10cSrcweir /*************************************************************************
1270cdf0e10cSrcweir |*
1271cdf0e10cSrcweir |*	Fuellt die Listbox (vorlaeufig) mit Strings
1272cdf0e10cSrcweir |*
1273cdf0e10cSrcweir \************************************************************************/
1274cdf0e10cSrcweir 
1275cdf0e10cSrcweir void FillAttrLB::Fill( const XHatchList* pList )
1276cdf0e10cSrcweir {
1277cdf0e10cSrcweir 	long nCount = pList->Count();
1278cdf0e10cSrcweir 	XHatchEntry* pEntry;
1279cdf0e10cSrcweir 	ListBox::SetUpdateMode( sal_False );
1280cdf0e10cSrcweir 
1281cdf0e10cSrcweir 	for( long i = 0; i < nCount; i++ )
1282cdf0e10cSrcweir 	{
1283cdf0e10cSrcweir         pEntry = pList->GetHatch( i );
1284cdf0e10cSrcweir 		Bitmap* pBitmap = pList->GetBitmap( i );
1285cdf0e10cSrcweir 		if( pBitmap )
1286cdf0e10cSrcweir 			ListBox::InsertEntry( pEntry->GetName(), *pBitmap );
1287cdf0e10cSrcweir 		else
1288cdf0e10cSrcweir 			InsertEntry( pEntry->GetName() );
1289cdf0e10cSrcweir 	}
1290cdf0e10cSrcweir 	ListBox::SetUpdateMode( sal_True );
1291cdf0e10cSrcweir }
1292cdf0e10cSrcweir 
1293cdf0e10cSrcweir /*************************************************************************
1294cdf0e10cSrcweir |*
1295cdf0e10cSrcweir |*	Fuellt die Listbox (vorlaeufig) mit Strings
1296cdf0e10cSrcweir |*
1297cdf0e10cSrcweir \************************************************************************/
1298cdf0e10cSrcweir 
1299cdf0e10cSrcweir GradientLB::GradientLB( Window* pParent, ResId Id, sal_Bool bUserDraw /*= sal_True*/ )
1300cdf0e10cSrcweir : ListBox( pParent, Id ),
1301cdf0e10cSrcweir   mpList(NULL),
1302cdf0e10cSrcweir   mbUserDraw( bUserDraw )
1303cdf0e10cSrcweir {
1304cdf0e10cSrcweir 	EnableUserDraw( mbUserDraw);
1305cdf0e10cSrcweir }
1306cdf0e10cSrcweir 
1307cdf0e10cSrcweir GradientLB::GradientLB( Window* pParent, WinBits aWB, sal_Bool bUserDraw /*= sal_True*/ )
1308cdf0e10cSrcweir : ListBox( pParent, aWB ),
1309cdf0e10cSrcweir   mpList(NULL),
1310cdf0e10cSrcweir   mbUserDraw( bUserDraw )
1311cdf0e10cSrcweir {
1312cdf0e10cSrcweir 	EnableUserDraw( mbUserDraw );
1313cdf0e10cSrcweir }
1314cdf0e10cSrcweir 
1315cdf0e10cSrcweir void GradientLB::Fill( const XGradientList* pList )
1316cdf0e10cSrcweir {
1317cdf0e10cSrcweir 	mpList = (XGradientList*)pList;
1318cdf0e10cSrcweir 	XGradientEntry* pEntry;
1319cdf0e10cSrcweir 	long nCount = pList->Count();
1320cdf0e10cSrcweir 
1321cdf0e10cSrcweir 	SetUpdateMode( sal_False );
1322cdf0e10cSrcweir 
1323cdf0e10cSrcweir 	if( mbUserDraw )
1324cdf0e10cSrcweir 	{
1325cdf0e10cSrcweir 		for( long i = 0; i < nCount; i++ )
1326cdf0e10cSrcweir             InsertEntry( pList->GetGradient( i )->GetName() );
1327cdf0e10cSrcweir 	}
1328cdf0e10cSrcweir 	else
1329cdf0e10cSrcweir 	{
1330cdf0e10cSrcweir 		for( long i = 0; i < nCount; i++ )
1331cdf0e10cSrcweir 		{
1332cdf0e10cSrcweir             pEntry = pList->GetGradient( i );
1333cdf0e10cSrcweir 			Bitmap* pBitmap = pList->GetBitmap( i );
1334cdf0e10cSrcweir 			if( pBitmap )
1335cdf0e10cSrcweir 				InsertEntry( pEntry->GetName(), *pBitmap );
1336cdf0e10cSrcweir 			else
1337cdf0e10cSrcweir 				InsertEntry( pEntry->GetName() );
1338cdf0e10cSrcweir 		}
1339cdf0e10cSrcweir 	}
1340cdf0e10cSrcweir 
1341cdf0e10cSrcweir 	SetUpdateMode( sal_True );
1342cdf0e10cSrcweir }
1343cdf0e10cSrcweir 
1344cdf0e10cSrcweir void GradientLB::UserDraw( const UserDrawEvent& rUDEvt )
1345cdf0e10cSrcweir {
1346cdf0e10cSrcweir 	if( mpList != NULL )
1347cdf0e10cSrcweir 	{
1348cdf0e10cSrcweir 		// Draw gradient with borderrectangle
1349cdf0e10cSrcweir 		const Rectangle& rDrawRect = rUDEvt.GetRect();
1350cdf0e10cSrcweir 		Rectangle aRect( rDrawRect.nLeft+1, rDrawRect.nTop+1, rDrawRect.nLeft+33, rDrawRect.nBottom-1 );
1351cdf0e10cSrcweir 
1352cdf0e10cSrcweir         sal_Int32 nId = rUDEvt.GetItemId();
1353cdf0e10cSrcweir 		if( nId >= 0 && nId <= mpList->Count() )
1354cdf0e10cSrcweir 		{
1355cdf0e10cSrcweir 			OutputDevice* pDevice = rUDEvt.GetDevice();
1356cdf0e10cSrcweir 
1357cdf0e10cSrcweir             XGradient& rXGrad = mpList->GetGradient( rUDEvt.GetItemId() )->GetGradient();
1358cdf0e10cSrcweir 			Gradient aGradient( (GradientStyle) rXGrad.GetGradientStyle(), rXGrad.GetStartColor(), rXGrad.GetEndColor() );
1359cdf0e10cSrcweir 			aGradient.SetAngle( (sal_uInt16)rXGrad.GetAngle() );
1360cdf0e10cSrcweir 			aGradient.SetBorder( rXGrad.GetBorder() );
1361cdf0e10cSrcweir 			aGradient.SetOfsX( rXGrad.GetXOffset() );
1362cdf0e10cSrcweir 			aGradient.SetOfsY( rXGrad.GetYOffset() );
1363cdf0e10cSrcweir 			aGradient.SetStartIntensity( rXGrad.GetStartIntens() );
1364cdf0e10cSrcweir 			aGradient.SetEndIntensity( rXGrad.GetEndIntens() );
1365cdf0e10cSrcweir 			aGradient.SetSteps( 255 );
1366cdf0e10cSrcweir 
1367cdf0e10cSrcweir             // #i76307# always paint the preview in LTR, because this is what the document does
1368cdf0e10cSrcweir             Window* pWin = dynamic_cast<Window*>(pDevice);
1369cdf0e10cSrcweir             if( pWin && pWin->IsRTLEnabled() && Application::GetSettings().GetLayoutRTL())
1370cdf0e10cSrcweir             {
1371cdf0e10cSrcweir                 long nWidth = pDevice->GetOutputSize().Width();
1372cdf0e10cSrcweir 
1373cdf0e10cSrcweir                 pWin->EnableRTL( sal_False );
1374cdf0e10cSrcweir 
1375cdf0e10cSrcweir                 Rectangle aMirrorRect( Point( nWidth - aRect.Left() - aRect.GetWidth(), aRect.Top() ),
1376cdf0e10cSrcweir                                        aRect.GetSize() );
1377cdf0e10cSrcweir 
1378cdf0e10cSrcweir                 pDevice->DrawGradient( aMirrorRect, aGradient );
1379cdf0e10cSrcweir 
1380cdf0e10cSrcweir                 pWin->EnableRTL( sal_True );
1381cdf0e10cSrcweir             }
1382cdf0e10cSrcweir             else
1383cdf0e10cSrcweir                 pDevice->DrawGradient( aRect, aGradient );
1384cdf0e10cSrcweir 
1385cdf0e10cSrcweir 			pDevice->SetLineColor( COL_BLACK );
1386cdf0e10cSrcweir 			pDevice->SetFillColor();
1387cdf0e10cSrcweir 			pDevice->DrawRect( aRect );
1388cdf0e10cSrcweir 
1389cdf0e10cSrcweir 			// Draw name
1390cdf0e10cSrcweir             pDevice->DrawText( Point( aRect.nRight+7, aRect.nTop-1 ), mpList->GetGradient( rUDEvt.GetItemId() )->GetName() );
1391cdf0e10cSrcweir 		}
1392cdf0e10cSrcweir 	}
1393cdf0e10cSrcweir }
1394cdf0e10cSrcweir 
1395cdf0e10cSrcweir /************************************************************************/
1396cdf0e10cSrcweir 
1397cdf0e10cSrcweir void GradientLB::Append( XGradientEntry* pEntry, Bitmap* pBmp )
1398cdf0e10cSrcweir {
1399cdf0e10cSrcweir 	if( pBmp )
1400cdf0e10cSrcweir 		InsertEntry( pEntry->GetName(), *pBmp );
1401cdf0e10cSrcweir 	else
1402cdf0e10cSrcweir 		InsertEntry( pEntry->GetName() );
1403cdf0e10cSrcweir }
1404cdf0e10cSrcweir 
1405cdf0e10cSrcweir /************************************************************************/
1406cdf0e10cSrcweir 
1407cdf0e10cSrcweir void GradientLB::Modify( XGradientEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp )
1408cdf0e10cSrcweir {
1409cdf0e10cSrcweir 	RemoveEntry( nPos );
1410cdf0e10cSrcweir 
1411cdf0e10cSrcweir 	if( pBmp )
1412cdf0e10cSrcweir 		InsertEntry( pEntry->GetName(), *pBmp, nPos );
1413cdf0e10cSrcweir 	else
1414cdf0e10cSrcweir 		InsertEntry( pEntry->GetName(), nPos );
1415cdf0e10cSrcweir }
1416cdf0e10cSrcweir 
1417cdf0e10cSrcweir /************************************************************************/
1418cdf0e10cSrcweir 
1419cdf0e10cSrcweir void GradientLB::SelectEntryByList( const XGradientList* pList, const String& rStr,
1420cdf0e10cSrcweir 								const XGradient& rGradient, sal_uInt16 nDist )
1421cdf0e10cSrcweir {
1422cdf0e10cSrcweir 	long nCount = pList->Count();
1423cdf0e10cSrcweir 	XGradientEntry* pEntry;
1424cdf0e10cSrcweir 	sal_Bool bFound = sal_False;
1425cdf0e10cSrcweir 	String aStr;
1426cdf0e10cSrcweir 
1427cdf0e10cSrcweir 	long i;
1428cdf0e10cSrcweir 	for( i = 0; i < nCount && !bFound; i++ )
1429cdf0e10cSrcweir 	{
1430cdf0e10cSrcweir         pEntry = pList->GetGradient( i );
1431cdf0e10cSrcweir 
1432cdf0e10cSrcweir 		aStr = pEntry->GetName();
1433cdf0e10cSrcweir 
1434cdf0e10cSrcweir 		if( rStr == aStr && rGradient == pEntry->GetGradient() )
1435cdf0e10cSrcweir 			bFound = sal_True;
1436cdf0e10cSrcweir 	}
1437cdf0e10cSrcweir 	if( bFound )
1438cdf0e10cSrcweir 		SelectEntryPos( (sal_uInt16) ( i - 1 + nDist ) );
1439cdf0e10cSrcweir }
1440cdf0e10cSrcweir 
1441cdf0e10cSrcweir /*************************************************************************
1442cdf0e10cSrcweir |*
1443cdf0e10cSrcweir |*	Fuellt die Listbox (vorlaeufig) mit Strings
1444cdf0e10cSrcweir |*
1445cdf0e10cSrcweir \************************************************************************/
1446cdf0e10cSrcweir 
1447cdf0e10cSrcweir void FillAttrLB::Fill( const XGradientList* pList )
1448cdf0e10cSrcweir {
1449cdf0e10cSrcweir 	long nCount = pList->Count();
1450cdf0e10cSrcweir 	XGradientEntry* pEntry;
1451cdf0e10cSrcweir 	ListBox::SetUpdateMode( sal_False );
1452cdf0e10cSrcweir 
1453cdf0e10cSrcweir 	for( long i = 0; i < nCount; i++ )
1454cdf0e10cSrcweir 	{
1455cdf0e10cSrcweir         pEntry = pList->GetGradient( i );
1456cdf0e10cSrcweir 		Bitmap* pBitmap = pList->GetBitmap( i );
1457cdf0e10cSrcweir 		if( pBitmap )
1458cdf0e10cSrcweir 			ListBox::InsertEntry( pEntry->GetName(), *pBitmap );
1459cdf0e10cSrcweir 		else
1460cdf0e10cSrcweir 			InsertEntry( pEntry->GetName() );
1461cdf0e10cSrcweir 	}
1462cdf0e10cSrcweir 	ListBox::SetUpdateMode( sal_True );
1463cdf0e10cSrcweir }
1464cdf0e10cSrcweir 
1465cdf0e10cSrcweir /*************************************************************************
1466cdf0e10cSrcweir |*
1467cdf0e10cSrcweir |*	Konstruktor von BitmapLB
1468cdf0e10cSrcweir |*
1469cdf0e10cSrcweir \************************************************************************/
1470cdf0e10cSrcweir 
1471cdf0e10cSrcweir BitmapLB::BitmapLB( Window* pParent, ResId Id, sal_Bool bUserDraw /*= sal_True*/ )
1472cdf0e10cSrcweir : ListBox( pParent, Id ),
1473cdf0e10cSrcweir   mpList( NULL ),
1474cdf0e10cSrcweir   mbUserDraw( bUserDraw )
1475cdf0e10cSrcweir {
1476cdf0e10cSrcweir 	aVD.SetOutputSizePixel( Size( 32, 16 ) );
1477cdf0e10cSrcweir 	EnableUserDraw( mbUserDraw );
1478cdf0e10cSrcweir }
1479cdf0e10cSrcweir 
1480cdf0e10cSrcweir /************************************************************************/
1481cdf0e10cSrcweir 
1482cdf0e10cSrcweir void BitmapLB::SetVirtualDevice()
1483cdf0e10cSrcweir {
1484cdf0e10cSrcweir 	if( aBitmap.GetSizePixel().Width() > 8 ||
1485cdf0e10cSrcweir 		aBitmap.GetSizePixel().Height() > 8 )
1486cdf0e10cSrcweir 	{
1487cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 0, 0 ), Size( 32, 16 ), aBitmap );
1488cdf0e10cSrcweir 	}
1489cdf0e10cSrcweir 	else
1490cdf0e10cSrcweir 	{
1491cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 0, 0 ), aBitmap );
1492cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 8, 0 ), aBitmap );
1493cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 16, 0 ), aBitmap );
1494cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 24, 0 ), aBitmap );
1495cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 0, 8 ), aBitmap );
1496cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 8, 8 ), aBitmap );
1497cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 16, 8 ), aBitmap );
1498cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 24, 8 ), aBitmap );
1499cdf0e10cSrcweir 	}
1500cdf0e10cSrcweir }
1501cdf0e10cSrcweir 
1502cdf0e10cSrcweir /************************************************************************/
1503cdf0e10cSrcweir 
1504cdf0e10cSrcweir void BitmapLB::Fill( const XBitmapList* pList )
1505cdf0e10cSrcweir {
1506cdf0e10cSrcweir 	mpList = (XBitmapList*)pList;
1507cdf0e10cSrcweir 	XBitmapEntry* pEntry;
1508cdf0e10cSrcweir 	long nCount = pList->Count();
1509cdf0e10cSrcweir 
1510cdf0e10cSrcweir 	SetUpdateMode( sal_False );
1511cdf0e10cSrcweir 
1512cdf0e10cSrcweir 	if( mbUserDraw )
1513cdf0e10cSrcweir 	{
1514cdf0e10cSrcweir 		for( long i = 0; i < nCount; i++ )
1515cdf0e10cSrcweir             InsertEntry( pList->GetBitmap( i )->GetName() );
1516cdf0e10cSrcweir 	}
1517cdf0e10cSrcweir 	else
1518cdf0e10cSrcweir 	{
1519cdf0e10cSrcweir 		for( long i = 0; i < nCount; i++ )
1520cdf0e10cSrcweir 		{
1521cdf0e10cSrcweir             pEntry = pList->GetBitmap( i );
1522cdf0e10cSrcweir 			aBitmap = pEntry->GetXBitmap().GetBitmap();
1523cdf0e10cSrcweir 
1524cdf0e10cSrcweir 			SetVirtualDevice();
1525cdf0e10cSrcweir 
1526cdf0e10cSrcweir 			InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ) );
1527cdf0e10cSrcweir 		}
1528cdf0e10cSrcweir 	}
1529cdf0e10cSrcweir 
1530cdf0e10cSrcweir 	SetUpdateMode( sal_True );
1531cdf0e10cSrcweir }
1532cdf0e10cSrcweir 
1533cdf0e10cSrcweir void BitmapLB::UserDraw( const UserDrawEvent& rUDEvt )
1534cdf0e10cSrcweir {
1535cdf0e10cSrcweir 	if( mpList != NULL )
1536cdf0e10cSrcweir 	{
1537cdf0e10cSrcweir 		// Draw bitmap
1538cdf0e10cSrcweir 		const Rectangle& rDrawRect = rUDEvt.GetRect();
1539cdf0e10cSrcweir 		Rectangle aRect( rDrawRect.nLeft+1, rDrawRect.nTop+1, rDrawRect.nLeft+33, rDrawRect.nBottom-1 );
1540cdf0e10cSrcweir 
1541cdf0e10cSrcweir         sal_Int32 nId = rUDEvt.GetItemId();
1542cdf0e10cSrcweir 		if( nId >= 0 && nId <= mpList->Count() )
1543cdf0e10cSrcweir 		{
1544cdf0e10cSrcweir 			Rectangle aClipRect( rDrawRect.nLeft+1, rDrawRect.nTop+1, rDrawRect.nRight-1, rDrawRect.nBottom-1 );
1545cdf0e10cSrcweir 
1546cdf0e10cSrcweir 			OutputDevice* pDevice = rUDEvt.GetDevice();
1547cdf0e10cSrcweir 			pDevice->SetClipRegion( Region( aClipRect ) );
1548cdf0e10cSrcweir 
1549cdf0e10cSrcweir             aBitmap = mpList->GetBitmap( nId )->GetXBitmap().GetBitmap();
1550cdf0e10cSrcweir 
1551cdf0e10cSrcweir 			long nPosBaseX = aRect.nLeft;
1552cdf0e10cSrcweir 			long nPosBaseY = aRect.nTop;
1553cdf0e10cSrcweir 
1554cdf0e10cSrcweir 			if( aBitmap.GetSizePixel().Width() > 8 ||
1555cdf0e10cSrcweir 				aBitmap.GetSizePixel().Height() > 8 )
1556cdf0e10cSrcweir 			{
1557cdf0e10cSrcweir 				pDevice->DrawBitmap( Point( nPosBaseX, nPosBaseY ), Size( 32, 16 ), aBitmap );
1558cdf0e10cSrcweir 			}
1559cdf0e10cSrcweir 			else
1560cdf0e10cSrcweir 			{
1561cdf0e10cSrcweir 				pDevice->DrawBitmap( Point( nPosBaseX+ 0, nPosBaseY+0 ), aBitmap );
1562cdf0e10cSrcweir 				pDevice->DrawBitmap( Point( nPosBaseX+ 8, nPosBaseY+0 ), aBitmap );
1563cdf0e10cSrcweir 				pDevice->DrawBitmap( Point( nPosBaseX+16, nPosBaseY+0 ), aBitmap );
1564cdf0e10cSrcweir 				pDevice->DrawBitmap( Point( nPosBaseX+24, nPosBaseY+0 ), aBitmap );
1565cdf0e10cSrcweir 				pDevice->DrawBitmap( Point( nPosBaseX+ 0, nPosBaseY+8 ), aBitmap );
1566cdf0e10cSrcweir 				pDevice->DrawBitmap( Point( nPosBaseX+ 8, nPosBaseY+8 ), aBitmap );
1567cdf0e10cSrcweir 				pDevice->DrawBitmap( Point( nPosBaseX+16, nPosBaseY+8 ), aBitmap );
1568cdf0e10cSrcweir 				pDevice->DrawBitmap( Point( nPosBaseX+24, nPosBaseY+8 ), aBitmap );
1569cdf0e10cSrcweir 			}
1570cdf0e10cSrcweir 
1571cdf0e10cSrcweir 			pDevice->SetClipRegion();
1572cdf0e10cSrcweir 
1573cdf0e10cSrcweir 			// Draw name
1574cdf0e10cSrcweir             pDevice->DrawText( Point( aRect.nRight+7, aRect.nTop-1 ), mpList->GetBitmap( nId )->GetName() );
1575cdf0e10cSrcweir 		}
1576cdf0e10cSrcweir 	}
1577cdf0e10cSrcweir }
1578cdf0e10cSrcweir 
1579cdf0e10cSrcweir /************************************************************************/
1580cdf0e10cSrcweir 
1581cdf0e10cSrcweir void BitmapLB::Append( XBitmapEntry* pEntry, Bitmap* pBmp )
1582cdf0e10cSrcweir {
1583cdf0e10cSrcweir 	if( pBmp )
1584cdf0e10cSrcweir 	{
1585cdf0e10cSrcweir 		aBitmap = pEntry->GetXBitmap().GetBitmap();
1586cdf0e10cSrcweir 		SetVirtualDevice();
1587cdf0e10cSrcweir 		InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ) );
1588cdf0e10cSrcweir 	}
1589cdf0e10cSrcweir 	else
1590cdf0e10cSrcweir 		InsertEntry( pEntry->GetName() );
1591cdf0e10cSrcweir }
1592cdf0e10cSrcweir 
1593cdf0e10cSrcweir /************************************************************************/
1594cdf0e10cSrcweir 
1595cdf0e10cSrcweir void BitmapLB::Modify( XBitmapEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp )
1596cdf0e10cSrcweir {
1597cdf0e10cSrcweir 	RemoveEntry( nPos );
1598cdf0e10cSrcweir 
1599cdf0e10cSrcweir 	if( pBmp )
1600cdf0e10cSrcweir 	{
1601cdf0e10cSrcweir 		aBitmap = pEntry->GetXBitmap().GetBitmap();
1602cdf0e10cSrcweir 		SetVirtualDevice();
1603cdf0e10cSrcweir 
1604cdf0e10cSrcweir 		InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ), nPos );
1605cdf0e10cSrcweir 	}
1606cdf0e10cSrcweir 	else
1607cdf0e10cSrcweir 		InsertEntry( pEntry->GetName() );
1608cdf0e10cSrcweir }
1609cdf0e10cSrcweir 
1610cdf0e10cSrcweir /************************************************************************/
1611cdf0e10cSrcweir 
1612cdf0e10cSrcweir void BitmapLB::SelectEntryByList( const XBitmapList* pList, const String& rStr,
1613cdf0e10cSrcweir                             const Bitmap& )
1614cdf0e10cSrcweir {
1615cdf0e10cSrcweir 	long nCount = pList->Count();
1616cdf0e10cSrcweir 	XBitmapEntry* pEntry;
1617cdf0e10cSrcweir 	sal_Bool bFound = sal_False;
1618cdf0e10cSrcweir 
1619cdf0e10cSrcweir 	long i;
1620cdf0e10cSrcweir 	for( i = 0; i < nCount && !bFound; i++ )
1621cdf0e10cSrcweir 	{
1622cdf0e10cSrcweir         pEntry = pList->GetBitmap( i );
1623cdf0e10cSrcweir 
1624cdf0e10cSrcweir 		String aStr = pEntry->GetName();
1625cdf0e10cSrcweir 		// Bitmap aBmp = pEntry->GetBitmap();
1626cdf0e10cSrcweir 
1627cdf0e10cSrcweir 		if( rStr == aStr )
1628cdf0e10cSrcweir 		{
1629cdf0e10cSrcweir 			bFound = sal_True;
1630cdf0e10cSrcweir 		}
1631cdf0e10cSrcweir 	}
1632cdf0e10cSrcweir 	if( bFound )
1633cdf0e10cSrcweir 		SelectEntryPos( (sal_uInt16) ( i - 1 ) );
1634cdf0e10cSrcweir }
1635cdf0e10cSrcweir 
1636cdf0e10cSrcweir /*************************************************************************
1637cdf0e10cSrcweir |*
1638cdf0e10cSrcweir |*	Konstruktor von FillAttrLB
1639cdf0e10cSrcweir |*
1640cdf0e10cSrcweir \************************************************************************/
1641cdf0e10cSrcweir 
1642cdf0e10cSrcweir FillAttrLB::FillAttrLB( Window* pParent, ResId Id ) :
1643cdf0e10cSrcweir 					ColorListBox( pParent, Id )
1644cdf0e10cSrcweir {
1645cdf0e10cSrcweir 	aVD.SetOutputSizePixel( Size( 32, 16 ) );
1646cdf0e10cSrcweir }
1647cdf0e10cSrcweir 
1648cdf0e10cSrcweir /************************************************************************/
1649cdf0e10cSrcweir 
1650cdf0e10cSrcweir FillAttrLB::FillAttrLB( Window* pParent, WinBits aWB ) :
1651cdf0e10cSrcweir 					ColorListBox( pParent, aWB )
1652cdf0e10cSrcweir {
1653cdf0e10cSrcweir 	aVD.SetOutputSizePixel( Size( 32, 16 ) );
1654cdf0e10cSrcweir }
1655cdf0e10cSrcweir 
1656cdf0e10cSrcweir /************************************************************************/
1657cdf0e10cSrcweir 
1658cdf0e10cSrcweir void FillAttrLB::SetVirtualDevice()
1659cdf0e10cSrcweir {
1660cdf0e10cSrcweir 	if( aBitmap.GetSizePixel().Width() > 8 ||
1661cdf0e10cSrcweir 		aBitmap.GetSizePixel().Height() > 8 )
1662cdf0e10cSrcweir 	{
1663cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 0, 0 ), Size( 32, 16 ), aBitmap );
1664cdf0e10cSrcweir 	}
1665cdf0e10cSrcweir 	else
1666cdf0e10cSrcweir 	{
1667cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 0, 0 ), aBitmap );
1668cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 8, 0 ), aBitmap );
1669cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 16, 0 ), aBitmap );
1670cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 24, 0 ), aBitmap );
1671cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 0, 8 ), aBitmap );
1672cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 8, 8 ), aBitmap );
1673cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 16, 8 ), aBitmap );
1674cdf0e10cSrcweir 		aVD.DrawBitmap( Point( 24, 8 ), aBitmap );
1675cdf0e10cSrcweir 	}
1676cdf0e10cSrcweir }
1677cdf0e10cSrcweir 
1678cdf0e10cSrcweir /************************************************************************/
1679cdf0e10cSrcweir 
1680cdf0e10cSrcweir void FillAttrLB::Fill( const XBitmapList* pList )
1681cdf0e10cSrcweir {
1682cdf0e10cSrcweir 	long nCount = pList->Count();
1683cdf0e10cSrcweir 	XBitmapEntry* pEntry;
1684cdf0e10cSrcweir 	ListBox::SetUpdateMode( sal_False );
1685cdf0e10cSrcweir 
1686cdf0e10cSrcweir 	for( long i = 0; i < nCount; i++ )
1687cdf0e10cSrcweir 	{
1688cdf0e10cSrcweir         pEntry = pList->GetBitmap( i );
1689cdf0e10cSrcweir 		aBitmap = pEntry->GetXBitmap().GetBitmap();
1690cdf0e10cSrcweir 
1691cdf0e10cSrcweir 		SetVirtualDevice();
1692cdf0e10cSrcweir 
1693cdf0e10cSrcweir 		ListBox::InsertEntry( pEntry->GetName(), aVD.GetBitmap( Point( 0, 2 ), Size( 32, 12 ) ) );
1694cdf0e10cSrcweir 	}
1695cdf0e10cSrcweir 	ListBox::SetUpdateMode( sal_True );
1696cdf0e10cSrcweir }
1697cdf0e10cSrcweir 
1698cdf0e10cSrcweir /************************************************************************/
1699cdf0e10cSrcweir 
1700cdf0e10cSrcweir void FillAttrLB::SelectEntryByList( const XBitmapList* pList, const String& rStr,
1701cdf0e10cSrcweir                             const Bitmap& /*rBmp*/)
1702cdf0e10cSrcweir {
1703cdf0e10cSrcweir 	long nCount = pList->Count();
1704cdf0e10cSrcweir 	XBitmapEntry* pEntry;
1705cdf0e10cSrcweir 	sal_Bool bFound = sal_False;
1706cdf0e10cSrcweir 
1707cdf0e10cSrcweir 	long i;
1708cdf0e10cSrcweir 	for( i = 0; i < nCount && !bFound; i++ )
1709cdf0e10cSrcweir 	{
1710cdf0e10cSrcweir         pEntry = pList->GetBitmap( i );
1711cdf0e10cSrcweir 
1712cdf0e10cSrcweir 		String aStr = pEntry->GetName();
1713cdf0e10cSrcweir 		// Bitmap aBmp = pEntry->GetBitmap();
1714cdf0e10cSrcweir 
1715cdf0e10cSrcweir 		if( rStr == aStr )
1716cdf0e10cSrcweir 		{
1717cdf0e10cSrcweir 			bFound = sal_True;
1718cdf0e10cSrcweir 		}
1719cdf0e10cSrcweir 		/*
1720cdf0e10cSrcweir 		if( rStr == aStr && rBmp == aBmp )
1721cdf0e10cSrcweir 			bFound = sal_True; */
1722cdf0e10cSrcweir 	}
1723cdf0e10cSrcweir 	if( bFound )
1724cdf0e10cSrcweir 		SelectEntryPos( (sal_uInt16) ( i - 1 ) );
1725cdf0e10cSrcweir }
1726cdf0e10cSrcweir 
1727cdf0e10cSrcweir /*************************************************************************
1728cdf0e10cSrcweir |*
1729cdf0e10cSrcweir |*	Fuellt die Listbox (vorlaeufig) mit Strings
1730cdf0e10cSrcweir |*
1731cdf0e10cSrcweir \************************************************************************/
1732cdf0e10cSrcweir 
1733cdf0e10cSrcweir void FillTypeLB::Fill()
1734cdf0e10cSrcweir {
1735cdf0e10cSrcweir 	SetUpdateMode( sal_False );
1736cdf0e10cSrcweir 	InsertEntry( String( SVX_RES( RID_SVXSTR_INVISIBLE ) ) );
1737cdf0e10cSrcweir 	InsertEntry( String( SVX_RES( RID_SVXSTR_COLOR ) ) );
1738cdf0e10cSrcweir 	InsertEntry( String( SVX_RES( RID_SVXSTR_GRADIENT ) ) );
1739cdf0e10cSrcweir 	InsertEntry( String( SVX_RES( RID_SVXSTR_HATCH ) ) );
1740cdf0e10cSrcweir 	InsertEntry( String( SVX_RES( RID_SVXSTR_BITMAP ) ) );
1741cdf0e10cSrcweir 	SetUpdateMode( sal_True );
1742cdf0e10cSrcweir }
1743cdf0e10cSrcweir 
1744cdf0e10cSrcweir /*************************************************************************
1745cdf0e10cSrcweir |*
1746cdf0e10cSrcweir |*	Fuellt die Listbox (vorlaeufig) mit Strings
1747cdf0e10cSrcweir |*
1748cdf0e10cSrcweir \************************************************************************/
1749cdf0e10cSrcweir 
1750cdf0e10cSrcweir void LineLB::Fill( const XDashList* pList )
1751cdf0e10cSrcweir {
1752cdf0e10cSrcweir 	long nCount = pList->Count();
1753cdf0e10cSrcweir 	XDashEntry* pEntry;
1754cdf0e10cSrcweir 	SetUpdateMode( sal_False );
1755cdf0e10cSrcweir 
1756cdf0e10cSrcweir 	for( long i = 0; i < nCount; i++ )
1757cdf0e10cSrcweir 	{
1758cdf0e10cSrcweir         pEntry = pList->GetDash( i );
1759cdf0e10cSrcweir 		Bitmap* pBitmap = const_cast<XDashList*>(pList)->CreateBitmapForUI( i );
1760cdf0e10cSrcweir 		if( pBitmap )
1761cdf0e10cSrcweir 		{
1762cdf0e10cSrcweir 			InsertEntry( pEntry->GetName(), *pBitmap );
1763cdf0e10cSrcweir 			delete pBitmap;
1764cdf0e10cSrcweir 		}
1765cdf0e10cSrcweir 		else
1766cdf0e10cSrcweir 			InsertEntry( pEntry->GetName() );
1767cdf0e10cSrcweir 	}
1768cdf0e10cSrcweir 	SetUpdateMode( sal_True );
1769cdf0e10cSrcweir }
1770cdf0e10cSrcweir 
1771cdf0e10cSrcweir void LineLB::FillStyles()
1772cdf0e10cSrcweir {
1773cdf0e10cSrcweir 	ResMgr& rMgr = DIALOG_MGR();
1774cdf0e10cSrcweir 
1775cdf0e10cSrcweir 	// Linienstile
1776cdf0e10cSrcweir 	Clear();
1777cdf0e10cSrcweir 	InsertEntry( String( ResId( RID_SVXSTR_INVISIBLE, rMgr ) ) );
1778cdf0e10cSrcweir 
1779cdf0e10cSrcweir 	const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
1780cdf0e10cSrcweir 	Bitmap aBitmap ( SVX_RES ( RID_SVXCTRL_LINECTRL ) );
1781cdf0e10cSrcweir 	Color aSourceColors[2];
1782cdf0e10cSrcweir 	Color aDestColors[2];
1783cdf0e10cSrcweir 
1784cdf0e10cSrcweir 	aSourceColors[0] = Color( COL_WHITE );
1785cdf0e10cSrcweir 	aSourceColors[1] = Color( COL_BLACK );
1786cdf0e10cSrcweir 
1787cdf0e10cSrcweir 	aDestColors[0] = rStyles.GetFieldColor();
1788cdf0e10cSrcweir 	aDestColors[1] = rStyles.GetFieldTextColor();
1789cdf0e10cSrcweir 
1790cdf0e10cSrcweir 	aBitmap.Replace ( aSourceColors, aDestColors, 2 );
1791cdf0e10cSrcweir 	Image aSolidLine ( aBitmap );
1792cdf0e10cSrcweir 	InsertEntry( String( ResId( RID_SVXSTR_SOLID, rMgr ) ), aSolidLine );
1793cdf0e10cSrcweir }
1794cdf0e10cSrcweir 
1795cdf0e10cSrcweir /************************************************************************/
1796cdf0e10cSrcweir 
1797cdf0e10cSrcweir void LineLB::Append( XDashEntry* pEntry, Bitmap* pBmp )
1798cdf0e10cSrcweir {
1799cdf0e10cSrcweir 	if( pBmp )
1800cdf0e10cSrcweir 		InsertEntry( pEntry->GetName(), *pBmp );
1801cdf0e10cSrcweir 	else
1802cdf0e10cSrcweir 		InsertEntry( pEntry->GetName() );
1803cdf0e10cSrcweir }
1804cdf0e10cSrcweir 
1805cdf0e10cSrcweir /************************************************************************/
1806cdf0e10cSrcweir 
1807cdf0e10cSrcweir void LineLB::Modify( XDashEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp )
1808cdf0e10cSrcweir {
1809cdf0e10cSrcweir 	RemoveEntry( nPos );
1810cdf0e10cSrcweir 
1811cdf0e10cSrcweir 	if( pBmp )
1812cdf0e10cSrcweir 		InsertEntry( pEntry->GetName(), *pBmp, nPos );
1813cdf0e10cSrcweir 	else
1814cdf0e10cSrcweir 		InsertEntry( pEntry->GetName(), nPos );
1815cdf0e10cSrcweir }
1816cdf0e10cSrcweir 
1817cdf0e10cSrcweir /************************************************************************/
1818cdf0e10cSrcweir 
1819cdf0e10cSrcweir void LineLB::SelectEntryByList( const XDashList* pList, const String& rStr,
1820cdf0e10cSrcweir 								const XDash& rDash, sal_uInt16 nDist )
1821cdf0e10cSrcweir {
1822cdf0e10cSrcweir 	long nCount = pList->Count();
1823cdf0e10cSrcweir 	XDashEntry* pEntry;
1824cdf0e10cSrcweir 	sal_Bool bFound = sal_False;
1825cdf0e10cSrcweir 	String aStr;
1826cdf0e10cSrcweir 	XDash aDash;
1827cdf0e10cSrcweir 
1828cdf0e10cSrcweir 	long i;
1829cdf0e10cSrcweir 	for( i = 0; i < nCount && !bFound; i++ )
1830cdf0e10cSrcweir 	{
1831cdf0e10cSrcweir         pEntry = pList->GetDash( i );
1832cdf0e10cSrcweir 
1833cdf0e10cSrcweir 		aStr = pEntry->GetName();
1834cdf0e10cSrcweir 		aDash = pEntry->GetDash();
1835cdf0e10cSrcweir 
1836cdf0e10cSrcweir 		if( rStr == aStr && rDash == aDash )
1837cdf0e10cSrcweir 			bFound = sal_True;
1838cdf0e10cSrcweir 	}
1839cdf0e10cSrcweir 	if( bFound )
1840cdf0e10cSrcweir 		SelectEntryPos( (sal_uInt16) ( i - 1 + nDist ) );
1841cdf0e10cSrcweir }
1842cdf0e10cSrcweir 
1843cdf0e10cSrcweir /*************************************************************************
1844cdf0e10cSrcweir |*
1845cdf0e10cSrcweir |*	Fuellt die Listbox (vorlaeufig) mit Strings
1846cdf0e10cSrcweir |*
1847cdf0e10cSrcweir \************************************************************************/
1848cdf0e10cSrcweir 
1849cdf0e10cSrcweir void LineEndLB::Fill( const XLineEndList* pList, sal_Bool bStart )
1850cdf0e10cSrcweir {
1851cdf0e10cSrcweir 	long nCount = pList->Count();
1852cdf0e10cSrcweir 	XLineEndEntry* pEntry;
1853cdf0e10cSrcweir 	VirtualDevice aVD;
1854cdf0e10cSrcweir 	SetUpdateMode( sal_False );
1855cdf0e10cSrcweir 
1856cdf0e10cSrcweir 	for( long i = 0; i < nCount; i++ )
1857cdf0e10cSrcweir 	{
1858cdf0e10cSrcweir         pEntry = pList->GetLineEnd( i );
1859cdf0e10cSrcweir 		Bitmap* pBitmap = const_cast<XLineEndList*>(pList)->CreateBitmapForUI( i );
1860cdf0e10cSrcweir 		if( pBitmap )
1861cdf0e10cSrcweir 		{
1862cdf0e10cSrcweir 			Size aBmpSize( pBitmap->GetSizePixel() );
1863cdf0e10cSrcweir 			aVD.SetOutputSizePixel( aBmpSize, sal_False );
1864cdf0e10cSrcweir 			aVD.DrawBitmap( Point(), *pBitmap );
1865cdf0e10cSrcweir 			InsertEntry( pEntry->GetName(),
1866cdf0e10cSrcweir 				aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ),
1867cdf0e10cSrcweir 					Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ) );
1868cdf0e10cSrcweir 
1869cdf0e10cSrcweir 			delete pBitmap;
1870cdf0e10cSrcweir 		}
1871cdf0e10cSrcweir 		else
1872cdf0e10cSrcweir 			InsertEntry( pEntry->GetName() );
1873cdf0e10cSrcweir 	}
1874cdf0e10cSrcweir 	SetUpdateMode( sal_True );
1875cdf0e10cSrcweir }
1876cdf0e10cSrcweir 
1877cdf0e10cSrcweir /************************************************************************/
1878cdf0e10cSrcweir 
1879cdf0e10cSrcweir void LineEndLB::Append( XLineEndEntry* pEntry, Bitmap* pBmp,
1880cdf0e10cSrcweir 						sal_Bool bStart )
1881cdf0e10cSrcweir {
1882cdf0e10cSrcweir 	if( pBmp )
1883cdf0e10cSrcweir 	{
1884cdf0e10cSrcweir 		VirtualDevice aVD;
1885cdf0e10cSrcweir 		Size aBmpSize( pBmp->GetSizePixel() );
1886cdf0e10cSrcweir 
1887cdf0e10cSrcweir 		aVD.SetOutputSizePixel( aBmpSize, sal_False );
1888cdf0e10cSrcweir 		aVD.DrawBitmap( Point(), *pBmp );
1889cdf0e10cSrcweir 		InsertEntry( pEntry->GetName(),
1890cdf0e10cSrcweir 			aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ),
1891cdf0e10cSrcweir 				Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ) );
1892cdf0e10cSrcweir 	}
1893cdf0e10cSrcweir 	else
1894cdf0e10cSrcweir 		InsertEntry( pEntry->GetName() );
1895cdf0e10cSrcweir }
1896cdf0e10cSrcweir 
1897cdf0e10cSrcweir /************************************************************************/
1898cdf0e10cSrcweir 
1899cdf0e10cSrcweir void LineEndLB::Modify( XLineEndEntry* pEntry, sal_uInt16 nPos, Bitmap* pBmp,
1900cdf0e10cSrcweir 						sal_Bool bStart )
1901cdf0e10cSrcweir {
1902cdf0e10cSrcweir 	RemoveEntry( nPos );
1903cdf0e10cSrcweir 
1904cdf0e10cSrcweir 	if( pBmp )
1905cdf0e10cSrcweir 	{
1906cdf0e10cSrcweir 		VirtualDevice aVD;
1907cdf0e10cSrcweir 		Size aBmpSize( pBmp->GetSizePixel() );
1908cdf0e10cSrcweir 
1909cdf0e10cSrcweir 		aVD.SetOutputSizePixel( aBmpSize, sal_False );
1910cdf0e10cSrcweir 		aVD.DrawBitmap( Point(), *pBmp );
1911cdf0e10cSrcweir 		InsertEntry( pEntry->GetName(),
1912cdf0e10cSrcweir 			aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ),
1913cdf0e10cSrcweir 				Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ), nPos );
1914cdf0e10cSrcweir 	}
1915cdf0e10cSrcweir 	else
1916cdf0e10cSrcweir 		InsertEntry( pEntry->GetName(), nPos );
1917cdf0e10cSrcweir }
1918cdf0e10cSrcweir 
1919cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
1920cdf0e10cSrcweir 
1921cdf0e10cSrcweir void SvxPreviewBase::InitSettings(bool bForeground, bool bBackground)
1922cdf0e10cSrcweir {
1923cdf0e10cSrcweir 	const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1924cdf0e10cSrcweir 
1925cdf0e10cSrcweir 	if(bForeground)
1926cdf0e10cSrcweir 	{
1927cdf0e10cSrcweir 		svtools::ColorConfig aColorConfig;
1928cdf0e10cSrcweir 		Color aTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
1929cdf0e10cSrcweir 
1930cdf0e10cSrcweir 		if(IsControlForeground())
1931cdf0e10cSrcweir         {
1932cdf0e10cSrcweir 			aTextColor = GetControlForeground();
1933cdf0e10cSrcweir         }
1934cdf0e10cSrcweir 
1935cdf0e10cSrcweir 		getBufferDevice().SetTextColor(aTextColor);
1936cdf0e10cSrcweir 	}
1937cdf0e10cSrcweir 
1938cdf0e10cSrcweir 	if(bBackground)
1939cdf0e10cSrcweir 	{
1940cdf0e10cSrcweir 		if(IsControlBackground())
1941cdf0e10cSrcweir         {
1942cdf0e10cSrcweir 			getBufferDevice().SetBackground(GetControlBackground());
1943cdf0e10cSrcweir         }
1944cdf0e10cSrcweir 		else
1945cdf0e10cSrcweir         {
1946cdf0e10cSrcweir 			getBufferDevice().SetBackground(rStyleSettings.GetWindowColor());
1947cdf0e10cSrcweir         }
1948cdf0e10cSrcweir 	}
1949cdf0e10cSrcweir 
1950cdf0e10cSrcweir     // do not paint background self, it gets painted buffered
1951cdf0e10cSrcweir 	SetControlBackground();
1952cdf0e10cSrcweir     SetBackground();
1953cdf0e10cSrcweir 
1954cdf0e10cSrcweir     Invalidate();
1955cdf0e10cSrcweir }
1956cdf0e10cSrcweir 
1957cdf0e10cSrcweir SvxPreviewBase::SvxPreviewBase( Window* pParent, const ResId& rResId )
1958cdf0e10cSrcweir :	Control( pParent, rResId ),
1959cdf0e10cSrcweir 	mpModel( new SdrModel() ),
1960cdf0e10cSrcweir     mpBufferDevice( new VirtualDevice(*this) )
1961cdf0e10cSrcweir {
1962cdf0e10cSrcweir 	//	Draw the control's border as a flat thin black line.
1963cdf0e10cSrcweir     SetBorderStyle(WINDOW_BORDER_MONO);
1964cdf0e10cSrcweir     SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
1965cdf0e10cSrcweir     SetMapMode(MAP_100TH_MM);
1966cdf0e10cSrcweir 
1967cdf0e10cSrcweir     // init model
1968cdf0e10cSrcweir 	mpModel->GetItemPool().FreezeIdRanges();
1969cdf0e10cSrcweir }
1970cdf0e10cSrcweir 
1971cdf0e10cSrcweir SvxPreviewBase::~SvxPreviewBase()
1972cdf0e10cSrcweir {
1973cdf0e10cSrcweir 	delete mpModel;
1974cdf0e10cSrcweir     delete mpBufferDevice;
1975cdf0e10cSrcweir }
1976cdf0e10cSrcweir 
1977cdf0e10cSrcweir void SvxPreviewBase::LocalPrePaint()
1978cdf0e10cSrcweir {
1979cdf0e10cSrcweir     // init BufferDevice
1980cdf0e10cSrcweir     if(mpBufferDevice->GetOutputSizePixel() != GetOutputSizePixel())
1981cdf0e10cSrcweir     {
1982cdf0e10cSrcweir         mpBufferDevice->SetDrawMode(GetDrawMode());
1983cdf0e10cSrcweir         mpBufferDevice->SetSettings(GetSettings());
1984cdf0e10cSrcweir         mpBufferDevice->SetAntialiasing(GetAntialiasing());
1985cdf0e10cSrcweir         mpBufferDevice->SetOutputSizePixel(GetOutputSizePixel());
1986cdf0e10cSrcweir 	    mpBufferDevice->SetMapMode(GetMapMode());
1987cdf0e10cSrcweir     }
1988cdf0e10cSrcweir 
1989cdf0e10cSrcweir     mpBufferDevice->Erase();
1990cdf0e10cSrcweir }
1991cdf0e10cSrcweir 
1992cdf0e10cSrcweir void SvxPreviewBase::LocalPostPaint()
1993cdf0e10cSrcweir {
1994cdf0e10cSrcweir     // copy to front (in pixel mode)
1995cdf0e10cSrcweir 	const bool bWasEnabledSrc(mpBufferDevice->IsMapModeEnabled());
1996cdf0e10cSrcweir 	const bool bWasEnabledDst(IsMapModeEnabled());
1997cdf0e10cSrcweir 	const Point aEmptyPoint;
1998cdf0e10cSrcweir 
1999cdf0e10cSrcweir     mpBufferDevice->EnableMapMode(false);
2000cdf0e10cSrcweir     EnableMapMode(false);
2001cdf0e10cSrcweir 
2002cdf0e10cSrcweir     DrawOutDev(
2003cdf0e10cSrcweir         aEmptyPoint, GetOutputSizePixel(),
2004cdf0e10cSrcweir         aEmptyPoint, GetOutputSizePixel(),
2005cdf0e10cSrcweir         *mpBufferDevice);
2006cdf0e10cSrcweir 
2007cdf0e10cSrcweir     mpBufferDevice->EnableMapMode(bWasEnabledSrc);
2008cdf0e10cSrcweir     EnableMapMode(bWasEnabledDst);
2009cdf0e10cSrcweir }
2010cdf0e10cSrcweir 
2011cdf0e10cSrcweir void SvxPreviewBase::StateChanged(StateChangedType nType)
2012cdf0e10cSrcweir {
2013cdf0e10cSrcweir 	Control::StateChanged(nType);
2014cdf0e10cSrcweir 
2015cdf0e10cSrcweir     if(STATE_CHANGE_CONTROLFOREGROUND == nType)
2016cdf0e10cSrcweir     {
2017cdf0e10cSrcweir 		InitSettings(true, false);
2018cdf0e10cSrcweir     }
2019cdf0e10cSrcweir 	else if(STATE_CHANGE_CONTROLBACKGROUND == nType)
2020cdf0e10cSrcweir     {
2021cdf0e10cSrcweir 		InitSettings(false, true);
2022cdf0e10cSrcweir     }
2023cdf0e10cSrcweir }
2024cdf0e10cSrcweir 
2025cdf0e10cSrcweir void SvxPreviewBase::DataChanged(const DataChangedEvent& rDCEvt)
2026cdf0e10cSrcweir {
2027cdf0e10cSrcweir     SetDrawMode(GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR);
2028cdf0e10cSrcweir 
2029cdf0e10cSrcweir     if((DATACHANGED_SETTINGS == rDCEvt.GetType()) && (rDCEvt.GetFlags() & SETTINGS_STYLE))
2030cdf0e10cSrcweir     {
2031cdf0e10cSrcweir 		InitSettings(true, true);
2032cdf0e10cSrcweir     }
2033cdf0e10cSrcweir 	else
2034cdf0e10cSrcweir     {
2035cdf0e10cSrcweir 		Control::DataChanged(rDCEvt);
2036cdf0e10cSrcweir     }
2037cdf0e10cSrcweir }
2038cdf0e10cSrcweir 
2039cdf0e10cSrcweir /*************************************************************************
2040cdf0e10cSrcweir |*
2041cdf0e10cSrcweir |*    SvxXLinePreview::SvxXLinePreview()
2042cdf0e10cSrcweir |*
2043cdf0e10cSrcweir *************************************************************************/
2044cdf0e10cSrcweir 
2045cdf0e10cSrcweir SvxXLinePreview::SvxXLinePreview( Window* pParent, const ResId& rResId )
2046cdf0e10cSrcweir :	SvxPreviewBase( pParent, rResId ),
2047cdf0e10cSrcweir 	mpLineObjA( 0L ),
2048cdf0e10cSrcweir 	mpLineObjB( 0L ),
2049cdf0e10cSrcweir 	mpLineObjC( 0L ),
2050cdf0e10cSrcweir 	mpGraphic( 0L ),
2051cdf0e10cSrcweir 	mbWithSymbol( sal_False )
2052cdf0e10cSrcweir {
2053cdf0e10cSrcweir 	const Size aOutputSize(GetOutputSize());
2054cdf0e10cSrcweir 	InitSettings( sal_True, sal_True );
2055cdf0e10cSrcweir 
2056cdf0e10cSrcweir 	const sal_Int32 nDistance(500L);
2057cdf0e10cSrcweir 	const sal_Int32 nAvailableLength(aOutputSize.Width() - (4 * nDistance));
2058cdf0e10cSrcweir 
2059cdf0e10cSrcweir 	// create DrawObectA
2060cdf0e10cSrcweir 	const sal_Int32 aYPosA(aOutputSize.Height() / 2);
2061cdf0e10cSrcweir 	const basegfx::B2DPoint aPointA1( nDistance,  aYPosA);
2062cdf0e10cSrcweir 	const basegfx::B2DPoint aPointA2( aPointA1.getX() + ((nAvailableLength * 14) / 20), aYPosA );
2063cdf0e10cSrcweir 	basegfx::B2DPolygon aPolygonA;
2064cdf0e10cSrcweir 	aPolygonA.append(aPointA1);
2065cdf0e10cSrcweir 	aPolygonA.append(aPointA2);
2066cdf0e10cSrcweir 	mpLineObjA = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygonA));
2067cdf0e10cSrcweir 	mpLineObjA->SetModel(&getModel());
2068cdf0e10cSrcweir 
2069cdf0e10cSrcweir 	// create DrawObectB
2070cdf0e10cSrcweir 	const sal_Int32 aYPosB1((aOutputSize.Height() * 3) / 4);
2071cdf0e10cSrcweir 	const sal_Int32 aYPosB2((aOutputSize.Height() * 1) / 4);
2072cdf0e10cSrcweir 	const basegfx::B2DPoint aPointB1( aPointA2.getX() + nDistance,  aYPosB1);
2073cdf0e10cSrcweir 	const basegfx::B2DPoint aPointB2( aPointB1.getX() + ((nAvailableLength * 2) / 20), aYPosB2 );
2074cdf0e10cSrcweir 	const basegfx::B2DPoint aPointB3( aPointB2.getX() + ((nAvailableLength * 2) / 20), aYPosB1 );
2075cdf0e10cSrcweir 	basegfx::B2DPolygon aPolygonB;
2076cdf0e10cSrcweir 	aPolygonB.append(aPointB1);
2077cdf0e10cSrcweir 	aPolygonB.append(aPointB2);
2078cdf0e10cSrcweir 	aPolygonB.append(aPointB3);
2079cdf0e10cSrcweir 	mpLineObjB = new SdrPathObj(OBJ_PLIN, basegfx::B2DPolyPolygon(aPolygonB));
2080cdf0e10cSrcweir 	mpLineObjB->SetModel(&getModel());
2081cdf0e10cSrcweir 
2082cdf0e10cSrcweir 	// create DrawObectC
2083cdf0e10cSrcweir 	const basegfx::B2DPoint aPointC1( aPointB3.getX() + nDistance,  aYPosB1);
2084cdf0e10cSrcweir 	const basegfx::B2DPoint aPointC2( aPointC1.getX() + ((nAvailableLength * 1) / 20), aYPosB2 );
2085cdf0e10cSrcweir 	const basegfx::B2DPoint aPointC3( aPointC2.getX() + ((nAvailableLength * 1) / 20), aYPosB1 );
2086cdf0e10cSrcweir 	basegfx::B2DPolygon aPolygonC;
2087cdf0e10cSrcweir 	aPolygonC.append(aPointC1);
2088cdf0e10cSrcweir 	aPolygonC.append(aPointC2);
2089cdf0e10cSrcweir 	aPolygonC.append(aPointC3);
2090cdf0e10cSrcweir 	mpLineObjC = new SdrPathObj(OBJ_PLIN, basegfx::B2DPolyPolygon(aPolygonC));
2091cdf0e10cSrcweir 	mpLineObjC->SetModel(&getModel());
2092cdf0e10cSrcweir }
2093cdf0e10cSrcweir 
2094cdf0e10cSrcweir SvxXLinePreview::~SvxXLinePreview()
2095cdf0e10cSrcweir {
2096cdf0e10cSrcweir     SdrObject::Free( mpLineObjA );
2097cdf0e10cSrcweir     SdrObject::Free( mpLineObjB );
2098cdf0e10cSrcweir     SdrObject::Free( mpLineObjC );
2099cdf0e10cSrcweir }
2100cdf0e10cSrcweir 
2101cdf0e10cSrcweir // -----------------------------------------------------------------------
2102cdf0e10cSrcweir 
2103cdf0e10cSrcweir void SvxXLinePreview::SetSymbol(Graphic* p,const Size& s)
2104cdf0e10cSrcweir {
2105cdf0e10cSrcweir 	mpGraphic = p;
2106cdf0e10cSrcweir 	maSymbolSize = s;
2107cdf0e10cSrcweir }
2108cdf0e10cSrcweir 
2109cdf0e10cSrcweir // -----------------------------------------------------------------------
2110cdf0e10cSrcweir 
2111cdf0e10cSrcweir void SvxXLinePreview::ResizeSymbol(const Size& s)
2112cdf0e10cSrcweir {
2113cdf0e10cSrcweir 	if ( s != maSymbolSize )
2114cdf0e10cSrcweir 	{
2115cdf0e10cSrcweir 		maSymbolSize = s;
2116cdf0e10cSrcweir 		Invalidate();
2117cdf0e10cSrcweir 	}
2118cdf0e10cSrcweir }
2119cdf0e10cSrcweir 
2120cdf0e10cSrcweir // -----------------------------------------------------------------------
2121cdf0e10cSrcweir 
2122cdf0e10cSrcweir void SvxXLinePreview::SetLineAttributes(const SfxItemSet& rItemSet)
2123cdf0e10cSrcweir {
2124cdf0e10cSrcweir 	// Set ItemSet at objects
2125cdf0e10cSrcweir 	mpLineObjA->SetMergedItemSet(rItemSet);
2126cdf0e10cSrcweir 
2127cdf0e10cSrcweir 	// At line joints, do not use arrows
2128cdf0e10cSrcweir 	SfxItemSet aTempSet(rItemSet);
2129cdf0e10cSrcweir 	aTempSet.ClearItem(XATTR_LINESTART);
2130cdf0e10cSrcweir 	aTempSet.ClearItem(XATTR_LINEEND);
2131cdf0e10cSrcweir 
2132cdf0e10cSrcweir 	mpLineObjB->SetMergedItemSet(aTempSet);
2133cdf0e10cSrcweir 	mpLineObjC->SetMergedItemSet(aTempSet);
2134cdf0e10cSrcweir }
2135cdf0e10cSrcweir 
2136cdf0e10cSrcweir // -----------------------------------------------------------------------
2137cdf0e10cSrcweir 
2138cdf0e10cSrcweir void SvxXLinePreview::Paint( const Rectangle& )
2139cdf0e10cSrcweir {
2140cdf0e10cSrcweir 	LocalPrePaint();
2141cdf0e10cSrcweir 
2142cdf0e10cSrcweir 	// paint objects to buffer device
2143cdf0e10cSrcweir 	sdr::contact::SdrObjectVector aObjectVector;
2144cdf0e10cSrcweir 	aObjectVector.push_back(mpLineObjA);
2145cdf0e10cSrcweir 	aObjectVector.push_back(mpLineObjB);
2146cdf0e10cSrcweir 	aObjectVector.push_back(mpLineObjC);
2147cdf0e10cSrcweir 
2148cdf0e10cSrcweir 	sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0);
2149cdf0e10cSrcweir 	sdr::contact::DisplayInfo aDisplayInfo;
2150cdf0e10cSrcweir 
2151cdf0e10cSrcweir 	// do processing
2152cdf0e10cSrcweir 	aPainter.ProcessDisplay(aDisplayInfo);
2153cdf0e10cSrcweir 
2154cdf0e10cSrcweir 	if ( mbWithSymbol && mpGraphic )
2155cdf0e10cSrcweir 	{
2156cdf0e10cSrcweir     	const Size aOutputSize(GetOutputSize());
2157cdf0e10cSrcweir 		Point aPos = Point( aOutputSize.Width() / 3, aOutputSize.Height() / 2 );
2158cdf0e10cSrcweir 		aPos.X() -= maSymbolSize.Width() / 2;
2159cdf0e10cSrcweir 		aPos.Y() -= maSymbolSize.Height() / 2;
2160cdf0e10cSrcweir 		mpGraphic->Draw( &getBufferDevice(), aPos, maSymbolSize );
2161cdf0e10cSrcweir 	}
2162cdf0e10cSrcweir 
2163cdf0e10cSrcweir 	LocalPostPaint();
2164cdf0e10cSrcweir }
2165cdf0e10cSrcweir 
2166cdf0e10cSrcweir /*************************************************************************
2167cdf0e10cSrcweir |*
2168cdf0e10cSrcweir |*    SvxXRectPreview::SvxXRectPreview()
2169cdf0e10cSrcweir |*
2170cdf0e10cSrcweir *************************************************************************/
2171cdf0e10cSrcweir 
2172cdf0e10cSrcweir SvxXRectPreview::SvxXRectPreview( Window* pParent, const ResId& rResId )
2173cdf0e10cSrcweir :	SvxPreviewBase( pParent, rResId ),
2174cdf0e10cSrcweir 	mpRectangleObject(0)
2175cdf0e10cSrcweir {
2176cdf0e10cSrcweir 	InitSettings(true, true);
2177cdf0e10cSrcweir 
2178cdf0e10cSrcweir 	// create RectangleObject
2179cdf0e10cSrcweir     const Rectangle aObjectSize(Point(), GetOutputSize());
2180cdf0e10cSrcweir 	mpRectangleObject = new SdrRectObj(aObjectSize);
2181cdf0e10cSrcweir 	mpRectangleObject->SetModel(&getModel());
2182cdf0e10cSrcweir }
2183cdf0e10cSrcweir 
2184cdf0e10cSrcweir SvxXRectPreview::~SvxXRectPreview()
2185cdf0e10cSrcweir {
2186cdf0e10cSrcweir     SdrObject::Free(mpRectangleObject);
2187cdf0e10cSrcweir }
2188cdf0e10cSrcweir 
2189cdf0e10cSrcweir void SvxXRectPreview::SetAttributes(const SfxItemSet& rItemSet)
2190cdf0e10cSrcweir {
2191cdf0e10cSrcweir 	mpRectangleObject->SetMergedItemSet(rItemSet, true);
2192cdf0e10cSrcweir 	mpRectangleObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
2193cdf0e10cSrcweir }
2194cdf0e10cSrcweir 
2195cdf0e10cSrcweir void SvxXRectPreview::Paint( const Rectangle& )
2196cdf0e10cSrcweir {
2197cdf0e10cSrcweir 	LocalPrePaint();
2198cdf0e10cSrcweir 
2199cdf0e10cSrcweir     sdr::contact::SdrObjectVector aObjectVector;
2200cdf0e10cSrcweir 
2201cdf0e10cSrcweir     aObjectVector.push_back(mpRectangleObject);
2202cdf0e10cSrcweir 
2203cdf0e10cSrcweir     sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0);
2204cdf0e10cSrcweir 	sdr::contact::DisplayInfo aDisplayInfo;
2205cdf0e10cSrcweir 
2206cdf0e10cSrcweir 	aPainter.ProcessDisplay(aDisplayInfo);
2207cdf0e10cSrcweir 
2208cdf0e10cSrcweir     LocalPostPaint();
2209cdf0e10cSrcweir }
2210cdf0e10cSrcweir 
2211cdf0e10cSrcweir /*************************************************************************
2212cdf0e10cSrcweir |*
2213cdf0e10cSrcweir |*    SvxXShadowPreview::SvxXShadowPreview()
2214cdf0e10cSrcweir |*
2215cdf0e10cSrcweir *************************************************************************/
2216cdf0e10cSrcweir 
2217cdf0e10cSrcweir SvxXShadowPreview::SvxXShadowPreview( Window* pParent, const ResId& rResId )
2218cdf0e10cSrcweir :	SvxPreviewBase( pParent, rResId ),
2219cdf0e10cSrcweir 	mpRectangleObject(0),
2220cdf0e10cSrcweir     mpRectangleShadow(0)
2221cdf0e10cSrcweir {
2222cdf0e10cSrcweir 	InitSettings(true, true);
2223cdf0e10cSrcweir 
2224cdf0e10cSrcweir     // prepare size
2225cdf0e10cSrcweir 	Size aSize = GetOutputSize();
2226cdf0e10cSrcweir 	aSize.Width() = aSize.Width() / 3;
2227cdf0e10cSrcweir 	aSize.Height() = aSize.Height() / 3;
2228cdf0e10cSrcweir 
2229cdf0e10cSrcweir     // create RectangleObject
2230cdf0e10cSrcweir     const Rectangle aObjectSize( Point( aSize.Width(), aSize.Height() ), aSize );
2231cdf0e10cSrcweir 	mpRectangleObject = new SdrRectObj(aObjectSize);
2232cdf0e10cSrcweir 	mpRectangleObject->SetModel(&getModel());
2233cdf0e10cSrcweir 
2234cdf0e10cSrcweir     // create ShadowObject
2235cdf0e10cSrcweir     const Rectangle aShadowSize( Point( aSize.Width(), aSize.Height() ), aSize );
2236cdf0e10cSrcweir 	mpRectangleShadow = new SdrRectObj(aShadowSize);
2237cdf0e10cSrcweir 	mpRectangleShadow->SetModel(&getModel());
2238cdf0e10cSrcweir }
2239cdf0e10cSrcweir 
2240cdf0e10cSrcweir SvxXShadowPreview::~SvxXShadowPreview()
2241cdf0e10cSrcweir {
2242cdf0e10cSrcweir     SdrObject::Free(mpRectangleObject);
2243cdf0e10cSrcweir     SdrObject::Free(mpRectangleShadow);
2244cdf0e10cSrcweir }
2245cdf0e10cSrcweir 
2246cdf0e10cSrcweir void SvxXShadowPreview::SetRectangleAttributes(const SfxItemSet& rItemSet)
2247cdf0e10cSrcweir {
2248cdf0e10cSrcweir 	mpRectangleObject->SetMergedItemSet(rItemSet, true);
2249cdf0e10cSrcweir 	mpRectangleObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
2250cdf0e10cSrcweir }
2251cdf0e10cSrcweir 
2252cdf0e10cSrcweir void SvxXShadowPreview::SetShadowAttributes(const SfxItemSet& rItemSet)
2253cdf0e10cSrcweir {
2254cdf0e10cSrcweir 	mpRectangleShadow->SetMergedItemSet(rItemSet, true);
2255cdf0e10cSrcweir 	mpRectangleShadow->SetMergedItem(XLineStyleItem(XLINE_NONE));
2256cdf0e10cSrcweir }
2257cdf0e10cSrcweir 
2258cdf0e10cSrcweir void SvxXShadowPreview::SetShadowPosition(const Point& rPos)
2259cdf0e10cSrcweir {
2260cdf0e10cSrcweir     Rectangle aObjectPosition(mpRectangleObject->GetSnapRect());
2261cdf0e10cSrcweir     aObjectPosition.Move(rPos.X(), rPos.Y());
2262cdf0e10cSrcweir     mpRectangleShadow->SetSnapRect(aObjectPosition);
2263cdf0e10cSrcweir }
2264cdf0e10cSrcweir 
2265cdf0e10cSrcweir void SvxXShadowPreview::Paint( const Rectangle& )
2266cdf0e10cSrcweir {
2267cdf0e10cSrcweir 	LocalPrePaint();
2268cdf0e10cSrcweir 
2269cdf0e10cSrcweir     sdr::contact::SdrObjectVector aObjectVector;
2270cdf0e10cSrcweir 
2271cdf0e10cSrcweir     aObjectVector.push_back(mpRectangleShadow);
2272cdf0e10cSrcweir 	aObjectVector.push_back(mpRectangleObject);
2273cdf0e10cSrcweir 
2274cdf0e10cSrcweir     sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0);
2275cdf0e10cSrcweir 	sdr::contact::DisplayInfo aDisplayInfo;
2276cdf0e10cSrcweir 
2277cdf0e10cSrcweir 	aPainter.ProcessDisplay(aDisplayInfo);
2278cdf0e10cSrcweir 
2279cdf0e10cSrcweir     LocalPostPaint();
2280cdf0e10cSrcweir }
2281cdf0e10cSrcweir 
2282cdf0e10cSrcweir // -----------------------------------------------------------------------
2283cdf0e10cSrcweir // eof
2284