diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /toolkit/inc | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/inc')
41 files changed, 4752 insertions, 0 deletions
diff --git a/toolkit/inc/awt/animatedimagespeer.hxx b/toolkit/inc/awt/animatedimagespeer.hxx new file mode 100644 index 000000000..839e249b3 --- /dev/null +++ b/toolkit/inc/awt/animatedimagespeer.hxx @@ -0,0 +1,103 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <toolkit/awt/vclxwindow.hxx> +#include <com/sun/star/container/XContainerListener.hpp> + +#include <com/sun/star/awt/XAnimatedImages.hpp> +#include <com/sun/star/awt/XAnimation.hpp> +#include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/util/XModifyListener.hpp> + +#include <cppuhelper/implbase.hxx> + +namespace toolkit +{ + + + //= AnimatedImagesPeer + + struct AnimatedImagesPeer_Data; + typedef cppu::ImplInheritanceHelper< VCLXWindow, + css::awt::XAnimation, + css::container::XContainerListener, + css::util::XModifyListener + > AnimatedImagesPeer_Base; + + class AnimatedImagesPeer final : public AnimatedImagesPeer_Base + { + public: + AnimatedImagesPeer(); + + private: + virtual ~AnimatedImagesPeer() override; + + public: + // XAnimation + virtual void SAL_CALL startAnimation( ) override; + virtual void SAL_CALL stopAnimation( ) override; + virtual sal_Bool SAL_CALL isAnimationRunning( ) override; + + // VclWindowPeer + virtual void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + virtual css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + // XContainerListener + virtual void SAL_CALL elementInserted( const css::container::ContainerEvent& Event ) override; + virtual void SAL_CALL elementRemoved( const css::container::ContainerEvent& Event ) override; + virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& i_event ) override; + + // XModifyListener + virtual void SAL_CALL modified( const css::lang::EventObject& i_event ) override; + + // XComponent + void SAL_CALL dispose( ) override; + + struct CachedImage + { + OUString sImageURL; + mutable css::uno::Reference< css::graphic::XGraphic > xGraphic; + }; + + private: + void ProcessWindowEvent( const VclWindowEvent& i_windowEvent ) override; + + /** updates our images with the ones from the given XAnimatedImages component + */ + void impl_updateImages_nolck( const css::uno::Reference< css::uno::XInterface >& i_animatedImages ); + + AnimatedImagesPeer(const AnimatedImagesPeer&) = delete; + AnimatedImagesPeer& operator=(const AnimatedImagesPeer&) = delete; + + void updateImageList_nothrow(); + void updateImageList_nothrow( const css::uno::Reference< css::awt::XAnimatedImages >& i_images ); + + std::vector< std::vector< CachedImage > > maCachedImageSets; + }; + + +} // namespace toolkit + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/awt/vclxbitmap.hxx b/toolkit/inc/awt/vclxbitmap.hxx new file mode 100644 index 000000000..6cf8928e0 --- /dev/null +++ b/toolkit/inc/awt/vclxbitmap.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/awt/XBitmap.hpp> +#include <com/sun/star/awt/XDisplayBitmap.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/util/XAccounting.hpp> +#include <comphelper/servicehelper.hxx> +#include <cppuhelper/implbase.hxx> +#include <mutex> +#include <vcl/bitmapex.hxx> + + + + +class VCLXBitmap final : public cppu::WeakImplHelper< + css::awt::XBitmap, + css::awt::XDisplayBitmap, + css::lang::XUnoTunnel, + css::util::XAccounting> +{ + std::mutex maMutex; + BitmapEx maBitmap; + + std::mutex& GetMutex() { return maMutex; } + + +public: + // inline constructors + VCLXBitmap() : maMutex(), maBitmap() {} + VCLXBitmap(const BitmapEx& rBitmapEx) : maMutex(), maBitmap(rBitmapEx) {} + + void SetBitmap( const BitmapEx& rBmp ) { maBitmap = rBmp; } + const BitmapEx& GetBitmap() const { return maBitmap; } + + // css::lang::XUnoTunnel + UNO3_GETIMPLEMENTATION_DECL(VCLXBitmap) + + // css::awt::XBitmap + css::awt::Size SAL_CALL getSize() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getDIB() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getMaskDIB() override; + + // XAccounting + sal_Int64 SAL_CALL estimateUsage() override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/awt/vclxcontainer.hxx b/toolkit/inc/awt/vclxcontainer.hxx new file mode 100644 index 000000000..d93c967b8 --- /dev/null +++ b/toolkit/inc/awt/vclxcontainer.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/awt/XVclContainer.hpp> +#include <com/sun/star/awt/XVclContainerPeer.hpp> +#include <cppuhelper/weak.hxx> + +#include <toolkit/awt/vclxwindow.hxx> + +class VCLXContainer : public css::awt::XVclContainer, + public css::awt::XVclContainerPeer, + public VCLXWindow +{ +public: + VCLXContainer(); + virtual ~VCLXContainer() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XVclContainer + void SAL_CALL addVclContainerListener( const css::uno::Reference< css::awt::XVclContainerListener >& l ) override; + void SAL_CALL removeVclContainerListener( const css::uno::Reference< css::awt::XVclContainerListener >& l ) override; + css::uno::Sequence< css::uno::Reference< css::awt::XWindow > > SAL_CALL getWindows( ) override; + + // css::awt::XVclContainerPeer + void SAL_CALL enableDialogControl( sal_Bool bEnable ) override; + void SAL_CALL setTabOrder( const css::uno::Sequence< css::uno::Reference< css::awt::XWindow > >& WindowOrder, const css::uno::Sequence< css::uno::Any >& Tabs, sal_Bool GroupControl ) override; + void SAL_CALL setGroup( const css::uno::Sequence< css::uno::Reference< css::awt::XWindow > >& Windows ) override; + + // css::awt::XVclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/awt/vclxgraphics.hxx b/toolkit/inc/awt/vclxgraphics.hxx new file mode 100644 index 000000000..ff697ead3 --- /dev/null +++ b/toolkit/inc/awt/vclxgraphics.hxx @@ -0,0 +1,122 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <comphelper/servicehelper.hxx> +#include <cppuhelper/implbase.hxx> +#include <tools/color.hxx> +#include <o3tl/typed_flags_set.hxx> +#include <vcl/font.hxx> +#include <vcl/rendercontext/RasterOp.hxx> +#include <vcl/vclptr.hxx> + +#include <com/sun/star/awt/XGraphics2.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +#include <memory> + +class OutputDevice; +namespace vcl { class Region; } +namespace com::sun::star::graphic { class XGraphic; } + + +enum class InitOutDevFlags +{ + NONE = 0x0000, + FONT = 0x0001, + COLORS = 0x0002, +}; +namespace o3tl +{ + template<> struct typed_flags<InitOutDevFlags> : is_typed_flags<InitOutDevFlags, 0x03> {}; +} + + + + +class VCLXGraphics final : public cppu::WeakImplHelper< + css::awt::XGraphics2, + css::lang::XUnoTunnel> +{ +private: + // used to return same reference on each call to getDevice() + css::uno::Reference< css::awt::XDevice> mxDevice; + + VclPtr<OutputDevice> mpOutputDevice; + vcl::Font maFont; + Color maTextColor; + Color maTextFillColor; + Color maLineColor; + Color maFillColor; + RasterOp meRasterOp; + std::unique_ptr<vcl::Region> mpClipRegion; + + void initAttrs(); + +public: + VCLXGraphics(); + virtual ~VCLXGraphics() override; + + void Init( OutputDevice* pOutDev ); + void InitOutputDevice( InitOutDevFlags nFlags ); + + void SetOutputDevice( OutputDevice* pOutDev ); + OutputDevice* GetOutputDevice() const { return mpOutputDevice; } + + // css::lang::XUnoTunnel + UNO3_GETIMPLEMENTATION_DECL(VCLXGraphics) + + // css::awt::XGraphics Attributes + virtual css::uno::Reference< css::awt::XDevice > SAL_CALL getDevice() override; + virtual void SAL_CALL setTextColor( ::sal_Int32 _textcolor ) override; + virtual void SAL_CALL setTextFillColor( ::sal_Int32 _textfillcolor ) override; + virtual void SAL_CALL setLineColor( ::sal_Int32 _linecolor ) override; + virtual void SAL_CALL setFillColor( ::sal_Int32 _fillcolor ) override; + virtual void SAL_CALL setRasterOp( css::awt::RasterOperation _rasterop ) override; + virtual void SAL_CALL setFont( const css::uno::Reference< css::awt::XFont >& _font ) override; + virtual css::awt::SimpleFontMetric SAL_CALL getFontMetric() override; + + // css::awt::XGraphics Methods + virtual void SAL_CALL selectFont( const css::awt::FontDescriptor& aDescription ) override; + virtual void SAL_CALL setClipRegion( const css::uno::Reference< css::awt::XRegion >& Clipping ) override; + virtual void SAL_CALL intersectClipRegion( const css::uno::Reference< css::awt::XRegion >& xClipping ) override; + virtual void SAL_CALL push( ) override; + virtual void SAL_CALL pop( ) override; + virtual void SAL_CALL clear( const css::awt::Rectangle& aRect ) override; + virtual void SAL_CALL copy( const css::uno::Reference< css::awt::XDevice >& xSource, ::sal_Int32 nSourceX, ::sal_Int32 nSourceY, ::sal_Int32 nSourceWidth, ::sal_Int32 nSourceHeight, ::sal_Int32 nDestX, ::sal_Int32 nDestY, ::sal_Int32 nDestWidth, ::sal_Int32 nDestHeight ) override; + virtual void SAL_CALL draw( const css::uno::Reference< css::awt::XDisplayBitmap >& xBitmapHandle, ::sal_Int32 SourceX, ::sal_Int32 SourceY, ::sal_Int32 SourceWidth, ::sal_Int32 SourceHeight, ::sal_Int32 DestX, ::sal_Int32 DestY, ::sal_Int32 DestWidth, ::sal_Int32 DestHeight ) override; + virtual void SAL_CALL drawPixel( ::sal_Int32 X, ::sal_Int32 Y ) override; + virtual void SAL_CALL drawLine( ::sal_Int32 X1, ::sal_Int32 Y1, ::sal_Int32 X2, ::sal_Int32 Y2 ) override; + virtual void SAL_CALL drawRect( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height ) override; + virtual void SAL_CALL drawRoundedRect( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height, ::sal_Int32 nHorzRound, ::sal_Int32 nVertRound ) override; + virtual void SAL_CALL drawPolyLine( const css::uno::Sequence< ::sal_Int32 >& DataX, const css::uno::Sequence< ::sal_Int32 >& DataY ) override; + virtual void SAL_CALL drawPolygon( const css::uno::Sequence< ::sal_Int32 >& DataX, const css::uno::Sequence< ::sal_Int32 >& DataY ) override; + virtual void SAL_CALL drawPolyPolygon( const css::uno::Sequence< css::uno::Sequence< ::sal_Int32 > >& DataX, const css::uno::Sequence< css::uno::Sequence< ::sal_Int32 > >& DataY ) override; + virtual void SAL_CALL drawEllipse( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height ) override; + virtual void SAL_CALL drawArc( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height, ::sal_Int32 X1, ::sal_Int32 Y1, ::sal_Int32 X2, ::sal_Int32 Y2 ) override; + virtual void SAL_CALL drawPie( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height, ::sal_Int32 X1, ::sal_Int32 Y1, ::sal_Int32 X2, ::sal_Int32 Y2 ) override; + virtual void SAL_CALL drawChord( ::sal_Int32 nX, ::sal_Int32 nY, ::sal_Int32 nWidth, ::sal_Int32 nHeight, ::sal_Int32 nX1, ::sal_Int32 nY1, ::sal_Int32 nX2, ::sal_Int32 nY2 ) override; + virtual void SAL_CALL drawGradient( ::sal_Int32 nX, ::sal_Int32 nY, ::sal_Int32 nWidth, ::sal_Int32 Height, const css::awt::Gradient& aGradient ) override; + virtual void SAL_CALL drawText( ::sal_Int32 X, ::sal_Int32 Y, const OUString& Text ) override; + virtual void SAL_CALL drawTextArray( ::sal_Int32 X, ::sal_Int32 Y, const OUString& Text, const css::uno::Sequence< ::sal_Int32 >& Longs ) override; + virtual void SAL_CALL drawImage( ::sal_Int32 nX, ::sal_Int32 nY, ::sal_Int32 nWidth, ::sal_Int32 nHeight, ::sal_Int16 nStyle, const css::uno::Reference< css::graphic::XGraphic >& aGraphic ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/awt/vclxpointer.hxx b/toolkit/inc/awt/vclxpointer.hxx new file mode 100644 index 000000000..3bfcceeab --- /dev/null +++ b/toolkit/inc/awt/vclxpointer.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + + +#include <com/sun/star/awt/XPointer.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <comphelper/servicehelper.hxx> +#include <cppuhelper/implbase.hxx> +#include <mutex> + +#include <vcl/ptrstyle.hxx> + + + + +class VCLXPointer final : public cppu::WeakImplHelper< + css::awt::XPointer, css::lang::XUnoTunnel, css::lang::XServiceInfo> +{ + std::mutex maMutex; + PointerStyle maPointer; + +public: + VCLXPointer(); + virtual ~VCLXPointer() override; + + PointerStyle GetPointer() const { return maPointer; } + + // css::lang::XUnoTunnel + UNO3_GETIMPLEMENTATION_DECL(VCLXPointer) + + // css::awt::XPointer + void SAL_CALL setType( sal_Int32 nType ) override; + sal_Int32 SAL_CALL getType( ) override; + + OUString SAL_CALL getImplementationName() override; + + sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/awt/vclxprinter.hxx b/toolkit/inc/awt/vclxprinter.hxx new file mode 100644 index 000000000..41a74044b --- /dev/null +++ b/toolkit/inc/awt/vclxprinter.hxx @@ -0,0 +1,194 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + + +#include <com/sun/star/awt/XPrinterPropertySet.hpp> +#include <com/sun/star/awt/XPrinterServer2.hpp> +#include <com/sun/star/awt/XInfoPrinter.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +#include <toolkit/helper/mutexandbroadcasthelper.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/implbase.hxx> +#include <comphelper/uno3.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/jobset.hxx> + +#include <memory> + +namespace com::sun::star::awt { class XPrinter; } +namespace vcl { class OldStylePrintAdaptor; } +class Printer; + +// relevant properties for the printer: +/* + sal_Bool Horizontal + sal_uInt16 CopyCount; + sal_Bool Collate; + String FormDescriptor; + sal_uInt16 Orientation; // PORTRAIT, LANDSCAPE +*/ + + + + +typedef ::cppu::WeakImplHelper < css::awt::XPrinterPropertySet + > VCLXPrinterPropertySet_Base; +class VCLXPrinterPropertySet :public VCLXPrinterPropertySet_Base + ,public MutexAndBroadcastHelper + ,public ::cppu::OPropertySetHelper +{ +protected: + VclPtr<Printer> mxPrinter; + css::uno::Reference< css::awt::XDevice > mxPrnDevice; + + sal_Int16 mnOrientation; + bool mbHorizontal; +public: + VCLXPrinterPropertySet( const OUString& rPrinterName ); + virtual ~VCLXPrinterPropertySet() override; + + Printer* GetPrinter() const { return mxPrinter.get(); } + css::uno::Reference< css::awt::XDevice > const & GetDevice(); + + // css::uno::XInterface + DECLARE_XINTERFACE(); + + // css::lang::XTypeProvider + DECLARE_XTYPEPROVIDER(); + + // css::beans::XPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + void SAL_CALL setPropertyValue( const OUString& rPropertyName, const css::uno::Any& aValue ) override { OPropertySetHelper::setPropertyValue( rPropertyName, aValue ); } + css::uno::Any SAL_CALL getPropertyValue( const OUString& rPropertyName ) override { return OPropertySetHelper::getPropertyValue( rPropertyName ); } + void SAL_CALL addPropertyChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rxListener ) override { OPropertySetHelper::addPropertyChangeListener( rPropertyName, rxListener ); } + void SAL_CALL removePropertyChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rxListener ) override { OPropertySetHelper::removePropertyChangeListener( rPropertyName, rxListener ); } + void SAL_CALL addVetoableChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rxListener ) override { OPropertySetHelper::addVetoableChangeListener( rPropertyName, rxListener ); } + void SAL_CALL removeVetoableChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rxListener ) override { OPropertySetHelper::removeVetoableChangeListener( rPropertyName, rxListener ); } + + // ::cppu::OPropertySetHelper + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any & rConvertedValue, css::uno::Any & rOldValue, sal_Int32 nHandle, const css::uno::Any& rValue ) override; + void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override; + using cppu::OPropertySetHelper::getFastPropertyValue; + void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override; + + // css::awt::XPrinterPropertySet + void SAL_CALL setHorizontal( sal_Bool bHorizontal ) override; + css::uno::Sequence< OUString > SAL_CALL getFormDescriptions( ) override; + void SAL_CALL selectForm( const OUString& aFormDescription ) override; + css::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup( ) override; + void SAL_CALL setBinarySetup( const css::uno::Sequence< sal_Int8 >& data ) override; +}; + + + + +typedef ::cppu::ImplInheritanceHelper < VCLXPrinterPropertySet + , css::awt::XPrinter + > VCLXPrinter_Base; +class VCLXPrinter final : public VCLXPrinter_Base +{ + std::shared_ptr<vcl::OldStylePrintAdaptor> mxListener; + JobSetup maInitJobSetup; +public: + VCLXPrinter( const OUString& rPrinterName ); + virtual ~VCLXPrinter() override; + + // css::beans::XPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override { return VCLXPrinterPropertySet::getPropertySetInfo(); } + void SAL_CALL setPropertyValue( const OUString& rPropertyName, const css::uno::Any& aValue ) override { VCLXPrinterPropertySet::setPropertyValue( rPropertyName, aValue ); } + css::uno::Any SAL_CALL getPropertyValue( const OUString& rPropertyName ) override { return VCLXPrinterPropertySet::getPropertyValue( rPropertyName ); } + void SAL_CALL addPropertyChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rxListener ) override { VCLXPrinterPropertySet::addPropertyChangeListener( rPropertyName, rxListener ); } + void SAL_CALL removePropertyChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rxListener ) override { VCLXPrinterPropertySet::removePropertyChangeListener( rPropertyName, rxListener ); } + void SAL_CALL addVetoableChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rxListener ) override { VCLXPrinterPropertySet::addVetoableChangeListener( rPropertyName, rxListener ); } + void SAL_CALL removeVetoableChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rxListener ) override { VCLXPrinterPropertySet::removeVetoableChangeListener( rPropertyName, rxListener ); } + + // css::awt::XPrinterPropertySet + void SAL_CALL setHorizontal( sal_Bool bHorizontal ) override { VCLXPrinterPropertySet::setHorizontal( bHorizontal ); } + css::uno::Sequence< OUString > SAL_CALL getFormDescriptions( ) override { return VCLXPrinterPropertySet::getFormDescriptions(); } + void SAL_CALL selectForm( const OUString& aFormDescription ) override { VCLXPrinterPropertySet::selectForm( aFormDescription ); } + css::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup( ) override { return VCLXPrinterPropertySet::getBinarySetup(); } + void SAL_CALL setBinarySetup( const css::uno::Sequence< sal_Int8 >& data ) override { VCLXPrinterPropertySet::setBinarySetup( data ); } + + // css::awt::XPrinter + sal_Bool SAL_CALL start( const OUString& nJobName, sal_Int16 nCopies, sal_Bool nCollate ) override; + void SAL_CALL end( ) override; + void SAL_CALL terminate( ) override; + css::uno::Reference< css::awt::XDevice > SAL_CALL startPage( ) override; + void SAL_CALL endPage( ) override; +}; + + + + +typedef ::cppu::ImplInheritanceHelper < VCLXPrinterPropertySet + , css::awt::XInfoPrinter + > VCLXInfoPrinter_Base; +class VCLXInfoPrinter final : public VCLXInfoPrinter_Base +{ +public: + VCLXInfoPrinter( const OUString& rPrinterName ); + virtual ~VCLXInfoPrinter() override; + + // css::beans::XPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override { return VCLXPrinterPropertySet::getPropertySetInfo(); } + void SAL_CALL setPropertyValue( const OUString& rPropertyName, const css::uno::Any& aValue ) override { VCLXPrinterPropertySet::setPropertyValue( rPropertyName, aValue ); } + css::uno::Any SAL_CALL getPropertyValue( const OUString& rPropertyName ) override { return VCLXPrinterPropertySet::getPropertyValue( rPropertyName ); } + void SAL_CALL addPropertyChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rxListener ) override { VCLXPrinterPropertySet::addPropertyChangeListener( rPropertyName, rxListener ); } + void SAL_CALL removePropertyChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& rxListener ) override { VCLXPrinterPropertySet::removePropertyChangeListener( rPropertyName, rxListener ); } + void SAL_CALL addVetoableChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rxListener ) override { VCLXPrinterPropertySet::addVetoableChangeListener( rPropertyName, rxListener ); } + void SAL_CALL removeVetoableChangeListener( const OUString& rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& rxListener ) override { VCLXPrinterPropertySet::removeVetoableChangeListener( rPropertyName, rxListener ); } + + // css::awt::XPrinterPropertySet + void SAL_CALL setHorizontal( sal_Bool bHorizontal ) override { VCLXPrinterPropertySet::setHorizontal( bHorizontal ); } + css::uno::Sequence< OUString > SAL_CALL getFormDescriptions( ) override { return VCLXPrinterPropertySet::getFormDescriptions(); } + void SAL_CALL selectForm( const OUString& aFormDescription ) override { VCLXPrinterPropertySet::selectForm( aFormDescription ); } + css::uno::Sequence< sal_Int8 > SAL_CALL getBinarySetup( ) override { return VCLXPrinterPropertySet::getBinarySetup(); } + void SAL_CALL setBinarySetup( const css::uno::Sequence< sal_Int8 >& data ) override { VCLXPrinterPropertySet::setBinarySetup( data ); } + + // css::awt::XInfoPrinter + css::uno::Reference< css::awt::XDevice > SAL_CALL createDevice( ) override; +}; + + + + +typedef ::cppu::WeakImplHelper < css::awt::XPrinterServer2, + css::lang::XServiceInfo + > VCLXPrinterServer_Base; +class VCLXPrinterServer final : public VCLXPrinterServer_Base +{ +public: + // css::awt::XPrinterServer2 + css::uno::Sequence< OUString > SAL_CALL getPrinterNames( ) override; + OUString SAL_CALL getDefaultPrinterName() override; + css::uno::Reference< css::awt::XPrinter > SAL_CALL createPrinter( const OUString& printerName ) override; + css::uno::Reference< css::awt::XInfoPrinter > SAL_CALL createInfoPrinter( const OUString& printerName ) override; + + OUString SAL_CALL getImplementationName() override; + + sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/awt/vclxregion.hxx b/toolkit/inc/awt/vclxregion.hxx new file mode 100644 index 000000000..70b79990c --- /dev/null +++ b/toolkit/inc/awt/vclxregion.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + + +#include <com/sun/star/awt/XRegion.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <comphelper/servicehelper.hxx> +#include <cppuhelper/implbase.hxx> +#include <mutex> + +#include <vcl/region.hxx> + + + + +class VCLXRegion final : public cppu::WeakImplHelper< + css::awt::XRegion, + css::lang::XUnoTunnel> +{ + std::mutex maMutex; + vcl::Region maRegion; + +public: + VCLXRegion(); + virtual ~VCLXRegion() override; + + const vcl::Region& GetRegion() const { return maRegion; } + + // css::lang::XUnoTunnel + UNO3_GETIMPLEMENTATION_DECL(VCLXRegion) + + // css::awt::XRegion + css::awt::Rectangle SAL_CALL getBounds() override; + void SAL_CALL clear() override; + void SAL_CALL move( sal_Int32 nHorzMove, sal_Int32 nVertMove ) override; + void SAL_CALL unionRectangle( const css::awt::Rectangle& rRect ) override; + void SAL_CALL intersectRectangle( const css::awt::Rectangle& rRect ) override; + void SAL_CALL excludeRectangle( const css::awt::Rectangle& rRect ) override; + void SAL_CALL xOrRectangle( const css::awt::Rectangle& rRect ) override; + void SAL_CALL unionRegion( const css::uno::Reference< css::awt::XRegion >& rxRegion ) override; + void SAL_CALL intersectRegion( const css::uno::Reference< css::awt::XRegion >& rxRegion ) override; + void SAL_CALL excludeRegion( const css::uno::Reference< css::awt::XRegion >& rxRegion ) override; + void SAL_CALL xOrRegion( const css::uno::Reference< css::awt::XRegion >& rxRegion ) override; + css::uno::Sequence< css::awt::Rectangle > SAL_CALL getRectangles() override; + +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/awt/vclxspinbutton.hxx b/toolkit/inc/awt/vclxspinbutton.hxx new file mode 100644 index 000000000..acd7a6898 --- /dev/null +++ b/toolkit/inc/awt/vclxspinbutton.hxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <toolkit/awt/vclxwindow.hxx> +#include <toolkit/helper/listenermultiplexer.hxx> +#include <cppuhelper/implbase1.hxx> +#include <comphelper/uno3.hxx> +#include <com/sun/star/awt/XSpinValue.hpp> + + +namespace toolkit +{ + + + //= VCLXSpinButton + + typedef ::cppu::ImplHelper1 < css::awt::XSpinValue + > VCLXSpinButton_Base; + + class VCLXSpinButton final : public VCLXWindow + ,public VCLXSpinButton_Base + { + private: + AdjustmentListenerMultiplexer maAdjustmentListeners; + + public: + VCLXSpinButton(); + + private: + virtual ~VCLXSpinButton( ) override; + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XComponent + void SAL_CALL dispose( ) override; + + // XSpinValue + virtual void SAL_CALL addAdjustmentListener( const css::uno::Reference< css::awt::XAdjustmentListener >& listener ) override; + virtual void SAL_CALL removeAdjustmentListener( const css::uno::Reference< css::awt::XAdjustmentListener >& listener ) override; + virtual void SAL_CALL setValue( sal_Int32 n ) override; + virtual void SAL_CALL setValues( sal_Int32 minValue, sal_Int32 maxValue, sal_Int32 currentValue ) override; + virtual sal_Int32 SAL_CALL getValue( ) override; + virtual void SAL_CALL setMinimum( sal_Int32 minValue ) override; + virtual void SAL_CALL setMaximum( sal_Int32 maxValue ) override; + virtual sal_Int32 SAL_CALL getMinimum( ) override; + virtual sal_Int32 SAL_CALL getMaximum( ) override; + virtual void SAL_CALL setSpinIncrement( sal_Int32 spinIncrement ) override; + virtual sal_Int32 SAL_CALL getSpinIncrement( ) override; + virtual void SAL_CALL setOrientation( sal_Int32 orientation ) override; + virtual sal_Int32 SAL_CALL getOrientation( ) override; + + // VclWindowPeer + virtual void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + virtual css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + // VCLXWindow + void ProcessWindowEvent( const VclWindowEvent& _rVclWindowEvent ) override; + + VCLXSpinButton( const VCLXSpinButton& ) = delete; + VCLXSpinButton& operator=( const VCLXSpinButton& ) = delete; + }; + + +} // namespacetoolkit + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/awt/vclxsystemdependentwindow.hxx b/toolkit/inc/awt/vclxsystemdependentwindow.hxx new file mode 100644 index 000000000..4bab43c49 --- /dev/null +++ b/toolkit/inc/awt/vclxsystemdependentwindow.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + + +#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp> +#include <cppuhelper/weak.hxx> + +#include <toolkit/awt/vclxwindow.hxx> + +class VCLXSystemDependentWindow final : public css::awt::XSystemDependentWindowPeer, + public VCLXWindow +{ +public: + VCLXSystemDependentWindow(); + virtual ~VCLXSystemDependentWindow() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XSystemDependentWindowPeer + css::uno::Any SAL_CALL getWindowHandle( const css::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/awt/vclxtabpagecontainer.hxx b/toolkit/inc/awt/vclxtabpagecontainer.hxx new file mode 100644 index 000000000..e300e03af --- /dev/null +++ b/toolkit/inc/awt/vclxtabpagecontainer.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/beans/XPropertiesChangeListener.hpp> +#include <com/sun/star/awt/tab/XTabPageContainer.hpp> +#include <cppuhelper/implbase.hxx> +#include <toolkit/helper/listenermultiplexer.hxx> +#include <awt/vclxcontainer.hxx> + + +typedef cppu::ImplInheritanceHelper< VCLXContainer, + css::awt::tab::XTabPageContainer, + css::beans::XPropertiesChangeListener, + css::container::XContainerListener + > VCLXTabPageContainer_Base; +class VCLXTabPageContainer final : public VCLXTabPageContainer_Base +{ +public: + VCLXTabPageContainer(); + virtual ~VCLXTabPageContainer() override; + + // css::awt::XView + void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) override; + + // css::awt::grid::XTabPageContainer + virtual ::sal_Int16 SAL_CALL getActiveTabPageID() override; + virtual void SAL_CALL setActiveTabPageID( ::sal_Int16 _activetabpageid ) override; + virtual ::sal_Int16 SAL_CALL getTabPageCount( ) override; + virtual sal_Bool SAL_CALL isTabPageActive( ::sal_Int16 tabPageIndex ) override; + virtual css::uno::Reference< css::awt::tab::XTabPage > SAL_CALL getTabPage( ::sal_Int16 tabPageIndex ) override; + virtual css::uno::Reference< css::awt::tab::XTabPage > SAL_CALL getTabPageByID( ::sal_Int16 tabPageID ) override; + virtual void SAL_CALL addTabPageContainerListener( const css::uno::Reference< css::awt::tab::XTabPageContainerListener >& listener ) override; + virtual void SAL_CALL removeTabPageContainerListener( const css::uno::Reference< css::awt::tab::XTabPageContainerListener >& listener ) override; + + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override; + + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + virtual void SAL_CALL elementInserted( const css::container::ContainerEvent& Event ) override; + virtual void SAL_CALL elementRemoved( const css::container::ContainerEvent& Event ) override; + virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override; + + // css::beans::XPropertiesChangeListener + virtual void SAL_CALL propertiesChange( const ::css::uno::Sequence< ::css::beans::PropertyChangeEvent >& aEvent ) override; + + // css::awt::XVclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; +private: + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + + TabPageListenerMultiplexer m_aTabPageListeners; + ::std::vector< css::uno::Reference< css::awt::tab::XTabPage > > m_aTabPages; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/awt/vclxtopwindow.hxx b/toolkit/inc/awt/vclxtopwindow.hxx new file mode 100644 index 000000000..ad07c2780 --- /dev/null +++ b/toolkit/inc/awt/vclxtopwindow.hxx @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_AWT_VCLXTOPWINDOW_HXX +#define INCLUDED_TOOLKIT_AWT_VCLXTOPWINDOW_HXX + +#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp> +#include <com/sun/star/awt/XTopWindow2.hpp> +#include <cppuhelper/weak.hxx> + +#include <cppuhelper/implbase2.hxx> + +#include <awt/vclxcontainer.hxx> + +namespace com::sun::star::awt { class XMenuBar; } + +typedef ::cppu::ImplHelper2 < css::awt::XTopWindow2, css::awt::XSystemDependentWindowPeer + > VCLXTopWindow_XBase; + + +class VCLXTopWindow: public VCLXTopWindow_XBase, + public VCLXContainer +{ +public: + VCLXTopWindow(); + virtual ~VCLXTopWindow() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XSystemDependentWindowPeer + css::uno::Any SAL_CALL getWindowHandle( const css::uno::Sequence< sal_Int8 >& ProcessId, sal_Int16 SystemType ) override; + + // css::awt::XTopWindow + void SAL_CALL addTopWindowListener( const css::uno::Reference< css::awt::XTopWindowListener >& rxListener ) override; + void SAL_CALL removeTopWindowListener( const css::uno::Reference< css::awt::XTopWindowListener >& rxListener ) override; + void SAL_CALL toFront() override; + void SAL_CALL toBack() override; + void SAL_CALL setMenuBar( const css::uno::Reference< css::awt::XMenuBar >& xMenu ) override; + + // XTopWindow2 + virtual sal_Bool SAL_CALL getIsMaximized() override; + virtual void SAL_CALL setIsMaximized( sal_Bool _ismaximized ) override; + virtual sal_Bool SAL_CALL getIsMinimized() override; + virtual void SAL_CALL setIsMinimized( sal_Bool _isminimized ) override; + virtual ::sal_Int32 SAL_CALL getDisplay() override; + virtual void SAL_CALL setDisplay( ::sal_Int32 _display ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + + +#endif // INCLUDED_TOOLKIT_AWT_VCLXTOPWINDOW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/awt/vclxwindows.hxx b/toolkit/inc/awt/vclxwindows.hxx new file mode 100644 index 000000000..21950271e --- /dev/null +++ b/toolkit/inc/awt/vclxwindows.hxx @@ -0,0 +1,697 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/awt/XCurrencyField.hpp> +#include <com/sun/star/awt/XDateField.hpp> +#include <com/sun/star/awt/XDialog2.hpp> +#include <com/sun/star/awt/XMessageBox.hpp> +#include <com/sun/star/awt/XMetricField.hpp> +#include <com/sun/star/awt/XNumericField.hpp> +#include <com/sun/star/awt/XPatternField.hpp> +#include <com/sun/star/awt/XProgressBar.hpp> +#include <com/sun/star/awt/XSimpleTabController.hpp> +#include <com/sun/star/awt/XTextArea.hpp> +#include <com/sun/star/awt/XTimeField.hpp> +#include <com/sun/star/util/Time.hpp> +#include <com/sun/star/util/Date.hpp> + +#include <tools/lineend.hxx> + +#include <awt/vclxtopwindow.hxx> +#include <toolkit/awt/vclxwindows.hxx> + +class FormatterBase; +class TabControl; +class TabPage; +class Edit; + +// class VCLXImageControl +class VCLXImageControl final : public VCLXGraphicControl +{ +public: + VCLXImageControl(); + virtual ~VCLXImageControl() override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& rNewSize ) override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } + +private: + virtual void ImplSetNewImage() override; +}; + +// class VCLXMessageBox +class VCLXMessageBox final : public css::awt::XMessageBox, + public VCLXTopWindow +{ +public: + VCLXMessageBox(); + virtual ~VCLXMessageBox() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + + // css::awt::XMessageBox + void SAL_CALL setCaptionText( const OUString& aText ) override; + OUString SAL_CALL getCaptionText( ) override; + void SAL_CALL setMessageText( const OUString& aText ) override; + OUString SAL_CALL getMessageText( ) override; + sal_Int16 SAL_CALL execute( ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize() override; + + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override; +}; + +// class VCLXFrame +class VCLXFrame final : public VCLXContainer +{ + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + +public: + VCLXFrame(); + virtual ~VCLXFrame() override; + + // css::uno::XInterface + void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XView + void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) override; + + // css::awt::XVclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + +// class VCLXDialog +class VCLXDialog final : public css::awt::XDialog2, + public VCLXTopWindow +{ +public: + VCLXDialog(); + virtual ~VCLXDialog() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XDialog2 + virtual void SAL_CALL endDialog( ::sal_Int32 Result ) override; + virtual void SAL_CALL setHelpId( const OUString& Id ) override; + + // css::awt::XDialog + void SAL_CALL setTitle( const OUString& Title ) override; + OUString SAL_CALL getTitle( ) override; + sal_Int16 SAL_CALL execute( ) override; + void SAL_CALL endExecute( ) override; + + // css::awt::XView + void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) override; + + // css::awt::XDevice, + css::awt::DeviceInfo SAL_CALL getInfo() override; + + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override; + + // css::awt::XVclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + +}; + +// class VCLXTabPage +class VCLXTabPage final : public VCLXContainer +{ +public: + VCLXTabPage(); + virtual ~VCLXTabPage() override; + + // css::uno::XInterface + void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XView + void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) override; + + // css::awt::XVclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + + /// @throws css::uno::RuntimeException + TabPage* getTabPage() const; + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + +class VCLXMultiPage final : public css::awt::XSimpleTabController, public VCLXContainer +{ + TabListenerMultiplexer maTabListeners; + sal_Int32 mTabId; + + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; +public: + VCLXMultiPage(); + virtual ~VCLXMultiPage() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::lang::XComponent + void SAL_CALL dispose( ) override; + + // css::awt::XView + void SAL_CALL draw( sal_Int32 nX, sal_Int32 nY ) override; + + // css::awt::XVclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + // XSimpleTabController + virtual ::sal_Int32 SAL_CALL insertTab() override; + virtual void SAL_CALL removeTab( ::sal_Int32 ID ) override; + + virtual void SAL_CALL setTabProps( ::sal_Int32 ID, const css::uno::Sequence< css::beans::NamedValue >& Properties ) override; + virtual css::uno::Sequence< css::beans::NamedValue > SAL_CALL getTabProps( ::sal_Int32 ID ) override; + + virtual void SAL_CALL activateTab( ::sal_Int32 ID ) override; + virtual ::sal_Int32 SAL_CALL getActiveTabID() override; + + virtual void SAL_CALL addTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) override; + virtual void SAL_CALL removeTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) override; + // C++ + /// @throws css::uno::RuntimeException + TabControl* getTabControl() const; + sal_uInt16 insertTab( TabPage*, OUString const & sTitle ); + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + +class VCLXMultiLineEdit final : public css::awt::XTextComponent, + public css::awt::XTextArea, + public css::awt::XTextLayoutConstrains, + public VCLXWindow +{ +private: + TextListenerMultiplexer maTextListeners; + LineEnd meLineEndType; + + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + +public: + VCLXMultiLineEdit(); + virtual ~VCLXMultiLineEdit() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { VCLXWindow::acquire(); } + void SAL_CALL release() noexcept override { VCLXWindow::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XTextComponent + void SAL_CALL addTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override; + void SAL_CALL removeTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override; + void SAL_CALL setText( const OUString& aText ) override; + void SAL_CALL insertText( const css::awt::Selection& Sel, const OUString& Text ) override; + OUString SAL_CALL getText( ) override; + OUString SAL_CALL getSelectedText( ) override; + void SAL_CALL setSelection( const css::awt::Selection& aSelection ) override; + css::awt::Selection SAL_CALL getSelection( ) override; + sal_Bool SAL_CALL isEditable( ) override; + void SAL_CALL setEditable( sal_Bool bEditable ) override; + void SAL_CALL setMaxTextLen( sal_Int16 nLen ) override; + sal_Int16 SAL_CALL getMaxTextLen( ) override; + + //XTextArea + OUString SAL_CALL getTextLines( ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override; + + // css::awt::XTextLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) override; + void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) override; + + // css::awt::XVclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + // css::awt::XWindow + void SAL_CALL setFocus( ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + +// class VCLXProgressBar +class VCLXProgressBar final : public css::awt::XProgressBar + , public VCLXWindow +{ +private: + sal_Int32 m_nValue; + sal_Int32 m_nValueMin; + sal_Int32 m_nValueMax; + + void ImplUpdateValue(); + +public: + VCLXProgressBar(); + virtual ~VCLXProgressBar() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { VCLXWindow::acquire(); } + void SAL_CALL release() noexcept override { VCLXWindow::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XProgressBar + void SAL_CALL setForegroundColor( sal_Int32 nColor ) override; + void SAL_CALL setBackgroundColor( sal_Int32 nColor ) override; + void SAL_CALL setValue( sal_Int32 nValue ) override; + void SAL_CALL setRange( sal_Int32 nMin, sal_Int32 nMax ) override; + sal_Int32 SAL_CALL getValue() override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + + +// class VCLXFormattedSpinField +class VCLXFormattedSpinField : public VCLXSpinField +{ +private: + FormatterBase* mpFormatter; + +protected: + FormatterBase* GetFormatter() const { return GetWindow() ? mpFormatter : nullptr; } + +public: + VCLXFormattedSpinField(); + virtual ~VCLXFormattedSpinField() override; + + void SetFormatter( FormatterBase* pFormatter ) { mpFormatter = pFormatter; } + + void setStrictFormat( bool bStrict ); + bool isStrictFormat() const; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + + +// class VCLXDateField + +class VCLXDateField : public css::awt::XDateField, + public VCLXFormattedSpinField +{ +protected: + virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; +public: + VCLXDateField(); + virtual ~VCLXDateField() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + + // css::awt::XDateField + void SAL_CALL setDate( const css::util::Date& Date ) override; + css::util::Date SAL_CALL getDate( ) override; + void SAL_CALL setMin( const css::util::Date& Date ) override; + css::util::Date SAL_CALL getMin( ) override; + void SAL_CALL setMax( const css::util::Date& Date ) override; + css::util::Date SAL_CALL getMax( ) override; + void SAL_CALL setFirst( const css::util::Date& Date ) override; + css::util::Date SAL_CALL getFirst( ) override; + void SAL_CALL setLast( const css::util::Date& Date ) override; + css::util::Date SAL_CALL getLast( ) override; + void SAL_CALL setLongFormat( sal_Bool bLong ) override; + sal_Bool SAL_CALL isLongFormat( ) override; + void SAL_CALL setEmpty( ) override; + sal_Bool SAL_CALL isEmpty( ) override; + void SAL_CALL setStrictFormat( sal_Bool bStrict ) override; + sal_Bool SAL_CALL isStrictFormat( ) override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + + +// class VCLXTimeField + +class VCLXTimeField final : public css::awt::XTimeField, + public VCLXFormattedSpinField +{ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; +public: + VCLXTimeField(); + virtual ~VCLXTimeField() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XTimeField + void SAL_CALL setTime( const css::util::Time& Time ) override; + css::util::Time SAL_CALL getTime( ) override; + void SAL_CALL setMin( const css::util::Time& Time ) override; + css::util::Time SAL_CALL getMin( ) override; + void SAL_CALL setMax( const css::util::Time& Time ) override; + css::util::Time SAL_CALL getMax( ) override; + void SAL_CALL setFirst( const css::util::Time& Time ) override; + css::util::Time SAL_CALL getFirst( ) override; + void SAL_CALL setLast( const css::util::Time& Time ) override; + css::util::Time SAL_CALL getLast( ) override; + void SAL_CALL setEmpty( ) override; + sal_Bool SAL_CALL isEmpty( ) override; + void SAL_CALL setStrictFormat( sal_Bool bStrict ) override; + sal_Bool SAL_CALL isStrictFormat( ) override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + + +// class VCLXNumericField + +class VCLXNumericField final : public css::awt::XNumericField, + public VCLXFormattedSpinField +{ +public: + VCLXNumericField(); + virtual ~VCLXNumericField() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XNumericField + void SAL_CALL setValue( double Value ) override; + double SAL_CALL getValue( ) override; + void SAL_CALL setMin( double Value ) override; + double SAL_CALL getMin( ) override; + void SAL_CALL setMax( double Value ) override; + double SAL_CALL getMax( ) override; + void SAL_CALL setFirst( double Value ) override; + double SAL_CALL getFirst( ) override; + void SAL_CALL setLast( double Value ) override; + double SAL_CALL getLast( ) override; + void SAL_CALL setSpinSize( double Value ) override; + double SAL_CALL getSpinSize( ) override; + void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) override; + sal_Int16 SAL_CALL getDecimalDigits( ) override; + void SAL_CALL setStrictFormat( sal_Bool bStrict ) override; + sal_Bool SAL_CALL isStrictFormat( ) override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + + +// class VCLXMetricField + +class MetricFormatter; +class MetricField; +class VCLXMetricField final : public css::awt::XMetricField, + public VCLXFormattedSpinField +{ + /// @throws css::uno::RuntimeException + MetricFormatter *GetMetricFormatter(); + /// @throws css::uno::RuntimeException + MetricField *GetMetricField(); + void CallListeners(); +public: + VCLXMetricField(); + virtual ~VCLXMetricField() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XMetricField + virtual void SAL_CALL setValue( ::sal_Int64 Value, ::sal_Int16 Unit ) override; + virtual void SAL_CALL setUserValue( ::sal_Int64 Value, ::sal_Int16 Unit ) override; + virtual ::sal_Int64 SAL_CALL getValue( ::sal_Int16 Unit ) override; + virtual ::sal_Int64 SAL_CALL getCorrectedValue( ::sal_Int16 Unit ) override; + virtual void SAL_CALL setMin( ::sal_Int64 Value, ::sal_Int16 Unit ) override; + virtual ::sal_Int64 SAL_CALL getMin( ::sal_Int16 Unit ) override; + virtual void SAL_CALL setMax( ::sal_Int64 Value, ::sal_Int16 Unit ) override; + virtual ::sal_Int64 SAL_CALL getMax( ::sal_Int16 Unit ) override; + virtual void SAL_CALL setFirst( ::sal_Int64 Value, ::sal_Int16 Unit ) override; + virtual ::sal_Int64 SAL_CALL getFirst( ::sal_Int16 Unit ) override; + virtual void SAL_CALL setLast( ::sal_Int64 Value, ::sal_Int16 Unit ) override; + virtual ::sal_Int64 SAL_CALL getLast( ::sal_Int16 Unit ) override; + virtual void SAL_CALL setSpinSize( ::sal_Int64 Value ) override; + virtual ::sal_Int64 SAL_CALL getSpinSize( ) override; + virtual void SAL_CALL setDecimalDigits( ::sal_Int16 nDigits ) override; + virtual ::sal_Int16 SAL_CALL getDecimalDigits( ) override; + virtual void SAL_CALL setStrictFormat( sal_Bool bStrict ) override; + virtual sal_Bool SAL_CALL isStrictFormat( ) override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + +// class VCLXPatternField +class VCLXPatternField final : public css::awt::XPatternField, + public VCLXFormattedSpinField +{ +public: + VCLXPatternField(); + virtual ~VCLXPatternField() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakObject::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + + // css::awt::XPatternField + void SAL_CALL setMasks( const OUString& EditMask, const OUString& LiteralMask ) override; + void SAL_CALL getMasks( OUString& EditMask, OUString& LiteralMask ) override; + void SAL_CALL setString( const OUString& Str ) override; + OUString SAL_CALL getString( ) override; + void SAL_CALL setStrictFormat( sal_Bool bStrict ) override; + sal_Bool SAL_CALL isStrictFormat( ) override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + + +class VCLXFileControl final : public css::awt::XTextComponent, public css::awt::XTextLayoutConstrains, public VCLXWindow +{ + DECL_LINK(ModifyHdl, Edit&, void); + void ModifyHdl(); + TextListenerMultiplexer maTextListeners; + +public: + VCLXFileControl(); + virtual ~VCLXFileControl() override; + + virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ) override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { VCLXWindow::acquire(); } + void SAL_CALL release() noexcept override { VCLXWindow::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XTextComponent + void SAL_CALL addTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override; + void SAL_CALL removeTextListener( const css::uno::Reference< css::awt::XTextListener >& l ) override; + void SAL_CALL setText( const OUString& aText ) override; + void SAL_CALL insertText( const css::awt::Selection& Sel, const OUString& Text ) override; + OUString SAL_CALL getText( ) override; + OUString SAL_CALL getSelectedText( ) override; + void SAL_CALL setSelection( const css::awt::Selection& aSelection ) override; + css::awt::Selection SAL_CALL getSelection( ) override; + sal_Bool SAL_CALL isEditable( ) override; + void SAL_CALL setEditable( sal_Bool bEditable ) override; + void SAL_CALL setMaxTextLen( sal_Int16 nLen ) override; + sal_Int16 SAL_CALL getMaxTextLen( ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( ) override; + css::awt::Size SAL_CALL getPreferredSize( ) override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override; + + // css::awt::XTextLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize( sal_Int16 nCols, sal_Int16 nLines ) override; + void SAL_CALL getColumnsAndLines( sal_Int16& nCols, sal_Int16& nLines ) override; + + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + +class SVTXCurrencyField final : public css::awt::XCurrencyField, public SVTXFormattedField +{ +public: + SVTXCurrencyField(); + virtual ~SVTXCurrencyField() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { SVTXFormattedField::acquire(); } + void SAL_CALL release() noexcept override { SVTXFormattedField::release(); } + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XVclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + // css::awt::XCurrencyField + void SAL_CALL setValue( double Value ) override; + double SAL_CALL getValue( ) override; + void SAL_CALL setMin( double Value ) override; + double SAL_CALL getMin( ) override; + void SAL_CALL setMax( double Value ) override; + double SAL_CALL getMax( ) override; + void SAL_CALL setFirst( double Value ) override; + double SAL_CALL getFirst( ) override; + void SAL_CALL setLast( double Value ) override; + double SAL_CALL getLast( ) override; + void SAL_CALL setSpinSize( double Value ) override; + double SAL_CALL getSpinSize( ) override; + void SAL_CALL setDecimalDigits( sal_Int16 nDigits ) override; + sal_Int16 SAL_CALL getDecimalDigits( ) override; + void SAL_CALL setStrictFormat( sal_Bool bStrict ) override; + sal_Bool SAL_CALL isStrictFormat( ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + + +class SVTXDateField final : public VCLXDateField +{ +public: + SVTXDateField(); + virtual ~SVTXDateField() override; + + // css::awt::VclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + + static void ImplGetPropertyIds( std::vector< sal_uInt16 > &aIds ); + virtual void GetPropertyIds( std::vector< sal_uInt16 > &aIds ) override { return ImplGetPropertyIds( aIds ); } +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/accessiblecontrolcontext.hxx b/toolkit/inc/controls/accessiblecontrolcontext.hxx new file mode 100644 index 000000000..d5233cc54 --- /dev/null +++ b/toolkit/inc/controls/accessiblecontrolcontext.hxx @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <comphelper/accessiblecomponenthelper.hxx> +#include <comphelper/accimplaccess.hxx> +#include <comphelper/uno3.hxx> +#include <com/sun/star/lang/XEventListener.hpp> +#include <rtl/ref.hxx> + +namespace vcl { class Window; } +namespace com::sun::star::awt { class XWindow; } +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::beans { class XPropertySetInfo; } + +namespace toolkit +{ + + + //= OAccessibleControlContext + + + typedef ::comphelper::OAccessibleComponentHelper OAccessibleControlContext_Base; + typedef ::cppu::ImplHelper1 < css::lang::XEventListener + > OAccessibleControlContext_IBase; + + /** class implementing the AccessibleContext for a UNO control - to be used in design mode of the control. + <p><b>life time control<b/><br/> + This control should be held weak by the creator (a UNO control), it itself holds a hard reference to the + control model, and a weak reference to the control. The reference to the model is freed when the model + is being disposed.</p> + */ + class OAccessibleControlContext final + :public ::comphelper::OAccessibleImplementationAccess + ,public OAccessibleControlContext_Base + ,public OAccessibleControlContext_IBase + { + public: + /** creates an accessible context for a uno control + @param _rxCreator + the uno control's XAccessible interface. This must be an XControl, from which an XControlModel + can be retrieved. + */ + static rtl::Reference<OAccessibleControlContext> create( + const css::uno::Reference< css::accessibility::XAccessible >& _rxCreator + ); + + // XInterface + DECLARE_XINTERFACE( ) + DECLARE_XTYPEPROVIDER( ) + private: + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; + virtual OUString SAL_CALL getAccessibleDescription( ) override; + virtual OUString SAL_CALL getAccessibleName( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; + + // XAccessibleComponent + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + virtual void SAL_CALL grabFocus( ) override; + virtual sal_Int32 SAL_CALL getForeground( ) override; + virtual sal_Int32 SAL_CALL getBackground( ) override; + + // XEventListener + using comphelper::OAccessibleContextHelper::disposing; + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // retrieves the value of a string property from the model, if the property is present + OUString getModelStringProperty( const char* _pPropertyName ); + + // starts listening at the control model (currently for disposal only) + void startModelListening( ); + // stops listening at the control model + void stopModelListening( ); + + vcl::Window* implGetWindow( css::uno::Reference< css::awt::XWindow >* _pxUNOWindow = nullptr ) const; + + /// ctor. @see Init + OAccessibleControlContext(); + virtual ~OAccessibleControlContext() override; + + /** late ctor + */ + void Init( + const css::uno::Reference< css::accessibility::XAccessible >& _rxCreator + ); + + // OCommonAccessibleComponent overridables + virtual css::awt::Rectangle implGetBounds( ) override; + + css::uno::Reference< css::beans::XPropertySet > + m_xControlModel; // the model of the control which's context we implement + css::uno::Reference< css::beans::XPropertySetInfo > + m_xModelPropsInfo; // the cached property set info of the model + }; + + +} // namespace toolkit + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/animatedimages.hxx b/toolkit/inc/controls/animatedimages.hxx new file mode 100644 index 000000000..a341447c5 --- /dev/null +++ b/toolkit/inc/controls/animatedimages.hxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <toolkit/controls/unocontrolmodel.hxx> +#include <com/sun/star/awt/XAnimatedImages.hpp> +#include <cppuhelper/implbase1.hxx> + +namespace com::sun::star::container { class XContainerListener; } +namespace com::sun::star::uno { class XComponentContext; } + +namespace toolkit +{ + + + typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel + , css::awt::XAnimatedImages + > AnimatedImagesControlModel_Base; + class AnimatedImagesControlModel : public AnimatedImagesControlModel_Base + { + public: + AnimatedImagesControlModel( css::uno::Reference< css::uno::XComponentContext > const & i_factory ); + AnimatedImagesControlModel( const AnimatedImagesControlModel& i_copySource ); + + virtual rtl::Reference<UnoControlModel> Clone() const override; + + // XPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // XPersistObject + OUString SAL_CALL getServiceName() override; + + // XServiceInfo + OUString SAL_CALL getImplementationName( ) override; + css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAnimatedImages + virtual ::sal_Int32 SAL_CALL getStepTime() override; + virtual void SAL_CALL setStepTime( ::sal_Int32 _steptime ) override; + virtual sal_Bool SAL_CALL getAutoRepeat() override; + virtual void SAL_CALL setAutoRepeat( sal_Bool _autorepeat ) override; + virtual ::sal_Int16 SAL_CALL getScaleMode() override; + virtual void SAL_CALL setScaleMode( ::sal_Int16 _scalemode ) override; + virtual ::sal_Int32 SAL_CALL getImageSetCount( ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getImageSet( ::sal_Int32 i_index ) override; + virtual void SAL_CALL insertImageSet( ::sal_Int32 i_index, const css::uno::Sequence< OUString >& i_imageURLs ) override; + virtual void SAL_CALL replaceImageSet( ::sal_Int32 i_index, const css::uno::Sequence< OUString >& i_imageURLs ) override; + virtual void SAL_CALL removeImageSet( ::sal_Int32 i_index ) override; + + // XAnimatedImages::XContainer + virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& i_listener ) override; + virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& i_listener ) override; + + protected: + virtual ~AnimatedImagesControlModel() override; + + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override; + + private: + std::vector< css::uno::Sequence< OUString > > maImageSets; + }; + + +} // namespace toolkit + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/controlmodelcontainerbase.hxx b/toolkit/inc/controls/controlmodelcontainerbase.hxx new file mode 100644 index 000000000..1bbc3f301 --- /dev/null +++ b/toolkit/inc/controls/controlmodelcontainerbase.hxx @@ -0,0 +1,270 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/awt/XTabControllerModel.hpp> +#include <com/sun/star/util/XChangesNotifier.hpp> +#include <com/sun/star/util/XChangesListener.hpp> +#include <com/sun/star/util/XModifyListener.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <cppuhelper/implbase8.hxx> +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/weak.hxx> +#include <toolkit/helper/listenermultiplexer.hxx> +#include <toolkit/controls/unocontrolmodel.hxx> +#include <controls/unocontrolcontainer.hxx> +#include <cppuhelper/propshlp.hxx> +#include <com/sun/star/awt/tab/XTabPageModel.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <comphelper/interfacecontainer3.hxx> +#include <mutex> +#include <vector> + +namespace com::sun::star::resource { class XStringResourceResolver; } +namespace com::sun::star::uno { class XComponentContext; } + + +typedef UnoControlModel ControlModel_Base; +typedef ::cppu::AggImplInheritanceHelper8 < ControlModel_Base + , css::lang::XMultiServiceFactory + , css::container::XContainer + , css::container::XNameContainer + , css::awt::XTabControllerModel + , css::util::XChangesNotifier + , css::beans::XPropertyChangeListener + , css::awt::tab::XTabPageModel + , css::lang::XInitialization + > ControlModelContainer_IBase; + +class ControlModelContainerBase : public ControlModelContainer_IBase +{ +public: + enum ChildOperation { Insert = 0, Remove }; + // would like to make this typedef private, too, but the Forte 7 compiler does have + // problems with this... + typedef ::std::pair< css::uno::Reference< css::awt::XControlModel >, OUString > + UnoControlModelHolder; +private: + typedef ::std::vector< UnoControlModelHolder > UnoControlModelHolderVector; + +public: + // for grouping control models (XTabControllerModel::getGroupXXX) + typedef ::std::vector< css::uno::Reference< css::awt::XControlModel > > + ModelGroup; + typedef ::std::vector< ModelGroup > AllGroups; + + friend struct CloneControlModel; + friend struct CompareControlModel; + +protected: + ContainerListenerMultiplexer maContainerListeners; + ::comphelper::OInterfaceContainerHelper3<css::util::XChangesListener> maChangeListeners; + UnoControlModelHolderVector maModels; + + AllGroups maGroups; + bool mbGroupsUpToDate; + + OUString m_sImageURL; + OUString m_sTooltip; + sal_Int16 m_nTabPageId; + + void Clone_Impl(ControlModelContainerBase& _rClone) const; +protected: + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + + UnoControlModelHolderVector::iterator ImplFindElement( std::u16string_view rName ); + + /// @throws css::lang::IllegalArgumentException + /// @throws css::container::ElementExistException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + void updateUserFormChildren( const css::uno::Reference< css::container::XNameContainer >& xAllChildren, const OUString& aName, ChildOperation Operation, const css::uno::Reference< css::awt::XControlModel >& xTarget ); +public: + ControlModelContainerBase( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + ControlModelContainerBase( const ControlModelContainerBase& rModel ); + virtual ~ControlModelContainerBase() override; + + rtl::Reference<UnoControlModel> Clone() const override; + + // css::container::XContainer + void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + + // css::container::XElementAccess + css::uno::Type SAL_CALL getElementType( ) override; + sal_Bool SAL_CALL hasElements( ) override; + + // css::container::XNameContainer, XNameReplace, XNameAccess + void SAL_CALL replaceByName( const OUString& aName, const css::uno::Any& aElement ) override; + css::uno::Any SAL_CALL getByName( const OUString& aName ) override; + css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override; + sal_Bool SAL_CALL hasByName( const OUString& aName ) override; + void SAL_CALL insertByName( const OUString& aName, const css::uno::Any& aElement ) override; + void SAL_CALL removeByName( const OUString& Name ) override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::lang::XMultiServiceFactory + css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier ) override; + css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const OUString& ServiceSpecifier, const css::uno::Sequence< css::uno::Any >& Arguments ) override; + css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames( ) override; + + // XComponent + void SAL_CALL dispose( ) override; + + // XTabControllerModel + virtual sal_Bool SAL_CALL getGroupControl( ) override; + virtual void SAL_CALL setGroupControl( sal_Bool GroupControl ) override; + virtual void SAL_CALL setControlModels( const css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& Controls ) override; + virtual css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > > SAL_CALL getControlModels( ) override; + virtual void SAL_CALL setGroup( const css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& Group, const OUString& GroupName ) override; + virtual sal_Int32 SAL_CALL getGroupCount( ) override; + virtual void SAL_CALL getGroup( sal_Int32 nGroup, css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& Group, OUString& Name ) override; + virtual void SAL_CALL getGroupByName( const OUString& Name, css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& Group ) override; + + // XChangesNotifier + virtual void SAL_CALL addChangesListener( const css::uno::Reference< css::util::XChangesListener >& aListener ) override; + virtual void SAL_CALL removeChangesListener( const css::uno::Reference< css::util::XChangesListener >& aListener ) override; + + // XPropertyChangeListener + virtual void SAL_CALL propertyChange( const css::beans::PropertyChangeEvent& evt ) override; + + // XEventListener + using cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL disposing( const css::lang::EventObject& evt ) override; + + // XServiceInfo + DECLIMPL_SERVICEINFO_DERIVED(ControlModelContainerBase, ControlModel_Base, "toolkit.ControlModelContainerBase" ) + + // XInitialization + virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments) override; + + // css::awt::tab::XTabPageModel + virtual ::sal_Int16 SAL_CALL getTabPageID() override; + virtual sal_Bool SAL_CALL getEnabled() override; + virtual void SAL_CALL setEnabled( sal_Bool _enabled ) override; + virtual OUString SAL_CALL getTitle() override; + virtual void SAL_CALL setTitle( const OUString& _title ) override; + virtual OUString SAL_CALL getImageURL() override; + virtual void SAL_CALL setImageURL( const OUString& _imageurl ) override; + virtual OUString SAL_CALL getToolTip() override; + virtual void SAL_CALL setToolTip( const OUString& _tooltip ) override; + +protected: + void startControlListening( const css::uno::Reference< css::awt::XControlModel >& _rxChildModel ); + void stopControlListening( const css::uno::Reference< css::awt::XControlModel >& _rxChildModel ); + + void implNotifyTabModelChange( const OUString& _rAccessor ); + + void implUpdateGroupStructure(); +}; + +class ResourceListener final : public css::util::XModifyListener, + public ::cppu::OWeakObject +{ + public: + ResourceListener( const css::uno::Reference< css::util::XModifyListener >& xListener ); + virtual ~ResourceListener() override; + + void startListening( const css::uno::Reference< css::resource::XStringResourceResolver >& rResource ); + void stopListening(); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // XModifyListener + virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + private: + std::mutex m_aMutex; + css::uno::Reference< css::resource::XStringResourceResolver > m_xResource; + css::uno::Reference< css::util::XModifyListener > m_xListener; + bool m_bListening; +}; + +typedef ::cppu::AggImplInheritanceHelper3 < UnoControlContainer + , css::container::XContainerListener + , css::util::XChangesListener + , css::util::XModifyListener + > ControlContainer_IBase; + +class ControlContainerBase : public ControlContainer_IBase +{ +protected: + css::uno::Reference< css::uno::XComponentContext > m_xContext; + bool mbSizeModified; + bool mbPosModified; + css::uno::Reference< css::awt::XTabController > mxTabController; + css::uno::Reference< css::util::XModifyListener > mxListener; + + void ImplInsertControl( css::uno::Reference< css::awt::XControlModel > const & rxModel, const OUString& rName ); + void ImplRemoveControl( css::uno::Reference< css::awt::XControlModel > const & rxModel ); + virtual void ImplSetPosSize( css::uno::Reference< css::awt::XControl >& rxCtrl ); + void ImplUpdateResourceResolver(); + void ImplStartListingForResourceEvents(); + +#ifdef _MSC_VER + // just implemented to let the various FooImplInheritanceHelper compile + ControlContainerBase(); +#endif + +public: + ControlContainerBase( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual ~ControlContainerBase() override; + + DECLIMPL_SERVICEINFO_DERIVED( ControlContainerBase, UnoControlBase, "toolkit.ControlContainerBase" ) + + void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + void SAL_CALL dispose() override; + + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + + // css::container::XContainerListener + void SAL_CALL elementInserted( const css::container::ContainerEvent& Event ) override; + void SAL_CALL elementRemoved( const css::container::ContainerEvent& Event ) override; + void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override; + + // XChangesListener + virtual void SAL_CALL changesOccurred( const css::util::ChangesEvent& Event ) override; + + // css::awt::XControl + sal_Bool SAL_CALL setModel( const css::uno::Reference< css::awt::XControlModel >& Model ) override; + void SAL_CALL setDesignMode( sal_Bool bOn ) override; + // XModifyListener + // Using a dummy/no-op implementation here, not sure if every container control needs + // to implement this, certainly Dialog does, lets see about others + virtual void SAL_CALL modified( const css::lang::EventObject& ) override {} +protected: + virtual void ImplModelPropertiesChanged( const css::uno::Sequence< css::beans::PropertyChangeEvent >& rEvents ) override; + virtual void removingControl( const css::uno::Reference< css::awt::XControl >& _rxControl ) override; + virtual void addingControl( const css::uno::Reference< css::awt::XControl >& _rxControl ) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/dialogcontrol.hxx b/toolkit/inc/controls/dialogcontrol.hxx new file mode 100644 index 000000000..b23c60f44 --- /dev/null +++ b/toolkit/inc/controls/dialogcontrol.hxx @@ -0,0 +1,311 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <controls/controlmodelcontainerbase.hxx> +#include <com/sun/star/awt/UnoControlDialog.hpp> +#include <com/sun/star/awt/XSimpleTabController.hpp> +#include <toolkit/helper/macros.hxx> +#include <cppuhelper/implbase2.hxx> + +namespace com::sun::star::awt { class XTopWindowListener; } + +typedef ::cppu::AggImplInheritanceHelper2 < ControlContainerBase + , css::awt::XUnoControlDialog + , css::awt::XWindowListener + > UnoDialogControl_Base; +class UnoDialogControl final : public UnoDialogControl_Base +{ +private: + css::uno::Reference< css::awt::XMenuBar > mxMenuBar; + TopWindowListenerMultiplexer maTopWindowListeners; + bool mbWindowListener; + +public: + + UnoDialogControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual ~UnoDialogControl() override; + OUString GetComponentServiceName() const override; + + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + void SAL_CALL dispose() override; + + // css::awt::XTopWindow + void SAL_CALL addTopWindowListener( const css::uno::Reference< css::awt::XTopWindowListener >& xListener ) override; + void SAL_CALL removeTopWindowListener( const css::uno::Reference< css::awt::XTopWindowListener >& xListener ) override; + void SAL_CALL toFront( ) override; + void SAL_CALL toBack( ) override; + void SAL_CALL setMenuBar( const css::uno::Reference< css::awt::XMenuBar >& xMenu ) override; + + // css::awt::XWindowListener + virtual void SAL_CALL windowResized( const css::awt::WindowEvent& e ) override; + virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& e ) override; + virtual void SAL_CALL windowShown( const css::lang::EventObject& e ) override; + virtual void SAL_CALL windowHidden( const css::lang::EventObject& e ) override; + + // css::awt::XDialog2 + virtual void SAL_CALL endDialog( ::sal_Int32 Result ) override; + virtual void SAL_CALL setHelpId( const OUString& Id ) override; + + // css::awt::XDialog + void SAL_CALL setTitle( const OUString& Title ) override; + OUString SAL_CALL getTitle() override; + sal_Int16 SAL_CALL execute() override; + void SAL_CALL endExecute() override; + + // css::awt::XControl + sal_Bool SAL_CALL setModel( const css::uno::Reference< css::awt::XControlModel >& Model ) override; + + // XModifyListener + virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; + + // resolve some ambiguous methods + virtual css::uno::Reference<css::awt::XWindowPeer> SAL_CALL getPeer() override + { return UnoDialogControl_Base::ControlContainerBase::getPeer(); } + virtual void SAL_CALL addWindowListener(const css::uno::Reference<css::awt::XWindowListener>& p1) override + { UnoDialogControl_Base::ControlContainerBase::addWindowListener(p1); } + virtual css::uno::Reference<css::awt::XControlModel> SAL_CALL getModel() override + { return UnoDialogControl_Base::ControlContainerBase::getModel(); } + virtual void SAL_CALL addEventListener(const css::uno::Reference<css::lang::XEventListener>& p1) override + { UnoDialogControl_Base::ControlContainerBase::addEventListener(p1); } + virtual void SAL_CALL removeEventListener(const css::uno::Reference<css::lang::XEventListener>& p1) override + { UnoDialogControl_Base::ControlContainerBase::removeEventListener(p1); } + virtual void SAL_CALL setContext(const css::uno::Reference<css::uno::XInterface>& p1) override + { UnoDialogControl_Base::ControlContainerBase::setContext(p1); } + virtual css::uno::Reference<css::uno::XInterface> SAL_CALL getContext() override + { return UnoDialogControl_Base::ControlContainerBase::getContext(); } + virtual css::uno::Reference<css::awt::XView> SAL_CALL getView() override + { return UnoDialogControl_Base::ControlContainerBase::getView(); } + virtual void SAL_CALL setDesignMode(sal_Bool p1) override + { UnoDialogControl_Base::ControlContainerBase::setDesignMode(p1); } + virtual sal_Bool SAL_CALL isDesignMode() override + { return UnoDialogControl_Base::ControlContainerBase::isDesignMode(); } + virtual sal_Bool SAL_CALL isTransparent() override + { return UnoDialogControl_Base::ControlContainerBase::isTransparent(); } + virtual void SAL_CALL setPosSize(sal_Int32 p1, sal_Int32 p2, sal_Int32 p3, sal_Int32 p4, sal_Int16 p5) override + { UnoDialogControl_Base::ControlContainerBase::setPosSize(p1, p2, p3, p4, p5); } + virtual css::awt::Rectangle SAL_CALL getPosSize() override + { return UnoDialogControl_Base::ControlContainerBase::getPosSize(); } + virtual void SAL_CALL setVisible(sal_Bool p1) override + { UnoDialogControl_Base::ControlContainerBase::setVisible(p1); } + virtual void SAL_CALL setEnable(sal_Bool p1) override + { UnoDialogControl_Base::ControlContainerBase::setEnable(p1); } + virtual void SAL_CALL setFocus() override + { UnoDialogControl_Base::ControlContainerBase::setFocus(); } + virtual void SAL_CALL removeWindowListener(const css::uno::Reference<css::awt::XWindowListener>& p1) override + { UnoDialogControl_Base::ControlContainerBase::removeWindowListener(p1); } + virtual void SAL_CALL addFocusListener(const css::uno::Reference<css::awt::XFocusListener>& p1) override + { UnoDialogControl_Base::ControlContainerBase::addFocusListener(p1); } + virtual void SAL_CALL removeFocusListener(const css::uno::Reference<css::awt::XFocusListener>& p1) override + { UnoDialogControl_Base::ControlContainerBase::removeFocusListener(p1); } + virtual void SAL_CALL addKeyListener(const css::uno::Reference<css::awt::XKeyListener>& p1) override + { UnoDialogControl_Base::ControlContainerBase::addKeyListener(p1); } + virtual void SAL_CALL removeKeyListener(const css::uno::Reference<css::awt::XKeyListener>& p1) override + { UnoDialogControl_Base::ControlContainerBase::removeKeyListener(p1); } + virtual void SAL_CALL addMouseListener(const css::uno::Reference<css::awt::XMouseListener>& p1) override + { UnoDialogControl_Base::ControlContainerBase::addMouseListener(p1); } + virtual void SAL_CALL removeMouseListener(const css::uno::Reference<css::awt::XMouseListener>& p1) override + { UnoDialogControl_Base::ControlContainerBase::removeMouseListener(p1); } + virtual void SAL_CALL addMouseMotionListener(const css::uno::Reference<css::awt::XMouseMotionListener>& p1) override + { UnoDialogControl_Base::ControlContainerBase::addMouseMotionListener(p1); } + virtual void SAL_CALL removeMouseMotionListener(const css::uno::Reference<css::awt::XMouseMotionListener>& p1) override + { UnoDialogControl_Base::ControlContainerBase::removeMouseMotionListener(p1); } + virtual void SAL_CALL addPaintListener(const css::uno::Reference<css::awt::XPaintListener>& p1) override + { UnoDialogControl_Base::ControlContainerBase::addPaintListener(p1); } + virtual void SAL_CALL removePaintListener(const css::uno::Reference<css::awt::XPaintListener>& p1) override + { UnoDialogControl_Base::ControlContainerBase::removePaintListener(p1); } + virtual void SAL_CALL setStatusText(const OUString& p1) override + { UnoDialogControl_Base::ControlContainerBase::setStatusText(p1); } + virtual css::uno::Sequence<css::uno::Reference<css::awt::XControl> > SAL_CALL getControls() override + { return UnoDialogControl_Base::ControlContainerBase::getControls(); } + virtual css::uno::Reference<css::awt::XControl> SAL_CALL getControl(const OUString& p1) override + { return UnoDialogControl_Base::ControlContainerBase::getControl(p1); } + virtual void SAL_CALL addControl(const OUString& p1, const css::uno::Reference<css::awt::XControl>& p2) override + { UnoDialogControl_Base::ControlContainerBase::addControl(p1, p2); } + virtual void SAL_CALL removeControl(const css::uno::Reference<css::awt::XControl>& p1) override + { UnoDialogControl_Base::ControlContainerBase::removeControl(p1); } + + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + +private: + virtual void PrepareWindowDescriptor( css::awt::WindowDescriptor& rDesc ) override; + virtual void ImplModelPropertiesChanged( const css::uno::Sequence< css::beans::PropertyChangeEvent >& rEvents ) override; +}; + +class UnoMultiPageModel final : public ControlModelContainerBase +{ +public: + UnoMultiPageModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual ~UnoMultiPageModel() override; + + UnoMultiPageModel(UnoMultiPageModel const &) = default; + UnoMultiPageModel(UnoMultiPageModel &&) = default; + UnoMultiPageModel & operator =(UnoMultiPageModel const &) = delete; // due to ControlModelContainerBase + UnoMultiPageModel & operator =(UnoMultiPageModel &&) = delete; // due to ControlModelContainerBase + + rtl::Reference<UnoControlModel> Clone() const override; + + DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageModel, ControlModelContainerBase, "com.sun.star.awt.UnoMultiPageModel" ) + + virtual OUString SAL_CALL getServiceName() override; + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XNamedContainer + void SAL_CALL insertByName( const OUString& aName, const css::uno::Any& aElement ) override; + + // Override the method of parent class + virtual sal_Bool SAL_CALL getGroupControl( ) override; +private: + virtual css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + +}; + +class UnoMultiPageControl final : public ControlContainerBase + ,public css::awt::XSimpleTabController + ,public css::awt::XTabListener +{ + TabListenerMultiplexer maTabListeners; + void bindPage( const css::uno::Reference< css::awt::XControl >& _rxControl ); +public: + UnoMultiPageControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual ~UnoMultiPageControl() override; + OUString GetComponentServiceName() const override; + + // css::lang::XServiceInfo + DECLIMPL_SERVICEINFO_DERIVED( UnoMultiPageControl, ControlContainerBase, "com.sun.star.awt.UnoControlMultiPage" ) + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return ControlContainerBase::queryInterface(rType); } + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakAggObject::release(); } + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + // css::awt::XSimpleTabController + virtual ::sal_Int32 SAL_CALL insertTab() override; + virtual void SAL_CALL removeTab( ::sal_Int32 ID ) override; + + virtual void SAL_CALL setTabProps( ::sal_Int32 ID, const css::uno::Sequence< css::beans::NamedValue >& Properties ) override; + virtual css::uno::Sequence< css::beans::NamedValue > SAL_CALL getTabProps( ::sal_Int32 ID ) override; + + virtual void SAL_CALL activateTab( ::sal_Int32 ID ) override; + virtual ::sal_Int32 SAL_CALL getActiveTabID() override; + + virtual void SAL_CALL addTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) override; + virtual void SAL_CALL removeTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) override; + // XTabListener + virtual void SAL_CALL inserted( ::sal_Int32 ID ) override; + virtual void SAL_CALL removed( ::sal_Int32 ID ) override; + virtual void SAL_CALL changed( ::sal_Int32 ID, const css::uno::Sequence< css::beans::NamedValue >& Properties ) override; + virtual void SAL_CALL activated( ::sal_Int32 ID ) override; + virtual void SAL_CALL deactivated( ::sal_Int32 ID ) override; + virtual void SAL_CALL disposing( const css::lang::EventObject& evt ) override; + // XComponent + void SAL_CALL dispose( ) override; + +private: + virtual void impl_createControlPeerIfNecessary( + const css::uno::Reference< css::awt::XControl >& _rxControl + ) override; + +}; + + +class UnoPageModel final : public ControlModelContainerBase +{ +public: + UnoPageModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual ~UnoPageModel() override; + + UnoPageModel(UnoPageModel const &) = default; + UnoPageModel(UnoPageModel &&) = default; + UnoPageModel & operator =(UnoPageModel const &) = delete; // due to ControlModelContainerBase + UnoPageModel & operator =(UnoPageModel &&) = delete; // due to ControlModelContainerBase + + rtl::Reference<UnoControlModel> Clone() const override; + + DECLIMPL_SERVICEINFO_DERIVED( UnoPageModel, ControlModelContainerBase, "com.sun.star.awt.UnoPageModel" ) + + virtual OUString SAL_CALL getServiceName() override; + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // Override the method of parent class + virtual sal_Bool SAL_CALL getGroupControl( ) override; +private: + virtual css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + +}; + +class UnoPageControl final : public ControlContainerBase +{ +public: + UnoPageControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual ~UnoPageControl() override; + OUString GetComponentServiceName() const override; + + + // css::lang::XServiceInfo + DECLIMPL_SERVICEINFO_DERIVED( UnoPageControl, ControlContainerBase, "com.sun.star.awt.UnoControlPage" ) +}; + +class UnoFrameModel final : public ControlModelContainerBase +{ +public: + UnoFrameModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual ~UnoFrameModel() override; + + UnoFrameModel(UnoFrameModel const &) = default; + UnoFrameModel(UnoFrameModel &&) = default; + UnoFrameModel & operator =(UnoFrameModel const &) = delete; // due to ControlModelContainerBase + UnoFrameModel & operator =(UnoFrameModel &&) = delete; // due to ControlModelContainerBase + + rtl::Reference<UnoControlModel> Clone() const override; + + DECLIMPL_SERVICEINFO_DERIVED( UnoFrameModel, ControlModelContainerBase, "com.sun.star.awt.UnoFrameModel" ) + + virtual OUString SAL_CALL getServiceName() override; + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + +private: + virtual css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; +}; + +class UnoFrameControl final : public ControlContainerBase +{ + virtual void ImplSetPosSize( css::uno::Reference< css::awt::XControl >& rxCtrl ) override; +public: + UnoFrameControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual ~UnoFrameControl() override; + OUString GetComponentServiceName() const override; + +// css::lang::XServiceInfo +DECLIMPL_SERVICEINFO_DERIVED( UnoFrameControl, ControlContainerBase, "com.sun.star.awt.UnoControlFrame" ) +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/eventcontainer.hxx b/toolkit/inc/controls/eventcontainer.hxx new file mode 100644 index 000000000..79a434a39 --- /dev/null +++ b/toolkit/inc/controls/eventcontainer.hxx @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/XContainer.hpp> + +#include <toolkit/helper/listenermultiplexer.hxx> + +#include <cppuhelper/implbase.hxx> +#include <unordered_map> + +namespace toolkit +{ + +// Hashtable to optimize +typedef std::unordered_map +< + OUString, + sal_Int32, + OUStringHash +> +NameContainerNameMap; + +class ScriptEventContainer final : public ::cppu::WeakImplHelper< + css::container::XNameContainer, + css::container::XContainer > +{ + // The map needs to keep the insertion order, otherwise Macro signatures would get broken + // if the order changes here (Dialog xml files are digitally signed too). + // Thus a std::map or std::unordered_map can't be used. + NameContainerNameMap mHashMap; + css::uno::Sequence< OUString > mNames; + std::vector< css::uno::Any > mValues; + css::uno::Type mType; + + ContainerListenerMultiplexer maContainerListeners; + +public: + ScriptEventContainer(); + + // Methods XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + // Methods XNameAccess + virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override; + virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; + + // Methods XNameReplace + virtual void SAL_CALL replaceByName( const OUString& aName, const css::uno::Any& aElement ) override; + + // Methods XNameContainer + virtual void SAL_CALL insertByName( const OUString& aName, const css::uno::Any& aElement ) override; + virtual void SAL_CALL removeByName( const OUString& Name ) override; + + // Methods XContainer + void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; +}; + +} // namespace toolkit_namecontainer + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/filectrl.hxx b/toolkit/inc/controls/filectrl.hxx new file mode 100644 index 000000000..1330d0ce7 --- /dev/null +++ b/toolkit/inc/controls/filectrl.hxx @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <vcl/window.hxx> +#include <vcl/toolkit/button.hxx> + +class Edit; + +// Flags for internal use of FileControl +enum class FileControlMode_Internal +{ + INRESIZE = 0x0001, + ORIGINALBUTTONTEXT = 0x0002, +}; + +namespace o3tl +{ + template<> struct typed_flags<FileControlMode_Internal> : is_typed_flags<FileControlMode_Internal, 0x03> {}; +} + + +class FileControl final : public vcl::Window +{ + VclPtr<Edit> maEdit; + VclPtr<PushButton> maButton; + OUString maButtonText; + FileControlMode_Internal mnInternalFlags; + + void Resize() override; + void GetFocus() override; + void StateChanged( StateChangedType nType ) override; + WinBits ImplInitStyle( WinBits nStyle ); + DECL_LINK( ButtonHdl, Button*, void ); + +public: + FileControl( vcl::Window* pParent, WinBits nStyle ); + virtual ~FileControl() override; + virtual void dispose() override; + + Edit& GetEdit() { return *maEdit; } + PushButton& GetButton() { return *maButton; } + + void Draw( OutputDevice* pDev, const Point& rPos, SystemTextColorFlags nFlags ) override; + + void SetText( const OUString& rStr ) override; + OUString GetText() const override; + + void SetEditModifyHdl( const Link<Edit&,void>& rLink ); +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/formattedcontrol.hxx b/toolkit/inc/controls/formattedcontrol.hxx new file mode 100644 index 000000000..388d94312 --- /dev/null +++ b/toolkit/inc/controls/formattedcontrol.hxx @@ -0,0 +1,122 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <toolkit/controls/unocontrols.hxx> +#include <toolkit/controls/unocontrolmodel.hxx> + +namespace com::sun::star::util { class XNumberFormatter; } + + +namespace toolkit +{ + + + // = UnoControlFormattedFieldModel + + class UnoControlFormattedFieldModel final : public UnoControlModel + { + public: + UnoControlFormattedFieldModel( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + UnoControlFormattedFieldModel( const UnoControlFormattedFieldModel& rModel ) + : UnoControlModel(rModel) + , m_bRevokedAsClient(false) + , m_bSettingValueAndText(false) + { + } + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlFormattedFieldModel( *this ); } + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + private: + virtual ~UnoControlFormattedFieldModel() override; + + // XComponent + void SAL_CALL dispose() override; + + // XPropertySet + void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& PropertyNames, const css::uno::Sequence< css::uno::Any >& Values ) override; + + // UnoControlModel + virtual void ImplNormalizePropertySequence( + const sal_Int32 _nCount, /// the number of entries in the arrays + sal_Int32* _pHandles, /// the handles of the properties to set + css::uno::Any* _pValues, /// the values of the properties to set + sal_Int32* _pValidHandles /// pointer to the valid handles, allowed to be adjusted + ) const override; + void impl_updateTextFromValue_nothrow(); + void impl_updateCachedFormatter_nothrow(); + void impl_updateCachedFormatKey_nothrow(); + + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + sal_Bool SAL_CALL convertFastPropertyValue( + css::uno::Any& rConvertedValue, + css::uno::Any& rOldValue, + sal_Int32 nPropId, + const css::uno::Any& rValue + ) override; + + void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 nHandle, + const css::uno::Any& rValue + ) override; + + css::uno::Any m_aCachedFormat; + bool m_bRevokedAsClient; + bool m_bSettingValueAndText; + css::uno::Reference< css::util::XNumberFormatter > + m_xCachedFormatter; + }; + + + // = UnoFormattedFieldControl + + class UnoFormattedFieldControl final : public UnoSpinFieldControl + { + public: + UnoFormattedFieldControl(); + OUString GetComponentServiceName() const override; + + // css::awt::XTextListener + void SAL_CALL textChanged( const css::awt::TextEvent& rEvent ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + }; + + +} // namespace toolkit + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/geometrycontrolmodel.hxx b/toolkit/inc/controls/geometrycontrolmodel.hxx new file mode 100644 index 000000000..d6b204b19 --- /dev/null +++ b/toolkit/inc/controls/geometrycontrolmodel.hxx @@ -0,0 +1,251 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <comphelper/broadcasthelper.hxx> +#include <comphelper/propagg.hxx> +#include <comphelper/proparrhlp.hxx> +#include <comphelper/propertycontainer.hxx> +#include <cppuhelper/compbase2.hxx> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/script/XScriptEventsSupplier.hpp> +#include <comphelper/IdPropArrayHelper.hxx> +#include <rtl/ref.hxx> + +namespace com::sun::star::resource { class XStringResourceResolver; } + +namespace com::sun::star { + namespace uno { + class XComponentContext; + } +} + + +// namespace toolkit +// { + + + //= OGeometryControlModel_Base + + typedef ::cppu::WeakAggComponentImplHelper2 < css::util::XCloneable + , css::script::XScriptEventsSupplier + > OGCM_Base; + class OGeometryControlModel_Base + :public ::comphelper::OMutexAndBroadcastHelper + ,public ::comphelper::OPropertySetAggregationHelper + ,public ::comphelper::OPropertyContainer + ,public OGCM_Base + { + protected: + css::uno::Reference< css::uno::XAggregation > + m_xAggregate; + css::uno::Reference< css::container::XNameContainer > + mxEventContainer; + + // <properties> + sal_Int32 m_nPosX; + sal_Int32 m_nPosY; + sal_Int32 m_nWidth; + sal_Int32 m_nHeight; + OUString m_aName; + sal_Int16 m_nTabIndex; + sal_Int32 m_nStep; + OUString m_aTag; + css::uno::Reference< css::resource::XStringResourceResolver > m_xStrResolver; + // </properties> + + bool m_bCloneable; + + protected: + static css::uno::Any ImplGetDefaultValueByHandle(sal_Int32 nHandle); + css::uno::Any ImplGetPropertyValueByHandle(sal_Int32 nHandle) const; + void ImplSetPropertyValueByHandle(sal_Int32 nHandle, const css::uno::Any& aValue); + + protected: + /** + @param _pAggregateInstance + the object to be aggregated. The refcount of the instance given MUST be 0! + */ + OGeometryControlModel_Base(css::uno::XAggregation* _pAggregateInstance); + + /** + @param _rxAggregateInstance + is the object to be aggregated. Must be acquired exactly once (by the reference object given).<br/> + Will be reset to NULL upon leaving + */ + OGeometryControlModel_Base(css::uno::Reference< css::util::XCloneable >& _rxAggregateInstance); + + /** releases the aggregation + <p>Can be used if in a derived class, an exception has to be thrown after this base class here already + did the aggregation</p> + */ + void releaseAggregation(); + + protected: + virtual ~OGeometryControlModel_Base() override; + + // XAggregation + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _aType ) override; + + public: + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + virtual void SAL_CALL acquire( ) noexcept override; + virtual void SAL_CALL release( ) noexcept override; + + protected: + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + // OPropertySetHelper overridables + virtual sal_Bool SAL_CALL convertFastPropertyValue( + css::uno::Any& _rConvertedValue, css::uno::Any& _rOldValue, + sal_Int32 _nHandle, const css::uno::Any& _rValue ) override; + + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 _nHandle, const css::uno::Any& _rValue) override; + + using comphelper::OPropertySetAggregationHelper::getFastPropertyValue; + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& _rValue, sal_Int32 _nHandle) const override; + + // OPropertyStateHelper overridables + virtual css::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle) override; + virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle) override; + virtual css::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override; + + // OPropertySetAggregationHelper overridables + using OPropertySetAggregationHelper::getInfoHelper; + + // XCloneable + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone( ) override; + + //XScriptEventsSupplier + virtual css::uno::Reference< css::container::XNameContainer > + SAL_CALL getEvents( ) override; + + // XCloneable implementation - to be overwritten + virtual rtl::Reference<OGeometryControlModel_Base> createClone_Impl( + css::uno::Reference< css::util::XCloneable >& _rxAggregateInstance) = 0; + + // XComponent + using comphelper::OPropertySetAggregationHelper::disposing; + virtual void SAL_CALL disposing() override; + + private: + void registerProperties(); + }; + + + //= OTemplateInstanceDisambiguation + + template <class CONTROLMODEL> + class OTemplateInstanceDisambiguation + { + }; + + + //= OGeometryControlModel + + /* example for usage: + Reference< XAggregation > xIFace = new ::toolkit::OGeometryControlModel< UnoControlButtonModel > (); + */ + template <class CONTROLMODEL> + class OGeometryControlModel final + :public OGeometryControlModel_Base + ,public ::comphelper::OAggregationArrayUsageHelper< OTemplateInstanceDisambiguation< CONTROLMODEL > > + { + public: + OGeometryControlModel( const css::uno::Reference< css::uno::XComponentContext >& i_factory ); + + private: + OGeometryControlModel(css::uno::Reference< css::util::XCloneable >& _rxAggregateInstance); + + // OAggregationArrayUsageHelper overridables + virtual void fillProperties( + css::uno::Sequence< css::beans::Property >& _rProps, + css::uno::Sequence< css::beans::Property >& _rAggregateProps + ) const override; + + // OPropertySetAggregationHelper overridables + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + + // OGeometryControlModel_Base + virtual rtl::Reference<OGeometryControlModel_Base> createClone_Impl( + css::uno::Reference< css::util::XCloneable >& _rxAggregateInstance) override; + + // XTypeProvider + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; + }; + + + //= OCommonGeometryControlModel + + /** allows to extend an arbitrary com.sun.star.awt::UnoControlModel with geometry + information. + */ + class OCommonGeometryControlModel final + :public OGeometryControlModel_Base + ,public ::comphelper::OIdPropertyArrayUsageHelper< OCommonGeometryControlModel > + { + private: + OUString m_sServiceSpecifier; // the service specifier of our aggregate + sal_Int32 m_nPropertyMapId; // our unique property info id, used to look up in s_aAggregateProperties + + public: + /** instantiate the model + + @param _rxAgg + the instance to aggregate. Must support the com.sun.star.awt::UnoControlModel + (this is not checked here) + */ + OCommonGeometryControlModel( + css::uno::Reference< css::util::XCloneable >& _rxAgg, + const OUString& _rxServiceSpecifier + ); + + // OIdPropertyArrayUsageHelper overridables + virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const override; + + // OPropertySetAggregationHelper overridables + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + + // OGeometryControlModel_Base + virtual rtl::Reference<OGeometryControlModel_Base> createClone_Impl( + css::uno::Reference< css::util::XCloneable >& _rxAggregateInstance) override; + + // XTypeProvider + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; + + private: + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( + sal_Int32 _nHandle, const css::uno::Any& _rValue) override; + }; + +#include <controls/geometrycontrolmodel_impl.hxx> + + +// } // namespace toolkit + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/geometrycontrolmodel_impl.hxx b/toolkit/inc/controls/geometrycontrolmodel_impl.hxx new file mode 100644 index 000000000..2ec8595dd --- /dev/null +++ b/toolkit/inc/controls/geometrycontrolmodel_impl.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +// no include protection. This is included from within geometrycontrolmodel.hxx only + +//= OGeometryControlModel + +template <class CONTROLMODEL> +OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel( + const css::uno::Reference<css::uno::XComponentContext>& i_factory) + : OGeometryControlModel_Base(new CONTROLMODEL(i_factory)) +{ +} + +template <class CONTROLMODEL> +OGeometryControlModel<CONTROLMODEL>::OGeometryControlModel( + css::uno::Reference<css::util::XCloneable>& _rxAggregateInstance) + : OGeometryControlModel_Base(_rxAggregateInstance) +{ +} + +template <class CONTROLMODEL> +::cppu::IPropertyArrayHelper& SAL_CALL OGeometryControlModel<CONTROLMODEL>::getInfoHelper() +{ + return *this->getArrayHelper(); +} + +template <class CONTROLMODEL> +void OGeometryControlModel<CONTROLMODEL>::fillProperties( + css::uno::Sequence<css::beans::Property>& _rProps, + css::uno::Sequence<css::beans::Property>& _rAggregateProps) const +{ + // our own properties + OPropertyContainer::describeProperties(_rProps); + // the aggregate properties + if (m_xAggregateSet.is()) + _rAggregateProps = m_xAggregateSet->getPropertySetInfo()->getProperties(); +} + +template <class CONTROLMODEL> +css::uno::Sequence<sal_Int8> SAL_CALL OGeometryControlModel<CONTROLMODEL>::getImplementationId() +{ + return css::uno::Sequence<sal_Int8>(); +} + +template <class CONTROLMODEL> +rtl::Reference<OGeometryControlModel_Base> OGeometryControlModel<CONTROLMODEL>::createClone_Impl( + css::uno::Reference<css::util::XCloneable>& _rxAggregateInstance) +{ + return new OGeometryControlModel<CONTROLMODEL>(_rxAggregateInstance); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/roadmapcontrol.hxx b/toolkit/inc/controls/roadmapcontrol.hxx new file mode 100644 index 000000000..2a4a1021e --- /dev/null +++ b/toolkit/inc/controls/roadmapcontrol.hxx @@ -0,0 +1,183 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + + +#include <toolkit/controls/unocontrols.hxx> +#include <toolkit/controls/unocontrolmodel.hxx> +#include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/awt/XItemListener.hpp> +#include <com/sun/star/awt/XItemEventBroadcaster.hpp> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase4.hxx> + + +#include <comphelper/uno3.hxx> + + +namespace toolkit +{ + + + typedef GraphicControlModel UnoControlRoadmapModel_Base; + + + typedef ::cppu::ImplHelper3 < css::lang::XSingleServiceFactory + , css::container::XContainer + , css::container::XIndexContainer + > UnoControlRoadmapModel_IBase; + + + typedef UnoControlBase UnoControlRoadmap_Base; + typedef ::cppu::ImplHelper4 < css::awt::XItemEventBroadcaster + , css::container::XContainerListener + , css::awt::XItemListener + , css::beans::XPropertyChangeListener + > UnoControlRoadmap_IBase; + + + typedef ::cppu::ImplHelper2< css::container::XContainerListener, + css::awt::XItemEventBroadcaster> SVTXRoadmap_Base; + + + // = UnoControlRoadmapModel + + class UnoControlRoadmapModel final : public UnoControlRoadmapModel_Base, + public UnoControlRoadmapModel_IBase + + { + private: +// PropertyChangeListenerMultiplexer maPropertyListeners; + + typedef ::std::vector< css::uno::Reference< XInterface > > RoadmapItemHolderList; + + ContainerListenerMultiplexer maContainerListeners; + RoadmapItemHolderList maRoadmapItems; + + void MakeRMItemValidation( sal_Int32 Index, const css::uno::Reference< XInterface >& xRoadmapItem ); + css::container::ContainerEvent GetContainerEvent(sal_Int32 Index, const css::uno::Reference< XInterface >& ); + void SetRMItemDefaultProperties( const css::uno::Reference< XInterface >& ); + static sal_Int16 GetCurrentItemID( const css::uno::Reference< css::beans::XPropertySet >& xPropertySet ); + sal_Int32 GetUniqueID(); + + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + + public: + UnoControlRoadmapModel( const css::uno::Reference< css::uno::XComponentContext >& i_factory ); + UnoControlRoadmapModel( const UnoControlRoadmapModel& rModel ) : + UnoControlRoadmapModel_Base( rModel ), + UnoControlRoadmapModel_IBase( rModel ), + maContainerListeners( *this ) {} + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlRoadmapModel( *this ); } + + + // XTypeProvider + DECLARE_XTYPEPROVIDER( ) + + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; + + virtual void SAL_CALL insertByIndex( sal_Int32 Index, const css::uno::Any & Element) override; + virtual void SAL_CALL removeByIndex( sal_Int32 Index ) override; + virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const css::uno::Any & Element) override; + + virtual void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + virtual void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoControlRoadmapModel_Base::queryInterface(rType); } + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { UnoControlRoadmapModel_Base::acquire(); } + void SAL_CALL release() noexcept override { UnoControlRoadmapModel_Base::release(); } + + + // css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + + virtual css::uno::Reference< XInterface > SAL_CALL createInstance( ) override; + virtual css::uno::Reference< XInterface > SAL_CALL createInstanceWithArguments( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + virtual css::uno::Type SAL_CALL getElementType() override; + + virtual sal_Bool SAL_CALL hasElements() override; + + }; + + + // = UnoRoadmapControl + + class UnoRoadmapControl final : public UnoControlRoadmap_Base, + public UnoControlRoadmap_IBase + { + private: + ItemListenerMultiplexer maItemListeners; + public: + UnoRoadmapControl(); + OUString GetComponentServiceName() const override; + + void SAL_CALL disposing( const css::lang::EventObject& Source ) override { UnoControlBase::disposing( Source ); } + + void SAL_CALL dispose( ) override; + + + sal_Bool SAL_CALL setModel(const css::uno::Reference< css::awt::XControlModel >& Model) override; + + void SAL_CALL elementInserted( const css::container::ContainerEvent& rEvent ) override; + void SAL_CALL elementRemoved( const css::container::ContainerEvent& rEvent ) override; + void SAL_CALL elementReplaced( const css::container::ContainerEvent& rEvent ) override; + + virtual void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + virtual void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& l ) override; + + + virtual void SAL_CALL itemStateChanged( const css::awt::ItemEvent& rEvent ) override; + + virtual void SAL_CALL propertyChange( const css::beans::PropertyChangeEvent& evt ) override; + + // XTypeProvider + DECLARE_XTYPEPROVIDER( ) + DECLARE_XINTERFACE() + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + }; + + +} // toolkit + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/roadmapentry.hxx b/toolkit/inc/controls/roadmapentry.hxx new file mode 100644 index 000000000..b8490439c --- /dev/null +++ b/toolkit/inc/controls/roadmapentry.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <comphelper/uno3.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <comphelper/propertycontainer.hxx> +#include <comphelper/proparrhlp.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase.hxx> + + +#define RM_PROPERTY_ID_LABEL 1 +#define RM_PROPERTY_ID_ID 2 +#define RM_PROPERTY_ID_ENABLED 4 +#define RM_PROPERTY_ID_INTERACTIVE 5 + +typedef cppu::WeakImplHelper< css::lang::XServiceInfo > ORoadmapEntry_Base; + +class ORoadmapEntry final : public ORoadmapEntry_Base + ,public ::comphelper::OMutexAndBroadcastHelper + ,public ::comphelper::OPropertyContainer + ,public ::comphelper::OPropertyArrayUsageHelper< ORoadmapEntry > +{ + +public: + ORoadmapEntry(); + + DECLARE_XINTERFACE() // merge XInterface implementations + DECLARE_XTYPEPROVIDER() // merge XTypeProvider implementations + +private: + /// @see css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() override; + + // OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; + + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + OUString m_sLabel; + sal_Int32 m_nID; + bool m_bEnabled; + bool m_bInteractive; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/stdtabcontroller.hxx b/toolkit/inc/controls/stdtabcontroller.hxx new file mode 100644 index 000000000..37de42d7d --- /dev/null +++ b/toolkit/inc/controls/stdtabcontroller.hxx @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/awt/XTabController.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <cppuhelper/weakagg.hxx> +#include <osl/mutex.hxx> + + +namespace com::sun::star::awt { class XWindow; } +namespace com::sun::star::awt { class XControl; } +namespace com::sun::star::awt { class XControlContainer; } + +class StdTabController final : public css::awt::XTabController, + public css::lang::XServiceInfo, + public css::lang::XTypeProvider, + public ::cppu::OWeakAggObject +{ +private: + ::osl::Mutex maMutex; + css::uno::Reference< css::awt::XTabControllerModel > mxModel; + css::uno::Reference< css::awt::XControlContainer > mxControlContainer; + + ::osl::Mutex& GetMutex() { return maMutex; } + static bool ImplCreateComponentSequence( css::uno::Sequence< css::uno::Reference< css::awt::XControl > >& rControls, const css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& rModels, css::uno::Sequence< css::uno::Reference< css::awt::XWindow > >& rComponents, css::uno::Sequence< css::uno::Any>* pTabStops, bool bPeerComponent ); + // if sequence length of rModels is less than rControls, return only the matching elements in rModels sequence and remove corresponding elements from rControls + void ImplActivateControl( bool bFirst ) const; + +public: + StdTabController(); + virtual ~StdTabController() override; + + static css::uno::Reference< css::awt::XControl > FindControl( css::uno::Sequence< css::uno::Reference< css::awt::XControl > >& rCtrls, const css::uno::Reference< css::awt::XControlModel > & rxCtrlModel ); + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return OWeakAggObject::queryInterface(rType); } + void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakAggObject::release(); } + + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // XTabController + void SAL_CALL setModel( const css::uno::Reference< css::awt::XTabControllerModel >& Model ) override; + css::uno::Reference< css::awt::XTabControllerModel > SAL_CALL getModel( ) override; + void SAL_CALL setContainer( const css::uno::Reference< css::awt::XControlContainer >& Container ) override; + css::uno::Reference< css::awt::XControlContainer > SAL_CALL getContainer( ) override; + css::uno::Sequence< css::uno::Reference< css::awt::XControl > > SAL_CALL getControls( ) override; + void SAL_CALL autoTabOrder( ) override; + void SAL_CALL activateTabOrder( ) override; + void SAL_CALL activateFirst( ) override; + void SAL_CALL activateLast( ) override; + + // XServiceInfo + OUString SAL_CALL getImplementationName() override; + + sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/stdtabcontrollermodel.hxx b/toolkit/inc/controls/stdtabcontrollermodel.hxx new file mode 100644 index 000000000..4fa12d252 --- /dev/null +++ b/toolkit/inc/controls/stdtabcontrollermodel.hxx @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/io/XPersistObject.hpp> +#include <com/sun/star/awt/XTabControllerModel.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <cppuhelper/weakagg.hxx> +#include <osl/mutex.hxx> + +#include <vector> + +struct UnoControlModelEntry; +typedef ::std::vector< UnoControlModelEntry* > UnoControlModelEntryListBase; + +class UnoControlModelEntryList +{ +private: + UnoControlModelEntryListBase maList; + OUString maGroupName; + +public: + UnoControlModelEntryList(); + ~UnoControlModelEntryList(); + + const OUString& GetName() const { return maGroupName; } + void SetName( const OUString& rName ) { maGroupName = rName; } + + void Reset(); + void DestroyEntry( size_t nEntry ); + size_t size() const; + UnoControlModelEntry* operator[]( size_t i ) const; + void push_back( UnoControlModelEntry* item ); + void insert( size_t i, UnoControlModelEntry* item ); +}; + +struct UnoControlModelEntry +{ + bool bGroup; + union + { + css::uno::Reference< css::awt::XControlModel >* pxControl; + UnoControlModelEntryList* pGroup; + }; +}; + +#define CONTROLPOS_NOTFOUND 0xFFFFFFFF + +class StdTabControllerModel final : public css::awt::XTabControllerModel, + public css::lang::XServiceInfo, + public css::io::XPersistObject, + public css::lang::XTypeProvider, + public ::cppu::OWeakAggObject +{ + ::osl::Mutex maMutex; + UnoControlModelEntryList maControls; + bool mbGroupControl; + + ::osl::Mutex& GetMutex() { return maMutex; } + sal_uInt32 ImplGetControlCount( const UnoControlModelEntryList& rList ) const; + void ImplGetControlModels( css::uno::Reference< css::awt::XControlModel > ** pRefs, const UnoControlModelEntryList& rList ) const; + static void ImplSetControlModels( UnoControlModelEntryList& rList, const css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& Controls ); + static sal_uInt32 ImplGetControlPos( const css::uno::Reference< css::awt::XControlModel >& rCtrl, const UnoControlModelEntryList& rList ); + +public: + StdTabControllerModel(); + virtual ~StdTabControllerModel() override; + + // css::uno::XInterface + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return OWeakAggObject::queryInterface(rType); } + void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakAggObject::release(); } + + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XTabControllerModel + sal_Bool SAL_CALL getGroupControl( ) override; + void SAL_CALL setGroupControl( sal_Bool GroupControl ) override; + void SAL_CALL setControlModels( const css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& Controls ) override; + css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > > SAL_CALL getControlModels( ) override; + void SAL_CALL setGroup( const css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& Group, const OUString& GroupName ) override; + sal_Int32 SAL_CALL getGroupCount( ) override; + void SAL_CALL getGroup( sal_Int32 nGroup, css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& Group, OUString& Name ) override; + void SAL_CALL getGroupByName( const OUString& Name, css::uno::Sequence< css::uno::Reference< css::awt::XControlModel > >& Group ) override; + + // css::io::XPersistObject + OUString SAL_CALL getServiceName( ) override; + void SAL_CALL write( const css::uno::Reference< css::io::XObjectOutputStream >& OutStream ) override; + void SAL_CALL read( const css::uno::Reference< css::io::XObjectInputStream >& InStream ) override; + + // XServiceInfo + OUString SAL_CALL getImplementationName() override; + + sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/svmedit.hxx b/toolkit/inc/controls/svmedit.hxx new file mode 100644 index 000000000..77295cdd5 --- /dev/null +++ b/toolkit/inc/controls/svmedit.hxx @@ -0,0 +1,32 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <vcl/toolkit/vclmedit.hxx> + +class MultiLineEdit final : public VclMultiLineEdit +{ +public: + MultiLineEdit( vcl::Window* pParent, WinBits nWinStyle ); + + virtual css::uno::Reference< css::awt::XWindowPeer > GetComponentInterface(bool bCreate = true) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/tabpagecontainer.hxx b/toolkit/inc/controls/tabpagecontainer.hxx new file mode 100644 index 000000000..d8cc32664 --- /dev/null +++ b/toolkit/inc/controls/tabpagecontainer.hxx @@ -0,0 +1,127 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/awt/tab/XTabPageContainer.hpp> +#include <com/sun/star/awt/tab/XTabPageContainerModel.hpp> +#include <toolkit/controls/unocontrolbase.hxx> +#include <toolkit/controls/unocontrolmodel.hxx> +#include <cppuhelper/implbase1.hxx> +#include <controls/controlmodelcontainerbase.hxx> +#include <toolkit/helper/listenermultiplexer.hxx> + + +namespace com::sun::star::awt::tab { class XTabPage; } +namespace com::sun::star::awt::tab { class XTabPageContainerListener; } +namespace com::sun::star::awt::tab { class XTabPageModel; } + + +typedef ::cppu::AggImplInheritanceHelper1 < UnoControlModel + , css::awt::tab::XTabPageContainerModel + > UnoControlTabPageContainerModel_Base; +class UnoControlTabPageContainerModel final : public UnoControlTabPageContainerModel_Base +{ +private: + std::vector< css::uno::Reference< css::awt::tab::XTabPageModel > > m_aTabPageVector; + ContainerListenerMultiplexer maContainerListeners; + + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + +public: + UnoControlTabPageContainerModel( const css::uno::Reference< css::uno::XComponentContext >& i_factory ); + UnoControlTabPageContainerModel( const UnoControlTabPageContainerModel& rModel ) : UnoControlTabPageContainerModel_Base( rModel ),maContainerListeners( *this ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlTabPageContainerModel( *this ); } + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::lang::XServiceInfo + DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageContainerModel, UnoControlModel, "com.sun.star.awt.tab.UnoControlTabPageContainerModel" ) + + // XTabPageContainerModel + virtual css::uno::Reference< css::awt::tab::XTabPageModel > SAL_CALL createTabPage( ::sal_Int16 TabPageID ) override; + virtual css::uno::Reference< css::awt::tab::XTabPageModel > SAL_CALL loadTabPage( ::sal_Int16 TabPageID, const OUString& ResourceURL ) override; + + // XIndexContainer + virtual void SAL_CALL insertByIndex( sal_Int32 Index, const css::uno::Any& Element ) override; + virtual void SAL_CALL removeByIndex( sal_Int32 Index ) override; + + // XIndexReplace + virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const css::uno::Any& Element ) override; + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // css::container::XContainer + void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; +}; + +// = UnoControlTabPageContainer + +typedef ::cppu::AggImplInheritanceHelper1 < ControlContainerBase + , css::awt::tab::XTabPageContainer + > UnoControlTabPageContainer_Base; +class UnoControlTabPageContainer final : public UnoControlTabPageContainer_Base +{ +public: + UnoControlTabPageContainer( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + OUString GetComponentServiceName() const override; + + // css::lang::XComponent + void SAL_CALL dispose( ) override; + + // css::awt::XControl + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + + // css::awt::tab::XTabPageContainer + virtual ::sal_Int16 SAL_CALL getActiveTabPageID() override; + virtual void SAL_CALL setActiveTabPageID( ::sal_Int16 _activetabpageid ) override; + virtual ::sal_Int16 SAL_CALL getTabPageCount( ) override; + virtual sal_Bool SAL_CALL isTabPageActive( ::sal_Int16 tabPageIndex ) override; + virtual css::uno::Reference< css::awt::tab::XTabPage > SAL_CALL getTabPage( ::sal_Int16 tabPageIndex ) override; + virtual css::uno::Reference< css::awt::tab::XTabPage > SAL_CALL getTabPageByID( ::sal_Int16 tabPageID ) override; + virtual void SAL_CALL addTabPageContainerListener( const css::uno::Reference< css::awt::tab::XTabPageContainerListener >& listener ) override; + virtual void SAL_CALL removeTabPageContainerListener( const css::uno::Reference< css::awt::tab::XTabPageContainerListener >& listener ) override; + + // css::beans::XPropertiesChangeListener + virtual void SAL_CALL propertiesChange( const ::css::uno::Sequence< ::css::beans::PropertyChangeEvent >& aEvent ) override; + + virtual void SAL_CALL addControl( const OUString& Name, const css::uno::Reference< css::awt::XControl >& Control ) override; + // css::lang::XServiceInfo + DECLIMPL_SERVICEINFO_DERIVED( UnoControlTabPageContainer, UnoControlBase, "com.sun.star.awt.tab.UnoControlTabPageContainer" ) + +// using UnoControl::getPeer; +private: + virtual void updateFromModel() override; + TabPageListenerMultiplexer m_aTabPageListeners; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/tabpagemodel.hxx b/toolkit/inc/controls/tabpagemodel.hxx new file mode 100644 index 000000000..6c12981b2 --- /dev/null +++ b/toolkit/inc/controls/tabpagemodel.hxx @@ -0,0 +1,80 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <controls/controlmodelcontainerbase.hxx> +#include <com/sun/star/awt/tab/XTabPage.hpp> +#include <cppuhelper/implbase2.hxx> + +class UnoControlTabPageModel final : public ControlModelContainerBase +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; +public: + UnoControlTabPageModel( css::uno::Reference< css::uno::XComponentContext > const & i_factory); + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + // XInitialization + virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments) override; + + // XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; +}; + + + +typedef ::cppu::AggImplInheritanceHelper2 < ControlContainerBase + , css::awt::tab::XTabPage + , css::awt::XWindowListener + > UnoControlTabPage_Base; +class UnoControlTabPage final : public UnoControlTabPage_Base +{ +private: + bool m_bWindowListener; +public: + + UnoControlTabPage( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual ~UnoControlTabPage() override; + OUString GetComponentServiceName() const override; + + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + void SAL_CALL dispose() override; + + // css::awt::XWindowListener + virtual void SAL_CALL windowResized( const css::awt::WindowEvent& e ) override; + virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& e ) override; + virtual void SAL_CALL windowShown( const css::lang::EventObject& e ) override; + virtual void SAL_CALL windowHidden( const css::lang::EventObject& e ) override; + // css::lang::XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + + virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; + + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/tkscrollbar.hxx b/toolkit/inc/controls/tkscrollbar.hxx new file mode 100644 index 000000000..ec774fa9d --- /dev/null +++ b/toolkit/inc/controls/tkscrollbar.hxx @@ -0,0 +1,112 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#pragma once + +#include <toolkit/controls/unocontrolmodel.hxx> +#include <toolkit/controls/unocontrolbase.hxx> +#include <com/sun/star/awt/XScrollBar.hpp> +#include <com/sun/star/awt/XAdjustmentListener.hpp> + + +namespace toolkit +{ + + + //= UnoControlScrollBarModel + + class UnoControlScrollBarModel final : public UnoControlModel + { + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + + public: + UnoControlScrollBarModel( const css::uno::Reference< css::uno::XComponentContext >& i_factory ); + UnoControlScrollBarModel( const UnoControlScrollBarModel& rModel ) : UnoControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlScrollBarModel( *this ); } + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + }; + + + //= UnoControlScrollBarModel + + class UnoScrollBarControl final : public UnoControlBase, + public css::awt::XAdjustmentListener, + public css::awt::XScrollBar + { + private: + AdjustmentListenerMultiplexer maAdjustmentListeners; + + public: + UnoScrollBarControl(); + OUString GetComponentServiceName() const override; + + css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) override { return UnoControlBase::queryInterface(rType); } + css::uno::Any SAL_CALL queryAggregation( const css::uno::Type & rType ) override; + void SAL_CALL acquire() noexcept override { OWeakAggObject::acquire(); } + void SAL_CALL release() noexcept override { OWeakAggObject::release(); } + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + void SAL_CALL disposing( const css::lang::EventObject& Source ) override { UnoControlBase::disposing( Source ); } + void SAL_CALL dispose( ) override; + + // css::lang::XTypeProvider + css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override; + css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // css::awt::XAdjustmentListener + void SAL_CALL adjustmentValueChanged( const css::awt::AdjustmentEvent& rEvent ) override; + + // css::awt::XScrollBar + void SAL_CALL addAdjustmentListener( const css::uno::Reference< css::awt::XAdjustmentListener >& l ) override; + void SAL_CALL removeAdjustmentListener( const css::uno::Reference< css::awt::XAdjustmentListener >& l ) override; + void SAL_CALL setValue( sal_Int32 n ) override; + void SAL_CALL setValues( sal_Int32 nValue, sal_Int32 nVisible, sal_Int32 nMax ) override; + sal_Int32 SAL_CALL getValue( ) override; + void SAL_CALL setMaximum( sal_Int32 n ) override; + sal_Int32 SAL_CALL getMaximum( ) override; + void SAL_CALL setLineIncrement( sal_Int32 n ) override; + sal_Int32 SAL_CALL getLineIncrement( ) override; + void SAL_CALL setBlockIncrement( sal_Int32 n ) override; + sal_Int32 SAL_CALL getBlockIncrement( ) override; + void SAL_CALL setVisibleSize( sal_Int32 n ) override; + sal_Int32 SAL_CALL getVisibleSize( ) override; + void SAL_CALL setOrientation( sal_Int32 n ) override; + sal_Int32 SAL_CALL getOrientation( ) override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + }; + + +} // namespacetoolkit + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/treecontrolpeer.hxx b/toolkit/inc/controls/treecontrolpeer.hxx new file mode 100644 index 000000000..d584516ae --- /dev/null +++ b/toolkit/inc/controls/treecontrolpeer.hxx @@ -0,0 +1,166 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/awt/tree/XTreeControl.hpp> +#include <com/sun/star/awt/tree/XTreeDataModel.hpp> +#include <com/sun/star/graphic/XGraphicProvider.hpp> + +#include <toolkit/awt/vclxwindow.hxx> +#include <toolkit/helper/listenermultiplexer.hxx> + +#include <vcl/image.hxx> + +#include <cppuhelper/implbase.hxx> + +#include <map> + +namespace com::sun::star::awt::tree { class XTreeNode; } + +class UnoTreeListEntry; +class TreeControlPeer; +class UnoTreeListBoxImpl; + +class TreeControlPeer final : public ::cppu::ImplInheritanceHelper< VCLXWindow, css::awt::tree::XTreeControl, css::awt::tree::XTreeDataModelListener > +{ + typedef std::map<css::uno::Reference<css::awt::tree::XTreeNode>, UnoTreeListEntry*> TreeNodeMap; + + friend class UnoTreeListBoxImpl; + friend class UnoTreeListEntry; +public: + TreeControlPeer(); + virtual ~TreeControlPeer() override; + + vcl::Window* createVclControl( vcl::Window* pParent, sal_Int64 nWinStyle ); + + // css::view::XSelectionSupplier + virtual sal_Bool SAL_CALL select( const css::uno::Any& xSelection ) override; + virtual css::uno::Any SAL_CALL getSelection( ) override; + virtual void SAL_CALL addSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override; + virtual void SAL_CALL removeSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override; + + // css::view::XMultiSelectionSupplier + virtual sal_Bool SAL_CALL addSelection( const css::uno::Any& Selection ) override; + virtual void SAL_CALL removeSelection( const css::uno::Any& Selection ) override; + virtual void SAL_CALL clearSelection( ) override; + virtual ::sal_Int32 SAL_CALL getSelectionCount( ) override; + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createSelectionEnumeration( ) override; + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createReverseSelectionEnumeration( ) override; + + // css::awt::XTreeControl + virtual OUString SAL_CALL getDefaultExpandedGraphicURL() override; + virtual void SAL_CALL setDefaultExpandedGraphicURL( const OUString& _defaultexpandedgraphicurl ) override; + virtual OUString SAL_CALL getDefaultCollapsedGraphicURL() override; + virtual void SAL_CALL setDefaultCollapsedGraphicURL( const OUString& _defaultcollapsedgraphicurl ) override; + virtual sal_Bool SAL_CALL isNodeExpanded( const css::uno::Reference< css::awt::tree::XTreeNode >& Node ) override; + virtual sal_Bool SAL_CALL isNodeCollapsed( const css::uno::Reference< css::awt::tree::XTreeNode >& Node ) override; + virtual void SAL_CALL makeNodeVisible( const css::uno::Reference< css::awt::tree::XTreeNode >& Node ) override; + virtual sal_Bool SAL_CALL isNodeVisible( const css::uno::Reference< css::awt::tree::XTreeNode >& Node ) override; + virtual void SAL_CALL expandNode( const css::uno::Reference< css::awt::tree::XTreeNode >& Node ) override; + virtual void SAL_CALL collapseNode( const css::uno::Reference< css::awt::tree::XTreeNode >& Node ) override; + virtual void SAL_CALL addTreeExpansionListener( const css::uno::Reference< css::awt::tree::XTreeExpansionListener >& Listener ) override; + virtual void SAL_CALL removeTreeExpansionListener( const css::uno::Reference< css::awt::tree::XTreeExpansionListener >& Listener ) override; + virtual css::uno::Reference< css::awt::tree::XTreeNode > SAL_CALL getNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) override; + virtual css::uno::Reference< css::awt::tree::XTreeNode > SAL_CALL getClosestNodeForLocation( ::sal_Int32 x, ::sal_Int32 y ) override; + virtual css::awt::Rectangle SAL_CALL getNodeRect( const css::uno::Reference< css::awt::tree::XTreeNode >& Node ) override; + virtual sal_Bool SAL_CALL isEditing( ) override; + virtual sal_Bool SAL_CALL stopEditing( ) override; + virtual void SAL_CALL cancelEditing( ) override; + virtual void SAL_CALL startEditingAtNode( const css::uno::Reference< css::awt::tree::XTreeNode >& Node ) override; + virtual void SAL_CALL addTreeEditListener( const css::uno::Reference< css::awt::tree::XTreeEditListener >& Listener ) override; + virtual void SAL_CALL removeTreeEditListener( const css::uno::Reference< css::awt::tree::XTreeEditListener >& Listener ) override; + + // css::awt::tree::TreeDataModelListener + virtual void SAL_CALL treeNodesChanged( const css::awt::tree::TreeDataModelEvent& aEvent ) override; + virtual void SAL_CALL treeNodesInserted( const css::awt::tree::TreeDataModelEvent& aEvent ) override; + virtual void SAL_CALL treeNodesRemoved( const css::awt::tree::TreeDataModelEvent& aEvent ) override; + virtual void SAL_CALL treeStructureChanged( const css::awt::tree::TreeDataModelEvent& aEvent ) override; + + // XEventListener + void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // css::awt::XLayoutConstrains + css::awt::Size SAL_CALL getMinimumSize() override; + css::awt::Size SAL_CALL getPreferredSize() override; + css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override; + + // css::awt::XVclWindowPeer + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + +private: + /// @throws css::lang::IllegalArgumentException + UnoTreeListEntry* getEntry( const css::uno::Reference< css::awt::tree::XTreeNode >& xNode, bool bThrow = true ); + + void disposeControl(); + + bool onEditingEntry( UnoTreeListEntry const * pEntry ); + bool onEditedEntry( UnoTreeListEntry const * pEntry, const OUString& rNewText ); + + void fillTree( UnoTreeListBoxImpl& rTree, const css::uno::Reference< css::awt::tree::XTreeDataModel >& xDataModel ); + void addNode( UnoTreeListBoxImpl& rTree, const css::uno::Reference< css::awt::tree::XTreeNode >& xNode, UnoTreeListEntry* pParentEntry ); + + UnoTreeListEntry* createEntry( const css::uno::Reference< css::awt::tree::XTreeNode >& xNode, UnoTreeListEntry* pParent, sal_uLong nPos ); + void updateEntry( UnoTreeListEntry* pEntry ); + + void updateTree( const css::awt::tree::TreeDataModelEvent& rEvent ); + void updateNode( UnoTreeListBoxImpl const & rTree, const css::uno::Reference< css::awt::tree::XTreeNode >& xNode ); + void updateChildNodes( UnoTreeListBoxImpl const & rTree, const css::uno::Reference< css::awt::tree::XTreeNode >& xParentNode, UnoTreeListEntry* pParentEntry ); + + static OUString getEntryString( const css::uno::Any& rValue ); + + /// @throws css::uno::RuntimeException + UnoTreeListBoxImpl& getTreeListBoxOrThrow() const; + /// @throws css::uno::RuntimeException + /// @throws css::lang::IllegalArgumentException + void ChangeNodesSelection( const css::uno::Any& rSelection, bool bSelect, bool bSetSelection ); + + void onChangeDataModel( UnoTreeListBoxImpl& rTree, const css::uno::Reference< css::awt::tree::XTreeDataModel >& xDataModel ); + + void onSelectionChanged(); + void onRequestChildNodes( const css::uno::Reference< css::awt::tree::XTreeNode >& xNode ); + bool onExpanding( const css::uno::Reference< css::awt::tree::XTreeNode >& xNode, bool bExpanding ); + void onExpanded( const css::uno::Reference< css::awt::tree::XTreeNode >& xNode, bool bExpanding ); + + void onChangeRootDisplayed( bool bIsRootDisplayed ); + + void addEntry( UnoTreeListEntry* pEntry ); + void removeEntry( UnoTreeListEntry const * pEntry ); + + bool loadImage( const OUString& rURL, Image& rImage ); + +private: + css::uno::Reference< css::awt::tree::XTreeDataModel >mxDataModel; + TreeSelectionListenerMultiplexer maSelectionListeners; + TreeExpansionListenerMultiplexer maTreeExpansionListeners; + TreeEditListenerMultiplexer maTreeEditListeners; + bool mbIsRootDisplayed; + VclPtr<UnoTreeListBoxImpl> mpTreeImpl; + sal_Int32 mnEditLock; + OUString msDefaultCollapsedGraphicURL; + OUString msDefaultExpandedGraphicURL; + Image maDefaultExpandedImage; + Image maDefaultCollapsedImage; + std::unique_ptr<TreeNodeMap> mpTreeNodeMap; + css::uno::Reference< css::graphic::XGraphicProvider > mxGraphicProvider; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/unocontrolcontainer.hxx b/toolkit/inc/controls/unocontrolcontainer.hxx new file mode 100644 index 000000000..f8e9d1085 --- /dev/null +++ b/toolkit/inc/controls/unocontrolcontainer.hxx @@ -0,0 +1,151 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + + +#include <com/sun/star/awt/XControlContainer.hpp> +#include <com/sun/star/awt/XUnoControlContainer.hpp> +#include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/container/XIdentifierContainer.hpp> + +#include <toolkit/controls/unocontrolbase.hxx> + +#include <cppuhelper/implbase4.hxx> +#include <memory> + +class UnoControlHolderList; + + + +typedef ::cppu::AggImplInheritanceHelper4 < UnoControlBase + , css::awt::XUnoControlContainer + , css::awt::XControlContainer + , css::container::XContainer + , css::container::XIdentifierContainer + > UnoControlContainer_Base; + +class UnoControlContainer : public UnoControlContainer_Base +{ +private: + std::unique_ptr<UnoControlHolderList> mpControls; + css::uno::Sequence< css::uno::Reference< css::awt::XTabController > > maTabControllers; + ContainerListenerMultiplexer maCListeners; + +protected: + void ImplActivateTabControllers(); + +public: + UnoControlContainer(); + UnoControlContainer( const css::uno::Reference< css::awt::XWindowPeer >& xPeer ); + virtual ~UnoControlContainer() override; + + + // css::lang::XComponent + void SAL_CALL dispose() override; + + // css::lang::XEventListener + void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // css::container::XContainer + void SAL_CALL addContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + void SAL_CALL removeContainerListener( const css::uno::Reference< css::container::XContainerListener >& xListener ) override; + + // css::container::XIdentifierContainer + virtual ::sal_Int32 SAL_CALL insert( const css::uno::Any& aElement ) override; + + // css::container::XIdentifierReplace + virtual void SAL_CALL removeByIdentifier( ::sal_Int32 Identifier ) override; + virtual void SAL_CALL replaceByIdentifer( ::sal_Int32 Identifier, const css::uno::Any& aElement ) override; + + // css::container::XIdentifierAccess + virtual css::uno::Any SAL_CALL getByIdentifier( ::sal_Int32 Identifierr ) override; + virtual css::uno::Sequence< ::sal_Int32 > SAL_CALL getIdentifiers( ) override; + + // css::container::XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + // css::awt::XControlContainer + void SAL_CALL setStatusText( const OUString& StatusText ) override; + css::uno::Sequence< css::uno::Reference< css::awt::XControl > > SAL_CALL getControls( ) override; + css::uno::Reference< css::awt::XControl > SAL_CALL getControl( const OUString& aName ) override; + void SAL_CALL addControl( const OUString& Name, const css::uno::Reference< css::awt::XControl >& Control ) override; + void SAL_CALL removeControl( const css::uno::Reference< css::awt::XControl >& Control ) override; + + // css::awt::XUnoControlContainer + void SAL_CALL setTabControllers( const css::uno::Sequence< css::uno::Reference< css::awt::XTabController > >& TabControllers ) override; + css::uno::Sequence< css::uno::Reference< css::awt::XTabController > > SAL_CALL getTabControllers( ) override; + void SAL_CALL addTabController( const css::uno::Reference< css::awt::XTabController >& TabController ) override; + void SAL_CALL removeTabController( const css::uno::Reference< css::awt::XTabController >& TabController ) override; + + // css::awt::XControl + void SAL_CALL createPeer( const css::uno::Reference< css::awt::XToolkit >& Toolkit, const css::uno::Reference< css::awt::XWindowPeer >& Parent ) override; + + // css::awt::XWindow + void SAL_CALL setVisible( sal_Bool Visible ) override; + + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + +protected: + virtual void PrepareWindowDescriptor( css::awt::WindowDescriptor& rDesc ) override; + virtual void removingControl( const css::uno::Reference< css::awt::XControl >& _rxControl ); + virtual void addingControl( const css::uno::Reference< css::awt::XControl >& _rxControl ); + + /** ensures that the given control has a peer, if necessary and possible + @param _rxControl + an ->XControl which has just been inserted into the container. Must not be <NULL/>. + @precond + our mutex is locked + */ + virtual void impl_createControlPeerIfNecessary( + const css::uno::Reference< css::awt::XControl >& _rxControl + ); +private: + /** adds the control to the container, does necessary notifications, and the like + @param _rxControl + the control to add. Must not be <NULL/> + @param _pName + Pointer to a name for the control. Might be <NULL/>, in this case an automatic name is generated + @return + the ID of the newly added control + */ + sal_Int32 impl_addControl( + const css::uno::Reference< css::awt::XControl >& _rxControl, + const OUString* _pName = nullptr + ); + + /** removes the given control from the container, including necessary notifications and the like + @param _nId + the ID of the control to remove + @param _rxControl + the control itself. Must be the one which is stored under the given ID. This parameter could also be + obtained inside the method, but callers usually have obtained it, anyway. + */ + void impl_removeControl( + sal_Int32 _nId, + const css::uno::Reference< css::awt::XControl >& _rxControl + ); + +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/unocontrolcontainermodel.hxx b/toolkit/inc/controls/unocontrolcontainermodel.hxx new file mode 100644 index 000000000..4fe48cdca --- /dev/null +++ b/toolkit/inc/controls/unocontrolcontainermodel.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + + +#include <toolkit/controls/unocontrolmodel.hxx> + + + +class UnoControlContainerModel final : public UnoControlModel +{ + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + +public: + UnoControlContainerModel( const css::uno::Reference< css::uno::XComponentContext >& i_factory ); + UnoControlContainerModel( const UnoControlContainerModel& rModel ) : UnoControlModel( rModel ) {} + + rtl::Reference<UnoControlModel> Clone() const override { return new UnoControlContainerModel( *this ); } + + // css::beans::XMultiPropertySet + css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + // css::io::XPersistObject + OUString SAL_CALL getServiceName() override; + + // css::lang::XServiceInfo + OUString SAL_CALL getImplementationName() override; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/accessibilityclient.hxx b/toolkit/inc/helper/accessibilityclient.hxx new file mode 100644 index 000000000..f90414671 --- /dev/null +++ b/toolkit/inc/helper/accessibilityclient.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_INC_HELPER_ACCESSIBILITYCLIENT_HXX +#define INCLUDED_TOOLKIT_INC_HELPER_ACCESSIBILITYCLIENT_HXX + +#include <toolkit/helper/accessiblefactory.hxx> + +namespace toolkit +{ + /** a client for the accessibility implementations which have been + outsourced from the main toolkit library + + All instances of this class share a reference to a common IAccessibleFactory + instance, which is used for creating all kind of Accessibility related + components. + + When the AccessibilityClient goes away, also this factory goes away, and the respective + library is unloaded. + + This class is not thread-safe. + */ + class AccessibilityClient + { + private: + bool m_bInitialized; + + public: + AccessibilityClient(); + + IAccessibleFactory& getFactory(); + + private: + void ensureInitialized(); + }; + +} // namespace toolkit + +#endif // INCLUDED_TOOLKIT_INC_HELPER_ACCESSIBILITYCLIENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/btndlg.hxx b/toolkit/inc/helper/btndlg.hxx new file mode 100644 index 000000000..8894b8dec --- /dev/null +++ b/toolkit/inc/helper/btndlg.hxx @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_VCL_BTNDLG_HXX +#define INCLUDED_VCL_BTNDLG_HXX + +#include <vcl/toolkit/dialog.hxx> +#include <o3tl/typed_flags_set.hxx> + +#include <vector> +#include <memory> + +struct ImplBtnDlgItem; +class PushButton; +class Button; + +#define BUTTONDIALOG_BUTTON_NOTFOUND (sal_uInt16(0xFFFF)) + +enum class ButtonDialogFlags +{ + NONE = 0x0000, + Default = 0x0001, + OK = 0x0002, + Cancel = 0x0004, + Help = 0x0008, + Focus = 0x0010, +}; +namespace o3tl +{ + template<> struct typed_flags<ButtonDialogFlags> : is_typed_flags<ButtonDialogFlags, 0x001f> {}; +} + +class ButtonDialog : public Dialog +{ +public: + virtual ~ButtonDialog() override; + virtual void dispose() override; + + virtual void Resize() override; + virtual void StateChanged( StateChangedType nStateChange ) override; + + void SetPageSizePixel( const Size& rSize ) { maPageSize = rSize; } + + void AddButton( StandardButtonType eType, sal_uInt16 nId, ButtonDialogFlags nBtnFlags, tools::Long nSepPixel = 0 ); + void RemoveButton( sal_uInt16 nId ); + +protected: + ButtonDialog( WindowType nType ); + tools::Long ImplGetButtonSize(); + +private: + ButtonDialog( const ButtonDialog & ) = delete; + ButtonDialog& operator=( const ButtonDialog& ) = delete; + +private: + std::vector<std::unique_ptr<ImplBtnDlgItem>> m_ItemList; + Size maPageSize; + Size maCtrlSize; + tools::Long mnButtonSize; + sal_uInt16 mnCurButtonId; + sal_uInt16 mnFocusButtonId; + bool mbFormat; + + void ImplInitButtonDialogData(); + VclPtr<PushButton> ImplCreatePushButton( ButtonDialogFlags nBtnFlags ); + DECL_LINK( ImplClickHdl, Button* pBtn, void ); + void ImplPosControls(); + +}; + +#endif // INCLUDED_VCL_BTNDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/imagealign.hxx b/toolkit/inc/helper/imagealign.hxx new file mode 100644 index 000000000..087a9f540 --- /dev/null +++ b/toolkit/inc/helper/imagealign.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_INC_HELPER_IMAGEALIGN_HXX +#define INCLUDED_TOOLKIT_INC_HELPER_IMAGEALIGN_HXX + +#include <sal/types.h> +#include <tools/wintypes.hxx> + +namespace toolkit +{ + + + /** translates a VCL ImageAlign value into a css.awt.ImagePosition value + */ + sal_Int16 translateImagePosition( ImageAlign _eVCLAlign ); + + /** translates a css.awt.ImagePosition value into a VCL ImageAlign + */ + ImageAlign translateImagePosition( sal_Int16 _nImagePosition ); + + /** translates a VCL ImageAlign value into a compatible css.awt.ImageAlign value + */ + sal_Int16 getCompatibleImageAlign( ImageAlign _eAlign ); + + /** translates a css.awt.ImageAlign value into a css.awt.ImagePosition value + */ + sal_Int16 getExtendedImagePosition( sal_Int16 _nImageAlign ); + + +} // namespace toolkit + + +#endif // INCLUDED_TOOLKIT_INC_HELPER_IMAGEALIGN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/msgbox.hxx b/toolkit/inc/helper/msgbox.hxx new file mode 100644 index 000000000..cef129cf4 --- /dev/null +++ b/toolkit/inc/helper/msgbox.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <o3tl/typed_flags_set.hxx> +#include <helper/btndlg.hxx> +#include <vcl/toolkit/fixed.hxx> +#include <vcl/toolkit/vclmedit.hxx> + +// Window-Bits for MessageBoxen +enum class MessBoxStyle +{ + NONE = 0x0000, + Ok = 0x0001, + OkCancel = 0x0002, + YesNo = 0x0004, + YesNoCancel = 0x0008, + RetryCancel = 0x0010, + DefaultOk = 0x0020, + DefaultCancel = 0x0040, + DefaultRetry = 0x0080, + DefaultYes = 0x0100, + DefaultNo = 0x0200, + AbortRetryIgnore = 0x1000, + DefaultIgnore = 0x2000, +}; +namespace o3tl +{ +template <> struct typed_flags<MessBoxStyle> : is_typed_flags<MessBoxStyle, 0x33ff> +{ +}; +} + +class MessBox : public ButtonDialog +{ + VclPtr<VclMultiLineEdit> mpVCLMultiLineEdit; + VclPtr<FixedImage> mpFixedImage; + Image maImage; + bool mbHelpBtn; + MessBoxStyle mnMessBoxStyle; + +protected: + OUString maMessText; + + void ImplInitButtons(); + void ImplPosControls(); + +public: + MessBox(vcl::Window* pParent, MessBoxStyle nMessBoxStyle, WinBits n, const OUString& rTitle, + const OUString& rMessage); + virtual ~MessBox() override; + virtual void dispose() override; + + virtual void StateChanged(StateChangedType nStateChange) override; + + void SetMessText(const OUString& rText) { maMessText = rText; } + const OUString& GetMessText() const { return maMessText; } + + void SetImage(const Image& rImage) { maImage = rImage; } + + virtual Size GetOptimalSize() const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/scrollabledialog.hxx b/toolkit/inc/helper/scrollabledialog.hxx new file mode 100644 index 000000000..26068b4f5 --- /dev/null +++ b/toolkit/inc/helper/scrollabledialog.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_AWT_SCROLLABLEDIALOG_HXX +#define INCLUDED_TOOLKIT_AWT_SCROLLABLEDIALOG_HXX + +#include <vcl/toolkit/dialog.hxx> +#include <vcl/scrbar.hxx> + +namespace toolkit +{ + class ScrollableDialog final : public Dialog + { + public: + enum ScrollBarVisibility { None, Vert, Hori, Both }; + + private: + VclPtr<ScrollBar> maHScrollBar; + VclPtr<ScrollBar> maVScrollBar; + Size maScrollArea; + bool mbHasHoriBar; + bool mbHasVertBar; + Point mnScrollPos; + tools::Long mnScrWidth; + ScrollBarVisibility maScrollVis; + + void lcl_Scroll( tools::Long nX, tools::Long nY ); + DECL_LINK( ScrollBarHdl, ScrollBar*, void ); + + public: + ScrollableDialog( vcl::Window* pParent, WinBits nStyle, Dialog::InitFlag eFlag = Dialog::InitFlag::Default ); + virtual ~ScrollableDialog() override; + virtual void dispose() override; + // Window + virtual void Resize() override; + + void SetScrollWidth( tools::Long nWidth ); + void SetScrollHeight( tools::Long nHeight ); + void SetScrollLeft( tools::Long nLeft ); + void SetScrollTop( tools::Long Top ); + void setScrollVisibility( ScrollBarVisibility rState ); + void ResetScrollBars(); + }; + +} // namespacetoolkit + + +#endif // INCLUDED_TOOLKIT_AWT_SCROLLABLEDIALOG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/servicenames.hxx b/toolkit/inc/helper/servicenames.hxx new file mode 100644 index 000000000..7fb7ab2a5 --- /dev/null +++ b/toolkit/inc/helper/servicenames.hxx @@ -0,0 +1,24 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +extern const char szServiceName_UnoControlDialog[]; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/tkresmgr.hxx b/toolkit/inc/helper/tkresmgr.hxx new file mode 100644 index 000000000..70cc4118c --- /dev/null +++ b/toolkit/inc/helper/tkresmgr.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_INC_HELPER_TKRESMGR_HXX +#define INCLUDED_TOOLKIT_INC_HELPER_TKRESMGR_HXX + +#include <rtl/ustring.hxx> + +class Image; + +namespace TkResMgr +{ +Image getImageFromURL(const OUString& i_rImageURL); +}; + +#endif // INCLUDED_TOOLKIT_INC_HELPER_TKRESMGR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/unopropertyarrayhelper.hxx b/toolkit/inc/helper/unopropertyarrayhelper.hxx new file mode 100644 index 000000000..31940ec4c --- /dev/null +++ b/toolkit/inc/helper/unopropertyarrayhelper.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_INC_HELPER_UNOPROPERTYARRAYHELPER_HXX +#define INCLUDED_TOOLKIT_INC_HELPER_UNOPROPERTYARRAYHELPER_HXX + +#include <cppuhelper/propshlp.hxx> + +#include <vector> +#include <o3tl/sorted_vector.hxx> + + + +class UnoPropertyArrayHelper final : public ::cppu::IPropertyArrayHelper +{ + o3tl::sorted_vector<sal_Int32> maIDs; + + bool ImplHasProperty( sal_uInt16 nPropId ) const; + +public: + UnoPropertyArrayHelper( const css::uno::Sequence<sal_Int32>& rIDs ); + UnoPropertyArrayHelper( const std::vector< sal_uInt16 > &rIDs ); + + // ::cppu::IPropertyArrayHelper + sal_Bool SAL_CALL fillPropertyMembersByHandle( OUString * pPropName, sal_Int16 * pAttributes, sal_Int32 nHandle ) override; + css::uno::Sequence< css::beans::Property > SAL_CALL getProperties() override; + css::beans::Property SAL_CALL getPropertyByName(const OUString& rPropertyName) override; + sal_Bool SAL_CALL hasPropertyByName(const OUString& rPropertyName) override; + sal_Int32 SAL_CALL getHandleByName( const OUString & rPropertyName ) override; + sal_Int32 SAL_CALL fillHandles( sal_Int32* pHandles, const css::uno::Sequence< OUString > & rPropNames ) override; +}; + + +#endif // INCLUDED_TOOLKIT_INC_HELPER_UNOPROPERTYARRAYHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/unowrapper.hxx b/toolkit/inc/helper/unowrapper.hxx new file mode 100644 index 000000000..03a9b525c --- /dev/null +++ b/toolkit/inc/helper/unowrapper.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_TOOLKIT_INC_HELPER_UNOWRAPPER_HXX +#define INCLUDED_TOOLKIT_INC_HELPER_UNOWRAPPER_HXX + +#include <com/sun/star/awt/XToolkit.hpp> +#include <com/sun/star/awt/XGraphics.hpp> +#include <com/sun/star/awt/XWindowPeer.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> + +#include <vcl/toolkit/unowrap.hxx> +#include <vcl/window.hxx> + +#include <helper/accessibilityclient.hxx> + + + +class UnoWrapper final : public UnoWrapperBase +{ +private: + css::uno::Reference< css::awt::XToolkit> mxToolkit; + ::toolkit::AccessibilityClient maAccessibleFactoryAccess; + +public: + UnoWrapper( const css::uno::Reference< css::awt::XToolkit>& rxToolkit ); + + virtual void Destroy() override; + + // Toolkit + virtual css::uno::Reference< css::awt::XToolkit> GetVCLToolkit() override; + + // Graphics + virtual css::uno::Reference< css::awt::XGraphics> CreateGraphics( OutputDevice* pOutDev ) override; + virtual void ReleaseAllGraphics( OutputDevice* pOutDev ) override; + + // Window + virtual css::uno::Reference< css::awt::XWindowPeer> GetWindowInterface( vcl::Window* pWindow ) override; + virtual void SetWindowInterface( vcl::Window* pWindow, const css::uno::Reference< css::awt::XWindowPeer> & xIFace ) override; + virtual VclPtr<vcl::Window> GetWindow(const css::uno::Reference<css::awt::XWindow>& rxWindow) override; + + // Menu + virtual css::uno::Reference<css::awt::XPopupMenu> CreateMenuInterface( PopupMenu* pPopupMenu ) override; + + void WindowDestroyed( vcl::Window* pWindow ) override; + + // Accessibility + virtual css::uno::Reference< css::accessibility::XAccessible > + CreateAccessible( Menu* pMenu, bool bIsMenuBar ) override; + +private: + virtual ~UnoWrapper(); +}; + +#endif // INCLUDED_TOOLKIT_INC_HELPER_UNOWRAPPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |