1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sfx2/app.hxx>
21 #include <sfx2/module.hxx>
22 #include <tools/shl.hxx>
24 #include <svx/svddef.hxx>
25 #include <svx/sdtditm.hxx>
26 #include <svx/sdtagitm.hxx>
27 #include <svx/sdtaitm.hxx>
28 #include <svx/sdtfsitm.hxx>
29 #include <svx/sdtcfitm.hxx>
30 #include <svx/svdobj.hxx>
31 #include <svx/svdmark.hxx>
32 #include <svx/svdview.hxx>
33 #include <svx/svdotext.hxx>
34 #include <svx/dialogs.hrc>
36 #include "textattr.hxx"
37 #include <dialmgr.hxx>
38 #include "svx/dlgutil.hxx"
39 #include <sfx2/request.hxx>
40 #include <svx/ofaitem.hxx>
41 #include <editeng/writingmodeitem.hxx>
43 static const sal_uInt16 pRanges
[] =
46 , SDRATTR_TEXT_HORZADJUST
47 , SDRATTR_TEXT_WORDWRAP
48 , SDRATTR_TEXT_AUTOGROWSIZE
52 /*************************************************************************
54 |* dialog (page) for copying objects
56 \************************************************************************/
57 SvxTextAttrPage::SvxTextAttrPage(Window
* pWindow
, const SfxItemSet
& rInAttrs
)
58 : SvxTabPage(pWindow
,"TextAttributesPage","cui/ui/textattrtabpage.ui", rInAttrs
)
61 , bAutoGrowSizeEnabled(false)
62 , bContourEnabled(false)
63 , bAutoGrowWidthEnabled(false)
64 , bAutoGrowHeightEnabled(false)
65 , bWordWrapTextEnabled(false)
66 , bFitToSizeEnabled(false)
68 get(m_pTsbAutoGrowWidth
,"TSB_AUTOGROW_WIDTH");
69 get(m_pTsbAutoGrowHeight
,"TSB_AUTOGROW_HEIGHT");
70 get(m_pTsbFitToSize
,"TSB_FIT_TO_SIZE");
71 get(m_pTsbContour
,"TSB_CONTOUR");
72 get(m_pTsbWordWrapText
,"TSB_WORDWRAP_TEXT");
73 get(m_pTsbAutoGrowSize
,"TSB_AUTOGROW_SIZE");
74 get(m_pFlDistance
,"FL_DISTANCE");
75 get(m_pMtrFldLeft
,"MTR_FLD_LEFT");
76 get(m_pMtrFldRight
,"MTR_FLD_RIGHT");
77 get(m_pMtrFldTop
,"MTR_FLD_TOP");
78 get(m_pMtrFldBottom
,"MTR_FLD_BOTTOM");
79 get(m_pFlPosition
,"FL_POSITION");
80 get(m_pCtlPosition
,"CTL_POSITION");
81 m_pCtlPosition
->SetControlSettings(RP_MM
, 240, 100),
82 get(m_pTsbFullWidth
,"TSB_FULL_WIDTH");
85 FieldUnit eFUnit
= GetModuleFieldUnit( rInAttrs
);
86 SetFieldUnit( *m_pMtrFldLeft
, eFUnit
);
87 SetFieldUnit( *m_pMtrFldRight
, eFUnit
);
88 SetFieldUnit( *m_pMtrFldTop
, eFUnit
);
89 SetFieldUnit( *m_pMtrFldBottom
, eFUnit
);
91 Link
aLink( LINK( this, SvxTextAttrPage
, ClickHdl_Impl
) );
92 m_pTsbAutoGrowWidth
->SetClickHdl( aLink
);
93 m_pTsbAutoGrowHeight
->SetClickHdl( aLink
);
94 m_pTsbFitToSize
->SetClickHdl( aLink
);
95 m_pTsbContour
->SetClickHdl( aLink
);
97 m_pTsbFullWidth
->SetClickHdl(LINK( this, SvxTextAttrPage
, ClickFullWidthHdl_Impl
) );
100 /*************************************************************************
104 \************************************************************************/
105 SvxTextAttrPage::~SvxTextAttrPage()
109 /*************************************************************************
111 |* reads the passed item set
113 \************************************************************************/
115 void SvxTextAttrPage::Reset( const SfxItemSet
& rAttrs
)
117 SfxItemPool
* pPool
= rAttrs
.GetPool();
118 DBG_ASSERT( pPool
, "Wo ist der Pool" );
119 SfxMapUnit eUnit
= pPool
->GetMetric( SDRATTR_TEXT_LEFTDIST
);
121 const SfxPoolItem
* pItem
= GetItem( rAttrs
, SDRATTR_TEXT_LEFTDIST
);
124 pItem
= &pPool
->GetDefaultItem( SDRATTR_TEXT_LEFTDIST
);
127 long nValue
= ( ( const SdrTextLeftDistItem
* )pItem
)->GetValue();
128 SetMetricValue( *m_pMtrFldLeft
, nValue
, eUnit
);
131 m_pMtrFldLeft
->SetText( "" );
132 m_pMtrFldLeft
->SaveValue();
134 pItem
= GetItem( rAttrs
, SDRATTR_TEXT_RIGHTDIST
);
136 pItem
= &pPool
->GetDefaultItem( SDRATTR_TEXT_RIGHTDIST
);
139 long nValue
= ( ( const SdrTextRightDistItem
* )pItem
)->GetValue();
140 SetMetricValue( *m_pMtrFldRight
, nValue
, eUnit
);
143 m_pMtrFldRight
->SetText( "" );
144 m_pMtrFldRight
->SaveValue();
146 pItem
= GetItem( rAttrs
, SDRATTR_TEXT_UPPERDIST
);
148 pItem
= &pPool
->GetDefaultItem( SDRATTR_TEXT_UPPERDIST
);
151 long nValue
= ( ( const SdrTextUpperDistItem
* )pItem
)->GetValue();
152 SetMetricValue( *m_pMtrFldTop
, nValue
, eUnit
);
155 m_pMtrFldTop
->SetText( "" );
156 m_pMtrFldTop
->SaveValue();
158 pItem
= GetItem( rAttrs
, SDRATTR_TEXT_LOWERDIST
);
160 pItem
= &pPool
->GetDefaultItem( SDRATTR_TEXT_LOWERDIST
);
163 long nValue
= ( ( const SdrTextLowerDistItem
* )pItem
)->GetValue();
164 SetMetricValue( *m_pMtrFldBottom
, nValue
, eUnit
);
167 m_pMtrFldBottom
->SetText( "" );
168 m_pMtrFldBottom
->SaveValue();
171 if ( rAttrs
.GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT
) != SFX_ITEM_DONTCARE
)
173 m_pTsbAutoGrowHeight
->SetState( ( ( const SdrTextAutoGrowHeightItem
& )rAttrs
.Get( SDRATTR_TEXT_AUTOGROWHEIGHT
) ).
174 GetValue() ? TRISTATE_TRUE
: TRISTATE_FALSE
);
175 m_pTsbAutoGrowHeight
->EnableTriState( false );
178 m_pTsbAutoGrowHeight
->SetState( TRISTATE_INDET
);
179 m_pTsbAutoGrowHeight
->SaveValue();
182 if ( rAttrs
.GetItemState( SDRATTR_TEXT_AUTOGROWWIDTH
) != SFX_ITEM_DONTCARE
)
184 m_pTsbAutoGrowWidth
->SetState( ( ( const SdrTextAutoGrowWidthItem
& )rAttrs
.Get( SDRATTR_TEXT_AUTOGROWWIDTH
) ).
185 GetValue() ? TRISTATE_TRUE
: TRISTATE_FALSE
);
186 m_pTsbAutoGrowWidth
->EnableTriState( false );
189 m_pTsbAutoGrowWidth
->SetState( TRISTATE_INDET
);
190 m_pTsbAutoGrowWidth
->SaveValue();
193 if ( rAttrs
.GetItemState( SDRATTR_TEXT_AUTOGROWSIZE
) != SFX_ITEM_DONTCARE
)
195 m_pTsbAutoGrowSize
->SetState( ( ( const SdrTextAutoGrowHeightItem
& )rAttrs
.Get( SDRATTR_TEXT_AUTOGROWHEIGHT
) ).
196 GetValue() ? TRISTATE_TRUE
: TRISTATE_FALSE
);
197 m_pTsbAutoGrowSize
->EnableTriState( false );
200 m_pTsbAutoGrowSize
->SetState( TRISTATE_INDET
);
201 m_pTsbAutoGrowSize
->SaveValue();
204 if ( rAttrs
.GetItemState( SDRATTR_TEXT_WORDWRAP
) != SFX_ITEM_DONTCARE
)
206 m_pTsbWordWrapText
->SetState( ( ( const SdrTextWordWrapItem
& )rAttrs
.Get( SDRATTR_TEXT_WORDWRAP
) ).
207 GetValue() ? TRISTATE_TRUE
: TRISTATE_FALSE
);
208 m_pTsbWordWrapText
->EnableTriState( false );
211 m_pTsbWordWrapText
->SetState( TRISTATE_INDET
);
212 m_pTsbWordWrapText
->SaveValue();
215 // #103516# Do the setup based on states of hor/ver adjust
216 // Setup center field and FullWidth
217 SfxItemState eVState
= rAttrs
.GetItemState( SDRATTR_TEXT_VERTADJUST
);
218 SfxItemState eHState
= rAttrs
.GetItemState( SDRATTR_TEXT_HORZADJUST
);
220 if(SFX_ITEM_DONTCARE
!= eVState
&& SFX_ITEM_DONTCARE
!= eHState
)
222 // VertAdjust and HorAdjust are unequivocal, thus
223 SdrTextVertAdjust eTVA
= (SdrTextVertAdjust
)((const SdrTextVertAdjustItem
&)rAttrs
.Get(SDRATTR_TEXT_VERTADJUST
)).GetValue();
224 SdrTextHorzAdjust eTHA
= (SdrTextHorzAdjust
)((const SdrTextHorzAdjustItem
&)rAttrs
.Get(SDRATTR_TEXT_HORZADJUST
)).GetValue();
225 RECT_POINT eRP
= RP_LB
;
227 m_pTsbFullWidth
->EnableTriState( false );
229 // Translate item values into local anchor position.
232 case SDRTEXTVERTADJUST_TOP
:
236 case SDRTEXTHORZADJUST_LEFT
: eRP
= RP_LT
; break;
237 case SDRTEXTHORZADJUST_BLOCK
:
238 case SDRTEXTHORZADJUST_CENTER
: eRP
= RP_MT
; break;
239 case SDRTEXTHORZADJUST_RIGHT
: eRP
= RP_RT
; break;
243 case SDRTEXTVERTADJUST_BLOCK
:
244 case SDRTEXTVERTADJUST_CENTER
:
248 case SDRTEXTHORZADJUST_LEFT
: eRP
= RP_LM
; break;
249 case SDRTEXTHORZADJUST_BLOCK
:
250 case SDRTEXTHORZADJUST_CENTER
: eRP
= RP_MM
; break;
251 case SDRTEXTHORZADJUST_RIGHT
: eRP
= RP_RM
; break;
255 case SDRTEXTVERTADJUST_BOTTOM
:
259 case SDRTEXTHORZADJUST_LEFT
: eRP
= RP_LB
; break;
260 case SDRTEXTHORZADJUST_BLOCK
:
261 case SDRTEXTHORZADJUST_CENTER
: eRP
= RP_MB
; break;
262 case SDRTEXTHORZADJUST_RIGHT
: eRP
= RP_RB
; break;
270 // See if we have to check the "full width" check button.
271 bool bLeftToRight(IsTextDirectionLeftToRight());
273 if((bLeftToRight
&& (SDRTEXTHORZADJUST_BLOCK
== eTHA
)) || (!bLeftToRight
&& (SDRTEXTVERTADJUST_BLOCK
== eTVA
)))
275 // Move anchor to valid position.
276 ClickFullWidthHdl_Impl(NULL
);
277 m_pTsbFullWidth
->SetState(TRISTATE_TRUE
);
280 m_pCtlPosition
->SetActualRP( eRP
);
284 // VertAdjust or HorAdjust is not unequivocal
285 m_pCtlPosition
->Reset();
287 m_pCtlPosition
->SetState(TRISTATE_INDET
);
288 m_pCtlPosition
->DoCompletelyDisable(true);
290 m_pTsbFullWidth
->SetState(TRISTATE_INDET
);
291 m_pFlPosition
->Enable( false );
295 if ( rAttrs
.GetItemState( SDRATTR_TEXT_FITTOSIZE
) != SFX_ITEM_DONTCARE
)
297 SdrFitToSizeType eFTS
= (SdrFitToSizeType
)
298 ( ( const SdrTextFitToSizeTypeItem
& )rAttrs
.Get( SDRATTR_TEXT_FITTOSIZE
) ).GetValue();
299 m_pTsbFitToSize
->SetState( eFTS
== SDRTEXTFIT_NONE
? TRISTATE_FALSE
: TRISTATE_TRUE
);
300 m_pTsbFitToSize
->EnableTriState( false );
303 m_pTsbFitToSize
->SetState( TRISTATE_INDET
);
304 m_pTsbFitToSize
->SaveValue();
306 if( rAttrs
.GetItemState( SDRATTR_TEXT_CONTOURFRAME
) != SFX_ITEM_DONTCARE
)
308 bool bContour
= ( ( const SdrTextContourFrameItem
& )rAttrs
.Get( SDRATTR_TEXT_CONTOURFRAME
) ).GetValue();
309 m_pTsbContour
->SetState( bContour
? TRISTATE_TRUE
: TRISTATE_FALSE
);
310 m_pTsbContour
->EnableTriState( false );
313 m_pTsbContour
->SetState( TRISTATE_INDET
);
314 m_pTsbContour
->SaveValue();
316 ClickHdl_Impl( NULL
);
319 /*************************************************************************
321 |* fills the passed item set with dialog box attributes
323 \************************************************************************/
325 bool SvxTextAttrPage::FillItemSet( SfxItemSet
& rAttrs
)
327 SfxItemPool
* pPool
= rAttrs
.GetPool();
328 DBG_ASSERT( pPool
, "Wo ist der Pool" );
329 SfxMapUnit eUnit
= pPool
->GetMetric( SDRATTR_TEXT_LEFTDIST
);
334 if( m_pMtrFldLeft
->IsValueChangedFromSaved() )
336 nValue
= GetCoreValue( *m_pMtrFldLeft
, eUnit
);
337 rAttrs
.Put( SdrTextLeftDistItem( nValue
) );
340 if( m_pMtrFldRight
->IsValueChangedFromSaved() )
342 nValue
= GetCoreValue( *m_pMtrFldRight
, eUnit
);
343 rAttrs
.Put( SdrTextRightDistItem( nValue
) );
346 if( m_pMtrFldTop
->IsValueChangedFromSaved() )
348 nValue
= GetCoreValue( *m_pMtrFldTop
, eUnit
);
349 rAttrs
.Put( SdrTextUpperDistItem( nValue
) );
352 if( m_pMtrFldBottom
->IsValueChangedFromSaved() )
354 nValue
= GetCoreValue( *m_pMtrFldBottom
, eUnit
);
355 rAttrs
.Put( SdrTextLowerDistItem( nValue
) );
358 eState
= m_pTsbAutoGrowHeight
->GetState();
359 if( m_pTsbAutoGrowHeight
->IsValueChangedFromSaved() )
361 rAttrs
.Put( SdrTextAutoGrowHeightItem( TRISTATE_TRUE
== eState
) );
364 eState
= m_pTsbAutoGrowWidth
->GetState();
365 if( m_pTsbAutoGrowWidth
->IsValueChangedFromSaved() )
367 rAttrs
.Put( SdrTextAutoGrowWidthItem( TRISTATE_TRUE
== eState
) );
370 eState
= m_pTsbAutoGrowSize
->GetState();
371 if( m_pTsbAutoGrowSize
->IsValueChangedFromSaved() )
373 rAttrs
.Put( SdrTextAutoGrowHeightItem( TRISTATE_TRUE
== eState
) );
376 eState
= m_pTsbWordWrapText
->GetState();
377 if( m_pTsbWordWrapText
->IsValueChangedFromSaved() )
379 rAttrs
.Put( SdrTextWordWrapItem( TRISTATE_TRUE
== eState
) );
382 eState
= m_pTsbContour
->GetState();
383 if( m_pTsbContour
->IsValueChangedFromSaved() )
385 rAttrs
.Put( SdrTextContourFrameItem( TRISTATE_TRUE
== eState
) );
388 eState
= m_pTsbFitToSize
->GetState();
389 if( m_pTsbFitToSize
->IsValueChangedFromSaved() )
391 SdrFitToSizeType eFTS
;
394 default: ; //prevent warning
395 OSL_FAIL( "svx::SvxTextAttrPage::FillItemSet(), unhandled state!" );
397 case TRISTATE_FALSE
: eFTS
= SDRTEXTFIT_NONE
; break;
398 case TRISTATE_TRUE
: eFTS
= SDRTEXTFIT_AUTOFIT
; break;
400 rAttrs
.Put( SdrTextFitToSizeTypeItem( eFTS
) );
404 RECT_POINT eRP
= m_pCtlPosition
->GetActualRP();
405 SdrTextVertAdjust eTVA
, eOldTVA
;
406 SdrTextHorzAdjust eTHA
, eOldTHA
;
411 case RP_LT
: eTVA
= SDRTEXTVERTADJUST_TOP
;
412 eTHA
= SDRTEXTHORZADJUST_LEFT
; break;
413 case RP_LM
: eTVA
= SDRTEXTVERTADJUST_CENTER
;
414 eTHA
= SDRTEXTHORZADJUST_LEFT
; break;
415 case RP_LB
: eTVA
= SDRTEXTVERTADJUST_BOTTOM
;
416 eTHA
= SDRTEXTHORZADJUST_LEFT
; break;
417 case RP_MT
: eTVA
= SDRTEXTVERTADJUST_TOP
;
418 eTHA
= SDRTEXTHORZADJUST_CENTER
; break;
419 case RP_MM
: eTVA
= SDRTEXTVERTADJUST_CENTER
;
420 eTHA
= SDRTEXTHORZADJUST_CENTER
; break;
421 case RP_MB
: eTVA
= SDRTEXTVERTADJUST_BOTTOM
;
422 eTHA
= SDRTEXTHORZADJUST_CENTER
; break;
423 case RP_RT
: eTVA
= SDRTEXTVERTADJUST_TOP
;
424 eTHA
= SDRTEXTHORZADJUST_RIGHT
; break;
425 case RP_RM
: eTVA
= SDRTEXTVERTADJUST_CENTER
;
426 eTHA
= SDRTEXTHORZADJUST_RIGHT
; break;
427 case RP_RB
: eTVA
= SDRTEXTVERTADJUST_BOTTOM
;
428 eTHA
= SDRTEXTHORZADJUST_RIGHT
; break;
431 // #103516# Do not change values if adjust controls were disabled.
432 bool bIsDisabled(m_pCtlPosition
->IsCompletelyDisabled());
436 if( m_pTsbFullWidth
->GetState() == TRISTATE_TRUE
)
438 if (IsTextDirectionLeftToRight())
439 eTHA
= SDRTEXTHORZADJUST_BLOCK
;
441 eTVA
= SDRTEXTVERTADJUST_BLOCK
;
444 if ( rOutAttrs
.GetItemState( SDRATTR_TEXT_VERTADJUST
) != SFX_ITEM_DONTCARE
)
446 eOldTVA
= (SdrTextVertAdjust
)
447 ( ( const SdrTextVertAdjustItem
& )rOutAttrs
.Get( SDRATTR_TEXT_VERTADJUST
) ).GetValue();
448 if( eOldTVA
!= eTVA
)
449 rAttrs
.Put( SdrTextVertAdjustItem( eTVA
) );
452 rAttrs
.Put( SdrTextVertAdjustItem( eTVA
) );
454 if ( rOutAttrs
.GetItemState( SDRATTR_TEXT_HORZADJUST
) != SFX_ITEM_DONTCARE
)
456 eOldTHA
= (SdrTextHorzAdjust
)
457 ( ( const SdrTextHorzAdjustItem
& )rOutAttrs
.Get( SDRATTR_TEXT_HORZADJUST
) ).GetValue();
458 if( eOldTHA
!= eTHA
)
459 rAttrs
.Put( SdrTextHorzAdjustItem( eTHA
) );
462 rAttrs
.Put( SdrTextHorzAdjustItem( eTHA
) );
468 void SvxTextAttrPage::Construct()
470 DBG_ASSERT( pView
, "Keine gueltige View Uebergeben!" );
472 bFitToSizeEnabled
= bContourEnabled
= true;
473 bWordWrapTextEnabled
= bAutoGrowSizeEnabled
= bAutoGrowWidthEnabled
= bAutoGrowHeightEnabled
= false;
475 const SdrMarkList
& rMarkList
= pView
->GetMarkedObjectList();
476 if( rMarkList
.GetMarkCount() == 1 )
478 const SdrObject
* pObj
= rMarkList
.GetMark( 0 )->GetMarkedSdrObj();
479 SdrObjKind eKind
= (SdrObjKind
) pObj
->GetObjIdentifier();
480 if( pObj
->GetObjInventor() == SdrInventor
)
486 case OBJ_OUTLINETEXT
:
491 // contour NOT possible for pure text objects
492 bContourEnabled
= false;
494 // adjusting width and height is ONLY possible for pure text objects
495 bAutoGrowWidthEnabled
= bAutoGrowHeightEnabled
= true;
499 case OBJ_CUSTOMSHAPE
:
501 bFitToSizeEnabled
= bContourEnabled
= false;
502 bAutoGrowSizeEnabled
= true;
503 bWordWrapTextEnabled
= true;
506 default: ;//prevent warning
510 m_pTsbAutoGrowHeight
->Enable( bAutoGrowHeightEnabled
);
511 m_pTsbAutoGrowWidth
->Enable( bAutoGrowWidthEnabled
);
512 m_pTsbFitToSize
->Enable( bFitToSizeEnabled
);
513 m_pTsbContour
->Enable( bContourEnabled
);
514 m_pTsbAutoGrowSize
->Enable( bAutoGrowSizeEnabled
);
515 m_pTsbWordWrapText
->Enable( bWordWrapTextEnabled
);
518 /*************************************************************************
522 \************************************************************************/
524 SfxTabPage
* SvxTextAttrPage::Create( Window
* pWindow
,
525 const SfxItemSet
& rAttrs
)
527 return( new SvxTextAttrPage( pWindow
, rAttrs
) );
530 const sal_uInt16
* SvxTextAttrPage::GetRanges()
535 /** Check whether we have to uncheck the "Full width" check box.
537 void SvxTextAttrPage::PointChanged( Window
*, RECT_POINT eRP
)
539 if (m_pTsbFullWidth
->GetState() == TRISTATE_TRUE
)
541 // Depending on write direction and currently checked anchor we have
542 // to uncheck the "full width" button.
543 if (IsTextDirectionLeftToRight())
552 m_pTsbFullWidth
->SetState( TRISTATE_FALSE
);
554 default: ;//prevent warning
565 m_pTsbFullWidth
->SetState( TRISTATE_FALSE
);
567 default: ;//prevent warning
572 /*************************************************************************
574 |* possibly changes the position of the position-control
576 \************************************************************************/
578 /** When switching the "full width" check button on the text anchor may have
579 to be moved to a valid and adjacent position. This position depends on
580 the current anchor position and the text writing direction.
582 IMPL_LINK_NOARG(SvxTextAttrPage
, ClickFullWidthHdl_Impl
)
584 if( m_pTsbFullWidth
->GetState() == TRISTATE_TRUE
)
586 if (IsTextDirectionLeftToRight())
588 // Move text anchor to horizontal middle axis.
589 switch( m_pCtlPosition
->GetActualRP() )
593 m_pCtlPosition
->SetActualRP( RP_MT
);
598 m_pCtlPosition
->SetActualRP( RP_MM
);
603 m_pCtlPosition
->SetActualRP( RP_MB
);
605 default: ;//prevent warning
610 // Move text anchor to vertical middle axis.
611 switch( m_pCtlPosition
->GetActualRP() )
615 m_pCtlPosition
->SetActualRP( RP_LM
);
620 m_pCtlPosition
->SetActualRP( RP_MM
);
625 m_pCtlPosition
->SetActualRP( RP_RM
);
627 default: ;//prevent warning
634 /*************************************************************************
636 |* enables/disables "size at text" or "adjust to frame"
638 \************************************************************************/
640 IMPL_LINK_NOARG(SvxTextAttrPage
, ClickHdl_Impl
)
642 bool bAutoGrowWidth
= m_pTsbAutoGrowWidth
->GetState() == TRISTATE_TRUE
;
643 bool bAutoGrowHeight
= m_pTsbAutoGrowHeight
->GetState() == TRISTATE_TRUE
;
644 bool bFitToSize
= m_pTsbFitToSize
->GetState() == TRISTATE_TRUE
;
645 bool bContour
= m_pTsbContour
->GetState() == TRISTATE_TRUE
;
647 m_pTsbContour
->Enable( !bFitToSize
&&
648 !( ( bAutoGrowWidth
&& bAutoGrowWidthEnabled
) || ( bAutoGrowHeight
&& bAutoGrowHeightEnabled
) ) &&
651 m_pTsbAutoGrowWidth
->Enable( !bFitToSize
&&
652 !( bContour
&& bContourEnabled
) &&
653 bAutoGrowWidthEnabled
);
655 m_pTsbAutoGrowHeight
->Enable( !bFitToSize
&&
656 !( bContour
&& bContourEnabled
) &&
657 bAutoGrowHeightEnabled
);
659 m_pTsbFitToSize
->Enable( !( ( bAutoGrowWidth
&& bAutoGrowWidthEnabled
) || ( bAutoGrowHeight
&& bAutoGrowHeightEnabled
) ) &&
660 !( bContour
&& bContourEnabled
) &&
663 // #101901# enable/disable metric fields and decorations dependent of contour
664 m_pFlDistance
->Enable(!bContour
);
666 if( bContour
&& bContourEnabled
)
668 m_pMtrFldLeft
->SetValue( 0 );
669 m_pMtrFldRight
->SetValue( 0 );
670 m_pMtrFldTop
->SetValue( 0 );
671 m_pMtrFldBottom
->SetValue( 0 );
674 // #103516# Do the setup based on states of hor/ver adjust
675 SfxItemState eVState
= rOutAttrs
.GetItemState( SDRATTR_TEXT_VERTADJUST
);
676 SfxItemState eHState
= rOutAttrs
.GetItemState( SDRATTR_TEXT_HORZADJUST
);
677 bool bHorAndVer(SFX_ITEM_DONTCARE
== eVState
|| SFX_ITEM_DONTCARE
== eHState
);
679 // #83698# enable/disable text anchoring dependent of contour
680 m_pFlPosition
->Enable(!bContour
&& !bHorAndVer
);
686 bool SvxTextAttrPage::IsTextDirectionLeftToRight (void) const
688 // Determine the text writing direction with left to right as default.
689 bool bLeftToRightDirection
= true;
690 SfxItemState eState
= rOutAttrs
.GetItemState(SDRATTR_TEXTDIRECTION
);
692 if(SFX_ITEM_DONTCARE
!= eState
)
694 const SvxWritingModeItem
& rItem
= static_cast<const SvxWritingModeItem
&> (
695 rOutAttrs
.Get (SDRATTR_TEXTDIRECTION
));
696 if (rItem
.GetValue() == com::sun::star::text::WritingMode_TB_RL
)
697 bLeftToRightDirection
= false;
699 return bLeftToRightDirection
;
702 void SvxTextAttrPage::PageCreated(const SfxAllItemSet
& aSet
)
704 SFX_ITEMSET_ARG (&aSet
,pViewItem
,OfaPtrItem
,SID_SVXTEXTATTRPAGE_VIEW
,false);
707 SetView( static_cast<SdrView
*>(pViewItem
->GetValue()));
712 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */