LibreOffice Module cui (master)  1
tpline.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 <memory>
21 #include <editeng/sizeitem.hxx>
22 #include <osl/file.hxx>
23 #include <tools/urlobj.hxx>
24 
25 #include <strings.hrc>
26 #include <svx/colorbox.hxx>
27 #include <svx/dlgctrl.hxx>
28 #include <svx/xlineit0.hxx>
29 #include <svx/xlinjoit.hxx>
30 #include <svx/xlncapit.hxx>
31 #include <svx/xlndsit.hxx>
32 #include <svx/xlnwtit.hxx>
33 #include <svx/xlnstwit.hxx>
34 #include <svx/xlnedwit.hxx>
35 #include <svx/xlnclit.hxx>
36 #include <svx/xlnstit.hxx>
37 #include <svx/xlnedit.hxx>
38 #include <svx/xlnstcit.hxx>
39 #include <svx/xlnedcit.hxx>
40 
41 
42 #include <svx/tabline.hxx>
43 #include <svx/xtable.hxx>
44 #include <svx/drawitem.hxx>
45 #include <cuitabline.hxx>
46 #include <dialmgr.hxx>
47 #include <svx/dlgutil.hxx>
48 #include <svx/svxgraphicitem.hxx>
49 #include <svx/ofaitem.hxx>
50 #include <svx/svdobj.hxx>
51 #include <svx/svdpage.hxx>
52 #include <svx/svdview.hxx>
53 #include <svx/svdmodel.hxx>
54 #include <svx/xlntrit.hxx>
55 #include <svx/xfltrit.hxx>
56 #include <editeng/numitem.hxx>
57 #include <editeng/brushitem.hxx>
58 #include <svx/gallery.hxx>
59 #include <sfx2/opengrf.hxx>
60 #include <svx/dialmgr.hxx>
61 #include <svx/svxids.hrc>
62 #include <svx/strings.hrc>
63 #include <cuitabarea.hxx>
64 #include <svtools/unitconv.hxx>
65 #include <comphelper/lok.hxx>
66 
67 #define MAX_BMP_WIDTH 16
68 #define MAX_BMP_HEIGHT 16
69 
70 using namespace com::sun::star;
71 
72 // static ----------------------------------------------------------------
73 
75  XATTR_LINETRANSPARENCE, XATTR_LINETRANSPARENCE,
76  SID_ATTR_LINE_STYLE, SID_ATTR_LINE_ENDCENTER
77 >);
78 
80  : SfxTabPage(pPage, pController, "cui/ui/linetabpage.ui", "LineTabPage", &rInAttrs)
81  , m_pSymbolList(nullptr)
82  , m_bNewSize(false)
83  , m_nSymbolType(SVX_SYMBOLTYPE_UNKNOWN) // unknown respectively unchanged
84  , m_bLastWidthModified(false)
85  , m_aSymbolLastSize(Size(0,0))
86  , m_bSymbols(false)
87  , m_rOutAttrs(rInAttrs)
88  , m_bObjSelected(false)
89  , m_aXLineAttr(rInAttrs.GetPool())
90  , m_rXLSet(m_aXLineAttr.GetItemSet())
91  , m_pnLineEndListState(nullptr)
92  , m_pnDashListState(nullptr)
93  , m_pnColorListState(nullptr)
94  , m_nPageType(PageType::Area)
95  , m_nDlgType(0)
96  , m_pPosDashLb(nullptr)
97  , m_pPosLineEndLb(nullptr)
98  , m_xBoxColor(m_xBuilder->weld_widget("boxCOLOR"))
99  , m_xLbLineStyle(new SvxLineLB(m_xBuilder->weld_combo_box("LB_LINE_STYLE")))
100  , m_xLbColor(new ColorListBox(m_xBuilder->weld_menu_button("LB_COLOR"),
101  [this]{ return GetDialogController()->getDialog(); }))
102  , m_xBoxWidth(m_xBuilder->weld_widget("boxWIDTH"))
103  , m_xMtrLineWidth(m_xBuilder->weld_metric_spin_button("MTR_FLD_LINE_WIDTH", FieldUnit::CM))
104  , m_xBoxTransparency(m_xBuilder->weld_widget("boxTRANSPARENCY"))
105  , m_xMtrTransparent(m_xBuilder->weld_metric_spin_button("MTR_LINE_TRANSPARENT", FieldUnit::PERCENT))
106  , m_xFlLineEnds(m_xBuilder->weld_widget("FL_LINE_ENDS"))
107  , m_xBoxArrowStyles(m_xBuilder->weld_widget("boxARROW_STYLES"))
108  , m_xLbStartStyle(new SvxLineEndLB(m_xBuilder->weld_combo_box("LB_START_STYLE")))
109  , m_xBoxStart(m_xBuilder->weld_widget("boxSTART"))
110  , m_xMtrStartWidth(m_xBuilder->weld_metric_spin_button("MTR_FLD_START_WIDTH", FieldUnit::CM))
111  , m_xTsbCenterStart(m_xBuilder->weld_check_button("TSB_CENTER_START"))
112  , m_xBoxEnd(m_xBuilder->weld_widget("boxEND"))
113  , m_xLbEndStyle(new SvxLineEndLB(m_xBuilder->weld_combo_box("LB_END_STYLE")))
114  , m_xMtrEndWidth(m_xBuilder->weld_metric_spin_button("MTR_FLD_END_WIDTH", FieldUnit::CM))
115  , m_xTsbCenterEnd(m_xBuilder->weld_check_button("TSB_CENTER_END"))
116  , m_xCbxSynchronize(m_xBuilder->weld_check_button("CBX_SYNCHRONIZE"))
117  , m_xCtlPreview(new weld::CustomWeld(*m_xBuilder, "CTL_PREVIEW", m_aCtlPreview))
118  , m_xFLEdgeStyle(m_xBuilder->weld_widget("FL_EDGE_STYLE"))
119  , m_xGridEdgeCaps(m_xBuilder->weld_widget("gridEDGE_CAPS"))
120  , m_xLBEdgeStyle(m_xBuilder->weld_combo_box("LB_EDGE_STYLE"))
121  , m_xLBCapStyle(m_xBuilder->weld_combo_box("LB_CAP_STYLE")) // LineCaps
122  , m_xFlSymbol(m_xBuilder->weld_widget("FL_SYMBOL_FORMAT")) //#58425# Symbols on a line (e.g. StarChart)
123  , m_xGridIconSize(m_xBuilder->weld_widget("gridICON_SIZE"))
124  , m_xSymbolMB(m_xBuilder->weld_menu_button("MB_SYMBOL_BITMAP"))
125  , m_xSymbolWidthMF(m_xBuilder->weld_metric_spin_button("MF_SYMBOL_WIDTH", FieldUnit::CM))
126  , m_xSymbolHeightMF(m_xBuilder->weld_metric_spin_button("MF_SYMBOL_HEIGHT", FieldUnit::CM))
127  , m_xSymbolRatioCB(m_xBuilder->weld_check_button("CB_SYMBOL_RATIO"))
128 {
129  // This Page requires ExchangeSupport
130  SetExchangeSupport();
131 
132  // Metric set
133  FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs );
134 
135  switch ( eFUnit )
136  {
137  case FieldUnit::M:
138  case FieldUnit::KM:
139  eFUnit = FieldUnit::MM;
140  [[fallthrough]]; // we now have mm
141  case FieldUnit::MM:
142  m_xMtrLineWidth->set_increments(50, 500, FieldUnit::NONE);
143  m_xMtrStartWidth->set_increments(50, 500, FieldUnit::NONE);
144  m_xMtrEndWidth->set_increments(50, 500, FieldUnit::NONE);
145  break;
146 
147  case FieldUnit::INCH:
148  m_xMtrLineWidth->set_increments(2, 20, FieldUnit::NONE);
149  m_xMtrStartWidth->set_increments(2, 20, FieldUnit::NONE);
150  m_xMtrEndWidth->set_increments(2, 20, FieldUnit::NONE);
151  break;
152  default: ;// prevent warning
153  }
154  SetFieldUnit( *m_xMtrLineWidth, eFUnit );
155  SetFieldUnit( *m_xMtrStartWidth, eFUnit );
156  SetFieldUnit( *m_xMtrEndWidth, eFUnit );
157 
158  // determine PoolUnit
159  SfxItemPool* pPool = m_rOutAttrs.GetPool();
160  DBG_ASSERT( pPool, "Where is the pool?" );
161  m_ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH );
162 
163  m_xLbLineStyle->connect_changed(LINK(this, SvxLineTabPage, ClickInvisibleHdl_Impl));
164  m_xLbColor->SetSelectHdl( LINK( this, SvxLineTabPage, ChangePreviewListBoxHdl_Impl ) );
165  m_xMtrLineWidth->connect_value_changed(LINK(this, SvxLineTabPage, ChangePreviewModifyHdl_Impl));
166  m_xMtrTransparent->connect_value_changed(LINK( this, SvxLineTabPage, ChangeTransparentHdl_Impl));
167 
168  m_xLbStartStyle->connect_changed(LINK(this, SvxLineTabPage, ChangeStartListBoxHdl_Impl));
169  m_xLbEndStyle->connect_changed(LINK(this, SvxLineTabPage, ChangeEndListBoxHdl_Impl));
170  m_xMtrStartWidth->connect_value_changed(LINK(this, SvxLineTabPage, ChangeStartModifyHdl_Impl));
171  m_xMtrEndWidth->connect_value_changed(LINK( this, SvxLineTabPage, ChangeEndModifyHdl_Impl));
172  m_xTsbCenterStart->connect_toggled(LINK(this, SvxLineTabPage, ChangeStartClickHdl_Impl));
173  m_xTsbCenterEnd->connect_toggled(LINK(this, SvxLineTabPage, ChangeEndClickHdl_Impl));
174 
175  Link<weld::ComboBox&,void> aEdgeStyle = LINK(this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl);
176  m_xLBEdgeStyle->connect_changed(aEdgeStyle);
177 
178  // LineCaps
179  Link<weld::ComboBox&,void> aCapStyle = LINK(this, SvxLineTabPage, ChangeCapStyleHdl_Impl);
180  m_xLBCapStyle->connect_changed(aCapStyle);
181 
182  // Symbols on a line (eg star charts), MB-handler set
183  m_xSymbolMB->connect_selected(LINK(this, SvxLineTabPage, GraphicHdl_Impl));
184  m_xSymbolMB->connect_toggled(LINK(this, SvxLineTabPage, MenuCreateHdl_Impl));
185  m_xSymbolWidthMF->connect_value_changed(LINK(this, SvxLineTabPage, SizeHdl_Impl));
186  m_xSymbolHeightMF->connect_value_changed(LINK(this, SvxLineTabPage, SizeHdl_Impl));
187  m_xSymbolRatioCB->connect_toggled(LINK(this, SvxLineTabPage, RatioHdl_Impl));
188 
189  m_xSymbolRatioCB->set_active(true);
190  ShowSymbolControls(false);
191 
192  m_nActLineWidth = -1;
193 }
194 
196 {
197  // Symbols on a line (e.g. StarCharts), symbol-enable controls
198 
199  m_bSymbols=bOn;
200  m_xFlSymbol->set_visible(bOn);
202 }
203 
205 {
206  m_xCtlPreview.reset();
207  m_xLbEndStyle.reset();
208  m_xLbStartStyle.reset();
209  m_xLbColor.reset();
210  m_xLbLineStyle.reset();
211  m_aGalleryBrushItems.clear();
212  m_aSymbolBrushItems.clear();
213 }
214 
216 {
217  FillListboxes();
218 }
219 
221 {
222  // Line styles
223  auto nOldSelect = m_xLbLineStyle->get_active();
224  // aLbLineStyle.FillStyles();
225  m_xLbLineStyle->Fill( m_pDashList );
226  m_xLbLineStyle->set_active( nOldSelect );
227 
228  // Line end style
229  OUString sNone( comphelper::LibreOfficeKit::isActive() ? SvxResId( RID_SVXSTR_INVISIBLE )
230  : SvxResId( RID_SVXSTR_NONE ) );
231  nOldSelect = m_xLbStartStyle->get_active();
232  m_xLbStartStyle->clear();
233  m_xLbStartStyle->append_text(sNone);
235  m_xLbStartStyle->set_active(nOldSelect);
236  nOldSelect = m_xLbEndStyle->get_active();
237  m_xLbEndStyle->clear();
238  m_xLbEndStyle->append_text(sNone);
239  m_xLbEndStyle->Fill(m_pLineEndList, false);
240  m_xLbEndStyle->set_active(nOldSelect);
241 }
242 
244 {
245  const CntUInt16Item* pPageTypeItem = rSet.GetItem<CntUInt16Item>(SID_PAGE_TYPE, false);
246  if (pPageTypeItem)
247  SetPageType(static_cast<PageType>(pPageTypeItem->GetValue()));
248  if( m_nDlgType == 0 && m_pDashList.is() )
249  {
250  sal_Int32 nPos;
251  sal_Int32 nCount;
252 
253  // Dash list
254  if( ( *m_pnDashListState & ChangeType::MODIFIED ) ||
255  ( *m_pnDashListState & ChangeType::CHANGED ) )
256  {
257  if( *m_pnDashListState & ChangeType::CHANGED )
258  m_pDashList = static_cast<SvxLineTabDialog*>(GetDialogController() )->GetNewDashList();
259 
260  *m_pnDashListState = ChangeType::NONE;
261 
262  // Style list
263  nPos = m_xLbLineStyle->get_active();
264 
265  m_xLbLineStyle->clear();
266  m_xLbLineStyle->append_text(SvxResId(RID_SVXSTR_INVISIBLE));
267  m_xLbLineStyle->append_text(SvxResId(RID_SVXSTR_SOLID));
269  nCount = m_xLbLineStyle->get_count();
270 
271  if ( nCount == 0 )
272  ; // This case should never occur
273  else if( nCount <= nPos )
274  m_xLbLineStyle->set_active(0);
275  else
276  m_xLbLineStyle->set_active(nPos);
277  }
278 
279  INetURLObject aDashURL( m_pDashList->GetPath() );
280 
281  aDashURL.Append( m_pDashList->GetName() );
282  DBG_ASSERT( aDashURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
283  // LineEnd list
284  if( ( *m_pnLineEndListState & ChangeType::MODIFIED ) || ( *m_pnLineEndListState & ChangeType::CHANGED ) )
285  {
286  if( *m_pnLineEndListState & ChangeType::CHANGED )
287  m_pLineEndList = static_cast<SvxLineTabDialog*>(GetDialogController())->GetNewLineEndList();
288 
289  *m_pnLineEndListState = ChangeType::NONE;
290 
291  nPos = m_xLbLineStyle->get_active();
292  OUString sNone( comphelper::LibreOfficeKit::isActive() ? SvxResId( RID_SVXSTR_INVISIBLE )
293  : SvxResId( RID_SVXSTR_NONE ) );
294 
295  m_xLbStartStyle->clear();
296  m_xLbStartStyle->append_text(sNone);
297 
299  nCount = m_xLbStartStyle->get_count();
300  if( nCount == 0 )
301  ; // This case should never occur
302  else if( nCount <= nPos )
303  m_xLbStartStyle->set_active(0);
304  else
305  m_xLbStartStyle->set_active(nPos);
306 
307  m_xLbEndStyle->clear();
308  m_xLbEndStyle->append_text(sNone);
309 
310  m_xLbEndStyle->Fill( m_pLineEndList, false );
311  nCount = m_xLbEndStyle->get_count();
312 
313  if( nCount == 0 )
314  ; // This case should never occur
315  else if( nCount <= nPos )
316  m_xLbEndStyle->set_active(0);
317  else
318  m_xLbEndStyle->set_active(nPos);
319  }
320  INetURLObject aLineURL( m_pLineEndList->GetPath() );
321 
322  aLineURL.Append( m_pLineEndList->GetName() );
323  DBG_ASSERT( aLineURL.GetProtocol() != INetProtocol::NotValid, "invalid URL" );
324  // Evaluate if another TabPage set another fill type
325  if( m_xLbLineStyle->get_active() != 0 )
326  {
327  if( m_nPageType == PageType::Hatch ) // 1
328  {
329  m_xLbLineStyle->set_active(*m_pPosDashLb + 2); // +2 due to SOLID and INVISIBLE
330  ChangePreviewHdl_Impl( nullptr );
331  }
333  {
334  m_xLbStartStyle->set_active(*m_pPosLineEndLb + 1);// +1 due to SOLID
335  m_xLbEndStyle->set_active(*m_pPosLineEndLb + 1);// +1 due to SOLID
336  ChangePreviewHdl_Impl( nullptr );
337  }
338  }
339 
340  // ColorList
341  if( *m_pnColorListState != ChangeType::NONE )
342  {
343  ChangePreviewHdl_Impl( nullptr );
344  }
345 
347  }
348  // Page does not yet exist in the ctor, that's why we do it here!
349 
350  else if (m_nDlgType == 1101) // nNoArrowNoShadowDlg from chart2/source/controller/dialogs/dlg_ObjectProperties.cxx
351  {
352  m_xFlLineEnds->hide();
353  m_xFLEdgeStyle->hide();
354  }
355 }
356 
357 
359 {
360  if( m_nDlgType == 0 ) // Line dialog
361  {
362  m_nPageType = PageType::Gradient; // possibly for extensions
363  *m_pPosDashLb = m_xLbLineStyle->get_active() - 2;// First entry SOLID!!!
364  sal_Int32 nPos = m_xLbStartStyle->get_active();
365  if (nPos != -1)
366  nPos--;
367  *m_pPosLineEndLb = nPos;
368  }
369 
370  if( _pSet )
371  FillItemSet( _pSet );
372 
373  return DeactivateRC::LeavePage;
374 }
375 
376 
378 {
379  const SfxPoolItem* pOld = nullptr;
380  sal_Int32 nPos;
381  bool bModified = false;
382 
383  // To prevent modifications to the list, we do not set other page's items.
384  if( m_nDlgType != 0 || m_nPageType != PageType::Hatch )
385  {
386  nPos = m_xLbLineStyle->get_active();
387  if( nPos != -1 &&
388  m_xLbLineStyle->get_value_changed_from_saved() )
389  {
390  std::unique_ptr<XLineStyleItem> pStyleItem;
391 
392  if( nPos == 0 )
393  pStyleItem.reset(new XLineStyleItem( drawing::LineStyle_NONE ));
394  else if( nPos == 1 )
395  pStyleItem.reset(new XLineStyleItem( drawing::LineStyle_SOLID ));
396  else
397  {
398  pStyleItem.reset(new XLineStyleItem( drawing::LineStyle_DASH ));
399 
400  // For added security
401  if( m_pDashList->Count() > static_cast<tools::Long>( nPos - 2 ) )
402  {
403  XLineDashItem aDashItem( m_xLbLineStyle->get_active_text(),
404  m_pDashList->GetDash( nPos - 2 )->GetDash() );
405  pOld = GetOldItem( *rAttrs, XATTR_LINEDASH );
406  if ( !pOld || !( *static_cast<const XLineDashItem*>(pOld) == aDashItem ) )
407  {
408  rAttrs->Put( aDashItem );
409  bModified = true;
410  }
411  }
412  }
413  pOld = GetOldItem( *rAttrs, XATTR_LINESTYLE );
414  if ( !pOld || !( *static_cast<const XLineStyleItem*>(pOld) == *pStyleItem ) )
415  {
416  rAttrs->Put( *pStyleItem );
417  bModified = true;
418  }
419  }
420  }
421  // Line width
422  // GetSavedValue() returns OUString!
423  if( m_xMtrLineWidth->get_value_changed_from_saved() )
424  {
426  pOld = GetOldItem( *rAttrs, XATTR_LINEWIDTH );
427  if ( !pOld || !( *static_cast<const XLineWidthItem*>(pOld) == aItem ) )
428  {
429  rAttrs->Put( aItem );
430  bModified = true;
431  }
432  }
433  // Width line start
434  if( m_xMtrStartWidth->get_value_changed_from_saved() )
435  {
437  pOld = GetOldItem( *rAttrs, XATTR_LINESTARTWIDTH );
438  if ( !pOld || !( *static_cast<const XLineStartWidthItem*>(pOld) == aItem ) )
439  {
440  rAttrs->Put( aItem );
441  bModified = true;
442  }
443  }
444  // Width line end
445  if( m_xMtrEndWidth->get_value_changed_from_saved() )
446  {
448  pOld = GetOldItem( *rAttrs, XATTR_LINEENDWIDTH );
449  if ( !pOld || !( *static_cast<const XLineEndWidthItem*>(pOld) == aItem ) )
450  {
451  rAttrs->Put( aItem );
452  bModified = true;
453  }
454  }
455 
456  // Line color
457  if (m_xLbColor->IsValueChangedFromSaved())
458  {
459  NamedColor aColor = m_xLbColor->GetSelectedEntry();
460  XLineColorItem aItem(aColor.second, aColor.first);
461  pOld = GetOldItem( *rAttrs, XATTR_LINECOLOR );
462  if ( !pOld || !( *static_cast<const XLineColorItem*>(pOld) == aItem ) )
463  {
464  rAttrs->Put( aItem );
465  bModified = true;
466  }
467  }
468 
469  if( m_nDlgType != 0 || m_nPageType != PageType::Bitmap )
470  {
471  // Line start
472  nPos = m_xLbStartStyle->get_active();
473  if( nPos != -1 && m_xLbStartStyle->get_value_changed_from_saved() )
474  {
475  std::unique_ptr<XLineStartItem> pItem;
476  if( nPos == 0 )
477  pItem.reset(new XLineStartItem());
478  else if( m_pLineEndList->Count() > static_cast<tools::Long>( nPos - 1 ) )
479  pItem.reset(new XLineStartItem( m_xLbStartStyle->get_active_text(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ));
480  pOld = GetOldItem( *rAttrs, XATTR_LINESTART );
481  if( pItem && ( !pOld || *pOld != *pItem ) )
482  {
483  rAttrs->Put( *pItem );
484  bModified = true;
485  }
486  }
487  // Line end
488  nPos = m_xLbEndStyle->get_active();
489  if( nPos != -1 && m_xLbEndStyle->get_value_changed_from_saved() )
490  {
491  std::unique_ptr<XLineEndItem> pItem;
492  if( nPos == 0 )
493  pItem.reset(new XLineEndItem());
494  else if( m_pLineEndList->Count() > static_cast<tools::Long>( nPos - 1 ) )
495  pItem.reset(new XLineEndItem( m_xLbEndStyle->get_active_text(), m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ));
496  pOld = GetOldItem( *rAttrs, XATTR_LINEEND );
497  if( pItem &&
498  ( !pOld || !( *static_cast<const XLineEndItem*>(pOld) == *pItem ) ) )
499  {
500  rAttrs->Put( *pItem );
501  bModified = true;
502  }
503  }
504  }
505 
506  // Centered line end
507  TriState eState = m_xTsbCenterStart->get_state();
508  if( m_xTsbCenterStart->get_state_changed_from_saved() )
509  {
510  XLineStartCenterItem aItem( eState != TRISTATE_FALSE );
511  pOld = GetOldItem( *rAttrs, XATTR_LINESTARTCENTER );
512  if ( !pOld || !( *static_cast<const XLineStartCenterItem*>(pOld) == aItem ) )
513  {
514  rAttrs->Put( aItem );
515  bModified = true;
516  }
517  }
518  eState = m_xTsbCenterEnd->get_state();
519  if( m_xTsbCenterEnd->get_state_changed_from_saved() )
520  {
521  XLineEndCenterItem aItem( eState != TRISTATE_FALSE );
522  pOld = GetOldItem( *rAttrs, XATTR_LINEENDCENTER );
523  if ( !pOld || !( *static_cast<const XLineEndCenterItem*>(pOld) == aItem ) )
524  {
525  rAttrs->Put( aItem );
526  bModified = true;
527  }
528  }
529 
530  // Transparency
531  sal_uInt16 nVal = m_xMtrTransparent->get_value(FieldUnit::PERCENT);
532  if( m_xMtrTransparent->get_value_changed_from_saved() )
533  {
534  XLineTransparenceItem aItem( nVal );
535  pOld = GetOldItem( *rAttrs, XATTR_LINETRANSPARENCE );
536  if ( !pOld || !( *static_cast<const XLineTransparenceItem*>(pOld) == aItem ) )
537  {
538  rAttrs->Put( aItem );
539  bModified = true;
540  }
541  }
542 
543  nPos = m_xLBEdgeStyle->get_active();
544  if (nPos != -1 && m_xLBEdgeStyle->get_value_changed_from_saved())
545  {
546  std::unique_ptr<XLineJointItem> pNew;
547 
548  switch(nPos)
549  {
550  case 0: // Rounded, default
551  {
552  pNew.reset(new XLineJointItem(css::drawing::LineJoint_ROUND));
553  break;
554  }
555  case 1: // - none -
556  {
557  pNew.reset(new XLineJointItem(css::drawing::LineJoint_NONE));
558  break;
559  }
560  case 2: // Miter
561  {
562  pNew.reset(new XLineJointItem(css::drawing::LineJoint_MITER));
563  break;
564  }
565  case 3: // Bevel
566  {
567  pNew.reset(new XLineJointItem(css::drawing::LineJoint_BEVEL));
568  break;
569  }
570  }
571 
572  if(pNew)
573  {
574  pOld = GetOldItem( *rAttrs, XATTR_LINEJOINT );
575 
576  if(!pOld || !(*static_cast<const XLineJointItem*>(pOld) == *pNew))
577  {
578  rAttrs->Put( *pNew );
579  bModified = true;
580  }
581  }
582  }
583 
584  // LineCaps
585  nPos = m_xLBCapStyle->get_active();
586  if (nPos != -1 && m_xLBCapStyle->get_value_changed_from_saved())
587  {
588  std::unique_ptr<XLineCapItem> pNew;
589 
590  switch(nPos)
591  {
592  case 0: // Butt (=Flat), default
593  {
594  pNew.reset(new XLineCapItem(css::drawing::LineCap_BUTT));
595  break;
596  }
597  case 1: // Round
598  {
599  pNew.reset(new XLineCapItem(css::drawing::LineCap_ROUND));
600  break;
601  }
602  case 2: // Square
603  {
604  pNew.reset(new XLineCapItem(css::drawing::LineCap_SQUARE));
605  break;
606  }
607  }
608 
609  if(pNew)
610  {
611  pOld = GetOldItem( *rAttrs, XATTR_LINECAP );
612 
613  if(!pOld || !(*static_cast<const XLineCapItem*>(pOld) == *pNew))
614  {
615  rAttrs->Put( *pNew );
616  bModified = true;
617  }
618  }
619  }
620 
622  {
623  // Was set by selection or the size is different
624  SvxSizeItem aSItem(rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),m_aSymbolSize);
625  const SfxPoolItem* pSOld = GetOldItem( *rAttrs, rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE) );
626  m_bNewSize = pSOld ? *static_cast<const SvxSizeItem *>(pSOld) != aSItem : m_bNewSize ;
627  if(m_bNewSize)
628  {
629  rAttrs->Put(aSItem);
630  bModified=true;
631  }
632 
633  SfxInt32Item aTItem(rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),m_nSymbolType);
634  const SfxPoolItem* pTOld = GetOldItem( *rAttrs, rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE) );
635  bool bNewType = pTOld == nullptr || *static_cast<const SfxInt32Item*>(pTOld) != aTItem;
636  if(bNewType && m_nSymbolType==SVX_SYMBOLTYPE_UNKNOWN)
637  bNewType=false; // a small fix, type wasn't set -> don't create a type item after all!
638  if(bNewType)
639  {
640  rAttrs->Put(aTItem);
641  bModified=true;
642  }
643 
645  {
646  SvxBrushItem aBItem(m_aSymbolGraphic,GPOS_MM,rAttrs->GetPool()->GetWhich(SID_ATTR_BRUSH));
647  const SfxPoolItem* pBOld = GetOldItem( *rAttrs, rAttrs->GetPool()->GetWhich(SID_ATTR_BRUSH) );
648  bool bNewBrush =
649  pBOld == nullptr || *static_cast<const SvxBrushItem*>(pBOld) != aBItem;
650  if(bNewBrush)
651  {
652  rAttrs->Put(aBItem);
653  bModified=true;
654  }
655  }
656  }
657  rAttrs->Put (CntUInt16Item(SID_PAGE_TYPE, static_cast<sal_uInt16>(m_nPageType)));
658  return bModified;
659 }
660 
661 
663 {
664  sal_Int32 nPos;
665 
666  if (m_xLbLineStyle->get_active() == -1)
667  {
668  m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
669  }
670  else if (m_xLbLineStyle->get_active() == 0)
671  m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) );
672  else if (m_xLbLineStyle->get_active() == 1)
673  m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_SOLID ) );
674  else
675  {
676  m_rXLSet.Put( XLineStyleItem( drawing::LineStyle_DASH ) );
677 
678  nPos = m_xLbLineStyle->get_active();
679  if (nPos != -1)
680  {
681  m_rXLSet.Put( XLineDashItem( m_xLbLineStyle->get_active_text(),
682  m_pDashList->GetDash( nPos - 2 )->GetDash() ) );
683  }
684  }
685 
686  nPos = m_xLbStartStyle->get_active();
687  if (nPos != -1)
688  {
689  if( nPos == 0 )
691  else
692  m_rXLSet.Put( XLineStartItem( m_xLbStartStyle->get_active_text(),
693  m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) );
694  }
695  nPos = m_xLbEndStyle->get_active();
696  if (nPos != -1)
697  {
698  if( nPos == 0 )
700  else
701  m_rXLSet.Put( XLineEndItem( m_xLbEndStyle->get_active_text(),
702  m_pLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) );
703  }
704 
705  nPos = m_xLBEdgeStyle->get_active();
706  if (nPos != -1)
707  {
708  switch(nPos)
709  {
710  case 0: // Rounded, default
711  {
712  m_rXLSet.Put(XLineJointItem(css::drawing::LineJoint_ROUND));
713  break;
714  }
715  case 1: // - none -
716  {
717  m_rXLSet.Put(XLineJointItem(css::drawing::LineJoint_NONE));
718  break;
719  }
720  case 2: // Miter
721  {
722  m_rXLSet.Put(XLineJointItem(css::drawing::LineJoint_MITER));
723  break;
724  }
725  case 3: // Bevel
726  {
727  m_rXLSet.Put(XLineJointItem(css::drawing::LineJoint_BEVEL));
728  break;
729  }
730  }
731  }
732 
733  // LineCaps
734  nPos = m_xLBCapStyle->get_active();
735  if (nPos != -1)
736  {
737  switch(nPos)
738  {
739  case 0: // Butt (=Flat), default
740  {
741  m_rXLSet.Put(XLineCapItem(css::drawing::LineCap_BUTT));
742  break;
743  }
744  case 1: // Round
745  {
746  m_rXLSet.Put(XLineCapItem(css::drawing::LineCap_ROUND));
747  break;
748  }
749  case 2: // Square
750  {
751  m_rXLSet.Put(XLineCapItem(css::drawing::LineCap_SQUARE));
752  break;
753  }
754  }
755  }
756 
759 
761  NamedColor aColor = m_xLbColor->GetSelectedEntry();
762  m_rXLSet.Put(XLineColorItem(aColor.second, aColor.first));
763 
764  // Centered line end
765  if( m_xTsbCenterStart->get_state() == TRISTATE_TRUE )
766  m_rXLSet.Put( XLineStartCenterItem( true ) );
767  else if( m_xTsbCenterStart->get_state() == TRISTATE_FALSE )
768  m_rXLSet.Put( XLineStartCenterItem( false ) );
769 
770  if( m_xTsbCenterEnd->get_state() == TRISTATE_TRUE )
771  m_rXLSet.Put( XLineEndCenterItem( true ) );
772  else if( m_xTsbCenterEnd->get_state() == TRISTATE_FALSE )
773  m_rXLSet.Put( XLineEndCenterItem( false ) );
774 
775  // Transparency
776  sal_uInt16 nVal = m_xMtrTransparent->get_value(FieldUnit::PERCENT);
778 
780 }
781 
782 
783 void SvxLineTabPage::Reset( const SfxItemSet* rAttrs )
784 {
785  drawing::LineStyle eXLS; // drawing::LineStyle_NONE, drawing::LineStyle_SOLID, drawing::LineStyle_DASH
786 
787  // Line style
789  bool bPrevSym=false;
790  bool bEnable=true;
791  bool bIgnoreGraphic=false;
792  bool bIgnoreSize=false;
793  if(const SfxInt32Item* pSymbolTypeItem = rAttrs->GetItemIfSet(rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE)))
794  {
795  nSymType = pSymbolTypeItem->GetValue();
796  }
797 
798  if(nSymType == SVX_SYMBOLTYPE_AUTO)
799  {
802  bPrevSym=true;
803  }
804  else if(nSymType == SVX_SYMBOLTYPE_NONE)
805  {
806  bEnable=false;
807  bIgnoreGraphic=true;
808  bIgnoreSize=true;
809  }
810  else if(nSymType >= 0)
811  {
813  pVDev->SetMapMode(MapMode(MapUnit::Map100thMM));
814 
815  std::unique_ptr<SdrModel> pModel(
816  new SdrModel(nullptr, nullptr, true));
817  pModel->GetItemPool().FreezeIdRanges();
818  rtl::Reference<SdrPage> pPage = new SdrPage( *pModel, false );
819  pPage->SetSize(Size(1000,1000));
820  pModel->InsertPage( pPage.get(), 0 );
821  {
822  SdrView aView( *pModel, pVDev );
823  aView.hideMarkHandles();
824  aView.ShowSdrPage(pPage.get());
825  size_t nSymTmp = static_cast<size_t>(nSymType);
826  if(m_pSymbolList)
827  {
829  {
830  nSymTmp %= m_pSymbolList->GetObjCount(); // Treat list as cyclic!
831  SdrObject *pObj=m_pSymbolList->GetObj(nSymTmp);
832  if(pObj)
833  {
834  // directly clone to target SdrModel
835  pObj = pObj->CloneSdrObject(*pModel);
836 
837  if(m_xSymbolAttr)
838  {
840  }
841  else
842  {
844  }
845 
846  pPage->NbcInsertObject(pObj);
847 
848  // Generate invisible square to give all symbol types a
849  // bitmap size, which is independent from specific glyph
850  SdrObject* pInvisibleSquare(m_pSymbolList->GetObj(0));
851 
852  // directly clone to target SdrModel
853  pInvisibleSquare = pInvisibleSquare->CloneSdrObject(*pModel);
854 
855  pPage->NbcInsertObject(pInvisibleSquare);
856  pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100));
857  pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100));
858 
859  aView.MarkAll();
860  GDIMetaFile aMeta(aView.GetMarkedObjMetaFile());
861 
862  m_aSymbolGraphic=Graphic(aMeta);
864  m_aSymbolGraphic.SetPrefSize(pInvisibleSquare->GetSnapRect().GetSize());
865  m_aSymbolGraphic.SetPrefMapMode(MapMode(MapUnit::Map100thMM));
866  bPrevSym=true;
867  bEnable=true;
868  bIgnoreGraphic=true;
869 
870  aView.UnmarkAll();
871  pInvisibleSquare=pPage->RemoveObject(1);
872  SdrObject::Free( pInvisibleSquare);
873  pObj=pPage->RemoveObject(0);
874  SdrObject::Free( pObj );
875  }
876  }
877  }
878  }
879  }
880  if(const SvxBrushItem* pBrushItem = rAttrs->GetItemIfSet(rAttrs->GetPool()->GetWhich(SID_ATTR_BRUSH)))
881  {
882  const Graphic* pGraphic = pBrushItem->GetGraphic();
883  if( pGraphic )
884  {
885  if(!bIgnoreGraphic)
886  {
887  m_aSymbolGraphic=*pGraphic;
888  }
889  if(!bIgnoreSize)
890  {
892  pGraphic->GetPrefMapMode(),
893  MapMode(MapUnit::Map100thMM));
894  }
895  bPrevSym=true;
896  }
897  }
898 
899  if(const SvxSizeItem* pSymbolSizeItem = rAttrs->GetItemIfSet(rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE)))
900  {
901  m_aSymbolSize = pSymbolSizeItem->GetSize();
902  }
903 
904  m_xGridIconSize->set_sensitive(bEnable);
905 
906  if(bPrevSym)
907  {
912  }
913 
914  if( rAttrs->GetItemState( XATTR_LINESTYLE ) != SfxItemState::DONTCARE )
915  {
916  eXLS = rAttrs->Get( XATTR_LINESTYLE ).GetValue();
917 
918  switch( eXLS )
919  {
920  case drawing::LineStyle_NONE:
921  m_xLbLineStyle->set_active(0);
922  break;
923  case drawing::LineStyle_SOLID:
924  m_xLbLineStyle->set_active(1);
925  break;
926 
927  case drawing::LineStyle_DASH:
928  m_xLbLineStyle->set_active(-1);
929  m_xLbLineStyle->set_active_text(rAttrs->Get( XATTR_LINEDASH ).GetName());
930  break;
931 
932  default:
933  break;
934  }
935  }
936  else
937  {
938  m_xLbLineStyle->set_active(-1);
939  }
940 
941  // Line strength
942  if( rAttrs->GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE )
943  {
944  SetMetricValue( *m_xMtrLineWidth, rAttrs->Get( XATTR_LINEWIDTH ).GetValue(), m_ePoolUnit );
945  }
946  else
947  m_xMtrLineWidth->set_text("");
948 
949  // Line color
950  m_xLbColor->SetNoSelection();
951 
952  if ( rAttrs->GetItemState( XATTR_LINECOLOR ) != SfxItemState::DONTCARE )
953  {
954  Color aCol = rAttrs->Get( XATTR_LINECOLOR ).GetColorValue();
955  m_xLbColor->SelectEntry( aCol );
956  }
957 
958  // Line start
959  if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINESTART ) == SfxItemState::DEFAULT )
960  {
961  m_xLbStartStyle->set_sensitive(false);
962  }
963  else if( rAttrs->GetItemState( XATTR_LINESTART ) != SfxItemState::DONTCARE )
964  {
965  // #86265# select entry using list and polygon, not string
966  bool bSelected(false);
967  const basegfx::B2DPolyPolygon& rItemPolygon = rAttrs->Get(XATTR_LINESTART).GetLineStartValue();
968 
969  for(tools::Long a(0);!bSelected && a < m_pLineEndList->Count(); a++)
970  {
971  const XLineEndEntry* pEntry = m_pLineEndList->GetLineEnd(a);
972  const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
973 
974  if(rItemPolygon == rEntryPolygon)
975  {
976  // select this entry
977  m_xLbStartStyle->set_active(a + 1);
978  bSelected = true;
979  }
980  }
981 
982  if(!bSelected)
983  m_xLbStartStyle->set_active(0);
984  }
985  else
986  {
987  m_xLbStartStyle->set_active(-1);
988  }
989 
990  // Line end
991  if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINEEND ) == SfxItemState::DEFAULT )
992  {
993  m_xLbEndStyle->set_sensitive(false);
994  }
995  else if( rAttrs->GetItemState( XATTR_LINEEND ) != SfxItemState::DONTCARE )
996  {
997  // #86265# select entry using list and polygon, not string
998  bool bSelected(false);
999  const basegfx::B2DPolyPolygon& rItemPolygon = rAttrs->Get(XATTR_LINEEND).GetLineEndValue();
1000 
1001  for(tools::Long a(0);!bSelected && a < m_pLineEndList->Count(); a++)
1002  {
1003  const XLineEndEntry* pEntry = m_pLineEndList->GetLineEnd(a);
1004  const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
1005 
1006  if(rItemPolygon == rEntryPolygon)
1007  {
1008  // select this entry
1009  m_xLbEndStyle->set_active(a + 1);
1010  bSelected = true;
1011  }
1012  }
1013 
1014  if(!bSelected)
1015  m_xLbEndStyle->set_active(0);
1016  }
1017  else
1018  {
1019  m_xLbEndStyle->set_active(-1);
1020  }
1021 
1022  // Line start strength
1023  if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINESTARTWIDTH ) == SfxItemState::DEFAULT )
1024  {
1025  m_xMtrStartWidth->set_sensitive(false);
1026  }
1027  else if( rAttrs->GetItemState( XATTR_LINESTARTWIDTH ) != SfxItemState::DONTCARE )
1028  {
1030  rAttrs->Get( XATTR_LINESTARTWIDTH ).GetValue(),
1031  m_ePoolUnit );
1032  }
1033  else
1034  m_xMtrStartWidth->set_text( "" );
1035 
1036  // Line end strength
1037  if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINEENDWIDTH ) == SfxItemState::DEFAULT )
1038  {
1039  m_xMtrEndWidth->set_sensitive(false);
1040  }
1041  else if( rAttrs->GetItemState( XATTR_LINEENDWIDTH ) != SfxItemState::DONTCARE )
1042  {
1044  rAttrs->Get( XATTR_LINEENDWIDTH ).GetValue(),
1045  m_ePoolUnit );
1046  }
1047  else
1048  m_xMtrEndWidth->set_text("");
1049 
1050  // Centered line end (start)
1051  if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINESTARTCENTER ) == SfxItemState::DEFAULT )
1052  {
1053  m_xTsbCenterStart->set_sensitive(false);
1054  }
1055  else if( rAttrs->GetItemState( XATTR_LINESTARTCENTER ) != SfxItemState::DONTCARE )
1056  {
1057  if( rAttrs->Get( XATTR_LINESTARTCENTER ).GetValue() )
1058  m_xTsbCenterStart->set_state(TRISTATE_TRUE);
1059  else
1060  m_xTsbCenterStart->set_state(TRISTATE_FALSE);
1061  }
1062  else
1063  {
1064  m_xTsbCenterStart->set_state(TRISTATE_INDET);
1065  }
1066 
1067  // Centered line end (end)
1068  if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINEENDCENTER ) == SfxItemState::DEFAULT )
1069  {
1070  m_xTsbCenterEnd->set_sensitive(false);
1071  }
1072  else if( rAttrs->GetItemState( XATTR_LINEENDCENTER ) != SfxItemState::DONTCARE )
1073  {
1074  if( rAttrs->Get( XATTR_LINEENDCENTER ).GetValue() )
1075  m_xTsbCenterEnd->set_state(TRISTATE_TRUE);
1076  else
1077  m_xTsbCenterEnd->set_state(TRISTATE_FALSE);
1078  }
1079  else
1080  {
1081  m_xTsbCenterEnd->set_state(TRISTATE_INDET);
1082  }
1083 
1084  // Transparency
1085  if( rAttrs->GetItemState( XATTR_LINETRANSPARENCE ) != SfxItemState::DONTCARE )
1086  {
1087  sal_uInt16 nTransp = rAttrs->Get( XATTR_LINETRANSPARENCE ).GetValue();
1088  m_xMtrTransparent->set_value(nTransp, FieldUnit::PERCENT);
1089  ChangeTransparentHdl_Impl(*m_xMtrTransparent);
1090  }
1091  else
1092  m_xMtrTransparent->set_text( "" );
1093 
1094  if( !m_xLbStartStyle->get_sensitive() &&
1095  !m_xLbEndStyle->get_sensitive() &&
1096  !m_xMtrStartWidth->get_sensitive() &&
1097  !m_xMtrEndWidth->get_sensitive() &&
1098  !m_xTsbCenterStart->get_sensitive()&&
1099  !m_xTsbCenterEnd->get_sensitive() )
1100  {
1101  m_xCbxSynchronize->set_sensitive(false);
1102  m_xFlLineEnds->set_sensitive(false);
1103  }
1104 
1105  // Synchronize
1106  // We get the value from the INI file now
1107  OUString aStr = GetUserData();
1108  m_xCbxSynchronize->set_active(aStr.toInt32() != 0);
1109 
1110  if(m_bObjSelected && SfxItemState::DEFAULT == rAttrs->GetItemState(XATTR_LINEJOINT))
1111  {
1112 // maFTEdgeStyle.set_sensitive(false);
1113  m_xLBEdgeStyle->set_sensitive(false);
1114  }
1115  else if(SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_LINEJOINT))
1116  {
1117  const css::drawing::LineJoint eLineJoint = rAttrs->Get(XATTR_LINEJOINT).GetValue();
1118 
1119  switch(eLineJoint)
1120  {
1121  case css::drawing::LineJoint::LineJoint_MAKE_FIXED_SIZE: // fallback to round, unused value
1122  case css::drawing::LineJoint_ROUND : m_xLBEdgeStyle->set_active(0); break;
1123  case css::drawing::LineJoint_NONE : m_xLBEdgeStyle->set_active(1); break;
1124  case css::drawing::LineJoint_MIDDLE : // fallback to mitre, unused value
1125  case css::drawing::LineJoint_MITER : m_xLBEdgeStyle->set_active(2); break;
1126  case css::drawing::LineJoint_BEVEL : m_xLBEdgeStyle->set_active(3); break;
1127  }
1128  }
1129  else
1130  {
1131  m_xLBEdgeStyle->set_active(-1);
1132  }
1133 
1134  // fdo#43209
1135  if(m_bObjSelected && SfxItemState::DEFAULT == rAttrs->GetItemState(XATTR_LINECAP))
1136  {
1137  m_xLBCapStyle->set_sensitive(false);
1138  }
1139  else if(SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_LINECAP))
1140  {
1141  const css::drawing::LineCap eLineCap(rAttrs->Get(XATTR_LINECAP).GetValue());
1142 
1143  switch(eLineCap)
1144  {
1145  case css::drawing::LineCap_ROUND: m_xLBCapStyle->set_active(1); break;
1146  case css::drawing::LineCap_SQUARE : m_xLBCapStyle->set_active(2); break;
1147  default /*css::drawing::LineCap_BUTT*/: m_xLBCapStyle->set_active(0); break;
1148  }
1149  }
1150  else
1151  {
1152  m_xLBCapStyle->set_active(-1);
1153  }
1154 
1155  // Save values
1156  m_xLbLineStyle->save_value();
1157  m_xMtrLineWidth->save_value();
1158  m_xLbColor->SaveValue();
1159  m_xLbStartStyle->save_value();
1160  m_xLbEndStyle->save_value();
1161  m_xMtrStartWidth->save_value();
1162  m_xMtrEndWidth->save_value();
1163  m_xTsbCenterStart->save_state();
1164  m_xTsbCenterEnd->save_state();
1165  m_xMtrTransparent->save_value();
1166 
1167  m_xLBEdgeStyle->save_value();
1168 
1169  // LineCaps
1170  m_xLBCapStyle->save_value();
1171 
1173 
1174  ChangePreviewHdl_Impl( nullptr );
1175 }
1176 
1177 std::unique_ptr<SfxTabPage> SvxLineTabPage::Create(weld::Container* pPage, weld::DialogController* pController,
1178  const SfxItemSet* rAttrs)
1179 {
1180  return std::make_unique<SvxLineTabPage>(pPage, pController, *rAttrs);
1181 }
1182 
1183 IMPL_LINK_NOARG(SvxLineTabPage, ChangePreviewListBoxHdl_Impl, ColorListBox&, void)
1184 {
1185  ChangePreviewHdl_Impl(nullptr);
1186 }
1187 
1188 IMPL_LINK(SvxLineTabPage, ChangePreviewModifyHdl_Impl, weld::MetricSpinButton&, rEdit, void)
1189 {
1190  ChangePreviewHdl_Impl(&rEdit);
1191 }
1192 
1194 {
1195  if (pCntrl == m_xMtrLineWidth.get())
1196  {
1197  // Line width and start end width
1198  sal_Int32 nNewLineWidth = GetCoreValue( *m_xMtrLineWidth, m_ePoolUnit );
1199  if(m_nActLineWidth == -1)
1200  {
1201  // Don't initialize yet, get the start value
1202  const SfxPoolItem* pOld = GetOldItem( m_rXLSet, XATTR_LINEWIDTH );
1203  sal_Int32 nStartLineWidth = 0;
1204  if(pOld)
1205  nStartLineWidth = static_cast<const XLineWidthItem *>(pOld)->GetValue();
1206  m_nActLineWidth = nStartLineWidth;
1207  }
1208 
1209  if(m_nActLineWidth != nNewLineWidth)
1210  {
1211  // Adapt start/end width
1212  sal_Int32 nValAct = GetCoreValue( *m_xMtrStartWidth, m_ePoolUnit );
1213  sal_Int32 nValNew = nValAct + (((nNewLineWidth - m_nActLineWidth) * 15) / 10);
1214  if(nValNew < 0)
1215  nValNew = 0;
1217 
1218  nValAct = GetCoreValue( *m_xMtrEndWidth, m_ePoolUnit );
1219  nValNew = nValAct + (((nNewLineWidth - m_nActLineWidth) * 15) / 10);
1220  if(nValNew < 0)
1221  nValNew = 0;
1223  }
1224 
1225  // Remember current value
1226  m_nActLineWidth = nNewLineWidth;
1227  }
1228 
1229  FillXLSet_Impl();
1230  m_aCtlPreview.Invalidate();
1231 
1232  // Make transparency accessible accordingly
1233  if( m_xLbLineStyle->get_active() == 0 ) // invisible
1234  {
1235  m_xBoxTransparency->set_sensitive(false);
1236  }
1237  else
1238  {
1239  m_xBoxTransparency->set_sensitive(true);
1240  }
1241 
1242  const bool bHasLineStyle = m_xLbLineStyle->get_active() !=0;
1243  const bool bHasLineStart = m_xLbStartStyle->get_active() != 0;
1244 
1245  m_xBoxStart->set_sensitive(bHasLineStart && bHasLineStyle);
1246 
1247  const bool bHasLineEnd = m_xLbEndStyle->get_active() != 0;
1248 
1249  m_xBoxEnd->set_sensitive(bHasLineEnd && bHasLineStyle);
1250 }
1251 
1252 IMPL_LINK_NOARG(SvxLineTabPage, ChangeStartClickHdl_Impl, weld::Toggleable&, void)
1253 {
1254  if (m_xCbxSynchronize->get_active())
1255  m_xTsbCenterEnd->set_state(m_xTsbCenterStart->get_state());
1256  ChangePreviewHdl_Impl(nullptr);
1257 }
1258 
1259 IMPL_LINK_NOARG(SvxLineTabPage, ChangeStartListBoxHdl_Impl, weld::ComboBox&, void)
1260 {
1261  if (m_xCbxSynchronize->get_active())
1262  m_xLbEndStyle->set_active(m_xLbStartStyle->get_active());
1263 
1264  ChangePreviewHdl_Impl(nullptr);
1265 }
1266 
1267 IMPL_LINK_NOARG(SvxLineTabPage, ChangeStartModifyHdl_Impl, weld::MetricSpinButton&, void)
1268 {
1269  if (m_xCbxSynchronize->get_active())
1270  m_xMtrEndWidth->set_value(m_xMtrStartWidth->get_value(FieldUnit::NONE), FieldUnit::NONE);
1271 
1272  ChangePreviewHdl_Impl(nullptr);
1273 }
1274 
1275 IMPL_LINK_NOARG(SvxLineTabPage, ChangeEdgeStyleHdl_Impl, weld::ComboBox&, void)
1276 {
1277  ChangePreviewHdl_Impl( nullptr );
1278 }
1279 
1280 // fdo#43209
1281 IMPL_LINK_NOARG(SvxLineTabPage, ChangeCapStyleHdl_Impl, weld::ComboBox&, void)
1282 {
1283  ChangePreviewHdl_Impl( nullptr );
1284 }
1285 
1286 IMPL_LINK_NOARG(SvxLineTabPage, ClickInvisibleHdl_Impl, weld::ComboBox&, void)
1287 {
1288  ClickInvisibleHdl_Impl();
1289 }
1290 
1292 {
1293  if( m_xLbLineStyle->get_active() == 0 ) // invisible
1294  {
1295  if(!m_bSymbols)
1296  m_xBoxColor->set_sensitive(false);
1297 
1298  m_xBoxWidth->set_sensitive(false);
1299 
1300  if( m_xFlLineEnds->get_sensitive() )
1301  {
1302  m_xBoxStart->set_sensitive(false);
1303  m_xBoxArrowStyles->set_sensitive(false);
1304  m_xGridEdgeCaps->set_sensitive(false);
1305  }
1306  }
1307  else
1308  {
1309  // set cap style associated to the line style
1310  sal_Int32 nPos = m_xLbLineStyle->get_active();
1311  if( nPos > 1 && m_pDashList->Count() > static_cast<tools::Long>( nPos - 2 ) )
1312  {
1313  css::drawing::DashStyle eStyle =
1314  m_pDashList->GetDash( nPos - 2 )->GetDash().GetDashStyle();
1315  if ( eStyle == drawing::DashStyle_RECT || eStyle == drawing::DashStyle_RECTRELATIVE)
1316  m_xLBCapStyle->set_active(0);
1317  else
1318  m_xLBCapStyle->set_active(1);
1319  }
1320 
1321  m_xBoxColor->set_sensitive(true);
1322  m_xBoxWidth->set_sensitive(true);
1323 
1324  if (m_xFlLineEnds->get_sensitive())
1325  {
1326  m_xBoxArrowStyles->set_sensitive(true);
1327  m_xGridEdgeCaps->set_sensitive(true);
1328  }
1329  }
1330  ChangePreviewHdl_Impl( nullptr );
1331 }
1332 
1333 IMPL_LINK_NOARG(SvxLineTabPage, ChangeEndClickHdl_Impl, weld::Toggleable&, void)
1334 {
1335  if (m_xCbxSynchronize->get_active())
1336  m_xTsbCenterStart->set_state(m_xTsbCenterEnd->get_state());
1337 
1338  ChangePreviewHdl_Impl(nullptr);
1339 }
1340 
1341 IMPL_LINK_NOARG(SvxLineTabPage, ChangeEndListBoxHdl_Impl, weld::ComboBox&, void)
1342 {
1343  if (m_xCbxSynchronize->get_active())
1344  m_xLbStartStyle->set_active(m_xLbEndStyle->get_active());
1345 
1346  ChangePreviewHdl_Impl(nullptr);
1347 }
1348 
1349 IMPL_LINK_NOARG(SvxLineTabPage, ChangeEndModifyHdl_Impl, weld::MetricSpinButton&, void)
1350 {
1351  if (m_xCbxSynchronize->get_active())
1352  m_xMtrStartWidth->set_value(m_xMtrEndWidth->get_value(FieldUnit::NONE), FieldUnit::NONE);
1353 
1354  ChangePreviewHdl_Impl(nullptr);
1355 }
1356 
1357 IMPL_LINK_NOARG(SvxLineTabPage, ChangeTransparentHdl_Impl, weld::MetricSpinButton&, void)
1358 {
1359  sal_uInt16 nVal = m_xMtrTransparent->get_value(FieldUnit::PERCENT);
1360 
1361  m_rXLSet.Put(XLineTransparenceItem(nVal));
1362 
1363  FillXLSet_Impl();
1364 
1365  m_aCtlPreview.Invalidate();
1366 }
1367 
1369 {
1370  // Write the synched value to the INI file
1371  OUString aStrUserData = OUString::boolean(m_xCbxSynchronize->get_active());
1372  SetUserData( aStrUserData );
1373 }
1374 
1375 // #58425# Symbols on a list (e.g. StarChart)
1376 // Handler for the symbol selection's popup menu (NumMenueButton)
1377 // The following link originates from SvxNumOptionsTabPage
1379 {
1381 
1382  // Initialize popup
1383  if (!m_xGalleryMenu)
1384  {
1385  m_xGalleryMenu = m_xBuilder->weld_menu("gallerysubmenu");
1386  weld::WaitObject aWait(GetFrameWeld());
1387  // Get gallery entries
1389 
1390  sal_uInt32 i = 0;
1391  for (auto const& grfName : m_aGrfNames)
1392  {
1393  const OUString *pUIName = &grfName;
1394 
1395  // Convert URL encodings to UI characters (e.g. %20 for spaces)
1396  OUString aPhysicalName;
1397  if (osl::FileBase::getSystemPathFromFileURL(grfName, aPhysicalName)
1398  == osl::FileBase::E_None)
1399  {
1400  pUIName = &aPhysicalName;
1401  }
1402 
1403  SvxBmpItemInfo* pInfo = new SvxBmpItemInfo;
1404  pInfo->pBrushItem.reset(new SvxBrushItem(grfName, "", GPOS_AREA, SID_ATTR_BRUSH));
1405  pInfo->sItemId = "gallery" + OUString::number(i);
1406  m_aGalleryBrushItems.emplace_back(pInfo);
1407  const Graphic* pGraphic = pInfo->pBrushItem->GetGraphic();
1408 
1409  if(pGraphic)
1410  {
1411  BitmapEx aBitmap(pGraphic->GetBitmapEx());
1412  Size aSize(aBitmap.GetSizePixel());
1413  if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
1414  {
1415  bool bWidth = aSize.Width() > aSize.Height();
1416  double nScale = bWidth ?
1417  double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width()):
1418  double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height());
1419  aBitmap.Scale(nScale, nScale);
1420 
1421  }
1422  pVD->SetOutputSizePixel(aBitmap.GetSizePixel());
1423  pVD->DrawBitmapEx(Point(), aBitmap);
1424  m_xGalleryMenu->append(pInfo->sItemId, *pUIName, *pVD);
1425  }
1426  else
1427  {
1428  m_xGalleryMenu->append(pInfo->sItemId, *pUIName);
1429  }
1430  ++i;
1431  }
1432 
1433  if (m_aGrfNames.empty())
1434  m_xSymbolMB->set_item_sensitive("gallery", false);
1435  }
1436 
1437  if (m_xSymbolsMenu || !m_pSymbolList)
1438  return;
1439 
1440  m_xSymbolsMenu = m_xBuilder->weld_menu("symbolssubmenu");
1442  pVDev->SetMapMode(MapMode(MapUnit::Map100thMM));
1443  std::unique_ptr<SdrModel> pModel(
1444  new SdrModel(nullptr, nullptr, true));
1445  pModel->GetItemPool().FreezeIdRanges();
1446  // Page
1447  rtl::Reference<SdrPage> pPage = new SdrPage( *pModel, false );
1448  pPage->SetSize(Size(1000,1000));
1449  pModel->InsertPage( pPage.get(), 0 );
1450  {
1451  // 3D View
1452  SdrView aView( *pModel, pVDev );
1453  aView.hideMarkHandles();
1454  aView.ShowSdrPage(pPage.get());
1455 
1456  // Generate invisible square to give all symbols a
1457  // bitmap size, which is independent from specific glyph
1458  SdrObject *pInvisibleSquare=m_pSymbolList->GetObj(0);
1459 
1460  // directly clone to target SdrModel
1461  pInvisibleSquare = pInvisibleSquare->CloneSdrObject(*pModel);
1462 
1463  pPage->NbcInsertObject(pInvisibleSquare);
1464  pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100));
1465  pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100));
1466 
1467  for(size_t i=0; i < m_pSymbolList->GetObjCount(); ++i)
1468  {
1469  SdrObject *pObj=m_pSymbolList->GetObj(i);
1470  assert(pObj);
1471 
1472  // directly clone to target SdrModel
1473  pObj = pObj->CloneSdrObject(*pModel);
1474 
1475  m_aGrfNames.emplace_back("");
1476  pPage->NbcInsertObject(pObj);
1477  if(m_xSymbolAttr)
1478  {
1479  pObj->SetMergedItemSet(*m_xSymbolAttr);
1480  }
1481  else
1482  {
1483  pObj->SetMergedItemSet(m_rOutAttrs);
1484  }
1485  aView.MarkAll();
1486  BitmapEx aBitmapEx(aView.GetMarkedObjBitmapEx());
1487  GDIMetaFile aMeta(aView.GetMarkedObjMetaFile());
1488  aView.UnmarkAll();
1489  pObj=pPage->RemoveObject(1);
1490  SdrObject::Free(pObj);
1491 
1492  SvxBmpItemInfo* pInfo = new SvxBmpItemInfo;
1493  pInfo->pBrushItem.reset(new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH));
1494  pInfo->sItemId = "symbol" + OUString::number(i);
1495  m_aSymbolBrushItems.emplace_back(pInfo);
1496 
1497  Size aSize(aBitmapEx.GetSizePixel());
1498  if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
1499  {
1500  bool bWidth = aSize.Width() > aSize.Height();
1501  double nScale = bWidth ?
1502  double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width()):
1503  double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height());
1504  aBitmapEx.Scale(nScale, nScale);
1505  }
1506  pVD->SetOutputSizePixel(aBitmapEx.GetSizePixel());
1507  pVD->DrawBitmapEx(Point(), aBitmapEx);
1508  m_xSymbolsMenu->append(pInfo->sItemId, "", *pVD);
1509  }
1510  pInvisibleSquare=pPage->RemoveObject(0);
1511  SdrObject::Free(pInvisibleSquare);
1512 
1513  if (m_aGrfNames.empty())
1514  m_xSymbolMB->set_item_sensitive("symbols", false);
1515  }
1516 }
1517 
1518 // #58425# Symbols on a list (e.g. StarChart)
1519 // Handler for menu button
1520 IMPL_LINK(SvxLineTabPage, GraphicHdl_Impl, const OString&, rIdent, void)
1521 {
1522  const Graphic* pGraphic = nullptr;
1523  Graphic aGraphic;
1524  bool bResetSize = false;
1525  bool bEnable = true;
1526  tools::Long nPreviousSymbolType = m_nSymbolType;
1527 
1528  OString sNumber;
1529  if (rIdent.startsWith("gallery", &sNumber))
1530  {
1531  SvxBmpItemInfo* pInfo = m_aGalleryBrushItems[sNumber.toUInt32()].get();
1532  pGraphic = pInfo->pBrushItem->GetGraphic();
1533  m_nSymbolType = SVX_SYMBOLTYPE_BRUSHITEM;
1534  }
1535  else if (rIdent.startsWith("symbol", &sNumber))
1536  {
1537  m_nSymbolType = sNumber.toUInt32();
1538  SvxBmpItemInfo* pInfo = m_aSymbolBrushItems[m_nSymbolType].get();
1539  pGraphic = pInfo->pBrushItem->GetGraphic();
1540  }
1541  else if (rIdent == "automatic")
1542  {
1543  pGraphic=&m_aAutoSymbolGraphic;
1544  m_aAutoSymbolGraphic.SetPrefSize( Size(253,253) );
1545  m_nSymbolType=SVX_SYMBOLTYPE_AUTO;
1546  }
1547  else if (rIdent == "none")
1548  {
1549  m_nSymbolType=SVX_SYMBOLTYPE_NONE;
1550  pGraphic=nullptr;
1551  bEnable = false;
1552  }
1553  else if (rIdent == "file")
1554  {
1555  SvxOpenGraphicDialog aGrfDlg(CuiResId(RID_CUISTR_EDIT_GRAPHIC), GetFrameWeld());
1556  aGrfDlg.EnableLink(false);
1557  aGrfDlg.AsLink(false);
1558  if( !aGrfDlg.Execute() )
1559  {
1560  // Remember selected filters
1561  if( !aGrfDlg.GetGraphic(aGraphic) )
1562  {
1563  m_nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
1564  pGraphic = &aGraphic;
1565  bResetSize = true;
1566  }
1567  }
1568  if( !pGraphic )
1569  return;
1570  }
1571 
1572  if (pGraphic)
1573  {
1574  Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic);
1575  aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(m_ePoolUnit));
1576  m_aSymbolGraphic=*pGraphic;
1577  if( bResetSize )
1578  {
1579  m_aSymbolSize=aSize;
1580  }
1581  else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM )
1582  { //#i31097# Data Point Symbol size changes when a different symbol is chosen(maoyg)
1583  if( m_aSymbolSize.Width() != m_aSymbolSize.Height() )
1584  {
1585  aSize.setWidth( static_cast<tools::Long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 );
1586  aSize.setHeight( static_cast<tools::Long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 );
1587  m_aSymbolSize = aSize;
1588  }
1589  }
1590  m_aCtlPreview.SetSymbol(&m_aSymbolGraphic,m_aSymbolSize);
1591  }
1592  else
1593  {
1594  m_aSymbolGraphic=Graphic();
1595  m_aCtlPreview.SetSymbol(nullptr,m_aSymbolSize);
1596  bEnable = false;
1597  }
1598  m_aSymbolLastSize=m_aSymbolSize;
1599  SetMetricValue(*m_xSymbolWidthMF, m_aSymbolSize.Width(), m_ePoolUnit);
1600  SetMetricValue(*m_xSymbolHeightMF, m_aSymbolSize.Height(), m_ePoolUnit);
1601 
1602  m_xGridIconSize->set_sensitive(bEnable);
1603  m_aCtlPreview.Invalidate();
1604 }
1605 
1606 IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField, void)
1607 {
1608  m_bNewSize = true;
1609  bool bWidth = &rField == m_xSymbolWidthMF.get();
1610  m_bLastWidthModified = bWidth;
1611  bool bRatio = m_xSymbolRatioCB->get_active();
1612  tools::Long nWidthVal = static_cast<tools::Long>(m_xSymbolWidthMF->denormalize(m_xSymbolWidthMF->get_value(FieldUnit::MM_100TH)));
1613  tools::Long nHeightVal= static_cast<tools::Long>(m_xSymbolHeightMF->denormalize(m_xSymbolHeightMF->get_value(FieldUnit::MM_100TH)));
1614  nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MapUnit::Map100thMM, m_ePoolUnit );
1615  nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MapUnit::Map100thMM, m_ePoolUnit);
1616  m_aSymbolSize = Size(nWidthVal,nHeightVal);
1617  double fSizeRatio = double(1);
1618 
1619  if(bRatio)
1620  {
1621  if (m_aSymbolLastSize.Height() && m_aSymbolLastSize.Width())
1622  fSizeRatio = static_cast<double>(m_aSymbolLastSize.Width()) / m_aSymbolLastSize.Height();
1623  }
1624 
1625  if (bWidth)
1626  {
1627  tools::Long nDelta = nWidthVal - m_aSymbolLastSize.Width();
1628  m_aSymbolSize.setWidth( nWidthVal );
1629  if (bRatio)
1630  {
1631  m_aSymbolSize.setHeight( m_aSymbolLastSize.Height() + static_cast<tools::Long>(static_cast<double>(nDelta) / fSizeRatio) );
1632  m_aSymbolSize.setHeight( OutputDevice::LogicToLogic( m_aSymbolSize.Height(), m_ePoolUnit, MapUnit::Map100thMM ) );
1633 //TODO m_xSymbolHeightMF->SetUserValue(m_xSymbolHeightMF->normalize(m_aSymbolSize.Height()), FieldUnit::MM_100TH);
1634  m_xSymbolHeightMF->set_value(m_xSymbolHeightMF->normalize(m_aSymbolSize.Height()), FieldUnit::MM_100TH);
1635  }
1636  }
1637  else
1638  {
1639  tools::Long nDelta = nHeightVal - m_aSymbolLastSize.Height();
1640  m_aSymbolSize.setHeight( nHeightVal );
1641  if (bRatio)
1642  {
1643  m_aSymbolSize.setWidth( m_aSymbolLastSize.Width() + static_cast<tools::Long>(static_cast<double>(nDelta) * fSizeRatio) );
1644  m_aSymbolSize.setWidth( OutputDevice::LogicToLogic( m_aSymbolSize.Width(), m_ePoolUnit, MapUnit::Map100thMM ) );
1645 //TODO m_xSymbolWidthMF->SetUserValue(m_xSymbolWidthMF->normalize(m_aSymbolSize.Width()), FieldUnit::MM_100TH);
1646  m_xSymbolWidthMF->set_value(m_xSymbolWidthMF->normalize(m_aSymbolSize.Width()), FieldUnit::MM_100TH);
1647  }
1648  }
1649  m_aCtlPreview.ResizeSymbol(m_aSymbolSize);
1650  m_aSymbolLastSize=m_aSymbolSize;
1651 }
1652 
1653 IMPL_LINK(SvxLineTabPage, RatioHdl_Impl, weld::Toggleable&, rBox, void)
1654 {
1655  if (rBox.get_active())
1656  {
1657  if (m_bLastWidthModified)
1658  SizeHdl_Impl(*m_xSymbolWidthMF);
1659  else
1660  SizeHdl_Impl(*m_xSymbolHeightMF);
1661  }
1662 }
1663 
1665 {
1666  const SvxDashListItem* pDashListItem = aSet.GetItem<SvxDashListItem>(SID_DASH_LIST, false);
1667  const SvxLineEndListItem* pLineEndListItem = aSet.GetItem<SvxLineEndListItem>(SID_LINEEND_LIST, false);
1668  const SfxUInt16Item* pPageTypeItem = aSet.GetItem<SfxUInt16Item>(SID_PAGE_TYPE, false);
1669  const SfxUInt16Item* pDlgTypeItem = aSet.GetItem<SfxUInt16Item>(SID_DLG_TYPE, false);
1670  const OfaPtrItem* pSdrObjListItem = aSet.GetItem<OfaPtrItem>(SID_OBJECT_LIST, false);
1671  const SfxTabDialogItem* pSymbolAttrItem = aSet.GetItem<SfxTabDialogItem>(SID_ATTR_SET, false);
1672  const SvxGraphicItem* pGraphicItem = aSet.GetItem<SvxGraphicItem>(SID_GRAPHIC, false);
1673 
1674  if (pDashListItem)
1675  SetDashList(pDashListItem->GetDashList());
1676  if (pLineEndListItem)
1677  SetLineEndList(pLineEndListItem->GetLineEndList());
1678  if (pPageTypeItem)
1679  SetPageType(static_cast<PageType>(pPageTypeItem->GetValue()));
1680  if (pDlgTypeItem)
1681  SetDlgType(pDlgTypeItem->GetValue());
1682  Construct();
1683 
1684  if(pSdrObjListItem) //symbols
1685  {
1686  ShowSymbolControls(true);
1687  m_pSymbolList = static_cast<SdrObjList*>(pSdrObjListItem->GetValue());
1688  if (pSymbolAttrItem)
1689  m_xSymbolAttr.reset(new SfxItemSet(pSymbolAttrItem->GetItemSet()));
1690  if(pGraphicItem)
1691  m_aAutoSymbolGraphic = pGraphicItem->GetGraphic();
1692  }
1693 }
1694 
1695 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SdrObjList * m_pSymbolList
a list of symbols to be shown in menu.
Definition: cuitabline.hxx:95
std::unique_ptr< SvxBrushItem > pBrushItem
Definition: cuitabline.hxx:84
void SetFieldUnit(weld::MetricSpinButton &rField, FieldUnit eUnit, bool bAll)
std::pair< Color, OUString > NamedColor
sal_Int32 m_nActLineWidth
Definition: cuitabline.hxx:133
FieldUnit
void SetMetricValue(weld::MetricSpinButton &rField, sal_Int64 nCoreValue, MapUnit eUnit)
SvxLineTabPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rInAttrs)
Definition: tpline.cxx:79
ErrCode GetGraphic(Graphic &) const
constexpr TypedWhichId< XLineEndItem > XATTR_LINEEND(XATTR_LINE_FIRST+5)
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
constexpr TypedWhichId< XLineEndCenterItem > XATTR_LINEENDCENTER(XATTR_LINE_FIRST+9)
#define SVX_SYMBOLTYPE_BRUSHITEM
sal_uInt16 m_nDlgType
Definition: cuitabline.hxx:127
constexpr TypedWhichId< XLineStartItem > XATTR_LINESTART(XATTR_LINE_FIRST+4)
void SetUserData(const OUString &rString)
void setWidth(tools::Long nWidth)
constexpr TypedWhichId< XLineJointItem > XATTR_LINEJOINT(XATTR_LINE_FIRST+11)
static constexpr auto Items
sal_Int32 * m_pPosDashLb
Definition: cuitabline.hxx:128
std::unique_ptr< weld::Widget > m_xFlLineEnds
Definition: cuitabline.hxx:143
SAL_WARN_UNUSED_RESULT Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
SvxXLinePreview m_aCtlPreview
Definition: cuitabline.hxx:135
std::unique_ptr< weld::Widget > m_xBoxWidth
Definition: cuitabline.hxx:139
virtual void PageCreated(const SfxAllItemSet &aSet) override
Definition: tpline.cxx:1664
std::unique_ptr< weld::Widget > m_xFlSymbol
Definition: cuitabline.hxx:163
sal_Int32 m_nSymbolType
Definition: cuitabline.hxx:99
constexpr OUStringLiteral sNone
void MarkAll()
long Long
virtual void FillUserData() override
Definition: tpline.cxx:1368
std::unique_ptr< weld::Widget > m_xBoxEnd
Definition: cuitabline.hxx:149
std::unique_ptr< SvxLineLB > m_xLbLineStyle
Definition: cuitabline.hxx:137
constexpr TypedWhichId< XLineWidthItem > XATTR_LINEWIDTH(XATTR_LINE_FIRST+2)
std::unique_ptr< weld::MetricSpinButton > m_xMtrLineWidth
Definition: cuitabline.hxx:140
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
sal_uInt16 GetValue() const
virtual void Reset(const SfxItemSet *) override
Definition: tpline.cxx:783
#define SVX_SYMBOLTYPE_UNKNOWN
Graphic m_aSymbolGraphic
Definition: cuitabline.hxx:110
std::unique_ptr< weld::MetricSpinButton > m_xMtrEndWidth
Definition: cuitabline.hxx:151
std::unique_ptr< weld::MetricSpinButton > m_xMtrTransparent
Definition: cuitabline.hxx:142
MapUnit m_ePoolUnit
Definition: cuitabline.hxx:131
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
PageType
void SetPageType(PageType nInType)
Definition: cuitabline.hxx:223
std::unique_ptr< weld::Widget > m_xBoxArrowStyles
Definition: cuitabline.hxx:144
constexpr TypedWhichId< XLineDashItem > XATTR_LINEDASH(XATTR_LINE_FIRST+1)
static void Free(SdrObject *&_rpObject)
void SetLineAttributes(const SfxItemSet &rItemSet)
XDashListRef m_pDashList
Definition: cuitabline.hxx:120
TRISTATE_TRUE
static Size GetGraphicSizeMM100(const Graphic *pGraphic)
FieldUnit GetModuleFieldUnit(const SfxItemSet &rSet)
virtual const tools::Rectangle & GetSnapRect() const
constexpr TypedWhichId< XLineTransparenceItem > XATTR_LINETRANSPARENCE(XATTR_LINE_FIRST+10)
constexpr tools::Long Width() const
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
#define SVX_SYMBOLTYPE_NONE
std::unique_ptr< weld::CheckButton > m_xTsbCenterEnd
Definition: cuitabline.hxx:152
#define MAX_BMP_HEIGHT
Definition: tpline.cxx:68
std::unique_ptr< ColorListBox > m_xLbColor
Definition: cuitabline.hxx:138
Graphic m_aAutoSymbolGraphic
a graphic to be displayed in the preview in case that an automatic symbol is chosen ...
Definition: cuitabline.hxx:98
virtual bool FillItemSet(SfxItemSet *) override
Definition: tpline.cxx:377
std::unique_ptr< weld::Widget > m_xBoxTransparency
Definition: cuitabline.hxx:141
int nCount
OUString SvxResId(TranslateId aId)
const OUString & GetUserData() const
void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
SdrPageView * ShowSdrPage(SdrPage *pPage) override
std::unique_ptr< weld::Widget > m_xGridEdgeCaps
Definition: cuitabline.hxx:157
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: tpline.cxx:358
std::unique_ptr< weld::Widget > m_xBoxStart
Definition: cuitabline.hxx:146
void ShowSymbol(bool b)
std::unique_ptr< weld::Widget > m_xFLEdgeStyle
Definition: cuitabline.hxx:156
void UnmarkAll()
TRISTATE_INDET
std::unique_ptr< SvxLineEndLB > m_xLbStartStyle
Definition: cuitabline.hxx:145
std::unique_ptr< weld::MetricSpinButton > m_xSymbolHeightMF
Definition: cuitabline.hxx:169
GDIMetaFile GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked=false) const
ChangeType * m_pnLineEndListState
Definition: cuitabline.hxx:123
void ShowSymbolControls(bool bOn)
Definition: tpline.cxx:195
IMPL_LINK_NOARG(SvxLineTabPage, ChangePreviewListBoxHdl_Impl, ColorListBox &, void)
Definition: tpline.cxx:1183
virtual tools::Long GetValue() const override
XLineEndListRef m_pLineEndList
Definition: cuitabline.hxx:121
OUString CuiResId(TranslateId aKey)
Definition: cuiresmgr.cxx:23
const SfxPoolItem * GetOldItem(const SfxItemSet &rSet, sal_uInt16 nSlot, bool bDeep=true)
const XDashListRef & GetDashList() const
SfxItemSet & m_rXLSet
Definition: cuitabline.hxx:118
void Construct()
Definition: tpline.cxx:215
constexpr TypedWhichId< XLineStartWidthItem > XATTR_LINESTARTWIDTH(XATTR_LINE_FIRST+6)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
#define DBG_ASSERT(sCon, aError)
int i
uno_Any a
ChangeType * m_pnColorListState
Definition: cuitabline.hxx:125
void SetDlgType(sal_uInt16 nInType)
Definition: cuitabline.hxx:224
XLineAttrSetItem m_aXLineAttr
Definition: cuitabline.hxx:117
void ChangePreviewHdl_Impl(const weld::MetricSpinButton *)
Definition: tpline.cxx:1193
constexpr TypedWhichId< XLineEndWidthItem > XATTR_LINEENDWIDTH(XATTR_LINE_FIRST+7)
void hideMarkHandles()
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *)
Definition: tpline.cxx:1177
TRISTATE_FALSE
void FillXLSet_Impl()
Definition: tpline.cxx:662
std::unique_ptr< SfxItemSet > m_xSymbolAttr
attributes for the shown symbols; only necessary if not equal to line properties
Definition: cuitabline.hxx:101
std::unique_ptr< weld::MetricSpinButton > m_xSymbolWidthMF
Definition: cuitabline.hxx:168
void SetDashList(XDashListRef const &pDshLst)
Definition: cuitabline.hxx:219
const SfxItemSet * GetItemSet(const SfxPoolItem &rAttr)
std::vector< std::unique_ptr< SvxBmpItemInfo > > m_aSymbolBrushItems
Definition: cuitabline.hxx:107
GPOS_MM
void ClickInvisibleHdl_Impl()
Definition: tpline.cxx:1291
virtual ~SvxLineTabPage() override
Definition: tpline.cxx:204
void SetMergedItem(const SfxPoolItem &rItem)
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
constexpr TypedWhichId< XLineStartCenterItem > XATTR_LINESTARTCENTER(XATTR_LINE_FIRST+8)
GPOS_AREA
std::unique_ptr< weld::ComboBox > m_xLBEdgeStyle
Definition: cuitabline.hxx:158
SfxItemPool * GetPool() const
#define MAX_BMP_WIDTH
Definition: tpline.cxx:67
void SetLineEndList(XLineEndListRef const &pLneEndLst)
Definition: cuitabline.hxx:220
const SfxItemSet & m_rOutAttrs
Definition: cuitabline.hxx:114
Size GetPrefSize() const
const basegfx::B2DPolyPolygon & GetLineEnd() const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
constexpr Size GetSize() const
weld::Entry & rEdit
std::unique_ptr< weld::MetricSpinButton > m_xMtrStartWidth
Definition: cuitabline.hxx:147
void SetSymbol(Graphic *p, const Size &s)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
MapMode GetPrefMapMode() const
constexpr tools::Long Height() const
#define SVX_SYMBOLTYPE_AUTO
sal_Int64 GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
void FillListboxes()
Definition: tpline.cxx:220
constexpr TypedWhichId< XLineCapItem > XATTR_LINECAP(XATTR_LINE_FIRST+12)
std::unique_ptr< weld::Widget > m_xGridIconSize
Definition: cuitabline.hxx:164
std::unique_ptr< weld::ComboBox > m_xLBCapStyle
Definition: cuitabline.hxx:161
virtual SdrObject * CloneSdrObject(SdrModel &rTargetModel) const
ChangeType * m_pnDashListState
Definition: cuitabline.hxx:124
SfxOkDialogController * GetDialogController() const
bool Append(std::u16string_view rTheSegment, EncodeMechanism eMechanism=EncodeMechanism::WasEncoded, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: tpline.cxx:243
IMPL_LINK(SvxLineTabPage, ChangePreviewModifyHdl_Impl, weld::MetricSpinButton &, rEdit, void)
Definition: tpline.cxx:1188
BitmapEx GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked=false, const sal_uInt32 nMaximumQuadraticPixels=500000, const std::optional< Size > &rTargetDPI=std::nullopt) const
std::unique_ptr< weld::CustomWeld > m_xCtlPreview
Definition: cuitabline.hxx:154
void SetPrefSize(const Size &rPrefSize)
std::unique_ptr< weld::Widget > m_xBoxColor
Definition: cuitabline.hxx:136
DeactivateRC
void setHeight(tools::Long nHeight)
PageType m_nPageType
Definition: cuitabline.hxx:126
Size m_aSymbolLastSize
Definition: cuitabline.hxx:109
std::unique_ptr< weld::CheckButton > m_xCbxSynchronize
Definition: cuitabline.hxx:153
static const WhichRangesContainer pLineRanges
Definition: cuitabline.hxx:90
std::vector< std::unique_ptr< SvxBmpItemInfo > > m_aGalleryBrushItems
Definition: cuitabline.hxx:105
TriState
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
constexpr TypedWhichId< XLineColorItem > XATTR_LINECOLOR(XATTR_LINE_FIRST+3)
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
aStr
std::unique_ptr< SvxLineEndLB > m_xLbEndStyle
Definition: cuitabline.hxx:150
OUString sItemId
Definition: cuitabline.hxx:85
static bool FillObjList(std::u16string_view rThemeName, std::vector< OUString > &rObjList)
sal_Int32 * m_pPosLineEndLb
Definition: cuitabline.hxx:129
sal_uInt16 nPos
bool m_bDetectedRangeSegmentation false
std::unique_ptr< weld::CheckButton > m_xTsbCenterStart
Definition: cuitabline.hxx:148