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