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/lang/XConnectionPointContainer.hpp> 23 #include <cppuhelper/propshlp.hxx> 24 #include <rtl/ref.hxx> 25 26 #include <basecontrol.hxx> 27 28 namespace com::sun::star::beans { struct PropertyValue; } 29 namespace com::sun::star::frame { class XFrame2; } 30 namespace unocontrols { class OConnectionPointContainerHelper; } 31 32 namespace unocontrols { 33 34 class FrameControl final : public css::awt::XControlModel 35 , public css::lang::XConnectionPointContainer 36 , public BaseControl // This order is necessary for right initialization of m_aMutex! 37 , public ::cppu::OBroadcastHelper 38 , public ::cppu::OPropertySetHelper 39 { 40 public: 41 42 FrameControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); 43 44 virtual ~FrameControl() override; 45 46 // XInterface 47 48 virtual css::uno::Any SAL_CALL queryInterface( 49 const css::uno::Type& aType 50 ) override; 51 52 /** 53 @short increment refcount 54 @seealso XInterface 55 @seealso release() 56 @onerror A RuntimeException is thrown. 57 */ 58 59 virtual void SAL_CALL acquire() noexcept override; 60 61 /** 62 @short decrement refcount 63 @seealso XInterface 64 @seealso acquire() 65 @onerror A RuntimeException is thrown. 66 */ 67 68 virtual void SAL_CALL release() noexcept override; 69 70 // XTypeProvider 71 72 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; 73 74 // XAggregation 75 76 css::uno::Any SAL_CALL queryAggregation( 77 const css::uno::Type& aType 78 ) override; 79 80 OUString SAL_CALL getImplementationName() override; 81 82 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; 83 84 // XControl 85 86 virtual void SAL_CALL createPeer( 87 const css::uno::Reference< css::awt::XToolkit >& xToolkit , 88 const css::uno::Reference< css::awt::XWindowPeer >& xParent 89 ) override; 90 91 virtual sal_Bool SAL_CALL setModel( 92 const css::uno::Reference< css::awt::XControlModel >& xModel 93 ) override; 94 95 virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override; 96 97 // XComponent 98 99 virtual void SAL_CALL dispose() override; 100 101 // XView 102 103 virtual sal_Bool SAL_CALL setGraphics( 104 const css::uno::Reference< css::awt::XGraphics >& xDevice 105 ) override; 106 107 virtual css::uno::Reference< css::awt::XGraphics > SAL_CALL getGraphics() override; 108 109 // XConnectionPointContainer 110 111 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getConnectionPointTypes() override; 112 113 virtual css::uno::Reference< css::lang::XConnectionPoint > SAL_CALL queryConnectionPoint( 114 const css::uno::Type& aType 115 ) override; 116 117 virtual void SAL_CALL advise( 118 const css::uno::Type& aType , 119 const css::uno::Reference< css::uno::XInterface >& xListener 120 ) override; 121 122 virtual void SAL_CALL unadvise( 123 const css::uno::Type& aType , 124 const css::uno::Reference< css::uno::XInterface >& xListener 125 ) override; 126 127 private: 128 129 using OPropertySetHelper::getFastPropertyValue; 130 131 // OPropertySetHelper 132 133 virtual sal_Bool SAL_CALL convertFastPropertyValue( 134 css::uno::Any& rConvertedValue , 135 css::uno::Any& rOldValue , 136 sal_Int32 nHandle , 137 const css::uno::Any& rValue 138 ) override; 139 140 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( 141 sal_Int32 nHandle , 142 const css::uno::Any& rValue 143 ) override; 144 145 virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue , 146 sal_Int32 nHandle ) const override; 147 148 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; 149 150 // XPropertySet 151 152 css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override; 153 154 // BaseControl 155 156 virtual css::awt::WindowDescriptor impl_getWindowDescriptor( 157 const css::uno::Reference< css::awt::XWindowPeer >& xParentPeer 158 ) override; 159 160 void impl_createFrame( const css::uno::Reference< css::awt::XWindowPeer >& xPeer , 161 const OUString& sURL , 162 const css::uno::Sequence< css::beans::PropertyValue >& seqArguments ); 163 164 void impl_deleteFrame(); 165 166 css::uno::Reference< css::frame::XFrame2 > m_xFrame; 167 OUString m_sComponentURL; 168 css::uno::Sequence< css::beans::PropertyValue > m_seqLoaderArguments; 169 rtl::Reference<OConnectionPointContainerHelper> m_aConnectionPointContainer; 170 171 }; 172 173 } 174 175 176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 177