Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef FRAMEWORK_BACKINGWINDOW_HXX
21 : #define FRAMEWORK_BACKINGWINDOW_HXX
22 :
23 : #include "rtl/ustring.hxx"
24 :
25 : #include "vcl/button.hxx"
26 : #include "vcl/menubtn.hxx"
27 : #include "vcl/fixed.hxx"
28 : #include "vcl/bitmapex.hxx"
29 : #include "vcl/toolbox.hxx"
30 :
31 : #include "unotools/moduleoptions.hxx"
32 : #include "svtools/acceleratorexecute.hxx"
33 :
34 : #include <com/sun/star/uno/XComponentContext.hpp>
35 : #include <com/sun/star/frame/XUIControllerFactory.hpp>
36 : #include <com/sun/star/frame/XPopupMenuController.hpp>
37 : #include <com/sun/star/awt/XPopupMenu.hpp>
38 : #include "com/sun/star/frame/XDispatchProvider.hpp"
39 : #include "com/sun/star/frame/XDesktop.hpp"
40 : #include "com/sun/star/frame/XFrame.hpp"
41 : #include "com/sun/star/frame/XTerminateListener.hpp"
42 : #include "com/sun/star/document/XEventListener.hpp"
43 : #include "com/sun/star/document/XEventBroadcaster.hpp"
44 : #include "com/sun/star/util/XURLTransformer.hpp"
45 : #include "com/sun/star/ui/dialogs/XFilePicker.hpp"
46 : #include "com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp"
47 : #include "com/sun/star/ui/dialogs/XFilterManager.hpp"
48 : #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
49 : #include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp"
50 :
51 : #include <set>
52 :
53 : class MnemonicGenerator;
54 :
55 : namespace framework
56 : {
57 : // To get the transparent mouse-over look, the closer is actually a toolbox
58 : // overload DataChange to handle style changes correctly
59 1 : class DecoToolBox : public ToolBox
60 : {
61 : Size maMinSize;
62 :
63 : using Window::ImplInit;
64 : public:
65 : DecoToolBox( Window* pParent, WinBits nStyle = 0 );
66 : DecoToolBox( Window* pParent, const ResId& rResId );
67 :
68 : void DataChanged( const DataChangedEvent& rDCEvt );
69 :
70 : void calcMinSize();
71 : Size getMinSize();
72 : };
73 :
74 : class BackingWindow : public Window
75 : {
76 : com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext;
77 : com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider > mxDesktopDispatchProvider;
78 : com::sun::star::uno::Reference<com::sun::star::frame::XFrame> mxFrame;
79 : com::sun::star::uno::Reference< com::sun::star::frame::XUIControllerFactory > mxPopupMenuFactory;
80 : com::sun::star::uno::Reference< com::sun::star::frame::XPopupMenuController > mxPopupMenuController;
81 : com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu > mxPopupMenu;
82 :
83 : ImageButton maWriterButton;
84 : ImageButton maCalcButton;
85 : ImageButton maImpressButton;
86 : MenuButton maOpenButton;
87 : ImageButton maDrawButton;
88 : ImageButton maDBButton;
89 : ImageButton maMathButton;
90 : ImageButton maTemplateButton;
91 :
92 : DecoToolBox maToolbox;
93 :
94 : BitmapEx maBackgroundLeft;
95 : BitmapEx maBackgroundMiddle;
96 : BitmapEx maBackgroundRight;
97 :
98 : String maCreateString;
99 : String maOpenString;
100 : String maTemplateString;
101 :
102 : Font maTextFont;
103 : Rectangle maControlRect;
104 :
105 : long mnColumnWidth[2];
106 : long mnTextColumnWidth[2];
107 : Color maLabelTextColor;
108 :
109 : Size maButtonImageSize;
110 :
111 : bool mbInitControls;
112 : sal_Int32 mnHideExternalLinks;
113 : svt::AcceleratorExecute* mpAccExec;
114 : long mnBtnPos;
115 : long mnBtnTop;
116 :
117 : static const int nItemId_Extensions = 1;
118 : static const int nItemId_Info = 3;
119 : static const int nItemId_TplRep = 4;
120 : static const int nShadowTop = 30;
121 : static const int nShadowLeft = 30;
122 : static const int nShadowRight = 30;
123 : static const int nShadowBottom = 30;
124 :
125 : void loadImage( const ResId& i_rId, PushButton& i_rButton );
126 :
127 : void layoutButton( const char* i_pURL, int nColumn, int i_nExtraWidth, const std::set<OUString>& i_rURLS,
128 : SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod,
129 : PushButton& i_rBtn,
130 : MnemonicGenerator& i_rMnemonicGen,
131 : const String& i_rStr = String()
132 : );
133 :
134 : void dispatchURL( const OUString& i_rURL,
135 : const OUString& i_rTarget = OUString( "_default" ),
136 : const com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >& i_xProv = com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >(),
137 : const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& = com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >()
138 : );
139 :
140 : DECL_LINK( ClickHdl, Button* );
141 : DECL_LINK( ActivateHdl, Button* );
142 : DECL_LINK( ToolboxHdl, void* );
143 : DECL_LINK( WindowEventListener, VclSimpleEvent* );
144 :
145 : void initControls();
146 : void initBackground();
147 : void prepareRecentFileMenu();
148 : public:
149 : BackingWindow( Window* pParent );
150 : ~BackingWindow();
151 :
152 : virtual void Paint( const Rectangle& rRect );
153 : virtual void Resize();
154 : virtual long Notify( NotifyEvent& rNEvt );
155 : virtual void GetFocus();
156 :
157 : void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame );
158 : };
159 :
160 : }
161 :
162 : #endif
163 :
164 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|