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 23 24 #ifndef FRAMEWORK_BACKINGWINDOW_HXX 25 #define FRAMEWORK_BACKINGWINDOW_HXX 26 27 #include "rtl/ustring.hxx" 28 29 #include "vcl/button.hxx" 30 #include "vcl/menubtn.hxx" 31 #include "vcl/fixed.hxx" 32 #include "vcl/bitmapex.hxx" 33 #include "vcl/toolbox.hxx" 34 35 #include "unotools/moduleoptions.hxx" 36 #include "svtools/acceleratorexecute.hxx" 37 38 #include <com/sun/star/uno/XComponentContext.hpp> 39 #include <com/sun/star/frame/XUIControllerFactory.hpp> 40 #include <com/sun/star/frame/XPopupMenuController.hpp> 41 #include <com/sun/star/awt/XPopupMenu.hpp> 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 82 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext; 83 com::sun::star::uno::Reference<com::sun::star::frame::XDesktop> mxDesktop; 84 com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider > mxDesktopDispatchProvider; 85 com::sun::star::uno::Reference<com::sun::star::frame::XFrame> mxFrame; 86 com::sun::star::uno::Reference< com::sun::star::frame::XUIControllerFactory > mxPopupMenuFactory; 87 com::sun::star::uno::Reference< com::sun::star::frame::XPopupMenuController > mxPopupMenuController; 88 com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu > mxPopupMenu; 89 90 FixedText maWelcome; 91 Size maWelcomeSize; 92 FixedText maProduct; 93 Size maProductSize; 94 ImageButton maWriterButton; 95 ImageButton maCalcButton; 96 ImageButton maImpressButton; 97 MenuButton maOpenButton; 98 ImageButton maDrawButton; 99 ImageButton maDBButton; 100 ImageButton maMathButton; 101 ImageButton maTemplateButton; 102 103 DecoToolBox maToolbox; 104 105 BitmapEx maBackgroundLeft; 106 BitmapEx maBackgroundMiddle; 107 BitmapEx maBackgroundRight; 108 109 String maWelcomeString; 110 String maProductString; 111 String maCreateString; 112 String maOpenString; 113 String maTemplateString; 114 115 Font maTextFont; 116 Rectangle maControlRect; 117 118 long mnColumnWidth[2]; 119 long mnTextColumnWidth[2]; 120 Color maLabelTextColor; 121 Color maWelcomeTextColor; 122 123 Size maButtonImageSize; 124 125 bool mbInitControls; 126 sal_Int32 mnLayoutStyle; 127 svt::AcceleratorExecute* mpAccExec; 128 long mnBtnPos; 129 long mnBtnTop; 130 131 static const int nItemId_Extensions = 1; 132 static const int nItemId_Reg = 2; 133 static const int nItemId_Info = 3; 134 static const int nItemId_TplRep = 4; 135 static const int nShadowTop = 32; 136 static const int nShadowLeft = 35; 137 static const int nShadowRight = 45; 138 static const int nShadowBottom = 50; 139 140 void loadImage( const ResId& i_rId, PushButton& i_rButton ); 141 142 void layoutButton( const char* i_pURL, int nColumn, const std::set<rtl::OUString>& i_rURLS, 143 SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod, 144 PushButton& i_rBtn, 145 MnemonicGenerator& i_rMnemonicGen, 146 const String& i_rStr = String() 147 ); 148 149 void dispatchURL( const rtl::OUString& i_rURL, 150 const rtl::OUString& i_rTarget = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ), 151 const com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >& i_xProv = com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >(), 152 const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& = com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >() 153 ); 154 155 DECL_LINK( ClickHdl, Button* ); 156 DECL_LINK( ActivateHdl, Button* ); 157 DECL_LINK( ToolboxHdl, void* ); 158 159 void initControls(); 160 void initBackground(); 161 void prepareRecentFileMenu(); 162 public: 163 BackingWindow( Window* pParent ); 164 ~BackingWindow(); 165 166 virtual void Paint( const Rectangle& rRect ); 167 virtual void Resize(); 168 virtual long Notify( NotifyEvent& rNEvt ); 169 virtual void DataChanged( const DataChangedEvent& rDCEvt ); 170 virtual void GetFocus(); 171 172 void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame ); 173 }; 174 175 } 176 177 #endif 178 179