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 "label.hrc"
28 :
29 : #define _SYNCDLG
30 : #include "syncbtn.hxx"
31 : #include "swtypes.hxx"
32 :
33 10 : SFX_IMPL_FLOATINGWINDOW( SwSyncChildWin, FN_SYNC_LABELS )
34 :
35 0 : SwSyncChildWin::SwSyncChildWin( Window* _pParent,
36 : sal_uInt16 nId,
37 : SfxBindings* pBindings,
38 : SfxChildWinInfo* pInfo ) :
39 0 : SfxChildWindow( _pParent, nId )
40 : {
41 0 : pWindow = new SwSyncBtnDlg( pBindings, this, _pParent);
42 :
43 0 : if (!pInfo->aSize.Width() || !pInfo->aSize.Height())
44 : {
45 0 : SwView* pActiveView = ::GetActiveView();
46 0 : if(pActiveView)
47 : {
48 0 : const SwEditWin &rEditWin = pActiveView->GetEditWin();
49 0 : pWindow->SetPosPixel(rEditWin.OutputToScreenPixel(Point(0, 0)));
50 : }
51 : else
52 0 : pWindow->SetPosPixel(_pParent->OutputToScreenPixel(Point(0, 0)));
53 0 : pInfo->aPos = pWindow->GetPosPixel();
54 0 : pInfo->aSize = pWindow->GetSizePixel();
55 : }
56 :
57 0 : ((SwSyncBtnDlg *)pWindow)->Initialize(pInfo);
58 :
59 0 : pWindow->Show();
60 0 : }
61 :
62 0 : SwSyncBtnDlg::SwSyncBtnDlg( SfxBindings* _pBindings,
63 : SfxChildWindow* pChild,
64 : Window *pParent) :
65 : SfxFloatingWindow(_pBindings, pChild, pParent, SW_RES(DLG_SYNC_BTN)),
66 0 : aSyncBtn (this, SW_RES(BTN_SYNC ))
67 : {
68 0 : FreeResource();
69 0 : aSyncBtn.SetClickHdl(LINK(this, SwSyncBtnDlg, BtnHdl));
70 0 : }
71 :
72 0 : SwSyncBtnDlg::~SwSyncBtnDlg()
73 : {
74 0 : }
75 :
76 0 : IMPL_LINK_NOARG(SwSyncBtnDlg, BtnHdl)
77 : {
78 0 : SfxViewFrame::Current()->GetDispatcher()->Execute(FN_UPDATE_ALL_LINKS, SFX_CALLMODE_ASYNCHRON);
79 0 : return 0;
80 : }
81 :
82 :
83 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|