/* -*- 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 "pcrcommon.hxx" #include #include #include #include #include #include #include #include #include #include #include namespace pcr { typedef std::map< OUString, css::uno::Reference< css::beans::XPropertySet >, std::less< OUString > > MapStringToPropertySet; //= EFormsHelper class EFormsHelper { protected: css::uno::Reference< css::beans::XPropertySet > m_xControlModel; css::uno::Reference< css::form::binding::XBindableValue > m_xBindableControl; css::uno::Reference< css::xforms::XFormsSupplier > m_xDocument; PropertyChangeListeners m_aPropertyListeners; MapStringToPropertySet m_aSubmissionUINames; // only filled upon request MapStringToPropertySet m_aBindingUINames; // only filled upon request public: EFormsHelper( ::osl::Mutex& _rMutex, const css::uno::Reference< css::beans::XPropertySet >& _rxControlModel, const css::uno::Reference< css::frame::XModel >& _rxContextDocument ); /** determines whether the given document is an eForm If this method returns , you cannot instantiate an EFormsHelper with this document, since none of its functionality will be available then. */ static bool isEForm( const css::uno::Reference< css::frame::XModel >& _rxContextDocument ); /** registers a listener to be notified when any aspect of the binding changes. The listener will be registered at the current binding of the control model. If the binding changes (see setBinding), the listener will be revoked from the old binding, registered at the new binding, and for all properties which differ between both bindings, the listener will be notified. @see revokeBindingListener */ void registerBindingListener( const css::uno::Reference< css::beans::XPropertyChangeListener >& _rxBindingListener ); /** revokes the binding listener which has previously been registered @see registerBindingListener */ void revokeBindingListener( const css::uno::Reference< css::beans::XPropertyChangeListener >& _rxBindingListener ); /** checks whether it's possible to bind the control model to a given XSD data type @param _nDataType the data type which should be bound. If this is -1, is returned if the control model can be bound to any data type. */ bool canBindToDataType( sal_Int32 _nDataType = -1 ) const; /** checks whether the control model can be bound to any XSD data type */ bool canBindToAnyDataType() const { return canBindToDataType(); } /** checks whether the control model is a source for list entries, as supplied by XML data bindings */ bool isListEntrySink() const; /** retrieves the names of all XForms models in the document the control lives in */ void getFormModelNames( std::vector< OUString >& /* [out] */ _rModelNames ) const; /** retrieves the names of all bindings for a given model @see getFormModelNames */ void getBindingNames( const OUString& _rModelName, std::vector< OUString >& /* [out] */ _rBindingNames ) const; /// retrieves the XForms model (within the control model's document) with the given name css::uno::Reference< css::xforms::XModel > getFormModelByName( const OUString& _rModelName ) const; /** retrieves the model which the active binding of the control model belongs to */ css::uno::Reference< css::xforms::XModel > getCurrentFormModel() const; /** retrieves the name of the model which the active binding of the control model belongs to */ OUString getCurrentFormModelName() const; /** retrieves the binding instance which is currently attached to the control model */ css::uno::Reference< css::beans::XPropertySet > getCurrentBinding() const; /** retrieves the name of the binding instance which is currently attached to the control model */ OUString getCurrentBindingName() const; /** sets a new binding at the control model */ void setBinding( const css::uno::Reference< css::beans::XPropertySet >& _rxBinding ); /** retrieves the binding instance which is currently used as list source for the control model @see isListEntrySink */ css::uno::Reference< css::form::binding::XListEntrySource > getCurrentListSourceBinding() const; /** sets a new list source at the control model @see isListEntrySink */ void setListSourceBinding( const css::uno::Reference< css::form::binding::XListEntrySource >& _rxListSource ); /** retrieves a given binding for a given model, or creates a new one @param _rTargetModel the name of the model to create a binding for. Must not be empty @param _rBindingName the name of the binding to retrieve. If the model denoted by _rTargetModel does not have a binding with this name, a new binding is created and returned. */ css::uno::Reference< css::beans::XPropertySet > getOrCreateBindingForModel( const OUString& _rTargetModel, const OUString& _rBindingName ) const; /** types of sub-elements of a model */ enum ModelElementType { Submission, Binding }; /** retrieves the name of a model's sub-element, as to be shown in the UI @see getModelElementFromUIName @see getAllElementUINames */ static OUString getModelElementUIName( const ModelElementType _eType, const css::uno::Reference< css::beans::XPropertySet >& _rxElement ); /** retrieves the submission object for an UI name Note that getAllElementUINames must have been called before, for the given element type @see getModelElementUIName @see getAllElementUINames */ css::uno::Reference< css::beans::XPropertySet > getModelElementFromUIName( const ModelElementType _eType, const OUString& _rUIName ) const; /** retrieves the UI names of all elements of all models in our document @param _eType the type of elements for which the names should be retrieved @param _rElementNames the array of element names @see getModelElementUIName @see getModelElementFromUIName */ void getAllElementUINames( const ModelElementType _eType, std::vector< OUString >& /* [out] */ _rElementNames, bool _bPrepentEmptyEntry ); protected: void firePropertyChanges( const css::uno::Reference< css::beans::XPropertySet >& _rxOldProps, const css::uno::Reference< css::beans::XPropertySet >& _rxNewProps, std::set< OUString >& _rFilter ) const; /** fires a change in a single property, if the property value changed, and if we have a listener interested in property changes */ void firePropertyChange( const OUString& _rName, const css::uno::Any& _rOldValue, const css::uno::Any& _rNewValue ) const; private: void impl_switchBindingListening_throw( bool _bDoListening, const css::uno::Reference< css::beans::XPropertyChangeListener >& _rxListener ); /// implementation for both getOrCreateBindingForModel css::uno::Reference< css::beans::XPropertySet > implGetOrCreateBinding( const OUString& _rTargetModel, const OUString& _rBindingName ) const; void impl_toggleBindingPropertyListening_throw( bool _bDoListen, const css::uno::Reference< css::beans::XPropertyChangeListener >& _rxConcreteListenerOrNull ); private: EFormsHelper( const EFormsHelper& ) = delete; EFormsHelper& operator=( const EFormsHelper& ) = delete; }; } // namespace pcr /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ emen kelemen.gabor2@nisz.hu 2019-04-13T19:42:04+00:00 368f20001c0d152f48575335757e3c3c3b7e5750 Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Also re-evaluate some blacklisted headers and recheck include/comphelper/ Change-Id: Ib7eea5951e849c07cea2e2782be4e8945f71ad96 Reviewed-on: https://gerrit.libreoffice.org/70899 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Also re-evaluate some blacklisted headers and recheck include/comphelper/

Change-Id: Ib7eea5951e849c07cea2e2782be4e8945f71ad96
Reviewed-on: https://gerrit.libreoffice.org/70899
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
loplugin:unusedfields - look for fields that can be const, in comphelper 2018-07-20T12:12:57+00:00 Noel Grandin noel.grandin@collabora.co.uk 2018-07-19T14:28:37+00:00 12dce07aec980562fa449fa1884e0e8379d680fb idea from tml. Extend the unusedfields plugin to find fields that are only assigned in the constructor. Change-Id: I258d3581afbe651d53ce730c9ba27a4598cd9248 Reviewed-on: https://gerrit.libreoffice.org/57733 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
idea from tml.

Extend the unusedfields plugin to find fields that are only assigned in
the constructor.

Change-Id: I258d3581afbe651d53ce730c9ba27a4598cd9248
Reviewed-on: https://gerrit.libreoffice.org/57733
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
loplugin: look for CPPUNIT_ASSERT_EQUALS with params swapped 2018-06-01T07:14:25+00:00 Noel Grandin noel.grandin@collabora.co.uk 2018-05-31T11:20:41+00:00 23b08449736ba825a9c582ba18b7a5fdba178e47 idea originally from either tml or moggi, can't remember which Change-Id: Id78d75035036d3aa1666e33469c6eeb38f9e624d Reviewed-on: https://gerrit.libreoffice.org/55126 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
idea originally from either tml or moggi, can't remember which

Change-Id: Id78d75035036d3aa1666e33469c6eeb38f9e624d
Reviewed-on: https://gerrit.libreoffice.org/55126
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
More loplugin:cstylecast: comphelper 2018-01-12T19:27:56+00:00 Stephan Bergmann sbergman@redhat.com 2018-01-12T19:27:56+00:00 b088da2a7ab151710416f6d58a5cc6d6b908d546 auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I71a5092b344f206f2c7de606f2739d3b6e2cf0bb
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files

Change-Id: I71a5092b344f206f2c7de606f2739d3b6e2cf0bb
loplugin:includeform: comphelper 2017-10-23T20:46:11+00:00 Stephan Bergmann sbergman@redhat.com 2017-10-23T20:44:03+00:00 4b60d19694d58641d054c0b14ca0f466233886e7 Change-Id: I9297bd0449633d1055125e7c2f2f6d215a22ae7d
Change-Id: I9297bd0449633d1055125e7c2f2f6d215a22ae7d