xref: /AOO41X/main/framework/source/services/backingwindow.hxx (revision d2bdf2d6a5e40ac28401a0a6c7c2d6ad2a76a0c7)
1f8e07b45SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3f8e07b45SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4f8e07b45SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5f8e07b45SAndrew Rist  * distributed with this work for additional information
6f8e07b45SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7f8e07b45SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8f8e07b45SAndrew Rist  * "License"); you may not use this file except in compliance
9f8e07b45SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11f8e07b45SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13f8e07b45SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14f8e07b45SAndrew Rist  * software distributed under the License is distributed on an
15f8e07b45SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16f8e07b45SAndrew Rist  * KIND, either express or implied.  See the License for the
17f8e07b45SAndrew Rist  * specific language governing permissions and limitations
18f8e07b45SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20f8e07b45SAndrew Rist  *************************************************************/
21f8e07b45SAndrew Rist 
22cdf0e10cSrcweir #ifndef FRAMEWORK_BACKINGWINDOW_HXX
23cdf0e10cSrcweir #define FRAMEWORK_BACKINGWINDOW_HXX
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include "rtl/ustring.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "vcl/button.hxx"
28cdf0e10cSrcweir #include "vcl/menubtn.hxx"
29cdf0e10cSrcweir #include "vcl/fixed.hxx"
30cdf0e10cSrcweir #include "vcl/bitmapex.hxx"
31cdf0e10cSrcweir #include "vcl/toolbox.hxx"
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include "unotools/moduleoptions.hxx"
34cdf0e10cSrcweir #include "svtools/acceleratorexecute.hxx"
35cdf0e10cSrcweir 
36f7882915SAriel Constenla-Haile #include <com/sun/star/uno/XComponentContext.hpp>
37f7882915SAriel Constenla-Haile #include <com/sun/star/frame/XUIControllerFactory.hpp>
38f7882915SAriel Constenla-Haile #include <com/sun/star/frame/XPopupMenuController.hpp>
39f7882915SAriel Constenla-Haile #include <com/sun/star/awt/XPopupMenu.hpp>
40cdf0e10cSrcweir #include "com/sun/star/frame/XDispatchProvider.hpp"
41cdf0e10cSrcweir #include "com/sun/star/frame/XDesktop.hpp"
42cdf0e10cSrcweir #include "com/sun/star/frame/XFrame.hpp"
43cdf0e10cSrcweir #include "com/sun/star/frame/XTerminateListener.hpp"
44cdf0e10cSrcweir #include "com/sun/star/document/XEventListener.hpp"
45cdf0e10cSrcweir #include "com/sun/star/document/XEventBroadcaster.hpp"
46cdf0e10cSrcweir #include "com/sun/star/util/XURLTransformer.hpp"
47cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/XFilePicker.hpp"
48cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp"
49cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/XFilterManager.hpp"
50cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/XFolderPicker.hpp"
51cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
52cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp"
53cdf0e10cSrcweir 
54cdf0e10cSrcweir #include <set>
55cdf0e10cSrcweir 
56cdf0e10cSrcweir class MnemonicGenerator;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir namespace framework
59cdf0e10cSrcweir {
60cdf0e10cSrcweir 	// To get the transparent mouse-over look, the closer is actually a toolbox
61cdf0e10cSrcweir 	// overload DataChange to handle style changes correctly
62cdf0e10cSrcweir 	class DecoToolBox : public ToolBox
63cdf0e10cSrcweir 	{
64cdf0e10cSrcweir 		Size maMinSize;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 		using Window::ImplInit;
67cdf0e10cSrcweir 	public:
68cdf0e10cSrcweir 				DecoToolBox( Window* pParent, WinBits nStyle = 0 );
69cdf0e10cSrcweir 				DecoToolBox( Window* pParent, const ResId& rResId );
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 		void	DataChanged( const DataChangedEvent& rDCEvt );
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 		void	calcMinSize();
74cdf0e10cSrcweir 		Size	getMinSize();
75cdf0e10cSrcweir 	};
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	class BackingWindow : public Window
78cdf0e10cSrcweir 	{
79cdf0e10cSrcweir 
80f7882915SAriel Constenla-Haile 		com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >		mxContext;
81cdf0e10cSrcweir 		com::sun::star::uno::Reference<com::sun::star::frame::XDesktop>					mxDesktop;
82cdf0e10cSrcweir 		com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider >		mxDesktopDispatchProvider;
83cdf0e10cSrcweir 		com::sun::star::uno::Reference<com::sun::star::frame::XFrame>					mxFrame;
84f7882915SAriel Constenla-Haile 		com::sun::star::uno::Reference< com::sun::star::frame::XUIControllerFactory >	mxPopupMenuFactory;
85f7882915SAriel Constenla-Haile 		com::sun::star::uno::Reference< com::sun::star::frame::XPopupMenuController >	mxPopupMenuController;
86f7882915SAriel Constenla-Haile 		com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >				mxPopupMenu;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 		FixedText						maWelcome;
89cdf0e10cSrcweir 		Size							maWelcomeSize;
90cdf0e10cSrcweir 		FixedText						maProduct;
91cdf0e10cSrcweir 		Size							maProductSize;
92cdf0e10cSrcweir 		ImageButton						maWriterButton;
93cdf0e10cSrcweir 		ImageButton						maCalcButton;
94cdf0e10cSrcweir 		ImageButton						maImpressButton;
95cdf0e10cSrcweir 		MenuButton						maOpenButton;
96cdf0e10cSrcweir 		ImageButton						maDrawButton;
97cdf0e10cSrcweir 		ImageButton						maDBButton;
98cdf0e10cSrcweir 		ImageButton						maMathButton;
99cdf0e10cSrcweir 		ImageButton						maTemplateButton;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 		DecoToolBox						maToolbox;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 		BitmapEx						maBackgroundLeft;
104cdf0e10cSrcweir 		BitmapEx						maBackgroundMiddle;
105cdf0e10cSrcweir 		BitmapEx						maBackgroundRight;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 		String							maWelcomeString;
108cdf0e10cSrcweir 		String							maProductString;
109cdf0e10cSrcweir 		String							maCreateString;
110cdf0e10cSrcweir 		String							maOpenString;
111cdf0e10cSrcweir 		String							maTemplateString;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 		Font							maTextFont;
114cdf0e10cSrcweir 		Rectangle						maControlRect;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 		long							mnColumnWidth[2];
117cdf0e10cSrcweir 		long							mnTextColumnWidth[2];
118cdf0e10cSrcweir 		Color							maLabelTextColor;
119cdf0e10cSrcweir 		Color							maWelcomeTextColor;
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 		Size							maButtonImageSize;
122cdf0e10cSrcweir 
123cdf0e10cSrcweir 		bool							mbInitControls;
124cdf0e10cSrcweir 		sal_Int32						mnLayoutStyle;
125cdf0e10cSrcweir 		svt::AcceleratorExecute*		mpAccExec;
126cdf0e10cSrcweir 		long							mnBtnPos;
127cdf0e10cSrcweir 		long							mnBtnTop;
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 		static const int nItemId_Extensions = 1;
130d98d5ab2Smseidel //		static const int nItemId_Reg = 2;
131cdf0e10cSrcweir 		static const int nItemId_Info = 3;
132cdf0e10cSrcweir 		static const int nItemId_TplRep = 4;
133cdf0e10cSrcweir 		static const int nShadowTop = 32;
134*d2bdf2d6Smseidel 		static const int nShadowLeft = 32;
135*d2bdf2d6Smseidel 		static const int nShadowRight = 32;
136*d2bdf2d6Smseidel 		static const int nShadowBottom = 32;
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 		void loadImage( const ResId& i_rId, PushButton& i_rButton );
139cdf0e10cSrcweir 
140cdf0e10cSrcweir 		void layoutButton( const char* i_pURL, int nColumn, const std::set<rtl::OUString>& i_rURLS,
141cdf0e10cSrcweir 						   SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod,
142cdf0e10cSrcweir 						   PushButton& i_rBtn,
143cdf0e10cSrcweir 						   MnemonicGenerator& i_rMnemonicGen,
144cdf0e10cSrcweir 						   const String& i_rStr = String()
145cdf0e10cSrcweir 						   );
146cdf0e10cSrcweir 
147cdf0e10cSrcweir 		void dispatchURL( const rtl::OUString& i_rURL,
148cdf0e10cSrcweir 						  const rtl::OUString& i_rTarget = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ),
149cdf0e10cSrcweir 						  const com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >& i_xProv = com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >(),
150cdf0e10cSrcweir 						  const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& = com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >()
151cdf0e10cSrcweir 						  );
152cdf0e10cSrcweir 
153cdf0e10cSrcweir 		DECL_LINK( ClickHdl, Button* );
154cdf0e10cSrcweir 		DECL_LINK( ActivateHdl, Button* );
155cdf0e10cSrcweir 		DECL_LINK( ToolboxHdl, void* );
156cdf0e10cSrcweir 
157cdf0e10cSrcweir 		void initControls();
158cdf0e10cSrcweir 		void initBackground();
159cdf0e10cSrcweir 		void prepareRecentFileMenu();
160cdf0e10cSrcweir 		public:
161cdf0e10cSrcweir 		BackingWindow( Window* pParent );
162cdf0e10cSrcweir 		~BackingWindow();
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 		virtual void		Paint( const Rectangle& rRect );
165cdf0e10cSrcweir 		virtual void		Resize();
166cdf0e10cSrcweir 		virtual long		Notify( NotifyEvent& rNEvt );
167cdf0e10cSrcweir 		virtual void		DataChanged( const DataChangedEvent& rDCEvt );
168cdf0e10cSrcweir 		virtual void		GetFocus();
169cdf0e10cSrcweir 
170cdf0e10cSrcweir 		void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame );
171cdf0e10cSrcweir 	};
172cdf0e10cSrcweir 
173cdf0e10cSrcweir }
174cdf0e10cSrcweir 
175cdf0e10cSrcweir #endif
176cdf0e10cSrcweir 
177d98d5ab2Smseidel /* vim: set noet sw=4 ts=4: */
178