Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / sfx2 / source / doc / new.cxx
blob2696882f154d78cf84eed20bc6c04340958eff8c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include <comphelper/string.hxx>
30 #include <sfx2/new.hxx>
31 #include <vcl/msgbox.hxx>
32 #include <vcl/morebtn.hxx>
33 #include <svtools/svmedit.hxx>
34 #include <svl/itemset.hxx>
35 #include <svl/eitem.hxx>
36 #include <svtools/sfxecode.hxx>
37 #include <svtools/ehdl.hxx>
38 #include <tools/urlobj.hxx>
39 #include <unotools/localfilehelper.hxx>
41 #include "new.hrc"
42 #include "doc.hrc"
43 #include <sfx2/app.hxx>
44 #include <sfx2/objsh.hxx>
45 #include "sfx2/sfxresid.hxx"
46 #include <sfx2/docfile.hxx>
47 #include "preview.hxx"
48 #include <sfx2/printer.hxx>
49 #include <vcl/waitobj.hxx>
51 // Draw modes
52 #define OUTPUT_DRAWMODE_COLOR (DRAWMODE_DEFAULT)
53 #define OUTPUT_DRAWMODE_GRAYSCALE (DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT)
54 #define OUTPUT_DRAWMODE_BLACKWHITE (DRAWMODE_BLACKLINE | DRAWMODE_BLACKTEXT | DRAWMODE_WHITEFILL | DRAWMODE_GRAYBITMAP | DRAWMODE_WHITEGRADIENT)
55 #define OUTPUT_DRAWMODE_CONTRAST (DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT)
57 //========================================================================
59 #define MORE_BTN(x) pMoreBt->x
61 //========================================================================
63 void SfxPreviewBase_Impl::SetObjectShell( SfxObjectShell* pObj )
65 ::boost::shared_ptr<GDIMetaFile> pFile = pObj
66 ? pObj->GetPreviewMetaFile()
67 : ::boost::shared_ptr<GDIMetaFile>();
68 pMetaFile = pFile;
69 Invalidate();
72 SfxPreviewBase_Impl::SfxPreviewBase_Impl(
73 Window* pParent, const ResId& rResId )
74 : Window(pParent, rResId), pMetaFile()
78 SfxPreviewBase_Impl::~SfxPreviewBase_Impl()
82 void SfxPreviewBase_Impl::Resize()
84 Invalidate();
87 void SfxPreviewWin_Impl::ImpPaint(
88 const Rectangle&, GDIMetaFile* pFile, Window* pWindow )
90 Size aTmpSize = pFile ? pFile->GetPrefSize() : Size(1,1 );
91 DBG_ASSERT( aTmpSize.Height()*aTmpSize.Width(),
92 "size of first page is 0, overload GetFirstPageSize or set vis-area!" );
93 #define FRAME 4
94 long nWidth = pWindow->GetOutputSize().Width() - 2*FRAME;
95 long nHeight = pWindow->GetOutputSize().Height() - 2*FRAME;
96 if( nWidth < 0 ) nWidth = 0;
97 if( nHeight < 0 ) nHeight = 0;
99 double dRatio=((double)aTmpSize.Width())/aTmpSize.Height();
100 double dRatioPreV=((double) nWidth ) / nHeight;
101 Size aSize;
102 Point aPoint;
103 if (dRatio>dRatioPreV)
105 aSize=Size(nWidth, (sal_uInt16)(nWidth/dRatio));
106 aPoint=Point( 0, (sal_uInt16)((nHeight-aSize.Height())/2));
108 else
110 aSize=Size((sal_uInt16)(nHeight*dRatio), nHeight);
111 aPoint=Point((sal_uInt16)((nWidth-aSize.Width())/2),0);
113 Point bPoint=Point(nWidth,nHeight)-aPoint;
116 pWindow->SetLineColor();
117 Color aLightGrayCol( COL_LIGHTGRAY );
118 pWindow->SetFillColor( aLightGrayCol );
119 pWindow->DrawRect( Rectangle( Point( 0,0 ), pWindow->GetOutputSize() ) );
120 if ( pFile )
122 Color aBlackCol( COL_BLACK );
123 Color aWhiteCol( COL_WHITE );
124 pWindow->SetLineColor( aBlackCol );
125 pWindow->SetFillColor( aWhiteCol );
126 pWindow->DrawRect( Rectangle( aPoint + Point( FRAME, FRAME ), bPoint + Point( FRAME, FRAME ) ) );
127 pFile->WindStart();
128 pFile->Play( pWindow, aPoint + Point( FRAME, FRAME ), aSize );
132 void SfxPreviewWin_Impl::Paint( const Rectangle& rRect )
134 ImpPaint( rRect, pMetaFile.get(), this );
137 class SfxNewFileDialog_Impl
139 FixedText aRegionFt;
140 ListBox aRegionLb;
141 FixedText aTemplateFt;
142 ListBox aTemplateLb;
144 CheckBox aPreviewBtn;
145 SfxPreviewWin_Impl aPreviewWin;
147 FixedText aTitleFt;
148 Edit aTitleEd;
149 FixedText aThemaFt;
150 Edit aThemaEd;
151 FixedText aKeywordsFt;
152 Edit aKeywordsEd;
153 FixedText aDescFt;
154 MultiLineEdit aDescEd;
155 FixedLine aDocinfoGb;
157 CheckBox aTextStyleCB;
158 CheckBox aFrameStyleCB;
159 CheckBox aPageStyleCB;
160 CheckBox aNumStyleCB;
161 CheckBox aMergeStyleCB;
162 PushButton aLoadFilePB;
164 OKButton aOkBt;
165 CancelButton aCancelBt;
166 HelpButton aHelpBt;
167 MoreButton* pMoreBt;
168 Timer aPrevTimer;
169 String aNone;
170 String sLoadTemplate;
172 sal_uInt16 nFlags;
173 SfxDocumentTemplates aTemplates;
174 SfxObjectShellLock xDocShell;
175 SfxNewFileDialog* pAntiImpl;
177 void ClearInfo();
178 DECL_LINK( Update, void * );
180 DECL_LINK( RegionSelect, ListBox * );
181 DECL_LINK(TemplateSelect, void *);
182 DECL_LINK( DoubleClick, ListBox * );
183 void TogglePreview(CheckBox *);
184 DECL_LINK( Expand, void * );
185 DECL_LINK( PreviewClick, CheckBox * );
186 DECL_LINK(LoadFile, void *);
187 sal_uInt16 GetSelectedTemplatePos() const;
189 public:
191 SfxNewFileDialog_Impl( SfxNewFileDialog* pAntiImplP, sal_uInt16 nFlags );
192 ~SfxNewFileDialog_Impl();
194 // Returns sal_False if '- No -' is set as a template
195 // Template name can only be obtained if IsTemplate() is TRUE
196 // erfragt werden
197 sal_Bool IsTemplate() const;
198 String GetTemplateFileName() const;
200 sal_uInt16 GetTemplateFlags()const;
201 void SetTemplateFlags(sal_uInt16 nSet);
205 //-------------------------------------------------------------------------
207 void SfxNewFileDialog_Impl::ClearInfo()
209 const String aNo;
210 aTitleEd.SetText(aNo);
211 aThemaEd.SetText(aNo);
212 aKeywordsEd.SetText(aNo);
213 aDescEd.SetText(aNo);
216 //-------------------------------------------------------------------------
218 IMPL_LINK_NOARG(SfxNewFileDialog_Impl, Update)
220 if ( xDocShell.Is() )
222 if ( xDocShell->GetProgress() )
223 return sal_False;
224 xDocShell.Clear();
227 const sal_uInt16 nEntry = GetSelectedTemplatePos();
228 if(!nEntry)
230 ClearInfo();
231 aPreviewWin.Invalidate();
232 aPreviewWin.SetObjectShell( 0);
233 return 0;
236 if ( aPreviewBtn.IsChecked() && (nFlags & SFXWB_PREVIEW) == SFXWB_PREVIEW)
239 String aFileName = aTemplates.GetPath( aRegionLb.GetSelectEntryPos(), nEntry-1);
240 INetURLObject aTestObj( aFileName );
241 if( aTestObj.GetProtocol() == INET_PROT_NOT_VALID )
243 // temp. fix until Templates are managed by UCB compatible service
244 // does NOT work with locally cached components !
245 rtl::OUString aTemp;
246 utl::LocalFileHelper::ConvertPhysicalNameToURL( aFileName, aTemp );
247 aFileName = aTemp;
250 INetURLObject aObj( aFileName );
251 for ( SfxObjectShell* pTmp = SfxObjectShell::GetFirst();
252 pTmp;
253 pTmp = SfxObjectShell::GetNext(*pTmp) )
255 //! fsys bug op==
256 if ( pTmp->GetMedium())
257 // ??? HasName() MM
258 if( INetURLObject( pTmp->GetMedium()->GetName() ) == aObj )
260 xDocShell = pTmp;
261 break;
265 if ( !xDocShell.Is() )
267 Window *pParent = Application::GetDefDialogParent();
268 Application::SetDefDialogParent( pAntiImpl );
269 SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,pAntiImpl);
270 SfxApplication *pSfxApp = SFX_APP();
271 sal_uIntPtr lErr;
272 SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() );
273 pSet->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
274 pSet->Put( SfxBoolItem( SID_PREVIEW, sal_True ) );
275 lErr = pSfxApp->LoadTemplate( xDocShell, aFileName, sal_True, pSet );
276 if( lErr )
277 ErrorHandler::HandleError(lErr);
278 Application::SetDefDialogParent( pParent );
279 if ( !xDocShell.Is() )
281 aPreviewWin.SetObjectShell( 0 );
282 return sal_False;
286 aPreviewWin.SetObjectShell( xDocShell );
288 return sal_True;
291 //-------------------------------------------------------------------------
293 IMPL_LINK( SfxNewFileDialog_Impl, RegionSelect, ListBox *, pBox )
295 if ( xDocShell.Is() && xDocShell->GetProgress() )
296 return 0;
298 const sal_uInt16 nRegion = pBox->GetSelectEntryPos();
299 const sal_uInt16 nCount = aTemplates.GetRegionCount()? aTemplates.GetCount(nRegion): 0;
300 aTemplateLb.SetUpdateMode(sal_False);
301 aTemplateLb.Clear();
302 String aSel=aRegionLb.GetSelectEntry();
303 sal_uInt16 nc=aSel.Search('(');
304 if (nc-1&&nc!=STRING_NOTFOUND)
305 aSel.Erase(nc-1);
306 if (aSel.CompareIgnoreCaseToAscii( String(SfxResId(STR_STANDARD)) )==COMPARE_EQUAL)
307 aTemplateLb.InsertEntry(aNone);
308 for (sal_uInt16 i = 0; i < nCount; ++i)
309 aTemplateLb.InsertEntry(aTemplates.GetName(nRegion, i));
310 aTemplateLb.SelectEntryPos(0);
311 aTemplateLb.SetUpdateMode(sal_True);
312 aTemplateLb.Invalidate();
313 aTemplateLb.Update();
314 TemplateSelect(&aTemplateLb);
315 return 0;
318 //-------------------------------------------------------------------------
320 IMPL_LINK_NOARG_INLINE_START(SfxNewFileDialog_Impl, Expand)
322 TemplateSelect(&aTemplateLb);
323 return 0;
325 IMPL_LINK_NOARG_INLINE_END(SfxNewFileDialog_Impl, Expand)
327 //-------------------------------------------------------------------------
329 IMPL_LINK( SfxNewFileDialog_Impl, PreviewClick, CheckBox *, pBox )
331 if ( xDocShell.Is() && xDocShell->GetProgress() )
332 return 0;
334 sal_uInt16 nEntry = GetSelectedTemplatePos();
335 if ( nEntry && pBox->IsChecked() )
337 if(!Update(0))
338 aPreviewWin.Invalidate();
340 else
342 if (xDocShell.Is())
343 xDocShell.Clear();
344 aPreviewWin.SetObjectShell( 0 );
346 return 0;
349 //-------------------------------------------------------------------------
351 IMPL_LINK_NOARG(SfxNewFileDialog_Impl, TemplateSelect)
353 // Still loading
354 if ( xDocShell && xDocShell->GetProgress() )
355 return 0;
357 if ( !MORE_BTN(GetState()) )
358 // Dialog is not opened
359 return 0;
361 aPrevTimer.Start();
362 return 0;
365 //-------------------------------------------------------------------------
367 IMPL_LINK_INLINE_START( SfxNewFileDialog_Impl, DoubleClick, ListBox *, pListBox )
369 (void)pListBox;
370 // Still loadning
371 if ( !xDocShell.Is() || !xDocShell->GetProgress() )
372 pAntiImpl->EndDialog(RET_OK);
373 return 0;
375 IMPL_LINK_INLINE_END( SfxNewFileDialog_Impl, DoubleClick, ListBox *, pListBox )
377 //-------------------------------------------------------------------------
379 IMPL_LINK_NOARG_INLINE_START(SfxNewFileDialog_Impl, LoadFile)
381 pAntiImpl->EndDialog(RET_TEMPLATE_LOAD);
382 return 0;
384 IMPL_LINK_NOARG_INLINE_END(SfxNewFileDialog_Impl, LoadFile)
385 //-------------------------------------------------------------------------
387 sal_uInt16 SfxNewFileDialog_Impl::GetSelectedTemplatePos() const
389 sal_uInt16 nEntry=aTemplateLb.GetSelectEntryPos();
390 String aSel=aRegionLb.GetSelectEntry().Copy();
391 sal_uInt16 nc=aSel.Search('(');
392 if (nc-1&&nc!=STRING_NOTFOUND)
393 aSel.Erase(nc-1);
394 if (aSel.CompareIgnoreCaseToAscii(String(SfxResId(STR_STANDARD)))!=COMPARE_EQUAL)
395 nEntry++;
396 if (!aTemplateLb.GetSelectEntryCount())
397 nEntry=0;
398 return nEntry;
401 //-------------------------------------------------------------------------
403 sal_Bool SfxNewFileDialog_Impl::IsTemplate() const
405 return GetSelectedTemplatePos()!=0;
409 //-------------------------------------------------------------------------
411 String SfxNewFileDialog_Impl::GetTemplateFileName() const
413 if(!IsTemplate() || !aTemplates.GetRegionCount())
414 return String();
415 return aTemplates.GetPath(aRegionLb.GetSelectEntryPos(),
416 GetSelectedTemplatePos()-1);
419 //-------------------------------------------------------------------------
421 void AdjustPosSize_Impl(Window *pWin, short nMoveOffset, short nSizeOffset)
423 Point aPos(pWin->GetPosPixel());
424 Size aSize(pWin->GetSizePixel());
425 aPos.X() -= nMoveOffset;
426 aSize.Width() += nSizeOffset;
427 pWin->SetPosSizePixel(aPos, aSize);
429 //-------------------------------------------------------------------------
430 sal_uInt16 SfxNewFileDialog_Impl::GetTemplateFlags()const
432 sal_uInt16 nRet = aTextStyleCB.IsChecked() ? SFX_LOAD_TEXT_STYLES : 0;
433 if(aFrameStyleCB.IsChecked())
434 nRet |= SFX_LOAD_FRAME_STYLES;
435 if(aPageStyleCB.IsChecked())
436 nRet |= SFX_LOAD_PAGE_STYLES;
437 if(aNumStyleCB.IsChecked())
438 nRet |= SFX_LOAD_NUM_STYLES;
439 if(aMergeStyleCB.IsChecked())
440 nRet |= SFX_MERGE_STYLES;
441 return nRet;
443 //-------------------------------------------------------------------------
444 void SfxNewFileDialog_Impl::SetTemplateFlags(sal_uInt16 nSet)
446 aTextStyleCB.Check( 0 != (nSet&SFX_LOAD_TEXT_STYLES ));
447 aFrameStyleCB.Check( 0 != (nSet&SFX_LOAD_FRAME_STYLES));
448 aPageStyleCB.Check( 0 != (nSet&SFX_LOAD_PAGE_STYLES ));
449 aNumStyleCB.Check( 0 != (nSet&SFX_LOAD_NUM_STYLES ));
450 aMergeStyleCB.Check( 0 != (nSet&SFX_MERGE_STYLES ));
453 //-------------------------------------------------------------------------
455 SfxNewFileDialog_Impl::SfxNewFileDialog_Impl(
456 SfxNewFileDialog* pAntiImplP, sal_uInt16 nFl)
457 : aRegionFt( pAntiImplP, SfxResId( FT_REGION ) ),
458 aRegionLb( pAntiImplP, SfxResId( LB_REGION ) ),
459 aTemplateFt( pAntiImplP, SfxResId( FT_TEMPLATE ) ),
460 aTemplateLb( pAntiImplP, SfxResId( LB_TEMPLATE ) ),
461 aPreviewBtn( pAntiImplP, SfxResId( BTN_PREVIEW ) ),
462 aPreviewWin( pAntiImplP, SfxResId( WIN_PREVIEW ) ),
463 aTitleFt( pAntiImplP, SfxResId( FT_TITLE ) ),
464 aTitleEd( pAntiImplP, SfxResId( ED_TITLE ) ),
465 aThemaFt( pAntiImplP, SfxResId( FT_THEMA ) ),
466 aThemaEd( pAntiImplP, SfxResId( ED_THEMA ) ),
467 aKeywordsFt( pAntiImplP, SfxResId( FT_KEYWORDS ) ),
468 aKeywordsEd( pAntiImplP, SfxResId( ED_KEYWORDS ) ),
469 aDescFt( pAntiImplP, SfxResId( FT_DESC ) ),
470 aDescEd( pAntiImplP, SfxResId( ED_DESC ) ),
471 aDocinfoGb( pAntiImplP, SfxResId( GB_DOCINFO ) ),
472 aTextStyleCB( pAntiImplP, SfxResId( CB_TEXT_STYLE )),
473 aFrameStyleCB( pAntiImplP, SfxResId( CB_FRAME_STYLE )),
474 aPageStyleCB( pAntiImplP, SfxResId( CB_PAGE_STYLE )),
475 aNumStyleCB( pAntiImplP, SfxResId( CB_NUM_STYLE )),
476 aMergeStyleCB( pAntiImplP, SfxResId( CB_MERGE_STYLE )),
477 aLoadFilePB( pAntiImplP, SfxResId( PB_LOAD_FILE )),
478 aOkBt( pAntiImplP, SfxResId( BT_OK ) ),
479 aCancelBt( pAntiImplP, SfxResId( BT_CANCEL ) ),
480 aHelpBt( pAntiImplP, SfxResId( BT_HELP ) ),
481 pMoreBt( new MoreButton( pAntiImplP, SfxResId( BT_MORE ) ) ),
482 aNone( SfxResId(STR_NONE) ),
483 sLoadTemplate( SfxResId(STR_LOAD_TEMPLATE)),
484 nFlags(nFl),
485 pAntiImpl( pAntiImplP )
487 short nMoveOffset = *(short *)pAntiImplP->GetClassRes();
488 pAntiImplP->IncrementRes(sizeof(short));
489 short nExpandSize= *(short *)pAntiImplP->GetClassRes();
490 pAntiImplP->IncrementRes(sizeof(short));
491 pAntiImplP->FreeResource();
493 if (!nFlags)
494 MORE_BTN(Hide());
495 else if(SFXWB_LOAD_TEMPLATE == nFlags)
497 aLoadFilePB.SetClickHdl(LINK(this, SfxNewFileDialog_Impl, LoadFile));
498 aLoadFilePB.Show();
499 aTextStyleCB.Show();
500 aFrameStyleCB.Show();
501 aPageStyleCB.Show();
502 aNumStyleCB.Show();
503 aMergeStyleCB.Show();
504 Size aSize(pAntiImplP->GetOutputSizePixel());
505 Size aTmp(pAntiImplP->LogicToPixel(Size(16, 16), MAP_APPFONT));
506 aSize.Height() += aTmp.Height();
507 pAntiImplP->SetOutputSizePixel(aSize);
508 pMoreBt->Hide();
509 aTextStyleCB.Check();
510 pAntiImplP->SetText(sLoadTemplate);
512 else
514 MORE_BTN(SetClickHdl(LINK(this, SfxNewFileDialog_Impl, Expand)));
515 if((nFlags & SFXWB_PREVIEW) == SFXWB_PREVIEW)
517 MORE_BTN(AddWindow(&aPreviewBtn));
518 MORE_BTN(AddWindow(&aPreviewWin));
519 aPreviewBtn.SetClickHdl(LINK(this, SfxNewFileDialog_Impl, PreviewClick));
521 else
523 aPreviewBtn.Hide();
524 aPreviewWin.Hide();
525 nMoveOffset = (short)pAntiImplP->LogicToPixel(
526 Size(nMoveOffset, nMoveOffset), MAP_APPFONT).Width();
527 nExpandSize = (short)pAntiImplP->LogicToPixel(
528 Size(nExpandSize, nExpandSize), MAP_APPFONT).Width();
529 AdjustPosSize_Impl(&aTitleFt, nMoveOffset, 0);
530 AdjustPosSize_Impl(&aTitleEd, nMoveOffset, nExpandSize);
531 AdjustPosSize_Impl(&aThemaFt, nMoveOffset, 0);
532 AdjustPosSize_Impl(&aThemaEd, nMoveOffset, nExpandSize);
533 AdjustPosSize_Impl(&aKeywordsFt, nMoveOffset, 0);
534 AdjustPosSize_Impl(&aKeywordsEd, nMoveOffset, nExpandSize);
535 AdjustPosSize_Impl(&aDescFt , nMoveOffset, 0);
536 AdjustPosSize_Impl(&aDescEd , nMoveOffset, nExpandSize);
537 AdjustPosSize_Impl(&aDocinfoGb, nMoveOffset, nExpandSize);
541 String &rExtra = pAntiImplP->GetExtraData();
542 sal_Int32 nTokCount = comphelper::string::getTokenCount(rExtra, '|');
543 if( nTokCount > 0 && nFlags )
544 MORE_BTN(SetState( rExtra.GetToken( 0, '|' ) == 'Y' ));
545 if( nTokCount > 1 && nFlags )
546 aPreviewBtn.Check( rExtra.GetToken( 1 ,'|' ) == 'Y' );
548 aTemplateLb.SetSelectHdl(LINK(this, SfxNewFileDialog_Impl, TemplateSelect));
549 aTemplateLb.SetDoubleClickHdl(LINK(this, SfxNewFileDialog_Impl, DoubleClick));
551 // update the template configuration if necessary
553 WaitObject aWaitCursor( pAntiImplP->GetParent() );
554 aTemplates.Update( sal_True /* be smart */ );
556 // fill the list boxes
557 const sal_uInt16 nCount = aTemplates.GetRegionCount();
558 if (nCount)
560 for(sal_uInt16 i = 0; i < nCount; ++i)
561 aRegionLb.InsertEntry(aTemplates.GetFullRegionName(i));
562 aRegionLb.SetSelectHdl(LINK(this, SfxNewFileDialog_Impl, RegionSelect));
565 aPrevTimer.SetTimeout( 500 );
566 aPrevTimer.SetTimeoutHdl( LINK( this, SfxNewFileDialog_Impl, Update));
568 aRegionLb.SelectEntryPos(0);
569 RegionSelect(&aRegionLb);
572 //-------------------------------------------------------------------------
574 SfxNewFileDialog_Impl::~SfxNewFileDialog_Impl()
576 String &rExtra = pAntiImpl->GetExtraData();
577 rExtra = MORE_BTN(GetState()) ? 'Y' : 'N';
578 rExtra += '|';
579 rExtra += aPreviewBtn.IsChecked() ? 'Y' : 'N';
581 delete pMoreBt;
583 //-------------------------------------------------------------------------
584 SfxNewFileDialog::SfxNewFileDialog(Window *pParent, sal_uInt16 nFlags)
585 : SfxModalDialog( pParent, SfxResId( DLG_NEW_FILE ) )
587 pImpl = new SfxNewFileDialog_Impl( this, nFlags );
589 //-------------------------------------------------------------------------
590 SfxNewFileDialog::~SfxNewFileDialog()
592 delete pImpl;
594 //-------------------------------------------------------------------------
595 sal_Bool SfxNewFileDialog::IsTemplate() const
597 return pImpl->IsTemplate();
599 //-------------------------------------------------------------------------
600 String SfxNewFileDialog::GetTemplateFileName() const
602 return pImpl->GetTemplateFileName();
604 //-------------------------------------------------------------------------
605 sal_uInt16 SfxNewFileDialog::GetTemplateFlags()const
607 return pImpl->GetTemplateFlags();
610 //-------------------------------------------------------------------------
611 void SfxNewFileDialog::SetTemplateFlags(sal_uInt16 nSet)
613 pImpl->SetTemplateFlags(nSet);
616 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */