LibreOffice Module sd (master) 1
ViewShellWrapper.hxx
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#pragma once
21
22#include <com/sun/star/drawing/framework/XView.hpp>
23#include <com/sun/star/drawing/framework/XRelocatableResource.hpp>
24#include <com/sun/star/view/XSelectionSupplier.hpp>
25#include <com/sun/star/awt/XWindowListener.hpp>
27
28#include <memory>
29
30namespace sd { class ViewShell; }
31namespace sd::slidesorter { class SlideSorterViewShell; }
32namespace com::sun::star::awt { class XWindow; }
33
34namespace sd::framework {
35
36typedef comphelper::WeakComponentImplHelper < css::awt::XWindowListener
37 , css::view::XSelectionSupplier
38 , css::drawing::framework::XRelocatableResource
39 , css::drawing::framework::XView
41
47{
48public:
61 const ::std::shared_ptr<ViewShell>& pViewShell,
62 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
63 const css::uno::Reference<css::awt::XWindow>& rxWindow);
64 virtual ~ViewShellWrapper() override;
65
66 virtual void disposing(std::unique_lock<std::mutex>&) override;
67 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override;
68
73 const ::std::shared_ptr<ViewShell>& GetViewShell() const { return mpViewShell;}
74
75 // XResource
76
77 virtual css::uno::Reference<css::drawing::framework::XResourceId>
78 SAL_CALL getResourceId() override;
79
80 virtual sal_Bool SAL_CALL isAnchorOnly() override;
81
82 // XSelectionSupplier
83
84 virtual sal_Bool SAL_CALL select( const css::uno::Any& aSelection ) override;
85 virtual css::uno::Any SAL_CALL getSelection() override;
86 virtual void SAL_CALL addSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override;
87 virtual void SAL_CALL removeSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override;
88
89 // XRelocatableResource
90
91 virtual sal_Bool SAL_CALL relocateToAnchor (
92 const css::uno::Reference<
93 css::drawing::framework::XResource>& xResource) override;
94
95 // XWindowListener
96
97 virtual void SAL_CALL windowResized(
98 const css::awt::WindowEvent& rEvent) override;
99
100 virtual void SAL_CALL windowMoved(
101 const css::awt::WindowEvent& rEvent) override;
102
103 virtual void SAL_CALL windowShown(
104 const css::lang::EventObject& rEvent) override;
105
106 virtual void SAL_CALL windowHidden(
107 const css::lang::EventObject& rEvent) override;
108
109 // XEventListener
110
111 virtual void SAL_CALL disposing(
112 const css::lang::EventObject& rEvent) override;
113
114private:
115 ::std::shared_ptr< ViewShell > mpViewShell;
116 ::std::shared_ptr< ::sd::slidesorter::SlideSorterViewShell > mpSlideSorterViewShell;
117 const css::uno::Reference< css::drawing::framework::XResourceId > mxViewId;
118 css::uno::Reference<css::awt::XWindow > mxWindow;
119};
120
121} // end of namespace sd::framework
122
123/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class wraps ViewShell objects and makes them look like an XView.
virtual void SAL_CALL windowHidden(const css::lang::EventObject &rEvent) override
virtual void SAL_CALL removeSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > &xListener) override
::std::shared_ptr< ::sd::slidesorter::SlideSorterViewShell > mpSlideSorterViewShell
virtual void SAL_CALL windowShown(const css::lang::EventObject &rEvent) override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual void SAL_CALL addSelectionChangeListener(const css::uno::Reference< css::view::XSelectionChangeListener > &xListener) override
virtual sal_Bool SAL_CALL isAnchorOnly() override
ViewShellWrapper(const ::std::shared_ptr< ViewShell > &pViewShell, const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId, const css::uno::Reference< css::awt::XWindow > &rxWindow)
Create a new ViewShellWrapper object that wraps the given ViewShell object.
virtual css::uno::Any SAL_CALL getSelection() override
virtual void disposing(std::unique_lock< std::mutex > &) override
css::uno::Reference< css::awt::XWindow > mxWindow
::std::shared_ptr< ViewShell > mpViewShell
const css::uno::Reference< css::drawing::framework::XResourceId > mxViewId
virtual sal_Bool SAL_CALL relocateToAnchor(const css::uno::Reference< css::drawing::framework::XResource > &xResource) override
virtual void SAL_CALL disposing(const css::lang::EventObject &rEvent) override
virtual void SAL_CALL windowResized(const css::awt::WindowEvent &rEvent) override
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent &rEvent) override
virtual sal_Bool SAL_CALL select(const css::uno::Any &aSelection) override
const ::std::shared_ptr< ViewShell > & GetViewShell() const
This method is typically used to obtain a pointer to the wrapped ViewShell object for a given XView o...
virtual css::uno::Reference< css::drawing::framework::XResourceId > SAL_CALL getResourceId() override
comphelper::WeakComponentImplHelper< css::awt::XWindowListener, css::view::XSelectionSupplier, css::drawing::framework::XRelocatableResource, css::drawing::framework::XView > ViewShellWrapperInterfaceBase
unsigned char sal_Bool