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 RPTUI_REPORTCONTROLLER_HXX
24cdf0e10cSrcweir #define RPTUI_REPORTCONTROLLER_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "DesignView.hxx"
27cdf0e10cSrcweir #include "ModuleHelper.hxx"
28cdf0e10cSrcweir #include "ReportControllerObserver.hxx"
29cdf0e10cSrcweir #include "RptDef.hxx"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir /** === begin UNO includes === **/
32cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValue.hpp>
33cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyChangeListener.hpp>
34cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
35cdf0e10cSrcweir #include <com/sun/star/embed/XVisualObject.hpp>
36cdf0e10cSrcweir #include <com/sun/star/frame/XComponentLoader.hpp>
37cdf0e10cSrcweir #include <com/sun/star/frame/XFrame.hpp>
38cdf0e10cSrcweir #include <com/sun/star/io/XObjectInputStream.hpp>
39cdf0e10cSrcweir #include <com/sun/star/io/XObjectOutputStream.hpp>
40cdf0e10cSrcweir #include <com/sun/star/report/XReportControlModel.hpp>
41cdf0e10cSrcweir #include <com/sun/star/report/XReportDefinition.hpp>
42cdf0e10cSrcweir #include <com/sun/star/report/XReportEngine.hpp>
43cdf0e10cSrcweir #include <com/sun/star/report/XSection.hpp>
44cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp>
45cdf0e10cSrcweir #include <com/sun/star/sdbc/XRowSet.hpp>
46cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.hxx>
47cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
48cdf0e10cSrcweir #include <com/sun/star/util/XModeSelector.hpp>
49cdf0e10cSrcweir #include <com/sun/star/util/XNumberFormatter.hpp>
50cdf0e10cSrcweir #include <com/sun/star/view/XSelectionSupplier.hpp>
51cdf0e10cSrcweir /** === end UNO includes === **/
52cdf0e10cSrcweir 
53cdf0e10cSrcweir #include <comphelper/implementationreference.hxx>
54cdf0e10cSrcweir #include <comphelper/proparrhlp.hxx>
55cdf0e10cSrcweir #include <comphelper/propertystatecontainer.hxx>
56cdf0e10cSrcweir #include <comphelper/uno3.hxx>
57cdf0e10cSrcweir #include <cppuhelper/implbase5.hxx>
58cdf0e10cSrcweir #include <dbaccess/dbsubcomponentcontroller.hxx>
59cdf0e10cSrcweir #include <svl/lstner.hxx>
60cdf0e10cSrcweir #include <svtools/transfer.hxx>
61cdf0e10cSrcweir #include <svx/svdedtv.hxx>
62cdf0e10cSrcweir #include <svx/zoomitem.hxx>
63cdf0e10cSrcweir 
64cdf0e10cSrcweir #include <boost/noncopyable.hpp>
65cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
66cdf0e10cSrcweir #include <functional>
67cdf0e10cSrcweir 
68cdf0e10cSrcweir class TransferableHelper;
69cdf0e10cSrcweir class TransferableClipboardListener;
70cdf0e10cSrcweir class VclWindowEvent;
71cdf0e10cSrcweir class SfxUndoManager;
72cdf0e10cSrcweir namespace rptui
73cdf0e10cSrcweir {
74cdf0e10cSrcweir 	class OGroupsSortingDialog;
75cdf0e10cSrcweir     class OPropertyMediator;
76cdf0e10cSrcweir     class OReportModel;
77cdf0e10cSrcweir     class OSectionView;
78cdf0e10cSrcweir     class OAddFieldWindow;
79cdf0e10cSrcweir     class OSectionWindow;
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 	typedef ::dbaui::DBSubComponentController	OReportController_BASE;
82cdf0e10cSrcweir 	typedef ::cppu::ImplHelper5	<	::com::sun::star::container::XContainerListener
83cdf0e10cSrcweir 								,   ::com::sun::star::beans::XPropertyChangeListener
84cdf0e10cSrcweir                                 ,   ::com::sun::star::view::XSelectionSupplier
85cdf0e10cSrcweir 								,	::com::sun::star::util::XModeSelector
86cdf0e10cSrcweir                                 ,	::com::sun::star::embed::XVisualObject
87cdf0e10cSrcweir 								>	OReportController_Listener;
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	class OReportController :	 public OReportController_BASE
90cdf0e10cSrcweir 								,public OReportController_Listener
91cdf0e10cSrcweir 								,public SfxListener
92cdf0e10cSrcweir                                 ,public ::comphelper::OPropertyStateContainer
93cdf0e10cSrcweir 						        ,public ::comphelper::OPropertyArrayUsageHelper < OReportController_BASE >
94cdf0e10cSrcweir                                 ,public ::boost::noncopyable
95cdf0e10cSrcweir 	{
96cdf0e10cSrcweir 	private:
97cdf0e10cSrcweir 		OModuleClient	        m_aModuleClient;
98cdf0e10cSrcweir         ::cppu::OInterfaceContainerHelper
99cdf0e10cSrcweir                                 m_aSelectionListeners;
100cdf0e10cSrcweir         ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>
101cdf0e10cSrcweir                                 m_aCollapsedSections;
102cdf0e10cSrcweir 		TransferableDataHelper	m_aSystemClipboard;		// content of the clipboard
103cdf0e10cSrcweir 		TransferableClipboardListener*
104cdf0e10cSrcweir 								m_pClipbordNotifier;	/// notifier for changes in the clipboard
105cdf0e10cSrcweir 		OGroupsSortingDialog*	m_pGroupsFloater;
106cdf0e10cSrcweir 
107cdf0e10cSrcweir         OXReportControllerObserver* m_pReportControllerObserver;
108cdf0e10cSrcweir 
getDesignView() const109cdf0e10cSrcweir         ODesignView*  getDesignView() const   { return static_cast< ODesignView* >( getView() ); }
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >         m_xReportDefinition;
112cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportEngine >             m_xReportEngine;
113cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XComponentLoader >           m_xFrameLoader;
114cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >            m_xContext;
115cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >                     m_xRowSet;
116cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >    m_xRowSetMediator;
117cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > 			m_xFormatter;	// a number formatter working with the report's NumberFormatsSupplier
118cdf0e10cSrcweir         mutable ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >			m_xHoldAlive;
119cdf0e10cSrcweir         mutable ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >    m_xColumns;
120cdf0e10cSrcweir         ::com::sun::star::awt::Size												                m_aVisualAreaSize;
121cdf0e10cSrcweir 
122cdf0e10cSrcweir         ::boost::shared_ptr<rptui::OReportModel>
123cdf0e10cSrcweir                                 m_aReportModel;
124cdf0e10cSrcweir 		::rtl::OUString			m_sName;			    /// name for the report definition
125cdf0e10cSrcweir         ::rtl::OUString         m_sLastActivePage;      /// last active property browser page
126cdf0e10cSrcweir         ::rtl::OUString         m_sMode;      			/// the current mode of the controller
127cdf0e10cSrcweir 		sal_Int32				m_nSplitPos;		    /// the position of the splitter
128cdf0e10cSrcweir         sal_Int32               m_nPageNum;             /// the page number from the restoreView call
129cdf0e10cSrcweir         sal_Int32               m_nSelectionCount;
130cdf0e10cSrcweir         ::sal_Int64				m_nAspect;
131cdf0e10cSrcweir         sal_Int16               m_nZoomValue;
132cdf0e10cSrcweir         SvxZoomType             m_eZoomType;
133cdf0e10cSrcweir         sal_Bool                m_bShowRuler;
134cdf0e10cSrcweir         sal_Bool                m_bGridVisible;
135cdf0e10cSrcweir         sal_Bool                m_bGridUse;
136cdf0e10cSrcweir         sal_Bool                m_bShowProperties;
137cdf0e10cSrcweir         sal_Bool                m_bGroupFloaterWasVisible;
138cdf0e10cSrcweir         sal_Bool                m_bHelplinesMove;
139cdf0e10cSrcweir         bool                    m_bChartEnabled;
140cdf0e10cSrcweir         bool                    m_bChartEnabledAsked;
141cdf0e10cSrcweir         bool                    m_bInGeneratePreview;
142cdf0e10cSrcweir 
143cdf0e10cSrcweir         /** creates a formatted field in the given section with the given formula as data field
144cdf0e10cSrcweir         *
145cdf0e10cSrcweir         * \param _aArgs
146cdf0e10cSrcweir         * \param _xSection the section where to create the formatted field
147cdf0e10cSrcweir         * \param _sFunction the function which will be set at the data field.
148cdf0e10cSrcweir         */
149cdf0e10cSrcweir         void createControl(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aArgs,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,const ::rtl::OUString& _sFunction ,sal_uInt16 _nObjectId = OBJ_DLG_FORMATTEDFIELD);
150cdf0e10cSrcweir         /** switch the report header/footer sectionon off with undo or without depending on the given id.
151cdf0e10cSrcweir         *
152cdf0e10cSrcweir         * \param _nId   Can either be SID_REPORTHEADER_WITHOUT_UNDO or SID_REPORTFOOTER_WITHOUT_UNDO or SID_REPORTHEADERFOOTER.
153cdf0e10cSrcweir         */
154cdf0e10cSrcweir         void switchReportSection(const sal_Int16 _nId);
155cdf0e10cSrcweir 
156cdf0e10cSrcweir         /** switch the report header/footer sectionon off with undo or without depending on the given id.
157cdf0e10cSrcweir         *
158cdf0e10cSrcweir         * \param _nId   Can either be SID_PAGEHEADER_WITHOUT_UNDO or SID_PAGEFOOTER_WITHOUT_UNDO or SID_PAGEHEADERFOOTER.
159cdf0e10cSrcweir         */
160cdf0e10cSrcweir         void switchPageSection(const sal_Int16 _nId);
161cdf0e10cSrcweir 
162cdf0e10cSrcweir         /** append a new group or remove it with undo.
163cdf0e10cSrcweir         *
164cdf0e10cSrcweir         * \param _bAppend
165cdf0e10cSrcweir         * \param _aArgs The args which contains a element named PROPERTY_GROUP of type report::XGroup.
166cdf0e10cSrcweir         */
167cdf0e10cSrcweir         void modifyGroup(const bool _bAppend, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aArgs);
168cdf0e10cSrcweir 
169cdf0e10cSrcweir         /** creates a group section.
170cdf0e10cSrcweir         *
171cdf0e10cSrcweir         * \param _bUndo true when undo action should be created
172cdf0e10cSrcweir         * \param _bHeader true when it is a header otherwise it is a footer
173cdf0e10cSrcweir         * \param _aArgs The args which contains a element named PROPERTY_GROUP of type report::XGroup.
174cdf0e10cSrcweir         */
175cdf0e10cSrcweir         void createGroupSection(const bool _bUndo,const bool _bHeader,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >&_aArgs);
176cdf0e10cSrcweir 
177cdf0e10cSrcweir         /** add or remove me as listener at the report definition
178cdf0e10cSrcweir         *
179cdf0e10cSrcweir         * \param _bAdd
180cdf0e10cSrcweir         */
181cdf0e10cSrcweir         void listen(const bool _bAdd);
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 		/** opens the common page dialog
184cdf0e10cSrcweir 		*/
185cdf0e10cSrcweir 		void openPageDialog(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection);
186cdf0e10cSrcweir 
187cdf0e10cSrcweir 		/** opens or hides the sorting and grouping dialog
188cdf0e10cSrcweir 		*/
189cdf0e10cSrcweir 		void openSortingAndGroupingDialog();
190cdf0e10cSrcweir 
191cdf0e10cSrcweir         /** opens the zoom dialog
192cdf0e10cSrcweir         */
193cdf0e10cSrcweir         void openZoomDialog();
194cdf0e10cSrcweir 
195cdf0e10cSrcweir 		/** returns the position of the group inside the groups collection
196cdf0e10cSrcweir 		*/
197cdf0e10cSrcweir 		sal_Int32 getGroupPosition(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xGroup);
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 		/** calls propertyChanged when the header or footer is really turned on.
200cdf0e10cSrcweir 			@param	_rEvent	the group
201cdf0e10cSrcweir 			@param	_bShow	when <TRUE/> the header and footer will be shown otherwise not
202cdf0e10cSrcweir 		*/
203cdf0e10cSrcweir 		void notifyGroupSections(const ::com::sun::star::container::ContainerEvent& _rEvent
204cdf0e10cSrcweir 								,bool _bShow);
205cdf0e10cSrcweir 
206cdf0e10cSrcweir 		/** change the sections for a group
207cdf0e10cSrcweir 			@param	_sPropName	the header or footer
208cdf0e10cSrcweir 			@param	_xGroup	the group
209cdf0e10cSrcweir 			@param	_nGroupPos	the position of the group inside the groups collection or the previous index when it was removed
210cdf0e10cSrcweir 			@param	_bShow	when <TRUE/> the header and footer will be shown otherwise not
211cdf0e10cSrcweir 		*/
212cdf0e10cSrcweir 		void groupChange( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup
213cdf0e10cSrcweir 						 ,const ::rtl::OUString& _sPropName
214cdf0e10cSrcweir 						 ,sal_Int32 _nGroupPos
215cdf0e10cSrcweir 						 ,bool _bShow);
216cdf0e10cSrcweir 
217cdf0e10cSrcweir         void executeMethodWithUndo(sal_uInt16 _nUndoStrId,const ::std::mem_fun_t<void,ODesignView>& _pMemfun);
218cdf0e10cSrcweir         void alignControlsWithUndo(sal_uInt16 _nUndoStrId,sal_Int32 _nControlModification,bool _bAlignAtSection = false);
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 		// open the help agent of report designer at start time
221cdf0e10cSrcweir 		void doOpenHelpAgent();
222cdf0e10cSrcweir 
223cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > getXFrame();
224cdf0e10cSrcweir 
225cdf0e10cSrcweir         /** shrink a section
226cdf0e10cSrcweir         @param _nUndoStrId the string id of the string which is shown in undo menu
227cdf0e10cSrcweir         @param _nShrinkId  ID of what you would like to shrink.
228cdf0e10cSrcweir         */
229cdf0e10cSrcweir         void shrinkSectionBottom(::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > _xSection);
230cdf0e10cSrcweir         void shrinkSectionTop(::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > _xSection);
231cdf0e10cSrcweir 
232cdf0e10cSrcweir     public:
233cdf0e10cSrcweir         void shrinkSection(sal_uInt16 _nUndoStrId, ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > _xSection, sal_Int32 _nShrinkId);
234cdf0e10cSrcweir 
235cdf0e10cSrcweir         /** opens the file open dialog to allow the user to select a image which will be
236cdf0e10cSrcweir         * bound to a newly created image button.
237cdf0e10cSrcweir         */
238cdf0e10cSrcweir         void insertGraphic();
239cdf0e10cSrcweir 
240cdf0e10cSrcweir         /** resets the floater
241cdf0e10cSrcweir         */
242cdf0e10cSrcweir         void updateFloater();
243cdf0e10cSrcweir 
244cdf0e10cSrcweir         /** creates a new function in the given value context
245cdf0e10cSrcweir         *
246cdf0e10cSrcweir         * \param _aValue contains a XNameContainer
247cdf0e10cSrcweir         */
248cdf0e10cSrcweir         void createNewFunction(const ::com::sun::star::uno::Any& _aValue);
249cdf0e10cSrcweir 
250cdf0e10cSrcweir         /** inserts a label - field pair into the current selected section
251cdf0e10cSrcweir         *
252cdf0e10cSrcweir         * \param aArgs
253cdf0e10cSrcweir         */
254cdf0e10cSrcweir         void addPairControls(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs);
255cdf0e10cSrcweir 
256cdf0e10cSrcweir         /** inserts a label - field combination to show the page number and/or page count
257cdf0e10cSrcweir         *
258cdf0e10cSrcweir         * \param _aArgs
259cdf0e10cSrcweir         */
260cdf0e10cSrcweir         void createPageNumber(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aArgs);
261cdf0e10cSrcweir 
262cdf0e10cSrcweir         /** creates a formatted filed with TODAY() function and if set also an NOW() function
263cdf0e10cSrcweir         *
264cdf0e10cSrcweir         * \param _aArgs
265cdf0e10cSrcweir         */
266cdf0e10cSrcweir         void createDateTime(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aArgs);
267cdf0e10cSrcweir 
268cdf0e10cSrcweir         /** gets the current section (SdrView)
269cdf0e10cSrcweir         *
270cdf0e10cSrcweir         * \return the currently selected section or <NULL/> if noone is selected
271cdf0e10cSrcweir         */
272cdf0e10cSrcweir         OSectionView* getCurrentSectionView() const;
273cdf0e10cSrcweir 
274cdf0e10cSrcweir         /**change the ZOrder of a current select object.
275cdf0e10cSrcweir         *
276cdf0e10cSrcweir         * \param _nId The command ID about what to do.
277cdf0e10cSrcweir         */
278cdf0e10cSrcweir         void changeZOrder(sal_Int32 _nId);
279cdf0e10cSrcweir 
280cdf0e10cSrcweir         /** marks the next or previous section, when the first/last section was already selected then the report will be selected.
281cdf0e10cSrcweir         *
282cdf0e10cSrcweir         * \param _bNext
283cdf0e10cSrcweir         */
284cdf0e10cSrcweir         void markSection(const bool _bNext);
285cdf0e10cSrcweir 
286cdf0e10cSrcweir         /** collapse or expand the currently selected section.
287cdf0e10cSrcweir         *
288cdf0e10cSrcweir         * \param _bCollapse collapse if sal_True otherwise expand
289cdf0e10cSrcweir         */
290cdf0e10cSrcweir         void collapseSection(const bool _bCollapse);
291cdf0e10cSrcweir 
292cdf0e10cSrcweir         /** fills the member that chart is enabled or not
293cdf0e10cSrcweir         *
294cdf0e10cSrcweir         */
295cdf0e10cSrcweir         void checkChartEnabled();
296cdf0e10cSrcweir 
297cdf0e10cSrcweir         /** set the zoom factor at the design view
298cdf0e10cSrcweir         */
299cdf0e10cSrcweir         void impl_zoom_nothrow();
300cdf0e10cSrcweir 
301cdf0e10cSrcweir 		virtual void impl_onModifyChanged();
302cdf0e10cSrcweir 
303cdf0e10cSrcweir 		virtual void onLoadedMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& _xLayoutManager );
304cdf0e10cSrcweir 		virtual void impl_initialize( );
305cdf0e10cSrcweir 		bool isUiVisible() const;
306cdf0e10cSrcweir 
307cdf0e10cSrcweir         /** creates a new default control for the currently set type when the modifier KEY_MOD1 was pressed
308cdf0e10cSrcweir         * \param _aArgs must contain a properyvalue with name "KeyModifier" and value KEY_MOD1 when control should be created.
309cdf0e10cSrcweir         */
310cdf0e10cSrcweir         void createDefaultControl(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aArgs);
311cdf0e10cSrcweir 
312cdf0e10cSrcweir         /** fills the state for the feture request.
313cdf0e10cSrcweir             @param  _sProperty  the property which should be filled in the value
314cdf0e10cSrcweir             @param  _rState     the state to fill
315cdf0e10cSrcweir         */
316cdf0e10cSrcweir         void impl_fillState_nothrow(const ::rtl::OUString& _sProperty,dbaui::FeatureState& _rState) const;
317cdf0e10cSrcweir         void impl_fillCustomShapeState_nothrow(const char* _pCustomShapeType,dbaui::FeatureState& _rState) const;
318cdf0e10cSrcweir 
319cdf0e10cSrcweir         /** set the property at all selected controls.
320cdf0e10cSrcweir             @return <TRUE/> when the selection is not empty
321cdf0e10cSrcweir         */
322cdf0e10cSrcweir         bool impl_setPropertyAtControls_throw(const sal_uInt16 _nUndoResId
323cdf0e10cSrcweir             ,const ::rtl::OUString& _sProperty
324cdf0e10cSrcweir             ,const ::com::sun::star::uno::Any& _aValue
325cdf0e10cSrcweir             ,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aArgs);
326cdf0e10cSrcweir 
327cdf0e10cSrcweir 		DECL_LINK( OnInvalidateClipboard, void* );
328cdf0e10cSrcweir 		DECL_LINK( OnClipboardChanged, void* );
329cdf0e10cSrcweir         DECL_LINK( OnExecuteReport, void* );
330cdf0e10cSrcweir         DECL_LINK( OnOpenHelpAgent, void* );
331cdf0e10cSrcweir 		short saveModified();
332cdf0e10cSrcweir 		// all the features which should be handled by this class
333cdf0e10cSrcweir 		virtual void			describeSupportedFeatures();
334cdf0e10cSrcweir 		// state of a feature. 'feature' may be the handle of a ::com::sun::star::util::URL somebody requested a dispatch interface for OR a toolbar slot.
335cdf0e10cSrcweir 		virtual dbaui::FeatureState	GetState(sal_uInt16 nId) const;
336cdf0e10cSrcweir 		// execute a feature
337cdf0e10cSrcweir 		virtual void Execute(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
338cdf0e10cSrcweir 
339cdf0e10cSrcweir         virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const;
340cdf0e10cSrcweir         virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception);
341cdf0e10cSrcweir 
342cdf0e10cSrcweir     private:
343cdf0e10cSrcweir 		virtual ~OReportController();
344cdf0e10cSrcweir 
345cdf0e10cSrcweir 	public:
346cdf0e10cSrcweir 		OReportController(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context);
347cdf0e10cSrcweir 
348cdf0e10cSrcweir 		DECL_LINK( EventLstHdl, VclWindowEvent* );
349cdf0e10cSrcweir         DECL_LINK( OnCreateHdl, OAddFieldWindow*);
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 		DECLARE_XINTERFACE( )
352cdf0e10cSrcweir 		DECLARE_XTYPEPROVIDER( )
353cdf0e10cSrcweir 
354cdf0e10cSrcweir 		// SfxListener
355cdf0e10cSrcweir 		virtual void Notify(SfxBroadcaster & rBc, SfxHint const & rHint);
356cdf0e10cSrcweir 
357cdf0e10cSrcweir 		/** returns <TRUE/> when the command is enbaled
358cdf0e10cSrcweir 			@param	_nCommand	the command id
359cdf0e10cSrcweir 			@param	_xControlFormat the report control format
360cdf0e10cSrcweir 		*/
361cdf0e10cSrcweir 		sal_Bool							isFormatCommandEnabled(sal_uInt16 _nCommand
362cdf0e10cSrcweir 												,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlFormat>& _xControlFormat) const;
363cdf0e10cSrcweir 
364cdf0e10cSrcweir 		virtual sal_Bool					Construct(Window* pParent);
365cdf0e10cSrcweir 		// XEventListener
366cdf0e10cSrcweir 		virtual void SAL_CALL				disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException);
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 		// ::com::sun::star::frame::XController
369cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL			suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException );
370cdf0e10cSrcweir 
371cdf0e10cSrcweir 		// ::com::sun::star::lang::XComponent
372cdf0e10cSrcweir 		virtual void		SAL_CALL disposing();
373cdf0e10cSrcweir 
374cdf0e10cSrcweir 		// XServiceInfo
375cdf0e10cSrcweir 		virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
376cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
377cdf0e10cSrcweir 		// need by registration
378cdf0e10cSrcweir 		static ::rtl::OUString getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException );
379cdf0e10cSrcweir 		static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException );
380cdf0e10cSrcweir 		static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
381cdf0e10cSrcweir 			create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext);
382cdf0e10cSrcweir 
383cdf0e10cSrcweir 		// ::com::sun::star::container::XContainerListener
384cdf0e10cSrcweir 		virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
385cdf0e10cSrcweir 		virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
386cdf0e10cSrcweir 		virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException );
387cdf0e10cSrcweir 
388cdf0e10cSrcweir 		// XPropertyChangeListener
389cdf0e10cSrcweir 		virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException);
390cdf0e10cSrcweir 
391cdf0e10cSrcweir         // XSelectionSupplier
392cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& xSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
393cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any SAL_CALL getSelection(  ) throw (::com::sun::star::uno::RuntimeException);
394cdf0e10cSrcweir         virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
395cdf0e10cSrcweir         virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
396cdf0e10cSrcweir 
397cdf0e10cSrcweir 		// ::com::sun::star::frame::XController
398cdf0e10cSrcweir 		virtual sal_Bool SAL_CALL attachModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel) throw( ::com::sun::star::uno::RuntimeException );
399cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any SAL_CALL getViewData(void) throw( ::com::sun::star::uno::RuntimeException );
400cdf0e10cSrcweir         virtual void SAL_CALL restoreViewData(const ::com::sun::star::uno::Any& Data) throw( ::com::sun::star::uno::RuntimeException );
401cdf0e10cSrcweir 
402cdf0e10cSrcweir 		/** gives access to the report definition
403cdf0e10cSrcweir 		* \return the report definition object, may be <NULL/>
404cdf0e10cSrcweir 		*/
getReportDefinition() const405cdf0e10cSrcweir 		inline ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition> getReportDefinition() const { return m_xReportDefinition; }
406cdf0e10cSrcweir 
407cdf0e10cSrcweir         // ::com::sun::star::frame::XController
408cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >  SAL_CALL getModel(void) throw( ::com::sun::star::uno::RuntimeException );
409cdf0e10cSrcweir 
410cdf0e10cSrcweir         // XTitle
411cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getTitle(  ) throw (::com::sun::star::uno::RuntimeException);
412cdf0e10cSrcweir 
413cdf0e10cSrcweir 		// XModeSelector
414cdf0e10cSrcweir         virtual void SAL_CALL setMode( const ::rtl::OUString& aMode ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException) ;
415cdf0e10cSrcweir         virtual ::rtl::OUString SAL_CALL getMode(  ) throw (::com::sun::star::uno::RuntimeException) ;
416cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedModes(  ) throw (::com::sun::star::uno::RuntimeException) ;
417cdf0e10cSrcweir         virtual ::sal_Bool SAL_CALL supportsMode( const ::rtl::OUString& aMode ) throw (::com::sun::star::uno::RuntimeException) ;
418cdf0e10cSrcweir 
419cdf0e10cSrcweir         // XVisualObject
420cdf0e10cSrcweir 		virtual void SAL_CALL setVisualAreaSize( ::sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
421cdf0e10cSrcweir 		virtual ::com::sun::star::awt::Size SAL_CALL getVisualAreaSize( ::sal_Int64 nAspect ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
422cdf0e10cSrcweir 		virtual ::com::sun::star::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
423cdf0e10cSrcweir 		virtual ::sal_Int32 SAL_CALL getMapUnit( ::sal_Int64 nAspect ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
424cdf0e10cSrcweir 
425cdf0e10cSrcweir 
426cdf0e10cSrcweir 		/** returns the current position of the splitter
427cdf0e10cSrcweir 		*
428cdf0e10cSrcweir 		* \return
429cdf0e10cSrcweir 		*/
getSplitPos() const430cdf0e10cSrcweir 		inline sal_Int32	getSplitPos() const { return m_nSplitPos;}
setSplitPos(sal_Int32 _nSplitPos)431cdf0e10cSrcweir 		inline void			setSplitPos(sal_Int32 _nSplitPos)		{ m_nSplitPos = _nSplitPos;}
432cdf0e10cSrcweir 
433cdf0e10cSrcweir         /** creates a new report from the report definition.
434cdf0e10cSrcweir          *
435cdf0e10cSrcweir          * \return The model or <NULL/> if the model could not be created.
436cdf0e10cSrcweir          */
437cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> executeReport();
438cdf0e10cSrcweir 
439cdf0e10cSrcweir         /** returns the RowSet which reflects the current settings of the report definition
440cdf0e10cSrcweir 
441cdf0e10cSrcweir             The caller is allowed to hold a reference to the RowSet - it is kept alive as long
442cdf0e10cSrcweir             as the controller lives, and it's settings will follow the report definition's settings.
443cdf0e10cSrcweir         */
444cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > getRowSet();
445cdf0e10cSrcweir 
446cdf0e10cSrcweir         /** returns the number formatter
447cdf0e10cSrcweir 		*/
448cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > 	getReportNumberFormatter() const;
449cdf0e10cSrcweir 
450cdf0e10cSrcweir         /** return the SdrModel of the real model
451cdf0e10cSrcweir         *
452cdf0e10cSrcweir         * \return
453cdf0e10cSrcweir         */
454cdf0e10cSrcweir         ::boost::shared_ptr<rptui::OReportModel> getSdrModel() const;
455cdf0e10cSrcweir 
getContext() const456cdf0e10cSrcweir         inline ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >  getContext() const { return m_xContext; }
getZoomValue() const457cdf0e10cSrcweir         inline sal_Int16   getZoomValue() const     { return m_nZoomValue; }
resetZoomType()458cdf0e10cSrcweir         inline void         resetZoomType()         { m_eZoomType = SVX_ZOOM_PERCENT; }
459cdf0e10cSrcweir 
460cdf0e10cSrcweir         // com::sun::star::beans::XPropertySet
getPropertySetInfo()461cdf0e10cSrcweir 		virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException)
462cdf0e10cSrcweir 		{
463cdf0e10cSrcweir 			return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
464cdf0e10cSrcweir 		}
465cdf0e10cSrcweir         // comphelper::OPropertyArrayUsageHelper
466cdf0e10cSrcweir 		virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
467cdf0e10cSrcweir 
468cdf0e10cSrcweir 	// cppu::OPropertySetHelper
469cdf0e10cSrcweir 		virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
470cdf0e10cSrcweir 
471cdf0e10cSrcweir         ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
472cdf0e10cSrcweir 
473cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getColumns() const;
474cdf0e10cSrcweir         ::rtl::OUString getColumnLabel_throw(const ::rtl::OUString& i_sColumnName) const;
475cdf0e10cSrcweir 
476cdf0e10cSrcweir         SfxUndoManager& getUndoManager() const;
477cdf0e10cSrcweir         void            clearUndoManager() const;
478cdf0e10cSrcweir 		void            addUndoAction( SfxUndoAction* i_pAction );
479cdf0e10cSrcweir 	};
480cdf0e10cSrcweir }
481cdf0e10cSrcweir #endif // RPTUI_REPORTCONTROLLER_HXX
482cdf0e10cSrcweir 
483