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
788  const SfxPoolItem *pPoolItem;
790  bool bPrevSym=false;
791  bool bEnable=true;
792  bool bIgnoreGraphic=false;
793  bool bIgnoreSize=false;
794  if(rAttrs->GetItemState(rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),true,&pPoolItem) == SfxItemState::SET)
795  {
796  nSymType=static_cast<const SfxInt32Item *>(pPoolItem)->GetValue();
797  }
798 
799  if(nSymType == SVX_SYMBOLTYPE_AUTO)
800  {
803  bPrevSym=true;
804  }
805  else if(nSymType == SVX_SYMBOLTYPE_NONE)
806  {
807  bEnable=false;
808  bIgnoreGraphic=true;
809  bIgnoreSize=true;
810  }
811  else if(nSymType >= 0)
812  {
814  pVDev->SetMapMode(MapMode(MapUnit::Map100thMM));
815 
816  std::unique_ptr<SdrModel> pModel(
817  new SdrModel(nullptr, nullptr, true));
818  pModel->GetItemPool().FreezeIdRanges();
819  rtl::Reference<SdrPage> pPage = new SdrPage( *pModel, false );
820  pPage->SetSize(Size(1000,1000));
821  pModel->InsertPage( pPage.get(), 0 );
822  {
823  SdrView aView( *pModel, pVDev );
824  aView.hideMarkHandles();
825  aView.ShowSdrPage(pPage.get());
826  size_t nSymTmp = static_cast<size_t>(nSymType);
827  if(m_pSymbolList)
828  {
830  {
831  nSymTmp %= m_pSymbolList->GetObjCount(); // Treat list as cyclic!
832  SdrObject *pObj=m_pSymbolList->GetObj(nSymTmp);
833  if(pObj)
834  {
835  // directly clone to target SdrModel
836  pObj = pObj->CloneSdrObject(*pModel);
837 
838  if(m_xSymbolAttr)
839  {
841  }
842  else
843  {
845  }
846 
847  pPage->NbcInsertObject(pObj);
848 
849  // Generate invisible square to give all symbol types a
850  // bitmap size, which is independent from specific glyph
851  SdrObject* pInvisibleSquare(m_pSymbolList->GetObj(0));
852 
853  // directly clone to target SdrModel
854  pInvisibleSquare = pInvisibleSquare->CloneSdrObject(*pModel);
855 
856  pPage->NbcInsertObject(pInvisibleSquare);
857  pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100));
858  pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100));
859 
860  aView.MarkAll();
861  GDIMetaFile aMeta(aView.GetMarkedObjMetaFile());
862 
863  m_aSymbolGraphic=Graphic(aMeta);
865  m_aSymbolGraphic.SetPrefSize(pInvisibleSquare->GetSnapRect().GetSize());
866  m_aSymbolGraphic.SetPrefMapMode(MapMode(MapUnit::Map100thMM));
867  bPrevSym=true;
868  bEnable=true;
869  bIgnoreGraphic=true;
870 
871  aView.UnmarkAll();
872  pInvisibleSquare=pPage->RemoveObject(1);
873  SdrObject::Free( pInvisibleSquare);
874  pObj=pPage->RemoveObject(0);
875  SdrObject::Free( pObj );
876  }
877  }
878  }
879  }
880  }
881  if(rAttrs->GetItemState(rAttrs->GetPool()->GetWhich(SID_ATTR_BRUSH),true,&pPoolItem) == SfxItemState::SET)
882  {
883  const Graphic* pGraphic = static_cast<const SvxBrushItem *>(pPoolItem)->GetGraphic();
884  if( pGraphic )
885  {
886  if(!bIgnoreGraphic)
887  {
888  m_aSymbolGraphic=*pGraphic;
889  }
890  if(!bIgnoreSize)
891  {
893  pGraphic->GetPrefMapMode(),
894  MapMode(MapUnit::Map100thMM));
895  }
896  bPrevSym=true;
897  }
898  }
899 
900  if(rAttrs->GetItemState(rAttrs->GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),true,&pPoolItem) == SfxItemState::SET)
901  {
902  m_aSymbolSize = static_cast<const SvxSizeItem *>(pPoolItem)->GetSize();
903  }
904 
905  m_xGridIconSize->set_sensitive(bEnable);
906 
907  if(bPrevSym)
908  {
913  }
914 
915  if( rAttrs->GetItemState( XATTR_LINESTYLE ) != SfxItemState::DONTCARE )
916  {
917  eXLS = rAttrs->Get( XATTR_LINESTYLE ).GetValue();
918 
919  switch( eXLS )
920  {
921  case drawing::LineStyle_NONE:
922  m_xLbLineStyle->set_active(0);
923  break;
924  case drawing::LineStyle_SOLID:
925  m_xLbLineStyle->set_active(1);
926  break;
927 
928  case drawing::LineStyle_DASH:
929  m_xLbLineStyle->set_active(-1);
930  m_xLbLineStyle->set_active_text(rAttrs->Get( XATTR_LINEDASH ).GetName());
931  break;
932 
933  default:
934  break;
935  }
936  }
937  else
938  {
939  m_xLbLineStyle->set_active(-1);
940  }
941 
942  // Line strength
943  if( rAttrs->GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE )
944  {
945  SetMetricValue( *m_xMtrLineWidth, rAttrs->Get( XATTR_LINEWIDTH ).GetValue(), m_ePoolUnit );
946  }
947  else
948  m_xMtrLineWidth->set_text("");
949 
950  // Line color
951  m_xLbColor->SetNoSelection();
952 
953  if ( rAttrs->GetItemState( XATTR_LINECOLOR ) != SfxItemState::DONTCARE )
954  {
955  Color aCol = rAttrs->Get( XATTR_LINECOLOR ).GetColorValue();
956  m_xLbColor->SelectEntry( aCol );
957  }
958 
959  // Line start
960  if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINESTART ) == SfxItemState::DEFAULT )
961  {
962  m_xLbStartStyle->set_sensitive(false);
963  }
964  else if( rAttrs->GetItemState( XATTR_LINESTART ) != SfxItemState::DONTCARE )
965  {
966  // #86265# select entry using list and polygon, not string
967  bool bSelected(false);
968  const basegfx::B2DPolyPolygon& rItemPolygon = rAttrs->Get(XATTR_LINESTART).GetLineStartValue();
969 
970  for(tools::Long a(0);!bSelected && a < m_pLineEndList->Count(); a++)
971  {
972  const XLineEndEntry* pEntry = m_pLineEndList->GetLineEnd(a);
973  const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
974 
975  if(rItemPolygon == rEntryPolygon)
976  {
977  // select this entry
978  m_xLbStartStyle->set_active(a + 1);
979  bSelected = true;
980  }
981  }
982 
983  if(!bSelected)
984  m_xLbStartStyle->set_active(0);
985  }
986  else
987  {
988  m_xLbStartStyle->set_active(-1);
989  }
990 
991  // Line end
992  if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINEEND ) == SfxItemState::DEFAULT )
993  {
994  m_xLbEndStyle->set_sensitive(false);
995  }
996  else if( rAttrs->GetItemState( XATTR_LINEEND ) != SfxItemState::DONTCARE )
997  {
998  // #86265# select entry using list and polygon, not string
999  bool bSelected(false);
1000  const basegfx::B2DPolyPolygon& rItemPolygon = rAttrs->Get(XATTR_LINEEND).GetLineEndValue();
1001 
1002  for(tools::Long a(0);!bSelected && a < m_pLineEndList->Count(); a++)
1003  {
1004  const XLineEndEntry* pEntry = m_pLineEndList->GetLineEnd(a);
1005  const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
1006 
1007  if(rItemPolygon == rEntryPolygon)
1008  {
1009  // select this entry
1010  m_xLbEndStyle->set_active(a + 1);
1011  bSelected = true;
1012  }
1013  }
1014 
1015  if(!bSelected)
1016  m_xLbEndStyle->set_active(0);
1017  }
1018  else
1019  {
1020  m_xLbEndStyle->set_active(-1);
1021  }
1022 
1023  // Line start strength
1024  if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINESTARTWIDTH ) == SfxItemState::DEFAULT )
1025  {
1026  m_xMtrStartWidth->set_sensitive(false);
1027  }
1028  else if( rAttrs->GetItemState( XATTR_LINESTARTWIDTH ) != SfxItemState::DONTCARE )
1029  {
1031  rAttrs->Get( XATTR_LINESTARTWIDTH ).GetValue(),
1032  m_ePoolUnit );
1033  }
1034  else
1035  m_xMtrStartWidth->set_text( "" );
1036 
1037  // Line end strength
1038  if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINEENDWIDTH ) == SfxItemState::DEFAULT )
1039  {
1040  m_xMtrEndWidth->set_sensitive(false);
1041  }
1042  else if( rAttrs->GetItemState( XATTR_LINEENDWIDTH ) != SfxItemState::DONTCARE )
1043  {
1045  rAttrs->Get( XATTR_LINEENDWIDTH ).GetValue(),
1046  m_ePoolUnit );
1047  }
1048  else
1049  m_xMtrEndWidth->set_text("");
1050 
1051  // Centered line end (start)
1052  if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINESTARTCENTER ) == SfxItemState::DEFAULT )
1053  {
1054  m_xTsbCenterStart->set_sensitive(false);
1055  }
1056  else if( rAttrs->GetItemState( XATTR_LINESTARTCENTER ) != SfxItemState::DONTCARE )
1057  {
1058  if( rAttrs->Get( XATTR_LINESTARTCENTER ).GetValue() )
1059  m_xTsbCenterStart->set_state(TRISTATE_TRUE);
1060  else
1061  m_xTsbCenterStart->set_state(TRISTATE_FALSE);
1062  }
1063  else
1064  {
1065  m_xTsbCenterStart->set_state(TRISTATE_INDET);
1066  }
1067 
1068  // Centered line end (end)
1069  if( m_bObjSelected && rAttrs->GetItemState( XATTR_LINEENDCENTER ) == SfxItemState::DEFAULT )
1070  {
1071  m_xTsbCenterEnd->set_sensitive(false);
1072  }
1073  else if( rAttrs->GetItemState( XATTR_LINEENDCENTER ) != SfxItemState::DONTCARE )
1074  {
1075  if( rAttrs->Get( XATTR_LINEENDCENTER ).GetValue() )
1076  m_xTsbCenterEnd->set_state(TRISTATE_TRUE);
1077  else
1078  m_xTsbCenterEnd->set_state(TRISTATE_FALSE);
1079  }
1080  else
1081  {
1082  m_xTsbCenterEnd->set_state(TRISTATE_INDET);
1083  }
1084 
1085  // Transparency
1086  if( rAttrs->GetItemState( XATTR_LINETRANSPARENCE ) != SfxItemState::DONTCARE )
1087  {
1088  sal_uInt16 nTransp = rAttrs->Get( XATTR_LINETRANSPARENCE ).GetValue();
1089  m_xMtrTransparent->set_value(nTransp, FieldUnit::PERCENT);
1090  ChangeTransparentHdl_Impl(*m_xMtrTransparent);
1091  }
1092  else
1093  m_xMtrTransparent->set_text( "" );
1094 
1095  if( !m_xLbStartStyle->get_sensitive() &&
1096  !m_xLbEndStyle->get_sensitive() &&
1097  !m_xMtrStartWidth->get_sensitive() &&
1098  !m_xMtrEndWidth->get_sensitive() &&
1099  !m_xTsbCenterStart->get_sensitive()&&
1100  !m_xTsbCenterEnd->get_sensitive() )
1101  {
1102  m_xCbxSynchronize->set_sensitive(false);
1103  m_xFlLineEnds->set_sensitive(false);
1104  }
1105 
1106  // Synchronize
1107  // We get the value from the INI file now
1108  OUString aStr = GetUserData();
1109  m_xCbxSynchronize->set_active(aStr.toInt32() != 0);
1110 
1111  if(m_bObjSelected && SfxItemState::DEFAULT == rAttrs->GetItemState(XATTR_LINEJOINT))
1112  {
1113 // maFTEdgeStyle.set_sensitive(false);
1114  m_xLBEdgeStyle->set_sensitive(false);
1115  }
1116  else if(SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_LINEJOINT))
1117  {
1118  const css::drawing::LineJoint eLineJoint = rAttrs->Get(XATTR_LINEJOINT).GetValue();
1119 
1120  switch(eLineJoint)
1121  {
1122  case css::drawing::LineJoint::LineJoint_MAKE_FIXED_SIZE: // fallback to round, unused value
1123  case css::drawing::LineJoint_ROUND : m_xLBEdgeStyle->set_active(0); break;
1124  case css::drawing::LineJoint_NONE : m_xLBEdgeStyle->set_active(1); break;
1125  case css::drawing::LineJoint_MIDDLE : // fallback to mitre, unused value
1126  case css::drawing::LineJoint_MITER : m_xLBEdgeStyle->set_active(2); break;
1127  case css::drawing::LineJoint_BEVEL : m_xLBEdgeStyle->set_active(3); break;
1128  }
1129  }
1130  else
1131  {
1132  m_xLBEdgeStyle->set_active(-1);
1133  }
1134 
1135  // fdo#43209
1136  if(m_bObjSelected && SfxItemState::DEFAULT == rAttrs->GetItemState(XATTR_LINECAP))
1137  {
1138  m_xLBCapStyle->set_sensitive(false);
1139  }
1140  else if(SfxItemState::DONTCARE != rAttrs->GetItemState(XATTR_LINECAP))
1141  {
1142  const css::drawing::LineCap eLineCap(rAttrs->Get(XATTR_LINECAP).GetValue());
1143 
1144  switch(eLineCap)
1145  {
1146  case css::drawing::LineCap_ROUND: m_xLBCapStyle->set_active(1); break;
1147  case css::drawing::LineCap_SQUARE : m_xLBCapStyle->set_active(2); break;
1148  default /*css::drawing::LineCap_BUTT*/: m_xLBCapStyle->set_active(0); break;
1149  }
1150  }
1151  else
1152  {
1153  m_xLBCapStyle->set_active(-1);
1154  }
1155 
1156  // Save values
1157  m_xLbLineStyle->save_value();
1158  m_xMtrLineWidth->save_value();
1159  m_xLbColor->SaveValue();
1160  m_xLbStartStyle->save_value();
1161  m_xLbEndStyle->save_value();
1162  m_xMtrStartWidth->save_value();
1163  m_xMtrEndWidth->save_value();
1164  m_xTsbCenterStart->save_state();
1165  m_xTsbCenterEnd->save_state();
1166  m_xMtrTransparent->save_value();
1167 
1168  m_xLBEdgeStyle->save_value();
1169 
1170  // LineCaps
1171  m_xLBCapStyle->save_value();
1172 
1174 
1175  ChangePreviewHdl_Impl( nullptr );
1176 }
1177 
1178 std::unique_ptr<SfxTabPage> SvxLineTabPage::Create(weld::Container* pPage, weld::DialogController* pController,
1179  const SfxItemSet* rAttrs)
1180 {
1181  return std::make_unique<SvxLineTabPage>(pPage, pController, *rAttrs);
1182 }
1183 
1184 IMPL_LINK_NOARG(SvxLineTabPage, ChangePreviewListBoxHdl_Impl, ColorListBox&, void)
1185 {
1186  ChangePreviewHdl_Impl(nullptr);
1187 }
1188 
1189 IMPL_LINK(SvxLineTabPage, ChangePreviewModifyHdl_Impl, weld::MetricSpinButton&, rEdit, void)
1190 {
1191  ChangePreviewHdl_Impl(&rEdit);
1192 }
1193 
1195 {
1196  if (pCntrl == m_xMtrLineWidth.get())
1197  {
1198  // Line width and start end width
1199  sal_Int32 nNewLineWidth = GetCoreValue( *m_xMtrLineWidth, m_ePoolUnit );
1200  if(m_nActLineWidth == -1)
1201  {
1202  // Don't initialize yet, get the start value
1203  const SfxPoolItem* pOld = GetOldItem( m_rXLSet, XATTR_LINEWIDTH );
1204  sal_Int32 nStartLineWidth = 0;
1205  if(pOld)
1206  nStartLineWidth = static_cast<const XLineWidthItem *>(pOld)->GetValue();
1207  m_nActLineWidth = nStartLineWidth;
1208  }
1209 
1210  if(m_nActLineWidth != nNewLineWidth)
1211  {
1212  // Adapt start/end width
1213  sal_Int32 nValAct = GetCoreValue( *m_xMtrStartWidth, m_ePoolUnit );
1214  sal_Int32 nValNew = nValAct + (((nNewLineWidth - m_nActLineWidth) * 15) / 10);
1215  if(nValNew < 0)
1216  nValNew = 0;
1218 
1219  nValAct = GetCoreValue( *m_xMtrEndWidth, m_ePoolUnit );
1220  nValNew = nValAct + (((nNewLineWidth - m_nActLineWidth) * 15) / 10);
1221  if(nValNew < 0)
1222  nValNew = 0;
1224  }
1225 
1226  // Remember current value
1227  m_nActLineWidth = nNewLineWidth;
1228  }
1229 
1230  FillXLSet_Impl();
1231  m_aCtlPreview.Invalidate();
1232 
1233  // Make transparency accessible accordingly
1234  if( m_xLbLineStyle->get_active() == 0 ) // invisible
1235  {
1236  m_xBoxTransparency->set_sensitive(false);
1237  }
1238  else
1239  {
1240  m_xBoxTransparency->set_sensitive(true);
1241  }
1242 
1243  const bool bHasLineStyle = m_xLbLineStyle->get_active() !=0;
1244  const bool bHasLineStart = m_xLbStartStyle->get_active() != 0;
1245 
1246  m_xBoxStart->set_sensitive(bHasLineStart && bHasLineStyle);
1247 
1248  const bool bHasLineEnd = m_xLbEndStyle->get_active() != 0;
1249 
1250  m_xBoxEnd->set_sensitive(bHasLineEnd && bHasLineStyle);
1251 }
1252 
1253 IMPL_LINK_NOARG(SvxLineTabPage, ChangeStartClickHdl_Impl, weld::Toggleable&, void)
1254 {
1255  if (m_xCbxSynchronize->get_active())
1256  m_xTsbCenterEnd->set_state(m_xTsbCenterStart->get_state());
1257  ChangePreviewHdl_Impl(nullptr);
1258 }
1259 
1260 IMPL_LINK_NOARG(SvxLineTabPage, ChangeStartListBoxHdl_Impl, weld::ComboBox&, void)
1261 {
1262  if (m_xCbxSynchronize->get_active())
1263  m_xLbEndStyle->set_active(m_xLbStartStyle->get_active());
1264 
1265  ChangePreviewHdl_Impl(nullptr);
1266 }
1267 
1268 IMPL_LINK_NOARG(SvxLineTabPage, ChangeStartModifyHdl_Impl, weld::MetricSpinButton&, void)
1269 {
1270  if (m_xCbxSynchronize->get_active())
1271  m_xMtrEndWidth->set_value(m_xMtrStartWidth->get_value(FieldUnit::NONE), FieldUnit::NONE);
1272 
1273  ChangePreviewHdl_Impl(nullptr);
1274 }
1275 
1276 IMPL_LINK_NOARG(SvxLineTabPage, ChangeEdgeStyleHdl_Impl, weld::ComboBox&, void)
1277 {
1278  ChangePreviewHdl_Impl( nullptr );
1279 }
1280 
1281 // fdo#43209
1282 IMPL_LINK_NOARG(SvxLineTabPage, ChangeCapStyleHdl_Impl, weld::ComboBox&, void)
1283 {
1284  ChangePreviewHdl_Impl( nullptr );
1285 }
1286 
1287 IMPL_LINK_NOARG(SvxLineTabPage, ClickInvisibleHdl_Impl, weld::ComboBox&, void)
1288 {
1289  ClickInvisibleHdl_Impl();
1290 }
1291 
1293 {
1294  if( m_xLbLineStyle->get_active() == 0 ) // invisible
1295  {
1296  if(!m_bSymbols)
1297  m_xBoxColor->set_sensitive(false);
1298 
1299  m_xBoxWidth->set_sensitive(false);
1300 
1301  if( m_xFlLineEnds->get_sensitive() )
1302  {
1303  m_xBoxStart->set_sensitive(false);
1304  m_xBoxArrowStyles->set_sensitive(false);
1305  m_xGridEdgeCaps->set_sensitive(false);
1306  }
1307  }
1308  else
1309  {
1310  // set cap style associated to the line style
1311  sal_Int32 nPos = m_xLbLineStyle->get_active();
1312  if( nPos > 1 && m_pDashList->Count() > static_cast<tools::Long>( nPos - 2 ) )
1313  {
1314  css::drawing::DashStyle eStyle =
1315  m_pDashList->GetDash( nPos - 2 )->GetDash().GetDashStyle();
1316  if ( eStyle == drawing::DashStyle_RECT || eStyle == drawing::DashStyle_RECTRELATIVE)
1317  m_xLBCapStyle->set_active(0);
1318  else
1319  m_xLBCapStyle->set_active(1);
1320  }
1321 
1322  m_xBoxColor->set_sensitive(true);
1323  m_xBoxWidth->set_sensitive(true);
1324 
1325  if (m_xFlLineEnds->get_sensitive())
1326  {
1327  m_xBoxArrowStyles->set_sensitive(true);
1328  m_xGridEdgeCaps->set_sensitive(true);
1329  }
1330  }
1331  ChangePreviewHdl_Impl( nullptr );
1332 }
1333 
1334 IMPL_LINK_NOARG(SvxLineTabPage, ChangeEndClickHdl_Impl, weld::Toggleable&, void)
1335 {
1336  if (m_xCbxSynchronize->get_active())
1337  m_xTsbCenterStart->set_state(m_xTsbCenterEnd->get_state());
1338 
1339  ChangePreviewHdl_Impl(nullptr);
1340 }
1341 
1342 IMPL_LINK_NOARG(SvxLineTabPage, ChangeEndListBoxHdl_Impl, weld::ComboBox&, void)
1343 {
1344  if (m_xCbxSynchronize->get_active())
1345  m_xLbStartStyle->set_active(m_xLbEndStyle->get_active());
1346 
1347  ChangePreviewHdl_Impl(nullptr);
1348 }
1349 
1350 IMPL_LINK_NOARG(SvxLineTabPage, ChangeEndModifyHdl_Impl, weld::MetricSpinButton&, void)
1351 {
1352  if (m_xCbxSynchronize->get_active())
1353  m_xMtrStartWidth->set_value(m_xMtrEndWidth->get_value(FieldUnit::NONE), FieldUnit::NONE);
1354 
1355  ChangePreviewHdl_Impl(nullptr);
1356 }
1357 
1358 IMPL_LINK_NOARG(SvxLineTabPage, ChangeTransparentHdl_Impl, weld::MetricSpinButton&, void)
1359 {
1360  sal_uInt16 nVal = m_xMtrTransparent->get_value(FieldUnit::PERCENT);
1361 
1362  m_rXLSet.Put(XLineTransparenceItem(nVal));
1363 
1364  FillXLSet_Impl();
1365 
1366  m_aCtlPreview.Invalidate();
1367 }
1368 
1370 {
1371  // Write the synched value to the INI file
1372  OUString aStrUserData = OUString::boolean(m_xCbxSynchronize->get_active());
1373  SetUserData( aStrUserData );
1374 }
1375 
1376 // #58425# Symbols on a list (e.g. StarChart)
1377 // Handler for the symbol selection's popup menu (NumMenueButton)
1378 // The following link originates from SvxNumOptionsTabPage
1380 {
1382 
1383  // Initialize popup
1384  if (!m_xGalleryMenu)
1385  {
1386  m_xGalleryMenu = m_xBuilder->weld_menu("gallerysubmenu");
1387  weld::WaitObject aWait(GetFrameWeld());
1388  // Get gallery entries
1390 
1391  sal_uInt32 i = 0;
1392  for (auto const& grfName : m_aGrfNames)
1393  {
1394  const OUString *pUIName = &grfName;
1395 
1396  // Convert URL encodings to UI characters (e.g. %20 for spaces)
1397  OUString aPhysicalName;
1398  if (osl::FileBase::getSystemPathFromFileURL(grfName, aPhysicalName)
1399  == osl::FileBase::E_None)
1400  {
1401  pUIName = &aPhysicalName;
1402  }
1403 
1404  SvxBmpItemInfo* pInfo = new SvxBmpItemInfo;
1405  pInfo->pBrushItem.reset(new SvxBrushItem(grfName, "", GPOS_AREA, SID_ATTR_BRUSH));
1406  pInfo->sItemId = "gallery" + OUString::number(i);
1407  m_aGalleryBrushItems.emplace_back(pInfo);
1408  const Graphic* pGraphic = pInfo->pBrushItem->GetGraphic();
1409 
1410  if(pGraphic)
1411  {
1412  BitmapEx aBitmap(pGraphic->GetBitmapEx());
1413  Size aSize(aBitmap.GetSizePixel());
1414  if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
1415  {
1416  bool bWidth = aSize.Width() > aSize.Height();
1417  double nScale = bWidth ?
1418  double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width()):
1419  double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height());
1420  aBitmap.Scale(nScale, nScale);
1421 
1422  }
1423  pVD->SetOutputSizePixel(aBitmap.GetSizePixel());
1424  pVD->DrawBitmapEx(Point(), aBitmap);
1425  m_xGalleryMenu->append(pInfo->sItemId, *pUIName, *pVD);
1426  }
1427  else
1428  {
1429  m_xGalleryMenu->append(pInfo->sItemId, *pUIName);
1430  }
1431  ++i;
1432  }
1433 
1434  if (m_aGrfNames.empty())
1435  m_xSymbolMB->set_item_sensitive("gallery", false);
1436  }
1437 
1438  if (m_xSymbolsMenu || !m_pSymbolList)
1439  return;
1440 
1441  m_xSymbolsMenu = m_xBuilder->weld_menu("symbolssubmenu");
1443  pVDev->SetMapMode(MapMode(MapUnit::Map100thMM));
1444  std::unique_ptr<SdrModel> pModel(
1445  new SdrModel(nullptr, nullptr, true));
1446  pModel->GetItemPool().FreezeIdRanges();
1447  // Page
1448  rtl::Reference<SdrPage> pPage = new SdrPage( *pModel, false );
1449  pPage->SetSize(Size(1000,1000));
1450  pModel->InsertPage( pPage.get(), 0 );
1451  {
1452  // 3D View
1453  SdrView aView( *pModel, pVDev );
1454  aView.hideMarkHandles();
1455  aView.ShowSdrPage(pPage.get());
1456 
1457  // Generate invisible square to give all symbols a
1458  // bitmap size, which is independent from specific glyph
1459  SdrObject *pInvisibleSquare=m_pSymbolList->GetObj(0);
1460 
1461  // directly clone to target SdrModel
1462  pInvisibleSquare = pInvisibleSquare->CloneSdrObject(*pModel);
1463 
1464  pPage->NbcInsertObject(pInvisibleSquare);
1465  pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100));
1466  pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100));
1467 
1468  for(size_t i=0; i < m_pSymbolList->GetObjCount(); ++i)
1469  {
1470  SdrObject *pObj=m_pSymbolList->GetObj(i);
1471  assert(pObj);
1472 
1473  // directly clone to target SdrModel
1474  pObj = pObj->CloneSdrObject(*pModel);
1475 
1476  m_aGrfNames.emplace_back("");
1477  pPage->NbcInsertObject(pObj);
1478  if(m_xSymbolAttr)
1479  {
1480  pObj->SetMergedItemSet(*m_xSymbolAttr);
1481  }
1482  else
1483  {
1484  pObj->SetMergedItemSet(m_rOutAttrs);
1485  }
1486  aView.MarkAll();
1487  BitmapEx aBitmapEx(aView.GetMarkedObjBitmapEx());
1488  GDIMetaFile aMeta(aView.GetMarkedObjMetaFile());
1489  aView.UnmarkAll();
1490  pObj=pPage->RemoveObject(1);
1491  SdrObject::Free(pObj);
1492 
1493  SvxBmpItemInfo* pInfo = new SvxBmpItemInfo;
1494  pInfo->pBrushItem.reset(new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH));
1495  pInfo->sItemId = "symbol" + OUString::number(i);
1496  m_aSymbolBrushItems.emplace_back(pInfo);
1497 
1498  Size aSize(aBitmapEx.GetSizePixel());
1499  if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
1500  {
1501  bool bWidth = aSize.Width() > aSize.Height();
1502  double nScale = bWidth ?
1503  double(MAX_BMP_WIDTH) / static_cast<double>(aSize.Width()):
1504  double(MAX_BMP_HEIGHT) / static_cast<double>(aSize.Height());
1505  aBitmapEx.Scale(nScale, nScale);
1506  }
1507  pVD->SetOutputSizePixel(aBitmapEx.GetSizePixel());
1508  pVD->DrawBitmapEx(Point(), aBitmapEx);
1509  m_xSymbolsMenu->append(pInfo->sItemId, "", *pVD);
1510  }
1511  pInvisibleSquare=pPage->RemoveObject(0);
1512  SdrObject::Free(pInvisibleSquare);
1513 
1514  if (m_aGrfNames.empty())
1515  m_xSymbolMB->set_item_sensitive("symbols", false);
1516  }
1517 }
1518 
1519 // #58425# Symbols on a list (e.g. StarChart)
1520 // Handler for menu button
1521 IMPL_LINK(SvxLineTabPage, GraphicHdl_Impl, const OString&, rIdent, void)
1522 {
1523  const Graphic* pGraphic = nullptr;
1524  Graphic aGraphic;
1525  bool bResetSize = false;
1526  bool bEnable = true;
1527  tools::Long nPreviousSymbolType = m_nSymbolType;
1528 
1529  OString sNumber;
1530  if (rIdent.startsWith("gallery", &sNumber))
1531  {
1532  SvxBmpItemInfo* pInfo = m_aGalleryBrushItems[sNumber.toUInt32()].get();
1533  pGraphic = pInfo->pBrushItem->GetGraphic();
1534  m_nSymbolType = SVX_SYMBOLTYPE_BRUSHITEM;
1535  }
1536  else if (rIdent.startsWith("symbol", &sNumber))
1537  {
1538  m_nSymbolType = sNumber.toUInt32();
1539  SvxBmpItemInfo* pInfo = m_aSymbolBrushItems[m_nSymbolType].get();
1540  pGraphic = pInfo->pBrushItem->GetGraphic();
1541  }
1542  else if (rIdent == "automatic")
1543  {
1544  pGraphic=&m_aAutoSymbolGraphic;
1545  m_aAutoSymbolGraphic.SetPrefSize( Size(253,253) );
1546  m_nSymbolType=SVX_SYMBOLTYPE_AUTO;
1547  }
1548  else if (rIdent == "none")
1549  {
1550  m_nSymbolType=SVX_SYMBOLTYPE_NONE;
1551  pGraphic=nullptr;
1552  bEnable = false;
1553  }
1554  else if (rIdent == "file")
1555  {
1556  SvxOpenGraphicDialog aGrfDlg(CuiResId(RID_SVXSTR_EDIT_GRAPHIC), GetFrameWeld());
1557  aGrfDlg.EnableLink(false);
1558  aGrfDlg.AsLink(false);
1559  if( !aGrfDlg.Execute() )
1560  {
1561  // Remember selected filters
1562  if( !aGrfDlg.GetGraphic(aGraphic) )
1563  {
1564  m_nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
1565  pGraphic = &aGraphic;
1566  bResetSize = true;
1567  }
1568  }
1569  if( !pGraphic )
1570  return;
1571  }
1572 
1573  if (pGraphic)
1574  {
1575  Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic);
1576  aSize = OutputDevice::LogicToLogic(aSize, MapMode(MapUnit::Map100thMM), MapMode(m_ePoolUnit));
1577  m_aSymbolGraphic=*pGraphic;
1578  if( bResetSize )
1579  {
1580  m_aSymbolSize=aSize;
1581  }
1582  else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM )
1583  { //#i31097# Data Point Symbol size changes when a different symbol is chosen(maoyg)
1584  if( m_aSymbolSize.Width() != m_aSymbolSize.Height() )
1585  {
1586  aSize.setWidth( static_cast<tools::Long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 );
1587  aSize.setHeight( static_cast<tools::Long>( m_aSymbolSize.Width() + m_aSymbolSize.Height() )/2 );
1588  m_aSymbolSize = aSize;
1589  }
1590  }
1591  m_aCtlPreview.SetSymbol(&m_aSymbolGraphic,m_aSymbolSize);
1592  }
1593  else
1594  {
1595  m_aSymbolGraphic=Graphic();
1596  m_aCtlPreview.SetSymbol(nullptr,m_aSymbolSize);
1597  bEnable = false;
1598  }
1599  m_aSymbolLastSize=m_aSymbolSize;
1600  SetMetricValue(*m_xSymbolWidthMF, m_aSymbolSize.Width(), m_ePoolUnit);
1601  SetMetricValue(*m_xSymbolHeightMF, m_aSymbolSize.Height(), m_ePoolUnit);
1602 
1603  m_xGridIconSize->set_sensitive(bEnable);
1604  m_aCtlPreview.Invalidate();
1605 }
1606 
1607 IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, weld::MetricSpinButton&, rField, void)
1608 {
1609  m_bNewSize = true;
1610  bool bWidth = &rField == m_xSymbolWidthMF.get();
1611  m_bLastWidthModified = bWidth;
1612  bool bRatio = m_xSymbolRatioCB->get_active();
1613  tools::Long nWidthVal = static_cast<tools::Long>(m_xSymbolWidthMF->denormalize(m_xSymbolWidthMF->get_value(FieldUnit::MM_100TH)));
1614  tools::Long nHeightVal= static_cast<tools::Long>(m_xSymbolHeightMF->denormalize(m_xSymbolHeightMF->get_value(FieldUnit::MM_100TH)));
1615  nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MapUnit::Map100thMM, m_ePoolUnit );
1616  nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MapUnit::Map100thMM, m_ePoolUnit);
1617  m_aSymbolSize = Size(nWidthVal,nHeightVal);
1618  double fSizeRatio = double(1);
1619 
1620  if(bRatio)
1621  {
1622  if (m_aSymbolLastSize.Height() && m_aSymbolLastSize.Width())
1623  fSizeRatio = static_cast<double>(m_aSymbolLastSize.Width()) / m_aSymbolLastSize.Height();
1624  }
1625 
1626  if (bWidth)
1627  {
1628  tools::Long nDelta = nWidthVal - m_aSymbolLastSize.Width();
1629  m_aSymbolSize.setWidth( nWidthVal );
1630  if (bRatio)
1631  {
1632  m_aSymbolSize.setHeight( m_aSymbolLastSize.Height() + static_cast<tools::Long>(static_cast<double>(nDelta) / fSizeRatio) );
1633  m_aSymbolSize.setHeight( OutputDevice::LogicToLogic( m_aSymbolSize.Height(), m_ePoolUnit, MapUnit::Map100thMM ) );
1634 //TODO m_xSymbolHeightMF->SetUserValue(m_xSymbolHeightMF->normalize(m_aSymbolSize.Height()), FieldUnit::MM_100TH);
1635  m_xSymbolHeightMF->set_value(m_xSymbolHeightMF->normalize(m_aSymbolSize.Height()), FieldUnit::MM_100TH);
1636  }
1637  }
1638  else
1639  {
1640  tools::Long nDelta = nHeightVal - m_aSymbolLastSize.Height();
1641  m_aSymbolSize.setHeight( nHeightVal );
1642  if (bRatio)
1643  {
1644  m_aSymbolSize.setWidth( m_aSymbolLastSize.Width() + static_cast<tools::Long>(static_cast<double>(nDelta) * fSizeRatio) );
1645  m_aSymbolSize.setWidth( OutputDevice::LogicToLogic( m_aSymbolSize.Width(), m_ePoolUnit, MapUnit::Map100thMM ) );
1646 //TODO m_xSymbolWidthMF->SetUserValue(m_xSymbolWidthMF->normalize(m_aSymbolSize.Width()), FieldUnit::MM_100TH);
1647  m_xSymbolWidthMF->set_value(m_xSymbolWidthMF->normalize(m_aSymbolSize.Width()), FieldUnit::MM_100TH);
1648  }
1649  }
1650  m_aCtlPreview.ResizeSymbol(m_aSymbolSize);
1651  m_aSymbolLastSize=m_aSymbolSize;
1652 }
1653 
1654 IMPL_LINK(SvxLineTabPage, RatioHdl_Impl, weld::Toggleable&, rBox, void)
1655 {
1656  if (rBox.get_active())
1657  {
1658  if (m_bLastWidthModified)
1659  SizeHdl_Impl(*m_xSymbolWidthMF);
1660  else
1661  SizeHdl_Impl(*m_xSymbolHeightMF);
1662  }
1663 }
1664 
1666 {
1667  const SvxDashListItem* pDashListItem = aSet.GetItem<SvxDashListItem>(SID_DASH_LIST, false);
1668  const SvxLineEndListItem* pLineEndListItem = aSet.GetItem<SvxLineEndListItem>(SID_LINEEND_LIST, false);
1669  const SfxUInt16Item* pPageTypeItem = aSet.GetItem<SfxUInt16Item>(SID_PAGE_TYPE, false);
1670  const SfxUInt16Item* pDlgTypeItem = aSet.GetItem<SfxUInt16Item>(SID_DLG_TYPE, false);
1671  const OfaPtrItem* pSdrObjListItem = aSet.GetItem<OfaPtrItem>(SID_OBJECT_LIST, false);
1672  const SfxTabDialogItem* pSymbolAttrItem = aSet.GetItem<SfxTabDialogItem>(SID_ATTR_SET, false);
1673  const SvxGraphicItem* pGraphicItem = aSet.GetItem<SvxGraphicItem>(SID_GRAPHIC, false);
1674 
1675  if (pDashListItem)
1676  SetDashList(pDashListItem->GetDashList());
1677  if (pLineEndListItem)
1678  SetLineEndList(pLineEndListItem->GetLineEndList());
1679  if (pPageTypeItem)
1680  SetPageType(static_cast<PageType>(pPageTypeItem->GetValue()));
1681  if (pDlgTypeItem)
1682  SetDlgType(pDlgTypeItem->GetValue());
1683  Construct();
1684 
1685  if(pSdrObjListItem) //symbols
1686  {
1687  ShowSymbolControls(true);
1688  m_pSymbolList = static_cast<SdrObjList*>(pSdrObjListItem->GetValue());
1689  if (pSymbolAttrItem)
1690  m_xSymbolAttr.reset(new SfxItemSet(pSymbolAttrItem->GetItemSet()));
1691  if(pGraphicItem)
1692  m_aAutoSymbolGraphic = pGraphicItem->GetGraphic();
1693  }
1694 }
1695 
1696 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tools::Long m_nSymbolType
Definition: cuitabline.hxx:99
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
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)
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:1665
std::unique_ptr< weld::Widget > m_xFlSymbol
Definition: cuitabline.hxx:163
constexpr OUStringLiteral sNone
void MarkAll()
long Long
virtual void FillUserData() override
Definition: tpline.cxx:1369
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:1184
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:1194
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:1178
TRISTATE_FALSE
int GetCoreValue(const weld::MetricSpinButton &rField, MapUnit eUnit)
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:1292
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
void SetMetricValue(weld::MetricSpinButton &rField, int nCoreValue, MapUnit eUnit)
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
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:1189
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
std::unique_ptr< weld::CheckButton > m_xTsbCenterStart
Definition: cuitabline.hxx:148