LibreOffice Module cui (master)  1
textattr.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <svx/svddef.hxx>
21 #include <svx/sdasitm.hxx>
22 #include <svx/sdtditm.hxx>
23 #include <svx/sdtagitm.hxx>
24 #include <svx/sdtaitm.hxx>
25 #include <svx/sdtfsitm.hxx>
26 #include <svx/sdtcfitm.hxx>
27 #include <svx/svdobj.hxx>
28 #include <svx/svxids.hrc>
29 
30 #include <textattr.hxx>
31 #include <svx/dlgutil.hxx>
33 #include <svtools/unitconv.hxx>
34 
35 using namespace ::com::sun::star;
36 
37 const sal_uInt16 SvxTextAttrPage::pRanges[] =
38 {
42  , SDRATTR_TEXT_WORDWRAP
43  , 0
44 };
45 
46 /*************************************************************************
47 |*
48 |* dialog (page) for copying objects
49 |*
50 \************************************************************************/
52  : SvxTabPage(pPage, pController, "cui/ui/textattrtabpage.ui", "TextAttributesPage", rInAttrs)
53  , rOutAttrs(rInAttrs)
54  , m_eObjKind(OBJ_NONE)
55  , bAutoGrowSizeEnabled(false)
56  , bContourEnabled(false)
57  , bAutoGrowWidthEnabled(false)
58  , bAutoGrowHeightEnabled(false)
59  , bWordWrapTextEnabled(false)
60  , bFitToSizeEnabled(false)
61  , m_aCtlPosition(this)
62  , m_xDrawingText(m_xBuilder->weld_widget("drawingtext"))
63  , m_xCustomShapeText(m_xBuilder->weld_widget("customshapetext"))
64  , m_xTsbAutoGrowWidth(m_xBuilder->weld_check_button("TSB_AUTOGROW_WIDTH"))
65  , m_xTsbAutoGrowHeight(m_xBuilder->weld_check_button("TSB_AUTOGROW_HEIGHT"))
66  , m_xTsbFitToSize(m_xBuilder->weld_check_button("TSB_FIT_TO_SIZE"))
67  , m_xTsbContour(m_xBuilder->weld_check_button("TSB_CONTOUR"))
68  , m_xTsbWordWrapText(m_xBuilder->weld_check_button("TSB_WORDWRAP_TEXT"))
69  , m_xTsbAutoGrowSize(m_xBuilder->weld_check_button("TSB_AUTOGROW_SIZE"))
70  , m_xFlDistance(m_xBuilder->weld_frame("FL_DISTANCE"))
71  , m_xMtrFldLeft(m_xBuilder->weld_metric_spin_button("MTR_FLD_LEFT", FieldUnit::CM))
72  , m_xMtrFldRight(m_xBuilder->weld_metric_spin_button("MTR_FLD_RIGHT", FieldUnit::CM))
73  , m_xMtrFldTop(m_xBuilder->weld_metric_spin_button("MTR_FLD_TOP", FieldUnit::CM))
74  , m_xMtrFldBottom(m_xBuilder->weld_metric_spin_button("MTR_FLD_BOTTOM", FieldUnit::CM))
75  , m_xFlPosition(m_xBuilder->weld_frame("FL_POSITION"))
76  , m_xCtlPosition(new weld::CustomWeld(*m_xBuilder, "CTL_POSITION", m_aCtlPosition))
77  , m_xTsbFullWidth(m_xBuilder->weld_check_button("TSB_FULL_WIDTH"))
78 {
79  m_aCtlPosition.SetControlSettings(RectPoint::MM, 240);
80 
81  FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs );
82  SetFieldUnit( *m_xMtrFldLeft, eFUnit );
83  SetFieldUnit( *m_xMtrFldRight, eFUnit );
84  SetFieldUnit( *m_xMtrFldTop, eFUnit );
85  SetFieldUnit( *m_xMtrFldBottom, eFUnit );
86 
87  Link<weld::Button&,void> aLink( LINK( this, SvxTextAttrPage, ClickHdl_Impl ) );
88  m_xTsbAutoGrowWidth->connect_clicked( aLink );
89  m_xTsbAutoGrowHeight->connect_clicked( aLink );
90  m_xTsbAutoGrowSize->connect_clicked( aLink );
91  m_xTsbFitToSize->connect_clicked( aLink );
92  m_xTsbContour->connect_clicked( aLink );
93 
94  m_xTsbFullWidth->connect_clicked(LINK( this, SvxTextAttrPage, ClickFullWidthHdl_Impl ) );
95 }
96 
98 {
99 }
100 
101 /*************************************************************************
102 |*
103 |* reads the passed item set
104 |*
105 \************************************************************************/
106 
107 void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
108 {
109  SfxItemPool* pPool = rAttrs->GetPool();
110  DBG_ASSERT( pPool, "Where is the pool?" );
111  MapUnit eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST );
112 
113  const SfxPoolItem* pItem = GetItem( *rAttrs, SDRATTR_TEXT_LEFTDIST );
114  if( !pItem )
115  pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LEFTDIST );
116 
117  SetMetricValue(*m_xMtrFldLeft, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
118  m_xMtrFldLeft->save_value();
119 
120  pItem = GetItem( *rAttrs, SDRATTR_TEXT_RIGHTDIST );
121  if( !pItem )
122  pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_RIGHTDIST );
123 
124  SetMetricValue(*m_xMtrFldRight, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
125  m_xMtrFldRight->save_value();
126 
127  pItem = GetItem( *rAttrs, SDRATTR_TEXT_UPPERDIST );
128  if( !pItem )
129  pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_UPPERDIST );
130 
131  SetMetricValue(*m_xMtrFldTop, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
132  m_xMtrFldTop->save_value();
133 
134  pItem = GetItem( *rAttrs, SDRATTR_TEXT_LOWERDIST );
135  if( !pItem )
136  pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LOWERDIST );
137 
138  SetMetricValue(*m_xMtrFldBottom, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
139  m_xMtrFldBottom->save_value();
140 
141  // adjust to height and autogrowsize
142  if ( rAttrs->GetItemState( SDRATTR_TEXT_AUTOGROWHEIGHT ) != SfxItemState::DONTCARE )
143  {
146 
147  m_xTsbAutoGrowSize->set_state( rAttrs->Get( SDRATTR_TEXT_AUTOGROWHEIGHT ).
149  }
150  else
151  {
152  m_xTsbAutoGrowHeight->set_state( TRISTATE_INDET );
153  m_xTsbAutoGrowSize->set_state( TRISTATE_INDET );
154  }
155  m_xTsbAutoGrowHeight->save_state();
156  m_xTsbAutoGrowSize->save_state();
157 
158  // adjust to width
159  if ( rAttrs->GetItemState( SDRATTR_TEXT_AUTOGROWWIDTH ) != SfxItemState::DONTCARE )
160  {
161  m_xTsbAutoGrowWidth->set_state( rAttrs->Get( SDRATTR_TEXT_AUTOGROWWIDTH ).
163  }
164  else
165  m_xTsbAutoGrowWidth->set_state( TRISTATE_INDET );
166  m_xTsbAutoGrowWidth->save_state();
167 
168  // wordwrap text
169  if ( rAttrs->GetItemState( SDRATTR_TEXT_WORDWRAP ) != SfxItemState::DONTCARE )
170  {
171  m_xTsbWordWrapText->set_state( rAttrs->Get( SDRATTR_TEXT_WORDWRAP ).
173  }
174  else
175  m_xTsbWordWrapText->set_state( TRISTATE_INDET );
176  m_xTsbWordWrapText->save_state();
177 
178 
179  // #103516# Do the setup based on states of hor/ver adjust
180  // Setup center field and FullWidth
183 
184  if(SfxItemState::DONTCARE != eVState && SfxItemState::DONTCARE != eHState)
185  {
186  // VertAdjust and HorAdjust are unequivocal, thus
187  SdrTextVertAdjust eTVA = rAttrs->Get(SDRATTR_TEXT_VERTADJUST).GetValue();
188  SdrTextHorzAdjust eTHA = rAttrs->Get(SDRATTR_TEXT_HORZADJUST).GetValue();
189  RectPoint eRP = RectPoint::LB;
190 
191  if (m_xTsbFullWidth->get_state() == TRISTATE_INDET)
192  m_xTsbFullWidth->set_state(TRISTATE_FALSE);
193 
194  // Translate item values into local anchor position.
195  switch (eTVA)
196  {
198  {
199  switch (eTHA)
200  {
201  case SDRTEXTHORZADJUST_LEFT: eRP = RectPoint::LT; break;
203  case SDRTEXTHORZADJUST_CENTER: eRP = RectPoint::MT; break;
204  case SDRTEXTHORZADJUST_RIGHT: eRP = RectPoint::RT; break;
205  }
206  break;
207  }
210  {
211  switch (eTHA)
212  {
213  case SDRTEXTHORZADJUST_LEFT: eRP = RectPoint::LM; break;
215  case SDRTEXTHORZADJUST_CENTER: eRP = RectPoint::MM; break;
216  case SDRTEXTHORZADJUST_RIGHT: eRP = RectPoint::RM; break;
217  }
218  break;
219  }
221  {
222  switch (eTHA)
223  {
224  case SDRTEXTHORZADJUST_LEFT: eRP = RectPoint::LB; break;
226  case SDRTEXTHORZADJUST_CENTER: eRP = RectPoint::MB; break;
227  case SDRTEXTHORZADJUST_RIGHT: eRP = RectPoint::RB; break;
228  }
229  break;
230  }
231  default:
232  break;
233  }
234 
235  // See if we have to check the "full width" check button.
236  bool bLeftToRight(IsTextDirectionLeftToRight());
237 
238  if((bLeftToRight && (SDRTEXTHORZADJUST_BLOCK == eTHA)) || (!bLeftToRight && (SDRTEXTVERTADJUST_BLOCK == eTVA)))
239  {
240  // Move anchor to valid position.
241  ClickFullWidthHdl_Impl(*m_xTsbFullWidth);
242  m_xTsbFullWidth->set_state(TRISTATE_TRUE);
243  }
244 
246  }
247  else
248  {
249  // VertAdjust or HorAdjust is not unequivocal
251 
252  m_aCtlPosition.SetState(CTL_STATE::NOVERT);
254 
255  m_xTsbFullWidth->set_state(TRISTATE_INDET);
256  m_xFlPosition->set_sensitive( false );
257  }
258 
259  // adjust to border
260  if (rAttrs->GetItemState(SDRATTR_TEXT_FITTOSIZE) != SfxItemState::DONTCARE)
261  {
262  drawing::TextFitToSizeType const eFTS =
263  rAttrs->Get( SDRATTR_TEXT_FITTOSIZE ).GetValue();
264  if (eFTS == drawing::TextFitToSizeType_AUTOFIT || eFTS == drawing::TextFitToSizeType_NONE)
265  m_xTsbFitToSize->set_state( TRISTATE_FALSE );
266  else
267  m_xTsbFitToSize->set_state( TRISTATE_TRUE );
268  }
269  else
270  m_xTsbFitToSize->set_state( TRISTATE_INDET );
271  m_xTsbFitToSize->save_state();
272 
273  if( rAttrs->GetItemState( SDRATTR_TEXT_CONTOURFRAME ) != SfxItemState::DONTCARE )
274  {
275  bool bContour = rAttrs->Get( SDRATTR_TEXT_CONTOURFRAME ).GetValue();
276  m_xTsbContour->set_state( bContour ? TRISTATE_TRUE : TRISTATE_FALSE );
277  }
278  else
279  m_xTsbContour->set_state( TRISTATE_INDET );
280  m_xTsbContour->save_state();
281 
282  ClickHdl_Impl(*m_xTsbContour);
283 }
284 
285 /*************************************************************************
286 |*
287 |* fills the passed item set with dialog box attributes
288 |*
289 \************************************************************************/
290 
292 {
293  SfxItemPool* pPool = rAttrs->GetPool();
294  DBG_ASSERT( pPool, "Where is the pool?" );
295  MapUnit eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST );
296 
297  sal_Int32 nValue;
298  TriState eState;
299 
300  if( m_xMtrFldLeft->get_value_changed_from_saved() )
301  {
302  nValue = GetCoreValue( *m_xMtrFldLeft, eUnit );
303  rAttrs->Put( makeSdrTextLeftDistItem( nValue ) );
304  }
305 
306  if( m_xMtrFldRight->get_value_changed_from_saved() )
307  {
308  nValue = GetCoreValue( *m_xMtrFldRight, eUnit );
309  rAttrs->Put( makeSdrTextRightDistItem( nValue ) );
310  }
311 
312  if( m_xMtrFldTop->get_value_changed_from_saved() )
313  {
314  nValue = GetCoreValue( *m_xMtrFldTop, eUnit );
315  rAttrs->Put( makeSdrTextUpperDistItem( nValue ) );
316  }
317 
318  if( m_xMtrFldBottom->get_value_changed_from_saved() )
319  {
320  nValue = GetCoreValue( *m_xMtrFldBottom, eUnit );
321  rAttrs->Put( makeSdrTextLowerDistItem( nValue ) );
322  }
323 
324  eState = m_xTsbAutoGrowHeight->get_state();
325  if( m_xTsbAutoGrowHeight->get_state_changed_from_saved() )
326  {
327  rAttrs->Put( makeSdrTextAutoGrowHeightItem( TRISTATE_TRUE == eState ) );
328  }
329 
330  eState = m_xTsbAutoGrowWidth->get_state();
331  if( m_xTsbAutoGrowWidth->get_state_changed_from_saved() )
332  {
333  rAttrs->Put( makeSdrTextAutoGrowWidthItem( TRISTATE_TRUE == eState ) );
334  }
335 
336  eState = m_xTsbAutoGrowSize->get_state();
337  if( m_xTsbAutoGrowSize->get_state_changed_from_saved() )
338  {
339  rAttrs->Put( makeSdrTextAutoGrowHeightItem( TRISTATE_TRUE == eState ) );
340  }
341 
342  eState = m_xTsbWordWrapText->get_state();
343  if( m_xTsbWordWrapText->get_state_changed_from_saved() )
344  {
345  rAttrs->Put( makeSdrTextWordWrapItem( TRISTATE_TRUE == eState ) );
346  }
347 
348  eState = m_xTsbContour->get_state();
349  if( m_xTsbContour->get_state_changed_from_saved() )
350  {
351  rAttrs->Put( makeSdrTextContourFrameItem( TRISTATE_TRUE == eState ) );
352  }
353 
354  eState = m_xTsbFitToSize->get_state();
355  if( m_xTsbFitToSize->get_state_changed_from_saved() )
356  {
357  drawing::TextFitToSizeType eFTS;
358  switch( eState )
359  {
360  default: ; //prevent warning
361  OSL_FAIL( "svx::SvxTextAttrPage::FillItemSet(), unhandled state!" );
362  [[fallthrough]];
363  case TRISTATE_FALSE: eFTS = drawing::TextFitToSizeType_AUTOFIT; break;
364  case TRISTATE_TRUE: eFTS = drawing::TextFitToSizeType_PROPORTIONAL; break;
365  }
366  rAttrs->Put( SdrTextFitToSizeTypeItem( eFTS ) );
367  }
368 
369  // centered
371  SdrTextVertAdjust eTVA, eOldTVA;
372  SdrTextHorzAdjust eTHA, eOldTHA;
373 
374  switch( eRP )
375  {
376  default:
377  case RectPoint::LT: eTVA = SDRTEXTVERTADJUST_TOP;
378  eTHA = SDRTEXTHORZADJUST_LEFT; break;
379  case RectPoint::LM: eTVA = SDRTEXTVERTADJUST_CENTER;
380  eTHA = SDRTEXTHORZADJUST_LEFT; break;
381  case RectPoint::LB: eTVA = SDRTEXTVERTADJUST_BOTTOM;
382  eTHA = SDRTEXTHORZADJUST_LEFT; break;
383  case RectPoint::MT: eTVA = SDRTEXTVERTADJUST_TOP;
384  eTHA = SDRTEXTHORZADJUST_CENTER; break;
385  case RectPoint::MM: eTVA = SDRTEXTVERTADJUST_CENTER;
386  eTHA = SDRTEXTHORZADJUST_CENTER; break;
387  case RectPoint::MB: eTVA = SDRTEXTVERTADJUST_BOTTOM;
388  eTHA = SDRTEXTHORZADJUST_CENTER; break;
389  case RectPoint::RT: eTVA = SDRTEXTVERTADJUST_TOP;
390  eTHA = SDRTEXTHORZADJUST_RIGHT; break;
391  case RectPoint::RM: eTVA = SDRTEXTVERTADJUST_CENTER;
392  eTHA = SDRTEXTHORZADJUST_RIGHT; break;
393  case RectPoint::RB: eTVA = SDRTEXTVERTADJUST_BOTTOM;
394  eTHA = SDRTEXTHORZADJUST_RIGHT; break;
395  }
396 
397  // #103516# Do not change values if adjust controls were disabled.
398  bool bIsDisabled(m_aCtlPosition.IsCompletelyDisabled());
399 
400  if(!bIsDisabled)
401  {
402  if( m_xTsbFullWidth->get_state() == TRISTATE_TRUE )
403  {
406  else
408  }
409 
410  if ( rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST ) != SfxItemState::DONTCARE )
411  {
412  eOldTVA = rOutAttrs.Get( SDRATTR_TEXT_VERTADJUST ).GetValue();
413  if( eOldTVA != eTVA )
414  rAttrs->Put( SdrTextVertAdjustItem( eTVA ) );
415  }
416  else
417  rAttrs->Put( SdrTextVertAdjustItem( eTVA ) );
418 
419  if ( rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST ) != SfxItemState::DONTCARE )
420  {
421  eOldTHA = rOutAttrs.Get( SDRATTR_TEXT_HORZADJUST ).GetValue();
422  if( eOldTHA != eTHA )
423  rAttrs->Put( SdrTextHorzAdjustItem( eTHA ) );
424  }
425  else
426  rAttrs->Put( SdrTextHorzAdjustItem( eTHA ) );
427  }
428 
429  return true;
430 }
431 
433 {
434  switch (m_eObjKind)
435  {
436  case OBJ_NONE:
437  // indeterminate, show them all
440  m_xCustomShapeText->show();
441  m_xDrawingText->show();
442  break;
443  case OBJ_TEXT:
444  case OBJ_TITLETEXT:
445  case OBJ_OUTLINETEXT:
446  case OBJ_CAPTION:
447  // contour NOT possible for pure text objects
449 
450  // adjusting width and height is ONLY possible for pure text objects
452  m_xCustomShapeText->hide();
453  m_xDrawingText->show();
454  break;
455  case OBJ_CUSTOMSHAPE:
458  m_xDrawingText->hide();
459  m_xCustomShapeText->show();
460  break;
461  default:
464  m_xCustomShapeText->hide();
465  m_xDrawingText->show();
466  break;
467  }
468 
471  m_xTsbFitToSize->set_visible( bFitToSizeEnabled );
472  m_xTsbContour->set_visible( bContourEnabled );
475 }
476 
477 std::unique_ptr<SfxTabPage> SvxTextAttrPage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rAttrs)
478 {
479  return std::make_unique<SvxTextAttrPage>(pPage, pController, *rAttrs);
480 }
481 
485 {
486  if (m_xTsbFullWidth->get_state() == TRISTATE_TRUE)
487  {
488  // Depending on write direction and currently checked anchor we have
489  // to uncheck the "full width" button.
491  switch( eRP )
492  {
493  case RectPoint::LT:
494  case RectPoint::LM:
495  case RectPoint::LB:
496  case RectPoint::RT:
497  case RectPoint::RM:
498  case RectPoint::RB:
499  m_xTsbFullWidth->set_state( TRISTATE_FALSE );
500  break;
501  default: ;//prevent warning
502  }
503  else
504  switch (eRP)
505  {
506  case RectPoint::LT:
507  case RectPoint::MT:
508  case RectPoint::RT:
509  case RectPoint::LB:
510  case RectPoint::MB:
511  case RectPoint::RB:
512  m_xTsbFullWidth->set_state( TRISTATE_FALSE );
513  break;
514  default: ;//prevent warning
515  }
516  }
517 }
518 
519 
520 /*************************************************************************
521 |*
522 |* possibly changes the position of the position-control
523 |*
524 \************************************************************************/
525 
530 IMPL_LINK_NOARG(SvxTextAttrPage, ClickFullWidthHdl_Impl, weld::Button&, void)
531 {
532  if( m_xTsbFullWidth->get_state() == TRISTATE_TRUE )
533  {
534  if (IsTextDirectionLeftToRight())
535  {
536  // Move text anchor to horizontal middle axis.
537  switch( m_aCtlPosition.GetActualRP() )
538  {
539  case RectPoint::LT:
540  case RectPoint::RT:
541  m_aCtlPosition.SetActualRP( RectPoint::MT );
542  break;
543 
544  case RectPoint::LM:
545  case RectPoint::RM:
546  m_aCtlPosition.SetActualRP( RectPoint::MM );
547  break;
548 
549  case RectPoint::LB:
550  case RectPoint::RB:
551  m_aCtlPosition.SetActualRP( RectPoint::MB );
552  break;
553  default: ;//prevent warning
554  }
555  }
556  else
557  {
558  // Move text anchor to vertical middle axis.
559  switch( m_aCtlPosition.GetActualRP() )
560  {
561  case RectPoint::LT:
562  case RectPoint::LB:
563  m_aCtlPosition.SetActualRP( RectPoint::LM );
564  break;
565 
566  case RectPoint::MT:
567  case RectPoint::MB:
568  m_aCtlPosition.SetActualRP( RectPoint::MM );
569  break;
570 
571  case RectPoint::RT:
572  case RectPoint::RB:
573  m_aCtlPosition.SetActualRP( RectPoint::RM );
574  break;
575  default: ;//prevent warning
576  }
577  }
578  }
579 }
580 
581 /*************************************************************************
582 |*
583 |* enables/disables "size at text" or "adjust to frame"
584 |*
585 \************************************************************************/
586 
587 IMPL_LINK(SvxTextAttrPage, ClickHdl_Impl, weld::Button&, rButton, void)
588 {
589  if (&rButton == m_xTsbAutoGrowSize.get())
590  {
591  m_xTsbAutoGrowHeight->set_state(m_xTsbAutoGrowSize->get_state());
592  if (m_xTsbAutoGrowSize->get_state() == TRISTATE_TRUE)
593  {
594  m_xTsbFitToSize->set_state(TRISTATE_FALSE);
595  m_xTsbContour->set_state(TRISTATE_FALSE);
596  }
597  }
598  else if (&rButton == m_xTsbAutoGrowHeight.get())
599  m_xTsbAutoGrowSize->set_state(m_xTsbAutoGrowHeight->get_state());
600 
601  bool bAutoGrowWidth = m_xTsbAutoGrowWidth->get_state() == TRISTATE_TRUE;
602  bool bAutoGrowHeight = m_xTsbAutoGrowHeight->get_state() == TRISTATE_TRUE;
603  bool bFitToSize = m_xTsbFitToSize->get_state() == TRISTATE_TRUE;
604  bool bContour = m_xTsbContour->get_state() == TRISTATE_TRUE;
605 
606  m_xTsbContour->set_sensitive( !bFitToSize &&
607  !( ( bAutoGrowWidth && bAutoGrowWidthEnabled ) || ( bAutoGrowHeight && bAutoGrowHeightEnabled ) ) &&
608  bContourEnabled );
609 
610  m_xTsbAutoGrowWidth->set_sensitive( !bFitToSize &&
611  !( bContour && bContourEnabled ) &&
612  bAutoGrowWidthEnabled );
613 
614  m_xTsbAutoGrowHeight->set_sensitive( !bFitToSize &&
615  !( bContour && bContourEnabled ) &&
616  bAutoGrowHeightEnabled );
617 
618  m_xTsbFitToSize->set_sensitive( !( ( bAutoGrowWidth && bAutoGrowWidthEnabled ) || ( bAutoGrowHeight && bAutoGrowHeightEnabled ) ) &&
619  !( bContour && bContourEnabled ) &&
620  bFitToSizeEnabled );
621 
622  // #101901# enable/disable metric fields and decorations dependent of contour
623  m_xFlDistance->set_sensitive(!bContour);
624 
625  if( bContour && bContourEnabled )
626  {
627  m_xMtrFldLeft->set_value(0, FieldUnit::NONE);
628  m_xMtrFldRight->set_value(0, FieldUnit::NONE);
629  m_xMtrFldTop->set_value(0, FieldUnit::NONE);
630  m_xMtrFldBottom->set_value(0, FieldUnit::NONE);
631  }
632 
633  // #103516# Do the setup based on states of hor/ver adjust
634  SfxItemState eVState = rOutAttrs.GetItemState( SDRATTR_TEXT_VERTADJUST );
635  SfxItemState eHState = rOutAttrs.GetItemState( SDRATTR_TEXT_HORZADJUST );
636  bool bHorAndVer(SfxItemState::DONTCARE == eVState || SfxItemState::DONTCARE == eHState);
637 
638  // #83698# enable/disable text anchoring dependent of contour
639  m_xFlPosition->set_sensitive(!bContour && !bHorAndVer);
640 }
641 
642 
644 {
645  // Determine the text writing direction with left to right as default.
646  bool bLeftToRightDirection = true;
648 
649  if(SfxItemState::DONTCARE != eState)
650  {
652  if (rItem.GetValue() == css::text::WritingMode_TB_RL)
653  bLeftToRightDirection = false;
654  }
655  return bLeftToRightDirection;
656 }
657 
659 {
660  const CntUInt16Item* pObjTypeItem = aSet.GetItem<CntUInt16Item>(SID_SVXTEXTATTRPAGE_OBJKIND, false);
661 
662  if (pObjTypeItem)
663  SetObjKind(static_cast<SdrObjKind>(pObjTypeItem->GetValue()));
664 
665  Construct();
666 }
667 
668 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static const sal_uInt16 pRanges[]
Definition: textattr.hxx:36
bool bAutoGrowSizeEnabled
Definition: textattr.hxx:41
void SetFieldUnit(weld::MetricSpinButton &rField, FieldUnit eUnit, bool bAll)
FieldUnit
bool bWordWrapTextEnabled
Definition: textattr.hxx:45
void SetActualRP(RectPoint eNewRP)
SDRTEXTVERTADJUST_TOP
#define SDRATTR_TEXT_FITTOSIZE
#define SDRATTR_TEXT_WORDWRAP
OBJ_CUSTOMSHAPE
std::unique_ptr< weld::Frame > m_xFlPosition
Definition: textattr.hxx:63
SvxTextAttrPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rInAttrs)
Definition: textattr.cxx:51
virtual bool FillItemSet(SfxItemSet *) override
Definition: textattr.cxx:291
std::string GetValue
void SetControlSettings(RectPoint eRpt, sal_uInt16 nBorder)
void Reset()
void DoCompletelyDisable(bool bNew)
OBJ_TEXT
const SfxPoolItem * GetItem(const SwTextAttr &rAttr, sal_uInt16 nWhich)
SdrTextHorzAdjust
IMPL_LINK(SvxTextAttrPage, ClickHdl_Impl, weld::Button &, rButton, void)
Definition: textattr.cxx:587
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldBottom
Definition: textattr.hxx:62
std::unique_ptr< weld::CheckButton > m_xTsbAutoGrowHeight
Definition: textattr.hxx:53
bool bContourEnabled
Definition: textattr.hxx:42
sal_uInt16 GetValue() const
RectPoint GetActualRP() const
SDRTEXTVERTADJUST_BLOCK
SdrOnOffItem makeSdrTextWordWrapItem(bool bAuto)
TRISTATE_TRUE
SdrOnOffItem makeSdrTextAutoGrowHeightItem(bool bAuto)
FieldUnit GetModuleFieldUnit(const SfxItemSet &rSet)
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
SdrObjKind m_eObjKind
Definition: textattr.hxx:39
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldLeft
Definition: textattr.hxx:59
OBJ_CAPTION
std::unique_ptr< weld::CheckButton > m_xTsbFitToSize
Definition: textattr.hxx:54
bool bFitToSizeEnabled
Definition: textattr.hxx:46
css::text::WritingMode GetValue() const
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: textattr.cxx:658
SDRTEXTHORZADJUST_CENTER
SdrOnOffItem makeSdrTextAutoGrowWidthItem(bool bAuto)
bool bAutoGrowHeightEnabled
Definition: textattr.hxx:44
void SetState(CTL_STATE nState)
TRISTATE_INDET
const SfxItemSet & rOutAttrs
Definition: textattr.hxx:38
SdrMetricItem makeSdrTextUpperDistItem(long mnHeight)
IMPL_LINK_NOARG(SvxTextAttrPage, ClickFullWidthHdl_Impl, weld::Button &, void)
When switching the "full width" check button on the text anchor may have to be moved to a valid and a...
Definition: textattr.cxx:530
std::unique_ptr< weld::CheckButton > m_xTsbFullWidth
Definition: textattr.hxx:65
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldTop
Definition: textattr.hxx:61
void Construct()
Definition: textattr.cxx:432
SdrOnOffItem makeSdrTextContourFrameItem(bool bOn)
std::unique_ptr< weld::CheckButton > m_xTsbWordWrapText
Definition: textattr.hxx:56
virtual void PointChanged(weld::DrawingArea *pWindow, RectPoint eRP) override
Check whether we have to uncheck the "Full width" check box.
Definition: textattr.cxx:484
#define SDRATTR_TEXT_HORZADJUST
SDRTEXTVERTADJUST_BOTTOM
SDRTEXTHORZADJUST_BLOCK
RectPoint
SDRTEXTHORZADJUST_LEFT
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define DBG_ASSERT(sCon, aError)
#define SDRATTR_TEXT_VERTADJUST
OBJ_NONE
TRISTATE_FALSE
int GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
bool IsCompletelyDisabled() const
#define SDRATTR_MISC_FIRST
bool IsTextDirectionLeftToRight() const
Return whether the text direction is from left to right () or top to bottom ()...
Definition: textattr.cxx:643
std::unique_ptr< weld::CheckButton > m_xTsbContour
Definition: textattr.hxx:55
#define SDRATTR_TEXTDIRECTION
#define SDRATTR_TEXT_CONTOURFRAME
void SetMetricValue(weld::MetricSpinButton &rField, int nCoreValue, MapUnit eUnit)
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
SfxItemPool * GetPool() const
std::unique_ptr< weld::MetricSpinButton > m_xMtrFldRight
Definition: textattr.hxx:60
std::unique_ptr< weld::CheckButton > m_xTsbAutoGrowWidth
Definition: textattr.hxx:52
#define SDRATTR_TEXT_UPPERDIST
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
Definition: textattr.cxx:477
SDRTEXTHORZADJUST_RIGHT
virtual ~SvxTextAttrPage() override
Definition: textattr.cxx:97
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
#define SDRATTR_TEXT_RIGHTDIST
OBJ_OUTLINETEXT
std::unique_ptr< weld::Widget > m_xDrawingText
Definition: textattr.hxx:50
void SetObjKind(SdrObjKind eObjKind)
Definition: textattr.hxx:89
SfxItemState
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual void Reset(const SfxItemSet *) override
Definition: textattr.cxx:107
#define SDRATTR_TEXT_AUTOGROWWIDTH
bool bAutoGrowWidthEnabled
Definition: textattr.hxx:43
SdrMetricItem makeSdrTextLeftDistItem(long mnHeight)
SdrMetricItem makeSdrTextRightDistItem(long mnHeight)
#define SDRATTR_TEXT_AUTOGROWHEIGHT
MapUnit
std::unique_ptr< weld::Widget > m_xCustomShapeText
Definition: textattr.hxx:51
#define SDRATTR_TEXT_LOWERDIST
TriState
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
SdrMetricItem makeSdrTextLowerDistItem(long mnHeight)
std::unique_ptr< weld::CheckButton > m_xTsbAutoGrowSize
Definition: textattr.hxx:57
SvxRectCtl m_aCtlPosition
Definition: textattr.hxx:48
OBJ_TITLETEXT
SdrTextVertAdjust
#define SDRATTR_TEXT_LEFTDIST
SDRTEXTVERTADJUST_CENTER