xref: /aoo41x/main/cui/source/tabpages/tplneend.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 #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() ),
101cdf0e10cSrcweir     pLineEndList( NULL )
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 {
149cdf0e10cSrcweir 	aLbLineEnds.Fill( pLineEndList );
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 !!!
180cdf0e10cSrcweir 		if( pLineEndList )
181cdf0e10cSrcweir 		{
182cdf0e10cSrcweir             if( *pPosLineEndLb != LISTBOX_ENTRY_NOTFOUND )
183cdf0e10cSrcweir 			{
184cdf0e10cSrcweir 				aLbLineEnds.SelectEntryPos( *pPosLineEndLb );
185cdf0e10cSrcweir 				SelectLineEndHdl_Impl( this );
186cdf0e10cSrcweir 			}
187cdf0e10cSrcweir 			INetURLObject	aURL( pLineEndList->GetPath() );
188cdf0e10cSrcweir 
189cdf0e10cSrcweir 			aURL.Append( pLineEndList->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();
259cdf0e10cSrcweir             XLineEndEntry* pEntry = pLineEndList->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
275cdf0e10cSrcweir 	if( pLineEndList->Count() > 0 )
276cdf0e10cSrcweir 	{
277cdf0e10cSrcweir 		int nPos = aLbLineEnds.GetSelectEntryPos();
278cdf0e10cSrcweir 
279cdf0e10cSrcweir         XLineEndEntry* pEntry = pLineEndList->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
293cdf0e10cSrcweir 	if( pLineEndList->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 {
319cdf0e10cSrcweir 	if( pLineEndList->Count() > 0 )
320cdf0e10cSrcweir 	{
321cdf0e10cSrcweir 		int nPos = aLbLineEnds.GetSelectEntryPos();
322cdf0e10cSrcweir 
323cdf0e10cSrcweir         XLineEndEntry* pEntry = pLineEndList->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() );
361cdf0e10cSrcweir 		long nCount = pLineEndList->Count();
362cdf0e10cSrcweir 		sal_Bool bDifferent = sal_True;
363cdf0e10cSrcweir 
364cdf0e10cSrcweir 		// Pruefen, ob Name schon vorhanden ist
365cdf0e10cSrcweir 		for ( long i = 0; i < nCount && bDifferent; i++ )
366cdf0e10cSrcweir             if ( aName == pLineEndList->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 				{
390cdf0e10cSrcweir                     if( aName == pLineEndList->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 
402cdf0e10cSrcweir 		// Wenn nicht vorhanden, wird Eintrag aufgenommen
403cdf0e10cSrcweir 		if( bDifferent )
404cdf0e10cSrcweir 		{
405cdf0e10cSrcweir             XLineEndEntry* pEntry = pLineEndList->GetLineEnd( nPos );
406cdf0e10cSrcweir 
407cdf0e10cSrcweir 			pEntry->SetName( aName );
408cdf0e10cSrcweir 			aEdtName.SetText( aName );
409cdf0e10cSrcweir 
410cdf0e10cSrcweir 			aLbLineEnds.Modify( pEntry, nPos, pLineEndList->GetBitmap( nPos ) );
411cdf0e10cSrcweir 			aLbLineEnds.SelectEntryPos( nPos );
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 			// Flag fuer modifiziert setzen
414cdf0e10cSrcweir 			*pnLineEndListState |= CT_MODIFIED;
415cdf0e10cSrcweir 
416cdf0e10cSrcweir 			*pPageType = 3;
417cdf0e10cSrcweir 		}
418cdf0e10cSrcweir 	}
419cdf0e10cSrcweir 	return( 0L );
420cdf0e10cSrcweir }
421cdf0e10cSrcweir 
422cdf0e10cSrcweir //------------------------------------------------------------------------
423cdf0e10cSrcweir 
424cdf0e10cSrcweir IMPL_LINK( SvxLineEndDefTabPage, ClickAddHdl_Impl, void *, EMPTYARG )
425cdf0e10cSrcweir {
426cdf0e10cSrcweir 	if( pPolyObj )
427cdf0e10cSrcweir 	{
428cdf0e10cSrcweir 		const SdrObject* pNewObj;
429cdf0e10cSrcweir 		SdrObject* pConvPolyObj = NULL;
430cdf0e10cSrcweir 
431cdf0e10cSrcweir 		if( pPolyObj->ISA( SdrPathObj ) )
432cdf0e10cSrcweir 		{
433cdf0e10cSrcweir 			pNewObj = pPolyObj;
434cdf0e10cSrcweir 		}
435cdf0e10cSrcweir 		else
436cdf0e10cSrcweir 		{
437cdf0e10cSrcweir 			SdrObjTransformInfoRec aInfoRec;
438cdf0e10cSrcweir 			pPolyObj->TakeObjInfo( aInfoRec );
439cdf0e10cSrcweir 
440cdf0e10cSrcweir 			if( aInfoRec.bCanConvToPath )
441cdf0e10cSrcweir 			{
442cdf0e10cSrcweir 				pNewObj = pConvPolyObj = pPolyObj->ConvertToPolyObj( sal_True, sal_False );
443cdf0e10cSrcweir 
444cdf0e10cSrcweir 				if( !pNewObj || !pNewObj->ISA( SdrPathObj ) )
445cdf0e10cSrcweir 					return( 0L ); // Abbruch, zusaetzliche Sicherheit, die bei
446cdf0e10cSrcweir 							// Gruppenobjekten aber nichts bringt.
447cdf0e10cSrcweir 			}
448cdf0e10cSrcweir 			else return( 0L ); // Abbruch
449cdf0e10cSrcweir 		}
450cdf0e10cSrcweir 
451cdf0e10cSrcweir 		basegfx::B2DPolyPolygon aNewPolyPolygon(((SdrPathObj*)pNewObj)->GetPathPoly());
452cdf0e10cSrcweir 		basegfx::B2DRange aNewRange(basegfx::tools::getRange(aNewPolyPolygon));
453cdf0e10cSrcweir 
454cdf0e10cSrcweir 		// Normalisieren
455cdf0e10cSrcweir         aNewPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(
456cdf0e10cSrcweir             -aNewRange.getMinX(), -aNewRange.getMinY()));
457cdf0e10cSrcweir 
458cdf0e10cSrcweir 		// Loeschen des angelegten PolyObjektes
459cdf0e10cSrcweir         SdrObject::Free( pConvPolyObj );
460cdf0e10cSrcweir 
461cdf0e10cSrcweir 		XLineEndEntry* pEntry;
462cdf0e10cSrcweir 
463cdf0e10cSrcweir 		ResMgr& rMgr = CUI_MGR();
464cdf0e10cSrcweir 		String aNewName( SVX_RES( RID_SVXSTR_LINEEND ) );
465cdf0e10cSrcweir 		String aDesc( ResId( RID_SVXSTR_DESC_LINEEND, rMgr ) );
466cdf0e10cSrcweir 		String aName;
467cdf0e10cSrcweir 
468cdf0e10cSrcweir 		long nCount = pLineEndList->Count();
469cdf0e10cSrcweir 		long j = 1;
470cdf0e10cSrcweir 		sal_Bool bDifferent = sal_False;
471cdf0e10cSrcweir 
472cdf0e10cSrcweir 		while ( !bDifferent )
473cdf0e10cSrcweir 		{
474cdf0e10cSrcweir 			aName = aNewName;
475cdf0e10cSrcweir 			aName += sal_Unicode(' ');
476cdf0e10cSrcweir 			aName += UniString::CreateFromInt32( j++ );
477cdf0e10cSrcweir 			bDifferent = sal_True;
478cdf0e10cSrcweir 
479cdf0e10cSrcweir 			for( long i = 0; i < nCount && bDifferent; i++ )
480cdf0e10cSrcweir                 if ( aName == pLineEndList->GetLineEnd( i )->GetName() )
481cdf0e10cSrcweir 					bDifferent = sal_False;
482cdf0e10cSrcweir 		}
483cdf0e10cSrcweir 
484cdf0e10cSrcweir 		SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create();
485cdf0e10cSrcweir 		DBG_ASSERT(pFact, "Dialogdiet fail!");//CHINA001
486cdf0e10cSrcweir 		AbstractSvxNameDialog* pDlg = pFact->CreateSvxNameDialog( DLGWIN, aName, aDesc );
487cdf0e10cSrcweir 		DBG_ASSERT(pDlg, "Dialogdiet fail!");//CHINA001
488cdf0e10cSrcweir 		sal_Bool bLoop = sal_True;
489cdf0e10cSrcweir 
490cdf0e10cSrcweir 		while ( bLoop && pDlg->Execute() == RET_OK )
491cdf0e10cSrcweir 		{
492cdf0e10cSrcweir 			pDlg->GetName( aName );
493cdf0e10cSrcweir 			bDifferent = sal_True;
494cdf0e10cSrcweir 
495cdf0e10cSrcweir 			for( long i = 0; i < nCount && bDifferent; i++ )
496cdf0e10cSrcweir 			{
497cdf0e10cSrcweir                 if( aName == pLineEndList->GetLineEnd( i )->GetName() )
498cdf0e10cSrcweir 					bDifferent = sal_False;
499cdf0e10cSrcweir 			}
500cdf0e10cSrcweir 
501cdf0e10cSrcweir 			if( bDifferent )
502cdf0e10cSrcweir 			{
503cdf0e10cSrcweir 				bLoop = sal_False;
504cdf0e10cSrcweir 				pEntry = new XLineEndEntry( aNewPolyPolygon, aName );
505cdf0e10cSrcweir 
506cdf0e10cSrcweir                 long nLineEndCount = pLineEndList->Count();
507cdf0e10cSrcweir                 pLineEndList->Insert( pEntry, nLineEndCount );
508cdf0e10cSrcweir                 Bitmap* pBitmap = pLineEndList->GetBitmap( nLineEndCount );
509cdf0e10cSrcweir 
510cdf0e10cSrcweir 				// Zur ListBox hinzufuegen
511cdf0e10cSrcweir 				aLbLineEnds.Append( pEntry, pBitmap );
512cdf0e10cSrcweir 				aLbLineEnds.SelectEntryPos( aLbLineEnds.GetEntryCount() - 1 );
513cdf0e10cSrcweir 
514cdf0e10cSrcweir 				// Flag fuer modifiziert setzen
515cdf0e10cSrcweir 				*pnLineEndListState |= CT_MODIFIED;
516cdf0e10cSrcweir 
517cdf0e10cSrcweir 				SelectLineEndHdl_Impl( this );
518cdf0e10cSrcweir 			}
519cdf0e10cSrcweir 			else
520cdf0e10cSrcweir 			{
521cdf0e10cSrcweir 				WarningBox aBox( DLGWIN, WinBits( WB_OK ),String( ResId( RID_SVXSTR_WARN_NAME_DUPLICATE, rMgr ) ) );
522cdf0e10cSrcweir 				aBox.SetHelpId( HID_WARN_NAME_DUPLICATE );
523cdf0e10cSrcweir 				aBox.Execute();
524cdf0e10cSrcweir 			}
525cdf0e10cSrcweir 		}
526cdf0e10cSrcweir 		delete pDlg;
527cdf0e10cSrcweir 	}
528cdf0e10cSrcweir 	else
529cdf0e10cSrcweir 		aBtnAdd.Disable();
530cdf0e10cSrcweir 
531cdf0e10cSrcweir 	// Status der Buttons ermitteln
532cdf0e10cSrcweir 	if ( pLineEndList->Count() )
533cdf0e10cSrcweir 	{
534cdf0e10cSrcweir 		aBtnModify.Enable();
535cdf0e10cSrcweir 		aBtnDelete.Enable();
536cdf0e10cSrcweir 		aBtnSave.Enable();
537cdf0e10cSrcweir 	}
538cdf0e10cSrcweir 	return( 0L );
539cdf0e10cSrcweir }
540cdf0e10cSrcweir 
541cdf0e10cSrcweir //------------------------------------------------------------------------
542cdf0e10cSrcweir 
543cdf0e10cSrcweir IMPL_LINK( SvxLineEndDefTabPage, ClickDeleteHdl_Impl, void *, EMPTYARG )
544cdf0e10cSrcweir {
545cdf0e10cSrcweir 	sal_uInt16 nPos = aLbLineEnds.GetSelectEntryPos();
546cdf0e10cSrcweir 
547cdf0e10cSrcweir 	if( nPos != LISTBOX_ENTRY_NOTFOUND )
548cdf0e10cSrcweir 	{
549cdf0e10cSrcweir 		QueryBox aQueryBox( DLGWIN, WinBits( WB_YES_NO | WB_DEF_NO ),
550cdf0e10cSrcweir 			String( CUI_RES( RID_SVXSTR_ASK_DEL_LINEEND ) ) );
551cdf0e10cSrcweir 
552cdf0e10cSrcweir 		if ( aQueryBox.Execute() == RET_YES )
553cdf0e10cSrcweir 		{
554cdf0e10cSrcweir 			delete pLineEndList->Remove( nPos );
555cdf0e10cSrcweir 			aLbLineEnds.RemoveEntry( nPos );
556cdf0e10cSrcweir 			aLbLineEnds.SelectEntryPos( 0 );
557cdf0e10cSrcweir 
558cdf0e10cSrcweir 			SelectLineEndHdl_Impl( this );
559cdf0e10cSrcweir 			*pPageType = 0; // LineEnd soll nicht uebernommen werden
560cdf0e10cSrcweir 
561cdf0e10cSrcweir 			// Flag fuer modifiziert setzen
562cdf0e10cSrcweir 			*pnLineEndListState |= CT_MODIFIED;
563cdf0e10cSrcweir 
564cdf0e10cSrcweir 			ChangePreviewHdl_Impl( this );
565cdf0e10cSrcweir 		}
566cdf0e10cSrcweir 	}
567cdf0e10cSrcweir 	// Status der Buttons ermitteln
568cdf0e10cSrcweir 	if( !pLineEndList->Count() )
569cdf0e10cSrcweir 	{
570cdf0e10cSrcweir 		aBtnModify.Disable();
571cdf0e10cSrcweir 		aBtnDelete.Disable();
572cdf0e10cSrcweir 		aBtnSave.Disable();
573cdf0e10cSrcweir 	}
574cdf0e10cSrcweir 	return( 0L );
575cdf0e10cSrcweir }
576cdf0e10cSrcweir 
577cdf0e10cSrcweir //------------------------------------------------------------------------
578cdf0e10cSrcweir 
579cdf0e10cSrcweir IMPL_LINK( SvxLineEndDefTabPage, ClickLoadHdl_Impl, void *, EMPTYARG )
580cdf0e10cSrcweir {
581cdf0e10cSrcweir 	ResMgr& rMgr = CUI_MGR();
582cdf0e10cSrcweir 	sal_uInt16 nReturn = RET_YES;
583cdf0e10cSrcweir 
584cdf0e10cSrcweir 	if ( *pnLineEndListState & CT_MODIFIED )
585cdf0e10cSrcweir 	{
586cdf0e10cSrcweir 		nReturn = WarningBox( DLGWIN, WinBits( WB_YES_NO_CANCEL ),
587cdf0e10cSrcweir 			String( ResId( RID_SVXSTR_WARN_TABLE_OVERWRITE, rMgr ) ) ).Execute();
588cdf0e10cSrcweir 
589cdf0e10cSrcweir 		if ( nReturn == RET_YES )
590cdf0e10cSrcweir 			pLineEndList->Save();
591cdf0e10cSrcweir 	}
592cdf0e10cSrcweir 
593cdf0e10cSrcweir 	if ( nReturn != RET_CANCEL )
594cdf0e10cSrcweir 	{
595cdf0e10cSrcweir     	::sfx2::FileDialogHelper aDlg(
596cdf0e10cSrcweir             com::sun::star::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
597cdf0e10cSrcweir             0 );
598cdf0e10cSrcweir 		String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soe" ) );
599cdf0e10cSrcweir 		aDlg.AddFilter( aStrFilterType, aStrFilterType );
600cdf0e10cSrcweir 		INetURLObject aFile( SvtPathOptions().GetPalettePath() );
601cdf0e10cSrcweir 		aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
602cdf0e10cSrcweir 
603cdf0e10cSrcweir 		if( aDlg.Execute() == ERRCODE_NONE )
604cdf0e10cSrcweir 		{
605cdf0e10cSrcweir 			INetURLObject aURL( aDlg.GetPath() );
606cdf0e10cSrcweir 			INetURLObject aPathURL( aURL );
607cdf0e10cSrcweir 
608cdf0e10cSrcweir 			aPathURL.removeSegment();
609cdf0e10cSrcweir 			aPathURL.removeFinalSlash();
610cdf0e10cSrcweir 
611cdf0e10cSrcweir 			// Liste speichern
612cdf0e10cSrcweir 			XLineEndList* pLeList = new XLineEndList( aPathURL.GetMainURL( INetURLObject::NO_DECODE ), pXPool );
613cdf0e10cSrcweir 			pLeList->SetName( aURL.getName() );
614cdf0e10cSrcweir 			if( pLeList->Load() )
615cdf0e10cSrcweir 			{
616cdf0e10cSrcweir 				if( pLeList )
617cdf0e10cSrcweir 				{
618cdf0e10cSrcweir 					// Pruefen, ob Tabelle geloescht werden darf:
619cdf0e10cSrcweir 					if( pLineEndList != ( (SvxLineTabDialog*) DLGWIN )->GetLineEndList() )
620cdf0e10cSrcweir 						delete pLineEndList;
621cdf0e10cSrcweir 
622cdf0e10cSrcweir 					pLineEndList = pLeList;
623cdf0e10cSrcweir 					( (SvxLineTabDialog*) DLGWIN )->SetNewLineEndList( pLineEndList );
624cdf0e10cSrcweir 					aLbLineEnds.Clear();
625cdf0e10cSrcweir 					aLbLineEnds.Fill( pLineEndList );
626cdf0e10cSrcweir 					Reset( rOutAttrs );
627cdf0e10cSrcweir 
628cdf0e10cSrcweir 					pLineEndList->SetName( aURL.getName() );
629cdf0e10cSrcweir 
630cdf0e10cSrcweir /*					// Ermitteln (evtl. abschneiden) des Namens und in
631cdf0e10cSrcweir 					// der GroupBox darstellen
632cdf0e10cSrcweir 					String aString( ResId( RID_SVXSTR_TABLE, rMgr ) );
633cdf0e10cSrcweir 					aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
634cdf0e10cSrcweir 					if( aURL.getBase().Len() > 18 )
635cdf0e10cSrcweir 					{
636cdf0e10cSrcweir 						aString += aURL.getBase().Copy( 0, 15 );
637cdf0e10cSrcweir 						aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
638cdf0e10cSrcweir 					}
639cdf0e10cSrcweir 					else
640cdf0e10cSrcweir 						aString += aURL.getBase();
641cdf0e10cSrcweir 
642cdf0e10cSrcweir 					aGrpLineEnds.SetText( aString );
643cdf0e10cSrcweir */
644cdf0e10cSrcweir 					// Flag fuer gewechselt setzen
645cdf0e10cSrcweir 					*pnLineEndListState |= CT_CHANGED;
646cdf0e10cSrcweir 					// Flag fuer modifiziert entfernen
647cdf0e10cSrcweir 					*pnLineEndListState &= ~CT_MODIFIED;
648cdf0e10cSrcweir 				}
649cdf0e10cSrcweir 			}
650cdf0e10cSrcweir 			else
651cdf0e10cSrcweir 				ErrorBox( DLGWIN, WinBits( WB_OK ),
652cdf0e10cSrcweir 					String( ResId( RID_SVXSTR_READ_DATA_ERROR, rMgr ) ) ).Execute();
653cdf0e10cSrcweir 		}
654cdf0e10cSrcweir 	}
655cdf0e10cSrcweir 
656cdf0e10cSrcweir 	// Status der Buttons ermitteln
657cdf0e10cSrcweir 	if ( pLineEndList->Count() )
658cdf0e10cSrcweir 	{
659cdf0e10cSrcweir 		aBtnModify.Enable();
660cdf0e10cSrcweir 		aBtnDelete.Enable();
661cdf0e10cSrcweir 		aBtnSave.Enable();
662cdf0e10cSrcweir 	}
663cdf0e10cSrcweir 	else
664cdf0e10cSrcweir 	{
665cdf0e10cSrcweir 		aBtnModify.Disable();
666cdf0e10cSrcweir 		aBtnDelete.Disable();
667cdf0e10cSrcweir 		aBtnSave.Disable();
668cdf0e10cSrcweir 	}
669cdf0e10cSrcweir 	return( 0L );
670cdf0e10cSrcweir }
671cdf0e10cSrcweir 
672cdf0e10cSrcweir //------------------------------------------------------------------------
673cdf0e10cSrcweir 
674cdf0e10cSrcweir IMPL_LINK( SvxLineEndDefTabPage, ClickSaveHdl_Impl, void *, EMPTYARG )
675cdf0e10cSrcweir {
676cdf0e10cSrcweir    	::sfx2::FileDialogHelper aDlg(
677cdf0e10cSrcweir         com::sun::star::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE, 0 );
678cdf0e10cSrcweir 	String aStrFilterType( RTL_CONSTASCII_USTRINGPARAM( "*.soe" ) );
679cdf0e10cSrcweir 	aDlg.AddFilter( aStrFilterType, aStrFilterType );
680cdf0e10cSrcweir 
681cdf0e10cSrcweir 	INetURLObject aFile( SvtPathOptions().GetPalettePath() );
682cdf0e10cSrcweir 	DBG_ASSERT( aFile.GetProtocol() != INET_PROT_NOT_VALID, "invalid URL" );
683cdf0e10cSrcweir 
684cdf0e10cSrcweir 	if( pLineEndList->GetName().Len() )
685cdf0e10cSrcweir 	{
686cdf0e10cSrcweir 		aFile.Append( pLineEndList->GetName() );
687cdf0e10cSrcweir 
688cdf0e10cSrcweir 		if( !aFile.getExtension().getLength() )
689cdf0e10cSrcweir 			aFile.SetExtension( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "soe" ) ) );
690cdf0e10cSrcweir 	}
691cdf0e10cSrcweir 
692cdf0e10cSrcweir 	aDlg.SetDisplayDirectory( aFile.GetMainURL( INetURLObject::NO_DECODE ) );
693cdf0e10cSrcweir 	if ( aDlg.Execute() == ERRCODE_NONE )
694cdf0e10cSrcweir 	{
695cdf0e10cSrcweir 		INetURLObject	aURL( aDlg.GetPath() );
696cdf0e10cSrcweir 		INetURLObject	aPathURL( aURL );
697cdf0e10cSrcweir 
698cdf0e10cSrcweir 		aPathURL.removeSegment();
699cdf0e10cSrcweir 		aPathURL.removeFinalSlash();
700cdf0e10cSrcweir 
701cdf0e10cSrcweir 		pLineEndList->SetName( aURL.getName() );
702cdf0e10cSrcweir 		pLineEndList->SetPath( aPathURL.GetMainURL( INetURLObject::NO_DECODE ) );
703cdf0e10cSrcweir 
704cdf0e10cSrcweir 		if( pLineEndList->Save() )
705cdf0e10cSrcweir 		{
706cdf0e10cSrcweir /*			// Ermitteln (evtl. abschneiden) des Namens und in
707cdf0e10cSrcweir 			// der GroupBox darstellen
708cdf0e10cSrcweir 			String aString( CUI_RES( RID_SVXSTR_TABLE ) );
709cdf0e10cSrcweir 			aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( ": " ) );
710cdf0e10cSrcweir 
711cdf0e10cSrcweir 			if ( aURL.getBase().Len() > 18 )
712cdf0e10cSrcweir 			{
713cdf0e10cSrcweir 				aString += aURL.getBase().Copy( 0, 15 );
714cdf0e10cSrcweir 				aString.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "..." ) );
715cdf0e10cSrcweir 			}
716cdf0e10cSrcweir 			else
717cdf0e10cSrcweir 				aString += aURL.getBase();
718cdf0e10cSrcweir 			aGrpLineEnds.SetText( aString );
719cdf0e10cSrcweir */
720cdf0e10cSrcweir 			// Flag fuer gespeichert setzen
721cdf0e10cSrcweir 			*pnLineEndListState |= CT_SAVED;
722cdf0e10cSrcweir 			// Flag fuer modifiziert entfernen
723cdf0e10cSrcweir 			*pnLineEndListState &= ~CT_MODIFIED;
724cdf0e10cSrcweir 		}
725cdf0e10cSrcweir 		else
726cdf0e10cSrcweir 		{
727cdf0e10cSrcweir 			ErrorBox( DLGWIN, WinBits( WB_OK ),
728cdf0e10cSrcweir 				String( CUI_RES( RID_SVXSTR_WRITE_DATA_ERROR ) ) ).Execute();
729cdf0e10cSrcweir 		}
730cdf0e10cSrcweir 	}
731cdf0e10cSrcweir 	return( 0L );
732cdf0e10cSrcweir }
733cdf0e10cSrcweir 
734cdf0e10cSrcweir void SvxLineEndDefTabPage::DataChanged( const DataChangedEvent& rDCEvt )
735cdf0e10cSrcweir {
736cdf0e10cSrcweir 	SfxTabPage::DataChanged( rDCEvt );
737cdf0e10cSrcweir 
738cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
739cdf0e10cSrcweir 	{
740cdf0e10cSrcweir 		sal_uInt16 nOldSelect = aLbLineEnds.GetSelectEntryPos();
741cdf0e10cSrcweir 		aLbLineEnds.Clear();
742cdf0e10cSrcweir 		aLbLineEnds.Fill( pLineEndList );
743cdf0e10cSrcweir 		aLbLineEnds.SelectEntryPos( nOldSelect );
744cdf0e10cSrcweir 	}
745cdf0e10cSrcweir }
746cdf0e10cSrcweir 
747