LibreOffice Module sw (master)
1
sw
source
uibase
shells
olesh.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/objface.hxx
>
21
#include <
vcl/EnumContext.hxx
>
22
#include <view.hxx>
23
#include <
frmsh.hxx
>
24
#include <
olesh.hxx
>
25
26
#include <
sfx2/sidebar/SidebarController.hxx
>
27
28
#define ShellClass_SwOleShell
29
#include <
sfx2/msg.hxx
>
30
#include <swslots.hxx>
31
32
using namespace
css::uno;
33
using namespace
sfx2::sidebar
;
34
35
namespace
{
36
37
bool
inChartOrMathContext(
const
SwView
& rViewShell)
38
{
39
SidebarController
* pSidebar = SidebarController::GetSidebarControllerForView(&rViewShell);
40
if
(pSidebar)
41
return
pSidebar->
hasChartOrMathContextCurrently
();
42
43
return
false
;
44
}
45
46
}
// anonymous namespace
47
48
SFX_IMPL_INTERFACE
(
SwOleShell
,
SwFrameShell
)
49
50
void
SwOleShell
::InitInterface_Impl()
51
{
52
GetStaticInterface()->RegisterPopupMenu(
"oleobject"
);
53
54
GetStaticInterface()->RegisterObjectBar(
SFX_OBJECTBAR_OBJECT
, SfxVisibilityFlags::Invisible, ToolbarId::Ole_Toolbox);
55
}
56
57
void
SwOleShell::Activate
(
bool
bMDI)
58
{
59
if
(!inChartOrMathContext(
GetView
()))
60
SwFrameShell::Activate
(bMDI);
61
else
62
{
63
// Avoid context changes for chart/math during activation / deactivation.
64
const
bool
bIsContextBroadcasterEnabled (
SfxShell::SetContextBroadcasterEnabled
(
false
));
65
66
SwFrameShell::Activate
(bMDI);
67
68
SfxShell::SetContextBroadcasterEnabled
(bIsContextBroadcasterEnabled);
69
}
70
}
71
72
void
SwOleShell::Deactivate
(
bool
bMDI)
73
{
74
if
(!inChartOrMathContext(
GetView
()))
75
SwFrameShell::Deactivate
(bMDI);
76
else
77
{
78
// Avoid context changes for chart/math during activation / deactivation.
79
const
bool
bIsContextBroadcasterEnabled (
SfxShell::SetContextBroadcasterEnabled
(
false
));
80
81
SwFrameShell::Deactivate
(bMDI);
82
83
SfxShell::SetContextBroadcasterEnabled
(bIsContextBroadcasterEnabled);
84
}
85
}
86
87
SwOleShell::SwOleShell
(
SwView
&_rView) :
88
SwFrameShell
(_rView)
89
90
{
91
SetName
(
"Object"
);
92
SfxShell::SetContextName
(
vcl::EnumContext::GetContextName
(
vcl::EnumContext::Context::OLE
));
93
}
94
95
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
EnumContext.hxx
SidebarController.hxx
SfxShell::Activate
virtual void Activate(bool bMDI)
SfxShell::SetContextBroadcasterEnabled
bool SetContextBroadcasterEnabled(const bool bIsEnabled)
SfxShell::SetContextName
void SetContextName(const OUString &rsContextName)
SfxShell::Deactivate
virtual void Deactivate(bool bMDI)
SfxShell::SetName
void SetName(const OUString &rName)
SwBaseShell::GetView
SwView & GetView()
Definition:
basesh.hxx:59
SwFrameShell
Definition:
frmsh.hxx:25
SwOleShell
Definition:
olesh.hxx:25
SwOleShell::SwOleShell
SwOleShell(SwView &rView)
Definition:
olesh.cxx:87
SwOleShell::Deactivate
virtual void Deactivate(bool bMDI) override
Definition:
olesh.cxx:72
SwOleShell::Activate
virtual void Activate(bool bMDI) override
Definition:
olesh.cxx:57
SwView
Definition:
view.hxx:146
sfx2::sidebar::SidebarController
sfx2::sidebar::SidebarController::hasChartOrMathContextCurrently
bool hasChartOrMathContextCurrently() const
vcl::EnumContext::Context::OLE
@ OLE
vcl::EnumContext::GetContextName
static const OUString & GetContextName(const Context eContext)
frmsh.hxx
msg.hxx
sfx2::sidebar
objface.hxx
SFX_OBJECTBAR_OBJECT
#define SFX_OBJECTBAR_OBJECT
olesh.hxx
SFX_IMPL_INTERFACE
#define SFX_IMPL_INTERFACE(Class, SuperClass)
Generated on Sun Jul 30 2023 04:30:00 for LibreOffice Module sw (master) by
1.9.3