1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <framework/Pane.hxx>
22 #include <osl/mutex.hxx>
23 #include <toolkit/helper/vclunohelper.hxx>
24 #include <vcl/window.hxx>
25 #include <cppcanvas/vclfactory.hxx>
26 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
27 #include <comphelper/servicehelper.hxx>
29 using namespace ::com::sun::star
;
30 using namespace ::com::sun::star::uno
;
31 using namespace ::com::sun::star::drawing::framework
;
33 namespace sd::framework
{
36 const Reference
<XResourceId
>& rxPaneId
,
39 : PaneInterfaceBase(m_aMutex
),
42 mxWindow(VCLUnoHelper::GetInterface(pWindow
))
50 void Pane::disposing()
56 vcl::Window
* Pane::GetWindow()
64 //----- XPane -----------------------------------------------------------------
66 Reference
<awt::XWindow
> SAL_CALL
Pane::getWindow()
73 Reference
<rendering::XCanvas
> SAL_CALL
Pane::getCanvas()
75 ::osl::MutexGuard
aGuard (m_aMutex
);
79 mxCanvas
= CreateCanvas();
84 //----- XPane2 ----------------------------------------------------------------
86 sal_Bool SAL_CALL
Pane::isVisible()
90 const vcl::Window
* pWindow
= GetWindow();
91 if (pWindow
!= nullptr)
92 return pWindow
->IsVisible();
97 void SAL_CALL
Pane::setVisible (sal_Bool bIsVisible
)
101 vcl::Window
* pWindow
= GetWindow();
102 if (pWindow
!= nullptr)
103 pWindow
->Show(bIsVisible
);
106 Reference
<css::accessibility::XAccessible
> SAL_CALL
Pane::getAccessible()
109 vcl::Window
* pWindow
= GetWindow();
110 if (pWindow
!= nullptr)
111 return pWindow
->GetAccessible(false);
116 void SAL_CALL
Pane::setAccessible (
117 const Reference
<css::accessibility::XAccessible
>& rxAccessible
)
120 vcl::Window
* pWindow
= GetWindow();
121 if (pWindow
!= nullptr)
122 pWindow
->SetAccessible(rxAccessible
);
125 //----- XResource -------------------------------------------------------------
127 Reference
<XResourceId
> SAL_CALL
Pane::getResourceId()
134 sal_Bool SAL_CALL
Pane::isAnchorOnly()
139 Reference
<rendering::XCanvas
> Pane::CreateCanvas()
141 Reference
<rendering::XCanvas
> xCanvas
;
143 if (mpWindow
!= nullptr)
145 ::cppcanvas::SpriteCanvasSharedPtr
pCanvas (
146 cppcanvas::VCLFactory::createSpriteCanvas(*mpWindow
));
148 xCanvas
.set(pCanvas
->getUNOSpriteCanvas());
154 void Pane::ThrowIfDisposed() const
156 if (rBHelper
.bDisposed
|| rBHelper
.bInDispose
)
158 throw lang::DisposedException (u
"Pane object has already been disposed"_ustr
,
159 const_cast<uno::XWeak
*>(static_cast<const uno::XWeak
*>(this)));
163 } // end of namespace sd::framework
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */