update dev300-m58
[ooovba.git] / svx / source / cui / labdlg.cxx
blobbbcbe9c4086dbde2f4beaca1f247da0a4349cde5
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: labdlg.cxx,v $
10 * $Revision: 1.19 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #ifdef SVX_DLLIMPLEMENTATION
35 #undef SVX_DLLIMPLEMENTATION
36 #endif
38 // include ---------------------------------------------------------------
39 #include <tools/shl.hxx>
40 #include <sfx2/app.hxx>
41 #include <sfx2/module.hxx>
42 #include <swpossizetabpage.hxx>
44 #define _SVX_LABDLG_CXX
46 #include <svx/svdattrx.hxx>
47 #include <svx/dialogs.hrc>
48 #include <svx/dialmgr.hxx>
49 #include "dlgutil.hxx"
50 #include "transfrm.hxx"
52 #include "labdlg.hrc"
53 #include "labdlg.hxx"
55 // define ----------------------------------------------------------------
57 #define AZ_OPTIMAL 0
58 #define AZ_VON_OBEN 1
59 #define AZ_VON_LINKS 2
60 #define AZ_HORIZONTAL 3
61 #define AZ_VERTIKAL 4
63 #define AT_OBEN 0
64 #define AT_MITTE 1
65 #define AT_UNTEN 2
67 #define WK_OPTIMAL 0
68 #define WK_30 1
69 #define WK_45 2
70 #define WK_60 3
71 #define WK_90 4
73 // static ----------------------------------------------------------------
75 static USHORT pCaptionRanges[] =
77 SDRATTR_CAPTIONTYPE,
78 SDRATTR_CAPTIONFIXEDANGLE,
79 SDRATTR_CAPTIONANGLE,
80 SDRATTR_CAPTIONGAP,
81 SDRATTR_CAPTIONESCDIR,
82 SDRATTR_CAPTIONESCISREL,
83 SDRATTR_CAPTIONESCREL,
84 SDRATTR_CAPTIONESCABS,
85 SDRATTR_CAPTIONLINELEN,
86 SDRATTR_CAPTIONFITLINELEN,
90 // -----------------------------------------------------------------------
92 SvxCaptionTabPage::SvxCaptionTabPage(Window* pParent, const SfxItemSet& rInAttrs)
93 : SfxTabPage( pParent, SVX_RES( RID_SVXPAGE_CAPTION ), rInAttrs ),
95 aCT_CAPTTYPE( this, SVX_RES( CT_CAPTTYPE ) ),
96 aFT_ABSTAND( this, SVX_RES( FT_ABSTAND ) ),
97 aMF_ABSTAND( this, SVX_RES( MF_ABSTAND ) ),
98 aFT_WINKEL( this, SVX_RES( FT_WINKEL ) ),
99 aLB_WINKEL( this, SVX_RES( LB_WINKEL ) ),
100 aFT_ANSATZ( this, SVX_RES( FT_ANSATZ ) ),
101 aLB_ANSATZ( this, SVX_RES( LB_ANSATZ ) ),
102 aFT_UM( this, SVX_RES( FT_UM ) ),
103 aMF_ANSATZ( this, SVX_RES( MF_ANSATZ ) ),
104 aFT_ANSATZ_REL( this, SVX_RES( FT_ANSATZ_REL ) ),
105 aLB_ANSATZ_REL( this, SVX_RES( LB_ANSATZ_REL ) ),
106 aFT_LAENGE( this, SVX_RES( FT_LAENGE ) ),
107 aMF_LAENGE( this, SVX_RES( MF_LAENGE ) ),
108 aCB_LAENGE( this, SVX_RES( CB_LAENGE ) ),
110 aStrHorzList( SVX_RES(STR_HORZ_LIST) ),
111 aStrVertList( SVX_RES(STR_VERT_LIST) ),
113 rOutAttrs ( rInAttrs )
115 //------------NYI-------------------------------------------
116 aFT_WINKEL.Hide();
117 aLB_WINKEL.Hide();
119 //------------Positionen korrigieren-------------------------
120 aFT_ANSATZ_REL.SetPosPixel( aFT_UM.GetPosPixel() );
121 aLB_ANSATZ_REL.SetPosPixel(
122 Point(
123 aFT_ANSATZ_REL.GetPosPixel().X()+aFT_ANSATZ_REL.GetSizePixel().Width()+6,
124 aLB_ANSATZ.GetPosPixel().Y() )
127 aMF_ANSATZ.SetPosPixel(
128 Point(
129 aFT_UM.GetPosPixel().X()+aFT_UM.GetSizePixel().Width()+6,
130 aLB_ANSATZ.GetPosPixel().Y() )
133 sal_uInt16 nBitmap;
134 for( nBitmap = 0; nBitmap < CAPTYPE_BITMAPS_COUNT; nBitmap++ )
136 mpBmpCapTypes[nBitmap] = new Image(Bitmap(SVX_RES(BMP_CAPTTYPE_1 + nBitmap)), COL_LIGHTMAGENTA );
137 mpBmpCapTypesH[nBitmap] = new Image(Bitmap(SVX_RES(BMP_CAPTTYPE_1_H + nBitmap)), COL_LIGHTMAGENTA );
140 //------------ValueSet installieren--------------------------
141 aCT_CAPTTYPE.SetStyle( aCT_CAPTTYPE.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD );
142 aCT_CAPTTYPE.SetColCount(5);//XXX
143 aCT_CAPTTYPE.SetLineCount(1);
144 aCT_CAPTTYPE.SetSelectHdl(LINK( this, SvxCaptionTabPage, SelectCaptTypeHdl_Impl));
146 Image aImage;
147 aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_1, aImage, String(SVX_RES(STR_CAPTTYPE_1)));
148 aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_2, aImage, String(SVX_RES(STR_CAPTTYPE_2)));
149 aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_3, aImage, String(SVX_RES(STR_CAPTTYPE_3)));
151 FillValueSet();
153 aLB_ANSATZ.SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzSelectHdl_Impl));
154 aLB_ANSATZ_REL.SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzRelSelectHdl_Impl));
155 aCB_LAENGE.SetClickHdl(LINK(this,SvxCaptionTabPage,LineOptHdl_Impl));
157 FreeResource();
160 // -----------------------------------------------------------------------
162 SvxCaptionTabPage::~SvxCaptionTabPage()
164 sal_uInt16 nBitmap;
165 for( nBitmap = 0; nBitmap < CAPTYPE_BITMAPS_COUNT; nBitmap++ )
167 delete mpBmpCapTypes[nBitmap];
168 delete mpBmpCapTypesH[nBitmap];
172 // -----------------------------------------------------------------------
174 void SvxCaptionTabPage::Construct()
176 // Setzen des Rechtecks und der Workingarea
177 DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
180 // -----------------------------------------------------------------------
182 BOOL SvxCaptionTabPage::FillItemSet( SfxItemSet& _rOutAttrs)
184 SfxItemPool* pPool = _rOutAttrs.GetPool();
185 DBG_ASSERT( pPool, "Wo ist der Pool" );
187 SfxMapUnit eUnit;
189 nCaptionType = aCT_CAPTTYPE.GetSelectItemId()-1;
191 _rOutAttrs.Put( SdrCaptionTypeItem( (SdrCaptionType) nCaptionType ) );
193 if( aMF_ABSTAND.IsValueModified() )
195 eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONGAP ) );
196 _rOutAttrs.Put( SdrCaptionGapItem( GetCoreValue(aMF_ABSTAND, eUnit ) ) );
199 // Sonderbehandlung!!! XXX
200 if( nCaptionType==SDRCAPT_TYPE1 )
202 switch( nEscDir )
204 case SDRCAPT_ESCHORIZONTAL: nEscDir=SDRCAPT_ESCVERTICAL;break;
205 case SDRCAPT_ESCVERTICAL: nEscDir=SDRCAPT_ESCHORIZONTAL;break;
209 _rOutAttrs.Put( SdrCaptionEscDirItem( (SdrCaptionEscDir)nEscDir ) );
211 bEscRel = aLB_ANSATZ_REL.IsVisible();
212 _rOutAttrs.Put( SdrCaptionEscIsRelItem( bEscRel ) );
214 if( bEscRel )
216 long nVal = 0;
218 switch( aLB_ANSATZ_REL.GetSelectEntryPos() )
220 case AT_OBEN: nVal=0;break;
221 case AT_MITTE: nVal=5000;break;
222 case AT_UNTEN: nVal=10000;break;
224 _rOutAttrs.Put( SdrCaptionEscRelItem( nVal ) );
226 else
228 if( aMF_ANSATZ.IsValueModified() )
230 eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONESCABS ) );
231 _rOutAttrs.Put( SdrCaptionEscAbsItem( GetCoreValue(aMF_ANSATZ, eUnit ) ) );
235 bFitLineLen = aCB_LAENGE.IsChecked();
236 _rOutAttrs.Put( SdrCaptionFitLineLenItem( bFitLineLen ) );
238 if( ! bFitLineLen )
240 if( aMF_LAENGE.IsValueModified() )
242 eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONLINELEN ) );
243 _rOutAttrs.Put( SdrCaptionLineLenItem( GetCoreValue(aMF_LAENGE, eUnit ) ) );
247 //NYI-------------die Winkel muessen noch hier rein!!! XXX----------------------
249 return( TRUE );
252 // -----------------------------------------------------------------------
254 void SvxCaptionTabPage::Reset( const SfxItemSet& )
257 //------------Metrik einstellen-----------------------------
259 FieldUnit eFUnit = GetModuleFieldUnit( &rOutAttrs );
261 switch ( eFUnit )
263 case FUNIT_CM:
264 case FUNIT_M:
265 case FUNIT_KM:
266 eFUnit = FUNIT_MM;
267 break;
268 default: ;//prevent warning
270 SetFieldUnit( aMF_ABSTAND, eFUnit );
271 SetFieldUnit( aMF_ANSATZ, eFUnit );
272 SetFieldUnit( aMF_LAENGE, eFUnit );
274 SfxItemPool* pPool = rOutAttrs.GetPool();
275 DBG_ASSERT( pPool, "Wo ist der Pool" );
277 USHORT nWhich;
278 SfxMapUnit eUnit;
280 //------- Winkel ----------
281 nWhich = GetWhich( SDRATTR_CAPTIONANGLE );
282 nFixedAngle = ( ( const SdrCaptionAngleItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
284 //------- absolute Ansatzentfernung ----------
285 nWhich = GetWhich( SDRATTR_CAPTIONESCABS );
286 eUnit = pPool->GetMetric( nWhich );
287 nEscAbs = ( ( const SdrCaptionEscAbsItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
288 SetMetricValue( aMF_ANSATZ, nEscAbs, eUnit );
289 nEscAbs = static_cast<long>(aMF_ANSATZ.GetValue());
291 //------- relative Ansatzentfernung ----------
292 nWhich = GetWhich( SDRATTR_CAPTIONESCREL );
293 nEscRel = (long)( ( const SdrCaptionEscRelItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
295 //------- Linienlaenge ----------
296 nWhich = GetWhich( SDRATTR_CAPTIONLINELEN );
297 eUnit = pPool->GetMetric( nWhich );
298 nLineLen = ( ( const SdrCaptionLineLenItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
299 SetMetricValue( aMF_LAENGE, nLineLen, eUnit );
300 nLineLen = static_cast<long>(aMF_LAENGE.GetValue());
302 //------- Abstand zur Box ----------
303 nWhich = GetWhich( SDRATTR_CAPTIONGAP );
304 eUnit = pPool->GetMetric( nWhich );
305 nGap = ( ( const SdrCaptionGapItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
306 SetMetricValue( aMF_ABSTAND, nGap, eUnit );
307 nGap = static_cast<long>(aMF_ABSTAND.GetValue());
309 nCaptionType = (short)( ( const SdrCaptionTypeItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONTYPE ) ) ).GetValue();
310 bFixedAngle = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFIXEDANGLE ) ) ).GetValue();
311 bFitLineLen = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFITLINELEN ) ) ).GetValue();
312 nEscDir = (short)( ( const SdrCaptionEscDirItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCDIR ) ) ).GetValue();
313 bEscRel = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCISREL ) ) ).GetValue();
315 // Sonderbehandlung!!! XXX
316 if( nCaptionType==SDRCAPT_TYPE1 )
318 switch( nEscDir )
320 case SDRCAPT_ESCHORIZONTAL: nEscDir=SDRCAPT_ESCVERTICAL;break;
321 case SDRCAPT_ESCVERTICAL: nEscDir=SDRCAPT_ESCHORIZONTAL;break;
325 nAnsatzRelPos=AT_MITTE;
326 nAnsatzTypePos=AZ_OPTIMAL;
327 nWinkelTypePos=WK_OPTIMAL;
329 aMF_ABSTAND.SetValue( nGap );
331 if( nEscDir == SDRCAPT_ESCHORIZONTAL )
333 if( bEscRel )
335 if( nEscRel < 3333 )
336 nAnsatzRelPos = AT_OBEN;
337 if( nEscRel > 6666 )
338 nAnsatzRelPos = AT_UNTEN;
339 nAnsatzTypePos = AZ_HORIZONTAL;
341 else
343 nAnsatzTypePos = AZ_VON_OBEN;
344 aMF_ANSATZ.SetValue( nEscAbs );
347 else if( nEscDir == SDRCAPT_ESCVERTICAL )
349 if( bEscRel )
351 if( nEscRel < 3333 )
352 nAnsatzRelPos = AT_OBEN;
353 if( nEscRel > 6666 )
354 nAnsatzRelPos = AT_UNTEN;
355 nAnsatzTypePos = AZ_VERTIKAL;
357 else
359 nAnsatzTypePos = AZ_VON_LINKS;
360 aMF_ANSATZ.SetValue( nEscAbs );
363 else if( nEscDir == SDRCAPT_ESCBESTFIT )
365 nAnsatzTypePos = AZ_OPTIMAL;
368 if( bFixedAngle )
370 if( nFixedAngle <= 3000 )
371 nWinkelTypePos=WK_30;
372 else if( nFixedAngle <= 4500 )
373 nWinkelTypePos=WK_45;
374 else if( nFixedAngle <= 6000 )
375 nWinkelTypePos=WK_60;
376 else
377 nWinkelTypePos=WK_90;
380 aCB_LAENGE.Check( bFitLineLen );
381 aMF_LAENGE.SetValue( nLineLen );
383 aLB_ANSATZ.SelectEntryPos( nAnsatzTypePos );
384 aLB_WINKEL.SelectEntryPos( nWinkelTypePos );
386 SetupAnsatz_Impl( nAnsatzTypePos );
387 aCT_CAPTTYPE.SelectItem( nCaptionType+1 );// Enum beginnt bei 0!
388 SetupType_Impl( nCaptionType+1 );
391 // -----------------------------------------------------------------------
393 SfxTabPage* SvxCaptionTabPage::Create( Window* pWindow,
394 const SfxItemSet& rOutAttrs )
396 return( new SvxCaptionTabPage( pWindow, rOutAttrs ) );
399 //------------------------------------------------------------------------
401 USHORT* SvxCaptionTabPage::GetRanges()
403 return( pCaptionRanges );
406 //------------------------------------------------------------------------
408 void SvxCaptionTabPage::SetupAnsatz_Impl( USHORT nType )
410 xub_StrLen nCnt=0, nIdx=0;
412 switch( nType )
414 case AZ_OPTIMAL:
415 // aMF_ANSATZ.Hide(); //XXX auch bei OPTIMAL werden Abswerte genommen
416 // aFT_UM.Hide();
417 aMF_ANSATZ.Show();
418 aFT_UM.Show();
419 aFT_ANSATZ_REL.Hide();
420 aLB_ANSATZ_REL.Hide();
421 nEscDir = SDRCAPT_ESCBESTFIT;
422 break;
424 case AZ_VON_OBEN:
425 aMF_ANSATZ.Show();
426 aFT_UM.Show();
427 aFT_ANSATZ_REL.Hide();
428 aLB_ANSATZ_REL.Hide();
429 nEscDir = SDRCAPT_ESCHORIZONTAL;
430 break;
432 case AZ_VON_LINKS:
433 aMF_ANSATZ.Show();
434 aFT_UM.Show();
435 aFT_ANSATZ_REL.Hide();
436 aLB_ANSATZ_REL.Hide();
437 nEscDir = SDRCAPT_ESCVERTICAL;
438 break;
440 case AZ_HORIZONTAL:
441 aLB_ANSATZ_REL.Clear();
442 nCnt = aStrHorzList.GetTokenCount();
443 for( nIdx=0 ; nIdx<nCnt ; nIdx++ )
444 aLB_ANSATZ_REL.InsertEntry( aStrHorzList.GetToken(nIdx) );
445 aLB_ANSATZ_REL.SelectEntryPos( nAnsatzRelPos );
447 aMF_ANSATZ.Hide();
448 aFT_UM.Hide();
449 aFT_ANSATZ_REL.Show();
450 aLB_ANSATZ_REL.Show();
451 nEscDir = SDRCAPT_ESCHORIZONTAL;
452 break;
454 case AZ_VERTIKAL:
455 aLB_ANSATZ_REL.Clear();
456 nCnt = aStrVertList.GetTokenCount();
457 for( nIdx=0 ; nIdx<nCnt ; nIdx++ )
458 aLB_ANSATZ_REL.InsertEntry( aStrVertList.GetToken(nIdx) );
459 aLB_ANSATZ_REL.SelectEntryPos( nAnsatzRelPos );
461 aMF_ANSATZ.Hide();
462 aFT_UM.Hide();
463 aFT_ANSATZ_REL.Show();
464 aLB_ANSATZ_REL.Show();
465 nEscDir = SDRCAPT_ESCVERTICAL;
466 break;
470 //------------------------------------------------------------------------
472 IMPL_LINK_INLINE_START( SvxCaptionTabPage, AnsatzSelectHdl_Impl, ListBox *, pListBox )
474 if( pListBox == &aLB_ANSATZ )
476 SetupAnsatz_Impl( aLB_ANSATZ.GetSelectEntryPos() );
478 return 0;
480 IMPL_LINK_INLINE_END( SvxCaptionTabPage, AnsatzSelectHdl_Impl, ListBox *, pListBox )
482 //------------------------------------------------------------------------
484 IMPL_LINK_INLINE_START( SvxCaptionTabPage, AnsatzRelSelectHdl_Impl, ListBox *, pListBox )
486 if( pListBox == &aLB_ANSATZ_REL )
488 nAnsatzRelPos = aLB_ANSATZ_REL.GetSelectEntryPos();
490 return 0;
492 IMPL_LINK_INLINE_END( SvxCaptionTabPage, AnsatzRelSelectHdl_Impl, ListBox *, pListBox )
494 //------------------------------------------------------------------------
496 IMPL_LINK( SvxCaptionTabPage, LineOptHdl_Impl, Button *, pButton )
498 if( pButton == &aCB_LAENGE )
500 if( aCB_LAENGE.IsChecked() || ! aCB_LAENGE.IsEnabled() )
502 aFT_LAENGE.Disable();
503 aMF_LAENGE.Disable();
505 else
507 aFT_LAENGE.Enable();
508 aMF_LAENGE.Enable();
511 return 0;
514 //------------------------------------------------------------------------
516 IMPL_LINK_INLINE_START( SvxCaptionTabPage, SelectCaptTypeHdl_Impl, void *, EMPTYARG )
518 SetupType_Impl( aCT_CAPTTYPE.GetSelectItemId() );
519 return 0;
521 IMPL_LINK_INLINE_END( SvxCaptionTabPage, SelectCaptTypeHdl_Impl, void *, EMPTYARG )
523 //------------------------------------------------------------------------
525 void SvxCaptionTabPage::SetupType_Impl( USHORT nType )
527 switch( nType-1 )
529 case SDRCAPT_TYPE1:
530 aFT_WINKEL.Disable();
531 aLB_WINKEL.Disable();
532 aFT_LAENGE.Disable();
533 aCB_LAENGE.Disable();
534 LineOptHdl_Impl( &aCB_LAENGE );
535 break;
537 case SDRCAPT_TYPE2:
538 aFT_WINKEL.Enable();
539 aLB_WINKEL.Enable();
540 aFT_LAENGE.Disable();
541 aCB_LAENGE.Disable();
542 LineOptHdl_Impl( &aCB_LAENGE );
543 break;
545 case SDRCAPT_TYPE3:
546 aFT_WINKEL.Enable();
547 aLB_WINKEL.Enable();
548 aFT_LAENGE.Enable();
549 aCB_LAENGE.Enable();
550 LineOptHdl_Impl( &aCB_LAENGE );
551 break;
553 case SDRCAPT_TYPE4:
554 aFT_WINKEL.Enable();
555 aLB_WINKEL.Enable();
556 aFT_LAENGE.Enable();
557 aCB_LAENGE.Enable();
558 LineOptHdl_Impl( &aCB_LAENGE );
559 break;
563 // -----------------------------------------------------------------------
565 void SvxCaptionTabPage::DataChanged( const DataChangedEvent& rDCEvt )
567 SfxTabPage::DataChanged( rDCEvt );
569 if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
570 FillValueSet();
573 // -----------------------------------------------------------------------
575 void SvxCaptionTabPage::FillValueSet()
577 bool bHighContrast = GetDisplayBackground().GetColor().IsDark() != 0;
579 Image** ppBitmaps = bHighContrast ? mpBmpCapTypesH : mpBmpCapTypes;
580 aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_1, *(ppBitmaps[0]) );
581 aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_2, *(ppBitmaps[1]) );
582 aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_3, *(ppBitmaps[2]) );
585 //========================================================================
588 SvxCaptionTabDialog::SvxCaptionTabDialog(Window* pParent, const SdrView* pSdrView, USHORT nAnchorTypes)
589 : SfxTabDialog( pParent, SVX_RES( RID_SVXDLG_CAPTION ) ),
590 pView ( pSdrView ),
591 nAnchorCtrls(nAnchorTypes)
593 FreeResource();
595 DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
597 //different positioning page in Writer
598 if(nAnchorCtrls & 0x00ff )
600 AddTabPage( RID_SVXPAGE_SWPOSSIZE, SvxSwPosSizeTabPage::Create,
601 SvxSwPosSizeTabPage::GetRanges );
602 RemoveTabPage( RID_SVXPAGE_POSITION_SIZE);
604 else
606 AddTabPage( RID_SVXPAGE_POSITION_SIZE, SvxPositionSizeTabPage::Create,
607 SvxPositionSizeTabPage::GetRanges );
608 RemoveTabPage( RID_SVXPAGE_SWPOSSIZE );
610 AddTabPage( RID_SVXPAGE_CAPTION, SvxCaptionTabPage::Create,
611 SvxCaptionTabPage::GetRanges );
614 // -----------------------------------------------------------------------
616 SvxCaptionTabDialog::~SvxCaptionTabDialog()
620 // -----------------------------------------------------------------------
622 void SvxCaptionTabDialog::PageCreated( USHORT nId, SfxTabPage &rPage )
624 switch( nId )
626 case RID_SVXPAGE_POSITION_SIZE:
627 ( (SvxPositionSizeTabPage&) rPage ).SetView( pView );
628 ( (SvxPositionSizeTabPage&) rPage ).Construct();
629 if( nAnchorCtrls & SVX_OBJ_NORESIZE )
630 ( (SvxPositionSizeTabPage&) rPage ).DisableResize();
632 if( nAnchorCtrls & SVX_OBJ_NOPROTECT )
633 ( (SvxPositionSizeTabPage&) rPage ).DisableProtect();
634 break;
635 case RID_SVXPAGE_SWPOSSIZE :
637 SvxSwPosSizeTabPage& rSwPage = static_cast<SvxSwPosSizeTabPage&>(rPage);
638 rSwPage.EnableAnchorTypes(nAnchorCtrls);
639 rSwPage.SetValidateFramePosLink( aValidateLink );
641 break;
643 case RID_SVXPAGE_CAPTION:
644 ( (SvxCaptionTabPage&) rPage ).SetView( pView );
645 ( (SvxCaptionTabPage&) rPage ).Construct();
646 break;
649 /*-- 05.03.2004 13:54:26---------------------------------------------------
651 -----------------------------------------------------------------------*/
652 void SvxCaptionTabDialog::SetValidateFramePosLink( const Link& rLink )
654 aValidateLink = rLink;