xref: /trunk/main/sd/source/ui/dlg/layeroptionsdlg.cxx (revision 79aad27f)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 
27 #ifdef SD_DLLIMPLEMENTATION
28 #undef SD_DLLIMPLEMENTATION
29 #endif
30 #include <svl/itemset.hxx>
31 
32 #include "strings.hrc"
33 #include "sdattr.hxx"
34 #include "sdresid.hxx"
35 #include "layeroptionsdlg.hxx"
36 #include "layeroptionsdlg.hrc"
37 
SdInsertLayerDlg(Window * pWindow,const SfxItemSet & rInAttrs,bool bDeletable,String aStr)38 SdInsertLayerDlg::SdInsertLayerDlg( Window* pWindow, const SfxItemSet& rInAttrs, bool bDeletable, String aStr )
39 : ModalDialog( pWindow, SdResId( DLG_INSERT_LAYER ) )
40 , maFtName( this, SdResId( FT_NAME ) )
41 , maEdtName( this, SdResId( EDT_NAME ) )
42 , maFtTitle( this, SdResId( FT_TITLE ) )
43 , maEdtTitle( this, SdResId( EDT_TITLE ) )
44 , maFtDesc( this, SdResId( FT_DESCRIPTION ) )
45 , maEdtDesc( this, SdResId( EDT_DESCRIPTION ) )
46 , maCbxVisible( this, SdResId( CBX_VISIBLE ) )
47 , maCbxPrintable( this, SdResId( CBX_PRINTABLE ) )
48 , maCbxLocked( this, SdResId( CBX_LOCKED ) )
49 , maFixedLine( this, SdResId( FL_SEPARATOR_B ) )
50 , maBtnHelp( this, SdResId( BTN_HELP ) )
51 , maBtnOK( this, SdResId( BTN_OK ) )
52 , maBtnCancel( this, SdResId( BTN_CANCEL ) )
53 , mrOutAttrs( rInAttrs )
54 {
55 	FreeResource();
56 
57 	SetText( aStr );
58 
59 	maEdtName.SetText( ( ( const SdAttrLayerName& ) mrOutAttrs.Get( ATTR_LAYER_NAME ) ).GetValue() );
60 	maEdtTitle.SetText( ( ( const SdAttrLayerTitle& ) mrOutAttrs.Get( ATTR_LAYER_TITLE ) ).GetValue() );
61 	maEdtDesc.SetText( ( ( const SdAttrLayerDesc& ) mrOutAttrs.Get( ATTR_LAYER_DESC ) ).GetValue() );
62 	maCbxVisible.Check( ( ( const SdAttrLayerVisible& ) mrOutAttrs.Get( ATTR_LAYER_VISIBLE ) ).GetValue() );
63 	maCbxPrintable.Check( ( ( const SdAttrLayerPrintable& ) mrOutAttrs.Get( ATTR_LAYER_PRINTABLE ) ).GetValue() );
64 	maCbxLocked.Check( ( ( const SdAttrLayerLocked& ) mrOutAttrs.Get( ATTR_LAYER_LOCKED ) ).GetValue() );
65 
66 	if( !bDeletable )
67 	{
68 		maFtName.Disable();
69 		maEdtName.Disable();
70 	}
71 }
72 
GetAttr(SfxItemSet & rAttrs)73 void SdInsertLayerDlg::GetAttr( SfxItemSet& rAttrs )
74 {
75 	rAttrs.Put( SdAttrLayerName( maEdtName.GetText() ) );
76 	rAttrs.Put( SdAttrLayerTitle( maEdtTitle.GetText() ) );
77 	rAttrs.Put( SdAttrLayerDesc( maEdtDesc.GetText() ) );
78 	rAttrs.Put( SdAttrLayerVisible( maCbxVisible.IsChecked() ) );
79 	rAttrs.Put( SdAttrLayerPrintable( maCbxPrintable.IsChecked() ) );
80 	rAttrs.Put( SdAttrLayerLocked( maCbxLocked.IsChecked() ) );
81 }
82