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 90 : 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 = new SwMailMergeChildWin( 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 : ((SwMailMergeChildWin *)pWindow)->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( BUTTON_SYMBOLTEXT );
74 0 : }
75 :
76 0 : IMPL_LINK_NOARG(SwMailMergeChildWin, BackHdl)
77 : {
78 0 : GetBindings().GetDispatcher()->Execute(FN_MAILMERGE_WIZARD, SfxCallMode::ASYNCHRON);
79 0 : return 0;
80 : }
81 :
82 0 : void SwMailMergeChildWin::FillInfo(SfxChildWinInfo& rInfo) const
83 : {
84 0 : SfxFloatingWindow::FillInfo(rInfo);
85 0 : rInfo.aWinState = OString();
86 0 : rInfo.bVisible = false;
87 270 : }
88 :
89 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|