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