xref: /aoo41x/main/svx/source/dialog/dlgctrl.cxx (revision 4d7c9de0)
1f6e50924SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f6e50924SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f6e50924SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f6e50924SAndrew Rist  * distributed with this work for additional information
6f6e50924SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f6e50924SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f6e50924SAndrew Rist  * "License"); you may not use this file except in compliance
9f6e50924SAndrew Rist  * with the License.  You may obtain a copy of the License at
10f6e50924SAndrew Rist  *
11f6e50924SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12f6e50924SAndrew Rist  *
13f6e50924SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f6e50924SAndrew Rist  * software distributed under the License is distributed on an
15f6e50924SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f6e50924SAndrew Rist  * KIND, either express or implied.  See the License for the
17f6e50924SAndrew Rist  * specific language governing permissions and limitations
18f6e50924SAndrew Rist  * under the License.
19f6e50924SAndrew Rist  *
20f6e50924SAndrew Rist  *************************************************************/
21f6e50924SAndrew Rist 
22f6e50924SAndrew 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 #include <vcl/svapp.hxx>
30cdf0e10cSrcweir #include <svx/xtable.hxx>
31cdf0e10cSrcweir #include <svx/xpool.hxx>
32cdf0e10cSrcweir #include <svx/dialogs.hrc>
3370d3707aSArmin Le Grand #include <accessibility.hrc>
34cdf0e10cSrcweir #include <svx/dlgctrl.hxx>
35cdf0e10cSrcweir #include <svx/dialmgr.hxx>
36cdf0e10cSrcweir #include <tools/poly.hxx>
37cdf0e10cSrcweir #include <vcl/region.hxx>
38cdf0e10cSrcweir #include <vcl/gradient.hxx>
39cdf0e10cSrcweir #include <vcl/hatch.hxx>
409b8096d0SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTOBJECT_HPP_
419b8096d0SSteve Yin #include <com/sun/star/accessibility/AccessibleEventObject.hpp>
429b8096d0SSteve Yin #endif
439b8096d0SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTID_HPP_
449b8096d0SSteve Yin #include <com/sun/star/accessibility/AccessibleEventId.hpp>
459b8096d0SSteve Yin #endif
469b8096d0SSteve Yin #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_
479b8096d0SSteve Yin #include <com/sun/star/accessibility/AccessibleStateType.hpp>
489b8096d0SSteve Yin #endif
499b8096d0SSteve Yin #include "svxpixelctlaccessiblecontext.hxx"
50cdf0e10cSrcweir #include <svtools/colorcfg.hxx>
5170d3707aSArmin Le Grand #include <svxrectctaccessiblecontext.hxx>
52cdf0e10cSrcweir #include <com/sun/star/lang/XUnoTunnel.hpp>
53cdf0e10cSrcweir #include <basegfx/point/b2dpoint.hxx>
54cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
55cdf0e10cSrcweir #include <svx/svdorect.hxx>
56cdf0e10cSrcweir #include <svx/svdmodel.hxx>
57cdf0e10cSrcweir #include <svx/svdopath.hxx>
58cdf0e10cSrcweir #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
59cdf0e10cSrcweir #include <svx/sdr/contact/displayinfo.hxx>
6070d3707aSArmin Le Grand #include <vcl/bmpacc.hxx>
6170d3707aSArmin Le Grand #include <svx/xbtmpit.hxx>
62cdf0e10cSrcweir 
63cdf0e10cSrcweir #define OUTPUT_DRAWMODE_COLOR		(DRAWMODE_DEFAULT)
64cdf0e10cSrcweir #define OUTPUT_DRAWMODE_CONTRAST	(DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT)
65cdf0e10cSrcweir 
66cdf0e10cSrcweir using namespace ::com::sun::star::uno;
67cdf0e10cSrcweir using namespace ::com::sun::star::lang;
68cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 
71cdf0e10cSrcweir /*************************************************************************
72cdf0e10cSrcweir |*
73cdf0e10cSrcweir |*	Control zur Darstellung und Auswahl der Eckpunkte (und Mittelpunkt)
74cdf0e10cSrcweir |*	eines Objekts
75cdf0e10cSrcweir |*
76cdf0e10cSrcweir \************************************************************************/
77cdf0e10cSrcweir 
GetRectBitmap(void)78cdf0e10cSrcweir Bitmap& SvxRectCtl::GetRectBitmap( void )
79cdf0e10cSrcweir {
80cdf0e10cSrcweir 	if( !pBitmap )
81cdf0e10cSrcweir 		InitRectBitmap();
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 	return *pBitmap;
84cdf0e10cSrcweir }
85cdf0e10cSrcweir 
SvxRectCtl(Window * pParent,const ResId & rResId,RECT_POINT eRpt,sal_uInt16 nBorder,sal_uInt16 nCircle,CTL_STYLE eStyle)86cdf0e10cSrcweir SvxRectCtl::SvxRectCtl( Window* pParent, const ResId& rResId, RECT_POINT eRpt,
87cdf0e10cSrcweir 						sal_uInt16 nBorder, sal_uInt16 nCircle, CTL_STYLE eStyle ) :
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	Control( pParent, rResId ),
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	pAccContext	( NULL ),
92cdf0e10cSrcweir     nBorderWidth( nBorder ),
93cdf0e10cSrcweir     nRadius     ( nCircle),
94cdf0e10cSrcweir     eDefRP      ( eRpt ),
95cdf0e10cSrcweir     eCS         ( eStyle ),
96cdf0e10cSrcweir 	pBitmap		( NULL ),
97cdf0e10cSrcweir     m_nState    ( 0 ),
98cdf0e10cSrcweir     mbCompleteDisable(sal_False)
99cdf0e10cSrcweir {
100cdf0e10cSrcweir 	SetMapMode( MAP_100TH_MM );
101cdf0e10cSrcweir     Resize_Impl();
102cdf0e10cSrcweir }
103cdf0e10cSrcweir 
104cdf0e10cSrcweir // -----------------------------------------------------------------------
105cdf0e10cSrcweir 
~SvxRectCtl()106cdf0e10cSrcweir SvxRectCtl::~SvxRectCtl()
107cdf0e10cSrcweir {
108cdf0e10cSrcweir 	delete pBitmap;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 	if( pAccContext )
111cdf0e10cSrcweir 		pAccContext->release();
112cdf0e10cSrcweir }
113cdf0e10cSrcweir 
114cdf0e10cSrcweir // -----------------------------------------------------------------------
Resize()115cdf0e10cSrcweir void SvxRectCtl::Resize()
116cdf0e10cSrcweir {
117cdf0e10cSrcweir     Resize_Impl();
118cdf0e10cSrcweir     Control::Resize();
119cdf0e10cSrcweir }
120cdf0e10cSrcweir 
121cdf0e10cSrcweir // -----------------------------------------------------------------------
122cdf0e10cSrcweir 
Resize_Impl()123cdf0e10cSrcweir void SvxRectCtl::Resize_Impl()
124cdf0e10cSrcweir {
125cdf0e10cSrcweir     aSize = GetOutputSize();
126cdf0e10cSrcweir 
127cdf0e10cSrcweir 	switch( eCS )
128cdf0e10cSrcweir 	{
129cdf0e10cSrcweir 		case CS_RECT:
130cdf0e10cSrcweir 		case CS_ANGLE:
131cdf0e10cSrcweir 		case CS_SHADOW:
132cdf0e10cSrcweir 			aPtLT = Point( 0 + nBorderWidth,  0 + nBorderWidth );
133cdf0e10cSrcweir 			aPtMT = Point( aSize.Width() / 2, 0 + nBorderWidth );
134cdf0e10cSrcweir 			aPtRT = Point( aSize.Width() - nBorderWidth, 0 + nBorderWidth );
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 			aPtLM = Point( 0 + nBorderWidth,  aSize.Height() / 2 );
137cdf0e10cSrcweir 			aPtMM = Point( aSize.Width() / 2, aSize.Height() / 2 );
138cdf0e10cSrcweir 			aPtRM = Point( aSize.Width() - nBorderWidth, aSize.Height() / 2 );
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 			aPtLB = Point( 0 + nBorderWidth,	aSize.Height() - nBorderWidth );
141cdf0e10cSrcweir 			aPtMB = Point( aSize.Width() / 2,	aSize.Height() - nBorderWidth );
142cdf0e10cSrcweir 			aPtRB = Point( aSize.Width() - nBorderWidth, aSize.Height() - nBorderWidth );
143cdf0e10cSrcweir 		break;
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 		case CS_LINE:
146cdf0e10cSrcweir 			aPtLT = Point( 0 + 3 * nBorderWidth,  0 + nBorderWidth );
147cdf0e10cSrcweir 			aPtMT = Point( aSize.Width() / 2, 0 + nBorderWidth );
148cdf0e10cSrcweir 			aPtRT = Point( aSize.Width() - 3 * nBorderWidth, 0 + nBorderWidth );
149cdf0e10cSrcweir 
150cdf0e10cSrcweir 			aPtLM = Point( 0 + 3 * nBorderWidth,  aSize.Height() / 2 );
151cdf0e10cSrcweir 			aPtMM = Point( aSize.Width() / 2, aSize.Height() / 2 );
152cdf0e10cSrcweir 			aPtRM = Point( aSize.Width() - 3 * nBorderWidth, aSize.Height() / 2 );
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 			aPtLB = Point( 0 + 3 * nBorderWidth,	aSize.Height() - nBorderWidth );
155cdf0e10cSrcweir 			aPtMB = Point( aSize.Width() / 2,	aSize.Height() - nBorderWidth );
156cdf0e10cSrcweir 			aPtRB = Point( aSize.Width() - 3 * nBorderWidth, aSize.Height() - nBorderWidth );
157cdf0e10cSrcweir 		break;
158cdf0e10cSrcweir 	}
159cdf0e10cSrcweir 	Reset();
160cdf0e10cSrcweir 	InitSettings( sal_True, sal_True );
161cdf0e10cSrcweir }
162cdf0e10cSrcweir // -----------------------------------------------------------------------
163cdf0e10cSrcweir 
InitRectBitmap(void)164cdf0e10cSrcweir void SvxRectCtl::InitRectBitmap( void )
165cdf0e10cSrcweir {
166cdf0e10cSrcweir 	if( pBitmap )
167cdf0e10cSrcweir 		delete pBitmap;
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 	const StyleSettings&	rStyles = Application::GetSettings().GetStyleSettings();
170cdf0e10cSrcweir 	svtools::ColorConfig aColorConfig;
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 	pBitmap = new Bitmap( SVX_RES( RID_SVXCTRL_RECTBTNS ) );
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 	// set bitmap-colors
175cdf0e10cSrcweir 	Color	aColorAry1[7];
176cdf0e10cSrcweir 	Color	aColorAry2[7];
177cdf0e10cSrcweir 	aColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 );	// light-gray
178cdf0e10cSrcweir 	aColorAry1[1] = Color( 0xFF, 0xFF, 0x00 );	// yellow
179cdf0e10cSrcweir 	aColorAry1[2] = Color( 0xFF, 0xFF, 0xFF );	// white
180cdf0e10cSrcweir 	aColorAry1[3] = Color( 0x80, 0x80, 0x80 );	// dark-gray
181cdf0e10cSrcweir 	aColorAry1[4] = Color( 0x00, 0x00, 0x00 );  // black
182cdf0e10cSrcweir 	aColorAry1[5] = Color( 0x00, 0xFF, 0x00 );	// green
183cdf0e10cSrcweir 	aColorAry1[6] = Color( 0x00, 0x00, 0xFF );	// blue
184cdf0e10cSrcweir 	aColorAry2[0] = rStyles.GetDialogColor();		// background
185cdf0e10cSrcweir 	aColorAry2[1] = rStyles.GetWindowColor();
186cdf0e10cSrcweir 	aColorAry2[2] = rStyles.GetLightColor();
187cdf0e10cSrcweir 	aColorAry2[3] = rStyles.GetShadowColor();
188cdf0e10cSrcweir 	aColorAry2[4] = rStyles.GetDarkShadowColor();
189cdf0e10cSrcweir 	aColorAry2[5] = Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
190cdf0e10cSrcweir 	aColorAry2[6] = rStyles.GetDialogColor();
191cdf0e10cSrcweir 
192cdf0e10cSrcweir #ifdef DBG_UTIL
193cdf0e10cSrcweir 	static sal_Bool		bModify = sal_False;
194cdf0e10cSrcweir 	sal_Bool&			rModify = bModify;
195cdf0e10cSrcweir 	if( rModify )
196cdf0e10cSrcweir 	{
197cdf0e10cSrcweir 		static int		n = 0;
198cdf0e10cSrcweir 		static sal_uInt8	r = 0xFF;
199cdf0e10cSrcweir 		static sal_uInt8	g = 0x00;
200cdf0e10cSrcweir 		static sal_uInt8	b = 0xFF;
201cdf0e10cSrcweir 		int&			rn = n;
202cdf0e10cSrcweir 		sal_uInt8&			rr = r;
203cdf0e10cSrcweir 		sal_uInt8&			rg = g;
204cdf0e10cSrcweir 		sal_uInt8&			rb = b;
205cdf0e10cSrcweir 		aColorAry2[ rn ] = Color( rr, rg, rb );
206cdf0e10cSrcweir 	}
207cdf0e10cSrcweir #endif
208cdf0e10cSrcweir 
209cdf0e10cSrcweir 	pBitmap->Replace( aColorAry1, aColorAry2, 7, NULL );
210cdf0e10cSrcweir }
211cdf0e10cSrcweir 
212cdf0e10cSrcweir // -----------------------------------------------------------------------
213cdf0e10cSrcweir 
InitSettings(sal_Bool bForeground,sal_Bool bBackground)214cdf0e10cSrcweir void SvxRectCtl::InitSettings( sal_Bool bForeground, sal_Bool bBackground )
215cdf0e10cSrcweir {
216cdf0e10cSrcweir 	const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 	if( bForeground )
219cdf0e10cSrcweir 	{
220cdf0e10cSrcweir 		svtools::ColorConfig aColorConfig;
221cdf0e10cSrcweir 		Color aTextColor( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
222cdf0e10cSrcweir 
223cdf0e10cSrcweir 		if ( IsControlForeground() )
224cdf0e10cSrcweir 			aTextColor = GetControlForeground();
225cdf0e10cSrcweir 		SetTextColor( aTextColor );
226cdf0e10cSrcweir 	}
227cdf0e10cSrcweir 
228cdf0e10cSrcweir 	if( bBackground )
229cdf0e10cSrcweir 	{
230cdf0e10cSrcweir 		if ( IsControlBackground() )
231cdf0e10cSrcweir 			SetBackground( GetControlBackground() );
232cdf0e10cSrcweir 		else
233cdf0e10cSrcweir 			SetBackground( rStyleSettings.GetWindowColor() );
234cdf0e10cSrcweir 	}
235cdf0e10cSrcweir 
236cdf0e10cSrcweir 	delete pBitmap;
237cdf0e10cSrcweir 	pBitmap = NULL;		// forces new creating of bitmap
238cdf0e10cSrcweir 
239cdf0e10cSrcweir 	Invalidate();
240cdf0e10cSrcweir }
241cdf0e10cSrcweir 
242cdf0e10cSrcweir /*************************************************************************
243cdf0e10cSrcweir |*
244cdf0e10cSrcweir |*	Das angeklickte Rechteck (3 x 3) wird ermittelt und der Parent (Dialog)
245cdf0e10cSrcweir |*	wird benachrichtigt, dass der Punkt geaendert wurde
246cdf0e10cSrcweir |*
247cdf0e10cSrcweir \************************************************************************/
248cdf0e10cSrcweir 
MouseButtonDown(const MouseEvent & rMEvt)249cdf0e10cSrcweir void SvxRectCtl::MouseButtonDown( const MouseEvent& rMEvt )
250cdf0e10cSrcweir {
251cdf0e10cSrcweir 	// #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
252cdf0e10cSrcweir 	if(!IsCompletelyDisabled())
253cdf0e10cSrcweir 	{
254cdf0e10cSrcweir 		Point aPtLast = aPtNew;
255cdf0e10cSrcweir 
256cdf0e10cSrcweir 		aPtNew = GetApproxLogPtFromPixPt( rMEvt.GetPosPixel() );
257cdf0e10cSrcweir 
258cdf0e10cSrcweir 		if( aPtNew == aPtMM && ( eCS == CS_SHADOW || eCS == CS_ANGLE ) )
259cdf0e10cSrcweir 		{
260cdf0e10cSrcweir 			aPtNew = aPtLast;
261cdf0e10cSrcweir 		}
262cdf0e10cSrcweir 		else
263cdf0e10cSrcweir 		{
264cdf0e10cSrcweir 			Invalidate( Rectangle( aPtLast - Point( nRadius, nRadius ),
265cdf0e10cSrcweir 								   aPtLast + Point( nRadius, nRadius ) ) );
266cdf0e10cSrcweir 			Invalidate( Rectangle( aPtNew - Point( nRadius, nRadius ),
267cdf0e10cSrcweir 								   aPtNew + Point( nRadius, nRadius ) ) );
268cdf0e10cSrcweir 			eRP = GetRPFromPoint( aPtNew );
269cdf0e10cSrcweir 
270cdf0e10cSrcweir 			SetActualRP( eRP );
271cdf0e10cSrcweir 
272cdf0e10cSrcweir 			if( WINDOW_TABPAGE == GetParent()->GetType() )
273cdf0e10cSrcweir 				( (SvxTabPage*) GetParent() )->PointChanged( this, eRP );
274cdf0e10cSrcweir 		}
275cdf0e10cSrcweir 	}
276cdf0e10cSrcweir }
277cdf0e10cSrcweir 
278cdf0e10cSrcweir // -----------------------------------------------------------------------
279cdf0e10cSrcweir 
KeyInput(const KeyEvent & rKeyEvt)280cdf0e10cSrcweir void SvxRectCtl::KeyInput( const KeyEvent& rKeyEvt )
281cdf0e10cSrcweir {
282cdf0e10cSrcweir 	// #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
283cdf0e10cSrcweir 	if(!IsCompletelyDisabled())
284cdf0e10cSrcweir 	{
285cdf0e10cSrcweir 		RECT_POINT eNewRP = eRP;
286cdf0e10cSrcweir 		sal_Bool bUseMM = (eCS != CS_SHADOW) && (eCS != CS_ANGLE);
287cdf0e10cSrcweir 
288cdf0e10cSrcweir 		switch( rKeyEvt.GetKeyCode().GetCode() )
289cdf0e10cSrcweir 		{
290cdf0e10cSrcweir 			case KEY_DOWN:
291cdf0e10cSrcweir 			{
292cdf0e10cSrcweir 				if( !(m_nState & CS_NOVERT) )
293cdf0e10cSrcweir 					switch( eNewRP )
294cdf0e10cSrcweir 					{
295cdf0e10cSrcweir 						case RP_LT: eNewRP = RP_LM; break;
296cdf0e10cSrcweir 						case RP_MT: eNewRP = bUseMM ? RP_MM : RP_MB; break;
297cdf0e10cSrcweir 						case RP_RT: eNewRP = RP_RM; break;
298cdf0e10cSrcweir 						case RP_LM: eNewRP = RP_LB; break;
299cdf0e10cSrcweir 						case RP_MM: eNewRP = RP_MB; break;
300cdf0e10cSrcweir 						case RP_RM: eNewRP = RP_RB; break;
301cdf0e10cSrcweir                         default: ; //prevent warning
302cdf0e10cSrcweir                     }
303cdf0e10cSrcweir 			}
304cdf0e10cSrcweir 			break;
305cdf0e10cSrcweir 			case KEY_UP:
306cdf0e10cSrcweir 			{
307cdf0e10cSrcweir 				if( !(m_nState & CS_NOVERT) )
308cdf0e10cSrcweir 					switch( eNewRP )
309cdf0e10cSrcweir 					{
310cdf0e10cSrcweir 						case RP_LM: eNewRP = RP_LT; break;
311cdf0e10cSrcweir 						case RP_MM: eNewRP = RP_MT; break;
312cdf0e10cSrcweir 						case RP_RM: eNewRP = RP_RT; break;
313cdf0e10cSrcweir 						case RP_LB: eNewRP = RP_LM; break;
314cdf0e10cSrcweir 						case RP_MB: eNewRP = bUseMM ? RP_MM : RP_MT; break;
315cdf0e10cSrcweir 						case RP_RB: eNewRP = RP_RM; break;
316cdf0e10cSrcweir                         default: ; //prevent warning
317cdf0e10cSrcweir                     }
318cdf0e10cSrcweir 			}
319cdf0e10cSrcweir 			break;
320cdf0e10cSrcweir 			case KEY_LEFT:
321cdf0e10cSrcweir 			{
322cdf0e10cSrcweir 				if( !(m_nState & CS_NOHORZ) )
323cdf0e10cSrcweir 					switch( eNewRP )
324cdf0e10cSrcweir 					{
325cdf0e10cSrcweir 						case RP_MT: eNewRP = RP_LT; break;
326cdf0e10cSrcweir 						case RP_RT: eNewRP = RP_MT; break;
327cdf0e10cSrcweir 						case RP_MM: eNewRP = RP_LM; break;
328cdf0e10cSrcweir 						case RP_RM: eNewRP = bUseMM ? RP_MM : RP_LM; break;
329cdf0e10cSrcweir 						case RP_MB: eNewRP = RP_LB; break;
330cdf0e10cSrcweir 						case RP_RB: eNewRP = RP_MB; break;
331cdf0e10cSrcweir                         default: ; //prevent warning
332cdf0e10cSrcweir                     }
333cdf0e10cSrcweir 			}
334cdf0e10cSrcweir 			break;
335cdf0e10cSrcweir 			case KEY_RIGHT:
336cdf0e10cSrcweir 			{
337cdf0e10cSrcweir 				if( !(m_nState & CS_NOHORZ) )
338cdf0e10cSrcweir 					switch( eNewRP )
339cdf0e10cSrcweir 					{
340cdf0e10cSrcweir 						case RP_LT: eNewRP = RP_MT; break;
341cdf0e10cSrcweir 						case RP_MT: eNewRP = RP_RT; break;
342cdf0e10cSrcweir 						case RP_LM: eNewRP = bUseMM ? RP_MM : RP_RM; break;
343cdf0e10cSrcweir 						case RP_MM: eNewRP = RP_RM; break;
344cdf0e10cSrcweir 						case RP_LB: eNewRP = RP_MB; break;
345cdf0e10cSrcweir 						case RP_MB: eNewRP = RP_RB; break;
346cdf0e10cSrcweir                         default: ; //prevent warning
347cdf0e10cSrcweir                     }
348cdf0e10cSrcweir 			}
349cdf0e10cSrcweir 			break;
350cdf0e10cSrcweir 			default:
351cdf0e10cSrcweir 				Control::KeyInput( rKeyEvt );
352cdf0e10cSrcweir 				return;
353cdf0e10cSrcweir 		}
354cdf0e10cSrcweir 		if( eNewRP != eRP )
355cdf0e10cSrcweir 		{
356cdf0e10cSrcweir 			SetActualRP( eNewRP );
357cdf0e10cSrcweir 
358cdf0e10cSrcweir 			if( WINDOW_TABPAGE == GetParent()->GetType() )
359cdf0e10cSrcweir 				( (SvxTabPage*) GetParent() )->PointChanged( this, eRP );
360cdf0e10cSrcweir 
361cdf0e10cSrcweir 			SetFocusRect();
362cdf0e10cSrcweir 		}
363cdf0e10cSrcweir 	}
364cdf0e10cSrcweir }
365cdf0e10cSrcweir 
366cdf0e10cSrcweir // -----------------------------------------------------------------------
367cdf0e10cSrcweir 
StateChanged(StateChangedType nType)368cdf0e10cSrcweir void SvxRectCtl::StateChanged( StateChangedType nType )
369cdf0e10cSrcweir {
370cdf0e10cSrcweir 	if ( nType == STATE_CHANGE_CONTROLFOREGROUND )
371cdf0e10cSrcweir 		InitSettings( sal_True, sal_False );
372cdf0e10cSrcweir 	else if ( nType == STATE_CHANGE_CONTROLBACKGROUND )
373cdf0e10cSrcweir 		InitSettings( sal_False, sal_True );
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 	Window::StateChanged( nType );
376cdf0e10cSrcweir }
377cdf0e10cSrcweir 
378cdf0e10cSrcweir // -----------------------------------------------------------------------
379cdf0e10cSrcweir 
DataChanged(const DataChangedEvent & rDCEvt)380cdf0e10cSrcweir void SvxRectCtl::DataChanged( const DataChangedEvent& rDCEvt )
381cdf0e10cSrcweir {
382cdf0e10cSrcweir 	if ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
383cdf0e10cSrcweir 		InitSettings( sal_True, sal_True );
384cdf0e10cSrcweir 	else
385cdf0e10cSrcweir 		Window::DataChanged( rDCEvt );
386cdf0e10cSrcweir }
387cdf0e10cSrcweir 
388cdf0e10cSrcweir /*************************************************************************
389cdf0e10cSrcweir |*
390cdf0e10cSrcweir |*	Zeichnet das Control (Rechteck mit 9 Kreisen)
391cdf0e10cSrcweir |*
392cdf0e10cSrcweir \************************************************************************/
393cdf0e10cSrcweir 
Paint(const Rectangle &)394cdf0e10cSrcweir void SvxRectCtl::Paint( const Rectangle& )
395cdf0e10cSrcweir {
396cdf0e10cSrcweir 	Point	aPtDiff( PixelToLogic( Point( 1, 1 ) ) );
397cdf0e10cSrcweir 
398cdf0e10cSrcweir 	const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
399cdf0e10cSrcweir 
400cdf0e10cSrcweir 	SetLineColor( rStyles.GetDialogColor() );
401cdf0e10cSrcweir 	SetFillColor( rStyles.GetDialogColor() );
402cdf0e10cSrcweir 	DrawRect( Rectangle( Point(0,0), GetOutputSize() ) );
403cdf0e10cSrcweir 
404cdf0e10cSrcweir 	if( IsEnabled() )
405cdf0e10cSrcweir 		SetLineColor( rStyles.GetLabelTextColor() );
406cdf0e10cSrcweir 	else
407cdf0e10cSrcweir 		SetLineColor( rStyles.GetShadowColor() );
408cdf0e10cSrcweir 
409cdf0e10cSrcweir 	SetFillColor();
410cdf0e10cSrcweir 
411cdf0e10cSrcweir 	switch( eCS )
412cdf0e10cSrcweir 	{
413cdf0e10cSrcweir 
414cdf0e10cSrcweir 		case CS_RECT:
415cdf0e10cSrcweir 		case CS_SHADOW:
416cdf0e10cSrcweir 			if( !IsEnabled() )
417cdf0e10cSrcweir 			{
418cdf0e10cSrcweir 				Color aOldCol = GetLineColor();
419cdf0e10cSrcweir 				SetLineColor( rStyles.GetLightColor() );
420cdf0e10cSrcweir 				DrawRect( Rectangle( aPtLT + aPtDiff, aPtRB + aPtDiff ) );
421cdf0e10cSrcweir 				SetLineColor( aOldCol );
422cdf0e10cSrcweir 			}
423cdf0e10cSrcweir 			DrawRect( Rectangle( aPtLT, aPtRB ) );
424cdf0e10cSrcweir 		break;
425cdf0e10cSrcweir 
426cdf0e10cSrcweir 		case CS_LINE:
427cdf0e10cSrcweir 			if( !IsEnabled() )
428cdf0e10cSrcweir 			{
429cdf0e10cSrcweir 				Color aOldCol = GetLineColor();
430cdf0e10cSrcweir 				SetLineColor( rStyles.GetLightColor() );
431cdf0e10cSrcweir 				DrawLine( aPtLM - Point( 2 * nBorderWidth, 0) + aPtDiff,
432cdf0e10cSrcweir 						  aPtRM + Point( 2 * nBorderWidth, 0 ) + aPtDiff );
433cdf0e10cSrcweir 				SetLineColor( aOldCol );
434cdf0e10cSrcweir 			}
435cdf0e10cSrcweir 			DrawLine( aPtLM - Point( 2 * nBorderWidth, 0),
436cdf0e10cSrcweir 					  aPtRM + Point( 2 * nBorderWidth, 0 ) );
437cdf0e10cSrcweir 		break;
438cdf0e10cSrcweir 
439cdf0e10cSrcweir 		case CS_ANGLE:
440cdf0e10cSrcweir 			if( !IsEnabled() )
441cdf0e10cSrcweir 			{
442cdf0e10cSrcweir 				Color aOldCol = GetLineColor();
443cdf0e10cSrcweir 				SetLineColor( rStyles.GetLightColor() );
444cdf0e10cSrcweir 				DrawLine( aPtLT + aPtDiff, aPtRB + aPtDiff );
445cdf0e10cSrcweir 				DrawLine( aPtLB + aPtDiff, aPtRT + aPtDiff );
446cdf0e10cSrcweir 				DrawLine( aPtLM + aPtDiff, aPtRM + aPtDiff );
447cdf0e10cSrcweir 				DrawLine( aPtMT + aPtDiff, aPtMB + aPtDiff );
448cdf0e10cSrcweir 				SetLineColor( aOldCol );
449cdf0e10cSrcweir 			}
450cdf0e10cSrcweir 			DrawLine( aPtLT, aPtRB );
451cdf0e10cSrcweir 			DrawLine( aPtLB, aPtRT );
452cdf0e10cSrcweir 			DrawLine( aPtLM, aPtRM );
453cdf0e10cSrcweir 			DrawLine( aPtMT, aPtMB );
454cdf0e10cSrcweir 		break;
455cdf0e10cSrcweir 
456cdf0e10cSrcweir 		default:
457cdf0e10cSrcweir 			break;
458cdf0e10cSrcweir 	}
459cdf0e10cSrcweir 	SetFillColor( GetBackground().GetColor() );
460cdf0e10cSrcweir 
461cdf0e10cSrcweir 	Size aBtnSize( 11, 11 );
462cdf0e10cSrcweir 	Size aDstBtnSize(  PixelToLogic( aBtnSize ) );
463cdf0e10cSrcweir 	Point aToCenter( aDstBtnSize.Width() >> 1, aDstBtnSize.Height() >> 1);
464cdf0e10cSrcweir 	Point aBtnPnt1( IsEnabled()?0:22,0 );
465cdf0e10cSrcweir 	Point aBtnPnt2( 11,0 );
466cdf0e10cSrcweir 	Point aBtnPnt3( 22,0 );
467cdf0e10cSrcweir 
468cdf0e10cSrcweir 	sal_Bool bNoHorz = (m_nState & CS_NOHORZ) != 0;
469cdf0e10cSrcweir 	sal_Bool bNoVert = (m_nState & CS_NOVERT) != 0;
470cdf0e10cSrcweir 
471cdf0e10cSrcweir 	Bitmap&			rBitmap = GetRectBitmap();
472cdf0e10cSrcweir 
473cdf0e10cSrcweir 	// #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
474cdf0e10cSrcweir 	if(IsCompletelyDisabled())
475cdf0e10cSrcweir 	{
476cdf0e10cSrcweir 		DrawBitmap( aPtLT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
477cdf0e10cSrcweir 		DrawBitmap( aPtMT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
478cdf0e10cSrcweir 		DrawBitmap( aPtRT - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
479cdf0e10cSrcweir 		DrawBitmap( aPtLM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
480cdf0e10cSrcweir 		if( eCS == CS_RECT || eCS == CS_LINE )
481cdf0e10cSrcweir 			DrawBitmap( aPtMM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
482cdf0e10cSrcweir 		DrawBitmap( aPtRM - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
483cdf0e10cSrcweir 		DrawBitmap( aPtLB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
484cdf0e10cSrcweir 		DrawBitmap( aPtMB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
485cdf0e10cSrcweir 		DrawBitmap( aPtRB - aToCenter, aDstBtnSize, aBtnPnt3, aBtnSize, rBitmap );
486cdf0e10cSrcweir 	}
487cdf0e10cSrcweir 	else
488cdf0e10cSrcweir 	{
489cdf0e10cSrcweir 		DrawBitmap( aPtLT - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
490cdf0e10cSrcweir 		DrawBitmap( aPtMT - aToCenter, aDstBtnSize, bNoVert?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
491cdf0e10cSrcweir 		DrawBitmap( aPtRT - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
492cdf0e10cSrcweir 
493cdf0e10cSrcweir 		DrawBitmap( aPtLM - aToCenter, aDstBtnSize, bNoHorz?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
494cdf0e10cSrcweir 
495cdf0e10cSrcweir 		// Mittelpunkt bei Rechteck und Linie
496cdf0e10cSrcweir 		if( eCS == CS_RECT || eCS == CS_LINE )
497cdf0e10cSrcweir 			DrawBitmap( aPtMM - aToCenter, aDstBtnSize, aBtnPnt1, aBtnSize, rBitmap );
498cdf0e10cSrcweir 
499cdf0e10cSrcweir 		DrawBitmap( aPtRM - aToCenter, aDstBtnSize, bNoHorz?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 		DrawBitmap( aPtLB - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
502cdf0e10cSrcweir 		DrawBitmap( aPtMB - aToCenter, aDstBtnSize, bNoVert?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
503cdf0e10cSrcweir 		DrawBitmap( aPtRB - aToCenter, aDstBtnSize, (bNoHorz | bNoVert)?aBtnPnt3:aBtnPnt1, aBtnSize, rBitmap );
504cdf0e10cSrcweir 	}
505cdf0e10cSrcweir 
506cdf0e10cSrcweir 	// draw active button, avoid center pos for angle
507cdf0e10cSrcweir 	// #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
508cdf0e10cSrcweir 	if(!IsCompletelyDisabled())
509cdf0e10cSrcweir 	{
510cdf0e10cSrcweir 		if( IsEnabled() && (eCS != CS_ANGLE || aPtNew != aPtMM) )
511cdf0e10cSrcweir 		{
512cdf0e10cSrcweir 			Point		aCenterPt( aPtNew );
513cdf0e10cSrcweir 			aCenterPt -= aToCenter;
514cdf0e10cSrcweir 
515cdf0e10cSrcweir 			DrawBitmap( aCenterPt, aDstBtnSize, aBtnPnt2, aBtnSize, rBitmap );
516cdf0e10cSrcweir 		}
517cdf0e10cSrcweir 	}
518cdf0e10cSrcweir }
519cdf0e10cSrcweir 
520cdf0e10cSrcweir /*************************************************************************
521cdf0e10cSrcweir |*
522cdf0e10cSrcweir |*	Konvertiert RECT_POINT in Point
523cdf0e10cSrcweir |*
524cdf0e10cSrcweir \************************************************************************/
525cdf0e10cSrcweir 
GetPointFromRP(RECT_POINT _eRP) const526cdf0e10cSrcweir Point SvxRectCtl::GetPointFromRP( RECT_POINT _eRP) const
527cdf0e10cSrcweir {
528cdf0e10cSrcweir     switch( _eRP )
529cdf0e10cSrcweir 	{
530cdf0e10cSrcweir 		case RP_LT: return aPtLT;
531cdf0e10cSrcweir 		case RP_MT: return aPtMT;
532cdf0e10cSrcweir 		case RP_RT: return aPtRT;
533cdf0e10cSrcweir 		case RP_LM: return aPtLM;
534cdf0e10cSrcweir 		case RP_MM: return aPtMM;
535cdf0e10cSrcweir 		case RP_RM: return aPtRM;
536cdf0e10cSrcweir 		case RP_LB: return aPtLB;
537cdf0e10cSrcweir 		case RP_MB: return aPtMB;
538cdf0e10cSrcweir 		case RP_RB: return aPtRB;
539cdf0e10cSrcweir 	}
540cdf0e10cSrcweir 	return( aPtMM ); // default
541cdf0e10cSrcweir }
542cdf0e10cSrcweir 
543cdf0e10cSrcweir 
SetFocusRect(const Rectangle * pRect)544cdf0e10cSrcweir void SvxRectCtl::SetFocusRect( const Rectangle* pRect )
545cdf0e10cSrcweir {
546cdf0e10cSrcweir 	HideFocus();
547cdf0e10cSrcweir 
548cdf0e10cSrcweir 	if( pRect )
549cdf0e10cSrcweir 		ShowFocus( *pRect );
550cdf0e10cSrcweir 	else
551cdf0e10cSrcweir 		ShowFocus( CalculateFocusRectangle() );
552cdf0e10cSrcweir }
553cdf0e10cSrcweir 
SetActualRPWithoutInvalidate(RECT_POINT eNewRP)554cdf0e10cSrcweir Point SvxRectCtl::SetActualRPWithoutInvalidate( RECT_POINT eNewRP )
555cdf0e10cSrcweir {
556cdf0e10cSrcweir 	Point aPtLast = aPtNew;
557cdf0e10cSrcweir 	aPtNew = GetPointFromRP( eNewRP );
558cdf0e10cSrcweir 
559cdf0e10cSrcweir 	if( (m_nState & CS_NOHORZ) != 0 )
560cdf0e10cSrcweir 		aPtNew.X() = aPtMM.X();
561cdf0e10cSrcweir 
562cdf0e10cSrcweir 	if( (m_nState & CS_NOVERT) != 0 )
563cdf0e10cSrcweir 		aPtNew.Y() = aPtMM.Y();
564cdf0e10cSrcweir 
565cdf0e10cSrcweir 	eNewRP = GetRPFromPoint( aPtNew );
566cdf0e10cSrcweir 
567cdf0e10cSrcweir 	eDefRP = eNewRP;
568cdf0e10cSrcweir 	eRP = eNewRP;
569cdf0e10cSrcweir 
570cdf0e10cSrcweir 	return aPtLast;
571cdf0e10cSrcweir }
572cdf0e10cSrcweir 
GetFocus()573cdf0e10cSrcweir void SvxRectCtl::GetFocus()
574cdf0e10cSrcweir {
575cdf0e10cSrcweir 	SetFocusRect();
5769b8096d0SSteve Yin 	//Solution: Send the accessible focused event
5779b8096d0SSteve Yin 	Control::GetFocus();
5789b8096d0SSteve Yin 	// Send accessibility event.
5799b8096d0SSteve Yin 	if(pAccContext)
5809b8096d0SSteve Yin 	{
5819b8096d0SSteve Yin 		pAccContext->FireChildFocus(GetActualRP());
5829b8096d0SSteve Yin 	}
583cdf0e10cSrcweir }
584cdf0e10cSrcweir 
585cdf0e10cSrcweir 
LoseFocus()586cdf0e10cSrcweir void SvxRectCtl::LoseFocus()
587cdf0e10cSrcweir {
588cdf0e10cSrcweir 	HideFocus();
589cdf0e10cSrcweir }
590cdf0e10cSrcweir 
591cdf0e10cSrcweir 
GetApproxLogPtFromPixPt(const Point & rPt) const592cdf0e10cSrcweir Point SvxRectCtl::GetApproxLogPtFromPixPt( const Point& rPt ) const
593cdf0e10cSrcweir {
594cdf0e10cSrcweir 	Point	aPt = PixelToLogic( rPt );
595cdf0e10cSrcweir 	long	x;
596cdf0e10cSrcweir 	long	y;
597cdf0e10cSrcweir 
598cdf0e10cSrcweir 	if( ( m_nState & CS_NOHORZ ) == 0 )
599cdf0e10cSrcweir 	{
600cdf0e10cSrcweir 		if( aPt.X() < aSize.Width() / 3 )
601cdf0e10cSrcweir 			x = aPtLT.X();
602cdf0e10cSrcweir 		else if( aPt.X() < aSize.Width() * 2 / 3 )
603cdf0e10cSrcweir 			x = aPtMM.X();
604cdf0e10cSrcweir 		else
605cdf0e10cSrcweir 			x = aPtRB.X();
606cdf0e10cSrcweir 	}
607cdf0e10cSrcweir 	else
608cdf0e10cSrcweir 		x = aPtMM.X();
609cdf0e10cSrcweir 
610cdf0e10cSrcweir 	if( ( m_nState & CS_NOVERT ) == 0 )
611cdf0e10cSrcweir 	{
612cdf0e10cSrcweir 		if( aPt.Y() < aSize.Height() / 3 )
613cdf0e10cSrcweir 			y = aPtLT.Y();
614cdf0e10cSrcweir 		else if( aPt.Y() < aSize.Height() * 2 / 3 )
615cdf0e10cSrcweir 			y = aPtMM.Y();
616cdf0e10cSrcweir 		else
617cdf0e10cSrcweir 			y = aPtRB.Y();
618cdf0e10cSrcweir 	}
619cdf0e10cSrcweir 	else
620cdf0e10cSrcweir 			y = aPtMM.Y();
621cdf0e10cSrcweir 
622cdf0e10cSrcweir 	return Point( x, y );
623cdf0e10cSrcweir }
624cdf0e10cSrcweir 
625cdf0e10cSrcweir 
626cdf0e10cSrcweir /*************************************************************************
627cdf0e10cSrcweir |*
628cdf0e10cSrcweir |*	Konvertiert Point in RECT_POINT
629cdf0e10cSrcweir |*
630cdf0e10cSrcweir \************************************************************************/
631cdf0e10cSrcweir 
GetRPFromPoint(Point aPt) const632cdf0e10cSrcweir RECT_POINT SvxRectCtl::GetRPFromPoint( Point aPt ) const
633cdf0e10cSrcweir {
634cdf0e10cSrcweir 	if	   ( aPt == aPtLT) return RP_LT;
635cdf0e10cSrcweir 	else if( aPt == aPtMT) return RP_MT;
636cdf0e10cSrcweir 	else if( aPt == aPtRT) return RP_RT;
637cdf0e10cSrcweir 	else if( aPt == aPtLM) return RP_LM;
638cdf0e10cSrcweir 	else if( aPt == aPtRM) return RP_RM;
639cdf0e10cSrcweir 	else if( aPt == aPtLB) return RP_LB;
640cdf0e10cSrcweir 	else if( aPt == aPtMB) return RP_MB;
641cdf0e10cSrcweir 	else if( aPt == aPtRB) return RP_RB;
642cdf0e10cSrcweir 
643cdf0e10cSrcweir 	else
644cdf0e10cSrcweir 		return RP_MM; // default
645cdf0e10cSrcweir }
646cdf0e10cSrcweir 
647cdf0e10cSrcweir /*************************************************************************
648cdf0e10cSrcweir |*
649cdf0e10cSrcweir |*	Bewirkt den Ursprungszustand des Controls
650cdf0e10cSrcweir |*
651cdf0e10cSrcweir \************************************************************************/
652cdf0e10cSrcweir 
Reset()653cdf0e10cSrcweir void SvxRectCtl::Reset()
654cdf0e10cSrcweir {
655cdf0e10cSrcweir 	aPtNew = GetPointFromRP( eDefRP );
656cdf0e10cSrcweir 	eRP = eDefRP;
657cdf0e10cSrcweir 	Invalidate();
658cdf0e10cSrcweir }
659cdf0e10cSrcweir 
660cdf0e10cSrcweir /*************************************************************************
661cdf0e10cSrcweir |*
662cdf0e10cSrcweir |*	Gibt den aktuell ausgewaehlten RECT_POINT zur�ck
663cdf0e10cSrcweir |*
664cdf0e10cSrcweir \************************************************************************/
665cdf0e10cSrcweir 
GetActualRP() const666cdf0e10cSrcweir RECT_POINT SvxRectCtl::GetActualRP() const
667cdf0e10cSrcweir {
668cdf0e10cSrcweir 	return( eRP );
669cdf0e10cSrcweir }
670cdf0e10cSrcweir 
671cdf0e10cSrcweir /*************************************************************************
672cdf0e10cSrcweir |*
673cdf0e10cSrcweir |*	Gibt den aktuell ausgewaehlten RECT_POINT zur�ck
674cdf0e10cSrcweir |*
675cdf0e10cSrcweir \************************************************************************/
SetActualRP(RECT_POINT eNewRP)6769b8096d0SSteve Yin void SvxRectCtl::SetActualRP( RECT_POINT eNewRP /* MT: , sal_Bool bFireFocus */ )
677cdf0e10cSrcweir {
6789b8096d0SSteve Yin 	// MT: bFireFox as API parameter is ugly...
679cdf0e10cSrcweir 	Point aPtLast( SetActualRPWithoutInvalidate( eNewRP ) );
680cdf0e10cSrcweir 
681cdf0e10cSrcweir 	Invalidate( Rectangle( aPtLast - Point( nRadius, nRadius ), aPtLast + Point( nRadius, nRadius ) ) );
682cdf0e10cSrcweir 	Invalidate( Rectangle( aPtNew - Point( nRadius, nRadius ), aPtNew + Point( nRadius, nRadius ) ) );
683cdf0e10cSrcweir 
684cdf0e10cSrcweir 	// notify accessibility object about change
685cdf0e10cSrcweir 	if( pAccContext )
6869b8096d0SSteve Yin 		pAccContext->selectChild( eNewRP /* MT, bFireFocus */ );
687cdf0e10cSrcweir }
SetState(CTL_STATE nState)688cdf0e10cSrcweir void SvxRectCtl::SetState( CTL_STATE nState )
689cdf0e10cSrcweir {
690cdf0e10cSrcweir 	m_nState = nState;
691cdf0e10cSrcweir 
692cdf0e10cSrcweir 	Point aPtLast( GetPointFromRP( eRP ) );
693cdf0e10cSrcweir     Point _aPtNew( aPtLast );
694cdf0e10cSrcweir 
695cdf0e10cSrcweir 	if( (m_nState & CS_NOHORZ) != 0 )
696cdf0e10cSrcweir         _aPtNew.X() = aPtMM.X();
697cdf0e10cSrcweir 
698cdf0e10cSrcweir 	if( (m_nState & CS_NOVERT) != 0 )
699cdf0e10cSrcweir         _aPtNew.Y() = aPtMM.Y();
700cdf0e10cSrcweir 
701cdf0e10cSrcweir     eRP = GetRPFromPoint( _aPtNew );
702cdf0e10cSrcweir 	Invalidate();
703cdf0e10cSrcweir 
704cdf0e10cSrcweir 	if( WINDOW_TABPAGE == GetParent()->GetType() )
705cdf0e10cSrcweir 		( (SvxTabPage*) GetParent() )->PointChanged( this, eRP );
706cdf0e10cSrcweir }
707cdf0e10cSrcweir 
GetNumOfChilds(void) const708cdf0e10cSrcweir sal_uInt8 SvxRectCtl::GetNumOfChilds( void ) const
709cdf0e10cSrcweir {
710cdf0e10cSrcweir 	return ( eCS == CS_ANGLE )? 8 : 9;
711cdf0e10cSrcweir }
712cdf0e10cSrcweir 
CalculateFocusRectangle(void) const713cdf0e10cSrcweir Rectangle SvxRectCtl::CalculateFocusRectangle( void ) const
714cdf0e10cSrcweir {
715cdf0e10cSrcweir 	Size		aDstBtnSize( PixelToLogic( Size( 15, 15 ) ) );
716cdf0e10cSrcweir 	return Rectangle( aPtNew - Point( aDstBtnSize.Width() >> 1, aDstBtnSize.Height() >> 1 ), aDstBtnSize );
717cdf0e10cSrcweir }
718cdf0e10cSrcweir 
CalculateFocusRectangle(RECT_POINT eRectPoint) const719cdf0e10cSrcweir Rectangle SvxRectCtl::CalculateFocusRectangle( RECT_POINT eRectPoint ) const
720cdf0e10cSrcweir {
721cdf0e10cSrcweir 	Rectangle	aRet;
722cdf0e10cSrcweir 	RECT_POINT	eOldRectPoint = GetActualRP();
723cdf0e10cSrcweir 
724cdf0e10cSrcweir 	if( eOldRectPoint == eRectPoint )
725cdf0e10cSrcweir 		aRet = CalculateFocusRectangle();
726cdf0e10cSrcweir 	else
727cdf0e10cSrcweir 	{
728cdf0e10cSrcweir 		SvxRectCtl*	pThis = const_cast< SvxRectCtl* >( this );
729cdf0e10cSrcweir 
730cdf0e10cSrcweir 		pThis->SetActualRPWithoutInvalidate( eRectPoint );		// no invalidation because it's only temporary!
731cdf0e10cSrcweir 		aRet = CalculateFocusRectangle();
732cdf0e10cSrcweir 
733cdf0e10cSrcweir 		pThis->SetActualRPWithoutInvalidate( eOldRectPoint );	// no invalidation because nothing has changed!
734cdf0e10cSrcweir 	}
735cdf0e10cSrcweir 
736cdf0e10cSrcweir 	return aRet;
737cdf0e10cSrcweir }
738cdf0e10cSrcweir 
CreateAccessible()739cdf0e10cSrcweir Reference< XAccessible > SvxRectCtl::CreateAccessible()
740cdf0e10cSrcweir {
741cdf0e10cSrcweir 	Window*						pParent = GetAccessibleParentWindow();
742cdf0e10cSrcweir 
743cdf0e10cSrcweir 	DBG_ASSERT( pParent, "-SvxRectCtl::CreateAccessible(): No Parent!" );
744cdf0e10cSrcweir 
745cdf0e10cSrcweir 	Reference< XAccessible >	xAccParent  = pParent->GetAccessible();
746cdf0e10cSrcweir 	if( xAccParent.is() )
747cdf0e10cSrcweir 	{
748cdf0e10cSrcweir 		pAccContext = new SvxRectCtlAccessibleContext( xAccParent, *this );
749cdf0e10cSrcweir 		pAccContext->acquire();
750cdf0e10cSrcweir 
751cdf0e10cSrcweir         SetActualRP( GetActualRP() );
752cdf0e10cSrcweir 
753cdf0e10cSrcweir 		return pAccContext;
754cdf0e10cSrcweir 	}
755cdf0e10cSrcweir 	else
756cdf0e10cSrcweir 		return Reference< XAccessible >();
757cdf0e10cSrcweir }
758cdf0e10cSrcweir 
GetApproxRPFromPixPt(const::com::sun::star::awt::Point & r) const759cdf0e10cSrcweir RECT_POINT SvxRectCtl::GetApproxRPFromPixPt( const ::com::sun::star::awt::Point& r ) const
760cdf0e10cSrcweir {
761cdf0e10cSrcweir 	return GetRPFromPoint( GetApproxLogPtFromPixPt( Point( r.X, r.Y ) ) );
762cdf0e10cSrcweir }
763cdf0e10cSrcweir 
764cdf0e10cSrcweir // #103516# CompletelyDisabled() added to have a disabled state for SvxRectCtl
DoCompletelyDisable(sal_Bool bNew)765cdf0e10cSrcweir void SvxRectCtl::DoCompletelyDisable(sal_Bool bNew)
766cdf0e10cSrcweir {
767cdf0e10cSrcweir 	mbCompleteDisable = bNew;
768cdf0e10cSrcweir 	Invalidate();
769cdf0e10cSrcweir }
770cdf0e10cSrcweir 
771cdf0e10cSrcweir /*************************************************************************
772cdf0e10cSrcweir |*
773cdf0e10cSrcweir |* Konstruktor ohne Size-Parameter
774cdf0e10cSrcweir |*
775cdf0e10cSrcweir \************************************************************************/
776cdf0e10cSrcweir 
SvxAngleCtl(Window * pParent,const ResId & rResId)777cdf0e10cSrcweir SvxAngleCtl::SvxAngleCtl( Window* pParent, const ResId& rResId ) :
778cdf0e10cSrcweir 
779cdf0e10cSrcweir 	SvxRectCtl( pParent, rResId ),
780cdf0e10cSrcweir 
781cdf0e10cSrcweir 	aFont( Application::GetSettings().GetStyleSettings().GetAppFont() )
782cdf0e10cSrcweir {
783cdf0e10cSrcweir 	aFontSize = Size( 250, 400 );
784cdf0e10cSrcweir 	Initialize();
785cdf0e10cSrcweir }
786cdf0e10cSrcweir 
787cdf0e10cSrcweir /*************************************************************************
788cdf0e10cSrcweir |*
789cdf0e10cSrcweir |* Konstruktor mit Size-Parameter
790cdf0e10cSrcweir |*
791cdf0e10cSrcweir \************************************************************************/
792cdf0e10cSrcweir 
SvxAngleCtl(Window * pParent,const ResId & rResId,Size _aSize)793cdf0e10cSrcweir SvxAngleCtl::SvxAngleCtl( Window* pParent, const ResId& rResId, Size _aSize ) :
794cdf0e10cSrcweir 
795cdf0e10cSrcweir 	SvxRectCtl( pParent, rResId ),
796cdf0e10cSrcweir 
797cdf0e10cSrcweir 	aFont( Application::GetSettings().GetStyleSettings().GetAppFont() )
798cdf0e10cSrcweir {
799cdf0e10cSrcweir     aFontSize = _aSize;
800cdf0e10cSrcweir 	Initialize();
801cdf0e10cSrcweir }
802cdf0e10cSrcweir 
803cdf0e10cSrcweir /*************************************************************************
804cdf0e10cSrcweir |*
805cdf0e10cSrcweir |* Initialisierung
806cdf0e10cSrcweir |*
807cdf0e10cSrcweir \************************************************************************/
808cdf0e10cSrcweir 
Initialize()809cdf0e10cSrcweir void SvxAngleCtl::Initialize()
810cdf0e10cSrcweir {
811cdf0e10cSrcweir 	bPositive = sal_True;
812cdf0e10cSrcweir 
813cdf0e10cSrcweir 	// aFont.SetName( "Helvetica" );
814cdf0e10cSrcweir 	aFont.SetSize( aFontSize );
815cdf0e10cSrcweir 	aFont.SetWeight( WEIGHT_NORMAL );
816cdf0e10cSrcweir 	aFont.SetTransparent( sal_False );
817cdf0e10cSrcweir 
818cdf0e10cSrcweir 	SetFont( aFont );
819cdf0e10cSrcweir }
820cdf0e10cSrcweir 
821cdf0e10cSrcweir /*************************************************************************
822cdf0e10cSrcweir |*
823cdf0e10cSrcweir |*	Zeichnet das (Mini-)Koordinatensystem
824cdf0e10cSrcweir |*
825cdf0e10cSrcweir \************************************************************************/
826cdf0e10cSrcweir 
Paint(const Rectangle &)827cdf0e10cSrcweir void SvxAngleCtl::Paint( const Rectangle& )
828cdf0e10cSrcweir {
829cdf0e10cSrcweir 	SetLineColor( Color( COL_BLACK ) ); 	// PEN_DOT ???
830cdf0e10cSrcweir 	DrawLine( aPtLT - Point( 0, 0), aPtRB + Point( 0, 0 ) );
831cdf0e10cSrcweir 	DrawLine( aPtLB - Point( 0, 0), aPtRT + Point( 0, 0 ) );
832cdf0e10cSrcweir 
833cdf0e10cSrcweir 	SetLineColor( Color( COL_BLACK ) );
834cdf0e10cSrcweir 	DrawLine( aPtLM - Point( 0, 0), aPtRM + Point( 0, 0 ) );
835cdf0e10cSrcweir 	DrawLine( aPtMT - Point( 0, 0), aPtMB + Point( 0, 0 ) );
836cdf0e10cSrcweir 
837cdf0e10cSrcweir 	Point aDiff(aFontSize.Width() / 2, aFontSize.Height() / 2);
838cdf0e10cSrcweir 
839cdf0e10cSrcweir 	DrawText( aPtLT - aDiff, UniString::CreateFromAscii(
840cdf0e10cSrcweir 		                     RTL_CONSTASCII_STRINGPARAM( "135" ) ) );
841cdf0e10cSrcweir 	DrawText( aPtLM - aDiff, UniString::CreateFromAscii(
842cdf0e10cSrcweir 		                     RTL_CONSTASCII_STRINGPARAM( "180" ) ) );
843cdf0e10cSrcweir 
844cdf0e10cSrcweir 	if ( bPositive )
845cdf0e10cSrcweir 		DrawText( aPtLB - aDiff, UniString::CreateFromAscii(
846cdf0e10cSrcweir 		                         RTL_CONSTASCII_STRINGPARAM( "225" ) ) );
847cdf0e10cSrcweir 	else
848cdf0e10cSrcweir 		DrawText( aPtLB - aDiff, UniString::CreateFromAscii(
849cdf0e10cSrcweir 		                         RTL_CONSTASCII_STRINGPARAM( "-135" ) ) );
850cdf0e10cSrcweir 
851cdf0e10cSrcweir 	aDiff.X() = aFontSize.Width();
852cdf0e10cSrcweir 	DrawText( aPtMT - aDiff, UniString::CreateFromAscii(
853cdf0e10cSrcweir 		                     RTL_CONSTASCII_STRINGPARAM( "90" ) ) );
854cdf0e10cSrcweir 	DrawText( aPtRT - aDiff, UniString::CreateFromAscii(
855cdf0e10cSrcweir 		                     RTL_CONSTASCII_STRINGPARAM( "45" ) ) );
856cdf0e10cSrcweir 	aDiff.X() = aDiff .X() * 3 / 2;
857cdf0e10cSrcweir 
858cdf0e10cSrcweir 	if ( bPositive )
859cdf0e10cSrcweir 		DrawText( aPtMB - aDiff, UniString::CreateFromAscii(
860cdf0e10cSrcweir 		                         RTL_CONSTASCII_STRINGPARAM( "270" ) ) );
861cdf0e10cSrcweir 	else
862cdf0e10cSrcweir 		DrawText( aPtMB - aDiff, UniString::CreateFromAscii(
863cdf0e10cSrcweir 		                         RTL_CONSTASCII_STRINGPARAM( "-90" ) ) );
864cdf0e10cSrcweir 
865cdf0e10cSrcweir 	DrawText( aPtRM - Point( 0, aDiff.Y() ), UniString::CreateFromAscii(
866cdf0e10cSrcweir 		                                     RTL_CONSTASCII_STRINGPARAM( "0" ) ) );
867cdf0e10cSrcweir 	aDiff.X() = aFontSize.Width() * 2;
868cdf0e10cSrcweir 
869cdf0e10cSrcweir 	if ( bPositive )
870cdf0e10cSrcweir 		DrawText( aPtRB - aDiff, UniString::CreateFromAscii(
871cdf0e10cSrcweir 		                         RTL_CONSTASCII_STRINGPARAM( "315" ) ) );
872cdf0e10cSrcweir 	else
873cdf0e10cSrcweir 		DrawText( aPtRB - aDiff, UniString::CreateFromAscii(
874cdf0e10cSrcweir 		                         RTL_CONSTASCII_STRINGPARAM( "-45" ) ) );
875cdf0e10cSrcweir }
876cdf0e10cSrcweir 
877cdf0e10cSrcweir /*************************************************************************
878cdf0e10cSrcweir |*
879cdf0e10cSrcweir |*	Control zum Editieren von Bitmaps
880cdf0e10cSrcweir |*
881cdf0e10cSrcweir \************************************************************************/
882cdf0e10cSrcweir 
CreateAccessible()8839b8096d0SSteve Yin ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SvxPixelCtl::CreateAccessible()
8849b8096d0SSteve Yin {
8859b8096d0SSteve Yin     if(!m_xAccess.is())
8869b8096d0SSteve Yin 	{
8879b8096d0SSteve Yin 		m_xAccess = m_pAccess =  new SvxPixelCtlAccessible(*this);
8889b8096d0SSteve Yin 	}
8899b8096d0SSteve Yin     return m_xAccess;
8909b8096d0SSteve Yin }
8919b8096d0SSteve Yin 
8929b8096d0SSteve Yin //Logic Pixel
PointToIndex(const Point & aPt) const8939b8096d0SSteve Yin long SvxPixelCtl::PointToIndex(const Point &aPt) const
8949b8096d0SSteve Yin {
8959b8096d0SSteve Yin 	sal_uInt16	nX, nY;
8969b8096d0SSteve Yin 
8979b8096d0SSteve Yin 	nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() );
8989b8096d0SSteve Yin 	nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() );
8999b8096d0SSteve Yin 
9009b8096d0SSteve Yin 	return nX + nY * nLines ;
9019b8096d0SSteve Yin }
IndexToPoint(long nIndex) const9029b8096d0SSteve Yin Point SvxPixelCtl::IndexToPoint(long nIndex) const
9039b8096d0SSteve Yin {
9049b8096d0SSteve Yin 	DBG_ASSERT(nIndex >= 0 && nIndex < nSquares ," Check Index");
9059b8096d0SSteve Yin 
9069b8096d0SSteve Yin 	sal_uInt16 nXIndex = nIndex % nLines ;
9079b8096d0SSteve Yin 	sal_uInt16 nYIndex = sal_uInt16(nIndex / nLines) ;
9089b8096d0SSteve Yin 
9099b8096d0SSteve Yin 	Point aPtTl;
9109b8096d0SSteve Yin 	aPtTl.Y() = aRectSize.Height() * nYIndex / nLines + 1;
9119b8096d0SSteve Yin 	aPtTl.X() = aRectSize.Width() * nXIndex / nLines + 1;
9129b8096d0SSteve Yin 
9139b8096d0SSteve Yin 	return aPtTl;
9149b8096d0SSteve Yin }
GetFoucsPosIndex() const9159b8096d0SSteve Yin long SvxPixelCtl::GetFoucsPosIndex() const
9169b8096d0SSteve Yin {
9179b8096d0SSteve Yin 	return aFocusPosition.getX() + aFocusPosition.getY() * nLines ;
9189b8096d0SSteve Yin }
ShowPosition(const Point & pt)9199b8096d0SSteve Yin long SvxPixelCtl::ShowPosition( const Point &pt)
9209b8096d0SSteve Yin {
9219b8096d0SSteve Yin 	Point aPt = PixelToLogic( pt );
9229b8096d0SSteve Yin 
9239b8096d0SSteve Yin 	sal_uInt16	nX, nY;
9249b8096d0SSteve Yin 	nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() );
9259b8096d0SSteve Yin 	nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() );
9269b8096d0SSteve Yin 
9279b8096d0SSteve Yin 	ChangePixel( nX + nY * nLines );
9289b8096d0SSteve Yin 
9299b8096d0SSteve Yin 	//Solution:Set new focus position and repaint
9309b8096d0SSteve Yin 	//Invalidate( Rectangle( aPtTl, aPtBr ) );
9319b8096d0SSteve Yin 	aFocusPosition.setX(nX);
9329b8096d0SSteve Yin 	aFocusPosition.setY(nY);
9339b8096d0SSteve Yin 	Invalidate(Rectangle(Point(0,0),aRectSize));
9349b8096d0SSteve Yin 
9359b8096d0SSteve Yin 	if( WINDOW_TABPAGE == GetParent()->GetType() )
9369b8096d0SSteve Yin 		( (SvxTabPage*) GetParent() )->PointChanged( this, RP_MM ); // RectPoint ist dummy
9379b8096d0SSteve Yin 
9389b8096d0SSteve Yin 	return GetFoucsPosIndex();
9399b8096d0SSteve Yin 
9409b8096d0SSteve Yin }
SvxPixelCtl(Window * pParent,const ResId & rResId,sal_uInt16 nNumber)941cdf0e10cSrcweir SvxPixelCtl::SvxPixelCtl( Window* pParent, const ResId& rResId, sal_uInt16 nNumber ) :
942cdf0e10cSrcweir 						Control		( pParent, rResId ),
943cdf0e10cSrcweir 						nLines		( nNumber ),
944cdf0e10cSrcweir 						bPaintable	( sal_True )
9459b8096d0SSteve Yin 						//Solution:Initialize it's value to Point(0,0)
9469b8096d0SSteve Yin 						,aFocusPosition(0,0)
947cdf0e10cSrcweir {
948cdf0e10cSrcweir 	// SetMapMode( MAP_100TH_MM );
949cdf0e10cSrcweir 	aRectSize = GetOutputSize();
950cdf0e10cSrcweir 
951cdf0e10cSrcweir 	SetPixelColor( Color( COL_BLACK ) );
952cdf0e10cSrcweir 	SetBackgroundColor( Color( COL_WHITE ) );
953cdf0e10cSrcweir 	SetLineColor( Application::GetSettings().GetStyleSettings().GetShadowColor() );
954cdf0e10cSrcweir 
955cdf0e10cSrcweir 	nSquares = nLines * nLines;
956cdf0e10cSrcweir 	pPixel = new sal_uInt16[ nSquares ];
957cdf0e10cSrcweir 	rtl_zeroMemory(pPixel, nSquares * sizeof(sal_uInt16));
9589b8096d0SSteve Yin 	m_pAccess=NULL;
959cdf0e10cSrcweir }
960cdf0e10cSrcweir 
961cdf0e10cSrcweir /*************************************************************************
962cdf0e10cSrcweir |*
963cdf0e10cSrcweir |*	Destruktor dealociert dyn. Array
964cdf0e10cSrcweir |*
965cdf0e10cSrcweir \************************************************************************/
966cdf0e10cSrcweir 
~SvxPixelCtl()967cdf0e10cSrcweir SvxPixelCtl::~SvxPixelCtl( )
968cdf0e10cSrcweir {
969cdf0e10cSrcweir 	delete []pPixel;
970cdf0e10cSrcweir }
971cdf0e10cSrcweir 
972cdf0e10cSrcweir /*************************************************************************
973cdf0e10cSrcweir |*
974cdf0e10cSrcweir |*	Wechselt die Vordergrund- ,bzw. Hintergrundfarbe
975cdf0e10cSrcweir |*
976cdf0e10cSrcweir \************************************************************************/
977cdf0e10cSrcweir 
ChangePixel(sal_uInt16 nPixel)978cdf0e10cSrcweir void SvxPixelCtl::ChangePixel( sal_uInt16 nPixel )
979cdf0e10cSrcweir {
980cdf0e10cSrcweir 	if( *( pPixel + nPixel) == 0 )
981cdf0e10cSrcweir 		*( pPixel + nPixel) = 1; // koennte erweitert werden auf mehrere Farben
982cdf0e10cSrcweir 	else
983cdf0e10cSrcweir 		*( pPixel + nPixel) = 0;
984cdf0e10cSrcweir }
985cdf0e10cSrcweir 
986cdf0e10cSrcweir /*************************************************************************
987cdf0e10cSrcweir |*
988cdf0e10cSrcweir |*	Das angeklickte Rechteck wird ermittelt um die Farbe zu wechseln
989cdf0e10cSrcweir |*
990cdf0e10cSrcweir \************************************************************************/
991cdf0e10cSrcweir 
MouseButtonDown(const MouseEvent & rMEvt)992cdf0e10cSrcweir void SvxPixelCtl::MouseButtonDown( const MouseEvent& rMEvt )
993cdf0e10cSrcweir {
9949b8096d0SSteve Yin 	//Point aPt = PixelToLogic( rMEvt.GetPosPixel() );
9959b8096d0SSteve Yin 	//Point aPtTl, aPtBr;
9969b8096d0SSteve Yin 	//sal_uInt16	nX, nY;
997cdf0e10cSrcweir 
9989b8096d0SSteve Yin 	//nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() );
9999b8096d0SSteve Yin 	//nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() );
1000cdf0e10cSrcweir 
10019b8096d0SSteve Yin 	//ChangePixel( nX + nY * nLines );
1002cdf0e10cSrcweir 
10039b8096d0SSteve Yin 	//aPtTl.X() = aRectSize.Width() * nX / nLines + 1;
10049b8096d0SSteve Yin 	//aPtBr.X() = aRectSize.Width() * (nX + 1) / nLines - 1;
10059b8096d0SSteve Yin 	//aPtTl.Y() = aRectSize.Height() * nY / nLines + 1;
10069b8096d0SSteve Yin 	//aPtBr.Y() = aRectSize.Height() * (nY + 1) / nLines - 1;
1007cdf0e10cSrcweir 
10089b8096d0SSteve Yin 	//Invalidate( Rectangle( aPtTl, aPtBr ) );
1009cdf0e10cSrcweir 
10109b8096d0SSteve Yin 	//if( WINDOW_TABPAGE == GetParent()->GetType() )
10119b8096d0SSteve Yin 	//	( (SvxTabPage*) GetParent() )->PointChanged( this, RP_MM ); // RectPoint ist dummy
10129b8096d0SSteve Yin 	//Solution:Grab focus when click in window
10139b8096d0SSteve Yin 	if( !HasFocus() )
10149b8096d0SSteve Yin 	{
10159b8096d0SSteve Yin 		GrabFocus();
10169b8096d0SSteve Yin 	}
10179b8096d0SSteve Yin 	long nIndex = ShowPosition(rMEvt.GetPosPixel());
10189b8096d0SSteve Yin 
10199b8096d0SSteve Yin 	if(m_pAccess)
10209b8096d0SSteve Yin 	{
10219b8096d0SSteve Yin 		m_pAccess->NotifyChild(nIndex,sal_True,sal_True);
10229b8096d0SSteve Yin 	}
1023cdf0e10cSrcweir }
1024cdf0e10cSrcweir 
1025cdf0e10cSrcweir /*************************************************************************
1026cdf0e10cSrcweir |*
1027cdf0e10cSrcweir |*	Zeichnet das Control (Rechteck mit 9 Kreisen)
1028cdf0e10cSrcweir |*
1029cdf0e10cSrcweir \************************************************************************/
1030cdf0e10cSrcweir 
Paint(const Rectangle &)1031cdf0e10cSrcweir void SvxPixelCtl::Paint( const Rectangle& )
1032cdf0e10cSrcweir {
1033cdf0e10cSrcweir 	sal_uInt16	i, j, nTmp;
1034cdf0e10cSrcweir 	Point	aPtTl, aPtBr;
1035cdf0e10cSrcweir 
1036cdf0e10cSrcweir 	if( bPaintable )
1037cdf0e10cSrcweir 	{
1038cdf0e10cSrcweir 		// Linien Zeichnen
1039cdf0e10cSrcweir 		Control::SetLineColor( aLineColor );
1040cdf0e10cSrcweir 		for( i = 1; i < nLines; i++)
1041cdf0e10cSrcweir 		{
1042cdf0e10cSrcweir 			// horizontal
1043cdf0e10cSrcweir 			nTmp = (sal_uInt16) ( aRectSize.Height() * i / nLines );
1044cdf0e10cSrcweir 			DrawLine( Point( 0, nTmp ), Point( aRectSize.Width(), nTmp ) );
1045cdf0e10cSrcweir 			// vertikal
1046cdf0e10cSrcweir 			nTmp = (sal_uInt16) ( aRectSize.Width() * i / nLines );
1047cdf0e10cSrcweir 			DrawLine( Point( nTmp, 0 ), Point( nTmp, aRectSize.Height() ) );
1048cdf0e10cSrcweir 		}
1049cdf0e10cSrcweir 
1050cdf0e10cSrcweir 		// Rechtecke (Quadrate) zeichnen
1051cdf0e10cSrcweir 		Control::SetLineColor();
1052cdf0e10cSrcweir 		sal_uInt16 nLastPixel = *pPixel ? 0 : 1;
1053cdf0e10cSrcweir 
1054cdf0e10cSrcweir 		for( i = 0; i < nLines; i++)
1055cdf0e10cSrcweir 		{
1056cdf0e10cSrcweir 			aPtTl.Y() = aRectSize.Height() * i / nLines + 1;
1057cdf0e10cSrcweir 			aPtBr.Y() = aRectSize.Height() * (i + 1) / nLines - 1;
1058cdf0e10cSrcweir 
1059cdf0e10cSrcweir 			for( j = 0; j < nLines; j++)
1060cdf0e10cSrcweir 			{
1061cdf0e10cSrcweir 				aPtTl.X() = aRectSize.Width() * j / nLines + 1;
1062cdf0e10cSrcweir 				aPtBr.X() = aRectSize.Width() * (j + 1) / nLines - 1;
1063cdf0e10cSrcweir 
1064cdf0e10cSrcweir 				if ( *( pPixel + i * nLines + j ) != nLastPixel )
1065cdf0e10cSrcweir 				{
1066cdf0e10cSrcweir 					nLastPixel = *( pPixel + i * nLines + j );
1067cdf0e10cSrcweir 					// Farbe wechseln: 0 -> Hintergrundfarbe
1068cdf0e10cSrcweir 					SetFillColor( nLastPixel ? aPixelColor : aBackgroundColor );
1069cdf0e10cSrcweir 				}
1070cdf0e10cSrcweir 				DrawRect( Rectangle( aPtTl, aPtBr ) );
1071cdf0e10cSrcweir 			}
1072cdf0e10cSrcweir 		}
10739b8096d0SSteve Yin 		//Solution:Draw visual focus when has focus
10749b8096d0SSteve Yin 		if( HasFocus() )
10759b8096d0SSteve Yin 		{
10769b8096d0SSteve Yin 			ShowFocus(implCalFocusRect(aFocusPosition));
10779b8096d0SSteve Yin 		}
1078cdf0e10cSrcweir 	} // bPaintable
1079cdf0e10cSrcweir 	else
1080cdf0e10cSrcweir 	{
1081cdf0e10cSrcweir 		SetBackground( Wallpaper( Color( COL_LIGHTGRAY ) ) );
1082cdf0e10cSrcweir 		Control::SetLineColor( Color( COL_LIGHTRED ) );
1083cdf0e10cSrcweir 		DrawLine( Point( 0, 0 ), Point( aRectSize.Width(), aRectSize.Height() ) );
1084cdf0e10cSrcweir 		DrawLine( Point( 0, aRectSize.Height() ), Point( aRectSize.Width(), 0 ) );
1085cdf0e10cSrcweir 	}
1086cdf0e10cSrcweir }
10879b8096d0SSteve Yin //Solution:Caculate visual focus rectangle via focus position
implCalFocusRect(const Point & aPosition)10889b8096d0SSteve Yin Rectangle SvxPixelCtl::implCalFocusRect( const Point& aPosition )
10899b8096d0SSteve Yin {
10909b8096d0SSteve Yin 	long nLeft,nTop,nRight,nBottom;
10919b8096d0SSteve Yin 	long i,j;
10929b8096d0SSteve Yin 	i = aPosition.Y();
10939b8096d0SSteve Yin 	j = aPosition.X();
10949b8096d0SSteve Yin 	nLeft = aRectSize.Width() * j / nLines + 1;
10959b8096d0SSteve Yin 	nRight = aRectSize.Width() * (j + 1) / nLines - 1;
10969b8096d0SSteve Yin 	nTop = aRectSize.Height() * i / nLines + 1;
10979b8096d0SSteve Yin 	nBottom = aRectSize.Height() * (i + 1) / nLines - 1;
10989b8096d0SSteve Yin 	return Rectangle(nLeft,nTop,nRight,nBottom);
10999b8096d0SSteve Yin }
11009b8096d0SSteve Yin 
11019b8096d0SSteve Yin //Solution:Keyboard fucntion
KeyInput(const KeyEvent & rKEvt)11029b8096d0SSteve Yin void SvxPixelCtl::KeyInput( const KeyEvent& rKEvt )
11039b8096d0SSteve Yin {
11049b8096d0SSteve Yin 	KeyCode aKeyCode = rKEvt.GetKeyCode();
11059b8096d0SSteve Yin 	sal_uInt16 nCode = aKeyCode.GetCode();
11069b8096d0SSteve Yin 	sal_Bool bIsMod = aKeyCode.IsShift() || aKeyCode.IsMod1() || aKeyCode.IsMod2();
11079b8096d0SSteve Yin 
11089b8096d0SSteve Yin 	if( !bIsMod )
11099b8096d0SSteve Yin 	{
11109b8096d0SSteve Yin 		Point pRepaintPoint( aRectSize.Width() *( aFocusPosition.getX() - 1)/ nLines - 1,
11119b8096d0SSteve Yin 		                     aRectSize.Height() *( aFocusPosition.getY() - 1)/ nLines -1
11129b8096d0SSteve Yin 		                    );
11139b8096d0SSteve Yin 		Size  mRepaintSize( aRectSize.Width() *3/ nLines + 2,aRectSize.Height() *3/ nLines + 2);
11149b8096d0SSteve Yin 		Rectangle mRepaintRect( pRepaintPoint, mRepaintSize );
11159b8096d0SSteve Yin 		sal_Bool bFocusPosChanged=sal_False;
11169b8096d0SSteve Yin 		switch(nCode)
11179b8096d0SSteve Yin 		{
11189b8096d0SSteve Yin 			case KEY_LEFT:
11199b8096d0SSteve Yin 				if((aFocusPosition.getX() >= 1))
11209b8096d0SSteve Yin 				{
11219b8096d0SSteve Yin 					aFocusPosition.setX( aFocusPosition.getX() - 1 );
11229b8096d0SSteve Yin 					Invalidate(mRepaintRect);
11239b8096d0SSteve Yin 					bFocusPosChanged=sal_True;
11249b8096d0SSteve Yin 				}
11259b8096d0SSteve Yin 				break;
11269b8096d0SSteve Yin 			case KEY_RIGHT:
11279b8096d0SSteve Yin 				if( aFocusPosition.getX() < (nLines - 1) )
11289b8096d0SSteve Yin 				{
11299b8096d0SSteve Yin 					aFocusPosition.setX( aFocusPosition.getX() + 1 );
11309b8096d0SSteve Yin 					Invalidate(mRepaintRect);
11319b8096d0SSteve Yin 					bFocusPosChanged=sal_True;
11329b8096d0SSteve Yin 				}
11339b8096d0SSteve Yin 				break;
11349b8096d0SSteve Yin 			case KEY_UP:
11359b8096d0SSteve Yin 				if((aFocusPosition.getY() >= 1))
11369b8096d0SSteve Yin 				{
11379b8096d0SSteve Yin 					aFocusPosition.setY( aFocusPosition.getY() - 1 );
11389b8096d0SSteve Yin 					Invalidate(mRepaintRect);
11399b8096d0SSteve Yin 					bFocusPosChanged=sal_True;
11409b8096d0SSteve Yin 				}
11419b8096d0SSteve Yin 				break;
11429b8096d0SSteve Yin 			case KEY_DOWN:
11439b8096d0SSteve Yin 				if( aFocusPosition.getY() < ( nLines - 1 ) )
11449b8096d0SSteve Yin 				{
11459b8096d0SSteve Yin 					aFocusPosition.setY( aFocusPosition.getY() + 1 );
11469b8096d0SSteve Yin 					Invalidate(mRepaintRect);
11479b8096d0SSteve Yin 					bFocusPosChanged=sal_True;
11489b8096d0SSteve Yin 				}
11499b8096d0SSteve Yin 				break;
11509b8096d0SSteve Yin 			case KEY_SPACE:
11519b8096d0SSteve Yin 				ChangePixel( sal_uInt16(aFocusPosition.getX() + aFocusPosition.getY() * nLines) );
11529b8096d0SSteve Yin 				Invalidate( implCalFocusRect(aFocusPosition) );
11539b8096d0SSteve Yin 				break;
11549b8096d0SSteve Yin 			default:
11559b8096d0SSteve Yin 				Control::KeyInput( rKEvt );
11569b8096d0SSteve Yin 				return;
11579b8096d0SSteve Yin 		}
11589b8096d0SSteve Yin 		if(m_xAccess.is())
11599b8096d0SSteve Yin 		{
11609b8096d0SSteve Yin 			long nIndex = GetFoucsPosIndex();
11619b8096d0SSteve Yin 			switch(nCode)
11629b8096d0SSteve Yin 			{
11639b8096d0SSteve Yin 			case KEY_LEFT:
11649b8096d0SSteve Yin 			case KEY_RIGHT:
11659b8096d0SSteve Yin 			case KEY_UP:
11669b8096d0SSteve Yin 			case KEY_DOWN:
11679b8096d0SSteve Yin 				if (bFocusPosChanged)
11689b8096d0SSteve Yin 				{
11699b8096d0SSteve Yin 					m_pAccess->NotifyChild(nIndex,sal_False,sal_False);
11709b8096d0SSteve Yin 				}
11719b8096d0SSteve Yin 				break;
11729b8096d0SSteve Yin 			case KEY_SPACE:
11739b8096d0SSteve Yin 				m_pAccess->NotifyChild(nIndex,sal_False,sal_True);
11749b8096d0SSteve Yin 				break;
11759b8096d0SSteve Yin 			default:
11769b8096d0SSteve Yin 				break;
11779b8096d0SSteve Yin 			}
11789b8096d0SSteve Yin 		}
11799b8096d0SSteve Yin 	}
11809b8096d0SSteve Yin 	else
11819b8096d0SSteve Yin 	{
11829b8096d0SSteve Yin 		Control::KeyInput( rKEvt );
11839b8096d0SSteve Yin 	}
11849b8096d0SSteve Yin }
11859b8096d0SSteve Yin 
11869b8096d0SSteve Yin //Draw focus when get focus
GetFocus()11879b8096d0SSteve Yin void SvxPixelCtl::GetFocus()
11889b8096d0SSteve Yin {
11899b8096d0SSteve Yin 	Invalidate(implCalFocusRect(aFocusPosition));
11909b8096d0SSteve Yin 
11919b8096d0SSteve Yin 	if(m_pAccess)
11929b8096d0SSteve Yin 	{
11939b8096d0SSteve Yin 		m_pAccess->NotifyChild(GetFoucsPosIndex(),sal_True,sal_False);
11949b8096d0SSteve Yin 	}
11959b8096d0SSteve Yin 
11969b8096d0SSteve Yin 	Control::GetFocus();
11979b8096d0SSteve Yin }
11989b8096d0SSteve Yin 
11999b8096d0SSteve Yin //Hide focus when lose focus
LoseFocus()12009b8096d0SSteve Yin void SvxPixelCtl::LoseFocus()
12019b8096d0SSteve Yin {
12029b8096d0SSteve Yin 	HideFocus();
12039b8096d0SSteve Yin 	if (m_pAccess)
12049b8096d0SSteve Yin 	{
12059b8096d0SSteve Yin 		m_pAccess->LoseFocus();
12069b8096d0SSteve Yin 	}
12079b8096d0SSteve Yin 	Control::LoseFocus();
12089b8096d0SSteve Yin }
1209cdf0e10cSrcweir 
1210cdf0e10cSrcweir /*************************************************************************
1211cdf0e10cSrcweir |*
1212cdf0e10cSrcweir |*
1213cdf0e10cSrcweir |*
1214cdf0e10cSrcweir \************************************************************************/
1215cdf0e10cSrcweir 
SetXBitmap(const BitmapEx & rBitmapEx)121670d3707aSArmin Le Grand void SvxPixelCtl::SetXBitmap( const BitmapEx& rBitmapEx )
1217cdf0e10cSrcweir {
121870d3707aSArmin Le Grand     BitmapColor aBack;
121970d3707aSArmin Le Grand     BitmapColor aFront;
1220cdf0e10cSrcweir 
122170d3707aSArmin Le Grand     if(isHistorical8x8(rBitmapEx, aBack, aFront))
122270d3707aSArmin Le Grand     {
122370d3707aSArmin Le Grand         Bitmap aBitmap(rBitmapEx.GetBitmap());
122470d3707aSArmin Le Grand         BitmapReadAccess* pRead = aBitmap.AcquireReadAccess();
1225cdf0e10cSrcweir 
122670d3707aSArmin Le Grand         aBackgroundColor = aBack;
122770d3707aSArmin Le Grand         aPixelColor = aFront;
122870d3707aSArmin Le Grand 
122970d3707aSArmin Le Grand         for(sal_uInt16 i(0); i < nSquares; i++)
123070d3707aSArmin Le Grand         {
123170d3707aSArmin Le Grand             const BitmapColor aColor(pRead->GetColor(i/8, i%8));
123270d3707aSArmin Le Grand 
123370d3707aSArmin Le Grand             if(aColor == aBack)
123470d3707aSArmin Le Grand             {
123570d3707aSArmin Le Grand                 *( pPixel + i ) = 0;
123670d3707aSArmin Le Grand             }
123770d3707aSArmin Le Grand             else
123870d3707aSArmin Le Grand             {
123970d3707aSArmin Le Grand                 *( pPixel + i ) = 1;
124070d3707aSArmin Le Grand             }
124170d3707aSArmin Le Grand         }
124270d3707aSArmin Le Grand 
124370d3707aSArmin Le Grand         aBitmap.ReleaseAccess(pRead);
124470d3707aSArmin Le Grand     }
1245cdf0e10cSrcweir }
1246cdf0e10cSrcweir 
1247cdf0e10cSrcweir /*************************************************************************
1248cdf0e10cSrcweir |*
1249cdf0e10cSrcweir |*	Gibt ein bestimmtes Pixel zurueck
1250cdf0e10cSrcweir |*
1251cdf0e10cSrcweir \************************************************************************/
1252cdf0e10cSrcweir 
GetBitmapPixel(const sal_uInt16 nPixel)1253cdf0e10cSrcweir sal_uInt16 SvxPixelCtl::GetBitmapPixel( const sal_uInt16 nPixel )
1254cdf0e10cSrcweir {
1255cdf0e10cSrcweir 	return( *( pPixel + nPixel ) );
1256cdf0e10cSrcweir }
1257cdf0e10cSrcweir 
1258cdf0e10cSrcweir /*************************************************************************
1259cdf0e10cSrcweir |*
1260cdf0e10cSrcweir |*	Bewirkt den Ursprungszustand des Controls
1261cdf0e10cSrcweir |*
1262cdf0e10cSrcweir \************************************************************************/
1263cdf0e10cSrcweir 
Reset()1264cdf0e10cSrcweir void SvxPixelCtl::Reset()
1265cdf0e10cSrcweir {
1266cdf0e10cSrcweir 	// clear pixel area
1267cdf0e10cSrcweir 	rtl_zeroMemory(pPixel, nSquares * sizeof(sal_uInt16));
1268cdf0e10cSrcweir 	Invalidate();
1269cdf0e10cSrcweir }
1270cdf0e10cSrcweir 
1271cdf0e10cSrcweir /*************************************************************************
1272cdf0e10cSrcweir |*
1273cdf0e10cSrcweir |*	Ctor: BitmapCtl fuer SvxPixelCtl
1274cdf0e10cSrcweir |*
1275cdf0e10cSrcweir \************************************************************************/
1276cdf0e10cSrcweir 
SvxBitmapCtl(Window *,const Size & rSize)1277cdf0e10cSrcweir SvxBitmapCtl::SvxBitmapCtl( Window* /*pParent*/, const Size& rSize )
1278cdf0e10cSrcweir {
1279cdf0e10cSrcweir 	aSize = rSize;
1280cdf0e10cSrcweir 	// aVD.SetOutputSizePixel( aSize );
1281cdf0e10cSrcweir }
1282cdf0e10cSrcweir 
1283cdf0e10cSrcweir /*************************************************************************
1284cdf0e10cSrcweir |*
1285cdf0e10cSrcweir |*	Dtor
1286cdf0e10cSrcweir |*
1287cdf0e10cSrcweir \************************************************************************/
1288cdf0e10cSrcweir 
~SvxBitmapCtl()1289cdf0e10cSrcweir SvxBitmapCtl::~SvxBitmapCtl()
1290cdf0e10cSrcweir {
1291cdf0e10cSrcweir }
1292cdf0e10cSrcweir 
1293cdf0e10cSrcweir /*************************************************************************
1294cdf0e10cSrcweir |*
1295cdf0e10cSrcweir |*	BitmapCtl:	Gibt die Bitmap zurueck
1296cdf0e10cSrcweir |*
1297cdf0e10cSrcweir \************************************************************************/
1298cdf0e10cSrcweir 
GetBitmapEx()129970d3707aSArmin Le Grand BitmapEx SvxBitmapCtl::GetBitmapEx()
1300cdf0e10cSrcweir {
130170d3707aSArmin Le Grand     const Bitmap aRetval(createHistorical8x8FromArray(pBmpArray, aPixelColor, aBackgroundColor));
1302cdf0e10cSrcweir 
130370d3707aSArmin Le Grand 	return BitmapEx(aRetval);
1304cdf0e10cSrcweir }
1305cdf0e10cSrcweir 
1306cdf0e10cSrcweir /*************************************************************************
1307cdf0e10cSrcweir |*
1308cdf0e10cSrcweir |*	Fuellt die Listbox mit Farben und Strings
1309cdf0e10cSrcweir |*
1310cdf0e10cSrcweir \************************************************************************/
1311cdf0e10cSrcweir 
Fill(const XColorListSharedPtr aColorTab)1312c7be74b1SArmin Le Grand void ColorLB::Fill( const XColorListSharedPtr aColorTab )
1313cdf0e10cSrcweir {
1314c7be74b1SArmin Le Grand 	long nCount = aColorTab->Count();
1315cdf0e10cSrcweir 	XColorEntry* pEntry;
1316cdf0e10cSrcweir 	SetUpdateMode( sal_False );
1317cdf0e10cSrcweir 
1318cdf0e10cSrcweir 	for( long i = 0; i < nCount; i++ )
1319cdf0e10cSrcweir 	{
1320c7be74b1SArmin Le Grand         pEntry = aColorTab->GetColor( i );
1321cdf0e10cSrcweir 		InsertEntry( pEntry->GetColor(), pEntry->GetName() );
1322cdf0e10cSrcweir 	}
1323a68b38dfSArmin Le Grand 
1324a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
1325cdf0e10cSrcweir 	SetUpdateMode( sal_True );
1326cdf0e10cSrcweir }
1327cdf0e10cSrcweir 
1328cdf0e10cSrcweir /************************************************************************/
1329cdf0e10cSrcweir 
Append(const XColorEntry & rEntry)13303e407bd8SArmin Le Grand void ColorLB::Append( const XColorEntry& rEntry )
1331cdf0e10cSrcweir {
13323e407bd8SArmin Le Grand     InsertEntry( rEntry.GetColor(), rEntry.GetName() );
1333a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
1334cdf0e10cSrcweir }
1335cdf0e10cSrcweir 
1336cdf0e10cSrcweir /************************************************************************/
1337cdf0e10cSrcweir 
Modify(const XColorEntry & rEntry,sal_uInt16 nPos)13383e407bd8SArmin Le Grand void ColorLB::Modify( const XColorEntry& rEntry, sal_uInt16 nPos )
1339cdf0e10cSrcweir {
13403e407bd8SArmin Le Grand     RemoveEntry( nPos );
13413e407bd8SArmin Le Grand     InsertEntry( rEntry.GetColor(), rEntry.GetName(), nPos );
1342cdf0e10cSrcweir }
1343cdf0e10cSrcweir 
1344cdf0e10cSrcweir /*************************************************************************
1345cdf0e10cSrcweir |*
1346cdf0e10cSrcweir |*	Fuellt die Listbox mit Farben und Strings
1347cdf0e10cSrcweir |*
1348cdf0e10cSrcweir \************************************************************************/
1349cdf0e10cSrcweir 
Fill(const XColorListSharedPtr aColorTab)1350c7be74b1SArmin Le Grand void FillAttrLB::Fill( const XColorListSharedPtr aColorTab )
1351cdf0e10cSrcweir {
1352c7be74b1SArmin Le Grand 	long nCount = aColorTab->Count();
1353cdf0e10cSrcweir 	XColorEntry* pEntry;
1354cdf0e10cSrcweir 	SetUpdateMode( sal_False );
1355cdf0e10cSrcweir 
1356cdf0e10cSrcweir 	for( long i = 0; i < nCount; i++ )
1357cdf0e10cSrcweir 	{
1358c7be74b1SArmin Le Grand         pEntry = aColorTab->GetColor( i );
1359cdf0e10cSrcweir 		InsertEntry( pEntry->GetColor(), pEntry->GetName() );
1360cdf0e10cSrcweir 	}
1361a68b38dfSArmin Le Grand 
1362a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
1363a68b38dfSArmin Le Grand     SetUpdateMode( sal_True );
1364cdf0e10cSrcweir }
1365cdf0e10cSrcweir 
1366cdf0e10cSrcweir /*************************************************************************
1367cdf0e10cSrcweir |*
1368cdf0e10cSrcweir |*	Fuellt die Listbox (vorlaeufig) mit Strings
1369cdf0e10cSrcweir |*
1370cdf0e10cSrcweir \************************************************************************/
1371cdf0e10cSrcweir 
HatchingLB(Window * pParent,ResId Id)1372a68b38dfSArmin Le Grand HatchingLB::HatchingLB( Window* pParent, ResId Id)
1373c7be74b1SArmin Le Grand : ListBox( pParent, Id )
1374cdf0e10cSrcweir {
1375a68b38dfSArmin Le Grand     SetEdgeBlending(true);
1376cdf0e10cSrcweir }
1377cdf0e10cSrcweir 
HatchingLB(Window * pParent,WinBits aWB)1378a68b38dfSArmin Le Grand HatchingLB::HatchingLB( Window* pParent, WinBits aWB)
1379c7be74b1SArmin Le Grand : ListBox( pParent, aWB )
1380cdf0e10cSrcweir {
1381a68b38dfSArmin Le Grand     SetEdgeBlending(true);
1382cdf0e10cSrcweir }
1383cdf0e10cSrcweir 
Fill(const XHatchListSharedPtr aList)1384c7be74b1SArmin Le Grand void HatchingLB::Fill( const XHatchListSharedPtr aList )
1385cdf0e10cSrcweir {
1386cdf0e10cSrcweir 	XHatchEntry* pEntry;
1387c7be74b1SArmin Le Grand 	long nCount = aList.get() ? aList->Count() : 0;
1388cdf0e10cSrcweir 
1389cdf0e10cSrcweir 	SetUpdateMode( sal_False );
1390cdf0e10cSrcweir 
1391a68b38dfSArmin Le Grand 	for( long i = 0; i < nCount; i++ )
1392cdf0e10cSrcweir 	{
1393c7be74b1SArmin Le Grand         pEntry = aList->GetHatch( i );
1394c7be74b1SArmin Le Grand 		const Bitmap aBitmap = aList->GetUiBitmap( i );
1395a68b38dfSArmin Le Grand 		if( !aBitmap.IsEmpty() )
1396a68b38dfSArmin Le Grand 			InsertEntry( pEntry->GetName(), aBitmap );
1397a68b38dfSArmin Le Grand 		else
1398a68b38dfSArmin Le Grand 			InsertEntry( pEntry->GetName() );
1399cdf0e10cSrcweir 	}
1400cdf0e10cSrcweir 
1401a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
1402cdf0e10cSrcweir 	SetUpdateMode( sal_True );
1403cdf0e10cSrcweir }
1404cdf0e10cSrcweir 
1405cdf0e10cSrcweir /************************************************************************/
1406cdf0e10cSrcweir 
Append(const XHatchEntry & rEntry,const Bitmap & rBitmap)14073e407bd8SArmin Le Grand void HatchingLB::Append( const XHatchEntry& rEntry, const Bitmap& rBitmap )
1408cdf0e10cSrcweir {
14093e407bd8SArmin Le Grand     if(!rBitmap.IsEmpty())
14103e407bd8SArmin Le Grand     {
14113e407bd8SArmin Le Grand         InsertEntry( rEntry.GetName(), rBitmap );
14123e407bd8SArmin Le Grand     }
14133e407bd8SArmin Le Grand     else
14143e407bd8SArmin Le Grand     {
14153e407bd8SArmin Le Grand         InsertEntry( rEntry.GetName() );
14163e407bd8SArmin Le Grand     }
14173e407bd8SArmin Le Grand 
1418a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
1419cdf0e10cSrcweir }
1420cdf0e10cSrcweir 
1421cdf0e10cSrcweir /************************************************************************/
1422cdf0e10cSrcweir 
Modify(const XHatchEntry & rEntry,sal_uInt16 nPos,const Bitmap & rBitmap)14233e407bd8SArmin Le Grand void HatchingLB::Modify( const XHatchEntry& rEntry, sal_uInt16 nPos, const Bitmap& rBitmap )
1424cdf0e10cSrcweir {
14253e407bd8SArmin Le Grand     RemoveEntry( nPos );
1426cdf0e10cSrcweir 
14273e407bd8SArmin Le Grand     if( !rBitmap.IsEmpty() )
14283e407bd8SArmin Le Grand     {
14293e407bd8SArmin Le Grand         InsertEntry( rEntry.GetName(), rBitmap, nPos );
14303e407bd8SArmin Le Grand     }
14313e407bd8SArmin Le Grand     else
14323e407bd8SArmin Le Grand     {
14333e407bd8SArmin Le Grand         InsertEntry( rEntry.GetName(), nPos );
14343e407bd8SArmin Le Grand     }
1435cdf0e10cSrcweir }
1436cdf0e10cSrcweir 
1437cdf0e10cSrcweir /************************************************************************/
1438cdf0e10cSrcweir 
SelectEntryByList(const XHatchListSharedPtr aList,const String & rStr,const XHatch & rHatch,sal_uInt16 nDist)1439c7be74b1SArmin Le Grand void HatchingLB::SelectEntryByList( const XHatchListSharedPtr aList, const String& rStr, const XHatch& rHatch, sal_uInt16 nDist )
1440cdf0e10cSrcweir {
1441c7be74b1SArmin Le Grand 	long nCount = aList.get() ? aList->Count() : 0;
1442cdf0e10cSrcweir 	XHatchEntry* pEntry;
1443cdf0e10cSrcweir 	sal_Bool bFound = sal_False;
1444cdf0e10cSrcweir 	String aStr;
1445cdf0e10cSrcweir 
1446cdf0e10cSrcweir 	long i;
1447cdf0e10cSrcweir 	for( i = 0; i < nCount && !bFound; i++ )
1448cdf0e10cSrcweir 	{
1449c7be74b1SArmin Le Grand         pEntry = aList->GetHatch( i );
1450cdf0e10cSrcweir 
1451cdf0e10cSrcweir 		aStr = pEntry->GetName();
1452cdf0e10cSrcweir 
1453cdf0e10cSrcweir 		if( rStr == aStr && rHatch == pEntry->GetHatch() )
1454cdf0e10cSrcweir 			bFound = sal_True;
1455cdf0e10cSrcweir 	}
1456cdf0e10cSrcweir 	if( bFound )
1457cdf0e10cSrcweir 		SelectEntryPos( (sal_uInt16) ( i - 1 + nDist ) );
1458cdf0e10cSrcweir }
1459cdf0e10cSrcweir 
1460cdf0e10cSrcweir /*************************************************************************
1461cdf0e10cSrcweir |*
1462cdf0e10cSrcweir |*	Fuellt die Listbox (vorlaeufig) mit Strings
1463cdf0e10cSrcweir |*
1464cdf0e10cSrcweir \************************************************************************/
1465cdf0e10cSrcweir 
Fill(const XHatchListSharedPtr aList)1466c7be74b1SArmin Le Grand void FillAttrLB::Fill( const XHatchListSharedPtr aList )
1467cdf0e10cSrcweir {
1468c7be74b1SArmin Le Grand 	long nCount = aList.get() ? aList->Count() : 0;
1469cdf0e10cSrcweir 	XHatchEntry* pEntry;
1470cdf0e10cSrcweir 	ListBox::SetUpdateMode( sal_False );
1471cdf0e10cSrcweir 
1472cdf0e10cSrcweir 	for( long i = 0; i < nCount; i++ )
1473cdf0e10cSrcweir 	{
1474c7be74b1SArmin Le Grand         pEntry = aList->GetHatch( i );
1475c7be74b1SArmin Le Grand 		const Bitmap aBitmap = aList->GetUiBitmap( i );
147697e8a929SArmin Le Grand 		if( !aBitmap.IsEmpty() )
147797e8a929SArmin Le Grand 			ListBox::InsertEntry( pEntry->GetName(), aBitmap );
1478cdf0e10cSrcweir 		else
1479cdf0e10cSrcweir 			InsertEntry( pEntry->GetName() );
1480cdf0e10cSrcweir 	}
1481a68b38dfSArmin Le Grand 
1482a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
1483cdf0e10cSrcweir 	ListBox::SetUpdateMode( sal_True );
1484cdf0e10cSrcweir }
1485cdf0e10cSrcweir 
1486cdf0e10cSrcweir /*************************************************************************
1487cdf0e10cSrcweir |*
1488cdf0e10cSrcweir |*	Fuellt die Listbox (vorlaeufig) mit Strings
1489cdf0e10cSrcweir |*
1490cdf0e10cSrcweir \************************************************************************/
1491cdf0e10cSrcweir 
GradientLB(Window * pParent,ResId Id)1492a68b38dfSArmin Le Grand GradientLB::GradientLB( Window* pParent, ResId Id)
1493c7be74b1SArmin Le Grand : ListBox( pParent, Id )
1494cdf0e10cSrcweir {
1495a68b38dfSArmin Le Grand     SetEdgeBlending(true);
1496cdf0e10cSrcweir }
1497cdf0e10cSrcweir 
GradientLB(Window * pParent,WinBits aWB)1498a68b38dfSArmin Le Grand GradientLB::GradientLB( Window* pParent, WinBits aWB)
1499c7be74b1SArmin Le Grand : ListBox( pParent, aWB )
1500cdf0e10cSrcweir {
1501a68b38dfSArmin Le Grand     SetEdgeBlending(true);
1502cdf0e10cSrcweir }
1503cdf0e10cSrcweir 
Fill(const XGradientListSharedPtr aList)1504c7be74b1SArmin Le Grand void GradientLB::Fill( const XGradientListSharedPtr aList )
1505cdf0e10cSrcweir {
1506cdf0e10cSrcweir 	XGradientEntry* pEntry;
1507c7be74b1SArmin Le Grand 	long nCount = aList.get() ? aList->Count() : 0;
1508cdf0e10cSrcweir 
1509cdf0e10cSrcweir 	SetUpdateMode( sal_False );
1510cdf0e10cSrcweir 
1511a68b38dfSArmin Le Grand 	for( long i = 0; i < nCount; i++ )
1512cdf0e10cSrcweir 	{
1513c7be74b1SArmin Le Grand         pEntry = aList->GetGradient( i );
1514c7be74b1SArmin Le Grand 		const Bitmap aBitmap = aList->GetUiBitmap( i );
1515a68b38dfSArmin Le Grand 		if( !aBitmap.IsEmpty() )
1516a68b38dfSArmin Le Grand 			InsertEntry( pEntry->GetName(), aBitmap );
1517a68b38dfSArmin Le Grand 		else
1518a68b38dfSArmin Le Grand 			InsertEntry( pEntry->GetName() );
1519cdf0e10cSrcweir 	}
1520cdf0e10cSrcweir 
1521a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
1522cdf0e10cSrcweir 	SetUpdateMode( sal_True );
1523cdf0e10cSrcweir }
1524cdf0e10cSrcweir 
1525cdf0e10cSrcweir /************************************************************************/
1526cdf0e10cSrcweir 
Append(const XGradientEntry & rEntry,const Bitmap & rBitmap)15273e407bd8SArmin Le Grand void GradientLB::Append( const XGradientEntry& rEntry, const Bitmap& rBitmap )
1528cdf0e10cSrcweir {
15293e407bd8SArmin Le Grand     if(!rBitmap.IsEmpty())
15303e407bd8SArmin Le Grand     {
15313e407bd8SArmin Le Grand         InsertEntry( rEntry.GetName(), rBitmap );
15323e407bd8SArmin Le Grand     }
15333e407bd8SArmin Le Grand     else
15343e407bd8SArmin Le Grand     {
15353e407bd8SArmin Le Grand         InsertEntry( rEntry.GetName() );
15363e407bd8SArmin Le Grand     }
15373e407bd8SArmin Le Grand 
1538a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
1539cdf0e10cSrcweir }
1540cdf0e10cSrcweir 
1541cdf0e10cSrcweir /************************************************************************/
1542cdf0e10cSrcweir 
Modify(const XGradientEntry & rEntry,sal_uInt16 nPos,const Bitmap & rBitmap)15433e407bd8SArmin Le Grand void GradientLB::Modify( const XGradientEntry& rEntry, sal_uInt16 nPos, const Bitmap& rBitmap )
1544cdf0e10cSrcweir {
15453e407bd8SArmin Le Grand     RemoveEntry( nPos );
1546cdf0e10cSrcweir 
15473e407bd8SArmin Le Grand     if(!rBitmap.IsEmpty())
15483e407bd8SArmin Le Grand     {
15493e407bd8SArmin Le Grand         InsertEntry( rEntry.GetName(), rBitmap, nPos );
15503e407bd8SArmin Le Grand     }
15513e407bd8SArmin Le Grand     else
15523e407bd8SArmin Le Grand     {
15533e407bd8SArmin Le Grand         InsertEntry( rEntry.GetName(), nPos );
15543e407bd8SArmin Le Grand     }
1555cdf0e10cSrcweir }
1556cdf0e10cSrcweir 
1557cdf0e10cSrcweir /************************************************************************/
1558cdf0e10cSrcweir 
SelectEntryByList(const XGradientListSharedPtr aList,const String & rStr,const XGradient & rGradient,sal_uInt16 nDist)1559c7be74b1SArmin Le Grand void GradientLB::SelectEntryByList( const XGradientListSharedPtr aList, const String& rStr, const XGradient& rGradient, sal_uInt16 nDist )
1560cdf0e10cSrcweir {
1561c7be74b1SArmin Le Grand 	long nCount = aList.get() ? aList->Count() : 0;
1562cdf0e10cSrcweir 	XGradientEntry* pEntry;
1563cdf0e10cSrcweir 	sal_Bool bFound = sal_False;
1564cdf0e10cSrcweir 	String aStr;
1565cdf0e10cSrcweir 
1566cdf0e10cSrcweir 	long i;
1567cdf0e10cSrcweir 	for( i = 0; i < nCount && !bFound; i++ )
1568cdf0e10cSrcweir 	{
1569c7be74b1SArmin Le Grand         pEntry = aList->GetGradient( i );
1570cdf0e10cSrcweir 
1571cdf0e10cSrcweir 		aStr = pEntry->GetName();
1572cdf0e10cSrcweir 
1573cdf0e10cSrcweir 		if( rStr == aStr && rGradient == pEntry->GetGradient() )
1574cdf0e10cSrcweir 			bFound = sal_True;
1575cdf0e10cSrcweir 	}
1576cdf0e10cSrcweir 	if( bFound )
1577cdf0e10cSrcweir 		SelectEntryPos( (sal_uInt16) ( i - 1 + nDist ) );
1578cdf0e10cSrcweir }
1579cdf0e10cSrcweir 
1580cdf0e10cSrcweir /*************************************************************************
1581cdf0e10cSrcweir |*
1582cdf0e10cSrcweir |*	Fuellt die Listbox (vorlaeufig) mit Strings
1583cdf0e10cSrcweir |*
1584cdf0e10cSrcweir \************************************************************************/
1585cdf0e10cSrcweir 
Fill(const XGradientListSharedPtr aList)1586c7be74b1SArmin Le Grand void FillAttrLB::Fill( const XGradientListSharedPtr aList )
1587cdf0e10cSrcweir {
1588c7be74b1SArmin Le Grand 	long nCount = aList.get() ? aList->Count() : 0;
1589cdf0e10cSrcweir 	XGradientEntry* pEntry;
1590cdf0e10cSrcweir 	ListBox::SetUpdateMode( sal_False );
1591cdf0e10cSrcweir 
1592cdf0e10cSrcweir 	for( long i = 0; i < nCount; i++ )
1593cdf0e10cSrcweir 	{
1594c7be74b1SArmin Le Grand         pEntry = aList->GetGradient( i );
1595c7be74b1SArmin Le Grand 		const Bitmap aBitmap = aList->GetUiBitmap( i );
159697e8a929SArmin Le Grand 		if( !aBitmap.IsEmpty() )
159797e8a929SArmin Le Grand 			ListBox::InsertEntry( pEntry->GetName(), aBitmap );
1598cdf0e10cSrcweir 		else
1599cdf0e10cSrcweir 			InsertEntry( pEntry->GetName() );
1600cdf0e10cSrcweir 	}
1601a68b38dfSArmin Le Grand 
1602a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
1603cdf0e10cSrcweir 	ListBox::SetUpdateMode( sal_True );
1604cdf0e10cSrcweir }
1605cdf0e10cSrcweir 
1606cdf0e10cSrcweir /*************************************************************************
1607cdf0e10cSrcweir |*
1608cdf0e10cSrcweir |*	Konstruktor von BitmapLB
1609cdf0e10cSrcweir |*
1610cdf0e10cSrcweir \************************************************************************/
1611cdf0e10cSrcweir 
BitmapLB(Window * pParent,ResId Id)1612a68b38dfSArmin Le Grand BitmapLB::BitmapLB(Window* pParent, ResId Id)
161370d3707aSArmin Le Grand :   ListBox(pParent, Id),
1614c7be74b1SArmin Le Grand     maBitmapEx()
1615cdf0e10cSrcweir {
1616a68b38dfSArmin Le Grand     SetEdgeBlending(true);
1617cdf0e10cSrcweir }
1618cdf0e10cSrcweir 
1619cdf0e10cSrcweir /************************************************************************/
1620cdf0e10cSrcweir 
1621a68b38dfSArmin Le Grand namespace
1622cdf0e10cSrcweir {
formatBitmapExToSize(BitmapEx & rBitmapEx,const Size & rSize)1623a68b38dfSArmin Le Grand     void formatBitmapExToSize(BitmapEx& rBitmapEx, const Size& rSize)
1624a68b38dfSArmin Le Grand     {
1625a68b38dfSArmin Le Grand         if(!rBitmapEx.IsEmpty() && rSize.Width() > 0 && rSize.Height() > 0)
1626a68b38dfSArmin Le Grand         {
1627a68b38dfSArmin Le Grand             VirtualDevice aVirtualDevice;
1628a68b38dfSArmin Le Grand             aVirtualDevice.SetOutputSizePixel(rSize);
162997e8a929SArmin Le Grand 
1630a68b38dfSArmin Le Grand             if(rBitmapEx.IsTransparent())
1631a68b38dfSArmin Le Grand             {
163235726d9dSArmin Le Grand                 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
163397e8a929SArmin Le Grand 
1634*33b19716SArmin Le Grand                 if(rStyleSettings.GetPreviewUsesCheckeredBackground())
163535726d9dSArmin Le Grand                 {
163635726d9dSArmin Le Grand                     const Point aNull(0, 0);
163735726d9dSArmin Le Grand                     static const sal_uInt32 nLen(8);
163835726d9dSArmin Le Grand                     static const Color aW(COL_WHITE);
163935726d9dSArmin Le Grand                     static const Color aG(0xef, 0xef, 0xef);
164035726d9dSArmin Le Grand 
164135726d9dSArmin Le Grand                     aVirtualDevice.DrawCheckered(aNull, rSize, nLen, aW, aG);
164235726d9dSArmin Le Grand                 }
164335726d9dSArmin Le Grand                 else
164435726d9dSArmin Le Grand                 {
164535726d9dSArmin Le Grand                     aVirtualDevice.SetBackground(rStyleSettings.GetFieldColor());
164635726d9dSArmin Le Grand                     aVirtualDevice.Erase();
164735726d9dSArmin Le Grand                 }
1648a68b38dfSArmin Le Grand             }
1649a68b38dfSArmin Le Grand 
1650a68b38dfSArmin Le Grand             if(rBitmapEx.GetSizePixel().Width() >= rSize.Width() && rBitmapEx.GetSizePixel().Height() >= rSize.Height())
165197e8a929SArmin Le Grand             {
1652a68b38dfSArmin Le Grand                 static sal_uInt32 nScaleFlag(BMP_SCALE_FASTESTINTERPOLATE);
1653a68b38dfSArmin Le Grand 
1654a68b38dfSArmin Le Grand                 rBitmapEx.Scale(rSize, nScaleFlag);
1655a68b38dfSArmin Le Grand                 aVirtualDevice.DrawBitmapEx(Point(0, 0), rBitmapEx);
165697e8a929SArmin Le Grand             }
1657a68b38dfSArmin Le Grand             else
1658a68b38dfSArmin Le Grand             {
1659a68b38dfSArmin Le Grand                 const Size aBitmapSize(rBitmapEx.GetSizePixel());
1660a68b38dfSArmin Le Grand 
1661a68b38dfSArmin Le Grand                 for(sal_Int32 y(0); y < rSize.Height(); y += aBitmapSize.Height())
1662a68b38dfSArmin Le Grand                 {
1663a68b38dfSArmin Le Grand                     for(sal_Int32 x(0); x < rSize.Width(); x += aBitmapSize.Width())
1664a68b38dfSArmin Le Grand                     {
1665a68b38dfSArmin Le Grand                         aVirtualDevice.DrawBitmapEx(
1666a68b38dfSArmin Le Grand                             Point(x, y),
1667a68b38dfSArmin Le Grand                             rBitmapEx);
1668a68b38dfSArmin Le Grand                     }
1669a68b38dfSArmin Le Grand                 }
1670a68b38dfSArmin Le Grand             }
1671a68b38dfSArmin Le Grand 
1672a68b38dfSArmin Le Grand             rBitmapEx = aVirtualDevice.GetBitmap(Point(0, 0), rSize);
167397e8a929SArmin Le Grand         }
1674a68b38dfSArmin Le Grand     }
1675a68b38dfSArmin Le Grand } // end of anonymous namespace
1676cdf0e10cSrcweir 
1677cdf0e10cSrcweir /************************************************************************/
1678cdf0e10cSrcweir 
Fill(const XBitmapListSharedPtr aList)1679c7be74b1SArmin Le Grand void BitmapLB::Fill(const XBitmapListSharedPtr aList)
1680cdf0e10cSrcweir {
1681cdf0e10cSrcweir 	XBitmapEntry* pEntry;
1682c7be74b1SArmin Le Grand 	const long nCount(aList.get() ? aList->Count() : 0);
1683a68b38dfSArmin Le Grand     const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1684a68b38dfSArmin Le Grand     const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize());
1685cdf0e10cSrcweir 
168670d3707aSArmin Le Grand 	SetUpdateMode(false);
1687cdf0e10cSrcweir 
1688a68b38dfSArmin Le Grand 	for(long i(0); i < nCount; i++)
1689cdf0e10cSrcweir 	{
1690c7be74b1SArmin Le Grand         pEntry = aList->GetBitmap(i);
1691a68b38dfSArmin Le Grand         maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
1692a68b38dfSArmin Le Grand         formatBitmapExToSize(maBitmapEx, aSize);
1693a68b38dfSArmin Le Grand         InsertEntry(pEntry->GetName(), maBitmapEx);
1694cdf0e10cSrcweir 	}
1695cdf0e10cSrcweir 
1696a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
169770d3707aSArmin Le Grand 	SetUpdateMode(true);
1698cdf0e10cSrcweir }
1699cdf0e10cSrcweir 
1700cdf0e10cSrcweir /************************************************************************/
1701cdf0e10cSrcweir 
Append(const Size & rSize,const XBitmapEntry & rEntry)17023e407bd8SArmin Le Grand void BitmapLB::Append(const Size& rSize, const XBitmapEntry& rEntry)
1703cdf0e10cSrcweir {
17043e407bd8SArmin Le Grand     maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx();
17053e407bd8SArmin Le Grand 
17063e407bd8SArmin Le Grand     if(!maBitmapEx.IsEmpty())
17073e407bd8SArmin Le Grand     {
1708a68b38dfSArmin Le Grand         formatBitmapExToSize(maBitmapEx, rSize);
17093e407bd8SArmin Le Grand         InsertEntry(rEntry.GetName(), maBitmapEx);
17103e407bd8SArmin Le Grand     }
17113e407bd8SArmin Le Grand     else
171270d3707aSArmin Le Grand     {
17133e407bd8SArmin Le Grand         InsertEntry(rEntry.GetName());
171470d3707aSArmin Le Grand     }
1715a68b38dfSArmin Le Grand 
1716a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
1717cdf0e10cSrcweir }
1718cdf0e10cSrcweir 
1719cdf0e10cSrcweir /************************************************************************/
1720cdf0e10cSrcweir 
Modify(const Size & rSize,const XBitmapEntry & rEntry,sal_uInt16 nPos)17213e407bd8SArmin Le Grand void BitmapLB::Modify(const Size& rSize, const XBitmapEntry& rEntry, sal_uInt16 nPos)
1722cdf0e10cSrcweir {
17233e407bd8SArmin Le Grand     RemoveEntry(nPos);
17243e407bd8SArmin Le Grand     maBitmapEx = rEntry.GetGraphicObject().GetGraphic().GetBitmapEx();
1725cdf0e10cSrcweir 
17263e407bd8SArmin Le Grand     if(!maBitmapEx.IsEmpty())
17273e407bd8SArmin Le Grand     {
1728a68b38dfSArmin Le Grand         formatBitmapExToSize(maBitmapEx, rSize);
17293e407bd8SArmin Le Grand         InsertEntry(rEntry.GetName(), maBitmapEx, nPos);
17303e407bd8SArmin Le Grand     }
17313e407bd8SArmin Le Grand     else
173270d3707aSArmin Le Grand     {
17333e407bd8SArmin Le Grand         InsertEntry(rEntry.GetName());
173470d3707aSArmin Le Grand     }
1735cdf0e10cSrcweir }
1736cdf0e10cSrcweir 
1737cdf0e10cSrcweir /************************************************************************/
1738cdf0e10cSrcweir 
SelectEntryByList(const XBitmapListSharedPtr aList,const String & rStr)1739c7be74b1SArmin Le Grand void BitmapLB::SelectEntryByList(const XBitmapListSharedPtr aList, const String& rStr)
1740cdf0e10cSrcweir {
1741c7be74b1SArmin Le Grand 	const long nCount(aList.get() ? aList->Count() : 0);
1742cdf0e10cSrcweir 	XBitmapEntry* pEntry;
174370d3707aSArmin Le Grand 	bool bFound(false);
174470d3707aSArmin Le Grand     long i(0);
1745cdf0e10cSrcweir 
174670d3707aSArmin Le Grand 	for(i = 0; i < nCount && !bFound; i++)
1747cdf0e10cSrcweir 	{
1748c7be74b1SArmin Le Grand         pEntry = aList->GetBitmap(i);
174970d3707aSArmin Le Grand 		const String aStr(pEntry->GetName());
1750cdf0e10cSrcweir 
175170d3707aSArmin Le Grand 		if(rStr == aStr)
1752cdf0e10cSrcweir 		{
175370d3707aSArmin Le Grand 			bFound = true;
1754cdf0e10cSrcweir 		}
1755cdf0e10cSrcweir 	}
175670d3707aSArmin Le Grand 
175770d3707aSArmin Le Grand     if(bFound)
175870d3707aSArmin Le Grand     {
175970d3707aSArmin Le Grand 		SelectEntryPos((sal_uInt16)(i - 1));
176070d3707aSArmin Le Grand     }
1761cdf0e10cSrcweir }
1762cdf0e10cSrcweir 
1763cdf0e10cSrcweir /*************************************************************************
1764cdf0e10cSrcweir |*
1765cdf0e10cSrcweir |*	Konstruktor von FillAttrLB
1766cdf0e10cSrcweir |*
1767cdf0e10cSrcweir \************************************************************************/
1768cdf0e10cSrcweir 
FillAttrLB(Window * pParent,ResId Id)176970d3707aSArmin Le Grand FillAttrLB::FillAttrLB( Window* pParent, ResId Id )
177070d3707aSArmin Le Grand :   ColorListBox(pParent, Id),
177170d3707aSArmin Le Grand     maBitmapEx()
1772cdf0e10cSrcweir {
1773cdf0e10cSrcweir }
1774cdf0e10cSrcweir 
1775cdf0e10cSrcweir /************************************************************************/
1776cdf0e10cSrcweir 
FillAttrLB(Window * pParent,WinBits aWB)177770d3707aSArmin Le Grand FillAttrLB::FillAttrLB(Window* pParent, WinBits aWB)
177870d3707aSArmin Le Grand :   ColorListBox(pParent, aWB)
1779cdf0e10cSrcweir {
1780cdf0e10cSrcweir }
1781cdf0e10cSrcweir 
1782cdf0e10cSrcweir /************************************************************************/
1783cdf0e10cSrcweir 
Fill(const XBitmapListSharedPtr aList)1784c7be74b1SArmin Le Grand void FillAttrLB::Fill(const XBitmapListSharedPtr aList)
1785cdf0e10cSrcweir {
1786c7be74b1SArmin Le Grand 	const long nCount(aList.get() ? aList->Count() : 0);
1787cdf0e10cSrcweir 	XBitmapEntry* pEntry;
1788a68b38dfSArmin Le Grand     const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1789a68b38dfSArmin Le Grand     const Size aSize(rStyleSettings.GetListBoxPreviewDefaultPixelSize());
179070d3707aSArmin Le Grand 
179170d3707aSArmin Le Grand     ListBox::SetUpdateMode(false);
1792cdf0e10cSrcweir 
179370d3707aSArmin Le Grand 	for(long i(0); i < nCount; i++)
1794cdf0e10cSrcweir 	{
1795c7be74b1SArmin Le Grand         pEntry = aList->GetBitmap( i );
179670d3707aSArmin Le Grand 		maBitmapEx = pEntry->GetGraphicObject().GetGraphic().GetBitmapEx();
1797a68b38dfSArmin Le Grand         formatBitmapExToSize(maBitmapEx, aSize);
1798a68b38dfSArmin Le Grand 		ListBox::InsertEntry(pEntry->GetName(), maBitmapEx);
1799cdf0e10cSrcweir 	}
180070d3707aSArmin Le Grand 
1801a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
180270d3707aSArmin Le Grand     ListBox::SetUpdateMode(true);
1803cdf0e10cSrcweir }
1804cdf0e10cSrcweir 
1805cdf0e10cSrcweir /************************************************************************/
1806cdf0e10cSrcweir 
SelectEntryByList(const XBitmapListSharedPtr aList,const String & rStr)1807c7be74b1SArmin Le Grand void FillAttrLB::SelectEntryByList( const XBitmapListSharedPtr aList, const String& rStr)
1808cdf0e10cSrcweir {
1809c7be74b1SArmin Le Grand 	const long nCount(aList.get() ? aList->Count() : 0);
1810cdf0e10cSrcweir 	XBitmapEntry* pEntry;
181170d3707aSArmin Le Grand 	bool bFound(false);
181270d3707aSArmin Le Grand 	long i(0);
1813cdf0e10cSrcweir 
181470d3707aSArmin Le Grand     for(i = 0; i < nCount && !bFound; i++)
1815cdf0e10cSrcweir 	{
1816c7be74b1SArmin Le Grand         pEntry = aList->GetBitmap(i);
181770d3707aSArmin Le Grand 		const String aStr(pEntry->GetName());
1818cdf0e10cSrcweir 
181970d3707aSArmin Le Grand 		if(rStr == aStr)
1820cdf0e10cSrcweir 		{
182170d3707aSArmin Le Grand 			bFound = true;
1822cdf0e10cSrcweir 		}
1823cdf0e10cSrcweir 	}
182470d3707aSArmin Le Grand 
182570d3707aSArmin Le Grand     if(bFound)
182670d3707aSArmin Le Grand     {
182770d3707aSArmin Le Grand 		SelectEntryPos((sal_uInt16)(i - 1));
182870d3707aSArmin Le Grand     }
1829cdf0e10cSrcweir }
1830cdf0e10cSrcweir 
1831cdf0e10cSrcweir /*************************************************************************
1832cdf0e10cSrcweir |*
1833cdf0e10cSrcweir |*	Fuellt die Listbox (vorlaeufig) mit Strings
1834cdf0e10cSrcweir |*
1835cdf0e10cSrcweir \************************************************************************/
1836cdf0e10cSrcweir 
Fill()1837cdf0e10cSrcweir void FillTypeLB::Fill()
1838cdf0e10cSrcweir {
1839cdf0e10cSrcweir 	SetUpdateMode( sal_False );
1840a68b38dfSArmin Le Grand 
1841a68b38dfSArmin Le Grand     InsertEntry( String( SVX_RES( RID_SVXSTR_INVISIBLE ) ) );
1842cdf0e10cSrcweir 	InsertEntry( String( SVX_RES( RID_SVXSTR_COLOR ) ) );
1843cdf0e10cSrcweir 	InsertEntry( String( SVX_RES( RID_SVXSTR_GRADIENT ) ) );
1844cdf0e10cSrcweir 	InsertEntry( String( SVX_RES( RID_SVXSTR_HATCH ) ) );
1845cdf0e10cSrcweir 	InsertEntry( String( SVX_RES( RID_SVXSTR_BITMAP ) ) );
1846a68b38dfSArmin Le Grand 
1847a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
1848cdf0e10cSrcweir 	SetUpdateMode( sal_True );
1849cdf0e10cSrcweir }
1850cdf0e10cSrcweir 
1851cdf0e10cSrcweir /*************************************************************************
1852cdf0e10cSrcweir |*
1853cdf0e10cSrcweir |*	Fuellt die Listbox (vorlaeufig) mit Strings
1854cdf0e10cSrcweir |*
1855cdf0e10cSrcweir \************************************************************************/
LineLB(Window * pParent,ResId Id)1856ed6b2054SArmin Le Grand LineLB::LineLB(Window* pParent, ResId Id)
1857ed6b2054SArmin Le Grand :   ListBox(pParent, Id),
1858ed6b2054SArmin Le Grand     mbAddStandardFields(true)
1859ed6b2054SArmin Le Grand {
1860a68b38dfSArmin Le Grand     // No EdgeBlending for LineStyle/Dash SetEdgeBlending(true);
1861ed6b2054SArmin Le Grand }
1862ed6b2054SArmin Le Grand 
LineLB(Window * pParent,WinBits aWB)1863ed6b2054SArmin Le Grand LineLB::LineLB(Window* pParent, WinBits aWB)
1864ed6b2054SArmin Le Grand :   ListBox(pParent, aWB),
1865ed6b2054SArmin Le Grand     mbAddStandardFields(true)
1866ed6b2054SArmin Le Grand {
1867a68b38dfSArmin Le Grand     // No EdgeBlending for LineStyle/Dash SetEdgeBlending(true);
1868ed6b2054SArmin Le Grand }
1869ed6b2054SArmin Le Grand 
~LineLB()1870ed6b2054SArmin Le Grand LineLB::~LineLB()
1871ed6b2054SArmin Le Grand {
1872ed6b2054SArmin Le Grand }
1873ed6b2054SArmin Le Grand 
setAddStandardFields(bool bNew)1874ed6b2054SArmin Le Grand void LineLB::setAddStandardFields(bool bNew)
1875ed6b2054SArmin Le Grand {
1876ed6b2054SArmin Le Grand     if(getAddStandardFields() != bNew)
1877ed6b2054SArmin Le Grand     {
1878ed6b2054SArmin Le Grand         mbAddStandardFields = bNew;
1879ed6b2054SArmin Le Grand     }
1880ed6b2054SArmin Le Grand }
1881cdf0e10cSrcweir 
Fill(const XDashListSharedPtr aList)1882c7be74b1SArmin Le Grand void LineLB::Fill( const XDashListSharedPtr aList )
1883cdf0e10cSrcweir {
188497e8a929SArmin Le Grand 	Clear();
188597e8a929SArmin Le Grand 
1886c7be74b1SArmin Le Grand     if(getAddStandardFields() && aList.get())
1887ed6b2054SArmin Le Grand     {
1888ed6b2054SArmin Le Grand         // entry for 'none'
1889c7be74b1SArmin Le Grand         InsertEntry(aList->GetStringForUiNoLine());
189097e8a929SArmin Le Grand 
1891ed6b2054SArmin Le Grand         // entry for solid line
1892c7be74b1SArmin Le Grand         InsertEntry(aList->GetStringForUiSolidLine(), aList->GetBitmapForUISolidLine());
1893ed6b2054SArmin Le Grand     }
189497e8a929SArmin Le Grand 
189597e8a929SArmin Le Grand     // entries for dashed lines
1896c7be74b1SArmin Le Grand 	long nCount = aList.get() ? aList->Count() : 0;
1897cdf0e10cSrcweir 	XDashEntry* pEntry;
1898cdf0e10cSrcweir 	SetUpdateMode( sal_False );
1899cdf0e10cSrcweir 
1900cdf0e10cSrcweir 	for( long i = 0; i < nCount; i++ )
1901cdf0e10cSrcweir 	{
1902c7be74b1SArmin Le Grand         pEntry = aList->GetDash( i );
1903c7be74b1SArmin Le Grand 		const Bitmap aBitmap = aList->GetUiBitmap( i );
190497e8a929SArmin Le Grand 		if( !aBitmap.IsEmpty() )
1905cdf0e10cSrcweir 		{
190697e8a929SArmin Le Grand 			InsertEntry( pEntry->GetName(), aBitmap );
190797e8a929SArmin Le Grand 			//delete pBitmap;
1908cdf0e10cSrcweir 		}
1909cdf0e10cSrcweir 		else
1910cdf0e10cSrcweir 			InsertEntry( pEntry->GetName() );
1911cdf0e10cSrcweir 	}
1912a68b38dfSArmin Le Grand 
1913a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
1914cdf0e10cSrcweir 	SetUpdateMode( sal_True );
1915cdf0e10cSrcweir }
1916cdf0e10cSrcweir 
1917cdf0e10cSrcweir /************************************************************************/
1918cdf0e10cSrcweir 
Append(const XDashEntry & rEntry,const Bitmap & rBitmap)19193e407bd8SArmin Le Grand void LineLB::Append( const XDashEntry& rEntry, const Bitmap& rBitmap )
1920cdf0e10cSrcweir {
19213e407bd8SArmin Le Grand     if(!rBitmap.IsEmpty())
19223e407bd8SArmin Le Grand     {
19233e407bd8SArmin Le Grand         InsertEntry( rEntry.GetName(), rBitmap );
19243e407bd8SArmin Le Grand     }
19253e407bd8SArmin Le Grand     else
19263e407bd8SArmin Le Grand     {
19273e407bd8SArmin Le Grand         InsertEntry( rEntry.GetName() );
19283e407bd8SArmin Le Grand     }
19293e407bd8SArmin Le Grand 
1930a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
1931cdf0e10cSrcweir }
1932cdf0e10cSrcweir 
1933cdf0e10cSrcweir /************************************************************************/
1934cdf0e10cSrcweir 
Modify(const XDashEntry & rEntry,sal_uInt16 nPos,const Bitmap & rBitmap)19353e407bd8SArmin Le Grand void LineLB::Modify( const XDashEntry& rEntry, sal_uInt16 nPos, const Bitmap& rBitmap )
1936cdf0e10cSrcweir {
19373e407bd8SArmin Le Grand     RemoveEntry( nPos );
1938cdf0e10cSrcweir 
19393e407bd8SArmin Le Grand     if(!rBitmap.IsEmpty())
19403e407bd8SArmin Le Grand     {
19413e407bd8SArmin Le Grand         InsertEntry( rEntry.GetName(), rBitmap, nPos );
19423e407bd8SArmin Le Grand     }
19433e407bd8SArmin Le Grand     else
19443e407bd8SArmin Le Grand     {
19453e407bd8SArmin Le Grand         InsertEntry( rEntry.GetName(), nPos );
19463e407bd8SArmin Le Grand     }
1947cdf0e10cSrcweir }
1948cdf0e10cSrcweir 
1949cdf0e10cSrcweir /************************************************************************/
1950cdf0e10cSrcweir 
SelectEntryByList(const XDashListSharedPtr aList,const String & rStr,const XDash & rDash,sal_uInt16 nDist)1951c7be74b1SArmin Le Grand void LineLB::SelectEntryByList( const XDashListSharedPtr aList, const String& rStr, const XDash& rDash, sal_uInt16 nDist )
1952cdf0e10cSrcweir {
1953c7be74b1SArmin Le Grand 	long nCount = aList.get() ? aList->Count() : 0;
1954cdf0e10cSrcweir 	XDashEntry* pEntry;
1955cdf0e10cSrcweir 	sal_Bool bFound = sal_False;
1956cdf0e10cSrcweir 	String aStr;
1957cdf0e10cSrcweir 	XDash aDash;
1958cdf0e10cSrcweir 
1959cdf0e10cSrcweir 	long i;
1960cdf0e10cSrcweir 	for( i = 0; i < nCount && !bFound; i++ )
1961cdf0e10cSrcweir 	{
1962c7be74b1SArmin Le Grand         pEntry = aList->GetDash( i );
1963cdf0e10cSrcweir 
1964cdf0e10cSrcweir 		aStr = pEntry->GetName();
1965cdf0e10cSrcweir 		aDash = pEntry->GetDash();
1966cdf0e10cSrcweir 
1967cdf0e10cSrcweir 		if( rStr == aStr && rDash == aDash )
1968cdf0e10cSrcweir 			bFound = sal_True;
1969cdf0e10cSrcweir 	}
1970cdf0e10cSrcweir 	if( bFound )
1971cdf0e10cSrcweir 		SelectEntryPos( (sal_uInt16) ( i - 1 + nDist ) );
1972cdf0e10cSrcweir }
1973cdf0e10cSrcweir 
1974cdf0e10cSrcweir /*************************************************************************
1975cdf0e10cSrcweir |*
1976cdf0e10cSrcweir |*	Fuellt die Listbox (vorlaeufig) mit Strings
1977cdf0e10cSrcweir |*
1978cdf0e10cSrcweir \************************************************************************/
LineEndLB(Window * pParent,ResId Id)1979fb2c9d94SAndre Fischer LineEndLB::LineEndLB( Window* pParent, ResId Id )
1980fb2c9d94SAndre Fischer     : ListBox( pParent, Id )
1981fb2c9d94SAndre Fischer {
1982a68b38dfSArmin Le Grand     // No EdgeBlending for LineEnds SetEdgeBlending(true);
1983fb2c9d94SAndre Fischer }
1984fb2c9d94SAndre Fischer 
LineEndLB(Window * pParent,WinBits aWB)1985fb2c9d94SAndre Fischer LineEndLB::LineEndLB( Window* pParent, WinBits aWB )
1986fb2c9d94SAndre Fischer     : ListBox( pParent, aWB )
1987fb2c9d94SAndre Fischer {
1988a68b38dfSArmin Le Grand     // No EdgeBlending for LineEnds SetEdgeBlending(true);
1989fb2c9d94SAndre Fischer }
1990fb2c9d94SAndre Fischer 
~LineEndLB(void)1991fb2c9d94SAndre Fischer LineEndLB::~LineEndLB(void)
1992fb2c9d94SAndre Fischer {
1993fb2c9d94SAndre Fischer }
1994fb2c9d94SAndre Fischer 
1995cdf0e10cSrcweir 
Fill(const XLineEndListSharedPtr aList,bool bStart)19963e407bd8SArmin Le Grand void LineEndLB::Fill( const XLineEndListSharedPtr aList, bool bStart )
1997cdf0e10cSrcweir {
1998c7be74b1SArmin Le Grand 	long nCount = aList.get() ? aList->Count() : 0;
1999cdf0e10cSrcweir 	XLineEndEntry* pEntry;
2000cdf0e10cSrcweir 	VirtualDevice aVD;
2001cdf0e10cSrcweir 	SetUpdateMode( sal_False );
2002cdf0e10cSrcweir 
2003cdf0e10cSrcweir 	for( long i = 0; i < nCount; i++ )
2004cdf0e10cSrcweir 	{
2005c7be74b1SArmin Le Grand         pEntry = aList->GetLineEnd( i );
2006c7be74b1SArmin Le Grand 		const Bitmap aBitmap = aList->GetUiBitmap( i );
200797e8a929SArmin Le Grand 		if( !aBitmap.IsEmpty() )
2008cdf0e10cSrcweir 		{
200997e8a929SArmin Le Grand 			Size aBmpSize( aBitmap.GetSizePixel() );
2010cdf0e10cSrcweir 			aVD.SetOutputSizePixel( aBmpSize, sal_False );
201197e8a929SArmin Le Grand 			aVD.DrawBitmap( Point(), aBitmap );
2012cdf0e10cSrcweir 			InsertEntry( pEntry->GetName(),
2013cdf0e10cSrcweir 				aVD.GetBitmap( bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ),
2014cdf0e10cSrcweir 					Size( aBmpSize.Width() / 2, aBmpSize.Height() ) ) );
201597e8a929SArmin Le Grand 			//delete pBitmap;
2016cdf0e10cSrcweir 		}
2017cdf0e10cSrcweir 		else
2018cdf0e10cSrcweir 			InsertEntry( pEntry->GetName() );
2019cdf0e10cSrcweir 	}
2020a68b38dfSArmin Le Grand 
2021a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
2022cdf0e10cSrcweir 	SetUpdateMode( sal_True );
2023cdf0e10cSrcweir }
2024cdf0e10cSrcweir 
2025cdf0e10cSrcweir /************************************************************************/
2026cdf0e10cSrcweir 
Append(const XLineEndEntry & rEntry,const Bitmap & rBitmap,bool bStart)20273e407bd8SArmin Le Grand void LineEndLB::Append( const XLineEndEntry& rEntry, const Bitmap& rBitmap, bool bStart )
2028cdf0e10cSrcweir {
20293e407bd8SArmin Le Grand     if(!rBitmap.IsEmpty())
20303e407bd8SArmin Le Grand     {
20313e407bd8SArmin Le Grand         VirtualDevice aVD;
20323e407bd8SArmin Le Grand         const Size aBmpSize(rBitmap.GetSizePixel());
20333e407bd8SArmin Le Grand 
20343e407bd8SArmin Le Grand         aVD.SetOutputSizePixel(aBmpSize, false);
20353e407bd8SArmin Le Grand         aVD.DrawBitmap(Point(), rBitmap);
20363e407bd8SArmin Le Grand         InsertEntry(
20373e407bd8SArmin Le Grand             rEntry.GetName(),
20383e407bd8SArmin Le Grand             aVD.GetBitmap(bStart ? Point() : Point(aBmpSize.Width() / 2, 0 ), Size(aBmpSize.Width() / 2, aBmpSize.Height())));
20393e407bd8SArmin Le Grand     }
20403e407bd8SArmin Le Grand     else
20413e407bd8SArmin Le Grand     {
20423e407bd8SArmin Le Grand         InsertEntry(rEntry.GetName());
20433e407bd8SArmin Le Grand     }
20443e407bd8SArmin Le Grand 
2045a68b38dfSArmin Le Grand     AdaptDropDownLineCountToMaximum();
2046cdf0e10cSrcweir }
2047cdf0e10cSrcweir 
2048cdf0e10cSrcweir /************************************************************************/
2049cdf0e10cSrcweir 
Modify(const XLineEndEntry & rEntry,sal_uInt16 nPos,const Bitmap & rBitmap,bool bStart)20503e407bd8SArmin Le Grand void LineEndLB::Modify( const XLineEndEntry& rEntry, sal_uInt16 nPos, const Bitmap& rBitmap, bool bStart )
2051cdf0e10cSrcweir {
20523e407bd8SArmin Le Grand     RemoveEntry( nPos );
2053cdf0e10cSrcweir 
20543e407bd8SArmin Le Grand     if(!rBitmap.IsEmpty())
20553e407bd8SArmin Le Grand     {
20563e407bd8SArmin Le Grand         VirtualDevice aVD;
20573e407bd8SArmin Le Grand         const Size aBmpSize(rBitmap.GetSizePixel());
20583e407bd8SArmin Le Grand 
20593e407bd8SArmin Le Grand         aVD.SetOutputSizePixel(aBmpSize, false);
20603e407bd8SArmin Le Grand         aVD.DrawBitmap(Point(), rBitmap);
20613e407bd8SArmin Le Grand         InsertEntry(
20623e407bd8SArmin Le Grand             rEntry.GetName(),
20633e407bd8SArmin Le Grand             aVD.GetBitmap(bStart ? Point() : Point( aBmpSize.Width() / 2, 0 ), Size( aBmpSize.Width() / 2, aBmpSize.Height())),
20643e407bd8SArmin Le Grand             nPos);
20653e407bd8SArmin Le Grand     }
20663e407bd8SArmin Le Grand     else
20673e407bd8SArmin Le Grand     {
20683e407bd8SArmin Le Grand         InsertEntry(rEntry.GetName(), nPos);
20693e407bd8SArmin Le Grand     }
2070cdf0e10cSrcweir }
2071cdf0e10cSrcweir 
2072cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
2073cdf0e10cSrcweir 
InitSettings(bool bForeground,bool bBackground)2074cdf0e10cSrcweir void SvxPreviewBase::InitSettings(bool bForeground, bool bBackground)
2075cdf0e10cSrcweir {
2076cdf0e10cSrcweir 	const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
2077cdf0e10cSrcweir 
2078cdf0e10cSrcweir 	if(bForeground)
2079cdf0e10cSrcweir 	{
2080cdf0e10cSrcweir 		svtools::ColorConfig aColorConfig;
2081cdf0e10cSrcweir 		Color aTextColor(aColorConfig.GetColorValue(svtools::FONTCOLOR).nColor);
2082cdf0e10cSrcweir 
2083cdf0e10cSrcweir 		if(IsControlForeground())
2084cdf0e10cSrcweir         {
2085cdf0e10cSrcweir 			aTextColor = GetControlForeground();
2086cdf0e10cSrcweir         }
2087cdf0e10cSrcweir 
2088cdf0e10cSrcweir 		getBufferDevice().SetTextColor(aTextColor);
2089cdf0e10cSrcweir 	}
2090cdf0e10cSrcweir 
2091cdf0e10cSrcweir 	if(bBackground)
2092cdf0e10cSrcweir 	{
2093cdf0e10cSrcweir 		if(IsControlBackground())
2094cdf0e10cSrcweir         {
2095cdf0e10cSrcweir 			getBufferDevice().SetBackground(GetControlBackground());
2096cdf0e10cSrcweir         }
2097cdf0e10cSrcweir 		else
2098cdf0e10cSrcweir         {
2099cdf0e10cSrcweir 			getBufferDevice().SetBackground(rStyleSettings.GetWindowColor());
2100cdf0e10cSrcweir         }
2101cdf0e10cSrcweir 	}
2102cdf0e10cSrcweir 
2103cdf0e10cSrcweir     // do not paint background self, it gets painted buffered
2104cdf0e10cSrcweir 	SetControlBackground();
2105cdf0e10cSrcweir     SetBackground();
2106cdf0e10cSrcweir 
2107cdf0e10cSrcweir     Invalidate();
2108cdf0e10cSrcweir }
2109cdf0e10cSrcweir 
SvxPreviewBase(Window * pParent,const ResId & rResId)2110cdf0e10cSrcweir SvxPreviewBase::SvxPreviewBase( Window* pParent, const ResId& rResId )
2111cdf0e10cSrcweir :	Control( pParent, rResId ),
2112cdf0e10cSrcweir 	mpModel( new SdrModel() ),
2113cdf0e10cSrcweir     mpBufferDevice( new VirtualDevice(*this) )
2114cdf0e10cSrcweir {
2115cdf0e10cSrcweir 	//	Draw the control's border as a flat thin black line.
2116cdf0e10cSrcweir     SetBorderStyle(WINDOW_BORDER_MONO);
2117cdf0e10cSrcweir     SetDrawMode( GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR );
2118cdf0e10cSrcweir     SetMapMode(MAP_100TH_MM);
2119cdf0e10cSrcweir 
2120cdf0e10cSrcweir     // init model
2121cdf0e10cSrcweir 	mpModel->GetItemPool().FreezeIdRanges();
2122cdf0e10cSrcweir }
2123cdf0e10cSrcweir 
~SvxPreviewBase()2124cdf0e10cSrcweir SvxPreviewBase::~SvxPreviewBase()
2125cdf0e10cSrcweir {
2126cdf0e10cSrcweir 	delete mpModel;
2127cdf0e10cSrcweir     delete mpBufferDevice;
2128cdf0e10cSrcweir }
2129cdf0e10cSrcweir 
LocalPrePaint()2130cdf0e10cSrcweir void SvxPreviewBase::LocalPrePaint()
2131cdf0e10cSrcweir {
2132cdf0e10cSrcweir     // init BufferDevice
2133cdf0e10cSrcweir     if(mpBufferDevice->GetOutputSizePixel() != GetOutputSizePixel())
2134cdf0e10cSrcweir     {
2135cdf0e10cSrcweir         mpBufferDevice->SetDrawMode(GetDrawMode());
2136cdf0e10cSrcweir         mpBufferDevice->SetSettings(GetSettings());
2137cdf0e10cSrcweir         mpBufferDevice->SetAntialiasing(GetAntialiasing());
2138cdf0e10cSrcweir         mpBufferDevice->SetOutputSizePixel(GetOutputSizePixel());
2139cdf0e10cSrcweir 	    mpBufferDevice->SetMapMode(GetMapMode());
2140cdf0e10cSrcweir     }
2141cdf0e10cSrcweir 
2142*33b19716SArmin Le Grand     const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
2143*33b19716SArmin Le Grand 
2144*33b19716SArmin Le Grand     if(rStyleSettings.GetPreviewUsesCheckeredBackground())
2145*33b19716SArmin Le Grand     {
2146*33b19716SArmin Le Grand         const Point aNull(0, 0);
2147*33b19716SArmin Le Grand         static const sal_uInt32 nLen(8);
2148*33b19716SArmin Le Grand         static const Color aW(COL_WHITE);
2149*33b19716SArmin Le Grand         static const Color aG(0xef, 0xef, 0xef);
2150*33b19716SArmin Le Grand         const bool bWasEnabled(mpBufferDevice->IsMapModeEnabled());
2151*33b19716SArmin Le Grand 
2152*33b19716SArmin Le Grand         mpBufferDevice->EnableMapMode(false);
2153*33b19716SArmin Le Grand         mpBufferDevice->DrawCheckered(aNull, mpBufferDevice->GetOutputSizePixel(), nLen, aW, aG);
2154*33b19716SArmin Le Grand         mpBufferDevice->EnableMapMode(bWasEnabled);
2155*33b19716SArmin Le Grand     }
2156*33b19716SArmin Le Grand     else
2157*33b19716SArmin Le Grand     {
2158*33b19716SArmin Le Grand         mpBufferDevice->Erase();
2159*33b19716SArmin Le Grand     }
2160cdf0e10cSrcweir }
2161cdf0e10cSrcweir 
LocalPostPaint()2162cdf0e10cSrcweir void SvxPreviewBase::LocalPostPaint()
2163cdf0e10cSrcweir {
2164cdf0e10cSrcweir     // copy to front (in pixel mode)
2165cdf0e10cSrcweir 	const bool bWasEnabledSrc(mpBufferDevice->IsMapModeEnabled());
2166cdf0e10cSrcweir 	const bool bWasEnabledDst(IsMapModeEnabled());
2167cdf0e10cSrcweir 	const Point aEmptyPoint;
2168cdf0e10cSrcweir 
2169cdf0e10cSrcweir     mpBufferDevice->EnableMapMode(false);
2170cdf0e10cSrcweir     EnableMapMode(false);
2171cdf0e10cSrcweir 
2172cdf0e10cSrcweir     DrawOutDev(
2173cdf0e10cSrcweir         aEmptyPoint, GetOutputSizePixel(),
2174cdf0e10cSrcweir         aEmptyPoint, GetOutputSizePixel(),
2175cdf0e10cSrcweir         *mpBufferDevice);
2176cdf0e10cSrcweir 
2177cdf0e10cSrcweir     mpBufferDevice->EnableMapMode(bWasEnabledSrc);
2178cdf0e10cSrcweir     EnableMapMode(bWasEnabledDst);
2179cdf0e10cSrcweir }
2180cdf0e10cSrcweir 
StateChanged(StateChangedType nType)2181cdf0e10cSrcweir void SvxPreviewBase::StateChanged(StateChangedType nType)
2182cdf0e10cSrcweir {
2183cdf0e10cSrcweir 	Control::StateChanged(nType);
2184cdf0e10cSrcweir 
2185cdf0e10cSrcweir     if(STATE_CHANGE_CONTROLFOREGROUND == nType)
2186cdf0e10cSrcweir     {
2187cdf0e10cSrcweir 		InitSettings(true, false);
2188cdf0e10cSrcweir     }
2189cdf0e10cSrcweir 	else if(STATE_CHANGE_CONTROLBACKGROUND == nType)
2190cdf0e10cSrcweir     {
2191cdf0e10cSrcweir 		InitSettings(false, true);
2192cdf0e10cSrcweir     }
2193cdf0e10cSrcweir }
2194cdf0e10cSrcweir 
DataChanged(const DataChangedEvent & rDCEvt)2195cdf0e10cSrcweir void SvxPreviewBase::DataChanged(const DataChangedEvent& rDCEvt)
2196cdf0e10cSrcweir {
2197cdf0e10cSrcweir     SetDrawMode(GetSettings().GetStyleSettings().GetHighContrastMode() ? OUTPUT_DRAWMODE_CONTRAST : OUTPUT_DRAWMODE_COLOR);
2198cdf0e10cSrcweir 
2199cdf0e10cSrcweir     if((DATACHANGED_SETTINGS == rDCEvt.GetType()) && (rDCEvt.GetFlags() & SETTINGS_STYLE))
2200cdf0e10cSrcweir     {
2201cdf0e10cSrcweir 		InitSettings(true, true);
2202cdf0e10cSrcweir     }
2203cdf0e10cSrcweir 	else
2204cdf0e10cSrcweir     {
2205cdf0e10cSrcweir 		Control::DataChanged(rDCEvt);
2206cdf0e10cSrcweir     }
2207cdf0e10cSrcweir }
2208cdf0e10cSrcweir 
2209cdf0e10cSrcweir /*************************************************************************
2210cdf0e10cSrcweir |*
2211cdf0e10cSrcweir |*    SvxXLinePreview::SvxXLinePreview()
2212cdf0e10cSrcweir |*
2213cdf0e10cSrcweir *************************************************************************/
2214cdf0e10cSrcweir 
SvxXLinePreview(Window * pParent,const ResId & rResId)2215cdf0e10cSrcweir SvxXLinePreview::SvxXLinePreview( Window* pParent, const ResId& rResId )
2216cdf0e10cSrcweir :	SvxPreviewBase( pParent, rResId ),
2217cdf0e10cSrcweir 	mpLineObjA( 0L ),
2218cdf0e10cSrcweir 	mpLineObjB( 0L ),
2219cdf0e10cSrcweir 	mpLineObjC( 0L ),
2220cdf0e10cSrcweir 	mpGraphic( 0L ),
2221cdf0e10cSrcweir 	mbWithSymbol( sal_False )
2222cdf0e10cSrcweir {
2223cdf0e10cSrcweir 	const Size aOutputSize(GetOutputSize());
2224cdf0e10cSrcweir 	InitSettings( sal_True, sal_True );
2225cdf0e10cSrcweir 
2226cdf0e10cSrcweir 	const sal_Int32 nDistance(500L);
2227cdf0e10cSrcweir 	const sal_Int32 nAvailableLength(aOutputSize.Width() - (4 * nDistance));
2228cdf0e10cSrcweir 
2229cdf0e10cSrcweir 	// create DrawObectA
2230cdf0e10cSrcweir 	const sal_Int32 aYPosA(aOutputSize.Height() / 2);
2231cdf0e10cSrcweir 	const basegfx::B2DPoint aPointA1( nDistance,  aYPosA);
2232cdf0e10cSrcweir 	const basegfx::B2DPoint aPointA2( aPointA1.getX() + ((nAvailableLength * 14) / 20), aYPosA );
2233cdf0e10cSrcweir 	basegfx::B2DPolygon aPolygonA;
2234cdf0e10cSrcweir 	aPolygonA.append(aPointA1);
2235cdf0e10cSrcweir 	aPolygonA.append(aPointA2);
2236cdf0e10cSrcweir 	mpLineObjA = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aPolygonA));
2237cdf0e10cSrcweir 	mpLineObjA->SetModel(&getModel());
2238cdf0e10cSrcweir 
2239cdf0e10cSrcweir 	// create DrawObectB
2240cdf0e10cSrcweir 	const sal_Int32 aYPosB1((aOutputSize.Height() * 3) / 4);
2241cdf0e10cSrcweir 	const sal_Int32 aYPosB2((aOutputSize.Height() * 1) / 4);
2242cdf0e10cSrcweir 	const basegfx::B2DPoint aPointB1( aPointA2.getX() + nDistance,  aYPosB1);
2243cdf0e10cSrcweir 	const basegfx::B2DPoint aPointB2( aPointB1.getX() + ((nAvailableLength * 2) / 20), aYPosB2 );
2244cdf0e10cSrcweir 	const basegfx::B2DPoint aPointB3( aPointB2.getX() + ((nAvailableLength * 2) / 20), aYPosB1 );
2245cdf0e10cSrcweir 	basegfx::B2DPolygon aPolygonB;
2246cdf0e10cSrcweir 	aPolygonB.append(aPointB1);
2247cdf0e10cSrcweir 	aPolygonB.append(aPointB2);
2248cdf0e10cSrcweir 	aPolygonB.append(aPointB3);
2249cdf0e10cSrcweir 	mpLineObjB = new SdrPathObj(OBJ_PLIN, basegfx::B2DPolyPolygon(aPolygonB));
2250cdf0e10cSrcweir 	mpLineObjB->SetModel(&getModel());
2251cdf0e10cSrcweir 
2252cdf0e10cSrcweir 	// create DrawObectC
2253cdf0e10cSrcweir 	const basegfx::B2DPoint aPointC1( aPointB3.getX() + nDistance,  aYPosB1);
2254cdf0e10cSrcweir 	const basegfx::B2DPoint aPointC2( aPointC1.getX() + ((nAvailableLength * 1) / 20), aYPosB2 );
2255cdf0e10cSrcweir 	const basegfx::B2DPoint aPointC3( aPointC2.getX() + ((nAvailableLength * 1) / 20), aYPosB1 );
2256cdf0e10cSrcweir 	basegfx::B2DPolygon aPolygonC;
2257cdf0e10cSrcweir 	aPolygonC.append(aPointC1);
2258cdf0e10cSrcweir 	aPolygonC.append(aPointC2);
2259cdf0e10cSrcweir 	aPolygonC.append(aPointC3);
2260cdf0e10cSrcweir 	mpLineObjC = new SdrPathObj(OBJ_PLIN, basegfx::B2DPolyPolygon(aPolygonC));
2261cdf0e10cSrcweir 	mpLineObjC->SetModel(&getModel());
2262cdf0e10cSrcweir }
2263cdf0e10cSrcweir 
~SvxXLinePreview()2264cdf0e10cSrcweir SvxXLinePreview::~SvxXLinePreview()
2265cdf0e10cSrcweir {
2266cdf0e10cSrcweir     SdrObject::Free( mpLineObjA );
2267cdf0e10cSrcweir     SdrObject::Free( mpLineObjB );
2268cdf0e10cSrcweir     SdrObject::Free( mpLineObjC );
2269cdf0e10cSrcweir }
2270cdf0e10cSrcweir 
2271cdf0e10cSrcweir // -----------------------------------------------------------------------
2272cdf0e10cSrcweir 
SetSymbol(Graphic * p,const Size & s)2273cdf0e10cSrcweir void SvxXLinePreview::SetSymbol(Graphic* p,const Size& s)
2274cdf0e10cSrcweir {
2275cdf0e10cSrcweir 	mpGraphic = p;
2276cdf0e10cSrcweir 	maSymbolSize = s;
2277cdf0e10cSrcweir }
2278cdf0e10cSrcweir 
2279cdf0e10cSrcweir // -----------------------------------------------------------------------
2280cdf0e10cSrcweir 
ResizeSymbol(const Size & s)2281cdf0e10cSrcweir void SvxXLinePreview::ResizeSymbol(const Size& s)
2282cdf0e10cSrcweir {
2283cdf0e10cSrcweir 	if ( s != maSymbolSize )
2284cdf0e10cSrcweir 	{
2285cdf0e10cSrcweir 		maSymbolSize = s;
2286cdf0e10cSrcweir 		Invalidate();
2287cdf0e10cSrcweir 	}
2288cdf0e10cSrcweir }
2289cdf0e10cSrcweir 
2290cdf0e10cSrcweir // -----------------------------------------------------------------------
2291cdf0e10cSrcweir 
SetLineAttributes(const SfxItemSet & rItemSet)2292cdf0e10cSrcweir void SvxXLinePreview::SetLineAttributes(const SfxItemSet& rItemSet)
2293cdf0e10cSrcweir {
2294cdf0e10cSrcweir 	// Set ItemSet at objects
2295cdf0e10cSrcweir 	mpLineObjA->SetMergedItemSet(rItemSet);
2296cdf0e10cSrcweir 
2297cdf0e10cSrcweir 	// At line joints, do not use arrows
2298cdf0e10cSrcweir 	SfxItemSet aTempSet(rItemSet);
2299cdf0e10cSrcweir 	aTempSet.ClearItem(XATTR_LINESTART);
2300cdf0e10cSrcweir 	aTempSet.ClearItem(XATTR_LINEEND);
2301cdf0e10cSrcweir 
2302cdf0e10cSrcweir 	mpLineObjB->SetMergedItemSet(aTempSet);
2303cdf0e10cSrcweir 	mpLineObjC->SetMergedItemSet(aTempSet);
2304cdf0e10cSrcweir }
2305cdf0e10cSrcweir 
2306cdf0e10cSrcweir // -----------------------------------------------------------------------
2307cdf0e10cSrcweir 
Paint(const Rectangle &)2308cdf0e10cSrcweir void SvxXLinePreview::Paint( const Rectangle& )
2309cdf0e10cSrcweir {
2310cdf0e10cSrcweir 	LocalPrePaint();
2311cdf0e10cSrcweir 
2312cdf0e10cSrcweir 	// paint objects to buffer device
2313cdf0e10cSrcweir 	sdr::contact::SdrObjectVector aObjectVector;
2314cdf0e10cSrcweir 	aObjectVector.push_back(mpLineObjA);
2315cdf0e10cSrcweir 	aObjectVector.push_back(mpLineObjB);
2316cdf0e10cSrcweir 	aObjectVector.push_back(mpLineObjC);
2317cdf0e10cSrcweir 
2318cdf0e10cSrcweir 	sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0);
2319cdf0e10cSrcweir 	sdr::contact::DisplayInfo aDisplayInfo;
2320cdf0e10cSrcweir 
2321cdf0e10cSrcweir 	// do processing
2322cdf0e10cSrcweir 	aPainter.ProcessDisplay(aDisplayInfo);
2323cdf0e10cSrcweir 
2324cdf0e10cSrcweir 	if ( mbWithSymbol && mpGraphic )
2325cdf0e10cSrcweir 	{
2326cdf0e10cSrcweir     	const Size aOutputSize(GetOutputSize());
2327cdf0e10cSrcweir 		Point aPos = Point( aOutputSize.Width() / 3, aOutputSize.Height() / 2 );
2328cdf0e10cSrcweir 		aPos.X() -= maSymbolSize.Width() / 2;
2329cdf0e10cSrcweir 		aPos.Y() -= maSymbolSize.Height() / 2;
2330cdf0e10cSrcweir 		mpGraphic->Draw( &getBufferDevice(), aPos, maSymbolSize );
2331cdf0e10cSrcweir 	}
2332cdf0e10cSrcweir 
2333cdf0e10cSrcweir 	LocalPostPaint();
2334cdf0e10cSrcweir }
2335cdf0e10cSrcweir 
2336cdf0e10cSrcweir /*************************************************************************
2337cdf0e10cSrcweir |*
2338cdf0e10cSrcweir |*    SvxXRectPreview::SvxXRectPreview()
2339cdf0e10cSrcweir |*
2340cdf0e10cSrcweir *************************************************************************/
2341cdf0e10cSrcweir 
SvxXRectPreview(Window * pParent,const ResId & rResId)2342cdf0e10cSrcweir SvxXRectPreview::SvxXRectPreview( Window* pParent, const ResId& rResId )
2343cdf0e10cSrcweir :	SvxPreviewBase( pParent, rResId ),
2344cdf0e10cSrcweir 	mpRectangleObject(0)
2345cdf0e10cSrcweir {
2346cdf0e10cSrcweir 	InitSettings(true, true);
2347cdf0e10cSrcweir 
2348cdf0e10cSrcweir 	// create RectangleObject
2349cdf0e10cSrcweir     const Rectangle aObjectSize(Point(), GetOutputSize());
2350cdf0e10cSrcweir 	mpRectangleObject = new SdrRectObj(aObjectSize);
2351cdf0e10cSrcweir 	mpRectangleObject->SetModel(&getModel());
2352cdf0e10cSrcweir }
2353cdf0e10cSrcweir 
~SvxXRectPreview()2354cdf0e10cSrcweir SvxXRectPreview::~SvxXRectPreview()
2355cdf0e10cSrcweir {
2356cdf0e10cSrcweir     SdrObject::Free(mpRectangleObject);
2357cdf0e10cSrcweir }
2358cdf0e10cSrcweir 
SetAttributes(const SfxItemSet & rItemSet)2359cdf0e10cSrcweir void SvxXRectPreview::SetAttributes(const SfxItemSet& rItemSet)
2360cdf0e10cSrcweir {
2361cdf0e10cSrcweir 	mpRectangleObject->SetMergedItemSet(rItemSet, true);
2362cdf0e10cSrcweir 	mpRectangleObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
2363cdf0e10cSrcweir }
2364cdf0e10cSrcweir 
Paint(const Rectangle &)2365cdf0e10cSrcweir void SvxXRectPreview::Paint( const Rectangle& )
2366cdf0e10cSrcweir {
2367cdf0e10cSrcweir 	LocalPrePaint();
2368cdf0e10cSrcweir 
2369cdf0e10cSrcweir     sdr::contact::SdrObjectVector aObjectVector;
2370cdf0e10cSrcweir 
2371cdf0e10cSrcweir     aObjectVector.push_back(mpRectangleObject);
2372cdf0e10cSrcweir 
2373cdf0e10cSrcweir     sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0);
2374cdf0e10cSrcweir 	sdr::contact::DisplayInfo aDisplayInfo;
2375cdf0e10cSrcweir 
2376cdf0e10cSrcweir 	aPainter.ProcessDisplay(aDisplayInfo);
2377cdf0e10cSrcweir 
2378cdf0e10cSrcweir     LocalPostPaint();
2379cdf0e10cSrcweir }
2380cdf0e10cSrcweir 
2381cdf0e10cSrcweir /*************************************************************************
2382cdf0e10cSrcweir |*
2383cdf0e10cSrcweir |*    SvxXShadowPreview::SvxXShadowPreview()
2384cdf0e10cSrcweir |*
2385cdf0e10cSrcweir *************************************************************************/
2386cdf0e10cSrcweir 
SvxXShadowPreview(Window * pParent,const ResId & rResId)2387cdf0e10cSrcweir SvxXShadowPreview::SvxXShadowPreview( Window* pParent, const ResId& rResId )
2388cdf0e10cSrcweir :	SvxPreviewBase( pParent, rResId ),
2389cdf0e10cSrcweir 	mpRectangleObject(0),
2390cdf0e10cSrcweir     mpRectangleShadow(0)
2391cdf0e10cSrcweir {
2392cdf0e10cSrcweir 	InitSettings(true, true);
2393cdf0e10cSrcweir 
2394cdf0e10cSrcweir     // prepare size
2395cdf0e10cSrcweir 	Size aSize = GetOutputSize();
2396cdf0e10cSrcweir 	aSize.Width() = aSize.Width() / 3;
2397cdf0e10cSrcweir 	aSize.Height() = aSize.Height() / 3;
2398cdf0e10cSrcweir 
2399cdf0e10cSrcweir     // create RectangleObject
2400cdf0e10cSrcweir     const Rectangle aObjectSize( Point( aSize.Width(), aSize.Height() ), aSize );
2401cdf0e10cSrcweir 	mpRectangleObject = new SdrRectObj(aObjectSize);
2402cdf0e10cSrcweir 	mpRectangleObject->SetModel(&getModel());
2403cdf0e10cSrcweir 
2404cdf0e10cSrcweir     // create ShadowObject
2405cdf0e10cSrcweir     const Rectangle aShadowSize( Point( aSize.Width(), aSize.Height() ), aSize );
2406cdf0e10cSrcweir 	mpRectangleShadow = new SdrRectObj(aShadowSize);
2407cdf0e10cSrcweir 	mpRectangleShadow->SetModel(&getModel());
2408cdf0e10cSrcweir }
2409cdf0e10cSrcweir 
~SvxXShadowPreview()2410cdf0e10cSrcweir SvxXShadowPreview::~SvxXShadowPreview()
2411cdf0e10cSrcweir {
2412cdf0e10cSrcweir     SdrObject::Free(mpRectangleObject);
2413cdf0e10cSrcweir     SdrObject::Free(mpRectangleShadow);
2414cdf0e10cSrcweir }
2415cdf0e10cSrcweir 
SetRectangleAttributes(const SfxItemSet & rItemSet)2416cdf0e10cSrcweir void SvxXShadowPreview::SetRectangleAttributes(const SfxItemSet& rItemSet)
2417cdf0e10cSrcweir {
2418cdf0e10cSrcweir 	mpRectangleObject->SetMergedItemSet(rItemSet, true);
2419cdf0e10cSrcweir 	mpRectangleObject->SetMergedItem(XLineStyleItem(XLINE_NONE));
2420cdf0e10cSrcweir }
2421cdf0e10cSrcweir 
SetShadowAttributes(const SfxItemSet & rItemSet)2422cdf0e10cSrcweir void SvxXShadowPreview::SetShadowAttributes(const SfxItemSet& rItemSet)
2423cdf0e10cSrcweir {
2424cdf0e10cSrcweir 	mpRectangleShadow->SetMergedItemSet(rItemSet, true);
2425cdf0e10cSrcweir 	mpRectangleShadow->SetMergedItem(XLineStyleItem(XLINE_NONE));
2426cdf0e10cSrcweir }
2427cdf0e10cSrcweir 
SetShadowPosition(const Point & rPos)2428cdf0e10cSrcweir void SvxXShadowPreview::SetShadowPosition(const Point& rPos)
2429cdf0e10cSrcweir {
2430cdf0e10cSrcweir     Rectangle aObjectPosition(mpRectangleObject->GetSnapRect());
2431cdf0e10cSrcweir     aObjectPosition.Move(rPos.X(), rPos.Y());
2432cdf0e10cSrcweir     mpRectangleShadow->SetSnapRect(aObjectPosition);
2433cdf0e10cSrcweir }
2434cdf0e10cSrcweir 
Paint(const Rectangle &)2435cdf0e10cSrcweir void SvxXShadowPreview::Paint( const Rectangle& )
2436cdf0e10cSrcweir {
2437cdf0e10cSrcweir 	LocalPrePaint();
2438cdf0e10cSrcweir 
2439cdf0e10cSrcweir     sdr::contact::SdrObjectVector aObjectVector;
2440cdf0e10cSrcweir 
2441cdf0e10cSrcweir     aObjectVector.push_back(mpRectangleShadow);
2442cdf0e10cSrcweir 	aObjectVector.push_back(mpRectangleObject);
2443cdf0e10cSrcweir 
2444cdf0e10cSrcweir     sdr::contact::ObjectContactOfObjListPainter aPainter(getBufferDevice(), aObjectVector, 0);
2445cdf0e10cSrcweir 	sdr::contact::DisplayInfo aDisplayInfo;
2446cdf0e10cSrcweir 
2447cdf0e10cSrcweir 	aPainter.ProcessDisplay(aDisplayInfo);
2448cdf0e10cSrcweir 
2449cdf0e10cSrcweir     LocalPostPaint();
2450cdf0e10cSrcweir }
2451cdf0e10cSrcweir 
2452cdf0e10cSrcweir // -----------------------------------------------------------------------
2453cdf0e10cSrcweir // eof
2454