1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: basdoc.cxx,v $
10 * $Revision: 1.21.22.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_basctl.hxx"
35 #include <ide_pch.hxx>
38 #define GLOBALOVERFLOW2
40 #include <sfx2/docfac.hxx>
41 #include <vcl/status.hxx>
43 #include <svx/xmlsecctrl.hxx>
48 #include <basslots.hxx>
50 #include "basicmod.hxx"
51 #include "unomodel.hxx"
53 TYPEINIT1(BasicDocShell
, SfxObjectShell
);
54 DBG_NAME(BasicDocShell
);
56 SFX_IMPL_OBJECTFACTORY( BasicDocShell
, SvGlobalName(), SFXOBJECTSHELL_STD_NORMAL
, "sbasic" )
58 SFX_IMPL_INTERFACE( BasicDocShell
, SfxObjectShell
, IDEResId( 0 ) )
60 SFX_STATUSBAR_REGISTRATION( IDEResId( SID_BASICIDE_STATUSBAR
) );
63 BasicDocShell::BasicDocShell( SfxObjectCreateMode eMode
) : SfxObjectShell( eMode
)
66 SetPool( &SFX_APP()->GetPool() );
68 SetModel( new SIDEModel(this) );
71 __EXPORT
BasicDocShell::~BasicDocShell()
76 SfxPrinter
* BasicDocShell::GetPrinter( BOOL bCreate
)
78 if ( !pPrinter
&& bCreate
)
79 pPrinter
= new SfxPrinter( new SfxItemSet( GetPool(), SID_PRINTER_NOTFOUND_WARN
, SID_PRINTER_NOTFOUND_WARN
) );
84 void BasicDocShell::SetPrinter( SfxPrinter
* pPr
)
86 if ( pPr
!= pPrinter
)
93 void BasicDocShell::FillStatusBar( StatusBar
& rStatusBar
)
99 rStatusBar
.InsertItem( SID_BASICIDE_STAT_TITLE
,
100 rStatusBar
.GetTextWidth( aTmp
), SIB_AUTOSIZE
| SIB_LEFT
);
103 rStatusBar
.InsertItem( SID_DOC_MODIFIED
,
104 rStatusBar
.GetTextWidth( '*' ) );
107 rStatusBar
.InsertItem( SID_SIGNATURE
, XmlSecStatusBarControl::GetDefItemWidth( rStatusBar
), SIB_USERDRAW
);
108 rStatusBar
.SetHelpId(SID_SIGNATURE
, SID_SIGNATURE
);
112 aTmp
.Fill( 15, 'X' );
113 rStatusBar
.InsertItem( SID_BASICIDE_STAT_POS
,
114 rStatusBar
.GetTextWidth( aTmp
), SIB_LEFT
);
117 rStatusBar
.InsertItem( SID_ATTR_INSERT
,
118 rStatusBar
.GetTextWidth( String( RTL_CONSTASCII_USTRINGPARAM( "XXXXX" /* "EINFG" */ ) ) ) );
121 aTmp
.Fill( 20, 'X' );
122 rStatusBar
.InsertItem( SID_ATTR_SIZE
,
123 rStatusBar
.GetTextWidth( aTmp
), SIB_AUTOSIZE
| SIB_LEFT
| SIB_USERDRAW
);
125 // return pStatusBar;
129 void BasicDocShell::FillClass( SvGlobalName
*, sal_uInt32
*, String
*, String
*, String
*, sal_Int32
, sal_Bool bTemplate
) const
132 DBG_ASSERT( bTemplate
== sal_False
, "No template for Basic" );
135 void BasicDocShell::Draw( OutputDevice
*, const JobSetup
&, USHORT
)