1*9ee13d13SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9ee13d13SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9ee13d13SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9ee13d13SAndrew Rist  * distributed with this work for additional information
6*9ee13d13SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9ee13d13SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9ee13d13SAndrew Rist  * "License"); you may not use this file except in compliance
9*9ee13d13SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9ee13d13SAndrew Rist  *
11*9ee13d13SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9ee13d13SAndrew Rist  *
13*9ee13d13SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9ee13d13SAndrew Rist  * software distributed under the License is distributed on an
15*9ee13d13SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9ee13d13SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9ee13d13SAndrew Rist  * specific language governing permissions and limitations
18*9ee13d13SAndrew Rist  * under the License.
19*9ee13d13SAndrew Rist  *
20*9ee13d13SAndrew Rist  *************************************************************/
21*9ee13d13SAndrew Rist 
22*9ee13d13SAndrew Rist 
23cdf0e10cSrcweir #ifndef INCLUDED_REPORTCONTROLLEROBSERVER_HXX
24cdf0e10cSrcweir #define INCLUDED_REPORTCONTROLLEROBSERVER_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp>
27cdf0e10cSrcweir #include <com/sun/star/beans/PropertyChangeEvent.hpp>
28cdf0e10cSrcweir #include <com/sun/star/report/XReportDefinition.hpp>
29cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <memory>
32cdf0e10cSrcweir #include <dllapi.h>
33cdf0e10cSrcweir #include <vector>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir // #include <svl/lstner.hxx>
36cdf0e10cSrcweir #include <vcl/svapp.hxx>
37cdf0e10cSrcweir #include <tools/link.hxx>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #include <FormattedFieldBeautifier.hxx>
40cdf0e10cSrcweir #include <FixedTextColor.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir namespace rptui
43cdf0e10cSrcweir {
44cdf0e10cSrcweir     class OReportController;
45cdf0e10cSrcweir     class OXReportControllerObserverImpl;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir 	//========================================================================
48cdf0e10cSrcweir 	class /* REPORTDESIGN_DLLPUBLIC */ OXReportControllerObserver
49cdf0e10cSrcweir         : public ::cppu::WeakImplHelper3<	::com::sun::star::beans::XPropertyChangeListener
50cdf0e10cSrcweir                                         ,   ::com::sun::star::container::XContainerListener
51cdf0e10cSrcweir 										,	::com::sun::star::util::XModifyListener
52cdf0e10cSrcweir                                         >
53cdf0e10cSrcweir         /*,public SfxListener*/
54cdf0e10cSrcweir 	{
55cdf0e10cSrcweir 
56cdf0e10cSrcweir         const ::std::auto_ptr<OXReportControllerObserverImpl> m_pImpl;
57cdf0e10cSrcweir 
58cdf0e10cSrcweir         FormattedFieldBeautifier m_aFormattedFieldBeautifier;
59cdf0e10cSrcweir         FixedTextColor           m_aFixedTextColor;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir         // do not allow copy
62cdf0e10cSrcweir         OXReportControllerObserver(const OXReportControllerObserver&);
63cdf0e10cSrcweir 		OXReportControllerObserver& operator=(const OXReportControllerObserver&);
64cdf0e10cSrcweir         virtual  ~OXReportControllerObserver(); // UNO Object must have private destructor!
65cdf0e10cSrcweir 	public:
66cdf0e10cSrcweir 		OXReportControllerObserver(const OReportController& _rController);
67cdf0e10cSrcweir 
68cdf0e10cSrcweir // protected:
69cdf0e10cSrcweir 		// XPropertyChangeListener
70cdf0e10cSrcweir 		virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
71cdf0e10cSrcweir 
72cdf0e10cSrcweir         // XEventListener
73cdf0e10cSrcweir 		virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 		// XContainerListener
76cdf0e10cSrcweir 		virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
77cdf0e10cSrcweir 		virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
78cdf0e10cSrcweir 		virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException);
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 		// XModifyListener
81cdf0e10cSrcweir 		virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 
84cdf0e10cSrcweir         void AddElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
85cdf0e10cSrcweir         void RemoveElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 		void AddSection( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection);
88cdf0e10cSrcweir 		void RemoveSection( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection );
89cdf0e10cSrcweir 
90cdf0e10cSrcweir         // SfxListener
91cdf0e10cSrcweir         // virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
92cdf0e10cSrcweir 
93cdf0e10cSrcweir         /**
94cdf0e10cSrcweir            Create an object ob OUndoEnvLock locks the undo possibility
95cdf0e10cSrcweir            As long as in the OUndoEnvLock scope, no undo is possible for manipulated object.
96cdf0e10cSrcweir          */
97cdf0e10cSrcweir         class OEnvLock
98cdf0e10cSrcweir         {
99cdf0e10cSrcweir             OXReportControllerObserver& m_rObserver;
100cdf0e10cSrcweir         public:
OEnvLock(OXReportControllerObserver & _rObserver)101cdf0e10cSrcweir             OEnvLock(OXReportControllerObserver& _rObserver): m_rObserver(_rObserver){m_rObserver.Lock();}
~OEnvLock()102cdf0e10cSrcweir             ~OEnvLock(){ m_rObserver.UnLock(); }
103cdf0e10cSrcweir         };
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 		void Lock();
106cdf0e10cSrcweir 		void UnLock();
107cdf0e10cSrcweir 		sal_Bool IsLocked() const;
108cdf0e10cSrcweir 
109cdf0e10cSrcweir         void Clear();
110cdf0e10cSrcweir 	private:
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 		void TogglePropertyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
113cdf0e10cSrcweir 		void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxContainer, bool _bStartListening ) SAL_THROW(());
114cdf0e10cSrcweir 		void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject, bool _bStartListening ) SAL_THROW(());
115cdf0e10cSrcweir 
116cdf0e10cSrcweir         // void ModeChanged(); // will be called from 'Notify'
117cdf0e10cSrcweir 		DECL_LINK(SettingsChanged, VclWindowEvent* );
118cdf0e10cSrcweir     private:
119cdf0e10cSrcweir 
120cdf0e10cSrcweir         ::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;
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     };
123cdf0e10cSrcweir 
124cdf0e10cSrcweir } // namespace rptui
125cdf0e10cSrcweir 
126cdf0e10cSrcweir #endif /* INCLUDED_REPORTCONTROLLEROBSERVER_HXX */
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 
129