1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef RPTUI_SECTIONWINDOW_HXX
28 #define RPTUI_SECTIONWINDOW_HXX
29 
30 #include <com/sun/star/report/XSection.hpp>
31 #include <vcl/window.hxx>
32 #include <vcl/split.hxx>
33 #include <svtools/colorcfg.hxx>
34 #include <comphelper/propmultiplex.hxx>
35 #include <cppuhelper/basemutex.hxx>
36 
37 #include "UITools.hxx"
38 #include "UndoActions.hxx"
39 #include "StartMarker.hxx"
40 #include "EndMarker.hxx"
41 #include "ReportSection.hxx"
42 
43 #include <list>
44 #include <map>
45 #include <boost/shared_ptr.hpp>
46 
47 namespace comphelper
48 {
49 	class OPropertyChangeMultiplexer;
50 }
51 namespace rptui
52 {
53 	class OReportWindow;
54 	class ODesignView;
55     class OViewsWindow;
56     class OSectionWindow :      public Window
57                             ,	public ::cppu::BaseMutex
58 							,	public ::comphelper::OPropertyChangeListener
59     {
60         OViewsWindow*   m_pParent;
61         OStartMarker    m_aStartMarker;
62         OReportSection  m_aReportSection;
63         Splitter        m_aSplitter;
64         OEndMarker      m_aEndMarker;
65 
66         ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pSectionMulti;
67         ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pGroupMulti;
68 
69         OSectionWindow(OSectionWindow&);
70         void operator =(OSectionWindow&);
71 
72         /** set the title of the group header or footer
73         *
74         * \param _xGroup
75         * \param _nResId
76         * \param _pGetSection
77         * \param _pIsSectionOn
78         * @return sal_True when title was set otherwise FALSE
79         */
80         bool setGroupSectionTitle(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup,sal_uInt16 _nResId,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> , OGroupHelper> _pGetSection,::std::mem_fun_t<sal_Bool, OGroupHelper> _pIsSectionOn);
81 
82         /** set the title of the (report/page) header or footer
83         *
84         * \param _xGroup
85         * \param _nResId
86         * \param _pGetSection
87         * \param _pIsSectionOn
88         * @return sal_True when title was set otherwise FALSE
89         */
90         bool setReportSectionTitle(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xReport,sal_uInt16 _nResId,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> , OReportHelper> _pGetSection,::std::mem_fun_t<sal_Bool, OReportHelper> _pIsSectionOn);
91         void ImplInitSettings();
92 
93         DECL_LINK(Collapsed,OColorListener*);
94         DECL_LINK(StartSplitHdl, Splitter*);
95 		DECL_LINK(SplitHdl, Splitter*);
96 		DECL_LINK(EndSplitHdl, Splitter*);
97 
98 
99         virtual void DataChanged( const DataChangedEvent& rDCEvt );
100         // windows overload
101 		virtual void Resize();
102 
103     protected:
104         virtual void	_propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException);
105     public:
106         OSectionWindow( OViewsWindow* _pParent
107                         ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
108 				        ,const ::rtl::OUString& _sColorEntry);
109         virtual ~OSectionWindow();
110 
111         inline OStartMarker&    getStartMarker()    { return m_aStartMarker;     }
112         inline OReportSection&  getReportSection()  { return m_aReportSection;   }
113         inline OEndMarker&      getEndMarker()      { return m_aEndMarker;       }
114         inline OViewsWindow*    getViewsWindow()    { return m_pParent;          }
115 
116         void	setCollapsed(sal_Bool _bCollapsed);
117 
118         /** triggers the property browser with the section
119 			@param	_pStartMarker
120 		*/
121 		void			showProperties();
122 
123         /** set the marker as marked or not marked
124 			@param	_bMark	set the new state of the marker
125 		*/
126 		void	setMarked(sal_Bool _bMark);
127 
128         OViewsWindow* getViewsWindow() const { return m_pParent; }
129 
130         /** zoom the ruler and view windows
131         */
132         void zoom(const Fraction& _aZoom);
133 
134         void scrollChildren(long _nThumbPosX);
135     };
136 //==============================================================================
137 } // rptui
138 //==============================================================================
139 #endif // RPTUI_SECTIONWINDOW_HXX
140 
141