xref: /aoo42x/main/cui/source/tabpages/textattr.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_cui.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir // include ---------------------------------------------------------------
32*cdf0e10cSrcweir #include <sfx2/app.hxx>
33*cdf0e10cSrcweir #include <sfx2/module.hxx>
34*cdf0e10cSrcweir #include <tools/shl.hxx>
35*cdf0e10cSrcweir #include <cuires.hrc>
36*cdf0e10cSrcweir #include <svx/svddef.hxx>
37*cdf0e10cSrcweir #include <svx/sdtditm.hxx>
38*cdf0e10cSrcweir #include <svx/sdtagitm.hxx>
39*cdf0e10cSrcweir #include <svx/sdtaitm.hxx>
40*cdf0e10cSrcweir #include <svx/sdtfsitm.hxx>
41*cdf0e10cSrcweir #include <svx/sdtcfitm.hxx>
42*cdf0e10cSrcweir #include <svx/svdobj.hxx>
43*cdf0e10cSrcweir #include <svx/svdmark.hxx>
44*cdf0e10cSrcweir #include <svx/svdview.hxx>
45*cdf0e10cSrcweir #include <svx/svdotext.hxx>
46*cdf0e10cSrcweir #include <svx/dialogs.hrc>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #ifndef _SVX_TEXTATTR_CXX
49*cdf0e10cSrcweir #define _SVX_TEXTATTR_CXX
50*cdf0e10cSrcweir #endif
51*cdf0e10cSrcweir #include "textattr.hxx"
52*cdf0e10cSrcweir #include "textattr.hrc"
53*cdf0e10cSrcweir #include <dialmgr.hxx>
54*cdf0e10cSrcweir #include "svx/dlgutil.hxx"
55*cdf0e10cSrcweir #include <sfx2/request.hxx> //add CHINA001
56*cdf0e10cSrcweir #include <svx/ofaitem.hxx> //add CHINA001
57*cdf0e10cSrcweir #include <editeng/writingmodeitem.hxx>
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir static sal_uInt16 pRanges[] =
60*cdf0e10cSrcweir {
61*cdf0e10cSrcweir 	SDRATTR_MISC_FIRST, SDRATTR_TEXT_HORZADJUST,
62*cdf0e10cSrcweir 	SDRATTR_TEXT_WORDWRAP, SDRATTR_TEXT_AUTOGROWSIZE,
63*cdf0e10cSrcweir 	0
64*cdf0e10cSrcweir };
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir /*************************************************************************
67*cdf0e10cSrcweir |*
68*cdf0e10cSrcweir |* Dialog zum Kopieren von Objekten
69*cdf0e10cSrcweir |*
70*cdf0e10cSrcweir \************************************************************************/
71*cdf0e10cSrcweir 
72*cdf0e10cSrcweir //CHINA001 SvxTextAttrDialog::SvxTextAttrDialog( Window* pParent, const SfxItemSet& rInAttrs,
73*cdf0e10cSrcweir //CHINA001 								const SdrView* pSdrView ) :
74*cdf0e10cSrcweir //CHINA001 		SfxSingleTabDialog( pParent, rInAttrs, RID_SVXPAGE_TEXTATTR )
75*cdf0e10cSrcweir //CHINA001 {
76*cdf0e10cSrcweir //CHINA001 SvxTextAttrPage* pPage = new SvxTextAttrPage( this, rInAttrs );
77*cdf0e10cSrcweir //CHINA001
78*cdf0e10cSrcweir //CHINA001 pPage->SetView( pSdrView );
79*cdf0e10cSrcweir //CHINA001 pPage->Construct();
80*cdf0e10cSrcweir //CHINA001
81*cdf0e10cSrcweir //CHINA001 SetTabPage( pPage );
82*cdf0e10cSrcweir //CHINA001 SetText( pPage->GetText() );
83*cdf0e10cSrcweir //CHINA001 }
84*cdf0e10cSrcweir //CHINA001
85*cdf0e10cSrcweir /*************************************************************************
86*cdf0e10cSrcweir |*
87*cdf0e10cSrcweir |* Dtor
88*cdf0e10cSrcweir |*
89*cdf0e10cSrcweir \************************************************************************/
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir //CHINA001 SvxTextAttrDialog::~SvxTextAttrDialog()
92*cdf0e10cSrcweir //CHINA001 {
93*cdf0e10cSrcweir //CHINA001 }
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir /*************************************************************************
96*cdf0e10cSrcweir |*
97*cdf0e10cSrcweir |* Dialog (Seite) zum Kopieren von Objekten
98*cdf0e10cSrcweir |*
99*cdf0e10cSrcweir \************************************************************************/
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir SvxTextAttrPage::SvxTextAttrPage( Window* pWindow, const SfxItemSet& rInAttrs ) :
102*cdf0e10cSrcweir 				SvxTabPage		( pWindow, CUI_RES( RID_SVXPAGE_TEXTATTR ),
103*cdf0e10cSrcweir 								  rInAttrs ),
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 				aFlText			( this, CUI_RES( FL_TEXT ) ),
106*cdf0e10cSrcweir 				aTsbAutoGrowWidth  ( this, CUI_RES( TSB_AUTOGROW_WIDTH ) ),
107*cdf0e10cSrcweir 				aTsbAutoGrowHeight ( this, CUI_RES( TSB_AUTOGROW_HEIGHT ) ),
108*cdf0e10cSrcweir 				aTsbFitToSize	( this, CUI_RES( TSB_FIT_TO_SIZE ) ),
109*cdf0e10cSrcweir 				aTsbContour  	( this, CUI_RES( TSB_CONTOUR ) ),
110*cdf0e10cSrcweir 				aTsbWordWrapText( this, CUI_RES( TSB_WORDWRAP_TEXT ) ),
111*cdf0e10cSrcweir 				aTsbAutoGrowSize( this, CUI_RES( TSB_AUTOGROW_SIZE ) ),
112*cdf0e10cSrcweir 				aFlDistance		( this, CUI_RES( FL_DISTANCE ) ),
113*cdf0e10cSrcweir 				aFtLeft			( this, CUI_RES( FT_LEFT ) ),
114*cdf0e10cSrcweir 				aMtrFldLeft		( this, CUI_RES( MTR_FLD_LEFT ) ),
115*cdf0e10cSrcweir 				aFtRight		( this, CUI_RES( FT_RIGHT ) ),
116*cdf0e10cSrcweir 				aMtrFldRight	( this, CUI_RES( MTR_FLD_RIGHT ) ),
117*cdf0e10cSrcweir 				aFtTop			( this, CUI_RES( FT_TOP ) ),
118*cdf0e10cSrcweir 				aMtrFldTop		( this, CUI_RES( MTR_FLD_TOP ) ),
119*cdf0e10cSrcweir 				aFtBottom		( this, CUI_RES( FT_BOTTOM ) ),
120*cdf0e10cSrcweir 				aMtrFldBottom	( this, CUI_RES( MTR_FLD_BOTTOM ) ),
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir 				aFlSeparator	( this, CUI_RES( FL_SEPARATOR ) ),
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 				aFlPosition		( this, CUI_RES( FL_POSITION ) ),
125*cdf0e10cSrcweir 				aCtlPosition 	( this, CUI_RES( CTL_POSITION ),
126*cdf0e10cSrcweir 											RP_MM, 240, 100 ),
127*cdf0e10cSrcweir 				aTsbFullWidth 	( this, CUI_RES( TSB_FULL_WIDTH ) ),
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir 				rOutAttrs		( rInAttrs )
130*cdf0e10cSrcweir {
131*cdf0e10cSrcweir 	FreeResource();
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir 	FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs );
134*cdf0e10cSrcweir 	SetFieldUnit( aMtrFldLeft, eFUnit );
135*cdf0e10cSrcweir 	SetFieldUnit( aMtrFldRight, eFUnit );
136*cdf0e10cSrcweir 	SetFieldUnit( aMtrFldTop, eFUnit );
137*cdf0e10cSrcweir 	SetFieldUnit( aMtrFldBottom, eFUnit );
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 	Link aLink( LINK( this, SvxTextAttrPage, ClickHdl_Impl ) );
140*cdf0e10cSrcweir 	aTsbAutoGrowWidth.SetClickHdl( aLink );
141*cdf0e10cSrcweir 	aTsbAutoGrowHeight.SetClickHdl( aLink );
142*cdf0e10cSrcweir 	aTsbFitToSize.SetClickHdl( aLink );
143*cdf0e10cSrcweir 	aTsbContour.SetClickHdl( aLink );
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir 	aTsbFullWidth.SetClickHdl(
146*cdf0e10cSrcweir 		LINK( this, SvxTextAttrPage, ClickFullWidthHdl_Impl ) );
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 	aCtlPosition.SetAccessibleRelationMemberOf( &aFlPosition );
149*cdf0e10cSrcweir }
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir /*************************************************************************
152*cdf0e10cSrcweir |*
153*cdf0e10cSrcweir |* Dtor
154*cdf0e10cSrcweir |*
155*cdf0e10cSrcweir \************************************************************************/
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir SvxTextAttrPage::~SvxTextAttrPage()
158*cdf0e10cSrcweir {
159*cdf0e10cSrcweir }
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir /*************************************************************************
162*cdf0e10cSrcweir |*
163*cdf0e10cSrcweir |* Liest uebergebenen Item-Set
164*cdf0e10cSrcweir |*
165*cdf0e10cSrcweir \************************************************************************/
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir void __EXPORT SvxTextAttrPage::Reset( const SfxItemSet& rAttrs )
168*cdf0e10cSrcweir {
169*cdf0e10cSrcweir 	SfxItemPool* pPool = rAttrs.GetPool();
170*cdf0e10cSrcweir 	DBG_ASSERT( pPool, "Wo ist der Pool" );
171*cdf0e10cSrcweir 	SfxMapUnit eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST );
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir 	// Linker Abstand vom Rahmen
174*cdf0e10cSrcweir 	const SfxPoolItem* pItem = GetItem( rAttrs, SDRATTR_TEXT_LEFTDIST );
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir 	if( !pItem )
177*cdf0e10cSrcweir 		pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LEFTDIST );
178*cdf0e10cSrcweir 	if( pItem )
179*cdf0e10cSrcweir 	{
180*cdf0e10cSrcweir 		long nValue = ( ( const SdrTextLeftDistItem* )pItem )->GetValue();
181*cdf0e10cSrcweir 		SetMetricValue( aMtrFldLeft, nValue, eUnit );
182*cdf0e10cSrcweir 	}
183*cdf0e10cSrcweir 	else
184*cdf0e10cSrcweir 		aMtrFldLeft.SetText( String() );
185*cdf0e10cSrcweir 	aMtrFldLeft.SaveValue();
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir 	// Rechter Abstand vom Rahmen
188*cdf0e10cSrcweir 	pItem = GetItem( rAttrs, SDRATTR_TEXT_RIGHTDIST );
189*cdf0e10cSrcweir 	if( !pItem )
190*cdf0e10cSrcweir 		pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_RIGHTDIST );
191*cdf0e10cSrcweir 	if( pItem )
192*cdf0e10cSrcweir 	{
193*cdf0e10cSrcweir 		long nValue = ( ( const SdrTextRightDistItem* )pItem )->GetValue();
194*cdf0e10cSrcweir 		SetMetricValue( aMtrFldRight, nValue, eUnit );
195*cdf0e10cSrcweir 	}
196*cdf0e10cSrcweir 	else
197*cdf0e10cSrcweir 		aMtrFldRight.SetText( String() );
198*cdf0e10cSrcweir 	aMtrFldRight.SaveValue();
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir 	// Oberer Abstand vom Rahmen
201*cdf0e10cSrcweir 	pItem = GetItem( rAttrs, SDRATTR_TEXT_UPPERDIST );
202*cdf0e10cSrcweir 	if( !pItem )
203*cdf0e10cSrcweir 		pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_UPPERDIST );
204*cdf0e10cSrcweir 	if( pItem )
205*cdf0e10cSrcweir 	{
206*cdf0e10cSrcweir 		long nValue = ( ( const SdrTextUpperDistItem* )pItem )->GetValue();
207*cdf0e10cSrcweir 		SetMetricValue( aMtrFldTop, nValue, eUnit );
208*cdf0e10cSrcweir 	}
209*cdf0e10cSrcweir 	else
210*cdf0e10cSrcweir 		aMtrFldTop.SetText( String() );
211*cdf0e10cSrcweir 	aMtrFldTop.SaveValue();
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 	// Unterer Abstand vom Rahmen
214*cdf0e10cSrcweir 	pItem = GetItem( rAttrs, SDRATTR_TEXT_LOWERDIST );
215*cdf0e10cSrcweir 	if( !pItem )
216*cdf0e10cSrcweir 		pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LOWERDIST );
217*cdf0e10cSrcweir 	if( pItem )
218*cdf0e10cSrcweir 	{
219*cdf0e10cSrcweir 		long nValue = ( ( const SdrTextLowerDistItem* )pItem )->GetValue();
220*cdf0e10cSrcweir 		SetMetricValue( aMtrFldBottom, nValue, eUnit );
221*cdf0e10cSrcweir 	}
222*cdf0e10cSrcweir 	else
223*cdf0e10cSrcweir 		aMtrFldBottom.SetText( String() );
224*cdf0e10cSrcweir 	aMtrFldBottom.SaveValue();
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir 	// An Hoehe anpassen
227*cdf0e10cSrcweir 	if ( rAttrs.GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) != SFX_ITEM_DONTCARE )
228*cdf0e10cSrcweir 	{
229*cdf0e10cSrcweir 		aTsbAutoGrowHeight.SetState( ( ( const SdrTextAutoGrowHeightItem& )rAttrs.Get( SDRATTR_TEXT_AUTOGROWHEIGHT ) ).
230*cdf0e10cSrcweir 						GetValue() ? STATE_CHECK : STATE_NOCHECK );
231*cdf0e10cSrcweir 		aTsbAutoGrowHeight.EnableTriState( sal_False );
232*cdf0e10cSrcweir 	}
233*cdf0e10cSrcweir 	else
234*cdf0e10cSrcweir 		aTsbAutoGrowHeight.SetState( STATE_DONTKNOW );
235*cdf0e10cSrcweir 	aTsbAutoGrowHeight.SaveValue();
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir 	// An Breite anpassen
238*cdf0e10cSrcweir 	if ( rAttrs.GetItemState( SDRATTR_TEXT_AUTOGROWWIDTH ) != SFX_ITEM_DONTCARE )
239*cdf0e10cSrcweir 	{
240*cdf0e10cSrcweir 		aTsbAutoGrowWidth.SetState( ( ( const SdrTextAutoGrowWidthItem& )rAttrs.Get( SDRATTR_TEXT_AUTOGROWWIDTH ) ).
241*cdf0e10cSrcweir 						GetValue() ? STATE_CHECK : STATE_NOCHECK );
242*cdf0e10cSrcweir 		aTsbAutoGrowWidth.EnableTriState( sal_False );
243*cdf0e10cSrcweir 	}
244*cdf0e10cSrcweir 	else
245*cdf0e10cSrcweir 		aTsbAutoGrowWidth.SetState( STATE_DONTKNOW );
246*cdf0e10cSrcweir 	aTsbAutoGrowWidth.SaveValue();
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir 	// autogrowsize
249*cdf0e10cSrcweir 	if ( rAttrs.GetItemState( SDRATTR_TEXT_AUTOGROWSIZE ) != SFX_ITEM_DONTCARE )
250*cdf0e10cSrcweir 	{
251*cdf0e10cSrcweir 		aTsbAutoGrowSize.SetState( ( ( const SdrTextAutoGrowHeightItem& )rAttrs.Get( SDRATTR_TEXT_AUTOGROWHEIGHT ) ).
252*cdf0e10cSrcweir 						GetValue() ? STATE_CHECK : STATE_NOCHECK );
253*cdf0e10cSrcweir 		aTsbAutoGrowSize.EnableTriState( sal_False );
254*cdf0e10cSrcweir 	}
255*cdf0e10cSrcweir 	else
256*cdf0e10cSrcweir 		aTsbAutoGrowSize.SetState( STATE_DONTKNOW );
257*cdf0e10cSrcweir 	aTsbAutoGrowSize.SaveValue();
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir 	// wordwrap text
260*cdf0e10cSrcweir 	if ( rAttrs.GetItemState( SDRATTR_TEXT_WORDWRAP ) != SFX_ITEM_DONTCARE )
261*cdf0e10cSrcweir 	{
262*cdf0e10cSrcweir 		aTsbWordWrapText.SetState( ( ( const SdrTextWordWrapItem& )rAttrs.Get( SDRATTR_TEXT_WORDWRAP ) ).
263*cdf0e10cSrcweir 						GetValue() ? STATE_CHECK : STATE_NOCHECK );
264*cdf0e10cSrcweir 		aTsbWordWrapText.EnableTriState( sal_False );
265*cdf0e10cSrcweir 	}
266*cdf0e10cSrcweir 	else
267*cdf0e10cSrcweir 		aTsbWordWrapText.SetState( STATE_DONTKNOW );
268*cdf0e10cSrcweir 	aTsbWordWrapText.SaveValue();
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 	// #103516# Do the setup based on states of hor/ver adjust
272*cdf0e10cSrcweir 	// Setup center field and FullWidth
273*cdf0e10cSrcweir 	SfxItemState eVState = rAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST );
274*cdf0e10cSrcweir 	SfxItemState eHState = rAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir 	if(SFX_ITEM_DONTCARE != eVState && SFX_ITEM_DONTCARE != eHState)
277*cdf0e10cSrcweir 	{
278*cdf0e10cSrcweir 		// VertAdjust and HorAdjust are unequivocal, thus
279*cdf0e10cSrcweir 		SdrTextVertAdjust eTVA = (SdrTextVertAdjust)((const SdrTextVertAdjustItem&)rAttrs.Get(SDRATTR_TEXT_VERTADJUST)).GetValue();
280*cdf0e10cSrcweir 		SdrTextHorzAdjust eTHA = (SdrTextHorzAdjust)((const SdrTextHorzAdjustItem&)rAttrs.Get(SDRATTR_TEXT_HORZADJUST)).GetValue();
281*cdf0e10cSrcweir 		RECT_POINT eRP = RP_LB;
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir 		aTsbFullWidth.EnableTriState( sal_False );
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir         // Translate item values into local anchor position.
286*cdf0e10cSrcweir 		switch (eTVA)
287*cdf0e10cSrcweir         {
288*cdf0e10cSrcweir             case SDRTEXTVERTADJUST_TOP:
289*cdf0e10cSrcweir 			{
290*cdf0e10cSrcweir                 switch (eTHA)
291*cdf0e10cSrcweir                 {
292*cdf0e10cSrcweir                     case SDRTEXTHORZADJUST_LEFT: eRP = RP_LT; break;
293*cdf0e10cSrcweir                     case SDRTEXTHORZADJUST_BLOCK:
294*cdf0e10cSrcweir                     case SDRTEXTHORZADJUST_CENTER: eRP = RP_MT; break;
295*cdf0e10cSrcweir                     case SDRTEXTHORZADJUST_RIGHT: eRP = RP_RT; break;
296*cdf0e10cSrcweir                 }
297*cdf0e10cSrcweir                 break;
298*cdf0e10cSrcweir 			}
299*cdf0e10cSrcweir             case SDRTEXTVERTADJUST_BLOCK:
300*cdf0e10cSrcweir             case SDRTEXTVERTADJUST_CENTER:
301*cdf0e10cSrcweir 			{
302*cdf0e10cSrcweir                 switch (eTHA)
303*cdf0e10cSrcweir                 {
304*cdf0e10cSrcweir                     case SDRTEXTHORZADJUST_LEFT: eRP = RP_LM; break;
305*cdf0e10cSrcweir                     case SDRTEXTHORZADJUST_BLOCK:
306*cdf0e10cSrcweir                     case SDRTEXTHORZADJUST_CENTER: eRP = RP_MM; break;
307*cdf0e10cSrcweir                     case SDRTEXTHORZADJUST_RIGHT: eRP = RP_RM; break;
308*cdf0e10cSrcweir                 }
309*cdf0e10cSrcweir                 break;
310*cdf0e10cSrcweir 			}
311*cdf0e10cSrcweir             case SDRTEXTVERTADJUST_BOTTOM:
312*cdf0e10cSrcweir 			{
313*cdf0e10cSrcweir                 switch (eTHA)
314*cdf0e10cSrcweir                 {
315*cdf0e10cSrcweir                     case SDRTEXTHORZADJUST_LEFT: eRP = RP_LB; break;
316*cdf0e10cSrcweir                     case SDRTEXTHORZADJUST_BLOCK:
317*cdf0e10cSrcweir                     case SDRTEXTHORZADJUST_CENTER: eRP = RP_MB; break;
318*cdf0e10cSrcweir                     case SDRTEXTHORZADJUST_RIGHT: eRP = RP_RB; break;
319*cdf0e10cSrcweir                 }
320*cdf0e10cSrcweir 				break;
321*cdf0e10cSrcweir 			}
322*cdf0e10cSrcweir 			default:
323*cdf0e10cSrcweir 				break;
324*cdf0e10cSrcweir 		}
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir         // See if we have to check the "full width" check button.
327*cdf0e10cSrcweir         sal_Bool bLeftToRight(IsTextDirectionLeftToRight());
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir 		if((bLeftToRight && (SDRTEXTHORZADJUST_BLOCK == eTHA)) || (!bLeftToRight && (SDRTEXTVERTADJUST_BLOCK == eTVA)))
330*cdf0e10cSrcweir         {
331*cdf0e10cSrcweir             // Move anchor to valid position.
332*cdf0e10cSrcweir             ClickFullWidthHdl_Impl(NULL);
333*cdf0e10cSrcweir             aTsbFullWidth.SetState(STATE_CHECK);
334*cdf0e10cSrcweir         }
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir 		aCtlPosition.SetActualRP( eRP );
337*cdf0e10cSrcweir 	}
338*cdf0e10cSrcweir 	else
339*cdf0e10cSrcweir 	{
340*cdf0e10cSrcweir 		// VertAdjust or HorAdjust is not unequivocal
341*cdf0e10cSrcweir 		aCtlPosition.Reset();
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir 		aCtlPosition.SetState(STATE_DONTKNOW);
344*cdf0e10cSrcweir 		aCtlPosition.DoCompletelyDisable(sal_True);
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir 		aTsbFullWidth.SetState(STATE_DONTKNOW);
347*cdf0e10cSrcweir 		aTsbFullWidth.Enable( sal_False );
348*cdf0e10cSrcweir 		aFlPosition.Enable( sal_False );
349*cdf0e10cSrcweir 	}
350*cdf0e10cSrcweir 
351*cdf0e10cSrcweir 	// Am Rahmen anpassen
352*cdf0e10cSrcweir 	if ( rAttrs.GetItemState( SDRATTR_TEXT_FITTOSIZE ) != SFX_ITEM_DONTCARE )
353*cdf0e10cSrcweir 	{
354*cdf0e10cSrcweir 		SdrFitToSizeType eFTS = (SdrFitToSizeType)
355*cdf0e10cSrcweir 					( ( const SdrTextFitToSizeTypeItem& )rAttrs.Get( SDRATTR_TEXT_FITTOSIZE ) ).GetValue();
356*cdf0e10cSrcweir 		aTsbFitToSize.SetState( eFTS == SDRTEXTFIT_NONE ? STATE_NOCHECK : STATE_CHECK );
357*cdf0e10cSrcweir 		aTsbFitToSize.EnableTriState( sal_False );
358*cdf0e10cSrcweir 	}
359*cdf0e10cSrcweir 	else
360*cdf0e10cSrcweir 		aTsbFitToSize.SetState( STATE_DONTKNOW );
361*cdf0e10cSrcweir 	aTsbFitToSize.SaveValue();
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir 	// Konturfluss
364*cdf0e10cSrcweir 	if( rAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME ) != SFX_ITEM_DONTCARE )
365*cdf0e10cSrcweir 	{
366*cdf0e10cSrcweir 		sal_Bool bContour = ( ( const SdrTextContourFrameItem& )rAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue();
367*cdf0e10cSrcweir 		aTsbContour.SetState( bContour ? STATE_CHECK : STATE_NOCHECK );
368*cdf0e10cSrcweir 		aTsbContour.EnableTriState( sal_False );
369*cdf0e10cSrcweir 	}
370*cdf0e10cSrcweir 	else
371*cdf0e10cSrcweir 		aTsbContour.SetState( STATE_DONTKNOW );
372*cdf0e10cSrcweir 	aTsbContour.SaveValue();
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir 	ClickHdl_Impl( NULL );
375*cdf0e10cSrcweir }
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir /*************************************************************************
378*cdf0e10cSrcweir |*
379*cdf0e10cSrcweir |* Fuellt uebergebenen Item-Set mit Dialogbox-Attributen
380*cdf0e10cSrcweir |*
381*cdf0e10cSrcweir \************************************************************************/
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir sal_Bool SvxTextAttrPage::FillItemSet( SfxItemSet& rAttrs)
384*cdf0e10cSrcweir {
385*cdf0e10cSrcweir 	SfxItemPool* pPool = rAttrs.GetPool();
386*cdf0e10cSrcweir 	DBG_ASSERT( pPool, "Wo ist der Pool" );
387*cdf0e10cSrcweir 	SfxMapUnit eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST );
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir 	sal_Int32	 nValue;
390*cdf0e10cSrcweir 	TriState eState;
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir 	if( aMtrFldLeft.GetText() != aMtrFldLeft.GetSavedValue() )
393*cdf0e10cSrcweir 	{
394*cdf0e10cSrcweir 		nValue = GetCoreValue( aMtrFldLeft, eUnit );
395*cdf0e10cSrcweir 		rAttrs.Put( SdrTextLeftDistItem( nValue ) );
396*cdf0e10cSrcweir 	}
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir 	if( aMtrFldRight.GetText() != aMtrFldRight.GetSavedValue() )
399*cdf0e10cSrcweir 	{
400*cdf0e10cSrcweir 		nValue = GetCoreValue( aMtrFldRight, eUnit );
401*cdf0e10cSrcweir 		rAttrs.Put( SdrTextRightDistItem( nValue ) );
402*cdf0e10cSrcweir 	}
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir 	if( aMtrFldTop.GetText() != aMtrFldTop.GetSavedValue() )
405*cdf0e10cSrcweir 	{
406*cdf0e10cSrcweir 		nValue = GetCoreValue( aMtrFldTop, eUnit );
407*cdf0e10cSrcweir 		rAttrs.Put( SdrTextUpperDistItem( nValue ) );
408*cdf0e10cSrcweir 	}
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir 	if( aMtrFldBottom.GetText() != aMtrFldBottom.GetSavedValue() )
411*cdf0e10cSrcweir 	{
412*cdf0e10cSrcweir 		nValue = GetCoreValue( aMtrFldBottom, eUnit );
413*cdf0e10cSrcweir 		rAttrs.Put( SdrTextLowerDistItem( nValue ) );
414*cdf0e10cSrcweir 	}
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir 	eState = aTsbAutoGrowHeight.GetState();
417*cdf0e10cSrcweir 	if( eState != aTsbAutoGrowHeight.GetSavedValue() )
418*cdf0e10cSrcweir 	{
419*cdf0e10cSrcweir 		rAttrs.Put( SdrTextAutoGrowHeightItem( (sal_Bool) STATE_CHECK == eState ) );
420*cdf0e10cSrcweir 	}
421*cdf0e10cSrcweir 
422*cdf0e10cSrcweir 	eState = aTsbAutoGrowWidth.GetState();
423*cdf0e10cSrcweir 	if( eState != aTsbAutoGrowWidth.GetSavedValue() )
424*cdf0e10cSrcweir 	{
425*cdf0e10cSrcweir 		rAttrs.Put( SdrTextAutoGrowWidthItem( (sal_Bool) STATE_CHECK == eState ) );
426*cdf0e10cSrcweir 	}
427*cdf0e10cSrcweir 
428*cdf0e10cSrcweir 	eState = aTsbAutoGrowSize.GetState();
429*cdf0e10cSrcweir 	if( eState != aTsbAutoGrowSize.GetSavedValue() )
430*cdf0e10cSrcweir 	{
431*cdf0e10cSrcweir 		rAttrs.Put( SdrTextAutoGrowHeightItem( (sal_Bool) STATE_CHECK == eState ) );
432*cdf0e10cSrcweir 	}
433*cdf0e10cSrcweir 
434*cdf0e10cSrcweir 	eState = aTsbWordWrapText.GetState();
435*cdf0e10cSrcweir 	if( eState != aTsbWordWrapText.GetSavedValue() )
436*cdf0e10cSrcweir 	{
437*cdf0e10cSrcweir 		rAttrs.Put( SdrTextWordWrapItem( (sal_Bool) STATE_CHECK == eState ) );
438*cdf0e10cSrcweir 	}
439*cdf0e10cSrcweir 
440*cdf0e10cSrcweir 	// Konturfluss
441*cdf0e10cSrcweir 	eState = aTsbContour.GetState();
442*cdf0e10cSrcweir 	if( eState != aTsbContour.GetSavedValue() )
443*cdf0e10cSrcweir 	{
444*cdf0e10cSrcweir 		rAttrs.Put( SdrTextContourFrameItem( (sal_Bool) STATE_CHECK == eState ) );
445*cdf0e10cSrcweir 	}
446*cdf0e10cSrcweir 
447*cdf0e10cSrcweir 	eState = aTsbFitToSize.GetState();
448*cdf0e10cSrcweir 	if( eState != aTsbFitToSize.GetSavedValue() )
449*cdf0e10cSrcweir 	{
450*cdf0e10cSrcweir 		SdrFitToSizeType eFTS;
451*cdf0e10cSrcweir 		switch( eState )
452*cdf0e10cSrcweir 		{
453*cdf0e10cSrcweir             default: ; //prevent warning
454*cdf0e10cSrcweir 				DBG_ERROR( "svx::SvxTextAttrPage::FillItemSet(), unhandled state!" );
455*cdf0e10cSrcweir 			case STATE_NOCHECK: eFTS = SDRTEXTFIT_NONE; break;
456*cdf0e10cSrcweir 			//case STATE_CHECK: eFTS = SDRTEXTFIT_RESIZEATTR; break;
457*cdf0e10cSrcweir 			case STATE_CHECK: eFTS = SDRTEXTFIT_PROPORTIONAL; break;
458*cdf0e10cSrcweir 		}
459*cdf0e10cSrcweir 		rAttrs.Put( SdrTextFitToSizeTypeItem( eFTS ) );
460*cdf0e10cSrcweir 	}
461*cdf0e10cSrcweir 
462*cdf0e10cSrcweir 	// zentriert
463*cdf0e10cSrcweir 	RECT_POINT eRP = aCtlPosition.GetActualRP();
464*cdf0e10cSrcweir 	SdrTextVertAdjust eTVA, eOldTVA;
465*cdf0e10cSrcweir 	SdrTextHorzAdjust eTHA, eOldTHA;
466*cdf0e10cSrcweir 
467*cdf0e10cSrcweir 	switch( eRP )
468*cdf0e10cSrcweir 	{
469*cdf0e10cSrcweir 		default:
470*cdf0e10cSrcweir 		case RP_LT: eTVA = SDRTEXTVERTADJUST_TOP;
471*cdf0e10cSrcweir 					eTHA = SDRTEXTHORZADJUST_LEFT; break;
472*cdf0e10cSrcweir 		case RP_LM: eTVA = SDRTEXTVERTADJUST_CENTER;
473*cdf0e10cSrcweir 					eTHA = SDRTEXTHORZADJUST_LEFT; break;
474*cdf0e10cSrcweir 		case RP_LB: eTVA = SDRTEXTVERTADJUST_BOTTOM;
475*cdf0e10cSrcweir 					eTHA = SDRTEXTHORZADJUST_LEFT; break;
476*cdf0e10cSrcweir 		case RP_MT: eTVA = SDRTEXTVERTADJUST_TOP;
477*cdf0e10cSrcweir 					eTHA = SDRTEXTHORZADJUST_CENTER; break;
478*cdf0e10cSrcweir 		case RP_MM: eTVA = SDRTEXTVERTADJUST_CENTER;
479*cdf0e10cSrcweir 					eTHA = SDRTEXTHORZADJUST_CENTER; break;
480*cdf0e10cSrcweir 		case RP_MB: eTVA = SDRTEXTVERTADJUST_BOTTOM;
481*cdf0e10cSrcweir 					eTHA = SDRTEXTHORZADJUST_CENTER; break;
482*cdf0e10cSrcweir 		case RP_RT: eTVA = SDRTEXTVERTADJUST_TOP;
483*cdf0e10cSrcweir 					eTHA = SDRTEXTHORZADJUST_RIGHT; break;
484*cdf0e10cSrcweir 		case RP_RM: eTVA = SDRTEXTVERTADJUST_CENTER;
485*cdf0e10cSrcweir 					eTHA = SDRTEXTHORZADJUST_RIGHT; break;
486*cdf0e10cSrcweir 		case RP_RB: eTVA = SDRTEXTVERTADJUST_BOTTOM;
487*cdf0e10cSrcweir 					eTHA = SDRTEXTHORZADJUST_RIGHT; break;
488*cdf0e10cSrcweir 	}
489*cdf0e10cSrcweir 
490*cdf0e10cSrcweir 	// #103516# Do not change values if adjust controls were disabled.
491*cdf0e10cSrcweir 	sal_Bool bIsDisabled(aCtlPosition.IsCompletelyDisabled());
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir 	if(!bIsDisabled)
494*cdf0e10cSrcweir 	{
495*cdf0e10cSrcweir 		if( aTsbFullWidth.GetState() == STATE_CHECK )
496*cdf0e10cSrcweir 		{
497*cdf0e10cSrcweir 			if (IsTextDirectionLeftToRight())
498*cdf0e10cSrcweir 				eTHA = SDRTEXTHORZADJUST_BLOCK;
499*cdf0e10cSrcweir 			else
500*cdf0e10cSrcweir 				eTVA = SDRTEXTVERTADJUST_BLOCK;
501*cdf0e10cSrcweir 		}
502*cdf0e10cSrcweir 
503*cdf0e10cSrcweir 		if ( rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ) != SFX_ITEM_DONTCARE )
504*cdf0e10cSrcweir 		{
505*cdf0e10cSrcweir 			eOldTVA = (SdrTextVertAdjust)
506*cdf0e10cSrcweir 						( ( const SdrTextVertAdjustItem& )rOutAttrs.Get( SDRATTR_TEXT_VERTADJUST ) ).GetValue();
507*cdf0e10cSrcweir 			if( eOldTVA != eTVA )
508*cdf0e10cSrcweir 				rAttrs.Put( SdrTextVertAdjustItem( eTVA ) );
509*cdf0e10cSrcweir 		}
510*cdf0e10cSrcweir 		else
511*cdf0e10cSrcweir 			rAttrs.Put( SdrTextVertAdjustItem( eTVA ) );
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir 		if ( rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ) != SFX_ITEM_DONTCARE )
514*cdf0e10cSrcweir 		{
515*cdf0e10cSrcweir 			eOldTHA = (SdrTextHorzAdjust)
516*cdf0e10cSrcweir 						( ( const SdrTextHorzAdjustItem& )rOutAttrs.Get( SDRATTR_TEXT_HORZADJUST ) ).GetValue();
517*cdf0e10cSrcweir 			if( eOldTHA != eTHA )
518*cdf0e10cSrcweir 				rAttrs.Put( SdrTextHorzAdjustItem( eTHA ) );
519*cdf0e10cSrcweir 		}
520*cdf0e10cSrcweir 		else
521*cdf0e10cSrcweir 			rAttrs.Put( SdrTextHorzAdjustItem( eTHA ) );
522*cdf0e10cSrcweir 	}
523*cdf0e10cSrcweir 
524*cdf0e10cSrcweir 	return( sal_True );
525*cdf0e10cSrcweir }
526*cdf0e10cSrcweir 
527*cdf0e10cSrcweir /*************************************************************************
528*cdf0e10cSrcweir |*
529*cdf0e10cSrcweir |*
530*cdf0e10cSrcweir |*
531*cdf0e10cSrcweir \************************************************************************/
532*cdf0e10cSrcweir 
533*cdf0e10cSrcweir void SvxTextAttrPage::Construct()
534*cdf0e10cSrcweir {
535*cdf0e10cSrcweir 	DBG_ASSERT( pView, "Keine gueltige View Uebergeben!" );
536*cdf0e10cSrcweir 
537*cdf0e10cSrcweir 	bFitToSizeEnabled = bContourEnabled = sal_True;
538*cdf0e10cSrcweir 	bWordWrapTextEnabled = bAutoGrowSizeEnabled = bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = sal_False;
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir 	const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
541*cdf0e10cSrcweir 	if( rMarkList.GetMarkCount() == 1 )
542*cdf0e10cSrcweir 	{
543*cdf0e10cSrcweir 		const SdrObject* pObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
544*cdf0e10cSrcweir 		SdrObjKind eKind = (SdrObjKind) pObj->GetObjIdentifier();
545*cdf0e10cSrcweir 		if( pObj->GetObjInventor() == SdrInventor )
546*cdf0e10cSrcweir 		{
547*cdf0e10cSrcweir 			switch( eKind )
548*cdf0e10cSrcweir 			{
549*cdf0e10cSrcweir 				case OBJ_TEXT :
550*cdf0e10cSrcweir 				case OBJ_TITLETEXT :
551*cdf0e10cSrcweir 				case OBJ_OUTLINETEXT :
552*cdf0e10cSrcweir 				case OBJ_CAPTION :
553*cdf0e10cSrcweir 				{
554*cdf0e10cSrcweir 					if ( ((SdrTextObj*)pObj)->HasText() )
555*cdf0e10cSrcweir 					{
556*cdf0e10cSrcweir 						// Konturfluss ist NICHT bei reinen Textobjekten m�glich
557*cdf0e10cSrcweir 						bContourEnabled = sal_False;
558*cdf0e10cSrcweir 
559*cdf0e10cSrcweir 						// Breite und Hoehe anpassen ist NUR bei reinen Textobjekten m�glich
560*cdf0e10cSrcweir 						bAutoGrowWidthEnabled = bAutoGrowHeightEnabled = sal_True;
561*cdf0e10cSrcweir 					}
562*cdf0e10cSrcweir 				}
563*cdf0e10cSrcweir 				break;
564*cdf0e10cSrcweir 				case OBJ_CUSTOMSHAPE :
565*cdf0e10cSrcweir 				{
566*cdf0e10cSrcweir 					bFitToSizeEnabled = bContourEnabled = sal_False;
567*cdf0e10cSrcweir 					bAutoGrowSizeEnabled = sal_True;
568*cdf0e10cSrcweir 					bWordWrapTextEnabled = sal_True;
569*cdf0e10cSrcweir 				}
570*cdf0e10cSrcweir 				break;
571*cdf0e10cSrcweir                 default: ;//prevent warning
572*cdf0e10cSrcweir 			}
573*cdf0e10cSrcweir 		}
574*cdf0e10cSrcweir 	}
575*cdf0e10cSrcweir 	aTsbAutoGrowHeight.Enable( bAutoGrowHeightEnabled );
576*cdf0e10cSrcweir 	aTsbAutoGrowWidth.Enable( bAutoGrowWidthEnabled );
577*cdf0e10cSrcweir 	aTsbFitToSize.Enable( bFitToSizeEnabled );
578*cdf0e10cSrcweir 	aTsbContour.Enable( bContourEnabled );
579*cdf0e10cSrcweir 	aTsbAutoGrowSize.Enable( bAutoGrowSizeEnabled );
580*cdf0e10cSrcweir 	aTsbWordWrapText.Enable( bWordWrapTextEnabled );
581*cdf0e10cSrcweir }
582*cdf0e10cSrcweir 
583*cdf0e10cSrcweir /*************************************************************************
584*cdf0e10cSrcweir |*
585*cdf0e10cSrcweir |* Erzeugt die Seite
586*cdf0e10cSrcweir |*
587*cdf0e10cSrcweir \************************************************************************/
588*cdf0e10cSrcweir 
589*cdf0e10cSrcweir SfxTabPage* SvxTextAttrPage::Create( Window* pWindow,
590*cdf0e10cSrcweir 				const SfxItemSet& rAttrs )
591*cdf0e10cSrcweir {
592*cdf0e10cSrcweir 	return( new SvxTextAttrPage( pWindow, rAttrs ) );
593*cdf0e10cSrcweir }
594*cdf0e10cSrcweir 
595*cdf0e10cSrcweir /*************************************************************************
596*cdf0e10cSrcweir |*
597*cdf0e10cSrcweir |*
598*cdf0e10cSrcweir |*
599*cdf0e10cSrcweir \************************************************************************/
600*cdf0e10cSrcweir 
601*cdf0e10cSrcweir sal_uInt16*	SvxTextAttrPage::GetRanges()
602*cdf0e10cSrcweir {
603*cdf0e10cSrcweir 	return( pRanges );
604*cdf0e10cSrcweir }
605*cdf0e10cSrcweir 
606*cdf0e10cSrcweir /*************************************************************************
607*cdf0e10cSrcweir |*
608*cdf0e10cSrcweir |*
609*cdf0e10cSrcweir |*
610*cdf0e10cSrcweir \************************************************************************/
611*cdf0e10cSrcweir 
612*cdf0e10cSrcweir /** Check whether we have to uncheck the "Full width" check box.
613*cdf0e10cSrcweir */
614*cdf0e10cSrcweir void SvxTextAttrPage::PointChanged( Window*, RECT_POINT eRP )
615*cdf0e10cSrcweir {
616*cdf0e10cSrcweir     if (aTsbFullWidth.GetState() == STATE_CHECK)
617*cdf0e10cSrcweir     {
618*cdf0e10cSrcweir         // Depending on write direction and currently checked anchor we have
619*cdf0e10cSrcweir         // to uncheck the "full width" button.
620*cdf0e10cSrcweir         if (IsTextDirectionLeftToRight())
621*cdf0e10cSrcweir             switch( eRP )
622*cdf0e10cSrcweir             {
623*cdf0e10cSrcweir                 case RP_LT:
624*cdf0e10cSrcweir                 case RP_LM:
625*cdf0e10cSrcweir                 case RP_LB:
626*cdf0e10cSrcweir                 case RP_RT:
627*cdf0e10cSrcweir                 case RP_RM:
628*cdf0e10cSrcweir                 case RP_RB:
629*cdf0e10cSrcweir                     aTsbFullWidth.SetState( STATE_NOCHECK );
630*cdf0e10cSrcweir                 break;
631*cdf0e10cSrcweir                 default: ;//prevent warning
632*cdf0e10cSrcweir             }
633*cdf0e10cSrcweir         else
634*cdf0e10cSrcweir             switch (eRP)
635*cdf0e10cSrcweir             {
636*cdf0e10cSrcweir                 case RP_LT:
637*cdf0e10cSrcweir                 case RP_MT:
638*cdf0e10cSrcweir                 case RP_RT:
639*cdf0e10cSrcweir                 case RP_LB:
640*cdf0e10cSrcweir                 case RP_MB:
641*cdf0e10cSrcweir                 case RP_RB:
642*cdf0e10cSrcweir                     aTsbFullWidth.SetState( STATE_NOCHECK );
643*cdf0e10cSrcweir                 break;
644*cdf0e10cSrcweir                 default: ;//prevent warning
645*cdf0e10cSrcweir             }
646*cdf0e10cSrcweir 	}
647*cdf0e10cSrcweir }
648*cdf0e10cSrcweir 
649*cdf0e10cSrcweir /*************************************************************************
650*cdf0e10cSrcweir |*
651*cdf0e10cSrcweir |* Aendert evtl. die Position des Positions-Controls
652*cdf0e10cSrcweir |*
653*cdf0e10cSrcweir \************************************************************************/
654*cdf0e10cSrcweir 
655*cdf0e10cSrcweir /** When switching the "full width" check button on the text anchor may have
656*cdf0e10cSrcweir     to be moved to a valid and adjacent position.  This position depends on
657*cdf0e10cSrcweir     the current anchor position and the text writing direction.
658*cdf0e10cSrcweir */
659*cdf0e10cSrcweir IMPL_LINK( SvxTextAttrPage, ClickFullWidthHdl_Impl, void *, EMPTYARG )
660*cdf0e10cSrcweir {
661*cdf0e10cSrcweir 	if( aTsbFullWidth.GetState() == STATE_CHECK )
662*cdf0e10cSrcweir 	{
663*cdf0e10cSrcweir         if (IsTextDirectionLeftToRight())
664*cdf0e10cSrcweir         {
665*cdf0e10cSrcweir             // Move text anchor to horizontal middle axis.
666*cdf0e10cSrcweir             switch( aCtlPosition.GetActualRP() )
667*cdf0e10cSrcweir             {
668*cdf0e10cSrcweir                 case RP_LT:
669*cdf0e10cSrcweir                 case RP_RT:
670*cdf0e10cSrcweir                     aCtlPosition.SetActualRP( RP_MT );
671*cdf0e10cSrcweir                     break;
672*cdf0e10cSrcweir 
673*cdf0e10cSrcweir                 case RP_LM:
674*cdf0e10cSrcweir                 case RP_RM:
675*cdf0e10cSrcweir                     aCtlPosition.SetActualRP( RP_MM );
676*cdf0e10cSrcweir                     break;
677*cdf0e10cSrcweir 
678*cdf0e10cSrcweir                 case RP_LB:
679*cdf0e10cSrcweir                 case RP_RB:
680*cdf0e10cSrcweir                     aCtlPosition.SetActualRP( RP_MB );
681*cdf0e10cSrcweir                     break;
682*cdf0e10cSrcweir                 default: ;//prevent warning
683*cdf0e10cSrcweir             }
684*cdf0e10cSrcweir         }
685*cdf0e10cSrcweir         else
686*cdf0e10cSrcweir         {
687*cdf0e10cSrcweir             // Move text anchor to vertical middle axis.
688*cdf0e10cSrcweir             switch( aCtlPosition.GetActualRP() )
689*cdf0e10cSrcweir             {
690*cdf0e10cSrcweir                 case RP_LT:
691*cdf0e10cSrcweir                 case RP_LB:
692*cdf0e10cSrcweir                     aCtlPosition.SetActualRP( RP_LM );
693*cdf0e10cSrcweir                     break;
694*cdf0e10cSrcweir 
695*cdf0e10cSrcweir                 case RP_MT:
696*cdf0e10cSrcweir                 case RP_MB:
697*cdf0e10cSrcweir                     aCtlPosition.SetActualRP( RP_MM );
698*cdf0e10cSrcweir                     break;
699*cdf0e10cSrcweir 
700*cdf0e10cSrcweir                 case RP_RT:
701*cdf0e10cSrcweir                 case RP_RB:
702*cdf0e10cSrcweir                     aCtlPosition.SetActualRP( RP_RM );
703*cdf0e10cSrcweir                 break;
704*cdf0e10cSrcweir                 default: ;//prevent warning
705*cdf0e10cSrcweir             }
706*cdf0e10cSrcweir         }
707*cdf0e10cSrcweir 	}
708*cdf0e10cSrcweir 	return( 0L );
709*cdf0e10cSrcweir }
710*cdf0e10cSrcweir 
711*cdf0e10cSrcweir /*************************************************************************
712*cdf0e10cSrcweir |*
713*cdf0e10cSrcweir |* Enabled/Disabled "Groesse an Text" oder "Am Rahmen Anpassen"
714*cdf0e10cSrcweir |*
715*cdf0e10cSrcweir \************************************************************************/
716*cdf0e10cSrcweir 
717*cdf0e10cSrcweir IMPL_LINK( SvxTextAttrPage, ClickHdl_Impl, void *, EMPTYARG )
718*cdf0e10cSrcweir {
719*cdf0e10cSrcweir 	sal_Bool bAutoGrowWidth  = aTsbAutoGrowWidth.GetState() == STATE_CHECK;
720*cdf0e10cSrcweir 	sal_Bool bAutoGrowHeight = aTsbAutoGrowHeight.GetState() == STATE_CHECK;
721*cdf0e10cSrcweir 	sal_Bool bFitToSize 	 = aTsbFitToSize.GetState() == STATE_CHECK;
722*cdf0e10cSrcweir 	sal_Bool bContour		 = aTsbContour.GetState() == STATE_CHECK;
723*cdf0e10cSrcweir 
724*cdf0e10cSrcweir 	aTsbContour.Enable( !bFitToSize &&
725*cdf0e10cSrcweir 						!( ( bAutoGrowWidth && bAutoGrowWidthEnabled ) || ( bAutoGrowHeight && bAutoGrowHeightEnabled ) ) &&
726*cdf0e10cSrcweir 						bContourEnabled );
727*cdf0e10cSrcweir 
728*cdf0e10cSrcweir 	aTsbAutoGrowWidth.Enable( !bFitToSize &&
729*cdf0e10cSrcweir 							  !( bContour && bContourEnabled ) &&
730*cdf0e10cSrcweir 							  bAutoGrowWidthEnabled );
731*cdf0e10cSrcweir 
732*cdf0e10cSrcweir 	aTsbAutoGrowHeight.Enable( !bFitToSize &&
733*cdf0e10cSrcweir 							   !( bContour && bContourEnabled ) &&
734*cdf0e10cSrcweir 							   bAutoGrowHeightEnabled );
735*cdf0e10cSrcweir 
736*cdf0e10cSrcweir 	aTsbFitToSize.Enable( !( ( bAutoGrowWidth && bAutoGrowWidthEnabled ) || ( bAutoGrowHeight && bAutoGrowHeightEnabled ) ) &&
737*cdf0e10cSrcweir 						  !( bContour && bContourEnabled ) &&
738*cdf0e10cSrcweir 						  bFitToSizeEnabled );
739*cdf0e10cSrcweir 
740*cdf0e10cSrcweir 	// #101901# enable/disable metric fields and decorations dependent of contour
741*cdf0e10cSrcweir     aMtrFldLeft.Enable(!bContour);
742*cdf0e10cSrcweir     aMtrFldRight.Enable(!bContour);
743*cdf0e10cSrcweir     aMtrFldTop.Enable(!bContour);
744*cdf0e10cSrcweir     aMtrFldBottom.Enable(!bContour);
745*cdf0e10cSrcweir     aFlDistance.Enable(!bContour);
746*cdf0e10cSrcweir     aFtLeft.Enable(!bContour);
747*cdf0e10cSrcweir     aFtRight.Enable(!bContour);
748*cdf0e10cSrcweir     aFtTop.Enable(!bContour);
749*cdf0e10cSrcweir     aFtBottom.Enable(!bContour);
750*cdf0e10cSrcweir 
751*cdf0e10cSrcweir 	if( bContour && bContourEnabled )
752*cdf0e10cSrcweir 	{
753*cdf0e10cSrcweir 		aMtrFldLeft.SetValue( 0 );
754*cdf0e10cSrcweir 		aMtrFldRight.SetValue( 0 );
755*cdf0e10cSrcweir 		aMtrFldTop.SetValue( 0 );
756*cdf0e10cSrcweir 		aMtrFldBottom.SetValue( 0 );
757*cdf0e10cSrcweir 	}
758*cdf0e10cSrcweir 
759*cdf0e10cSrcweir 	// #103516# Do the setup based on states of hor/ver adjust
760*cdf0e10cSrcweir 	SfxItemState eVState = rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST );
761*cdf0e10cSrcweir 	SfxItemState eHState = rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
762*cdf0e10cSrcweir 	sal_Bool bHorAndVer(SFX_ITEM_DONTCARE == eVState || SFX_ITEM_DONTCARE == eHState);
763*cdf0e10cSrcweir 
764*cdf0e10cSrcweir 	// #83698# enable/disable text anchoring dependent of contour
765*cdf0e10cSrcweir 	aCtlPosition.Enable(!bContour && !bHorAndVer);
766*cdf0e10cSrcweir 	aTsbFullWidth.Enable(!bContour && !bHorAndVer);
767*cdf0e10cSrcweir 	aFlPosition.Enable(!bContour && !bHorAndVer);
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir 	return( 0L );
770*cdf0e10cSrcweir }
771*cdf0e10cSrcweir 
772*cdf0e10cSrcweir 
773*cdf0e10cSrcweir bool SvxTextAttrPage::IsTextDirectionLeftToRight (void) const
774*cdf0e10cSrcweir {
775*cdf0e10cSrcweir     // Determine the text writing direction with left to right as default.
776*cdf0e10cSrcweir     bool bLeftToRightDirection = true;
777*cdf0e10cSrcweir 	SfxItemState eState = rOutAttrs.GetItemState(SDRATTR_TEXTDIRECTION);
778*cdf0e10cSrcweir 
779*cdf0e10cSrcweir     if(SFX_ITEM_DONTCARE != eState)
780*cdf0e10cSrcweir     {
781*cdf0e10cSrcweir         const SvxWritingModeItem& rItem = static_cast<const SvxWritingModeItem&> (
782*cdf0e10cSrcweir             rOutAttrs.Get (SDRATTR_TEXTDIRECTION));
783*cdf0e10cSrcweir         if (rItem.GetValue() == com::sun::star::text::WritingMode_TB_RL)
784*cdf0e10cSrcweir             bLeftToRightDirection = false;
785*cdf0e10cSrcweir     }
786*cdf0e10cSrcweir     return bLeftToRightDirection;
787*cdf0e10cSrcweir }
788*cdf0e10cSrcweir 
789*cdf0e10cSrcweir //add CHINA001 begin
790*cdf0e10cSrcweir void SvxTextAttrPage::PageCreated(SfxAllItemSet aSet)
791*cdf0e10cSrcweir {
792*cdf0e10cSrcweir 	SFX_ITEMSET_ARG (&aSet,pViewItem,OfaPtrItem,SID_SVXTEXTATTRPAGE_VIEW,sal_False);
793*cdf0e10cSrcweir 
794*cdf0e10cSrcweir 	if (pViewItem)
795*cdf0e10cSrcweir 		SetView( static_cast<SdrView *>(pViewItem->GetValue()));
796*cdf0e10cSrcweir 
797*cdf0e10cSrcweir 	Construct();
798*cdf0e10cSrcweir }
799*cdf0e10cSrcweir 
800*cdf0e10cSrcweir //end of CHINA001
801