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