12ee96f1cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
32ee96f1cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
42ee96f1cSAndrew Rist * or more contributor license agreements. See the NOTICE file
52ee96f1cSAndrew Rist * distributed with this work for additional information
62ee96f1cSAndrew Rist * regarding copyright ownership. The ASF licenses this file
72ee96f1cSAndrew Rist * to you under the Apache License, Version 2.0 (the
82ee96f1cSAndrew Rist * "License"); you may not use this file except in compliance
92ee96f1cSAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
112ee96f1cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
132ee96f1cSAndrew Rist * Unless required by applicable law or agreed to in writing,
142ee96f1cSAndrew Rist * software distributed under the License is distributed on an
152ee96f1cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
162ee96f1cSAndrew Rist * KIND, either express or implied. See the License for the
172ee96f1cSAndrew Rist * specific language governing permissions and limitations
182ee96f1cSAndrew Rist * under the License.
19cdf0e10cSrcweir *
202ee96f1cSAndrew Rist *************************************************************/
212ee96f1cSAndrew Rist
222ee96f1cSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_cui.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir // include ---------------------------------------------------------------
28cdf0e10cSrcweir #include <tools/shl.hxx>
29cdf0e10cSrcweir #include <svl/eitem.hxx>
30cdf0e10cSrcweir #include <svl/intitem.hxx>
31cdf0e10cSrcweir #define _SVX_OPTSAVE_CXX
32cdf0e10cSrcweir
33cdf0e10cSrcweir #include "optsave.hrc"
34cdf0e10cSrcweir #include <cuires.hrc>
35cdf0e10cSrcweir
36cdf0e10cSrcweir #include "optsave.hxx"
37cdf0e10cSrcweir #include <dialmgr.hxx>
38cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
39cdf0e10cSrcweir #include <comphelper/sequenceasvector.hxx>
40cdf0e10cSrcweir #include <comphelper/sequenceashashmap.hxx>
41cdf0e10cSrcweir #include <unotools/moduleoptions.hxx>
42cdf0e10cSrcweir #include <unotools/saveopt.hxx>
43cdf0e10cSrcweir #include <comphelper/sequenceasvector.hxx>
44cdf0e10cSrcweir #include <comphelper/sequenceashashmap.hxx>
45cdf0e10cSrcweir #include <com/sun/star/container/XContainerQuery.hpp>
46cdf0e10cSrcweir #include <com/sun/star/container/XEnumeration.hpp>
47cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
48cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
49cdf0e10cSrcweir #include <com/sun/star/container/XContainerQuery.hpp>
50cdf0e10cSrcweir #include <com/sun/star/container/XEnumeration.hpp>
51cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
52cdf0e10cSrcweir #include <com/sun/star/util/XFlushable.hpp>
53cdf0e10cSrcweir #include <sfx2/docfilt.hxx>
54cdf0e10cSrcweir #include <svtools/stdctrl.hxx>
55cdf0e10cSrcweir #include <vcl/fixed.hxx>
56cdf0e10cSrcweir #include <vcl/msgbox.hxx>
57cdf0e10cSrcweir #include <unotools/configitem.hxx>
58cdf0e10cSrcweir #include <unotools/optionsdlg.hxx>
59cdf0e10cSrcweir
60cdf0e10cSrcweir #include <vcl/msgbox.hxx>
61cdf0e10cSrcweir
62cdf0e10cSrcweir using namespace com::sun::star::uno;
63cdf0e10cSrcweir using namespace com::sun::star::util;
64cdf0e10cSrcweir using namespace com::sun::star::lang;
65cdf0e10cSrcweir using namespace com::sun::star::beans;
66cdf0e10cSrcweir using namespace com::sun::star::container;
67cdf0e10cSrcweir using namespace comphelper;
68cdf0e10cSrcweir using rtl::OUString;
69cdf0e10cSrcweir
70cdf0e10cSrcweir #define C2U(cChar) OUString::createFromAscii(cChar)
71cdf0e10cSrcweir #define C2S(cChar) String( RTL_CONSTASCII_STRINGPARAM(cChar) )
72cdf0e10cSrcweir #define CFG_PAGE_AND_GROUP C2S("General"), C2S("LoadSave")
73cdf0e10cSrcweir // !! you have to update these index, if you changed the list of the child windows !!
74cdf0e10cSrcweir #define WININDEX_AUTOSAVE ((sal_uInt16)6)
75cdf0e10cSrcweir #define WININDEX_SAVEURL_RELFSYS ((sal_uInt16)9)
76cdf0e10cSrcweir
77cdf0e10cSrcweir // ----------------------------------------------------------------------
78cdf0e10cSrcweir #ifdef FILTER_WARNING_ENABLED
79cdf0e10cSrcweir class SvxAlienFilterWarningConfig_Impl : public utl::ConfigItem
80cdf0e10cSrcweir {
81cdf0e10cSrcweir sal_Bool bWarning;
82cdf0e10cSrcweir com::sun::star::uno::Sequence< OUString > aPropNames;
83cdf0e10cSrcweir
84cdf0e10cSrcweir public:
85cdf0e10cSrcweir SvxAlienFilterWarningConfig_Impl();
86cdf0e10cSrcweir ~SvxAlienFilterWarningConfig_Impl();
87cdf0e10cSrcweir
88cdf0e10cSrcweir virtual void Commit();
89cdf0e10cSrcweir
ResetWarning()90cdf0e10cSrcweir void ResetWarning()
91cdf0e10cSrcweir {
92cdf0e10cSrcweir if(bWarning)
93cdf0e10cSrcweir {
94cdf0e10cSrcweir bWarning = sal_False;
95cdf0e10cSrcweir ConfigItem::SetModified();
96cdf0e10cSrcweir }
97cdf0e10cSrcweir
98cdf0e10cSrcweir }
IsWarning() const99cdf0e10cSrcweir sal_Bool IsWarning()const{return bWarning;}
100cdf0e10cSrcweir };
101cdf0e10cSrcweir // ----------------------------------------------------------------------
SvxAlienFilterWarningConfig_Impl()102cdf0e10cSrcweir SvxAlienFilterWarningConfig_Impl::SvxAlienFilterWarningConfig_Impl() :
103cdf0e10cSrcweir ConfigItem(C2U("TypeDetection.Misc/Defaults"),
104cdf0e10cSrcweir CONFIG_MODE_IMMEDIATE_UPDATE),
105cdf0e10cSrcweir aPropNames(1),
106cdf0e10cSrcweir bWarning(sal_True)
107cdf0e10cSrcweir {
108cdf0e10cSrcweir aPropNames.getArray()[0] = C2U("ShowAlienFilterWarning");
109cdf0e10cSrcweir Sequence<Any> aValues = GetProperties(aPropNames);
110cdf0e10cSrcweir const Any* pValues = aValues.getConstArray();
111cdf0e10cSrcweir DBG_ASSERT(aValues.getLength() == aPropNames.getLength(), "GetProperties failed");
112cdf0e10cSrcweir if(aValues.getLength() == aPropNames.getLength() &&
113cdf0e10cSrcweir pValues[0].hasValue() &&
114cdf0e10cSrcweir pValues[0].getValueType() == ::getBooleanCppuType())
115cdf0e10cSrcweir bWarning = *(sal_Bool*)pValues[0].getValue();
116cdf0e10cSrcweir }
117cdf0e10cSrcweir // ----------------------------------------------------------------------
~SvxAlienFilterWarningConfig_Impl()118cdf0e10cSrcweir SvxAlienFilterWarningConfig_Impl::~SvxAlienFilterWarningConfig_Impl()
119cdf0e10cSrcweir {
120cdf0e10cSrcweir if(IsModified())
121cdf0e10cSrcweir Commit();
122cdf0e10cSrcweir }
123cdf0e10cSrcweir // ----------------------------------------------------------------------
Commit()124cdf0e10cSrcweir void SvxAlienFilterWarningConfig_Impl::Commit()
125cdf0e10cSrcweir {
126cdf0e10cSrcweir Sequence<Any> aValues(aPropNames.getLength());
127cdf0e10cSrcweir Any* pValues = aValues.getArray();
128cdf0e10cSrcweir pValues[0].setValue(&bWarning, ::getBooleanCppuType());
129cdf0e10cSrcweir PutProperties(aPropNames, aValues);
130cdf0e10cSrcweir }
131cdf0e10cSrcweir #endif // FILTER_WARNING_ENABLED
132cdf0e10cSrcweir // ----------------------------------------------------------------------
133cdf0e10cSrcweir // ----------------------------------------------------------------------
134cdf0e10cSrcweir
135cdf0e10cSrcweir struct SvxSaveTabPage_Impl
136cdf0e10cSrcweir {
137cdf0e10cSrcweir Reference< XNameContainer > xFact;
138cdf0e10cSrcweir Sequence< OUString > aFilterArr[APP_COUNT];
139cdf0e10cSrcweir Sequence< sal_Bool > aAlienArr[APP_COUNT];
140cdf0e10cSrcweir Sequence< sal_Bool > aODFArr[APP_COUNT];
141cdf0e10cSrcweir Sequence< OUString > aUIFilterArr[APP_COUNT];
142cdf0e10cSrcweir OUString aDefaultArr[APP_COUNT];
143cdf0e10cSrcweir sal_Bool aDefaultReadonlyArr[APP_COUNT];
144cdf0e10cSrcweir sal_Bool bInitialized;
145cdf0e10cSrcweir
146cdf0e10cSrcweir SvxSaveTabPage_Impl();
147cdf0e10cSrcweir ~SvxSaveTabPage_Impl();
148cdf0e10cSrcweir };
149cdf0e10cSrcweir
SvxSaveTabPage_Impl()150cdf0e10cSrcweir SvxSaveTabPage_Impl::SvxSaveTabPage_Impl() : bInitialized( sal_False )
151cdf0e10cSrcweir {
152cdf0e10cSrcweir }
153cdf0e10cSrcweir
~SvxSaveTabPage_Impl()154cdf0e10cSrcweir SvxSaveTabPage_Impl::~SvxSaveTabPage_Impl()
155cdf0e10cSrcweir {
156cdf0e10cSrcweir }
157cdf0e10cSrcweir
158cdf0e10cSrcweir // class SvxSaveTabPage --------------------------------------------------
159cdf0e10cSrcweir
SfxSaveTabPage(Window * pParent,const SfxItemSet & rCoreSet)160cdf0e10cSrcweir SfxSaveTabPage::SfxSaveTabPage( Window* pParent, const SfxItemSet& rCoreSet ) :
161cdf0e10cSrcweir
162cdf0e10cSrcweir SfxTabPage( pParent, CUI_RES( RID_SFXPAGE_SAVE ), rCoreSet ),
163cdf0e10cSrcweir
164cdf0e10cSrcweir aLoadFL ( this, CUI_RES( LB_LOAD ) ),
165cdf0e10cSrcweir aLoadUserSettingsCB ( this, CUI_RES( CB_LOAD_SETTINGS ) ),
166cdf0e10cSrcweir aLoadDocPrinterCB ( this, CUI_RES( CB_LOAD_DOCPRINTER ) ),
167cdf0e10cSrcweir
168cdf0e10cSrcweir aSaveFL ( this, CUI_RES( GB_SAVE ) ),
169cdf0e10cSrcweir aDocInfoCB ( this, CUI_RES( BTN_DOCINFO ) ),
170cdf0e10cSrcweir aBackupFI ( this, CUI_RES( FI_BACKUP ) ),
171cdf0e10cSrcweir aBackupCB ( this, CUI_RES( BTN_BACKUP ) ),
172cdf0e10cSrcweir aAutoSaveCB ( this, CUI_RES( BTN_AUTOSAVE ) ),
173cdf0e10cSrcweir aAutoSaveEdit ( this, CUI_RES( ED_AUTOSAVE ) ),
174cdf0e10cSrcweir aMinuteFT ( this, CUI_RES( FT_MINUTE ) ),
175cdf0e10cSrcweir aRelativeFsysCB ( this, CUI_RES( BTN_RELATIVE_FSYS ) ),
176cdf0e10cSrcweir aRelativeInetCB ( this, CUI_RES( BTN_RELATIVE_INET ) ),
177cdf0e10cSrcweir
178cdf0e10cSrcweir aDefaultFormatFL ( this, CUI_RES( FL_FILTER ) ),
179cdf0e10cSrcweir aODFVersionFT ( this, CUI_RES( FT_ODF_VERSION ) ),
180cdf0e10cSrcweir aODFVersionLB ( this, CUI_RES( LB_ODF_VERSION ) ),
181*0be829e8SMatthias Seidel aODFEncryptionCB ( this, CUI_RES( BTN_ODFENCRYPTION ) ),
182cdf0e10cSrcweir aSizeOptimizationCB ( this, CUI_RES( BTN_NOPRETTYPRINTING ) ),
183cdf0e10cSrcweir aWarnAlienFormatCB ( this, CUI_RES( BTN_WARNALIENFORMAT ) ),
184cdf0e10cSrcweir aDocTypeFT ( this, CUI_RES( FT_APP ) ),
185cdf0e10cSrcweir aDocTypeLB ( this, CUI_RES( LB_APP ) ),
186cdf0e10cSrcweir aSaveAsFT ( this, CUI_RES( FT_FILTER ) ),
187cdf0e10cSrcweir aSaveAsFI ( this, CUI_RES( FI_FILTER ) ),
188cdf0e10cSrcweir aSaveAsLB ( this, CUI_RES( LB_FILTER ) ),
189cdf0e10cSrcweir aODFWarningFI ( this, CUI_RES( FI_ODF_WARNING ) ),
190cdf0e10cSrcweir aODFWarningFT ( this, CUI_RES( FT_WARN ) ),
191cdf0e10cSrcweir
192cdf0e10cSrcweir pImpl ( new SvxSaveTabPage_Impl )
193cdf0e10cSrcweir
194cdf0e10cSrcweir {
195cdf0e10cSrcweir sal_Bool bHighContrast = GetSettings().GetStyleSettings().GetHighContrastMode();
196cdf0e10cSrcweir aODFWarningFI.SetImage(
197cdf0e10cSrcweir Image( CUI_RES( bHighContrast ? IMG_ODF_WARNING_HC : IMG_ODF_WARNING ) ) );
198cdf0e10cSrcweir
199cdf0e10cSrcweir FreeResource();
200cdf0e10cSrcweir
201cdf0e10cSrcweir Link aLink = LINK( this, SfxSaveTabPage, AutoClickHdl_Impl );
202cdf0e10cSrcweir aAutoSaveCB.SetClickHdl( aLink );
203cdf0e10cSrcweir aAutoSaveEdit.SetMaxTextLen( 2 );
204cdf0e10cSrcweir
205cdf0e10cSrcweir SvtModuleOptions aModuleOpt;
206cdf0e10cSrcweir if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SMATH ) )
207cdf0e10cSrcweir {
208cdf0e10cSrcweir aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_MATH ));
209cdf0e10cSrcweir aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_MATH ));
210cdf0e10cSrcweir }
211cdf0e10cSrcweir else
212cdf0e10cSrcweir {
213cdf0e10cSrcweir pImpl->aDefaultArr[APP_MATH] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_MATH);
214cdf0e10cSrcweir pImpl->aDefaultReadonlyArr[APP_MATH] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_MATH);
215cdf0e10cSrcweir }
216cdf0e10cSrcweir
217cdf0e10cSrcweir if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) )
218cdf0e10cSrcweir {
219cdf0e10cSrcweir aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_DRAW ));
220cdf0e10cSrcweir aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_DRAW ));
221cdf0e10cSrcweir }
222cdf0e10cSrcweir else
223cdf0e10cSrcweir {
224cdf0e10cSrcweir pImpl->aDefaultArr[APP_DRAW] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_DRAW);
225cdf0e10cSrcweir pImpl->aDefaultReadonlyArr[APP_DRAW] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_DRAW);
226cdf0e10cSrcweir }
227cdf0e10cSrcweir
228cdf0e10cSrcweir if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
229cdf0e10cSrcweir {
230cdf0e10cSrcweir aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_IMPRESS ));
231cdf0e10cSrcweir aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_IMPRESS ));
232cdf0e10cSrcweir }
233cdf0e10cSrcweir else
234cdf0e10cSrcweir {
235cdf0e10cSrcweir pImpl->aDefaultArr[APP_IMPRESS] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_IMPRESS);
236cdf0e10cSrcweir pImpl->aDefaultReadonlyArr[APP_IMPRESS] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_IMPRESS);
237cdf0e10cSrcweir }
238cdf0e10cSrcweir
239cdf0e10cSrcweir if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) )
240cdf0e10cSrcweir {
241cdf0e10cSrcweir aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_CALC ));
242cdf0e10cSrcweir aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_CALC ));
243cdf0e10cSrcweir }
244cdf0e10cSrcweir else
245cdf0e10cSrcweir {
246cdf0e10cSrcweir pImpl->aDefaultArr[APP_CALC] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_CALC);
247cdf0e10cSrcweir pImpl->aDefaultReadonlyArr[APP_CALC] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_CALC);
248cdf0e10cSrcweir }
249cdf0e10cSrcweir
250cdf0e10cSrcweir if ( !aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) )
251cdf0e10cSrcweir {
252cdf0e10cSrcweir aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_WRITER ));
253cdf0e10cSrcweir aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_WRITER_WEB ));
254cdf0e10cSrcweir aSaveAsLB.RemoveEntry(aSaveAsLB.GetEntryPos( (void*) APP_WRITER_GLOBAL ));
255cdf0e10cSrcweir aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_WRITER ));
256cdf0e10cSrcweir aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_WRITER_WEB ));
257cdf0e10cSrcweir aDocTypeLB.RemoveEntry(aDocTypeLB.GetEntryPos( (void*) APP_WRITER_GLOBAL ));
258cdf0e10cSrcweir }
259cdf0e10cSrcweir else
260cdf0e10cSrcweir {
261cdf0e10cSrcweir pImpl->aDefaultArr[APP_WRITER] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITER);
262cdf0e10cSrcweir pImpl->aDefaultArr[APP_WRITER_WEB] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERWEB);
263cdf0e10cSrcweir pImpl->aDefaultArr[APP_WRITER_GLOBAL] = aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERGLOBAL);
264cdf0e10cSrcweir pImpl->aDefaultReadonlyArr[APP_WRITER] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_WRITER);
265cdf0e10cSrcweir pImpl->aDefaultReadonlyArr[APP_WRITER_WEB] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_WRITERWEB);
266cdf0e10cSrcweir pImpl->aDefaultReadonlyArr[APP_WRITER_GLOBAL] = aModuleOpt.IsDefaultFilterReadonly(SvtModuleOptions::E_WRITERGLOBAL);
267cdf0e10cSrcweir }
268cdf0e10cSrcweir
269cdf0e10cSrcweir aLink = LINK( this, SfxSaveTabPage, ODFVersionHdl_Impl );
270cdf0e10cSrcweir aODFVersionLB.SetSelectHdl( aLink );
271cdf0e10cSrcweir aLink = LINK( this, SfxSaveTabPage, FilterHdl_Impl );
272cdf0e10cSrcweir aDocTypeLB.SetSelectHdl( aLink );
273cdf0e10cSrcweir aSaveAsLB.SetSelectHdl( aLink );
274cdf0e10cSrcweir
275cdf0e10cSrcweir DetectHiddenControls();
276cdf0e10cSrcweir }
277cdf0e10cSrcweir
278cdf0e10cSrcweir // -----------------------------------------------------------------------
279cdf0e10cSrcweir
~SfxSaveTabPage()280cdf0e10cSrcweir SfxSaveTabPage::~SfxSaveTabPage()
281cdf0e10cSrcweir {
282cdf0e10cSrcweir delete pImpl;
283cdf0e10cSrcweir }
284cdf0e10cSrcweir
285cdf0e10cSrcweir // -----------------------------------------------------------------------
286cdf0e10cSrcweir
Create(Window * pParent,const SfxItemSet & rAttrSet)287cdf0e10cSrcweir SfxTabPage* SfxSaveTabPage::Create( Window* pParent,
288cdf0e10cSrcweir const SfxItemSet& rAttrSet )
289cdf0e10cSrcweir {
290cdf0e10cSrcweir return ( new SfxSaveTabPage( pParent, rAttrSet ) );
291cdf0e10cSrcweir }
292cdf0e10cSrcweir
293cdf0e10cSrcweir // -----------------------------------------------------------------------
AcceptFilter(sal_uInt16 nPos)294cdf0e10cSrcweir bool SfxSaveTabPage::AcceptFilter( sal_uInt16 nPos )
295cdf0e10cSrcweir {
296cdf0e10cSrcweir const OUString* pFilters = pImpl->aFilterArr[nPos].getConstArray();
297cdf0e10cSrcweir sal_Bool bAlien = sal_False, bODF = sal_False;
298cdf0e10cSrcweir OUString* pUIFilters = pImpl->aUIFilterArr[nPos].getArray();
299cdf0e10cSrcweir OUString sUIName;
300cdf0e10cSrcweir for(int nFilter = 0; nFilter < pImpl->aFilterArr[nPos].getLength(); nFilter++)
301cdf0e10cSrcweir {
302cdf0e10cSrcweir if( pImpl->aDefaultArr[nPos] == pFilters[nFilter] )
303cdf0e10cSrcweir {
304cdf0e10cSrcweir bAlien = pImpl->aAlienArr[nPos][nFilter];
305cdf0e10cSrcweir bODF = pImpl->aODFArr[nPos][nFilter];
306cdf0e10cSrcweir sUIName = pUIFilters[nFilter];;
307cdf0e10cSrcweir break;
308cdf0e10cSrcweir }
309cdf0e10cSrcweir }
310cdf0e10cSrcweir bool bSet = true;
311cdf0e10cSrcweir return bSet;
312cdf0e10cSrcweir }
313cdf0e10cSrcweir // -----------------------------------------------------------------------
DetectHiddenControls()314cdf0e10cSrcweir void SfxSaveTabPage::DetectHiddenControls()
315cdf0e10cSrcweir {
316cdf0e10cSrcweir long nDelta = 0;
317cdf0e10cSrcweir // the index of the first child window which perhaps have to move upwards
318cdf0e10cSrcweir sal_uInt16 nWinIndex = WININDEX_SAVEURL_RELFSYS;
319cdf0e10cSrcweir SvtOptionsDialogOptions aOptionsDlgOpt;
320cdf0e10cSrcweir
321cdf0e10cSrcweir if ( aOptionsDlgOpt.IsOptionHidden( C2S("Backup"), CFG_PAGE_AND_GROUP ) )
322cdf0e10cSrcweir {
323cdf0e10cSrcweir // hide controls of "Backup"
324cdf0e10cSrcweir aBackupFI.Hide();
325cdf0e10cSrcweir aBackupCB.Hide();
326cdf0e10cSrcweir // the other controls have to move upwards the height of checkbox + space
327cdf0e10cSrcweir nDelta = aAutoSaveCB.GetPosPixel().Y() - aBackupCB.GetPosPixel().Y();
328cdf0e10cSrcweir }
329cdf0e10cSrcweir
330cdf0e10cSrcweir if ( aOptionsDlgOpt.IsOptionHidden( C2S("AutoSave"), CFG_PAGE_AND_GROUP ) )
331cdf0e10cSrcweir {
332cdf0e10cSrcweir // hide controls of "AutoSave"
333cdf0e10cSrcweir aAutoSaveCB.Hide();
334cdf0e10cSrcweir aAutoSaveEdit.Hide();
335cdf0e10cSrcweir aMinuteFT.Hide();
336cdf0e10cSrcweir // the other controls have to move upwards the height of checkbox + space
337cdf0e10cSrcweir nDelta += aRelativeFsysCB.GetPosPixel().Y() - aAutoSaveCB.GetPosPixel().Y();
338cdf0e10cSrcweir }
339cdf0e10cSrcweir else if ( nDelta > 0 )
340cdf0e10cSrcweir // the "AutoSave" controls have to move upwards too
341cdf0e10cSrcweir nWinIndex = WININDEX_AUTOSAVE;
342cdf0e10cSrcweir
343cdf0e10cSrcweir if ( nDelta > 0 )
344cdf0e10cSrcweir {
345cdf0e10cSrcweir sal_uInt16 i, nChildCount = GetChildCount();
346cdf0e10cSrcweir for ( i = nWinIndex; i < nChildCount; ++i )
347cdf0e10cSrcweir {
348cdf0e10cSrcweir Window* pWin = GetChild(i);
349cdf0e10cSrcweir Point aPos = pWin->GetPosPixel();
350cdf0e10cSrcweir aPos.Y() -= nDelta;
351cdf0e10cSrcweir pWin->SetPosPixel( aPos );
352cdf0e10cSrcweir }
353cdf0e10cSrcweir }
354cdf0e10cSrcweir }
355cdf0e10cSrcweir // -----------------------------------------------------------------------
FillItemSet(SfxItemSet & rSet)356cdf0e10cSrcweir sal_Bool SfxSaveTabPage::FillItemSet( SfxItemSet& rSet )
357cdf0e10cSrcweir {
358cdf0e10cSrcweir sal_Bool bModified = sal_False;
359cdf0e10cSrcweir SvtSaveOptions aSaveOpt;
360cdf0e10cSrcweir if(aLoadUserSettingsCB.IsChecked() != aLoadUserSettingsCB.GetSavedValue())
361cdf0e10cSrcweir {
362cdf0e10cSrcweir aSaveOpt.SetLoadUserSettings(aLoadUserSettingsCB.IsChecked());
363cdf0e10cSrcweir }
364cdf0e10cSrcweir
365cdf0e10cSrcweir if ( aLoadDocPrinterCB.IsChecked() != aLoadDocPrinterCB.GetSavedValue() )
366cdf0e10cSrcweir aSaveOpt.SetLoadDocumentPrinter( aLoadDocPrinterCB.IsChecked() );
367cdf0e10cSrcweir
368cdf0e10cSrcweir if ( aODFVersionLB.GetSelectEntryPos() != aODFVersionLB.GetSavedValue() )
369cdf0e10cSrcweir {
370cdf0e10cSrcweir long nVersion = long( aODFVersionLB.GetEntryData( aODFVersionLB.GetSelectEntryPos() ) );
371cdf0e10cSrcweir aSaveOpt.SetODFDefaultVersion( SvtSaveOptions::ODFDefaultVersion( nVersion ) );
372cdf0e10cSrcweir }
373cdf0e10cSrcweir
374cdf0e10cSrcweir if ( aDocInfoCB.IsChecked() != aDocInfoCB.GetSavedValue() )
375cdf0e10cSrcweir {
376cdf0e10cSrcweir rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_DOCINFO ),
377cdf0e10cSrcweir aDocInfoCB.IsChecked() ) );
378cdf0e10cSrcweir bModified |= sal_True;
379cdf0e10cSrcweir }
380cdf0e10cSrcweir
381cdf0e10cSrcweir if ( aBackupCB.IsEnabled() && aBackupCB.IsChecked() != aBackupCB.GetSavedValue() )
382cdf0e10cSrcweir {
383cdf0e10cSrcweir rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_BACKUP ),
384cdf0e10cSrcweir aBackupCB.IsChecked() ) );
385cdf0e10cSrcweir bModified |= sal_True;
386cdf0e10cSrcweir }
387cdf0e10cSrcweir
388*0be829e8SMatthias Seidel if ( aODFEncryptionCB.IsChecked() != aODFEncryptionCB.GetSavedValue() )
389*0be829e8SMatthias Seidel {
390*0be829e8SMatthias Seidel rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_ODFENCRYPTION ), aODFEncryptionCB.IsChecked() ) );
391*0be829e8SMatthias Seidel bModified |= sal_True;
392*0be829e8SMatthias Seidel }
393*0be829e8SMatthias Seidel
394cdf0e10cSrcweir if ( aSizeOptimizationCB.IsChecked() != aSizeOptimizationCB.GetSavedValue() )
395cdf0e10cSrcweir {
396cdf0e10cSrcweir rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_PRETTYPRINTING ), !aSizeOptimizationCB.IsChecked() ) );
397cdf0e10cSrcweir bModified |= sal_True;
398cdf0e10cSrcweir }
399cdf0e10cSrcweir
400cdf0e10cSrcweir if ( aAutoSaveCB.IsChecked() != aAutoSaveCB.GetSavedValue() )
401cdf0e10cSrcweir {
402cdf0e10cSrcweir rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_AUTOSAVE ),
403cdf0e10cSrcweir aAutoSaveCB.IsChecked() ) );
404cdf0e10cSrcweir bModified |= sal_True;
405cdf0e10cSrcweir }
406cdf0e10cSrcweir if ( aWarnAlienFormatCB.IsChecked() != aWarnAlienFormatCB.GetSavedValue() )
407cdf0e10cSrcweir {
408cdf0e10cSrcweir rSet.Put( SfxBoolItem( GetWhich( SID_ATTR_WARNALIENFORMAT ),
409cdf0e10cSrcweir aWarnAlienFormatCB.IsChecked() ) );
410cdf0e10cSrcweir bModified |= sal_True;
411cdf0e10cSrcweir }
412cdf0e10cSrcweir
413cdf0e10cSrcweir if ( aAutoSaveEdit.GetText() != aAutoSaveEdit.GetSavedValue() )
414cdf0e10cSrcweir {
415cdf0e10cSrcweir rSet.Put( SfxUInt16Item( GetWhich( SID_ATTR_AUTOSAVEMINUTE ),
416cdf0e10cSrcweir (sal_uInt16)aAutoSaveEdit.GetValue() ) );
417cdf0e10cSrcweir bModified |= sal_True;
418cdf0e10cSrcweir }
419cdf0e10cSrcweir // relativ speichern
420cdf0e10cSrcweir if ( aRelativeFsysCB.IsChecked() != aRelativeFsysCB.GetSavedValue() )
421cdf0e10cSrcweir {
422cdf0e10cSrcweir rSet.Put( SfxBoolItem( GetWhich( SID_SAVEREL_FSYS ),
423cdf0e10cSrcweir aRelativeFsysCB.IsChecked() ) );
424cdf0e10cSrcweir bModified |= sal_True;
425cdf0e10cSrcweir }
426cdf0e10cSrcweir
427cdf0e10cSrcweir if ( aRelativeInetCB.IsChecked() != aRelativeInetCB.GetSavedValue() )
428cdf0e10cSrcweir {
429cdf0e10cSrcweir rSet.Put( SfxBoolItem( GetWhich( SID_SAVEREL_INET ),
430cdf0e10cSrcweir aRelativeInetCB.IsChecked() ) );
431cdf0e10cSrcweir bModified |= sal_True;
432cdf0e10cSrcweir }
433cdf0e10cSrcweir
434cdf0e10cSrcweir SvtModuleOptions aModuleOpt;
435cdf0e10cSrcweir if(pImpl->aDefaultArr[APP_MATH].getLength() &&
436cdf0e10cSrcweir pImpl->aDefaultArr[APP_MATH] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_MATH) &&
437cdf0e10cSrcweir AcceptFilter( APP_MATH ))
438cdf0e10cSrcweir aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_MATH, pImpl->aDefaultArr[APP_MATH]);
439cdf0e10cSrcweir
440cdf0e10cSrcweir if( pImpl->aDefaultArr[APP_DRAW].getLength() &&
441cdf0e10cSrcweir pImpl->aDefaultArr[APP_DRAW] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_DRAW) &&
442cdf0e10cSrcweir AcceptFilter( APP_DRAW ))
443cdf0e10cSrcweir aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_DRAW, pImpl->aDefaultArr[APP_DRAW]);
444cdf0e10cSrcweir
445cdf0e10cSrcweir if(pImpl->aDefaultArr[APP_IMPRESS].getLength() &&
446cdf0e10cSrcweir pImpl->aDefaultArr[APP_IMPRESS] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_IMPRESS)&&
447cdf0e10cSrcweir AcceptFilter( APP_IMPRESS ))
448cdf0e10cSrcweir aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_IMPRESS, pImpl->aDefaultArr[APP_IMPRESS]);
449cdf0e10cSrcweir
450cdf0e10cSrcweir if(pImpl->aDefaultArr[APP_CALC].getLength() &&
451cdf0e10cSrcweir pImpl->aDefaultArr[APP_CALC] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_CALC)&&
452cdf0e10cSrcweir AcceptFilter( APP_CALC ))
453cdf0e10cSrcweir aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_CALC, pImpl->aDefaultArr[APP_CALC]);
454cdf0e10cSrcweir
455cdf0e10cSrcweir if(pImpl->aDefaultArr[APP_WRITER].getLength() &&
456cdf0e10cSrcweir pImpl->aDefaultArr[APP_WRITER] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITER)&&
457cdf0e10cSrcweir AcceptFilter( APP_WRITER))
458cdf0e10cSrcweir aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_WRITER, pImpl->aDefaultArr[APP_WRITER]);
459cdf0e10cSrcweir
460cdf0e10cSrcweir if(pImpl->aDefaultArr[APP_WRITER_WEB].getLength() &&
461cdf0e10cSrcweir pImpl->aDefaultArr[APP_WRITER_WEB] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERWEB)&&
462cdf0e10cSrcweir AcceptFilter( APP_WRITER_WEB ))
463cdf0e10cSrcweir aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_WRITERWEB, pImpl->aDefaultArr[APP_WRITER_WEB]);
464cdf0e10cSrcweir
465cdf0e10cSrcweir if(pImpl->aDefaultArr[APP_WRITER_GLOBAL].getLength() &&
466cdf0e10cSrcweir pImpl->aDefaultArr[APP_WRITER_GLOBAL] != aModuleOpt.GetFactoryDefaultFilter(SvtModuleOptions::E_WRITERGLOBAL)&&
467cdf0e10cSrcweir AcceptFilter( APP_WRITER_GLOBAL ))
468cdf0e10cSrcweir aModuleOpt.SetFactoryDefaultFilter(SvtModuleOptions::E_WRITERGLOBAL, pImpl->aDefaultArr[APP_WRITER_GLOBAL]);
469cdf0e10cSrcweir
470cdf0e10cSrcweir return bModified;
471cdf0e10cSrcweir }
472cdf0e10cSrcweir
473cdf0e10cSrcweir // -----------------------------------------------------------------------
474cdf0e10cSrcweir
isODFFormat(OUString sFilter)475cdf0e10cSrcweir sal_Bool isODFFormat( OUString sFilter )
476cdf0e10cSrcweir {
477cdf0e10cSrcweir static const char* aODFFormats[] =
478cdf0e10cSrcweir {
479cdf0e10cSrcweir "writer8",
480cdf0e10cSrcweir "writer8_template",
481cdf0e10cSrcweir "writerglobal8",
482cdf0e10cSrcweir "writerglobal8_writer",
483cdf0e10cSrcweir "calc8",
484cdf0e10cSrcweir "calc8_template",
485cdf0e10cSrcweir "draw8",
486cdf0e10cSrcweir "draw8_template",
487cdf0e10cSrcweir "impress8",
488cdf0e10cSrcweir "impress8_template",
489cdf0e10cSrcweir "impress8_draw",
490cdf0e10cSrcweir "chart8",
491cdf0e10cSrcweir "math8",
492cdf0e10cSrcweir NULL
493cdf0e10cSrcweir };
494cdf0e10cSrcweir
495cdf0e10cSrcweir sal_Bool bRet = sal_False;
496cdf0e10cSrcweir int i = 0;
497cdf0e10cSrcweir while ( aODFFormats[i] != NULL )
498cdf0e10cSrcweir {
499cdf0e10cSrcweir if ( sFilter.equalsAscii( aODFFormats[i++] ) )
500cdf0e10cSrcweir {
501cdf0e10cSrcweir bRet = sal_True;
502cdf0e10cSrcweir break;
503cdf0e10cSrcweir }
504cdf0e10cSrcweir }
505cdf0e10cSrcweir
506cdf0e10cSrcweir return bRet;
507cdf0e10cSrcweir }
508cdf0e10cSrcweir
Reset(const SfxItemSet &)509cdf0e10cSrcweir void SfxSaveTabPage::Reset( const SfxItemSet& )
510cdf0e10cSrcweir {
511cdf0e10cSrcweir SvtSaveOptions aSaveOpt;
512cdf0e10cSrcweir aLoadUserSettingsCB.Check(aSaveOpt.IsLoadUserSettings());
513cdf0e10cSrcweir aLoadUserSettingsCB.SaveValue();
514cdf0e10cSrcweir aLoadDocPrinterCB.Check( aSaveOpt.IsLoadDocumentPrinter() );
515cdf0e10cSrcweir aLoadDocPrinterCB.SaveValue();
516cdf0e10cSrcweir
517cdf0e10cSrcweir if ( !pImpl->bInitialized )
518cdf0e10cSrcweir {
519cdf0e10cSrcweir try
520cdf0e10cSrcweir {
521cdf0e10cSrcweir Reference< XMultiServiceFactory > xMSF = comphelper::getProcessServiceFactory();
522cdf0e10cSrcweir pImpl->xFact = Reference<XNameContainer>(
523cdf0e10cSrcweir xMSF->createInstance(C2U("com.sun.star.document.FilterFactory")), UNO_QUERY);
524cdf0e10cSrcweir
525cdf0e10cSrcweir DBG_ASSERT(pImpl->xFact.is(), "service com.sun.star.document.FilterFactory unavailable");
526cdf0e10cSrcweir Reference< XContainerQuery > xQuery(pImpl->xFact, UNO_QUERY);
527cdf0e10cSrcweir if(xQuery.is())
528cdf0e10cSrcweir {
529cdf0e10cSrcweir for(sal_uInt16 n = 0; n < aDocTypeLB.GetEntryCount(); n++)
530cdf0e10cSrcweir {
531cdf0e10cSrcweir long nData = (long) aDocTypeLB.GetEntryData(n);
532cdf0e10cSrcweir OUString sCommand;
533cdf0e10cSrcweir sCommand = C2U("matchByDocumentService=%1:iflags=");
534cdf0e10cSrcweir sCommand += String::CreateFromInt32(SFX_FILTER_IMPORT|SFX_FILTER_EXPORT);
535cdf0e10cSrcweir sCommand += C2U(":eflags=");
536cdf0e10cSrcweir sCommand += String::CreateFromInt32(SFX_FILTER_NOTINFILEDLG);
537cdf0e10cSrcweir sCommand += C2U(":default_first");
538cdf0e10cSrcweir String sReplace;
539cdf0e10cSrcweir switch(nData)
540cdf0e10cSrcweir {
541cdf0e10cSrcweir case APP_WRITER : sReplace = C2U("com.sun.star.text.TextDocument"); break;
542cdf0e10cSrcweir case APP_WRITER_WEB : sReplace = C2U("com.sun.star.text.WebDocument"); break;
543cdf0e10cSrcweir case APP_WRITER_GLOBAL : sReplace = C2U("com.sun.star.text.GlobalDocument"); break;
544cdf0e10cSrcweir case APP_CALC : sReplace = C2U("com.sun.star.sheet.SpreadsheetDocument");break;
545cdf0e10cSrcweir case APP_IMPRESS : sReplace = C2U("com.sun.star.presentation.PresentationDocument");break;
546cdf0e10cSrcweir case APP_DRAW : sReplace = C2U("com.sun.star.drawing.DrawingDocument");break;
547cdf0e10cSrcweir case APP_MATH : sReplace = C2U("com.sun.star.formula.FormulaProperties");break;
548cdf0e10cSrcweir default: DBG_ERROR("illegal user data");
549cdf0e10cSrcweir }
550cdf0e10cSrcweir String sTmp(sCommand);
551cdf0e10cSrcweir sTmp.SearchAndReplaceAscii("%1", sReplace);
552cdf0e10cSrcweir sCommand = sTmp;
553cdf0e10cSrcweir Reference< XEnumeration > xList = xQuery->createSubSetEnumerationByQuery(sCommand);
554cdf0e10cSrcweir SequenceAsVector< OUString > lList;
555cdf0e10cSrcweir SequenceAsVector< sal_Bool > lAlienList;
556cdf0e10cSrcweir SequenceAsVector< sal_Bool > lODFList;
557cdf0e10cSrcweir while(xList->hasMoreElements())
558cdf0e10cSrcweir {
559cdf0e10cSrcweir SequenceAsHashMap aFilter(xList->nextElement());
560cdf0e10cSrcweir OUString sFilter = aFilter.getUnpackedValueOrDefault(OUString::createFromAscii("Name"),OUString());
561cdf0e10cSrcweir if (sFilter.getLength())
562cdf0e10cSrcweir {
563cdf0e10cSrcweir sal_Int32 nFlags = aFilter.getUnpackedValueOrDefault(OUString::createFromAscii("Flags"),sal_Int32());
564cdf0e10cSrcweir lList.push_back(sFilter);
565cdf0e10cSrcweir lAlienList.push_back(0 != (nFlags & SFX_FILTER_ALIEN));
566cdf0e10cSrcweir lODFList.push_back( isODFFormat( sFilter ) );
567cdf0e10cSrcweir }
568cdf0e10cSrcweir }
569cdf0e10cSrcweir pImpl->aFilterArr[nData] = lList.getAsConstList();
570cdf0e10cSrcweir pImpl->aAlienArr[nData] = lAlienList.getAsConstList();
571cdf0e10cSrcweir pImpl->aODFArr[nData] = lODFList.getAsConstList();
572cdf0e10cSrcweir }
573cdf0e10cSrcweir }
574cdf0e10cSrcweir aDocTypeLB.SelectEntryPos(0);
575cdf0e10cSrcweir FilterHdl_Impl(&aDocTypeLB);
576cdf0e10cSrcweir }
577cdf0e10cSrcweir catch(Exception& e)
578cdf0e10cSrcweir {
579cdf0e10cSrcweir (void) e;
580cdf0e10cSrcweir DBG_ERROR(
581cdf0e10cSrcweir rtl::OUStringToOString(
582cdf0e10cSrcweir (rtl::OUString(
583cdf0e10cSrcweir RTL_CONSTASCII_USTRINGPARAM(
584cdf0e10cSrcweir "exception in FilterFactory access: ")) +
585cdf0e10cSrcweir e.Message),
586cdf0e10cSrcweir RTL_TEXTENCODING_UTF8).
587cdf0e10cSrcweir getStr());
588cdf0e10cSrcweir }
589cdf0e10cSrcweir
590cdf0e10cSrcweir pImpl->bInitialized = sal_True;
591cdf0e10cSrcweir }
592cdf0e10cSrcweir
593cdf0e10cSrcweir aDocInfoCB.Check(aSaveOpt.IsDocInfoSave());
594cdf0e10cSrcweir // aDocInfoCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_DOCINFSAVE));
595cdf0e10cSrcweir
596cdf0e10cSrcweir aBackupCB.Check(aSaveOpt.IsBackup());
597cdf0e10cSrcweir sal_Bool bBackupRO = aSaveOpt.IsReadOnly(SvtSaveOptions::E_BACKUP);
598cdf0e10cSrcweir aBackupCB.Enable(!bBackupRO);
599cdf0e10cSrcweir aBackupFI.Show(bBackupRO);
600cdf0e10cSrcweir
601cdf0e10cSrcweir aAutoSaveCB.Check(aSaveOpt.IsAutoSave());
602cdf0e10cSrcweir aWarnAlienFormatCB.Check(aSaveOpt.IsWarnAlienFormat());
603cdf0e10cSrcweir aWarnAlienFormatCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_WARNALIENFORMAT));
604cdf0e10cSrcweir // aAutoSaveCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_AUTOSAVE));
605cdf0e10cSrcweir
606*0be829e8SMatthias Seidel // ODF encryption
607*0be829e8SMatthias Seidel aODFEncryptionCB.Check( !aSaveOpt.IsUseSHA1InODF12());
608*0be829e8SMatthias Seidel
609cdf0e10cSrcweir // the pretty printing
610cdf0e10cSrcweir aSizeOptimizationCB.Check( !aSaveOpt.IsPrettyPrinting());
611cdf0e10cSrcweir // aSizeOptimizationCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_DOPRETTYPRINTING ));
612cdf0e10cSrcweir
613cdf0e10cSrcweir
614cdf0e10cSrcweir aAutoSaveEdit.SetValue( aSaveOpt.GetAutoSaveTime() );
615cdf0e10cSrcweir // aAutoSaveEdit.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_AUTOSAVETIME));
616cdf0e10cSrcweir
617cdf0e10cSrcweir // relativ speichern
618cdf0e10cSrcweir aRelativeFsysCB.Check( aSaveOpt.IsSaveRelFSys() );
619cdf0e10cSrcweir // aRelativeFsysCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_SAVERELFSYS));
620cdf0e10cSrcweir
621cdf0e10cSrcweir aRelativeInetCB.Check( aSaveOpt.IsSaveRelINet() );
622cdf0e10cSrcweir // aRelativeInetCB.Enable(!aSaveOpt.IsReadOnly(SvtSaveOptions::E_SAVERELINET));
623cdf0e10cSrcweir
624cdf0e10cSrcweir void* pDefaultVersion = (void*)long( aSaveOpt.GetODFDefaultVersion() );
625cdf0e10cSrcweir aODFVersionLB.SelectEntryPos( aODFVersionLB.GetEntryPos( pDefaultVersion ) );
626cdf0e10cSrcweir
627cdf0e10cSrcweir AutoClickHdl_Impl( &aAutoSaveCB );
628cdf0e10cSrcweir ODFVersionHdl_Impl( &aODFVersionLB );
629cdf0e10cSrcweir
630cdf0e10cSrcweir aDocInfoCB.SaveValue();
631cdf0e10cSrcweir aBackupCB.SaveValue();
632cdf0e10cSrcweir aWarnAlienFormatCB.SaveValue();
633*0be829e8SMatthias Seidel aODFEncryptionCB.SaveValue();
634cdf0e10cSrcweir aSizeOptimizationCB.SaveValue();
635cdf0e10cSrcweir aAutoSaveCB.SaveValue();
636cdf0e10cSrcweir aAutoSaveEdit.SaveValue();
637cdf0e10cSrcweir // aAutoSavePromptBtn.SaveValue();
638cdf0e10cSrcweir
639cdf0e10cSrcweir aRelativeFsysCB.SaveValue();
640cdf0e10cSrcweir aRelativeInetCB.SaveValue();
641cdf0e10cSrcweir aODFVersionLB.SaveValue();
642cdf0e10cSrcweir }
643cdf0e10cSrcweir
644cdf0e10cSrcweir // -----------------------------------------------------------------------
645cdf0e10cSrcweir
IMPL_LINK(SfxSaveTabPage,AutoClickHdl_Impl,CheckBox *,pBox)646cdf0e10cSrcweir IMPL_LINK( SfxSaveTabPage, AutoClickHdl_Impl, CheckBox *, pBox )
647cdf0e10cSrcweir {
648cdf0e10cSrcweir if ( pBox == &aAutoSaveCB )
649cdf0e10cSrcweir {
650cdf0e10cSrcweir if ( aAutoSaveCB.IsChecked() )
651cdf0e10cSrcweir {
652cdf0e10cSrcweir aAutoSaveEdit.Enable();
653cdf0e10cSrcweir aMinuteFT.Enable();
654cdf0e10cSrcweir // aAutoSavePromptBtn.Enable();
655cdf0e10cSrcweir aAutoSaveEdit.GrabFocus();
656cdf0e10cSrcweir }
657cdf0e10cSrcweir else
658cdf0e10cSrcweir {
659cdf0e10cSrcweir aAutoSaveEdit.Disable();
660cdf0e10cSrcweir aMinuteFT.Disable();
661cdf0e10cSrcweir // aAutoSavePromptBtn.Disable();
662cdf0e10cSrcweir }
663cdf0e10cSrcweir }
664cdf0e10cSrcweir return 0;
665cdf0e10cSrcweir }
666cdf0e10cSrcweir /* -----------------------------05.04.01 13:10--------------------------------
667cdf0e10cSrcweir
668cdf0e10cSrcweir ---------------------------------------------------------------------------*/
lcl_ExtracUIName(const Sequence<PropertyValue> & rProperties)6694d2226efSAriel Constenla-Haile OUString lcl_ExtracUIName(const Sequence<PropertyValue> &rProperties)
670cdf0e10cSrcweir {
6714d2226efSAriel Constenla-Haile OUString sName;
6724d2226efSAriel Constenla-Haile const PropertyValue* pPropVal = rProperties.getConstArray();
6734d2226efSAriel Constenla-Haile const PropertyValue* const pEnd = pPropVal + rProperties.getLength();
6744d2226efSAriel Constenla-Haile for( ; pPropVal != pEnd; pPropVal++ )
675cdf0e10cSrcweir {
6764d2226efSAriel Constenla-Haile const OUString &rName = pPropVal->Name;
6774d2226efSAriel Constenla-Haile if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "UIName" ) ) )
678cdf0e10cSrcweir {
6794d2226efSAriel Constenla-Haile OUString sUIName;
6804d2226efSAriel Constenla-Haile if ( ( pPropVal->Value >>= sUIName ) && sUIName.getLength() )
6814d2226efSAriel Constenla-Haile return sUIName;
682cdf0e10cSrcweir }
6834d2226efSAriel Constenla-Haile else if( rName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Name" ) ) )
684cdf0e10cSrcweir {
6854d2226efSAriel Constenla-Haile pPropVal->Value >>= sName;
686cdf0e10cSrcweir }
687cdf0e10cSrcweir }
6884d2226efSAriel Constenla-Haile
6894d2226efSAriel Constenla-Haile OSL_ENSURE( false, "Filter without UIName!" );
6904d2226efSAriel Constenla-Haile
6914d2226efSAriel Constenla-Haile return sName;
692cdf0e10cSrcweir }
693cdf0e10cSrcweir /* -----------------------------05.04.01 13:37--------------------------------
694cdf0e10cSrcweir
695cdf0e10cSrcweir ---------------------------------------------------------------------------*/
IMPL_LINK(SfxSaveTabPage,FilterHdl_Impl,ListBox *,pBox)696cdf0e10cSrcweir IMPL_LINK( SfxSaveTabPage, FilterHdl_Impl, ListBox *, pBox )
697cdf0e10cSrcweir {
698cdf0e10cSrcweir sal_uInt16 nCurPos = aDocTypeLB.GetSelectEntryPos();
699cdf0e10cSrcweir
700cdf0e10cSrcweir long nData = -1;
701cdf0e10cSrcweir if(nCurPos < APP_COUNT)
702cdf0e10cSrcweir nData = (long) aDocTypeLB.GetEntryData(nCurPos);
703cdf0e10cSrcweir
704cdf0e10cSrcweir if ( nData >= 0 && nData < APP_COUNT )
705cdf0e10cSrcweir {
706cdf0e10cSrcweir if(&aDocTypeLB == pBox)
707cdf0e10cSrcweir {
708cdf0e10cSrcweir aSaveAsLB.Clear();
709cdf0e10cSrcweir const OUString* pFilters = pImpl->aFilterArr[nData].getConstArray();
710cdf0e10cSrcweir if(!pImpl->aUIFilterArr[nData].getLength())
711cdf0e10cSrcweir {
712cdf0e10cSrcweir pImpl->aUIFilterArr[nData].realloc(pImpl->aFilterArr[nData].getLength());
713cdf0e10cSrcweir OUString* pUIFilters = pImpl->aUIFilterArr[nData].getArray();
714cdf0e10cSrcweir for(int nFilter = 0; nFilter < pImpl->aFilterArr[nData].getLength(); nFilter++)
715cdf0e10cSrcweir {
716cdf0e10cSrcweir Any aProps = pImpl->xFact->getByName(pFilters[nFilter]);
717cdf0e10cSrcweir Sequence<PropertyValue> aProperties;
718cdf0e10cSrcweir aProps >>= aProperties;
719cdf0e10cSrcweir pUIFilters[nFilter] = lcl_ExtracUIName(aProperties);
720cdf0e10cSrcweir }
721cdf0e10cSrcweir }
722cdf0e10cSrcweir const OUString* pUIFilters = pImpl->aUIFilterArr[nData].getConstArray();
723cdf0e10cSrcweir OUString sSelect;
724cdf0e10cSrcweir for(int i = 0; i < pImpl->aUIFilterArr[nData].getLength(); i++)
725cdf0e10cSrcweir {
726cdf0e10cSrcweir sal_uInt16 nEntryPos = aSaveAsLB.InsertEntry(pUIFilters[i]);
727cdf0e10cSrcweir if ( pImpl->aODFArr[nData][i] )
728cdf0e10cSrcweir aSaveAsLB.SetEntryData( nEntryPos, (void*)pImpl );
729cdf0e10cSrcweir if(pFilters[i] == pImpl->aDefaultArr[nData])
730cdf0e10cSrcweir sSelect = pUIFilters[i];
731cdf0e10cSrcweir }
732cdf0e10cSrcweir if(sSelect.getLength())
733cdf0e10cSrcweir aSaveAsLB.SelectEntry(sSelect);
734cdf0e10cSrcweir aSaveAsFI.Show(pImpl->aDefaultReadonlyArr[nData]);
735cdf0e10cSrcweir aSaveAsFT.Enable(!pImpl->aDefaultReadonlyArr[nData]);
736cdf0e10cSrcweir aSaveAsLB.Enable(!pImpl->aDefaultReadonlyArr[nData]);
737cdf0e10cSrcweir }
738cdf0e10cSrcweir else
739cdf0e10cSrcweir {
740cdf0e10cSrcweir OUString sSelect = pBox->GetSelectEntry();
741cdf0e10cSrcweir const OUString* pFilters = pImpl->aFilterArr[nData].getConstArray();
742cdf0e10cSrcweir OUString* pUIFilters = pImpl->aUIFilterArr[nData].getArray();
743cdf0e10cSrcweir for(int i = 0; i < pImpl->aUIFilterArr[nData].getLength(); i++)
744cdf0e10cSrcweir if(pUIFilters[i] == sSelect)
745cdf0e10cSrcweir {
746cdf0e10cSrcweir sSelect = pFilters[i];
747cdf0e10cSrcweir break;
748cdf0e10cSrcweir }
749cdf0e10cSrcweir
750cdf0e10cSrcweir pImpl->aDefaultArr[nData] = sSelect;
751cdf0e10cSrcweir }
752cdf0e10cSrcweir }
753cdf0e10cSrcweir
754cdf0e10cSrcweir ODFVersionHdl_Impl( &aSaveAsLB );
755cdf0e10cSrcweir return 0;
756cdf0e10cSrcweir };
757cdf0e10cSrcweir
IMPL_LINK(SfxSaveTabPage,ODFVersionHdl_Impl,ListBox *,EMPTYARG)758cdf0e10cSrcweir IMPL_LINK( SfxSaveTabPage, ODFVersionHdl_Impl, ListBox *, EMPTYARG )
759cdf0e10cSrcweir {
760cdf0e10cSrcweir long nVersion = long( aODFVersionLB.GetEntryData( aODFVersionLB.GetSelectEntryPos() ) );
761cdf0e10cSrcweir bool bShown = SvtSaveOptions::ODFDefaultVersion( nVersion ) != SvtSaveOptions::ODFVER_LATEST;
762cdf0e10cSrcweir if ( bShown )
763cdf0e10cSrcweir {
764cdf0e10cSrcweir bool bHasODFFormat = false;
765cdf0e10cSrcweir sal_uInt16 i = 0, nCount = aSaveAsLB.GetEntryCount();
766cdf0e10cSrcweir for ( ; i < nCount; ++ i )
767cdf0e10cSrcweir {
768cdf0e10cSrcweir if ( aSaveAsLB.GetEntryData(i) != NULL )
769cdf0e10cSrcweir {
770cdf0e10cSrcweir bHasODFFormat = true;
771cdf0e10cSrcweir break;
772cdf0e10cSrcweir }
773cdf0e10cSrcweir }
774cdf0e10cSrcweir
775cdf0e10cSrcweir bShown = !bHasODFFormat
776cdf0e10cSrcweir || ( aSaveAsLB.GetEntryData( aSaveAsLB.GetSelectEntryPos() ) != NULL );
777cdf0e10cSrcweir }
778cdf0e10cSrcweir
779cdf0e10cSrcweir aODFWarningFI.Show( bShown );
780cdf0e10cSrcweir aODFWarningFT.Show( bShown );
781cdf0e10cSrcweir
782cdf0e10cSrcweir return 0;
783cdf0e10cSrcweir }
784cdf0e10cSrcweir
785