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::XDispatchProvider > mxDesktopDispatchProvider;
79 : com::sun::star::uno::Reference<com::sun::star::frame::XFrame> mxFrame;
80 : com::sun::star::uno::Reference<com::sun::star::document::XEventBroadcaster> mxBroadcaster;
81 :
82 : ImageButton maWriterButton;
83 : ImageButton maCalcButton;
84 : ImageButton maImpressButton;
85 : MenuButton maOpenButton;
86 : ImageButton maDrawButton;
87 : ImageButton maDBButton;
88 : ImageButton maMathButton;
89 : ImageButton maTemplateButton;
90 :
91 : DecoToolBox maToolbox;
92 :
93 : BitmapEx maBackgroundLeft;
94 : BitmapEx maBackgroundMiddle;
95 : BitmapEx maBackgroundRight;
96 :
97 : String maCreateString;
98 : String maOpenString;
99 : String maTemplateString;
100 :
101 : Font maTextFont;
102 : Rectangle maControlRect;
103 :
104 : long mnColumnWidth[2];
105 : long mnTextColumnWidth[2];
106 : Color maLabelTextColor;
107 :
108 : Size maButtonImageSize;
109 :
110 : bool mbInitControls;
111 : sal_Int32 mnHideExternalLinks;
112 : svt::AcceleratorExecute* mpAccExec;
113 : long mnBtnPos;
114 : long mnBtnTop;
115 :
116 : PopupMenu* mpRecentMenu;
117 : std::vector< LoadRecentFile > maRecentFiles;
118 :
119 : static const int nItemId_Extensions = 1;
120 : static const int nItemId_Info = 3;
121 : static const int nItemId_TplRep = 4;
122 : static const int nShadowTop = 37;
123 : static const int nShadowLeft = 38;
124 : static const int nShadowRight = 38;
125 : static const int nShadowBottom = 38;
126 :
127 : void loadImage( const ResId& i_rId, PushButton& i_rButton );
128 :
129 : void layoutButton( const char* i_pURL, int nColumn, int i_nExtraWidth, const std::set<rtl::OUString>& i_rURLS,
130 : SvtModuleOptions& i_rOpt, SvtModuleOptions::EModule i_eMod,
131 : PushButton& i_rBtn,
132 : MnemonicGenerator& i_rMnemonicGen,
133 : const String& i_rStr = String()
134 : );
135 :
136 : void dispatchURL( const rtl::OUString& i_rURL,
137 : const rtl::OUString& i_rTarget = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_default" ) ),
138 : const com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >& i_xProv = com::sun::star::uno::Reference< com::sun::star::frame::XDispatchProvider >(),
139 : const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& = com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >()
140 : );
141 :
142 : DECL_LINK( ClickHdl, Button* );
143 : DECL_LINK( SelectHdl, Button* );
144 : DECL_LINK( ActivateHdl, Button* );
145 : DECL_LINK( ToolboxHdl, void* );
146 : DECL_LINK( WindowEventListener, VclSimpleEvent* );
147 :
148 : void initControls();
149 : void initBackground();
150 : void prepareRecentFileMenu();
151 : public:
152 : BackingWindow( Window* pParent );
153 : ~BackingWindow();
154 :
155 : virtual void Paint( const Rectangle& rRect );
156 : virtual void Resize();
157 : virtual long Notify( NotifyEvent& rNEvt );
158 : virtual void GetFocus();
159 :
160 : void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame );
161 : };
162 :
163 : }
164 :
165 : #endif
166 :
167 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|