diff options
Diffstat (limited to 'toolkit/inc')
52 files changed, 6453 insertions, 0 deletions
diff --git a/toolkit/inc/awt/animatedimagespeer.hxx b/toolkit/inc/awt/animatedimagespeer.hxx new file mode 100644 index 0000000000..839e249b3f --- /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 0000000000..9edf562c1d --- /dev/null +++ b/toolkit/inc/awt/vclxbitmap.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/XBitmap.hpp> +#include <com/sun/star/awt/XDisplayBitmap.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::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::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 0000000000..248f2e6505 --- /dev/null +++ b/toolkit/inc/awt/vclxcontainer.hxx @@ -0,0 +1,53 @@ +/* -*- 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/implbase.hxx> + +#include <toolkit/awt/vclxwindow.hxx> + +class VCLXContainer : public cppu::ImplInheritanceHelper<VCLXWindow, + css::awt::XVclContainer, + css::awt::XVclContainerPeer> +{ +public: + VCLXContainer(); + virtual ~VCLXContainer() 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 0000000000..acf03dd178 --- /dev/null +++ b/toolkit/inc/awt/vclxgraphics.hxx @@ -0,0 +1,117 @@ +/* -*- 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 <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> +{ +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::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 0000000000..1030319269 --- /dev/null +++ b/toolkit/inc/awt/vclxpointer.hxx @@ -0,0 +1,58 @@ +/* -*- 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 <comphelper/servicehelper.hxx> +#include <cppuhelper/implbase.hxx> +#include <mutex> + +#include <vcl/ptrstyle.hxx> + + + + +class VCLXPointer final : public cppu::WeakImplHelper< + css::awt::XPointer, css::lang::XServiceInfo> +{ + std::mutex maMutex; + PointerStyle maPointer; + +public: + VCLXPointer(); + virtual ~VCLXPointer() override; + + PointerStyle GetPointer() const { return maPointer; } + + // 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 0000000000..e5440f38aa --- /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 <comphelper/broadcasthelper.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 comphelper::OMutexAndBroadcastHelper + ,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 0000000000..c0c64d37a6 --- /dev/null +++ b/toolkit/inc/awt/vclxregion.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/XRegion.hpp> +#include <comphelper/servicehelper.hxx> +#include <cppuhelper/implbase.hxx> +#include <mutex> + +#include <vcl/region.hxx> + + + + +class VCLXRegion final : public cppu::WeakImplHelper< + css::awt::XRegion> +{ + std::mutex maMutex; + vcl::Region maRegion; + +public: + VCLXRegion(); + virtual ~VCLXRegion() override; + + const vcl::Region& GetRegion() const { return maRegion; } + + // 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 0000000000..acd7a68984 --- /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 0000000000..69eba013c6 --- /dev/null +++ b/toolkit/inc/awt/vclxsystemdependentwindow.hxx @@ -0,0 +1,40 @@ +/* -*- 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/implbase.hxx> + +#include <toolkit/awt/vclxwindow.hxx> + +class VCLXSystemDependentWindow final : + public cppu::ImplInheritanceHelper<VCLXWindow, css::awt::XSystemDependentWindowPeer> +{ +public: + VCLXSystemDependentWindow(); + virtual ~VCLXSystemDependentWindow() 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 0000000000..e300e03aff --- /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 0000000000..1913c4594f --- /dev/null +++ b/toolkit/inc/awt/vclxtopwindow.hxx @@ -0,0 +1,65 @@ +/* -*- 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/implbase.hxx> + +#include <awt/vclxcontainer.hxx> + +namespace com::sun::star::awt { class XMenuBar; } + + +class VCLXTopWindow: public cppu::ImplInheritanceHelper< + VCLXContainer, css::awt::XTopWindow2, css::awt::XSystemDependentWindowPeer > +{ +public: + VCLXTopWindow(); + virtual ~VCLXTopWindow() 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 0000000000..22367ddcc0 --- /dev/null +++ b/toolkit/inc/awt/vclxwindows.hxx @@ -0,0 +1,605 @@ +/* -*- 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/XTimeField.hpp> +#include <com/sun/star/awt/grid/XGridControl.hpp> +#include <com/sun/star/awt/grid/XGridRowSelection.hpp> +#include <com/sun/star/awt/grid/XGridDataListener.hpp> +#include <com/sun/star/awt/grid/GridDataEvent.hpp> +#include <com/sun/star/awt/grid/XGridSelectionListener.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/util/Time.hpp> +#include <com/sun/star/util/Date.hpp> + +#include <cppuhelper/implbase.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 cppu::ImplInheritanceHelper<VCLXTopWindow, css::awt::XMessageBox> +{ +public: + VCLXMessageBox(); + virtual ~VCLXMessageBox() 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::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 cppu::ImplInheritanceHelper<VCLXTopWindow, css::awt::XDialog2> +{ +public: + VCLXDialog(); + virtual ~VCLXDialog() 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::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 cppu::ImplInheritanceHelper<VCLXContainer, css::awt::XSimpleTabController> +{ + TabListenerMultiplexer maTabListeners; + sal_Int32 mTabId; + + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; +public: + VCLXMultiPage(); + virtual ~VCLXMultiPage() 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 VCLXProgressBar +class VCLXProgressBar final : public cppu::ImplInheritanceHelper<VCLXWindow, css::awt::XProgressBar> +{ +private: + sal_Int32 m_nValue; + sal_Int32 m_nValueMin; + sal_Int32 m_nValueMax; + + void ImplUpdateValue(); + +public: + VCLXProgressBar(); + virtual ~VCLXProgressBar() 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 cppu::ImplInheritanceHelper<VCLXFormattedSpinField, css::awt::XDateField> +{ +protected: + virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; +public: + VCLXDateField(); + virtual ~VCLXDateField() 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 cppu::ImplInheritanceHelper<VCLXFormattedSpinField, css::awt::XTimeField> +{ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > CreateAccessibleContext() override; +public: + VCLXTimeField(); + virtual ~VCLXTimeField() 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 cppu::ImplInheritanceHelper<VCLXFormattedSpinField, css::awt::XNumericField> +{ +public: + VCLXNumericField(); + virtual ~VCLXNumericField() 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 cppu::ImplInheritanceHelper<VCLXFormattedSpinField, css::awt::XMetricField> +{ + /// @throws css::uno::RuntimeException + MetricFormatter *GetMetricFormatter(); + /// @throws css::uno::RuntimeException + MetricField *GetMetricField(); + void CallListeners(); +public: + VCLXMetricField(); + virtual ~VCLXMetricField() 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 cppu::ImplInheritanceHelper<VCLXFormattedSpinField, css::awt::XPatternField> +{ +public: + VCLXPatternField(); + virtual ~VCLXPatternField() 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 cppu::ImplInheritanceHelper<VCLXWindow, css::awt::XTextComponent, css::awt::XTextLayoutConstrains> +{ + DECL_LINK(ModifyHdl, Edit&, void); + void ModifyHdl(); + TextListenerMultiplexer maTextListeners; + +public: + VCLXFileControl(); + virtual ~VCLXFileControl() override; + + virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ) 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 cppu::ImplInheritanceHelper<SVTXFormattedField, css::awt::XCurrencyField> +{ +public: + SVTXCurrencyField(); + virtual ~SVTXCurrencyField() 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 ); } +}; + +namespace svt::table { + class TableControl; + class UnoControlTableModel; +} + +typedef ::cppu::ImplInheritanceHelper < VCLXWindow + , css::awt::grid::XGridControl + , css::awt::grid::XGridRowSelection + , css::awt::grid::XGridDataListener + , css::container::XContainerListener + > SVTXGridControl_Base; +class SVTXGridControl final : public SVTXGridControl_Base +{ +public: + SVTXGridControl(); + virtual ~SVTXGridControl() override; + + // XGridDataListener + virtual void SAL_CALL rowsInserted( const css::awt::grid::GridDataEvent& Event ) override; + virtual void SAL_CALL rowsRemoved( const css::awt::grid::GridDataEvent& Event ) override; + virtual void SAL_CALL dataChanged( const css::awt::grid::GridDataEvent& Event ) override; + virtual void SAL_CALL rowHeadingChanged( const css::awt::grid::GridDataEvent& Event ) 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& Source ) override; + + // XGridControl + virtual ::sal_Int32 SAL_CALL getRowAtPoint(::sal_Int32 x, ::sal_Int32 y) override; + virtual ::sal_Int32 SAL_CALL getColumnAtPoint(::sal_Int32 x, ::sal_Int32 y) override; + virtual ::sal_Int32 SAL_CALL getCurrentColumn( ) override; + virtual ::sal_Int32 SAL_CALL getCurrentRow( ) override; + virtual void SAL_CALL goToCell( ::sal_Int32 i_columnIndex, ::sal_Int32 i_rowIndex ) override; + + // XGridRowSelection + virtual void SAL_CALL selectRow( ::sal_Int32 i_rowIndex ) override; + virtual void SAL_CALL selectAllRows() override; + virtual void SAL_CALL deselectRow( ::sal_Int32 i_rowIndex ) override; + virtual void SAL_CALL deselectAllRows() override; + virtual css::uno::Sequence< ::sal_Int32 > SAL_CALL getSelectedRows() override; + virtual sal_Bool SAL_CALL hasSelectedRows() override; + virtual sal_Bool SAL_CALL isRowSelected(::sal_Int32 index) override; + virtual void SAL_CALL addSelectionListener(const css::uno::Reference< css::awt::grid::XGridSelectionListener > & listener) override; + virtual void SAL_CALL removeSelectionListener(const css::uno::Reference< css::awt::grid::XGridSelectionListener > & listener) override; + + void SAL_CALL setProperty( const OUString& PropertyName, const css::uno::Any& Value ) override; + css::uno::Any SAL_CALL getProperty( const OUString& PropertyName ) override; + + // css::lang::XComponent + void SAL_CALL dispose( ) override; + + // XWindow + void SAL_CALL setEnable( sal_Bool bEnable ) override; + +private: + // VCLXWindow + virtual void SetWindow( const VclPtr< vcl::Window > &pWindow ) override; + + void impl_updateColumnsFromModel_nothrow(); + void impl_checkTableModelInit(); + + void impl_checkColumnIndex_throw( ::svt::table::TableControl const & i_table, sal_Int32 const i_columnIndex ) const; + void impl_checkRowIndex_throw( ::svt::table::TableControl const & i_table, sal_Int32 const i_rowIndex ) const; + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + void ImplCallItemListeners(); + + std::shared_ptr< ::svt::table::UnoControlTableModel > m_xTableModel; + bool m_bTableModelInitCompleted; + SelectionListenerMultiplexer m_aSelectionListeners; +}; + +/* 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 0000000000..416984c334 --- /dev/null +++ b/toolkit/inc/controls/accessiblecontrolcontext.hxx @@ -0,0 +1,116 @@ +/* -*- 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 <com/sun/star/lang/XEventListener.hpp> +#include <cppuhelper/implbase.hxx> +#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; + + /** 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 cppu::ImplInheritanceHelper< + OAccessibleControlContext_Base, css::lang::XEventListener> + { + 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 + ); + + private: + + // XAccessibleContext + virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 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 sal_Int64 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::OCommonAccessibleComponent::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 0000000000..fca49bfa39 --- /dev/null +++ b/toolkit/inc/controls/animatedimages.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 . + */ + +#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& getInfoHelper() override; + void setFastPropertyValue_NoBroadcast( + std::unique_lock<std::mutex>& rGuard, + sal_Int32 nHandle, const css::uno::Any& rValue ) override; + + private: + comphelper::OInterfaceContainerHelper4<css::container::XContainerListener> maContainerListeners; + 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 0000000000..ae414346c7 --- /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/interfacecontainer4.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::OInterfaceContainerHelper4<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& 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 comphelper::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 0000000000..3aaf3e50b1 --- /dev/null +++ b/toolkit/inc/controls/dialogcontrol.hxx @@ -0,0 +1,299 @@ +/* -*- 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 ); + UnoMultiPageModel(const UnoMultiPageModel& rOther) : ControlModelContainerBase(rOther) {} + virtual ~UnoMultiPageModel() override; + + 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& 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 ); + UnoPageModel(const UnoPageModel& rOther) : ControlModelContainerBase(rOther) {} + virtual ~UnoPageModel() override; + + 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& 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 ); + UnoFrameModel(const UnoFrameModel& rOther) : ControlModelContainerBase(rOther) {} + virtual ~UnoFrameModel() override; + + 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& 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 0000000000..79a434a398 --- /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 0000000000..1330d0ce7c --- /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 0000000000..c614b42c74 --- /dev/null +++ b/toolkit/inc/controls/formattedcontrol.hxx @@ -0,0 +1,124 @@ +/* -*- 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(std::unique_lock<std::mutex>& rGuard); + void impl_updateCachedFormatter_nothrow(std::unique_lock<std::mutex>& rGuard); + void impl_updateCachedFormatKey_nothrow(std::unique_lock<std::mutex>& rGuard); + + css::uno::Any ImplGetDefaultValue( sal_uInt16 nPropId ) const override; + ::cppu::IPropertyArrayHelper& getInfoHelper() override; + bool convertFastPropertyValue( + std::unique_lock<std::mutex>& rGuard, + css::uno::Any& rConvertedValue, + css::uno::Any& rOldValue, + sal_Int32 nPropId, + const css::uno::Any& rValue + ) override; + + void setFastPropertyValue_NoBroadcast( + std::unique_lock<std::mutex>& rGuard, + 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 0000000000..c2dc13b49f --- /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, + OUString _aServiceSpecifier + ); + + // 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 0000000000..2ec8595ddd --- /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 0000000000..cb6e2cec45 --- /dev/null +++ b/toolkit/inc/controls/roadmapcontrol.hxx @@ -0,0 +1,185 @@ +/* -*- 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& 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_UNO3_AGG_DEFAULTS(UnoRoadmapControl, UnoControlRoadmap_Base) + + css::uno::Any SAL_CALL queryAggregation(css::uno::Type const & aType) override; + + // 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 0000000000..b8490439c9 --- /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 0000000000..37de42d7da --- /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 0000000000..4fa12d252e --- /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 0000000000..61befc9815 --- /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::XVclWindowPeer > GetComponentInterface(bool bCreate = true) override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/table/defaultinputhandler.hxx b/toolkit/inc/controls/table/defaultinputhandler.hxx new file mode 100644 index 0000000000..3f3d425a69 --- /dev/null +++ b/toolkit/inc/controls/table/defaultinputhandler.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 . + */ + +#pragma once + +#include <controls/table/mousefunction.hxx> +#include <controls/table/tableinputhandler.hxx> +#include <rtl/ref.hxx> + +#include <vector> + +namespace svt::table +{ + + class DefaultInputHandler final : public ITableInputHandler + { + public: + DefaultInputHandler(); + virtual ~DefaultInputHandler() override; + + virtual bool MouseMove ( ITableControl& _rControl, const MouseEvent& rMEvt ) override; + virtual bool MouseButtonDown ( ITableControl& _rControl, const MouseEvent& rMEvt ) override; + virtual bool MouseButtonUp ( ITableControl& _rControl, const MouseEvent& rMEvt ) override; + virtual bool KeyInput ( ITableControl& _rControl, const KeyEvent& rKEvt ) override; + virtual bool GetFocus ( ITableControl& _rControl ) override; + virtual bool LoseFocus ( ITableControl& _rControl ) override; + + private: + bool delegateMouseEvent( ITableControl& i_control, const MouseEvent& i_event, + FunctionResult ( MouseFunction::*i_handlerMethod )( ITableControl&, const MouseEvent& ) ); + + rtl::Reference< MouseFunction > pActiveFunction; + std::vector< rtl::Reference< MouseFunction > > aMouseFunctions; + }; + + +} // namespace svt::table + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/table/gridtablerenderer.hxx b/toolkit/inc/controls/table/gridtablerenderer.hxx new file mode 100644 index 0000000000..e2634b2d26 --- /dev/null +++ b/toolkit/inc/controls/table/gridtablerenderer.hxx @@ -0,0 +1,116 @@ +/* -*- 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/table/tablemodel.hxx> +#include <vcl/image.hxx> + +#include <memory> + + +namespace svt::table +{ + + + struct GridTableRenderer_Impl; + + + //= GridTableRenderer + + /** a default implementation for the ->ITableRenderer interface + + This class is able to paint a table grid, table headers, and cell + backgrounds according to the selected/active state of cells. + */ + class GridTableRenderer final : public ITableRenderer + { + private: + ::std::unique_ptr< GridTableRenderer_Impl > m_pImpl; + + public: + /** creates a table renderer associated with the given model + + @param _rModel + the model which should be rendered. The caller is responsible + for lifetime control, that is, the model instance must live + at least as long as the renderer instance lives + */ + GridTableRenderer( ITableModel& _rModel ); + virtual ~GridTableRenderer() override; + + /** determines whether or not to paint grid lines + */ + bool useGridLines() const; + + /** controls whether or not to paint grid lines + */ + void useGridLines( bool const i_use ); + + public: + // ITableRenderer overridables + virtual void PaintHeaderArea( + vcl::RenderContext& _rDevice, const tools::Rectangle& _rArea, + bool _bIsColHeaderArea, bool _bIsRowHeaderArea, + const StyleSettings& _rStyle ) override; + virtual void PaintColumnHeader( ColPos _nCol, + vcl::RenderContext& _rDevice, const tools::Rectangle& _rArea, + const StyleSettings& _rStyle ) override; + virtual void PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected, + vcl::RenderContext& _rDevice, const tools::Rectangle& _rRowArea, + const StyleSettings& _rStyle ) override; + virtual void PaintRowHeader( + vcl::RenderContext& _rDevice, const tools::Rectangle& _rArea, + const StyleSettings& _rStyle ) override; + virtual void PaintCell( ColPos const i_col, + bool i_hasControlFocus, bool _bSelected, + vcl::RenderContext& _rDevice, const tools::Rectangle& _rArea, + const StyleSettings& _rStyle ) override; + virtual void ShowCellCursor( vcl::Window& _rView, const tools::Rectangle& _rCursorRect) override; + virtual void HideCellCursor( vcl::Window& _rView ) override; + virtual bool FitsIntoCell( + css::uno::Any const & i_cellContent, + OutputDevice& i_targetDevice, tools::Rectangle const & i_targetArea + ) const override; + virtual bool GetFormattedCellString( + css::uno::Any const & i_cellValue, + OUString & o_cellString + ) const override; + + private: + struct CellRenderContext; + + void impl_paintCellContent( + CellRenderContext const & i_context + ); + void impl_paintCellImage( + CellRenderContext const & i_context, + Image const & i_image + ); + void impl_paintCellText( + CellRenderContext const & i_context, + OUString const & i_text + ); + }; + +} // namespace svt::table + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/table/mousefunction.hxx b/toolkit/inc/controls/table/mousefunction.hxx new file mode 100644 index 0000000000..ef68dc89ce --- /dev/null +++ b/toolkit/inc/controls/table/mousefunction.hxx @@ -0,0 +1,133 @@ +/* -*- 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 "tabletypes.hxx" + +#include <salhelper/simplereferenceobject.hxx> + +class MouseEvent; + +namespace svt::table +{ +class ITableControl; + +//= FunctionResult + +enum FunctionResult +{ + ActivateFunction, + ContinueFunction, + DeactivateFunction, + + SkipFunction +}; + +//= MouseFunction + +class MouseFunction : public ::salhelper::SimpleReferenceObject +{ +public: + MouseFunction() {} + MouseFunction(const MouseFunction&) = delete; + MouseFunction& operator=(const MouseFunction&) = delete; + virtual FunctionResult handleMouseMove(ITableControl& i_tableControl, MouseEvent const& i_event) + = 0; + virtual FunctionResult handleMouseDown(ITableControl& i_tableControl, MouseEvent const& i_event) + = 0; + virtual FunctionResult handleMouseUp(ITableControl& i_tableControl, MouseEvent const& i_event) + = 0; + +protected: + virtual ~MouseFunction() override {} +}; + +//= ColumnResize + +class ColumnResize final : public MouseFunction +{ +public: + ColumnResize() + : m_nResizingColumn(COL_INVALID) + { + } + +public: + // MouseFunction + virtual FunctionResult handleMouseMove(ITableControl& i_tableControl, + MouseEvent const& i_event) override; + virtual FunctionResult handleMouseDown(ITableControl& i_tableControl, + MouseEvent const& i_event) override; + virtual FunctionResult handleMouseUp(ITableControl& i_tableControl, + MouseEvent const& i_event) override; + +private: + ColPos m_nResizingColumn; +}; + +//= RowSelection + +class RowSelection final : public MouseFunction +{ +public: + RowSelection() + : m_bActive(false) + { + } + +public: + // MouseFunction + virtual FunctionResult handleMouseMove(ITableControl& i_tableControl, + MouseEvent const& i_event) override; + virtual FunctionResult handleMouseDown(ITableControl& i_tableControl, + MouseEvent const& i_event) override; + virtual FunctionResult handleMouseUp(ITableControl& i_tableControl, + MouseEvent const& i_event) override; + +private: + bool m_bActive; +}; + +//= ColumnSortHandler + +class ColumnSortHandler final : public MouseFunction +{ +public: + ColumnSortHandler() + : m_nActiveColumn(COL_INVALID) + { + } + +public: + // MouseFunction + virtual FunctionResult handleMouseMove(ITableControl& i_tableControl, + MouseEvent const& i_event) override; + virtual FunctionResult handleMouseDown(ITableControl& i_tableControl, + MouseEvent const& i_event) override; + virtual FunctionResult handleMouseUp(ITableControl& i_tableControl, + MouseEvent const& i_event) override; + +private: + ColPos m_nActiveColumn; +}; + +} // namespace svt::table + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/table/tablecontrol.hxx b/toolkit/inc/controls/table/tablecontrol.hxx new file mode 100644 index 0000000000..9d9f98ff11 --- /dev/null +++ b/toolkit/inc/controls/table/tablecontrol.hxx @@ -0,0 +1,174 @@ +/* -*- 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/table/tablemodel.hxx> +#include <vcl/accessibletable.hxx> + +#include <vcl/ctrl.hxx> +#include <vcl/seleng.hxx> + +#include <memory> + +namespace svt::table +{ + class TableControl_Impl; + + + //= TableControl + + /** a basic control which manages table-like data, i.e. a number of cells + organized in <code>m</code> rows and <code>n</code> columns. + + The control itself does not do any assumptions about the concrete data + it displays, this is encapsulated in an instance supporting the + ->ITableModel interface. + + Also, the control does not do any assumptions about how the model's + content is rendered. This is the responsibility of a component + supporting the ->ITableRenderer interface (the renderer is obtained from + the model). + + The control supports the concept of a <em>current</em> (or <em>active</em> + cell). + The control supports accessibility, this is encapsulated in IAccessibleTable + */ + class TableControl final : public Control, public vcl::table::IAccessibleTable + { + private: + std::shared_ptr<TableControl_Impl> m_pImpl; + + + public: + TableControl( vcl::Window* _pParent, WinBits _nStyle ); + virtual ~TableControl() override; + virtual void dispose() override; + + /// sets a new table model + void SetModel( const PTableModel& _pModel ); + /// retrieves the current table model + PTableModel GetModel() const; + + /** retrieves the current row + + The current row is the one which contains the active cell. + + @return + the row index of the active cell, or ->ROW_INVALID + if there is no active cell, e.g. because the table does + not contain any rows or columns. + */ + sal_Int32 GetCurrentRow() const override; + + ITableControl& + getTableControlInterface(); + + /** retrieves the current column + + The current col is the one which contains the active cell. + + @return + the column index of the active cell, or ->COL_INVALID + if there is no active cell, e.g. because the table does + not contain any rows or columns. + */ + sal_Int32 GetCurrentColumn() const override; + + /** activates the cell at the given position + */ + void GoTo( ColPos _nColumnPos, RowPos _nRow); + + virtual void Resize() override; + void Select(); + + /**after removing a row, updates the vector which contains the selected rows + if the row, which should be removed, is selected, it will be erased from the vector + */ + SelectionEngine* getSelEngine(); + vcl::Window& getDataWindow(); + + // Window overridables + virtual void GetFocus() override; + virtual void LoseFocus() override; + virtual void KeyInput( const KeyEvent& rKEvt ) override; + virtual void StateChanged( StateChangedType i_nStateChange ) override; + + /** Creates and returns the accessible object of the whole GridControl. */ + virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; + virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) override; + virtual OUString GetAccessibleObjectName(vcl::table::AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const override; + virtual void GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow ) override; + virtual OUString GetAccessibleObjectDescription(vcl::table::AccessibleTableControlObjType eObjType) const override; + virtual void FillAccessibleStateSet( sal_Int64& rStateSet, vcl::table::AccessibleTableControlObjType eObjType ) const override; + + // temporary methods + // Those do not really belong into the public API - they're intended for firing A11Y-related events. However, + // firing those events should be an implementation internal to the TableControl resp. TableControl_Impl, + // instead of something triggered externally. + void commitCellEventIfAccessibleAlive( sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue ); + void commitTableEventIfAccessibleAlive( sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue ); + + + // IAccessibleTable + virtual AbsoluteScreenPixelRectangle GetWindowExtentsAbsolute() const override; + virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) const override; + virtual void GrabFocus() override; + virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override; + virtual vcl::Window* GetAccessibleParentWindow() const override; + virtual vcl::Window* GetWindowInstance() override; + virtual sal_Int32 GetAccessibleControlCount() const override; + virtual bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) override; + virtual sal_Int32 GetRowCount() const override; + virtual sal_Int32 GetColumnCount() const override; + virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint ) override; + virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar ) override; + virtual tools::Rectangle calcHeaderCellRect( bool _bIsColumnBar, sal_Int32 nPos) override; + virtual tools::Rectangle calcTableRect() override; + virtual tools::Rectangle calcCellRect( sal_Int32 _nRowPos, sal_Int32 _nColPos ) override; + virtual tools::Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) override; + virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) override; + virtual void FillAccessibleStateSetForCell( sal_Int64& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const override; + virtual OUString GetRowName(sal_Int32 _nIndex) const override; + virtual OUString GetColumnName( sal_Int32 _nIndex ) const override; + virtual bool HasRowHeader() override; + virtual bool HasColHeader() override; + virtual OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const override; + + virtual sal_Int32 GetSelectedRowCount() const override; + virtual sal_Int32 GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const override; + virtual bool IsRowSelected( sal_Int32 const i_rowIndex ) const override; + virtual void SelectRow( sal_Int32 const i_rowIndex, bool const i_select ) override; + virtual void SelectAllRows( bool const i_select ) override; + + + private: + DECL_LINK( ImplSelectHdl, LinkParamNone*, void ); + + private: + TableControl( const TableControl& ) = delete; + TableControl& operator=( const TableControl& ) = delete; + }; + + +} // namespace svt::table + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/table/tablecontrolinterface.hxx b/toolkit/inc/controls/table/tablecontrolinterface.hxx new file mode 100644 index 0000000000..8f5dca6763 --- /dev/null +++ b/toolkit/inc/controls/table/tablecontrolinterface.hxx @@ -0,0 +1,234 @@ +/* -*- 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 <sal/types.h> +#include <vcl/seleng.hxx> +#include <vcl/window.hxx> + +#include <controls/table/tabletypes.hxx> +#include <controls/table/tablemodel.hxx> + +namespace svt::table +{ + //= TableControlAction + enum TableControlAction + { + /// moves the cursor in the table control one row up, if possible, by keeping the current column + cursorUp, + /// moves the cursor in the table control one row down, if possible, by keeping the current column + cursorDown, + /// moves the cursor in the table control one column to the left, if possible, by keeping the current row + cursorLeft, + /// moves the cursor in the table control one column to the right, if possible, by keeping the current row + cursorRight, + /// moves the cursor to the beginning of the current line + cursorToLineStart, + /// moves the cursor to the end of the current line + cursorToLineEnd, + /// moves the cursor to the first row, keeping the current column + cursorToFirstLine, + /// moves the cursor to the last row, keeping the current column + cursorToLastLine, + /// moves the cursor one page up, keeping the current column + cursorPageUp, + /// moves the cursor one page down, keeping the current column + cursorPageDown, + /// moves the cursor to the top-most, left-most cell + cursorTopLeft, + /// moves the cursor to the bottom-most, right-most cell + cursorBottomRight, + /// selects the row, where the actual cursor is + cursorSelectRow, + /// selects the rows, above the actual cursor is + cursorSelectRowUp, + /// selects the row, beneath the actual cursor is + cursorSelectRowDown, + /// selects the row, from the actual cursor till top + cursorSelectRowAreaTop, + /// selects the row, from the actual cursor till bottom + cursorSelectRowAreaBottom + }; + + + //= TableCellArea + + enum TableCellArea + { + CellContent, + ColumnDivider + }; + + + //= TableCell + + struct TableCell + { + ColPos nColumn; + RowPos nRow; + TableCellArea eArea; + + TableCell( ColPos const i_column, RowPos const i_row ) + :nColumn( i_column ) + ,nRow( i_row ) + ,eArea( CellContent ) + { + } + }; + + + //= ColumnMetrics + + struct ColumnMetrics + { + /** the start of the column, in pixels. Might be negative, in case the column is scrolled out of the visible + area. Note: see below. + */ + tools::Long nStartPixel; + + /** the end of the column, in pixels, plus 1. Effectively, this is the accumulated width of all columns + up to the current one. + + Huh? Earlier you said that the nStartPixel of columns + scrolled out (to the left) of the visible area is + negative. Also, where is the promise that there is no gap + between columns? The above claim would be true only if the + first column always started at zero, and there is never a + gap. So these doc comments are inconsistent. How + surprising. + */ + tools::Long nEndPixel; + + ColumnMetrics() + :nStartPixel(0) + ,nEndPixel(0) + { + } + + ColumnMetrics( tools::Long const i_start, tools::Long const i_end ) + :nStartPixel( i_start ) + ,nEndPixel( i_end ) + { + } + }; + + + //= TableArea + + enum class TableArea + { + ColumnHeaders, + RowHeaders, + All + }; + + + //= ITableControl + + /** defines a callback interface to be implemented by a concrete table control + */ + class SAL_NO_VTABLE ITableControl + { + public: + /** hides the cell cursor + + The method cares for successive calls, that is, for every call to + ->hideCursor(), you need one call to ->showCursor. Only if the number + of both calls matches, the cursor is really shown. + + @see showCursor + */ + virtual void hideCursor() = 0; + + /** shows the cell cursor + + @see hideCursor + */ + virtual void showCursor() = 0; + + /** dispatches an action to the table control + + @return + <TRUE/> if the action could be dispatched successfully, <FALSE/> otherwise. Usual + failure conditions include some other instance vetoing the action, or impossibility + to execute the action at all (for instance moving up one row when already positioned + on the very first row). + + @see TableControlAction + */ + virtual bool dispatchAction( TableControlAction _eAction ) = 0; + + /** returns selection engine*/ + virtual SelectionEngine* getSelEngine() = 0; + + /** returns the table model + + The returned model is guaranteed to not be <NULL/>. + */ + virtual PTableModel getModel() const = 0; + + /// returns the index of the currently active column + virtual ColPos getCurrentColumn() const = 0; + + /// returns the index of the currently active row + virtual RowPos getCurrentRow() const = 0; + + /// activates the given cell + virtual void activateCell( ColPos const i_col, RowPos const i_row ) = 0; + + /// retrieves the size of the table window, in pixels + virtual ::Size getTableSizePixel() const = 0; + + /// sets a new mouse pointer for the table window + virtual void setPointer( PointerStyle i_pointer ) = 0; + + /// captures the mouse to the table window + virtual void captureMouse() = 0; + + /// releases the mouse, after it had previously been captured + virtual void releaseMouse() = 0; + + /// invalidates the table window + virtual void invalidate( TableArea const i_what ) = 0; + + /// calculates a width, given in pixels, into an AppFont-based width + virtual tools::Long pixelWidthToAppFont( tools::Long const i_pixels ) const = 0; + + /// shows a tracking rectangle + virtual void showTracking( tools::Rectangle const & i_location, ShowTrackFlags const i_flags ) = 0; + + /// hides a previously shown tracking rectangle + virtual void hideTracking() = 0; + + /// does a hit test for the given pixel coordinates + virtual TableCell hitTest( const Point& rPoint ) const = 0; + + /// retrieves the metrics for a given column + virtual ColumnMetrics getColumnMetrics( ColPos const i_column ) const = 0; + + /// determines whether a given row is selected + virtual bool isRowSelected( RowPos _nRow ) const = 0; + + virtual ~ITableControl() {}; + }; + +} // namespace svt::table + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/table/tableinputhandler.hxx b/toolkit/inc/controls/table/tableinputhandler.hxx new file mode 100644 index 0000000000..9d11df38db --- /dev/null +++ b/toolkit/inc/controls/table/tableinputhandler.hxx @@ -0,0 +1,63 @@ +/* -*- 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 <memory> + +class MouseEvent; +class KeyEvent; + + +namespace svt::table +{ + + + class ITableControl; + + + //= ITableInputHandler + + /** interface for components handling input in a ->TableControl + */ + class ITableInputHandler + { + public: + // all those methods have the same semantics as the equal-named methods of ->Window, + // with the additional option to return a boolean value indicating whether + // the event should be further processed by the ->Window implementations (<FALSE/>), + // or whether it has been sufficiently handled by the ->ITableInputHandler instance + // (<FALSE/>). + + virtual bool MouseMove ( ITableControl& _rControl, const MouseEvent& rMEvt ) = 0; + virtual bool MouseButtonDown ( ITableControl& _rControl, const MouseEvent& rMEvt ) = 0; + virtual bool MouseButtonUp ( ITableControl& _rControl, const MouseEvent& rMEvt ) = 0; + virtual bool KeyInput ( ITableControl& _rControl, const KeyEvent& rKEvt ) = 0; + virtual bool GetFocus ( ITableControl& _rControl ) = 0; + virtual bool LoseFocus ( ITableControl& _rControl ) = 0; + + virtual ~ITableInputHandler() { } + }; + typedef std::shared_ptr< ITableInputHandler > PTableInputHandler; + + +} // namespace svt::table + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/table/tablemodel.hxx b/toolkit/inc/controls/table/tablemodel.hxx new file mode 100644 index 0000000000..7add49629a --- /dev/null +++ b/toolkit/inc/controls/table/tablemodel.hxx @@ -0,0 +1,454 @@ +/* -*- 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/dllapi.h> +#include <controls/table/tabletypes.hxx> +#include <controls/table/tablerenderer.hxx> +#include <controls/table/tableinputhandler.hxx> + +#include <com/sun/star/style/VerticalAlignment.hpp> +#include <com/sun/star/style/HorizontalAlignment.hpp> + +#include <sal/types.h> + +#include <optional> +#include <memory> +#include <vector> +#include <o3tl/typed_flags_set.hxx> + +namespace svt::table { class ITableDataSort; } + +class Color; + +enum class ColumnAttributeGroup +{ + NONE = 0x00, + /// denotes column attributes related to the width of the column + WIDTH = 0x01, + /// denotes column attributes related to the appearance of the column, i.e. those relevant for rendering + APPEARANCE = 0x02, + /// denotes the entirety of column attributes + ALL = 0x03, +}; +namespace o3tl +{ + template<> struct typed_flags<ColumnAttributeGroup> : is_typed_flags<ColumnAttributeGroup, 0x03> {}; +} + + +namespace svt::table +{ + //= ScrollbarVisibility + enum ScrollbarVisibility + { + /** enumeration value denoting that a scrollbar should never be visible, even + if needed normally + */ + ScrollbarShowNever, + /** enumeration value denoting that a scrollbar should be visible when needed only + */ + ScrollbarShowSmart, + /** enumeration value denoting that a scrollbar should always be visible, even + if not needed normally + */ + ScrollbarShowAlways + }; + + + //= ITableModelListener + + /** declares an interface to be implemented by components interested in + changes in an ->ITableModel + */ + class SAL_NO_VTABLE ITableModelListener : public std::enable_shared_from_this< ITableModelListener > + { + public: + /** notifies the listener that one or more rows have been inserted into + the table + + @param first + the index of the first newly inserted row + @param last + the index of the last newly inserted row. Must not be smaller + than ->first + */ + virtual void rowsInserted( RowPos first, RowPos last ) = 0; + + /** notifies the listener that one or more rows have been removed from + the table + + @param first + the old index of the first removed row. If this is <code>-1</code>, then all + rows have been removed from the model. + @param last + the old index of the last removed row. Must not be smaller + than ->first + */ + virtual void rowsRemoved( RowPos first, RowPos last ) = 0; + + /** notifies the listener that one or more columns have been inserted into + the table + */ + virtual void columnInserted() = 0; + + /** notifies the listener that one or more columns have been removed from + the table + */ + virtual void columnRemoved() = 0; + + /** notifies the listener that all columns have been removed from the model + */ + virtual void allColumnsRemoved() = 0; + + /** notifies the listener that a rectangular cell range in the table + has been updated + + Listeners are required to discard any possibly cached information + they have about the cells in question, in particular any possibly + cached cell values. + */ + virtual void cellsUpdated( RowPos const i_firstRow, RowPos const i_lastRow ) = 0; + + /** notifies the listener that attributes of a given column changed + + @param i_column + the position of the column whose attributes changed + @param i_attributeGroup + a combination of one or more <code>COL_ATTRS_*</code> flags, denoting the attribute group(s) + in which changes occurred. + */ + virtual void columnChanged( ColPos const i_column, ColumnAttributeGroup const i_attributeGroup ) = 0; + + /** notifies the listener that the metrics of the table changed. + + Metrics here include the column header height, the row header width, the row height, and the presence + of both the row and column header. + */ + virtual void tableMetricsChanged() = 0; + + /// deletes the listener instance + virtual ~ITableModelListener(){}; + }; + typedef std::shared_ptr< ITableModelListener > PTableModelListener; + + + //= IColumnModel + + /** interface to be implemented by table column models + */ + class SAL_NO_VTABLE IColumnModel + { + public: + /** returns the name of the column + + Column names should be human-readable, but not necessarily unique + within a given table. + + @see setName + */ + virtual OUString getName() const = 0; + + /** retrieves the help text to be displayed for the column. + */ + virtual OUString getHelpText() const = 0; + + /** determines whether the column can be interactively resized + + @see getMinWidth + @see getMaxWidth + @see getWidth + */ + virtual bool isResizable() const = 0; + + /** denotes the relative flexibility of the column + + This flexibility is taken into account when a table control auto-resizes its columns, because the available + space changed. In this case, the columns grow or shrink according to their flexibility. + + A value of 0 means the column is not auto-resized at all. + */ + virtual sal_Int32 getFlexibility() const = 0; + + /** returns the width of the column, in app-font units + + The returned value must be a positive ->TableMetrics value. + + @see setWidth + @see getMinWidth + @see getMaxWidth + */ + virtual TableMetrics getWidth() const = 0; + + /** sets a new width for the column + + @param _nWidth + the new width, app-font units + + @see getWidth + */ + virtual void setWidth( TableMetrics _nWidth ) = 0; + + /** returns the minimum width of the column, in app-font units, or 0 if the column + does not have a minimal width + + @see setMinWidth + @see getMaxWidth + @see getWidth + */ + virtual TableMetrics getMinWidth() const = 0; + + /** returns the maximum width of the column, in app-font units, or 0 if the column + does not have a minimal width + + @see setMaxWidth + @see getMinWidth + @see getWidth + */ + virtual TableMetrics getMaxWidth() const = 0; + + /** retrieves the horizontal alignment to be used for content in this cell + */ + virtual css::style::HorizontalAlignment getHorizontalAlign() = 0; + + /// deletes the column model instance + virtual ~IColumnModel() { } + }; + typedef std::shared_ptr< IColumnModel > PColumnModel; + + + //= ITableModel + + /** declares the interface to implement by an abstract table model + */ + class SAL_NO_VTABLE TOOLKIT_DLLPUBLIC ITableModel + { + public: + /** returns the number of columns in the table + */ + virtual TableSize getColumnCount() const = 0; + + /** returns the number of rows in the table + */ + virtual TableSize getRowCount() const = 0; + + /** determines whether the table has column headers + + If this method returns <TRUE/>, the renderer returned by + ->getRenderer must be able to render column headers. + + @see IColumnRenderer + */ + virtual bool hasColumnHeaders() const = 0; + + /** determines whether the table has row headers + + If this method returns <TRUE/>, the renderer returned by + ->getRenderer must be able to render row headers. + + @see IColumnRenderer + */ + virtual bool hasRowHeaders() const = 0; + + /** returns a model for a certain column + + @param column + the index of the column in question. Must be greater than or + equal 0, and smaller than the return value of ->getColumnCount() + + @return + the model of the column in question. Must not be <NULL/> + */ + virtual PColumnModel getColumnModel( ColPos column ) = 0; + + /** returns a renderer which is able to paint the table represented + by this table model + + @return the renderer to use. Must not be <NULL/> + */ + virtual PTableRenderer getRenderer() const = 0; + + /** returns the component handling input in a view associated with the model + */ + virtual PTableInputHandler getInputHandler() const = 0; + + /** determines the height of rows in the table. + + @return + the logical height of rows in the table, in app-font units. The height must be + greater 0. + */ + virtual TableMetrics getRowHeight() const = 0; + + /** determines the height of the column header row + + This method is not to be called if ->hasColumnHeaders() + returned <FALSE/>. + + @return + the logical height of the column header row, in app-font units. + Must be greater than 0. + */ + virtual TableMetrics getColumnHeaderHeight() const = 0; + + /** determines the width of the row header column + + This method is not to be called if ->hasRowHeaders() + returned <FALSE/>. + + @return + the logical width of the row header column, in app-font units. + Must be greater than 0. + */ + virtual TableMetrics getRowHeaderWidth() const = 0; + + /** returns the visibility mode of the vertical scrollbar + */ + virtual ScrollbarVisibility getVerticalScrollbarVisibility() const = 0; + + /** returns the visibility mode of the horizontal scrollbar + */ + virtual ScrollbarVisibility getHorizontalScrollbarVisibility() const = 0; + + /** adds a listener to be notified of changes in the table model + */ + virtual void addTableModelListener( const PTableModelListener& i_listener ) = 0; + + /** remove a listener to be notified of changes in the table model + */ + virtual void removeTableModelListener( const PTableModelListener& i_listener ) = 0; + + /** retrieves the content of the given cell + */ + virtual void getCellContent( ColPos const i_col, RowPos const i_row, css::uno::Any& o_cellContent ) = 0; + + /** returns an object which should be displayed as tooltip for the given cell + + At the moment, only string-convertible values are supported here. In the future, one might imagine displaying + scaled-down versions of a graphic in a cell, and a larger version of that very graphic as tooltip. + + If no tooltip object is provided, then the cell content is used, and displayed as tooltip for the cell + if and only if it doesn't fit into the cell's space itself. + + @param i_col + The column index of the cell in question. COL_ROW_HEADERS is a valid argument here. + @param i_row + The row index of the cell in question. + @param o_cellToolTip + takes the tooltip object upon return. + */ + virtual void getCellToolTip( ColPos const i_col, RowPos const i_row, css::uno::Any & o_cellToolTip ) = 0; + + /** retrieves title of a given row + */ + virtual css::uno::Any getRowHeading( RowPos const i_rowPos ) const = 0; + + /** returns the color to be used for rendering the grid lines. + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::std::optional< ::Color > getLineColor() const = 0; + + /** returns the color to be used for rendering the header background. + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::std::optional< ::Color > getHeaderBackgroundColor() const = 0; + + /** returns the color to be used for rendering the header text. + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::std::optional< ::Color > getHeaderTextColor() const = 0; + + /** returns the color to be used for the background of selected cells, when the control has the focus + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::std::optional< ::Color > getActiveSelectionBackColor() const = 0; + + /** returns the color to be used for the background of selected cells, when the control does not have the focus + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::std::optional< ::Color > getInactiveSelectionBackColor() const = 0; + + /** returns the color to be used for the text of selected cells, when the control has the focus + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::std::optional< ::Color > getActiveSelectionTextColor() const = 0; + + /** returns the color to be used for the text of selected cells, when the control does not have the focus + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::std::optional< ::Color > getInactiveSelectionTextColor() const = 0; + + /** returns the color to be used for rendering cell texts. + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::std::optional< ::Color > getTextColor() const = 0; + + /** returns the color to be used for text lines (underline, strikethrough) when rendering cell text. + + If this value is not set, a default color from the style settings will be used. + */ + virtual ::std::optional< ::Color > getTextLineColor() const = 0; + + /** returns the colors to be used for the row backgrounds. + + If this value is not set, every second row will have a background color derived from the style settings's + selection color, the other rows will not have a special background at all. + + If this value is an empty sequence, the rows will not have a special background at all, instead the + normal background of the complete control will be used. + + If value is a non-empty sequence, then rows will have the background colors as specified in the sequence, + in alternating order. + */ + virtual ::std::optional< ::std::vector< ::Color > > + getRowBackgroundColors() const = 0; + + /** determines the vertical alignment of content within a cell + */ + virtual css::style::VerticalAlignment getVerticalAlign() const = 0; + + /** returns an adapter to the sorting functionality of the model + + It is legitimate to return <NULL/> here, in this case, the table model does not support sorting. + */ + virtual ITableDataSort* getSortAdapter() = 0; + + /** returns enabled state. + */ + virtual bool isEnabled() const = 0; + + /// destroys the table model instance + virtual ~ITableModel() { } + }; + typedef std::shared_ptr< ITableModel > PTableModel; + + +} // namespace svt::table + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/table/tablerenderer.hxx b/toolkit/inc/controls/table/tablerenderer.hxx new file mode 100644 index 0000000000..a4d7a48a62 --- /dev/null +++ b/toolkit/inc/controls/table/tablerenderer.hxx @@ -0,0 +1,249 @@ +/* -*- 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/table/tabletypes.hxx> + +#include <rtl/ustring.hxx> + +#include <memory> + +namespace com :: sun :: star :: uno { class Any; } +namespace tools { class Rectangle; } +namespace vcl { class Window; } + +class OutputDevice; +class StyleSettings; +namespace vcl { + typedef OutputDevice RenderContext; +}; + + +namespace svt::table +{ + + + //= ITableRenderer + + /** interface to implement by components rendering a ->TableControl + */ + class SAL_NO_VTABLE ITableRenderer + { + public: + + /** paints a (part of) header area + + There are two header areas in a table control: + <ul><li>The row containing all column headers, i.e. <em>above</em> all rows containing the data</li> + <li>The column containing all row headers. i.e. <em>left of</em> all columns containing the data</li> + </ul> + + A header area is more than the union of the single column/row headers. + + First, there might be less columns than fit into the view - in this case, right + beside the right-most column, there's still room which belongs to the column header + area, but is not occupied by any particular column header.<br/> + An equivalent statement holds for the row header area, if there are fewer rows than + fit into the view. + + Second, if the table control has both a row header and a column header, + the intersection between those both belongs to both the column header area and the + row header area, but not to any particular column or row header. + + There are two flags specifying whether the to-be-painted area is part of the column + and/or row header area. + <ul><li>If both are <TRUE/>, the intersection of both areas is to be painted.</li> + <li>If ->_bIsColHeaderArea is <TRUE/> and ->_bIsRowHeaderArea is <FALSE/>, + then ->_rArea denotes the column header area <em>excluding</em> the + intersection between row and column header area.</li> + <li>Equivalently for ->_bIsColHeaderArea being <FALSE/> and ->_bIsRowHeaderArea + being <TRUE/></li> + </ul> + Note that it's not possible for both ->_bIsColHeaderArea and ->_bIsRowHeaderArea + to be <FALSE/> at the same time. + + @param _rDevice + the device to paint onto + @param _rArea + the area to paint into + @param _bIsColHeaderArea + <TRUE/> if and only if ->_rArea is part of the column header area. + @param _bIsRowHeaderArea + <TRUE/> if and only if ->_rArea is part of the row header area. + @param _rStyle + the style to be used for drawing + */ + virtual void PaintHeaderArea( + vcl::RenderContext& _rDevice, const tools::Rectangle& _rArea, + bool _bIsColHeaderArea, bool _bIsRowHeaderArea, + const StyleSettings& _rStyle ) = 0; + + /** paints the header for a given column + + @param _nCol + the index of the column to paint + @param _rDevice + denotes the device to paint onto + @param _rArea + the are into which the column header should be painted + @param _rStyle + the style to be used for drawing + */ + virtual void PaintColumnHeader( ColPos _nCol, + vcl::RenderContext& _rDevice, const tools::Rectangle& _rArea, + const StyleSettings& _rStyle ) = 0; + + /** prepares a row for painting + + Painting a table means painting rows as necessary, in an increasing + order. The assumption is that retrieving data for two different rows + is (potentially) more expensive than retrieving data for two different + columns. Thus, the renderer will get the chance to "seek" to a certain + row, and then has to render all cells in this row, before another + row is going to be painted. + + @param _nRow + the row which is going to be painted. The renderer should + at least remember this row, since subsequent calls to + ->PaintRowHeader(), ->PaintCell(), and ->FinishRow() will + not pass this parameter again. + + However, the renderer is also allowed to render any + cell-independent content of this row. + + @param i_hasControlFocus + <TRUE/> if and only if the table control currently has the focus + @param _bSelected + <TRUE/> if and only if the row to be prepared is + selected currently. + @param _rDevice + denotes the device to paint onto + @param _rRowArea + the are into which the row should be painted. This excludes + the row header area, if applicable. + @param _rStyle + the style to be used for drawing + */ + virtual void PrepareRow( RowPos _nRow, bool i_hasControlFocus, bool _bSelected, + vcl::RenderContext& _rDevice, const tools::Rectangle& _rRowArea, + const StyleSettings& _rStyle ) = 0; + + /** paints the header of a row + + The row to be painted is denoted by the most recent call to + ->PrepareRow. + + @param _rDevice + denotes the device to paint onto + @param _rArea + the are into which the row header should be painted + @param _rStyle + the style to be used for drawing + */ + virtual void PaintRowHeader( + vcl::RenderContext& _rDevice, tools::Rectangle const & _rArea, + StyleSettings const & _rStyle ) = 0; + + /** paints a certain cell + + The row to be painted is denoted by the most recent call to + ->PrepareRow. + + @param _bSelected + <TRUE/> if and only if the cell to be painted is + selected currently. This is the case if either + the row or the column of the cell is currently selected. + <br/> + Note that this flag is equal to the respective flag in the + previous ->PrepareRow call, it's passed here for convenience + only. + @param i_hasControlFocus + <TRUE/> if and only if the table control currently has the focus + <br/> + Note that this flag is equal to the respective flag in the + previous ->PrepareRow call, it's passed here for convenience + only. + @param _rDevice + denotes the device to paint onto + @param _rArea + the are into which the cell should be painted + @param _rStyle + the style to be used for drawing + */ + virtual void PaintCell( ColPos const i_col, + bool i_hasControlFocus, bool _bSelected, + vcl::RenderContext& _rDevice, const tools::Rectangle& _rArea, + const StyleSettings& _rStyle ) = 0; + + /** draws a cell cursor in the given rectangle + + The cell cursor is used to indicate the active/current cell + of a table control. + */ + virtual void ShowCellCursor( vcl::Window& _rView, const tools::Rectangle& _rCursorRect) = 0; + + /** hides the cell cursor previously drawn into the given rectangle + + The cell cursor is used to indicate the active/current cell + of a table control. + */ + virtual void HideCellCursor( vcl::Window& _rView ) = 0; + + /** checks whether a given cell content fits into a given target area on a given device. + + @param i_targetDevice + denotes the target device for the assumed rendering operation + + @param i_targetArea + denotes the area within the target device for the assumed rendering operation. + + @return + <TRUE/> if and only if the given cell content could be rendered into the given device and the + given area. + */ + virtual bool FitsIntoCell( + css::uno::Any const & i_cellContent, + OutputDevice& i_targetDevice, tools::Rectangle const & i_targetArea + ) const = 0; + + /** attempts to format the content of the given cell as string + + @param i_cellValue + the value for which an attempt for a string conversion should be made + @param o_cellString + the cell content, formatted as string + @return + <TRUE/> if and only if the content could be formatted as string + */ + virtual bool GetFormattedCellString( + css::uno::Any const & i_cellValue, + OUString & o_cellString + ) const = 0; + + /// deletes the renderer instance + virtual ~ITableRenderer() { } + }; + typedef std::shared_ptr< ITableRenderer > PTableRenderer; + + +} // namespace svt::table + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/table/tablesort.hxx b/toolkit/inc/controls/table/tablesort.hxx new file mode 100644 index 0000000000..691beea4ed --- /dev/null +++ b/toolkit/inc/controls/table/tablesort.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 . + */ + +#pragma once + +#include <controls/table/tabletypes.hxx> + +namespace svt::table +{ + + + //= ColumnSortDirection + + enum ColumnSortDirection + { + ColumnSortAscending, + ColumnSortDescending + }; + + + //= ColumnSort + + struct ColumnSort + { + ColPos nColumnPos; + ColumnSortDirection eSortDirection; + + ColumnSort() + :nColumnPos( COL_INVALID ) + ,eSortDirection( ColumnSortAscending ) + { + } + + }; + + + //= ITableDataSort + + /** provides sorting functionality for the data underlying an ITableModel + */ + class SAL_NO_VTABLE ITableDataSort + { + public: + /** sorts the rows in the model by the given column's data, in the given direction. + */ + virtual void sortByColumn( ColPos const i_column, ColumnSortDirection const i_sortDirection ) = 0; + + /** retrieves the current sort order of the data + + If the <code>nColumnIndex</code> member of the returned structure is <code>COL_INVALID</code>, then + the data is currently not sorted. + */ + virtual ColumnSort getCurrentSortOrder() const = 0; + + protected: + ~ITableDataSort() {} + }; + + +} // namespace svt::table + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/table/tabletypes.hxx b/toolkit/inc/controls/table/tabletypes.hxx new file mode 100644 index 0000000000..8fdb18a830 --- /dev/null +++ b/toolkit/inc/controls/table/tabletypes.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 . + */ + +#pragma once + +#include <sal/types.h> + + +namespace svt::table +{ + + /// a value denoting the size of a table + typedef sal_Int32 TableSize; + + /// a value denoting a column position within a table + typedef sal_Int32 ColPos; + /// a value denoting a row position within a table + typedef sal_Int32 RowPos; + + typedef sal_Int32 TableMetrics; + +/// denotes the column containing the row headers +#define COL_ROW_HEADERS (::svt::table::ColPos(-1)) +/// denotes the row containing the column headers +#define ROW_COL_HEADERS (::svt::table::RowPos(-1)) + +/// denotes an invalid column index +#define COL_INVALID (::svt::table::ColPos(-2)) +/// denotes an invalid row index +#define ROW_INVALID (::svt::table::RowPos(-2)) + + +} // namespace svt::table + + +/* 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 0000000000..f9fe2df02d --- /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& 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 0000000000..a1668e2d5d --- /dev/null +++ b/toolkit/inc/controls/tabpagemodel.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 . + */ + +#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& 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; + + // 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 0000000000..c7948de072 --- /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& 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 0000000000..d584516ae3 --- /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 0000000000..ac4e018160 --- /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::XVclWindowPeer >& 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 0000000000..83db8af31b --- /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& 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 0000000000..f90414671d --- /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 0000000000..8894b8dec6 --- /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 0000000000..b3c68cd210 --- /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 <vcl/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 0000000000..7c2b26ee1e --- /dev/null +++ b/toolkit/inc/helper/msgbox.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 . + */ + +#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; + OUString maMessText; + +protected: + void ImplInitButtons(); + void ImplPosControls(); + +public: + MessBox(vcl::Window* pParent, MessBoxStyle nMessBoxStyle, WinBits n, const OUString& rTitle, + 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/property.hxx b/toolkit/inc/helper/property.hxx new file mode 100644 index 0000000000..013f734964 --- /dev/null +++ b/toolkit/inc/helper/property.hxx @@ -0,0 +1,246 @@ +/* -*- 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_HELPER_PROPERTY_HXX +#define INCLUDED_TOOLKIT_HELPER_PROPERTY_HXX + +#include <sal/types.h> +#include <rtl/ustring.hxx> + +namespace com::sun::star::uno { + class Type; + class Any; +} + + +#define BASEPROPERTY_NOTFOUND 0 + +#define BASEPROPERTY_TEXT 1 // OUString +#define BASEPROPERTY_BACKGROUNDCOLOR 2 // sal_Int32 +#define BASEPROPERTY_FILLCOLOR 3 // sal_Int32 +#define BASEPROPERTY_TEXTCOLOR 4 // sal_Int32 +#define BASEPROPERTY_LINECOLOR 5 // sal_Int32 +#define BASEPROPERTY_BORDER 6 // sal_Int16 +#define BASEPROPERTY_ALIGN 7 // sal_Int16 +#define BASEPROPERTY_FONTDESCRIPTOR 8 // css::awt::FontDescriptor +#define BASEPROPERTY_DROPDOWN 9 // sal_Bool +#define BASEPROPERTY_MULTILINE 10 // sal_Bool +#define BASEPROPERTY_STRINGITEMLIST 11 // UStringSequence +#define BASEPROPERTY_HSCROLL 12 // sal_Bool +#define BASEPROPERTY_VSCROLL 13 // sal_Bool +#define BASEPROPERTY_TABSTOP 14 // sal_Bool +#define BASEPROPERTY_STATE 15 // sal_Int16 +#define BASEPROPERTY_FONT_TYPE 16 // OLD: Font_Type +#define BASEPROPERTY_FONT_SIZE 17 // OLD: Font_Size +#define BASEPROPERTY_FONT_ATTRIBS 18 // OLD: Font_Attribs +#define BASEPROPERTY_DEFAULTCONTROL 19 // OUString (ServiceName) +#define BASEPROPERTY_LABEL 20 // OUString +#define BASEPROPERTY_LINECOUNT 21 // sal_Int16 +#define BASEPROPERTY_EXTDATEFORMAT 22 // sal_Int16 +#define BASEPROPERTY_DATESHOWCENTURY 23 // sal_Bool +#define BASEPROPERTY_EXTTIMEFORMAT 24 // sal_Int16 +#define BASEPROPERTY_NUMSHOWTHOUSANDSEP 25 // sal_Bool +#define BASEPROPERTY_CURRENCYSYMBOL 26 // OUString +#define BASEPROPERTY_SPIN 27 // sal_Bool +#define BASEPROPERTY_STRICTFORMAT 28 // sal_Bool +#define BASEPROPERTY_DECIMALACCURACY 29 // sal_Int16 +#define BASEPROPERTY_DATE 30 // css::util::Date +#define BASEPROPERTY_DATEMIN 31 // css::util::Date +#define BASEPROPERTY_DATEMAX 32 // css::util::Date +#define BASEPROPERTY_TIME 33 // css::util::Time +#define BASEPROPERTY_TIMEMIN 34 // css::util::Time +#define BASEPROPERTY_TIMEMAX 35 // css::util::Time +#define BASEPROPERTY_VALUE_INT32 36 // sal_Int32 +#define BASEPROPERTY_VALUEMIN_INT32 37 // sal_Int32 +#define BASEPROPERTY_VALUEMAX_INT32 38 // sal_Int32 +#define BASEPROPERTY_VALUESTEP_INT32 39 // sal_Int32 +#define BASEPROPERTY_EDITMASK 40 // OUString +#define BASEPROPERTY_LITERALMASK 41 // OUString +#define BASEPROPERTY_IMAGEURL 42 // OUString +#define BASEPROPERTY_READONLY 43 // sal_Bool +#define BASEPROPERTY_ENABLED 44 // sal_Bool +#define BASEPROPERTY_PRINTABLE 45 // sal_Bool +#define BASEPROPERTY_ECHOCHAR 46 // sal_Int16 +#define BASEPROPERTY_MAXTEXTLEN 47 // sal_Int16 +#define BASEPROPERTY_HARDLINEBREAKS 48 // sal_Int16 +#define BASEPROPERTY_AUTOCOMPLETE 49 // sal_Bool +#define BASEPROPERTY_MULTISELECTION 50 // sal_Bool +#define BASEPROPERTY_SELECTEDITEMS 51 // INT16Sequence +#define BASEPROPERTY_VALUE_DOUBLE 52 // DOUBLE +#define BASEPROPERTY_VALUEMIN_DOUBLE 53 // DOUBLE +#define BASEPROPERTY_VALUEMAX_DOUBLE 54 // DOUBLE +#define BASEPROPERTY_VALUESTEP_DOUBLE 55 // DOUBLE +#define BASEPROPERTY_TRISTATE 56 // sal_Bool +#define BASEPROPERTY_DEFAULTBUTTON 57 // sal_Bool +#define BASEPROPERTY_HELPURL 58 // OUString +#define BASEPROPERTY_AUTOTOGGLE 59 // sal_Bool +//#define BASEPROPERTY_FOCUSSELECTIONHIDE 60 // sal_Bool +#define BASEPROPERTY_FORMATKEY 61 // sal_Bool +#define BASEPROPERTY_FORMATSSUPPLIER 62 // css::util::XNumberFormatsSupplier +#define BASEPROPERTY_EFFECTIVE_VALUE 63 // Any (double or string) +#define BASEPROPERTY_TREATASNUMBER 64 // sal_Bool +#define BASEPROPERTY_EFFECTIVE_DEFAULT 65 // Any (double or string) +#define BASEPROPERTY_EFFECTIVE_MIN 66 // Double +#define BASEPROPERTY_EFFECTIVE_MAX 67 // Double +#define BASEPROPERTY_CURSYM_POSITION 68 // sal_Bool +#define BASEPROPERTY_TITLE 69 // OUString +#define BASEPROPERTY_MOVEABLE 70 // sal_Bool +#define BASEPROPERTY_CLOSEABLE 71 // sal_Bool +#define BASEPROPERTY_SIZEABLE 72 // sal_Bool +#define BASEPROPERTY_HELPTEXT 73 // OUString +#define BASEPROPERTY_PROGRESSVALUE 74 // sal_Int32 +#define BASEPROPERTY_PROGRESSVALUE_MIN 75 // sal_Int32 +#define BASEPROPERTY_PROGRESSVALUE_MAX 76 // sal_Int32 +#define BASEPROPERTY_SCROLLVALUE 77 // sal_Int32 +#define BASEPROPERTY_SCROLLVALUE_MAX 78 // sal_Int32 +#define BASEPROPERTY_LINEINCREMENT 79 // sal_Int32 +#define BASEPROPERTY_BLOCKINCREMENT 80 // sal_Int32 +#define BASEPROPERTY_VISIBLESIZE 81 // sal_Int32 +#define BASEPROPERTY_ORIENTATION 82 // sal_Int32 +#define BASEPROPERTY_FONTRELIEF 83 // sal_Int16 +#define BASEPROPERTY_FONTEMPHASISMARK 84 // sal_Int16 +#define BASEPROPERTY_TEXTLINECOLOR 85 // sal_Int32 +#define BASEPROPERTY_IMAGEALIGN 86 // sal_Int16 +#define BASEPROPERTY_SCALEIMAGE 87 // sal_Bool +#define BASEPROPERTY_PUSHBUTTONTYPE 88 // sal_Int16 +#define BASEPROPERTY_DISPLAYBACKGROUNDCOLOR 89 // sal_Int32 +#define BASEPROPERTY_AUTOMNEMONICS 90 // sal_Bool +#define BASEPROPERTY_MOUSETRANSPARENT 91 // sal_Bool +#define BASEPROPERTY_ACCESSIBLENAME 92 // OUString +#define BASEPROPERTY_PLUGINPARENT 93 // sal_Int64 +#define BASEPROPERTY_SCROLLVALUE_MIN 94 // sal_Int32 +#define BASEPROPERTY_REPEAT_DELAY 95 // sal_Int32 +#define BASEPROPERTY_SYMBOL_COLOR 96 // sal_Int32 +#define BASEPROPERTY_SPINVALUE 97 // sal_Int32 +#define BASEPROPERTY_SPINVALUE_MIN 98 // sal_Int32 +#define BASEPROPERTY_SPINVALUE_MAX 99 // sal_Int32 +#define BASEPROPERTY_SPININCREMENT 100 // sal_Int32 +#define BASEPROPERTY_REPEAT 101 // sal_Bool +#define BASEPROPERTY_ENFORCE_FORMAT 102 // sal_Bool +#define BASEPROPERTY_LIVE_SCROLL 103 // sal_Bool +#define BASEPROPERTY_LINE_END_FORMAT 104 // sal_Int16 +#define BASEPROPERTY_ACTIVATED 105 // sal Bool +#define BASEPROPERTY_COMPLETE 106 // sal_Bool +#define BASEPROPERTY_CURRENTITEMID 107 // sal_Int16 +#define BASEPROPERTY_TOGGLE 108 // sal_Bool +#define BASEPROPERTY_FOCUSONCLICK 109 // sal_Bool +#define BASEPROPERTY_HIDEINACTIVESELECTION 110 // sal_Bool +#define BASEPROPERTY_VISUALEFFECT 111 // sal_Int16 +#define BASEPROPERTY_BORDERCOLOR 112 // sal_Int32 +#define BASEPROPERTY_IMAGEPOSITION 113 // sal_Int16 +#define BASEPROPERTY_NATIVE_WIDGET_LOOK 114 // sal_Bool +#define BASEPROPERTY_VERTICALALIGN 115 // VerticalAlignment +#define BASEPROPERTY_MOUSE_WHEEL_BEHAVIOUR 116 // sal_Int16 +#define BASEPROPERTY_GRAPHIC 117 // css.graphic.XGraphic +#define BASEPROPERTY_STEP_TIME 118 // sal_Int32 +#define BASEPROPERTY_DECORATION 119 // sal_Bool +#define BASEPROPERTY_PAINTTRANSPARENT 120 // sal_Bool +#define BASEPROPERTY_AUTOHSCROLL 121 // sal_Bool +#define BASEPROPERTY_AUTOVSCROLL 122 // sal_Bool +#define BASEPROPERTY_DESKTOP_AS_PARENT 123 // sal_Bool +#define BASEPROPERTY_TREE_START 124 +#define BASEPROPERTY_TREE_SELECTIONTYPE 124 +#define BASEPROPERTY_TREE_EDITABLE 125 +#define BASEPROPERTY_TREE_DATAMODEL 126 +#define BASEPROPERTY_TREE_ROOTDISPLAYED 127 +#define BASEPROPERTY_TREE_SHOWSHANDLES 128 +#define BASEPROPERTY_TREE_SHOWSROOTHANDLES 129 +#define BASEPROPERTY_ROW_HEIGHT 130 +#define BASEPROPERTY_TREE_INVOKESSTOPNODEEDITING 131 +#define BASEPROPERTY_TREE_END 131 +#define BASEPROPERTY_DIALOGSOURCEURL 132 +#define BASEPROPERTY_NOLABEL 133 // OUString added for issue79712 +#define BASEPROPERTY_URL 134 // OUString +#define BASEPROPERTY_UNIT 135 // ::awt::FieldUnit +#define BASEPROPERTY_CUSTOMUNITTEXT 136 // OUString +#define BASEPROPERTY_IMAGE_SCALE_MODE 137 +#define BASEPROPERTY_WRITING_MODE 138 +#define BASEPROPERTY_CONTEXT_WRITING_MODE 139 +#define BASEPROPERTY_GRID_SHOWROWHEADER 140 +#define BASEPROPERTY_GRID_SHOWCOLUMNHEADER 141 +#define BASEPROPERTY_GRID_DATAMODEL 142 +#define BASEPROPERTY_GRID_COLUMNMODEL 143 +#define BASEPROPERTY_GRID_SELECTIONMODE 144 +#define BASEPROPERTY_ENABLEVISIBLE 145 // sal_Bool +#define BASEPROPERTY_REFERENCE_DEVICE 146 + +#define BASEPROPERTY_HIGHCONTRASTMODE 147 +#define BASEPROPERTY_GRID_HEADER_BACKGROUND 148 +#define BASEPROPERTY_GRID_HEADER_TEXT_COLOR 149 +#define BASEPROPERTY_GRID_ROW_BACKGROUND_COLORS 150 +#define BASEPROPERTY_GRID_LINE_COLOR 151 +#define BASEPROPERTY_MULTISELECTION_SIMPLEMODE 152 +#define BASEPROPERTY_ITEM_SEPARATOR_POS 153 +#define BASEPROPERTY_GROUPNAME 154 // OUString +#define BASEPROPERTY_MULTIPAGEVALUE 155 // sal_Int32 +#define BASEPROPERTY_USERFORMCONTAINEES 156 // css::container::XNameContainer +#define BASEPROPERTY_AUTO_REPEAT 157 +#define BASEPROPERTY_ROW_HEADER_WIDTH 158 +#define BASEPROPERTY_COLUMN_HEADER_HEIGHT 159 +#define BASEPROPERTY_USE_GRID_LINES 160 +#define BASEPROPERTY_SCROLLWIDTH 161 +#define BASEPROPERTY_SCROLLHEIGHT 162 +#define BASEPROPERTY_SCROLLTOP 163 +#define BASEPROPERTY_SCROLLLEFT 164 +#define BASEPROPERTY_ACTIVE_SEL_BACKGROUND_COLOR 165 +#define BASEPROPERTY_INACTIVE_SEL_BACKGROUND_COLOR 166 +#define BASEPROPERTY_ACTIVE_SEL_TEXT_COLOR 167 +#define BASEPROPERTY_INACTIVE_SEL_TEXT_COLOR 168 +#define BASEPROPERTY_HIGHLIGHT_COLOR 169 +#define BASEPROPERTY_HIGHLIGHT_TEXT_COLOR 170 +#define BASEPROPERTY_TYPEDITEMLIST 171 // AnySequence + + +// These properties are not bound, they are always extracted from the BASEPROPERTY_FONTDESCRIPTOR property +#define BASEPROPERTY_FONTDESCRIPTORPART_START 1000 +#define BASEPROPERTY_FONTDESCRIPTORPART_NAME 1000 // OUString, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_STYLENAME 1001 // OUString, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_FAMILY 1002 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_CHARSET 1003 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT 1004 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT 1005 // Float, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_SLANT 1006 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE 1007 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT 1008 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_WIDTH 1009 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_PITCH 1010 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_CHARWIDTH 1011 // Float, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_ORIENTATION 1012 // Float, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_KERNING 1013 // sal_Bool, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_WORDLINEMODE 1014 // sal_Bool, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_TYPE 1015 // sal_Int16, not bound +#define BASEPROPERTY_FONTDESCRIPTORPART_END 1015 + +#define PROPERTY_ALIGN_LEFT 0 +#define PROPERTY_ALIGN_CENTER 1 +#define PROPERTY_ALIGN_RIGHT 2 + + +sal_uInt16 GetPropertyId( const OUString& rPropertyName ); +const css::uno::Type* GetPropertyType( sal_uInt16 nPropertyId ); +const OUString& GetPropertyName( sal_uInt16 nPropertyId ); +sal_Int16 GetPropertyAttribs( sal_uInt16 nPropertyId ); +bool DoesDependOnOthers( sal_uInt16 nPropertyId ); +bool CompareProperties( const css::uno::Any& r1, const css::uno::Any& r2 ); + + +#endif // INCLUDED_TOOLKIT_HELPER_PROPERTY_HXX + + +/* 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 0000000000..b93751c680 --- /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/toolkit/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 0000000000..7fb7ab2a57 --- /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 0000000000..70cc4118c7 --- /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 0000000000..31940ec4c4 --- /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 0000000000..dfed1b1215 --- /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/XVclWindowPeer.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::XVclWindowPeer> GetWindowInterface( vcl::Window* pWindow ) override; + virtual void SetWindowInterface( vcl::Window* pWindow, const css::uno::Reference< css::awt::XVclWindowPeer> & 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: */ |