xref: /aoo41x/main/cui/source/tabpages/tplneend.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_cui.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir // include ---------------------------------------------------------------
32*cdf0e10cSrcweir #include <tools/shl.hxx>
33*cdf0e10cSrcweir #include <tools/urlobj.hxx>
34*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
35*cdf0e10cSrcweir #include <unotools/pathoptions.hxx>
36*cdf0e10cSrcweir #include <sfx2/app.hxx>
37*cdf0e10cSrcweir #include <sfx2/filedlghelper.hxx>
38*cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #define _SVX_TPLNEEND_CXX
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #include <cuires.hrc>
43*cdf0e10cSrcweir #include "tabline.hrc"
44*cdf0e10cSrcweir #include "helpid.hrc"
45*cdf0e10cSrcweir #include <svx/dialmgr.hxx>
46*cdf0e10cSrcweir #include <svx/svdobj.hxx>
47*cdf0e10cSrcweir #include <svx/svdopath.hxx>
48*cdf0e10cSrcweir #include "svx/drawitem.hxx"
49*cdf0e10cSrcweir #include <svx/xpool.hxx>
50*cdf0e10cSrcweir #include <svx/xtable.hxx>
51*cdf0e10cSrcweir #include "cuitabline.hxx"
52*cdf0e10cSrcweir #include <svx/svxdlg.hxx> //CHINA001
53*cdf0e10cSrcweir #include <dialmgr.hxx>
54*cdf0e10cSrcweir #include "svx/dlgutil.hxx"
55*cdf0e10cSrcweir #include <basegfx/range/b2drange.hxx>
56*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
57*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
58*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
59*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygontools.hxx>
60*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrixtools.hxx>
61*cdf0e10cSrcweir #include <svx/dialogs.hrc>
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir #define DLGWIN this->GetParent()->GetParent()
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir #define BITMAP_WIDTH   32
66*cdf0e10cSrcweir #define BITMAP_HEIGHT  12
67*cdf0e10cSrcweir #define XOUT_WIDTH    150
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir /*************************************************************************
70*cdf0e10cSrcweir |*
71*cdf0e10cSrcweir |*	Dialog zum Definieren von Linienenden-Stilen
72*cdf0e10cSrcweir |*
73*cdf0e10cSrcweir \************************************************************************/
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir SvxLineEndDefTabPage::SvxLineEndDefTabPage
76*cdf0e10cSrcweir (
77*cdf0e10cSrcweir 	Window* pParent,
78*cdf0e10cSrcweir 	const SfxItemSet& rInAttrs
79*cdf0e10cSrcweir ) :
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir 	SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_LINEEND_DEF ), rInAttrs ),
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir     aFlTip              ( this, CUI_RES( FL_TIP ) ),
84*cdf0e10cSrcweir     aFTTitle            ( this, CUI_RES( FT_TITLE ) ),
85*cdf0e10cSrcweir     aEdtName            ( this, CUI_RES( EDT_NAME ) ),
86*cdf0e10cSrcweir     aFTLineEndStyle     ( this, CUI_RES( FT_LINE_END_STYLE ) ),
87*cdf0e10cSrcweir     aLbLineEnds         ( this, CUI_RES( LB_LINEENDS ) ),
88*cdf0e10cSrcweir     aBtnAdd             ( this, CUI_RES( BTN_ADD ) ),
89*cdf0e10cSrcweir     aBtnModify          ( this, CUI_RES( BTN_MODIFY ) ),
90*cdf0e10cSrcweir     aBtnDelete          ( this, CUI_RES( BTN_DELETE ) ),
91*cdf0e10cSrcweir     aBtnLoad            ( this, CUI_RES( BTN_LOAD ) ),
92*cdf0e10cSrcweir 	aBtnSave 		    ( this, CUI_RES( BTN_SAVE ) ),
93*cdf0e10cSrcweir     aFiTip              ( this, CUI_RES( FI_TIP ) ),
94*cdf0e10cSrcweir     aCtlPreview         ( this, CUI_RES( CTL_PREVIEW ) ),
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir     rOutAttrs           ( rInAttrs ),
97*cdf0e10cSrcweir     pPolyObj( NULL ),
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir     pXPool              ( (XOutdevItemPool*) rInAttrs.GetPool() ),
100*cdf0e10cSrcweir     aXLStyle            ( XLINE_SOLID ),
101*cdf0e10cSrcweir     aXWidth             ( XOUT_WIDTH ),
102*cdf0e10cSrcweir     aXColor             ( String(), COL_BLACK ),
103*cdf0e10cSrcweir     aXLineAttr          ( pXPool ),
104*cdf0e10cSrcweir     rXLSet              ( aXLineAttr.GetItemSet() ),
105*cdf0e10cSrcweir     pLineEndList( NULL )
106*cdf0e10cSrcweir {
107*cdf0e10cSrcweir 	aBtnLoad.SetModeImage( Image( CUI_RES( RID_SVXIMG_LOAD_H ) ), BMP_COLOR_HIGHCONTRAST );
108*cdf0e10cSrcweir 	aBtnSave.SetModeImage( Image( CUI_RES( RID_SVXIMG_SAVE_H ) ), BMP_COLOR_HIGHCONTRAST );
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir 	FreeResource();
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	// diese Page braucht ExchangeSupport
113*cdf0e10cSrcweir 	SetExchangeSupport();
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 	rXLSet.Put( aXLStyle );
116*cdf0e10cSrcweir 	rXLSet.Put( aXWidth );
117*cdf0e10cSrcweir 	rXLSet.Put( aXColor );
118*cdf0e10cSrcweir 	rXLSet.Put( XLineStartWidthItem( aCtlPreview.GetOutputSize().Height()  / 2 ) );
119*cdf0e10cSrcweir 	rXLSet.Put( XLineEndWidthItem( aCtlPreview.GetOutputSize().Height() / 2 ) );
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 	// #i34740#
122*cdf0e10cSrcweir 	aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 	aBtnAdd.SetClickHdl(
125*cdf0e10cSrcweir 		LINK( this, SvxLineEndDefTabPage, ClickAddHdl_Impl ) );
126*cdf0e10cSrcweir 	aBtnModify.SetClickHdl(
127*cdf0e10cSrcweir 		LINK( this, SvxLineEndDefTabPage, ClickModifyHdl_Impl ) );
128*cdf0e10cSrcweir 	aBtnDelete.SetClickHdl(
129*cdf0e10cSrcweir 		LINK( this, SvxLineEndDefTabPage, ClickDeleteHdl_Impl ) );
130*cdf0e10cSrcweir 	aBtnLoad.SetClickHdl(
131*cdf0e10cSrcweir 		LINK( this, SvxLineEndDefTabPage, ClickLoadHdl_Impl ) );
132*cdf0e10cSrcweir 	aBtnSave.SetClickHdl(
133*cdf0e10cSrcweir 		LINK( this, SvxLineEndDefTabPage, ClickSaveHdl_Impl ) );
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir 	aLbLineEnds.SetSelectHdl(
136*cdf0e10cSrcweir 		LINK( this, SvxLineEndDefTabPage, SelectLineEndHdl_Impl ) );
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 	aBtnAdd.SetAccessibleRelationMemberOf(&aFlTip);
139*cdf0e10cSrcweir 	aBtnModify.SetAccessibleRelationMemberOf(&aFlTip);
140*cdf0e10cSrcweir 	aBtnDelete.SetAccessibleRelationMemberOf(&aFlTip);
141*cdf0e10cSrcweir }
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir //------------------------------------------------------------------------
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir SvxLineEndDefTabPage::~SvxLineEndDefTabPage()
146*cdf0e10cSrcweir {
147*cdf0e10cSrcweir }
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir // -----------------------------------------------------------------------
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir void SvxLineEndDefTabPage::Construct()
152*cdf0e10cSrcweir {
153*cdf0e10cSrcweir 	aLbLineEnds.Fill( pLineEndList );
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 	bool bCreateArrowPossible = true;
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 	if( !pPolyObj )
158*cdf0e10cSrcweir 	{
159*cdf0e10cSrcweir 		bCreateArrowPossible = false;
160*cdf0e10cSrcweir 	}
161*cdf0e10cSrcweir 	else if( !pPolyObj->ISA( SdrPathObj ) )
162*cdf0e10cSrcweir 	{
163*cdf0e10cSrcweir 		SdrObjTransformInfoRec aInfoRec;
164*cdf0e10cSrcweir 		pPolyObj->TakeObjInfo( aInfoRec );
165*cdf0e10cSrcweir 		SdrObject* pNewObj = 0;
166*cdf0e10cSrcweir 		if( aInfoRec.bCanConvToPath )
167*cdf0e10cSrcweir 			pNewObj = pPolyObj->ConvertToPolyObj( sal_True, sal_False );
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir 		bCreateArrowPossible = pNewObj && pNewObj->ISA( SdrPathObj );
170*cdf0e10cSrcweir         SdrObject::Free( pNewObj );
171*cdf0e10cSrcweir 	}
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir 	if( !bCreateArrowPossible )
174*cdf0e10cSrcweir 		aBtnAdd.Disable();
175*cdf0e10cSrcweir }
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir // -----------------------------------------------------------------------
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir void SvxLineEndDefTabPage::ActivatePage( const SfxItemSet& )
180*cdf0e10cSrcweir {
181*cdf0e10cSrcweir 	if( *pDlgType == 0 ) // Flaechen-Dialog
182*cdf0e10cSrcweir 	{
183*cdf0e10cSrcweir 		// ActivatePage() wird aufgerufen bevor der Dialog PageCreated() erhaelt !!!
184*cdf0e10cSrcweir 		if( pLineEndList )
185*cdf0e10cSrcweir 		{
186*cdf0e10cSrcweir             if( *pPosLineEndLb != LISTBOX_ENTRY_NOTFOUND )
187*cdf0e10cSrcweir 			{
188*cdf0e10cSrcweir 				aLbLineEnds.SelectEntryPos( *pPosLineEndLb );
189*cdf0e10cSrcweir 				SelectLineEndHdl_Impl( this );
190*cdf0e10cSrcweir 			}
191*cdf0e10cSrcweir 			INetURLObject	aURL( pLineEndList->GetPath() );
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 			aURL.Append( pLineEndList->GetName() );
194*cdf0e10cSrcweir 			DBG_ASSERT( aURL.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
195*cdf0e10cSrcweir /*			// Ermitteln (evtl. abschneiden) des Namens und in
196*cdf0e10cSrcweir 			// der GroupBox darstellen
197*cdf0e10cSrcweir 			String			aString( CUI_RES( RID_SVXSTR_TABLE ) ); aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir 			if ( aURL.getBase().Len() > 18 )
200*cdf0e10cSrcweir 			{
201*cdf0e10cSrcweir 				aString += aURL.getBase().Copy( 0, 15 );
202*cdf0e10cSrcweir 				aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
203*cdf0e10cSrcweir 			}
204*cdf0e10cSrcweir 			else
205*cdf0e10cSrcweir 				aString += aURL.getBase();
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir 			aGrpLineEnds.SetText( aString );
208*cdf0e10cSrcweir */
209*cdf0e10cSrcweir 			*pPageType = 0; // 3
210*cdf0e10cSrcweir 			*pPosLineEndLb = LISTBOX_ENTRY_NOTFOUND;
211*cdf0e10cSrcweir 		}
212*cdf0e10cSrcweir 	}
213*cdf0e10cSrcweir }
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir // -----------------------------------------------------------------------
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir int SvxLineEndDefTabPage::DeactivatePage( SfxItemSet* _pSet )
218*cdf0e10cSrcweir {
219*cdf0e10cSrcweir 	CheckChanges_Impl();
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir     if( _pSet )
222*cdf0e10cSrcweir         FillItemSet( *_pSet );
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir 	return( LEAVE_PAGE );
225*cdf0e10cSrcweir }
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir // -----------------------------------------------------------------------
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir void SvxLineEndDefTabPage::CheckChanges_Impl()
230*cdf0e10cSrcweir {
231*cdf0e10cSrcweir 	sal_uInt16 nPos = aLbLineEnds.GetSelectEntryPos();
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir 	if ( nPos != LISTBOX_ENTRY_NOTFOUND )
234*cdf0e10cSrcweir 	{
235*cdf0e10cSrcweir 		String aString = aEdtName.GetText();
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir 		if( aString != aLbLineEnds.GetSelectEntry() )
238*cdf0e10cSrcweir 		{
239*cdf0e10cSrcweir 			QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
240*cdf0e10cSrcweir 				CUI_RESSTR( RID_SVXSTR_ASK_CHANGE_LINEEND ) );
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir 			if ( aQueryBox.Execute() == RET_YES )
243*cdf0e10cSrcweir 				ClickModifyHdl_Impl( this );
244*cdf0e10cSrcweir 		}
245*cdf0e10cSrcweir 	}
246*cdf0e10cSrcweir 	nPos = aLbLineEnds.GetSelectEntryPos();
247*cdf0e10cSrcweir 
248*cdf0e10cSrcweir 	if ( nPos != LISTBOX_ENTRY_NOTFOUND )
249*cdf0e10cSrcweir 		*pPosLineEndLb = nPos;
250*cdf0e10cSrcweir }
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir // -----------------------------------------------------------------------
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir sal_Bool SvxLineEndDefTabPage::FillItemSet( SfxItemSet& rSet )
255*cdf0e10cSrcweir {
256*cdf0e10cSrcweir 	if( *pDlgType == 0 ) // Linien-Dialog
257*cdf0e10cSrcweir 	{
258*cdf0e10cSrcweir 		if( *pPageType == 3 )
259*cdf0e10cSrcweir 		{
260*cdf0e10cSrcweir 			CheckChanges_Impl();
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir 			long nPos = aLbLineEnds.GetSelectEntryPos();
263*cdf0e10cSrcweir             XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
264*cdf0e10cSrcweir 
265*cdf0e10cSrcweir             rSet.Put( XLineStartItem( pEntry->GetName(), pEntry->GetLineEnd() ) );
266*cdf0e10cSrcweir             rSet.Put( XLineEndItem( pEntry->GetName(), pEntry->GetLineEnd() ) );
267*cdf0e10cSrcweir 		}
268*cdf0e10cSrcweir 	}
269*cdf0e10cSrcweir 	return( sal_True );
270*cdf0e10cSrcweir }
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir // -----------------------------------------------------------------------
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir void SvxLineEndDefTabPage::Reset( const SfxItemSet& )
275*cdf0e10cSrcweir {
276*cdf0e10cSrcweir 	aLbLineEnds.SelectEntryPos( 0 );
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir 	// Update lineend
279*cdf0e10cSrcweir 	if( pLineEndList->Count() > 0 )
280*cdf0e10cSrcweir 	{
281*cdf0e10cSrcweir 		int nPos = aLbLineEnds.GetSelectEntryPos();
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir         XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir 		aEdtName.SetText( aLbLineEnds.GetSelectEntry() );
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir 		rXLSet.Put( XLineStartItem( String(), pEntry->GetLineEnd() ) );
288*cdf0e10cSrcweir 		rXLSet.Put( XLineEndItem( String(), pEntry->GetLineEnd() ) );
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir 		// #i34740#
291*cdf0e10cSrcweir 		aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
292*cdf0e10cSrcweir 
293*cdf0e10cSrcweir 		aCtlPreview.Invalidate();
294*cdf0e10cSrcweir 	}
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir 	// Status der Buttons ermitteln
297*cdf0e10cSrcweir 	if( pLineEndList->Count() )
298*cdf0e10cSrcweir 	{
299*cdf0e10cSrcweir 		aBtnModify.Enable();
300*cdf0e10cSrcweir 		aBtnDelete.Enable();
301*cdf0e10cSrcweir 		aBtnSave.Enable();
302*cdf0e10cSrcweir 	}
303*cdf0e10cSrcweir 	else
304*cdf0e10cSrcweir 	{
305*cdf0e10cSrcweir 		aBtnModify.Disable();
306*cdf0e10cSrcweir 		aBtnDelete.Disable();
307*cdf0e10cSrcweir 		aBtnSave.Disable();
308*cdf0e10cSrcweir 	}
309*cdf0e10cSrcweir }
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir // -----------------------------------------------------------------------
312*cdf0e10cSrcweir 
313*cdf0e10cSrcweir SfxTabPage* SvxLineEndDefTabPage::Create( Window* pWindow,
314*cdf0e10cSrcweir                 const SfxItemSet& rSet )
315*cdf0e10cSrcweir {
316*cdf0e10cSrcweir     return( new SvxLineEndDefTabPage( pWindow, rSet ) );
317*cdf0e10cSrcweir }
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir //------------------------------------------------------------------------
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir IMPL_LINK( SvxLineEndDefTabPage, SelectLineEndHdl_Impl, void *, EMPTYARG )
322*cdf0e10cSrcweir {
323*cdf0e10cSrcweir 	if( pLineEndList->Count() > 0 )
324*cdf0e10cSrcweir 	{
325*cdf0e10cSrcweir 		int nPos = aLbLineEnds.GetSelectEntryPos();
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir         XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir 		aEdtName.SetText( aLbLineEnds.GetSelectEntry() );
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir 		rXLSet.Put( XLineStartItem( String(), pEntry->GetLineEnd() ) );
332*cdf0e10cSrcweir 		rXLSet.Put( XLineEndItem( String(), pEntry->GetLineEnd() ) );
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir 		// #i34740#
335*cdf0e10cSrcweir 		aCtlPreview.SetLineAttributes(aXLineAttr.GetItemSet());
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir 		aCtlPreview.Invalidate();
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir 		// Wird erst hier gesetzt, um den Style nur dann zu uebernehmen,
340*cdf0e10cSrcweir 		// wenn in der ListBox ein Eintrag ausgewaehlt wurde
341*cdf0e10cSrcweir 		*pPageType = 3;
342*cdf0e10cSrcweir 	}
343*cdf0e10cSrcweir 	return( 0L );
344*cdf0e10cSrcweir }
345*cdf0e10cSrcweir 
346*cdf0e10cSrcweir //------------------------------------------------------------------------
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir long SvxLineEndDefTabPage::ChangePreviewHdl_Impl( void* )
349*cdf0e10cSrcweir {
350*cdf0e10cSrcweir 	aCtlPreview.Invalidate();
351*cdf0e10cSrcweir 	return( 0L );
352*cdf0e10cSrcweir }
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir //------------------------------------------------------------------------
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir IMPL_LINK( SvxLineEndDefTabPage, ClickModifyHdl_Impl, void *, EMPTYARG )
357*cdf0e10cSrcweir {
358*cdf0e10cSrcweir 	sal_uInt16 nPos = aLbLineEnds.GetSelectEntryPos();
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir 	if( nPos != LISTBOX_ENTRY_NOTFOUND )
361*cdf0e10cSrcweir 	{
362*cdf0e10cSrcweir 		ResMgr& rMgr = CUI_MGR();
363*cdf0e10cSrcweir 		String aDesc( ResId( RID_SVXSTR_DESC_LINEEND, rMgr ) );
364*cdf0e10cSrcweir 		String aName( aEdtName.GetText() );
365*cdf0e10cSrcweir 		long nCount = pLineEndList->Count();
366*cdf0e10cSrcweir 		sal_Bool bDifferent = sal_True;
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir 		// Pruefen, ob Name schon vorhanden ist
369*cdf0e10cSrcweir 		for ( long i = 0; i < nCount && bDifferent; i++ )
370*cdf0e10cSrcweir             if ( aName == pLineEndList->GetLineEnd( i )->GetName() )
371*cdf0e10cSrcweir 				bDifferent = sal_False;
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir 		// Wenn ja, wird wiederholt ein neuer Name angefordert
374*cdf0e10cSrcweir 		if ( !bDifferent )
375*cdf0e10cSrcweir 		{
376*cdf0e10cSrcweir 			WarningBox aWarningBox( DLGWIN, WinBits( WB_OK ),
377*cdf0e10cSrcweir 				String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
378*cdf0e10cSrcweir 			aWarningBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
379*cdf0e10cSrcweir 			aWarningBox.Execute();
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 			SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
382*cdf0e10cSrcweir 			DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
383*cdf0e10cSrcweir 			AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc );
384*cdf0e10cSrcweir 			DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
385*cdf0e10cSrcweir 			sal_Bool bLoop = sal_True;
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir 			while( !bDifferent && bLoop && pDlg->Execute() == RET_OK )
388*cdf0e10cSrcweir 			{
389*cdf0e10cSrcweir 				pDlg->GetName( aName );
390*cdf0e10cSrcweir 				bDifferent = sal_True;
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir 				for( long i = 0; i < nCount && bDifferent; i++ )
393*cdf0e10cSrcweir 				{
394*cdf0e10cSrcweir                     if( aName == pLineEndList->GetLineEnd( i )->GetName() )
395*cdf0e10cSrcweir 						bDifferent = sal_False;
396*cdf0e10cSrcweir 				}
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir 				if( bDifferent )
399*cdf0e10cSrcweir 					bLoop = sal_False;
400*cdf0e10cSrcweir 				else
401*cdf0e10cSrcweir 					aWarningBox.Execute();
402*cdf0e10cSrcweir 			}
403*cdf0e10cSrcweir 			delete( pDlg );
404*cdf0e10cSrcweir 		}
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir 		// Wenn nicht vorhanden, wird Eintrag aufgenommen
407*cdf0e10cSrcweir 		if( bDifferent )
408*cdf0e10cSrcweir 		{
409*cdf0e10cSrcweir             XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
410*cdf0e10cSrcweir 
411*cdf0e10cSrcweir 			pEntry->SetName( aName );
412*cdf0e10cSrcweir 			aEdtName.SetText( aName );
413*cdf0e10cSrcweir 
414*cdf0e10cSrcweir 			aLbLineEnds.Modify( pEntry, nPos, pLineEndList->GetBitmap( nPos ) );
415*cdf0e10cSrcweir 			aLbLineEnds.SelectEntryPos( nPos );
416*cdf0e10cSrcweir 
417*cdf0e10cSrcweir 			// Flag fuer modifiziert setzen
418*cdf0e10cSrcweir 			*pnLineEndListState |= CT_MODIFIED;
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir 			*pPageType = 3;
421*cdf0e10cSrcweir 		}
422*cdf0e10cSrcweir 	}
423*cdf0e10cSrcweir 	return( 0L );
424*cdf0e10cSrcweir }
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir //------------------------------------------------------------------------
427*cdf0e10cSrcweir 
428*cdf0e10cSrcweir IMPL_LINK( SvxLineEndDefTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
429*cdf0e10cSrcweir {
430*cdf0e10cSrcweir 	if( pPolyObj )
431*cdf0e10cSrcweir 	{
432*cdf0e10cSrcweir 		const SdrObject* pNewObj;
433*cdf0e10cSrcweir 		SdrObject* pConvPolyObj = NULL;
434*cdf0e10cSrcweir 
435*cdf0e10cSrcweir 		if( pPolyObj->ISA( SdrPathObj ) )
436*cdf0e10cSrcweir 		{
437*cdf0e10cSrcweir 			pNewObj = pPolyObj;
438*cdf0e10cSrcweir 		}
439*cdf0e10cSrcweir 		else
440*cdf0e10cSrcweir 		{
441*cdf0e10cSrcweir 			SdrObjTransformInfoRec aInfoRec;
442*cdf0e10cSrcweir 			pPolyObj->TakeObjInfo( aInfoRec );
443*cdf0e10cSrcweir 
444*cdf0e10cSrcweir 			if( aInfoRec.bCanConvToPath )
445*cdf0e10cSrcweir 			{
446*cdf0e10cSrcweir 				pNewObj = pConvPolyObj = pPolyObj->ConvertToPolyObj( sal_True, sal_False );
447*cdf0e10cSrcweir 
448*cdf0e10cSrcweir 				if( !pNewObj || !pNewObj->ISA( SdrPathObj ) )
449*cdf0e10cSrcweir 					return( 0L ); // Abbruch, zusaetzliche Sicherheit, die bei
450*cdf0e10cSrcweir 							// Gruppenobjekten aber nichts bringt.
451*cdf0e10cSrcweir 			}
452*cdf0e10cSrcweir 			else return( 0L ); // Abbruch
453*cdf0e10cSrcweir 		}
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir 		basegfx::B2DPolyPolygon aNewPolyPolygon(((SdrPathObj*)pNewObj)->GetPathPoly());
456*cdf0e10cSrcweir 		basegfx::B2DRange aNewRange(basegfx::tools::getRange(aNewPolyPolygon));
457*cdf0e10cSrcweir 
458*cdf0e10cSrcweir 		// Normalisieren
459*cdf0e10cSrcweir         aNewPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(
460*cdf0e10cSrcweir             -aNewRange.getMinX(), -aNewRange.getMinY()));
461*cdf0e10cSrcweir 
462*cdf0e10cSrcweir 		// Loeschen des angelegten PolyObjektes
463*cdf0e10cSrcweir         SdrObject::Free( pConvPolyObj );
464*cdf0e10cSrcweir 
465*cdf0e10cSrcweir 		XLineEndEntry* pEntry;
466*cdf0e10cSrcweir 
467*cdf0e10cSrcweir 		ResMgr& rMgr = CUI_MGR();
468*cdf0e10cSrcweir 		String aNewName( SVX_RES( RID_SVXSTR_LINEEND ) );
469*cdf0e10cSrcweir 		String aDesc( ResId( RID_SVXSTR_DESC_LINEEND, rMgr ) );
470*cdf0e10cSrcweir 		String aName;
471*cdf0e10cSrcweir 
472*cdf0e10cSrcweir 		long nCount = pLineEndList->Count();
473*cdf0e10cSrcweir 		long j = 1;
474*cdf0e10cSrcweir 		sal_Bool bDifferent = sal_False;
475*cdf0e10cSrcweir 
476*cdf0e10cSrcweir 		while ( !bDifferent )
477*cdf0e10cSrcweir 		{
478*cdf0e10cSrcweir 			aName = aNewName;
479*cdf0e10cSrcweir 			aName += sal_Unicode(' ');
480*cdf0e10cSrcweir 			aName += UniString::CreateFromInt32( j++ );
481*cdf0e10cSrcweir 			bDifferent = sal_True;
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir 			for( long i = 0; i < nCount && bDifferent; i++ )
484*cdf0e10cSrcweir                 if ( aName == pLineEndList->GetLineEnd( i )->GetName() )
485*cdf0e10cSrcweir 					bDifferent = sal_False;
486*cdf0e10cSrcweir 		}
487*cdf0e10cSrcweir 
488*cdf0e10cSrcweir 		SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
489*cdf0e10cSrcweir 		DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
490*cdf0e10cSrcweir 		AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc );
491*cdf0e10cSrcweir 		DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
492*cdf0e10cSrcweir 		sal_Bool bLoop = sal_True;
493*cdf0e10cSrcweir 
494*cdf0e10cSrcweir 		while ( bLoop && pDlg->Execute() == RET_OK )
495*cdf0e10cSrcweir 		{
496*cdf0e10cSrcweir 			pDlg->GetName( aName );
497*cdf0e10cSrcweir 			bDifferent = sal_True;
498*cdf0e10cSrcweir 
499*cdf0e10cSrcweir 			for( long i = 0; i < nCount && bDifferent; i++ )
500*cdf0e10cSrcweir 			{
501*cdf0e10cSrcweir                 if( aName == pLineEndList->GetLineEnd( i )->GetName() )
502*cdf0e10cSrcweir 					bDifferent = sal_False;
503*cdf0e10cSrcweir 			}
504*cdf0e10cSrcweir 
505*cdf0e10cSrcweir 			if( bDifferent )
506*cdf0e10cSrcweir 			{
507*cdf0e10cSrcweir 				bLoop = sal_False;
508*cdf0e10cSrcweir 				pEntry = new XLineEndEntry( aNewPolyPolygon, aName );
509*cdf0e10cSrcweir 
510*cdf0e10cSrcweir                 long nLineEndCount = pLineEndList->Count();
511*cdf0e10cSrcweir                 pLineEndList->Insert( pEntry, nLineEndCount );
512*cdf0e10cSrcweir                 Bitmap* pBitmap = pLineEndList->GetBitmap( nLineEndCount );
513*cdf0e10cSrcweir 
514*cdf0e10cSrcweir 				// Zur ListBox hinzufuegen
515*cdf0e10cSrcweir 				aLbLineEnds.Append( pEntry, pBitmap );
516*cdf0e10cSrcweir 				aLbLineEnds.SelectEntryPos( aLbLineEnds.GetEntryCount() - 1 );
517*cdf0e10cSrcweir 
518*cdf0e10cSrcweir 				// Flag fuer modifiziert setzen
519*cdf0e10cSrcweir 				*pnLineEndListState |= CT_MODIFIED;
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir 				SelectLineEndHdl_Impl( this );
522*cdf0e10cSrcweir 			}
523*cdf0e10cSrcweir 			else
524*cdf0e10cSrcweir 			{
525*cdf0e10cSrcweir 				WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
526*cdf0e10cSrcweir 				aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
527*cdf0e10cSrcweir 				aBox.Execute();
528*cdf0e10cSrcweir 			}
529*cdf0e10cSrcweir 		}
530*cdf0e10cSrcweir 		delete pDlg;
531*cdf0e10cSrcweir 	}
532*cdf0e10cSrcweir 	else
533*cdf0e10cSrcweir 		aBtnAdd.Disable();
534*cdf0e10cSrcweir 
535*cdf0e10cSrcweir 	// Status der Buttons ermitteln
536*cdf0e10cSrcweir 	if ( pLineEndList->Count() )
537*cdf0e10cSrcweir 	{
538*cdf0e10cSrcweir 		aBtnModify.Enable();
539*cdf0e10cSrcweir 		aBtnDelete.Enable();
540*cdf0e10cSrcweir 		aBtnSave.Enable();
541*cdf0e10cSrcweir 	}
542*cdf0e10cSrcweir 	return( 0L );
543*cdf0e10cSrcweir }
544*cdf0e10cSrcweir 
545*cdf0e10cSrcweir //------------------------------------------------------------------------
546*cdf0e10cSrcweir 
547*cdf0e10cSrcweir IMPL_LINK( SvxLineEndDefTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG )
548*cdf0e10cSrcweir {
549*cdf0e10cSrcweir 	sal_uInt16 nPos = aLbLineEnds.GetSelectEntryPos();
550*cdf0e10cSrcweir 
551*cdf0e10cSrcweir 	if( nPos != LISTBOX_ENTRY_NOTFOUND )
552*cdf0e10cSrcweir 	{
553*cdf0e10cSrcweir 		QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
554*cdf0e10cSrcweir 			String( CUI_RES( RID_SVXSTR_ASK_DEL_LINEEND ) ) );
555*cdf0e10cSrcweir 
556*cdf0e10cSrcweir 		if ( aQueryBox.Execute() == RET_YES )
557*cdf0e10cSrcweir 		{
558*cdf0e10cSrcweir 			delete pLineEndList->Remove( nPos );
559*cdf0e10cSrcweir 			aLbLineEnds.RemoveEntry( nPos );
560*cdf0e10cSrcweir 			aLbLineEnds.SelectEntryPos( 0 );
561*cdf0e10cSrcweir 
562*cdf0e10cSrcweir 			SelectLineEndHdl_Impl( this );
563*cdf0e10cSrcweir 			*pPageType = 0; // LineEnd soll nicht uebernommen werden
564*cdf0e10cSrcweir 
565*cdf0e10cSrcweir 			// Flag fuer modifiziert setzen
566*cdf0e10cSrcweir 			*pnLineEndListState |= CT_MODIFIED;
567*cdf0e10cSrcweir 
568*cdf0e10cSrcweir 			ChangePreviewHdl_Impl( this );
569*cdf0e10cSrcweir 		}
570*cdf0e10cSrcweir 	}
571*cdf0e10cSrcweir 	// Status der Buttons ermitteln
572*cdf0e10cSrcweir 	if( !pLineEndList->Count() )
573*cdf0e10cSrcweir 	{
574*cdf0e10cSrcweir 		aBtnModify.Disable();
575*cdf0e10cSrcweir 		aBtnDelete.Disable();
576*cdf0e10cSrcweir 		aBtnSave.Disable();
577*cdf0e10cSrcweir 	}
578*cdf0e10cSrcweir 	return( 0L );
579*cdf0e10cSrcweir }
580*cdf0e10cSrcweir 
581*cdf0e10cSrcweir //------------------------------------------------------------------------
582*cdf0e10cSrcweir 
583*cdf0e10cSrcweir IMPL_LINK( SvxLineEndDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
584*cdf0e10cSrcweir {
585*cdf0e10cSrcweir 	ResMgr& rMgr = CUI_MGR();
586*cdf0e10cSrcweir 	sal_uInt16 nReturn = RET_YES;
587*cdf0e10cSrcweir 
588*cdf0e10cSrcweir 	if ( *pnLineEndListState & CT_MODIFIED )
589*cdf0e10cSrcweir 	{
590*cdf0e10cSrcweir 		nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ),
591*cdf0e10cSrcweir 			String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute();
592*cdf0e10cSrcweir 
593*cdf0e10cSrcweir 		if ( nReturn == RET_YES )
594*cdf0e10cSrcweir 			pLineEndList->Save();
595*cdf0e10cSrcweir 	}
596*cdf0e10cSrcweir 
597*cdf0e10cSrcweir 	if ( nReturn != RET_CANCEL )
598*cdf0e10cSrcweir 	{
599*cdf0e10cSrcweir     	::sfx2::FileDialogHelper aDlg(
600*cdf0e10cSrcweir             com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
601*cdf0e10cSrcweir             0 );
602*cdf0e10cSrcweir 		String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soe" ) );
603*cdf0e10cSrcweir 		aDlg.AddFilter( aStrFilterType, aStrFilterType );
604*cdf0e10cSrcweir 		INetURLObject aFile( SvtPathOptions().GetPalettePath() );
605*cdf0e10cSrcweir 		aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
606*cdf0e10cSrcweir 
607*cdf0e10cSrcweir 		if( aDlg.Execute() == ERRCODE_NONE )
608*cdf0e10cSrcweir 		{
609*cdf0e10cSrcweir 			INetURLObject aURL( aDlg.GetPath() );
610*cdf0e10cSrcweir 			INetURLObject aPathURL( aURL );
611*cdf0e10cSrcweir 
612*cdf0e10cSrcweir 			aPathURL.removeSegment();
613*cdf0e10cSrcweir 			aPathURL.removeFinalSlash();
614*cdf0e10cSrcweir 
615*cdf0e10cSrcweir 			// Liste speichern
616*cdf0e10cSrcweir 			XLineEndList* pLeList = new XLineEndList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool );
617*cdf0e10cSrcweir 			pLeList->SetName( aURL.getName() );
618*cdf0e10cSrcweir 			if( pLeList->Load() )
619*cdf0e10cSrcweir 			{
620*cdf0e10cSrcweir 				if( pLeList )
621*cdf0e10cSrcweir 				{
622*cdf0e10cSrcweir 					// Pruefen, ob Tabelle geloescht werden darf:
623*cdf0e10cSrcweir 					if( pLineEndList != ( (SvxLineTabDialog*) DLGWIN )->GetLineEndList() )
624*cdf0e10cSrcweir 						delete pLineEndList;
625*cdf0e10cSrcweir 
626*cdf0e10cSrcweir 					pLineEndList = pLeList;
627*cdf0e10cSrcweir 					( (SvxLineTabDialog*) DLGWIN )->SetNewLineEndList( pLineEndList );
628*cdf0e10cSrcweir 					aLbLineEnds.Clear();
629*cdf0e10cSrcweir 					aLbLineEnds.Fill( pLineEndList );
630*cdf0e10cSrcweir 					Reset( rOutAttrs );
631*cdf0e10cSrcweir 
632*cdf0e10cSrcweir 					pLineEndList->SetName( aURL.getName() );
633*cdf0e10cSrcweir 
634*cdf0e10cSrcweir /*					// Ermitteln (evtl. abschneiden) des Namens und in
635*cdf0e10cSrcweir 					// der GroupBox darstellen
636*cdf0e10cSrcweir 					String aString( ResId( RID_SVXSTR_TABLE, rMgr ) );
637*cdf0e10cSrcweir 					aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
638*cdf0e10cSrcweir 					if( aURL.getBase().Len() > 18 )
639*cdf0e10cSrcweir 					{
640*cdf0e10cSrcweir 						aString += aURL.getBase().Copy( 0, 15 );
641*cdf0e10cSrcweir 						aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
642*cdf0e10cSrcweir 					}
643*cdf0e10cSrcweir 					else
644*cdf0e10cSrcweir 						aString += aURL.getBase();
645*cdf0e10cSrcweir 
646*cdf0e10cSrcweir 					aGrpLineEnds.SetText( aString );
647*cdf0e10cSrcweir */
648*cdf0e10cSrcweir 					// Flag fuer gewechselt setzen
649*cdf0e10cSrcweir 					*pnLineEndListState |= CT_CHANGED;
650*cdf0e10cSrcweir 					// Flag fuer modifiziert entfernen
651*cdf0e10cSrcweir 					*pnLineEndListState &= ~CT_MODIFIED;
652*cdf0e10cSrcweir 				}
653*cdf0e10cSrcweir 			}
654*cdf0e10cSrcweir 			else
655*cdf0e10cSrcweir 				ErrorBox( DLGWIN, WinBits( WB_OK ),
656*cdf0e10cSrcweir 					String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute();
657*cdf0e10cSrcweir 		}
658*cdf0e10cSrcweir 	}
659*cdf0e10cSrcweir 
660*cdf0e10cSrcweir 	// Status der Buttons ermitteln
661*cdf0e10cSrcweir 	if ( pLineEndList->Count() )
662*cdf0e10cSrcweir 	{
663*cdf0e10cSrcweir 		aBtnModify.Enable();
664*cdf0e10cSrcweir 		aBtnDelete.Enable();
665*cdf0e10cSrcweir 		aBtnSave.Enable();
666*cdf0e10cSrcweir 	}
667*cdf0e10cSrcweir 	else
668*cdf0e10cSrcweir 	{
669*cdf0e10cSrcweir 		aBtnModify.Disable();
670*cdf0e10cSrcweir 		aBtnDelete.Disable();
671*cdf0e10cSrcweir 		aBtnSave.Disable();
672*cdf0e10cSrcweir 	}
673*cdf0e10cSrcweir 	return( 0L );
674*cdf0e10cSrcweir }
675*cdf0e10cSrcweir 
676*cdf0e10cSrcweir //------------------------------------------------------------------------
677*cdf0e10cSrcweir 
678*cdf0e10cSrcweir IMPL_LINK( SvxLineEndDefTabPage, ClickSaveHdl_Impl, void *, EMPTYARG )
679*cdf0e10cSrcweir {
680*cdf0e10cSrcweir    	::sfx2::FileDialogHelper aDlg(
681*cdf0e10cSrcweir         com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 );
682*cdf0e10cSrcweir 	String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soe" ) );
683*cdf0e10cSrcweir 	aDlg.AddFilter( aStrFilterType, aStrFilterType );
684*cdf0e10cSrcweir 
685*cdf0e10cSrcweir 	INetURLObject aFile( SvtPathOptions().GetPalettePath() );
686*cdf0e10cSrcweir 	DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
687*cdf0e10cSrcweir 
688*cdf0e10cSrcweir 	if( pLineEndList->GetName().Len() )
689*cdf0e10cSrcweir 	{
690*cdf0e10cSrcweir 		aFile.Append( pLineEndList->GetName() );
691*cdf0e10cSrcweir 
692*cdf0e10cSrcweir 		if( !aFile.getExtension().getLength() )
693*cdf0e10cSrcweir 			aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "soe" ) ) );
694*cdf0e10cSrcweir 	}
695*cdf0e10cSrcweir 
696*cdf0e10cSrcweir 	aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
697*cdf0e10cSrcweir 	if ( aDlg.Execute() == ERRCODE_NONE )
698*cdf0e10cSrcweir 	{
699*cdf0e10cSrcweir 		INetURLObject	aURL( aDlg.GetPath() );
700*cdf0e10cSrcweir 		INetURLObject	aPathURL( aURL );
701*cdf0e10cSrcweir 
702*cdf0e10cSrcweir 		aPathURL.removeSegment();
703*cdf0e10cSrcweir 		aPathURL.removeFinalSlash();
704*cdf0e10cSrcweir 
705*cdf0e10cSrcweir 		pLineEndList->SetName( aURL.getName() );
706*cdf0e10cSrcweir 		pLineEndList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
707*cdf0e10cSrcweir 
708*cdf0e10cSrcweir 		if( pLineEndList->Save() )
709*cdf0e10cSrcweir 		{
710*cdf0e10cSrcweir /*			// Ermitteln (evtl. abschneiden) des Namens und in
711*cdf0e10cSrcweir 			// der GroupBox darstellen
712*cdf0e10cSrcweir 			String aString( CUI_RES( RID_SVXSTR_TABLE ) );
713*cdf0e10cSrcweir 			aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
714*cdf0e10cSrcweir 
715*cdf0e10cSrcweir 			if ( aURL.getBase().Len() > 18 )
716*cdf0e10cSrcweir 			{
717*cdf0e10cSrcweir 				aString += aURL.getBase().Copy( 0, 15 );
718*cdf0e10cSrcweir 				aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
719*cdf0e10cSrcweir 			}
720*cdf0e10cSrcweir 			else
721*cdf0e10cSrcweir 				aString += aURL.getBase();
722*cdf0e10cSrcweir 			aGrpLineEnds.SetText( aString );
723*cdf0e10cSrcweir */
724*cdf0e10cSrcweir 			// Flag fuer gespeichert setzen
725*cdf0e10cSrcweir 			*pnLineEndListState |= CT_SAVED;
726*cdf0e10cSrcweir 			// Flag fuer modifiziert entfernen
727*cdf0e10cSrcweir 			*pnLineEndListState &= ~CT_MODIFIED;
728*cdf0e10cSrcweir 		}
729*cdf0e10cSrcweir 		else
730*cdf0e10cSrcweir 		{
731*cdf0e10cSrcweir 			ErrorBox( DLGWIN, WinBits( WB_OK ),
732*cdf0e10cSrcweir 				String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute();
733*cdf0e10cSrcweir 		}
734*cdf0e10cSrcweir 	}
735*cdf0e10cSrcweir 	return( 0L );
736*cdf0e10cSrcweir }
737*cdf0e10cSrcweir 
738*cdf0e10cSrcweir void SvxLineEndDefTabPage::DataChanged( const DataChangedEvent& rDCEvt )
739*cdf0e10cSrcweir {
740*cdf0e10cSrcweir 	SfxTabPage::DataChanged( rDCEvt );
741*cdf0e10cSrcweir 
742*cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
743*cdf0e10cSrcweir 	{
744*cdf0e10cSrcweir 		sal_uInt16 nOldSelect = aLbLineEnds.GetSelectEntryPos();
745*cdf0e10cSrcweir 		aLbLineEnds.Clear();
746*cdf0e10cSrcweir 		aLbLineEnds.Fill( pLineEndList );
747*cdf0e10cSrcweir 		aLbLineEnds.SelectEntryPos( nOldSelect );
748*cdf0e10cSrcweir 	}
749*cdf0e10cSrcweir }
750*cdf0e10cSrcweir 
751