masterfix DEV300: #i10000# build fix
[LibreOffice.git] / cui / source / tabpages / labdlg.cxx
blobe4ef79b4f1f9e855a0aab02643fea681f3d33870
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_cui.hxx"
31 // include ---------------------------------------------------------------
32 #include <tools/shl.hxx>
33 #include <sfx2/app.hxx>
34 #include <sfx2/module.hxx>
35 #include <swpossizetabpage.hxx>
36 #include <svx/dialogs.hrc>
37 #define _SVX_LABDLG_CXX
39 #include <svx/svdattrx.hxx>
40 #include <cuires.hrc>
41 #include <dialmgr.hxx>
42 #include "svx/dlgutil.hxx"
43 #include "transfrm.hxx"
45 #include "labdlg.hrc"
46 #include "labdlg.hxx"
48 // define ----------------------------------------------------------------
50 #define AZ_OPTIMAL 0
51 #define AZ_VON_OBEN 1
52 #define AZ_VON_LINKS 2
53 #define AZ_HORIZONTAL 3
54 #define AZ_VERTIKAL 4
56 #define AT_OBEN 0
57 #define AT_MITTE 1
58 #define AT_UNTEN 2
60 #define WK_OPTIMAL 0
61 #define WK_30 1
62 #define WK_45 2
63 #define WK_60 3
64 #define WK_90 4
66 // static ----------------------------------------------------------------
68 static sal_uInt16 pCaptionRanges[] =
70 SDRATTR_CAPTIONTYPE,
71 SDRATTR_CAPTIONFIXEDANGLE,
72 SDRATTR_CAPTIONANGLE,
73 SDRATTR_CAPTIONGAP,
74 SDRATTR_CAPTIONESCDIR,
75 SDRATTR_CAPTIONESCISREL,
76 SDRATTR_CAPTIONESCREL,
77 SDRATTR_CAPTIONESCABS,
78 SDRATTR_CAPTIONLINELEN,
79 SDRATTR_CAPTIONFITLINELEN,
83 // -----------------------------------------------------------------------
85 SvxCaptionTabPage::SvxCaptionTabPage(Window* pParent, const SfxItemSet& rInAttrs)
86 : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_CAPTION ), rInAttrs ),
88 aCT_CAPTTYPE( this, CUI_RES( CT_CAPTTYPE ) ),
89 aFT_ABSTAND( this, CUI_RES( FT_ABSTAND ) ),
90 aMF_ABSTAND( this, CUI_RES( MF_ABSTAND ) ),
91 aFT_WINKEL( this, CUI_RES( FT_WINKEL ) ),
92 aLB_WINKEL( this, CUI_RES( LB_WINKEL ) ),
93 aFT_ANSATZ( this, CUI_RES( FT_ANSATZ ) ),
94 aLB_ANSATZ( this, CUI_RES( LB_ANSATZ ) ),
95 aFT_UM( this, CUI_RES( FT_UM ) ),
96 aMF_ANSATZ( this, CUI_RES( MF_ANSATZ ) ),
97 aFT_ANSATZ_REL( this, CUI_RES( FT_ANSATZ_REL ) ),
98 aLB_ANSATZ_REL( this, CUI_RES( LB_ANSATZ_REL ) ),
99 aFT_LAENGE( this, CUI_RES( FT_LAENGE ) ),
100 aMF_LAENGE( this, CUI_RES( MF_LAENGE ) ),
101 aCB_LAENGE( this, CUI_RES( CB_LAENGE ) ),
103 aStrHorzList( CUI_RES(STR_HORZ_LIST) ),
104 aStrVertList( CUI_RES(STR_VERT_LIST) ),
106 rOutAttrs ( rInAttrs )
108 //------------NYI-------------------------------------------
109 aFT_WINKEL.Hide();
110 aLB_WINKEL.Hide();
112 //------------Positionen korrigieren-------------------------
113 aFT_ANSATZ_REL.SetPosPixel( aFT_UM.GetPosPixel() );
114 aLB_ANSATZ_REL.SetPosPixel(
115 Point(
116 aFT_ANSATZ_REL.GetPosPixel().X()+aFT_ANSATZ_REL.GetSizePixel().Width()+6,
117 aLB_ANSATZ.GetPosPixel().Y() )
120 aMF_ANSATZ.SetPosPixel(
121 Point(
122 aFT_UM.GetPosPixel().X()+aFT_UM.GetSizePixel().Width()+6,
123 aLB_ANSATZ.GetPosPixel().Y() )
126 sal_uInt16 nBitmap;
127 for( nBitmap = 0; nBitmap < CAPTYPE_BITMAPS_COUNT; nBitmap++ )
129 mpBmpCapTypes[nBitmap] = new Image(Bitmap(CUI_RES(BMP_CAPTTYPE_1 + nBitmap)), COL_LIGHTMAGENTA );
130 mpBmpCapTypesH[nBitmap] = new Image(Bitmap(CUI_RES(BMP_CAPTTYPE_1_H + nBitmap)), COL_LIGHTMAGENTA );
133 //------------ValueSet installieren--------------------------
134 aCT_CAPTTYPE.SetStyle( aCT_CAPTTYPE.GetStyle() | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD );
135 aCT_CAPTTYPE.SetColCount(5);//XXX
136 aCT_CAPTTYPE.SetLineCount(1);
137 aCT_CAPTTYPE.SetSelectHdl(LINK( this, SvxCaptionTabPage, SelectCaptTypeHdl_Impl));
139 Image aImage;
140 aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_1, aImage, String(CUI_RES(STR_CAPTTYPE_1)));
141 aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_2, aImage, String(CUI_RES(STR_CAPTTYPE_2)));
142 aCT_CAPTTYPE.InsertItem(BMP_CAPTTYPE_3, aImage, String(CUI_RES(STR_CAPTTYPE_3)));
144 FillValueSet();
146 aLB_ANSATZ.SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzSelectHdl_Impl));
147 aLB_ANSATZ_REL.SetSelectHdl(LINK(this,SvxCaptionTabPage,AnsatzRelSelectHdl_Impl));
148 aCB_LAENGE.SetClickHdl(LINK(this,SvxCaptionTabPage,LineOptHdl_Impl));
150 FreeResource();
153 // -----------------------------------------------------------------------
155 SvxCaptionTabPage::~SvxCaptionTabPage()
157 sal_uInt16 nBitmap;
158 for( nBitmap = 0; nBitmap < CAPTYPE_BITMAPS_COUNT; nBitmap++ )
160 delete mpBmpCapTypes[nBitmap];
161 delete mpBmpCapTypesH[nBitmap];
165 // -----------------------------------------------------------------------
167 void SvxCaptionTabPage::Construct()
169 // Setzen des Rechtecks und der Workingarea
170 DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
173 // -----------------------------------------------------------------------
175 sal_Bool SvxCaptionTabPage::FillItemSet( SfxItemSet& _rOutAttrs)
177 SfxItemPool* pPool = _rOutAttrs.GetPool();
178 DBG_ASSERT( pPool, "Wo ist der Pool" );
180 SfxMapUnit eUnit;
182 nCaptionType = aCT_CAPTTYPE.GetSelectItemId()-1;
184 _rOutAttrs.Put( SdrCaptionTypeItem( (SdrCaptionType) nCaptionType ) );
186 if( aMF_ABSTAND.IsValueModified() )
188 eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONGAP ) );
189 _rOutAttrs.Put( SdrCaptionGapItem( GetCoreValue(aMF_ABSTAND, eUnit ) ) );
192 // Sonderbehandlung!!! XXX
193 if( nCaptionType==SDRCAPT_TYPE1 )
195 switch( nEscDir )
197 case SDRCAPT_ESCHORIZONTAL: nEscDir=SDRCAPT_ESCVERTICAL;break;
198 case SDRCAPT_ESCVERTICAL: nEscDir=SDRCAPT_ESCHORIZONTAL;break;
202 _rOutAttrs.Put( SdrCaptionEscDirItem( (SdrCaptionEscDir)nEscDir ) );
204 bEscRel = aLB_ANSATZ_REL.IsVisible();
205 _rOutAttrs.Put( SdrCaptionEscIsRelItem( bEscRel ) );
207 if( bEscRel )
209 long nVal = 0;
211 switch( aLB_ANSATZ_REL.GetSelectEntryPos() )
213 case AT_OBEN: nVal=0;break;
214 case AT_MITTE: nVal=5000;break;
215 case AT_UNTEN: nVal=10000;break;
217 _rOutAttrs.Put( SdrCaptionEscRelItem( nVal ) );
219 else
221 if( aMF_ANSATZ.IsValueModified() )
223 eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONESCABS ) );
224 _rOutAttrs.Put( SdrCaptionEscAbsItem( GetCoreValue(aMF_ANSATZ, eUnit ) ) );
228 bFitLineLen = aCB_LAENGE.IsChecked();
229 _rOutAttrs.Put( SdrCaptionFitLineLenItem( bFitLineLen ) );
231 if( ! bFitLineLen )
233 if( aMF_LAENGE.IsValueModified() )
235 eUnit = pPool->GetMetric( GetWhich( SDRATTR_CAPTIONLINELEN ) );
236 _rOutAttrs.Put( SdrCaptionLineLenItem( GetCoreValue(aMF_LAENGE, eUnit ) ) );
240 //NYI-------------die Winkel muessen noch hier rein!!! XXX----------------------
242 return( sal_True );
245 // -----------------------------------------------------------------------
247 void SvxCaptionTabPage::Reset( const SfxItemSet& )
250 //------------Metrik einstellen-----------------------------
252 FieldUnit eFUnit = GetModuleFieldUnit( rOutAttrs );
254 switch ( eFUnit )
256 case FUNIT_CM:
257 case FUNIT_M:
258 case FUNIT_KM:
259 eFUnit = FUNIT_MM;
260 break;
261 default: ;//prevent warning
263 SetFieldUnit( aMF_ABSTAND, eFUnit );
264 SetFieldUnit( aMF_ANSATZ, eFUnit );
265 SetFieldUnit( aMF_LAENGE, eFUnit );
267 SfxItemPool* pPool = rOutAttrs.GetPool();
268 DBG_ASSERT( pPool, "Wo ist der Pool" );
270 sal_uInt16 nWhich;
271 SfxMapUnit eUnit;
273 //------- Winkel ----------
274 nWhich = GetWhich( SDRATTR_CAPTIONANGLE );
275 nFixedAngle = ( ( const SdrCaptionAngleItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
277 //------- absolute Ansatzentfernung ----------
278 nWhich = GetWhich( SDRATTR_CAPTIONESCABS );
279 eUnit = pPool->GetMetric( nWhich );
280 nEscAbs = ( ( const SdrCaptionEscAbsItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
281 SetMetricValue( aMF_ANSATZ, nEscAbs, eUnit );
282 nEscAbs = static_cast<long>(aMF_ANSATZ.GetValue());
284 //------- relative Ansatzentfernung ----------
285 nWhich = GetWhich( SDRATTR_CAPTIONESCREL );
286 nEscRel = (long)( ( const SdrCaptionEscRelItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
288 //------- Linienlaenge ----------
289 nWhich = GetWhich( SDRATTR_CAPTIONLINELEN );
290 eUnit = pPool->GetMetric( nWhich );
291 nLineLen = ( ( const SdrCaptionLineLenItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
292 SetMetricValue( aMF_LAENGE, nLineLen, eUnit );
293 nLineLen = static_cast<long>(aMF_LAENGE.GetValue());
295 //------- Abstand zur Box ----------
296 nWhich = GetWhich( SDRATTR_CAPTIONGAP );
297 eUnit = pPool->GetMetric( nWhich );
298 nGap = ( ( const SdrCaptionGapItem& ) rOutAttrs.Get( nWhich ) ).GetValue();
299 SetMetricValue( aMF_ABSTAND, nGap, eUnit );
300 nGap = static_cast<long>(aMF_ABSTAND.GetValue());
302 nCaptionType = (short)( ( const SdrCaptionTypeItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONTYPE ) ) ).GetValue();
303 bFixedAngle = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFIXEDANGLE ) ) ).GetValue();
304 bFitLineLen = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONFITLINELEN ) ) ).GetValue();
305 nEscDir = (short)( ( const SdrCaptionEscDirItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCDIR ) ) ).GetValue();
306 bEscRel = ( ( const SfxBoolItem& ) rOutAttrs.Get( GetWhich( SDRATTR_CAPTIONESCISREL ) ) ).GetValue();
308 // Sonderbehandlung!!! XXX
309 if( nCaptionType==SDRCAPT_TYPE1 )
311 switch( nEscDir )
313 case SDRCAPT_ESCHORIZONTAL: nEscDir=SDRCAPT_ESCVERTICAL;break;
314 case SDRCAPT_ESCVERTICAL: nEscDir=SDRCAPT_ESCHORIZONTAL;break;
318 nAnsatzRelPos=AT_MITTE;
319 nAnsatzTypePos=AZ_OPTIMAL;
320 nWinkelTypePos=WK_OPTIMAL;
322 aMF_ABSTAND.SetValue( nGap );
324 if( nEscDir == SDRCAPT_ESCHORIZONTAL )
326 if( bEscRel )
328 if( nEscRel < 3333 )
329 nAnsatzRelPos = AT_OBEN;
330 if( nEscRel > 6666 )
331 nAnsatzRelPos = AT_UNTEN;
332 nAnsatzTypePos = AZ_HORIZONTAL;
334 else
336 nAnsatzTypePos = AZ_VON_OBEN;
337 aMF_ANSATZ.SetValue( nEscAbs );
340 else if( nEscDir == SDRCAPT_ESCVERTICAL )
342 if( bEscRel )
344 if( nEscRel < 3333 )
345 nAnsatzRelPos = AT_OBEN;
346 if( nEscRel > 6666 )
347 nAnsatzRelPos = AT_UNTEN;
348 nAnsatzTypePos = AZ_VERTIKAL;
350 else
352 nAnsatzTypePos = AZ_VON_LINKS;
353 aMF_ANSATZ.SetValue( nEscAbs );
356 else if( nEscDir == SDRCAPT_ESCBESTFIT )
358 nAnsatzTypePos = AZ_OPTIMAL;
361 if( bFixedAngle )
363 if( nFixedAngle <= 3000 )
364 nWinkelTypePos=WK_30;
365 else if( nFixedAngle <= 4500 )
366 nWinkelTypePos=WK_45;
367 else if( nFixedAngle <= 6000 )
368 nWinkelTypePos=WK_60;
369 else
370 nWinkelTypePos=WK_90;
373 aCB_LAENGE.Check( bFitLineLen );
374 aMF_LAENGE.SetValue( nLineLen );
376 aLB_ANSATZ.SelectEntryPos( nAnsatzTypePos );
377 aLB_WINKEL.SelectEntryPos( nWinkelTypePos );
379 SetupAnsatz_Impl( nAnsatzTypePos );
380 aCT_CAPTTYPE.SelectItem( nCaptionType+1 );// Enum beginnt bei 0!
381 SetupType_Impl( nCaptionType+1 );
384 // -----------------------------------------------------------------------
386 SfxTabPage* SvxCaptionTabPage::Create( Window* pWindow,
387 const SfxItemSet& rOutAttrs )
389 return( new SvxCaptionTabPage( pWindow, rOutAttrs ) );
392 //------------------------------------------------------------------------
394 sal_uInt16* SvxCaptionTabPage::GetRanges()
396 return( pCaptionRanges );
399 //------------------------------------------------------------------------
401 void SvxCaptionTabPage::SetupAnsatz_Impl( sal_uInt16 nType )
403 xub_StrLen nCnt=0, nIdx=0;
405 switch( nType )
407 case AZ_OPTIMAL:
408 // aMF_ANSATZ.Hide(); //XXX auch bei OPTIMAL werden Abswerte genommen
409 // aFT_UM.Hide();
410 aMF_ANSATZ.Show();
411 aFT_UM.Show();
412 aFT_ANSATZ_REL.Hide();
413 aLB_ANSATZ_REL.Hide();
414 nEscDir = SDRCAPT_ESCBESTFIT;
415 break;
417 case AZ_VON_OBEN:
418 aMF_ANSATZ.Show();
419 aFT_UM.Show();
420 aFT_ANSATZ_REL.Hide();
421 aLB_ANSATZ_REL.Hide();
422 nEscDir = SDRCAPT_ESCHORIZONTAL;
423 break;
425 case AZ_VON_LINKS:
426 aMF_ANSATZ.Show();
427 aFT_UM.Show();
428 aFT_ANSATZ_REL.Hide();
429 aLB_ANSATZ_REL.Hide();
430 nEscDir = SDRCAPT_ESCVERTICAL;
431 break;
433 case AZ_HORIZONTAL:
434 aLB_ANSATZ_REL.Clear();
435 nCnt = aStrHorzList.GetTokenCount();
436 for( nIdx=0 ; nIdx<nCnt ; nIdx++ )
437 aLB_ANSATZ_REL.InsertEntry( aStrHorzList.GetToken(nIdx) );
438 aLB_ANSATZ_REL.SelectEntryPos( nAnsatzRelPos );
440 aMF_ANSATZ.Hide();
441 aFT_UM.Hide();
442 aFT_ANSATZ_REL.Show();
443 aLB_ANSATZ_REL.Show();
444 nEscDir = SDRCAPT_ESCHORIZONTAL;
445 break;
447 case AZ_VERTIKAL:
448 aLB_ANSATZ_REL.Clear();
449 nCnt = aStrVertList.GetTokenCount();
450 for( nIdx=0 ; nIdx<nCnt ; nIdx++ )
451 aLB_ANSATZ_REL.InsertEntry( aStrVertList.GetToken(nIdx) );
452 aLB_ANSATZ_REL.SelectEntryPos( nAnsatzRelPos );
454 aMF_ANSATZ.Hide();
455 aFT_UM.Hide();
456 aFT_ANSATZ_REL.Show();
457 aLB_ANSATZ_REL.Show();
458 nEscDir = SDRCAPT_ESCVERTICAL;
459 break;
463 //------------------------------------------------------------------------
465 IMPL_LINK_INLINE_START( SvxCaptionTabPage, AnsatzSelectHdl_Impl, ListBox *, pListBox )
467 if( pListBox == &aLB_ANSATZ )
469 SetupAnsatz_Impl( aLB_ANSATZ.GetSelectEntryPos() );
471 return 0;
473 IMPL_LINK_INLINE_END( SvxCaptionTabPage, AnsatzSelectHdl_Impl, ListBox *, pListBox )
475 //------------------------------------------------------------------------
477 IMPL_LINK_INLINE_START( SvxCaptionTabPage, AnsatzRelSelectHdl_Impl, ListBox *, pListBox )
479 if( pListBox == &aLB_ANSATZ_REL )
481 nAnsatzRelPos = aLB_ANSATZ_REL.GetSelectEntryPos();
483 return 0;
485 IMPL_LINK_INLINE_END( SvxCaptionTabPage, AnsatzRelSelectHdl_Impl, ListBox *, pListBox )
487 //------------------------------------------------------------------------
489 IMPL_LINK( SvxCaptionTabPage, LineOptHdl_Impl, Button *, pButton )
491 if( pButton == &aCB_LAENGE )
493 if( aCB_LAENGE.IsChecked() || ! aCB_LAENGE.IsEnabled() )
495 aFT_LAENGE.Disable();
496 aMF_LAENGE.Disable();
498 else
500 aFT_LAENGE.Enable();
501 aMF_LAENGE.Enable();
504 return 0;
507 //------------------------------------------------------------------------
509 IMPL_LINK_INLINE_START( SvxCaptionTabPage, SelectCaptTypeHdl_Impl, void *, EMPTYARG )
511 SetupType_Impl( aCT_CAPTTYPE.GetSelectItemId() );
512 return 0;
514 IMPL_LINK_INLINE_END( SvxCaptionTabPage, SelectCaptTypeHdl_Impl, void *, EMPTYARG )
516 //------------------------------------------------------------------------
518 void SvxCaptionTabPage::SetupType_Impl( sal_uInt16 nType )
520 switch( nType-1 )
522 case SDRCAPT_TYPE1:
523 aFT_WINKEL.Disable();
524 aLB_WINKEL.Disable();
525 aFT_LAENGE.Disable();
526 aCB_LAENGE.Disable();
527 LineOptHdl_Impl( &aCB_LAENGE );
528 break;
530 case SDRCAPT_TYPE2:
531 aFT_WINKEL.Enable();
532 aLB_WINKEL.Enable();
533 aFT_LAENGE.Disable();
534 aCB_LAENGE.Disable();
535 LineOptHdl_Impl( &aCB_LAENGE );
536 break;
538 case SDRCAPT_TYPE3:
539 aFT_WINKEL.Enable();
540 aLB_WINKEL.Enable();
541 aFT_LAENGE.Enable();
542 aCB_LAENGE.Enable();
543 LineOptHdl_Impl( &aCB_LAENGE );
544 break;
546 case SDRCAPT_TYPE4:
547 aFT_WINKEL.Enable();
548 aLB_WINKEL.Enable();
549 aFT_LAENGE.Enable();
550 aCB_LAENGE.Enable();
551 LineOptHdl_Impl( &aCB_LAENGE );
552 break;
556 // -----------------------------------------------------------------------
558 void SvxCaptionTabPage::DataChanged( const DataChangedEvent& rDCEvt )
560 SfxTabPage::DataChanged( rDCEvt );
562 if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
563 FillValueSet();
566 // -----------------------------------------------------------------------
568 void SvxCaptionTabPage::FillValueSet()
570 bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
572 Image** ppBitmaps = bHighContrast ? mpBmpCapTypesH : mpBmpCapTypes;
573 aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_1, *(ppBitmaps[0]) );
574 aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_2, *(ppBitmaps[1]) );
575 aCT_CAPTTYPE.SetItemImage(BMP_CAPTTYPE_3, *(ppBitmaps[2]) );
578 //========================================================================
581 SvxCaptionTabDialog::SvxCaptionTabDialog(Window* pParent, const SdrView* pSdrView, sal_uInt16 nAnchorTypes)
582 : SfxTabDialog( pParent, CUI_RES( RID_SVXDLG_CAPTION ) ),
583 pView ( pSdrView ),
584 nAnchorCtrls(nAnchorTypes)
586 FreeResource();
588 DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
590 //different positioning page in Writer
591 if(nAnchorCtrls & 0x00ff )
593 AddTabPage( RID_SVXPAGE_SWPOSSIZE, SvxSwPosSizeTabPage::Create,
594 SvxSwPosSizeTabPage::GetRanges );
595 RemoveTabPage( RID_SVXPAGE_POSITION_SIZE);
597 else
599 AddTabPage( RID_SVXPAGE_POSITION_SIZE, SvxPositionSizeTabPage::Create,
600 SvxPositionSizeTabPage::GetRanges );
601 RemoveTabPage( RID_SVXPAGE_SWPOSSIZE );
603 AddTabPage( RID_SVXPAGE_CAPTION, SvxCaptionTabPage::Create,
604 SvxCaptionTabPage::GetRanges );
607 // -----------------------------------------------------------------------
609 SvxCaptionTabDialog::~SvxCaptionTabDialog()
613 // -----------------------------------------------------------------------
615 void SvxCaptionTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage )
617 switch( nId )
619 case RID_SVXPAGE_POSITION_SIZE:
620 ( (SvxPositionSizeTabPage&) rPage ).SetView( pView );
621 ( (SvxPositionSizeTabPage&) rPage ).Construct();
622 if( nAnchorCtrls & SVX_OBJ_NORESIZE )
623 ( (SvxPositionSizeTabPage&) rPage ).DisableResize();
625 if( nAnchorCtrls & SVX_OBJ_NOPROTECT )
626 ( (SvxPositionSizeTabPage&) rPage ).DisableProtect();
627 break;
628 case RID_SVXPAGE_SWPOSSIZE :
630 SvxSwPosSizeTabPage& rSwPage = static_cast<SvxSwPosSizeTabPage&>(rPage);
631 rSwPage.EnableAnchorTypes(nAnchorCtrls);
632 rSwPage.SetValidateFramePosLink( aValidateLink );
634 break;
636 case RID_SVXPAGE_CAPTION:
637 ( (SvxCaptionTabPage&) rPage ).SetView( pView );
638 ( (SvxCaptionTabPage&) rPage ).Construct();
639 break;
642 /*-- 05.03.2004 13:54:26---------------------------------------------------
644 -----------------------------------------------------------------------*/
645 void SvxCaptionTabDialog::SetValidateFramePosLink( const Link& rLink )
647 aValidateLink = rLink;