xref: /AOO41X/main/framework/source/services/backingwindow.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef FRAMEWORK_BACKINGWINDOW_HXX
29*cdf0e10cSrcweir #define FRAMEWORK_BACKINGWINDOW_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "rtl/ustring.hxx"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include "vcl/button.hxx"
34*cdf0e10cSrcweir #include "vcl/menubtn.hxx"
35*cdf0e10cSrcweir #include "vcl/fixed.hxx"
36*cdf0e10cSrcweir #include "vcl/bitmapex.hxx"
37*cdf0e10cSrcweir #include "vcl/toolbox.hxx"
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include "unotools/moduleoptions.hxx"
40*cdf0e10cSrcweir #include "svtools/acceleratorexecute.hxx"
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #include "com/sun/star/frame/XDispatchProvider.hpp"
43*cdf0e10cSrcweir #include "com/sun/star/frame/XDesktop.hpp"
44*cdf0e10cSrcweir #include "com/sun/star/frame/XFrame.hpp"
45*cdf0e10cSrcweir #include "com/sun/star/frame/XTerminateListener.hpp"
46*cdf0e10cSrcweir #include "com/sun/star/document/XEventListener.hpp"
47*cdf0e10cSrcweir #include "com/sun/star/document/XEventBroadcaster.hpp"
48*cdf0e10cSrcweir #include "com/sun/star/util/XURLTransformer.hpp"
49*cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/XFilePicker.hpp"
50*cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp"
51*cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/XFilterManager.hpp"
52*cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/XFolderPicker.hpp"
53*cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
54*cdf0e10cSrcweir #include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp"
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir #include <set>
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir class MnemonicGenerator;
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir namespace framework
61*cdf0e10cSrcweir {
62*cdf0e10cSrcweir         // To get the transparent mouse-over look, the closer is actually a toolbox
63*cdf0e10cSrcweir     // overload DataChange to handle style changes correctly
64*cdf0e10cSrcweir     class DecoToolBox : public ToolBox
65*cdf0e10cSrcweir     {
66*cdf0e10cSrcweir         Size maMinSize;
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir         using Window::ImplInit;
69*cdf0e10cSrcweir     public:
70*cdf0e10cSrcweir                 DecoToolBox( Window* pParent, WinBits nStyle = 0 );
71*cdf0e10cSrcweir                 DecoToolBox( Window* pParent, const ResId& rResId );
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir         void    DataChanged( const DataChangedEvent& rDCEvt );
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir         void    calcMinSize();
76*cdf0e10cSrcweir         Size    getMinSize();
77*cdf0e10cSrcweir     };
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir     class BackingWindow : public Window
80*cdf0e10cSrcweir     {
81*cdf0e10cSrcweir         struct LoadRecentFile
82*cdf0e10cSrcweir         {
83*cdf0e10cSrcweir             rtl::OUString                                                             aTargetURL;
84*cdf0e10cSrcweir             com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >     aArgSeq;
85*cdf0e10cSrcweir         };
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir         com::sun::star::uno::Reference<com::sun::star::frame::XDesktop>                  mxDesktop;
88*cdf0e10cSrcweir         com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider >        mxDesktopDispatchProvider;
89*cdf0e10cSrcweir         com::sun::star::uno::Reference<com::sun::star::frame::XFrame>                    mxFrame;
90*cdf0e10cSrcweir         com::sun::star::uno::Reference<com::sun::star::document::XEventBroadcaster>      mxBroadcaster;
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir         FixedText                       maWelcome;
93*cdf0e10cSrcweir         Size                            maWelcomeSize;
94*cdf0e10cSrcweir         FixedText                       maProduct;
95*cdf0e10cSrcweir         Size                            maProductSize;
96*cdf0e10cSrcweir         ImageButton                     maWriterButton;
97*cdf0e10cSrcweir         ImageButton                     maCalcButton;
98*cdf0e10cSrcweir         ImageButton                     maImpressButton;
99*cdf0e10cSrcweir         MenuButton                      maOpenButton;
100*cdf0e10cSrcweir         ImageButton                     maDrawButton;
101*cdf0e10cSrcweir         ImageButton                     maDBButton;
102*cdf0e10cSrcweir         ImageButton                     maMathButton;
103*cdf0e10cSrcweir         ImageButton                     maTemplateButton;
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir         DecoToolBox                     maToolbox;
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir         BitmapEx                        maBackgroundLeft;
108*cdf0e10cSrcweir         BitmapEx                        maBackgroundMiddle;
109*cdf0e10cSrcweir         BitmapEx                        maBackgroundRight;
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir         String                          maWelcomeString;
112*cdf0e10cSrcweir         String                          maProductString;
113*cdf0e10cSrcweir         String                          maCreateString;
114*cdf0e10cSrcweir         String                          maOpenString;
115*cdf0e10cSrcweir         String                          maTemplateString;
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir         Font                            maTextFont;
118*cdf0e10cSrcweir         Rectangle                       maControlRect;
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir         long                            mnColumnWidth[2];
121*cdf0e10cSrcweir         long                            mnTextColumnWidth[2];
122*cdf0e10cSrcweir         Color                           maLabelTextColor;
123*cdf0e10cSrcweir         Color                           maWelcomeTextColor;
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir         Size                            maButtonImageSize;
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir         bool                            mbInitControls;
128*cdf0e10cSrcweir         sal_Int32                       mnLayoutStyle;
129*cdf0e10cSrcweir         svt::AcceleratorExecute*        mpAccExec;
130*cdf0e10cSrcweir         long                            mnBtnPos;
131*cdf0e10cSrcweir         long                            mnBtnTop;
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir         PopupMenu*                      mpRecentMenu;
134*cdf0e10cSrcweir         std::vector< LoadRecentFile >   maRecentFiles;
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir         static const int nItemId_Extensions = 1;
137*cdf0e10cSrcweir         static const int nItemId_Reg = 2;
138*cdf0e10cSrcweir         static const int nItemId_Info = 3;
139*cdf0e10cSrcweir         static const int nItemId_TplRep = 4;
140*cdf0e10cSrcweir         static const int nShadowTop = 32;
141*cdf0e10cSrcweir         static const int nShadowLeft = 35;
142*cdf0e10cSrcweir         static const int nShadowRight = 45;
143*cdf0e10cSrcweir         static const int nShadowBottom = 50;
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir         void loadImage( const ResId& i_rId, PushButton& i_rButton );
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir         void layoutButton( const char* i_pURL, int nColumn, const std::set<rtl::OUString>& i_rURLS,
148*cdf0e10cSrcweir                            SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod,
149*cdf0e10cSrcweir                            PushButton& i_rBtn,
150*cdf0e10cSrcweir                            MnemonicGenerator& i_rMnemonicGen,
151*cdf0e10cSrcweir                            const String& i_rStr = String()
152*cdf0e10cSrcweir                            );
153*cdf0e10cSrcweir 
154*cdf0e10cSrcweir         void dispatchURL( const rtl::OUString& i_rURL,
155*cdf0e10cSrcweir                           const rtl::OUString& i_rTarget = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ),
156*cdf0e10cSrcweir                           const com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >& i_xProv = com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >(),
157*cdf0e10cSrcweir                           const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& = com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >()
158*cdf0e10cSrcweir                           );
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir         DECL_LINK( ClickHdl, Button* );
161*cdf0e10cSrcweir         DECL_LINK( SelectHdl, Button* );
162*cdf0e10cSrcweir         DECL_LINK( ActivateHdl, Button* );
163*cdf0e10cSrcweir         DECL_LINK( ToolboxHdl, void* );
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir         void initControls();
166*cdf0e10cSrcweir         void initBackground();
167*cdf0e10cSrcweir         void prepareRecentFileMenu();
168*cdf0e10cSrcweir         public:
169*cdf0e10cSrcweir         BackingWindow( Window* pParent );
170*cdf0e10cSrcweir         ~BackingWindow();
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir         virtual void        Paint( const Rectangle& rRect );
173*cdf0e10cSrcweir         virtual void        Resize();
174*cdf0e10cSrcweir         virtual long        Notify( NotifyEvent& rNEvt );
175*cdf0e10cSrcweir         virtual void        DataChanged( const DataChangedEvent& rDCEvt );
176*cdf0e10cSrcweir         virtual void        GetFocus();
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir         void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame );
179*cdf0e10cSrcweir     };
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir }
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir #endif
184*cdf0e10cSrcweir 
185