xref: /aoo41x/main/sd/source/ui/dlg/layeroptionsdlg.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sd.hxx"
30 
31 #ifdef SD_DLLIMPLEMENTATION
32 #undef SD_DLLIMPLEMENTATION
33 #endif
34 #include <svl/itemset.hxx>
35 
36 #include "strings.hrc"
37 #include "sdattr.hxx"
38 #include "sdresid.hxx"
39 #include "layeroptionsdlg.hxx"
40 #include "layeroptionsdlg.hrc"
41 
42 SdInsertLayerDlg::SdInsertLayerDlg( Window* pWindow, const SfxItemSet& rInAttrs, bool bDeletable, String aStr )
43 : ModalDialog( pWindow, SdResId( DLG_INSERT_LAYER ) )
44 , maFtName( this, SdResId( FT_NAME ) )
45 , maEdtName( this, SdResId( EDT_NAME ) )
46 , maFtTitle( this, SdResId( FT_TITLE ) )
47 , maEdtTitle( this, SdResId( EDT_TITLE ) )
48 , maFtDesc( this, SdResId( FT_DESCRIPTION ) )
49 , maEdtDesc( this, SdResId( EDT_DESCRIPTION ) )
50 , maCbxVisible( this, SdResId( CBX_VISIBLE ) )
51 , maCbxPrintable( this, SdResId( CBX_PRINTABLE ) )
52 , maCbxLocked( this, SdResId( CBX_LOCKED ) )
53 , maFixedLine( this, SdResId( FL_SEPARATOR_B ) )
54 , maBtnHelp( this, SdResId( BTN_HELP ) )
55 , maBtnOK( this, SdResId( BTN_OK ) )
56 , maBtnCancel( this, SdResId( BTN_CANCEL ) )
57 , mrOutAttrs( rInAttrs )
58 {
59 	FreeResource();
60 
61 	SetText( aStr );
62 
63 	maEdtName.SetText( ( ( const SdAttrLayerName& ) mrOutAttrs.Get( ATTR_LAYER_NAME ) ).GetValue() );
64 	maEdtTitle.SetText( ( ( const SdAttrLayerTitle& ) mrOutAttrs.Get( ATTR_LAYER_TITLE ) ).GetValue() );
65 	maEdtDesc.SetText( ( ( const SdAttrLayerDesc& ) mrOutAttrs.Get( ATTR_LAYER_DESC ) ).GetValue() );
66 	maCbxVisible.Check( ( ( const SdAttrLayerVisible& ) mrOutAttrs.Get( ATTR_LAYER_VISIBLE ) ).GetValue() );
67 	maCbxPrintable.Check( ( ( const SdAttrLayerPrintable& ) mrOutAttrs.Get( ATTR_LAYER_PRINTABLE ) ).GetValue() );
68 	maCbxLocked.Check( ( ( const SdAttrLayerLocked& ) mrOutAttrs.Get( ATTR_LAYER_LOCKED ) ).GetValue() );
69 
70 	if( !bDeletable )
71 	{
72 		maFtName.Disable();
73 		maEdtName.Disable();
74 	}
75 }
76 
77 void SdInsertLayerDlg::GetAttr( SfxItemSet& rAttrs )
78 {
79 	rAttrs.Put( SdAttrLayerName( maEdtName.GetText() ) );
80 	rAttrs.Put( SdAttrLayerTitle( maEdtTitle.GetText() ) );
81 	rAttrs.Put( SdAttrLayerDesc( maEdtDesc.GetText() ) );
82 	rAttrs.Put( SdAttrLayerVisible( maCbxVisible.IsChecked() ) );
83 	rAttrs.Put( SdAttrLayerPrintable( maCbxPrintable.IsChecked() ) );
84 	rAttrs.Put( SdAttrLayerLocked( maCbxLocked.IsChecked() ) );
85 }
86