Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <tools/shl.hxx>
30 : : #include <tools/urlobj.hxx>
31 : : #include <vcl/msgbox.hxx>
32 : : #include <unotools/pathoptions.hxx>
33 : : #include <sfx2/app.hxx>
34 : : #include <sfx2/module.hxx>
35 : : #include <sfx2/filedlghelper.hxx>
36 : : #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
37 : :
38 : : #define _SVX_TPLNEDEF_CXX
39 : :
40 : : #include <cuires.hrc>
41 : : #include "tabline.hrc"
42 : : #include "helpid.hrc"
43 : :
44 : : #include "svx/xattr.hxx"
45 : : #include <svx/xpool.hxx>
46 : : #include <svx/xtable.hxx>
47 : :
48 : : #include "svx/drawitem.hxx"
49 : : #include "cuitabline.hxx"
50 : : #include "defdlgname.hxx"
51 : : #include <svx/svxdlg.hxx>
52 : : #include <dialmgr.hxx>
53 : : #include "svx/dlgutil.hxx"
54 : : #include <svx/dialmgr.hxx>
55 : : #include <svx/dialogs.hrc>
56 : :
57 : : #define XOUT_WIDTH 150
58 : :
59 : 0 : SvxLineDefTabPage::SvxLineDefTabPage
60 : : (
61 : : Window* pParent,
62 : : const SfxItemSet& rInAttrs
63 : : ) :
64 : :
65 : 0 : SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_LINE_DEF ), rInAttrs ),
66 : :
67 [ # # ]: 0 : aFlDefinition ( this, CUI_RES( FL_DEFINITION ) ),
68 [ # # ]: 0 : aFTLinestyle ( this, CUI_RES( FT_LINESTYLE ) ),
69 [ # # ]: 0 : aLbLineStyles ( this, CUI_RES( LB_LINESTYLES ) ),
70 [ # # ]: 0 : aFtType ( this, CUI_RES( FT_TYPE ) ),
71 [ # # ]: 0 : aLbType1 ( this, CUI_RES( LB_TYPE_1 ) ),
72 [ # # ]: 0 : aLbType2 ( this, CUI_RES( LB_TYPE_2 ) ),
73 [ # # ]: 0 : aFtNumber ( this, CUI_RES( FT_NUMBER ) ),
74 [ # # ]: 0 : aNumFldNumber1 ( this, CUI_RES( NUM_FLD_1 ) ),
75 [ # # ]: 0 : aNumFldNumber2 ( this, CUI_RES( NUM_FLD_2 ) ),
76 [ # # ]: 0 : aFtLength ( this, CUI_RES( FT_LENGTH ) ),
77 [ # # ]: 0 : aMtrLength1 ( this, CUI_RES( MTR_FLD_LENGTH_1 ) ),
78 [ # # ]: 0 : aMtrLength2 ( this, CUI_RES( MTR_FLD_LENGTH_2 ) ),
79 [ # # ]: 0 : aFtDistance ( this, CUI_RES( FT_DISTANCE ) ),
80 [ # # ]: 0 : aMtrDistance ( this, CUI_RES( MTR_FLD_DISTANCE ) ),
81 [ # # ]: 0 : aCbxSynchronize ( this, CUI_RES( CBX_SYNCHRONIZE ) ),
82 [ # # ]: 0 : aBtnAdd ( this, CUI_RES( BTN_ADD ) ),
83 [ # # ]: 0 : aBtnModify ( this, CUI_RES( BTN_MODIFY ) ),
84 [ # # ]: 0 : aBtnDelete ( this, CUI_RES( BTN_DELETE ) ),
85 [ # # ]: 0 : aBtnLoad ( this, CUI_RES( BTN_LOAD ) ),
86 [ # # ]: 0 : aBtnSave ( this, CUI_RES( BTN_SAVE ) ),
87 [ # # ]: 0 : aCtlPreview ( this, CUI_RES( CTL_PREVIEW ) ),
88 : :
89 : : rOutAttrs ( rInAttrs ),
90 : :
91 : 0 : pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
92 : : aXLStyle ( XLINE_DASH ),
93 : : aXWidth ( XOUT_WIDTH ),
94 : : aXDash ( String(), XDash( XDASH_RECT, 3, 7, 2, 40, 15 ) ),
95 : : aXColor ( String(), COL_BLACK ),
96 : : aXLineAttr ( pXPool ),
97 [ # # ][ # # ]: 0 : rXLSet ( aXLineAttr.GetItemSet() )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
[ # # # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
98 : : {
99 [ # # ][ # # ]: 0 : aLbType1.SetAccessibleName(String(CUI_RES( STR_START_TYPE ) ) );
[ # # ][ # # ]
100 [ # # ][ # # ]: 0 : aLbType2.SetAccessibleName(String(CUI_RES( STR_END_TYPE ) ) );
[ # # ][ # # ]
101 [ # # ][ # # ]: 0 : aNumFldNumber1.SetAccessibleName(String(CUI_RES( STR_START_NUM ) ) );
[ # # ][ # # ]
102 [ # # ][ # # ]: 0 : aNumFldNumber2.SetAccessibleName(String(CUI_RES( STR_END_NUM ) ) );
[ # # ][ # # ]
103 [ # # ][ # # ]: 0 : aMtrLength1.SetAccessibleName(String(CUI_RES( STR_START_LENGTH ) ) );
[ # # ][ # # ]
104 [ # # ][ # # ]: 0 : aMtrLength2.SetAccessibleName(String(CUI_RES( STR_END_LENGTH ) ) );
[ # # ][ # # ]
105 : :
106 [ # # ]: 0 : FreeResource();
107 : :
108 : : // this page needs ExchangeSupport
109 : 0 : SetExchangeSupport();
110 : :
111 : : // adjust metric
112 [ # # ]: 0 : eFUnit = GetModuleFieldUnit( rInAttrs );
113 : :
114 [ # # ]: 0 : switch ( eFUnit )
115 : : {
116 : : case FUNIT_M:
117 : : case FUNIT_KM:
118 : 0 : eFUnit = FUNIT_MM;
119 : 0 : break;
120 : : default: ; //prevent warning
121 : : }
122 [ # # ]: 0 : SetFieldUnit( aMtrDistance, eFUnit );
123 [ # # ]: 0 : SetFieldUnit( aMtrLength1, eFUnit );
124 [ # # ]: 0 : SetFieldUnit( aMtrLength2, eFUnit );
125 : :
126 : : // determine PoolUnit
127 : 0 : SfxItemPool* pPool = rOutAttrs.GetPool();
128 : : DBG_ASSERT( pPool, "Wo ist der Pool?" );
129 [ # # ]: 0 : ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH );
130 : :
131 [ # # ]: 0 : rXLSet.Put( aXLStyle );
132 [ # # ]: 0 : rXLSet.Put( aXWidth );
133 [ # # ]: 0 : rXLSet.Put( aXDash );
134 [ # # ]: 0 : rXLSet.Put( aXColor );
135 : :
136 : : // #i34740#
137 [ # # ]: 0 : aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
138 : :
139 [ # # ]: 0 : aBtnAdd.SetClickHdl( LINK( this, SvxLineDefTabPage, ClickAddHdl_Impl ) );
140 : : aBtnModify.SetClickHdl(
141 [ # # ]: 0 : LINK( this, SvxLineDefTabPage, ClickModifyHdl_Impl ) );
142 : : aBtnDelete.SetClickHdl(
143 [ # # ]: 0 : LINK( this, SvxLineDefTabPage, ClickDeleteHdl_Impl ) );
144 [ # # ]: 0 : aBtnLoad.SetClickHdl( LINK( this, SvxLineDefTabPage, ClickLoadHdl_Impl ) );
145 [ # # ]: 0 : aBtnSave.SetClickHdl( LINK( this, SvxLineDefTabPage, ClickSaveHdl_Impl ) );
146 : :
147 : : aNumFldNumber1.SetModifyHdl(
148 [ # # ]: 0 : LINK( this, SvxLineDefTabPage, ChangeNumber1Hdl_Impl ) );
149 : : aNumFldNumber2.SetModifyHdl(
150 [ # # ]: 0 : LINK( this, SvxLineDefTabPage, ChangeNumber2Hdl_Impl ) );
151 : : aLbLineStyles.SetSelectHdl(
152 [ # # ]: 0 : LINK( this, SvxLineDefTabPage, SelectLinestyleHdl_Impl ) );
153 : :
154 : : // absolute (in mm) or relative (in %)
155 : : aCbxSynchronize.SetClickHdl(
156 [ # # ]: 0 : LINK( this, SvxLineDefTabPage, ChangeMetricHdl_Impl ) );
157 : :
158 : : // preview must be updated when there's something changed
159 [ # # ]: 0 : Link aLink = LINK( this, SvxLineDefTabPage, SelectTypeHdl_Impl );
160 : 0 : aLbType1.SetSelectHdl( aLink );
161 : 0 : aLbType2.SetSelectHdl( aLink );
162 [ # # ]: 0 : aLink = LINK( this, SvxLineDefTabPage, ChangePreviewHdl_Impl );
163 : 0 : aMtrLength1.SetModifyHdl( aLink );
164 : 0 : aMtrLength2.SetModifyHdl( aLink );
165 : 0 : aMtrDistance.SetModifyHdl( aLink );
166 : :
167 [ # # ]: 0 : pDashList = NULL;
168 : :
169 [ # # ]: 0 : aBtnAdd.SetAccessibleRelationMemberOf( &aFlDefinition );
170 [ # # ]: 0 : aBtnModify.SetAccessibleRelationMemberOf( &aFlDefinition );
171 [ # # ]: 0 : aBtnDelete.SetAccessibleRelationMemberOf( &aFlDefinition );
172 [ # # ]: 0 : aBtnLoad.SetAccessibleRelationMemberOf( &aFlDefinition );
173 [ # # ]: 0 : aBtnSave.SetAccessibleRelationMemberOf( &aFlDefinition );
174 : 0 : }
175 : :
176 : :
177 : : // -----------------------------------------------------------------------
178 : :
179 : 0 : void SvxLineDefTabPage::Construct()
180 : : {
181 : 0 : aLbLineStyles.Fill( pDashList );
182 : 0 : }
183 : :
184 : : // -----------------------------------------------------------------------
185 : :
186 : 0 : void SvxLineDefTabPage::ActivatePage( const SfxItemSet& )
187 : : {
188 [ # # ]: 0 : if( *pDlgType == 0 ) // area dialog
189 : : {
190 : : // ActivatePage() is called before the dialog receives PageCreated() !!!
191 [ # # ]: 0 : if( pDashList.is() )
192 : : {
193 [ # # ][ # # ]: 0 : if( *pPageType == 1 &&
194 : : *pPosDashLb != LISTBOX_ENTRY_NOTFOUND )
195 : : {
196 [ # # ]: 0 : aLbLineStyles.SelectEntryPos( *pPosDashLb );
197 : : }
198 : : // so that a possibly existing line style is discarded
199 [ # # ]: 0 : SelectLinestyleHdl_Impl( this );
200 : :
201 : : // determining (and possibly cutting) the name
202 : : // and displaying it in the GroupBox
203 [ # # ][ # # ]: 0 : String aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
[ # # ]
204 [ # # ][ # # ]: 0 : INetURLObject aURL( pDashList->GetPath() );
205 : :
206 [ # # ][ # # ]: 0 : aURL.Append( pDashList->GetName() );
207 : : DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
208 : :
209 : 0 : *pPageType = 0; // 2
210 [ # # ][ # # ]: 0 : *pPosDashLb = LISTBOX_ENTRY_NOTFOUND;
211 : : }
212 : : }
213 : 0 : }
214 : :
215 : : // -----------------------------------------------------------------------
216 : :
217 : 0 : int SvxLineDefTabPage::DeactivatePage( SfxItemSet* _pSet )
218 : : {
219 : 0 : CheckChanges_Impl();
220 : :
221 [ # # ]: 0 : if( _pSet )
222 : 0 : FillItemSet( *_pSet );
223 : :
224 : 0 : return( LEAVE_PAGE );
225 : : }
226 : :
227 : : // -----------------------------------------------------------------------
228 : :
229 : 0 : void SvxLineDefTabPage::CheckChanges_Impl()
230 : : {
231 : : // is here used to NOT lose changes
232 : : //XDashStyle eXDS;
233 : :
234 [ # # ][ # # ]: 0 : if( aNumFldNumber1.GetText() != aNumFldNumber1.GetSavedValue() ||
[ # # ]
[ # # # # ]
[ # # ]
[ # # # # ]
[ # # ][ # # ]
[ # # # # ]
235 [ # # ][ # # ]: 0 : aMtrLength1.GetText() != aMtrLength1.GetSavedValue() ||
[ # # ][ # # ]
[ # # ]
236 [ # # ]: 0 : aLbType1.GetSelectEntryPos() != aLbType1.GetSavedValue() ||
237 [ # # ][ # # ]: 0 : aNumFldNumber2.GetText() != aNumFldNumber2.GetSavedValue() ||
[ # # ][ # # ]
[ # # ]
238 [ # # ][ # # ]: 0 : aMtrLength2.GetText() != aMtrLength2.GetSavedValue() ||
[ # # ][ # # ]
[ # # ]
239 [ # # ]: 0 : aLbType2.GetSelectEntryPos() != aLbType2.GetSavedValue() ||
240 [ # # ][ # # ]: 0 : aMtrDistance.GetText() != aMtrDistance.GetSavedValue() )
[ # # ][ # # ]
[ # # ]
241 : : {
242 [ # # ]: 0 : ResMgr& rMgr = CUI_MGR();
243 [ # # ]: 0 : Image aWarningBoxImage = WarningBox::GetStandardImage();
244 [ # # ]: 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
245 : : DBG_ASSERT(pFact, "Dialogdiet fail!");
246 : : AbstractSvxMessDialog* aMessDlg = pFact->CreateSvxMessDialog( GetParentDialog(), RID_SVXDLG_MESSBOX,
247 [ # # ]: 0 : SVX_RESSTR( RID_SVXSTR_LINESTYLE ),
248 : : String( ResId( RID_SVXSTR_ASK_CHANGE_LINESTYLE, rMgr ) ),
249 [ # # ][ # # ]: 0 : &aWarningBoxImage );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
250 : : DBG_ASSERT(aMessDlg, "Dialogdiet fail!");
251 : : aMessDlg->SetButtonText( MESS_BTN_1,
252 [ # # ][ # # ]: 0 : String( ResId( RID_SVXSTR_CHANGE, rMgr ) ) );
[ # # ]
253 : : aMessDlg->SetButtonText( MESS_BTN_2,
254 [ # # ][ # # ]: 0 : String( ResId( RID_SVXSTR_ADD, rMgr ) ) );
[ # # ]
255 : :
256 [ # # ]: 0 : short nRet = aMessDlg->Execute();
257 : :
258 [ # # # # ]: 0 : switch( nRet )
259 : : {
260 : : case RET_BTN_1:
261 : : {
262 [ # # ]: 0 : ClickModifyHdl_Impl( this );
263 : : }
264 : 0 : break;
265 : :
266 : : case RET_BTN_2:
267 : : {
268 [ # # ]: 0 : ClickAddHdl_Impl( this );
269 : : }
270 : 0 : break;
271 : :
272 : : case RET_CANCEL:
273 : 0 : break;
274 : : }
275 [ # # ][ # # ]: 0 : delete aMessDlg;
[ # # ]
276 : : }
277 : :
278 : :
279 : :
280 : 0 : sal_uInt16 nPos = aLbLineStyles.GetSelectEntryPos();
281 [ # # ]: 0 : if( nPos != LISTBOX_ENTRY_NOTFOUND )
282 : : {
283 : 0 : *pPosDashLb = nPos;
284 : : }
285 : 0 : }
286 : :
287 : : // -----------------------------------------------------------------------
288 : :
289 : 0 : sal_Bool SvxLineDefTabPage::FillItemSet( SfxItemSet& rAttrs )
290 : : {
291 [ # # ]: 0 : if( *pDlgType == 0 ) // line dialog
292 : : {
293 [ # # ]: 0 : if( *pPageType == 2 )
294 : : {
295 [ # # ]: 0 : FillDash_Impl();
296 : :
297 [ # # ]: 0 : String aString( aLbLineStyles.GetSelectEntry() );
298 [ # # ][ # # ]: 0 : rAttrs.Put( XLineStyleItem( XLINE_DASH ) );
[ # # ]
299 [ # # ][ # # ]: 0 : rAttrs.Put( XLineDashItem( aString, aDash ) );
[ # # ][ # # ]
300 : : }
301 : : }
302 : 0 : return( sal_True );
303 : : }
304 : :
305 : : // -----------------------------------------------------------------------
306 : :
307 : 0 : void SvxLineDefTabPage::Reset( const SfxItemSet& rAttrs )
308 : : {
309 [ # # ]: 0 : if( rAttrs.GetItemState( GetWhich( XATTR_LINESTYLE ) ) != SFX_ITEM_DONTCARE )
310 : : {
311 : 0 : XLineStyle eXLS = (XLineStyle) ( ( const XLineStyleItem& ) rAttrs.Get( GetWhich( XATTR_LINESTYLE ) ) ).GetValue();
312 : :
313 [ # # # ]: 0 : switch( eXLS )
314 : : {
315 : : case XLINE_NONE:
316 : : case XLINE_SOLID:
317 : 0 : aLbLineStyles.SelectEntryPos( 0 );
318 : 0 : break;
319 : :
320 : : case XLINE_DASH:
321 : : {
322 : 0 : const XLineDashItem& rDashItem = ( const XLineDashItem& ) rAttrs.Get( XATTR_LINEDASH );
323 : 0 : aDash = rDashItem.GetDashValue();
324 : :
325 : 0 : aLbLineStyles.SetNoSelection();
326 [ # # ]: 0 : aLbLineStyles.SelectEntry( rDashItem.GetName() );
327 : : }
328 : 0 : break;
329 : :
330 : : default:
331 : 0 : break;
332 : : }
333 : : }
334 : 0 : SelectLinestyleHdl_Impl( NULL );
335 : :
336 : : // determine button state
337 [ # # ]: 0 : if( pDashList->Count() )
338 : : {
339 : 0 : aBtnModify.Enable();
340 : 0 : aBtnDelete.Enable();
341 : 0 : aBtnSave.Enable();
342 : : }
343 : : else
344 : : {
345 : 0 : aBtnModify.Disable();
346 : 0 : aBtnDelete.Disable();
347 : 0 : aBtnSave.Disable();
348 : : }
349 : 0 : }
350 : :
351 : : // -----------------------------------------------------------------------
352 : :
353 : 0 : SfxTabPage* SvxLineDefTabPage::Create( Window* pWindow,
354 : : const SfxItemSet& rOutAttrs )
355 : : {
356 [ # # ]: 0 : return( new SvxLineDefTabPage( pWindow, rOutAttrs ) );
357 : : }
358 : :
359 : : //------------------------------------------------------------------------
360 : :
361 : 0 : IMPL_LINK( SvxLineDefTabPage, SelectLinestyleHdl_Impl, void *, p )
362 : : {
363 [ # # ]: 0 : if( pDashList->Count() > 0 )
364 : : {
365 : 0 : int nTmp = aLbLineStyles.GetSelectEntryPos();
366 [ # # ]: 0 : if( nTmp == LISTBOX_ENTRY_NOTFOUND )
367 : : {
368 : : }
369 : : else
370 : 0 : aDash = pDashList->GetDash( nTmp )->GetDash();
371 : :
372 : 0 : FillDialog_Impl();
373 : :
374 [ # # ][ # # ]: 0 : rXLSet.Put( XLineDashItem( String(), aDash ) );
[ # # ]
375 : :
376 : : // #i34740#
377 : 0 : aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
378 : :
379 : 0 : aCtlPreview.Invalidate();
380 : :
381 : : // Is not set before, in order to take the new style
382 : : // only if there was an entry selected in the ListBox.
383 : : // If it was called via Reset(), then p is == NULL
384 [ # # ]: 0 : if( p )
385 : 0 : *pPageType = 2;
386 : : }
387 : 0 : return( 0L );
388 : : }
389 : :
390 : : //------------------------------------------------------------------------
391 : :
392 : 0 : IMPL_LINK_NOARG_INLINE_START(SvxLineDefTabPage, ChangePreviewHdl_Impl)
393 : : {
394 : 0 : FillDash_Impl();
395 : 0 : aCtlPreview.Invalidate();
396 : :
397 : 0 : return( 0L );
398 : : }
399 : 0 : IMPL_LINK_NOARG_INLINE_END(SvxLineDefTabPage, ChangePreviewHdl_Impl)
400 : :
401 : : //------------------------------------------------------------------------
402 : :
403 : 0 : IMPL_LINK_NOARG(SvxLineDefTabPage, ChangeNumber1Hdl_Impl)
404 : : {
405 [ # # ]: 0 : if( aNumFldNumber1.GetValue() == 0L )
406 : : {
407 : 0 : aNumFldNumber2.SetMin( 1L );
408 : 0 : aNumFldNumber2.SetFirst( 1L );
409 : : }
410 : : else
411 : : {
412 : 0 : aNumFldNumber2.SetMin( 0L );
413 : 0 : aNumFldNumber2.SetFirst( 0L );
414 : : }
415 : :
416 : 0 : ChangePreviewHdl_Impl( this );
417 : :
418 : 0 : return( 0L );
419 : : }
420 : :
421 : : //------------------------------------------------------------------------
422 : :
423 : 0 : IMPL_LINK_NOARG(SvxLineDefTabPage, ChangeNumber2Hdl_Impl)
424 : : {
425 [ # # ]: 0 : if( aNumFldNumber2.GetValue() == 0L )
426 : : {
427 : 0 : aNumFldNumber1.SetMin( 1L );
428 : 0 : aNumFldNumber1.SetFirst( 1L );
429 : : }
430 : : else
431 : : {
432 : 0 : aNumFldNumber1.SetMin( 0L );
433 : 0 : aNumFldNumber1.SetFirst( 0L );
434 : : }
435 : :
436 : 0 : ChangePreviewHdl_Impl( this );
437 : :
438 : 0 : return( 0L );
439 : : }
440 : :
441 : :
442 : : //------------------------------------------------------------------------
443 : :
444 : 0 : IMPL_LINK( SvxLineDefTabPage, ChangeMetricHdl_Impl, void *, p )
445 : : {
446 [ # # ][ # # ]: 0 : if( !aCbxSynchronize.IsChecked() && aMtrLength1.GetUnit() != eFUnit )
[ # # ]
447 : : {
448 : : long nTmp1, nTmp2, nTmp3;
449 : :
450 : : // was changed with Control
451 [ # # ]: 0 : if( p )
452 : : {
453 : 0 : nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit ) * XOUT_WIDTH / 100;
454 : 0 : nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit ) * XOUT_WIDTH / 100;
455 : 0 : nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit ) * XOUT_WIDTH / 100;
456 : : }
457 : : else
458 : : {
459 : 0 : nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit );
460 : 0 : nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit );
461 : 0 : nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit );
462 : : }
463 : 0 : aMtrLength1.SetDecimalDigits( 2 );
464 : 0 : aMtrLength2.SetDecimalDigits( 2 );
465 : 0 : aMtrDistance.SetDecimalDigits( 2 );
466 : :
467 : : // adjust metric
468 : 0 : aMtrLength1.SetUnit( eFUnit );
469 : 0 : aMtrLength2.SetUnit( eFUnit );
470 : 0 : aMtrDistance.SetUnit( eFUnit );
471 : :
472 : 0 : SetMetricValue( aMtrLength1, nTmp1, ePoolUnit );
473 : 0 : SetMetricValue( aMtrLength2, nTmp2, ePoolUnit );
474 : 0 : SetMetricValue( aMtrDistance, nTmp3, ePoolUnit );
475 : : }
476 [ # # ][ # # ]: 0 : else if( aCbxSynchronize.IsChecked() && aMtrLength1.GetUnit() != FUNIT_CUSTOM )
[ # # ]
477 : : {
478 : : long nTmp1, nTmp2, nTmp3;
479 : :
480 : : // was changed with Control
481 [ # # ]: 0 : if( p )
482 : : {
483 : 0 : nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit ) * 100 / XOUT_WIDTH;
484 : 0 : nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit ) * 100 / XOUT_WIDTH;
485 : 0 : nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit ) * 100 / XOUT_WIDTH;
486 : : }
487 : : else
488 : : {
489 : 0 : nTmp1 = GetCoreValue( aMtrLength1, ePoolUnit );
490 : 0 : nTmp2 = GetCoreValue( aMtrLength2, ePoolUnit );
491 : 0 : nTmp3 = GetCoreValue( aMtrDistance, ePoolUnit );
492 : : }
493 : :
494 : 0 : aMtrLength1.SetDecimalDigits( 0 );
495 : 0 : aMtrLength2.SetDecimalDigits( 0 );
496 : 0 : aMtrDistance.SetDecimalDigits( 0 );
497 : :
498 : 0 : aMtrLength1.SetUnit( FUNIT_CUSTOM );
499 : 0 : aMtrLength2.SetUnit( FUNIT_CUSTOM );
500 : 0 : aMtrDistance.SetUnit( FUNIT_CUSTOM );
501 : :
502 : :
503 : 0 : SetMetricValue( aMtrLength1, nTmp1, ePoolUnit );
504 : 0 : SetMetricValue( aMtrLength2, nTmp2, ePoolUnit );
505 : 0 : SetMetricValue( aMtrDistance, nTmp3, ePoolUnit );
506 : : }
507 : 0 : SelectTypeHdl_Impl( NULL );
508 : :
509 : 0 : return( 0L );
510 : : }
511 : :
512 : : //------------------------------------------------------------------------
513 : :
514 : 0 : IMPL_LINK( SvxLineDefTabPage, SelectTypeHdl_Impl, void *, p )
515 : : {
516 [ # # ][ # # ]: 0 : if ( p == &aLbType1 || !p )
517 : : {
518 [ # # ]: 0 : if ( aLbType1.GetSelectEntryPos() == 0 )
519 : : {
520 : 0 : aMtrLength1.Disable();
521 [ # # ]: 0 : aMtrLength1.SetText( String() );
522 : : }
523 [ # # ]: 0 : else if ( !aMtrLength1.IsEnabled() )
524 : : {
525 : 0 : aMtrLength1.Enable();
526 : 0 : aMtrLength1.Reformat();
527 : : }
528 : : }
529 : :
530 [ # # ][ # # ]: 0 : if ( p == &aLbType2 || !p )
531 : : {
532 [ # # ]: 0 : if ( aLbType2.GetSelectEntryPos() == 0 )
533 : : {
534 : 0 : aMtrLength2.Disable();
535 [ # # ]: 0 : aMtrLength2.SetText( String() );
536 : : }
537 [ # # ]: 0 : else if ( !aMtrLength2.IsEnabled() )
538 : : {
539 : 0 : aMtrLength2.Enable();
540 : 0 : aMtrLength2.Reformat();
541 : : }
542 : : }
543 : 0 : ChangePreviewHdl_Impl( p );
544 : 0 : return( 0L );
545 : : }
546 : :
547 : : //------------------------------------------------------------------------
548 : :
549 : 0 : IMPL_LINK_NOARG(SvxLineDefTabPage, ClickAddHdl_Impl)
550 : : {
551 [ # # ]: 0 : ResMgr& rMgr = CUI_MGR();
552 [ # # ][ # # ]: 0 : String aNewName( SVX_RES( RID_SVXSTR_LINESTYLE ) );
553 [ # # ]: 0 : String aDesc( ResId( RID_SVXSTR_DESC_LINESTYLE, rMgr ) );
554 [ # # ]: 0 : String aName;
555 : : XDashEntry* pEntry;
556 : :
557 [ # # ]: 0 : long nCount = pDashList->Count();
558 : 0 : long j = 1;
559 : 0 : sal_Bool bDifferent = sal_False;
560 : :
561 [ # # ]: 0 : while ( !bDifferent )
562 : : {
563 [ # # ]: 0 : aName = aNewName;
564 [ # # ]: 0 : aName += sal_Unicode(' ');
565 [ # # ][ # # ]: 0 : aName += UniString::CreateFromInt32( j++ );
[ # # ]
566 : 0 : bDifferent = sal_True;
567 : :
568 [ # # ][ # # ]: 0 : for ( long i = 0; i < nCount && bDifferent; i++ )
[ # # ]
569 [ # # ][ # # ]: 0 : if ( aName == pDashList->GetDash( i )->GetName() )
[ # # ]
570 : 0 : bDifferent = sal_False;
571 : : }
572 : :
573 [ # # ]: 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
574 : : DBG_ASSERT(pFact, "Dialogdiet fail!");
575 [ # # ][ # # ]: 0 : AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
576 : : DBG_ASSERT(pDlg, "Dialogdiet fail!");
577 : 0 : sal_Bool bLoop = sal_True;
578 : :
579 [ # # ][ # # ]: 0 : while ( bLoop && pDlg->Execute() == RET_OK )
[ # # ][ # # ]
580 : : {
581 [ # # ]: 0 : pDlg->GetName( aName );
582 : 0 : bDifferent = sal_True;
583 : :
584 [ # # ][ # # ]: 0 : for( long i = 0; i < nCount && bDifferent; i++ )
[ # # ]
585 : : {
586 [ # # ][ # # ]: 0 : if( aName == pDashList->GetDash( i )->GetName() )
[ # # ]
587 : 0 : bDifferent = sal_False;
588 : : }
589 : :
590 [ # # ]: 0 : if( bDifferent )
591 : : {
592 : 0 : bLoop = sal_False;
593 [ # # ]: 0 : FillDash_Impl();
594 : :
595 [ # # ][ # # ]: 0 : pEntry = new XDashEntry( aDash, aName );
596 : :
597 [ # # ]: 0 : long nDashCount = pDashList->Count();
598 [ # # ]: 0 : pDashList->Insert( pEntry, nDashCount );
599 [ # # ]: 0 : Bitmap* pBitmap = pDashList->GetBitmap( nDashCount );
600 [ # # ]: 0 : aLbLineStyles.Append( pEntry, pBitmap );
601 : :
602 [ # # ][ # # ]: 0 : aLbLineStyles.SelectEntryPos( aLbLineStyles.GetEntryCount() - 1 );
603 : :
604 : 0 : *pnDashListState |= CT_MODIFIED;
605 : :
606 : 0 : *pPageType = 2;
607 : :
608 : : // save values for changes recognition (-> method)
609 [ # # ]: 0 : aNumFldNumber1.SaveValue();
610 [ # # ]: 0 : aMtrLength1.SaveValue();
611 [ # # ]: 0 : aLbType1.SaveValue();
612 [ # # ]: 0 : aNumFldNumber2.SaveValue();
613 [ # # ]: 0 : aMtrLength2.SaveValue();
614 [ # # ]: 0 : aLbType2.SaveValue();
615 [ # # ]: 0 : aMtrDistance.SaveValue();
616 : : }
617 : : else
618 : : {
619 [ # # ][ # # ]: 0 : WarningBox aBox( GetParentDialog(), WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
[ # # ][ # # ]
620 [ # # ]: 0 : aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
621 [ # # ][ # # ]: 0 : aBox.Execute();
622 : : }
623 : : }
624 [ # # ][ # # ]: 0 : delete( pDlg );
625 : :
626 : : // determine button state
627 [ # # ][ # # ]: 0 : if ( pDashList->Count() )
628 : : {
629 [ # # ]: 0 : aBtnModify.Enable();
630 [ # # ]: 0 : aBtnDelete.Enable();
631 [ # # ]: 0 : aBtnSave.Enable();
632 : : }
633 [ # # ][ # # ]: 0 : return( 0L );
[ # # ]
634 : : }
635 : :
636 : : //------------------------------------------------------------------------
637 : :
638 : 0 : IMPL_LINK_NOARG(SvxLineDefTabPage, ClickModifyHdl_Impl)
639 : : {
640 : 0 : sal_uInt16 nPos = aLbLineStyles.GetSelectEntryPos();
641 : :
642 [ # # ]: 0 : if( nPos != LISTBOX_ENTRY_NOTFOUND )
643 : : {
644 [ # # ]: 0 : ResMgr& rMgr = CUI_MGR();
645 [ # # ][ # # ]: 0 : String aNewName( SVX_RES( RID_SVXSTR_LINESTYLE ) );
646 [ # # ]: 0 : String aDesc( ResId( RID_SVXSTR_DESC_LINESTYLE, rMgr ) );
647 [ # # ][ # # ]: 0 : String aName( pDashList->GetDash( nPos )->GetName() );
648 [ # # ]: 0 : String aOldName = aName;
649 : :
650 [ # # ]: 0 : SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
651 : : DBG_ASSERT(pFact, "Dialogdiet fail!");
652 [ # # ][ # # ]: 0 : AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( GetParentDialog(), aName, aDesc );
653 : : DBG_ASSERT(pDlg, "Dialogdiet fail!");
654 : :
655 [ # # ]: 0 : long nCount = pDashList->Count();
656 : 0 : sal_Bool bDifferent = sal_False;
657 : 0 : sal_Bool bLoop = sal_True;
658 : :
659 [ # # ][ # # ]: 0 : while ( bLoop && pDlg->Execute() == RET_OK )
[ # # ][ # # ]
660 : : {
661 [ # # ]: 0 : pDlg->GetName( aName );
662 : 0 : bDifferent = sal_True;
663 : :
664 [ # # ][ # # ]: 0 : for( long i = 0; i < nCount && bDifferent; i++ )
[ # # ]
665 : : {
666 [ # # ][ # # ]: 0 : if( aName == pDashList->GetDash( i )->GetName() &&
[ # # ][ # # ]
[ # # ]
667 [ # # ]: 0 : aName != aOldName )
668 : 0 : bDifferent = sal_False;
669 : : }
670 : :
671 [ # # ]: 0 : if ( bDifferent )
672 : : {
673 : 0 : bLoop = sal_False;
674 [ # # ]: 0 : FillDash_Impl();
675 : :
676 [ # # ][ # # ]: 0 : XDashEntry* pEntry = new XDashEntry( aDash, aName );
677 : :
678 [ # # ][ # # ]: 0 : delete pDashList->Replace( pEntry, nPos );
[ # # ]
679 [ # # ]: 0 : Bitmap* pBitmap = pDashList->GetBitmap( nPos );
680 [ # # ]: 0 : aLbLineStyles.Modify( pEntry, nPos, pBitmap );
681 : :
682 [ # # ]: 0 : aLbLineStyles.SelectEntryPos( nPos );
683 : :
684 : 0 : *pnDashListState |= CT_MODIFIED;
685 : :
686 : 0 : *pPageType = 2;
687 : :
688 : : // save values for changes recognition (-> method)
689 [ # # ]: 0 : aNumFldNumber1.SaveValue();
690 [ # # ]: 0 : aMtrLength1.SaveValue();
691 [ # # ]: 0 : aLbType1.SaveValue();
692 [ # # ]: 0 : aNumFldNumber2.SaveValue();
693 [ # # ]: 0 : aMtrLength2.SaveValue();
694 [ # # ]: 0 : aLbType2.SaveValue();
695 [ # # ]: 0 : aMtrDistance.SaveValue();
696 : : }
697 : : else
698 : : {
699 [ # # ][ # # ]: 0 : WarningBox aBox( GetParentDialog(), WinBits( WB_OK ), String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
[ # # ][ # # ]
700 [ # # ]: 0 : aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
701 [ # # ][ # # ]: 0 : aBox.Execute();
702 : : }
703 : : }
704 [ # # ][ # # ]: 0 : delete( pDlg );
[ # # ][ # # ]
[ # # ][ # # ]
705 : : }
706 : 0 : return( 0L );
707 : : }
708 : :
709 : : //------------------------------------------------------------------------
710 : :
711 : 0 : IMPL_LINK_NOARG(SvxLineDefTabPage, ClickDeleteHdl_Impl)
712 : : {
713 : 0 : sal_uInt16 nPos = aLbLineStyles.GetSelectEntryPos();
714 : :
715 [ # # ]: 0 : if ( nPos != LISTBOX_ENTRY_NOTFOUND )
716 : : {
717 : : QueryBox aQueryBox( GetParentDialog(), WinBits( WB_YES_NO | WB_DEF_NO ),
718 [ # # ][ # # ]: 0 : String( CUI_RES( RID_SVXSTR_ASK_DEL_LINESTYLE ) ) );
[ # # ][ # # ]
[ # # ]
719 : :
720 [ # # ][ # # ]: 0 : if ( aQueryBox.Execute() == RET_YES )
721 : : {
722 [ # # ][ # # ]: 0 : delete pDashList->Remove( nPos );
[ # # ]
723 [ # # ]: 0 : aLbLineStyles.RemoveEntry( nPos );
724 [ # # ]: 0 : aLbLineStyles.SelectEntryPos( 0 );
725 : :
726 [ # # ]: 0 : SelectLinestyleHdl_Impl( this );
727 : 0 : *pPageType = 0; // style should not be taken
728 : :
729 : 0 : *pnDashListState |= CT_MODIFIED;
730 : :
731 [ # # ]: 0 : ChangePreviewHdl_Impl( this );
732 [ # # ]: 0 : }
733 : : }
734 : :
735 : : // determine button state
736 [ # # ]: 0 : if ( !pDashList->Count() )
737 : : {
738 : 0 : aBtnModify.Disable();
739 : 0 : aBtnDelete.Disable();
740 : 0 : aBtnSave.Disable();
741 : : }
742 : 0 : return( 0L );
743 : : }
744 : :
745 : : // -----------------------------------------------------------------------
746 : :
747 : 0 : IMPL_LINK_NOARG(SvxLineDefTabPage, ClickLoadHdl_Impl)
748 : : {
749 : 0 : ResMgr& rMgr = CUI_MGR();
750 : 0 : sal_uInt16 nReturn = RET_YES;
751 : :
752 [ # # ]: 0 : if ( *pnDashListState & CT_MODIFIED )
753 : : {
754 : : nReturn = WarningBox( GetParentDialog(), WinBits( WB_YES_NO_CANCEL ),
755 [ # # ][ # # ]: 0 : String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute();
[ # # ][ # # ]
[ # # ][ # # ]
756 : :
757 [ # # ]: 0 : if ( nReturn == RET_YES )
758 : 0 : pDashList->Save();
759 : : }
760 : :
761 [ # # ]: 0 : if ( nReturn != RET_CANCEL )
762 : : {
763 : : ::sfx2::FileDialogHelper aDlg(
764 : : com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
765 [ # # ]: 0 : 0 );
766 [ # # ]: 0 : String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sod" ) );
767 [ # # ]: 0 : aDlg.AddFilter( aStrFilterType, aStrFilterType );
768 [ # # ][ # # ]: 0 : INetURLObject aFile( SvtPathOptions().GetPalettePath() );
[ # # ][ # # ]
[ # # ]
769 [ # # ][ # # ]: 0 : aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
[ # # ][ # # ]
770 : :
771 [ # # ][ # # ]: 0 : if( aDlg.Execute() == ERRCODE_NONE )
772 : : {
773 [ # # ][ # # ]: 0 : INetURLObject aURL( aDlg.GetPath() );
[ # # ][ # # ]
774 [ # # ]: 0 : INetURLObject aPathURL( aURL );
775 : :
776 [ # # ]: 0 : aPathURL.removeSegment();
777 [ # # ]: 0 : aPathURL.removeFinalSlash();
778 : :
779 : : XDashListRef pDshLst = XPropertyList::CreatePropertyList(
780 [ # # ][ # # ]: 0 : XGRADIENT_LIST, aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool )->AsDashList();
[ # # ][ # # ]
[ # # ]
781 [ # # ][ # # ]: 0 : pDshLst->SetName( aURL.getName() );
[ # # ][ # # ]
782 : :
783 [ # # ][ # # ]: 0 : if( pDshLst->Load() )
784 : : {
785 [ # # ]: 0 : pDashList = pDshLst;
786 [ # # ][ # # ]: 0 : ( (SvxLineTabDialog*) GetParentDialog() )->SetNewDashList( pDashList );
787 : :
788 [ # # ]: 0 : aLbLineStyles.Clear();
789 [ # # ]: 0 : aLbLineStyles.Fill( pDashList );
790 [ # # ]: 0 : Reset( rOutAttrs );
791 : :
792 [ # # ][ # # ]: 0 : pDashList->SetName( aURL.getName() );
[ # # ][ # # ]
793 : :
794 : 0 : *pnDashListState |= CT_CHANGED;
795 : 0 : *pnDashListState &= ~CT_MODIFIED;
796 : : }
797 : : else
798 : : //aIStream.Close();
799 : : ErrorBox( GetParentDialog(), WinBits( WB_OK ),
800 [ # # ][ # # ]: 0 : String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute();
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
801 [ # # ][ # # ]: 0 : }
[ # # ]
802 : : }
803 : :
804 : : // determine button state
805 [ # # ]: 0 : if ( pDashList->Count() )
806 : : {
807 : 0 : aBtnModify.Enable();
808 : 0 : aBtnDelete.Enable();
809 : 0 : aBtnSave.Enable();
810 : : }
811 : : else
812 : : {
813 : 0 : aBtnModify.Disable();
814 : 0 : aBtnDelete.Disable();
815 : 0 : aBtnSave.Disable();
816 : : }
817 : 0 : return( 0L );
818 : : }
819 : :
820 : : // -----------------------------------------------------------------------
821 : :
822 : 0 : IMPL_LINK_NOARG(SvxLineDefTabPage, ClickSaveHdl_Impl)
823 : : {
824 : : ::sfx2::FileDialogHelper aDlg(
825 [ # # ]: 0 : com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 );
826 [ # # ]: 0 : String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.sod" ) );
827 [ # # ]: 0 : aDlg.AddFilter( aStrFilterType, aStrFilterType );
828 : :
829 [ # # ][ # # ]: 0 : INetURLObject aFile( SvtPathOptions().GetPalettePath() );
[ # # ][ # # ]
[ # # ]
830 : : DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
831 : :
832 [ # # ]: 0 : if( pDashList->GetName().Len() )
833 : : {
834 [ # # ][ # # ]: 0 : aFile.Append( pDashList->GetName() );
835 : :
836 [ # # ][ # # ]: 0 : if( aFile.getExtension().isEmpty() )
837 [ # # ]: 0 : aFile.SetExtension(rtl::OUString("sod"));
838 : : }
839 : :
840 [ # # ][ # # ]: 0 : aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
[ # # ][ # # ]
841 [ # # ][ # # ]: 0 : if ( aDlg.Execute() == ERRCODE_NONE )
842 : : {
843 [ # # ][ # # ]: 0 : INetURLObject aURL( aDlg.GetPath() );
[ # # ][ # # ]
844 [ # # ]: 0 : INetURLObject aPathURL( aURL );
845 : :
846 [ # # ]: 0 : aPathURL.removeSegment();
847 [ # # ]: 0 : aPathURL.removeFinalSlash();
848 : :
849 [ # # ][ # # ]: 0 : pDashList->SetName( aURL.getName() );
[ # # ][ # # ]
850 [ # # ][ # # ]: 0 : pDashList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
[ # # ][ # # ]
851 : :
852 [ # # ][ # # ]: 0 : if( pDashList->Save() )
853 : : {
854 : 0 : *pnDashListState |= CT_SAVED;
855 : 0 : *pnDashListState &= ~CT_MODIFIED;
856 : : }
857 : : else
858 : : {
859 : : ErrorBox( GetParentDialog(), WinBits( WB_OK ),
860 [ # # ][ # # ]: 0 : String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute();
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
861 [ # # ][ # # ]: 0 : }
862 : : }
863 : :
864 [ # # ][ # # ]: 0 : return( 0L );
[ # # ]
865 : : }
866 : :
867 : : //------------------------------------------------------------------------
868 : :
869 : 0 : void SvxLineDefTabPage::FillDash_Impl()
870 : : {
871 : : XDashStyle eXDS;
872 : :
873 [ # # ]: 0 : if( aCbxSynchronize.IsChecked() )
874 : 0 : eXDS = XDASH_RECTRELATIVE;
875 : : else
876 : 0 : eXDS = XDASH_RECT;
877 : :
878 : 0 : aDash.SetDashStyle( eXDS );
879 : 0 : aDash.SetDots( (sal_uInt8) aNumFldNumber1.GetValue() );
880 : 0 : aDash.SetDotLen( aLbType1.GetSelectEntryPos() == 0 ? 0 :
881 [ # # ]: 0 : GetCoreValue( aMtrLength1, ePoolUnit ) );
882 : 0 : aDash.SetDashes( (sal_uInt8) aNumFldNumber2.GetValue() );
883 : 0 : aDash.SetDashLen( aLbType2.GetSelectEntryPos() == 0 ? 0 :
884 [ # # ]: 0 : GetCoreValue( aMtrLength2, ePoolUnit ) );
885 : 0 : aDash.SetDistance( GetCoreValue( aMtrDistance, ePoolUnit ) );
886 : :
887 [ # # ][ # # ]: 0 : rXLSet.Put( XLineDashItem( String(), aDash ) );
[ # # ]
888 : :
889 : : // #i34740#
890 : 0 : aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
891 : 0 : }
892 : :
893 : : //------------------------------------------------------------------------
894 : :
895 : 0 : void SvxLineDefTabPage::FillDialog_Impl()
896 : : {
897 : 0 : XDashStyle eXDS = aDash.GetDashStyle(); // XDASH_RECT, XDASH_ROUND
898 [ # # ]: 0 : if( eXDS == XDASH_RECTRELATIVE )
899 : 0 : aCbxSynchronize.Check();
900 : : else
901 : 0 : aCbxSynchronize.Check( sal_False );
902 : :
903 : 0 : aNumFldNumber1.SetValue( aDash.GetDots() );
904 : 0 : SetMetricValue( aMtrLength1, aDash.GetDotLen(), ePoolUnit );
905 : 0 : aLbType1.SelectEntryPos( aDash.GetDotLen() == 0 ? 0 : 1 );
906 : 0 : aNumFldNumber2.SetValue( aDash.GetDashes() );
907 : 0 : SetMetricValue( aMtrLength2, aDash.GetDashLen(), ePoolUnit );
908 : 0 : aLbType2.SelectEntryPos( aDash.GetDashLen() == 0 ? 0 : 1 );
909 : 0 : SetMetricValue( aMtrDistance, aDash.GetDistance(), ePoolUnit );
910 : :
911 : 0 : ChangeMetricHdl_Impl( NULL );
912 : :
913 : : // save values for changes recognition (-> method)
914 : 0 : aNumFldNumber1.SaveValue();
915 : 0 : aMtrLength1.SaveValue();
916 : 0 : aLbType1.SaveValue();
917 : 0 : aNumFldNumber2.SaveValue();
918 : 0 : aMtrLength2.SaveValue();
919 : 0 : aLbType2.SaveValue();
920 : 0 : aMtrDistance.SaveValue();
921 : 0 : }
922 : :
923 : :
924 : 0 : void SvxLineDefTabPage::DataChanged( const DataChangedEvent& rDCEvt )
925 : : {
926 : 0 : SfxTabPage::DataChanged( rDCEvt );
927 : :
928 [ # # ][ # # ]: 0 : if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
[ # # ]
929 : : {
930 : 0 : sal_uInt16 nOldSelect = aLbLineStyles.GetSelectEntryPos();
931 : 0 : aLbLineStyles.Clear();
932 : 0 : aLbLineStyles.Fill( pDashList );
933 : 0 : aLbLineStyles.SelectEntryPos( nOldSelect );
934 : : }
935 : 0 : }
936 : :
937 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|