Line data Source code
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 <com/sun/star/report/XReportDefinition.hpp>
25 : #include <cppuhelper/implbase3.hxx>
26 :
27 : #include <memory>
28 : #include <dllapi.h>
29 : #include <vector>
30 :
31 : #include <vcl/svapp.hxx>
32 : #include <tools/link.hxx>
33 :
34 : #include "FormattedFieldBeautifier.hxx"
35 : #include "FixedTextColor.hxx"
36 :
37 : namespace rptui
38 : {
39 : class OReportController;
40 : class OXReportControllerObserverImpl;
41 :
42 :
43 : class OXReportControllerObserver
44 : : public ::cppu::WeakImplHelper3< ::com::sun::star::beans::XPropertyChangeListener
45 : , ::com::sun::star::container::XContainerListener
46 : , ::com::sun::star::util::XModifyListener
47 : >
48 : {
49 :
50 : const ::std::unique_ptr<OXReportControllerObserverImpl> m_pImpl;
51 :
52 : FormattedFieldBeautifier m_aFormattedFieldBeautifier;
53 : FixedTextColor m_aFixedTextColor;
54 :
55 : // do not allow copy
56 : OXReportControllerObserver(const OXReportControllerObserver&);
57 : OXReportControllerObserver& operator=(const OXReportControllerObserver&);
58 : virtual ~OXReportControllerObserver(); // UNO Object must have private destructor!
59 : public:
60 : OXReportControllerObserver(const OReportController& _rController);
61 :
62 : // XPropertyChangeListener
63 : virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
64 :
65 : // XEventListener
66 : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
67 :
68 : // XContainerListener
69 : virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
70 : virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
71 : virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
72 :
73 : // XModifyListener
74 : virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
75 :
76 :
77 : void AddElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
78 : void RemoveElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
79 :
80 : void AddSection( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection);
81 : void RemoveSection( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection );
82 :
83 : /**
84 : Create an object ob OUndoEnvLock locks the undo possibility
85 : As long as in the OUndoEnvLock scope, no undo is possible for manipulated object.
86 : */
87 : class OEnvLock
88 : {
89 : OXReportControllerObserver& m_rObserver;
90 : public:
91 0 : OEnvLock(OXReportControllerObserver& _rObserver): m_rObserver(_rObserver){m_rObserver.Lock();}
92 0 : ~OEnvLock(){ m_rObserver.UnLock(); }
93 : };
94 :
95 : void Lock();
96 : void UnLock();
97 : bool IsLocked() const;
98 :
99 : void Clear();
100 : private:
101 :
102 : void TogglePropertyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
103 : void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxContainer, bool _bStartListening );
104 : void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject, bool _bStartListening );
105 :
106 : DECL_LINK(SettingsChanged, VclWindowEvent* );
107 : private:
108 :
109 : ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild> >::const_iterator getSection(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild>& _xContainer) const;
110 :
111 : };
112 :
113 : } // namespace rptui
114 :
115 : #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTCONTROLLEROBSERVER_HXX
116 :
117 :
118 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|