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/frame/XDispatchProvider.hpp"
35 : #include "com/sun/star/frame/XDesktop.hpp"
36 : #include "com/sun/star/frame/XFrame.hpp"
37 : #include "com/sun/star/frame/XTerminateListener.hpp"
38 : #include "com/sun/star/document/XEventListener.hpp"
39 : #include "com/sun/star/document/XEventBroadcaster.hpp"
40 : #include "com/sun/star/util/XURLTransformer.hpp"
41 : #include "com/sun/star/ui/dialogs/XFilePicker.hpp"
42 : #include "com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp"
43 : #include "com/sun/star/ui/dialogs/XFilterManager.hpp"
44 : #include "com/sun/star/ui/dialogs/TemplateDescription.hpp"
45 : #include "com/sun/star/ui/dialogs/ExecutableDialogResults.hpp"
46 :
47 : #include <set>
48 :
49 : class MnemonicGenerator;
50 :
51 : namespace framework
52 : {
53 : // To get the transparent mouse-over look, the closer is actually a toolbox
54 : // overload DataChange to handle style changes correctly
55 0 : class DecoToolBox : public ToolBox
56 : {
57 : Size maMinSize;
58 :
59 : using Window::ImplInit;
60 : public:
61 : DecoToolBox( Window* pParent, WinBits nStyle = 0 );
62 : DecoToolBox( Window* pParent, const ResId& rResId );
63 :
64 : void DataChanged( const DataChangedEvent& rDCEvt );
65 :
66 : void calcMinSize();
67 : Size getMinSize();
68 : };
69 :
70 : class BackingWindow : public Window
71 : {
72 0 : struct LoadRecentFile
73 : {
74 : rtl::OUString aTargetURL;
75 : com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aArgSeq;
76 : };
77 :
78 : com::sun::star::uno::Reference<com::sun::star::frame::XDesktop> mxDesktop;
79 : com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider > mxDesktopDispatchProvider;
80 : com::sun::star::uno::Reference<com::sun::star::frame::XFrame> mxFrame;
81 : com::sun::star::uno::Reference<com::sun::star::document::XEventBroadcaster> mxBroadcaster;
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 : PopupMenu* mpRecentMenu;
118 : std::vector< LoadRecentFile > maRecentFiles;
119 :
120 : static const int nItemId_Extensions = 1;
121 : static const int nItemId_Info = 3;
122 : static const int nItemId_TplRep = 4;
123 : static const int nShadowTop = 37;
124 : static const int nShadowLeft = 38;
125 : static const int nShadowRight = 38;
126 : static const int nShadowBottom = 38;
127 :
128 : void loadImage( const ResId& i_rId, PushButton& i_rButton );
129 :
130 : void layoutButton( const char* i_pURL, int nColumn, int i_nExtraWidth, const std::set<rtl::OUString>& i_rURLS,
131 : SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod,
132 : PushButton& i_rBtn,
133 : MnemonicGenerator& i_rMnemonicGen,
134 : const String& i_rStr = String()
135 : );
136 :
137 : void dispatchURL( const rtl::OUString& i_rURL,
138 : const rtl::OUString& i_rTarget = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ),
139 : const com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >& i_xProv = com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >(),
140 : const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& = com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >()
141 : );
142 :
143 : DECL_LINK( ClickHdl, Button* );
144 : DECL_LINK( SelectHdl, Button* );
145 : DECL_LINK( ActivateHdl, Button* );
146 : DECL_LINK( ToolboxHdl, void* );
147 : DECL_LINK( WindowEventListener, VclSimpleEvent* );
148 :
149 : void initControls();
150 : void initBackground();
151 : void prepareRecentFileMenu();
152 : public:
153 : BackingWindow( Window* pParent );
154 : ~BackingWindow();
155 :
156 : virtual void Paint( const Rectangle& rRect );
157 : virtual void Resize();
158 : virtual long Notify( NotifyEvent& rNEvt );
159 : virtual void GetFocus();
160 :
161 : void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame );
162 : };
163 :
164 : }
165 :
166 : #endif
167 :
168 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|