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