diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-06-19 15:02:49 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-09-03 18:25:52 +0200 |
commit | 79daf40ec696e0855d4a2894f048e44188cfbbb6 (patch) | |
tree | 96cb3ec48472c06961c1f4392ea6e1b560980555 /svx | |
parent | b094921089beeecb2333075e174c8b1fa6d1b812 (diff) |
weld SvxAreaTabPage
which itself has 5 sub tab pages
Change-Id: If71e91248b5771af4845ad6dba997ac4c7841b5d
Reviewed-on: https://gerrit.libreoffice.org/56112
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/Executable_pixelctl.mk | 40 | ||||
-rw-r--r-- | svx/Module_svx.mk | 2 | ||||
-rw-r--r-- | svx/inc/pch/precompiled_svx.hxx | 39 | ||||
-rw-r--r-- | svx/source/accessibility/svxpixelctlaccessiblecontext.cxx | 552 | ||||
-rw-r--r-- | svx/source/accessibility/svxrectctaccessiblecontext.cxx | 3 | ||||
-rw-r--r-- | svx/source/dialog/dlgctrl.cxx | 82 | ||||
-rw-r--r-- | svx/source/inc/svxpixelctlaccessiblecontext.hxx | 191 | ||||
-rw-r--r-- | svx/source/inc/svxrectctaccessiblecontext.hxx | 19 | ||||
-rw-r--r-- | svx/source/tbxctrls/SvxPresetListBox.cxx | 78 | ||||
-rw-r--r-- | svx/workben/pixelctl.cxx | 127 |
10 files changed, 324 insertions, 809 deletions
diff --git a/svx/Executable_pixelctl.mk b/svx/Executable_pixelctl.mk deleted file mode 100644 index 3140af42ee12..000000000000 --- a/svx/Executable_pixelctl.mk +++ /dev/null @@ -1,40 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# -# 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/. -# - -$(eval $(call gb_Executable_Executable,pixelctl)) - -$(eval $(call gb_Executable_use_api,pixelctl,\ - offapi \ - udkapi \ -)) - -$(eval $(call gb_Executable_use_external,pixelctl,boost_headers)) - -$(eval $(call gb_Executable_set_include,pixelctl,\ - $$(INCLUDE) \ - -I$(SRCDIR)/vcl/inc \ - -I$(SRCDIR)/svx/inc \ -)) - -$(eval $(call gb_Executable_use_libraries,pixelctl,\ - svx \ - tl \ - sal \ - vcl \ - cppu \ - cppuhelper \ - comphelper \ -)) - -$(eval $(call gb_Executable_add_exception_objects,pixelctl,\ - svx/workben/pixelctl \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/svx/Module_svx.mk b/svx/Module_svx.mk index da7c3b2aba8f..48ab6bcb071d 100644 --- a/svx/Module_svx.mk +++ b/svx/Module_svx.mk @@ -44,8 +44,6 @@ $(eval $(call gb_Module_add_targets,svx,\ Executable_gengal \ $(if $(filter-out MACOSX WNT,$(OS)), \ Package_gengal) \ - $(if $(filter-out WNT,$(OS)), \ - Executable_pixelctl) \ )) endif diff --git a/svx/inc/pch/precompiled_svx.hxx b/svx/inc/pch/precompiled_svx.hxx index 30f2dae197dc..ec723151fdcc 100644 --- a/svx/inc/pch/precompiled_svx.hxx +++ b/svx/inc/pch/precompiled_svx.hxx @@ -13,7 +13,7 @@ manual changes will be rewritten by the next run of update_pch.sh (which presumably also fixes all possible problems, so it's usually better to use it). - Generated on 2017-09-20 22:54:10 using: + Generated on 2018-08-29 17:19:11 using: ./bin/update_pch svx svx --cutoff=3 --exclude:system --exclude:module --include:local If after updating build fails, use the following command to locate conflicting headers: @@ -21,6 +21,7 @@ */ #include <algorithm> +#include <array> #include <cassert> #include <climits> #include <config_features.h> @@ -34,7 +35,6 @@ #include <helpids.h> #include <iomanip> #include <limits.h> -#include <list> #include <map> #include <memory> #include <ostream> @@ -63,20 +63,31 @@ #include <rtl/instance.hxx> #include <rtl/math.hxx> #include <rtl/ref.hxx> +#include <rtl/strbuf.h> +#include <rtl/strbuf.hxx> #include <rtl/string.h> +#include <rtl/string.hxx> +#include <rtl/stringutils.hxx> #include <rtl/tencinfo.h> #include <rtl/textenc.h> +#include <rtl/uri.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/ustring.h> #include <rtl/ustring.hxx> #include <rtl/uuid.h> #include <sal/config.h> +#include <sal/log.hxx> #include <sal/macros.h> #include <sal/saldllapi.h> #include <sal/types.h> #include <sal/typesizes.h> +#include <salhelper/simplereferenceobject.hxx> #include <salhelper/singletonref.hxx> +#include <vcl/BitmapFilter.hxx> #include <vcl/EnumContext.hxx> +#include <vcl/GraphicObject.hxx> +#include <vcl/IDialogRenderable.hxx> +#include <vcl/abstdlg.hxx> #include <vcl/bitmap.hxx> #include <vcl/bitmapex.hxx> #include <vcl/builder.hxx> @@ -87,6 +98,8 @@ #include <vcl/commandevent.hxx> #include <vcl/commandinfoprovider.hxx> #include <vcl/ctrl.hxx> +#include <vcl/cursor.hxx> +#include <vcl/customweld.hxx> #include <vcl/dialog.hxx> #include <vcl/dllapi.h> #include <vcl/dockwin.hxx> @@ -100,7 +113,6 @@ #include <vcl/font.hxx> #include <vcl/gradient.hxx> #include <vcl/graph.hxx> -#include <vcl/GraphicObject.hxx> #include <vcl/group.hxx> #include <vcl/idle.hxx> #include <vcl/image.hxx> @@ -112,6 +124,8 @@ #include <vcl/metric.hxx> #include <vcl/outdev.hxx> #include <vcl/region.hxx> +#include <vcl/salbtype.hxx> +#include <vcl/salgtype.hxx> #include <vcl/scopedbitmapaccess.hxx> #include <vcl/scrbar.hxx> #include <vcl/settings.hxx> @@ -126,6 +140,7 @@ #include <vcl/vclenum.hxx> #include <vcl/vclptr.hxx> #include <vcl/virdev.hxx> +#include <vcl/weld.hxx> #include <vcl/window.hxx> #include <vcl/wrkwin.hxx> #include <avmedia/avmediadllapi.h> @@ -140,11 +155,7 @@ #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/polygon/b3dpolypolygon.hxx> -#include <basegfx/range/b2drange.hxx> #include <basegfx/range/b3drange.hxx> -#include <basegfx/range/basicrange.hxx> -#include <basegfx/tuple/b2dtuple.hxx> -#include <basegfx/vector/b2dvector.hxx> #include <basegfx/vector/b2enums.hxx> #include <basegfx/vector/b3dvector.hxx> #include <com/sun/star/accessibility/AccessibleEventId.hpp> @@ -155,6 +166,7 @@ #include <com/sun/star/accessibility/TextSegment.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleEventListener.hpp> #include <com/sun/star/awt/FontDescriptor.hpp> #include <com/sun/star/awt/FontSlant.hpp> #include <com/sun/star/awt/GradientStyle.hpp> @@ -183,7 +195,6 @@ #include <com/sun/star/drawing/DashStyle.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineCap.hpp> -#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> #include <com/sun/star/drawing/XShapeDescriptor.hpp> #include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/embed/VerbDescriptor.hpp> @@ -207,6 +218,7 @@ #include <com/sun/star/i18n/NumberFormatMapper.hpp> #include <com/sun/star/i18n/ParseResult.hpp> #include <com/sun/star/i18n/UnicodeScript.hpp> +#include <com/sun/star/i18n/WordType.hpp> #include <com/sun/star/i18n/XCharacterClassification.hpp> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/lang/DisposedException.hpp> @@ -235,6 +247,7 @@ #include <com/sun/star/text/XTextRange.hpp> #include <com/sun/star/text/XTextRangeCompare.hpp> #include <com/sun/star/text/XTextRangeMover.hpp> +#include <com/sun/star/text/textfield/Type.hpp> #include <com/sun/star/ui/XContextChangeEventListener.hpp> #include <com/sun/star/ui/XSidebar.hpp> #include <com/sun/star/ui/XSidebarPanel.hpp> @@ -249,7 +262,6 @@ #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/uno/Type.hxx> -#include <com/sun/star/uno/XAggregation.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/uno/XWeak.hpp> @@ -271,9 +283,9 @@ #include <comphelper/property.hxx> #include <comphelper/propertycontainer.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/propertysetinfo.hxx> #include <comphelper/sequence.hxx> #include <comphelper/servicehelper.hxx> -#include <comphelper/string.hxx> #include <comphelper/types.hxx> #include <comphelper/uno3.hxx> #include <comphelper/weak.hxx> @@ -301,8 +313,11 @@ #include <editeng/editdata.hxx> #include <editeng/editeng.hxx> #include <editeng/editengdllapi.h> +#include <editeng/editstat.hxx> +#include <editeng/editview.hxx> #include <editeng/eeitem.hxx> #include <editeng/fhgtitem.hxx> +#include <editeng/flditem.hxx> #include <editeng/itemtype.hxx> #include <editeng/kernitem.hxx> #include <editeng/lrspitem.hxx> @@ -325,6 +340,7 @@ #include <i18nlangtag/mslangid.hxx> #include <o3tl/cow_wrapper.hxx> #include <o3tl/make_unique.hxx> +#include <o3tl/safeint.hxx> #include <o3tl/strong_int.hxx> #include <o3tl/typed_flags_set.hxx> #include <sfx2//dllapi.h> @@ -346,6 +362,7 @@ #include <sfx2/sfxuno.hxx> #include <sfx2/shell.hxx> #include <sfx2/sidebar/ControlFactory.hxx> +#include <sfx2/sidebar/DeckDescriptor.hxx> #include <sfx2/sidebar/IContextChangeReceiver.hxx> #include <sfx2/sidebar/ResourceManager.hxx> #include <sfx2/sidebar/SidebarPanelBase.hxx> @@ -375,6 +392,7 @@ #include <svl/style.hxx> #include <svl/stylesheetuser.hxx> #include <svl/svldllapi.h> +#include <svl/typedwhich.hxx> #include <svl/urihelper.hxx> #include <svl/zforlist.hxx> #include <svtools/colorcfg.hxx> @@ -428,6 +446,7 @@ #include <unotools/viewoptions.hxx> #include <svx/AccessibleShape.hxx> #include <svx/AccessibleShapeInfo.hxx> +#include <svx/ClassificationField.hxx> #include <svx/DescriptionGenerator.hxx> #include <svx/IAccessibleViewForwarder.hxx> #include <svx/ShapeTypeHandler.hxx> diff --git a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx index 8908e36d3bde..f5821243a743 100644 --- a/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx +++ b/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx @@ -48,21 +48,19 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::accessibility; -SvxPixelCtlAccessible::SvxPixelCtlAccessible( SvxPixelCtl& rControl) : - SvxPixelCtlAccessible_BASE(m_aMutex), - mrPixelCtl(rControl), - mnClientId(0) +SvxPixelCtlAccessible::SvxPixelCtlAccessible(SvxPixelCtl* pControl) + : mpPixelCtl(pControl) { } SvxPixelCtlAccessible::~SvxPixelCtlAccessible() { - if( IsAlive() ) - { - osl_atomic_increment( &m_refCount ); - dispose(); // set mpRepr = NULL & release all children - } + ensureDisposed(); } + +IMPLEMENT_FORWARD_XINTERFACE2( SvxPixelCtlAccessible, OAccessibleSelectionHelper, OAccessibleHelper_Base ) +IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxPixelCtlAccessible, OAccessibleSelectionHelper, OAccessibleHelper_Base ) + uno::Reference< XAccessibleContext > SvxPixelCtlAccessible::getAccessibleContext( ) { return this; @@ -78,31 +76,18 @@ uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleChild( sal_Int ::osl::MutexGuard aGuard( m_aMutex ); if ( i < 0 || i >= getAccessibleChildCount()) throw lang::IndexOutOfBoundsException(); - return CreateChild(i, mrPixelCtl.IndexToPoint(i)); + Reference< XAccessible > xChild; + if (mpPixelCtl) + xChild = CreateChild(i, mpPixelCtl->IndexToPoint(i)); + return xChild; } uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleParent( ) { ::osl::MutexGuard aGuard( m_aMutex ); - vcl::Window *pTabPage = getNonLayoutParent(&mrPixelCtl); - if (!pTabPage || WindowType::TABPAGE != pTabPage->GetType()) - return uno::Reference< XAccessible >(); - else - return pTabPage->GetAccessible(); -} - -sal_Int32 SvxPixelCtlAccessible::getAccessibleIndexInParent( ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - sal_uInt16 nIdx = 0; - vcl::Window *pTabPage = getNonLayoutParent(&mrPixelCtl); - if (!pTabPage || WindowType::TABPAGE != pTabPage->GetType()) - return -1; - sal_uInt16 nChildren = pTabPage->GetChildCount(); - for(nIdx = 0; nIdx < nChildren; nIdx++) - if(pTabPage->GetChild( nIdx ) == &mrPixelCtl) - break; - return nIdx; + if (mpPixelCtl) + return mpPixelCtl->getAccessibleParent(); + return uno::Reference<css::accessibility::XAccessible>(); } sal_Int16 SvxPixelCtlAccessible::getAccessibleRole( ) @@ -114,282 +99,146 @@ OUString SvxPixelCtlAccessible::getAccessibleDescription( ) { ::osl::MutexGuard aGuard( m_aMutex ); - return mrPixelCtl.GetAccessibleDescription(); + return mpPixelCtl ? mpPixelCtl->GetAccessibleDescription() : ""; } OUString SvxPixelCtlAccessible::getAccessibleName( ) { - ::osl::MutexGuard aGuard( m_aMutex ); - return mrPixelCtl.GetAccessibleName(); + return mpPixelCtl ? mpPixelCtl->GetAccessibleName() : ""; } -uno::Reference< XAccessibleRelationSet > SvxPixelCtlAccessible::getAccessibleRelationSet( ) +Reference< XAccessibleRelationSet > SAL_CALL SvxPixelCtlAccessible::getAccessibleRelationSet() { - ::osl::MutexGuard aGuard( m_aMutex ); - utl::AccessibleRelationSetHelper* rRelationSet = new utl::AccessibleRelationSetHelper; - uno::Reference< css::accessibility::XAccessibleRelationSet > rSet = rRelationSet; - vcl::Window *pLabeledBy = mrPixelCtl.GetAccessibleRelationLabeledBy(); - if ( pLabeledBy && pLabeledBy != &mrPixelCtl ) - { - uno::Sequence< uno::Reference< uno::XInterface > > aSequence { pLabeledBy->GetAccessible() }; - rRelationSet->AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::LABELED_BY, aSequence ) ); - } - - vcl::Window* pMemberOf = mrPixelCtl.GetAccessibleRelationMemberOf(); - if ( pMemberOf && pMemberOf != &mrPixelCtl ) - { - uno::Sequence< uno::Reference< uno::XInterface > > aSequence { pMemberOf->GetAccessible() }; - rRelationSet->AddRelation( css::accessibility::AccessibleRelation( css::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) ); - } - return rSet; + if (mpPixelCtl) + return mpPixelCtl->get_accessible_relation_set(); + return uno::Reference<css::accessibility::XAccessibleRelationSet>(); } - uno::Reference< XAccessibleStateSet > SvxPixelCtlAccessible::getAccessibleStateSet( ) { ::osl::MutexGuard aGuard( m_aMutex ); utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; uno::Reference< XAccessibleStateSet > xRet = pStateSetHelper; - const sal_Int16 aStandardStates[] = - { - AccessibleStateType::FOCUSABLE, - AccessibleStateType::SELECTABLE, - AccessibleStateType::SHOWING, - AccessibleStateType::VISIBLE, - AccessibleStateType::OPAQUE, - 0 - }; - - sal_Int16 nState = 0; - while(aStandardStates[nState]) + if (mpPixelCtl) { - pStateSetHelper->AddState(aStandardStates[nState++]); + const sal_Int16 aStandardStates[] = + { + AccessibleStateType::FOCUSABLE, + AccessibleStateType::SELECTABLE, + AccessibleStateType::SHOWING, + AccessibleStateType::VISIBLE, + AccessibleStateType::OPAQUE, + 0 + }; + + sal_Int16 nState = 0; + while (aStandardStates[nState]) + { + pStateSetHelper->AddState(aStandardStates[nState++]); + } + if (mpPixelCtl->IsEnabled()) + pStateSetHelper->AddState(AccessibleStateType::ENABLED); + if (mpPixelCtl->HasFocus()) + pStateSetHelper->AddState(AccessibleStateType::FOCUSED); + pStateSetHelper->AddState(AccessibleStateType::MANAGES_DESCENDANTS); } - if(mrPixelCtl.IsEnabled()) - pStateSetHelper->AddState(AccessibleStateType::ENABLED); - if(mrPixelCtl.HasFocus()) - pStateSetHelper->AddState(AccessibleStateType::FOCUSED); - pStateSetHelper->AddState(AccessibleStateType::MANAGES_DESCENDANTS); return xRet; } - -css::lang::Locale SvxPixelCtlAccessible::getLocale( ) +uno::Reference<XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleAtPoint ( + const awt::Point& rPoint) { ::osl::MutexGuard aGuard( m_aMutex ); - if( getAccessibleParent().is() ) + + Reference< XAccessible > xRet; + + if (mpPixelCtl) { - uno::Reference< XAccessibleContext > xParentContext( getAccessibleParent()->getAccessibleContext() ); - if( xParentContext.is() ) - return xParentContext->getLocale(); + long nIndex = mpPixelCtl->PointToIndex(Point(rPoint.X, rPoint.Y)); + xRet = CreateChild(nIndex, mpPixelCtl->IndexToPoint(nIndex)); } - // No locale and no parent. Therefore throw exception to indicate this - // cluelessness. - throw IllegalAccessibleComponentStateException(); + return xRet; } - -sal_Bool SvxPixelCtlAccessible::containsPoint( const awt::Point& aPt ) +awt::Rectangle SvxPixelCtlAccessible::implGetBounds() { ::osl::MutexGuard aGuard( m_aMutex ); - Point aPoint(aPt.X, aPt.Y); - return (aPoint.X() >= 0) - && (aPoint.X() < mrPixelCtl.GetSizePixel().getWidth()) - && (aPoint.Y() >= 0) - && (aPoint.Y() < mrPixelCtl.GetSizePixel().getHeight()); -} -uno::Reference<XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleAtPoint ( - const awt::Point& aPoint) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - if( !IsAlive() ) - throw lang::DisposedException(); - Point childPoint; - childPoint.setX( aPoint.X ); - childPoint.setY( aPoint.Y ); + awt::Rectangle aRet; - Point pt= mrPixelCtl.PixelToLogic(childPoint); - long nIndex = mrPixelCtl.PointToIndex(pt); - return CreateChild(nIndex, mrPixelCtl.IndexToPoint(nIndex)); -} + if (mpPixelCtl) + { + const Point aOutPos; + Size aOutSize(mpPixelCtl->GetOutputSizePixel()); -awt::Rectangle SvxPixelCtlAccessible::getBounds( ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - awt::Rectangle aRet; - Size aSz = mrPixelCtl.GetSizePixel(); - Point aPos = mrPixelCtl.GetPosPixel(); - aRet.X = aPos.X(); - aRet.Y = aPos.Y(); - aRet.Width = aSz.Width(); - aRet.Height = aSz.Height(); - return aRet; -} + aRet.X = aOutPos.X(); + aRet.Y = aOutPos.Y(); + aRet.Width = aOutSize.Width(); + aRet.Height = aOutSize.Height(); + } -awt::Point SvxPixelCtlAccessible::getLocation( ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - Point aPos; - aPos = mrPixelCtl.GetPosPixel(); - awt::Point aRet(aPos.X(), aPos.Y()); return aRet; } -awt::Point SvxPixelCtlAccessible::getLocationOnScreen( ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - tools::Rectangle rect = mrPixelCtl.GetWindowExtentsRelative(nullptr); - return awt::Point(rect.Left(),rect.Top() ); -} - -awt::Size SvxPixelCtlAccessible::getSize( ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - Size aSz = mrPixelCtl.GetSizePixel(); - return awt::Size(aSz.Width(),aSz.Height()); -} void SvxPixelCtlAccessible::grabFocus( ) { ::osl::MutexGuard aGuard( m_aMutex ); - mrPixelCtl.GrabFocus(); + if (mpPixelCtl) + mpPixelCtl->GrabFocus(); } sal_Int32 SvxPixelCtlAccessible::getForeground( ) { ::osl::MutexGuard aGuard( m_aMutex ); - return sal_Int32(mrPixelCtl.GetControlForeground()); + + //see SvxPixelCtl::Paint + const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); + return sal_Int32(rStyles.GetLabelTextColor()); } sal_Int32 SvxPixelCtlAccessible::getBackground( ) { ::osl::MutexGuard aGuard( m_aMutex ); - return sal_Int32(mrPixelCtl.GetControlBackground()); -} - -OUString SvxPixelCtlAccessible::getImplementationName( ) -{ - return OUString("SvxPixelCtlAccessible"); -} -sal_Bool SvxPixelCtlAccessible::supportsService( const OUString& rServiceName ) -{ - return cppu::supportsService( this, rServiceName ); -} - -uno::Sequence< OUString > SvxPixelCtlAccessible::getSupportedServiceNames( ) -{ - return uno::Sequence< OUString >{ - "Accessible", - "AccessibleContext", - "AccessibleComponent" - }; + //see SvxPixelCtl::Paint + const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings(); + return sal_Int32(rStyles.GetDialogColor()); } - -// XAccessibleSelection - -void SAL_CALL SvxPixelCtlAccessible::selectAccessibleChild( sal_Int32 nChildIndex ) +void SvxPixelCtlAccessible::implSelect(sal_Int32 nChildIndex, bool bSelect) { ::osl::MutexGuard aGuard( m_aMutex ); if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount()) throw lang::IndexOutOfBoundsException(); - long nIndex = mrPixelCtl.ShowPosition(mrPixelCtl.IndexToPoint(nChildIndex)); - NotifyChild(nIndex,true,false); -} - -sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleChildSelected( sal_Int32 nChildIndex ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - return mrPixelCtl.GetFocusPosIndex() == nChildIndex; -} - -void SAL_CALL SvxPixelCtlAccessible::clearAccessibleSelection( ) -{ -} + if (!mpPixelCtl) + return; -void SAL_CALL SvxPixelCtlAccessible::selectAllAccessibleChildren( ) -{ + long nIndex = mpPixelCtl->ShowPosition(mpPixelCtl->IndexToPoint(nChildIndex)); + NotifyChild(nIndex, bSelect, false); } -sal_Int32 SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleChildCount( ) -{ - return 1; -} - -uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) +bool SvxPixelCtlAccessible::implIsSelected(sal_Int32 nChildIndex) { ::osl::MutexGuard aGuard( m_aMutex ); - if ( nSelectedChildIndex >= 1) - throw lang::IndexOutOfBoundsException(); - - uno::Reference< XAccessible > xChild; - if(m_xCurChild.is()) - { - xChild = m_xCurChild; - } - return xChild; -} - -void SAL_CALL SvxPixelCtlAccessible::deselectAccessibleChild( sal_Int32 ) -{ -} - -//XAccessibleEventBroadcaster -void SAL_CALL SvxPixelCtlAccessible::addAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) -{ - if (xListener.is()) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if (!mnClientId) - mnClientId = comphelper::AccessibleEventNotifier::registerClient( ); - comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener ); - } -} - -void SAL_CALL SvxPixelCtlAccessible::removeAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) -{ - if (xListener.is()) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if (!mnClientId) - return; - sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ); - if ( !nListenerCount ) - { - comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); - mnClientId = 0; - } - } -} + if (!mpPixelCtl) + return false; -//Solution:Add the event handling method -void SvxPixelCtlAccessible::FireAccessibleEvent (short nEventId, const css::uno::Any& rOld, const css::uno::Any& rNew) -{ - const uno::Reference< XInterface > xSource( *this ); - if (mnClientId) - comphelper::AccessibleEventNotifier::addEvent( mnClientId, AccessibleEventObject( xSource, nEventId, rNew,rOld ) ); + return mpPixelCtl->GetFocusPosIndex() == nChildIndex; } void SAL_CALL SvxPixelCtlAccessible::disposing() { - if( !rBHelper.bDisposed ) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( mnClientId ) - { - comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this ); - mnClientId = 0; - } - } + ::osl::MutexGuard aGuard(m_aMutex); + OAccessibleSelectionHelper::disposing(); + m_xCurChild.clear(); + mpPixelCtl = nullptr; } void SvxPixelCtlAccessible::NotifyChild(long nIndex,bool bSelect ,bool bCheck) @@ -410,21 +259,19 @@ void SvxPixelCtlAccessible::NotifyChild(long nIndex,bool bSelect ,bool bCheck) } if (bCheck) { - pChild->ChangePixelColorOrBG( mrPixelCtl.GetBitmapPixel(sal_uInt16(nIndex)) != 0); + pChild->ChangePixelColorOrBG(mpPixelCtl->GetBitmapPixel(sal_uInt16(nIndex)) != 0); pChild->CheckChild(); } return ; } } - uno::Reference <XAccessible> xNewChild =CreateChild(nIndex, mrPixelCtl.IndexToPoint(nIndex)); + uno::Reference <XAccessible> xNewChild =CreateChild(nIndex, mpPixelCtl->IndexToPoint(nIndex)); SvxPixelCtlAccessibleChild *pNewChild= static_cast<SvxPixelCtlAccessibleChild*>(xNewChild.get()); DBG_ASSERT(pNewChild,"Child Must be Valid"); Any aNewValue,aOldValue; aNewValue<<= xNewChild; - FireAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, - aOldValue, - aNewValue ); + NotifyAccessibleEvent(AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue); if (bSelect) { @@ -439,16 +286,14 @@ void SvxPixelCtlAccessible::NotifyChild(long nIndex,bool bSelect ,bool bCheck) pNewChild->CheckChild(); } m_xCurChild= xNewChild; - - } uno::Reference<XAccessible> SvxPixelCtlAccessible::CreateChild (long nIndex,Point mPoint) { - bool bPixelColorOrBG = mrPixelCtl.GetBitmapPixel(sal_uInt16(nIndex)) != 0; - Size size(mrPixelCtl.GetWidth() / SvxPixelCtl::GetLineCount(), mrPixelCtl.GetHeight() / SvxPixelCtl::GetLineCount()); + bool bPixelColorOrBG = mpPixelCtl->GetBitmapPixel(sal_uInt16(nIndex)) != 0; + Size size(mpPixelCtl->GetWidth() / SvxPixelCtl::GetLineCount(), mpPixelCtl->GetHeight() / SvxPixelCtl::GetLineCount()); uno::Reference<XAccessible> xChild; - xChild = new SvxPixelCtlAccessibleChild(mrPixelCtl, + xChild = new SvxPixelCtlAccessibleChild(*mpPixelCtl, bPixelColorOrBG, tools::Rectangle(mPoint,size), this, @@ -457,7 +302,6 @@ uno::Reference<XAccessible> SvxPixelCtlAccessible::CreateChild (long nIndex,Poin return xChild; } - void SvxPixelCtlAccessible::LoseFocus() { m_xCurChild.clear(); @@ -470,15 +314,11 @@ void SvxPixelCtlAccessibleChild::CheckChild() if (m_bPixelColorOrBG)//Current Child State { - FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, - Any(), - aChecked); + NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(), aChecked); } else { - FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, - aChecked, - Any() ); + NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aChecked, Any()); } } @@ -489,118 +329,58 @@ void SvxPixelCtlAccessibleChild::SelectChild( bool bSelect) if (bSelect) { - FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, - Any(), - aSelected); + NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, Any(), aSelected); } else { - FireAccessibleEvent( AccessibleEventId::STATE_CHANGED, - aSelected, - Any()); + NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aSelected, Any()); } } -void SvxPixelCtlAccessibleChild::FireAccessibleEvent ( - short nEventId, - const css::uno::Any& rOld, - const css::uno::Any& rNew) -{ - const uno::Reference< XInterface > xSource( *this ); - if (mnClientId) - comphelper::AccessibleEventNotifier::addEvent( mnClientId, AccessibleEventObject( xSource, nEventId, rNew,rOld ) ); -} -SvxPixelCtlAccessibleChild::SvxPixelCtlAccessibleChild( - SvxPixelCtl& rWindow, - bool bPixelColorOrBG, - const tools::Rectangle& rBoundingBox, - const uno::Reference<XAccessible>& rxParent, - long nIndexInParent ) : - SvxPixelCtlAccessibleChild_BASE( m_aMutex ), - mrParentWindow( rWindow ), - mxParent(rxParent), - m_bPixelColorOrBG(bPixelColorOrBG), - maBoundingBox( rBoundingBox ), - mnIndexInParent( nIndexInParent ), - mnClientId( 0 ) +SvxPixelCtlAccessibleChild::SvxPixelCtlAccessibleChild( SvxPixelCtl& rWindow, bool bPixelColorOrBG, + const tools::Rectangle& rBoundingBox, const rtl::Reference<SvxPixelCtlAccessible>& rxParent, + long nIndexInParent) + : mrParentWindow( rWindow ) + , mxParent(rxParent) + , m_bPixelColorOrBG(bPixelColorOrBG) + , maBoundingBox( rBoundingBox ) + , mnIndexInParent( nIndexInParent ) { } - SvxPixelCtlAccessibleChild::~SvxPixelCtlAccessibleChild() { - if( IsAlive() ) - { - osl_atomic_increment( &m_refCount ); - dispose(); // set mpRepr = NULL & release all children - } + ensureDisposed(); } +IMPLEMENT_FORWARD_XINTERFACE2( SvxPixelCtlAccessibleChild, OAccessibleComponentHelper, OAccessibleHelper_Base ) +IMPLEMENT_FORWARD_XTYPEPROVIDER2( SvxPixelCtlAccessibleChild, OAccessibleComponentHelper, OAccessibleHelper_Base ) + // XAccessible uno::Reference< XAccessibleContext> SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleContext() { return this; } -// XAccessibleComponent -sal_Bool SAL_CALL SvxPixelCtlAccessibleChild::containsPoint( const awt::Point& rPoint ) -{ - // no guard -> done in getBounds() -// return GetBoundingBox().IsInside( VCLPoint( rPoint ) ); - return tools::Rectangle( Point( 0, 0 ), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) ); -} - uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleAtPoint( const awt::Point& ) { return uno::Reference< XAccessible >(); } -awt::Rectangle SAL_CALL SvxPixelCtlAccessibleChild::getBounds() -{ - // no guard -> done in getBoundingBox() - //Modified by lq, 09/26 - //return AWTRectangle( GetBoundingBox() ); - awt::Rectangle rect = AWTRectangle( GetBoundingBox() ); - rect.X = rect.X + mrParentWindow.GetClientWindowExtentsRelative().Left()-mrParentWindow.GetWindowExtentsRelative(nullptr).Left(); - rect.Y = rect.Y + mrParentWindow.GetClientWindowExtentsRelative().Top()-mrParentWindow.GetWindowExtentsRelative(nullptr).Top(); - return rect; - // End -} - -awt::Point SAL_CALL SvxPixelCtlAccessibleChild::getLocation() -{ - // no guard -> done in getBoundingBox() - return AWTPoint( GetBoundingBox().TopLeft() ); -} - -awt::Point SAL_CALL SvxPixelCtlAccessibleChild::getLocationOnScreen() -{ - // no guard -> done in getBoundingBoxOnScreen() - return AWTPoint( GetBoundingBoxOnScreen().TopLeft() ); -} - -awt::Size SAL_CALL SvxPixelCtlAccessibleChild::getSize() -{ - // no guard -> done in getBoundingBox() - return AWTSize( GetBoundingBox().GetSize() ); -} - void SAL_CALL SvxPixelCtlAccessibleChild::grabFocus() { } -sal_Int32 SvxPixelCtlAccessibleChild::getForeground( ) +sal_Int32 SvxPixelCtlAccessibleChild::getForeground() { ::osl::MutexGuard aGuard( m_aMutex ); - ThrowExceptionIfNotAlive(); - return sal_Int32(mrParentWindow.GetControlForeground()); + return mxParent.is() ? mxParent->getForeground() : -1; } -sal_Int32 SvxPixelCtlAccessibleChild::getBackground( ) + +sal_Int32 SvxPixelCtlAccessibleChild::getBackground() { ::osl::MutexGuard aGuard( m_aMutex ); - - ThrowExceptionIfNotAlive(); - return sal_Int32(mrParentWindow.GetControlBackground()); + return mxParent.is() ? mxParent->getBackground() : -1; } // XAccessibleContext @@ -616,12 +396,7 @@ uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessible uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleParent() { - return mxParent; -} - -sal_Int32 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleIndexInParent() -{ - return mnIndexInParent; + return mxParent.get(); } sal_Int16 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleRole() @@ -655,7 +430,7 @@ uno::Reference< XAccessibleStateSet > SAL_CALL SvxPixelCtlAccessibleChild::getAc ::osl::MutexGuard aGuard( m_aMutex ); utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper; - if( IsAlive() ) + if (!rBHelper.bDisposed) { pStateSetHelper->AddState( AccessibleStateType::TRANSIENT ); @@ -681,111 +456,16 @@ uno::Reference< XAccessibleStateSet > SAL_CALL SvxPixelCtlAccessibleChild::getAc return pStateSetHelper; } -lang::Locale SAL_CALL SvxPixelCtlAccessibleChild::getLocale() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - if( mxParent.is() ) - { - uno::Reference< XAccessibleContext > xParentContext( mxParent->getAccessibleContext() ); - if( xParentContext.is() ) - return xParentContext->getLocale(); - } - - // No locale and no parent. Therefore throw exception to indicate this - // cluelessness. - throw IllegalAccessibleComponentStateException(); -} - -void SAL_CALL SvxPixelCtlAccessibleChild::addAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) -{ - if (xListener.is()) - { - ::osl::MutexGuard aGuard( m_aMutex ); - if (!mnClientId) - mnClientId = comphelper::AccessibleEventNotifier::registerClient( ); - comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener ); - } -} - -void SAL_CALL SvxPixelCtlAccessibleChild::removeAccessibleEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) -{ - if (xListener.is()) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener ); - if ( !nListenerCount ) - { - // no listeners anymore - // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), - // and at least to us not firing any events anymore, in case somebody calls - // NotifyAccessibleEvent, again - comphelper::AccessibleEventNotifier::revokeClient( mnClientId ); - mnClientId = 0; - } - } -} - -// XServiceInfo -OUString SAL_CALL SvxPixelCtlAccessibleChild::getImplementationName() -{ - return OUString( "SvxPixelCtlAccessibleChild" ); -} - -sal_Bool SAL_CALL SvxPixelCtlAccessibleChild::supportsService( const OUString& rServiceName ) -{ - return cppu::supportsService( this, rServiceName ); -} - -Sequence< OUString > SAL_CALL SvxPixelCtlAccessibleChild::getSupportedServiceNames() -{ - uno::Sequence< OUString > aRet(3); - OUString* pArray = aRet.getArray(); - pArray[0] = "Accessible"; - pArray[1] = "AccessibleContext"; - pArray[2] = "AccessibleComponent"; - return aRet; -} - void SAL_CALL SvxPixelCtlAccessibleChild::disposing() { - if( !rBHelper.bDisposed ) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // Send a disposing to all listeners. - if ( mnClientId ) - { - comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this ); - mnClientId = 0; - } - - mxParent.clear(); - } -} - -void SvxPixelCtlAccessibleChild::ThrowExceptionIfNotAlive() -{ - if( rBHelper.bDisposed || rBHelper.bInDispose ) - throw lang::DisposedException(); + OAccessibleComponentHelper::disposing(); + mxParent.clear(); } -tools::Rectangle SvxPixelCtlAccessibleChild::GetBoundingBoxOnScreen() -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - // no ThrowExceptionIfNotAlive() because its done in GetBoundingBox() - tools::Rectangle aRect( GetBoundingBox() ); - - return tools::Rectangle( mrParentWindow.OutputToAbsoluteScreenPixel( aRect.TopLeft() ), aRect.GetSize() ); -} - -tools::Rectangle const & SvxPixelCtlAccessibleChild::GetBoundingBox() +awt::Rectangle SvxPixelCtlAccessibleChild::implGetBounds() { // no guard necessary, because no one changes maBoundingBox after creating it - ThrowExceptionIfNotAlive(); - - return maBoundingBox; + return AWTRectangle(maBoundingBox); } OUString SvxPixelCtlAccessibleChild::GetName() diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx index d18fff3ad720..a92bdacbc632 100644 --- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx +++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx @@ -400,6 +400,7 @@ sal_Int32 SvxRectCtlAccessibleContext::getForeground( ) return sal_Int32(mpRepr->GetControlForeground()); } + sal_Int32 SvxRectCtlAccessibleContext::getBackground( ) { ::SolarMutexGuard aSolarGuard; @@ -705,6 +706,7 @@ Reference< XAccessible > SAL_CALL RectCtlAccessibleContext::getAccessibleChild( Reference< XAccessible > SAL_CALL RectCtlAccessibleContext::getAccessibleParent() { + ::osl::MutexGuard aGuard( m_aMutex ); if (mpRepr) return mpRepr->getAccessibleParent(); return uno::Reference<css::accessibility::XAccessible>(); @@ -732,6 +734,7 @@ OUString SAL_CALL RectCtlAccessibleContext::getAccessibleName() */ Reference< XAccessibleRelationSet > SAL_CALL RectCtlAccessibleContext::getAccessibleRelationSet() { + ::osl::MutexGuard aGuard( m_aMutex ); if (mpRepr) return mpRepr->get_accessible_relation_set(); return uno::Reference<css::accessibility::XAccessibleRelationSet>(); diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index aee18ab17494..626debc835a8 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -103,14 +103,12 @@ void SvxRectCtl::dispose() Control::dispose(); } - void SvxRectCtl::Resize() { Resize_Impl(); Control::Resize(); } - void SvxRectCtl::Resize_Impl() { aSize = GetOutputSize(); @@ -612,7 +610,7 @@ Reference< XAccessible > SvxRectCtl::CreateAccessible() RectPoint SvxRectCtl::GetApproxRPFromPixPt( const css::awt::Point& r ) const { - return GetRPFromPoint( GetApproxLogPtFromPixPt( Point( r.X, r.Y ) ) ); + return GetRPFromPoint(GetApproxLogPtFromPixPt(Point(r.X, r.Y ))); } BitmapEx& RectCtl::GetRectBitmap() @@ -1135,14 +1133,11 @@ void RectCtl::DoCompletelyDisable(bool bNew) css::uno::Reference< css::accessibility::XAccessible > SvxPixelCtl::CreateAccessible() { - if(!m_xAccess.is()) - { - m_xAccess = new SvxPixelCtlAccessible(*this); - } + if (!m_xAccess.is()) + m_xAccess = new SvxPixelCtlAccessible(this); return m_xAccess.get(); } -//Logic Pixel long SvxPixelCtl::PointToIndex(const Point &aPt) const { long nX = aPt.X() * nLines / aRectSize.Width(); @@ -1170,56 +1165,48 @@ long SvxPixelCtl::GetFocusPosIndex() const return aFocusPosition.getX() + aFocusPosition.getY() * nLines ; } -long SvxPixelCtl::ShowPosition( const Point &pt) +long SvxPixelCtl::ShowPosition( const Point &rPt) { - Point aPt = PixelToLogic( pt ); - - sal_Int32 nX = aPt.X() * nLines / aRectSize.Width(); - sal_Int32 nY = aPt.Y() * nLines / aRectSize.Height(); + sal_Int32 nX = rPt.X() * nLines / aRectSize.Width(); + sal_Int32 nY = rPt.Y() * nLines / aRectSize.Height(); ChangePixel( nX + nY * nLines ); //Solution:Set new focus position and repaint - //Invalidate( Rectangle( aPtTl, aPtBr ) ); aFocusPosition.setX(nX); aFocusPosition.setY(nY); Invalidate(tools::Rectangle(Point(0,0),aRectSize)); - vcl::Window *pTabPage = getNonLayoutParent(this); - if (pTabPage && WindowType::TABPAGE == pTabPage->GetType()) - static_cast<SvxTabPage*>(pTabPage)->PointChanged( this, RectPoint::MM ); // RectPoint is dummy + if (m_pPage) + m_pPage->PointChanged(GetDrawingArea(), RectPoint::MM ); // RectPoint is dummy return GetFocusPosIndex(); } -SvxPixelCtl::SvxPixelCtl(vcl::Window* pParent) - : Control(pParent, WB_BORDER) +SvxPixelCtl::SvxPixelCtl(SvxTabPage* pPage) + : m_pPage(pPage) , bPaintable(true) , aFocusPosition(0,0) { - SetPixelColor( COL_BLACK ); - SetBackgroundColor( COL_WHITE ); - SetLineColor( COL_LIGHTGRAY ); maPixelData.fill(0); } void SvxPixelCtl::Resize() { - Control::Resize(); - aRectSize = GetOutputSize(); + CustomWidgetController::Resize(); + aRectSize = GetOutputSizePixel(); } -Size SvxPixelCtl::GetOptimalSize() const +void SvxPixelCtl::SetDrawingArea(weld::DrawingArea* pDrawingArea) { - return LogicToPixel(Size(72, 72), MapMode(MapUnit::MapAppFont)); + pDrawingArea->set_size_request(pDrawingArea->get_approximate_digit_width() * 25, + pDrawingArea->get_text_height() * 10); + CustomWidgetController::SetDrawingArea(pDrawingArea); } -VCL_BUILDER_FACTORY(SvxPixelCtl) - -SvxPixelCtl::~SvxPixelCtl( ) +SvxPixelCtl::~SvxPixelCtl() { - disposeOnce(); } // Changes the foreground or Background color @@ -1253,8 +1240,16 @@ void SvxPixelCtl::MouseButtonDown( const MouseEvent& rMEvt ) } } -// Draws the Control (Rectangle with nine circles) +tools::Rectangle SvxPixelCtl::GetFocusRect() +{ + tools::Rectangle aRet; + //Draw visual focus when has focus + if (HasFocus()) + aRet = implCalFocusRect(aFocusPosition); + return aRet; +} +// Draws the Control (Rectangle with nine circles) void SvxPixelCtl::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& ) { if (!aRectSize.Width() || !aRectSize.Height()) @@ -1300,11 +1295,6 @@ void SvxPixelCtl::Paint( vcl::RenderContext& rRenderContext, const tools::Rectan rRenderContext.DrawRect(tools::Rectangle(aPtTl, aPtBr)); } } - //Draw visual focus when has focus - if (HasFocus()) - { - ShowFocus(implCalFocusRect(aFocusPosition)); - } } else { @@ -1330,7 +1320,7 @@ tools::Rectangle SvxPixelCtl::implCalFocusRect( const Point& aPosition ) } //Solution:Keyboard function -void SvxPixelCtl::KeyInput( const KeyEvent& rKEvt ) +bool SvxPixelCtl::KeyInput( const KeyEvent& rKEvt ) { vcl::KeyCode aKeyCode = rKEvt.GetKeyCode(); sal_uInt16 nCode = aKeyCode.GetCode(); @@ -1383,8 +1373,7 @@ void SvxPixelCtl::KeyInput( const KeyEvent& rKEvt ) Invalidate( implCalFocusRect(aFocusPosition) ); break; default: - Control::KeyInput( rKEvt ); - return; + return CustomWidgetController::KeyInput( rKEvt ); } if(m_xAccess.is()) { @@ -1407,10 +1396,11 @@ void SvxPixelCtl::KeyInput( const KeyEvent& rKEvt ) break; } } + return true; } else { - Control::KeyInput( rKEvt ); + return CustomWidgetController::KeyInput( rKEvt ); } } @@ -1419,23 +1409,15 @@ void SvxPixelCtl::GetFocus() { Invalidate(implCalFocusRect(aFocusPosition)); - if(m_xAccess.is()) + if (m_xAccess.is()) { m_xAccess->NotifyChild(GetFocusPosIndex(),true,false); } - - Control::GetFocus(); } -//Hide focus when lose focus void SvxPixelCtl::LoseFocus() { - HideFocus(); - if (m_xAccess.is()) - { - m_xAccess->LoseFocus(); - } - Control::LoseFocus(); + Invalidate(); } void SvxPixelCtl::SetXBitmap(const BitmapEx& rBitmapEx) diff --git a/svx/source/inc/svxpixelctlaccessiblecontext.hxx b/svx/source/inc/svxpixelctlaccessiblecontext.hxx index 4f399ea4a7a8..23af17a5c2ea 100644 --- a/svx/source/inc/svxpixelctlaccessiblecontext.hxx +++ b/svx/source/inc/svxpixelctlaccessiblecontext.hxx @@ -35,6 +35,7 @@ #include <com/sun/star/lang/XServiceName.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <com/sun/star/lang/DisposedException.hpp> +#include <comphelper/accessibleselectionhelper.hxx> #include <cppuhelper/interfacecontainer.h> #include <cppuhelper/compbase6.hxx> #include <cppuhelper/compbase5.hxx> @@ -51,197 +52,121 @@ namespace com { namespace sun { namespace star { namespace awt { class XFocusListener; } } } }; class SvxPixelCtl; +class SvxPixelCtlAccessible; +typedef ::cppu::ImplHelper1<css::accessibility::XAccessible> OAccessibleHelper_Base; -typedef ::cppu::WeakAggComponentImplHelper5< - css::accessibility::XAccessible, - css::accessibility::XAccessibleComponent, - css::accessibility::XAccessibleContext, - css::accessibility::XAccessibleEventBroadcaster, - css::lang::XServiceInfo > - SvxPixelCtlAccessibleChild_BASE; - -class SvxPixelCtlAccessibleChild : - public ::cppu::BaseMutex, - public SvxPixelCtlAccessibleChild_BASE +class SvxPixelCtlAccessibleChild final : public ::comphelper::OAccessibleComponentHelper, + public OAccessibleHelper_Base { - SvxPixelCtl& mrParentWindow; - css::uno::Reference< css::accessibility::XAccessible > mxParent; - bool m_bPixelColorOrBG;//Pixel Color Or BackGround Color - tools::Rectangle maBoundingBox; - /// index of child in parent - long mnIndexInParent; public: SvxPixelCtlAccessibleChild( SvxPixelCtl& rWindow, bool bPixelColorOrBG, const tools::Rectangle& rBounds, - const css::uno::Reference< css::accessibility::XAccessible >& xParent, + const rtl::Reference<SvxPixelCtlAccessible>& xParent, long nIndexInParent ); - virtual ~SvxPixelCtlAccessibleChild() override; - //XAccessible - virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + DECLARE_XINTERFACE( ) + DECLARE_XTYPEPROVIDER( ) + + //XAccessibleComponent + virtual void SAL_CALL grabFocus( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; //XAccessibleContext virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) 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::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; - virtual css::lang::Locale SAL_CALL getLocale( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; + //XAccessible + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; - //XAccessibleComponent - virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; - virtual css::awt::Rectangle SAL_CALL getBounds( ) override; - virtual css::awt::Point SAL_CALL getLocation( ) override; - virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override; - virtual css::awt::Size SAL_CALL getSize( ) override; virtual sal_Int32 SAL_CALL getForeground( ) override; virtual sal_Int32 SAL_CALL getBackground( ) override; - virtual void SAL_CALL grabFocus( ) override; - - //XServiceInfo - 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; - - //Methods for XAccessibleEventBroadcaster - sal_uInt32 mnClientId; - - virtual void SAL_CALL - addAccessibleEventListener( - const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; - - virtual void SAL_CALL - removeAccessibleEventListener( - const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; - - //Solution: Add the event handling method - void FireAccessibleEvent (short nEventId, const css::uno::Any& rOld, const css::uno::Any& rNew); - virtual void SAL_CALL disposing() override; - - /// @throws css::uno::RuntimeException - tools::Rectangle GetBoundingBoxOnScreen(); - - /// @throws css::uno::RuntimeException - tools::Rectangle const & GetBoundingBox(); - - /// @returns true if it's disposed or in disposing - inline bool IsAlive() const; - /// @throws css::lang::DisposedException if it's not alive - void ThrowExceptionIfNotAlive(); - void CheckChild(); void SelectChild( bool bSelect); void ChangePixelColorOrBG(bool bPixelColorOrBG){ m_bPixelColorOrBG = bPixelColorOrBG ;} OUString GetName(); -}; +private: + virtual ~SvxPixelCtlAccessibleChild() override; -typedef ::cppu::WeakAggComponentImplHelper6< - css::accessibility::XAccessible, - css::accessibility::XAccessibleComponent, - css::accessibility::XAccessibleContext, - css::accessibility::XAccessibleEventBroadcaster, - css::accessibility::XAccessibleSelection, - css::lang::XServiceInfo > - SvxPixelCtlAccessible_BASE; + virtual void SAL_CALL disposing() override; -class SvxPixelCtlAccessible : - public ::cppu::BaseMutex, - public SvxPixelCtlAccessible_BASE -{ - SvxPixelCtl& mrPixelCtl; + // OCommonAccessibleComponent + /// implements the calculation of the bounding rectangle + virtual css::awt::Rectangle implGetBounds( ) override; + SvxPixelCtl& mrParentWindow; + rtl::Reference<SvxPixelCtlAccessible> mxParent; + bool m_bPixelColorOrBG;//Pixel Color Or BackGround Color + tools::Rectangle maBoundingBox; + /// index of child in parent + long mnIndexInParent; +}; + +class SvxPixelCtlAccessible final : public ::comphelper::OAccessibleSelectionHelper, + public OAccessibleHelper_Base +{ public: - SvxPixelCtlAccessible(SvxPixelCtl& rWindow); - virtual ~SvxPixelCtlAccessible() override; + SvxPixelCtlAccessible(SvxPixelCtl* pPixelCtl); - //XAccessible - virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + DECLARE_XINTERFACE( ) + DECLARE_XTYPEPROVIDER( ) + + //XAccessibleComponent + virtual void SAL_CALL grabFocus( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + //XAccessible //XAccessibleContext virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; - virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) 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::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; - virtual css::lang::Locale SAL_CALL getLocale( ) override; - + virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; - //XAccessibleComponent - virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; - virtual css::awt::Rectangle SAL_CALL getBounds( ) override; - virtual css::awt::Point SAL_CALL getLocation( ) override; - virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override; - virtual css::awt::Size SAL_CALL getSize( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; virtual sal_Int32 SAL_CALL getForeground( ) override; virtual sal_Int32 SAL_CALL getBackground( ) override; - virtual void SAL_CALL grabFocus( ) override; - //XServiceInfo - 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; - // XAccessibleSelection - void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) override; - sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) override; - void SAL_CALL clearAccessibleSelection( ) override; - void SAL_CALL selectAllAccessibleChildren( ) override; - sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override; - css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override; - void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) override; - - //Methods for XAccessibleEventBroadcaster - sal_uInt32 mnClientId; - - virtual void SAL_CALL - addAccessibleEventListener( - const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; - - virtual void SAL_CALL - removeAccessibleEventListener( - const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; - //Solution: Add the event handling method - void FireAccessibleEvent (short nEventId, const css::uno::Any& rOld, const css::uno::Any& rNew); - virtual void SAL_CALL disposing() override; css::uno::Reference< css::accessibility::XAccessible > CreateChild (long nIndex, Point mPoint); void LoseFocus(); - /// @returns true if it's disposed or in disposing - inline bool IsAlive() const; +private: + virtual ~SvxPixelCtlAccessible() override; + + // OCommonAccessibleSelection + // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) + virtual bool implIsSelected(sal_Int32 nAccessibleChildIndex) override; + + // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) + virtual void implSelect(sal_Int32 nAccessibleChildIndex, bool bSelect) override; -protected: + // OCommonAccessibleComponent + virtual css::awt::Rectangle implGetBounds() override; + + virtual void SAL_CALL disposing() override; + + SvxPixelCtl* mpPixelCtl; css::uno::Reference< css::accessibility::XAccessible> m_xCurChild; + public: void NotifyChild(long nIndex, bool bSelect, bool bCheck); }; -inline bool SvxPixelCtlAccessible::IsAlive() const -{ - return !rBHelper.bDisposed && !rBHelper.bInDispose; -} - -inline bool SvxPixelCtlAccessibleChild::IsAlive() const -{ - return !rBHelper.bDisposed && !rBHelper.bInDispose; -} - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/svxrectctaccessiblecontext.hxx b/svx/source/inc/svxrectctaccessiblecontext.hxx index de5df8a46ad7..6e3fb5b509bd 100644 --- a/svx/source/inc/svxrectctaccessiblecontext.hxx +++ b/svx/source/inc/svxrectctaccessiblecontext.hxx @@ -545,8 +545,8 @@ typedef ::cppu::ImplHelper3 < css::accessibility::XAccessible, css::accessibility::XAccessibleAction > OAccessibleHelper_Base_3; -class RectCtlChildAccessibleContext : public ::comphelper::OAccessibleComponentHelper, - public OAccessibleHelper_Base_3 +class RectCtlChildAccessibleContext final : public ::comphelper::OAccessibleComponentHelper, + public OAccessibleHelper_Base_3 { public: RectCtlChildAccessibleContext( @@ -554,13 +554,6 @@ public: const OUString& rName, const OUString& rDescription, const tools::Rectangle& rBoundingBox, long nIndexInParent ); -protected: - virtual ~RectCtlChildAccessibleContext() override; - - // OCommonAccessibleComponent - /// implements the calculation of the bounding rectangle - still waiting to be overwritten - virtual css::awt::Rectangle implGetBounds( ) override; -public: DECLARE_XINTERFACE( ) DECLARE_XTYPEPROVIDER( ) @@ -608,10 +601,14 @@ public: void setStateChecked(bool bChecked); void FireFocusEvent(); -protected: +private: + virtual ~RectCtlChildAccessibleContext() override; + virtual void SAL_CALL disposing() override; -private: + // OCommonAccessibleComponent + /// implements the calculation of the bounding rectangle + virtual css::awt::Rectangle implGetBounds( ) override; /** Description of this object. This is not a constant because it can be set from the outside. Furthermore, it changes according to the diff --git a/svx/source/tbxctrls/SvxPresetListBox.cxx b/svx/source/tbxctrls/SvxPresetListBox.cxx index fd320d81009c..d6ee0510a15a 100644 --- a/svx/source/tbxctrls/SvxPresetListBox.cxx +++ b/svx/source/tbxctrls/SvxPresetListBox.cxx @@ -130,4 +130,82 @@ IMPL_LINK(SvxPresetListBox, OnMenuItemSelected, Menu*, pMenu, bool) return false; } +PresetListBox::PresetListBox(std::unique_ptr<weld::ScrolledWindow> pWindow) + : SvtValueSet(std::move(pWindow)) + , nColCount(3) + , aIconSize(60, 64) +{ + SetEdgeBlending(true); + SetExtraSpacing(4); +} + +void PresetListBox::Resize() +{ + DrawLayout(); + WinBits aWinBits(GetStyle()); + aWinBits |= WB_VSCROLL; + SetStyle(aWinBits); + SvtValueSet::Resize(); +} + +bool PresetListBox::ContextMenu(const Point& rPos) +{ + const sal_uInt16 nIndex = GetSelectedItemId(); + if(nIndex > 0) + { + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetDrawingArea(), "svx/ui/presetmenu.ui")); + std::unique_ptr<weld::Menu> xMenu(xBuilder->weld_menu("menu")); + OnMenuItemSelected(xMenu->popup_at_rect(GetDrawingArea(), tools::Rectangle(rPos, Size(1,1)))); + return true; + } + return false; +} + +void PresetListBox::DrawLayout() +{ + SetColCount(getColumnCount()); + SetLineCount(5); +} + +template< typename ListType, typename EntryType > +void PresetListBox::FillPresetListBoxImpl(ListType & pList, sal_uInt32 nStartIndex) +{ + const Size aSize( GetIconSize() ); + BitmapEx aBitmap; + for(long nIndex = 0; nIndex < pList.Count(); nIndex++, nStartIndex++) + { + aBitmap = pList.GetBitmapForPreview(nIndex, aSize); + EntryType* pItem = static_cast<EntryType*>( pList.Get(nIndex) ); + InsertItem(nStartIndex, Image(aBitmap), pItem->GetName()); + } +} + +void PresetListBox::FillPresetListBox(XGradientList& pList, sal_uInt32 nStartIndex) +{ + FillPresetListBoxImpl< XGradientList, XGradientEntry>( pList, nStartIndex ); +} + +void PresetListBox::FillPresetListBox(XHatchList& pList, sal_uInt32 nStartIndex) +{ + FillPresetListBoxImpl< XHatchList, XHatchEntry>( pList, nStartIndex ); +} + +void PresetListBox::FillPresetListBox(XBitmapList& pList, sal_uInt32 nStartIndex) +{ + FillPresetListBoxImpl< XBitmapList, XBitmapEntry >( pList, nStartIndex ); +} + +void PresetListBox::FillPresetListBox(XPatternList& pList, sal_uInt32 nStartIndex) +{ + FillPresetListBoxImpl< XPatternList, XBitmapEntry >( pList, nStartIndex ); +} + +void PresetListBox::OnMenuItemSelected(const OString& rIdent) +{ + if (rIdent == "rename") + maRenameHdl.Call(this); + else if (rIdent == "delete") + maDeleteHdl.Call(this); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/workben/pixelctl.cxx b/svx/workben/pixelctl.cxx deleted file mode 100644 index 854dcd7b94eb..000000000000 --- a/svx/workben/pixelctl.cxx +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- 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 <sal/main.h> - -#include <cppuhelper/bootstrap.hxx> -#include <comphelper/processfactory.hxx> - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/uno/XComponentContext.hpp> - -#include <vcl/event.hxx> -#include <vcl/svapp.hxx> -#include <vcl/wrkwin.hxx> -#include <tools/extendapplicationenvironment.hxx> - -#include <svx/dlgctrl.hxx> - -#include <rtl/strbuf.hxx> -#include <rtl/ustrbuf.hxx> -#include <sal/log.hxx> - -#include <math.h> - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace cppu; - -// Forward declaration -void Main(); - -SAL_IMPLEMENT_MAIN() -{ - try - { - tools::extendApplicationEnvironment(); - - // create the global service-manager - Reference< XComponentContext > xContext = defaultBootstrap_InitialComponentContext(); - Reference< XMultiServiceFactory > xServiceManager( xContext->getServiceManager(), UNO_QUERY ); - - if( !xServiceManager.is() ) - Application::Abort( "Failed to bootstrap" ); - - comphelper::setProcessServiceFactory( xServiceManager ); - - InitVCL(); - ::Main(); - DeInitVCL(); - } - catch (const Exception& e) - { - SAL_WARN("vcl.app", "Fatal: " << e); - return 1; - } - catch (const std::exception& e) - { - SAL_WARN("vcl.app", "Fatal: " << e.what()); - return 1; - } - - return 0; -} - -class MyWin : public WorkWindow -{ - VclPtr<SvxPixelCtl> maPixelCtl; - -public: - MyWin(vcl::Window* pParent, WinBits nWinStyle); - virtual ~MyWin() override - { - disposeOnce(); - } - virtual void dispose() override; - bool Close() override; -}; - -void Main() -{ - ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_STDWORK ); - aMainWin->SetText( "SvxPixelCtl" ); - aMainWin->Show(); - - Application::Execute(); -} - -MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) : - WorkWindow( pParent, nWinStyle ), - maPixelCtl( VclPtr<SvxPixelCtl>::Create(this) ) -{ - maPixelCtl->SetPosSizePixel( Point( 10, 10 ), Size( 200, 200 ) ); - maPixelCtl->Show(); - -} - -void MyWin::dispose() -{ - maPixelCtl.disposeAndClear(); - WorkWindow::dispose(); -} - -bool MyWin::Close() -{ - bool bRet = WorkWindow::Close(); - if( bRet ) - Application::Quit(); - return bRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |