1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SFX2_SOURCE_DIALOG_BACKINGWINDOW_HXX
21 #define INCLUDED_SFX2_SOURCE_DIALOG_BACKINGWINDOW_HXX
23 #include <rtl/ustring.hxx>
25 #include <vcl/builder.hxx>
26 #include <vcl/button.hxx>
27 #include <vcl/tabctrl.hxx>
28 #include <vcl/layout.hxx>
30 #include <vcl/menubtn.hxx>
32 #include <sfx2/recentdocsview.hxx>
33 #include <sfx2/templatedefaultview.hxx>
34 #include <sfx2/templateabstractview.hxx>
35 #include <sfx2/templateviewitem.hxx>
37 #include <svtools/acceleratorexecute.hxx>
38 #include <unotools/moduleoptions.hxx>
40 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
41 #include <com/sun/star/uno/XComponentContext.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/XDesktop2.hpp>
51 class BackingWindow
: public vcl::Window
, public VclBuilderContainer
53 typedef bool (*selection_cmp_fn
)(const ThumbnailViewItem
*, const ThumbnailViewItem
*);
54 css::uno::Reference
<css::uno::XComponentContext
> mxContext
;
55 css::uno::Reference
<css::frame::XDispatchProvider
> mxDesktopDispatchProvider
;
56 css::uno::Reference
<css::frame::XFrame
> mxFrame
;
57 css::uno::Reference
<css::frame::XDesktop2
> mxDesktop
;
59 /** helper for drag&drop. */
60 css::uno::Reference
<css::datatransfer::dnd::XDropTargetListener
> mxDropTargetListener
;
62 VclPtr
<PushButton
> mpOpenButton
;
63 VclPtr
<PushButton
> mpRecentButton
;
64 VclPtr
<MenuButton
> mpTemplateButton
;
66 VclPtr
<FixedText
> mpCreateLabel
;
68 VclPtr
<PushButton
> mpWriterAllButton
;
69 VclPtr
<PushButton
> mpCalcAllButton
;
70 VclPtr
<PushButton
> mpImpressAllButton
;
71 VclPtr
<PushButton
> mpDrawAllButton
;
72 VclPtr
<PushButton
> mpDBAllButton
;
73 VclPtr
<PushButton
> mpMathAllButton
;
75 VclPtr
<PushButton
> mpHelpButton
;
76 VclPtr
<PushButton
> mpExtensionsButton
;
78 VclPtr
<VclBox
> mpAllButtonsBox
;
79 VclPtr
<VclBox
> mpButtonsBox
;
80 VclPtr
<VclBox
> mpSmallButtonsBox
;
82 VclPtr
<RecentDocsView
> mpAllRecentThumbnails
;
83 VclPtr
<TemplateDefaultView
> mpLocalView
;
84 bool mbLocalViewInitialized
;
86 std::vector
< VclPtr
<vcl::Window
> > maDndWindows
;
88 Color maButtonsTextColor
;
89 Rectangle maStartCentButtons
;
93 sal_Int32 mnHideExternalLinks
;
94 svt::AcceleratorExecute
* mpAccExec
;
96 void setupButton(PushButton
* pButton
);
97 void setupButton(MenuButton
* pButton
);
99 void OnTemplateOpen();
101 void dispatchURL(const OUString
& i_rURL
,
102 const OUString
& i_rTarget
= OUString("_default"),
103 const css::uno::Reference
<css::frame::XDispatchProvider
>& i_xProv
= css::uno::Reference
<css::frame::XDispatchProvider
>(),
104 const css::uno::Sequence
<css::beans::PropertyValue
>& = css::uno::Sequence
<css::beans::PropertyValue
>());
106 std::set
<const ThumbnailViewItem
*, selection_cmp_fn
> maSelTemplates
;
107 std::set
<const ThumbnailViewItem
*, selection_cmp_fn
> maSelFolders
;
109 DECL_LINK(ClickHdl
, Button
*);
110 DECL_LINK_TYPED(MenuSelectHdl
, MenuButton
*, void);
111 DECL_LINK(ExtLinkClickHdl
, Button
*);
112 DECL_LINK(OpenRegionHdl
, void*);
113 DECL_LINK(OpenTemplateHdl
, ThumbnailViewItem
*);
117 void initializeLocalView();
120 BackingWindow(vcl::Window
* pParent
);
121 virtual ~BackingWindow();
122 virtual void dispose() SAL_OVERRIDE
;
124 virtual void Paint(vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
) SAL_OVERRIDE
;
125 virtual void Resize() SAL_OVERRIDE
;
126 virtual bool PreNotify(NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
127 virtual bool Notify(NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
128 virtual void GetFocus() SAL_OVERRIDE
;
130 virtual Size
GetOptimalSize() const SAL_OVERRIDE
;
132 void setOwningFrame(const css::uno::Reference
<css::frame::XFrame
>& xFrame
);
134 void clearRecentFileList();
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */