1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef RPTUI_SECTIONWINDOW_HXX
24 #define RPTUI_SECTIONWINDOW_HXX
25 
26 #include <com/sun/star/report/XSection.hpp>
27 #include <vcl/window.hxx>
28 #include <vcl/split.hxx>
29 #include <svtools/colorcfg.hxx>
30 #include <comphelper/propmultiplex.hxx>
31 #include <cppuhelper/basemutex.hxx>
32 
33 #include "UITools.hxx"
34 #include "UndoActions.hxx"
35 #include "StartMarker.hxx"
36 #include "EndMarker.hxx"
37 #include "ReportSection.hxx"
38 
39 #include <list>
40 #include <map>
41 #include <boost/shared_ptr.hpp>
42 
43 namespace comphelper
44 {
45 	class OPropertyChangeMultiplexer;
46 }
47 namespace rptui
48 {
49 	class OReportWindow;
50 	class ODesignView;
51     class OViewsWindow;
52     class OSectionWindow :      public Window
53                             ,	public ::cppu::BaseMutex
54 							,	public ::comphelper::OPropertyChangeListener
55     {
56         OViewsWindow*   m_pParent;
57         OStartMarker    m_aStartMarker;
58         OReportSection  m_aReportSection;
59         Splitter        m_aSplitter;
60         OEndMarker      m_aEndMarker;
61 
62         ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pSectionMulti;
63         ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pGroupMulti;
64 
65         OSectionWindow(OSectionWindow&);
66         void operator =(OSectionWindow&);
67 
68         /** set the title of the group header or footer
69         *
70         * \param _xGroup
71         * \param _nResId
72         * \param _pGetSection
73         * \param _pIsSectionOn
74         * @return sal_True when title was set otherwise FALSE
75         */
76         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);
77 
78         /** set the title of the (report/page) header or footer
79         *
80         * \param _xGroup
81         * \param _nResId
82         * \param _pGetSection
83         * \param _pIsSectionOn
84         * @return sal_True when title was set otherwise FALSE
85         */
86         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);
87         void ImplInitSettings();
88 
89         DECL_LINK(Collapsed,OColorListener*);
90         DECL_LINK(StartSplitHdl, Splitter*);
91 		DECL_LINK(SplitHdl, Splitter*);
92 		DECL_LINK(EndSplitHdl, Splitter*);
93 
94 
95         virtual void DataChanged( const DataChangedEvent& rDCEvt );
96         // windows overload
97 		virtual void Resize();
98 
99     protected:
100         virtual void	_propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException);
101     public:
102         OSectionWindow( OViewsWindow* _pParent
103                         ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
104 				        ,const ::rtl::OUString& _sColorEntry);
105         virtual ~OSectionWindow();
106 
getStartMarker()107         inline OStartMarker&    getStartMarker()    { return m_aStartMarker;     }
getReportSection()108         inline OReportSection&  getReportSection()  { return m_aReportSection;   }
getEndMarker()109         inline OEndMarker&      getEndMarker()      { return m_aEndMarker;       }
getViewsWindow()110         inline OViewsWindow*    getViewsWindow()    { return m_pParent;          }
111 
112         void	setCollapsed(sal_Bool _bCollapsed);
113 
114         /** triggers the property browser with the section
115 			@param	_pStartMarker
116 		*/
117 		void			showProperties();
118 
119         /** set the marker as marked or not marked
120 			@param	_bMark	set the new state of the marker
121 		*/
122 		void	setMarked(sal_Bool _bMark);
123 
getViewsWindow() const124         OViewsWindow* getViewsWindow() const { return m_pParent; }
125 
126         /** zoom the ruler and view windows
127         */
128         void zoom(const Fraction& _aZoom);
129 
130         void scrollChildren(long _nThumbPosX);
131     };
132 //==============================================================================
133 } // rptui
134 //==============================================================================
135 #endif // RPTUI_SECTIONWINDOW_HXX
136 
137