lok: vcl: fix multiple floatwin removal case more robustly.
[LibreOffice.git] / reportdesign / source / ui / inc / ReportControllerObserver.hxx
blob7cbde89539d4f1aa4ce07d6877fd13a806a34851
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTCONTROLLEROBSERVER_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTCONTROLLEROBSERVER_HXX
22 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
23 #include <com/sun/star/beans/PropertyChangeEvent.hpp>
24 #include <cppuhelper/implbase.hxx>
26 #include <memory>
27 #include <dllapi.h>
28 #include <vector>
30 #include <vcl/svapp.hxx>
31 #include <tools/link.hxx>
33 #include "FormattedFieldBeautifier.hxx"
34 #include "FixedTextColor.hxx"
36 namespace rptui
38 class OReportController;
39 class OXReportControllerObserverImpl;
42 class OXReportControllerObserver
43 : public ::cppu::WeakImplHelper< css::beans::XPropertyChangeListener
44 , css::container::XContainerListener
45 , css::util::XModifyListener
49 const ::std::unique_ptr<OXReportControllerObserverImpl> m_pImpl;
51 FormattedFieldBeautifier m_aFormattedFieldBeautifier;
52 FixedTextColor m_aFixedTextColor;
54 // do not allow copy
55 OXReportControllerObserver(const OXReportControllerObserver&) = delete;
56 OXReportControllerObserver& operator=(const OXReportControllerObserver&) = delete;
57 virtual ~OXReportControllerObserver() override; // UNO Object must have private destructor!
58 public:
59 OXReportControllerObserver(const OReportController& _rController);
61 // XPropertyChangeListener
62 virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override;
64 // XEventListener
65 virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override;
67 // XContainerListener
68 virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& rEvent) override;
69 virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& rEvent) override;
70 virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& rEvent) override;
72 // XModifyListener
73 virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override;
76 void AddElement(const css::uno::Reference< css::uno::XInterface>& Element);
77 void RemoveElement(const css::uno::Reference< css::uno::XInterface>& Element);
79 void AddSection( const css::uno::Reference< css::report::XSection>& _xSection);
80 void RemoveSection( const css::uno::Reference< css::report::XSection>& _xSection );
82 /**
83 Create an object ob OUndoEnvLock locks the undo possibility
84 As long as in the OUndoEnvLock scope, no undo is possible for manipulated object.
86 class OEnvLock
88 OXReportControllerObserver& m_rObserver;
89 public:
90 OEnvLock(OXReportControllerObserver& _rObserver): m_rObserver(_rObserver){m_rObserver.Lock();}
91 ~OEnvLock(){ m_rObserver.UnLock(); }
94 void Lock();
95 void UnLock();
97 void Clear();
98 private:
100 void switchListening( const css::uno::Reference< css::container::XIndexAccess >& _rxContainer, bool _bStartListening );
101 void switchListening( const css::uno::Reference< css::uno::XInterface >& _rxObject, bool _bStartListening );
103 DECL_LINK(SettingsChanged, VclSimpleEvent&, void );
106 } // namespace rptui
108 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTCONTROLLEROBSERVER_HXX
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */