1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ReportSection.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef REPORT_REPORTSECTION_HXX
31 #define REPORT_REPORTSECTION_HXX
33 #include <vcl/window.hxx>
34 #include "RptPage.hxx"
35 #include <com/sun/star/beans/NamedValue.hpp>
36 #include <comphelper/propmultiplex.hxx>
37 #include "cppuhelper/basemutex.hxx"
38 #include "ReportDefines.hxx"
39 #include "dlgedfunc.hxx"
40 #include <svtools/transfer.hxx>
41 #include <rtl/ref.hxx>
42 #include <boost/shared_ptr.hpp>
52 class OReportSection
: public Window
53 , public ::cppu::BaseMutex
54 , public ::comphelper::OPropertyChangeListener
55 , public DropTargetHelper
58 OSectionView
* m_pView
;
59 OSectionWindow
* m_pParent
;
60 ::std::auto_ptr
<DlgEdFunc
> m_pFunc
;
61 ::boost::shared_ptr
<OReportModel
> m_pModel
;
62 ::rtl::Reference
< comphelper::OPropertyChangeMultiplexer
> m_pMulti
;
63 ::rtl::Reference
< comphelper::OPropertyChangeMultiplexer
> m_pReportListener
;
64 ::com::sun::star::uno::Reference
< ::com::sun::star::report::XSection
> m_xSection
;
67 BOOL m_bDialogModelChanged
;
70 /** fills the section with all control from the report section
74 OReportSection(OReportSection
&);
75 void operator =(OReportSection
&);
77 // DropTargetHelper overridables
78 virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& _rEvt
);
79 virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& _rEvt
);
82 virtual void Paint( const Rectangle
& rRect
);
83 virtual void MouseMove( const MouseEvent
& rMEvt
);
84 virtual void Command( const CommandEvent
& rCEvt
);
85 virtual void Resize();
87 // OPropertyChangeListener
88 virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent
& _rEvent
) throw( ::com::sun::star::uno::RuntimeException
);
90 OReportSection(OSectionWindow
* _pParent
,const ::com::sun::star::uno::Reference
< ::com::sun::star::report::XSection
>& _xSection
);
91 virtual ~OReportSection();
94 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
95 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
97 /** copies the current selection in this section
98 @param _rAllreadyCopiedObjects This is an out/in put param which contains all already copied objects.
100 void Copy(::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& _rAllreadyCopiedObjects
);
102 void Copy(::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& _rAllreadyCopiedObjects
,bool _bEraseAnddNoClone
);
104 /** paste a new control in this section
105 @param _aAllreadyCopiedObjects objects to paste into the section. Only objects are pasted where the name is equal to the section name.
106 @param _bForce If set to <TRUE/> than the objects will be copied into this section. The name is not compared in this case.
108 void Paste(const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& _aAllreadyCopiedObjects
,bool _bForce
= false);
110 /** Deletes the current selection in this section
115 /** All objects will be marked.
117 void SelectAll(const sal_uInt16 _nObjectType
);
119 /** makes the grid visible
121 * \param _bVisible when <TRUE/> the grid is made visible
123 void SetGridVisible(BOOL _bVisible
);
125 inline OSectionWindow
* getSectionWindow() const { return m_pParent
; }
126 inline OSectionView
& getSectionView() const { return *m_pView
; }
127 inline OReportPage
* getPage() const { return m_pPage
; }
128 inline ::com::sun::star::uno::Reference
< ::com::sun::star::report::XSection
> getSection() const { return m_xSection
; }
130 void SetDialogModelChanged( BOOL bChanged
= TRUE
) { m_bDialogModelChanged
= bChanged
; }
131 BOOL
IsDialogModelChanged() const { return m_bDialogModelChanged
; }
132 DlgEdMode
GetMode() const { return m_eMode
; }
133 void SetMode( DlgEdMode m_eMode
);
135 /** checks if the keycode is known by the child windows
136 @param _rCode the keycode
137 @return <TRUE/> if the keycode is handled otherwise <FALSE/>
139 sal_Bool
handleKeyEvent(const KeyEvent
& _rEvent
);
141 /** returns the current control report model or <NULL/>
143 ::com::sun::star::uno::Reference
< ::com::sun::star::report::XReportComponent
> getCurrentControlModel() const;
145 /** fills the vector with all selected control models
146 /param _rSelection The vector will be filled and will not be cleared before.
148 void fillControlModelSelection(::std::vector
< ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> >& _rSelection
) const;
150 /** creates a default object (custom shape)
154 void createDefault(const ::rtl::OUString
& _sType
);
156 /** creates a new default custom shape
161 void createDefault(const ::rtl::OUString
& _sType
,SdrObject
* _pObj
);
162 void stopScrollTimer();
164 /** deactivate the currect active ole object if any
166 void deactivateOle();
168 /** returns true when an ole object is currently active
170 bool isUiActive() const;
172 //==================================================================
174 //==================================================================
175 #endif // REPORT_REPORTSECTION_HXX