LibreOffice Module reportdesign (master)  1
ReportControllerObserver.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 #ifndef INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTCONTROLLEROBSERVER_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTCONTROLLEROBSERVER_HXX
21 
22 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
23 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
24 #include <cppuhelper/implbase.hxx>
25 
26 #include <memory>
27 
28 #include <tools/link.hxx>
29 
31 #include "FixedTextColor.hxx"
32 
33 class VclSimpleEvent;
34 
35 namespace rptui
36 {
37  class OReportController;
38  class OXReportControllerObserverImpl;
39 
40 
42  : public ::cppu::WeakImplHelper< css::beans::XPropertyChangeListener
43  , css::container::XContainerListener
44  , css::util::XModifyListener
45  >
46  {
47 
48  const ::std::unique_ptr<OXReportControllerObserverImpl> m_pImpl;
49 
52 
53  // do not allow copy
56  virtual ~OXReportControllerObserver() override; // UNO Object must have private destructor!
57  public:
58  OXReportControllerObserver(const OReportController& _rController);
59 
60  // XPropertyChangeListener
61  virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override;
62 
63  // XEventListener
64  virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
65 
66  // XContainerListener
67  virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& rEvent) override;
68  virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& rEvent) override;
69  virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& rEvent) override;
70 
71  // XModifyListener
72  virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override;
73 
74 
75  void AddElement(const css::uno::Reference< css::uno::XInterface>& Element);
76  void RemoveElement(const css::uno::Reference< css::uno::XInterface>& Element);
77 
78  void AddSection( const css::uno::Reference< css::report::XSection>& _xSection);
79  void RemoveSection( const css::uno::Reference< css::report::XSection>& _xSection );
80 
85  class OEnvLock
86  {
88  public:
89  OEnvLock(OXReportControllerObserver& _rObserver): m_rObserver(_rObserver){m_rObserver.Lock();}
90  ~OEnvLock(){ m_rObserver.UnLock(); }
91  };
92 
93  void Lock();
94  void UnLock();
95 
96  void Clear();
97  private:
98 
99  void switchListening( const css::uno::Reference< css::container::XIndexAccess >& _rxContainer, bool _bStartListening );
100  void switchListening( const css::uno::Reference< css::uno::XInterface >& _rxObject, bool _bStartListening );
101 
102  DECL_LINK(SettingsChanged, VclSimpleEvent&, void );
103  };
104 
105 } // namespace rptui
106 
107 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTCONTROLLEROBSERVER_HXX
108 
109 
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent &rEvent) override
OXReportControllerObserver(const OXReportControllerObserver &)=delete
void RemoveSection(const css::uno::Reference< css::report::XSection > &_xSection)
void AddSection(const css::uno::Reference< css::report::XSection > &_xSection)
virtual void SAL_CALL modified(const css::lang::EventObject &aEvent) override
virtual void SAL_CALL elementInserted(const css::container::ContainerEvent &rEvent) override
const ::std::unique_ptr< OXReportControllerObserverImpl > m_pImpl
void AddElement(const css::uno::Reference< css::uno::XInterface > &Element)
OXReportControllerObserver & operator=(const OXReportControllerObserver &)=delete
OEnvLock(OXReportControllerObserver &_rObserver)
void switchListening(const css::uno::Reference< css::container::XIndexAccess > &_rxContainer, bool _bStartListening)
FormattedFieldBeautifier m_aFormattedFieldBeautifier
virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent &rEvent) override
void RemoveElement(const css::uno::Reference< css::uno::XInterface > &Element)
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &evt) override
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
DECL_LINK(SettingsChanged, VclSimpleEvent &, void)
Create an object ob OUndoEnvLock locks the undo possibility As long as in the OUndoEnvLock scope...