xref: /aoo4110/main/cui/source/tabpages/labdlg.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_cui.hxx"
26 
27 // include ---------------------------------------------------------------
28 #include <tools/shl.hxx>
29 #include <sfx2/app.hxx>
30 #include <sfx2/module.hxx>
31 #include <swpossizetabpage.hxx>
32 #include <svx/dialogs.hrc>
33 #define _SVX_LABDLG_CXX
34 
35 #include <svx/svdattrx.hxx>
36 #include <cuires.hrc>
37 #include <dialmgr.hxx>
38 #include "svx/dlgutil.hxx"
39 #include "transfrm.hxx"
40 
41 #include "labdlg.hrc"
42 #include "labdlg.hxx"
43 
44 // define ----------------------------------------------------------------
45 
46 #define AZ_OPTIMAL		0
47 #define AZ_VON_OBEN		1
48 #define AZ_VON_LINKS	2
49 #define AZ_HORIZONTAL	3
50 #define AZ_VERTIKAL		4
51 
52 #define AT_OBEN			0
53 #define AT_MITTE		1
54 #define AT_UNTEN		2
55 
56 #define WK_OPTIMAL		0
57 #define WK_30			1
58 #define WK_45			2
59 #define WK_60			3
60 #define WK_90			4
61 
62 // static ----------------------------------------------------------------
63 
64 static sal_uInt16 pCaptionRanges[] =
65 {
66 	SDRATTR_CAPTIONTYPE,
67 	SDRATTR_CAPTIONFIXEDANGLE,
68 	SDRATTR_CAPTIONANGLE,
69 	SDRATTR_CAPTIONGAP,
70 	SDRATTR_CAPTIONESCDIR,
71 	SDRATTR_CAPTIONESCISREL,
72 	SDRATTR_CAPTIONESCREL,
73 	SDRATTR_CAPTIONESCABS,
74 	SDRATTR_CAPTIONLINELEN,
75 	SDRATTR_CAPTIONFITLINELEN,
76 	0
77 };
78 
79 // -----------------------------------------------------------------------
80 
SvxCaptionTabPage(Window * pParent,const SfxItemSet & rInAttrs)81 SvxCaptionTabPage::SvxCaptionTabPage(Window* pParent, const SfxItemSet& rInAttrs)
82  :	SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_CAPTION ), rInAttrs ),
83 
84 	aCT_CAPTTYPE(		this, CUI_RES( CT_CAPTTYPE ) ),
85 	aFT_ABSTAND(		this, CUI_RES( FT_ABSTAND ) ),
86 	aMF_ABSTAND(		this, CUI_RES( MF_ABSTAND ) ),
87 	aFT_WINKEL(			this, CUI_RES( FT_WINKEL ) ),
88 	aLB_WINKEL(			this, CUI_RES( LB_WINKEL ) ),
89 	aFT_ANSATZ(			this, CUI_RES( FT_ANSATZ ) ),
90 	aLB_ANSATZ(			this, CUI_RES( LB_ANSATZ ) ),
91 	aFT_UM(				this, CUI_RES( FT_UM ) ),
92 	aMF_ANSATZ(			this, CUI_RES( MF_ANSATZ ) ),
93 	aFT_ANSATZ_REL(		this, CUI_RES( FT_ANSATZ_REL ) ),
94 	aLB_ANSATZ_REL(		this, CUI_RES( LB_ANSATZ_REL ) ),
95 	aFT_LAENGE(			this, CUI_RES( FT_LAENGE ) ),
96 	aMF_LAENGE(			this, CUI_RES( MF_LAENGE ) ),
97 	aCB_LAENGE(			this, CUI_RES( CB_LAENGE ) ),
98 
99 	aStrHorzList( CUI_RES(STR_HORZ_LIST) ),
100 	aStrVertList( CUI_RES(STR_VERT_LIST) ),
101 
102 	rOutAttrs		( rInAttrs )
103 {
104 	//------------NYI-------------------------------------------
105 	aFT_WINKEL.Hide();
106 	aLB_WINKEL.Hide();
107 
108 	//------------Positionen korrigieren-------------------------
109 	aFT_ANSATZ_REL.SetPosPixel( aFT_UM.GetPosPixel() );
110 	aLB_ANSATZ_REL.SetPosPixel(
111 		Point(
112 			aFT_ANSATZ_REL.GetPosPixel().X()+aFT_ANSATZ_REL.GetSizePixel().Width()+6,
113 			aLB_ANSATZ.GetPosPixel().Y() )
114 		);
115 
116 	aMF_ANSATZ.SetPosPixel(
117 		Point(
118 			aFT_UM.GetPosPixel().X()+aFT_UM.GetSizePixel().Width()+6,
119 			aLB_ANSATZ.GetPosPixel().Y() )
120 		);
121 
122 	sal_uInt16 nBitmap;
123 	for( nBitmap = 0; nBitmap < CAPTYPE_BITMAPS_COUNT; nBitmap++ )
124 	{
125 		mpBmpCapTypes[nBitmap]  = new Image(Bitmap(CUI_RES(BMP_CAPTTYPE_1   + nBitmap)), COL_LIGHTMAGENTA );
126 		mpBmpCapTypesH[nBitmap] = new Image(Bitmap(CUI_RES(BMP_CAPTTYPE_1_H + nBitmap)), COL_LIGHTMAGENTA );
127 	}
128 
129 	//------------ValueSet installieren--------------------------
130 	aCT_CAPTTYPE.SetStyle( aCT_CAPTTYPE.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD );
131 	aCT_CAPTTYPE.SetColCount(5);//XXX
132 	aCT_CAPTTYPE.SetLineCount(1);
133 	aCT_CAPTTYPE.SetSelectHdl(LINK( this, SvxCaptionTabPage, SelectCaptTypeHdl_Impl));
134 
135 	Image aImage;
136 	aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_1, aImage,	String(CUI_RES(STR_CAPTTYPE_1)));
137 	aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_2,	aImage,	String(CUI_RES(STR_CAPTTYPE_2)));
138 	aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_3,	aImage,	String(CUI_RES(STR_CAPTTYPE_3)));
139 
140 	FillValueSet();
141 
142 	aLB_ANSATZ.SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzSelectHdl_Impl));
143 	aLB_ANSATZ_REL.SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzRelSelectHdl_Impl));
144 	aCB_LAENGE.SetClickHdl(LINK(this,SvxCaptionTabPage,LineOptHdl_Impl));
145 
146 	FreeResource();
147 }
148 
149 // -----------------------------------------------------------------------
150 
~SvxCaptionTabPage()151 SvxCaptionTabPage::~SvxCaptionTabPage()
152 {
153 	sal_uInt16 nBitmap;
154 	for( nBitmap = 0; nBitmap < CAPTYPE_BITMAPS_COUNT; nBitmap++ )
155 	{
156 		delete mpBmpCapTypes[nBitmap];
157 		delete mpBmpCapTypesH[nBitmap];
158 	}
159 }
160 
161 // -----------------------------------------------------------------------
162 
Construct()163 void SvxCaptionTabPage::Construct()
164 {
165 	// Setzen des Rechtecks und der Workingarea
166 	DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
167 }
168 
169 // -----------------------------------------------------------------------
170 
FillItemSet(SfxItemSet & _rOutAttrs)171 sal_Bool SvxCaptionTabPage::FillItemSet( SfxItemSet&  _rOutAttrs)
172 {
173     SfxItemPool*    pPool = _rOutAttrs.GetPool();
174 	DBG_ASSERT( pPool, "Wo ist der Pool" );
175 
176 	SfxMapUnit		eUnit;
177 
178 	nCaptionType = aCT_CAPTTYPE.GetSelectItemId()-1;
179 
180     _rOutAttrs.Put( SdrCaptionTypeItem( (SdrCaptionType) nCaptionType ) );
181 
182 	if( aMF_ABSTAND.IsValueModified() )
183 	{
184 		eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONGAP ) );
185         _rOutAttrs.Put( SdrCaptionGapItem( GetCoreValue(aMF_ABSTAND, eUnit ) ) );
186 	}
187 
188 	// Sonderbehandlung!!! XXX
189 	if( nCaptionType==SDRCAPT_TYPE1 )
190 	{
191 		switch( nEscDir )
192 		{
193 			case SDRCAPT_ESCHORIZONTAL:		nEscDir=SDRCAPT_ESCVERTICAL;break;
194 			case SDRCAPT_ESCVERTICAL:		nEscDir=SDRCAPT_ESCHORIZONTAL;break;
195 		}
196 	}
197 
198     _rOutAttrs.Put( SdrCaptionEscDirItem( (SdrCaptionEscDir)nEscDir ) );
199 
200 	bEscRel = aLB_ANSATZ_REL.IsVisible();
201     _rOutAttrs.Put( SdrCaptionEscIsRelItem( bEscRel ) );
202 
203 	if( bEscRel )
204 	{
205 		long	nVal = 0;
206 
207 		switch( aLB_ANSATZ_REL.GetSelectEntryPos() )
208 		{
209 			case AT_OBEN:	nVal=0;break;
210 			case AT_MITTE:	nVal=5000;break;
211 			case AT_UNTEN:	nVal=10000;break;
212 		}
213         _rOutAttrs.Put( SdrCaptionEscRelItem( nVal ) );
214 	}
215 	else
216 	{
217 		if( aMF_ANSATZ.IsValueModified() )
218 		{
219 			eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONESCABS ) );
220             _rOutAttrs.Put( SdrCaptionEscAbsItem( GetCoreValue(aMF_ANSATZ, eUnit ) ) );
221 		}
222 	}
223 
224 	bFitLineLen = aCB_LAENGE.IsChecked();
225     _rOutAttrs.Put( SdrCaptionFitLineLenItem( bFitLineLen ) );
226 
227 	if( ! bFitLineLen )
228 	{
229 		if( aMF_LAENGE.IsValueModified() )
230 		{
231 			eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONLINELEN ) );
232             _rOutAttrs.Put( SdrCaptionLineLenItem( GetCoreValue(aMF_LAENGE, eUnit ) ) );
233 		}
234 	}
235 
236 //NYI-------------die Winkel muessen noch hier rein!!! XXX----------------------
237 
238 	return( sal_True );
239 }
240 
241 // -----------------------------------------------------------------------
242 
Reset(const SfxItemSet &)243 void SvxCaptionTabPage::Reset( const SfxItemSet&  )
244 {
245 
246 	//------------Metrik einstellen-----------------------------
247 
248 	FieldUnit eFUnit = GetModuleFieldUnit( rOutAttrs );
249 
250 	switch ( eFUnit )
251 	{
252 		case FUNIT_CM:
253 		case FUNIT_M:
254 		case FUNIT_KM:
255 			eFUnit = FUNIT_MM;
256 			break;
257         default: ;//prevent warning
258 	}
259 	SetFieldUnit( aMF_ABSTAND, eFUnit );
260 	SetFieldUnit( aMF_ANSATZ, eFUnit );
261 	SetFieldUnit( aMF_LAENGE, eFUnit );
262 
263 	SfxItemPool* 	pPool = rOutAttrs.GetPool();
264 	DBG_ASSERT( pPool, "Wo ist der Pool" );
265 
266 	sal_uInt16			nWhich;
267 	SfxMapUnit		eUnit;
268 
269 	//------- Winkel ----------
270 	nWhich = GetWhich( SDRATTR_CAPTIONANGLE );
271 	nFixedAngle = ( ( const SdrCaptionAngleItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
272 
273 	//------- absolute Ansatzentfernung ----------
274 	nWhich = GetWhich( SDRATTR_CAPTIONESCABS );
275 	eUnit = pPool->GetMetric( nWhich );
276 	nEscAbs = ( ( const SdrCaptionEscAbsItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
277 	SetMetricValue( aMF_ANSATZ, nEscAbs, eUnit );
278 	nEscAbs = static_cast<long>(aMF_ANSATZ.GetValue());
279 
280 	//------- relative Ansatzentfernung ----------
281 	nWhich = GetWhich( SDRATTR_CAPTIONESCREL );
282 	nEscRel = (long)( ( const SdrCaptionEscRelItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
283 
284 	//------- Linienlaenge ----------
285 	nWhich = GetWhich( SDRATTR_CAPTIONLINELEN );
286 	eUnit = pPool->GetMetric( nWhich );
287 	nLineLen = ( ( const SdrCaptionLineLenItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
288 	SetMetricValue( aMF_LAENGE, nLineLen, eUnit );
289 	nLineLen = static_cast<long>(aMF_LAENGE.GetValue());
290 
291 	//------- Abstand zur Box ----------
292 	nWhich = GetWhich( SDRATTR_CAPTIONGAP );
293 	eUnit = pPool->GetMetric( nWhich );
294 	nGap = ( ( const SdrCaptionGapItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
295 	SetMetricValue( aMF_ABSTAND, nGap, eUnit );
296 	nGap = static_cast<long>(aMF_ABSTAND.GetValue());
297 
298 	nCaptionType = (short)( ( const SdrCaptionTypeItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONTYPE ) ) ).GetValue();
299 	bFixedAngle = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFIXEDANGLE ) ) ).GetValue();
300 	bFitLineLen = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFITLINELEN ) ) ).GetValue();
301 	nEscDir = (short)( ( const SdrCaptionEscDirItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCDIR ) ) ).GetValue();
302 	bEscRel = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCISREL ) ) ).GetValue();
303 
304 	// Sonderbehandlung!!! XXX
305 	if( nCaptionType==SDRCAPT_TYPE1 )
306 	{
307 		switch( nEscDir )
308 		{
309 			case SDRCAPT_ESCHORIZONTAL:		nEscDir=SDRCAPT_ESCVERTICAL;break;
310 			case SDRCAPT_ESCVERTICAL:		nEscDir=SDRCAPT_ESCHORIZONTAL;break;
311 		}
312 	}
313 
314 	nAnsatzRelPos=AT_MITTE;
315 	nAnsatzTypePos=AZ_OPTIMAL;
316 	nWinkelTypePos=WK_OPTIMAL;
317 
318 	aMF_ABSTAND.SetValue( nGap );
319 
320 	if( nEscDir == SDRCAPT_ESCHORIZONTAL )
321 	{
322 		if( bEscRel )
323 		{
324 			if( nEscRel < 3333 )
325 				nAnsatzRelPos = AT_OBEN;
326 			if( nEscRel > 6666 )
327 				nAnsatzRelPos = AT_UNTEN;
328 			nAnsatzTypePos = AZ_HORIZONTAL;
329 		}
330 		else
331 		{
332 			nAnsatzTypePos = AZ_VON_OBEN;
333 			aMF_ANSATZ.SetValue( nEscAbs );
334 		}
335 	}
336 	else if( nEscDir == SDRCAPT_ESCVERTICAL )
337 	{
338 		if( bEscRel )
339 		{
340 			if( nEscRel < 3333 )
341 				nAnsatzRelPos = AT_OBEN;
342 			if( nEscRel > 6666 )
343 				nAnsatzRelPos = AT_UNTEN;
344 			nAnsatzTypePos = AZ_VERTIKAL;
345 		}
346 		else
347 		{
348 			nAnsatzTypePos = AZ_VON_LINKS;
349 			aMF_ANSATZ.SetValue( nEscAbs );
350 		}
351 	}
352 	else if( nEscDir == SDRCAPT_ESCBESTFIT )
353 	{
354 		nAnsatzTypePos = AZ_OPTIMAL;
355 	}
356 
357 	if( bFixedAngle )
358 	{
359 		if( nFixedAngle <= 3000 )
360 			nWinkelTypePos=WK_30;
361 		else if( nFixedAngle <= 4500 )
362 			nWinkelTypePos=WK_45;
363 		else if( nFixedAngle <= 6000 )
364 			nWinkelTypePos=WK_60;
365 		else
366 			nWinkelTypePos=WK_90;
367 	}
368 
369 	aCB_LAENGE.Check( bFitLineLen );
370 	aMF_LAENGE.SetValue( nLineLen );
371 
372 	aLB_ANSATZ.SelectEntryPos( nAnsatzTypePos );
373 	aLB_WINKEL.SelectEntryPos( nWinkelTypePos );
374 
375 	SetupAnsatz_Impl( nAnsatzTypePos );
376 	aCT_CAPTTYPE.SelectItem( nCaptionType+1 );// Enum beginnt bei 0!
377 	SetupType_Impl( nCaptionType+1 );
378 }
379 
380 // -----------------------------------------------------------------------
381 
Create(Window * pWindow,const SfxItemSet & rOutAttrs)382 SfxTabPage* SvxCaptionTabPage::Create( Window* pWindow,
383 				const SfxItemSet& rOutAttrs )
384 {
385 	return( new SvxCaptionTabPage( pWindow, rOutAttrs ) );
386 }
387 
388 //------------------------------------------------------------------------
389 
GetRanges()390 sal_uInt16*	SvxCaptionTabPage::GetRanges()
391 {
392 	return( pCaptionRanges );
393 }
394 
395 //------------------------------------------------------------------------
396 
SetupAnsatz_Impl(sal_uInt16 nType)397 void SvxCaptionTabPage::SetupAnsatz_Impl( sal_uInt16 nType )
398 {
399 	xub_StrLen	nCnt=0, nIdx=0;
400 
401 	switch( nType )
402 	{
403 		case AZ_OPTIMAL:
404 //		aMF_ANSATZ.Hide(); //XXX auch bei OPTIMAL werden Abswerte genommen
405 //		aFT_UM.Hide();
406 		aMF_ANSATZ.Show();
407 		aFT_UM.Show();
408 		aFT_ANSATZ_REL.Hide();
409 		aLB_ANSATZ_REL.Hide();
410 		nEscDir = SDRCAPT_ESCBESTFIT;
411 		break;
412 
413 		case AZ_VON_OBEN:
414 		aMF_ANSATZ.Show();
415 		aFT_UM.Show();
416 		aFT_ANSATZ_REL.Hide();
417 		aLB_ANSATZ_REL.Hide();
418 		nEscDir = SDRCAPT_ESCHORIZONTAL;
419 		break;
420 
421 		case AZ_VON_LINKS:
422 		aMF_ANSATZ.Show();
423 		aFT_UM.Show();
424 		aFT_ANSATZ_REL.Hide();
425 		aLB_ANSATZ_REL.Hide();
426 		nEscDir = SDRCAPT_ESCVERTICAL;
427 		break;
428 
429 		case AZ_HORIZONTAL:
430 		aLB_ANSATZ_REL.Clear();
431 		nCnt = aStrHorzList.GetTokenCount();
432 		for( nIdx=0 ; nIdx<nCnt ; nIdx++ )
433 			aLB_ANSATZ_REL.InsertEntry( aStrHorzList.GetToken(nIdx) );
434 		aLB_ANSATZ_REL.SelectEntryPos( nAnsatzRelPos );
435 
436 		aMF_ANSATZ.Hide();
437 		aFT_UM.Hide();
438 		aFT_ANSATZ_REL.Show();
439 		aLB_ANSATZ_REL.Show();
440 		nEscDir = SDRCAPT_ESCHORIZONTAL;
441 		break;
442 
443 		case AZ_VERTIKAL:
444 		aLB_ANSATZ_REL.Clear();
445 		nCnt = aStrVertList.GetTokenCount();
446 		for( nIdx=0 ; nIdx<nCnt ; nIdx++ )
447 			aLB_ANSATZ_REL.InsertEntry( aStrVertList.GetToken(nIdx) );
448 		aLB_ANSATZ_REL.SelectEntryPos( nAnsatzRelPos );
449 
450 		aMF_ANSATZ.Hide();
451 		aFT_UM.Hide();
452 		aFT_ANSATZ_REL.Show();
453 		aLB_ANSATZ_REL.Show();
454 		nEscDir = SDRCAPT_ESCVERTICAL;
455 		break;
456 	}
457 }
458 
459 //------------------------------------------------------------------------
460 
IMPL_LINK_INLINE_START(SvxCaptionTabPage,AnsatzSelectHdl_Impl,ListBox *,pListBox)461 IMPL_LINK_INLINE_START( SvxCaptionTabPage, AnsatzSelectHdl_Impl, ListBox *, pListBox )
462 {
463 	if( pListBox == &aLB_ANSATZ )
464 	{
465 		SetupAnsatz_Impl( aLB_ANSATZ.GetSelectEntryPos() );
466 	}
467 	return 0;
468 }
IMPL_LINK_INLINE_END(SvxCaptionTabPage,AnsatzSelectHdl_Impl,ListBox *,pListBox)469 IMPL_LINK_INLINE_END( SvxCaptionTabPage, AnsatzSelectHdl_Impl, ListBox *, pListBox )
470 
471 //------------------------------------------------------------------------
472 
473 IMPL_LINK_INLINE_START( SvxCaptionTabPage, AnsatzRelSelectHdl_Impl, ListBox *, pListBox )
474 {
475 	if( pListBox == &aLB_ANSATZ_REL )
476 	{
477 		nAnsatzRelPos = aLB_ANSATZ_REL.GetSelectEntryPos();
478 	}
479 	return 0;
480 }
IMPL_LINK_INLINE_END(SvxCaptionTabPage,AnsatzRelSelectHdl_Impl,ListBox *,pListBox)481 IMPL_LINK_INLINE_END( SvxCaptionTabPage, AnsatzRelSelectHdl_Impl, ListBox *, pListBox )
482 
483 //------------------------------------------------------------------------
484 
485 IMPL_LINK( SvxCaptionTabPage, LineOptHdl_Impl, Button *, pButton )
486 {
487 	if( pButton == &aCB_LAENGE )
488 	{
489 		if( aCB_LAENGE.IsChecked() || ! aCB_LAENGE.IsEnabled() )
490 		{
491             aFT_LAENGE.Disable();
492 			aMF_LAENGE.Disable();
493 		}
494 		else
495 		{
496             aFT_LAENGE.Enable();
497 			aMF_LAENGE.Enable();
498 		}
499 	}
500 	return 0;
501 }
502 
503 //------------------------------------------------------------------------
504 
IMPL_LINK_INLINE_START(SvxCaptionTabPage,SelectCaptTypeHdl_Impl,void *,EMPTYARG)505 IMPL_LINK_INLINE_START( SvxCaptionTabPage, SelectCaptTypeHdl_Impl, void *, EMPTYARG )
506 {
507 	SetupType_Impl( aCT_CAPTTYPE.GetSelectItemId() );
508 	return 0;
509 }
IMPL_LINK_INLINE_END(SvxCaptionTabPage,SelectCaptTypeHdl_Impl,void *,EMPTYARG)510 IMPL_LINK_INLINE_END( SvxCaptionTabPage, SelectCaptTypeHdl_Impl, void *, EMPTYARG )
511 
512 //------------------------------------------------------------------------
513 
514 void SvxCaptionTabPage::SetupType_Impl( sal_uInt16 nType )
515 {
516 	switch( nType-1 )
517 	{
518 		case SDRCAPT_TYPE1:
519         aFT_WINKEL.Disable();
520 		aLB_WINKEL.Disable();
521         aFT_LAENGE.Disable();
522 		aCB_LAENGE.Disable();
523 		LineOptHdl_Impl( &aCB_LAENGE );
524 		break;
525 
526 		case SDRCAPT_TYPE2:
527         aFT_WINKEL.Enable();
528 		aLB_WINKEL.Enable();
529         aFT_LAENGE.Disable();
530 		aCB_LAENGE.Disable();
531 		LineOptHdl_Impl( &aCB_LAENGE );
532 		break;
533 
534 		case SDRCAPT_TYPE3:
535         aFT_WINKEL.Enable();
536 		aLB_WINKEL.Enable();
537         aFT_LAENGE.Enable();
538 		aCB_LAENGE.Enable();
539 		LineOptHdl_Impl( &aCB_LAENGE );
540 		break;
541 
542 		case SDRCAPT_TYPE4:
543         aFT_WINKEL.Enable();
544 		aLB_WINKEL.Enable();
545         aFT_LAENGE.Enable();
546 		aCB_LAENGE.Enable();
547 		LineOptHdl_Impl( &aCB_LAENGE );
548 		break;
549 	}
550 }
551 
552 // -----------------------------------------------------------------------
553 
DataChanged(const DataChangedEvent & rDCEvt)554 void SvxCaptionTabPage::DataChanged( const DataChangedEvent& rDCEvt )
555 {
556     SfxTabPage::DataChanged( rDCEvt );
557 
558 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
559             FillValueSet();
560 }
561 
562 // -----------------------------------------------------------------------
563 
FillValueSet()564 void SvxCaptionTabPage::FillValueSet()
565 {
566 	bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
567 
568 	Image** ppBitmaps = bHighContrast ? mpBmpCapTypesH : mpBmpCapTypes;
569 	aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_1, *(ppBitmaps[0]) );
570 	aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_2, *(ppBitmaps[1]) );
571 	aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_3, *(ppBitmaps[2]) );
572 }
573 
574 //========================================================================
575 
576 
SvxCaptionTabDialog(Window * pParent,const SdrView * pSdrView,sal_uInt16 nAnchorTypes)577 SvxCaptionTabDialog::SvxCaptionTabDialog(Window* pParent, const SdrView* pSdrView, sal_uInt16 nAnchorTypes)
578  :	SfxTabDialog( pParent, CUI_RES( RID_SVXDLG_CAPTION ) ),
579     pView       ( pSdrView ),
580     nAnchorCtrls(nAnchorTypes)
581 {
582 	FreeResource();
583 
584 	DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
585 
586     //different positioning page in Writer
587     if(nAnchorCtrls & 0x00ff )
588     {
589         AddTabPage( RID_SVXPAGE_SWPOSSIZE, SvxSwPosSizeTabPage::Create,
590                                 SvxSwPosSizeTabPage::GetRanges );
591         RemoveTabPage( RID_SVXPAGE_POSITION_SIZE);
592     }
593     else
594     {
595         AddTabPage( RID_SVXPAGE_POSITION_SIZE, SvxPositionSizeTabPage::Create,
596                                 SvxPositionSizeTabPage::GetRanges );
597         RemoveTabPage( RID_SVXPAGE_SWPOSSIZE );
598     }
599     AddTabPage( RID_SVXPAGE_CAPTION, SvxCaptionTabPage::Create,
600 							SvxCaptionTabPage::GetRanges );
601 }
602 
603 // -----------------------------------------------------------------------
604 
~SvxCaptionTabDialog()605 SvxCaptionTabDialog::~SvxCaptionTabDialog()
606 {
607 }
608 
609 // -----------------------------------------------------------------------
610 
PageCreated(sal_uInt16 nId,SfxTabPage & rPage)611 void SvxCaptionTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
612 {
613 	switch( nId )
614 	{
615 		case RID_SVXPAGE_POSITION_SIZE:
616 			( (SvxPositionSizeTabPage&) rPage ).SetView( pView );
617 			( (SvxPositionSizeTabPage&) rPage ).Construct();
618 			if( nAnchorCtrls & SVX_OBJ_NORESIZE )
619 				( (SvxPositionSizeTabPage&) rPage ).DisableResize();
620 
621 			if( nAnchorCtrls & SVX_OBJ_NOPROTECT )
622 				( (SvxPositionSizeTabPage&) rPage ).DisableProtect();
623 		break;
624         case RID_SVXPAGE_SWPOSSIZE :
625         {
626             SvxSwPosSizeTabPage& rSwPage = static_cast<SvxSwPosSizeTabPage&>(rPage);
627             rSwPage.EnableAnchorTypes(nAnchorCtrls);
628             rSwPage.SetValidateFramePosLink( aValidateLink );
629         }
630         break;
631 
632 		case RID_SVXPAGE_CAPTION:
633 			( (SvxCaptionTabPage&) rPage ).SetView( pView );
634 			( (SvxCaptionTabPage&) rPage ).Construct();
635 		break;
636 	}
637 }
638 /*-- 05.03.2004 13:54:26---------------------------------------------------
639 
640   -----------------------------------------------------------------------*/
SetValidateFramePosLink(const Link & rLink)641 void SvxCaptionTabDialog::SetValidateFramePosLink( const Link& rLink )
642 {
643     aValidateLink = rLink;
644 }
645 
646 
647