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_filter.hxx"
26 
27 #include "impswfdialog.hxx"
28 #include "impswfdialog.hrc"
29 
30 using namespace rtl;
31 using namespace com::sun::star::uno;
32 using namespace com::sun::star::beans;
33 
34 // ----------------
35 // - ImpPDFDialog -
36 // ----------------
37 
ImpSWFDialog(Window * pParent,ResMgr & rResMgr,Sequence<PropertyValue> & rFilterData)38 ImpSWFDialog::ImpSWFDialog( Window* pParent, ResMgr& rResMgr, Sequence< PropertyValue >& rFilterData ) :
39     ModalDialog( pParent, ResId( DLG_OPTIONS, rResMgr ) ),
40 	maFiDescr( this, ResId( FI_DESCR, rResMgr ) ),
41 	maNumFldQuality( this, ResId( NUM_FLD_QUALITY, rResMgr ) ),
42 	maFiExportAllDescr( this, ResId( FI_EXPORT_ALL_DESCR, rResMgr ) ),
43 	maCheckExportAll( this, ResId( BOOL_EXPORT_ALL, rResMgr ) ),
44 	maFiExportBackgroundsDescr( this, ResId( FI_EXPORT_BACKGROUNDS_DESCR, rResMgr ) ),
45 	maCheckExportBackgrounds( this, ResId( BOOL_EXPORT_BACKGROUNDS, rResMgr ) ),
46 	maFiExportBackgroundObjectsDescr( this, ResId( FI_EXPORT_BACKGROUND_OBJECTS_DESCR, rResMgr ) ),
47 	maCheckExportBackgroundObjects( this, ResId( BOOL_EXPORT_BACKGROUND_OBJECTS, rResMgr ) ),
48 	maFiExportSlideContentsDescr( this, ResId( FI_EXPORT_SLIDE_CONTENTS_DESCR, rResMgr ) ),
49 	maCheckExportSlideContents( this, ResId( BOOL_EXPORT_SLIDE_CONTENTS, rResMgr ) ),
50 	maFiExportSoundDescr( this, ResId( FI_EXPORT_SOUND_DESCR, rResMgr ) ),
51 	maCheckExportSound( this, ResId( BOOL_EXPORT_SOUND, rResMgr ) ),
52 	maFiExportOLEAsJPEGDescr( this, ResId( FI_EXPORT_OLE_AS_JPEG_DESCR, rResMgr ) ),
53 	maCheckExportOLEAsJPEG( this, ResId( BOOL_EXPORT_OLE_AS_JPEG, rResMgr ) ),
54 	maFiExportMultipleFilesDescr( this, ResId( FI_EXPORT_MULTIPLE_FILES_DESCR, rResMgr ) ),
55 	maCheckExportMultipleFiles( this, ResId( BOOL_EXPORT_MULTIPLE_FILES, rResMgr ) ),
56 
57 	maBtnOK( this, ResId( BTN_OK, rResMgr ) ),
58 	maBtnCancel( this, ResId( BTN_CANCEL, rResMgr ) ),
59 	maBtnHelp( this, ResId( BTN_HELP, rResMgr ) ),
60     maConfigItem( String( RTL_CONSTASCII_USTRINGPARAM( "Office.Common/Filter/Flash/Export/" ) ), &rFilterData )
61 {
62     const sal_uLong nCompressMode = maConfigItem.ReadInt32( String( RTL_CONSTASCII_USTRINGPARAM( "CompressMode" ) ), 75 );
63 	maNumFldQuality.SetValue( nCompressMode );
64 
65 	maCheckExportAll.Check();
66 	maCheckExportSlideContents.Check();
67 	maCheckExportSound.Check();
68 
69 	maCheckExportAll.SetToggleHdl( LINK( this, ImpSWFDialog, OnToggleCheckbox ) );
70 
71 	maCheckExportBackgrounds.Disable(); maFiExportBackgroundsDescr.Disable();
72 	maCheckExportBackgroundObjects.Disable(); maFiExportBackgroundObjectsDescr.Disable();
73 	maCheckExportSlideContents.Disable(); maFiExportSlideContentsDescr.Disable();
74 
75 #ifdef AUGUSTUS
76 	maCheckExportMultipleFiles.Check();
77 #endif
78 
79     FreeResource();
80 }
81 
82 // -----------------------------------------------------------------------------
83 
~ImpSWFDialog()84 ImpSWFDialog::~ImpSWFDialog()
85 {
86 }
87 
88 // -----------------------------------------------------------------------------
89 
GetFilterData()90 Sequence< PropertyValue > ImpSWFDialog::GetFilterData()
91 {
92     sal_Int32 nCompressMode = (sal_Int32)maNumFldQuality.GetValue();
93     maConfigItem.WriteInt32( OUString( RTL_CONSTASCII_USTRINGPARAM( "CompressMode" ) ), nCompressMode );
94 	maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportAll" ) ), maCheckExportAll.IsChecked() );
95 	maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBackgrounds" ) ), maCheckExportBackgrounds.IsChecked() );
96 	maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportBackgroundObjects" ) ), maCheckExportBackgroundObjects.IsChecked() );
97 	maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportSlideContents" ) ), maCheckExportSlideContents.IsChecked() );
98 	maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportSound" ) ), maCheckExportSound.IsChecked() );
99 	maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportOLEAsJPEG" ) ), maCheckExportOLEAsJPEG.IsChecked() );
100 	maConfigItem.WriteBool( OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportMultipleFiles" ) ), maCheckExportMultipleFiles.IsChecked() );
101 
102     Sequence< PropertyValue > aRet( maConfigItem.GetFilterData() );
103 
104     return aRet;
105 }
106 
107 // AS: This is called whenever the user toggles one of the checkboxes
IMPL_LINK(ImpSWFDialog,OnToggleCheckbox,CheckBox *,pBox)108 IMPL_LINK( ImpSWFDialog, OnToggleCheckbox, CheckBox*, pBox )
109 {
110     if (pBox == &maCheckExportAll)
111 	{
112 		maCheckExportBackgrounds.Enable(!maCheckExportBackgrounds.IsEnabled());
113 		maFiExportBackgroundsDescr.Enable(!maFiExportBackgroundsDescr.IsEnabled());
114 		maCheckExportBackgroundObjects.Enable(!maCheckExportBackgroundObjects.IsEnabled());
115 		maFiExportBackgroundObjectsDescr.Enable(!maFiExportBackgroundObjectsDescr.IsEnabled());
116 		maCheckExportSlideContents.Enable(!maCheckExportSlideContents.IsEnabled());
117 		maFiExportSlideContentsDescr.Enable(!maFiExportSlideContentsDescr.IsEnabled());
118 	}
119 
120     return 0;
121 }
122