LibreOffice Module sw (master) 1
fldwrap.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 <cmdid.h>
21#include <sfx2/basedlgs.hxx>
22#include <docsh.hxx>
23#include <fldwrap.hxx>
24
25#include <swabstdlg.hxx>
26
28
29SwChildWinWrapper::SwChildWinWrapper(vcl::Window *pParentWindow, sal_uInt16 nId) :
30 SfxChildWindow(pParentWindow, nId),
31 m_aUpdateTimer("SwChildWinWrapper m_aUpdateTimer"),
32 m_pDocSh(nullptr)
33{
34 // avoid flickering of buttons:
35 m_aUpdateTimer.SetTimeout(200);
36 m_aUpdateTimer.SetInvokeHandler(LINK(this, SwChildWinWrapper, UpdateHdl));
37}
38
40{
41 if (GetController())
42 GetController()->Activate(); // update dialog
43}
44
45// newly initialise dialog after Doc switch
47{
48 bool bRet = false;
49
50 if (m_pDocSh != GetOldDocShell())
51 {
53 bRet = true; // immediate Update
54 }
55 else
57
58 return bRet;
59}
60
62{
64 return aInfo;
65}
66
68 SfxBindings* pB,
70 : SwChildWinWrapper( _pParent, nId )
71{
73 m_pDlgInterface = pFact->CreateSwFieldDlg(pB, this, _pParent->GetFrameWeld());
74 SetController(m_pDlgInterface->GetController());
75 m_pDlgInterface->StartExecuteAsync(nullptr);
76}
77
78// newly initialise dialog after Doc switch
80{
81 bool bRet = SwChildWinWrapper::ReInitDlg(pDocSh);
82 if (bRet) // update immediately, Doc switch
83 {
84 m_pDlgInterface->ReInitDlg();
85 }
86
87 return bRet;
88}
89
91{
92 m_pDlgInterface->ShowReferencePage();
93}
94
96
98{
100// prevent instantiation of dialog other than by calling
101// the mail merge dialog
102 aInfo.bVisible = false;
103 return aInfo;
104}
105
107 SfxBindings* pB,
108 SfxChildWinInfo* pInfo )
109 : SwChildWinWrapper( _pParent, nId )
110{
112 m_pDlgInterface = pFact->CreateSwFieldDlg(pB, this, _pParent->GetFrameWeld());
113
114 SetController(m_pDlgInterface->GetController());
115 m_pDlgInterface->ActivateDatabasePage();
116 m_pDlgInterface->StartExecuteAsync(nullptr);
117 m_pDlgInterface->Initialize( pInfo );
118}
119
120// re-init after doc activation
122{
123 bool bRet = SwChildWinWrapper::ReInitDlg(pDocSh);
124 if (bRet) // update immediately, Doc switch
125 {
126 m_pDlgInterface->ReInitDlg();
127 }
128
129 return bRet;
130}
131
132/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetController(std::shared_ptr< SfxDialogController > controller)
virtual SfxChildWinInfo GetInfo() const
static SwAbstractDialogFactory * Create()
Definition: swabstdlg.cxx:36
virtual VclPtr< AbstractSwFieldDlg > CreateSwFieldDlg(SfxBindings *pB, SwChildWinWrapper *pCW, weld::Window *pParent)=0
SwDocShell * m_pDocSh
Definition: chldwrap.hxx:30
virtual bool ReInitDlg(SwDocShell *pDocSh)
Definition: fldwrap.cxx:46
Timer m_aUpdateTimer
Definition: chldwrap.hxx:29
SwDocShell * GetOldDocShell()
Definition: chldwrap.hxx:41
ScopedVclPtr< AbstractSwFieldDlg > m_pDlgInterface
Definition: fldwrap.hxx:45
virtual bool ReInitDlg(SwDocShell *pDocSh) override
Definition: fldwrap.cxx:121
SwFieldDataOnlyDlgWrapper(vcl::Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo)
Definition: fldwrap.cxx:106
virtual bool ReInitDlg(SwDocShell *pDocSh) override
Definition: fldwrap.cxx:79
SwFieldDlgWrapper(vcl::Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, SfxChildWinInfo *pInfo)
Definition: fldwrap.cxx:67
ScopedVclPtr< AbstractSwFieldDlg > m_pDlgInterface
Definition: fldwrap.hxx:31
void ShowReferencePage()
Definition: fldwrap.cxx:90
void Stop()
virtual void Start(bool bStartTimer=true) override
weld::Window * GetFrameWeld() const
#define FN_INSERT_FIELD
Definition: cmdid.h:211
#define FN_INSERT_FIELD_DATA_ONLY
Definition: cmdid.h:223
virtual std::shared_ptr< SfxDialogController > GetController() override
IMPL_LINK_NOARG(SwChildWinWrapper, UpdateHdl, Timer *, void)
Definition: fldwrap.cxx:39
SFX_IMPL_CHILDWINDOW_WITHID(SearchResultsDlgWrapper, SID_SEARCH_RESULTS_DIALOG)
sal_Int16 nId
SFX_IMPL_CHILDWINDOW(SvxRubyChildWindow, SID_RUBY_DIALOG)