1cdf0e10cSrcweir /************************************************************************* 2cdf0e10cSrcweir * 3cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4cdf0e10cSrcweir * 5cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6cdf0e10cSrcweir * 7cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8cdf0e10cSrcweir * 9cdf0e10cSrcweir * This file is part of OpenOffice.org. 10cdf0e10cSrcweir * 11cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14cdf0e10cSrcweir * 15cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20cdf0e10cSrcweir * 21cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25cdf0e10cSrcweir * 26cdf0e10cSrcweir ************************************************************************/ 27cdf0e10cSrcweir 28cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29cdf0e10cSrcweir #include "precompiled_sfx2.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir // INCLUDE --------------------------------------------------------------- 32cdf0e10cSrcweir #include <svl/style.hxx> 33cdf0e10cSrcweir #ifndef GCC 34cdf0e10cSrcweir #endif 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <sfx2/newstyle.hxx> 37cdf0e10cSrcweir #include "dialog.hrc" 38cdf0e10cSrcweir #include "newstyle.hrc" 39cdf0e10cSrcweir #include "sfx2/sfxresid.hxx" 40cdf0e10cSrcweir 41cdf0e10cSrcweir // PRIVATE METHODES ------------------------------------------------------ 42cdf0e10cSrcweir 43cdf0e10cSrcweir IMPL_LINK( SfxNewStyleDlg, OKHdl, Control *, pControl ) 44cdf0e10cSrcweir { 45cdf0e10cSrcweir (void)pControl; //unused 46cdf0e10cSrcweir const String aName( aColBox.GetText() ); 47cdf0e10cSrcweir SfxStyleSheetBase* pStyle = rPool.Find( aName, rPool.GetSearchFamily(), SFXSTYLEBIT_ALL ); 48cdf0e10cSrcweir if ( pStyle ) 49cdf0e10cSrcweir { 50cdf0e10cSrcweir if ( !pStyle->IsUserDefined() ) 51cdf0e10cSrcweir { 52cdf0e10cSrcweir InfoBox( this, SfxResId( MSG_POOL_STYLE_NAME ) ).Execute(); 53cdf0e10cSrcweir return 0; 54cdf0e10cSrcweir } 55cdf0e10cSrcweir 56cdf0e10cSrcweir if ( RET_YES == aQueryOverwriteBox.Execute() ) 57cdf0e10cSrcweir EndDialog( RET_OK ); 58cdf0e10cSrcweir } 59cdf0e10cSrcweir else 60cdf0e10cSrcweir EndDialog( RET_OK ); 61cdf0e10cSrcweir 62cdf0e10cSrcweir return 0; 63cdf0e10cSrcweir } 64cdf0e10cSrcweir 65cdf0e10cSrcweir // ----------------------------------------------------------------------- 66cdf0e10cSrcweir 67cdf0e10cSrcweir IMPL_LINK_INLINE_START( SfxNewStyleDlg, ModifyHdl, ComboBox *, pBox ) 68cdf0e10cSrcweir { 69cdf0e10cSrcweir aOKBtn.Enable( pBox->GetText().EraseAllChars().Len() > 0 ); 70cdf0e10cSrcweir return 0; 71cdf0e10cSrcweir } 72cdf0e10cSrcweir IMPL_LINK_INLINE_END( SfxNewStyleDlg, ModifyHdl, ComboBox *, pBox ) 73cdf0e10cSrcweir 74cdf0e10cSrcweir // CTOR / DTOR ----------------------------------------------------------- 75cdf0e10cSrcweir 76cdf0e10cSrcweir SfxNewStyleDlg::SfxNewStyleDlg( Window* pParent, SfxStyleSheetBasePool& rInPool ) : 77cdf0e10cSrcweir 78cdf0e10cSrcweir ModalDialog( pParent, SfxResId( DLG_NEW_STYLE_BY_EXAMPLE ) ), 79cdf0e10cSrcweir 80cdf0e10cSrcweir aColFL ( this, SfxResId( FL_COL ) ), 81cdf0e10cSrcweir aColBox ( this, SfxResId( LB_COL ) ), 82cdf0e10cSrcweir aOKBtn ( this, SfxResId( BT_OK ) ), 83cdf0e10cSrcweir aCancelBtn ( this, SfxResId( BT_CANCEL ) ), 84cdf0e10cSrcweir aQueryOverwriteBox ( this, SfxResId( MSG_OVERWRITE ) ), 85cdf0e10cSrcweir 86cdf0e10cSrcweir rPool( rInPool ) 87cdf0e10cSrcweir 88cdf0e10cSrcweir { 89cdf0e10cSrcweir FreeResource(); 90cdf0e10cSrcweir 91cdf0e10cSrcweir aOKBtn.SetClickHdl(LINK(this, SfxNewStyleDlg, OKHdl)); 92cdf0e10cSrcweir aColBox.SetModifyHdl(LINK(this, SfxNewStyleDlg, ModifyHdl)); 93cdf0e10cSrcweir aColBox.SetDoubleClickHdl(LINK(this, SfxNewStyleDlg, OKHdl)); 94*00d11a91SMathias Bauer // aColBox.SetAccessibleName(SfxResId(FL_COL)); 95cdf0e10cSrcweir 96cdf0e10cSrcweir SfxStyleSheetBase *pStyle = rPool.First(); 97cdf0e10cSrcweir while ( pStyle ) 98cdf0e10cSrcweir { 99cdf0e10cSrcweir aColBox.InsertEntry(pStyle->GetName()); 100cdf0e10cSrcweir pStyle = rPool.Next(); 101cdf0e10cSrcweir } 102cdf0e10cSrcweir } 103cdf0e10cSrcweir 104cdf0e10cSrcweir // ----------------------------------------------------------------------- 105cdf0e10cSrcweir 106cdf0e10cSrcweir __EXPORT SfxNewStyleDlg::~SfxNewStyleDlg() 107cdf0e10cSrcweir { 108cdf0e10cSrcweir } 109cdf0e10cSrcweir 110