1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_cui.hxx"
26
27 // include ---------------------------------------------------------------
28
29 #ifndef _SVX_SIZEITEM_HXX //autogen
30
31 #include <editeng/sizeitem.hxx>
32 #endif
33 #include <tools/shl.hxx>
34 #include <tools/urlobj.hxx>
35 #include <sfx2/app.hxx>
36 #include <sfx2/module.hxx>
37
38 #define _SVX_TPLINE_CXX
39
40 #include <cuires.hrc>
41 #include "tabline.hrc"
42 #include "svx/xattr.hxx"
43 #include <svx/xpool.hxx>
44 #include <svx/xtable.hxx>
45 #include "svx/drawitem.hxx"
46 #include "cuitabline.hxx"
47 #include "dlgname.hxx"
48 #include <dialmgr.hxx>
49 #include "svx/dlgutil.hxx"
50 #include <svx/svdmodel.hxx>
51 #include "svx/svxgrahicitem.hxx"
52 //#include "linectrl.hrc"
53 #include <sfx2/request.hxx>
54 #include "svx/ofaitem.hxx"
55 #include <svx/svdobj.hxx>
56 #include <svx/svdview.hxx>
57 #include <svx/svdmodel.hxx>
58 #include <svx/numvset.hxx>
59 #include <vcl/msgbox.hxx>
60 #include <editeng/numitem.hxx>
61 #include <editeng/svxenum.hxx>
62 #include <sfx2/objsh.hxx>
63 #include <editeng/brshitem.hxx>
64 #include <svx/gallery.hxx>
65 #include <unotools/localfilehelper.hxx>
66 #include "paragrph.hrc"
67 #include "sfx2/opengrf.hxx"
68 #include <svx/dialmgr.hxx>
69 #include <svx/dialogs.hrc>
70
71 #define MAX_BMP_WIDTH 16
72 #define MAX_BMP_HEIGHT 16
73 // define ----------------------------------------------------------------
74
75 #define DLGWIN this->GetParent()->GetParent()
76
77 #define BITMAP_WIDTH 32
78 #define BITMAP_HEIGHT 12
79 #define XOUT_WIDTH 150
80
81 // static ----------------------------------------------------------------
82
83 static sal_uInt16 pLineRanges[] =
84 {
85 XATTR_LINETRANSPARENCE,
86 XATTR_LINETRANSPARENCE,
87 SID_ATTR_LINE_STYLE,
88 SID_ATTR_LINE_ENDCENTER,
89 0
90 };
91
92 /*************************************************************************
93 |*
94 |* Dialog zum Aendern der Linien
95 |*
96 \************************************************************************/
97
SvxLineTabPage(Window * pParent,const SfxItemSet & rInAttrs)98 SvxLineTabPage::SvxLineTabPage
99 (
100 Window* pParent,
101 const SfxItemSet& rInAttrs
102 ) :
103 SvxTabPage ( pParent, CUI_RES( RID_SVXPAGE_LINE ), rInAttrs ),
104 aFlLine ( this, CUI_RES( FL_LINE ) ),
105 aFtLineStyle ( this, CUI_RES( FT_LINE_STYLE ) ),
106 aLbLineStyle ( this, CUI_RES( LB_LINE_STYLE ) ),
107 aFtColor ( this, CUI_RES( FT_COLOR ) ),
108 aLbColor ( this, CUI_RES( LB_COLOR ) ),
109 aFtLineWidth ( this, CUI_RES( FT_LINE_WIDTH ) ),
110 aMtrLineWidth ( this, CUI_RES( MTR_FLD_LINE_WIDTH ) ),
111 aFtTransparent ( this, CUI_RES( FT_TRANSPARENT ) ),
112 aMtrTransparent ( this, CUI_RES( MTR_LINE_TRANSPARENT ) ),
113 aFlLineEnds ( this, CUI_RES( FL_LINE_ENDS ) ),
114 aLbStartStyle ( this, CUI_RES( LB_START_STYLE ) ),
115 aMtrStartWidth ( this, CUI_RES( MTR_FLD_START_WIDTH ) ),
116 aTsbCenterStart ( this, CUI_RES( TSB_CENTER_START ) ),
117 aFtLineEndsStyle ( this, CUI_RES( FT_LINE_ENDS_STYLE ) ),
118 aLbEndStyle ( this, CUI_RES( LB_END_STYLE ) ),
119 aFtLineEndsWidth ( this, CUI_RES( FT_LINE_ENDS_WIDTH ) ),
120 aMtrEndWidth ( this, CUI_RES( MTR_FLD_END_WIDTH ) ),
121 aTsbCenterEnd ( this, CUI_RES( TSB_CENTER_END ) ),
122 aCbxSynchronize ( this, CUI_RES( CBX_SYNCHRONIZE ) ),
123 aFLSeparator ( this, CUI_RES( FL_SEPARATOR ) ),
124 aCtlPreview ( this, CUI_RES( CTL_PREVIEW ) ),
125
126 // #116827#
127 maFLEdgeStyle ( this, CUI_RES( FL_EDGE_STYLE ) ),
128 maFTEdgeStyle ( this, CUI_RES( FT_EDGE_STYLE ) ),
129 maLBEdgeStyle ( this, CUI_RES( LB_EDGE_STYLE ) ),
130
131 // LineCaps
132 maFTCapStyle ( this, CUI_RES( FT_CAP_STYLE ) ),
133 maLBCapStyle ( this, CUI_RES( LB_CAP_STYLE ) ),
134
135 pSymbolList(NULL),
136 bNewSize(false),
137 nNumMenuGalleryItems(0),
138 nSymbolType(SVX_SYMBOLTYPE_UNKNOWN), //unbekannt bzw. unchanged
139 pSymbolAttr(NULL),
140 //#58425# Symbole auf einer Linie (z.B. StarChart)
141 aFlSymbol ( this, CUI_RES(FL_SYMBOL_FORMAT)),
142 aSymbolMB ( this, CUI_RES(MB_SYMBOL_BITMAP)),
143 aSymbolWidthFT ( this, CUI_RES(FT_SYMBOL_WIDTH)),
144 aSymbolWidthMF ( this, CUI_RES(MF_SYMBOL_WIDTH)),
145 aSymbolHeightFT ( this, CUI_RES(FT_SYMBOL_HEIGHT)),
146 aSymbolHeightMF ( this, CUI_RES(MF_SYMBOL_HEIGHT)),
147 aSymbolRatioCB ( this, CUI_RES(CB_SYMBOL_RATIO)),
148
149 bLastWidthModified(sal_False),
150 aSymbolLastSize(Size(0,0)),
151 bSymbols(sal_False),
152
153 rOutAttrs ( rInAttrs ),
154 bObjSelected( sal_False ),
155
156 pXPool ( (XOutdevItemPool*) rInAttrs.GetPool() ),
157 aXLStyle ( XLINE_DASH ),
158 aXWidth ( 1 ),
159 aXDash ( String(), XDash( XDASH_RECT, 3, 7, 2, 40, 15 ) ),
160 aXColor ( String(), COL_LIGHTRED ),
161 aXLineAttr ( pXPool ),
162 rXLSet ( aXLineAttr.GetItemSet() ),
163 pnLineEndListState( 0 ),
164 pnDashListState( 0 ),
165 pnColorTableState( 0 ),
166 nPageType ( 0 )//CHINA001 pPageType ( NULL ),
167 {
168 aLbEndStyle.SetAccessibleName(String(CUI_RES(STR_STYLE)));
169 aLbStartStyle.SetAccessibleName(String(CUI_RES( STR_LB_START_STYLE ) ) );
170 aMtrStartWidth.SetAccessibleName(String(CUI_RES( STR_MTR_FLD_START_WIDTH ) ) );
171 aLbEndStyle.SetAccessibleName(String(CUI_RES( STR_LB_END_STYLE ) ) );
172 aMtrEndWidth.SetAccessibleName(String(CUI_RES( STR_MTR_FLD_END_WIDTH ) ) );
173 aTsbCenterStart.SetAccessibleName(String(CUI_RES( STR_CENTER_START ) ) );
174 aTsbCenterEnd.SetAccessibleName(String(CUI_RES( STR_CENTER_END ) ) );
175
176 FreeResource();
177
178 aCtlPreview.SetAccessibleName(String(CUI_RES(STR_EXAMPLE)));
179
180 // diese Page braucht ExchangeSupport
181 SetExchangeSupport();
182
183 // Metrik einstellen
184 FieldUnit eFUnit = GetModuleFieldUnit( rInAttrs );
185
186 switch ( eFUnit )
187 {
188 case FUNIT_M:
189 case FUNIT_KM:
190 eFUnit = FUNIT_MM;
191 // no break -> we now have mm
192 case FUNIT_MM:
193 aMtrLineWidth.SetSpinSize( 50 );
194 aMtrStartWidth.SetSpinSize( 50 );
195 aMtrEndWidth.SetSpinSize( 50 );
196 break;
197
198 case FUNIT_INCH:
199 aMtrLineWidth.SetSpinSize( 2 );
200 aMtrStartWidth.SetSpinSize( 2 );
201 aMtrEndWidth.SetSpinSize( 2 );
202 break;
203 default: ;//prevent warning
204 }
205 SetFieldUnit( aMtrLineWidth, eFUnit );
206 SetFieldUnit( aMtrStartWidth, eFUnit );
207 SetFieldUnit( aMtrEndWidth, eFUnit );
208
209 // PoolUnit ermitteln
210 SfxItemPool* pPool = rOutAttrs.GetPool();
211 DBG_ASSERT( pPool, "Wo ist der Pool?" );
212 ePoolUnit = pPool->GetMetric( SID_ATTR_LINE_WIDTH );
213
214 aLbLineStyle.SetSelectHdl(
215 LINK( this, SvxLineTabPage, ClickInvisibleHdl_Impl ) );
216 aLbColor.SetSelectHdl(
217 LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) );
218 aMtrLineWidth.SetModifyHdl(
219 LINK( this, SvxLineTabPage, ChangePreviewHdl_Impl ) );
220 aMtrTransparent.SetModifyHdl(
221 LINK( this, SvxLineTabPage, ChangeTransparentHdl_Impl ) );
222
223 Link aStart = LINK( this, SvxLineTabPage, ChangeStartHdl_Impl );
224 Link aEnd = LINK( this, SvxLineTabPage, ChangeEndHdl_Impl );
225 aLbStartStyle.SetSelectHdl( aStart );
226 aLbEndStyle.SetSelectHdl( aEnd );
227 aMtrStartWidth.SetModifyHdl( aStart );
228 aMtrEndWidth.SetModifyHdl( aEnd );
229 aTsbCenterStart.SetClickHdl( aStart );
230 aTsbCenterEnd.SetClickHdl( aEnd );
231
232 // #116827#
233 Link aEdgeStyle = LINK( this, SvxLineTabPage, ChangeEdgeStyleHdl_Impl );
234 maLBEdgeStyle.SetSelectHdl( aEdgeStyle );
235
236 // LineCaps
237 Link aCapStyle = LINK( this, SvxLineTabPage, ChangeCapStyleHdl_Impl );
238 maLBCapStyle.SetSelectHdl( aCapStyle );
239
240 //#58425# Symbole auf einer Linie (z.B. StarChart) , MB-Handler setzen
241 aSymbolMB.SetSelectHdl(LINK(this, SvxLineTabPage, GraphicHdl_Impl));
242 aSymbolMB.SetActivateHdl(LINK(this, SvxLineTabPage, MenuCreateHdl_Impl));
243 aSymbolWidthMF.SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl));
244 aSymbolHeightMF.SetModifyHdl(LINK(this, SvxLineTabPage, SizeHdl_Impl));
245 aSymbolRatioCB.SetClickHdl(LINK(this, SvxLineTabPage, RatioHdl_Impl));
246
247 aSymbolRatioCB.Check(sal_True);
248 ShowSymbolControls(sal_False);
249
250 // #63083#
251 nActLineWidth = -1;
252 }
253 //#58425# Symbole auf einer Linie (z.B. StarChart) , Symbol-Controls aktivieren
ShowSymbolControls(sal_Bool bOn)254 void SvxLineTabPage::ShowSymbolControls(sal_Bool bOn)
255 {
256 bSymbols=bOn;
257 aSymbolWidthFT.Show(bOn);
258 aSymbolWidthMF.Show(bOn);
259 aSymbolHeightFT.Show(bOn);
260 aSymbolHeightMF.Show(bOn);
261 aFlSymbol.Show(bOn);
262 aSymbolRatioCB.Show(bOn);
263 aSymbolMB.Show(bOn);
264 aCtlPreview.ShowSymbol(bOn);
265 }
266 // -----------------------------------------------------------------------
267 //#58425# Symbole auf einer Linie (z.B. StarChart) , dtor neu!
~SvxLineTabPage()268 SvxLineTabPage::~SvxLineTabPage()
269 {
270 delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
271
272 if(pSymbolList)
273 delete aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_SYMBOLS );
274
275 String* pStr = (String*)aGrfNames.First();
276 while( pStr )
277 {
278 delete pStr;
279 pStr = (String*)aGrfNames.Next();
280 }
281 SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.First();
282 while( pInfo )
283 {
284 delete pInfo->pBrushItem;
285 delete pInfo;
286 pInfo = (SvxBmpItemInfo*)aGrfBrushItems.Next();
287 }
288 }
Construct()289 void SvxLineTabPage::Construct()
290 {
291 // Farbtabelle
292 aLbColor.Fill( maColorTab );
293 FillListboxes();
294 }
295
FillListboxes()296 void SvxLineTabPage::FillListboxes()
297 {
298 // Linienstile
299 sal_uInt16 nOldSelect = aLbLineStyle.GetSelectEntryPos();
300 // aLbLineStyle.FillStyles();
301 aLbLineStyle.Fill( maDashList );
302 aLbLineStyle.SelectEntryPos( nOldSelect );
303
304 // LinienEndenStile
305 String sNone( SVX_RES( RID_SVXSTR_NONE ) );
306 nOldSelect = aLbStartStyle.GetSelectEntryPos();
307 aLbStartStyle.Clear();
308 aLbStartStyle.InsertEntry( sNone );
309 aLbStartStyle.Fill( maLineEndList );
310 aLbStartStyle.SelectEntryPos( nOldSelect );
311 nOldSelect = aLbEndStyle.GetSelectEntryPos();
312 aLbEndStyle.Clear();
313 aLbEndStyle.InsertEntry( sNone );
314 aLbEndStyle.Fill( maLineEndList, sal_False );
315 aLbEndStyle.SelectEntryPos( nOldSelect );
316 }
317
318 // -----------------------------------------------------------------------
319
ActivatePage(const SfxItemSet & rSet)320 void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet )
321 {
322 SFX_ITEMSET_ARG (&rSet,pPageTypeItem,CntUInt16Item,SID_PAGE_TYPE,sal_False); //add CHINA001 begin
323 if (pPageTypeItem)
324 SetPageType(pPageTypeItem->GetValue()); //add CHINA001 end
325 if( nDlgType == 0 && maDashList.get() ) //CHINA001 if( *pDlgType == 0 && pDashList ) // Linien-Dialog
326 {
327 sal_uInt16 nPos;
328 sal_uInt16 nCount;
329
330 // Dashliste
331 if( ( *pnDashListState & CT_MODIFIED ) ||
332 ( *pnDashListState & CT_CHANGED ) )
333 {
334 if( *pnDashListState & CT_CHANGED )
335 maDashList = ( (SvxLineTabDialog*) DLGWIN )->GetNewDashList();
336 *pnDashListState = CT_NONE;
337
338 // Styleliste
339 nPos = aLbLineStyle.GetSelectEntryPos();
340
341 aLbLineStyle.Clear();
342 aLbLineStyle.InsertEntry(
343 SVX_RESSTR( RID_SVXSTR_INVISIBLE ) );
344 aLbLineStyle.InsertEntry(
345 SVX_RESSTR( RID_SVXSTR_SOLID ) );
346 aLbLineStyle.Fill( maDashList );
347 nCount = aLbLineStyle.GetEntryCount();
348
349 if ( nCount == 0 )
350 ; // Dieser Fall sollte nicht auftreten
351 else if( nCount <= nPos )
352 aLbLineStyle.SelectEntryPos( 0 );
353 else
354 aLbLineStyle.SelectEntryPos( nPos );
355 // SelectStyleHdl_Impl( this );
356 }
357
358 INetURLObject aDashURL( maDashList->GetPath() );
359
360 aDashURL.Append( maDashList->GetName() );
361 DBG_ASSERT( aDashURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
362 /* // Ermitteln (evtl. abschneiden) des Namens und in
363 // der GroupBox darstellen
364 String aString( ResId( RID_SVXSTR_TABLE, pMgr ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
365
366 if ( aDashURL.getBase().Len() > 18 )
367 {
368 aString += aDashURL.getBase().Copy( 0, 15 );
369 aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
370 }
371 else
372 aString += aDashURL.getBase();
373
374 aGrpLine.SetText( aString );
375 */
376 // LineEndliste
377 if( ( *pnLineEndListState & CT_MODIFIED ) ||
378 ( *pnLineEndListState & CT_CHANGED ) )
379 {
380 if( *pnLineEndListState & CT_CHANGED )
381 maLineEndList = ( (SvxLineTabDialog*) DLGWIN )->GetNewLineEndList();
382 *pnLineEndListState = CT_NONE;
383
384 nPos = aLbLineStyle.GetSelectEntryPos();
385 String sNone( SVX_RES( RID_SVXSTR_NONE ) );
386 aLbStartStyle.Clear();
387 aLbStartStyle.InsertEntry( sNone );
388
389 aLbStartStyle.Fill( maLineEndList );
390 nCount = aLbStartStyle.GetEntryCount();
391 if( nCount == 0 )
392 ; // Dieser Fall sollte nicht auftreten
393 else if( nCount <= nPos )
394 aLbStartStyle.SelectEntryPos( 0 );
395 else
396 aLbStartStyle.SelectEntryPos( nPos );
397
398 aLbEndStyle.Clear();
399 aLbEndStyle.InsertEntry( sNone );
400
401 aLbEndStyle.Fill( maLineEndList, sal_False );
402 nCount = aLbEndStyle.GetEntryCount();
403
404 if( nCount == 0 )
405 ; // Dieser Fall sollte nicht auftreten
406 else if( nCount <= nPos )
407 aLbEndStyle.SelectEntryPos( 0 );
408 else
409 aLbEndStyle.SelectEntryPos( nPos );
410 }
411 INetURLObject aLineURL( maLineEndList->GetPath() );
412
413 aLineURL.Append( maLineEndList->GetName() );
414 DBG_ASSERT( aLineURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
415 /* // Ermitteln (evtl. abschneiden) des Namens und in
416 // der GroupBox darstellen
417 aString = String( ResId( RID_SVXSTR_TABLE, pMgr ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
418
419 if ( aLineURL.getBase().Len() > 18 )
420 {
421 aString += aLineURL.getBase().Copy( 0, 15 );
422 aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
423 }
424 else
425 aString += aLineURL.getBase();
426
427 aGrpLineEnds.SetText( aString );
428 */
429 // Auswertung, ob von einer anderen TabPage ein anderer Fuelltyp gesetzt wurde
430 if( aLbLineStyle.GetSelectEntryPos() != 0 )
431 {
432 if( nPageType == 2 ) // 1//CHINA001 if( *pPageType == 2 ) // 1
433 {
434 aLbLineStyle.SelectEntryPos( *pPosDashLb + 2 ); // +2 wegen SOLID und INVLISIBLE
435 ChangePreviewHdl_Impl( this );
436 }
437 if( nPageType == 3 )//CHINA001 if( *pPageType == 3 )
438 {
439 aLbStartStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 wegen SOLID
440 aLbEndStyle.SelectEntryPos( *pPosLineEndLb + 1 );// +1 wegen SOLID
441 ChangePreviewHdl_Impl( this );
442 }
443 }
444
445 // ColorTable
446 if( *pnColorTableState )
447 {
448 if( *pnColorTableState & CT_CHANGED )
449 maColorTab = ( (SvxLineTabDialog*) DLGWIN )->GetNewColorTable();
450 // aLbColor
451 sal_uInt16 nColorPos = aLbColor.GetSelectEntryPos();
452 aLbColor.Clear();
453 aLbColor.Fill( maColorTab );
454 nCount = aLbColor.GetEntryCount();
455 if( nCount == 0 )
456 ; // This case should never occur
457 else if( nCount <= nColorPos )
458 aLbColor.SelectEntryPos( 0 );
459 else
460 aLbColor.SelectEntryPos( nColorPos );
461
462 ChangePreviewHdl_Impl( this );
463 }
464
465 nPageType = 0;//CHINA001 *pPageType = 0;
466 }
467 // Seite existiert im Ctor noch nicht, deswegen hier!
468
469 else if ( nDlgType == 1100 || // Chart-Dialog//CHINA001 else if ( *pDlgType == 1100 || // Chart-Dialog
470 nDlgType == 1101 )//CHINA001 *pDlgType == 1101 )
471 {
472 aFtLineEndsStyle.Hide();
473 aFtLineEndsWidth.Hide();
474 aLbStartStyle.Hide();
475 aMtrStartWidth.Hide();
476 aTsbCenterStart.Hide();
477 aLbEndStyle.Hide();
478 aMtrEndWidth.Hide();
479 aTsbCenterEnd.Hide();
480 aCbxSynchronize.Hide();
481 aFlLineEnds.Hide();
482
483 // #116827#
484 maFLEdgeStyle.Hide();
485 maFTEdgeStyle.Hide();
486 maLBEdgeStyle.Hide();
487
488 // LineCaps
489 maFTCapStyle.Hide();
490 maLBCapStyle.Hide();
491 }
492 }
493
494 // -----------------------------------------------------------------------
495
DeactivatePage(SfxItemSet * _pSet)496 int SvxLineTabPage::DeactivatePage( SfxItemSet* _pSet )
497 {
498 if( nDlgType == 0 ) // Linien-Dialog//CHINA001 if( *pDlgType == 0 ) // Linien-Dialog
499 {
500 nPageType = 1; // evtl. fuer Erweiterungen//CHINA001 *pPageType = 1; // evtl. fuer Erweiterungen
501 *pPosDashLb = aLbLineStyle.GetSelectEntryPos() - 2;// erster Eintrag SOLID !!!
502 sal_uInt16 nPos = aLbStartStyle.GetSelectEntryPos();
503 if( nPos != LISTBOX_ENTRY_NOTFOUND )
504 nPos--;
505 *pPosLineEndLb = nPos;
506 }
507
508 if( _pSet )
509 FillItemSet( *_pSet );
510
511 return( LEAVE_PAGE );
512 }
513
514 // -----------------------------------------------------------------------
515
FillItemSet(SfxItemSet & rAttrs)516 sal_Bool SvxLineTabPage::FillItemSet( SfxItemSet& rAttrs )
517 {
518 const SfxPoolItem* pOld = NULL;
519 sal_uInt16 nPos;
520 sal_Bool bModified = sal_False;
521
522 // Um evtl. Modifikationen der Liste vorzubeugen
523 // werden Items anderer Seiten nicht gesetzt
524 if( nDlgType != 0 || nPageType != 2 )//CHINA001 if( *pDlgType != 0 || *pPageType != 2 )
525 {
526 nPos = aLbLineStyle.GetSelectEntryPos();
527 if( nPos != LISTBOX_ENTRY_NOTFOUND &&
528 nPos != aLbLineStyle.GetSavedValue() )
529 {
530 XLineStyleItem* pStyleItem = NULL;
531
532 if( nPos == 0 )
533 pStyleItem = new XLineStyleItem( XLINE_NONE );
534 else if( nPos == 1 )
535 pStyleItem = new XLineStyleItem( XLINE_SOLID );
536 else
537 {
538 pStyleItem = new XLineStyleItem( XLINE_DASH );
539
540 // Zusaetzliche Sicherheit
541 if( maDashList->Count() > (long) ( nPos - 2 ) )
542 {
543 XLineDashItem aDashItem( aLbLineStyle.GetSelectEntry(), maDashList->GetDash( nPos - 2 )->GetDash() );
544 pOld = GetOldItem( rAttrs, XATTR_LINEDASH );
545 if ( !pOld || !( *(const XLineDashItem*)pOld == aDashItem ) )
546 {
547 rAttrs.Put( aDashItem );
548 bModified = sal_True;
549 }
550 }
551 }
552 pOld = GetOldItem( rAttrs, XATTR_LINESTYLE );
553 if ( !pOld || !( *(const XLineStyleItem*)pOld == *pStyleItem ) )
554 {
555 rAttrs.Put( *pStyleItem );
556 bModified = sal_True;
557 }
558 delete pStyleItem;
559 }
560 }
561 // Linienbreite
562 // GetSavedValue() liefert String!
563 if( aMtrLineWidth.GetText() != aMtrLineWidth.GetSavedValue() )
564 {
565 XLineWidthItem aItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) );
566 pOld = GetOldItem( rAttrs, XATTR_LINEWIDTH );
567 if ( !pOld || !( *(const XLineWidthItem*)pOld == aItem ) )
568 {
569 rAttrs.Put( aItem );
570 bModified = sal_True;
571 }
572 }
573 //Breite Linienanfang
574 if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() )
575 {
576 XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) );
577 pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH );
578 if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) )
579 {
580 rAttrs.Put( aItem );
581 bModified = sal_True;
582 }
583 }
584 //Breite Linienende
585 if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() )
586 {
587 XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) );
588 pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH );
589 if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) )
590 {
591 rAttrs.Put( aItem );
592 bModified = sal_True;
593 }
594 }
595
596 // Linienfarbe
597 if( aLbColor.GetSelectEntryPos() != aLbColor.GetSavedValue() )
598 {
599 XLineColorItem aItem( aLbColor.GetSelectEntry(),
600 aLbColor.GetSelectEntryColor() );
601 pOld = GetOldItem( rAttrs, XATTR_LINECOLOR );
602 if ( !pOld || !( *(const XLineColorItem*)pOld == aItem ) )
603 {
604 rAttrs.Put( aItem );
605 bModified = sal_True;
606 }
607 }
608
609 if( nDlgType != 0 || nPageType != 3 )//CHINA001 if( *pDlgType != 0 || *pPageType != 3 )
610 {
611 // Linienanfang
612 nPos = aLbStartStyle.GetSelectEntryPos();
613 if( nPos != LISTBOX_ENTRY_NOTFOUND &&
614 nPos != aLbStartStyle.GetSavedValue() )
615 {
616 XLineStartItem* pItem = NULL;
617 if( nPos == 0 )
618 pItem = new XLineStartItem();
619 else if( maLineEndList->Count() > (long) ( nPos - 1 ) )
620 pItem = new XLineStartItem( aLbStartStyle.GetSelectEntry(),
621 maLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
622 pOld = GetOldItem( rAttrs, XATTR_LINESTART );
623 if( pItem &&
624 ( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) )
625 {
626 rAttrs.Put( *pItem );
627 bModified = sal_True;
628 }
629 delete pItem;
630 }
631 // Linienende
632 nPos = aLbEndStyle.GetSelectEntryPos();
633 if( nPos != LISTBOX_ENTRY_NOTFOUND &&
634 nPos != aLbEndStyle.GetSavedValue() )
635 {
636 XLineEndItem* pItem = NULL;
637 if( nPos == 0 )
638 pItem = new XLineEndItem();
639 else if( maLineEndList->Count() > (long) ( nPos - 1 ) )
640 pItem = new XLineEndItem( aLbEndStyle.GetSelectEntry(),
641 maLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() );
642 pOld = GetOldItem( rAttrs, XATTR_LINEEND );
643 if( pItem &&
644 ( !pOld || !( *(const XLineEndItem*)pOld == *pItem ) ) )
645 {
646 rAttrs.Put( *pItem );
647 bModified = sal_True;
648 }
649 delete pItem;
650 }
651 }
652
653 // Linienenden zentriert
654 TriState eState = aTsbCenterStart.GetState();
655 if( eState != aTsbCenterStart.GetSavedValue() )
656 {
657 XLineStartCenterItem aItem( sal::static_int_cast< sal_Bool >( eState ) );
658 pOld = GetOldItem( rAttrs, XATTR_LINESTARTCENTER );
659 if ( !pOld || !( *(const XLineStartCenterItem*)pOld == aItem ) )
660 {
661 rAttrs.Put( aItem );
662 bModified = sal_True;
663 }
664 }
665 eState = aTsbCenterEnd.GetState();
666 if( eState != aTsbCenterEnd.GetSavedValue() )
667 {
668 XLineEndCenterItem aItem( sal::static_int_cast< sal_Bool >( eState ) );
669 pOld = GetOldItem( rAttrs, XATTR_LINEENDCENTER );
670 if ( !pOld || !( *(const XLineEndCenterItem*)pOld == aItem ) )
671 {
672 rAttrs.Put( aItem );
673 bModified = sal_True;
674 }
675 }
676
677 //Breite Linienanfang
678 if( aMtrStartWidth.GetText() != aMtrStartWidth.GetSavedValue() )
679 {
680 XLineStartWidthItem aItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) );
681 pOld = GetOldItem( rAttrs, XATTR_LINESTARTWIDTH );
682 if ( !pOld || !( *(const XLineStartWidthItem*)pOld == aItem ) )
683 {
684 rAttrs.Put( aItem );
685 bModified = sal_True;
686 }
687 }
688 //Breite Linienende
689 if( aMtrEndWidth.GetText() != aMtrEndWidth.GetSavedValue() )
690 {
691 XLineEndWidthItem aItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) );
692 pOld = GetOldItem( rAttrs, XATTR_LINEENDWIDTH );
693 if ( !pOld || !( *(const XLineEndWidthItem*)pOld == aItem ) )
694 {
695 rAttrs.Put( aItem );
696 bModified = sal_True;
697 }
698 }
699
700 // Transparenz
701 sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue();
702 if( nVal != (sal_uInt16)aMtrTransparent.GetSavedValue().ToInt32() )
703 {
704 XLineTransparenceItem aItem( nVal );
705 pOld = GetOldItem( rAttrs, XATTR_LINETRANSPARENCE );
706 if ( !pOld || !( *(const XLineTransparenceItem*)pOld == aItem ) )
707 {
708 rAttrs.Put( aItem );
709 bModified = sal_True;
710 }
711 }
712
713 // #116827#
714 nPos = maLBEdgeStyle.GetSelectEntryPos();
715 if( LISTBOX_ENTRY_NOTFOUND != nPos && nPos != maLBEdgeStyle.GetSavedValue() )
716 {
717 XLineJointItem* pNew = 0L;
718
719 switch(nPos)
720 {
721 case 0: // Rounded, default
722 {
723 pNew = new XLineJointItem(com::sun::star::drawing::LineJoint_ROUND);
724 break;
725 }
726 case 1: // - none -
727 {
728 pNew = new XLineJointItem(com::sun::star::drawing::LineJoint_NONE);
729 break;
730 }
731 case 2: // Miter
732 {
733 pNew = new XLineJointItem(com::sun::star::drawing::LineJoint_MITER);
734 break;
735 }
736 case 3: // Bevel
737 {
738 pNew = new XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL);
739 break;
740 }
741 }
742
743 if(pNew)
744 {
745 pOld = GetOldItem( rAttrs, XATTR_LINEJOINT );
746
747 if(!pOld || !(*(const XLineJointItem*)pOld == *pNew))
748 {
749 rAttrs.Put( *pNew );
750 bModified = sal_True;
751 }
752
753 delete pNew;
754 }
755 }
756
757 // LineCaps
758 nPos = maLBCapStyle.GetSelectEntryPos();
759 if( LISTBOX_ENTRY_NOTFOUND != nPos && nPos != maLBCapStyle.GetSavedValue() )
760 {
761 XLineCapItem* pNew = 0L;
762
763 switch(nPos)
764 {
765 case 0: // Butt (=Flat), default
766 {
767 pNew = new XLineCapItem(com::sun::star::drawing::LineCap_BUTT);
768 break;
769 }
770 case 1: // Round
771 {
772 pNew = new XLineCapItem(com::sun::star::drawing::LineCap_ROUND);
773 break;
774 }
775 case 2: // Square
776 {
777 pNew = new XLineCapItem(com::sun::star::drawing::LineCap_SQUARE);
778 break;
779 }
780 }
781
782 if(pNew)
783 {
784 pOld = GetOldItem( rAttrs, XATTR_LINECAP );
785
786 if(!pOld || !(*(const XLineCapItem*)pOld == *pNew))
787 {
788 rAttrs.Put( *pNew );
789 bModified = sal_True;
790 }
791
792 delete pNew;
793 }
794 }
795
796 if(nSymbolType!=SVX_SYMBOLTYPE_UNKNOWN || bNewSize)
797 {
798 //wurde also per Auswahl gesetzt oder Gr��e ist anders
799 SvxSizeItem aSItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),aSymbolSize);
800 const SfxPoolItem* pSOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE) );
801 bNewSize = pSOld ? *(const SvxSizeItem *)pSOld != aSItem : bNewSize ;
802 if(bNewSize)
803 {
804 rAttrs.Put(aSItem);
805 bModified=sal_True;
806 }
807
808 SfxInt32Item aTItem(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),nSymbolType);
809 const SfxPoolItem* pTOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE) );
810 bool bNewType = pTOld == NULL || *(const SfxInt32Item*)pTOld != aTItem;
811 if(bNewType && nSymbolType==SVX_SYMBOLTYPE_UNKNOWN)
812 bNewType=false;//kleine Korrektur, Typ wurde garnicht gesetzt -> kein Type-Item erzeugen!
813 if(bNewType)
814 {
815 rAttrs.Put(aTItem);
816 bModified=sal_True;
817 }
818
819 if(nSymbolType!=SVX_SYMBOLTYPE_NONE)
820 {
821 SvxBrushItem aBItem(aSymbolGraphic,GPOS_MM,rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH));
822 const SfxPoolItem* pBOld = GetOldItem( rAttrs, rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH) );
823 bool bNewBrush =
824 pBOld == NULL || *(const SvxBrushItem*)pBOld != aBItem;
825 if(bNewBrush)
826 {
827 rAttrs.Put(aBItem);
828 bModified=sal_True;
829 }
830 }
831 }
832 rAttrs.Put (CntUInt16Item(SID_PAGE_TYPE,nPageType));//add CHINA001
833 return( bModified );
834 }
835
836 // -----------------------------------------------------------------------
837
FillXLSet_Impl()838 sal_Bool SvxLineTabPage::FillXLSet_Impl()
839 {
840 sal_uInt16 nPos;
841
842 if( aLbLineStyle.GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND )
843 {
844 //rXLSet.Put( XLineDashItem ( rOutAttrs.Get( GetWhich( XATTR_LINEDASH ) ) ) );
845 rXLSet.Put( XLineStyleItem( XLINE_NONE ) );
846 }
847 else if( aLbLineStyle.IsEntryPosSelected( 0 ) )
848 rXLSet.Put( XLineStyleItem( XLINE_NONE ) );
849 else if( aLbLineStyle.IsEntryPosSelected( 1 ) )
850 rXLSet.Put( XLineStyleItem( XLINE_SOLID ) );
851 else
852 {
853 rXLSet.Put( XLineStyleItem( XLINE_DASH ) );
854
855 nPos = aLbLineStyle.GetSelectEntryPos();
856 if( nPos != LISTBOX_ENTRY_NOTFOUND )
857 {
858 rXLSet.Put( XLineDashItem( aLbLineStyle.GetSelectEntry(), maDashList->GetDash( nPos - 2 )->GetDash() ) );
859 }
860 }
861
862 nPos = aLbStartStyle.GetSelectEntryPos();
863 if( nPos != LISTBOX_ENTRY_NOTFOUND )
864 {
865 if( nPos == 0 )
866 rXLSet.Put( XLineStartItem() );
867 else
868 rXLSet.Put( XLineStartItem( aLbStartStyle.GetSelectEntry(),
869 maLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) );
870 }
871 nPos = aLbEndStyle.GetSelectEntryPos();
872 if( nPos != LISTBOX_ENTRY_NOTFOUND )
873 {
874 if( nPos == 0 )
875 rXLSet.Put( XLineEndItem() );
876 else
877 rXLSet.Put( XLineEndItem( aLbEndStyle.GetSelectEntry(),
878 maLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() ) );
879 }
880
881 // #116827#
882 nPos = maLBEdgeStyle.GetSelectEntryPos();
883 if(LISTBOX_ENTRY_NOTFOUND != nPos)
884 {
885 switch(nPos)
886 {
887 case 0: // Rounded, default
888 {
889 rXLSet.Put(XLineJointItem(com::sun::star::drawing::LineJoint_ROUND));
890 break;
891 }
892 case 1: // - none -
893 {
894 rXLSet.Put(XLineJointItem(com::sun::star::drawing::LineJoint_NONE));
895 break;
896 }
897 case 2: // Miter
898 {
899 rXLSet.Put(XLineJointItem(com::sun::star::drawing::LineJoint_MITER));
900 break;
901 }
902 case 3: // Bevel
903 {
904 rXLSet.Put(XLineJointItem(com::sun::star::drawing::LineJoint_BEVEL));
905 break;
906 }
907 }
908 }
909
910 // LineCaps
911 nPos = maLBCapStyle.GetSelectEntryPos();
912 if(LISTBOX_ENTRY_NOTFOUND != nPos)
913 {
914 switch(nPos)
915 {
916 case 0: // Butt (=Flat), default
917 {
918 rXLSet.Put(XLineCapItem(com::sun::star::drawing::LineCap_BUTT));
919 break;
920 }
921 case 1: // Round
922 {
923 rXLSet.Put(XLineCapItem(com::sun::star::drawing::LineCap_ROUND));
924 break;
925 }
926 case 2: // Square
927 {
928 rXLSet.Put(XLineCapItem(com::sun::star::drawing::LineCap_SQUARE));
929 break;
930 }
931 }
932 }
933
934 rXLSet.Put( XLineStartWidthItem( GetCoreValue( aMtrStartWidth, ePoolUnit ) ) );
935 rXLSet.Put( XLineEndWidthItem( GetCoreValue( aMtrEndWidth, ePoolUnit ) ) );
936
937 rXLSet.Put( XLineWidthItem( GetCoreValue( aMtrLineWidth, ePoolUnit ) ) );
938 rXLSet.Put( XLineColorItem( aLbColor.GetSelectEntry(),
939 aLbColor.GetSelectEntryColor() ) );
940
941 // Linienenden zentriert
942 if( aTsbCenterStart.GetState() == STATE_CHECK )
943 rXLSet.Put( XLineStartCenterItem( sal_True ) );
944 else if( aTsbCenterStart.GetState() == STATE_NOCHECK )
945 rXLSet.Put( XLineStartCenterItem( sal_False ) );
946
947 if( aTsbCenterEnd.GetState() == STATE_CHECK )
948 rXLSet.Put( XLineEndCenterItem( sal_True ) );
949 else if( aTsbCenterEnd.GetState() == STATE_NOCHECK )
950 rXLSet.Put( XLineEndCenterItem( sal_False ) );
951
952 // Transparenz
953 sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue();
954 rXLSet.Put( XLineTransparenceItem( nVal ) );
955
956 // #116827#
957 aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
958
959 return( sal_True );
960 }
961
962 // -----------------------------------------------------------------------
963
Reset(const SfxItemSet & rAttrs)964 void SvxLineTabPage::Reset( const SfxItemSet& rAttrs )
965 {
966 String aString;
967 XLineStyle eXLS; // XLINE_NONE, XLINE_SOLID, XLINE_DASH
968
969 // Linienstil
970 /*
971 if( bObjSelected &&
972 rAttrs.GetItemState( GetWhich( XATTR_LINESTYLE ) ) == SFX_ITEM_DEFAULT )
973 {
974 aLbLineStyle.Disable();
975 }
976 */
977 const SfxPoolItem *pPoolItem;
978 long nSymType=SVX_SYMBOLTYPE_UNKNOWN;
979 sal_Bool bPrevSym=sal_False;
980 sal_Bool bEnable=sal_True;
981 sal_Bool bIgnoreGraphic=sal_False;
982 sal_Bool bIgnoreSize=sal_False;
983 if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLTYPE),sal_True,&pPoolItem) == SFX_ITEM_SET)
984 {
985 nSymType=((const SfxInt32Item *)pPoolItem)->GetValue();
986 }
987
988 if(nSymType == SVX_SYMBOLTYPE_AUTO)
989 {
990 aSymbolGraphic=aAutoSymbolGraphic;
991 aSymbolSize=aSymbolLastSize=aAutoSymbolGraphic.GetPrefSize();
992 bPrevSym=sal_True;
993 }
994 else if(nSymType == SVX_SYMBOLTYPE_NONE)
995 {
996 bEnable=sal_False;
997 bIgnoreGraphic=sal_True;
998 bIgnoreSize=sal_True;
999 }
1000 else if(nSymType >= 0)
1001 {
1002 VirtualDevice aVDev;
1003 aVDev.SetMapMode(MapMode(MAP_100TH_MM));
1004
1005 SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS);
1006 pModel->GetItemPool().FreezeIdRanges();
1007 SdrPage* pPage = new SdrPage( *pModel, sal_False );
1008 pPage->SetSize(Size(1000,1000));
1009 pModel->InsertPage( pPage, 0 );
1010 SdrView* pView = new SdrView( pModel, &aVDev );
1011 pView->hideMarkHandles();
1012 /*SdrPageView* pPageView = */pView->ShowSdrPage(pPage);
1013 SdrObject *pObj=NULL;
1014 long nSymTmp=nSymType;
1015 if(pSymbolList)
1016 {
1017 if(pSymbolList->GetObjCount())
1018 {
1019 nSymTmp=nSymTmp%pSymbolList->GetObjCount(); //Liste wird als cyclisch betrachtet!!!
1020 pObj=pSymbolList->GetObj(nSymTmp);
1021 if(pObj)
1022 {
1023 pObj=pObj->Clone();
1024 if(pSymbolAttr)
1025 {
1026 pObj->SetMergedItemSet(*pSymbolAttr);
1027 }
1028 else
1029 {
1030 pObj->SetMergedItemSet(rOutAttrs);
1031 }
1032
1033 pPage->NbcInsertObject(pObj);
1034
1035 // Generate invisible square to give all symbol types a
1036 // bitmap size, which is indepedent from specific glyph
1037 SdrObject *pInvisibleSquare=pSymbolList->GetObj(0);
1038 pInvisibleSquare=pInvisibleSquare->Clone();
1039 pPage->NbcInsertObject(pInvisibleSquare);
1040 pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100));
1041 pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100));
1042
1043 pView->MarkAll();
1044 GDIMetaFile aMeta(pView->GetMarkedObjMetaFile());
1045
1046 aSymbolGraphic=Graphic(aMeta);
1047 aSymbolSize=pObj->GetSnapRect().GetSize();
1048 aSymbolGraphic.SetPrefSize(pInvisibleSquare->GetSnapRect().GetSize());
1049 aSymbolGraphic.SetPrefMapMode(MAP_100TH_MM);
1050 bPrevSym=sal_True;
1051 bEnable=sal_True;
1052 bIgnoreGraphic=sal_True;
1053
1054 pView->UnmarkAll();
1055 pInvisibleSquare=pPage->RemoveObject(1);
1056 SdrObject::Free( pInvisibleSquare);
1057 pObj=pPage->RemoveObject(0);
1058 SdrObject::Free( pObj );
1059 }
1060 }
1061 }
1062 delete pView;
1063 delete pModel;
1064 }
1065 if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_BRUSH),sal_True,&pPoolItem) == SFX_ITEM_SET)
1066 {
1067 const Graphic* pGraphic = ((const SvxBrushItem *)pPoolItem)->GetGraphic();
1068 if( pGraphic )
1069 {
1070 if(!bIgnoreGraphic)
1071 {
1072 aSymbolGraphic=*pGraphic;
1073 }
1074 if(!bIgnoreSize)
1075 {
1076 aSymbolSize=OutputDevice::LogicToLogic( pGraphic->GetPrefSize(),
1077 pGraphic->GetPrefMapMode(),
1078 MAP_100TH_MM );
1079 }
1080 bPrevSym=sal_True;
1081 }
1082 }
1083
1084 if(rAttrs.GetItemState(rAttrs.GetPool()->GetWhich(SID_ATTR_SYMBOLSIZE),sal_True,&pPoolItem) == SFX_ITEM_SET)
1085 {
1086 aSymbolSize = ((const SvxSizeItem *)pPoolItem)->GetSize();
1087 }
1088
1089 aSymbolRatioCB.Enable(bEnable);
1090 aSymbolHeightFT.Enable(bEnable);
1091 aSymbolWidthFT.Enable(bEnable);
1092 aSymbolWidthMF.Enable(bEnable);
1093 aSymbolHeightMF.Enable(bEnable);
1094 if(bPrevSym)
1095 {
1096 SetMetricValue(aSymbolWidthMF, aSymbolSize.Width(), ePoolUnit);
1097 SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(),ePoolUnit);
1098 aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize);
1099 aSymbolLastSize=aSymbolSize;
1100 }
1101
1102 if( rAttrs.GetItemState( XATTR_LINESTYLE ) != SFX_ITEM_DONTCARE )
1103 {
1104 eXLS = (XLineStyle) ( ( const XLineStyleItem& ) rAttrs.Get( XATTR_LINESTYLE ) ).GetValue();
1105
1106 switch( eXLS )
1107 {
1108 case XLINE_NONE:
1109 aLbLineStyle.SelectEntryPos( 0 );
1110 break;
1111 case XLINE_SOLID:
1112 aLbLineStyle.SelectEntryPos( 1 );
1113 break;
1114
1115 case XLINE_DASH:
1116 aLbLineStyle.SetNoSelection();
1117 aLbLineStyle.SelectEntry( ( ( const XLineDashItem& ) rAttrs.
1118 Get( XATTR_LINEDASH ) ).GetName() );
1119 break;
1120
1121 default:
1122 break;
1123 }
1124 }
1125 else
1126 {
1127 aLbLineStyle.SetNoSelection();
1128 }
1129
1130 // Linienstaerke
1131 /*
1132 if( bObjSelected &&
1133 rAttrs.GetItemState( GetWhich( XATTR_LINEWIDTH ) ) == SFX_ITEM_DEFAULT )
1134 {
1135 aMtrLineWidth.Disable();
1136 }
1137 */
1138 if( rAttrs.GetItemState( XATTR_LINEWIDTH ) != SFX_ITEM_DONTCARE )
1139 {
1140 SetMetricValue( aMtrLineWidth, ( ( const XLineWidthItem& ) rAttrs.
1141 Get( XATTR_LINEWIDTH ) ).GetValue(), ePoolUnit );
1142 }
1143 else
1144 aMtrLineWidth.SetText( String() );
1145
1146 // Linienfarbe
1147 /*
1148 if( bObjSelected &&
1149 rAttrs.GetItemState( GetWhich( XATTR_LINECOLOR ) ) == SFX_ITEM_DEFAULT )
1150 {
1151 aLbColor.Disable();
1152 }
1153 */
1154 aLbColor.SetNoSelection();
1155
1156 if ( rAttrs.GetItemState( XATTR_LINECOLOR ) != SFX_ITEM_DONTCARE )
1157 {
1158 Color aCol = ( ( const XLineColorItem& ) rAttrs.Get( XATTR_LINECOLOR ) ).GetColorValue();
1159 aLbColor.SelectEntry( aCol );
1160 if( aLbColor.GetSelectEntryCount() == 0 )
1161 {
1162 aLbColor.InsertEntry( aCol, String() );
1163 aLbColor.SelectEntry( aCol );
1164 }
1165 }
1166
1167 // LinienAnfang
1168 if( bObjSelected &&
1169 rAttrs.GetItemState( XATTR_LINESTART ) == SFX_ITEM_DEFAULT )
1170 {
1171 aLbStartStyle.Disable();
1172 }
1173 else if( rAttrs.GetItemState( XATTR_LINESTART ) != SFX_ITEM_DONTCARE )
1174 {
1175 // #86265# select entry using list and polygon, not string
1176 sal_Bool bSelected(sal_False);
1177 const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineStartItem&)rAttrs.Get(XATTR_LINESTART)).GetLineStartValue();
1178
1179 for(sal_Int32 a(0);!bSelected && a < maLineEndList->Count(); a++)
1180 {
1181 XLineEndEntry* pEntry = maLineEndList->GetLineEnd(a);
1182 const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
1183
1184 if(rItemPolygon == rEntryPolygon)
1185 {
1186 // select this entry
1187 aLbStartStyle.SelectEntryPos((sal_uInt16)a + 1);
1188 bSelected = sal_True;
1189 }
1190 }
1191
1192 if(!bSelected)
1193 aLbStartStyle.SelectEntryPos( 0 );
1194 }
1195 else
1196 {
1197 aLbStartStyle.SetNoSelection();
1198 }
1199
1200 // LinienEnde
1201 if( bObjSelected &&
1202 rAttrs.GetItemState( XATTR_LINEEND ) == SFX_ITEM_DEFAULT )
1203 {
1204 aLbEndStyle.Disable();
1205 }
1206 else if( rAttrs.GetItemState( XATTR_LINEEND ) != SFX_ITEM_DONTCARE )
1207 {
1208 // #86265# select entry using list and polygon, not string
1209 sal_Bool bSelected(sal_False);
1210 const basegfx::B2DPolyPolygon& rItemPolygon = ((const XLineEndItem&)rAttrs.Get(XATTR_LINEEND)).GetLineEndValue();
1211
1212 for(sal_Int32 a(0);!bSelected && a < maLineEndList->Count(); a++)
1213 {
1214 XLineEndEntry* pEntry = maLineEndList->GetLineEnd(a);
1215 const basegfx::B2DPolyPolygon& rEntryPolygon = pEntry->GetLineEnd();
1216
1217 if(rItemPolygon == rEntryPolygon)
1218 {
1219 // select this entry
1220 aLbEndStyle.SelectEntryPos((sal_uInt16)a + 1);
1221 bSelected = sal_True;
1222 }
1223 }
1224
1225 if(!bSelected)
1226 aLbEndStyle.SelectEntryPos( 0 );
1227 }
1228 else
1229 {
1230 aLbEndStyle.SetNoSelection();
1231 }
1232
1233 // LinienAnfang St"arke
1234 if( bObjSelected &&
1235 rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) == SFX_ITEM_DEFAULT )
1236 {
1237 aMtrStartWidth.Disable();
1238 }
1239 else if( rAttrs.GetItemState( XATTR_LINESTARTWIDTH ) != SFX_ITEM_DONTCARE )
1240 {
1241 SetMetricValue( aMtrStartWidth, ( ( const XLineStartWidthItem& ) rAttrs.
1242 Get( XATTR_LINESTARTWIDTH ) ).GetValue(), ePoolUnit );
1243 }
1244 else
1245 aMtrStartWidth.SetText( String() );
1246
1247 // LinienEnde St"arke
1248 if( bObjSelected &&
1249 rAttrs.GetItemState( XATTR_LINEENDWIDTH ) == SFX_ITEM_DEFAULT )
1250 {
1251 aMtrEndWidth.Disable();
1252 }
1253 else if( rAttrs.GetItemState( XATTR_LINEENDWIDTH ) != SFX_ITEM_DONTCARE )
1254 {
1255 SetMetricValue( aMtrEndWidth, ( ( const XLineEndWidthItem& ) rAttrs.
1256 Get( XATTR_LINEENDWIDTH ) ).GetValue(), ePoolUnit );
1257 }
1258 else
1259 aMtrEndWidth.SetText( String() );
1260
1261 // Linienenden zentriert (Start)
1262 if( bObjSelected &&
1263 rAttrs.GetItemState( XATTR_LINESTARTCENTER ) == SFX_ITEM_DEFAULT )
1264 {
1265 aTsbCenterStart.Disable();
1266 }
1267 else if( rAttrs.GetItemState( XATTR_LINESTARTCENTER ) != SFX_ITEM_DONTCARE )
1268 {
1269 aTsbCenterStart.EnableTriState( sal_False );
1270
1271 if( ( ( const XLineStartCenterItem& ) rAttrs.Get( XATTR_LINESTARTCENTER ) ).GetValue() )
1272 aTsbCenterStart.SetState( STATE_CHECK );
1273 else
1274 aTsbCenterStart.SetState( STATE_NOCHECK );
1275 }
1276 else
1277 {
1278 aTsbCenterStart.SetState( STATE_DONTKNOW );
1279 }
1280
1281 // Linienenden zentriert (Ende)
1282 if( bObjSelected &&
1283 rAttrs.GetItemState( XATTR_LINEENDCENTER ) == SFX_ITEM_DEFAULT )
1284 {
1285 aTsbCenterEnd.Disable();
1286 }
1287 else if( rAttrs.GetItemState( XATTR_LINEENDCENTER ) != SFX_ITEM_DONTCARE )
1288 {
1289 aTsbCenterEnd.EnableTriState( sal_False );
1290
1291 if( ( ( const XLineEndCenterItem& ) rAttrs.Get( XATTR_LINEENDCENTER ) ).GetValue() )
1292 aTsbCenterEnd.SetState( STATE_CHECK );
1293 else
1294 aTsbCenterEnd.SetState( STATE_NOCHECK );
1295 }
1296 else
1297 {
1298 aTsbCenterEnd.SetState( STATE_DONTKNOW );
1299 }
1300
1301 // Transparenz
1302 if( rAttrs.GetItemState( XATTR_LINETRANSPARENCE ) != SFX_ITEM_DONTCARE )
1303 {
1304 sal_uInt16 nTransp = ( ( const XLineTransparenceItem& ) rAttrs.
1305 Get( XATTR_LINETRANSPARENCE ) ).GetValue();
1306 aMtrTransparent.SetValue( nTransp );
1307 ChangeTransparentHdl_Impl( NULL );
1308 }
1309 else
1310 aMtrTransparent.SetText( String() );
1311
1312 if( !aLbStartStyle.IsEnabled() &&
1313 !aLbEndStyle.IsEnabled() &&
1314 !aMtrStartWidth.IsEnabled() &&
1315 !aMtrEndWidth.IsEnabled() &&
1316 !aTsbCenterStart.IsEnabled()&&
1317 !aTsbCenterEnd.IsEnabled() )
1318 {
1319 aCbxSynchronize.Disable();
1320 aFtLineEndsStyle.Disable();
1321 aFtLineEndsWidth.Disable();
1322 aFlLineEnds.Disable();
1323 }
1324
1325 // Synchronisieren
1326 // Jetzt wird der Wert aus der INI-Datei geholt (#42258#)
1327 String aStr = GetUserData();
1328 aCbxSynchronize.Check( (sal_Bool)aStr.ToInt32() );
1329
1330 // #116827#
1331 if(bObjSelected && SFX_ITEM_DEFAULT == rAttrs.GetItemState(XATTR_LINEJOINT))
1332 {
1333 maFTEdgeStyle.Disable();
1334 maLBEdgeStyle.Disable();
1335 }
1336 else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINEJOINT))
1337 {
1338 const com::sun::star::drawing::LineJoint eLineJoint = ((const XLineJointItem&)(rAttrs.Get(XATTR_LINEJOINT))).GetValue();
1339
1340 switch(eLineJoint)
1341 {
1342 case com::sun::star::drawing::LineJoint_MIDDLE : // fallback to round, unused value
1343 case com::sun::star::drawing::LineJoint_ROUND : maLBEdgeStyle.SelectEntryPos(0); break;
1344 case com::sun::star::drawing::LineJoint_NONE : maLBEdgeStyle.SelectEntryPos(1); break;
1345 case com::sun::star::drawing::LineJoint_MITER : maLBEdgeStyle.SelectEntryPos(2); break;
1346 case com::sun::star::drawing::LineJoint_BEVEL : maLBEdgeStyle.SelectEntryPos(3); break;
1347 default: break;
1348 }
1349 }
1350 else
1351 {
1352 maLBEdgeStyle.SetNoSelection();
1353 }
1354
1355 /*
1356 if( aLbStartStyle.GetSelectEntryPos() == aLbEndStyle.GetSelectEntryPos() &&
1357 aMtrStartWidth.GetValue() == aMtrEndWidth.GetValue() &&
1358 aTsbCenterStart.GetState() == aTsbCenterEnd.GetState() )
1359 {
1360 aCbxSynchronize.Check();
1361 }
1362 */
1363
1364 // fdo#43209
1365 if(bObjSelected && SFX_ITEM_DEFAULT == rAttrs.GetItemState(XATTR_LINECAP))
1366 {
1367 maFTCapStyle.Disable();
1368 maLBCapStyle.Disable();
1369 }
1370 else if(SFX_ITEM_DONTCARE != rAttrs.GetItemState(XATTR_LINECAP))
1371 {
1372 const com::sun::star::drawing::LineCap eLineCap(((const XLineCapItem&)(rAttrs.Get(XATTR_LINECAP))).GetValue());
1373
1374 switch(eLineCap)
1375 {
1376 case com::sun::star::drawing::LineCap_ROUND: maLBCapStyle.SelectEntryPos(1); break;
1377 case com::sun::star::drawing::LineCap_SQUARE : maLBCapStyle.SelectEntryPos(2); break;
1378 default /*com::sun::star::drawing::LineCap_BUTT*/: maLBCapStyle.SelectEntryPos(0); break;
1379 }
1380 }
1381 else
1382 {
1383 maLBCapStyle.SetNoSelection();
1384 }
1385
1386 // Werte sichern
1387 aLbLineStyle.SaveValue();
1388 aMtrLineWidth.SaveValue();
1389 aLbColor.SaveValue();
1390 aLbStartStyle.SaveValue();
1391 aLbEndStyle.SaveValue();
1392 aMtrStartWidth.SaveValue();
1393 aMtrEndWidth.SaveValue();
1394 aTsbCenterStart.SaveValue();
1395 aTsbCenterEnd.SaveValue();
1396 aMtrTransparent.SaveValue();
1397
1398 // #116827#
1399 maLBEdgeStyle.SaveValue();
1400
1401 // LineCaps
1402 maLBCapStyle.SaveValue();
1403
1404 ClickInvisibleHdl_Impl( this );
1405 //ClickMeasuringHdl_Impl( this );
1406 //aCtlPosition.Reset();
1407
1408 ChangePreviewHdl_Impl( NULL );
1409 }
1410
1411 // -----------------------------------------------------------------------
1412
Create(Window * pWindow,const SfxItemSet & rAttrs)1413 SfxTabPage* SvxLineTabPage::Create( Window* pWindow,
1414 const SfxItemSet& rAttrs )
1415 {
1416 return( new SvxLineTabPage( pWindow, rAttrs ) );
1417 }
1418
1419 //------------------------------------------------------------------------
1420
GetRanges()1421 sal_uInt16* SvxLineTabPage::GetRanges()
1422 {
1423 return( pLineRanges );
1424 }
1425
1426 //------------------------------------------------------------------------
1427
IMPL_LINK(SvxLineTabPage,ChangePreviewHdl_Impl,void *,pCntrl)1428 IMPL_LINK( SvxLineTabPage, ChangePreviewHdl_Impl, void *, pCntrl )
1429 {
1430 if(pCntrl == &aMtrLineWidth)
1431 {
1432 // Linienbreite und Start/EndBreite
1433 sal_Int32 nNewLineWidth = GetCoreValue( aMtrLineWidth, ePoolUnit );
1434 if(nActLineWidth == -1)
1435 {
1436 // Noch nicht initialisiert, hole den Startwert
1437 const SfxPoolItem* pOld = GetOldItem( rXLSet, XATTR_LINEWIDTH );
1438 sal_Int32 nStartLineWidth = 0;
1439 if(pOld)
1440 nStartLineWidth = (( const XLineWidthItem *)pOld)->GetValue();
1441 nActLineWidth = nStartLineWidth;
1442 }
1443
1444 if(nActLineWidth != nNewLineWidth)
1445 {
1446 // Anpassungen Start/EndWidth #63083#
1447 sal_Int32 nValAct = GetCoreValue( aMtrStartWidth, ePoolUnit );
1448 sal_Int32 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
1449 if(nValNew < 0)
1450 nValNew = 0;
1451 SetMetricValue( aMtrStartWidth, nValNew, ePoolUnit );
1452
1453 nValAct = GetCoreValue( aMtrEndWidth, ePoolUnit );
1454 nValNew = nValAct + (((nNewLineWidth - nActLineWidth) * 15) / 10);
1455 if(nValNew < 0)
1456 nValNew = 0;
1457 SetMetricValue( aMtrEndWidth, nValNew, ePoolUnit );
1458 }
1459
1460 // Aktuellen Wert merken
1461 nActLineWidth = nNewLineWidth;
1462 }
1463
1464 FillXLSet_Impl();
1465 aCtlPreview.Invalidate();
1466
1467 // Transparenz entspr. zugaenglich machen
1468 if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar
1469 {
1470 aFtTransparent.Disable();
1471 aMtrTransparent.Disable();
1472 }
1473 else
1474 {
1475 aFtTransparent.Enable();
1476 aMtrTransparent.Enable();
1477 }
1478
1479 const bool bHasLineStart = aLbStartStyle.GetSelectEntryPos() != 0;
1480 const bool bHasLineEnd = aLbEndStyle.GetSelectEntryPos() != 0;
1481
1482 aFtLineEndsWidth.Enable( bHasLineStart || bHasLineEnd );
1483 aMtrStartWidth.Enable( bHasLineStart );
1484 aTsbCenterStart.Enable( bHasLineStart );
1485 aMtrEndWidth.Enable( bHasLineEnd );
1486 aTsbCenterEnd.Enable( bHasLineEnd );
1487
1488 return( 0L );
1489 }
1490
1491 //------------------------------------------------------------------------
1492
IMPL_LINK(SvxLineTabPage,ChangeStartHdl_Impl,void *,p)1493 IMPL_LINK( SvxLineTabPage, ChangeStartHdl_Impl, void *, p )
1494 {
1495 if( aCbxSynchronize.IsChecked() )
1496 {
1497 if( p == &aMtrStartWidth )
1498 aMtrEndWidth.SetValue( aMtrStartWidth.GetValue() );
1499 if( p == &aLbStartStyle )
1500 aLbEndStyle.SelectEntryPos( aLbStartStyle.GetSelectEntryPos() );
1501 if( p == &aTsbCenterStart )
1502 aTsbCenterEnd.SetState( aTsbCenterStart.GetState() );
1503 }
1504
1505 ChangePreviewHdl_Impl( this );
1506
1507 return( 0L );
1508 }
1509
1510 //------------------------------------------------------------------------
1511 // #116827#
1512
IMPL_LINK(SvxLineTabPage,ChangeEdgeStyleHdl_Impl,void *,EMPTYARG)1513 IMPL_LINK( SvxLineTabPage, ChangeEdgeStyleHdl_Impl, void *, EMPTYARG )
1514 {
1515 ChangePreviewHdl_Impl( this );
1516
1517 return( 0L );
1518 }
1519
1520 //------------------------------------------------------------------------
1521 // fdo#43209
1522
IMPL_LINK(SvxLineTabPage,ChangeCapStyleHdl_Impl,void *,EMPTYARG)1523 IMPL_LINK( SvxLineTabPage, ChangeCapStyleHdl_Impl, void *, EMPTYARG )
1524 {
1525 ChangePreviewHdl_Impl( this );
1526
1527 return( 0L );
1528 }
1529 //------------------------------------------------------------------------
1530
IMPL_LINK(SvxLineTabPage,ClickInvisibleHdl_Impl,void *,EMPTYARG)1531 IMPL_LINK( SvxLineTabPage, ClickInvisibleHdl_Impl, void *, EMPTYARG )
1532 {
1533 if( aLbLineStyle.GetSelectEntryPos() == 0 ) // unsichtbar
1534 {
1535 aFtColor.Disable();
1536 if(!bSymbols)
1537 aLbColor.Disable();
1538 aFtLineWidth.Disable();
1539 aMtrLineWidth.Disable();
1540
1541 if( aFlLineEnds.IsEnabled() )
1542 {
1543 aFtLineEndsStyle.Disable();
1544 aFtLineEndsWidth.Disable();
1545 aLbStartStyle.Disable();
1546 aMtrStartWidth.Disable();
1547 aTsbCenterStart.Disable();
1548 aLbEndStyle.Disable();
1549 aMtrEndWidth.Disable();
1550 aTsbCenterEnd.Disable();
1551 aCbxSynchronize.Disable();
1552
1553 // #116827#
1554 maFTEdgeStyle.Disable();
1555 maLBEdgeStyle.Disable();
1556
1557 // LineCaps
1558 maFTCapStyle.Disable();
1559 maLBCapStyle.Disable();
1560 }
1561 }
1562 else
1563 {
1564 aFtColor.Enable();
1565 aLbColor.Enable();
1566 aFtLineWidth.Enable();
1567 aMtrLineWidth.Enable();
1568
1569 if( aFlLineEnds.IsEnabled() )
1570 {
1571 aFtLineEndsStyle.Enable();
1572 aFtLineEndsWidth.Enable();
1573 aLbStartStyle.Enable();
1574 aMtrStartWidth.Enable();
1575 aTsbCenterStart.Enable();
1576 aLbEndStyle.Enable();
1577 aMtrEndWidth.Enable();
1578 aTsbCenterEnd.Enable();
1579 aCbxSynchronize.Enable();
1580
1581 // #116827#
1582 maFTEdgeStyle.Enable();
1583 maLBEdgeStyle.Enable();
1584
1585 // LineCaps
1586 maFTCapStyle.Enable();
1587 maLBCapStyle.Enable();
1588 }
1589 }
1590 ChangePreviewHdl_Impl( NULL );
1591
1592 return( 0L );
1593 }
1594
1595 //------------------------------------------------------------------------
1596
IMPL_LINK(SvxLineTabPage,ChangeEndHdl_Impl,void *,p)1597 IMPL_LINK( SvxLineTabPage, ChangeEndHdl_Impl, void *, p )
1598 {
1599 if( aCbxSynchronize.IsChecked() )
1600 {
1601 if( p == &aMtrEndWidth )
1602 aMtrStartWidth.SetValue( aMtrEndWidth.GetValue() );
1603 if( p == &aLbEndStyle )
1604 aLbStartStyle.SelectEntryPos( aLbEndStyle.GetSelectEntryPos() );
1605 if( p == &aTsbCenterEnd )
1606 aTsbCenterStart.SetState( aTsbCenterEnd.GetState() );
1607 }
1608
1609 ChangePreviewHdl_Impl( this );
1610
1611 return( 0L );
1612 }
1613
1614 //------------------------------------------------------------------------
1615 /*
1616
1617 long SvxLineTabPage::ClickMeasuringHdl_Impl( void* )
1618 {
1619 if( aTsbShowMeasuring.GetState() == STATE_NOCHECK )
1620 {
1621 aFtPosition.Disable();
1622 aCtlPosition.Disable();
1623 }
1624 else
1625 {
1626 aFtPosition.Enable();
1627 aCtlPosition.Enable();
1628 }
1629 aCtlPosition.Invalidate();
1630
1631 return( 0L );
1632 }
1633 */
1634 //------------------------------------------------------------------------
1635
IMPL_LINK(SvxLineTabPage,ChangeTransparentHdl_Impl,void *,EMPTYARG)1636 IMPL_LINK( SvxLineTabPage, ChangeTransparentHdl_Impl, void *, EMPTYARG )
1637 {
1638 sal_uInt16 nVal = (sal_uInt16)aMtrTransparent.GetValue();
1639 XLineTransparenceItem aItem( nVal );
1640
1641 rXLSet.Put( XLineTransparenceItem( aItem ) );
1642
1643 // #116827#
1644 FillXLSet_Impl();
1645
1646 aCtlPreview.Invalidate();
1647
1648 return( 0L );
1649 }
1650
1651 //------------------------------------------------------------------------
1652
PointChanged(Window *,RECT_POINT eRcPt)1653 void SvxLineTabPage::PointChanged( Window*, RECT_POINT eRcPt )
1654 {
1655 eRP = eRcPt;
1656 }
1657
1658 //------------------------------------------------------------------------
1659
FillUserData()1660 void SvxLineTabPage::FillUserData()
1661 {
1662 // Abgleich wird in der Ini-Datei festgehalten
1663 UniString aStrUserData = UniString::CreateFromInt32( (sal_Int32) aCbxSynchronize.IsChecked() );
1664 SetUserData( aStrUserData );
1665 }
1666
1667
1668 //#58425# Symbole auf einer Linie (z.B. StarChart)
1669 //Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton)
1670 //der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage
IMPL_LINK(SvxLineTabPage,MenuCreateHdl_Impl,MenuButton *,pButton)1671 IMPL_LINK( SvxLineTabPage, MenuCreateHdl_Impl, MenuButton *, pButton )
1672 {
1673 //Popup initialisieren
1674 if(!pButton->GetPopupMenu()->GetPopupMenu( MN_GALLERY ))
1675 {
1676 // Gallery-Eintraege besorgen
1677 GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
1678
1679 PopupMenu* pPopup = new PopupMenu;
1680 String aEmptyStr;
1681
1682 nNumMenuGalleryItems=aGrfNames.Count();
1683 for(long i = 0; i < nNumMenuGalleryItems; i++)
1684 {
1685 const String* pGrfName = (const String*)aGrfNames.GetObject(i);
1686 const String* pUIName = pGrfName;
1687
1688 // convert URL encodings to UI characters (eg %20 for spaces)
1689 String aPhysicalName;
1690 if( ::utl::LocalFileHelper::ConvertURLToPhysicalName( *pGrfName, aPhysicalName ))
1691 pUIName = &aPhysicalName;
1692
1693 SvxBrushItem* pBrushItem = new SvxBrushItem(*pGrfName, aEmptyStr, GPOS_AREA, SID_ATTR_BRUSH);
1694 pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl));
1695
1696 SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
1697 pInfo->pBrushItem = pBrushItem;
1698 pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i);
1699 aGrfBrushItems.Insert(pInfo, i);
1700 const Graphic* pGraphic = pBrushItem->GetGraphic();
1701
1702 if(pGraphic)
1703 {
1704 Bitmap aBitmap(pGraphic->GetBitmap());
1705 Size aSize(aBitmap.GetSizePixel());
1706 if(aSize.Width() > MAX_BMP_WIDTH ||
1707 aSize.Height() > MAX_BMP_HEIGHT)
1708 {
1709 sal_Bool bWidth = aSize.Width() > aSize.Height();
1710 double nScale = bWidth ?
1711 (double)MAX_BMP_WIDTH / (double)aSize.Width():
1712 (double)MAX_BMP_HEIGHT / (double)aSize.Height();
1713 aBitmap.Scale(nScale, nScale);
1714
1715 }
1716 Image aImage(aBitmap);
1717 pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage );
1718 }
1719 else
1720 {
1721 Image aImage;
1722 pPopup->InsertItem(pInfo->nItemId, *pUIName, aImage );
1723 }
1724 }
1725 aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_GALLERY, pPopup );
1726 if(!aGrfNames.Count())
1727 aSymbolMB.GetPopupMenu()->EnableItem(MN_GALLERY, sal_False);
1728 }
1729
1730 if(!pButton->GetPopupMenu()->GetPopupMenu( MN_SYMBOLS ) && pSymbolList)
1731 {
1732 VirtualDevice aVDev;
1733 aVDev.SetMapMode(MapMode(MAP_100TH_MM));
1734 SdrModel* pModel = new SdrModel(NULL, NULL, LOADREFCOUNTS);
1735 pModel->GetItemPool().FreezeIdRanges();
1736 // Page
1737 SdrPage* pPage = new SdrPage( *pModel, sal_False );
1738 pPage->SetSize(Size(1000,1000));
1739 pModel->InsertPage( pPage, 0 );
1740 // 3D View
1741 SdrView* pView = new SdrView( pModel, &aVDev );
1742 pView->hideMarkHandles();
1743 /*SdrPageView* pPageView = */pView->ShowSdrPage(pPage);
1744
1745 PopupMenu* pPopup = new PopupMenu;
1746 String aEmptyStr;
1747
1748 // Generate invisible square to give all symbols a
1749 // bitmap size, which is indepedent from specific glyph
1750 SdrObject *pInvisibleSquare=pSymbolList->GetObj(0);
1751 pInvisibleSquare=pInvisibleSquare->Clone();
1752 pPage->NbcInsertObject(pInvisibleSquare);
1753 pInvisibleSquare->SetMergedItem(XFillTransparenceItem(100));
1754 pInvisibleSquare->SetMergedItem(XLineTransparenceItem(100));
1755
1756 for(long i=0;; ++i)
1757 {
1758 SdrObject *pObj=pSymbolList->GetObj(i);
1759 if(pObj==NULL)
1760 break;
1761 pObj=pObj->Clone();
1762 //const String* pGrfName = (const String*)aGrfNames.GetObject(i);
1763 String *pStr=new String();//String(i));
1764 aGrfNames.Insert(pStr,LIST_APPEND);
1765 //Rectangle aRect(pObj->GetLogicRect());
1766 pPage->NbcInsertObject(pObj);
1767 if(pSymbolAttr)
1768 {
1769 pObj->SetMergedItemSet(*pSymbolAttr);
1770 }
1771 else
1772 {
1773 pObj->SetMergedItemSet(rOutAttrs);
1774 }
1775 pView->MarkAll();
1776 BitmapEx aBitmapEx(pView->GetMarkedObjBitmapEx());
1777 GDIMetaFile aMeta(pView->GetMarkedObjMetaFile());
1778 pView->UnmarkAll();
1779 pObj=pPage->RemoveObject(1);
1780 SdrObject::Free(pObj);
1781
1782 SvxBrushItem* pBrushItem = new SvxBrushItem(Graphic(aMeta), GPOS_AREA, SID_ATTR_BRUSH);
1783 pBrushItem->SetDoneLink(STATIC_LINK(this, SvxLineTabPage, GraphicArrivedHdl_Impl));
1784
1785 SvxBmpItemInfo* pInfo = new SvxBmpItemInfo();
1786 pInfo->pBrushItem = pBrushItem;
1787 pInfo->nItemId = (sal_uInt16)(MN_GALLERY_ENTRY + i + nNumMenuGalleryItems);
1788 aGrfBrushItems.Insert(pInfo, nNumMenuGalleryItems + i);
1789
1790 Size aSize(aBitmapEx.GetSizePixel());
1791 if(aSize.Width() > MAX_BMP_WIDTH || aSize.Height() > MAX_BMP_HEIGHT)
1792 {
1793 sal_Bool bWidth = aSize.Width() > aSize.Height();
1794 double nScale = bWidth ?
1795 (double)MAX_BMP_WIDTH / (double)aSize.Width():
1796 (double)MAX_BMP_HEIGHT / (double)aSize.Height();
1797 aBitmapEx.Scale(nScale, nScale);
1798 }
1799 Image aImage(aBitmapEx);
1800 pPopup->InsertItem(pInfo->nItemId,*pStr,aImage);
1801 }
1802 pInvisibleSquare=pPage->RemoveObject(0);
1803 SdrObject::Free(pInvisibleSquare);
1804
1805 aSymbolMB.GetPopupMenu()->SetPopupMenu( MN_SYMBOLS, pPopup );
1806 if(!aGrfNames.Count())
1807 aSymbolMB.GetPopupMenu()->EnableItem(MN_SYMBOLS, sal_False);
1808
1809 delete pView;
1810 delete pModel;
1811 }
1812 return 0;
1813 }
1814 //#58425# Symbole auf einer Linie (z.B. StarChart)
1815 //Handler f�r Popup-Menue der Symbolauswahl (NumMenueButton)
1816 //der folgende Link stammt urspruenglich aus SvxNumOptionsTabPage:
IMPL_STATIC_LINK(SvxLineTabPage,GraphicArrivedHdl_Impl,SvxBrushItem *,pItem)1817 IMPL_STATIC_LINK(SvxLineTabPage, GraphicArrivedHdl_Impl, SvxBrushItem*, pItem)
1818 {
1819 PopupMenu* pPopup = pThis->aSymbolMB.GetPopupMenu()->GetPopupMenu( MN_GALLERY );
1820
1821 SvxBmpItemInfo* pBmpInfo = 0;
1822 for ( sal_uInt16 i = 0; i < pThis->aGrfBrushItems.Count(); i++ )
1823 {
1824 SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)pThis->aGrfBrushItems.GetObject(i);
1825 if( pInfo->pBrushItem == pItem )
1826 {
1827 pBmpInfo = pInfo; break;
1828 }
1829 }
1830 if( pBmpInfo )
1831 {
1832 if( pItem->GetGraphic() )
1833 {
1834 Bitmap aBitmap(pItem->GetGraphic()->GetBitmap());
1835 Size aSize(aBitmap.GetSizePixel());
1836 if(aSize.Width() > MAX_BMP_WIDTH ||
1837 aSize.Height() > MAX_BMP_HEIGHT)
1838 {
1839 sal_Bool bWidth = aSize.Width() > aSize.Height();
1840 double nScale = bWidth ?
1841 (double)MAX_BMP_WIDTH / (double)aSize.Width():
1842 (double)MAX_BMP_HEIGHT / (double)aSize.Height();
1843 aBitmap.Scale(nScale, nScale);
1844 }
1845 Image aImage(aBitmap);
1846 pPopup->SetItemImage( pBmpInfo->nItemId, aImage );
1847 }
1848 }
1849
1850 return 0;
1851 }
1852
1853 //#58425# Symbole auf einer Linie (z.B. StarChart)
1854 //Handler f�r Menuebutton
IMPL_LINK(SvxLineTabPage,GraphicHdl_Impl,MenuButton *,pButton)1855 IMPL_LINK( SvxLineTabPage, GraphicHdl_Impl, MenuButton *, pButton )
1856 {
1857 sal_uInt16 nItemId = pButton->GetCurItemId();
1858 const Graphic* pGraphic = 0;
1859 Graphic aGraphic;
1860 String aGrfName;
1861 sal_Bool bResetSize = sal_False;
1862 sal_Bool bEnable=sal_True;
1863 long nPreviousSymbolType = nSymbolType;
1864
1865 if(nItemId >= MN_GALLERY_ENTRY)
1866 {
1867 if( (nItemId-MN_GALLERY_ENTRY) >= nNumMenuGalleryItems)
1868 {
1869 nSymbolType=nItemId-MN_GALLERY_ENTRY-nNumMenuGalleryItems; //Index der Liste
1870 }
1871 else
1872 {
1873 nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
1874 bResetSize = sal_True;
1875 }
1876 SvxBmpItemInfo* pInfo = (SvxBmpItemInfo*)aGrfBrushItems.GetObject(nItemId - MN_GALLERY_ENTRY);
1877 pGraphic = pInfo->pBrushItem->GetGraphic();
1878 }
1879 else switch(nItemId)
1880 {
1881 case MN_SYMBOLS_AUTO:
1882 {
1883 pGraphic=&aAutoSymbolGraphic;
1884 aAutoSymbolGraphic.SetPrefSize( Size(253,253) );
1885 nSymbolType=SVX_SYMBOLTYPE_AUTO;
1886 }
1887 break;
1888
1889 case MN_SYMBOLS_NONE:
1890 {
1891 nSymbolType=SVX_SYMBOLTYPE_NONE;
1892 pGraphic=NULL;
1893 bEnable=sal_False;
1894 }
1895 break;
1896 default:
1897 {
1898 SvxOpenGraphicDialog aGrfDlg(CUI_RES(RID_STR_EDIT_GRAPHIC));
1899 aGrfDlg.EnableLink(sal_False);
1900 aGrfDlg.AsLink(sal_False);
1901 if( !aGrfDlg.Execute() )
1902 {
1903 // ausgewaehlten Filter merken
1904 aGrfName = aGrfDlg.GetPath();
1905 if( !aGrfDlg.GetGraphic(aGraphic) )
1906 {
1907 nSymbolType=SVX_SYMBOLTYPE_BRUSHITEM;
1908 pGraphic = &aGraphic;
1909 bResetSize = sal_True;
1910 }
1911 }
1912 if( !pGraphic )
1913 return 0;
1914 }
1915 break;
1916 }
1917
1918 if(pGraphic)
1919 {
1920 Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic);
1921 aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)ePoolUnit);
1922 aSymbolGraphic=*pGraphic;
1923 if( bResetSize )
1924 {
1925 aSymbolSize=aSize;
1926 }
1927 else if( nPreviousSymbolType == SVX_SYMBOLTYPE_BRUSHITEM )
1928 { //#i31097# Data Point Symbol size changes when a different symbol is choosen(maoyg)
1929 if( aSymbolSize.Width() != aSymbolSize.Height() )
1930 {
1931 aSize.setWidth( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 );
1932 aSize.setHeight( (long)( aSymbolSize.Width() + aSymbolSize.Height() )/2 );
1933 aSymbolSize = aSize;
1934 }
1935 }
1936 aCtlPreview.SetSymbol(&aSymbolGraphic,aSymbolSize);
1937 }
1938 else
1939 {
1940 aSymbolGraphic=Graphic();
1941 aCtlPreview.SetSymbol(NULL,aSymbolSize);
1942 bEnable=sal_False;
1943 }
1944 aSymbolLastSize=aSymbolSize;
1945 SetMetricValue(aSymbolWidthMF, aSymbolSize.Width(), ePoolUnit);
1946 SetMetricValue(aSymbolHeightMF, aSymbolSize.Height(), ePoolUnit);
1947 aSymbolRatioCB.Enable(bEnable);
1948 aSymbolHeightFT.Enable(bEnable);
1949 aSymbolWidthFT.Enable(bEnable);
1950 aSymbolWidthMF.Enable(bEnable);
1951 aSymbolHeightMF.Enable(bEnable);
1952 aCtlPreview.Invalidate();
1953
1954 return 0;
1955 }
IMPL_LINK(SvxLineTabPage,SizeHdl_Impl,MetricField *,pField)1956 IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, MetricField *, pField)
1957 {
1958 bNewSize=true;
1959 sal_Bool bWidth = (sal_Bool)(pField == &aSymbolWidthMF);
1960 bLastWidthModified = bWidth;
1961 sal_Bool bRatio = aSymbolRatioCB.IsChecked();
1962 long nWidthVal = static_cast<long>(aSymbolWidthMF.Denormalize(aSymbolWidthMF.GetValue(FUNIT_100TH_MM)));
1963 long nHeightVal= static_cast<long>(aSymbolHeightMF.Denormalize(aSymbolHeightMF.GetValue(FUNIT_100TH_MM)));
1964 nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MAP_100TH_MM,(MapUnit)ePoolUnit );
1965 nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MAP_100TH_MM,(MapUnit)ePoolUnit);
1966 aSymbolSize=Size(nWidthVal,nHeightVal);
1967 double fSizeRatio = (double)1;
1968
1969 if(bRatio)
1970 {
1971 if (aSymbolLastSize.Height() && aSymbolLastSize.Width())
1972 fSizeRatio = (double)aSymbolLastSize.Width() / aSymbolLastSize.Height();
1973 }
1974
1975 //Size aSymbolSize(aSymbolLastSize);
1976
1977 if(bWidth)
1978 {
1979 long nDelta = nWidthVal - aSymbolLastSize.Width();
1980 aSymbolSize.Width() = nWidthVal;
1981 if (bRatio)
1982 {
1983 aSymbolSize.Height() = aSymbolLastSize.Height() + (long)((double)nDelta / fSizeRatio);
1984 aSymbolSize.Height() = OutputDevice::LogicToLogic( aSymbolSize.Height(),(MapUnit)ePoolUnit, MAP_100TH_MM );
1985 aSymbolHeightMF.SetUserValue(aSymbolHeightMF.Normalize(aSymbolSize.Height()), FUNIT_100TH_MM);
1986 }
1987 }
1988 else
1989 {
1990 long nDelta = nHeightVal - aSymbolLastSize.Height();
1991 aSymbolSize.Height() = nHeightVal;
1992 if (bRatio)
1993 {
1994 aSymbolSize.Width() = aSymbolLastSize.Width() + (long)((double)nDelta * fSizeRatio);
1995 aSymbolSize.Width() = OutputDevice::LogicToLogic( aSymbolSize.Width(),
1996 (MapUnit)ePoolUnit, MAP_100TH_MM );
1997 aSymbolWidthMF.SetUserValue(aSymbolWidthMF.Normalize(aSymbolSize.Width()), FUNIT_100TH_MM);
1998 }
1999 }
2000 aCtlPreview.ResizeSymbol(aSymbolSize);
2001 aSymbolLastSize=aSymbolSize;
2002 return 0;
2003 }
IMPL_LINK(SvxLineTabPage,RatioHdl_Impl,CheckBox *,pBox)2004 IMPL_LINK( SvxLineTabPage, RatioHdl_Impl, CheckBox *, pBox )
2005 {
2006 if (pBox->IsChecked())
2007 {
2008 if (bLastWidthModified)
2009 SizeHdl_Impl(&aSymbolWidthMF);
2010 else
2011 SizeHdl_Impl(&aSymbolHeightMF);
2012 }
2013 return 0;
2014 }
2015
2016
DataChanged(const DataChangedEvent & rDCEvt)2017 void SvxLineTabPage::DataChanged( const DataChangedEvent& rDCEvt )
2018 {
2019 SvxTabPage::DataChanged( rDCEvt );
2020
2021 if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
2022 {
2023 FillListboxes();
2024 }
2025 }
2026
PageCreated(SfxAllItemSet aSet)2027 void SvxLineTabPage::PageCreated (SfxAllItemSet aSet) //add CHINA001
2028 {
2029 SFX_ITEMSET_ARG (&aSet,pColorTabItem,SvxColorTableItem,SID_COLOR_TABLE,sal_False);
2030 SFX_ITEMSET_ARG (&aSet,pDashListItem,SvxDashListItem,SID_DASH_LIST,sal_False);
2031 SFX_ITEMSET_ARG (&aSet,pLineEndListItem,SvxLineEndListItem,SID_LINEEND_LIST,sal_False);
2032 SFX_ITEMSET_ARG (&aSet,pPageTypeItem,SfxUInt16Item,SID_PAGE_TYPE,sal_False);
2033 SFX_ITEMSET_ARG (&aSet,pDlgTypeItem,SfxUInt16Item,SID_DLG_TYPE,sal_False);
2034 SFX_ITEMSET_ARG (&aSet,pSdrObjListItem,OfaPtrItem,SID_OBJECT_LIST,sal_False);
2035 SFX_ITEMSET_ARG (&aSet,pSymbolAttrItem,SfxTabDialogItem,SID_ATTR_SET,sal_False);
2036 SFX_ITEMSET_ARG (&aSet,pGraphicItem,SvxGraphicItem,SID_GRAPHIC,sal_False);
2037
2038 if (pColorTabItem)
2039 SetColorTable(pColorTabItem->GetColorTable());
2040 if (pDashListItem)
2041 SetDashList(pDashListItem->GetDashList());
2042 if (pLineEndListItem)
2043 SetLineEndList(pLineEndListItem->GetLineEndList());
2044 if (pPageTypeItem)
2045 SetPageType(pPageTypeItem->GetValue());
2046 if (pDlgTypeItem)
2047 SetDlgType(pDlgTypeItem->GetValue());
2048 Construct();
2049
2050 if(pSdrObjListItem) //symbols
2051 {
2052 ShowSymbolControls(sal_True);
2053 pSymbolList = static_cast<SdrObjList*>(pSdrObjListItem->GetValue());
2054 if (pSymbolAttrItem)
2055 pSymbolAttr = new SfxItemSet(pSymbolAttrItem->GetItemSet());
2056 if(pGraphicItem)
2057 aAutoSymbolGraphic = pGraphicItem->GetGraphic();
2058 }
2059 }
2060