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