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#include <vcl/windowstate.hxx>
23
24#include <cmdid.h>
25#include <swmodule.hxx>
26#include <view.hxx>
27#include <edtwin.hxx>
28
29#include <syncbtn.hxx>
30
32
34 sal_uInt16 nId,
35 SfxBindings* pBindings,
36 SfxChildWinInfo* pInfo)
37 : SfxChildWindow(_pParent, nId)
38{
39 SetController(std::make_shared<SwSyncBtnDlg>(pBindings, this, _pParent->GetFrameWeld()));
40 SwSyncBtnDlg* pBtnDlg = static_cast<SwSyncBtnDlg*>(GetController().get());
41
42 if (!pInfo->aSize.Width() || !pInfo->aSize.Height())
43 {
44 weld::Dialog* pDlg = pBtnDlg->getDialog();
45 Point aPos;
46
47 SwView* pActiveView = ::GetActiveView();
48 if (pActiveView)
49 {
50 const SwEditWin &rEditWin = pActiveView->GetEditWin();
51 aPos = rEditWin.OutputToScreenPixel(Point(0, 0));
52 }
53 else
54 aPos = _pParent->OutputToScreenPixel(Point(0, 0));
55
56 vcl::WindowData aState;
58 aState.setPos(aPos);
59 pDlg->set_window_state(aState.toStr());
60
61 pInfo->aPos = pDlg->get_position();
62 pInfo->aSize = pDlg->get_size();
63 }
64
65 pBtnDlg->Initialize(pInfo);
66}
67
69 SfxChildWindow* pChild,
70 weld::Window *pParent)
71 : SfxModelessDialogController(pBindings, pChild, pParent, "modules/swriter/ui/floatingsync.ui", "FloatingSync")
72 , m_xSyncBtn(m_xBuilder->weld_button("sync"))
73{
74 m_xSyncBtn->connect_clicked(LINK(this, SwSyncBtnDlg, BtnHdl));
75}
76
78{
79}
80
82{
84}
85
86/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
void Initialize(SfxChildWinInfo const *pInfo)
static SfxViewFrame * Current()
SfxDispatcher * GetDispatcher()
Window class for the Writer edit area, this is the one handling mouse and keyboard events and doing t...
Definition: edtwin.hxx:61
std::unique_ptr< weld::Button > m_xSyncBtn
Definition: syncbtn.hxx:27
SwSyncBtnDlg(SfxBindings *, SfxChildWindow *, weld::Window *pParent)
Definition: syncbtn.cxx:68
virtual ~SwSyncBtnDlg() override
Definition: syncbtn.cxx:77
Definition: view.hxx:146
SwEditWin & GetEditWin()
Definition: view.hxx:419
void setMask(WindowDataMask nMask)
OString toStr() const
void setPos(const Point &aPos)
Point OutputToScreenPixel(const Point &rPos) const
virtual Point get_position() const=0
virtual void set_window_state(const OString &rStr)=0
virtual Size get_size() const=0
#define FN_UPDATE_ALL_LINKS
Definition: cmdid.h:127
#define FN_SYNC_LABELS
Definition: cmdid.h:478
virtual std::shared_ptr< SfxDialogController > GetController() override
SFX_IMPL_MODELESSDIALOGCONTOLLER(SfxRecordingFloatWrapper_Impl, SID_RECORDING_FLOATWINDOW)
SwView * GetActiveView()
Definition: swmodul1.cxx:116
IMPL_STATIC_LINK_NOARG(SwSyncBtnDlg, BtnHdl, weld::Button &, void)
Definition: syncbtn.cxx:81