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