Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef INCLUDED_REPORTCONTROLLEROBSERVER_HXX
29 : : #define INCLUDED_REPORTCONTROLLEROBSERVER_HXX
30 : :
31 : : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
32 : : #include <com/sun/star/beans/PropertyChangeEvent.hpp>
33 : : #include <com/sun/star/report/XReportDefinition.hpp>
34 : : #include <cppuhelper/implbase3.hxx>
35 : :
36 : : #include <memory>
37 : : #include <dllapi.h>
38 : : #include <vector>
39 : :
40 : : #include <vcl/svapp.hxx>
41 : : #include <tools/link.hxx>
42 : :
43 : : #include <FormattedFieldBeautifier.hxx>
44 : : #include <FixedTextColor.hxx>
45 : :
46 : : namespace rptui
47 : : {
48 : : class OReportController;
49 : : class OXReportControllerObserverImpl;
50 : :
51 : : //========================================================================
52 : : class OXReportControllerObserver
53 : : : public ::cppu::WeakImplHelper3< ::com::sun::star::beans::XPropertyChangeListener
54 : : , ::com::sun::star::container::XContainerListener
55 : : , ::com::sun::star::util::XModifyListener
56 : : >
57 : : {
58 : :
59 : : const ::std::auto_ptr<OXReportControllerObserverImpl> m_pImpl;
60 : :
61 : : FormattedFieldBeautifier m_aFormattedFieldBeautifier;
62 : : FixedTextColor m_aFixedTextColor;
63 : :
64 : : // do not allow copy
65 : : OXReportControllerObserver(const OXReportControllerObserver&);
66 : : OXReportControllerObserver& operator=(const OXReportControllerObserver&);
67 : : virtual ~OXReportControllerObserver(); // UNO Object must have private destructor!
68 : : public:
69 : : OXReportControllerObserver(const OReportController& _rController);
70 : :
71 : : // XPropertyChangeListener
72 : : virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
73 : :
74 : : // XEventListener
75 : : virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
76 : :
77 : : // XContainerListener
78 : : virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
79 : : virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
80 : : virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
81 : :
82 : : // XModifyListener
83 : : virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
84 : :
85 : :
86 : : void AddElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
87 : : void RemoveElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
88 : :
89 : : void AddSection( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection);
90 : : void RemoveSection( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection );
91 : :
92 : : /**
93 : : Create an object ob OUndoEnvLock locks the undo possibility
94 : : As long as in the OUndoEnvLock scope, no undo is possible for manipulated object.
95 : : */
96 : : class OEnvLock
97 : : {
98 : : OXReportControllerObserver& m_rObserver;
99 : : public:
100 : 0 : OEnvLock(OXReportControllerObserver& _rObserver): m_rObserver(_rObserver){m_rObserver.Lock();}
101 : 0 : ~OEnvLock(){ m_rObserver.UnLock(); }
102 : : };
103 : :
104 : : void Lock();
105 : : void UnLock();
106 : : sal_Bool IsLocked() const;
107 : :
108 : : void Clear();
109 : : private:
110 : :
111 : : void TogglePropertyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
112 : : void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxContainer, bool _bStartListening ) SAL_THROW(());
113 : : void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject, bool _bStartListening ) SAL_THROW(());
114 : :
115 : : DECL_LINK(SettingsChanged, VclWindowEvent* );
116 : : private:
117 : :
118 : : ::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;
119 : :
120 : : };
121 : :
122 : : } // namespace rptui
123 : :
124 : : #endif /* INCLUDED_REPORTCONTROLLEROBSERVER_HXX */
125 : :
126 : :
127 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|