From 267c6f2ac71f92999e969232431ba04678e7437e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 07:54:39 +0200 Subject: Adding upstream version 4:24.2.0. Signed-off-by: Daniel Baumann --- svx/source/inc/AccessibleFrameSelector.hxx | 132 +++ svx/source/inc/DefaultShapesPanel.hxx | 82 ++ svx/source/inc/GraphCtlAccessibleContext.hxx | 190 ++++ svx/source/inc/ShapesUtil.hxx | 39 + svx/source/inc/StylesPreviewToolBoxControl.hxx | 68 ++ svx/source/inc/StylesPreviewWindow.hxx | 150 ++++ svx/source/inc/cell.hxx | 220 +++++ svx/source/inc/celltypes.hxx | 86 ++ svx/source/inc/charmapacc.hxx | 209 +++++ svx/source/inc/clonelist.hxx | 47 + svx/source/inc/datalistener.hxx | 72 ++ svx/source/inc/datanavi.hxx | 585 +++++++++++++ svx/source/inc/delayedevent.hxx | 81 ++ svx/source/inc/docrecovery.hxx | 515 +++++++++++ svx/source/inc/filtnav.hxx | 340 ++++++++ svx/source/inc/findtextfield.hxx | 73 ++ svx/source/inc/fmPropBrw.hxx | 105 +++ svx/source/inc/fmcontrolbordermanager.hxx | 231 +++++ svx/source/inc/fmcontrollayout.hxx | 62 ++ svx/source/inc/fmdocumentclassification.hxx | 71 ++ svx/source/inc/fmexch.hxx | 243 ++++++ svx/source/inc/fmexpl.hxx | 551 ++++++++++++ svx/source/inc/fmobj.hxx | 116 +++ svx/source/inc/fmpgeimp.hxx | 144 +++ svx/source/inc/fmprop.hxx | 153 ++++ svx/source/inc/fmscriptingenv.hxx | 98 +++ svx/source/inc/fmservs.hxx | 110 +++ svx/source/inc/fmshimp.hxx | 562 ++++++++++++ svx/source/inc/fmslotinvalidator.hxx | 32 + svx/source/inc/fmtextcontroldialogs.hxx | 50 ++ svx/source/inc/fmtextcontrolfeature.hxx | 92 ++ svx/source/inc/fmtextcontrolshell.hxx | 201 +++++ svx/source/inc/fmundo.hxx | 202 +++++ svx/source/inc/fmurl.hxx | 55 ++ svx/source/inc/fmvwimp.hxx | 302 +++++++ svx/source/inc/formcontrolfactory.hxx | 107 +++ svx/source/inc/formcontroller.hxx | 570 ++++++++++++ svx/source/inc/formcontrolling.hxx | 213 +++++ svx/source/inc/formdispatchinterceptor.hxx | 107 +++ svx/source/inc/formfeaturedispatcher.hxx | 111 +++ svx/source/inc/formtoolbars.hxx | 62 ++ svx/source/inc/frmselimpl.hxx | 285 ++++++ svx/source/inc/gridcell.hxx | 1059 +++++++++++++++++++++++ svx/source/inc/gridcols.hxx | 54 ++ svx/source/inc/sdbdatacolumn.hxx | 59 ++ svx/source/inc/sqlparserclient.hxx | 70 ++ svx/source/inc/svdobjplusdata.hxx | 47 + svx/source/inc/svdobjuserdatalist.hxx | 37 + svx/source/inc/svdoutlinercache.hxx | 51 ++ svx/source/inc/svdpdf.hxx | 142 +++ svx/source/inc/svxpixelctlaccessiblecontext.hxx | 149 ++++ svx/source/inc/svxrectctaccessiblecontext.hxx | 226 +++++ svx/source/inc/tablemodel.hxx | 209 +++++ svx/source/inc/tabwin.hxx | 92 ++ svx/source/inc/tbxform.hxx | 105 +++ svx/source/inc/treevisitor.hxx | 104 +++ svx/source/inc/xfm_addcondition.hxx | 76 ++ svx/source/inc/xmlxtexp.hxx | 63 ++ svx/source/inc/xmlxtimp.hxx | 55 ++ 59 files changed, 10322 insertions(+) create mode 100644 svx/source/inc/AccessibleFrameSelector.hxx create mode 100644 svx/source/inc/DefaultShapesPanel.hxx create mode 100644 svx/source/inc/GraphCtlAccessibleContext.hxx create mode 100644 svx/source/inc/ShapesUtil.hxx create mode 100644 svx/source/inc/StylesPreviewToolBoxControl.hxx create mode 100644 svx/source/inc/StylesPreviewWindow.hxx create mode 100644 svx/source/inc/cell.hxx create mode 100644 svx/source/inc/celltypes.hxx create mode 100644 svx/source/inc/charmapacc.hxx create mode 100644 svx/source/inc/clonelist.hxx create mode 100644 svx/source/inc/datalistener.hxx create mode 100644 svx/source/inc/datanavi.hxx create mode 100644 svx/source/inc/delayedevent.hxx create mode 100644 svx/source/inc/docrecovery.hxx create mode 100644 svx/source/inc/filtnav.hxx create mode 100644 svx/source/inc/findtextfield.hxx create mode 100644 svx/source/inc/fmPropBrw.hxx create mode 100644 svx/source/inc/fmcontrolbordermanager.hxx create mode 100644 svx/source/inc/fmcontrollayout.hxx create mode 100644 svx/source/inc/fmdocumentclassification.hxx create mode 100644 svx/source/inc/fmexch.hxx create mode 100644 svx/source/inc/fmexpl.hxx create mode 100644 svx/source/inc/fmobj.hxx create mode 100644 svx/source/inc/fmpgeimp.hxx create mode 100644 svx/source/inc/fmprop.hxx create mode 100644 svx/source/inc/fmscriptingenv.hxx create mode 100644 svx/source/inc/fmservs.hxx create mode 100644 svx/source/inc/fmshimp.hxx create mode 100644 svx/source/inc/fmslotinvalidator.hxx create mode 100644 svx/source/inc/fmtextcontroldialogs.hxx create mode 100644 svx/source/inc/fmtextcontrolfeature.hxx create mode 100644 svx/source/inc/fmtextcontrolshell.hxx create mode 100644 svx/source/inc/fmundo.hxx create mode 100644 svx/source/inc/fmurl.hxx create mode 100644 svx/source/inc/fmvwimp.hxx create mode 100644 svx/source/inc/formcontrolfactory.hxx create mode 100644 svx/source/inc/formcontroller.hxx create mode 100644 svx/source/inc/formcontrolling.hxx create mode 100644 svx/source/inc/formdispatchinterceptor.hxx create mode 100644 svx/source/inc/formfeaturedispatcher.hxx create mode 100644 svx/source/inc/formtoolbars.hxx create mode 100644 svx/source/inc/frmselimpl.hxx create mode 100644 svx/source/inc/gridcell.hxx create mode 100644 svx/source/inc/gridcols.hxx create mode 100644 svx/source/inc/sdbdatacolumn.hxx create mode 100644 svx/source/inc/sqlparserclient.hxx create mode 100644 svx/source/inc/svdobjplusdata.hxx create mode 100644 svx/source/inc/svdobjuserdatalist.hxx create mode 100644 svx/source/inc/svdoutlinercache.hxx create mode 100644 svx/source/inc/svdpdf.hxx create mode 100644 svx/source/inc/svxpixelctlaccessiblecontext.hxx create mode 100644 svx/source/inc/svxrectctaccessiblecontext.hxx create mode 100644 svx/source/inc/tablemodel.hxx create mode 100644 svx/source/inc/tabwin.hxx create mode 100644 svx/source/inc/tbxform.hxx create mode 100644 svx/source/inc/treevisitor.hxx create mode 100644 svx/source/inc/xfm_addcondition.hxx create mode 100644 svx/source/inc/xmlxtexp.hxx create mode 100644 svx/source/inc/xmlxtimp.hxx (limited to 'svx/source/inc') diff --git a/svx/source/inc/AccessibleFrameSelector.hxx b/svx/source/inc/AccessibleFrameSelector.hxx new file mode 100644 index 0000000000..37ed1aa061 --- /dev/null +++ b/svx/source/inc/AccessibleFrameSelector.hxx @@ -0,0 +1,132 @@ +/* -*- 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_SVX_SOURCE_INC_ACCESSIBLEFRAMESELECTOR_HXX +#define INCLUDED_SVX_SOURCE_INC_ACCESSIBLEFRAMESELECTOR_HXX + +#include +#include +#include +#include +#include + +namespace svx { + +class FrameSelector; + +namespace a11y { + +class AccFrameSelector final : public cppu::ImplInheritanceHelper< + ::comphelper::OAccessibleComponentHelper, + css::accessibility::XAccessible> +{ +public: + explicit AccFrameSelector(FrameSelector& rFrameSel); + virtual ~AccFrameSelector() override; + + //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_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; + virtual css::awt::Point SAL_CALL getLocationOnScreen() override; + + //XAccessible + 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; + + void Invalidate(); + +private: + // OCommonAccessibleComponent + /// implements the calculation of the bounding rectangle + virtual css::awt::Rectangle implGetBounds( ) override; + + /// @throws css::uno::RuntimeException + void IsValid(); + + FrameSelector* mpFrameSel; +}; + +class AccFrameSelectorChild final : public cppu::ImplInheritanceHelper< + ::comphelper::OAccessibleComponentHelper, + css::accessibility::XAccessible> +{ +public: + explicit AccFrameSelectorChild( FrameSelector& rFrameSel, FrameBorderType eBorder ); + + virtual ~AccFrameSelectorChild() override; + + //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_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; + + //XAccessible + 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; + + void NotifyAccessibleEvent(const sal_Int16 _nEventId, const css::uno::Any& _rOldValue, const css::uno::Any& _rNewValue) + { + ::comphelper::OAccessibleComponentHelper::NotifyAccessibleEvent(_nEventId, _rOldValue, _rNewValue); + } + + void Invalidate(); + +private: + // OCommonAccessibleComponent + /// implements the calculation of the bounding rectangle + virtual css::awt::Rectangle implGetBounds( ) override; + + /// @throws css::uno::RuntimeException + void IsValid(); + + FrameSelector* mpFrameSel; + + FrameBorderType meBorder; +}; + + +} +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/DefaultShapesPanel.hxx b/svx/source/inc/DefaultShapesPanel.hxx new file mode 100644 index 0000000000..788acab692 --- /dev/null +++ b/svx/source/inc/DefaultShapesPanel.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 . + */ +#ifndef INCLUDED_SVX_SOURCE_INC_DEFAULTSHAPESPANEL_HXX +#define INCLUDED_SVX_SOURCE_INC_DEFAULTSHAPESPANEL_HXX + +#include +#include +#include +#include +#include "ShapesUtil.hxx" + +using namespace css; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::frame; + +namespace svx::sidebar { + +/** This panel provides buttons for inserting shapes into a document. +*/ +class DefaultShapesPanel final + : public PanelLayout, public SvxShapeCommandsMap +{ +public: + DefaultShapesPanel ( + weld::Widget* pParent, + css::uno::Reference xFrame); + static std::unique_ptr Create( + weld::Widget* pParent, + const css::uno::Reference& rxFrame); + virtual ~DefaultShapesPanel() override; + +private: + std::unique_ptr mxLineArrowSet; + std::unique_ptr mxLineArrowSetWin; + std::unique_ptr mxCurveSet; + std::unique_ptr mxCurveSetWin; + std::unique_ptr mxConnectorSet; + std::unique_ptr mxConnectorSetWin; + std::unique_ptr mxBasicShapeSet; + std::unique_ptr mxBasicShapeSetWin; + std::unique_ptr mxSymbolShapeSet; + std::unique_ptr mxSymbolShapeSetWin; + std::unique_ptr mxBlockArrowSet; + std::unique_ptr mxBlockArrowSetWin; + std::unique_ptr mxFlowchartSet; + std::unique_ptr mxFlowchartSetWin; + std::unique_ptr mxCalloutSet; + std::unique_ptr mxCalloutSetWin; + std::unique_ptr mxStarSet; + std::unique_ptr mxStarSetWin; + std::unique_ptr mx3DObjectSet; + std::unique_ptr mx3DObjectSetWin; + + Reference< XFrame > mxFrame; + std::map> mpShapesSetMap; + + void populateShapes(); + void Initialize(); + DECL_LINK( ShapeSelectHdl, ValueSet*, void ); +}; + +} // end of namespace sd::sidebar + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/GraphCtlAccessibleContext.hxx b/svx/source/inc/GraphCtlAccessibleContext.hxx new file mode 100644 index 0000000000..3e328e9f89 --- /dev/null +++ b/svx/source/inc/GraphCtlAccessibleContext.hxx @@ -0,0 +1,190 @@ +/* -*- 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_SVX_SOURCE_INC_GRAPHCTLACCESSIBLECONTEXT_HXX +#define INCLUDED_SVX_SOURCE_INC_GRAPHCTLACCESSIBLECONTEXT_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +namespace com::sun::star::awt { + struct Point; + struct Rectangle; + struct Size; + class XFocusListener; +} +namespace tools { class Rectangle; } +class GraphCtrl; +class SdrObject; +class SdrModel; +class SdrPage; +class SdrView; + +/** @descr + This base class provides an implementation of the + AccessibleContext service. +*/ + +typedef ::cppu::WeakComponentImplHelper< + css::accessibility::XAccessible, + css::accessibility::XAccessibleComponent, + css::accessibility::XAccessibleContext, + css::accessibility::XAccessibleEventBroadcaster, + css::accessibility::XAccessibleSelection, + css::lang::XServiceInfo, + css::lang::XServiceName > + SvxGraphCtrlAccessibleContext_Base; + +class SvxGraphCtrlAccessibleContext final : + private cppu::BaseMutex, public SvxGraphCtrlAccessibleContext_Base, + public SfxListener, public ::accessibility::IAccessibleViewForwarder +{ +public: + friend class GraphCtrl; + + // internal + SvxGraphCtrlAccessibleContext(GraphCtrl& rRepresentation); + + void Notify( SfxBroadcaster& aBC, const SfxHint& aHint ) override; + + // XAccessible + /// Return the XAccessibleContext. + virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL + getAccessibleContext() override; + + // XAccessibleComponent + virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& rPoint ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& rPoint ) 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 void SAL_CALL grabFocus() override; + + virtual sal_Int32 SAL_CALL getForeground() override; + + virtual sal_Int32 SAL_CALL getBackground() override; + + // XAccessibleContext + virtual sal_Int64 SAL_CALL getAccessibleChildCount() override; + virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleChild (sal_Int64 nIndex) override; + virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleParent() override; + virtual sal_Int64 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::XAccessibleRelationSet> SAL_CALL getAccessibleRelationSet() override; + virtual sal_Int64 SAL_CALL getAccessibleStateSet() override; + virtual css::lang::Locale SAL_CALL getLocale() override; + + // XAccessibleEventBroadcaster + 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; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService (const OUString& sServiceName) override; + virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override; + + // XTypeProvider + virtual css::uno::Sequence SAL_CALL getImplementationId() override; + + // XServiceName + virtual OUString SAL_CALL getServiceName() override; + + // XAccessibleSelection + virtual void SAL_CALL selectAccessibleChild( sal_Int64 nChildIndex ) override; + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int64 nChildIndex ) override; + virtual void SAL_CALL clearAccessibleSelection() override; + virtual void SAL_CALL selectAllAccessibleChildren() override; + virtual sal_Int64 SAL_CALL getSelectedAccessibleChildCount() override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) override; + virtual void SAL_CALL deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) override; + + // IAccessibleViewforwarder + virtual tools::Rectangle GetVisibleArea() const override; + virtual Point LogicToPixel (const Point& rPoint) const override; + virtual Size LogicToPixel (const Size& rSize) const override; + + /** This method is used by the graph control to tell the + accessibility object about a new model and view. + */ + void setModelAndView (SdrModel* pModel, SdrView* pView); + +private: + virtual ~SvxGraphCtrlAccessibleContext() override; + /// @throws css::lang::IndexOutOfBoundsException + void checkChildIndexOnSelection(sal_Int64 nIndexOfChild ); + + virtual void SAL_CALL disposing() final override; + + /// @throws css::uno::RuntimeException + /// @throws css::lang::IndexOutOfBoundsException + SdrObject* getSdrObject( sal_Int64 nIndex ); + + void CommitChange (sal_Int16 aEventId, const css::uno::Any& rNewValue, const css::uno::Any& rOldValue); + + css::uno::Reference< css::accessibility::XAccessible > getAccessible( const SdrObject* pObj ); + + ::accessibility::AccessibleShapeTreeInfo maTreeInfo; + + /** Description of this object. This is not a constant because it can + be set from the outside. + */ + OUString msDescription; + + /** Name of this object. + */ + OUString msName; + + /// map of accessible shapes + typedef ::std::map< const SdrObject*, rtl::Reference<::accessibility::AccessibleShape> > ShapesMapType; + ShapesMapType mxShapes; + + GraphCtrl* mpControl; + + SdrModel* mpModel; + SdrPage* mpPage; + SdrView* mpView; + + /// client id in the AccessibleEventNotifier queue + sal_uInt32 mnClientId; + + bool mbDisposed; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/ShapesUtil.hxx b/svx/source/inc/ShapesUtil.hxx new file mode 100644 index 0000000000..72d6e63dc7 --- /dev/null +++ b/svx/source/inc/ShapesUtil.hxx @@ -0,0 +1,39 @@ +/* -*- 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_SVX_SOURCE_INC_SHAPESUTIL_HXX +#define INCLUDED_SVX_SOURCE_INC_SHAPESUTIL_HXX +#include +#include + +namespace svx::sidebar { + +class SvxShapeCommandsMap +{ +public: + SvxShapeCommandsMap(); + std::map mpLineShapes, mpCurveShapes, + mpConnectorShapes, mpBasicShapes, mpSymbolShapes, + mpBlockArrowShapes, mpFlowchartShapes, + mpCalloutShapes, mpStarShapes, mp3DShapes; +}; + +} + +#endif +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file diff --git a/svx/source/inc/StylesPreviewToolBoxControl.hxx b/svx/source/inc/StylesPreviewToolBoxControl.hxx new file mode 100644 index 0000000000..f1f943dfff --- /dev/null +++ b/svx/source/inc/StylesPreviewToolBoxControl.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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_SVX_SOURCE_INC_STYLES_PREVIEW_TOOLBOX_CONTROL_HXX +#define INCLUDED_SVX_SOURCE_INC_STYLES_PREVIEW_TOOLBOX_CONTROL_HXX + +#include +#include +#include "StylesPreviewWindow.hxx" +#include +#include + +class StylesPreviewToolBoxControl final + : public cppu::ImplInheritanceHelper +{ + VclPtr m_xVclBox; + std::unique_ptr m_xWeldBox; + + std::vector> m_aDefaultStyles; + +public: + StylesPreviewToolBoxControl(); + virtual ~StylesPreviewToolBoxControl() override; + + // XStatusListener + virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& rEvent) override; + + // XToolbarController + virtual css::uno::Reference + SAL_CALL createItemWindow(const css::uno::Reference& rParent) override; + + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence& aArguments) override; + + // XComponent + virtual void SAL_CALL dispose() override; + + // XUpdatable + virtual void SAL_CALL update() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override; + virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override; + +private: + void InitializeStyles(const css::uno::Reference& xModel); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/svx/source/inc/StylesPreviewWindow.hxx b/svx/source/inc/StylesPreviewWindow.hxx new file mode 100644 index 0000000000..76b385c084 --- /dev/null +++ b/svx/source/inc/StylesPreviewWindow.hxx @@ -0,0 +1,150 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * 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_SVX_SOURCE_INC_STYLES_PREVIEW_WINDOW_HXX +#define INCLUDED_SVX_SOURCE_INC_STYLES_PREVIEW_WINDOW_HXX + +#include +#include +#include +#include +#include + +class StylesPreviewWindow_Base; + +/// Listener for style selection +class StyleStatusListener final : public SfxStatusListener +{ + StylesPreviewWindow_Base* m_pPreviewControl; + +public: + StyleStatusListener( + StylesPreviewWindow_Base* pPreviewControl, + const css::uno::Reference& xDispatchProvider); + + void StateChangedAtStatusListener(SfxItemState eState, const SfxPoolItem* pState) override; +}; + +/// Listener for styles creation or modification +class StylePoolChangeListener final : public SfxListener +{ + StylesPreviewWindow_Base* m_pPreviewControl; + SfxStyleSheetBasePool* m_pStyleSheetPool; + +public: + StylePoolChangeListener(StylesPreviewWindow_Base* pPreviewControl); + ~StylePoolChangeListener(); + + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; +}; + +class StyleItemController +{ + static constexpr unsigned LEFT_MARGIN = 8; + + SfxStyleFamily m_eStyleFamily; + std::pair m_aStyleName; + +public: + StyleItemController(std::pair aStyleName); + + void Paint(vcl::RenderContext& rRenderContext); + +private: + void DrawEntry(vcl::RenderContext& rRenderContext); + void DrawText(vcl::RenderContext& rRenderContext); + void DrawHighlight(vcl::RenderContext& rRenderContext, Color aFontBack); + static void DrawContentBackground(vcl::RenderContext& rRenderContext, + const tools::Rectangle& aContentRect, const Color& aColor); +}; + +class StylesListUpdateTask final : public Idle +{ + StylesPreviewWindow_Base& m_rStylesList; + +public: + StylesListUpdateTask(StylesPreviewWindow_Base& rStylesList) + : Idle("StylesListUpdateTask") + , m_rStylesList(rStylesList) + { + SetPriority(TaskPriority::HIGH_IDLE); + } + + virtual void Invoke() override; +}; + +class StylesPreviewWindow_Base +{ + friend class StylesListUpdateTask; + +protected: + static constexpr unsigned STYLES_COUNT = 6; + + css::uno::Reference m_xFrame; + + std::unique_ptr m_xStylesView; + + StylesListUpdateTask m_aUpdateTask; + + rtl::Reference m_xStatusListener; + std::unique_ptr m_pStylePoolChangeListener; + + std::vector> m_aDefaultStyles; + std::vector> m_aAllStyles; + + OUString m_sSelectedStyle; + + DECL_LINK(Selected, weld::IconView&, void); + DECL_LINK(DoubleClick, weld::IconView&, bool); + DECL_LINK(DoCommand, const CommandEvent&, bool); + DECL_LINK(DoJsonProperty, const weld::json_prop_query&, bool); + +public: + StylesPreviewWindow_Base(weld::Builder& xBuilder, + std::vector>&& aDefaultStyles, + const css::uno::Reference& xFrame); + ~StylesPreviewWindow_Base(); + + void Select(const OUString& rStyleName); + void RequestStylesListUpdate(); + static VclPtr GetCachedPreview(const std::pair& rStyle); + static OString GetCachedPreviewJson(const std::pair& rStyle); + +private: + void UpdateStylesList(); + void UpdateSelection(); + bool Command(const CommandEvent& rEvent); +}; + +class StylesPreviewWindow_Impl final : public InterimItemWindow, public StylesPreviewWindow_Base +{ +public: + StylesPreviewWindow_Impl(vcl::Window* pParent, + std::vector>&& aDefaultStyles, + const css::uno::Reference& xFrame); + ~StylesPreviewWindow_Impl(); + + void dispose(); + + void SetOptimalSize(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/svx/source/inc/cell.hxx b/svx/source/inc/cell.hxx new file mode 100644 index 0000000000..b70c683ddd --- /dev/null +++ b/svx/source/inc/cell.hxx @@ -0,0 +1,220 @@ +/* -*- 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_SVX_SOURCE_INC_CELL_HXX +#define INCLUDED_SVX_SOURCE_INC_CELL_HXX + +#include +#include +#include +#include + +#include +#include +#include +#include +#include "tablemodel.hxx" +#include +#include + + +class SfxItemSet; +class OutlinerParaObject; +class SdrObject; +namespace sdr::properties { class CellProperties; } + + +namespace sdr::table { + + +class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) Cell final : public SdrText, + public SvxUnoTextBase, + public css::table::XMergeableCell, + public css::awt::XLayoutConstrains, + public css::lang::XEventListener +{ + friend class CellUndo; + +public: + SVX_DLLPRIVATE static rtl::Reference< Cell > create( SdrTableObj& rTableObj ); + + // private + SVX_DLLPRIVATE void dispose(); + + // SdrTextShape proxy + bool IsActiveCell() const; + bool IsTextEditActive() const; + SVX_DLLPRIVATE bool hasText() const; + + SVX_DLLPRIVATE void cloneFrom( const CellRef& rCell ); + + SVX_DLLPRIVATE void setCellRect( ::tools::Rectangle const & rCellRect ) { maCellRect = rCellRect; } + SVX_DLLPRIVATE const ::tools::Rectangle& getCellRect() const { return maCellRect; } + SVX_DLLPRIVATE ::tools::Rectangle& getCellRect() { return maCellRect; } + + bool CanCreateEditOutlinerParaObject() const; + std::optional CreateEditOutlinerParaObject() const; + SVX_DLLPRIVATE void SetStyleSheet( SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr ); + SVX_DLLPRIVATE virtual SfxStyleSheet* GetStyleSheet() const override; + SVX_DLLPRIVATE void TakeTextAnchorRect(tools::Rectangle& rAnchorRect) const; + + SVX_DLLPRIVATE void SetMergedItemSetAndBroadcast(const SfxItemSet& rSet, bool bClearAllItems); + void SetMergedItem(const SfxPoolItem& rItem); + + SVX_DLLPRIVATE sal_Int32 calcPreferredWidth( const Size aSize ); + SVX_DLLPRIVATE sal_Int32 getMinimumWidth() const; + SVX_DLLPRIVATE sal_Int32 getMinimumHeight(); + + SVX_DLLPRIVATE tools::Long GetTextLeftDistance() const; + SVX_DLLPRIVATE tools::Long GetTextRightDistance() const; + SVX_DLLPRIVATE tools::Long GetTextUpperDistance() const; + SVX_DLLPRIVATE tools::Long GetTextLowerDistance() const; + + SVX_DLLPRIVATE SdrTextVertAdjust GetTextVerticalAdjust() const; + SdrTextHorzAdjust GetTextHorizontalAdjust() const; + + SVX_DLLPRIVATE void merge( sal_Int32 nColumnSpan, sal_Int32 nRowSpan ); + SVX_DLLPRIVATE void mergeContent( const CellRef& xSourceCell ); + SVX_DLLPRIVATE void replaceContentAndFormatting( const CellRef& xSourceCell ); + + SVX_DLLPRIVATE void setMerged(); + + SVX_DLLPRIVATE void copyFormatFrom( const CellRef& xSourceCell ); + + // XInterface + SVX_DLLPRIVATE virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& Type ) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // XTypeProvider + SVX_DLLPRIVATE virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + SVX_DLLPRIVATE virtual css::uno::Sequence< ::sal_Int8 > SAL_CALL getImplementationId( ) override; + + // XLayoutConstrains + SVX_DLLPRIVATE virtual css::awt::Size SAL_CALL getMinimumSize() override; + SVX_DLLPRIVATE virtual css::awt::Size SAL_CALL getPreferredSize() override; + SVX_DLLPRIVATE virtual css::awt::Size SAL_CALL calcAdjustedSize( const css::awt::Size& aNewSize ) override; + + // XMergeableCell + SVX_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getRowSpan() override; + SVX_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getColumnSpan() override; + virtual sal_Bool SAL_CALL isMerged() override; + + // XCell + SVX_DLLPRIVATE virtual OUString SAL_CALL getFormula() override; + SVX_DLLPRIVATE virtual void SAL_CALL setFormula( const OUString& aFormula ) override; + SVX_DLLPRIVATE virtual double SAL_CALL getValue() override; + SVX_DLLPRIVATE virtual void SAL_CALL setValue( double nValue ) override; + SVX_DLLPRIVATE virtual css::table::CellContentType SAL_CALL getType() override; + SVX_DLLPRIVATE virtual sal_Int32 SAL_CALL getError() override; + + // css::beans::XPropertySet + SVX_DLLPRIVATE virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override; + SVX_DLLPRIVATE virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + SVX_DLLPRIVATE virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + SVX_DLLPRIVATE virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + SVX_DLLPRIVATE virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + SVX_DLLPRIVATE virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + SVX_DLLPRIVATE virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XMultiPropertySet + SVX_DLLPRIVATE virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override; + SVX_DLLPRIVATE virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override; + SVX_DLLPRIVATE virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + SVX_DLLPRIVATE virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + SVX_DLLPRIVATE virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + + // css::beans::XPropertyState + SVX_DLLPRIVATE virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override; + SVX_DLLPRIVATE virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override; + SVX_DLLPRIVATE virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override; + SVX_DLLPRIVATE virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override; + + // XMultiPropertyStates + SVX_DLLPRIVATE virtual void SAL_CALL setAllPropertiesToDefault() override; + SVX_DLLPRIVATE virtual void SAL_CALL setPropertiesToDefault( const css::uno::Sequence< OUString >& aPropertyNames ) override; + SVX_DLLPRIVATE virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override; + + // XText + SVX_DLLPRIVATE virtual void SAL_CALL insertTextContent( const css::uno::Reference< css::text::XTextRange >& xRange, const css::uno::Reference< css::text::XTextContent >& xContent, sal_Bool bAbsorb ) override; + SVX_DLLPRIVATE virtual void SAL_CALL removeTextContent( const css::uno::Reference< css::text::XTextContent >& xContent ) override; + + // XSimpleText + SVX_DLLPRIVATE virtual void SAL_CALL insertString( const css::uno::Reference< css::text::XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb ) override; + SVX_DLLPRIVATE virtual void SAL_CALL insertControlCharacter( const css::uno::Reference< css::text::XTextRange >& xRange, ::sal_Int16 nControlCharacter, sal_Bool bAbsorb ) override; + + // XTextRange + SVX_DLLPRIVATE virtual OUString SAL_CALL getString( ) override; + SVX_DLLPRIVATE virtual void SAL_CALL setString( const OUString& aString ) override; + + // XEventListener + SVX_DLLPRIVATE virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + SVX_DLLPRIVATE virtual void SetOutlinerParaObject( std::optional pTextObject ) override; + + SVX_DLLPRIVATE void AddUndo(); + + using SvxUnoTextRangeBase::setPropertyValue; + using SvxUnoTextRangeBase::getPropertyValue; + + SVX_DLLPRIVATE sdr::properties::CellProperties* CloneProperties( SdrObject& rNewObj, Cell& rNewCell ); + + SVX_DLLPRIVATE void notifyModified(); + + void dumpAsXml(xmlTextWriterPtr pWriter, sal_Int32 nRow, sal_Int32 nCol) const; + +private: + SVX_DLLPRIVATE virtual const SfxItemSet& GetObjectItemSet() override; + SVX_DLLPRIVATE void SetObjectItem(const SfxPoolItem& rItem); + + SVX_DLLPRIVATE static css::uno::Any GetAnyForItem( SfxItemSet const & aSet, const SfxItemPropertyMapEntry* pMap ); + + /// @throws css::uno::RuntimeException + SVX_DLLPRIVATE Cell( SdrTableObj& rTableObj ); + SVX_DLLPRIVATE virtual ~Cell() COVERITY_NOEXCEPT_FALSE override; + + Cell(Cell const &) = delete; + void operator =(Cell const &) = delete; + + const SvxItemPropertySet* mpPropSet; + + std::unique_ptr mpProperties; + + css::table::CellContentType mnCellContentType; + + OUString msFormula; + double mfValue; + ::sal_Int32 mnError; + bool mbMerged; + ::sal_Int32 mnRowSpan; + ::sal_Int32 mnColSpan; + + tools::Rectangle maCellRect; + + css::uno::Reference< css::table::XTable > mxTable; + + std::unique_ptr mpGrabBagItem = {}; +}; + + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/celltypes.hxx b/svx/source/inc/celltypes.hxx new file mode 100644 index 0000000000..f70e386db8 --- /dev/null +++ b/svx/source/inc/celltypes.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 . + */ + +#ifndef INCLUDED_SVX_SOURCE_INC_CELLTYPES_HXX +#define INCLUDED_SVX_SOURCE_INC_CELLTYPES_HXX + +#include +#include + +namespace sdr::table +{ +class Cell; +class TableModel; +class TableRow; +class TableColumn; +class TableRows; +class TableColumns; +typedef rtl::Reference CellRef; +typedef rtl::Reference TableModelRef; +typedef rtl::Reference TableRowRef; +typedef rtl::Reference TableColumnRef; +typedef std::vector CellVector; +typedef std::vector RowVector; +typedef std::vector ColumnVector; + +template class RangeIterator +{ +public: + /** creates an iterator from rStart (including) to rEnd (excluding) if + bForward is true or from nEnd (excluding to nStart (including). + rStart must be <= rEnd. + */ + RangeIterator(const T& rStart, const T& rEnd, bool bForward) + { + if (bForward) + { + maIter = rStart; + maEnd = rEnd; + } + else + { + maIter = rEnd - 1; + maEnd = rStart - 1; + } + } + + /* iterates in the configured direction and returns true if rValue + now contains a valid position in the range of this iterator */ + bool next(T& rValue) + { + if (maIter == maEnd) + return false; + + rValue = maIter; + if (maIter < maEnd) + ++maIter; + else + --maIter; + return true; + } + +private: + T maEnd; + T maIter; +}; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/charmapacc.hxx b/svx/source/inc/charmapacc.hxx new file mode 100644 index 0000000000..43ab846d5b --- /dev/null +++ b/svx/source/inc/charmapacc.hxx @@ -0,0 +1,209 @@ +/* -*- 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_SVX_SOURCE_INC_CHARMAPACC_HXX +#define INCLUDED_SVX_SOURCE_INC_CHARMAPACC_HXX + +#include +#include +#include +#include +#include +#include + +#include +class SvxShowCharSet; + +namespace svx +{ + class SvxShowCharSetAcc; + + class SvxShowCharSetItemAcc; + + // - SvxShowCharSetItem - + + /** Simple struct to hold some information about the single items of the table. + */ + struct SvxShowCharSetItem + { + SvxShowCharSet& mrParent; + sal_uInt16 mnId; + OUString maText; + tools::Rectangle maRect; + rtl::Reference m_xItem; + SvxShowCharSetAcc* m_pParent; + + SvxShowCharSetItem( SvxShowCharSet& rParent, SvxShowCharSetAcc* _pParent, sal_uInt16 _nPos ); + ~SvxShowCharSetItem(); + + rtl::Reference< SvxShowCharSetItemAcc > GetAccessible(); + }; + + + // - SvxShowCharSetAcc - + + /** The table implementation of the vcl control. + */ + + class SvxShowCharSetAcc final : public cppu::ImplInheritanceHelper< + ::comphelper::OAccessibleSelectionHelper, + css::accessibility::XAccessible, + css::accessibility::XAccessibleTable> + { + ::std::vector< rtl::Reference< SvxShowCharSetItemAcc > > m_aChildren; + SvxShowCharSet* m_pParent; // the vcl control + virtual void SAL_CALL disposing() override; + public: + SvxShowCharSetAcc(SvxShowCharSet* pParent); + + // XAccessibleComponent + virtual void SAL_CALL grabFocus( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + + //OCommonAccessibleComponent + // XAccessibleContext - still waiting to be overwritten + 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; + + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override { return this; } + virtual sal_Int32 SAL_CALL getForeground( ) override; + virtual sal_Int32 SAL_CALL getBackground( ) override; + + // XAccessibleTable + virtual sal_Int32 SAL_CALL getAccessibleRowCount( ) override; + virtual sal_Int32 SAL_CALL getAccessibleColumnCount( ) override; + virtual OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow ) override; + virtual OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn ) override; + virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) override; + virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders( ) override; + virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows( ) override; + virtual css::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns( ) override; + virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) override; + virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleCaption( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleSummary( ) override; + virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) override; + virtual sal_Int64 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) override; + virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int64 nChildIndex ) override; + virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int64 nChildIndex ) override; + + + void fireEvent( + const sal_Int16 _nEventId, + const css::uno::Any& _rOldValue, + const css::uno::Any& _rNewValue + ) + { + NotifyAccessibleEvent(_nEventId,_rOldValue,_rNewValue); + } + + void clearCharSetControl() { m_pParent = nullptr; } + private: + + virtual ~SvxShowCharSetAcc() override; + + // OCommonAccessibleSelection + // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) + virtual bool + implIsSelected( sal_Int64 nAccessibleChildIndex ) override; + + // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) + virtual void + implSelect( sal_Int64 nAccessibleChildIndex, bool bSelect ) override; + + // OCommonAccessibleComponent + /// implements the calculation of the bounding rectangle - still waiting to be overwritten + virtual css::awt::Rectangle implGetBounds( ) override; + }; + + + // - SvxShowCharSetItemAcc - + + /** The child implementation of the table. + */ + class SvxShowCharSetItemAcc final : public cppu::ImplInheritanceHelper< + ::comphelper::OAccessibleComponentHelper, + css::accessibility::XAccessible, + css::accessibility::XAccessibleAction> + { + private: + SvxShowCharSetItem* mpParent; + + virtual ~SvxShowCharSetItemAcc() override; + + // OCommonAccessibleComponent + /// implements the calculation of the bounding rectangle - still waiting to be overwritten + virtual css::awt::Rectangle implGetBounds( ) override; + public: + + SvxShowCharSetItemAcc( SvxShowCharSetItem* pParent ); + + void ParentDestroyed(); + + // XAccessibleComponent + virtual void SAL_CALL grabFocus( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + + //OCommonAccessibleComponent + // XAccessibleContext - still waiting to be overwritten + 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; + + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override { return this; } + + virtual sal_Int32 SAL_CALL getForeground( ) override { return mpParent->m_pParent->getForeground(); } + virtual sal_Int32 SAL_CALL getBackground( ) override { return mpParent->m_pParent->getBackground(); } + + // XAccessibleAction + virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) override; + virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) override; + virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) override; + + + void fireEvent( + const sal_Int16 _nEventId, + const css::uno::Any& _rOldValue, + const css::uno::Any& _rNewValue + ) + { + NotifyAccessibleEvent(_nEventId,_rOldValue,_rNewValue); + } + }; +} + + +#endif // INCLUDED_SVX_SOURCE_INC_CHARMAPACC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/clonelist.hxx b/svx/source/inc/clonelist.hxx new file mode 100644 index 0000000000..5ed3e4d8c1 --- /dev/null +++ b/svx/source/inc/clonelist.hxx @@ -0,0 +1,47 @@ +/* -*- 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_SVX_SOURCE_INC_CLONELIST_HXX +#define INCLUDED_SVX_SOURCE_INC_CLONELIST_HXX + +#include + +#include + +class SdrObject; + +// #i13033# +// New mechanism to hold a list of all original and cloned objects for later +// re-creating the connections for contained connectors +class CloneList +{ + std::vector maOriginalList; + std::vector maCloneList; + +public: + void AddPair(const SdrObject* pOriginal, SdrObject* pClone); + + const SdrObject* GetOriginal(sal_uInt32 nIndex) const; + SdrObject* GetClone(sal_uInt32 nIndex) const; + + void CopyConnections() const; +}; + +#endif // INCLUDED_SVX_SOURCE_INC_CLONELIST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/datalistener.hxx b/svx/source/inc/datalistener.hxx new file mode 100644 index 0000000000..88f0a9f5a9 --- /dev/null +++ b/svx/source/inc/datalistener.hxx @@ -0,0 +1,72 @@ +/* -*- 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_SVX_SOURCE_INC_DATALISTENER_HXX +#define INCLUDED_SVX_SOURCE_INC_DATALISTENER_HXX + +#include +#include +#include +#include + + +namespace svxform +{ + + + class DataNavigatorWindow; + + typedef cppu::WeakImplHelper< + css::container::XContainerListener, + css::frame::XFrameActionListener, + css::xml::dom::events::XEventListener > DataListener_t; + + class DataListener final : public DataListener_t + { + private: + DataNavigatorWindow* m_pNaviWin; + + public: + DataListener( DataNavigatorWindow* pNaviWin ); + + private: + virtual ~DataListener() override; + + public: + // 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; + + // XFrameActionListener + virtual void SAL_CALL frameAction( const css::frame::FrameActionEvent& Action ) override; + + // xml::dom::events::XEventListener + virtual void SAL_CALL handleEvent( const css::uno::Reference< css::xml::dom::events::XEvent >& evt ) override; + + // lang::XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + }; + + +} + + +#endif // INCLUDED_SVX_SOURCE_INC_DATALISTENER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/datanavi.hxx b/svx/source/inc/datanavi.hxx new file mode 100644 index 0000000000..c3d0564a90 --- /dev/null +++ b/svx/source/inc/datanavi.hxx @@ -0,0 +1,585 @@ +/* -*- 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_SVX_SOURCE_INC_DATANAVI_HXX +#define INCLUDED_SVX_SOURCE_INC_DATANAVI_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "datalistener.hxx" + +#include +#include +#include + +class FmFormShell; + + +namespace svxform +{ + + + enum DataGroupType + { + DGTUnknown = 0, + DGTInstance, + DGTSubmission, + DGTBinding + }; + + enum DataItemType + { + DITNone = 0, + DITText, + DITAttribute, + DITElement, + DITBinding + }; + + struct ItemNode; + class XFormsPage; + class DataNavigatorWindow; + class AddInstanceDialog; + + class ReplaceString + { + OUString m_sDoc_UI; + OUString m_sInstance_UI; + OUString m_sNone_UI; + + static constexpr OUString m_sDoc_API = u"all"_ustr; + static constexpr OUString m_sInstance_API = u"instance"_ustr; + static constexpr OUString m_sNone_API = u"none"_ustr; + + ReplaceString( const ReplaceString& ) = delete; + + public: + ReplaceString() + { + m_sDoc_UI = SvxResId(RID_STR_REPLACE_DOC); + m_sInstance_UI = SvxResId(RID_STR_REPLACE_INST); + m_sNone_UI = SvxResId(RID_STR_REPLACE_NONE); + } + + /** convert submission replace string from API value to UI value. + Use 'none' as default. */ + OUString const & toUI( std::u16string_view rStr ) const + { + if( rStr == m_sDoc_API ) + return m_sDoc_UI; + else if( rStr == m_sInstance_API ) + return m_sInstance_UI; + else + return m_sNone_UI; + } + + /** convert submission replace string from UI to API. + Use 'none' as default. */ + OUString toAPI( std::u16string_view rStr ) const + { + if( rStr == m_sDoc_UI ) + return m_sDoc_API; + else if( rStr == m_sInstance_UI ) + return m_sInstance_API; + else + return m_sNone_API; + } + }; + + class MethodString + { + OUString m_sPost_UI; + OUString m_sPut_UI; + OUString m_sGet_UI; + + static constexpr OUString m_sPost_API = u"post"_ustr; + static constexpr OUString m_sPut_API = u"put"_ustr; + static constexpr OUString m_sGet_API = u"get"_ustr; + + MethodString( const MethodString& ) = delete; + + public: + + MethodString() + { + m_sPost_UI = SvxResId(RID_STR_METHOD_POST); + m_sPut_UI = SvxResId(RID_STR_METHOD_PUT); + m_sGet_UI = SvxResId(RID_STR_METHOD_GET); + } + + /** convert from API to UI; put is default. */ + OUString const & toUI( std::u16string_view rStr ) const + { + if( rStr == m_sGet_API ) + return m_sGet_UI; + else if( rStr == m_sPost_API ) + return m_sPost_UI; + else + return m_sPut_UI; + } + + /** convert from UI to API; put is default */ + OUString toAPI( std::u16string_view rStr ) const + { + if( rStr == m_sGet_UI ) + return m_sGet_API; + else if( rStr == m_sPost_UI ) + return m_sPost_API; + else + return m_sPut_API; + } + }; + + class DataTreeDropTarget final : public DropTargetHelper + { + private: + virtual sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt) override; + virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt) override; + + public: + DataTreeDropTarget(weld::TreeView& rWidget); + }; + + class XFormsPage final : public BuilderPage + { + private: + MethodString m_aMethodString; + ReplaceString m_aReplaceString; + + weld::Container* m_pParent; + std::unique_ptr m_xToolBox; + std::unique_ptr m_xMenu; + std::unique_ptr m_xItemList; + std::unique_ptr m_xScratchIter; + + o3tl::sorted_vector m_aRemovedMenuEntries; + + DataTreeDropTarget m_aDropHelper; + + css::uno::Reference< css::xforms::XFormsUIHelper1 > + m_xUIHelper; + + DataNavigatorWindow* m_pNaviWin; + bool m_bHasModel; + DataGroupType m_eGroup; + // these strings are not valid on the Submission and Binding Page + // mb: furthermore these are properties of an instance, thus + // it would be much better to get/set them through the UIHelper + // interface. + OUString m_sInstanceName; + OUString m_sInstanceURL; + bool m_bLinkOnce; + + DECL_LINK(TbxSelectHdl, const OUString&, void); + DECL_LINK(ItemSelectHdl, weld::TreeView&, void); + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + DECL_LINK(PopupMenuHdl, const CommandEvent&, bool); + + void AddChildren(const weld::TreeIter* _pParent, + const css::uno::Reference< css::xml::dom::XNode >& _xNode); + bool DoToolBoxAction(std::u16string_view rToolBoxID); + void AddEntry(std::unique_ptr _pNewNode, bool _bIsElement, weld::TreeIter* pRet = nullptr); + void AddEntry(const css::uno::Reference< css::beans::XPropertySet >& _rPropSet, weld::TreeIter* pRet = nullptr); + void EditEntry( const css::uno::Reference< css::beans::XPropertySet >& _rPropSet ); + bool RemoveEntry(); + + void PrepDnD(); + + void DeleteAndClearTree(); + + void SetMenuEntrySensitive(const OUString& rIdent, bool bSensitive); + + public: + XFormsPage(weld::Container* pParent, DataNavigatorWindow* _pNaviWin, DataGroupType _eGroup); + virtual ~XFormsPage() override; + + bool HasModel() const { return m_bHasModel; } + OUString SetModel( const css::uno::Reference< css::xforms::XModel > & _xModel, int _nPagePos ); + void ClearModel(); + OUString LoadInstance(const css::uno::Sequence< css::beans::PropertyValue >& _xPropSeq); + + bool DoMenuAction(std::u16string_view rMenuID); + void EnableMenuItems(); + void SelectFirstEntry(); + + const OUString& GetInstanceName() const { return m_sInstanceName; } + const OUString& GetInstanceURL() const { return m_sInstanceURL; } + bool GetLinkOnce() const { return m_bLinkOnce; } + void SetInstanceName( const OUString &name ) { m_sInstanceName=name; } + void SetInstanceURL( const OUString &url ) { m_sInstanceURL=url; } + void SetLinkOnce( bool bLinkOnce ) { m_bLinkOnce=bLinkOnce; } + + css::uno::Reference + GetBindingForNode( const css::uno::Reference &xNode ) { return m_xUIHelper->getBindingForNode(xNode,true); } + OUString GetServiceNameForNode( const css::uno::Reference &xNode ) { return m_xUIHelper->getDefaultServiceNameForNode(xNode); } + const css::uno::Reference< css::xforms::XFormsUIHelper1 >& + GetXFormsHelper() const { return m_xUIHelper; } + }; + + class DataNavigatorWindow final + { + private: + VclPtr m_xParent; + std::unique_ptr m_xModelsBox; + std::unique_ptr m_xModelBtn; + std::unique_ptr m_xTabCtrl; + std::unique_ptr m_xInstanceBtn; + + std::unique_ptr m_xInstPage; + std::unique_ptr m_xSubmissionPage; + std::unique_ptr m_xBindingPage; + + sal_Int32 m_nLastSelectedPos; + bool m_bShowDetails; + bool m_bIsNotifyDisabled; + std::vector< std::unique_ptr > + m_aPageList; + std::vector< css::uno::Reference< css::container::XContainer > > + m_aContainerList; + std::vector< css::uno::Reference< css::xml::dom::events::XEventTarget > > + m_aEventTargetList; + Timer m_aUpdateTimer; + + ::rtl::Reference < DataListener > + m_xDataListener; + css::uno::Reference< css::container::XNameContainer > + m_xDataContainer; + css::uno::Reference< css::frame::XFrame > + m_xFrame; + css::uno::Reference< css::frame::XModel > + m_xFrameModel; + + DECL_LINK( ModelSelectListBoxHdl, weld::ComboBox&, void ); + DECL_LINK( MenuSelectHdl, const OUString&, void ); + DECL_LINK( MenuActivateHdl, weld::Toggleable&, void ); + DECL_LINK( ActivatePageHdl, const OUString&, void); + DECL_LINK( UpdateHdl, Timer *, void); + void ModelSelectHdl(const weld::ComboBox*); + OUString GetCurrentPage() const; + XFormsPage* GetPage(const OUString& rCurId); + void LoadModels(); + void SetPageModel(const OUString& rCurId); + void ClearAllPageModels( bool bClearPages ); + void InitPages(); + void CreateInstancePage( const css::uno::Sequence< css::beans::PropertyValue >& _xPropSeq ); + bool HasFirstInstancePage() const; + OUString GetNewPageId() const; + + static bool IsAdditionalPage(std::u16string_view rIdent); + + public: + DataNavigatorWindow(vcl::Window* pParent, weld::Builder& rBuilder, SfxBindings const * pBindings); + ~DataNavigatorWindow(); + + static void SetDocModified(); + void NotifyChanges( bool _bLoadAll = false ); + void AddContainerBroadcaster( const css::uno::Reference< css::container::XContainer > & xContainer ); + void AddEventBroadcaster( const css::uno::Reference< css::xml::dom::events::XEventTarget >& xTarget ); + void RemoveBroadcaster(); + + weld::Window* GetFrameWeld() const { return m_xParent->GetFrameWeld(); } + + bool IsShowDetails() const { return m_bShowDetails; } + void DisableNotify( bool _bDisable ) { m_bIsNotifyDisabled = _bDisable; } + }; + + class DataNavigator final : public SfxDockingWindow, public SfxControllerItem + { + private: + std::unique_ptr m_xDataWin; + + virtual Size CalcDockingSize( SfxChildAlignment ) override; + virtual SfxChildAlignment CheckAlignment( SfxChildAlignment, SfxChildAlignment ) override; + + public: + DataNavigator( SfxBindings* pBindings, SfxChildWindow* pMgr, vcl::Window* pParent ); + virtual ~DataNavigator() override; + virtual void dispose() override; + + using SfxDockingWindow::StateChanged; + + void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState ) override; + }; + + class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) DataNavigatorManager final : public SfxChildWindow + { + public: + SVX_DLLPRIVATE DataNavigatorManager( vcl::Window* pParent, sal_uInt16 nId, + SfxBindings* pBindings, SfxChildWinInfo* pInfo ); + SFX_DECL_CHILDWINDOW( DataNavigatorManager ); + }; + + class AddDataItemDialog final : public weld::GenericDialogController + { + private: + css::uno::Reference< css::xforms::XFormsUIHelper1 > + m_xUIHelper; + css::uno::Reference< css::beans::XPropertySet > + m_xBinding; + css::uno::Reference< css::beans::XPropertySet > + m_xTempBinding; + + ItemNode* m_pItemNode; + DataItemType m_eItemType; + OUString m_sFL_Element; + OUString m_sFL_Attribute; + OUString m_sFL_Binding; + OUString m_sFT_BindingExp; + + std::unique_ptr m_xItemFrame; + std::unique_ptr m_xNameFT; + std::unique_ptr m_xNameED; + std::unique_ptr m_xDefaultFT; + std::unique_ptr m_xDefaultED; + std::unique_ptr m_xDefaultBtn; + std::unique_ptr m_xSettingsFrame; + std::unique_ptr m_xDataTypeLB; + std::unique_ptr m_xRequiredCB; + std::unique_ptr m_xRequiredBtn; + std::unique_ptr m_xRelevantCB; + std::unique_ptr m_xRelevantBtn; + std::unique_ptr m_xConstraintCB; + std::unique_ptr m_xConstraintBtn; + std::unique_ptr m_xReadonlyCB; + std::unique_ptr m_xReadonlyBtn; + std::unique_ptr m_xCalculateCB; + std::unique_ptr m_xCalculateBtn; + std::unique_ptr m_xOKBtn; + + void Check(const weld::Toggleable* pBox); + DECL_LINK(CheckHdl, weld::Toggleable&, void); + DECL_LINK(ConditionHdl, weld::Button&, void); + DECL_LINK(OKHdl, weld::Button&, void); + + void InitDialog(); + void InitFromNode(); + void InitDataTypeBox(); + + public: + AddDataItemDialog( + weld::Window* pParent, ItemNode* _pNode, + const css::uno::Reference< css::xforms::XFormsUIHelper1 >& _rUIHelper ); + virtual ~AddDataItemDialog() override; + + void InitText( DataItemType _eType ); + }; + + class AddConditionDialog final : public weld::GenericDialogController + { + private: + Idle m_aResultIdle; + OUString m_sPropertyName; + + css::uno::Reference< css::xforms::XFormsUIHelper1 > + m_xUIHelper; + css::uno::Reference< css::beans::XPropertySet > + m_xBinding; + + std::unique_ptr m_xConditionED; + std::unique_ptr m_xResultWin; + std::unique_ptr m_xEditNamespacesBtn; + std::unique_ptr m_xOKBtn; + + DECL_LINK(ModifyHdl, weld::TextView&, void); + DECL_LINK(ResultHdl, Timer *, void); + DECL_LINK(EditHdl, weld::Button&, void); + DECL_LINK(OKHdl, weld::Button&, void); + + public: + AddConditionDialog(weld::Window* pParent, + OUString _aPropertyName, const css::uno::Reference< css::beans::XPropertySet >& _rBinding); + virtual ~AddConditionDialog() override; + + const css::uno::Reference< css::xforms::XFormsUIHelper1 >& GetUIHelper() const { return m_xUIHelper; } + OUString GetCondition() const { return m_xConditionED->get_text(); } + void SetCondition(const OUString& _rCondition) + { + m_xConditionED->set_text(_rCondition); + m_aResultIdle.Start(); + } + }; + + class NamespaceItemDialog final : public weld::GenericDialogController + { + private: + AddConditionDialog* m_pConditionDlg; + std::vector< OUString > m_aRemovedList; + + css::uno::Reference< css::container::XNameContainer >& + m_rNamespaces; + + std::unique_ptr m_xNamespacesList; + std::unique_ptr m_xAddNamespaceBtn; + std::unique_ptr m_xEditNamespaceBtn; + std::unique_ptr m_xDeleteNamespaceBtn; + std::unique_ptr m_xOKBtn; + + DECL_LINK(SelectHdl, weld::TreeView&, void); + DECL_LINK(ClickHdl, weld::Button&, void); + DECL_LINK(OKHdl, weld::Button&, void); + + void LoadNamespaces(); + + public: + NamespaceItemDialog(AddConditionDialog* pParent, css::uno::Reference< css::container::XNameContainer >& _rContainer); + virtual ~NamespaceItemDialog() override; + }; + + class ManageNamespaceDialog final : public weld::GenericDialogController + { + private: + AddConditionDialog* m_pConditionDlg; + + std::unique_ptr m_xPrefixED; + std::unique_ptr m_xUrlED; + std::unique_ptr m_xOKBtn; + std::unique_ptr m_xAltTitle; + + DECL_LINK(OKHdl, weld::Button&, void); + + public: + ManageNamespaceDialog(weld::Window* pParent, AddConditionDialog* _pCondDlg, bool bIsEdit); + virtual ~ManageNamespaceDialog() override; + + void SetNamespace(const OUString& _rPrefix, const OUString& _rURL) + { + m_xPrefixED->set_text(_rPrefix); + m_xUrlED->set_text(_rURL); + } + OUString GetPrefix() const { return m_xPrefixED->get_text(); } + OUString GetURL() const { return m_xUrlED->get_text(); } + }; + + class AddSubmissionDialog final : public weld::GenericDialogController + { + private: + MethodString m_aMethodString; + ReplaceString m_aReplaceString; + + ItemNode* m_pItemNode; + + css::uno::Reference< css::xforms::XFormsUIHelper1 > + m_xUIHelper; + css::uno::Reference< css::xforms::XSubmission > + m_xNewSubmission; + css::uno::Reference< css::beans::XPropertySet > + m_xSubmission; + css::uno::Reference< css::beans::XPropertySet > + m_xTempBinding; + css::uno::Reference< css::beans::XPropertySet > + m_xCreatedBinding; + + std::unique_ptr m_xNameED; + std::unique_ptr m_xActionED; + std::unique_ptr m_xMethodLB; + std::unique_ptr m_xRefED; + std::unique_ptr m_xRefBtn; + std::unique_ptr m_xBindLB; + std::unique_ptr m_xReplaceLB; + std::unique_ptr m_xOKBtn; + + DECL_LINK(RefHdl, weld::Button&, void); + DECL_LINK(OKHdl, weld::Button&, void); + + void FillAllBoxes(); + + public: + AddSubmissionDialog(weld::Window* pParent, ItemNode* pNode, + const css::uno::Reference< css::xforms::XFormsUIHelper1 >& rUIHelper); + virtual ~AddSubmissionDialog() override; + + const css::uno::Reference< css::xforms::XSubmission >& GetNewSubmission() const { return m_xNewSubmission; } + }; + + class AddModelDialog final : public weld::GenericDialogController + { + private: + std::unique_ptr m_xNameED; + std::unique_ptr m_xModifyCB; + std::unique_ptr m_xAltTitle; + + public: + AddModelDialog(weld::Window* pParent, bool _bEdit); + virtual ~AddModelDialog() override; + + OUString GetName() const { return m_xNameED->get_text(); } + void SetName( const OUString& _rName ) { m_xNameED->set_text( _rName );} + + bool GetModifyDoc() const { return m_xModifyCB->get_active(); } + void SetModifyDoc( const bool bModify ) { m_xModifyCB->set_active(bModify); } + }; + + class AddInstanceDialog final : public weld::GenericDialogController + { + private: + OUString m_sAllFilterName; + + std::unique_ptr m_xNameED; + std::unique_ptr m_xURLED; + std::unique_ptr m_xFilePickerBtn; + std::unique_ptr m_xLinkInstanceCB; + std::unique_ptr m_xAltTitle; + + DECL_LINK(FilePickerHdl, weld::Button&, void); + + public: + AddInstanceDialog(weld::Window* pParent, bool _bEdit); + virtual ~AddInstanceDialog() override; + + OUString GetName() const { return m_xNameED->get_text(); } + void SetName( const OUString& rName ) { m_xNameED->set_text( rName );} + OUString GetURL() const { return m_xURLED->get_active_text(); } + void SetURL( const OUString& rURL ) { m_xURLED->set_entry_text( rURL );} + bool IsLinkInstance() const { return m_xLinkInstanceCB->get_active(); } + void SetLinkInstance( bool bLink ) { m_xLinkInstanceCB->set_active(bLink); } + }; + + class LinkedInstanceWarningBox final : public weld::MessageDialogController + { + public: + LinkedInstanceWarningBox(weld::Widget* pParent); + }; +} + + +#endif // INCLUDED_SVX_SOURCE_INC_DATANAVI_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/delayedevent.hxx b/svx/source/inc/delayedevent.hxx new file mode 100644 index 0000000000..4f7925c94b --- /dev/null +++ b/svx/source/inc/delayedevent.hxx @@ -0,0 +1,81 @@ +/* -*- 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_SVX_SOURCE_INC_DELAYEDEVENT_HXX +#define INCLUDED_SVX_SOURCE_INC_DELAYEDEVENT_HXX + +#include + +struct ImplSVEvent; + +namespace svxform +{ + + + //= DelayedEvent + + /** small class which encapsulates posting a Link instance as ApplicationUserEvent + + No thread safety at all here, just a little saving of code to type multiple times + */ + class DelayedEvent + { + public: + DelayedEvent( const Link& _rHandler ) + :m_aHandler( _rHandler ) + ,m_nEventId( nullptr ) + { + } + + ~DelayedEvent() + { + CancelPendingCall(); + } + + /** calls the handler asynchronously + + If there's already a call pending, this previous call is cancelled. + */ + void Call(); + + /** cancels a call which is currently pending + + If no call is currently pending, then this is ignored. + */ + void CancelPendingCall(); + + private: + Link m_aHandler; + ImplSVEvent * m_nEventId; + + private: + DECL_LINK( OnCall, void*, void ); + + private: + DelayedEvent( const DelayedEvent& ) = delete; + DelayedEvent& operator=( const DelayedEvent& ) = delete; + }; + + +} + + +#endif // INCLUDED_SVX_SOURCE_INC_DELAYEDEVENT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx new file mode 100644 index 0000000000..7ac9549e1c --- /dev/null +++ b/svx/source/inc/docrecovery.hxx @@ -0,0 +1,515 @@ +/* -*- 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_SVX_SOURCE_INC_DOCRECOVERY_HXX +#define INCLUDED_SVX_SOURCE_INC_DOCRECOVERY_HXX + +#include +#include + +#include +#include +#include +#include +#include +#include + + +#define RECOVERY_CMDPART_PROTOCOL "vnd.sun.star.autorecovery:" + +#define RECOVERY_CMDPART_DO_EMERGENCY_SAVE "/doEmergencySave" +#define RECOVERY_CMDPART_DO_RECOVERY "/doAutoRecovery" +#define RECOVERY_CMDPART_DO_BRINGTOFRONT "/doBringToFront" + +inline constexpr OUString RECOVERY_CMD_DO_PREPARE_EMERGENCY_SAVE = u"vnd.sun.star.autorecovery:/doPrepareEmergencySave"_ustr; +inline constexpr OUString RECOVERY_CMD_DO_EMERGENCY_SAVE = u"vnd.sun.star.autorecovery:/doEmergencySave"_ustr; +inline constexpr OUString RECOVERY_CMD_DO_RECOVERY = u"vnd.sun.star.autorecovery:/doAutoRecovery"_ustr; +inline constexpr OUString RECOVERY_CMD_DO_ENTRY_BACKUP = u"vnd.sun.star.autorecovery:/doEntryBackup"_ustr; +inline constexpr OUString RECOVERY_CMD_DO_ENTRY_CLEANUP = u"vnd.sun.star.autorecovery:/doEntryCleanUp"_ustr; + +inline constexpr OUString PROP_STATUSINDICATOR = u"StatusIndicator"_ustr; +inline constexpr OUString PROP_DISPATCHASYNCHRON = u"DispatchAsynchron"_ustr; +inline constexpr OUString PROP_SAVEPATH = u"SavePath"_ustr; +inline constexpr OUString PROP_ENTRYID = u"EntryID"_ustr; + +inline constexpr OUString STATEPROP_ID = u"ID"_ustr; +inline constexpr OUString STATEPROP_STATE = u"DocumentState"_ustr; +inline constexpr OUString STATEPROP_ORGURL = u"OriginalURL"_ustr; +inline constexpr OUString STATEPROP_TEMPURL = u"TempURL"_ustr; +inline constexpr OUString STATEPROP_FACTORYURL = u"FactoryURL"_ustr; +inline constexpr OUString STATEPROP_TEMPLATEURL = u"TemplateURL"_ustr; +inline constexpr OUString STATEPROP_TITLE = u"Title"_ustr; +inline constexpr OUString STATEPROP_MODULE = u"Module"_ustr; + +#define RECOVERY_OPERATIONSTATE_START "start" +#define RECOVERY_OPERATIONSTATE_STOP "stop" +#define RECOVERY_OPERATIONSTATE_UPDATE "update" + +#define DLG_RET_UNKNOWN -1 +#define DLG_RET_OK RET_OK +#define DLG_RET_CANCEL RET_CANCEL +#define DLG_RET_OK_AUTOLAUNCH 101 // request a restart + + +enum class EDocStates +{ + /* TEMP STATES */ + + /// default state, if a document was new created or loaded + Unknown = 0x000, + /** an action was started (saving/loading) ... Can be interesting later if the process may be was interrupted by an exception. */ + TryLoadBackup = 0x010, + TryLoadOriginal = 0x020, + + /* FINAL STATES */ + + /// the Auto/Emergency saved document isn't usable any longer + Damaged = 0x040, + /// the Auto/Emergency saved document is not really up-to-date (some changes can be missing) + Incomplete = 0x080, + /// the Auto/Emergency saved document was processed successfully + Succeeded = 0x200 +}; +namespace o3tl { + template<> struct typed_flags : is_typed_flags {}; +} + + +namespace svx{ + namespace DocRecovery{ + + +enum ERecoveryState +{ + E_SUCCESSFULLY_RECOVERED, + E_ORIGINAL_DOCUMENT_RECOVERED, + E_RECOVERY_FAILED, + E_RECOVERY_IS_IN_PROGRESS, + E_NOT_RECOVERED_YET, + E_WILL_BE_DISCARDED, +}; + + +struct TURLInfo +{ + public: + + /// unique ID, which is specified by the underlying autorecovery core! + sal_Int32 ID; + + /// the full qualified document URL + OUString OrgURL; + + /// the full qualified URL of the temp. file (if it's exists) + OUString TempURL; + + /// a may be existing factory URL (e.g. for untitled documents) + OUString FactoryURL; + + /// may be the document base on a template file !? + OUString TemplateURL; + + /// the pure file name, without path, disc etcpp. + OUString DisplayName; + + /// the application module, where this document was loaded + OUString Module; + + /// state info as e.g. VALID, CORRUPTED, NON EXISTING ... + EDocStates DocState; + + /// ui representation for DocState! + ERecoveryState RecoveryState; + + /// standard icon + OUString StandardImageId; + + /// user choice to discard + bool ShouldDiscard; + + public: + + TURLInfo() + : ID (-1 ) + , DocState (EDocStates::Unknown) + , RecoveryState(E_NOT_RECOVERED_YET) + , ShouldDiscard(false) + {} +}; + + +typedef ::std::vector< TURLInfo > TURLList; + + +class IRecoveryUpdateListener +{ + public: + + // inform listener about changed items, which should be refreshed + virtual void updateItems() = 0; + + // inform listener about ending of the asynchronous recovery operation + virtual void end() = 0; + + // TODO + virtual void stepNext(TURLInfo* pItem) = 0; + + protected: + ~IRecoveryUpdateListener() {} +}; + + +class RecoveryCore final : public ::cppu::WeakImplHelper< css::frame::XStatusListener > +{ + + // types, const + public: + + + // member + private: + + /// TODO + css::uno::Reference< css::uno::XComponentContext > m_xContext; + + /// TODO + css::uno::Reference< css::frame::XDispatch > m_xRealCore; + + /// TODO + css::uno::Reference< css::task::XStatusIndicator > m_xProgress; + + /// TODO + TURLList m_lURLs; + + /// TODO + IRecoveryUpdateListener* m_pListener; + + /** @short knows the reason, why we listen on our internal m_xRealCore + member. + + @descr Because we listen for different operations + on the core dispatch implementation, we must know, + which URL we have to use for deregistration! + */ + bool m_bListenForSaving; + + + // native interface + public: + + + /** @short TODO */ + RecoveryCore(css::uno::Reference< css::uno::XComponentContext > xContext, + bool bUsedForSaving); + + + /** @short TODO */ + virtual ~RecoveryCore() override; + + + /** @short TODO */ + const css::uno::Reference< css::uno::XComponentContext >& getComponentContext() const; + + + /** @short TODO */ + TURLList& getURLListAccess(); + + + /** @short TODO */ + static bool isBrokenTempEntry(const TURLInfo& rInfo); + void saveBrokenTempEntries(const OUString& sSaveDir); + void saveAllTempEntries(const OUString& sSaveDir); + void forgetBrokenTempEntries(); + void forgetAllRecoveryEntries(); + void forgetBrokenRecoveryEntries(); + void forgetAllRecoveryEntriesMarkedForDiscard(); + + + /** @short TODO */ + void setProgressHandler(const css::uno::Reference< css::task::XStatusIndicator >& xProgress); + + + /** @short TODO */ + void setUpdateListener(IRecoveryUpdateListener* pListener); + + + /** @short TODO */ + void doEmergencySavePrepare(); + void doEmergencySave(); + void doRecovery(); + + + /** @short TODO */ + static ERecoveryState mapDocState2RecoverState(EDocStates eDocState); + + + // uno interface + public: + + // css.frame.XStatusListener + virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& aEvent) override; + + // css.lang.XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) override; + + + // helper + private: + + + /** @short starts listening on the internal EmergencySave/AutoRecovery core. + */ + void impl_startListening(); + + + /** @short stop listening on the internal EmergencySave/AutoRecovery core. + */ + void impl_stopListening(); + + + /** @short TODO */ + css::util::URL impl_getParsedURL(const OUString& sURL); +}; + +class PluginProgress final : public ::cppu::WeakImplHelper +{ +// member +private: + weld::ProgressBar* m_pProgressBar; + int m_nRange; + +// native interface +public: + PluginProgress(weld::ProgressBar* pProgressBar); + virtual ~PluginProgress() override; + +// uno interface +public: + // XStatusIndicator + virtual void SAL_CALL start(const OUString& sText, sal_Int32 nRange) override; + virtual void SAL_CALL end() override; + virtual void SAL_CALL setText(const OUString& sText) override; + virtual void SAL_CALL setValue(sal_Int32 nValue) override; + virtual void SAL_CALL reset() override; + + // XComponent + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener >& xListener) override; + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener) override; +}; + +class SaveDialog final : public weld::GenericDialogController +{ +// member +private: + RecoveryCore* m_pCore; + std::unique_ptr m_xFileListLB; + std::unique_ptr m_xOkBtn; + +// interface +public: + /** @short create all child controls of this dialog. + + @descr The dialog isn't shown nor it starts any + action by itself! + + @param pParent + can point to a parent window. + If it's set to 0, the defmodal-dialog-parent + is used automatically. + + @param pCore + provides access to the recovery core service + and the current list of open documents, + which should be shown inside this dialog. + */ + SaveDialog(weld::Window* pParent, RecoveryCore* pCore); + virtual ~SaveDialog() override; + + DECL_LINK(OKButtonHdl, weld::Button&, void); +}; + +class SaveProgressDialog final : public weld::GenericDialogController + , public IRecoveryUpdateListener +{ + // member + private: + // @short TODO + RecoveryCore* m_pCore; + + std::unique_ptr m_xProgressBar; + + // @short TODO + css::uno::Reference< css::task::XStatusIndicator > m_xProgress; + // interface + public: + /** @short create all child controls of this dialog. + + @descr The dialog isn't shown nor it starts any + action by itself! + + @param pParent + can point to a parent window. + If it's set to 0, the defmodal-dialog-parent + is used automatically. + + @param pCore + used to start emergency save. + */ + SaveProgressDialog(weld::Window* pParent, + RecoveryCore* pCore); + virtual ~SaveProgressDialog() override; + + /** @short start the emergency save operation. */ + virtual short run() override; + + // IRecoveryUpdateListener + virtual void updateItems() override; + virtual void stepNext(TURLInfo* pItem) override; + virtual void end() override; +}; + +class RecoveryDialog final : public weld::GenericDialogController + , public IRecoveryUpdateListener +{ + // member + private: + OUString m_aTitleRecoveryInProgress; + OUString m_aRecoveryOnlyFinish; + OUString m_aRecoveryOnlyFinishDescr; + + RecoveryCore* m_pCore; + css::uno::Reference< css::task::XStatusIndicator > m_xProgress; + enum EInternalRecoveryState + { + E_RECOVERY_PREPARED, // dialog started... recovery prepared + E_RECOVERY_IN_PROGRESS, // recovery core still in progress + E_RECOVERY_CORE_DONE, // recovery core finished it's task + E_RECOVERY_DONE, // user clicked "next" button + E_RECOVERY_CANCELED, // user clicked "cancel" button + E_RECOVERY_CANCELED_BEFORE, // user clicked "cancel" button before recovery was started + E_RECOVERY_CANCELED_AFTERWARDS, // user clicked "cancel" button after recovery was finished + E_RECOVERY_HANDLED // the recovery wizard page was shown already... and will be shown now again... + }; + sal_Int32 m_eRecoveryState; + bool m_bWaitForCore; + bool m_bWasRecoveryStarted; + int m_aToggleCount; + + OUString m_aSuccessRecovStr; + OUString m_aOrigDocRecovStr; + OUString m_aRecovFailedStr; + OUString m_aRecovInProgrStr; + OUString m_aNotRecovYetStr; + OUString m_aWillBeDiscStr; + + std::unique_ptr m_xDescrFT; + std::unique_ptr m_xProgressBar; + std::unique_ptr m_xFileListLB; + std::unique_ptr m_xNextBtn; + std::unique_ptr m_xCancelBtn; + + // member + public: + /** @short TODO */ + RecoveryDialog(weld::Window* pParent, + RecoveryCore* pCore); + + virtual ~RecoveryDialog() override; + + // IRecoveryUpdateListener + virtual void updateItems() override; + virtual void stepNext(TURLInfo* pItem) override; + virtual void end() override; + + bool allSuccessfullyRecovered(); + + short execute(); + + // helper + private: + DECL_LINK(NextButtonHdl, weld::Button&, void); + DECL_LINK(CancelButtonHdl, weld::Button&, void); + DECL_LINK(ToggleRowHdl, const weld::TreeView::iter_col&, void); + + OUString impl_getStatusString( const TURLInfo& rInfo ) const; + static OUString impl_getStatusImage( const TURLInfo& rInfo ); + void impl_updateItemDescription(int row, const TriState& rState); +}; + + +class BrokenRecoveryDialog final : public weld::GenericDialogController +{ +// member +private: + OUString m_sSavePath; + RecoveryCore* m_pCore; + bool const m_bBeforeRecovery; + bool m_bExecutionNeeded; + + std::unique_ptr m_xFileListLB; + std::unique_ptr m_xSaveDirED; + std::unique_ptr m_xSaveDirBtn; + std::unique_ptr m_xOkBtn; + std::unique_ptr m_xCancelBtn; + +// interface +public: + + /** @short TODO */ + BrokenRecoveryDialog(weld::Window* pParent, + RecoveryCore* pCore, + bool bBeforeRecovery); + virtual ~BrokenRecoveryDialog() override; + + /** @short TODO */ + bool isExecutionNeeded() const; + + + /** @short TODO */ + const OUString& getSaveDirURL() const; + + +// helper +private: + /** @short TODO */ + void impl_refresh(); + + + /** @short TODO */ + DECL_LINK(SaveButtonHdl, weld::Button&, void); + + + /** @short TODO */ + DECL_LINK(OkButtonHdl, weld::Button&, void); + + + /** @short TODO */ + DECL_LINK(CancelButtonHdl, weld::Button&, void); + + + /** @short TODO */ + void impl_askForSavePath(); +}; + } +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/filtnav.hxx b/svx/source/inc/filtnav.hxx new file mode 100644 index 0000000000..67e1deb8bf --- /dev/null +++ b/svx/source/inc/filtnav.hxx @@ -0,0 +1,340 @@ +/* -*- 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_SVX_SOURCE_INC_FILTNAV_HXX +#define INCLUDED_SVX_SOURCE_INC_FILTNAV_HXX + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "fmexch.hxx" +#include "sqlparserclient.hxx" + +class FmFormShell; + +namespace svxform +{ + +class FmFilterItem; +class FmFilterItems; +class FmParentData; +class FmFilterAdapter; + +// data structure for the filter model +class FmFilterData +{ + FmParentData* m_pParent; + OUString m_aText; + +public: + FmFilterData(FmParentData* pParent, OUString aText) + :m_pParent( pParent ) + ,m_aText(std::move( aText )) + {} + virtual ~FmFilterData(){} + + void SetText( const OUString& rText ){ m_aText = rText; } + const OUString& GetText() const { return m_aText; } + FmParentData* GetParent() const {return m_pParent;} + + virtual OUString GetImage() const; +}; + +class FmParentData : public FmFilterData +{ +protected: + ::std::vector< std::unique_ptr > m_aChildren; + +public: + FmParentData(FmParentData* pParent, const OUString& rText) + : FmFilterData(pParent, rText) + {} + virtual ~FmParentData() override; + + ::std::vector< std::unique_ptr >& GetChildren() { return m_aChildren; } +}; + +// Item representing the forms and subforms +class FmFormItem final : public FmParentData +{ + css::uno::Reference< css::form::runtime::XFormController > m_xController; + css::uno::Reference< css::form::runtime::XFilterController > m_xFilterController; + +public: + + FmFormItem( FmParentData* _pParent, + const css::uno::Reference< css::form::runtime::XFormController > & _xController, + const OUString& _rText) + :FmParentData( _pParent, _rText ) + ,m_xController( _xController ) + ,m_xFilterController( _xController, css::uno::UNO_QUERY_THROW ) + { + } + + const css::uno::Reference< css::form::runtime::XFormController >& + GetController() const { return m_xController; } + + const css::uno::Reference< css::form::runtime::XFilterController >& + GetFilterController() const { return m_xFilterController; } + + virtual OUString GetImage() const override; +}; + +class FmFilterItems final : public FmParentData +{ +public: + FmFilterItems(FmFormItem* pParent, const OUString& rText ) : FmParentData(pParent, rText) {} + + FmFilterItem* Find( const ::sal_Int32 _nFilterComponentIndex ) const; + virtual OUString GetImage() const override; +}; + +class FmFilterItem final : public FmFilterData +{ + OUString m_aFieldName; + sal_Int32 m_nComponentIndex; + +public: + FmFilterItem( + FmFilterItems* pParent, + OUString aFieldName, + const OUString& aCondition, + const sal_Int32 _nComponentIndex + ); + + const OUString& GetFieldName() const {return m_aFieldName;} + sal_Int32 GetComponentIndex() const { return m_nComponentIndex; } + + virtual OUString GetImage() const override; +}; + +class FmFilterModel final : public FmParentData + ,public SfxBroadcaster + ,public ::svxform::OSQLParserClient +{ + friend class FmFilterAdapter; + + css::uno::Reference< css::container::XIndexAccess > m_xControllers; + css::uno::Reference< css::form::runtime::XFormController > m_xController; + rtl::Reference m_pAdapter; + FmFilterItems* m_pCurrentItems; + +public: + FmFilterModel(); + virtual ~FmFilterModel() override; + + void Update(const css::uno::Reference< css::container::XIndexAccess > & xControllers, const css::uno::Reference< css::form::runtime::XFormController > & xCurrent); + void Clear(); + bool ValidateText(FmFilterItem const * pItem, OUString& rText, OUString& rErrorMsg) const; + void Append(FmFilterItems* pItems, std::unique_ptr pFilterItem); + void SetTextForItem(FmFilterItem* pItem, const OUString& rText); + + FmFormItem* GetCurrentForm() const {return m_pCurrentItems ? static_cast(m_pCurrentItems->GetParent()) : nullptr;} + FmFilterItems* GetCurrentItems() const {return m_pCurrentItems;} + void SetCurrentItems(FmFilterItems* pCurrent); + + const css::uno::Reference< css::form::runtime::XFormController > & GetCurrentController() const {return m_xController;} + void SetCurrentController(const css::uno::Reference< css::form::runtime::XFormController > & xController); + + void Remove(FmFilterData* pFilterItem); + static void AppendFilterItems( FmFormItem& _rItem ); + void EnsureEmptyFilterRows( FmParentData& _rItem ); + +private: + void Insert(const ::std::vector>::iterator& rPos, std::unique_ptr pFilterItem); + void Remove( const ::std::vector>::iterator& rPos ); + FmFormItem* Find(const ::std::vector>& rItems, const css::uno::Reference< css::form::runtime::XFormController > & xController) const; + FmFormItem* Find(const ::std::vector>& rItems, const css::uno::Reference< css::form::XForm >& xForm) const; + void Update(const css::uno::Reference< css::container::XIndexAccess > & xControllers, FmParentData* pParent); +}; + + +class OFilterItemExchange final : public OLocalExchange +{ + ::std::vector m_aDraggedEntries; + FmFormItem* m_pFormItem; // ensure that we drop on the same form + +public: + OFilterItemExchange(); + + static SotClipboardFormatId getFormatId( ); + inline static bool hasFormat( const DataFlavorExVector& _rFormats ); + + const ::std::vector& getDraggedEntries() const { return m_aDraggedEntries; } + void setDraggedEntries(::std::vector&& _rList) { m_aDraggedEntries = std::move(_rList); } + FmFormItem* getFormItem() const { return m_pFormItem; } + + void setFormItem( FmFormItem* _pItem ) { m_pFormItem = _pItem; } + +private: + virtual void AddSupportedFormats() override; +}; + +inline bool OFilterItemExchange::hasFormat( const DataFlavorExVector& _rFormats ) +{ + return OLocalExchange::hasFormat( _rFormats, getFormatId() ); +} + +class OFilterExchangeHelper final : public OLocalExchangeHelper +{ +public: + OFilterExchangeHelper() : OLocalExchangeHelper() { } + + OFilterItemExchange* operator->() const { return static_cast(m_xTransferable.get()); } + OFilterItemExchange& operator*() const { return *static_cast(m_xTransferable.get()); } + +private: + virtual rtl::Reference createExchange() const override; +}; + +class FmFilterNavigator; + +class FmFilterNavigatorDropTarget final : public DropTargetHelper +{ +private: + FmFilterNavigator& m_rTreeView; + + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; + +public: + FmFilterNavigatorDropTarget(FmFilterNavigator& rTreeView); +}; + +class FmFilterNavigator final : public SfxListener +{ + VclPtr m_xTopLevel; + std::unique_ptr m_xTreeView; + FmFilterNavigatorDropTarget m_aDropTargetHelper; + + std::unique_ptr m_pModel; + std::unique_ptr m_xEditingCurrently; + OFilterExchangeHelper m_aControlExchange; + + ImplSVEvent* m_nAsyncRemoveEvent; + +public: + FmFilterNavigator(vcl::Window* pTopLevel, std::unique_ptr xTreeView); + virtual ~FmFilterNavigator() override; + + void GrabFocus() { m_xTreeView->grab_focus(); } + + void EndEditing(); + + void UpdateContent( + const css::uno::Reference< css::container::XIndexAccess > & xControllers, + const css::uno::Reference< css::form::runtime::XFormController > & xCurrent + ); + + weld::TreeView& get_widget() { return *m_xTreeView; } + + sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt); + sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt); + +private: + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + DECL_LINK(PopupMenuHdl, const CommandEvent&, bool); + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + DECL_STATIC_LINK(FmFilterNavigator, CustomGetSizeHdl, weld::TreeView::get_size_args, Size); + DECL_STATIC_LINK(FmFilterNavigator, CustomRenderHdl, weld::TreeView::render_args, void); + + DECL_LINK(SelectHdl, weld::TreeView&, void); + DECL_LINK(EditingEntryHdl, const weld::TreeIter&, bool); + typedef std::pair IterString; + DECL_LINK(EditedEntryHdl, const IterString&, bool); + + DECL_LINK(DragBeginHdl, bool&, bool); + + void DeleteSelection(); + std::unique_ptr FindEntry(const FmFilterData* pItem) const; + void Insert(const FmFilterData* pItem, int nPos); + void Remove(FmFilterData const * pItem); + + DECL_LINK(OnRemove, void*, void); + + /** returns the first form item and the selected FilterItems in the vector + @param _rItemList + Is filled inside. + @return + The first form item. + */ + FmFormItem* getSelectedFilterItems(::std::vector& _rItemList); + + /** + * inserts the filter items into the tree model and creates new FilterItems if needed. + * @param _rFilterList + * The items which should be inserted. + * @param _pTargetItems + * The target where to insert the items. + * @param _bCopy + * If the items will not be removed from the model, otherwise they will. + */ + void insertFilterItem(const ::std::vector& _rFilterList,FmFilterItems* _pTargetItems, bool _bCopy); + + bool getPrevEntry(weld::TreeIter& rEntry); + bool getNextEntry(weld::TreeIter& rEntry); +}; + +class FmFilterNavigatorWin final : public SfxDockingWindow, public SfxControllerItem +{ +private: + std::unique_ptr m_xNavigatorTree; + + virtual bool Close() override; + virtual void GetFocus() override; + virtual Size CalcDockingSize( SfxChildAlignment ) override; + virtual SfxChildAlignment CheckAlignment( SfxChildAlignment, SfxChildAlignment ) override; + + using SfxDockingWindow::StateChanged; + +public: + FmFilterNavigatorWin( SfxBindings *pBindings, SfxChildWindow *pMgr, + vcl::Window* pParent ); + virtual ~FmFilterNavigatorWin() override; + virtual void dispose() override; + + void UpdateContent( FmFormShell const * pFormShell ); + void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override; + void FillInfo( SfxChildWinInfo& rInfo ) const override; +}; + +class FmFilterNavigatorWinMgr final : public SfxChildWindow +{ +public: + FmFilterNavigatorWinMgr( vcl::Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, + SfxChildWinInfo *pInfo ); + SFX_DECL_CHILDWINDOW( FmFilterNavigatorWinMgr ); +}; + +} + +#endif // INCLUDED_SVX_SOURCE_INC_FILTNAV_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/findtextfield.hxx b/svx/source/inc/findtextfield.hxx new file mode 100644 index 0000000000..9d15a0d8b4 --- /dev/null +++ b/svx/source/inc/findtextfield.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 +#include +#include + +namespace svt +{ +class AcceleratorExecute; +} + +class FindTextFieldControl final : public InterimItemWindow +{ +public: + FindTextFieldControl(vcl::Window* pParent, css::uno::Reference xFrame, + css::uno::Reference xContext); + + virtual void dispose() override; + + virtual ~FindTextFieldControl() override; + + void Remember_Impl(const OUString& rStr); + void SetTextToSelected_Impl(); + + void connect_changed(const Link& rLink); + + int get_count() const; + OUString get_text(int nIndex) const; + OUString get_active_text() const; + void append_text(const OUString& rText); + +private: + ImplSVEvent* m_nAsyncGetFocusId; + std::unique_ptr m_xWidget; + css::uno::Reference m_xFrame; + css::uno::Reference m_xContext; + std::unique_ptr m_pAcc; + Link m_aChangeHdl; + + DECL_LINK(FocusInHdl, weld::Widget&, void); + DECL_LINK(KeyInputHdl, const KeyEvent&, bool); + DECL_LINK(ActivateHdl, weld::ComboBox&, bool); + DECL_LINK(OnAsyncGetFocus, void*, void); + + void FocusIn(); + void ActivateFind(bool bShift); + + // tdf#154269 - respect FindReplaceRememberedSearches expert option + sal_uInt16 m_nRememberSize; + // tdf#154818 - remember last search string + static OUString m_sRememberedSearchString; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmPropBrw.hxx b/svx/source/inc/fmPropBrw.hxx new file mode 100644 index 0000000000..e5b735c0ee --- /dev/null +++ b/svx/source/inc/fmPropBrw.hxx @@ -0,0 +1,105 @@ +/* -*- 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_SVX_SOURCE_INC_FMPROPBRW_HXX +#define INCLUDED_SVX_SOURCE_INC_FMPROPBRW_HXX + +#include +#include +#include + +#include +#include +#include +#include + + +class FmPropBrwMgr final : public SfxChildWindow +{ +public: + FmPropBrwMgr(vcl::Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, const SfxChildWinInfo *pInfo); + SFX_DECL_CHILDWINDOW(FmPropBrwMgr); +}; + +class SfxBindings; +class FmFormShell; + +class FmPropBrw final : public SfxModelessDialogController, public SfxControllerItem +{ + bool m_bInitialStateChange; + weld::Window* m_pParent; + ImplSVEvent* m_nAsyncGetFocusId; + OUString m_sLastActivePage; + std::unique_ptr m_xDialogBox; + std::unique_ptr m_xContainer; + css::uno::Reference< css::uno::XComponentContext > + m_xInspectorContext; + css::uno::Reference< css::uno::XComponentContext > + m_xORB; + css::uno::Reference< css::frame::XFrame2 > + m_xMeAsFrame; + css::uno::Reference< css::uno::XInterface > + m_xLastKnownDocument; + css::uno::Reference< css::inspection::XObjectInspectorModel > + m_xInspectorModel; + css::uno::Reference< css::frame::XController > + m_xBrowserController; + + virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) override; + virtual void FillInfo( SfxChildWinInfo& rInfo ) const override; + virtual void Close() override; + + DECL_LINK( OnAsyncGetFocus, void*, void ); + + void implSetNewSelection( const InterfaceBag& _rSelection ); + void implDetachController(); + bool implIsReadOnlyModel() const; + OUString getCurrentPage() const; + +public: + FmPropBrw( + const css::uno::Reference< css::uno::XComponentContext >& _xORB, + SfxBindings* pBindings, + SfxChildWindow* pMgr, + weld::Window* pParent, + const SfxChildWinInfo* _pInfo + ); + virtual ~FmPropBrw() override; + +private: + + /** creates the PropertyBrowser (aka ObjectInspector) and plugs it into our frame + + This method ensures that a new component is created every time the XModel which + we're working for changed. This is necessary since this model is part of the + ComponentContext we use to create the ObjectInspector. + */ + void impl_ensurePropertyBrowser_nothrow( FmFormShell* _pFormShell ); + + /** creates a property browser + + After this method returns, m_xBrowserController is not . + + @precond + we don't have an ObjectInspector, yet, i.e. m_xBrowserController is . + */ + void impl_createPropertyBrowser_throw( FmFormShell* _pFormShell ); +}; +#endif // INCLUDED_SVX_SOURCE_INC_FMPROPBRW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmcontrolbordermanager.hxx b/svx/source/inc/fmcontrolbordermanager.hxx new file mode 100644 index 0000000000..e0d96c5577 --- /dev/null +++ b/svx/source/inc/fmcontrolbordermanager.hxx @@ -0,0 +1,231 @@ +/* -*- 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_SVX_SOURCE_INC_FMCONTROLBORDERMANAGER_HXX +#define INCLUDED_SVX_SOURCE_INC_FMCONTROLBORDERMANAGER_HXX + +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace com::sun::star::form::validation { class XValidatableFormComponent; } + +enum class ControlStatus { + NONE = 0x00, + Focused = 0x01, + MouseHover = 0x02, + Invalid = 0x04 +}; +namespace o3tl { + template<> struct typed_flags : is_typed_flags {}; +} + + +namespace svxform +{ + + + struct BorderDescriptor + { + sal_Int16 nBorderType; + Color nBorderColor; + + BorderDescriptor() + :nBorderType( css::awt::VisualEffect::FLAT ) + { + } + }; + + struct UnderlineDescriptor + { + sal_Int16 nUnderlineType; + Color nUnderlineColor; + + UnderlineDescriptor() + :nUnderlineType( css::awt::FontUnderline::NONE ) + { + } + + UnderlineDescriptor( sal_Int16 _nUnderlineType, Color _nUnderlineColor ) + :nUnderlineType( _nUnderlineType ) + ,nUnderlineColor( _nUnderlineColor ) + { + } + }; + + struct ControlData : public BorderDescriptor, UnderlineDescriptor + { + css::uno::Reference< css::awt::XControl > xControl; + OUString sOriginalHelpText; + + ControlData() : BorderDescriptor() { } + ControlData( css::uno::Reference< css::awt::XControl > _xControl ) + :xControl(std::move( _xControl )) + { + } + }; + + + //= ControlBorderManager + + /** manages the dynamic border color for form controls + + Used by the FormController, this class manages the dynamic changes in the + border color of form controls. For this a set of events have to be forwarded to the manager + instance, which then will switch the border color depending on the mouse and focus status + of the controls. + */ + class ControlBorderManager + { + private: + struct ControlDataCompare + { + bool operator()( const ControlData& _rLHS, const ControlData& _rRHS ) const + { + return _rLHS.xControl.get() < _rRHS.xControl.get(); + } + }; + + typedef ::std::set< ControlData, ControlDataCompare > ControlBag; + typedef ::std::set< css::uno::Reference< css::awt::XVclWindowPeer > > PeerBag; + + PeerBag m_aColorableControls; + PeerBag m_aNonColorableControls; + + ControlData m_aFocusControl; + ControlData m_aMouseHoverControl; + ControlBag m_aInvalidControls; + + + // attributes + Color m_nFocusColor; + Color m_nMouseHoveColor; + Color m_nInvalidColor; + bool m_bDynamicBorderColors; + + public: + ControlBorderManager(); + ~ControlBorderManager(); + + public: + void focusGained( const css::uno::Reference< css::uno::XInterface >& _rxControl ); + void focusLost( const css::uno::Reference< css::uno::XInterface >& _rxControl ); + void mouseEntered( const css::uno::Reference< css::uno::XInterface >& _rxControl ); + void mouseExited( const css::uno::Reference< css::uno::XInterface >& _rxControl ); + + void validityChanged( + const css::uno::Reference< css::awt::XControl >& _rxControl, + const css::uno::Reference< css::form::validation::XValidatableFormComponent >& _rxValidatable + ); + + /// enables dynamic border color for the controls + void enableDynamicBorderColor( ); + /// disables dynamic border color for the controls + void disableDynamicBorderColor( ); + + /** sets a color to be used for a given status + @param _nStatus + the status which the color should be applied for. Must not be ControlStatus::NONE + @param _nColor + the color to apply for the given status + */ + void setStatusColor( ControlStatus _nStatus, Color _nColor ); + + /** restores all colors of all controls where we possibly changed them + */ + void restoreAll(); + + private: + /** called when a control got one of the two possible statuses (focused, and hovered with the mouse) + @param _rxControl + the control which gained the status + @param _rControlData + the control's status data, as a reference to our respective member + */ + void controlStatusGained( + const css::uno::Reference< css::uno::XInterface >& _rxControl, + ControlData& _rControlData + ); + + /** called when a control lost one of the two possible statuses (focused, and hovered with the mouse) + @param _rxControl + the control which lost the status + @param _rControlData + the control's status data, as a reference to our respective member + */ + void controlStatusLost( const css::uno::Reference< css::uno::XInterface >& _rxControl, ControlData& _rControlData ); + + /** determines whether the border of a given peer can be colored + @param _rxPeer + the peer to examine. Must not be + */ + bool canColorBorder( const css::uno::Reference< css::awt::XVclWindowPeer >& _rxPeer ); + + /** determines the status of the given control + */ + ControlStatus getControlStatus( const css::uno::Reference< css::awt::XControl >& _rxControl ); + + /** retrieves the color associated with a given ControlStatus + @param _eStatus + the status of the control. Must not be ControlStatus::none + */ + Color getControlColorByStatus( ControlStatus _eStatus ) const; + + /** sets the border color for a given control, depending on its status + @param _rxControl + the control to set the border color for. Must not be + @param _rxPeer + the peer of the control, to be passed herein for optimization the caller usually needs it, anyway). + Must not be + @param _rFallback + the color/type to use when the control has the status ControlStatus::NONE + */ + void updateBorderStyle( + const css::uno::Reference< css::awt::XControl >& _rxControl, + const css::uno::Reference< css::awt::XVclWindowPeer >& _rxPeer, + const BorderDescriptor& _rFallback + ); + + /** determines the to-be-remembered original border color and type for a control + + The method also takes into account that the control may currently have an overwritten + border style + + @param _rxControl + the control to examine. Must not be , and have a non- peer + */ + void determineOriginalBorderStyle( + const css::uno::Reference< css::awt::XControl >& _rxControl, + BorderDescriptor& _rData + ) const; + }; + + +} + + +#endif // INCLUDED_SVX_SOURCE_INC_FMCONTROLBORDERMANAGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmcontrollayout.hxx b/svx/source/inc/fmcontrollayout.hxx new file mode 100644 index 0000000000..f2494d83ef --- /dev/null +++ b/svx/source/inc/fmcontrollayout.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 . + */ + +#ifndef INCLUDED_SVX_SOURCE_INC_FMCONTROLLAYOUT_HXX +#define INCLUDED_SVX_SOURCE_INC_FMCONTROLLAYOUT_HXX + +#include + +#include "fmdocumentclassification.hxx" + + +namespace svxform::ControlLayouter +{ + /** initializes the layout of a newly created form control (model) + */ + void initializeControlLayout( + const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel, + DocumentType _eDocType + ); + + /** determines whether for the given document type, dynamic control border coloring is enabled + */ + bool useDynamicBorderColor( DocumentType _eDocType ); + + /** determines whether for the given document type, form controls should use the document's reference device + for text rendering + */ + bool useDocumentReferenceDevice( DocumentType _eDocType ); + + /** gets the "default" style in a document which can be used if some default text format is needed + + It depends on the type document type which concrete kind of style is returned, but it is expected to support + the css.style.CharacterProperties service. + + @param _rxModel + a form component. + */ + css::uno::Reference< css::beans::XPropertySet > + getDefaultDocumentTextStyle( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ); + +} + + +#endif // INCLUDED_SVX_SOURCE_INC_FMCONTROLLAYOUT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmdocumentclassification.hxx b/svx/source/inc/fmdocumentclassification.hxx new file mode 100644 index 0000000000..e505233481 --- /dev/null +++ b/svx/source/inc/fmdocumentclassification.hxx @@ -0,0 +1,71 @@ +/* -*- 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_SVX_SOURCE_INC_FMDOCUMENTCLASSIFICATION_HXX +#define INCLUDED_SVX_SOURCE_INC_FMDOCUMENTCLASSIFICATION_HXX + +#include + + +namespace svxform +{ + + enum DocumentType + { + eTextDocument, + eWebDocument, + eSpreadsheetDocument, + eDrawingDocument, + ePresentationDocument, + eEnhancedForm, + eDatabaseForm, + eDatabaseReport, + + eUnknownDocumentType + }; + + class DocumentClassification + { + public: + /** classifies a document model + */ + static DocumentType classifyDocument( + const css::uno::Reference< css::frame::XModel >& _rxDocumentModel + ); + + static DocumentType classifyHostDocument( + const css::uno::Reference< css::uno::XInterface >& _rxFormComponent + ); + + static DocumentType getDocumentTypeForModuleIdentifier( + std::u16string_view _rModuleIdentifier + ); + + static OUString getModuleIdentifierForDocumentType( + DocumentType _eType + ); + }; + + +} + + +#endif // INCLUDED_SVX_SOURCE_INC_FMDOCUMENTCLASSIFICATION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmexch.hxx b/svx/source/inc/fmexch.hxx new file mode 100644 index 0000000000..b8878e76d4 --- /dev/null +++ b/svx/source/inc/fmexch.hxx @@ -0,0 +1,243 @@ +/* -*- 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_SVX_SOURCE_INC_FMEXCH_HXX +#define INCLUDED_SVX_SOURCE_INC_FMEXCH_HXX + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace svxform +{ + typedef ::std::set> ListBoxEntrySet; + + //= OLocalExchange + class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) OLocalExchange : public TransferDataContainer + { + private: + Link m_aClipboardListener; + bool m_bDragging : 1; + bool m_bClipboardOwner : 1; + + public: + class GrantAccess + { + friend class OLocalExchangeHelper; + }; + + public: + OLocalExchange( ); + + bool isDragging() const { return m_bDragging; } + bool isClipboardOwner() const { return m_bClipboardOwner; } + + void setDragging(bool bDragging); + SVXCORE_DLLPRIVATE void copyToClipboard(const weld::Widget& rWidget, const GrantAccess&); + + void setClipboardListener( const Link& _rListener ) { m_aClipboardListener = _rListener; } + + SVXCORE_DLLPRIVATE void clear(); + + static bool hasFormat( const DataFlavorExVector& _rFormats, SotClipboardFormatId _nFormatId ); + + protected: + // XClipboardOwner + virtual void SAL_CALL lostOwnership( const css::uno::Reference< css::datatransfer::clipboard::XClipboard >& _rxClipboard, const css::uno::Reference< css::datatransfer::XTransferable >& _rxTrans ) override; + + // TransferableHelper + virtual void DragFinished( sal_Int8 nDropAction ) override; + virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; + + private: + // don't allow this base class method to be called from outside + using TransferDataContainer::StartDrag; + }; + + + //= OLocalExchangeHelper + + /// a helper for navigator windows (SvTreeListBox'es) which allow DnD within themself + class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) OLocalExchangeHelper + { + protected: + rtl::Reference m_xTransferable; + + public: + OLocalExchangeHelper(); + virtual ~OLocalExchangeHelper(); + + void prepareDrag( ); + + SVXCORE_DLLPRIVATE void copyToClipboard(const weld::Widget& rWidget) const; + + bool isDragSource() const { return m_xTransferable.is() && m_xTransferable->isDragging(); } + bool isClipboardOwner() const { return m_xTransferable.is() && m_xTransferable->isClipboardOwner(); } + bool isDataExchangeActive( ) const { return isDragSource() || isClipboardOwner(); } + void clear() { if ( isDataExchangeActive() ) m_xTransferable->clear(); } + + SVX_DLLPRIVATE void setClipboardListener( const Link& _rListener ) { if ( m_xTransferable.is() ) m_xTransferable->setClipboardListener( _rListener ); } + + protected: + SVX_DLLPRIVATE virtual rtl::Reference createExchange() const = 0; + + protected: + SVX_DLLPRIVATE void implReset(); + }; + + class OControlTransferData + { + private: + DataFlavorExVector m_aCurrentFormats; + + protected: + ListBoxEntrySet m_aSelectedEntries; + css::uno::Sequence< css::uno::Sequence< sal_uInt32 > > + m_aControlPaths; + css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > + m_aHiddenControlModels; + + css::uno::Reference< css::form::XForms > + m_xFormsRoot; // the root of the forms collection where the entries we represent reside + // this uniquely identifies the page and the document + + bool m_bFocusEntry; + + protected: + // updates m_aCurrentFormats with all formats we currently could supply + void updateFormats( ); + + public: + OControlTransferData( ); + + // ctor to construct the data from an arbitrary Transferable (usually clipboard data) + OControlTransferData( + const css::uno::Reference< css::datatransfer::XTransferable >& _rxTransferable + ); + + inline const DataFlavorExVector& GetDataFlavorExVector() const; + + void addSelectedEntry(std::unique_ptr xEntry); + void setFocusEntry(bool _bFocusEntry); + + /** notifies the data transfer object that a certain entry has been removed from the owning tree + + In case the removed entry is part of the transfer object's selection, the entry is removed from + the selection. + + @param _pEntry + @return the number of entries remaining in the selection. + */ + size_t onEntryRemoved(const weld::TreeView* pView, const weld::TreeIter* _pEntry); + + void setFormsRoot( + const css::uno::Reference< css::form::XForms >& _rxFormsRoot + ) { m_xFormsRoot = _rxFormsRoot; } + + void buildPathFormat(const weld::TreeView* pTreeBox, const weld::TreeIter* pRoot); + // assembles m_aControlPaths from m_aSelectedEntries + // (it is assumed that the entries are sorted in m_aSelectedEntries with respect to the neighbor relationship) + + + void buildListFromPath(const weld::TreeView* pTreeBox, const weld::TreeIter* pRoot); + // The reverse way: throws everything out of m_aSelectedEntries and rebuilds it using m_aControlPaths + + void addHiddenControlsFormat(const css::uno::Sequence< css::uno::Reference< css::uno::XInterface > >& seqInterfaces); + // adds an SVX_FML_HIDDEN_CONTROLS format and remembers the passed interfaces for it + // (it is NOT checked whether actually only hidden controls are denominated + // by this - the caller must ensure that) + + const ListBoxEntrySet& selected() const { return m_aSelectedEntries; } + const css::uno::Sequence< css::uno::Reference< css::uno::XInterface > >& + hiddenControls() const { return m_aHiddenControlModels; } + + const css::uno::Reference< css::form::XForms >& + getFormsRoot() const { return m_xFormsRoot; } + }; + + + inline const DataFlavorExVector& OControlTransferData::GetDataFlavorExVector() const + { + const_cast< OControlTransferData* >( this )->updateFormats( ); + return m_aCurrentFormats; + } + + class OControlExchange final : public OLocalExchange, public OControlTransferData + { + public: + OControlExchange( ); + + public: + static SotClipboardFormatId getFieldExchangeFormatId( ); + static SotClipboardFormatId getControlPathFormatId( ); + static SotClipboardFormatId getHiddenControlModelsFormatId( ); + + inline static bool hasFieldExchangeFormat( const DataFlavorExVector& _rFormats ); + inline static bool hasControlPathFormat( const DataFlavorExVector& _rFormats ); + inline static bool hasHiddenControlModelsFormat( const DataFlavorExVector& _rFormats ); + + private: + virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; + virtual void AddSupportedFormats() override; + }; + + class OControlExchangeHelper final : public OLocalExchangeHelper + { + public: + OControlExchangeHelper() : OLocalExchangeHelper() { } + + OControlExchange* operator->() const { return static_cast< OControlExchange* >( m_xTransferable.get() ); } + OControlExchange& operator*() const { return *static_cast< OControlExchange* >( m_xTransferable.get() ); } + + private: + virtual rtl::Reference createExchange() const override; + }; + + + inline bool OControlExchange::hasFieldExchangeFormat( const DataFlavorExVector& _rFormats ) + { + return hasFormat( _rFormats, getFieldExchangeFormatId() ); + } + + inline bool OControlExchange::hasControlPathFormat( const DataFlavorExVector& _rFormats ) + { + return hasFormat( _rFormats, getControlPathFormatId() ); + } + + inline bool OControlExchange::hasHiddenControlModelsFormat( const DataFlavorExVector& _rFormats ) + { + return hasFormat( _rFormats, getHiddenControlModelsFormatId() ); + } + + +} + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmexpl.hxx b/svx/source/inc/fmexpl.hxx new file mode 100644 index 0000000000..aae83d41a2 --- /dev/null +++ b/svx/source/inc/fmexpl.hxx @@ -0,0 +1,551 @@ +/* -*- 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_SVX_SOURCE_INC_FMEXPL_HXX +#define INCLUDED_SVX_SOURCE_INC_FMEXPL_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "fmexch.hxx" +#include +#include +#include + +class SdrObjListIter; +class FmFormShell; +class SdrObject; +class FmFormModel; +class FmFormView; +class SdrMarkList; + + +class FmEntryData; +class FmNavInsertedHint final : public SfxHint +{ + FmEntryData* pEntryData; + sal_uInt32 nPos; + +public: + FmNavInsertedHint( FmEntryData* pInsertedEntryData, sal_uInt32 nRelPos ); + virtual ~FmNavInsertedHint() override; + + FmEntryData* GetEntryData() const { return pEntryData; } + sal_uInt32 GetRelPos() const { return nPos; } +}; + + +class FmNavModelReplacedHint final : public SfxHint +{ + FmEntryData* pEntryData; // the data of the entry that has got a new model + +public: + FmNavModelReplacedHint( FmEntryData* pAffectedEntryData ); + virtual ~FmNavModelReplacedHint() override; + + FmEntryData* GetEntryData() const { return pEntryData; } +}; + + +class FmNavRemovedHint final : public SfxHint +{ + FmEntryData* pEntryData; + +public: + FmNavRemovedHint( FmEntryData* pInsertedEntryData ); + virtual ~FmNavRemovedHint() override; + + FmEntryData* GetEntryData() const { return pEntryData; } +}; + + +class FmNavNameChangedHint final : public SfxHint +{ + FmEntryData* pEntryData; + OUString aNewName; + +public: + FmNavNameChangedHint( FmEntryData* pData, OUString aNewName ); + virtual ~FmNavNameChangedHint() override; + + FmEntryData* GetEntryData() const { return pEntryData; } + const OUString& GetNewName() const { return aNewName; } +}; + + +class FmNavClearedHint final : public SfxHint +{ +public: + FmNavClearedHint(); + virtual ~FmNavClearedHint() override; +}; + + +class FmNavViewMarksChanged final : public SfxHint +{ + FmFormView* pView; +public: + FmNavViewMarksChanged(FmFormView* pWhichView) { pView = pWhichView; } + + const FmFormView* GetAffectedView() const { return pView; } +}; + + +class FmEntryDataList; +class FmEntryData +{ +private: + css::uno::Reference< css::uno::XInterface > m_xNormalizedIFace; + css::uno::Reference< css::beans::XPropertySet > m_xProperties; + css::uno::Reference< css::container::XChild > m_xChild; + +protected: + OUString m_aNormalImage; + OUString aText; + + std::unique_ptr + pChildList; + FmEntryData* pParent; + +protected: + void newObject( const css::uno::Reference< css::uno::XInterface >& _rxIFace ); + +public: + + FmEntryData( FmEntryData* pParentData, const css::uno::Reference< css::uno::XInterface >& _rIFace ); + FmEntryData( const FmEntryData& rEntryData ); + virtual ~FmEntryData(); + + void SetText( const OUString& rText ){ aText = rText; } + void SetParent( FmEntryData* pParentData ){ pParent = pParentData; } + + const OUString& GetNormalImage() const { return m_aNormalImage; } + + const OUString& GetText() const { return aText; } + FmEntryData* GetParent() const { return pParent; } + FmEntryDataList* GetChildList() const { return pChildList.get(); } + + virtual bool IsEqualWithoutChildren( FmEntryData* pEntryData ); + virtual std::unique_ptr Clone() = 0; + + // note that the interface returned is normalized, i.e. querying the given XInterface of the object + // for XInterface must return the interface itself. + const css::uno::Reference< css::uno::XInterface >& GetElement() const + { + return m_xNormalizedIFace; + } + + const css::uno::Reference< css::beans::XPropertySet >& GetPropertySet() const + { + return m_xProperties; + } + + const css::uno::Reference< css::container::XChild >& GetChildIFace() const + { + return m_xChild; + } +}; + + +class FmEntryDataList final +{ +private: + std::vector< std::unique_ptr > maEntryDataList; + +public: + FmEntryDataList(); + ~FmEntryDataList(); + + FmEntryData* at( size_t Index ) + { return maEntryDataList.at(Index).get(); } + + size_t size() const { return maEntryDataList.size(); } + void removeNoDelete( FmEntryData* pItem ); + void insert( std::unique_ptr pItem, size_t Index ); + void clear(); +}; + + +// FmNavRequestSelectHint - someone tells the NavigatorTree to select certain entries + +typedef std::set FmEntryDataArray; + +class FmNavRequestSelectHint final : public SfxHint +{ + FmEntryDataArray m_arredToSelect; + bool m_bMixedSelection; +public: + FmNavRequestSelectHint() + : m_bMixedSelection(false) + { + } + + void SetMixedSelection(bool bMixedSelection) { m_bMixedSelection = bMixedSelection; } + bool IsMixedSelection() const { return m_bMixedSelection; } + void AddItem(FmEntryData* pEntry) { m_arredToSelect.insert(pEntry); } + void ClearItems() { m_arredToSelect.clear(); } + FmEntryDataArray& GetItems() { return m_arredToSelect; } +}; + + +class FmFormData final : public FmEntryData +{ + css::uno::Reference< css::form::XForm > m_xForm; + +public: + FmFormData(const css::uno::Reference< css::form::XForm >& _rxForm, FmFormData* _pParent); + FmFormData( const FmFormData& rFormData ); + virtual ~FmFormData() override; + + const css::uno::Reference< css::form::XForm >& GetFormIface() const { return m_xForm; } + + virtual bool IsEqualWithoutChildren( FmEntryData* pEntryData ) override; + virtual std::unique_ptr Clone() override; +}; + + +class FmControlData final : public FmEntryData +{ + css::uno::Reference< css::form::XFormComponent > m_xFormComponent; + + OUString GetImage() const; + +public: + + FmControlData( + const css::uno::Reference< css::form::XFormComponent >& _rxComponent, + FmFormData* _pParent + ); + FmControlData( const FmControlData& rControlData ); + virtual ~FmControlData() override; + + const css::uno::Reference< css::form::XFormComponent >& GetFormComponent() const { return m_xFormComponent; } + virtual bool IsEqualWithoutChildren( FmEntryData* pEntryData ) override; + virtual std::unique_ptr Clone() override; + + void ModelReplaced(const css::uno::Reference< css::form::XFormComponent >& _rxNew); +}; + + +namespace svxform +{ + + + class NavigatorTreeModel; + + class OFormComponentObserver final + :public ::cppu::WeakImplHelper < css::beans::XPropertyChangeListener + , css::container::XContainerListener + > + { + ::svxform::NavigatorTreeModel* m_pNavModel; + sal_uInt32 m_nLocks; + bool m_bCanUndo; + + public: + OFormComponentObserver( ::svxform::NavigatorTreeModel* pModel ); + + // XEventListenerListener + virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; + + // css::beans::XPropertyChangeListener + virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override; + + // css::container::XContainerListener + + virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& rEvent) override; + virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& rEvent) override; + virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& rEvent) override; + + void Lock() { m_nLocks++; } + void UnLock() { m_nLocks--; } + bool IsLocked() const { return m_nLocks != 0; } + bool CanUndo() const { return m_bCanUndo; } + void ReleaseModel() { m_pNavModel = nullptr; } + private: + void Insert(const css::uno::Reference< css::uno::XInterface >& xIface, sal_Int32 nIndex); + void Remove( const css::uno::Reference< css::uno::XInterface >& _rxElement ); + }; + + class NavigatorTreeModel final : public SfxBroadcaster + ,public SfxListener + { + friend class NavigatorTree; + friend class OFormComponentObserver; + + std::unique_ptr + m_pRootList; + FmFormShell* m_pFormShell; + FmFormPage* m_pFormPage; + FmFormModel* m_pFormModel; + rtl::Reference m_pPropChangeList; + + void UpdateContent( const css::uno::Reference< css::form::XForms >& xForms ); + + void InsertForm(const css::uno::Reference< css::form::XForm >& xForm, sal_uInt32 nRelPos); + void RemoveForm(FmFormData const * pFormData); + + void InsertFormComponent(const css::uno::Reference< css::form::XFormComponent >& xComp, sal_uInt32 nRelPos); + void RemoveFormComponent(FmControlData const * pControlData); + void InsertSdrObj(const SdrObject* pSdrObj); + void RemoveSdrObj(const SdrObject* pSdrObj); + + void ReplaceFormComponent(const css::uno::Reference< css::form::XFormComponent >& xOld, const css::uno::Reference< css::form::XFormComponent >& xNew); + + void BroadcastMarkedObjects(const SdrMarkList& mlMarked); + // send a RequestSelectHint with the currently selected objects + bool InsertFormComponent(FmNavRequestSelectHint& rHint, SdrObject* pObject); + // is a helper for previous, manages the ... in SdrObjGroups; + // returns sal_True if the object is a FormComponent (or recursively consists only of such) + + public: + NavigatorTreeModel(); + virtual ~NavigatorTreeModel() override; + + void FillBranch( FmFormData* pParentData ); + void UpdateContent( FmFormShell* pNewShell ); + + void Insert(FmEntryData* pEntryData, sal_uInt32 nRelPos = SAL_MAX_UINT32, + bool bAlterModel = false); + void Remove(FmEntryData* pEntryData, bool bAlterModel = false); + + static bool Rename( FmEntryData* pEntryData, const OUString& rNewText ); + + void Clear(); + void SetModified(); + + css::uno::Reference< css::form::XForms > GetForms() const; + FmFormShell* GetFormShell() const { return m_pFormShell; } + FmFormPage* GetFormPage() const { return m_pFormPage; } + FmEntryData* FindData( const css::uno::Reference< css::uno::XInterface >& xElement, FmEntryDataList* pDataList, bool bRecurs=true ); + FmEntryData* FindData( const OUString& rText, FmFormData const * pParentData, bool bRecurs ); + FmEntryDataList* GetRootList() const { return m_pRootList.get(); } + static css::uno::Reference< css::container::XIndexContainer > GetFormComponents( FmFormData const * pParentFormData ); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + }; + + class NavigatorTree; + + class NavigatorTreeDropTarget final : public DropTargetHelper + { + private: + NavigatorTree& m_rTreeView; + + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; + + public: + NavigatorTreeDropTarget(NavigatorTree& rTreeView); + }; + + typedef std::set> SvLBoxEntrySortedArray; + + class NavigatorTree final : public SfxListener + { + std::unique_ptr m_xTreeView; + NavigatorTreeDropTarget m_aDropTargetHelper; + + enum SELDATA_ITEMS { SDI_DIRTY, SDI_ALL, SDI_NORMALIZED, SDI_NORMALIZED_FORMARK }; + + Timer m_aSynchronizeTimer; + // the meta-data about my current selection + SvLBoxEntrySortedArray m_arrCurrentSelection; + // the entries which, in the view, are currently marked as "cut" (painted semi-transparent) + ListBoxEntrySet m_aCutEntries; + + ::svxform::OControlExchangeHelper m_aControlExchange; + + std::unique_ptr m_pNavModel; + std::unique_ptr m_xRootEntry; + std::unique_ptr m_xEditEntry; + + ImplSVEvent * nEditEvent; + + SELDATA_ITEMS m_sdiState; + + sal_uInt16 m_nSelectLock; + sal_uInt16 m_nFormsSelected; + sal_uInt16 m_nControlsSelected; + sal_uInt16 m_nHiddenControls; // (the number is included in m_nControlsSelected) + + bool m_bDragDataDirty : 1; // ditto + bool m_bPrevSelectionMixed : 1; + bool m_bRootSelected : 1; + bool m_bInitialUpdate : 1; // am I the first time in the UpdateContent? + bool m_bKeyboardCut : 1; + bool m_bEditing : 1; + + FmControlData* NewControl(const OUString& rServiceName, const weld::TreeIter& rParentEntry, bool bEditName); + void NewForm(const weld::TreeIter& rParentEntry); + std::unique_ptr Insert(const FmEntryData* pEntryData, int nRelPos); + void Remove( FmEntryData* pEntryData ); + + + void CollectSelectionData(SELDATA_ITEMS sdiHow); + // Collects the currently selected entries in m_arrCurrentSelection, normalizes the list if requested. + // - SDI_NORMALIZED simply means that all entries that already have a selected ancestor are not collected. + // - SDI_NORMALIZED_FORMARK means that the procedure is the same as for SDI_NORMALIZED, + // but entries whose direct parent is not selected are collected (independent of the + // status of further ancestors). The same applies for forms that are selected, + // regardless of the status of any ancestors. + // For both normalized modes, the m_nFormsSelected, ... contain the correct number, + // even if not all of these entries end up in m_arrCurrentSelection. + // SDI_DIRTY is of course not allowed as a parameter. + + // a single interface for all selected entries + void ShowSelectionProperties(bool bForce = false); + // delete all selected elements + void DeleteSelection(); + + void SynchronizeSelection(FmEntryDataArray& arredToSelect); + // after calling this method, exactly the entries marked in the array are selected + void SynchronizeSelection(); + // makes the same, takes the MarkList of the View + void SynchronizeMarkList(); + // reverse direction of SynchronizeMarkList: selects in the view all controls corresponding to the current selection + + void CollectObjects(FmFormData const * pFormData, bool bDeep, ::std::set< css::uno::Reference< css::form::XFormComponent > >& _rObjects); + + // in the Select I usually update the Marklist of the corresponding view, + // with the following functions I can control the locking of this behavior + void LockSelectionHandling() { ++m_nSelectLock; } + void UnlockSelectionHandling() { --m_nSelectLock; } + bool IsSelectionHandlingLocked() const { return m_nSelectLock>0; } + + bool IsEditingActive() const { return m_bEditing; } + + static bool IsHiddenControl(FmEntryData const * pEntryData); + + DECL_LINK( KeyInputHdl, const KeyEvent&, bool ); + DECL_LINK( PopupMenuHdl, const CommandEvent&, bool ); + + DECL_LINK(EditingEntryHdl, const weld::TreeIter&, bool); + typedef std::pair IterString; + DECL_LINK(EditedEntryHdl, const IterString&, bool); + + DECL_LINK( OnEdit, void*, void ); + + DECL_LINK( OnEntrySelDesel, weld::TreeView&, void ); + DECL_LINK( OnSynchronizeTimer, Timer*, void ); + + DECL_LINK( OnClipboardAction, OLocalExchange&, void ); + + DECL_LINK( DragBeginHdl, bool&, bool ); + + public: + NavigatorTree(std::unique_ptr xTreeView); + virtual ~NavigatorTree() override; + + void Clear(); + void UpdateContent( FmFormShell* pFormShell ); + void MarkViewObj( FmFormData const * pFormData, bool bDeep ); + void MarkViewObj( FmControlData const * pControlData ); + void UnmarkAllViewObj(); + + void GrabFocus() { m_xTreeView->grab_focus(); } + + bool IsFormEntry(const weld::TreeIter& rEntry); + bool IsFormComponentEntry(const weld::TreeIter& rEntry); + + OUString GenerateName( FmEntryData const * pEntryData ); + + NavigatorTreeModel* GetNavModel() const { return m_pNavModel.get(); } + std::unique_ptr FindEntry(FmEntryData* pEntryData); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + weld::TreeView& get_widget() { return *m_xTreeView; } + + sal_Int8 AcceptDrop(const AcceptDropEvent& rEvt); + sal_Int8 ExecuteDrop(const ExecuteDropEvent& rEvt); + + private: + sal_Int8 implAcceptDataTransfer( const DataFlavorExVector& _rFlavors, sal_Int8 _nAction, const weld::TreeIter* _pTargetEntry, bool _bDnD ); + + sal_Int8 implExecuteDataTransfer( const OControlTransferData& _rData, sal_Int8 _nAction, const Point& _rDropPos, bool _bDnD ); + sal_Int8 implExecuteDataTransfer( const OControlTransferData& _rData, sal_Int8 _nAction, const weld::TreeIter* _pTargetEntry, bool _bDnD ); + + // check if a cut, copy, or drag operation can be started in the current situation + bool implAllowExchange( sal_Int8 _nAction, bool* _pHasNonHidden = nullptr ); + // check if a paste with the current clipboard content can be accepted + bool implAcceptPaste( ); + + // fills m_aControlExchange in preparation of a DnD or clipboard operation + bool implPrepareExchange( sal_Int8 _nAction ); + + void ModelHasRemoved(const weld::TreeIter* _pEntry); + + void doPaste(); + void doCopy(); + void doCut(); + + bool doingKeyboardCut( ) const { return m_bKeyboardCut; } + }; + + class NavigatorFrame final : public SfxDockingWindow, public SfxControllerItem + { + private: + std::unique_ptr m_xNavigatorTree; + + virtual bool Close() override; + virtual void GetFocus() override; + virtual Size CalcDockingSize( SfxChildAlignment ) override; + virtual SfxChildAlignment CheckAlignment( SfxChildAlignment, SfxChildAlignment ) override; + + using SfxDockingWindow::StateChanged; + + public: + NavigatorFrame( SfxBindings *pBindings, SfxChildWindow *pMgr, + vcl::Window* pParent ); + virtual ~NavigatorFrame() override; + virtual void dispose() override; + + void UpdateContent( FmFormShell* pFormShell ); + void StateChangedAtToolBoxControl( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) override; + void FillInfo( SfxChildWinInfo& rInfo ) const override; + }; + + class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) NavigatorFrameManager final : public SfxChildWindow + { + public: + SVX_DLLPRIVATE NavigatorFrameManager( vcl::Window *pParent, sal_uInt16 nId, SfxBindings *pBindings, + SfxChildWinInfo *pInfo ); + SFX_DECL_CHILDWINDOW( NavigatorFrameManager ); + }; +} + +#endif // INCLUDED_SVX_SOURCE_INC_FMEXPL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmobj.hxx b/svx/source/inc/fmobj.hxx new file mode 100644 index 0000000000..d19399a737 --- /dev/null +++ b/svx/source/inc/fmobj.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 . + */ +#ifndef INCLUDED_SVX_SOURCE_INC_FMOBJ_HXX +#define INCLUDED_SVX_SOURCE_INC_FMOBJ_HXX + +#include +#include +#include +#include +#include + + +// FmFormObj + +class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) FmFormObj final : public SdrUnoObj +{ + FmFormObj( const FmFormObj& ) = delete; + + css::uno::Sequence< css::script::ScriptEventDescriptor > aEvts; // events of the object + css::uno::Sequence< css::script::ScriptEventDescriptor> m_aEventsHistory; + // valid if and only if m_pEnvironmentHistory != NULL, this are the events which we're set when + // m_pEnvironmentHistory was created + + // information for the control environment is only maintained if an object is not in an + // object list + css::uno::Reference< css::container::XIndexContainer> m_xParent; + css::uno::Reference< css::form::XForms > m_xEnvironmentHistory; + sal_Int32 m_nPos; + + VclPtr m_pLastKnownRefDevice; + // the last ref device we know, as set at the model + // only to be used for comparison with the current ref device! + + // protected destructor + SAL_DLLPRIVATE virtual ~FmFormObj() override; + +public: + FmFormObj( + SdrModel& rSdrModel, + const OUString& rModelName); + FmFormObj(SdrModel& rSdrModel); + // Copy constructor + FmFormObj(SdrModel& rSdrModel, FmFormObj const & rSource); + + SAL_DLLPRIVATE const css::uno::Reference< css::container::XIndexContainer>& + GetOriginalParent() const { return m_xParent; } + SAL_DLLPRIVATE const css::uno::Sequence< css::script::ScriptEventDescriptor >& + GetOriginalEvents() const { return aEvts; } + SAL_DLLPRIVATE sal_Int32 + GetOriginalIndex() const { return m_nPos; } + + SAL_DLLPRIVATE void SetObjEnv( + const css::uno::Reference< css::container::XIndexContainer>& xForm, + const sal_Int32 nIdx, + const css::uno::Sequence< css::script::ScriptEventDescriptor >& rEvts ); + SAL_DLLPRIVATE void ClearObjEnv(); + +public: + // react on page change + virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override; + + SAL_DLLPRIVATE virtual SdrInventor GetObjInventor() const override; + SAL_DLLPRIVATE virtual SdrObjKind GetObjIdentifier() const override; + SAL_DLLPRIVATE virtual void NbcReformatText() override; + + SAL_DLLPRIVATE virtual rtl::Reference CloneSdrObject(SdrModel& rTargetModel) const override; + + SAL_DLLPRIVATE static css::uno::Reference< css::uno::XInterface> ensureModelEnv( + const css::uno::Reference< css::uno::XInterface>& _rSourceContainer, + const css::uno::Reference< css::form::XForms>& _rTopLevelDestContainer); + + /** returns the FmFormObj behind the given SdrObject + + In case the SdrObject *is* a FmFormObject, this is a simple cast. In case the SdrObject + is a virtual object whose referenced object is a FmFormObj, then this referenced + object is returned. In all other cases, NULL is returned. + */ + SAL_DLLPRIVATE static FmFormObj* GetFormObject( SdrObject* _pSdrObject ); + SAL_DLLPRIVATE static const FmFormObj* GetFormObject( const SdrObject* _pSdrObject ); + + SAL_DLLPRIVATE virtual void SetUnoControlModel( const css::uno::Reference< css::awt::XControlModel >& _rxModel ) override; + +private: + SAL_DLLPRIVATE virtual bool EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd ) override; + SAL_DLLPRIVATE virtual void BrkCreate( SdrDragStat& rStat ) override; + + /** isolates the control model from its form component hierarchy, i.e. removes it from + its parent. + */ + SAL_DLLPRIVATE void impl_isolateControlModel_nothrow(); + + /** forwards the reference device of our SdrModel to the control model + */ + SAL_DLLPRIVATE void impl_checkRefDevice_nothrow( bool _force = false ); +}; + + +#endif // _FM_FMOBJ_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmpgeimp.hxx b/svx/source/inc/fmpgeimp.hxx new file mode 100644 index 0000000000..1e2b632071 --- /dev/null +++ b/svx/source/inc/fmpgeimp.hxx @@ -0,0 +1,144 @@ +/* -*- 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_SVX_SOURCE_INC_FMPGEIMP_HXX +#define INCLUDED_SVX_SOURCE_INC_FMPGEIMP_HXX + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +class FmFormObj; +class FmFormPage; +class SdrObject; + + +// FmFormPageImpl +// Listens to all containers to determine when objects have been inserted +// and when they have been removed + + +class FmFormPageImpl final +{ + css::uno::Reference< css::form::XForm > xCurrentForm; + css::uno::Reference< css::form::XForms > m_xForms; + css::uno::WeakReference< css::container::XMap > m_aControlShapeMap; + + FmFormPage& m_rPage; + Link m_aFormsCreationHdl; + + bool m_bFirstActivation; + bool m_bAttemptedFormCreation; + +public: + explicit FmFormPageImpl( FmFormPage& _rPage ); + ~FmFormPageImpl(); + + void initFrom( FmFormPageImpl& i_foreignImpl ); + + // only important for the DesignMode + void setCurForm(const css::uno::Reference< css::form::XForm>& xForm); + css::uno::Reference< css::form::XForm> getDefaultForm(); + + /** finds a place in the form component hierarchy where to insert the given component + + Note that no actual insertion happens, this is the responsibility of the caller (as + the caller might decide on a suitable place where in the returned container the insertion + should happen). + */ + css::uno::Reference< css::form::XForm> findPlaceInFormComponentHierarchy( + const css::uno::Reference< css::form::XFormComponent>& rContent, + const css::uno::Reference< css::sdbc::XDataSource>& rDatabase = css::uno::Reference< css::sdbc::XDataSource>(), + const OUString& rDBTitle = OUString(), + const OUString& rCursorSource = OUString(), + sal_Int32 nCommandType = 0 + ); + + // activation handling + bool hasEverBeenActivated( ) const { return !m_bFirstActivation; } + void setHasBeenActivated( ) { m_bFirstActivation = false; } + + const css::uno::Reference< css::form::XForms>& getForms( bool _bForceCreate = true ); + + void SetFormsCreationHdl( const Link& _rFormsCreationHdl ) { m_aFormsCreationHdl = _rFormsCreationHdl; } + +private: + /** finds a form with a given data source signature + @param rForm + the form to start the search with. This form, including all possible sub forms, + will be examined + @param rDatabase + the data source which to which the found form must be bound + @param rCommand + the desired Command property value of the sought-after form + @param nCommandType + the desired CommandType property value of the sought-after form + */ + css::uno::Reference< css::form::XForm> findFormForDataSource( + const css::uno::Reference< css::form::XForm>& rForm, + const css::uno::Reference< css::sdbc::XDataSource>& rDatabase, + const OUString& rCommand, + sal_Int32 nCommandType + ); + +public: + static OUString setUniqueName(const css::uno::Reference< css::form::XFormComponent>& xFormComponent, const css::uno::Reference< css::form::XForm>& xControls); + + void formObjectInserted( const FmFormObj& _object ); + void formObjectRemoved( const FmFormObj& _object ); + void formModelAssigned( const FmFormObj& _object ); + + /** returns an object mapping from control models to drawing shapes. + */ + UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) css::uno::Reference< css::container::XMap > getControlToShapeMap(); + +private: + /** validates whether xCurrentForm is still valid and to be used + + There are situations where our current form becomes invalid, without us noticing this. Thus, + every method which accesses xCurrentForm should beforehand validate the current + form by calling this method. + + If xCurrentForm is not valid anymore, it is reset to . + + @return + if and only if xCurrentForm is valid. + + @since #i40086# + */ + bool validateCurForm(); + + css::uno::Reference< css::container::XMap > + impl_createControlShapeMap_nothrow(); + + FmFormPageImpl( const FmFormPageImpl& ) = delete; + FmFormPageImpl& operator=( const FmFormPageImpl& ) = delete; +}; + + +#endif // INCLUDED_SVX_SOURCE_INC_FMPGEIMP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmprop.hxx b/svx/source/inc/fmprop.hxx new file mode 100644 index 0000000000..ef0d866ee7 --- /dev/null +++ b/svx/source/inc/fmprop.hxx @@ -0,0 +1,153 @@ +/* -*- 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_SVX_SOURCE_INC_FMPROP_HXX +#define INCLUDED_SVX_SOURCE_INC_FMPROP_HXX + +#include + +// PropertyIds, which have an assignment to a PropertyName, could continue +// to be WhichIds in the future -> Itemset +#define FM_ATTR_START 0 + +#define FM_ATTR_FILTER ( FM_ATTR_START + 1 ) +#define FM_ATTR_FORM_OPERATIONS ( FM_ATTR_START + 2 ) + +inline constexpr OUString FM_PROP_NAME = u"Name"_ustr; +inline constexpr OUString FM_PROP_CLASSID = u"ClassId"_ustr; +inline constexpr OUString FM_PROP_ALIGN = u"Align"_ustr; +inline constexpr OUString FM_PROP_ROWCOUNT = u"RowCount"_ustr; +inline constexpr OUString FM_PROP_ROWCOUNTFINAL = u"IsRowCountFinal"_ustr; +inline constexpr OUString FM_PROP_FETCHSIZE = u"FetchSize"_ustr; +inline constexpr OUString FM_PROP_VALUE = u"Value"_ustr; +inline constexpr OUString FM_PROP_VALUEMIN = u"ValueMin"_ustr; +inline constexpr OUString FM_PROP_VALUEMAX = u"ValueMax"_ustr; +inline constexpr OUString FM_PROP_VALUESTEP = u"ValueStep"_ustr; +inline constexpr OUString FM_PROP_TEXT = u"Text"_ustr; +inline constexpr OUString FM_PROP_LABEL = u"Label"_ustr; +inline constexpr OUString FM_PROP_NAVIGATION = u"NavigationBarMode"_ustr; +inline constexpr OUString FM_PROP_CYCLE = u"Cycle"_ustr; +inline constexpr OUString FM_PROP_CONTROLSOURCE = u"DataField"_ustr; +inline constexpr OUString FM_PROP_ENABLED = u"Enabled"_ustr; +inline constexpr OUString FM_PROP_SPIN = u"Spin"_ustr; +inline constexpr OUString FM_PROP_READONLY = u"ReadOnly"_ustr; +inline constexpr OUString FM_PROP_FILTER = u"Filter"_ustr; +inline constexpr OUString FM_PROP_AUTOINCREMENT = u"IsAutoIncrement"_ustr; +inline constexpr OUString FM_PROP_WIDTH = u"Width"_ustr; +inline constexpr OUString FM_PROP_SEARCHABLE = u"IsSearchable"_ustr; +inline constexpr OUString FM_PROP_MULTILINE = u"MultiLine"_ustr; +inline constexpr OUString FM_PROP_TARGET_URL = u"TargetURL"_ustr; +inline constexpr OUString FM_PROP_DEFAULTCONTROL = u"DefaultControl"_ustr; +inline constexpr OUString FM_PROP_MAXTEXTLEN = u"MaxTextLen"_ustr; +inline constexpr OUString FM_PROP_DATE = u"Date"_ustr; +inline constexpr OUString FM_PROP_TIME = u"Time"_ustr; +inline constexpr OUString FM_PROP_STATE = u"State"_ustr; +inline constexpr OUString FM_PROP_TRISTATE = u"TriState"_ustr; +inline constexpr OUString FM_PROP_STRINGITEMLIST = u"StringItemList"_ustr; +inline constexpr OUString FM_PROP_DEFAULT_TEXT = u"DefaultText"_ustr; +inline constexpr OUString FM_PROP_DEFAULTCHECKED = u"DefaultState"_ustr; +inline constexpr OUString FM_PROP_DEFAULT_DATE = u"DefaultDate"_ustr; +inline constexpr OUString FM_PROP_DEFAULT_TIME = u"DefaultTime"_ustr; +inline constexpr OUString FM_PROP_DEFAULT_VALUE = u"DefaultValue"_ustr; +inline constexpr OUString FM_PROP_FORMATKEY = u"FormatKey"_ustr; +inline constexpr OUString FM_PROP_FORMATSSUPPLIER = u"FormatsSupplier"_ustr; +inline constexpr OUString FM_PROP_LISTSOURCETYPE = u"ListSourceType"_ustr; +inline constexpr OUString FM_PROP_LISTSOURCE = u"ListSource"_ustr; +inline constexpr OUString FM_PROP_SELECT_SEQ = u"SelectedItems"_ustr; +inline constexpr OUString FM_PROP_VALUE_SEQ = u"ValueItemList"_ustr; +inline constexpr OUString FM_PROP_DEFAULT_SELECT_SEQ = u"DefaultSelection"_ustr; +inline constexpr OUString FM_PROP_DECIMAL_ACCURACY = u"DecimalAccuracy"_ustr; +inline constexpr OUString FM_PROP_EDITMASK = u"EditMask"_ustr; +inline constexpr OUString FM_PROP_ISREADONLY = u"IsReadOnly"_ustr; +inline constexpr OUString FM_PROP_FIELDTYPE = u"Type"_ustr; +inline constexpr OUString FM_PROP_REFVALUE = u"RefValue"_ustr; +inline constexpr OUString FM_PROP_STRICTFORMAT = u"StrictFormat"_ustr; +inline constexpr OUString FM_PROP_DATASOURCE = u"DataSourceName"_ustr; +inline constexpr OUString FM_PROP_LITERALMASK = u"LiteralMask"_ustr; +inline constexpr OUString FM_PROP_SHOWTHOUSANDSEP = u"ShowThousandsSeparator"_ustr; +inline constexpr OUString FM_PROP_CURRENCYSYMBOL = u"CurrencySymbol"_ustr; +inline constexpr OUString FM_PROP_DATEFORMAT = u"DateFormat"_ustr; +inline constexpr OUString FM_PROP_DATEMIN = u"DateMin"_ustr; +inline constexpr OUString FM_PROP_DATEMAX = u"DateMax"_ustr; +inline constexpr OUString FM_PROP_DATE_SHOW_CENTURY = u"DateShowCentury"_ustr; +inline constexpr OUString FM_PROP_TIMEFORMAT = u"TimeFormat"_ustr; +inline constexpr OUString FM_PROP_TIMEMIN = u"TimeMin"_ustr; +inline constexpr OUString FM_PROP_TIMEMAX = u"TimeMax"_ustr; +inline constexpr OUString FM_PROP_LINECOUNT = u"LineCount"_ustr; +inline constexpr OUString FM_PROP_BOUNDCOLUMN = u"BoundColumn"_ustr; +#define FM_PROP_HASNAVIGATION "HasNavigationBar" +inline constexpr OUString FM_PROP_FONT = u"FontDescriptor"_ustr; +#define FM_PROP_BACKGROUNDCOLOR "BackgroundColor" +#define FM_PROP_TEXTCOLOR "TextColor" +inline constexpr OUString FM_PROP_BORDER = u"Border"_ustr; +inline constexpr OUString FM_PROP_DROPDOWN = u"Dropdown"_ustr; +inline constexpr OUString FM_PROP_ROWHEIGHT = u"RowHeight"_ustr; +inline constexpr OUString FM_PROP_HELPTEXT = u"HelpText"_ustr; +#define FM_PROP_HELPURL "HelpURL" +#define FM_PROP_RECORDMARKER "HasRecordMarker" +inline constexpr OUString FM_PROP_BOUNDFIELD = u"BoundField"_ustr; +inline constexpr OUString FM_PROP_EFFECTIVE_VALUE = u"EffectiveValue"_ustr; +inline constexpr OUString FM_PROP_EFFECTIVE_DEFAULT = u"EffectiveDefault"_ustr; +inline constexpr OUString FM_PROP_EFFECTIVE_MIN = u"EffectiveMin"_ustr; +inline constexpr OUString FM_PROP_EFFECTIVE_MAX = u"EffectiveMax"_ustr; +inline constexpr OUString FM_PROP_HIDDEN = u"Hidden"_ustr; +inline constexpr OUString FM_PROP_FILTERPROPOSAL = u"UseFilterValueProposal"_ustr; +inline constexpr OUString FM_PROP_FIELDSOURCE = u"FieldSource"_ustr; +inline constexpr OUString FM_PROP_TABLENAME = u"TableName"_ustr; +inline constexpr OUString FM_PROP_CONTROLLABEL = u"LabelControl"_ustr; +inline constexpr OUString FM_PROP_CURSORCOLOR = u"CursorColor"_ustr; +inline constexpr OUString FM_PROP_ALWAYSSHOWCURSOR = u"AlwaysShowCursor"_ustr; +inline constexpr OUString FM_PROP_DISPLAYSYNCHRON = u"DisplayIsSynchron"_ustr; +inline constexpr OUString FM_PROP_ISMODIFIED = u"IsModified"_ustr; +inline constexpr OUString FM_PROP_ISNEW = u"IsNew"_ustr; +inline constexpr OUString FM_PROP_PRIVILEGES = u"Privileges"_ustr; +inline constexpr OUString FM_PROP_COMMAND = u"Command"_ustr; +inline constexpr OUString FM_PROP_COMMANDTYPE = u"CommandType"_ustr; +inline constexpr OUString FM_PROP_RESULTSET_CONCURRENCY = u"ResultSetConcurrency"_ustr; +inline constexpr OUString FM_PROP_INSERTONLY = u"IgnoreResult"_ustr; +inline constexpr OUString FM_PROP_RESULTSET_TYPE = u"ResultSetType"_ustr; +inline constexpr OUString FM_PROP_ESCAPE_PROCESSING = u"EscapeProcessing"_ustr; +inline constexpr OUString FM_PROP_APPLYFILTER = u"ApplyFilter"_ustr; +inline constexpr OUString FM_PROP_ISNULLABLE = u"IsNullable"_ustr; +inline constexpr OUString FM_PROP_ACTIVECOMMAND = u"ActiveCommand"_ustr; +inline constexpr OUString FM_PROP_ISCURRENCY = u"IsCurrency"_ustr; +inline constexpr OUString FM_PROP_URL = u"URL"_ustr; +inline constexpr OUString FM_PROP_ACTIVE_CONNECTION = u"ActiveConnection"_ustr; +inline constexpr OUString FM_PROP_CONTROLSOURCEPROPERTY = u"DataFieldProperty"_ustr; +inline constexpr OUString FM_PROP_REALNAME = u"RealName"_ustr; +inline constexpr OUString FM_PROP_TEXTLINECOLOR = u"TextLineColor"_ustr; +#define FM_PROP_FONTEMPHASISMARK "FontEmphasisMark" +#define FM_PROP_FONTRELIEF "FontRelief" +inline constexpr OUString FM_PROP_ORIENTATION = u"Orientation"_ustr; +inline constexpr OUString FM_PROP_LINEENDFORMAT = u"LineEndFormat"_ustr; +inline constexpr OUString FM_PROP_VISUALEFFECT = u"VisualEffect"_ustr; +inline constexpr OUString FM_PROP_BORDERCOLOR = u"BorderColor"_ustr; +inline constexpr OUString FM_PROP_DYNAMIC_CONTROL_BORDER = u"DynamicControlBorder"_ustr; +inline constexpr OUString FM_PROP_CONTROL_BORDER_COLOR_FOCUS = u"ControlBorderColorOnFocus"_ustr; +inline constexpr OUString FM_PROP_CONTROL_BORDER_COLOR_MOUSE = u"ControlBorderColorOnHover"_ustr; +inline constexpr OUString FM_PROP_CONTROL_BORDER_COLOR_INVALID = u"ControlBorderColorOnInvalid"_ustr; +inline constexpr OUString FM_PROP_BUTTON_TYPE = u"ButtonType"_ustr; +inline constexpr OUString FM_PROP_FORM_OPERATIONS = u"FormOperations"_ustr; +inline constexpr OUString FM_PROP_INPUT_REQUIRED = u"InputRequired"_ustr; +inline constexpr OUString FM_PROP_WRITING_MODE = u"WritingMode"_ustr; +inline constexpr OUString FM_PROP_MOUSE_WHEEL_BEHAVIOR = u"MouseWheelBehavior"_ustr; +inline constexpr OUString FM_PROP_DESCRIPTION = u"Description"_ustr; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmscriptingenv.hxx b/svx/source/inc/fmscriptingenv.hxx new file mode 100644 index 0000000000..0fdbcbc251 --- /dev/null +++ b/svx/source/inc/fmscriptingenv.hxx @@ -0,0 +1,98 @@ +/* -*- 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_SVX_SOURCE_INC_FMSCRIPTINGENV_HXX +#define INCLUDED_SVX_SOURCE_INC_FMSCRIPTINGENV_HXX + +#include +#include +#include +#include + +class FmFormModel; + +namespace svxform +{ + class FormScriptListener; + + //= IFormScriptingEnvironment + + /** describes the interface implemented by a component which handles scripting requirements + in a form/control environment. + */ + class FormScriptingEnvironment final : public ::salhelper::SimpleReferenceObject + { + friend class FormScriptListener; + public: + explicit FormScriptingEnvironment( FmFormModel& _rModel ); + FormScriptingEnvironment(const FormScriptingEnvironment&) = delete; + FormScriptingEnvironment& operator=(const FormScriptingEnvironment&) = delete; + + /** registers an XEventAttacherManager whose events should be monitored and handled + + @param _rxManager + the XEventAttacherManager to monitor. Must not be . + + @throws css::lang::IllegalArgumentException + if _rxManager is + @throws css::lang::DisposedException + if the instance is already disposed + @throws css::uno::RuntimeException + if attaching as script listener to the manager fails with a RuntimeException itself + */ + void registerEventAttacherManager( + const css::uno::Reference< css::script::XEventAttacherManager >& _rxManager ); + + /** registers an XEventAttacherManager whose events should not be monitored and handled anymore + + @param _rxManager + the XEventAttacherManager which was previously registered. Must not ne . + + @throws css::lang::IllegalArgumentException + if _rxManager is + @throws css::lang::DisposedException + if the instance is already disposed + @throws css::uno::RuntimeException + if removing as script listener from the manager fails with a RuntimeException itself + */ + void revokeEventAttacherManager( + const css::uno::Reference< css::script::XEventAttacherManager >& _rxManager ); + + /** disposes the scripting environment instance + */ + void dispose(); + + private: + std::mutex m_aMutex; + rtl::Reference m_pScriptListener; + FmFormModel& m_rFormModel; + bool m_bDisposed; + + void impl_registerOrRevoke_throw( const css::uno::Reference< css::script::XEventAttacherManager >& _rxManager, bool _bRegister ); + // callback for FormScriptListener + void doFireScriptEvent( const css::script::ScriptEvent& _rEvent, css::uno::Any* _pSynchronousResult ); + + }; + +} + + +#endif // INCLUDED_SVX_SOURCE_INC_FMSCRIPTINGENV_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmservs.hxx b/svx/source/inc/fmservs.hxx new file mode 100644 index 0000000000..64e78a52c9 --- /dev/null +++ b/svx/source/inc/fmservs.hxx @@ -0,0 +1,110 @@ +/* -*- 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_SVX_SOURCE_INC_FMSERVS_HXX +#define INCLUDED_SVX_SOURCE_INC_FMSERVS_HXX + +#include + +#include +#include + +namespace com::sun::star::lang { class XMultiServiceFactory; } + +inline constexpr OUString FM_COMPONENT_EDIT = u"stardiv.one.form.component.Edit"_ustr; +inline constexpr OUString FM_COMPONENT_TEXTFIELD = u"stardiv.one.form.component.TextField"_ustr; +inline constexpr OUString FM_COMPONENT_LISTBOX = u"stardiv.one.form.component.ListBox"_ustr; +inline constexpr OUString FM_COMPONENT_COMBOBOX = u"stardiv.one.form.component.ComboBox"_ustr; +inline constexpr OUString FM_COMPONENT_RADIOBUTTON = u"stardiv.one.form.component.RadioButton"_ustr; +inline constexpr OUString FM_COMPONENT_GROUPBOX = u"stardiv.one.form.component.GroupBox"_ustr; +inline constexpr OUString FM_COMPONENT_FIXEDTEXT = u"stardiv.one.form.component.FixedText"_ustr; +inline constexpr OUString FM_COMPONENT_COMMANDBUTTON = u"stardiv.one.form.component.CommandButton"_ustr; +inline constexpr OUString FM_COMPONENT_CHECKBOX = u"stardiv.one.form.component.CheckBox"_ustr; +inline constexpr OUString FM_COMPONENT_GRID = u"stardiv.one.form.component.Grid"_ustr; +inline constexpr OUString FM_COMPONENT_GRIDCONTROL = u"stardiv.one.form.component.GridControl"_ustr; +inline constexpr OUString FM_COMPONENT_IMAGEBUTTON = u"stardiv.one.form.component.ImageButton"_ustr; +inline constexpr OUString FM_COMPONENT_FILECONTROL = u"stardiv.one.form.component.FileControl"_ustr; +inline constexpr OUString FM_COMPONENT_TIMEFIELD = u"stardiv.one.form.component.TimeField"_ustr; +inline constexpr OUString FM_COMPONENT_DATEFIELD = u"stardiv.one.form.component.DateField"_ustr; +inline constexpr OUString FM_COMPONENT_NUMERICFIELD = u"stardiv.one.form.component.NumericField"_ustr; +inline constexpr OUString FM_COMPONENT_CURRENCYFIELD = u"stardiv.one.form.component.CurrencyField"_ustr; +inline constexpr OUString FM_COMPONENT_PATTERNFIELD = u"stardiv.one.form.component.PatternField"_ustr; +inline constexpr OUString FM_COMPONENT_FORMATTEDFIELD = u"stardiv.one.form.component.FormattedField"_ustr; +inline constexpr OUString FM_COMPONENT_HIDDEN = u"stardiv.one.form.component.Hidden"_ustr; +inline constexpr OUString FM_COMPONENT_HIDDENCONTROL = u"stardiv.one.form.component.HiddenControl"_ustr; +inline constexpr OUString FM_COMPONENT_IMAGECONTROL = u"stardiv.one.form.component.ImageControl"_ustr; +inline constexpr OUString FM_CONTROL_GRID = u"stardiv.one.form.control.Grid"_ustr; +inline constexpr OUString FM_CONTROL_GRIDCONTROL = u"stardiv.one.form.control.GridControl"_ustr; +inline constexpr OUString SRV_SDB_CONNECTION = u"com.sun.star.sdb.Connection"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_FORM = u"com.sun.star.form.component.Form"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_TEXTFIELD = u"com.sun.star.form.component.TextField"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_LISTBOX = u"com.sun.star.form.component.ListBox"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_COMBOBOX = u"com.sun.star.form.component.ComboBox"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_RADIOBUTTON = u"com.sun.star.form.component.RadioButton"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_GROUPBOX = u"com.sun.star.form.component.GroupBox"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_FIXEDTEXT = u"com.sun.star.form.component.FixedText"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_COMMANDBUTTON = u"com.sun.star.form.component.CommandButton"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_CHECKBOX = u"com.sun.star.form.component.CheckBox"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_GRIDCONTROL = u"com.sun.star.form.component.GridControl"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_IMAGEBUTTON = u"com.sun.star.form.component.ImageButton"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_FILECONTROL = u"com.sun.star.form.component.FileControl"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_TIMEFIELD = u"com.sun.star.form.component.TimeField"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_DATEFIELD = u"com.sun.star.form.component.DateField"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_NUMERICFIELD = u"com.sun.star.form.component.NumericField"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_CURRENCYFIELD = u"com.sun.star.form.component.CurrencyField"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_PATTERNFIELD = u"com.sun.star.form.component.PatternField"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_HIDDENCONTROL = u"com.sun.star.form.component.HiddenControl"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_IMAGECONTROL = u"com.sun.star.form.component.DatabaseImageControl"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_FORMATTEDFIELD = u"com.sun.star.form.component.FormattedField"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_SCROLLBAR = u"com.sun.star.form.component.ScrollBar"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_SPINBUTTON = u"com.sun.star.form.component.SpinButton"_ustr; +inline constexpr OUString FM_SUN_COMPONENT_NAVIGATIONBAR = u"com.sun.star.form.component.NavigationToolBar"_ustr; +inline constexpr OUString FM_SUN_CONTROL_GRIDCONTROL = u"com.sun.star.form.control.GridControl"_ustr; + +namespace svxform +{ + SVXCORE_DLLPUBLIC void ImplSmartRegisterUnoServices(); + + css::uno::Reference + OAddConditionDialog_Create( + css::uno::Reference const &); + + OUString OAddConditionDialog_GetImplementationName(); + + css::uno::Sequence + OAddConditionDialog_GetSupportedServiceNames(); +} + +/// @throws css::uno::Exception +css::uno::Reference +FmXGridControl_NewInstance_Impl( + css::uno::Reference const &); + +/// @throws css::uno::Exception +css::uno::Reference +FormController_NewInstance_Impl( + css::uno::Reference const &); + +/// @throws css::uno::Exception +css::uno::Reference +LegacyFormController_NewInstance_Impl( + css::uno::Reference const &); + +#endif // INCLUDED_SVX_SOURCE_INC_FMSERVS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmshimp.hxx b/svx/source/inc/fmshimp.hxx new file mode 100644 index 0000000000..7720e5f019 --- /dev/null +++ b/svx/source/inc/fmshimp.hxx @@ -0,0 +1,562 @@ +/* -*- 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_SVX_SOURCE_INC_FMSHIMP_HXX +#define INCLUDED_SVX_SOURCE_INC_FMSHIMP_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include "formcontrolling.hxx" +#include "fmdocumentclassification.hxx" +#include + +#include +#include +#include +#include + +struct ImplSVEvent; + +typedef std::vector< css::uno::Reference< css::form::XForm > > FmFormArray; + +// catch database exceptions if they occur +#define DO_SAFE(statement) try { statement; } catch( const Exception& ) { TOOLS_WARN_EXCEPTION("svx", "unhandled exception (I tried to move a cursor (or something like that).)"); } + +enum class LoopGridsSync { + DISABLE_SYNC = 1, + FORCE_SYNC = 2, + ENABLE_SYNC = 3 +}; +enum class LoopGridsFlags +{ + NONE = 0, + DISABLE_ROCTRLR = 4 +}; +namespace o3tl +{ + template<> struct typed_flags : is_typed_flags {}; +} + + +// flags for controlling the behaviour when calling loadForms +enum class LoadFormsFlags { + Load = 0x0000, // default: simply load + Sync = 0x0000, // default: do in synchronous + Unload = 0x0001, // unload + Async = 0x0002 // do this async +}; +namespace o3tl { + template<> struct typed_flags : is_typed_flags {}; +} + +namespace weld { + class Menu; +} + +// a class iterating through all fields of a form which are bound to a field +// sub forms are ignored, grid columns (where the grid is a direct child of the form) are included +class FmXBoundFormFieldIterator final : public ::comphelper::IndexAccessIterator +{ +public: + FmXBoundFormFieldIterator(const css::uno::Reference< css::uno::XInterface>& _rStartingPoint) : ::comphelper::IndexAccessIterator(_rStartingPoint) { } + +private: + virtual bool ShouldHandleElement(const css::uno::Reference< css::uno::XInterface>& _rElement) override; + virtual bool ShouldStepInto(const css::uno::Reference< css::uno::XInterface>& _rContainer) const override; +}; + +class FmFormPage; +class FmFormPageImpl; + +struct FmLoadAction +{ + FmFormPage* pPage; + ImplSVEvent * nEventId; + LoadFormsFlags nFlags; + + FmLoadAction( FmFormPage* _pPage, LoadFormsFlags _nFlags, ImplSVEvent * _nEventId ) + :pPage( _pPage ), nEventId( _nEventId ), nFlags( _nFlags ) + { + } +}; + + +class SfxViewFrame; +typedef ::cppu::WeakComponentImplHelper< css::beans::XPropertyChangeListener + , css::container::XContainerListener + , css::view::XSelectionChangeListener + , css::form::XFormControllerListener + > FmXFormShell_BD_BASE; + + +class FmXFormShell_Base_Disambiguation : public FmXFormShell_BD_BASE +{ + using css::beans::XPropertyChangeListener::disposing; +protected: + FmXFormShell_Base_Disambiguation( ::osl::Mutex& _rMutex ); + using WeakComponentImplHelperBase::disposing; +}; + + +namespace svx +{ + class FmTextControlShell; +} + + +typedef FmXFormShell_Base_Disambiguation FmXFormShell_BASE; +typedef ::utl::ConfigItem FmXFormShell_CFGBASE; + +struct SdrViewEvent; +class FmFormShell; +class FmFormView; +class FmFormObj; +class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) FmXFormShell final : private cppu::BaseMutex + ,public FmXFormShell_BASE + ,public FmXFormShell_CFGBASE + ,public svx::IControllerFeatureInvalidation +{ + friend class FmFormView; + friend class FmXFormView; + + class SuspendPropertyTracking; + friend class SuspendPropertyTracking; + + // timer for delayed mark + Timer m_aMarkTimer; + std::vector m_arrSearchedControls; + // We enable a permanent cursor for the grid we found a searched text, it's disabled in the next "found" event. + FmFormArray m_aSearchForms; + + struct SAL_DLLPRIVATE InvalidSlotInfo { + sal_uInt16 id; + sal_uInt8 flags; + InvalidSlotInfo(sal_uInt16 slotId, sal_uInt8 flgs) : id(slotId), flags(flgs) {}; + }; + std::vector m_arrInvalidSlots; + // we explicitly switch off the propbrw before leaving the design mode + // this flag tells us if we have to switch it on again when reentering + + css::form::NavigationBarMode m_eNavigate; // kind of navigation + + // since I want to mark an SdrObject when searching for the treatment of the "found", + // I get all relevant objects before yanking up of the search dialog + // (the array is thus only valid during the search process) + std::vector m_arrRelativeGridColumn; + + ImplSVEvent * m_nInvalidationEvent; + ImplSVEvent * m_nActivationEvent; + ::std::queue< FmLoadAction > + m_aLoadingPages; + + FmFormShell* m_pShell; + std::unique_ptr m_pTextShell; + + svx::ControllerFeatures m_aActiveControllerFeatures; + svx::ControllerFeatures m_aNavControllerFeatures; + + // current form, controller + // only available in the alive mode + css::uno::Reference< css::form::runtime::XFormController > m_xActiveController; + css::uno::Reference< css::form::runtime::XFormController > m_xNavigationController; + css::uno::Reference< css::form::XForm > m_xActiveForm; + + // current container of a page + // only available in the design mode + css::uno::Reference< css::container::XIndexAccess> m_xForms; + + // the currently selected objects, as to be displayed in the property browser + InterfaceBag m_aCurrentSelection; + /// the currently selected form, or the form which all currently selected controls belong to, or + css::uno::Reference< css::form::XForm > m_xCurrentForm; + /// the last selection/marking of controls only. Necessary to implement the "Control properties" slot + InterfaceBag m_aLastKnownMarkedControls; + + + // And this is also for the 'found': When I find in GridControls, I need the column, + // but only get the number of the field corresponding to the number of the + // column + , where the offset depends on the position of the GridControl + // in the form. So here is a conversion. + css::uno::Reference< css::awt::XControlModel> m_xLastGridFound; + // the frame we live in + css::uno::Reference< css::frame::XFrame> m_xAttachedFrame; + // Administration of external form views (see the SID_FM_VIEW_AS_GRID-slot) + css::uno::Reference< css::frame::XController > m_xExternalViewController; // the controller for the external form view + css::uno::Reference< css::form::runtime::XFormController > m_xExtViewTriggerController; // the nav controller at the time the external display was triggered + css::uno::Reference< css::sdbc::XResultSet > m_xExternalDisplayedForm; // the form which the external view is based on + + mutable ::svxform::DocumentType + m_eDocumentType; /// the type of document we're living in + sal_Int16 m_nLockSlotInvalidation; + bool m_bHadPropertyBrowserInDesignMode : 1; + + bool m_bTrackProperties : 1; + // should I (or the owner of this impl class) take car of the update of the css::beans::Property-Browser? + + bool m_bUseWizards : 1; + + bool m_bDatabaseBar : 1; // is there a database bar + bool m_bInActivate : 1; // is a controller activated + bool m_bSetFocus : 1; // may the focus be changed over + bool m_bFilterMode : 1; // is a filter currently set to the controls + bool m_bChangingDesignMode:1; // sal_True within SetDesignMode + bool m_bPreparedClose : 1; // for the current modification state of the current form + // PrepareClose had been called and the user denied to save changes + bool m_bFirstActivation : 1; // has the shell ever been activated? + +public: + // attribute access + SAL_DLLPRIVATE const css::uno::Reference< css::frame::XFrame >& + getHostFrame_Lock() const { return m_xAttachedFrame; } + SAL_DLLPRIVATE const css::uno::Reference< css::sdbc::XResultSet >& + getExternallyDisplayedForm_Lock() const { return m_xExternalDisplayedForm; } + + SAL_DLLPRIVATE bool + didPrepareClose_Lock() const { return m_bPreparedClose; } + SAL_DLLPRIVATE void + didPrepareClose_Lock(bool bDid) { m_bPreparedClose = bDid; } + + SAL_DLLPRIVATE FmXFormShell(FmFormShell& _rShell, SfxViewFrame* _pViewFrame); + +private: + SAL_DLLPRIVATE virtual ~FmXFormShell() override; + +// EventListener + SAL_DLLPRIVATE virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; + +// css::container::XContainerListener + SAL_DLLPRIVATE virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& rEvent) override; + SAL_DLLPRIVATE virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& rEvent) override; + SAL_DLLPRIVATE virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& rEvent) override; + +// XSelectionChangeListener + SAL_DLLPRIVATE virtual void SAL_CALL selectionChanged(const css::lang::EventObject& rEvent) override; + +// css::beans::XPropertyChangeListener + SAL_DLLPRIVATE virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override; + +// css::form::XFormControllerListener + SAL_DLLPRIVATE virtual void SAL_CALL formActivated(const css::lang::EventObject& rEvent) override; + SAL_DLLPRIVATE virtual void SAL_CALL formDeactivated(const css::lang::EventObject& rEvent) override; + +// OComponentHelper + SAL_DLLPRIVATE virtual void SAL_CALL disposing() override; + +public: + SAL_DLLPRIVATE void EnableTrackProperties_Lock(bool bEnable) { m_bTrackProperties = bEnable; } + SAL_DLLPRIVATE bool IsTrackPropertiesEnabled_Lock() const { return m_bTrackProperties; } + + // activation handling + SAL_DLLPRIVATE void viewActivated_Lock(FmFormView& _rCurrentView, bool _bSyncAction = false); + SAL_DLLPRIVATE void viewDeactivated_Lock(FmFormView& _rCurrentView, bool _bDeactivateController = true); + + // IControllerFeatureInvalidation + SAL_DLLPRIVATE virtual void invalidateFeatures/*_NoLock*/( const ::std::vector< sal_Int32 >& _rFeatures ) override; + + SAL_DLLPRIVATE void ExecuteTabOrderDialog_Lock( // execute SID_FM_TAB_DIALOG + const css::uno::Reference< css::awt::XTabControllerModel >& _rxForForm + ); + + // stuff + SAL_DLLPRIVATE void AddElement_Lock(const css::uno::Reference< css::uno::XInterface>& Element); + SAL_DLLPRIVATE void RemoveElement_Lock(const css::uno::Reference< css::uno::XInterface>& Element); + + /** updates m_xForms, to be either , if we're in alive mode, or our current page's forms collection, + if in design mode + */ + SAL_DLLPRIVATE void UpdateForms_Lock(bool bInvalidate); + + SAL_DLLPRIVATE void ExecuteSearch_Lock(); // execute SID_FM_SEARCH + SAL_DLLPRIVATE void CreateExternalView_Lock(); // execute SID_FM_VIEW_AS_GRID + + SAL_DLLPRIVATE bool GetY2KState_Lock(sal_uInt16 & n); + SAL_DLLPRIVATE void SetY2KState_Lock(sal_uInt16 n); + +private: + // form handling + /// load or unload the forms on a page + SAL_DLLPRIVATE void loadForms_Lock( FmFormPage* _pPage, const LoadFormsFlags _nBehaviour ); + SAL_DLLPRIVATE void smartControlReset( const css::uno::Reference< css::container::XIndexAccess >& _rxModels ); + + + SAL_DLLPRIVATE void startListening_Lock(); + SAL_DLLPRIVATE void stopListening_Lock(); + + SAL_DLLPRIVATE css::uno::Reference< css::awt::XControl > + impl_getControl_Lock( + const css::uno::Reference< css::awt::XControlModel>& i_rxModel, + const FmFormObj& i_rKnownFormObj + ); + + // collects in strNames the names of all forms + SAL_DLLPRIVATE static void impl_collectFormSearchContexts_nothrow_Lock( + const css::uno::Reference< css::uno::XInterface>& _rxStartingPoint, + std::u16string_view _rCurrentLevelPrefix, + FmFormArray& _out_rForms, + ::std::vector< OUString >& _out_rNames ); + + /** checks whenever the instance is already disposed, if so, this is reported as assertion error (debug + builds only) and is returned. + */ + SAL_DLLPRIVATE bool impl_checkDisposed_Lock() const; + +public: + // method for non design mode (alive mode) + SAL_DLLPRIVATE void setActiveController_Lock(const css::uno::Reference< css::form::runtime::XFormController>& _xController, bool _bNoSaveOldContent = false); + SAL_DLLPRIVATE const css::uno::Reference< css::form::runtime::XFormController>& getActiveController_Lock() const { return m_xActiveController; } + SAL_DLLPRIVATE const css::uno::Reference< css::form::runtime::XFormController>& getActiveInternalController_Lock() const { return m_xActiveController == m_xExternalViewController ? m_xExtViewTriggerController : m_xActiveController; } + SAL_DLLPRIVATE const css::uno::Reference< css::form::XForm>& getActiveForm_Lock() const { return m_xActiveForm; } + SAL_DLLPRIVATE const css::uno::Reference< css::form::runtime::XFormController>& getNavController_Lock() const { return m_xNavigationController; } + + SAL_DLLPRIVATE const svx::ControllerFeatures& getActiveControllerFeatures_Lock() const + { return m_aActiveControllerFeatures; } + SAL_DLLPRIVATE const svx::ControllerFeatures& getNavControllerFeatures_Lock() const + { return m_aNavControllerFeatures.isAssigned() ? m_aNavControllerFeatures : m_aActiveControllerFeatures; } + + /** announces a new "current selection" + @return + if and only if the to-bet-set selection was different from the previous selection + */ + SAL_DLLPRIVATE bool setCurrentSelection_Lock(InterfaceBag&& rSelection); + + /** sets the new selection to the last known marked controls + */ + SAL_DLLPRIVATE bool selectLastMarkedControls_Lock(); + + /** retrieves the current selection + */ + void getCurrentSelection_Lock(InterfaceBag& /* [out] */ _rSelection) const; + + /** sets a new current selection as indicated by a mark list + @return + if and only if the to-bet-set selection was different from the previous selection + */ + SAL_DLLPRIVATE bool setCurrentSelectionFromMark_Lock(const SdrMarkList& rMarkList); + + /// returns the currently selected form, or the form which all currently selected controls belong to, or + SAL_DLLPRIVATE const css::uno::Reference< css::form::XForm >& + getCurrentForm_Lock() const { return m_xCurrentForm; } + SAL_DLLPRIVATE void forgetCurrentForm_Lock(); + /// returns whether the last known marking contained only controls + SAL_DLLPRIVATE bool onlyControlsAreMarked_Lock() const { return !m_aLastKnownMarkedControls.empty(); } + + /// determines whether the current selection consists of exactly the given object + SAL_DLLPRIVATE bool isSolelySelected_Lock( + const css::uno::Reference< css::uno::XInterface >& _rxObject + ); + + /// handles a MouseButtonDown event of the FmFormView + SAL_DLLPRIVATE void handleMouseButtonDown_Lock( const SdrViewEvent& _rViewEvent ); + /// handles the request for showing the "Properties" + SAL_DLLPRIVATE void handleShowPropertiesRequest_Lock(); + + SAL_DLLPRIVATE bool hasForms_Lock() const { return m_xForms.is() && m_xForms->getCount() != 0; } + SAL_DLLPRIVATE bool hasDatabaseBar_Lock() const { return m_bDatabaseBar; } + + SAL_DLLPRIVATE void ShowSelectionProperties_Lock(bool bShow); + SAL_DLLPRIVATE bool IsPropBrwOpen_Lock() const; + + SAL_DLLPRIVATE void DetermineSelection_Lock(const SdrMarkList& rMarkList); + SAL_DLLPRIVATE void SetSelection_Lock(const SdrMarkList& rMarkList); + SAL_DLLPRIVATE void SetSelectionDelayed_Lock(); + + SAL_DLLPRIVATE void SetDesignMode_Lock(bool bDesign); + + SAL_DLLPRIVATE bool GetWizardUsing_Lock() const { return m_bUseWizards; } + SAL_DLLPRIVATE void SetWizardUsing_Lock(bool _bUseThem); + + // setting the filter mode + SAL_DLLPRIVATE bool isInFilterMode_Lock() const { return m_bFilterMode; } + SAL_DLLPRIVATE void startFiltering_Lock(); + SAL_DLLPRIVATE void stopFiltering_Lock(bool bSave); + + // fills rMenu to be a menu that contains all ControlConversion entries + SAL_DLLPRIVATE static void GetConversionMenu_Lock(weld::Menu& rMenu); + + /// checks whether a given control conversion slot can be applied to the current selection + SAL_DLLPRIVATE bool canConvertCurrentSelectionToControl_Lock(std::u16string_view rIdent); + /// enables or disables all conversion slots in a menu, according to the current selection + SAL_DLLPRIVATE void checkControlConversionSlotsForCurrentSelection_Lock(weld::Menu& rMenu); + /// executes a control conversion slot for a given object + SAL_DLLPRIVATE bool executeControlConversionSlot_Lock(const css::uno::Reference< css::form::XFormComponent >& _rxObject, std::u16string_view rIdent); + /** executes a control conversion slot for the current selection + @precond canConvertCurrentSelectionToControl( _nSlotId ) must return + */ + SAL_DLLPRIVATE void executeControlConversionSlot_Lock(std::u16string_view rIdent); + /// checks whether the given slot id denotes a control conversion slot + SAL_DLLPRIVATE static bool isControlConversionSlot(std::u16string_view rIdent); + + SAL_DLLPRIVATE void ExecuteTextAttribute_Lock(SfxRequest& _rReq); + SAL_DLLPRIVATE void GetTextAttributeState_Lock(SfxItemSet& _rSet); + SAL_DLLPRIVATE bool IsActiveControl_Lock(bool _bCountRichTextOnly) const; + SAL_DLLPRIVATE void ForgetActiveControl_Lock(); + SAL_DLLPRIVATE void SetControlActivationHandler_Lock(const Link& _rHdl); + + /// classifies our host document + SAL_DLLPRIVATE ::svxform::DocumentType getDocumentType_Lock() const; + SAL_DLLPRIVATE bool isEnhancedForm_Lock() const; + + /// determines whether our host document is currently read-only + SAL_DLLPRIVATE bool IsReadonlyDoc_Lock() const; + + // Setting the curObject/selObject/curForm is delayed (SetSelectionDelayed). With the + // following functions this can be inquired/enforced. + SAL_DLLPRIVATE inline bool IsSelectionUpdatePending_Lock() const; + SAL_DLLPRIVATE void ForceUpdateSelection_Lock(); + + SAL_DLLPRIVATE css::uno::Reference< css::frame::XModel> getContextDocument_Lock() const; + SAL_DLLPRIVATE css::uno::Reference< css::form::XForm> getInternalForm_Lock(const css::uno::Reference< css::form::XForm>& _xForm) const; + SAL_DLLPRIVATE css::uno::Reference< css::sdbc::XResultSet> getInternalForm_Lock(const css::uno::Reference< css::sdbc::XResultSet>& _xForm) const; + // if the form belongs to the controller (extern) displaying a grid, the according internal form will + // be displayed, _xForm else + + // check if the current control of the active controller has the focus + SAL_DLLPRIVATE bool HasControlFocus_Lock() const; + +private: + DECL_DLLPRIVATE_LINK(OnFoundData_Lock, FmFoundRecordInformation&, void); + DECL_DLLPRIVATE_LINK(OnCanceledNotFound_Lock, FmFoundRecordInformation&, void); + DECL_DLLPRIVATE_LINK(OnSearchContextRequest_Lock, FmSearchContext&, sal_uInt32); + DECL_DLLPRIVATE_LINK(OnTimeOut_Lock, Timer*, void); + DECL_DLLPRIVATE_LINK(OnFirstTimeActivation_Lock, void*, void); + DECL_DLLPRIVATE_LINK(OnFormsCreated_Lock, FmFormPageImpl&, void); + + SAL_DLLPRIVATE void LoopGrids_Lock(LoopGridsSync nSync, LoopGridsFlags nWhat = LoopGridsFlags::NONE); + + // invalidation of slots + SAL_DLLPRIVATE void InvalidateSlot_Lock(sal_Int16 nId, bool bWithId); + SAL_DLLPRIVATE void UpdateSlot_Lock(sal_Int16 nId); + // locking the invalidation - if the internal locking counter goes to 0, all accumulated slots + // are invalidated (asynchronously) + SAL_DLLPRIVATE void LockSlotInvalidation_Lock(bool bLock); + + DECL_DLLPRIVATE_LINK(OnInvalidateSlots_Lock, void*, void); + + SAL_DLLPRIVATE void CloseExternalFormViewer_Lock(); + // closes the task-local beamer displaying a grid view for a form + + // ConfigItem related stuff + SAL_DLLPRIVATE virtual void Notify( const css::uno::Sequence< OUString >& _rPropertyNames) override; + SAL_DLLPRIVATE void implAdjustConfigCache_Lock(); + + SAL_DLLPRIVATE css::uno::Reference< css::awt::XControlContainer > + getControlContainerForView_Lock() const; + + /** finds and sets a default for m_xCurrentForm, if it is currently NULL + */ + SAL_DLLPRIVATE void impl_defaultCurrentForm_nothrow_Lock(); + + /** sets m_xCurrentForm to the provided form, and updates everything which + depends on the current form + */ + SAL_DLLPRIVATE void impl_updateCurrentForm_Lock( const css::uno::Reference< css::form::XForm >& _rxNewCurForm ); + + /** adds or removes ourself as XEventListener at m_xActiveController + */ + SAL_DLLPRIVATE void impl_switchActiveControllerListening_Lock(const bool _bListen); + + /** add an element + */ + SAL_DLLPRIVATE void impl_AddElement_nothrow(const css::uno::Reference< css::uno::XInterface>& Element); + + /** remove an element + */ + SAL_DLLPRIVATE void impl_RemoveElement_nothrow_Lock(const css::uno::Reference< css::uno::XInterface>& Element); + + SAL_DLLPRIVATE virtual void ImplCommit() override; + + // asynchronous cursor actions/navigation slot handling + +public: + /** execute the given form slot +

Warning. Only a small set of slots implemented currently.

+ @param _nSlot + the slot to execute + */ + SAL_DLLPRIVATE void ExecuteFormSlot_Lock(sal_Int32 _nSlot); + + /** determines whether the current form slot is currently enabled + */ + SAL_DLLPRIVATE bool IsFormSlotEnabled( sal_Int32 _nSlot, css::form::runtime::FeatureState* _pCompleteState ) const; + + SAL_DLLPRIVATE static OUString SlotToIdent(sal_uInt16 nSlot); + +private: + DECL_DLLPRIVATE_LINK( OnLoadForms_Lock, void*, void ); +}; + + +inline bool FmXFormShell::IsSelectionUpdatePending_Lock() const +{ + return m_aMarkTimer.IsActive(); +} + + +// = An iterator that, emanating from an interface, looks for an object whose +// = css::beans::Property-Set has a ControlSource and a BoundField property, the +// = latter having a non-NULL value. If the interface itself does not meet this +// = condition, it is tested whether it is a container (that is, has a +// = css::container::XIndexAccess), then it is descended there and the same tried +// = for each element of the container (again possibly with descent). If any +// = object thereby has the required property, the part with the container test +// = for that object is omitted. +// = + +class SearchableControlIterator final : public ::comphelper::IndexAccessIterator +{ + OUString m_sCurrentValue; + // the current value of the ControlSource css::beans::Property + +public: + const OUString& getCurrentValue() const { return m_sCurrentValue; } + + SearchableControlIterator(css::uno::Reference< css::uno::XInterface> const & xStartingPoint); + + virtual bool ShouldHandleElement(const css::uno::Reference< css::uno::XInterface>& rElement) override; + virtual bool ShouldStepInto(const css::uno::Reference< css::uno::XInterface>& xContainer) const override; + virtual void Invalidate() override { IndexAccessIterator::Invalidate(); m_sCurrentValue.clear(); } +}; + +#endif // INCLUDED_SVX_SOURCE_INC_FMSHIMP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmslotinvalidator.hxx b/svx/source/inc/fmslotinvalidator.hxx new file mode 100644 index 0000000000..4027b63fa7 --- /dev/null +++ b/svx/source/inc/fmslotinvalidator.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 . + */ + +#ifndef INCLUDED_SVX_SOURCE_INC_FMSLOTINVALIDATOR_HXX +#define INCLUDED_SVX_SOURCE_INC_FMSLOTINVALIDATOR_HXX + +#include + +namespace svx +{ +typedef sal_uInt16 SfxSlotId; +} + +#endif // INCLUDED_SVX_SOURCE_INC_FMSLOTINVALIDATOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmtextcontroldialogs.hxx b/svx/source/inc/fmtextcontroldialogs.hxx new file mode 100644 index 0000000000..c525f1fd00 --- /dev/null +++ b/svx/source/inc/fmtextcontroldialogs.hxx @@ -0,0 +1,50 @@ +/* -*- 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_SVX_SOURCE_INC_FMTEXTCONTROLDIALOGS_HXX +#define INCLUDED_SVX_SOURCE_INC_FMTEXTCONTROLDIALOGS_HXX + +#include +#include + +namespace svx +{ + + class TextControlCharAttribDialog final : public SfxTabDialogController + { + private: + SvxFontListItem m_aFontList; + + public: + TextControlCharAttribDialog(weld::Window* pParent, const SfxItemSet& rCoreSet, SvxFontListItem aFontList); + + private: + virtual void PageCreated(const OUString& rId, SfxTabPage& _rPage) override; + }; + + class TextControlParaAttribDialog final : public SfxTabDialogController + { + public: + TextControlParaAttribDialog(weld::Window* pParent, const SfxItemSet& rCoreSet); + }; +} + +#endif // INCLUDED_SVX_SOURCE_INC_FMTEXTCONTROLDIALOGS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmtextcontrolfeature.hxx b/svx/source/inc/fmtextcontrolfeature.hxx new file mode 100644 index 0000000000..fb8d64ec55 --- /dev/null +++ b/svx/source/inc/fmtextcontrolfeature.hxx @@ -0,0 +1,92 @@ +/* -*- 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_SVX_SOURCE_INC_FMTEXTCONTROLFEATURE_HXX +#define INCLUDED_SVX_SOURCE_INC_FMTEXTCONTROLFEATURE_HXX + +#include +#include +#include +#include +#include +#include "fmslotinvalidator.hxx" + + +namespace svx +{ + class FmTextControlShell; + + typedef ::cppu::WeakImplHelper < css::frame::XStatusListener + > FmTextControlFeature_Base; + + class FmTextControlFeature final : public FmTextControlFeature_Base + { + private: + css::uno::Reference< css::frame::XDispatch > + m_xDispatcher; + css::util::URL m_aFeatureURL; + css::uno::Any m_aFeatureState; + SfxSlotId m_nSlotId; + FmTextControlShell* m_pInvalidator; + bool m_bFeatureEnabled; + + public: + /** constructs a FmTextControlFeature object + @param _rxDispatcher + the dispatcher which the instance should work with + @param _rFeatureURL + the URL which the instance should be responsible for + */ + FmTextControlFeature( + const css::uno::Reference< css::frame::XDispatch >& _rxDispatcher, + css::util::URL _aFeatureURL, + SfxSlotId _nId, + FmTextControlShell* _pInvalidator + ); + + /// determines whether the feature we're responsible for is currently enabled + bool isFeatureEnabled( ) const { return m_bFeatureEnabled; } + const css::uno::Any& getFeatureState( ) const { return m_aFeatureState; } + + /** dispatches the feature URL to the dispatcher + */ + void dispatch() const; + + /** dispatches the feature URL to the dispatcher, with passing the given arguments + */ + void dispatch( const css::uno::Sequence< css::beans::PropertyValue >& _rArgs ) const; + + /// releases any resources associated with this instance + void dispose(); + + private: + virtual ~FmTextControlFeature() override; + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& State ) override; + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + }; + + +} + + +#endif // INCLUDED_SVX_SOURCE_INC_FMTEXTCONTROLFEATURE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmtextcontrolshell.hxx b/svx/source/inc/fmtextcontrolshell.hxx new file mode 100644 index 0000000000..77ea5c5d2f --- /dev/null +++ b/svx/source/inc/fmtextcontrolshell.hxx @@ -0,0 +1,201 @@ +/* -*- 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_SVX_SOURCE_INC_FMTEXTCONTROLSHELL_HXX +#define INCLUDED_SVX_SOURCE_INC_FMTEXTCONTROLSHELL_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "fmslotinvalidator.hxx" + +#include +#include + +class SfxRequest; +class SfxItemSet; +class SfxAllItemSet; +class SfxBindings; +class SfxViewFrame; +class SfxApplication; + + +namespace svx +{ + + + class FmFocusListenerAdapter; + class FmTextControlFeature; + class FmMouseListenerAdapter; + + class IFocusObserver + { + public: + virtual void focusGained( const css::awt::FocusEvent& _rEvent ) = 0; + virtual void focusLost( const css::awt::FocusEvent& _rEvent ) = 0; + + protected: + ~IFocusObserver() {} + }; + + + //= IFocusObserver + + class IContextRequestObserver + { + public: + virtual void contextMenuRequested() = 0; + + protected: + ~IContextRequestObserver() {} + }; + + class FmTextControlShell final : public IFocusObserver + ,public IContextRequestObserver + { + private: + css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; + css::uno::Reference< css::awt::XControl > m_xActiveControl; + css::uno::Reference< css::awt::XTextComponent > m_xActiveTextComponent; + css::uno::Reference< css::form::runtime::XFormController > m_xActiveController; +#ifndef DONT_REMEMBER_LAST_CONTROL + // without this define, m_xActiveControl remembers the *last* active control, even + // if it, in the meantime, already lost the focus + bool m_bActiveControl; + // so we need an additional boolean flag telling whether the active control + // is really focused +#endif + bool m_bActiveControlIsReadOnly; + bool m_bActiveControlIsRichText; + + // listening at all controls of the active controller for focus changes + typedef rtl::Reference FocusListenerAdapter; + typedef ::std::vector< FocusListenerAdapter > FocusListenerAdapters; + FocusListenerAdapters m_aControlObservers; + + typedef rtl::Reference MouseListenerAdapter; + MouseListenerAdapter m_aContextMenuObserver; + + // translating between "slots" of the framework and "features" of the active control + typedef rtl::Reference ControlFeature; + typedef ::std::map< SfxSlotId, ControlFeature > ControlFeatures; + ControlFeatures m_aControlFeatures; + + SfxViewFrame* m_pViewFrame; + // invalidating slots + SfxBindings& m_rBindings; + Link m_aControlActivationHandler; + AutoTimer m_aClipboardInvalidation; + bool m_bNeedClipboardInvalidation; + + public: + FmTextControlShell( SfxViewFrame* _pFrame ); + virtual ~FmTextControlShell(); + + // clean up any resources associated with this instance + void dispose(); + + void ExecuteTextAttribute( SfxRequest& _rReq ); + void GetTextAttributeState( SfxItemSet& _rSet ); + bool IsActiveControl( bool _bCountRichTextOnly = false ) const; + void ForgetActiveControl(); + void SetControlActivationHandler( const Link& _rHdl ) { m_aControlActivationHandler = _rHdl; } + + /** to be called when a form in our document has been activated + */ + void formActivated( const css::uno::Reference< css::form::runtime::XFormController >& _rxController ); + /** to be called when a form in our document has been deactivated + */ + void formDeactivated( const css::uno::Reference< css::form::runtime::XFormController >& _rxController ); + + /** notifies the instance that the design mode has changed + */ + void designModeChanged(); + + void Invalidate( SfxSlotId _nSlot ); + + private: + // IFocusObserver + virtual void focusGained( const css::awt::FocusEvent& _rEvent ) override; + virtual void focusLost( const css::awt::FocusEvent& _rEvent ) override; + + // IContextRequestObserver + virtual void contextMenuRequested() override; + + enum AttributeSet { eCharAttribs, eParaAttribs }; + void executeAttributeDialog( AttributeSet _eSet, SfxRequest& _rReq ); + void executeSelectAll( ); + void executeClipboardSlot( SfxSlotId _nSlot ); + + bool isControllerListening() const { return !m_aControlObservers.empty(); } + + rtl::Reference + implGetFeatureDispatcher( + const css::uno::Reference< css::frame::XDispatchProvider >& _rxProvider, + SfxApplication const * _pApplication, + SfxSlotId _nSlot + ); + + // fills the given structure with dispatchers for the given slots, for the given control + void fillFeatureDispatchers( + const css::uno::Reference< css::awt::XControl >& _rxControl, + SfxSlotId* _pZeroTerminatedSlots, + ControlFeatures& _rDispatchers + ); + + /// creates SfxPoolItes for all features in the given set, and puts them into the given SfxAllItemSet + static void transferFeatureStatesToItemSet( + ControlFeatures& _rDispatchers, + SfxAllItemSet& _rSet, + bool _bTranslateLatin + ); + + /// to be called when a control has been activated + void controlActivated( const css::uno::Reference< css::awt::XControl >& _rxControl ); + /// to be called when the currently active control has been deactivated + void controlDeactivated( ); + + void implClearActiveControlRef(); + + /** starts listening at all controls of the given controller for focus events + @precond + we don't have an active controller currently + */ + void startControllerListening( const css::uno::Reference< css::form::runtime::XFormController >& _rxController ); + /** stops listening at the active controller + @precond + we have an active controller currently + */ + void stopControllerListening( ); + + DECL_LINK( OnInvalidateClipboard, Timer*, void ); + }; + + +} + + +#endif // INCLUDED_SVX_SOURCE_INC_FMTEXTCONTROLSHELL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmundo.hxx b/svx/source/inc/fmundo.hxx new file mode 100644 index 0000000000..f0e691fe67 --- /dev/null +++ b/svx/source/inc/fmundo.hxx @@ -0,0 +1,202 @@ +/* -*- 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_SVX_SOURCE_INC_FMUNDO_HXX +#define INCLUDED_SVX_SOURCE_INC_FMUNDO_HXX + +#include +#include +#include "fmscriptingenv.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include +#include + +class FmFormModel; +class FmFormObj; +class SdrObject; +struct PropertySetInfo; + +class FmUndoPropertyAction final : public SdrUndoAction +{ + css::uno::Reference< css::beans::XPropertySet> xObj; + OUString aPropertyName; + css::uno::Any aNewValue; + css::uno::Any aOldValue; + +public: + FmUndoPropertyAction(FmFormModel& rMod, const css::beans::PropertyChangeEvent& evt); + + virtual void Undo() override; + virtual void Redo() override; + + virtual OUString GetComment() const override; + +}; + +class FmUndoContainerAction final : public SdrUndoAction +{ +public: + enum Action + { + Inserted = 1, + Removed = 2 + }; + + FmUndoContainerAction(FmFormModel& rMod, + Action _eAction, + const css::uno::Reference< css::container::XIndexContainer >& xCont, + const css::uno::Reference< css::uno::XInterface >& xElem, + sal_Int32 nIdx); + virtual ~FmUndoContainerAction() override; + + virtual void Undo() override; + virtual void Redo() override; + + static void DisposeElement( const css::uno::Reference< css::uno::XInterface >& xElem ); + +private: + void implReInsert( ); + void implReRemove( ); + + css::uno::Reference< css::container::XIndexContainer > + m_xContainer; // container which the action applies to + css::uno::Reference< css::uno::XInterface > + m_xElement; // object not owned by the action + css::uno::Reference< css::uno::XInterface > + m_xOwnElement; // object owned by the action + sal_Int32 m_nIndex; // index of the object within its container + css::uno::Sequence< css::script::ScriptEventDescriptor > + m_aEvents; // events of the object + Action m_eAction; +}; + +class FmUndoModelReplaceAction final : public SdrUndoAction +{ + css::uno::Reference< css::awt::XControlModel> m_xReplaced; + SdrUnoObj* m_pObject; + +public: + FmUndoModelReplaceAction(FmFormModel& rMod, SdrUnoObj* pObject, const css::uno::Reference< css::awt::XControlModel>& xReplaced); + virtual ~FmUndoModelReplaceAction() override; + + virtual void Undo() override; + virtual void Redo() override { Undo(); } + + virtual OUString GetComment() const override; + + static void DisposeElement( const css::uno::Reference< css::awt::XControlModel>& xReplaced ); +}; + +typedef std::map, PropertySetInfo> PropertySetInfoCache; + +class FmXUndoEnvironment final + : public ::cppu::WeakImplHelper< css::beans::XPropertyChangeListener + , css::container::XContainerListener + , css::util::XModifyListener + > + , public SfxListener +{ +public: + FmXUndoEnvironment(FmFormModel& _rModel); + virtual ~FmXUndoEnvironment() override; + + // UNO binding + // SMART_UNO_DECLARATION(FmXUndoEnvironment, ::cppu::OWeakObject); + // virtual sal_Bool queryInterface(UsrUik, css::uno::Reference< css::uno::XInterface>&); + // virtual css::uno::Sequence< css::uno::Reference< css::reflection::XIdlClass>> getIdlClasses(); + + void Lock() { osl_atomic_increment( &m_Locks ); } + void UnLock() { osl_atomic_decrement( &m_Locks ); } + bool IsLocked() const { return m_Locks != 0; } + + // access control + struct Accessor { friend class FmFormModel; private: Accessor() { } }; + + // addition and removal of form collections + void AddForms( const css::uno::Reference< css::container::XNameContainer>& rForms ); + void RemoveForms( const css::uno::Reference< css::container::XNameContainer>& rForms ); + + // readonly-ness + void SetReadOnly( bool bRead, const Accessor& ) { bReadOnly = bRead; } + bool IsReadOnly() const {return bReadOnly;} + + // Methods for assigning controls to forms, + // used by the page and the undo environment + void Inserted(SdrObject* pObj); + void Removed(SdrObject* pObj); + + static void Inserted(FmFormObj* pObj); + static void Removed(FmFormObj* pObj); + +private: + // XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; + + // XPropertyChangeListener + virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override; + + // XContainerListener + virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& rEvent) override; + virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& rEvent) override; + virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& rEvent) override; + + // XModifyListener + virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; + + void ModeChanged(); + void dispose(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + + void AddElement(const css::uno::Reference< css::uno::XInterface>& Element); + void RemoveElement(const css::uno::Reference< css::uno::XInterface>& Element); + void TogglePropertyListening(const css::uno::Reference< css::uno::XInterface>& Element); + + void implSetModified(); + + void switchListening( const css::uno::Reference< css::container::XIndexContainer >& _rxContainer, bool _bStartListening ); + void switchListening( const css::uno::Reference< css::uno::XInterface >& _rxObject, bool _bStartListening ); + + FmFormModel& rModel; + std::unique_ptr m_pPropertySetCache; + ::rtl::Reference m_pScriptingEnv; + oslInterlockedCount m_Locks; + ::osl::Mutex m_aMutex; + bool bReadOnly; + bool m_bDisposed; + css::uno::Reference< css::script::XScriptListener > m_vbaListener; +}; + + +#endif // INCLUDED_SVX_SOURCE_INC_FMUNDO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmurl.hxx b/svx/source/inc/fmurl.hxx new file mode 100644 index 0000000000..e6d512a729 --- /dev/null +++ b/svx/source/inc/fmurl.hxx @@ -0,0 +1,55 @@ +/* -*- 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_SVX_SOURCE_INC_FMURL_HXX +#define INCLUDED_SVX_SOURCE_INC_FMURL_HXX + +#include + +inline constexpr OUString FMURL_FORM_POSITION = u".uno:FormController/positionForm"_ustr; +inline constexpr OUString FMURL_FORM_RECORDCOUNT = u".uno:FormController/RecordCount"_ustr; +inline constexpr OUString FMURL_RECORD_MOVEFIRST = u".uno:FormController/moveToFirst"_ustr; +inline constexpr OUString FMURL_RECORD_MOVEPREV = u".uno:FormController/moveToPrev"_ustr; +inline constexpr OUString FMURL_RECORD_MOVENEXT = u".uno:FormController/moveToNext"_ustr; +inline constexpr OUString FMURL_RECORD_MOVELAST = u".uno:FormController/moveToLast"_ustr; +inline constexpr OUString FMURL_RECORD_MOVETONEW = u".uno:FormController/moveToNew"_ustr; +inline constexpr OUString FMURL_RECORD_UNDO = u".uno:FormController/undoRecord"_ustr; +inline constexpr OUString FMURL_RECORD_SAVE = u".uno:FormController/saveRecord"_ustr; +inline constexpr OUString FMURL_RECORD_DELETE = u".uno:FormController/deleteRecord"_ustr; +inline constexpr OUString FMURL_FORM_REFRESH = u".uno:FormController/refreshForm"_ustr; +inline constexpr OUString FMURL_FORM_REFRESH_CURRENT_CONTROL = u".uno:FormController/refreshCurrentControl"_ustr; +inline constexpr OUString FMURL_FORM_SORT_UP = u".uno:FormController/sortUp"_ustr; +inline constexpr OUString FMURL_FORM_SORT_DOWN = u".uno:FormController/sortDown"_ustr; +inline constexpr OUString FMURL_FORM_SORT = u".uno:FormController/sort"_ustr; +inline constexpr OUString FMURL_FORM_AUTO_FILTER = u".uno:FormController/autoFilter"_ustr; +inline constexpr OUString FMURL_FORM_FILTER = u".uno:FormController/filter"_ustr; +inline constexpr OUString FMURL_FORM_APPLY_FILTER = u".uno:FormController/applyFilter"_ustr; +inline constexpr OUString FMURL_FORM_REMOVE_FILTER = u".uno:FormController/removeFilterOrder"_ustr; +inline constexpr OUString FMURL_CONFIRM_DELETION = u".uno:FormSlots/ConfirmDeletion"_ustr; +inline constexpr OUString FMURL_COMPONENT_FORMGRIDVIEW = u".component:DB/FormGridView"_ustr; +inline constexpr OUString FMURL_GRIDVIEW_CLEARVIEW = u".uno:FormSlots/ClearView"_ustr; +inline constexpr OUString FMURL_GRIDVIEW_ADDCOLUMN = u".uno:FormSlots/AddGridColumn"_ustr; +inline constexpr OUString FMURL_GRIDVIEW_ATTACHTOFORM = u".uno:FormSlots/AttachToForm"_ustr; +inline constexpr OUString FMARG_ATTACHTO_MASTERFORM = u"MasterForm"_ustr; +inline constexpr OUString FMARG_ADDCOL_COLUMNTYPE = u"ColumnType"_ustr; +inline constexpr OUString FMARG_ADDCOL_COLUMNPOS = u"ColumnPosition"_ustr; + +#endif // INCLUDED_SVX_SOURCE_INC_FMURL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/fmvwimp.hxx b/svx/source/inc/fmvwimp.hxx new file mode 100644 index 0000000000..16c156d9a6 --- /dev/null +++ b/svx/source/inc/fmvwimp.hxx @@ -0,0 +1,302 @@ +/* -*- 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_SVX_SOURCE_INC_FMVWIMP_HXX +#define INCLUDED_SVX_SOURCE_INC_FMVWIMP_HXX + +#include + +#include +#include +#include +#include + +#include +#include +#include "fmdocumentclassification.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +class SdrPageWindow; + +class SdrObject; +class FmFormObj; +class FmFormModel; +class FmFormView; +class FmFormShell; +namespace vcl { class Window; } +class OutputDevice; +class SdrUnoObj; +struct ImplSVEvent; +enum class SdrInventor : sal_uInt32; + +namespace com::sun::star { + namespace awt { + class XControl; + class XWindow; + } + namespace beans { + class XPropertySet; + } + namespace util { + class XNumberFormats; + } +} + +class FmXFormView; + +namespace svx { + class ODataAccessDescriptor; + struct OXFormsDescriptor; +} + + +// FormViewPageWindowAdapter + +typedef ::cppu::WeakImplHelper < css::container::XIndexAccess + , css::form::runtime::XFormControllerContext + > FormViewPageWindowAdapter_Base; + +class FormViewPageWindowAdapter final : public FormViewPageWindowAdapter_Base +{ + friend class FmXFormView; + + ::std::vector< css::uno::Reference< css::form::runtime::XFormController > > m_aControllerList; + css::uno::Reference< css::awt::XControlContainer > m_xControlContainer; + css::uno::Reference m_xContext; + FmXFormView* m_pViewImpl; + VclPtr m_pWindow; + +public: + FormViewPageWindowAdapter( css::uno::Reference _xContext, + const SdrPageWindow&, FmXFormView* pView); + //const SdrPageViewWinRec*, FmXFormView* pView); + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override; + + // XFormControllerContext + virtual void SAL_CALL makeVisible( const css::uno::Reference< css::awt::XControl >& Control ) override; + + const ::std::vector< css::uno::Reference< css::form::runtime::XFormController > >& GetList() const {return m_aControllerList;} + +private: + virtual ~FormViewPageWindowAdapter() override; + + css::uno::Reference< css::form::runtime::XFormController > getController( const css::uno::Reference< css::form::XForm >& xForm ) const; + void setController( + const css::uno::Reference< css::form::XForm >& xForm, + const css::uno::Reference< css::form::runtime::XFormController >& _rxParentController ); + const css::uno::Reference< css::awt::XControlContainer >& getControlContainer() const { return m_xControlContainer; } + void updateTabOrder( const css::uno::Reference< css::form::XForm >& _rxForm ); + void dispose(); + vcl::Window* getWindow() const {return m_pWindow;} +}; + +class SdrModel; + +class FmXFormView final : public ::cppu::WeakImplHelper< + css::form::XFormControllerListener, + css::awt::XFocusListener, + css::container::XContainerListener> +{ + friend class FmFormView; + friend class FmFormShell; + friend class FmXFormShell; + friend class FormViewPageWindowAdapter; + class ObjectRemoveListener; + friend class ObjectRemoveListener; + + css::uno::Reference< css::awt::XWindow> m_xWindow; + css::uno::Reference< css::beans::XPropertySet > m_xLastCreatedControlModel; + + FmFormObj* m_pMarkedGrid; + FmFormView* m_pView; + ImplSVEvent * m_nActivationEvent; + ImplSVEvent * m_nErrorMessageEvent; // event for an asynchronous error message. See also m_aAsyncError + ImplSVEvent * m_nAutoFocusEvent; // event for asynchronously setting the focus to a control + ImplSVEvent * m_nControlWizardEvent; // event for asynchronously setting the focus to a control + + css::sdb::SQLErrorEvent + m_aAsyncError; // error event which is to be displayed asyn. See m_nErrorMessageEvent. + + std::vector< rtl::Reference< FormViewPageWindowAdapter > > + m_aPageWindowAdapters; // to be filled in alive mode only + typedef ::std::set< css::uno::Reference< css::form::XForm > > SetOfForms; + std::map< css::uno::Reference< css::awt::XControlContainer >, SetOfForms > + m_aNeedTabOrderUpdate; // map control container to set of forms + + // list of selected objects, used for restoration when switching from Alive to DesignMode + SdrMarkList m_aMark; + std::unique_ptr + m_pWatchStoredList; + + bool m_bFirstActivation; + bool m_isTabOrderUpdateSuspended; + + FmFormShell* GetFormShell() const; + + css::uno::Reference GetParentWindow() const; + + FmXFormView( FmFormView* _pView ); + virtual ~FmXFormView() override; + + void saveMarkList(); + void restoreMarkList( SdrMarkList& _rRestoredMarkList ); + void stopMarkListWatching(); + void startMarkListWatching(); + + void notifyViewDying( ); + // notifies this impl class that the anti-impl instance (m_pView) is going to die + +public: + // UNO binding + +// css::lang::XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; + +// css::container::XContainerListener + virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& rEvent) override; + virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& rEvent) override; + virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& rEvent) override; + +// css::form::XFormControllerListener + virtual void SAL_CALL formActivated(const css::lang::EventObject& rEvent) override; + virtual void SAL_CALL formDeactivated(const css::lang::EventObject& rEvent) override; + + // XFocusListener + virtual void SAL_CALL focusGained( const css::awt::FocusEvent& e ) override; + virtual void SAL_CALL focusLost( const css::awt::FocusEvent& e ) override; + + FmFormView* getView() const {return m_pView;} + rtl::Reference< FormViewPageWindowAdapter > findWindow( const css::uno::Reference< css::awt::XControlContainer >& _rxCC ) const; + + css::uno::Reference< css::form::runtime::XFormController > + getFormController( const css::uno::Reference< css::form::XForm >& _rxForm, const OutputDevice& _rDevice ) const; + + // activation handling + bool hasEverBeenActivated( ) const { return !m_bFirstActivation; } + void setHasBeenActivated( ) { m_bFirstActivation = false; } + + void onFirstViewActivation( const FmFormModel* _pDocModel ); + + /** suspends the calls to activateTabOrder, which normally happen whenever for any ControlContainer of the view, + new controls are inserted. Cannot be nested, i.e. you need to call resumeTabOrderUpdate before calling + suspendTabOrderUpdate, again. + */ + void suspendTabOrderUpdate(); + + /** resumes calls to activateTabOrder, and also does all pending calls which were collected since the last + suspendTabOrderUpdate call. + */ + void resumeTabOrderUpdate(); + + void onCreatedFormObject( FmFormObj const & _rFormObject ); + + void breakCreateFormObject(); + + static bool + isFocusable( const css::uno::Reference< css::awt::XControl >& i_rControl ); + +private: + //void addWindow(const SdrPageViewWinRec*); + void addWindow(const SdrPageWindow&); + void removeWindow( const css::uno::Reference< css::awt::XControlContainer >& _rxCC ); + void Activate(bool bSync = false); + void Deactivate(bool bDeactivateController = true); + + rtl::Reference implCreateFieldControl( const svx::ODataAccessDescriptor& _rColumnDescriptor ); + rtl::Reference implCreateXFormsControl( const svx::OXFormsDescriptor &_rDesc ); + + static bool createControlLabelPair( + OutputDevice const & _rOutDev, + sal_Int32 _nXOffsetMM, + sal_Int32 _nYOffsetMM, + const css::uno::Reference< css::beans::XPropertySet >& _rxField, + const css::uno::Reference< css::util::XNumberFormats >& _rxNumberFormats, + SdrObjKind _nControlObjectID, + std::u16string_view _rFieldPostfix, + SdrInventor _nInventor, + SdrObjKind _nLabelObjectID, + + // tdf#118963 Need a SdrModel for SdrObject creation. To make the + // demand clear, hand over a SdrMldel& + SdrModel& _rModel, + + rtl::Reference& _rpLabel, + rtl::Reference& _rpControl + ); + + bool createControlLabelPair( + OutputDevice const & _rOutDev, + sal_Int32 _nXOffsetMM, + sal_Int32 _nYOffsetMM, + const css::uno::Reference< css::beans::XPropertySet >& _rxField, + const css::uno::Reference< css::util::XNumberFormats >& _rxNumberFormats, + SdrObjKind _nControlObjectID, + std::u16string_view _rFieldPostfix, + rtl::Reference& _rpLabel, + rtl::Reference& _rpControl, + const css::uno::Reference< css::sdbc::XDataSource >& _rxDataSource, + const OUString& _rDataSourceName, + const OUString& _rCommand, + const sal_Int32 _nCommandType + ); + + void ObjectRemovedInAliveMode(const SdrObject* pObject); + + // asynchronously displays an error message. See also OnDelayedErrorMessage. + void displayAsyncErrorMessage( const css::sdb::SQLErrorEvent& _rEvent ); + + // cancels all pending async events + void cancelEvents(); + + /// the auto focus to the first (in terms of the tab order) control + void AutoFocus(); + DECL_LINK( OnActivate, void*, void ); + DECL_LINK( OnAutoFocus, void*, void ); + DECL_LINK( OnDelayedErrorMessage, void*, void ); + DECL_LINK( OnStartControlWizard, void*, void ); + +private: + ::svxform::DocumentType impl_getDocumentType() const; +}; + + +#endif // INCLUDED_SVX_SOURCE_INC_FMVWIMP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/formcontrolfactory.hxx b/svx/source/inc/formcontrolfactory.hxx new file mode 100644 index 0000000000..a95c510958 --- /dev/null +++ b/svx/source/inc/formcontrolfactory.hxx @@ -0,0 +1,107 @@ +/* -*- 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_SVX_SOURCE_INC_FORMCONTROLFACTORY_HXX +#define INCLUDED_SVX_SOURCE_INC_FORMCONTROLFACTORY_HXX + +#include "fmdocumentclassification.hxx" + +#include +#include +#include +#include +#include + +#include + +class SdrUnoObj; +namespace tools { class Rectangle; } + +namespace comphelper { + class ComponentContext; +} + + +namespace svxform +{ + + class FormControlFactory + { + public: + FormControlFactory( const css::uno::Reference& _rContext ); + FormControlFactory(); + ~FormControlFactory(); + + /** initializes the given control model which is to be newly inserted into a document + + @param _eDocType + the type of the document which the control is to be inserted into + @param _rxControlModel + the control model to be inserted + @param _rControlBoundRect + the bound rect of the control, if applicable + @return + the class ID of the control + */ + sal_Int16 initializeControlModel( + const DocumentType _eDocType, + const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel, + const tools::Rectangle& _rControlBoundRect + ); + + sal_Int16 initializeControlModel( const DocumentType _eDocType, const SdrUnoObj& _rObject ); + void initializeControlModel( const DocumentType _eDocType, const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel ); + + void initializeTextFieldLineEnds( + const css::uno::Reference< css::beans::XPropertySet >& _rxModel + ); + + static void initializeFieldDependentProperties( + const css::uno::Reference< css::beans::XPropertySet >& _rxDatabaseField, + const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel, + const css::uno::Reference< css::util::XNumberFormats >& _rxNumberFormats + ); + + static OUString getDefaultName( + const sal_Int16 nClassId, + const css::uno::Reference< css::lang::XServiceInfo >& _rxObject + ); + + static OUString getDefaultUniqueName_ByComponentType( + const css::uno::Reference< css::container::XNameAccess >& _rxContainer, + const css::uno::Reference< css::beans::XPropertySet >& _rxObject + ); + + static OUString getUniqueName( + const css::uno::Reference< css::container::XNameAccess >& _rxContainer, + std::u16string_view _rBaseName + ); + + private: + css::uno::Reference m_xContext; + }; + + +} + + +#endif // INCLUDED_SVX_SOURCE_INC_FORMCONTROLFACTORY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/formcontroller.hxx b/svx/source/inc/formcontroller.hxx new file mode 100644 index 0000000000..22e3bcb432 --- /dev/null +++ b/svx/source/inc/formcontroller.hxx @@ -0,0 +1,570 @@ +/* -*- 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_SVX_SOURCE_INC_FORMCONTROLLER_HXX +#define INCLUDED_SVX_SOURCE_INC_FORMCONTROLLER_HXX + +#include + +#include +#include + +#include "delayedevent.hxx" +#include "fmcontrolbordermanager.hxx" +#include "formdispatchinterceptor.hxx" +#include "sqlparserclient.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +struct FmXTextComponentLess +{ + bool operator() (const css::uno::Reference< css::awt::XTextComponent >& x, const css::uno::Reference< css::awt::XTextComponent >& y) const + { + return reinterpret_cast(x.get()) < reinterpret_cast(y.get()); + } +}; + +typedef ::std::map< css::uno::Reference< css::awt::XTextComponent >, OUString, FmXTextComponentLess> FmFilterRow; +typedef ::std::vector< FmFilterRow > FmFilterRows; + +namespace svxform +{ + typedef ::std::vector< css::uno::Reference< css::awt::XTextComponent > > FilterComponents; + class ControlBorderManager; + struct FmFieldInfo; + + typedef cppu::WeakComponentImplHelper < css::form::runtime::XFormController + , css::form::runtime::XFilterController + , css::awt::XFocusListener + , css::form::XLoadListener + , css::beans::XPropertyChangeListener + , css::awt::XTextListener + , css::awt::XItemListener + , css::container::XContainerListener + , css::util::XModifyListener + , css::form::XConfirmDeleteListener + , css::sdb::XSQLErrorListener + , css::sdbc::XRowSetListener + , css::sdb::XRowSetApproveListener + , css::form::XDatabaseParameterListener + , css::lang::XServiceInfo + , css::form::XResetListener + , css::frame::XDispatch + , css::awt::XMouseListener + , css::form::validation::XFormComponentValidityListener + , css::task::XInteractionHandler + , css::form::XGridControlListener + , css::form::runtime::XFeatureInvalidation + > FormController_BASE; + + class ColumnInfoCache; + class FormController final : public ::cppu::BaseMutex + ,public FormController_BASE + ,public ::cppu::OPropertySetHelper + ,public DispatchInterceptor + ,public ::comphelper::OAggregationArrayUsageHelper< FormController > + ,public ::svxform::OSQLParserClient + { + typedef ::std::map < sal_Int16, + css::uno::Reference< css::frame::XDispatch > + > DispatcherContainer; + + css::uno::Reference< css::uno::XAggregation> m_xAggregate; + css::uno::Reference< css::awt::XTabController> m_xTabController; + css::uno::Reference< css::awt::XControl> m_xActiveControl, m_xCurrentControl; + css::uno::Reference< css::container::XIndexAccess> m_xModelAsIndex; + css::uno::Reference< css::script::XEventAttacherManager> m_xModelAsManager; + css::uno::Reference< css::uno::XInterface> m_xParent; + css::uno::Reference< css::uno::XComponentContext> m_xComponentContext; + // Composer used for checking filter conditions + css::uno::Reference< css::sdb::XSingleSelectQueryComposer > m_xComposer; + css::uno::Reference< css::task::XInteractionHandler > m_xInteractionHandler; + css::uno::Reference< css::form::runtime::XFormControllerContext > m_xFormControllerContext; + + css::uno::Sequence< css::uno::Reference< css::awt::XControl> > m_aControls; + ::comphelper::OInterfaceContainerHelper3 + m_aActivateListeners; + ::comphelper::OInterfaceContainerHelper3 + m_aModifyListeners; + ::comphelper::OInterfaceContainerHelper3 + m_aErrorListeners; + ::comphelper::OInterfaceContainerHelper3 + m_aDeleteListeners; + ::comphelper::OInterfaceContainerHelper3 + m_aRowSetApproveListeners; + ::comphelper::OInterfaceContainerHelper3 + m_aParameterListeners; + ::comphelper::OInterfaceContainerHelper3 + m_aFilterListeners; + + std::vector< css::uno::Reference< css::form::runtime::XFormController > > + m_aChildren; + FilterComponents m_aFilterComponents; + FmFilterRows m_aFilterRows; + + Idle m_aTabActivationIdle; + Timer m_aFeatureInvalidationTimer; + + ::svxform::ControlBorderManager + m_aControlBorderManager; + + css::uno::Reference< css::form::runtime::XFormOperations > + m_xFormOperations; + DispatcherContainer m_aFeatureDispatchers; + ::std::set< sal_Int16 > m_aInvalidFeatures; // for asynchronous feature invalidation + + OUString m_aMode; + + ::svxform::DelayedEvent m_aLoadEvent; + ::svxform::DelayedEvent m_aToggleEvent; + ::svxform::DelayedEvent m_aActivationEvent; + ::svxform::DelayedEvent m_aDeactivationEvent; + + ::std::unique_ptr< ColumnInfoCache > + m_pColumnInfoCache; + + sal_Int32 m_nCurrentFilterPosition; // current level for filtering (or-criteria) + + bool m_bCurrentRecordModified : 1; + bool m_bCurrentRecordNew : 1; + bool m_bLocked : 1; + bool m_bDBConnection : 1; // focus listener only for database forms + bool m_bCycle : 1; + bool m_bCanInsert : 1; + bool m_bCanUpdate : 1; + bool m_bCommitLock : 1; // lock the committing of controls see focusGained + bool m_bModified : 1; // is the content of a control modified? + bool m_bControlsSorted : 1; + bool m_bFiltering : 1; + bool m_bAttachEvents : 1; + bool m_bDetachEvents : 1; + bool m_bAttemptedHandlerCreation : 1; + bool m_bSuspendFilterTextListening; // no bit field, passed around as reference + + // as we want to intercept dispatches of _all_ controls we're responsible for, and an object implementing + // the css::frame::XDispatchProviderInterceptor interface can intercept only _one_ objects dispatches, we need a helper class + std::vector> m_aControlDispatchInterceptors; + + public: + FormController( const css::uno::Reference< css::uno::XComponentContext > & _rxORB ); + + // returns the window which should be used as parent window for dialogs + static css::uno::Reference getDialogParentWindow(css::uno::Reference xFormController); + + private: + virtual ~FormController() override; + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& type) override; + virtual void SAL_CALL acquire() noexcept override; + virtual void SAL_CALL release() noexcept override; + + // XTypeProvider + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + + // XDispatch + virtual void SAL_CALL dispatch( const css::util::URL& _rURL, const css::uno::Sequence< css::beans::PropertyValue >& _rArgs ) override; + virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& _rxListener, const css::util::URL& _rURL ) override; + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& _rxListener, const css::util::URL& _rURL ) override; + + // css::container::XChild + virtual css::uno::Reference< css::uno::XInterface> SAL_CALL getParent() override; + virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface>& Parent) override; + + // css::lang::XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; + + // OComponentHelper + virtual void SAL_CALL disposing() override; + + // OPropertySetHelper + 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; + virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override; + + virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override; + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + using OPropertySetHelper::getFastPropertyValue; + + // XFilterController + virtual ::sal_Int32 SAL_CALL getFilterComponents() override; + virtual ::sal_Int32 SAL_CALL getDisjunctiveTerms() override; + virtual void SAL_CALL addFilterControllerListener( const css::uno::Reference< css::form::runtime::XFilterControllerListener >& Listener ) override; + virtual void SAL_CALL removeFilterControllerListener( const css::uno::Reference< css::form::runtime::XFilterControllerListener >& Listener ) override; + virtual void SAL_CALL setPredicateExpression( ::sal_Int32 Component, ::sal_Int32 Term, const OUString& PredicateExpression ) override; + virtual css::uno::Reference< css::awt::XControl > SAL_CALL getFilterComponent( ::sal_Int32 Component ) override; + virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL getPredicateExpressions() override; + virtual void SAL_CALL removeDisjunctiveTerm( ::sal_Int32 Term ) override; + virtual void SAL_CALL appendEmptyDisjunctiveTerm() override; + virtual ::sal_Int32 SAL_CALL getActiveTerm() override; + virtual void SAL_CALL setActiveTerm( ::sal_Int32 ActiveTerm ) override; + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // css::container::XEnumerationAccess + virtual css::uno::Reference< css::container::XEnumeration> SAL_CALL createEnumeration() override; + + // css::container::XContainerListener + virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& rEvent) override; + virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& rEvent) override; + virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& rEvent) override; + + // XLoadListener + virtual void SAL_CALL loaded(const css::lang::EventObject& rEvent) override; + virtual void SAL_CALL unloaded(const css::lang::EventObject& rEvent) override; + virtual void SAL_CALL unloading(const css::lang::EventObject& aEvent) override; + virtual void SAL_CALL reloading(const css::lang::EventObject& aEvent) override; + virtual void SAL_CALL reloaded(const css::lang::EventObject& aEvent) override; + + // XModeSelector + virtual void SAL_CALL setMode(const OUString& Mode) override; + virtual OUString SAL_CALL getMode() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedModes() override; + virtual sal_Bool SAL_CALL supportsMode(const OUString& Mode) override; + + // css::container::XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override; + + // XModifyBroadcaster + virtual void SAL_CALL addModifyListener(const css::uno::Reference< css::util::XModifyListener>& l) override; + virtual void SAL_CALL removeModifyListener(const css::uno::Reference< css::util::XModifyListener>& l) override; + + // XFocusListener + virtual void SAL_CALL focusGained(const css::awt::FocusEvent& e) override; + virtual void SAL_CALL focusLost(const css::awt::FocusEvent& e) override; + + // XMouseListener + virtual void SAL_CALL mousePressed( const css::awt::MouseEvent& _rEvent ) override; + virtual void SAL_CALL mouseReleased( const css::awt::MouseEvent& _rEvent ) override; + virtual void SAL_CALL mouseEntered( const css::awt::MouseEvent& _rEvent ) override; + virtual void SAL_CALL mouseExited( const css::awt::MouseEvent& _rEvent ) override; + + // XFormComponentValidityListener + virtual void SAL_CALL componentValidityChanged( const css::lang::EventObject& _rSource ) override; + + // XInteractionHandler + virtual void SAL_CALL handle( const css::uno::Reference< css::task::XInteractionRequest >& Request ) override; + + // XGridControlListener + virtual void SAL_CALL columnChanged( const css::lang::EventObject& _event ) override; + + // css::beans::XPropertyChangeListener -> change of states + virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override; + + // XTextListener -> set modify + virtual void SAL_CALL textChanged(const css::awt::TextEvent& rEvent) override; + + // XItemListener -> set modify + virtual void SAL_CALL itemStateChanged(const css::awt::ItemEvent& rEvent) override; + + // XModifyListener -> set modify + virtual void SAL_CALL modified(const css::lang::EventObject& rEvent) override; + + // XFormController + virtual css::uno::Reference< css::form::runtime::XFormOperations > SAL_CALL getFormOperations() override; + virtual css::uno::Reference< css::awt::XControl> SAL_CALL getCurrentControl() override; + virtual void SAL_CALL addActivateListener(const css::uno::Reference< css::form::XFormControllerListener>& l) override; + virtual void SAL_CALL removeActivateListener(const css::uno::Reference< css::form::XFormControllerListener>& l) override; + virtual void SAL_CALL addChildController( const css::uno::Reference< css::form::runtime::XFormController >& ChildController ) override; + + virtual css::uno::Reference< css::form::runtime::XFormControllerContext > SAL_CALL getContext() override; + virtual void SAL_CALL setContext( const css::uno::Reference< css::form::runtime::XFormControllerContext >& _context ) override; + virtual css::uno::Reference< css::task::XInteractionHandler > SAL_CALL getInteractionHandler() override; + virtual void SAL_CALL setInteractionHandler( const css::uno::Reference< css::task::XInteractionHandler >& _interactionHandler ) override; + + // XTabController + virtual css::uno::Sequence< css::uno::Reference< css::awt::XControl> > SAL_CALL getControls() override; + + virtual void SAL_CALL setModel(const css::uno::Reference< css::awt::XTabControllerModel>& Model) override; + virtual css::uno::Reference< css::awt::XTabControllerModel> SAL_CALL getModel() override; + + virtual void SAL_CALL setContainer(const css::uno::Reference< css::awt::XControlContainer>& Container) override; + virtual css::uno::Reference< css::awt::XControlContainer> SAL_CALL getContainer() override; + + virtual void SAL_CALL autoTabOrder() override; + virtual void SAL_CALL activateTabOrder() override; + + virtual void SAL_CALL activateFirst() override; + virtual void SAL_CALL activateLast() override; + + // css::sdbc::XRowSetListener + virtual void SAL_CALL cursorMoved(const css::lang::EventObject& event) override; + virtual void SAL_CALL rowChanged(const css::lang::EventObject& event) override; + virtual void SAL_CALL rowSetChanged(const css::lang::EventObject& event) override; + + // XRowSetApproveListener + virtual sal_Bool SAL_CALL approveCursorMove(const css::lang::EventObject& event) override; + virtual sal_Bool SAL_CALL approveRowChange(const css::sdb::RowChangeEvent& event) override; + virtual sal_Bool SAL_CALL approveRowSetChange(const css::lang::EventObject& event) override; + + // XRowSetApproveBroadcaster + virtual void SAL_CALL addRowSetApproveListener(const css::uno::Reference< css::sdb::XRowSetApproveListener>& listener) override; + virtual void SAL_CALL removeRowSetApproveListener(const css::uno::Reference< css::sdb::XRowSetApproveListener>& listener) override; + + // XSQLErrorBroadcaster + virtual void SAL_CALL errorOccured(const css::sdb::SQLErrorEvent& aEvent) override; + + // XSQLErrorListener + virtual void SAL_CALL addSQLErrorListener(const css::uno::Reference< css::sdb::XSQLErrorListener>& _rListener) override; + virtual void SAL_CALL removeSQLErrorListener(const css::uno::Reference< css::sdb::XSQLErrorListener>& _rListener) override; + + // XDatabaseParameterBroadcaster2 + virtual void SAL_CALL addDatabaseParameterListener(const css::uno::Reference< css::form::XDatabaseParameterListener>& aListener) override; + virtual void SAL_CALL removeDatabaseParameterListener(const css::uno::Reference< css::form::XDatabaseParameterListener>& aListener) override; + + // XDatabaseParameterBroadcaster + virtual void SAL_CALL addParameterListener(const css::uno::Reference< css::form::XDatabaseParameterListener>& aListener) override; + virtual void SAL_CALL removeParameterListener(const css::uno::Reference< css::form::XDatabaseParameterListener>& aListener) override; + + // XDatabaseParameterListener + virtual sal_Bool SAL_CALL approveParameter(const css::form::DatabaseParameterEvent& aEvent) override; + + // XConfirmDeleteBroadcaster + virtual void SAL_CALL addConfirmDeleteListener(const css::uno::Reference< css::form::XConfirmDeleteListener>& aListener) override; + virtual void SAL_CALL removeConfirmDeleteListener(const css::uno::Reference< css::form::XConfirmDeleteListener>& aListener) override; + + // XConfirmDeleteListener + virtual sal_Bool SAL_CALL confirmDelete(const css::sdb::RowChangeEvent& aEvent) override; + + // XServiceInfo + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XResetListener + virtual sal_Bool SAL_CALL approveReset(const css::lang::EventObject& rEvent) override; + virtual void SAL_CALL resetted(const css::lang::EventObject& rEvent) override; + + // XFeatureInvalidation + virtual void SAL_CALL invalidateFeatures( const css::uno::Sequence< ::sal_Int16 >& Features ) override; + virtual void SAL_CALL invalidateAllFeatures( ) override; + +// method for registration + static css::uno::Sequence< OUString > const & getSupportedServiceNames_Static(); + + // comphelper::OPropertyArrayUsageHelper + virtual void fillProperties( + css::uno::Sequence< css::beans::Property >& /* [out] */ _rProps, + css::uno::Sequence< css::beans::Property >& /* [out] */ _rAggregateProps + ) const override; + + // DispatchInterceptor + virtual css::uno::Reference< css::frame::XDispatch> + interceptedQueryDispatch( + const css::util::URL& aURL, + const OUString& aTargetFrameName, + sal_Int32 nSearchFlags + ) override; + + virtual ::osl::Mutex* getInterceptorMutex() override { return &m_aMutex; } + + /// update all our dispatchers + void updateAllDispatchers() const; + + /** disposes all dispatchers in m_aFeatureDispatchers, and empties m_aFeatureDispatchers + */ + void disposeAllFeaturesAndDispatchers(); + + void startFiltering(); + void stopFiltering(); + void setFilter(::std::vector&); + void startListening(); + void stopListening(); + + /** ensures that we have an interaction handler, if possible + + If an interaction handler was provided at creation time (initialize), this + one will be used. Else, an attempt is made to create an InteractionHandler + is made. + + @return + if and only if m_xInteractionHandler is valid when the method returns + */ + bool ensureInteractionHandler(); + + /** replaces one of our controls with another one + + Upon successful replacing, the old control will be disposed. Also, internal members pointing + to the current or active control will be adjusted. Yet more, if the replaced control was + the active control, the new control will be made active. + + @param _rxExistentControl + The control to replace. Must be one of the controls in our ControlContainer. + @param _rxNewControl + The control which should replace the existent control. + @return + if and only if the control was successfully replaced + */ + bool replaceControl( + const css::uno::Reference< css::awt::XControl >& _rxExistentControl, + const css::uno::Reference< css::awt::XControl >& _rxNewControl + ); + + // we're listening at all bound controls for modifications + void startControlModifyListening(const css::uno::Reference< css::awt::XControl>& xControl); + void stopControlModifyListening(const css::uno::Reference< css::awt::XControl>& xControl); + + void setLocks(); + void setControlLock(const css::uno::Reference< css::awt::XControl>& xControl); + void addToEventAttacher(const css::uno::Reference< css::awt::XControl>& xControl); + void removeFromEventAttacher(const css::uno::Reference< css::awt::XControl>& xControl); + void toggleAutoFields(bool bAutoFields); + /// @throws css::uno::RuntimeException + void unload(); + void removeBoundFieldListener(); + + void startFormListening( const css::uno::Reference< css::beans::XPropertySet >& _rxForm, bool _bPropertiesOnly ); + void stopFormListening( const css::uno::Reference< css::beans::XPropertySet >& _rxForm, bool _bPropertiesOnly ); + + 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, bool _bRemove, bool _bOverWrite ) const; + + void insertControl(const css::uno::Reference< css::awt::XControl>& xControl); + void removeControl(const css::uno::Reference< css::awt::XControl>& xControl); + + /// called when a new control is to be handled by the controller + void implControlInserted( const css::uno::Reference< css::awt::XControl>& _rxControl, bool _bAddToEventAttacher ); + /// called when a control is not to be handled by the controller anymore + void implControlRemoved( const css::uno::Reference< css::awt::XControl>& _rxControl, bool _bRemoveFromEventAttacher ); + + /** sets m_xCurrentControl, plus does administrative tasks depending on it + */ + void implSetCurrentControl( const css::uno::Reference< css::awt::XControl >& _rxControl ); + + /** invalidates the FormFeatures which depend on the current control + */ + void implInvalidateCurrentControlDependentFeatures(); + + bool impl_isDisposed_nofail() const { return FormController_BASE::rBHelper.bDisposed; } + void impl_checkDisposed_throw() const; + + void impl_onModify(); + + /** adds the given filter row to m_aFilterRows, setting m_nCurrentFilterPosition to 0 if the newly added + row is the first one. + + @precond + our mutex is locked + */ + void impl_addFilterRow( const FmFilterRow& _row ); + + /** adds an empty filter row to m_aFilterRows, and notifies our listeners + */ + void impl_appendEmptyFilterRow( ::osl::ClearableMutexGuard& _rClearBeforeNotify ); + + bool isLocked() const {return m_bLocked;} + bool determineLockState() const; + + css::uno::Reference< css::frame::XDispatchProviderInterceptor> createInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterception>& _xInterception); + // create a new interceptor, register it on the given object + void deleteInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterception>& _xInterception); + // if createInterceptor was called for the given object the according interceptor will be removed + // from the objects interceptor chain and released + + /** checks all form controls belonging to our form for validity + + If a form control supports the XValidatableFormComponent interface, this is used to determine + the validity of the control. If the interface is not supported, the control is supposed to be + valid. + + @param _rFirstInvalidityExplanation + if the method returns (i.e. if there is an invalid control), this string contains + the explanation for the invalidity, as obtained from the validator. + + @param _rxFirstInvalidModel + if the method returns (i.e. if there is an invalid control), this contains + the control model + + @return + if and only if all controls belonging to our form are valid + */ + bool checkFormComponentValidity( + OUString& /* [out] */ _rFirstInvalidityExplanation, + css::uno::Reference< css::awt::XControlModel >& /* [out] */ _rxFirstInvalidModel + ); + + /** locates the control which belongs to a given model + */ + css::uno::Reference< css::awt::XControl > + locateControl( const css::uno::Reference< css::awt::XControlModel >& _rxModel ); + + // set the text for all filters + void impl_setTextOnAllFilter_throw(); + + // in filter mode we do not listen for changes + bool isListeningForChanges() const {return m_bDBConnection && !m_bFiltering && !isLocked();} + css::uno::Reference< css::awt::XControl> isInList(const css::uno::Reference< css::awt::XWindowPeer>& xPeer) const; + + DECL_LINK( OnActivateTabOrder, Timer*, void ); + DECL_LINK( OnInvalidateFeatures, Timer*, void ); + DECL_LINK( OnLoad, void*, void ); + DECL_LINK( OnToggleAutoFields, void*, void ); + DECL_LINK( OnActivated, void*, void ); + DECL_LINK( OnDeactivated, void*, void ); + }; + +} + +#endif // INCLUDED_SVX_SOURCE_INC_FORMCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/formcontrolling.hxx b/svx/source/inc/formcontrolling.hxx new file mode 100644 index 0000000000..c9bd8f23f8 --- /dev/null +++ b/svx/source/inc/formcontrolling.hxx @@ -0,0 +1,213 @@ +/* -*- 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_SVX_SOURCE_INC_FORMCONTROLLING_HXX +#define INCLUDED_SVX_SOURCE_INC_FORMCONTROLLING_HXX + +#include +#include +#include +#include + +#include +#include + +#include + + +namespace svx +{ + + class FeatureSlotTranslation + { + public: + /// retrieves the feature id for a given feature URL + static sal_Int32 getControllerFeatureSlotIdForURL( const OUString& _rMainURL ); + + /// retrieves the css.form.runtime.FormFeature ID for a given slot ID + static sal_Int16 getFormFeatureForSlotId( sal_Int32 _nSlotId ); + + /// retrieves the slot id for a given css.form.runtime.FormFeature ID + static sal_Int32 getSlotIdForFormFeature( sal_Int16 _nFormFeature ); + }; + + class IControllerFeatureInvalidation + { + public: + /** invalidates the given features + + Invalidation means that any user interface representation (such as toolbox buttons), or + any dispatches associated with the features in question are potentially out-of-date, and + need to be updated + + @param _rFeatures + Ids of the features to be invalidated. + */ + virtual void invalidateFeatures( const ::std::vector< sal_Int32 >& _rFeatures ) = 0; + + protected: + ~IControllerFeatureInvalidation() {} + }; + + class FormControllerHelper; + /** easier access to a FormControllerHelper instance + */ + class ControllerFeatures final + { + IControllerFeatureInvalidation* m_pInvalidationCallback; // necessary as long as m_pImpl is not yet constructed + rtl::Reference m_pImpl; + + public: + /** standard ctor + + The instance is not functional until assign is used. + + @param _pInvalidationCallback + the callback for invalidating feature states + */ + ControllerFeatures( + IControllerFeatureInvalidation* _pInvalidationCallback + ); + + /** constructs the instance from a XFormController instance + + @param _rxController + The form controller which the helper should be responsible for. Must not + be , and must have a valid model (form). + */ + ControllerFeatures( + const css::uno::Reference< css::form::runtime::XFormController >& _rxController + ); + + /// dtor + ~ControllerFeatures(); + + /// checks whether the instance is properly assigned to a form and/or controller + bool isAssigned( ) const { return m_pImpl != nullptr; } + + /** assign to a controller + */ + void assign( + const css::uno::Reference< css::form::runtime::XFormController >& _rxController + ); + + /// clears the instance so that it cannot be used afterwards + void dispose(); + + // access to the instance which implements the functionality. Not to be used when not assigned + const FormControllerHelper* operator->() const { return m_pImpl.get(); } + FormControllerHelper* operator->() { return m_pImpl.get(); } + }; + + + //= FormControllerHelper + + typedef ::cppu::WeakImplHelper < css::form::runtime::XFeatureInvalidation + , css::sdb::XSQLErrorListener + > FormControllerHelper_Base; + /** is a helper class which manages form controller functionality (such as moveNext etc.). + +

The class helps implementing form controller functionality, by providing + methods to determine the state of, and execute, various common form features.
+ A feature is for instance moving the form associated with the controller + to a certain position, or reloading the form, and so on.

+ */ + class FormControllerHelper final : public FormControllerHelper_Base + { + IControllerFeatureInvalidation* m_pInvalidationCallback; + css::uno::Reference< css::form::runtime::XFormOperations > + m_xFormOperations; + + css::uno::Any m_aOperationError; + + public: + /** constructs the helper from a XFormController instance + + @param _rxController + The form controller which the helper should be responsible for. Must not + be , and must have a valid model (form). + @param _pInvalidationCallback + the callback for invalidating feature states + */ + FormControllerHelper( + const css::uno::Reference< css::form::runtime::XFormController >& _rxController, + IControllerFeatureInvalidation* _pInvalidationCallback + ); + + // forwards to the XFormOperations implementation + css::uno::Reference< css::sdbc::XRowSet > + getCursor() const; + void getState( + sal_Int32 _nSlotId, + css::form::runtime::FeatureState& _out_rState + ) const; + bool isEnabled( sal_Int32 _nSlotId ) const; + void execute( sal_Int32 _nSlotId ) const; + void execute( sal_Int32 _nSlotId, const OUString& _rParamName, const css::uno::Any& _rParamValue ) const; + bool commitCurrentRecord() const; + bool commitCurrentControl( ) const; + bool isInsertionRow() const; + bool isModifiedRow() const; + + bool canDoFormFilter() const; + + /** disposes this instance. + + After this method has been called, the instance is not functional anymore + */ + void dispose(); + + private: + /// dtor + virtual ~FormControllerHelper() override; + + // XFeatureInvalidation + virtual void SAL_CALL invalidateFeatures( const css::uno::Sequence< ::sal_Int16 >& Features ) override; + virtual void SAL_CALL invalidateAllFeatures() override; + + // XSQLErrorListener + virtual void SAL_CALL errorOccured( const css::sdb::SQLErrorEvent& Event ) override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + enum FormOperation { EXECUTE, EXECUTE_ARGS, COMMIT_CONTROL, COMMIT_RECORD }; + + bool impl_operateForm_nothrow( + const FormOperation _eWhat, + const sal_Int16 _nFeature, /* ignore for COMMIT_* */ + const css::uno::Sequence< css::beans::NamedValue >& _rArguments /* ignore except for EXECUTE_ARGS */ + ) const; + bool impl_operateForm_nothrow( const FormOperation _eWhat ) const + { + return impl_operateForm_nothrow( _eWhat, 0, css::uno::Sequence< css::beans::NamedValue >() ); + } + + private: + FormControllerHelper( const FormControllerHelper& ) = delete; + FormControllerHelper& operator=( const FormControllerHelper& ) = delete; + }; + + +} + + +#endif // INCLUDED_SVX_SOURCE_INC_FORMCONTROLLING_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/formdispatchinterceptor.hxx b/svx/source/inc/formdispatchinterceptor.hxx new file mode 100644 index 0000000000..d2947eec55 --- /dev/null +++ b/svx/source/inc/formdispatchinterceptor.hxx @@ -0,0 +1,107 @@ +/* -*- 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_SVX_SOURCE_INC_FORMDISPATCHINTERCEPTOR_HXX +#define INCLUDED_SVX_SOURCE_INC_FORMDISPATCHINTERCEPTOR_HXX + +#include +#include + +#include + + +namespace svxform +{ + + class DispatchInterceptor + { + public: + /// @throws css::uno::RuntimeException + virtual css::uno::Reference< css::frame::XDispatch> interceptedQueryDispatch( + const css::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags) = 0; + + virtual ::osl::Mutex* getInterceptorMutex() = 0; + + protected: + DispatchInterceptor() {} + + ~DispatchInterceptor() {} + }; + + + //= + + typedef ::cppu::WeakComponentImplHelper< css::frame::XDispatchProviderInterceptor + , css::lang::XEventListener + > DispatchInterceptionMultiplexer_BASE; + + class DispatchInterceptionMultiplexer final : public DispatchInterceptionMultiplexer_BASE + { + public: + css::uno::Reference< css::frame::XDispatchProviderInterception> getIntercepted() const { return m_xIntercepted; } + + DispatchInterceptionMultiplexer( + const css::uno::Reference< css::frame::XDispatchProviderInterception>& _rToIntercept, + DispatchInterceptor* _pMaster + ); + + // css::frame::XDispatchProvider + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& aURL, const OUString& aTargetFrameName, sal_Int32 nSearchFlags ) override; + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& aDescripts ) override; + + // css::frame::XDispatchProviderInterceptor + virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) override; + virtual void SAL_CALL setSlaveDispatchProvider( const css::uno::Reference< css::frame::XDispatchProvider >& xNewDispatchProvider ) override; + virtual css::uno::Reference< css::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) override; + virtual void SAL_CALL setMasterDispatchProvider( const css::uno::Reference< css::frame::XDispatchProvider >& xNewSupplier ) override; + + // css::lang::XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // OComponentHelper + virtual void SAL_CALL disposing() override; + + private: + virtual ~DispatchInterceptionMultiplexer() override; + + void ImplDetach(); + + ::osl::Mutex m_aFallback; + ::osl::Mutex* m_pMutex; + + // the component which's dispatches we're intercepting + css::uno::WeakReference< css::frame::XDispatchProviderInterception > + m_xIntercepted; + bool m_bListening; + + // the real interceptor + DispatchInterceptor* m_pMaster; + + // chaining + css::uno::Reference< css::frame::XDispatchProvider> m_xSlaveDispatcher; + css::uno::Reference< css::frame::XDispatchProvider> m_xMasterDispatcher; + }; + + +} + + +#endif // INCLUDED_SVX_SOURCE_INC_FORMDISPATCHINTERCEPTOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/formfeaturedispatcher.hxx b/svx/source/inc/formfeaturedispatcher.hxx new file mode 100644 index 0000000000..62fe40e699 --- /dev/null +++ b/svx/source/inc/formfeaturedispatcher.hxx @@ -0,0 +1,111 @@ +/* -*- 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_SVX_SOURCE_INC_FORMFEATUREDISPATCHER_HXX +#define INCLUDED_SVX_SOURCE_INC_FORMFEATUREDISPATCHER_HXX + +#include +#include + +#include +#include + + +namespace svx +{ + + typedef ::cppu::WeakImplHelper < css::frame::XDispatch + > OSingleFeatureDispatcher_Base; + + class OSingleFeatureDispatcher final : public OSingleFeatureDispatcher_Base + { + public: + /** constructs the dispatcher + + @param _rFeatureURL + the URL of the feature which this instance is responsible for + + @param _nFeatureId + the feature which this instance is responsible for + + @param _rController + the controller which is responsible for providing the state of feature of this instance, + and for executing it. After disposing the dispatcher instance, the controller will + not be accessed anymore + + @see dispose + */ + OSingleFeatureDispatcher( + css::util::URL _aFeatureURL, + const sal_Int16 _nFormFeature, + const css::uno::Reference< css::form::runtime::XFormOperations >& _rxFormOperations, + ::osl::Mutex& _rMutex + ); + + /** notifies all our listeners of the current state + */ + void updateAllListeners(); + + private: + // XDispatch + virtual void SAL_CALL dispatch( const css::util::URL& _rURL, const css::uno::Sequence< css::beans::PropertyValue >& _rArguments ) override; + virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& _rxControl, const css::util::URL& _rURL ) override; + virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& _rxControl, const css::util::URL& _rURL ) override; + + /** notifies our current state to one or all listeners + + @param _rxListener + the listener to notify. May be NULL, in this case all our listeners will be + notified with the current state + + @param _rFreeForNotification + a guard which currently locks our mutex, and which is to be cleared + for actually doing the notification(s) + */ + void notifyStatus( + const css::uno::Reference< css::frame::XStatusListener >& _rxListener, + ::osl::ClearableMutexGuard& _rFreeForNotification + ); + + /** retrieves the current status of our feature, in a format which can be used + for UNO notifications + + @precond + our mutex is locked + */ + void getUnoState( css::frame::FeatureStateEvent& /* [out] */ _rState ) const; + + ::osl::Mutex& m_rMutex; + ::comphelper::OInterfaceContainerHelper3 m_aStatusListeners; + css::uno::Reference< css::form::runtime::XFormOperations > + m_xFormOperations; + const css::util::URL m_aFeatureURL; + css::uno::Any m_aLastKnownState; + const sal_Int16 m_nFormFeature; + bool m_bLastKnownEnabled; + + }; + + +} + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/formtoolbars.hxx b/svx/source/inc/formtoolbars.hxx new file mode 100644 index 0000000000..1a77613bf7 --- /dev/null +++ b/svx/source/inc/formtoolbars.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 . + */ + +#ifndef INCLUDED_SVX_SOURCE_INC_FORMTOOLBARS_HXX +#define INCLUDED_SVX_SOURCE_INC_FORMTOOLBARS_HXX + +#include + +namespace svxform +{ + class FormToolboxes + { + private: + css::uno::Reference< css::frame::XLayoutManager > m_xLayouter; + + public: + /** constructs an instance + @param _rxFrame + the frame to analyze + */ + FormToolboxes( + const css::uno::Reference< css::frame::XFrame >& _rxFrame + ); + + public: + /** retrieves the URI for the toolbox associated with the given slot, depending + on the type of our document + */ + static OUString + getToolboxResourceName( sal_uInt16 _nSlotId ); + + /** toggles the toolbox associated with the given slot + */ + void toggleToolbox( sal_uInt16 _nSlotId ) const; + + /** determines whether the toolbox associated with the given slot is currently visible + */ + bool isToolboxVisible( sal_uInt16 _nSlotId ) const; + + }; + +} + +#endif // INCLUDED_SVX_SOURCE_INC_FORMTOOLBARS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/frmselimpl.hxx b/svx/source/inc/frmselimpl.hxx new file mode 100644 index 0000000000..79df99cfb1 --- /dev/null +++ b/svx/source/inc/frmselimpl.hxx @@ -0,0 +1,285 @@ +/* -*- 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_SVX_SOURCE_INC_FRMSELIMPL_HXX +#define INCLUDED_SVX_SOURCE_INC_FRMSELIMPL_HXX + +#include +#include +#include +#include +#include +#include + +namespace svx { + +namespace a11y { + class AccFrameSelector; + class AccFrameSelectorChild; +} + +class FrameBorder +{ +public: + explicit FrameBorder(FrameBorderType eType); + static double GetDefaultPatternScale() { return 0.05; } + + FrameBorderType GetType() const + { + return meType; + } + + bool IsEnabled() const + { + return mbEnabled; + } + void Enable(FrameSelFlags nFlags); + + FrameBorderState GetState() const + { + return meState; + } + void SetState(FrameBorderState eState); + + bool IsSelected() const { return mbSelected; } + void Select( bool bSelect ) { mbSelected = bSelect; } + + const editeng::SvxBorderLine& GetCoreStyle() const { return maCoreStyle; } + void SetCoreStyle( const editeng::SvxBorderLine* pStyle ); + + void SetUIColorPrim( const Color& rColor ) {maUIStyle.SetColorPrim( rColor ); } + void SetUIColorSecn( const Color& rColor ) {maUIStyle.SetColorSecn( rColor ); } + const frame::Style& GetUIStyle() const { return maUIStyle; } + + void ClearFocusArea() { maFocusArea.Clear(); } + void AddFocusPolygon( const tools::Polygon& rFocus ); + void MergeFocusToPolyPolygon( tools::PolyPolygon& rPPoly ) const; + + void ClearClickArea() { maClickArea.Clear(); } + void AddClickRect( const tools::Rectangle& rRect ); + bool ContainsClickPoint( const Point& rPos ) const; + tools::Rectangle GetClickBoundRect() const; + + void SetKeyboardNeighbors(FrameBorderType eLeft, FrameBorderType eRight, + FrameBorderType eTop, FrameBorderType eBottom); + FrameBorderType GetKeyboardNeighbor( sal_uInt16 nKeyCode ) const; + +private: + const FrameBorderType meType; /// Frame border type (position in control). + FrameBorderState meState; /// Frame border state (on/off/don't care). + editeng::SvxBorderLine maCoreStyle; /// Core style from application. + frame::Style maUIStyle; /// Internal style to draw lines. + FrameBorderType meKeyLeft; /// Left neighbor for keyboard control. + FrameBorderType meKeyRight; /// Right neighbor for keyboard control. + FrameBorderType meKeyTop; /// Upper neighbor for keyboard control. + FrameBorderType meKeyBottom; /// Lower neighbor for keyboard control. + tools::PolyPolygon maFocusArea; /// Focus drawing areas. + tools::PolyPolygon maClickArea; /// Mouse click areas. + bool mbEnabled : 1; /// true = Border enabled in control. + bool mbSelected : 1; /// true = Border selected in control. +}; + + +typedef std::vector< FrameBorder* > FrameBorderPtrVec; + +struct FrameSelectorImpl +{ + FrameSelector& mrFrameSel; /// The control itself. + ScopedVclPtr mpVirDev; /// For all buffered drawing operations. + std::vector maArrows; /// Arrows in current system colors. + Color maBackCol; /// Background color. + Color maArrowCol; /// Selection arrow color. + Color maMarkCol; /// Selection marker color. + Color maHCLineCol; /// High contrast line color. + Point maVirDevPos; /// Position of virtual device in the control. + + FrameBorder maLeft; /// All data of left frame border. + FrameBorder maRight; /// All data of right frame border. + FrameBorder maTop; /// All data of top frame border. + FrameBorder maBottom; /// All data of bottom frame border. + FrameBorder maHor; /// All data of inner horizontal frame border. + FrameBorder maVer; /// All data of inner vertical frame border. + FrameBorder maTLBR; /// All data of top-left to bottom-right frame border. + FrameBorder maBLTR; /// All data of bottom-left to top-right frame border. + editeng::SvxBorderLine maCurrStyle; /// Current style and color for new borders. + frame::Array maArray; /// Frame link array to draw an array of frame borders. + + FrameSelFlags mnFlags; /// Flags for enabled frame borders. + FrameBorderPtrVec maAllBorders; /// Pointers to all frame borders. + FrameBorderPtrVec maEnabBorders; /// Pointers to enables frame borders. + Link maSelectHdl; /// Selection handler. + + tools::Long mnCtrlSize; /// Size of the control (always square). + tools::Long mnArrowSize; /// Size of an arrow image. + tools::Long mnLine1; /// Middle of left/top frame borders. + tools::Long mnLine2; /// Middle of inner frame borders. + tools::Long mnLine3; /// Middle of right/bottom frame borders. + tools::Long mnFocusOffs; /// Offset from frame border middle to draw focus. + + bool mbHor; /// true = Inner horizontal frame border enabled. + bool mbVer; /// true = Inner vertical frame border enabled. + bool mbTLBR; /// true = Top-left to bottom-right frame border enabled. + bool mbBLTR; /// true = Bottom-left to top-right frame border enabled. + bool mbFullRepaint; /// Used for repainting (false = only copy virtual device). + bool mbAutoSelect; /// true = Auto select a frame border, if focus reaches control. + bool mbHCMode; /// true = High contrast mode. + + std::vector> + maChildVec; /// Pointers to accessibility objects for frame borders. + explicit FrameSelectorImpl( FrameSelector& rFrameSel ); + ~FrameSelectorImpl(); + + // initialization + /** Initializes the control, enables/disables frame borders according to flags. */ + void Initialize( FrameSelFlags nFlags ); + + /** Fills all color members from current style settings. */ + void InitColors(); + /** Creates the image list with selection arrows regarding current style settings. */ + void InitArrowImageList(); + /** Initializes global coordinates. */ + void InitGlobalGeometry(); + /** Initializes coordinates of all frame borders. */ + void InitBorderGeometry(); + /** Draws the entire control into the internal virtual device. */ + void InitVirtualDevice(); + /** call this to recalculate based on parent size */ + void sizeChanged(); + + // frame border access + /** Returns the object representing the specified frame border. */ + const FrameBorder& GetBorder( FrameBorderType eBorder ) const; + /** Returns the object representing the specified frame border (write access). */ + FrameBorder& GetBorderAccess( FrameBorderType eBorder ); + + // drawing + /** Draws the background of the entire control (the gray areas between borders). */ + void DrawBackground(); + + /** Draws selection arrows for the specified frame border. */ + void DrawArrows( const FrameBorder& rBorder ); + + /** Returns the color that has to be used to draw a frame border. */ + Color GetDrawLineColor( const Color& rColor ) const; + /** Draws all frame borders. */ + void DrawAllFrameBorders(); + + /** Draws all contents of the control. */ + void DrawVirtualDevice(); + /** Copies contents of the virtual device to the control. */ + void CopyVirDevToControl(vcl::RenderContext& rRenderContext); + + /** Draws tracking rectangles for all selected frame borders. */ + void DrawAllTrackingRects(vcl::RenderContext& rRenderContext); + + /** Converts a mouse position to the virtual device position. */ + Point GetDevPosFromMousePos( const Point& rMousePos ) const; + + /** Invalidates the control. + @param bFullRepaint true = Full repaint; false = update selection only. */ + void DoInvalidate( bool bFullRepaint ); + + // frame border state and style + /** Sets the state of the specified frame border. */ + void SetBorderState( FrameBorder& rBorder, FrameBorderState eState ); + /** Sets the core style of the specified frame border, or hides the frame border, if pStyle is 0. */ + void SetBorderCoreStyle( FrameBorder& rBorder, const editeng::SvxBorderLine* pStyle ); + + /** Changes the state of a frame border after a control event (mouse/keyboard). */ + void ToggleBorderState( FrameBorder& rBorder ); + + // frame border selection + /** Selects a frame border and schedules redraw. */ + void SelectBorder( FrameBorder& rBorder, bool bSelect ); + /** Grabs focus without auto-selection of a frame border, if no border selected. */ + void SilentGrabFocus(); + + /** Returns true, if all selected frame borders are equal (or if nothing is selected). */ + bool SelectedBordersEqual() const; +}; + + +/** Dummy predicate for frame border iterators to use all borders in a container. */ +struct FrameBorderDummy_Pred +{ + bool operator()( const FrameBorder* ) const { return true; } +}; + +/** Predicate for frame border iterators to use only visible borders in a container. */ +struct FrameBorderVisible_Pred +{ + bool operator()( const FrameBorder* pBorder ) const { return pBorder->GetState() == FrameBorderState::Show; } +}; + +/** Predicate for frame border iterators to use only selected borders in a container. */ +struct FrameBorderSelected_Pred +{ + bool operator()( const FrameBorder* pBorder ) const { return pBorder->IsSelected(); } +}; + +/** Template class for all types of frame border iterators. */ +template< typename Cont, typename Iter, typename Pred > +class FrameBorderIterBase +{ +public: + typedef Cont container_type; + typedef Iter iterator_type; + typedef typename Cont::value_type value_type; + typedef FrameBorderIterBase this_type; + + explicit FrameBorderIterBase( container_type& rCont ); + bool Is() const { return maIt != maEnd; } + this_type& operator++(); + value_type operator*() const { return *maIt; } + +private: + iterator_type maIt; + iterator_type maEnd; + Pred maPred; +}; + +/** Iterator for constant svx::FrameBorder containers, iterates over all borders. */ +typedef FrameBorderIterBase< const FrameBorderPtrVec, FrameBorderPtrVec::const_iterator, FrameBorderDummy_Pred > + FrameBorderCIter; + +/** Iterator for mutable svx::FrameBorder containers, iterates over all borders. */ +typedef FrameBorderIterBase< FrameBorderPtrVec, FrameBorderPtrVec::iterator, FrameBorderDummy_Pred > + FrameBorderIter; + +/** Iterator for constant svx::FrameBorder containers, iterates over visible borders. */ +typedef FrameBorderIterBase< const FrameBorderPtrVec, FrameBorderPtrVec::const_iterator, FrameBorderVisible_Pred > + VisFrameBorderCIter; + +/** Iterator for mutable svx::FrameBorder containers, iterates over visible borders. */ +typedef FrameBorderIterBase< FrameBorderPtrVec, FrameBorderPtrVec::iterator, FrameBorderVisible_Pred > + VisFrameBorderIter; + +/** Iterator for constant svx::FrameBorder containers, iterates over selected borders. */ +typedef FrameBorderIterBase< const FrameBorderPtrVec, FrameBorderPtrVec::const_iterator, FrameBorderSelected_Pred > + SelFrameBorderCIter; + +/** Iterator for mutable svx::FrameBorder containers, iterates over selected borders. */ +typedef FrameBorderIterBase< FrameBorderPtrVec, FrameBorderPtrVec::iterator, FrameBorderSelected_Pred > + SelFrameBorderIter; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx new file mode 100644 index 0000000000..f134e306e1 --- /dev/null +++ b/svx/source/inc/gridcell.hxx @@ -0,0 +1,1059 @@ +/* -*- 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_SVX_SOURCE_INC_GRIDCELL_HXX +#define INCLUDED_SVX_SOURCE_INC_GRIDCELL_HXX + +#include +#include + +#include "sqlparserclient.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class DbCellControl; +class Edit; +class FmXGridCell; +namespace dbtools { + class FormattedColumnValue; +} + +// DbGridColumn, column description + +class DbGridColumn +{ + friend class DbGridControl; + + css::uno::Reference< css::beans::XPropertySet > m_xModel; + css::uno::Reference< css::beans::XPropertySet > m_xField; // connection to the database field + ::svt::CellControllerRef m_xController; // structure for managing the controls for a column + // this is positioned by the DbBrowseBox on the respective + // cells of a column + rtl::Reference m_pCell; + DbGridControl& m_rParent; + sal_Int32 m_nLastVisibleWidth; // only valid if m_bHidden == sal_True + sal_Int32 m_nFormatKey; + sal_Int16 m_nFieldType; + sal_Int16 m_nTypeId; + sal_uInt16 m_nId; + sal_Int16 m_nFieldPos; + sal_Int16 m_nAlign; // specified with TXT_ALIGN_LEFT... + bool m_bReadOnly : 1; + bool m_bAutoValue : 1; + bool m_bInSave : 1; + bool m_bNumeric : 1; + bool m_bObject : 1; // does the column reference an object datatype? + bool m_bHidden : 1; + bool m_bLocked : 1; + + static ::svt::CellControllerRef s_xEmptyController; + // used by locked columns +public: + DbGridColumn(sal_uInt16 _nId, DbGridControl& rParent) + :m_rParent(rParent) + ,m_nLastVisibleWidth(-1) + ,m_nFormatKey(0) + ,m_nFieldType(0) + ,m_nTypeId(0) + ,m_nId(_nId) + ,m_nFieldPos(-1) + ,m_nAlign(css::awt::TextAlign::LEFT) + ,m_bReadOnly(false) + ,m_bAutoValue(false) + ,m_bInSave(false) + ,m_bNumeric(false) + ,m_bObject(false) + ,m_bHidden(false) + ,m_bLocked(false) + { + } + + ~DbGridColumn(); + + const css::uno::Reference< css::beans::XPropertySet >& getModel() const { return m_xModel; } + void setModel(const css::uno::Reference< css::beans::XPropertySet >& _xModel); + + + sal_uInt16 GetId() const {return m_nId;} + bool IsReadOnly() const {return m_bReadOnly;} + bool IsAutoValue() const {return m_bAutoValue;} + sal_Int16 GetAlignment() const {return m_nAlign;} + sal_Int16 GetFieldPos() const {return m_nFieldPos; } + bool IsNumeric() const {return m_bNumeric;} + bool IsHidden() const {return m_bHidden;} + sal_Int32 GetKey() const {return m_nFormatKey;} + const ::svt::CellControllerRef& GetController() const {return m_bLocked ? s_xEmptyController : m_xController;} + const css::uno::Reference< css::beans::XPropertySet >& GetField() const {return m_xField;} + DbGridControl& GetParent() const {return m_rParent;} + FmXGridCell* GetCell() const {return m_pCell.get();} + + css::uno::Reference< css::sdb::XColumn > GetCurrentFieldValue() const; + + // Drawing a field at a position. If a view is set, it takes over the drawing, + // e.g., for checkboxes. + void Paint(OutputDevice& rDev, + const tools::Rectangle& rRect, + const DbGridRow* pRow, + const css::uno::Reference< css::util::XNumberFormatter >& xFormatter); + + + // Initializing in the alive mode. + // If no ColumnController is set, a default initialization is performed. + void CreateControl(sal_Int32 _nFieldPos, const css::uno::Reference< css::beans::XPropertySet >& xField, sal_Int32 nTypeId); + void UpdateControl() + { + css::uno::Reference< css::beans::XPropertySet > xField(m_xField); + CreateControl(m_nFieldPos, xField, m_nTypeId); + } + + // Editing a Zelle + void UpdateFromField(const DbGridRow* pRow, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter); + bool Commit(); + + // releasing all the data required for the AliveMode + void Clear(); + + OUString GetCellText(const DbGridRow* pRow, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) const; + OUString GetCellText(const css::uno::Reference< css::sdb::XColumn >& xField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) const; + + void SetReadOnly(bool bRead){m_bReadOnly = bRead;} + void SetObject(sal_Int16 nPos) {m_bObject = m_bReadOnly = true; m_nFieldPos = nPos;} + + void ImplInitWindow( vcl::Window const & rParent, const InitWindowFacet _eInitWhat ); + + // properties that can bleed through onto the css::frame::Controller + sal_Int16 SetAlignment(sal_Int16 _nAlign); + // if _nAlign is -1, the alignment is calculated from the type of the field we are bound to + // the value really set is returned + sal_Int16 SetAlignmentFromModel(sal_Int16 nStandardAlign); + // set the alignment according to the "Align"-property of m_xModel, use the given standard + // alignment if the property if void, return the really set alignment + + // column locking + bool isLocked() const { return m_bLocked; } + void setLock(bool _bLock); + +private: + /** attaches or detaches our cell object to the SctriptEventAttacherManager implemented + by our model's parent + */ + void impl_toggleScriptManager_nothrow( bool _bAttach ); +}; + + +// DbCellControl, provides the data for a CellController. +// Is usually only required for complex controls such as combo boxes. + +class DbCellControl + :public cppu::BaseMutex // _before_ the listener, so the listener is to be destroyed first! + ,public ::comphelper::OPropertyChangeListener +{ +private: + rtl::Reference<::comphelper::OPropertyChangeMultiplexer> m_pModelChangeBroadcaster; + rtl::Reference<::comphelper::OPropertyChangeMultiplexer> m_pFieldChangeBroadcaster; + +private: + bool m_bTransparent : 1; + bool m_bAlignedController : 1; + bool m_bAccessingValueProperty : 1; + + css::uno::Reference< css::sdbc::XRowSet > + m_xCursor; + +protected: + DbGridColumn& m_rColumn; + VclPtr m_pPainter; + VclPtr m_pWindow; + +protected: + // attribute access + const css::uno::Reference< css::sdbc::XRowSet >& getCursor() const { return m_xCursor; } + + // control transparency + bool isTransparent( ) const { return m_bTransparent; } + void setTransparent( bool _bSet ) { m_bTransparent = _bSet; } + + // control alignment + void setAlignedController( bool _bAlign ) { m_bAlignedController = _bAlign; } + + + /** determined whether or not the value property is locked + @see lockValueProperty + */ + inline bool isValuePropertyLocked() const; + + /** locks the listening at the value property. +

This means that every subsequent change now done on the value property of the model ("Text", or "Value", + or whatever) is then ignored.
+ This base class uses this setting in Commit.

+ @precond + Value locking can't be nested + @see unlockValueProperty + */ + inline void lockValueProperty(); + /** unlocks the listening at the value property + @see lockValueProperty + */ + inline void unlockValueProperty(); + +protected: + // adds the given property to the list of properties which we listen for + void doPropertyListening( const OUString& _rPropertyName ); + + // called whenever a property which affects field settings in general is called + // you should overwrite this method for every property you add yourself as listener to + // with doPropertyListening + virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ); + + // called by _propertyChanged if a property which denotes the column value has changed + void implValuePropertyChanged( ); + + +public: + DbCellControl(DbGridColumn& _rColumn); + virtual ~DbCellControl() override; + + svt::ControlBase& GetWindow() const + { + ENSURE_OR_THROW( m_pWindow, "no window" ); + return *m_pWindow; + } + + // control alignment + bool isAlignedController() const { return m_bAlignedController; } + void AlignControl(sal_Int16 nAlignment); + + void SetTextLineColor(); + void SetTextLineColor(const Color& _rColor); + + // initializing before a control is displayed + virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ); + virtual ::svt::CellControllerRef CreateController() const = 0; + + // writing the value into the model + bool Commit(); + + // Formatting the field data to output text + virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) = 0; + + virtual void Update(){} + // Refresh the control by the field data + virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) = 0; + + // painting a cell content in the specified rectangle + virtual void PaintFieldToCell( OutputDevice& rDev, const tools::Rectangle& rRect, const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter); + virtual void PaintCell( OutputDevice& _rDev, const tools::Rectangle& _rRect ); + + void ImplInitWindow( vcl::Window const & rParent, const InitWindowFacet _eInitWhat ); + + double GetValue(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) const; + +protected: + void invalidatedController(); + + /** commits the content of the control (e.g. the text of an edit field) into the column model + (e.g. the "Text" property of the model). +

To be overwritten in derived classes.

+ @see updateFromModel + */ + virtual bool commitControl( ) = 0; + + /** updates the current content of the control (e.g. the text of an edit field) from the column model + (e.g. the "Text" property of the model). +

To be overwritten in derived classes.

+ @precond + NULL != _rxModel + @precond + NULL != m_pWindow + + @see commitControl + */ + virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) = 0; + +protected: +// OPropertyChangeListener + virtual void _propertyChanged(const css::beans::PropertyChangeEvent& evt) override; + +private: + void implDoPropertyListening( const OUString& _rPropertyName, bool _bWarnIfNotExistent ); + + /// updates the "readonly" setting on m_pWindow, according to the respective property value in the given model + void implAdjustReadOnly( const css::uno::Reference< css::beans::XPropertySet >& _rxModel,bool i_bReadOnly ); + + /// updates the "enabled" setting on m_pWindow, according to the respective property value in the given model + void implAdjustEnabled( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ); +}; + + +inline bool DbCellControl::isValuePropertyLocked() const +{ + return m_bAccessingValueProperty; +} + + +inline void DbCellControl::lockValueProperty() +{ + OSL_ENSURE( !isValuePropertyLocked(), "DbCellControl::lockValueProperty: not to be nested!" ); + m_bAccessingValueProperty = true; +} + + +inline void DbCellControl::unlockValueProperty() +{ + OSL_ENSURE( isValuePropertyLocked(), "DbCellControl::lockValueProperty: not locked so far!" ); + m_bAccessingValueProperty = false; +} + + +/** a field which is bound to a column which supports the MaxTextLen property +*/ +class DbLimitedLengthField : public DbCellControl +{ +public: + +protected: + DbLimitedLengthField( DbGridColumn& _rColumn ); + +protected: + // DbCellControl + virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override; + +protected: + void implSetMaxTextLen( sal_Int16 _nMaxLen ) + { + implSetEffectiveMaxTextLen(_nMaxLen); + } + virtual void implSetEffectiveMaxTextLen( sal_Int32 _nMaxLen ); +}; + + +class DbTextField final : public DbLimitedLengthField +{ + std::unique_ptr<::svt::IEditImplementation> m_pEdit; + std::unique_ptr<::svt::IEditImplementation> m_pPainterImplementation; + bool m_bIsMultiLineEdit; + + virtual ~DbTextField( ) override; + +public: + DbTextField(DbGridColumn& _rColumn); + + ::svt::IEditImplementation* GetEditImplementation() { return m_pEdit.get(); } + bool IsMultiLineEdit() const { return m_bIsMultiLineEdit; } + + virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ) override; + virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override; + virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override; + virtual ::svt::CellControllerRef CreateController() const override; + virtual void PaintFieldToCell( OutputDevice& _rDev, const tools::Rectangle& _rRect, + const css::uno::Reference< css::sdb::XColumn >& _rxField, + const css::uno::Reference< css::util::XNumberFormatter >& _rxFormatter ) override; + +private: + // DbCellControl + virtual bool commitControl( ) override; + virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override; + // DbLimitedLengthField + virtual void implSetEffectiveMaxTextLen( sal_Int32 _nMaxLen ) override; +}; + + +class DbFormattedField final : public DbLimitedLengthField +{ +public: + DbFormattedField(DbGridColumn& _rColumn); + virtual ~DbFormattedField() override; + + virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ) override; + virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override; + virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override; + virtual ::svt::CellControllerRef CreateController() const override; + +private: + // DbCellControl + virtual bool commitControl( ) override; + virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override; + + // OPropertyChangeListener + virtual void _propertyChanged(const css::beans::PropertyChangeEvent& evt) override; + + css::uno::Reference< css::util::XNumberFormatsSupplier > m_xSupplier; +}; + + +class DbCheckBox final : public DbCellControl +{ +public: + DbCheckBox(DbGridColumn& _rColumn); + + virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ) override; + virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override; + virtual ::svt::CellControllerRef CreateController() const override; + virtual void PaintFieldToCell(OutputDevice& rDev, const tools::Rectangle& rRect, + const css::uno::Reference< css::sdb::XColumn >& _rxField, + const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override; + virtual void PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect) override; + virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override; + +private: + // DbCellControl + virtual bool commitControl( ) override; + virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override; +}; + + +class DbComboBox final : public DbCellControl +{ + +public: + DbComboBox(DbGridColumn& _rColumn); + + virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ) override; + virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override; + virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override; + virtual ::svt::CellControllerRef CreateController() const override; + + void SetList(const css::uno::Any& rItems); + +private: + // DbCellControl + virtual bool commitControl( ) override; + virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override; + + virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override; + + // OPropertyChangeListener + virtual void _propertyChanged(const css::beans::PropertyChangeEvent& evt) override; +}; + + +class DbListBox final : public DbCellControl +{ + bool m_bBound : 1; + css::uno::Sequence< OUString > m_aValueList; + +public: + DbListBox(DbGridColumn& _rColumn); + + virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ) override; + virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override; + virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override; + virtual ::svt::CellControllerRef CreateController() const override; + + void SetList(const css::uno::Any& rItems); + +private: + // DbCellControl + virtual bool commitControl( ) override; + virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override; + + virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override; + + // OPropertyChangeListener + virtual void _propertyChanged(const css::beans::PropertyChangeEvent& evt) override; +}; + + +class DbPatternField final : public DbCellControl +{ +public: + DbPatternField( DbGridColumn& _rColumn, const css::uno::Reference& _rContext ); + virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ) override; + virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override; + virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override; + virtual ::svt::CellControllerRef CreateController() const override; + +private: + /// DbCellControl + virtual bool commitControl( ) override; + virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override; + + virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override; + + OUString impl_formatText(const OUString& _rText); + + ::std::unique_ptr< ::dbtools::FormattedColumnValue > m_pValueFormatter; + ::std::unique_ptr< ::dbtools::FormattedColumnValue > m_pPaintFormatter; + css::uno::Reference m_xContext; +}; + + +class DbSpinField : public DbCellControl +{ +private: + sal_Int16 m_nStandardAlign; + +public: + +protected: + DbSpinField( DbGridColumn& _rColumn, sal_Int16 _nStandardAlign = css::awt::TextAlign::RIGHT ); + +public: + virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& _rxCursor ) override; + virtual ::svt::CellControllerRef CreateController() const override; + +protected: + virtual VclPtr createField( + BrowserDataWin* _pParent, + bool bSpinButton, + const css::uno::Reference< css::beans::XPropertySet >& _rxModel + ) = 0; +}; + +class DbDateField final : public DbSpinField +{ +public: + DbDateField(DbGridColumn& _rColumn); + virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override; + virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override; + +private: + // DbCellControl + virtual bool commitControl( ) override; + virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override; + + // DbSpinField + virtual VclPtr createField( + BrowserDataWin* _pParent, + bool bSpinButton, + const css::uno::Reference< css::beans::XPropertySet >& _rxModel + ) override; + + /// initializes everything which relates to the properties describing the numeric behaviour + virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override; +}; + +class DbTimeField final : public DbSpinField +{ +public: + DbTimeField(DbGridColumn& _rColumn); + virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override; + virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override; + +private: + // DbCellControl + virtual bool commitControl( ) override; + virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override; + + // DbSpinField + virtual VclPtr createField( + BrowserDataWin* _pParent, + bool bSpinButton, + const css::uno::Reference< css::beans::XPropertySet >& _rxModel + ) override; + + /// initializes everything which relates to the properties describing the numeric behaviour + virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override; +}; + +class DbCurrencyField final : public DbSpinField +{ +public: + DbCurrencyField(DbGridColumn& _rColumn); + virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override; + virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override; + +private: + // DbCellControl + virtual bool commitControl( ) override; + virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override; + + // DbSpinField + virtual VclPtr createField( + BrowserDataWin* _pParent, + bool bSpinButton, + const css::uno::Reference< css::beans::XPropertySet >& _rxModel + ) override; + + /// initializes everything which relates to the properties describing the numeric behaviour + virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override; +}; + +class DbNumericField final : public DbSpinField +{ +public: + DbNumericField(DbGridColumn& _rColumn); + + virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override; + virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override; + +private: + // DbCellControl + virtual bool commitControl( ) override; + virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override; + + // DbSpinField + virtual VclPtr createField( + BrowserDataWin* _pParent, + bool bSpinButton, + const css::uno::Reference< css::beans::XPropertySet >& _rxModel + ) override; + + /// initializes everything which relates to the properties describing the numeric behaviour + void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override; +}; + +class DbFilterField final + :public DbCellControl + ,public ::svxform::OSQLParserClient +{ +public: + DbFilterField(const css::uno::Reference< css::uno::XComponentContext >& rxContext, DbGridColumn& _rColumn); + virtual ~DbFilterField() override; + + virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ) override; + virtual ::svt::CellControllerRef CreateController() const override; + virtual void PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect) override; + virtual void Update() override; + virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override; + virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override; + + const OUString& GetText() const {return m_aText;} + void SetText(const OUString& rText); + + void SetCommitHdl( const Link& rLink ) { m_aCommitLink = rLink; } + +private: + // DbCellControl + virtual bool commitControl( ) override; + virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override; + + void SetList(const css::uno::Any& rItems, bool bComboBox); + void CreateControl(BrowserDataWin* pParent, const css::uno::Reference< css::beans::XPropertySet >& xModel); + DECL_LINK(OnToggle, weld::CheckButton&, void); + + css::uno::Sequence< OUString > m_aValueList; + OUString m_aText; + Link m_aCommitLink; + sal_Int16 m_nControlClass; + bool m_bFilterList : 1; + bool m_bFilterListFilled : 1; +}; + + +// Base class providing the access to a grid cell + +typedef ::cppu::ImplHelper2 < css::awt::XControl + , css::form::XBoundControl + > FmXGridCell_Base; +typedef ::cppu::ImplHelper1 < css::awt::XWindow + > FmXGridCell_WindowBase; +class FmXGridCell :public ::cppu::OComponentHelper + ,public FmXGridCell_Base + ,public FmXGridCell_WindowBase +{ +protected: + ::osl::Mutex m_aMutex; + DbGridColumn* m_pColumn; + std::unique_ptr m_pCellControl; + +private: + ::comphelper::OInterfaceContainerHelper3 m_aWindowListeners; + ::comphelper::OInterfaceContainerHelper3 m_aFocusListeners; + ::comphelper::OInterfaceContainerHelper3 m_aKeyListeners; + ::comphelper::OInterfaceContainerHelper3 m_aMouseListeners; + ::comphelper::OInterfaceContainerHelper3 m_aMouseMotionListeners; + +protected: + virtual ~FmXGridCell() override; + +public: + FmXGridCell( DbGridColumn* pColumn, std::unique_ptr pControl ); + void init(); + + DECLARE_UNO3_AGG_DEFAULTS(FmXGridCell, OComponentHelper) + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override; + + void SetTextLineColor(); + void SetTextLineColor(const Color& _rColor); + +// XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + +// OComponentHelper + virtual void SAL_CALL disposing() override; + +// css::lang::XComponent + virtual void SAL_CALL dispose() override {OComponentHelper::dispose();} + virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener >& aListener) override { OComponentHelper::addEventListener(aListener);} + virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener >& aListener) override { OComponentHelper::removeEventListener(aListener);} + +// css::awt::XControl + virtual void SAL_CALL setContext(const css::uno::Reference< css::uno::XInterface >& /*Context*/) override {} + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getContext() override; + virtual void SAL_CALL createPeer(const css::uno::Reference< css::awt::XToolkit >& /*Toolkit*/, const css::uno::Reference< css::awt::XWindowPeer >& /*Parent*/) override {} + + virtual css::uno::Reference< css::awt::XWindowPeer > SAL_CALL getPeer() override {return css::uno::Reference< css::awt::XWindowPeer > ();} + virtual sal_Bool SAL_CALL setModel(const css::uno::Reference< css::awt::XControlModel >& /*Model*/) override {return false;} + virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override; + virtual css::uno::Reference< css::awt::XView > SAL_CALL getView() override {return css::uno::Reference< css::awt::XView > ();} + virtual void SAL_CALL setDesignMode(sal_Bool /*bOn*/) override {} + virtual sal_Bool SAL_CALL isDesignMode() override {return false;} + virtual sal_Bool SAL_CALL isTransparent() override {return false;} + +// css::form::XBoundControl + virtual sal_Bool SAL_CALL getLock() override; + virtual void SAL_CALL setLock(sal_Bool _bLock) override; + + // XWindow + virtual void SAL_CALL setPosSize( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height, ::sal_Int16 Flags ) override; + virtual css::awt::Rectangle SAL_CALL getPosSize( ) override; + virtual void SAL_CALL setVisible( sal_Bool Visible ) override; + virtual void SAL_CALL setEnable( sal_Bool Enable ) override; + virtual void SAL_CALL setFocus( ) override; + virtual void SAL_CALL addWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) override; + virtual void SAL_CALL removeWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) override; + virtual void SAL_CALL addFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) override; + virtual void SAL_CALL removeFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) override; + virtual void SAL_CALL addKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) override; + virtual void SAL_CALL removeKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) override; + virtual void SAL_CALL addMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override; + virtual void SAL_CALL removeMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override; + virtual void SAL_CALL addMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override; + virtual void SAL_CALL removeMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override; + virtual void SAL_CALL addPaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override; + virtual void SAL_CALL removePaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override; + + bool Commit() {return m_pCellControl->Commit();} + void ImplInitWindow( vcl::Window const & rParent, const InitWindowFacet _eInitWhat ) + { m_pCellControl->ImplInitWindow( rParent, _eInitWhat ); } + + bool isAlignedController() const { return m_pCellControl->isAlignedController(); } + void AlignControl(sal_Int16 nAlignment) + { m_pCellControl->AlignControl(nAlignment);} + +protected: + // default implementations call our focus listeners, don't forget to call them if you override this + virtual void onFocusGained( const css::awt::FocusEvent& _rEvent ); + virtual void onFocusLost( const css::awt::FocusEvent& _rEvent ); + +private: + svt::ControlBase* getEventWindow() const; + DECL_LINK(OnFocusGained, LinkParamNone*, void); + DECL_LINK(OnFocusLost, LinkParamNone*, void); + DECL_LINK(OnMousePress, const MouseEvent&, void); + DECL_LINK(OnMouseRelease, const MouseEvent&, void); + DECL_LINK(OnMouseMove, const MouseEvent&, void); + DECL_LINK(OnKeyInput, const KeyEvent&, void); + DECL_LINK(OnKeyRelease, const KeyEvent&, void); +}; + + +class FmXDataCell : public FmXGridCell +{ +public: + FmXDataCell( DbGridColumn* pColumn, std::unique_ptr pControl ) + :FmXGridCell( pColumn, std::move(pControl) ) + { + } + + virtual void PaintFieldToCell(OutputDevice& rDev, + const tools::Rectangle& rRect, + const css::uno::Reference< css::sdb::XColumn >& xField, + const css::uno::Reference< css::util::XNumberFormatter >& xFormatter); + + void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& xField, + const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) + { m_pCellControl->UpdateFromField(xField, xFormatter); } + +protected: + void UpdateFromColumn(); +}; + + +class FmXTextCell : public FmXDataCell +{ +protected: + bool m_bIsMultiLineText; + +public: + FmXTextCell( DbGridColumn* pColumn, std::unique_ptr pControl ); + + virtual void PaintFieldToCell(OutputDevice& rDev, + const tools::Rectangle& rRect, + const css::uno::Reference< css::sdb::XColumn >& xField, + const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override; + + OUString GetText(const css::uno::Reference< css::sdb::XColumn >& _rxField, + const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, + const Color** ppColor = nullptr) + {return m_pCellControl->GetFormatText(_rxField, xFormatter, ppColor);} +}; + + +typedef ::cppu::ImplHelper2 < css::awt::XTextComponent + , css::form::XChangeBroadcaster + > FmXEditCell_Base; +class FmXEditCell final : public FmXTextCell, + public FmXEditCell_Base +{ +public: + FmXEditCell( DbGridColumn* pColumn, std::unique_ptr pControl ); + + DECLARE_UNO3_AGG_DEFAULTS(FmXEditCell, FmXTextCell) + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override; + +// XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + +// OComponentHelper + virtual void SAL_CALL disposing() override; + +// css::awt::XTextComponent + virtual void SAL_CALL addTextListener(const css::uno::Reference< css::awt::XTextListener >& l) override; + virtual void SAL_CALL removeTextListener(const css::uno::Reference< css::awt::XTextListener >& l) override; + virtual void SAL_CALL setText(const OUString& aText) override; + virtual void SAL_CALL insertText(const css::awt::Selection& Sel, const OUString& Text) override; + virtual OUString SAL_CALL getText() override; + virtual OUString SAL_CALL getSelectedText() override; + virtual void SAL_CALL setSelection(const css::awt::Selection& aSelection) override; + virtual css::awt::Selection SAL_CALL getSelection() override; + virtual sal_Bool SAL_CALL isEditable() override; + virtual void SAL_CALL setEditable(sal_Bool bEditable) override; + virtual void SAL_CALL setMaxTextLen(sal_Int16 nLen) override; + virtual sal_Int16 SAL_CALL getMaxTextLen() override; + + // XChangeBroadcaster + virtual void SAL_CALL addChangeListener( const css::uno::Reference< css::form::XChangeListener >& aListener ) override; + virtual void SAL_CALL removeChangeListener( const css::uno::Reference< css::form::XChangeListener >& aListener ) override; + +private: + virtual ~FmXEditCell() override; + + virtual void onFocusGained( const css::awt::FocusEvent& _rEvent ) override; + virtual void onFocusLost( const css::awt::FocusEvent& _rEvent ) override; + + DECL_LINK(ModifyHdl, LinkParamNone*, void); + + void onTextChanged(); + + OUString m_sValueOnEnter; + ::comphelper::OInterfaceContainerHelper3 m_aTextListeners; + ::comphelper::OInterfaceContainerHelper3 m_aChangeListeners; + ::svt::IEditImplementation* m_pEditImplementation; + bool m_bOwnEditImplementation; +}; + +typedef ::cppu::ImplHelper2 < css::awt::XCheckBox + , css::awt::XButton + > FmXCheckBoxCell_Base; +class FmXCheckBoxCell final : public FmXDataCell, + public FmXCheckBoxCell_Base +{ + ::comphelper::OInterfaceContainerHelper3 m_aItemListeners; + ::comphelper::OInterfaceContainerHelper3 m_aActionListeners; + OUString m_aActionCommand; + VclPtr<::svt::CheckBoxControl> m_pBox; + + DECL_LINK(ModifyHdl, LinkParamNone*, void); + + virtual ~FmXCheckBoxCell() override; + +public: + FmXCheckBoxCell( DbGridColumn* pColumn, std::unique_ptr pControl ); + +// UNO + DECLARE_UNO3_AGG_DEFAULTS(FmXCheckBoxCell, FmXDataCell) + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override; + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + +// OComponentHelper + virtual void SAL_CALL disposing() override; + +// css::awt::XCheckBox + 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 sal_Int16 SAL_CALL getState() override; + virtual void SAL_CALL setState(sal_Int16 n) override; + virtual void SAL_CALL setLabel(const OUString& Label) override; + virtual void SAL_CALL enableTriState(sal_Bool b) override; + + // XButton + virtual void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + virtual void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override; + //virtual void SAL_CALL setLabel( const OUString& Label ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setActionCommand( const OUString& Command ) override; +}; + +typedef ::cppu::ImplHelper1 < css::awt::XListBox + > FmXListBoxCell_Base; +class FmXListBoxCell final : public FmXTextCell + , public FmXListBoxCell_Base +{ +public: + FmXListBoxCell( DbGridColumn* pColumn, std::unique_ptr pControl ); + + DECLARE_UNO3_AGG_DEFAULTS(FmXListBoxCell, FmXTextCell) + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override; + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + +// OComponentHelper + virtual void SAL_CALL disposing() override; + +// css::awt::XListBox + 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 addActionListener(const css::uno::Reference< css::awt::XActionListener >& l) override; + virtual void SAL_CALL removeActionListener(const css::uno::Reference< css::awt::XActionListener >& l) override; + virtual void SAL_CALL addItem(const OUString& aItem, sal_Int16 nPos) override; + virtual void SAL_CALL addItems(const css::uno::Sequence< OUString >& aItems, sal_Int16 nPos) override; + virtual void SAL_CALL removeItems(sal_Int16 nPos, sal_Int16 nCount) override; + virtual sal_Int16 SAL_CALL getItemCount() override; + virtual OUString SAL_CALL getItem(sal_Int16 nPos) override; + virtual css::uno::Sequence< OUString > SAL_CALL getItems() override; + virtual sal_Int16 SAL_CALL getSelectedItemPos() override; + virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSelectedItemsPos() override; + virtual OUString SAL_CALL getSelectedItem() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSelectedItems() override; + virtual void SAL_CALL selectItemPos(sal_Int16 nPos, sal_Bool bSelect) override; + virtual void SAL_CALL selectItemsPos(const css::uno::Sequence< sal_Int16 >& aPositions, sal_Bool bSelect) override; + virtual void SAL_CALL selectItem(const OUString& aItem, sal_Bool bSelect) override; + virtual sal_Bool SAL_CALL isMutipleMode() override; + virtual void SAL_CALL setMultipleMode(sal_Bool bMulti) override; + virtual sal_Int16 SAL_CALL getDropDownLineCount() override; + virtual void SAL_CALL setDropDownLineCount(sal_Int16 nLines) override; + virtual void SAL_CALL makeVisible(sal_Int16 nEntry) override; + +private: + virtual ~FmXListBoxCell() override; + + DECL_LINK(ChangedHdl, bool, void); + + void OnDoubleClick(); + + ::comphelper::OInterfaceContainerHelper3 m_aItemListeners; + ::comphelper::OInterfaceContainerHelper3 m_aActionListeners; + VclPtr<::svt::ListBoxControl> m_pBox; + sal_uInt16 m_nLines; + bool m_bMulti; +}; + + +typedef ::cppu::ImplHelper1 < css::awt::XComboBox + > FmXComboBoxCell_Base; +class FmXComboBoxCell final : public FmXTextCell + , public FmXComboBoxCell_Base +{ +private: + ::comphelper::OInterfaceContainerHelper3 m_aItemListeners; + ::comphelper::OInterfaceContainerHelper3 m_aActionListeners; + VclPtr<::svt::ComboBoxControl> m_pComboBox; + sal_uInt16 m_nLines; + + DECL_LINK(ChangedHdl, bool, void); + + virtual ~FmXComboBoxCell() override; + +public: + FmXComboBoxCell( DbGridColumn* pColumn, std::unique_ptr pControl ); + + DECLARE_UNO3_AGG_DEFAULTS(FmXListBoxCell, FmXTextCell) + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override; + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // OComponentHelper + virtual void SAL_CALL disposing() override; + + // XComboBox + virtual void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& Listener ) override; + virtual void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& Listener ) override; + virtual void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& Listener ) override; + virtual void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& Listener ) override; + virtual void SAL_CALL addItem( const OUString& Item, ::sal_Int16 Pos ) override; + virtual void SAL_CALL addItems( const css::uno::Sequence< OUString >& Items, ::sal_Int16 Pos ) override; + virtual void SAL_CALL removeItems( ::sal_Int16 nPos, ::sal_Int16 nCount ) override; + virtual ::sal_Int16 SAL_CALL getItemCount( ) override; + virtual OUString SAL_CALL getItem( ::sal_Int16 Pos ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getItems( ) override; + virtual ::sal_Int16 SAL_CALL getDropDownLineCount( ) override; + virtual void SAL_CALL setDropDownLineCount( ::sal_Int16 Lines ) override; +}; + +typedef ::cppu::ImplHelper1 < css::awt::XTextComponent + > FmXFilterCell_Base; +class FmXFilterCell final : public FmXGridCell + ,public FmXFilterCell_Base +{ +public: + FmXFilterCell(DbGridColumn* pColumn, std::unique_ptr pControl); + + + DECLARE_UNO3_AGG_DEFAULTS(FmXFilterCell, FmXGridCell) + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override; + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + +// painting the filter text + void PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect); + void Update(){m_pCellControl->Update();} + +// OComponentHelper + virtual void SAL_CALL disposing() override; + +// css::awt::XTextComponent + virtual void SAL_CALL addTextListener(const css::uno::Reference< css::awt::XTextListener >& l) override; + virtual void SAL_CALL removeTextListener(const css::uno::Reference< css::awt::XTextListener >& l) override; + virtual void SAL_CALL setText(const OUString& aText) override; + virtual void SAL_CALL insertText(const css::awt::Selection& Sel, const OUString& Text) override; + virtual OUString SAL_CALL getText() override; + virtual OUString SAL_CALL getSelectedText() override; + virtual void SAL_CALL setSelection(const css::awt::Selection& aSelection) override; + virtual css::awt::Selection SAL_CALL getSelection() override; + virtual sal_Bool SAL_CALL isEditable() override; + virtual void SAL_CALL setEditable(sal_Bool bEditable) override; + virtual void SAL_CALL setMaxTextLen(sal_Int16 nLen) override; + virtual sal_Int16 SAL_CALL getMaxTextLen() override; + +private: + DECL_LINK( OnCommit, DbFilterField&, void ); + virtual ~FmXFilterCell() override; + + ::comphelper::OInterfaceContainerHelper3 m_aTextListeners; +}; + +#endif // INCLUDED_SVX_SOURCE_INC_GRIDCELL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/gridcols.hxx b/svx/source/inc/gridcols.hxx new file mode 100644 index 0000000000..180337f7f5 --- /dev/null +++ b/svx/source/inc/gridcols.hxx @@ -0,0 +1,54 @@ +/* -*- 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_SVX_SOURCE_INC_GRIDCOLS_HXX +#define INCLUDED_SVX_SOURCE_INC_GRIDCOLS_HXX + +#include +#include + +#define FM_COL_TEXTFIELD "TextField" +#define FM_COL_COMBOBOX "ComboBox" +#define FM_COL_CHECKBOX "CheckBox" +#define FM_COL_TIMEFIELD "TimeField" +#define FM_COL_DATEFIELD "DateField" +#define FM_COL_NUMERICFIELD "NumericField" +#define FM_COL_CURRENCYFIELD "CurrencyField" +#define FM_COL_PATTERNFIELD "PatternField" +#define FM_COL_LISTBOX "ListBox" +#define FM_COL_FORMATTEDFIELD "FormattedField" + +// column type ids +#define TYPE_CHECKBOX 0 +#define TYPE_COMBOBOX 1 +#define TYPE_CURRENCYFIELD 2 +#define TYPE_DATEFIELD 3 +#define TYPE_FORMATTEDFIELD 4 +#define TYPE_LISTBOX 5 +#define TYPE_NUMERICFIELD 6 +#define TYPE_PATTERNFIELD 7 +#define TYPE_TEXTFIELD 8 +#define TYPE_TIMEFIELD 9 + + +sal_Int32 getColumnTypeByModelName(const OUString& aModelName); + + +#endif // INCLUDED_SVX_SOURCE_INC_GRIDCOLS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/sdbdatacolumn.hxx b/svx/source/inc/sdbdatacolumn.hxx new file mode 100644 index 0000000000..76d8039c82 --- /dev/null +++ b/svx/source/inc/sdbdatacolumn.hxx @@ -0,0 +1,59 @@ +/* -*- 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_SVX_SOURCE_INC_SDBDATACOLUMN_HXX +#define INCLUDED_SVX_SOURCE_INC_SDBDATACOLUMN_HXX + +#include +#include +#include + + +namespace svxform +{ + + + //= DataColumn - a class wrapping an object implementing a sdb::DataColumn service + + class DataColumn + { + // interfaces needed for sddb::Column + css::uno::Reference< css::beans::XPropertySet> m_xPropertySet; + // interfaces needed for sdb::DataColumn + css::uno::Reference< css::sdb::XColumn> m_xColumn; + css::uno::Reference< css::sdb::XColumnUpdate> m_xColumnUpdate; + + public: + DataColumn(const css::uno::Reference< css::beans::XPropertySet>& _rxIFace); + // if the object behind _rxIFace doesn't fully support the DataColumn service, + // (which is checked via the supported interfaces) _all_ members will be set to + // void !, even if the object has some of the needed interfaces. + + // 'conversions' + const css::uno::Reference< css::sdb::XColumn>& getColumn() const + { + return m_xColumn; + } + }; + +} + +#endif // INCLUDED_SVX_SOURCE_INC_SDBDATACOLUMN_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/sqlparserclient.hxx b/svx/source/inc/sqlparserclient.hxx new file mode 100644 index 0000000000..a14ea36711 --- /dev/null +++ b/svx/source/inc/sqlparserclient.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 . + */ + +#ifndef INCLUDED_SVX_SOURCE_INC_SQLPARSERCLIENT_HXX +#define INCLUDED_SVX_SOURCE_INC_SQLPARSERCLIENT_HXX + +#include +#include + +#include + +#include + +namespace com::sun::star { + namespace util { + class XNumberFormatter; + } + namespace beans { + class XPropertySet; + } +} +namespace connectivity { + class OSQLParser; + class OSQLParseNode; +} + +namespace svxform +{ + //= OSQLParserClient + + class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) OSQLParserClient : public ::svxform::OParseContextClient + { + protected: + mutable std::shared_ptr< ::connectivity::OSQLParser > m_pParser; + + OSQLParserClient( + const css::uno::Reference< css::uno::XComponentContext >& rxContext); + + std::unique_ptr< ::connectivity::OSQLParseNode > predicateTree( + OUString& _rErrorMessage, + const OUString& _rStatement, + const css::uno::Reference< css::util::XNumberFormatter >& _rxFormatter, + const css::uno::Reference< css::beans::XPropertySet >& _rxField + ) const; + }; + + +} + + +#endif // INCLUDED_SVX_SOURCE_INC_SQLPARSERCLIENT_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/svdobjplusdata.hxx b/svx/source/inc/svdobjplusdata.hxx new file mode 100644 index 0000000000..ef2bc2abd0 --- /dev/null +++ b/svx/source/inc/svdobjplusdata.hxx @@ -0,0 +1,47 @@ +/* -*- 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/. +*/ + +#ifndef INCLUDED_SVX_SVDOBJPLUSDATA_HXX +#define INCLUDED_SVX_SVDOBJPLUSDATA_HXX + +#include +#include + +class SdrObject; +class SfxBroadcaster; +class SdrObjUserDataList; +class SdrGluePointList; + +// Bitsack for DrawObjects +class SdrObjPlusData final +{ + friend class SdrObject; + + std::unique_ptr pBroadcast; // broadcaster, if this object is referenced (bVirtObj=true). Also for connectors etc. + std::unique_ptr pUserDataList; // application specific data + std::unique_ptr pGluePoints; // gluepoints for glueing object connectors + + // #i68101# + // object name, title and description + OUString aObjName; + OUString aObjTitle; + OUString aObjDescription; + bool isDecorative = false; + +public: + SdrObjPlusData(); + ~SdrObjPlusData(); + SdrObjPlusData* Clone(SdrObject* pObj1) const; + + void SetGluePoints(const SdrGluePointList& rPts); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/svdobjuserdatalist.hxx b/svx/source/inc/svdobjuserdatalist.hxx new file mode 100644 index 0000000000..d2cb0e16ab --- /dev/null +++ b/svx/source/inc/svdobjuserdatalist.hxx @@ -0,0 +1,37 @@ +/* -*- 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/. +*/ + +#ifndef INCLUDED_SVX_SVDOBJUSERDATALIST_HXX +#define INCLUDED_SVX_SVDOBJUSERDATALIST_HXX + +#include + +#include +#include + +class SdrObjUserData; + +class SdrObjUserDataList +{ + typedef std::vector> ListType; + ListType maList; + +public: + SdrObjUserDataList(); + ~SdrObjUserDataList(); + + size_t GetUserDataCount() const; + SdrObjUserData& GetUserData(size_t nNum); + void AppendUserData(std::unique_ptr pData); + void DeleteUserData(size_t nNum); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/svdoutlinercache.hxx b/svx/source/inc/svdoutlinercache.hxx new file mode 100644 index 0000000000..01679f6b93 --- /dev/null +++ b/svx/source/inc/svdoutlinercache.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 . + */ + +#ifndef INCLUDED_SVX_SOURCE_INC_SVDOUTLINERCACHE_HXX +#define INCLUDED_SVX_SOURCE_INC_SVDOUTLINERCACHE_HXX + +#include +#include +#include + +class SdrModel; +class SdrOutliner; +enum class OutlinerMode; + +class SdrOutlinerCache +{ +private: + SdrModel* mpModel; + std::vector< std::unique_ptr > maModeOutline; + std::vector< std::unique_ptr > maModeText; + o3tl::sorted_vector< SdrOutliner* > maActiveOutliners; + +public: + SdrOutlinerCache( SdrModel* pModel ); + ~SdrOutlinerCache(); + + std::unique_ptr createOutliner( OutlinerMode nOutlinerMode ); + void disposeOutliner( std::unique_ptr pOutliner ); + std::vector< SdrOutliner* > GetActiveOutliners() const; +}; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/svdpdf.hxx b/svx/source/inc/svdpdf.hxx new file mode 100644 index 0000000000..a644bee45d --- /dev/null +++ b/svx/source/inc/svdpdf.hxx @@ -0,0 +1,142 @@ +/* -*- 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_SVX_SOURCE_SVDRAW_SVDPDF_HXX +#define INCLUDED_SVX_SOURCE_SVDRAW_SVDPDF_HXX + +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#include + +// Forward Declarations + +class SfxItemSet; +class SdrObjList; +class SdrModel; +class SdrPage; +class SdrObject; +class SvdProgressInfo; + +// Helper Class to import PDF +class ImpSdrPdfImport final +{ + std::vector> maTmpList; + ScopedVclPtr mpVD; + tools::Rectangle maScaleRect; + size_t mnMapScalingOfs; // from here on, not edited with MapScaling + std::unique_ptr mpLineAttr; + std::unique_ptr mpFillAttr; + std::unique_ptr mpTextAttr; + SdrModel* mpModel; + SdrLayerID mnLayer; + Color maOldLineColor; + sal_Int32 mnLineWidth; + static constexpr css::drawing::LineCap gaLineCap = css::drawing::LineCap_BUTT; + XDash maDash; + + bool mbMov; + bool mbSize; + Point maOfs; + double mfScaleX; + double mfScaleY; + Fraction maScaleX; + Fraction maScaleY; + + bool mbFntDirty; + + // to optimize (PenNULL,Brush,DrawPoly),(Pen,BrushNULL,DrawPoly) -> two-in-one + bool mbLastObjWasPolyWithoutLine; + bool mbNoLine; + bool mbNoFill; + + // clipregion + basegfx::B2DPolyPolygon maClip; + + std::unique_ptr mpPdfDocument; + int mnPageCount; + double mdPageHeightPts; + /// The current transformation matrix, typically used with Form objects. + basegfx::B2DHomMatrix maCurrentMatrix; + + /// Correct the vertical coordinate to start at the top. + /// PDF coordinate system has origin at the bottom right. + double correctVertOrigin(double offsetPts) const { return mdPageHeightPts - offsetPts; } + /// Convert PDF points to logic (twips). + tools::Rectangle PointsToLogic(double left, double right, double top, double bottom) const; + Point PointsToLogic(double x, double y) const; + + std::shared_ptr mpPDFium; + + // check for clip and evtl. fill maClip + void checkClip(); + bool isClip() const; + + void ImportPdfObject(std::unique_ptr const& pPageObject, + std::unique_ptr const& pTextPage, + int nPageObjectIndex); + void ImportForm(std::unique_ptr const& pPageObject, + std::unique_ptr const& pTextPage, + int nPageObjectIndex); + void ImportImage(std::unique_ptr const& pPageObject, + int nPageObjectIndex); + void ImportPath(std::unique_ptr const& pPageObject, + int nPageObjectIndex); + void ImportText(std::unique_ptr const& pPageObject, + std::unique_ptr const& pTextPage, + int nPageObjectIndex); + void InsertTextObject(const Point& rPos, const Size& rSize, const OUString& rStr); + + void SetupPageScale(const double dPageWidth, const double dPageHeight); + void SetAttributes(SdrObject* pObj, bool bForceTextAttr = false); + void InsertObj(SdrObject* pObj, bool bScale = true); + void MapScaling(); + + // #i73407# reformulation to use new B2DPolygon classes + bool CheckLastPolyLineAndFillMerge(const basegfx::B2DPolyPolygon& rPolyPolygon); + + void DoObjects(SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport, int nPageIndex); + + // Copy assignment is forbidden and not implemented. + ImpSdrPdfImport(const ImpSdrPdfImport&) = delete; + ImpSdrPdfImport& operator=(const ImpSdrPdfImport&) = delete; + +public: + ImpSdrPdfImport(SdrModel& rModel, SdrLayerID nLay, const tools::Rectangle& rRect, + Graphic const& rGraphic); + + ~ImpSdrPdfImport(); + + int GetPageCount() const { return mnPageCount; } + size_t DoImport(SdrObjList& rDestList, size_t nInsPos, int nPageNumber, + SvdProgressInfo* pProgrInfo = nullptr); +}; + +#endif // INCLUDED_SVX_SOURCE_SVDRAW_SVDPDF_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/svxpixelctlaccessiblecontext.hxx b/svx/source/inc/svxpixelctlaccessiblecontext.hxx new file mode 100644 index 0000000000..ae79b36f7b --- /dev/null +++ b/svx/source/inc/svxpixelctlaccessiblecontext.hxx @@ -0,0 +1,149 @@ +/* -*- 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_SVX_SOURCE_INC_SVXPIXELCTLACCESSIBLECONTEXT_HXX +#define INCLUDED_SVX_SOURCE_INC_SVXPIXELCTLACCESSIBLECONTEXT_HXX + +#include +#include + +#include +#include +#include + +#include +#include + + +namespace com::sun::star::awt { + struct Point; + struct Rectangle; + struct Size; + class XFocusListener; +} +class SvxPixelCtl; +class SvxPixelCtlAccessible; + +class SvxPixelCtlAccessibleChild final : public cppu::ImplInheritanceHelper< + ::comphelper::OAccessibleComponentHelper, + css::accessibility::XAccessible> +{ +public: + SvxPixelCtlAccessibleChild( + SvxPixelCtl& rWindow, + bool bPixelColorOrBG, + const tools::Rectangle& rBounds, + rtl::Reference xParent, + tools::Long nIndexInParent ); + + //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_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; + + //XAccessible + 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; + + void CheckChild(); + void SelectChild( bool bSelect); + void ChangePixelColorOrBG(bool bPixelColorOrBG){ m_bPixelColorOrBG = bPixelColorOrBG ;} + OUString GetName() const; + +private: + virtual ~SvxPixelCtlAccessibleChild() override; + + virtual void SAL_CALL disposing() override; + + // OCommonAccessibleComponent + /// implements the calculation of the bounding rectangle + virtual css::awt::Rectangle implGetBounds( ) override; + + SvxPixelCtl& mrParentWindow; + rtl::Reference mxParent; + bool m_bPixelColorOrBG;//Pixel Color Or BackGround Color + tools::Rectangle maBoundingBox; + /// index of child in parent + tools::Long mnIndexInParent; +}; + +class SvxPixelCtlAccessible final : public cppu::ImplInheritanceHelper< + ::comphelper::OAccessibleSelectionHelper, + css::accessibility::XAccessible> +{ +public: + SvxPixelCtlAccessible(SvxPixelCtl* pPixelCtl); + + //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_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; + + 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; + + rtl::Reference + CreateChild (tools::Long nIndex, Point mPoint); + +private: + virtual ~SvxPixelCtlAccessible() override; + + // OCommonAccessibleSelection + // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) + virtual bool implIsSelected(sal_Int64 nAccessibleChildIndex) override; + + // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) + virtual void implSelect(sal_Int64 nAccessibleChildIndex, bool bSelect) override; + + // OCommonAccessibleComponent + virtual css::awt::Rectangle implGetBounds() override; + + virtual void SAL_CALL disposing() override; + + SvxPixelCtl* mpPixelCtl; + rtl::Reference m_xCurChild; + +public: + void NotifyChild(tools::Long nIndex, bool bSelect, bool bCheck); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/svxrectctaccessiblecontext.hxx b/svx/source/inc/svxrectctaccessiblecontext.hxx new file mode 100644 index 0000000000..f44338ade7 --- /dev/null +++ b/svx/source/inc/svxrectctaccessiblecontext.hxx @@ -0,0 +1,226 @@ +/* -*- 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_SVX_SOURCE_INC_SVXRECTCTACCESSIBLECONTEXT_HXX +#define INCLUDED_SVX_SOURCE_INC_SVXRECTCTACCESSIBLECONTEXT_HXX + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace com::sun::star::awt { + struct Point; + struct Rectangle; + struct Size; + class XFocusListener; +} +namespace tools { class Rectangle; } +class SvxRectCtl; +class SvxRectCtlChildAccessibleContext; + +class SvxRectCtlAccessibleContext final : public cppu::ImplInheritanceHelper< + ::comphelper::OAccessibleSelectionHelper, + css::accessibility::XAccessible> +{ +public: + // internal + SvxRectCtlAccessibleContext(SvxRectCtl* pRepresentation); + + // XAccessibleComponent + virtual void SAL_CALL grabFocus() override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point& rPoint) override; + + // XAccessible + // XAccessibleContext + virtual sal_Int64 SAL_CALL getAccessibleChildCount() override; + virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL getAccessibleChild(sal_Int64 nIndex) 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; + + virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext() override { return this; } + virtual sal_Int32 SAL_CALL getForeground() override; + virtual sal_Int32 SAL_CALL getBackground() override; + + /** Selects a new child by point. + +

If the child was not selected before, the state of the child will + be updated. If the point is not invalid, the index will internally set to NOCHILDSELECTED

+ + @param eButton + Button which belongs to the child which should be selected. + */ + void selectChild( RectPoint ePoint ); + void FireChildFocus( RectPoint eButton ); + +private: + virtual ~SvxRectCtlAccessibleContext() override; + + // OCommonAccessibleSelection + // return if the specified child is visible => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) + virtual bool implIsSelected(sal_Int64 nAccessibleChildIndex) override; + + // select the specified child => watch for special ChildIndexes (ACCESSIBLE_SELECTION_CHILD_xxx) + virtual void implSelect(sal_Int64 nAccessibleChildIndex, bool bSelect) override; + + // OCommonAccessibleComponent + virtual css::awt::Rectangle implGetBounds() override; + + virtual void SAL_CALL disposing() override; + + void checkChildIndex(sal_Int64 nIndex); + + /** Selects a new child by index. + +

If the child was not selected before, the state of the child will + be updated. If the index is invalid, the index will internally set to NOCHILDSELECTED

+ + @param nIndexOfChild + Index of the new child which should be selected. + */ + void selectChild( tools::Long nIndexOfChild ); + + /** Description of this object. This is not a constant because it can + be set from the outside. + */ + OUString msDescription; + + /** Name of this object. + */ + OUString msName; + + /// pointer to internal representation + SvxRectCtl* mpRepr; + + /// array for all possible children + std::vector> mvChildren; + + /// actual selected child + tools::Long mnSelectedChild; +}; + +class SvxRectCtlChildAccessibleContext final : public cppu::ImplInheritanceHelper< + ::comphelper::OAccessibleComponentHelper, + css::accessibility::XAccessible, + css::accessibility::XAccessibleValue, + css::accessibility::XAccessibleAction> +{ +public: + SvxRectCtlChildAccessibleContext( + const css::uno::Reference< css::accessibility::XAccessible>& rxParent, + OUString aName, OUString aDescription, + const tools::Rectangle& rBoundingBox, + tools::Long nIndexInParent ); + + // XAccessibleComponent + virtual void SAL_CALL grabFocus() override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& rPoint ) override; + + // XAccessibleContext + virtual sal_Int64 SAL_CALL getAccessibleChildCount() override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 nIndex ) 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; + + virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext() override { return this; } + + virtual sal_Int32 SAL_CALL getForeground() override; + virtual sal_Int32 SAL_CALL getBackground() override; + + // XAccessibleValue + virtual css::uno::Any SAL_CALL + getCurrentValue() override; + + virtual sal_Bool SAL_CALL + setCurrentValue( const css::uno::Any& aNumber ) override; + + virtual css::uno::Any SAL_CALL + getMaximumValue() override; + + virtual css::uno::Any SAL_CALL + getMinimumValue() override; + + virtual css::uno::Any SAL_CALL + getMinimumIncrement() override; + + // XAccessibleAction + virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) override; + virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) override; + virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) override; + + // internal + /// Sets the checked status + void setStateChecked(bool bChecked); + void FireFocusEvent(); + +private: + virtual ~SvxRectCtlChildAccessibleContext() override; + + virtual void SAL_CALL disposing() override; + + // 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 + draw page's display mode. + */ + OUString msDescription; + + /** Name of this object. It changes according the draw page's + display mode. + */ + OUString msName; + + /// Reference to the parent object. + css::uno::Reference< css::accessibility::XAccessible > + mxParent; + + /// Bounding box + tools::Rectangle maBoundingBox; + + /// index of child in parent + tools::Long mnIndexInParent; + + /// Indicates, if object is checked + bool mbIsChecked; +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/tablemodel.hxx b/svx/source/inc/tablemodel.hxx new file mode 100644 index 0000000000..7a2cf4851c --- /dev/null +++ b/svx/source/inc/tablemodel.hxx @@ -0,0 +1,209 @@ +/* -*- 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_SVX_SOURCE_INC_TABLEMODEL_HXX +#define INCLUDED_SVX_SOURCE_INC_TABLEMODEL_HXX + +#include +#include +#include +#include +#include +#include "celltypes.hxx" + +struct _xmlTextWriter; +typedef struct _xmlTextWriter* xmlTextWriterPtr; + +namespace sdr::table { + +class SdrTableObj; + +/** base class for each object implementing an XCellRange */ +class SAL_LOPLUGIN_ANNOTATE("crosscast") ICellRange +{ +public: + virtual sal_Int32 getLeft() = 0; + virtual sal_Int32 getTop() = 0; + virtual sal_Int32 getRight() = 0; + virtual sal_Int32 getBottom() = 0; + virtual css::uno::Reference< css::table::XTable > getTable() = 0; + +protected: + ~ICellRange() {} +}; + +typedef ::cppu::WeakComponentImplHelper< css::table::XTable, css::util::XBroadcaster > TableModelBase; + +class TableModel final : public ::cppu::BaseMutex, + public TableModelBase, + public ICellRange +{ + friend class InsertRowUndo; + friend class RemoveRowUndo; + friend class InsertColUndo; + friend class RemoveColUndo; + friend class TableColumnUndo; + friend class TableRowUndo; + friend class TableColumn; + friend class TableRow; + friend class TableRows; + friend class TableColumns; + friend class TableModelNotifyGuard; + +public: + explicit TableModel( SdrTableObj* pTableObj ); + TableModel( SdrTableObj* pTableObj, const TableModelRef& xSourceTable ); + virtual ~TableModel() override; + + void init( sal_Int32 nColumns, sal_Int32 nRows ); + + SdrTableObj* getSdrTableObj() const { return mpTableObj; } + + /** deletes rows and columns that are completely merged. Must be called between BegUndo/EndUndo! */ + void optimize(); + + /// merges the cell at the given position with the given span + void merge( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nColSpan, sal_Int32 nRowSpan ); + /// Get the width of all columns in this table. + std::vector getColumnWidths(); + + void dumpAsXml(xmlTextWriterPtr pWriter) const; + + // ICellRange + virtual sal_Int32 getLeft() override; + virtual sal_Int32 getTop() override; + virtual sal_Int32 getRight() override; + virtual sal_Int32 getBottom() override; + virtual css::uno::Reference< css::table::XTable > getTable() override; + + // XTable + virtual css::uno::Reference< css::table::XCellCursor > SAL_CALL createCursor( ) override; + virtual css::uno::Reference< css::table::XCellCursor > SAL_CALL createCursorByRange( const css::uno::Reference< css::table::XCellRange >& rRange ) override; + virtual ::sal_Int32 SAL_CALL getRowCount() override; + virtual ::sal_Int32 SAL_CALL getColumnCount() override; + + // XComponent + virtual void SAL_CALL dispose( ) override; + + // XModifiable + virtual sal_Bool SAL_CALL isModified( ) override; + virtual void SAL_CALL setModified( sal_Bool bModified ) override; + + // XModifyBroadcaster + virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + virtual void SAL_CALL removeModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + + // XColumnRowRange + virtual css::uno::Reference< css::table::XTableColumns > SAL_CALL getColumns() override; + virtual css::uno::Reference< css::table::XTableRows > SAL_CALL getRows() override; + + // XCellRange + virtual css::uno::Reference< css::table::XCell > SAL_CALL getCellByPosition( ::sal_Int32 nColumn, ::sal_Int32 nRow ) override; + virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByPosition( ::sal_Int32 nLeft, ::sal_Int32 nTop, ::sal_Int32 nRight, ::sal_Int32 nBottom ) override; + virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByName( const OUString& aRange ) override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XFastPropertySet + virtual void SAL_CALL setFastPropertyValue( ::sal_Int32 nHandle, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getFastPropertyValue( ::sal_Int32 nHandle ) override; + + // XBroadcaster + virtual void SAL_CALL lockBroadcasts() override; + virtual void SAL_CALL unlockBroadcasts() override; + +private: + void notifyModification(); + + void insertColumns( sal_Int32 nIndex, sal_Int32 nCount ); + void removeColumns( sal_Int32 nIndex, sal_Int32 nCount ); + void insertRows( sal_Int32 nIndex, sal_Int32 nCount ); + void removeRows( sal_Int32 nIndex, sal_Int32 nCount ); + + sal_Int32 getRowCountImpl() const; + sal_Int32 getColumnCountImpl() const; + + CellRef createCell(); + CellRef getCell( ::sal_Int32 nCol, ::sal_Int32 nRow ) const; + + void UndoInsertRows( sal_Int32 nIndex, sal_Int32 nCount ); + void UndoRemoveRows( sal_Int32 nIndex, RowVector& aNewRows ); + + void UndoInsertColumns( sal_Int32 nIndex, sal_Int32 nCount ); + void UndoRemoveColumns( sal_Int32 nIndex, ColumnVector& aNewCols, CellVector& aCells ); + +private: + /** this function is called upon disposing the component + */ + virtual void SAL_CALL disposing() override; + + /// @throws css::lang::IndexOutOfBoundsException + TableRowRef const & getRow( sal_Int32 nRow ) const; + /// @throws css::lang::IndexOutOfBoundsException + TableColumnRef const & getColumn( sal_Int32 nColumn ) const; + + void updateRows(); + void updateColumns(); + + RowVector maRows; + ColumnVector maColumns; + + rtl::Reference< TableColumns > mxTableColumns; + rtl::Reference< TableRows > mxTableRows; + + SdrTableObj* mpTableObj; // TTTT should be reference + + bool mbModified; + bool mbNotifyPending; + + sal_Int32 mnNotifyLock; +}; + +class TableModelNotifyGuard +{ +public: + explicit TableModelNotifyGuard( TableModel* pModel ) + : mxBroadcaster( static_cast< css::util::XBroadcaster* >( pModel ) ) + { + if( mxBroadcaster.is() ) + mxBroadcaster->lockBroadcasts(); + } + + ~TableModelNotifyGuard() + { + if( mxBroadcaster.is() ) + mxBroadcaster->unlockBroadcasts(); + } + +private: + css::uno::Reference< css::util::XBroadcaster > mxBroadcaster; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/tabwin.hxx b/svx/source/inc/tabwin.hxx new file mode 100644 index 0000000000..0209f3d316 --- /dev/null +++ b/svx/source/inc/tabwin.hxx @@ -0,0 +1,92 @@ +/* -*- 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_SVX_SOURCE_INC_TABWIN_HXX +#define INCLUDED_SVX_SOURCE_INC_TABWIN_HXX + +#include +#include +#include +#include +#include + +#include +#include + +class FmFormShell; +struct ColumnInfo; + +class FmFieldWin final : public SfxModelessDialogController + , public SfxControllerItem + , public ::comphelper::OPropertyChangeListener2 +{ + std::mutex m_aMutex; + std::unique_ptr m_xListBox; + std::vector> m_aListBoxData; + ::dbtools::SharedConnection + m_aConnection; + OUString m_aDatabaseName, + m_aObjectName; + sal_Int32 m_nObjectType; + + rtl::Reference m_xChangeListener; + rtl::Reference m_xHelper; + + void addToList(const css::uno::Reference& i_xColumns); + + DECL_LINK(RowActivatedHdl, weld::TreeView&, bool); + DECL_LINK(DragBeginHdl, bool&, bool); +public: + FmFieldWin(SfxBindings *pBindings, SfxChildWindow *pMgr, weld::Window* pParent); + + virtual ~FmFieldWin() override; + + virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState) override; + + void UpdateContent(FmFormShell const *); + void UpdateContent(const css::uno::Reference< css::form::XForm > &); + void FillInfo( SfxChildWinInfo& rInfo ) const override; + + const OUString& GetDatabaseName() const { return m_aDatabaseName; } + const ::dbtools::SharedConnection& GetConnection() const { return m_aConnection; } + const OUString& GetObjectName() const { return m_aObjectName; } + sal_Int32 GetObjectType() const { return m_nObjectType; } + + bool createSelectionControls( ); + +private: + // FmXChangeListener + virtual void _propertyChanged(const css::beans::PropertyChangeEvent& evt) override; + + using SfxControllerItem::GetBindings; +}; + + +class FmFieldWinMgr final : public SfxChildWindow +{ +public: + FmFieldWinMgr(vcl::Window *pParent, sal_uInt16 nId, + SfxBindings *pBindings, SfxChildWinInfo const *pInfo); + SFX_DECL_CHILDWINDOW(FmFieldWinMgr); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/tbxform.hxx b/svx/source/inc/tbxform.hxx new file mode 100644 index 0000000000..20c22a0b58 --- /dev/null +++ b/svx/source/inc/tbxform.hxx @@ -0,0 +1,105 @@ +/* -*- 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_SVX_SOURCE_INC_TBXFORM_HXX +#define INCLUDED_SVX_SOURCE_INC_TBXFORM_HXX + +#include +#include + +class SvxFmAbsRecWin final : public RecordItemWindow +{ +public: + SvxFmAbsRecWin(vcl::Window* _pParent, SfxToolBoxControl* _pController); + +private: + virtual void PositionFired(sal_Int64 nRecord) override; + + SfxToolBoxControl* m_pController; +}; + +class SvxFmTbxCtlAbsRec final : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + + SvxFmTbxCtlAbsRec(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); + virtual ~SvxFmTbxCtlAbsRec() override; + + virtual VclPtr CreateItemWindow(vcl::Window* pParent) override; + + virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState) override; +}; + +class SvxFmTbxCtlRecText final : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + + SvxFmTbxCtlRecText(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); + virtual ~SvxFmTbxCtlRecText() override; + + virtual VclPtr CreateItemWindow(vcl::Window* pParent) override; +}; + +class SvxFmTbxCtlRecFromText final : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + + SvxFmTbxCtlRecFromText(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); + virtual ~SvxFmTbxCtlRecFromText() override; + + virtual VclPtr CreateItemWindow(vcl::Window* pParent) override; +}; + +class LabelItemWindow; + +class SvxFmTbxCtlRecTotal final : public SfxToolBoxControl +{ + VclPtr m_xFixedText; + +public: + SFX_DECL_TOOLBOX_CONTROL(); + + SvxFmTbxCtlRecTotal(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); + virtual ~SvxFmTbxCtlRecTotal() override; + + virtual VclPtr CreateItemWindow(vcl::Window* pParent) override; + virtual void StateChangedAtToolBoxControl(sal_uInt16 nSID, SfxItemState eState, + const SfxPoolItem* pState) override; +}; + +class SvxFmTbxNextRec final : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + SvxFmTbxNextRec(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); +}; + +class SvxFmTbxPrevRec final : public SfxToolBoxControl +{ +public: + SFX_DECL_TOOLBOX_CONTROL(); + SvxFmTbxPrevRec(sal_uInt16 nSlotId, ToolBoxItemId nId, ToolBox& rTbx); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/treevisitor.hxx b/svx/source/inc/treevisitor.hxx new file mode 100644 index 0000000000..50e7d7a356 --- /dev/null +++ b/svx/source/inc/treevisitor.hxx @@ -0,0 +1,104 @@ +/* -*- 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_SVX_SOURCE_INC_TREEVISITOR_HXX +#define INCLUDED_SVX_SOURCE_INC_TREEVISITOR_HXX + +#include + +template< class ELEMENT, class NODEINFO, class PROCESSOR > +class TreeVisitor +{ +public: + TreeVisitor( NODEINFO _nodeInfo ) + :m_visitedRoot( false ) + ,m_root() + ,m_current() + ,m_nodeInfo( _nodeInfo ) + { + } + + void process( const ELEMENT& _root, PROCESSOR& _processor ) + { + m_root = _root; + m_visitedRoot = false; + + while ( do_step() ) + _processor.process( m_current ); + } + +private: + bool do_step(); + +private: + bool m_visitedRoot; + ELEMENT m_root; + ELEMENT m_current; + const NODEINFO m_nodeInfo; + + ::std::stack< size_t > m_pathToCurrent; + ::std::stack< ELEMENT > m_currentAncestors; +}; + +template< class ELEMENT, class NODEINFO, class PROCESSOR > +bool TreeVisitor< ELEMENT, NODEINFO, PROCESSOR >::do_step() +{ + if ( !m_visitedRoot ) + { + m_current = m_root; + m_visitedRoot = true; + return true; + } + + // can we step down from the current node? + size_t childCount = m_nodeInfo.childCount( m_current ); + if ( childCount ) + { + m_currentAncestors.push( m_current ); + m_current = m_nodeInfo.getChild( m_current, 0 ); + m_pathToCurrent.push( 0 ); + return true; + } + + // is there a right sibling of the current node? + while ( !m_pathToCurrent.empty() ) + { + const ELEMENT& currentParent = m_currentAncestors.top(); + childCount = m_nodeInfo.childCount( currentParent ); + + size_t currentChildPos = m_pathToCurrent.top(); + if ( ++currentChildPos < childCount ) + { + // yes there is + m_pathToCurrent.top() = currentChildPos; + m_current = m_nodeInfo.getChild( currentParent, currentChildPos ); + return true; + } + + // no there isn't => step up + m_currentAncestors.pop(); + m_pathToCurrent.pop(); + } + + return false; +} + +#endif // INCLUDED_SVX_SOURCE_INC_TREEVISITOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/xfm_addcondition.hxx b/svx/source/inc/xfm_addcondition.hxx new file mode 100644 index 0000000000..10d4674cbf --- /dev/null +++ b/svx/source/inc/xfm_addcondition.hxx @@ -0,0 +1,76 @@ +/* -*- 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_SVX_SOURCE_INC_XFM_ADDCONDITION_HXX +#define INCLUDED_SVX_SOURCE_INC_XFM_ADDCONDITION_HXX + +#include +#include +#include +#include + + +namespace svxform +{ + + typedef ::svt::OGenericUnoDialog OAddConditionDialogBase; + class OAddConditionDialog final + :public OAddConditionDialogBase + ,public ::comphelper::OPropertyArrayUsageHelper< OAddConditionDialog > + { + public: + static css::uno::Reference< css::uno::XInterface > + Create( const css::uno::Reference< css::lang::XMultiServiceFactory >& ); + + private: + OAddConditionDialog( const css::uno::Reference< css::uno::XComponentContext >& _rxORB ); + + // XTypeProvider + virtual css::uno::Sequence SAL_CALL getImplementationId( ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XPropertySet + virtual css::uno::Reference SAL_CALL getPropertySetInfo() override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + + // OGenericUnoDialog overridables + virtual std::unique_ptr createDialog(const css::uno::Reference& rParent) override; + virtual void executedDialog(sal_Int16 _nExecutionResult) override; + + css::uno::Reference< css::beans::XPropertySet > + m_xBinding; + OUString m_sFacetName; + OUString m_sConditionValue; + css::uno::Reference< css::xforms::XModel > + m_xWorkModel; + }; + + +} + + +#endif // INCLUDED_SVX_SOURCE_INC_XFM_ADDCONDITION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/xmlxtexp.hxx b/svx/source/inc/xmlxtexp.hxx new file mode 100644 index 0000000000..e47dbf1df9 --- /dev/null +++ b/svx/source/inc/xmlxtexp.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 . + */ + +#ifndef INCLUDED_SVX_SOURCE_INC_XMLXTEXP_HXX +#define INCLUDED_SVX_SOURCE_INC_XMLXTEXP_HXX + +#include + +namespace com::sun::star { + namespace frame { class XModel; } + namespace uno { template class Reference; } + namespace uno { class XInterface; } + namespace container { class XNameContainer; } + namespace document { class XGraphicStorageHandler; } + namespace xml::sax { class XDocumentHandler; } +} + +class SvxXMLXTableExportComponent final : public SvXMLExport +{ +public: + SvxXMLXTableExportComponent( + const css::uno::Reference< css::uno::XComponentContext >& xContext, + const css::uno::Reference< css::xml::sax::XDocumentHandler > & xHandler, + const css::uno::Reference< css::container::XNameContainer > & xTable, + css::uno::Reference const & xGraphicStorageHandler); + + virtual ~SvxXMLXTableExportComponent() override; + + /// @throws css::uno::RuntimeException + static bool save( const OUString& rURL, + const css::uno::Reference< css::container::XNameContainer >& xTable, + const css::uno::Reference< css::embed::XStorage > &xStorage, + OUString *pOptName ); + + // methods without content: + virtual void ExportAutoStyles_() override; + virtual void ExportMasterStyles_() override; + virtual void ExportContent_() override; + +private: + bool exportTable() noexcept; + const css::uno::Reference< css::container::XNameContainer > & mxTable; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/inc/xmlxtimp.hxx b/svx/source/inc/xmlxtimp.hxx new file mode 100644 index 0000000000..ee442ac40c --- /dev/null +++ b/svx/source/inc/xmlxtimp.hxx @@ -0,0 +1,55 @@ +/* -*- 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_SVX_SOURCE_INC_XMLXTIMP_HXX +#define INCLUDED_SVX_SOURCE_INC_XMLXTIMP_HXX + +#include + +namespace com::sun::star { + namespace uno { template class Reference; } + namespace uno { class XInterface; } + namespace document { class XGraphicStorageHandler; } + namespace container { class XNameContainer; } +} + +class SvxXMLXTableImport final : public SvXMLImport +{ +public: + SvxXMLXTableImport( + const css::uno::Reference< css::uno::XComponentContext >& rContext, + const css::uno::Reference< css::container::XNameContainer > & rTable, + css::uno::Reference const & rxGraphicStorageHandler); + + virtual ~SvxXMLXTableImport() noexcept override; + + static bool load( const OUString &rPath, const OUString &rReferer, + const css::uno::Reference < css::embed::XStorage > &xStorage, + const css::uno::Reference< css::container::XNameContainer >& xTable, + bool *bOptLoadedFromStorage ) noexcept; +private: + virtual SvXMLImportContext *CreateFastContext( sal_Int32 Element, + const ::css::uno::Reference< ::css::xml::sax::XFastAttributeList >& xAttrList ) override; + + const css::uno::Reference< css::container::XNameContainer > & mrTable; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3