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 : #include <sfx2/viewfrm.hxx>
21 : #include <sfx2/dispatch.hxx>
22 :
23 : #include <cmdid.h>
24 : #include <swmodule.hxx>
25 : #include <view.hxx>
26 : #include <edtwin.hxx>
27 : #include <vcl/layout.hxx>
28 : #include <mailmergechildwindow.hxx>
29 : #include <mmconfigitem.hxx>
30 : #include <svtools/svmedit.hxx>
31 : #include <vcl/msgbox.hxx>
32 : #include <vcl/image.hxx>
33 : #include <dbui.hrc>
34 : #include <helpid.h>
35 :
36 : using namespace ::com::sun::star;
37 :
38 59 : SFX_IMPL_FLOATINGWINDOW( SwMailMergeChildWindow, FN_MAILMERGE_CHILDWINDOW )
39 :
40 0 : SwMailMergeChildWindow::SwMailMergeChildWindow( vcl::Window* _pParent,
41 : sal_uInt16 nId,
42 : SfxBindings* pBindings,
43 : SfxChildWinInfo* pInfo ) :
44 0 : SfxChildWindow( _pParent, nId )
45 : {
46 0 : pWindow = VclPtr<SwMailMergeChildWin>::Create( pBindings, this, _pParent);
47 :
48 0 : if (!pInfo->aSize.Width() || !pInfo->aSize.Height())
49 : {
50 0 : SwView* pActiveView = ::GetActiveView();
51 0 : if(pActiveView)
52 : {
53 0 : const SwEditWin &rEditWin = pActiveView->GetEditWin();
54 0 : pWindow->SetPosPixel(rEditWin.OutputToScreenPixel(Point(0, 0)));
55 : }
56 : else
57 0 : pWindow->SetPosPixel(_pParent->OutputToScreenPixel(Point(0, 0)));
58 0 : pInfo->aPos = pWindow->GetPosPixel();
59 0 : pInfo->aSize = pWindow->GetSizePixel();
60 : }
61 :
62 0 : static_cast<SwMailMergeChildWin *>(pWindow.get())->Initialize(pInfo);
63 0 : pWindow->Show();
64 0 : }
65 :
66 0 : SwMailMergeChildWin::SwMailMergeChildWin(SfxBindings* _pBindings,
67 : SfxChildWindow* pChild, vcl::Window *pParent)
68 : : SfxFloatingWindow(_pBindings, pChild, pParent, "FloatingMMChild",
69 0 : "modules/swriter/ui/floatingmmchild.ui")
70 : {
71 0 : get(m_pBackTB, "back");
72 0 : m_pBackTB->SetSelectHdl(LINK(this, SwMailMergeChildWin, BackHdl));
73 0 : m_pBackTB->SetButtonType( ButtonType::SYMBOLTEXT );
74 0 : }
75 :
76 0 : SwMailMergeChildWin::~SwMailMergeChildWin()
77 : {
78 0 : disposeOnce();
79 0 : }
80 :
81 0 : void SwMailMergeChildWin::dispose()
82 : {
83 0 : m_pBackTB.clear();
84 0 : SfxFloatingWindow::dispose();
85 0 : }
86 :
87 0 : IMPL_LINK_NOARG_TYPED(SwMailMergeChildWin, BackHdl, ToolBox *, void)
88 : {
89 0 : GetBindings().GetDispatcher()->Execute(FN_MAILMERGE_WIZARD, SfxCallMode::ASYNCHRON);
90 0 : }
91 :
92 0 : void SwMailMergeChildWin::FillInfo(SfxChildWinInfo& rInfo) const
93 : {
94 0 : SfxFloatingWindow::FillInfo(rInfo);
95 0 : rInfo.aWinState.clear();
96 0 : rInfo.bVisible = false;
97 177 : }
98 :
99 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|