1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef FRAMEWORK_BACKINGWINDOW_HXX
29 #define FRAMEWORK_BACKINGWINDOW_HXX
31 #include "rtl/ustring.hxx"
33 #include "vcl/button.hxx"
34 #include "vcl/menubtn.hxx"
35 #include "vcl/fixed.hxx"
36 #include "vcl/bitmapex.hxx"
37 #include "vcl/toolbox.hxx"
39 #include "unotools/moduleoptions.hxx"
40 #include "svtools/acceleratorexecute.hxx"
42 #include "com/sun/star/frame/XDispatchProvider.hpp"
43 #include "com/sun/star/frame/XDesktop.hpp"
44 #include "com/sun/star/frame/XFrame.hpp"
45 #include "com/sun/star/frame/XTerminateListener.hpp"
46 #include "com/sun/star/document/XEventListener.hpp"
47 #include "com/sun/star/document/XEventBroadcaster.hpp"
48 #include "com/sun/star/util/XURLTransformer.hpp"
49 #include "com/sun/star/ui/dialogs/XFilePicker.hpp"
50 #include "com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp"
51 #include "com/sun/star/ui/dialogs/XFilterManager.hpp"
52 #include "com/sun/star/ui/dialogs/XFolderPicker.hpp"
53 #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
54 #include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp"
58 class MnemonicGenerator
;
62 // To get the transparent mouse-over look, the closer is actually a toolbox
63 // overload DataChange to handle style changes correctly
64 class DecoToolBox
: public ToolBox
68 using Window::ImplInit
;
70 DecoToolBox( Window
* pParent
, WinBits nStyle
= 0 );
71 DecoToolBox( Window
* pParent
, const ResId
& rResId
);
73 void DataChanged( const DataChangedEvent
& rDCEvt
);
79 class BackingWindow
: public Window
83 rtl::OUString aTargetURL
;
84 com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
> aArgSeq
;
87 com::sun::star::uno::Reference
<com::sun::star::frame::XDesktop
> mxDesktop
;
88 com::sun::star::uno::Reference
<com::sun::star::frame::XDispatchProvider
> mxDesktopDispatchProvider
;
89 com::sun::star::uno::Reference
<com::sun::star::frame::XFrame
> mxFrame
;
90 com::sun::star::uno::Reference
<com::sun::star::document::XEventBroadcaster
> mxBroadcaster
;
96 ImageButton maWriterButton
;
97 ImageButton maCalcButton
;
98 ImageButton maImpressButton
;
99 MenuButton maOpenButton
;
100 ImageButton maDrawButton
;
101 ImageButton maDBButton
;
102 ImageButton maMathButton
;
103 ImageButton maTemplateButton
;
105 DecoToolBox maToolbox
;
107 BitmapEx maBackgroundLeft
;
108 BitmapEx maBackgroundMiddle
;
109 BitmapEx maBackgroundRight
;
111 String maWelcomeString
;
112 String maProductString
;
113 String maCreateString
;
115 String maTemplateString
;
118 Rectangle maControlRect
;
120 long mnColumnWidth
[2];
121 long mnTextColumnWidth
[2];
122 Color maLabelTextColor
;
123 Color maWelcomeTextColor
;
125 Size maButtonImageSize
;
128 sal_Int32 mnLayoutStyle
;
129 svt::AcceleratorExecute
* mpAccExec
;
133 PopupMenu
* mpRecentMenu
;
134 std::vector
< LoadRecentFile
> maRecentFiles
;
136 static const int nItemId_Extensions
= 1;
137 static const int nItemId_Reg
= 2;
138 static const int nItemId_Info
= 3;
139 static const int nItemId_TplRep
= 4;
140 static const int nShadowTop
= 32;
141 static const int nShadowLeft
= 35;
142 static const int nShadowRight
= 45;
143 static const int nShadowBottom
= 50;
145 void loadImage( const ResId
& i_rId
, PushButton
& i_rButton
);
147 void layoutButton( const char* i_pURL
, int nColumn
, const std::set
<rtl::OUString
>& i_rURLS
,
148 SvtModuleOptions
& i_rOpt
, SvtModuleOptions::EModule i_eMod
,
150 MnemonicGenerator
& i_rMnemonicGen
,
151 const String
& i_rStr
= String()
154 void dispatchURL( const rtl::OUString
& i_rURL
,
155 const rtl::OUString
& i_rTarget
= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ),
156 const com::sun::star::uno::Reference
< com::sun::star::frame::XDispatchProvider
>& i_xProv
= com::sun::star::uno::Reference
< com::sun::star::frame::XDispatchProvider
>(),
157 const com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>& = com::sun::star::uno::Sequence
< com::sun::star::beans::PropertyValue
>()
160 DECL_LINK( ClickHdl
, Button
* );
161 DECL_LINK( SelectHdl
, Button
* );
162 DECL_LINK( ActivateHdl
, Button
* );
163 DECL_LINK( ToolboxHdl
, void* );
166 void initBackground();
167 void prepareRecentFileMenu();
169 BackingWindow( Window
* pParent
);
172 virtual void Paint( const Rectangle
& rRect
);
173 virtual void Resize();
174 virtual long Notify( NotifyEvent
& rNEvt
);
175 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
176 virtual void GetFocus();
178 void setOwningFrame( const com::sun::star::uno::Reference
< com::sun::star::frame::XFrame
>& xFrame
);