1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 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. 14 * 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). 20 * 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. 25 * 26 ************************************************************************/ 27 28 #ifndef FRAMEWORK_BACKINGWINDOW_HXX 29 #define FRAMEWORK_BACKINGWINDOW_HXX 30 31 #include "rtl/ustring.hxx" 32 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" 38 39 #include "unotools/moduleoptions.hxx" 40 #include "svtools/acceleratorexecute.hxx" 41 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" 55 56 #include <set> 57 58 class MnemonicGenerator; 59 60 namespace framework 61 { 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 65 { 66 Size maMinSize; 67 68 using Window::ImplInit; 69 public: 70 DecoToolBox( Window* pParent, WinBits nStyle = 0 ); 71 DecoToolBox( Window* pParent, const ResId& rResId ); 72 73 void DataChanged( const DataChangedEvent& rDCEvt ); 74 75 void calcMinSize(); 76 Size getMinSize(); 77 }; 78 79 class BackingWindow : public Window 80 { 81 struct LoadRecentFile 82 { 83 rtl::OUString aTargetURL; 84 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aArgSeq; 85 }; 86 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; 91 92 FixedText maWelcome; 93 Size maWelcomeSize; 94 FixedText maProduct; 95 Size maProductSize; 96 ImageButton maWriterButton; 97 ImageButton maCalcButton; 98 ImageButton maImpressButton; 99 MenuButton maOpenButton; 100 ImageButton maDrawButton; 101 ImageButton maDBButton; 102 ImageButton maMathButton; 103 ImageButton maTemplateButton; 104 105 DecoToolBox maToolbox; 106 107 BitmapEx maBackgroundLeft; 108 BitmapEx maBackgroundMiddle; 109 BitmapEx maBackgroundRight; 110 111 String maWelcomeString; 112 String maProductString; 113 String maCreateString; 114 String maOpenString; 115 String maTemplateString; 116 117 Font maTextFont; 118 Rectangle maControlRect; 119 120 long mnColumnWidth[2]; 121 long mnTextColumnWidth[2]; 122 Color maLabelTextColor; 123 Color maWelcomeTextColor; 124 125 Size maButtonImageSize; 126 127 bool mbInitControls; 128 sal_Int32 mnLayoutStyle; 129 svt::AcceleratorExecute* mpAccExec; 130 long mnBtnPos; 131 long mnBtnTop; 132 133 PopupMenu* mpRecentMenu; 134 std::vector< LoadRecentFile > maRecentFiles; 135 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; 144 145 void loadImage( const ResId& i_rId, PushButton& i_rButton ); 146 147 void layoutButton( const char* i_pURL, int nColumn, const std::set<rtl::OUString>& i_rURLS, 148 SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod, 149 PushButton& i_rBtn, 150 MnemonicGenerator& i_rMnemonicGen, 151 const String& i_rStr = String() 152 ); 153 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 >() 158 ); 159 160 DECL_LINK( ClickHdl, Button* ); 161 DECL_LINK( SelectHdl, Button* ); 162 DECL_LINK( ActivateHdl, Button* ); 163 DECL_LINK( ToolboxHdl, void* ); 164 165 void initControls(); 166 void initBackground(); 167 void prepareRecentFileMenu(); 168 public: 169 BackingWindow( Window* pParent ); 170 ~BackingWindow(); 171 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(); 177 178 void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame ); 179 }; 180 181 } 182 183 #endif 184 185