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