2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 12:07:08 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 12:07:08 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 12:07:08 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 12:07:08 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 12:07:08 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 12:07:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 15:42:11 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sfx2.hxx"
|
2007-06-27 22:22:26 +00:00
|
|
|
#include <sfx2/new.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <vcl/gdimtf.hxx>
|
|
|
|
#include <vcl/msgbox.hxx>
|
|
|
|
#include <vcl/morebtn.hxx>
|
|
|
|
#include <svtools/svmedit.hxx>
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <svl/itemset.hxx>
|
|
|
|
#include <svl/eitem.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <svtools/sfxecode.hxx>
|
|
|
|
#include <svtools/ehdl.hxx>
|
2000-09-28 10:47:22 +00:00
|
|
|
#include <tools/urlobj.hxx>
|
2000-11-16 14:59:14 +00:00
|
|
|
#include <unotools/localfilehelper.hxx>
|
2000-09-28 10:47:22 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "new.hrc"
|
|
|
|
#include "doc.hrc"
|
2007-06-27 22:22:26 +00:00
|
|
|
#include <sfx2/sfx.hrc>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "helpid.hrc"
|
|
|
|
#include "sfxtypes.hxx"
|
2007-06-27 22:22:26 +00:00
|
|
|
#include <sfx2/app.hxx>
|
|
|
|
#include <sfx2/viewfrm.hxx>
|
|
|
|
#include <sfx2/docfac.hxx>
|
|
|
|
#include <sfx2/objsh.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "fltfnc.hxx"
|
2007-06-27 22:22:26 +00:00
|
|
|
#include <sfx2/viewsh.hxx>
|
2010-04-16 23:02:51 +02:00
|
|
|
#include "sfx2/viewfac.hxx"
|
|
|
|
#include "sfx2/sfxresid.hxx"
|
2007-06-27 22:22:26 +00:00
|
|
|
#include <sfx2/docfile.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include "preview.hxx"
|
2007-06-27 22:22:26 +00:00
|
|
|
#include <sfx2/printer.hxx>
|
2001-12-06 12:42:19 +00:00
|
|
|
#include <vcl/waitobj.hxx>
|
2002-08-26 10:49:54 +00:00
|
|
|
#include <vcl/virdev.hxx>
|
|
|
|
#include <vcl/jobset.hxx>
|
2002-08-01 10:41:27 +00:00
|
|
|
#include <svtools/accessibilityoptions.hxx>
|
2001-12-06 12:42:19 +00:00
|
|
|
|
2002-08-01 10:41:27 +00:00
|
|
|
// Draw modes
|
|
|
|
#define OUTPUT_DRAWMODE_COLOR (DRAWMODE_DEFAULT)
|
|
|
|
#define OUTPUT_DRAWMODE_GRAYSCALE (DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT)
|
|
|
|
#define OUTPUT_DRAWMODE_BLACKWHITE (DRAWMODE_BLACKLINE | DRAWMODE_BLACKTEXT | DRAWMODE_WHITEFILL | DRAWMODE_GRAYBITMAP | DRAWMODE_WHITEGRADIENT)
|
|
|
|
#define OUTPUT_DRAWMODE_CONTRAST (DRAWMODE_SETTINGSLINE | DRAWMODE_SETTINGSFILL | DRAWMODE_SETTINGSTEXT | DRAWMODE_SETTINGSGRADIENT)
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
#define MORE_BTN(x) pMoreBt->x
|
|
|
|
|
|
|
|
//========================================================================
|
|
|
|
|
|
|
|
void SfxPreviewBase_Impl::SetObjectShell( SfxObjectShell* pObj )
|
|
|
|
{
|
INTEGRATION: CWS custommeta (1.19.74); FILE MERGED
2008/02/01 16:23:32 mst 1.19.74.3: interface change: SfxObjectShell::GetPreviewMetaFile
- sfx2/inc/sfx2/objsh.hxx,
sfx2/source/doc/{objcont.cxx,objstor.cxx,sfxbasemodel.cxx}:
+ SfxObjectShell::GetPreviewMetaFile returns a boost::shared_ptr;
likewise SfxObjectShell::CreatePreviewMetaFile_Impl
- sfx2/source/inc/preview.hxx, sfx2/source/doc/new.cxx:
+ SfxPreviewBase_Impl stores its GDIMetaFile member in a boost::shared_ptr
2008/01/25 14:19:27 mst 1.19.74.2: - sfx2/inc/sfx2/{frmhtmlw.hxx,sfxhtml.hxx},
sfx2/source/appl/{appbas.cxx,appcfg.cxx,appmain.cxx,appserv.cxx},
sfx2/source/bastyp/{fltfnc.cxx,frmhtml.cxx}, sfx2/source/config/evntconf.cxx,
sfx2/source/doc/new.cxx, sfx2/source/doc/oleprops.cxx:
+ remove unneeded includes and assorted detritus
2008/01/24 10:42:34 mst 1.19.74.1: - sfx2/inc/sfx2/new.hxx, sfx2/source/doc/new.cxx:
+ remove unused flag SFXWB_DOCINFO and all supporting code
2008-02-26 14:09:04 +00:00
|
|
|
::boost::shared_ptr<GDIMetaFile> pFile = pObj
|
|
|
|
? pObj->GetPreviewMetaFile()
|
|
|
|
: ::boost::shared_ptr<GDIMetaFile>();
|
2000-09-18 16:07:07 +00:00
|
|
|
pMetaFile = pFile;
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxPreviewBase_Impl::SfxPreviewBase_Impl(
|
|
|
|
Window* pParent, const ResId& rResId )
|
INTEGRATION: CWS custommeta (1.19.74); FILE MERGED
2008/02/01 16:23:32 mst 1.19.74.3: interface change: SfxObjectShell::GetPreviewMetaFile
- sfx2/inc/sfx2/objsh.hxx,
sfx2/source/doc/{objcont.cxx,objstor.cxx,sfxbasemodel.cxx}:
+ SfxObjectShell::GetPreviewMetaFile returns a boost::shared_ptr;
likewise SfxObjectShell::CreatePreviewMetaFile_Impl
- sfx2/source/inc/preview.hxx, sfx2/source/doc/new.cxx:
+ SfxPreviewBase_Impl stores its GDIMetaFile member in a boost::shared_ptr
2008/01/25 14:19:27 mst 1.19.74.2: - sfx2/inc/sfx2/{frmhtmlw.hxx,sfxhtml.hxx},
sfx2/source/appl/{appbas.cxx,appcfg.cxx,appmain.cxx,appserv.cxx},
sfx2/source/bastyp/{fltfnc.cxx,frmhtml.cxx}, sfx2/source/config/evntconf.cxx,
sfx2/source/doc/new.cxx, sfx2/source/doc/oleprops.cxx:
+ remove unneeded includes and assorted detritus
2008/01/24 10:42:34 mst 1.19.74.1: - sfx2/inc/sfx2/new.hxx, sfx2/source/doc/new.cxx:
+ remove unused flag SFXWB_DOCINFO and all supporting code
2008-02-26 14:09:04 +00:00
|
|
|
: Window(pParent, rResId), pMetaFile()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SfxPreviewBase_Impl::~SfxPreviewBase_Impl()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void SfxPreviewBase_Impl::Resize()
|
|
|
|
{
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SfxPreviewWin_Impl::ImpPaint(
|
|
|
|
const Rectangle&, GDIMetaFile* pFile, Window* pWindow )
|
|
|
|
{
|
|
|
|
Size aTmpSize = pFile ? pFile->GetPrefSize() : Size(1,1 );
|
|
|
|
DBG_ASSERT( aTmpSize.Height()*aTmpSize.Width(),
|
|
|
|
"size of first page is 0, overload GetFirstPageSize or set vis-area!" );
|
|
|
|
#define FRAME 4
|
|
|
|
long nWidth = pWindow->GetOutputSize().Width() - 2*FRAME;
|
|
|
|
long nHeight = pWindow->GetOutputSize().Height() - 2*FRAME;
|
|
|
|
if( nWidth < 0 ) nWidth = 0;
|
|
|
|
if( nHeight < 0 ) nHeight = 0;
|
|
|
|
|
|
|
|
double dRatio=((double)aTmpSize.Width())/aTmpSize.Height();
|
|
|
|
double dRatioPreV=((double) nWidth ) / nHeight;
|
|
|
|
Size aSize;
|
|
|
|
Point aPoint;
|
|
|
|
if (dRatio>dRatioPreV)
|
|
|
|
{
|
2011-01-07 17:14:47 +01:00
|
|
|
aSize=Size(nWidth, (sal_uInt16)(nWidth/dRatio));
|
|
|
|
aPoint=Point( 0, (sal_uInt16)((nHeight-aSize.Height())/2));
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-01-07 17:14:47 +01:00
|
|
|
aSize=Size((sal_uInt16)(nHeight*dRatio), nHeight);
|
|
|
|
aPoint=Point((sal_uInt16)((nWidth-aSize.Width())/2),0);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
Point bPoint=Point(nWidth,nHeight)-aPoint;
|
|
|
|
|
2003-03-27 10:29:38 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
pWindow->SetLineColor();
|
|
|
|
Color aLightGrayCol( COL_LIGHTGRAY );
|
|
|
|
pWindow->SetFillColor( aLightGrayCol );
|
|
|
|
pWindow->DrawRect( Rectangle( Point( 0,0 ), pWindow->GetOutputSize() ) );
|
|
|
|
if ( pFile )
|
|
|
|
{
|
|
|
|
Color aBlackCol( COL_BLACK );
|
|
|
|
Color aWhiteCol( COL_WHITE );
|
|
|
|
pWindow->SetLineColor( aBlackCol );
|
|
|
|
pWindow->SetFillColor( aWhiteCol );
|
|
|
|
pWindow->DrawRect( Rectangle( aPoint + Point( FRAME, FRAME ), bPoint + Point( FRAME, FRAME ) ) );
|
|
|
|
pFile->WindStart();
|
|
|
|
pFile->Play( pWindow, aPoint + Point( FRAME, FRAME ), aSize );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SfxPreviewWin_Impl::Paint( const Rectangle& rRect )
|
|
|
|
{
|
INTEGRATION: CWS custommeta (1.19.74); FILE MERGED
2008/02/01 16:23:32 mst 1.19.74.3: interface change: SfxObjectShell::GetPreviewMetaFile
- sfx2/inc/sfx2/objsh.hxx,
sfx2/source/doc/{objcont.cxx,objstor.cxx,sfxbasemodel.cxx}:
+ SfxObjectShell::GetPreviewMetaFile returns a boost::shared_ptr;
likewise SfxObjectShell::CreatePreviewMetaFile_Impl
- sfx2/source/inc/preview.hxx, sfx2/source/doc/new.cxx:
+ SfxPreviewBase_Impl stores its GDIMetaFile member in a boost::shared_ptr
2008/01/25 14:19:27 mst 1.19.74.2: - sfx2/inc/sfx2/{frmhtmlw.hxx,sfxhtml.hxx},
sfx2/source/appl/{appbas.cxx,appcfg.cxx,appmain.cxx,appserv.cxx},
sfx2/source/bastyp/{fltfnc.cxx,frmhtml.cxx}, sfx2/source/config/evntconf.cxx,
sfx2/source/doc/new.cxx, sfx2/source/doc/oleprops.cxx:
+ remove unneeded includes and assorted detritus
2008/01/24 10:42:34 mst 1.19.74.1: - sfx2/inc/sfx2/new.hxx, sfx2/source/doc/new.cxx:
+ remove unused flag SFXWB_DOCINFO and all supporting code
2008-02-26 14:09:04 +00:00
|
|
|
ImpPaint( rRect, pMetaFile.get(), this );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SfxPreviewWin::SfxPreviewWin(
|
|
|
|
Window* pParent, const ResId& rResId, SfxObjectShellLock &rDocSh )
|
|
|
|
: Window(pParent, rResId), rDocShell( rDocSh )
|
|
|
|
{
|
|
|
|
SetHelpId( HID_PREVIEW_FRAME );
|
2002-08-01 10:41:27 +00:00
|
|
|
|
|
|
|
// adjust contrast mode initially
|
2010-11-16 19:01:58 -08:00
|
|
|
SetDrawMode( OUTPUT_DRAWMODE_COLOR );
|
2003-03-27 10:29:38 +00:00
|
|
|
|
2011-02-27 20:44:41 +01:00
|
|
|
// This preview window is for document previews. Therefore
|
2003-03-27 10:29:38 +00:00
|
|
|
// right-to-left mode should be off
|
2011-01-07 17:14:47 +01:00
|
|
|
EnableRTL( sal_False );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SfxPreviewWin::Paint( const Rectangle& rRect )
|
|
|
|
{
|
2002-08-26 10:49:54 +00:00
|
|
|
SfxViewFrame *pFrame = SfxViewFrame::GetFirst( &rDocShell );
|
|
|
|
if ( pFrame && pFrame->GetViewShell() &&
|
|
|
|
pFrame->GetViewShell()->GetPrinter() &&
|
|
|
|
pFrame->GetViewShell()->GetPrinter()->IsPrinting() )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-10-04 19:55:22 +00:00
|
|
|
Size aTmpSize( rDocShell->GetFirstPageSize() );
|
|
|
|
GDIMetaFile aMtf;
|
|
|
|
VirtualDevice aDevice;
|
2002-08-26 10:49:54 +00:00
|
|
|
|
2004-10-04 19:55:22 +00:00
|
|
|
DBG_ASSERT( aTmpSize.Height() * aTmpSize.Width(), "size of first page is 0, overload GetFirstPageSize or set vis-area!" );
|
2002-08-26 10:49:54 +00:00
|
|
|
|
2004-10-04 19:55:22 +00:00
|
|
|
aMtf.SetPrefSize( aTmpSize );
|
2011-01-07 17:14:47 +01:00
|
|
|
aDevice.EnableOutput( sal_False );
|
2004-10-04 19:55:22 +00:00
|
|
|
aDevice.SetMapMode( rDocShell->GetMapUnit() );
|
|
|
|
aDevice.SetDrawMode( GetDrawMode() );
|
|
|
|
aMtf.Record( &aDevice );
|
|
|
|
rDocShell->DoDraw( &aDevice, Point(0,0), aTmpSize, JobSetup(), ASPECT_THUMBNAIL );
|
|
|
|
aMtf.Stop();
|
|
|
|
aMtf.WindStart();
|
|
|
|
SfxPreviewWin_Impl::ImpPaint( rRect, &aMtf, this );
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2002-08-01 10:41:27 +00:00
|
|
|
void SfxPreviewWin::DataChanged( const DataChangedEvent& rDCEvt )
|
|
|
|
{
|
|
|
|
Window::DataChanged( rDCEvt );
|
|
|
|
|
|
|
|
if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
|
|
|
|
(rDCEvt.GetFlags() & SETTINGS_STYLE) )
|
|
|
|
{
|
2010-11-16 19:01:58 -08:00
|
|
|
SetDrawMode( OUTPUT_DRAWMODE_COLOR );
|
2002-08-01 10:41:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
class SfxNewFileDialog_Impl
|
|
|
|
{
|
|
|
|
FixedText aRegionFt;
|
|
|
|
ListBox aRegionLb;
|
|
|
|
FixedText aTemplateFt;
|
|
|
|
ListBox aTemplateLb;
|
|
|
|
|
|
|
|
CheckBox aPreviewBtn;
|
|
|
|
SfxPreviewWin_Impl aPreviewWin;
|
|
|
|
|
|
|
|
FixedText aTitleFt;
|
|
|
|
Edit aTitleEd;
|
|
|
|
FixedText aThemaFt;
|
|
|
|
Edit aThemaEd;
|
|
|
|
FixedText aKeywordsFt;
|
|
|
|
Edit aKeywordsEd;
|
|
|
|
FixedText aDescFt;
|
|
|
|
MultiLineEdit aDescEd;
|
2001-06-18 10:21:24 +00:00
|
|
|
FixedLine aDocinfoGb;
|
|
|
|
|
|
|
|
CheckBox aTextStyleCB;
|
|
|
|
CheckBox aFrameStyleCB;
|
|
|
|
CheckBox aPageStyleCB;
|
|
|
|
CheckBox aNumStyleCB;
|
|
|
|
CheckBox aMergeStyleCB;
|
|
|
|
PushButton aLoadFilePB;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
OKButton aOkBt;
|
|
|
|
CancelButton aCancelBt;
|
|
|
|
HelpButton aHelpBt;
|
|
|
|
MoreButton* pMoreBt;
|
|
|
|
Timer aPrevTimer;
|
|
|
|
String aNone;
|
2001-06-18 10:21:24 +00:00
|
|
|
String sLoadTemplate;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_uInt16 nFlags;
|
2000-09-18 16:07:07 +00:00
|
|
|
SfxDocumentTemplates aTemplates;
|
|
|
|
SfxObjectShellLock xDocShell;
|
|
|
|
SfxNewFileDialog* pAntiImpl;
|
|
|
|
|
|
|
|
void ClearInfo();
|
|
|
|
DECL_LINK( Update, void * );
|
|
|
|
|
|
|
|
DECL_LINK( RegionSelect, ListBox * );
|
|
|
|
DECL_LINK( TemplateSelect, ListBox * );
|
|
|
|
DECL_LINK( DoubleClick, ListBox * );
|
|
|
|
void TogglePreview(CheckBox *);
|
|
|
|
DECL_LINK( Expand, MoreButton * );
|
|
|
|
DECL_LINK( PreviewClick, CheckBox * );
|
2001-06-18 10:21:24 +00:00
|
|
|
DECL_LINK( LoadFile, PushButton* );
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_uInt16 GetSelectedTemplatePos() const;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2011-01-07 17:14:47 +01:00
|
|
|
SfxNewFileDialog_Impl( SfxNewFileDialog* pAntiImplP, sal_uInt16 nFlags );
|
2000-09-18 16:07:07 +00:00
|
|
|
~SfxNewFileDialog_Impl();
|
|
|
|
|
2011-03-18 15:49:47 +01:00
|
|
|
// Returns sal_False if '- No -' is set as a template
|
2011-03-10 18:00:38 +05:30
|
|
|
// Template name can only be obtained if IsTemplate() is TRUE
|
2000-09-18 16:07:07 +00:00
|
|
|
// erfragt werden
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_Bool IsTemplate() const;
|
2000-09-18 16:07:07 +00:00
|
|
|
String GetTemplateRegion() const;
|
|
|
|
String GetTemplateName() const;
|
|
|
|
String GetTemplateFileName() const;
|
2001-06-18 10:21:24 +00:00
|
|
|
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_uInt16 GetTemplateFlags()const;
|
|
|
|
void SetTemplateFlags(sal_uInt16 nSet);
|
2000-09-18 16:07:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SfxNewFileDialog_Impl::ClearInfo()
|
|
|
|
{
|
|
|
|
const String aNo;
|
|
|
|
aTitleEd.SetText(aNo);
|
|
|
|
aThemaEd.SetText(aNo);
|
|
|
|
aKeywordsEd.SetText(aNo);
|
|
|
|
aDescEd.SetText(aNo);
|
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
IMPL_LINK( SfxNewFileDialog_Impl, Update, void *, EMPTYARG )
|
|
|
|
{
|
|
|
|
if ( xDocShell.Is() )
|
|
|
|
{
|
|
|
|
if ( xDocShell->GetProgress() )
|
2011-01-07 17:14:47 +01:00
|
|
|
return sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
xDocShell.Clear();
|
|
|
|
}
|
|
|
|
|
2011-01-07 17:14:47 +01:00
|
|
|
const sal_uInt16 nEntry = GetSelectedTemplatePos();
|
2000-09-18 16:07:07 +00:00
|
|
|
if(!nEntry)
|
|
|
|
{
|
|
|
|
ClearInfo();
|
|
|
|
aPreviewWin.Invalidate();
|
|
|
|
aPreviewWin.SetObjectShell( 0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( aPreviewBtn.IsChecked() && (nFlags & SFXWB_PREVIEW) == SFXWB_PREVIEW)
|
|
|
|
{
|
|
|
|
|
|
|
|
String aFileName = aTemplates.GetPath( aRegionLb.GetSelectEntryPos(), nEntry-1);
|
2000-11-16 14:59:14 +00:00
|
|
|
INetURLObject aTestObj( aFileName );
|
|
|
|
if( aTestObj.GetProtocol() == INET_PROT_NOT_VALID )
|
|
|
|
{
|
|
|
|
// temp. fix until Templates are managed by UCB compatible service
|
|
|
|
// does NOT work with locally cached components !
|
|
|
|
String aTemp;
|
|
|
|
utl::LocalFileHelper::ConvertPhysicalNameToURL( aFileName, aTemp );
|
|
|
|
aFileName = aTemp;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-11-16 14:59:14 +00:00
|
|
|
INetURLObject aObj( aFileName );
|
2000-09-18 16:07:07 +00:00
|
|
|
for ( SfxObjectShell* pTmp = SfxObjectShell::GetFirst();
|
|
|
|
pTmp;
|
|
|
|
pTmp = SfxObjectShell::GetNext(*pTmp) )
|
|
|
|
{
|
|
|
|
//! fsys bug op==
|
|
|
|
if ( pTmp->GetMedium())
|
|
|
|
// ??? HasName() MM
|
2000-11-16 14:59:14 +00:00
|
|
|
if( INetURLObject( pTmp->GetMedium()->GetName() ) == aObj )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
xDocShell = pTmp;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !xDocShell.Is() )
|
|
|
|
{
|
|
|
|
Window *pParent = Application::GetDefDialogParent();
|
|
|
|
Application::SetDefDialogParent( pAntiImpl );
|
|
|
|
SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,pAntiImpl);
|
|
|
|
SfxApplication *pSfxApp = SFX_APP();
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_uIntPtr lErr;
|
2000-09-18 16:07:07 +00:00
|
|
|
SfxItemSet* pSet = new SfxAllItemSet( pSfxApp->GetPool() );
|
2011-01-07 17:14:47 +01:00
|
|
|
pSet->Put( SfxBoolItem( SID_TEMPLATE, sal_True ) );
|
|
|
|
pSet->Put( SfxBoolItem( SID_PREVIEW, sal_True ) );
|
|
|
|
lErr = pSfxApp->LoadTemplate( xDocShell, aFileName, sal_True, pSet );
|
2004-09-08 14:42:45 +00:00
|
|
|
if( lErr )
|
2000-09-18 16:07:07 +00:00
|
|
|
ErrorHandler::HandleError(lErr);
|
|
|
|
Application::SetDefDialogParent( pParent );
|
|
|
|
if ( !xDocShell.Is() )
|
|
|
|
{
|
|
|
|
aPreviewWin.SetObjectShell( 0 );
|
2011-01-07 17:14:47 +01:00
|
|
|
return sal_False;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aPreviewWin.SetObjectShell( xDocShell );
|
|
|
|
}
|
2011-01-07 17:14:47 +01:00
|
|
|
return sal_True;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
IMPL_LINK( SfxNewFileDialog_Impl, RegionSelect, ListBox *, pBox )
|
|
|
|
{
|
|
|
|
if ( xDocShell.Is() && xDocShell->GetProgress() )
|
|
|
|
return 0;
|
|
|
|
|
2011-01-07 17:14:47 +01:00
|
|
|
const sal_uInt16 nRegion = pBox->GetSelectEntryPos();
|
|
|
|
const sal_uInt16 nCount = aTemplates.GetRegionCount()? aTemplates.GetCount(nRegion): 0;
|
|
|
|
aTemplateLb.SetUpdateMode(sal_False);
|
2000-09-18 16:07:07 +00:00
|
|
|
aTemplateLb.Clear();
|
|
|
|
String aSel=aRegionLb.GetSelectEntry();
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_uInt16 nc=aSel.Search('(');
|
2000-09-18 16:07:07 +00:00
|
|
|
if (nc-1&&nc!=STRING_NOTFOUND)
|
|
|
|
aSel.Erase(nc-1);
|
|
|
|
if (aSel.CompareIgnoreCaseToAscii( String(SfxResId(STR_STANDARD)) )==COMPARE_EQUAL)
|
|
|
|
aTemplateLb.InsertEntry(aNone);
|
2011-01-07 17:14:47 +01:00
|
|
|
for (sal_uInt16 i = 0; i < nCount; ++i)
|
2000-09-18 16:07:07 +00:00
|
|
|
aTemplateLb.InsertEntry(aTemplates.GetName(nRegion, i));
|
|
|
|
aTemplateLb.SelectEntryPos(0);
|
2011-01-07 17:14:47 +01:00
|
|
|
aTemplateLb.SetUpdateMode(sal_True);
|
2000-09-18 16:07:07 +00:00
|
|
|
aTemplateLb.Invalidate();
|
|
|
|
aTemplateLb.Update();
|
2011-08-06 18:51:52 +02:00
|
|
|
TemplateSelect(&aTemplateLb);
|
2000-09-18 16:07:07 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2006-06-19 21:28:46 +00:00
|
|
|
IMPL_LINK_INLINE_START( SfxNewFileDialog_Impl, Expand, MoreButton *, EMPTYARG )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
TemplateSelect(&aTemplateLb);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
IMPL_LINK_INLINE_END( SfxNewFileDialog_Impl, Expand, MoreButton *, pMoreButton )
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
IMPL_LINK( SfxNewFileDialog_Impl, PreviewClick, CheckBox *, pBox )
|
|
|
|
{
|
|
|
|
if ( xDocShell.Is() && xDocShell->GetProgress() )
|
|
|
|
return 0;
|
|
|
|
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_uInt16 nEntry = GetSelectedTemplatePos();
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( nEntry && pBox->IsChecked() )
|
|
|
|
{
|
|
|
|
if(!Update(0))
|
|
|
|
aPreviewWin.Invalidate();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (xDocShell.Is())
|
|
|
|
xDocShell.Clear();
|
|
|
|
aPreviewWin.SetObjectShell( 0 );
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2006-06-19 21:28:46 +00:00
|
|
|
IMPL_LINK( SfxNewFileDialog_Impl, TemplateSelect, ListBox *, EMPTYARG )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-03-10 18:00:38 +05:30
|
|
|
// Still loading
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( xDocShell && xDocShell->GetProgress() )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if ( !MORE_BTN(GetState()) )
|
2011-03-10 18:00:38 +05:30
|
|
|
// Dialog is not opened
|
2000-09-18 16:07:07 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
aPrevTimer.Start();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
IMPL_LINK_INLINE_START( SfxNewFileDialog_Impl, DoubleClick, ListBox *, pListBox )
|
|
|
|
{
|
2006-06-19 21:28:46 +00:00
|
|
|
(void)pListBox;
|
2011-03-10 18:00:38 +05:30
|
|
|
// Still loadning
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !xDocShell.Is() || !xDocShell->GetProgress() )
|
|
|
|
pAntiImpl->EndDialog(RET_OK);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
IMPL_LINK_INLINE_END( SfxNewFileDialog_Impl, DoubleClick, ListBox *, pListBox )
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2001-06-18 10:21:24 +00:00
|
|
|
IMPL_LINK_INLINE_START( SfxNewFileDialog_Impl, LoadFile, PushButton *, EMPTYARG )
|
|
|
|
{
|
|
|
|
pAntiImpl->EndDialog(RET_TEMPLATE_LOAD);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
IMPL_LINK_INLINE_END( SfxNewFileDialog_Impl, LoadFile, PushButton *, EMPTYARG )
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_uInt16 SfxNewFileDialog_Impl::GetSelectedTemplatePos() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_uInt16 nEntry=aTemplateLb.GetSelectEntryPos();
|
2000-09-18 16:07:07 +00:00
|
|
|
String aSel=aRegionLb.GetSelectEntry().Copy();
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_uInt16 nc=aSel.Search('(');
|
2000-09-18 16:07:07 +00:00
|
|
|
if (nc-1&&nc!=STRING_NOTFOUND)
|
|
|
|
aSel.Erase(nc-1);
|
|
|
|
if (aSel.CompareIgnoreCaseToAscii(String(SfxResId(STR_STANDARD)))!=COMPARE_EQUAL)
|
|
|
|
nEntry++;
|
|
|
|
if (!aTemplateLb.GetSelectEntryCount())
|
|
|
|
nEntry=0;
|
|
|
|
return nEntry;
|
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_Bool SfxNewFileDialog_Impl::IsTemplate() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return GetSelectedTemplatePos()!=0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
String SfxNewFileDialog_Impl::GetTemplateFileName() const
|
|
|
|
{
|
|
|
|
if(!IsTemplate() || !aTemplates.GetRegionCount())
|
|
|
|
return String();
|
|
|
|
return aTemplates.GetPath(aRegionLb.GetSelectEntryPos(),
|
|
|
|
GetSelectedTemplatePos()-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
String SfxNewFileDialog_Impl::GetTemplateRegion() const
|
|
|
|
{
|
|
|
|
if(!IsTemplate() || !aTemplates.GetRegionCount())
|
|
|
|
return String();
|
|
|
|
return aRegionLb.GetSelectEntry();
|
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
String SfxNewFileDialog_Impl::GetTemplateName() const
|
|
|
|
{
|
|
|
|
if(!IsTemplate() || !aTemplates.GetRegionCount())
|
|
|
|
return String();
|
|
|
|
return aTemplateLb.GetSelectEntry();
|
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void AdjustPosSize_Impl(Window *pWin, short nMoveOffset, short nSizeOffset)
|
|
|
|
{
|
|
|
|
Point aPos(pWin->GetPosPixel());
|
|
|
|
Size aSize(pWin->GetSizePixel());
|
|
|
|
aPos.X() -= nMoveOffset;
|
|
|
|
aSize.Width() += nSizeOffset;
|
|
|
|
pWin->SetPosSizePixel(aPos, aSize);
|
|
|
|
}
|
2001-06-18 10:21:24 +00:00
|
|
|
//-------------------------------------------------------------------------
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_uInt16 SfxNewFileDialog_Impl::GetTemplateFlags()const
|
2001-06-18 10:21:24 +00:00
|
|
|
{
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_uInt16 nRet = aTextStyleCB.IsChecked() ? SFX_LOAD_TEXT_STYLES : 0;
|
2001-06-18 10:21:24 +00:00
|
|
|
if(aFrameStyleCB.IsChecked())
|
|
|
|
nRet |= SFX_LOAD_FRAME_STYLES;
|
|
|
|
if(aPageStyleCB.IsChecked())
|
|
|
|
nRet |= SFX_LOAD_PAGE_STYLES;
|
|
|
|
if(aNumStyleCB.IsChecked())
|
|
|
|
nRet |= SFX_LOAD_NUM_STYLES;
|
|
|
|
if(aMergeStyleCB.IsChecked())
|
|
|
|
nRet |= SFX_MERGE_STYLES;
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
2011-01-07 17:14:47 +01:00
|
|
|
void SfxNewFileDialog_Impl::SetTemplateFlags(sal_uInt16 nSet)
|
2001-06-18 10:21:24 +00:00
|
|
|
{
|
|
|
|
aTextStyleCB.Check( 0 != (nSet&SFX_LOAD_TEXT_STYLES ));
|
|
|
|
aFrameStyleCB.Check( 0 != (nSet&SFX_LOAD_FRAME_STYLES));
|
|
|
|
aPageStyleCB.Check( 0 != (nSet&SFX_LOAD_PAGE_STYLES ));
|
|
|
|
aNumStyleCB.Check( 0 != (nSet&SFX_LOAD_NUM_STYLES ));
|
|
|
|
aMergeStyleCB.Check( 0 != (nSet&SFX_MERGE_STYLES ));
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
SfxNewFileDialog_Impl::SfxNewFileDialog_Impl(
|
2011-01-07 17:14:47 +01:00
|
|
|
SfxNewFileDialog* pAntiImplP, sal_uInt16 nFl)
|
2007-04-26 09:14:08 +00:00
|
|
|
: aRegionFt( pAntiImplP, SfxResId( FT_REGION ) ),
|
|
|
|
aRegionLb( pAntiImplP, SfxResId( LB_REGION ) ),
|
|
|
|
aTemplateFt( pAntiImplP, SfxResId( FT_TEMPLATE ) ),
|
|
|
|
aTemplateLb( pAntiImplP, SfxResId( LB_TEMPLATE ) ),
|
|
|
|
aPreviewBtn( pAntiImplP, SfxResId( BTN_PREVIEW ) ),
|
|
|
|
aPreviewWin( pAntiImplP, SfxResId( WIN_PREVIEW ) ),
|
|
|
|
aTitleFt( pAntiImplP, SfxResId( FT_TITLE ) ),
|
|
|
|
aTitleEd( pAntiImplP, SfxResId( ED_TITLE ) ),
|
|
|
|
aThemaFt( pAntiImplP, SfxResId( FT_THEMA ) ),
|
|
|
|
aThemaEd( pAntiImplP, SfxResId( ED_THEMA ) ),
|
|
|
|
aKeywordsFt( pAntiImplP, SfxResId( FT_KEYWORDS ) ),
|
|
|
|
aKeywordsEd( pAntiImplP, SfxResId( ED_KEYWORDS ) ),
|
|
|
|
aDescFt( pAntiImplP, SfxResId( FT_DESC ) ),
|
|
|
|
aDescEd( pAntiImplP, SfxResId( ED_DESC ) ),
|
|
|
|
aDocinfoGb( pAntiImplP, SfxResId( GB_DOCINFO ) ),
|
|
|
|
aTextStyleCB( pAntiImplP, SfxResId( CB_TEXT_STYLE )),
|
|
|
|
aFrameStyleCB( pAntiImplP, SfxResId( CB_FRAME_STYLE )),
|
|
|
|
aPageStyleCB( pAntiImplP, SfxResId( CB_PAGE_STYLE )),
|
|
|
|
aNumStyleCB( pAntiImplP, SfxResId( CB_NUM_STYLE )),
|
|
|
|
aMergeStyleCB( pAntiImplP, SfxResId( CB_MERGE_STYLE )),
|
|
|
|
aLoadFilePB( pAntiImplP, SfxResId( PB_LOAD_FILE )),
|
|
|
|
aOkBt( pAntiImplP, SfxResId( BT_OK ) ),
|
|
|
|
aCancelBt( pAntiImplP, SfxResId( BT_CANCEL ) ),
|
|
|
|
aHelpBt( pAntiImplP, SfxResId( BT_HELP ) ),
|
|
|
|
pMoreBt( new MoreButton( pAntiImplP, SfxResId( BT_MORE ) ) ),
|
|
|
|
aNone( SfxResId(STR_NONE) ),
|
|
|
|
sLoadTemplate( SfxResId(STR_LOAD_TEMPLATE)),
|
2000-09-18 16:07:07 +00:00
|
|
|
nFlags(nFl),
|
|
|
|
pAntiImpl( pAntiImplP )
|
|
|
|
{
|
|
|
|
short nMoveOffset = *(short *)pAntiImplP->GetClassRes();
|
|
|
|
pAntiImplP->IncrementRes(sizeof(short));
|
|
|
|
short nExpandSize= *(short *)pAntiImplP->GetClassRes();
|
|
|
|
pAntiImplP->IncrementRes(sizeof(short));
|
|
|
|
pAntiImplP->FreeResource();
|
|
|
|
|
|
|
|
if (!nFlags)
|
|
|
|
MORE_BTN(Hide());
|
2001-06-18 10:21:24 +00:00
|
|
|
else if(SFXWB_LOAD_TEMPLATE == nFlags)
|
|
|
|
{
|
|
|
|
aLoadFilePB.SetClickHdl(LINK(this, SfxNewFileDialog_Impl, LoadFile));
|
|
|
|
aLoadFilePB.Show();
|
|
|
|
aTextStyleCB.Show();
|
|
|
|
aFrameStyleCB.Show();
|
|
|
|
aPageStyleCB.Show();
|
|
|
|
aNumStyleCB.Show();
|
|
|
|
aMergeStyleCB.Show();
|
|
|
|
Size aSize(pAntiImplP->GetOutputSizePixel());
|
|
|
|
Size aTmp(pAntiImplP->LogicToPixel(Size(16, 16), MAP_APPFONT));
|
|
|
|
aSize.Height() += aTmp.Height();
|
|
|
|
pAntiImplP->SetOutputSizePixel(aSize);
|
|
|
|
pMoreBt->Hide();
|
|
|
|
aTextStyleCB.Check();
|
|
|
|
pAntiImplP->SetText(sLoadTemplate);
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
MORE_BTN(SetClickHdl(LINK(this, SfxNewFileDialog_Impl, Expand)));
|
|
|
|
if((nFlags & SFXWB_PREVIEW) == SFXWB_PREVIEW)
|
|
|
|
{
|
|
|
|
MORE_BTN(AddWindow(&aPreviewBtn));
|
|
|
|
MORE_BTN(AddWindow(&aPreviewWin));
|
|
|
|
aPreviewBtn.SetClickHdl(LINK(this, SfxNewFileDialog_Impl, PreviewClick));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aPreviewBtn.Hide();
|
|
|
|
aPreviewWin.Hide();
|
|
|
|
nMoveOffset = (short)pAntiImplP->LogicToPixel(
|
|
|
|
Size(nMoveOffset, nMoveOffset), MAP_APPFONT).Width();
|
|
|
|
nExpandSize = (short)pAntiImplP->LogicToPixel(
|
|
|
|
Size(nExpandSize, nExpandSize), MAP_APPFONT).Width();
|
|
|
|
AdjustPosSize_Impl(&aTitleFt, nMoveOffset, 0);
|
|
|
|
AdjustPosSize_Impl(&aTitleEd, nMoveOffset, nExpandSize);
|
|
|
|
AdjustPosSize_Impl(&aThemaFt, nMoveOffset, 0);
|
|
|
|
AdjustPosSize_Impl(&aThemaEd, nMoveOffset, nExpandSize);
|
|
|
|
AdjustPosSize_Impl(&aKeywordsFt, nMoveOffset, 0);
|
|
|
|
AdjustPosSize_Impl(&aKeywordsEd, nMoveOffset, nExpandSize);
|
|
|
|
AdjustPosSize_Impl(&aDescFt , nMoveOffset, 0);
|
|
|
|
AdjustPosSize_Impl(&aDescEd , nMoveOffset, nExpandSize);
|
|
|
|
AdjustPosSize_Impl(&aDocinfoGb, nMoveOffset, nExpandSize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
String &rExtra = pAntiImplP->GetExtraData();
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_uInt16 nTokCount = rExtra.GetTokenCount( '|' );
|
2000-09-18 16:07:07 +00:00
|
|
|
if( nTokCount > 0 && nFlags )
|
|
|
|
MORE_BTN(SetState( rExtra.GetToken( 0, '|' ) == 'Y' ));
|
|
|
|
if( nTokCount > 1 && nFlags )
|
|
|
|
aPreviewBtn.Check( rExtra.GetToken( 1 ,'|' ) == 'Y' );
|
|
|
|
|
2011-08-06 18:51:52 +02:00
|
|
|
aTemplateLb.SetSelectHdl(LINK(this, SfxNewFileDialog_Impl, TemplateSelect));
|
2000-09-18 16:07:07 +00:00
|
|
|
aTemplateLb.SetDoubleClickHdl(LINK(this, SfxNewFileDialog_Impl, DoubleClick));
|
2001-12-06 12:42:19 +00:00
|
|
|
|
|
|
|
// update the template configuration if necessary
|
|
|
|
{
|
|
|
|
WaitObject aWaitCursor( pAntiImplP->GetParent() );
|
|
|
|
aTemplates.Update( sal_True /* be smart */ );
|
|
|
|
}
|
|
|
|
// fill the list boxes
|
2011-01-07 17:14:47 +01:00
|
|
|
const sal_uInt16 nCount = aTemplates.GetRegionCount();
|
2000-09-18 16:07:07 +00:00
|
|
|
if (nCount)
|
|
|
|
{
|
2011-01-07 17:14:47 +01:00
|
|
|
for(sal_uInt16 i = 0; i < nCount; ++i)
|
2000-09-18 16:07:07 +00:00
|
|
|
aRegionLb.InsertEntry(aTemplates.GetFullRegionName(i));
|
|
|
|
aRegionLb.SetSelectHdl(LINK(this, SfxNewFileDialog_Impl, RegionSelect));
|
|
|
|
}
|
|
|
|
|
|
|
|
aPrevTimer.SetTimeout( 500 );
|
|
|
|
aPrevTimer.SetTimeoutHdl( LINK( this, SfxNewFileDialog_Impl, Update));
|
|
|
|
|
|
|
|
aRegionLb.SelectEntryPos(0);
|
|
|
|
RegionSelect(&aRegionLb);
|
|
|
|
}
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
SfxNewFileDialog_Impl::~SfxNewFileDialog_Impl()
|
|
|
|
{
|
|
|
|
String &rExtra = pAntiImpl->GetExtraData();
|
|
|
|
rExtra = MORE_BTN(GetState()) ? 'Y' : 'N';
|
|
|
|
rExtra += '|';
|
|
|
|
rExtra += aPreviewBtn.IsChecked() ? 'Y' : 'N';
|
|
|
|
|
|
|
|
delete pMoreBt;
|
|
|
|
}
|
2001-06-18 10:21:24 +00:00
|
|
|
//-------------------------------------------------------------------------
|
2011-01-07 17:14:47 +01:00
|
|
|
SfxNewFileDialog::SfxNewFileDialog(Window *pParent, sal_uInt16 nFlags)
|
2000-09-18 16:07:07 +00:00
|
|
|
: SfxModalDialog( pParent, SfxResId( DLG_NEW_FILE ) )
|
|
|
|
{
|
|
|
|
pImpl = new SfxNewFileDialog_Impl( this, nFlags );
|
|
|
|
}
|
2001-06-18 10:21:24 +00:00
|
|
|
//-------------------------------------------------------------------------
|
2000-09-18 16:07:07 +00:00
|
|
|
SfxNewFileDialog::~SfxNewFileDialog()
|
|
|
|
{
|
|
|
|
delete pImpl;
|
|
|
|
}
|
2001-06-18 10:21:24 +00:00
|
|
|
//-------------------------------------------------------------------------
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_Bool SfxNewFileDialog::IsTemplate() const
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return pImpl->IsTemplate();
|
|
|
|
}
|
2001-06-18 10:21:24 +00:00
|
|
|
//-------------------------------------------------------------------------
|
2000-09-18 16:07:07 +00:00
|
|
|
String SfxNewFileDialog::GetTemplateRegion() const
|
|
|
|
{
|
|
|
|
return pImpl->GetTemplateRegion();
|
|
|
|
}
|
2001-06-18 10:21:24 +00:00
|
|
|
//-------------------------------------------------------------------------
|
2000-09-18 16:07:07 +00:00
|
|
|
String SfxNewFileDialog::GetTemplateName() const
|
|
|
|
{
|
|
|
|
return pImpl->GetTemplateName();
|
|
|
|
}
|
2001-06-18 10:21:24 +00:00
|
|
|
//-------------------------------------------------------------------------
|
2000-09-18 16:07:07 +00:00
|
|
|
String SfxNewFileDialog::GetTemplateFileName() const
|
|
|
|
{
|
|
|
|
return pImpl->GetTemplateFileName();
|
|
|
|
}
|
2001-06-18 10:21:24 +00:00
|
|
|
//-------------------------------------------------------------------------
|
2011-01-07 17:14:47 +01:00
|
|
|
sal_uInt16 SfxNewFileDialog::GetTemplateFlags()const
|
2001-06-18 10:21:24 +00:00
|
|
|
{
|
|
|
|
return pImpl->GetTemplateFlags();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-06-18 10:21:24 +00:00
|
|
|
}
|
|
|
|
//-------------------------------------------------------------------------
|
2011-01-07 17:14:47 +01:00
|
|
|
void SfxNewFileDialog::SetTemplateFlags(sal_uInt16 nSet)
|
2001-06-18 10:21:24 +00:00
|
|
|
{
|
|
|
|
pImpl->SetTemplateFlags(nSet);
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|