LibreOffice Module sw (master)  1
syncbtn.cxx
Go to the documentation of this file.
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 
28 #include <syncbtn.hxx>
29 #include <swtypes.hxx>
30 
32 
33 SwSyncChildWin::SwSyncChildWin( vcl::Window* _pParent,
34  sal_uInt16 nId,
35  SfxBindings* pBindings,
36  SfxChildWinInfo* pInfo ) :
37  SfxChildWindow( _pParent, nId )
38 {
39  SetWindow(VclPtr<SwSyncBtnDlg>::Create( pBindings, this, _pParent));
40 
41  if (!pInfo->aSize.Width() || !pInfo->aSize.Height())
42  {
43  SwView* pActiveView = ::GetActiveView();
44  if(pActiveView)
45  {
46  const SwEditWin &rEditWin = pActiveView->GetEditWin();
47  GetWindow()->SetPosPixel(rEditWin.OutputToScreenPixel(Point(0, 0)));
48  }
49  else
50  GetWindow()->SetPosPixel(_pParent->OutputToScreenPixel(Point(0, 0)));
51  pInfo->aPos = GetWindow()->GetPosPixel();
52  pInfo->aSize = GetWindow()->GetSizePixel();
53  }
54 
55  static_cast<SwSyncBtnDlg *>(GetWindow())->Initialize(pInfo);
56 
57  GetWindow()->Show();
58 }
59 
61  SfxChildWindow* pChild,
62  vcl::Window *pParent)
63  : SfxFloatingWindow(_pBindings, pChild, pParent, "FloatingSync", "modules/swriter/ui/floatingsync.ui")
64 {
65  get(m_pSyncBtn, "sync");
66  m_pSyncBtn->SetClickHdl(LINK(this, SwSyncBtnDlg, BtnHdl));
67  Show();
68 }
69 
71 {
72  disposeOnce();
73 }
74 
76 {
77  m_pSyncBtn.clear();
79 }
80 
82 {
83  SfxViewFrame::Current()->GetDispatcher()->Execute(FN_UPDATE_ALL_LINKS, SfxCallMode::ASYNCHRON);
84 }
85 
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define FN_UPDATE_ALL_LINKS
Definition: cmdid.h:119
SwView * GetActiveView()
Definition: swmodul1.cxx:123
void SetClickHdl(const Link< Button *, void > &rLink)
SfxDispatcher * GetDispatcher()
IMPL_STATIC_LINK_NOARG(SwSyncBtnDlg, BtnHdl, Button *, void)
Definition: syncbtn.cxx:81
SwEditWin & GetEditWin()
Definition: view.hxx:403
#define FN_SYNC_LABELS
Definition: cmdid.h:444
virtual void dispose() override
Definition: syncbtn.cxx:75
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:58
virtual void dispose() override
VclPtr< PushButton > m_pSyncBtn
Definition: syncbtn.hxx:28
static SfxViewFrame * Current()
SFX_IMPL_FLOATINGWINDOW(SfxRecordingFloatWrapper_Impl, SID_RECORDING_FLOATWINDOW)
SwSyncBtnDlg(SfxBindings *, SfxChildWindow *, vcl::Window *pParent)
Definition: syncbtn.cxx:60
Point OutputToScreenPixel(const Point &rPos) const
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
virtual void SetPosPixel(const Point &rNewPos)
virtual ~SwSyncBtnDlg() override
Definition: syncbtn.cxx:70
Definition: view.hxx:146