1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: newstyle.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sfx2.hxx"
34 // INCLUDE ---------------------------------------------------------------
35 #include <svtools/style.hxx>
39 #include <sfx2/newstyle.hxx>
41 #include "newstyle.hrc"
42 #include "sfxresid.hxx"
44 // PRIVATE METHODES ------------------------------------------------------
46 IMPL_LINK( SfxNewStyleDlg
, OKHdl
, Control
*, pControl
)
48 (void)pControl
; //unused
49 const String
aName( aColBox
.GetText() );
50 SfxStyleSheetBase
* pStyle
= rPool
.Find( aName
, rPool
.GetSearchFamily(), SFXSTYLEBIT_ALL
);
53 if ( !pStyle
->IsUserDefined() )
55 InfoBox( this, SfxResId( MSG_POOL_STYLE_NAME
) ).Execute();
59 if ( RET_YES
== aQueryOverwriteBox
.Execute() )
68 // -----------------------------------------------------------------------
70 IMPL_LINK_INLINE_START( SfxNewStyleDlg
, ModifyHdl
, ComboBox
*, pBox
)
72 aOKBtn
.Enable( pBox
->GetText().EraseAllChars().Len() > 0 );
75 IMPL_LINK_INLINE_END( SfxNewStyleDlg
, ModifyHdl
, ComboBox
*, pBox
)
77 // CTOR / DTOR -----------------------------------------------------------
79 SfxNewStyleDlg::SfxNewStyleDlg( Window
* pParent
, SfxStyleSheetBasePool
& rInPool
) :
81 ModalDialog( pParent
, SfxResId( DLG_NEW_STYLE_BY_EXAMPLE
) ),
83 aColFL ( this, SfxResId( FL_COL
) ),
84 aColBox ( this, SfxResId( LB_COL
) ),
85 aOKBtn ( this, SfxResId( BT_OK
) ),
86 aCancelBtn ( this, SfxResId( BT_CANCEL
) ),
87 aQueryOverwriteBox ( this, SfxResId( MSG_OVERWRITE
) ),
94 aOKBtn
.SetClickHdl(LINK(this, SfxNewStyleDlg
, OKHdl
));
95 aColBox
.SetModifyHdl(LINK(this, SfxNewStyleDlg
, ModifyHdl
));
96 aColBox
.SetDoubleClickHdl(LINK(this, SfxNewStyleDlg
, OKHdl
));
98 SfxStyleSheetBase
*pStyle
= rPool
.First();
101 aColBox
.InsertEntry(pStyle
->GetName());
102 pStyle
= rPool
.Next();
106 // -----------------------------------------------------------------------
108 __EXPORT
SfxNewStyleDlg::~SfxNewStyleDlg()