xref: /trunk/main/reportdesign/source/ui/inc/ReportSection.hxx (revision 093b492c61de4e1fb95c7e65810eaeddbb65f806)
19ee13d13SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
39ee13d13SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
49ee13d13SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
59ee13d13SAndrew Rist  * distributed with this work for additional information
69ee13d13SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
79ee13d13SAndrew Rist  * to you under the Apache License, Version 2.0 (the
89ee13d13SAndrew Rist  * "License"); you may not use this file except in compliance
99ee13d13SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
119ee13d13SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
139ee13d13SAndrew Rist  * Unless required by applicable law or agreed to in writing,
149ee13d13SAndrew Rist  * software distributed under the License is distributed on an
159ee13d13SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169ee13d13SAndrew Rist  * KIND, either express or implied.  See the License for the
179ee13d13SAndrew Rist  * specific language governing permissions and limitations
189ee13d13SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
209ee13d13SAndrew Rist  *************************************************************/
219ee13d13SAndrew Rist 
22cdf0e10cSrcweir #ifndef REPORT_REPORTSECTION_HXX
23cdf0e10cSrcweir #define REPORT_REPORTSECTION_HXX
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #include <vcl/window.hxx>
26cdf0e10cSrcweir #include "RptPage.hxx"
27cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp>
28cdf0e10cSrcweir #include <comphelper/propmultiplex.hxx>
29cdf0e10cSrcweir #include "cppuhelper/basemutex.hxx"
30cdf0e10cSrcweir #include "ReportDefines.hxx"
31cdf0e10cSrcweir #include "dlgedfunc.hxx"
32cdf0e10cSrcweir #include <svtools/transfer.hxx>
33cdf0e10cSrcweir #include <rtl/ref.hxx>
34cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
35cdf0e10cSrcweir #include <memory>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir namespace rptui
38cdf0e10cSrcweir {
39cdf0e10cSrcweir     class OReportModel;
40cdf0e10cSrcweir     class OReportPage;
41cdf0e10cSrcweir     class OSectionView;
42cdf0e10cSrcweir     class OSectionWindow;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir     class OReportSection :   public Window
45cdf0e10cSrcweir                         ,   public ::cppu::BaseMutex
46cdf0e10cSrcweir                         ,   public ::comphelper::OPropertyChangeListener
47cdf0e10cSrcweir                         ,   public DropTargetHelper
48cdf0e10cSrcweir     {
49cdf0e10cSrcweir         OReportPage*                        m_pPage;
50cdf0e10cSrcweir         OSectionView*                       m_pView;
51cdf0e10cSrcweir         OSectionWindow*                     m_pParent;
52cdf0e10cSrcweir         ::std::auto_ptr<DlgEdFunc>          m_pFunc;
53cdf0e10cSrcweir         ::boost::shared_ptr<OReportModel>   m_pModel;
54cdf0e10cSrcweir         ::rtl::Reference< comphelper::OPropertyChangeMultiplexer>                           m_pMulti;
55cdf0e10cSrcweir         ::rtl::Reference< comphelper::OPropertyChangeMultiplexer>                           m_pReportListener;
56cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >              m_xSection;
57cdf0e10cSrcweir         sal_Int32                   m_nPaintEntranceCount;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir         DlgEdMode                   m_eMode;
60cdf0e10cSrcweir         sal_Bool                        m_bDialogModelChanged;
61cdf0e10cSrcweir         sal_Bool                    m_bInDrag;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir         /** fills the section with all control from the report section
64cdf0e10cSrcweir         */
65cdf0e10cSrcweir         void fill();
66cdf0e10cSrcweir         /** checks all objects if they fit in the new paper width.
67cdf0e10cSrcweir         */
68cdf0e10cSrcweir         void impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth,sal_Int32 i_nLeftMargin,sal_Int32 i_nRightMargin);
69cdf0e10cSrcweir 
70cdf0e10cSrcweir         OReportSection(OReportSection&);
71cdf0e10cSrcweir         void operator =(OReportSection&);
72cdf0e10cSrcweir     protected:
73cdf0e10cSrcweir         // DropTargetHelper overridables
74cdf0e10cSrcweir         virtual sal_Int8    AcceptDrop( const AcceptDropEvent& _rEvt );
75cdf0e10cSrcweir         virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& _rEvt );
76cdf0e10cSrcweir 
77cdf0e10cSrcweir         // window overrides
78cdf0e10cSrcweir         virtual void        Paint( const Rectangle& rRect );
79cdf0e10cSrcweir         virtual void        MouseMove( const MouseEvent& rMEvt );
80cdf0e10cSrcweir         virtual void        Command( const CommandEvent& rCEvt );
81cdf0e10cSrcweir         virtual void        Resize();
82cdf0e10cSrcweir 
83cdf0e10cSrcweir         // OPropertyChangeListener
84cdf0e10cSrcweir         virtual void    _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException);
85cdf0e10cSrcweir     public:
86cdf0e10cSrcweir         OReportSection(OSectionWindow* _pParent,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection);
87cdf0e10cSrcweir         virtual ~OReportSection();
88cdf0e10cSrcweir 
89cdf0e10cSrcweir         // window overrides
90cdf0e10cSrcweir         virtual void        MouseButtonDown( const MouseEvent& rMEvt );
91cdf0e10cSrcweir         virtual void        MouseButtonUp( const MouseEvent& rMEvt );
92cdf0e10cSrcweir 
93cdf0e10cSrcweir         /** copies the current selection in this section
94cdf0e10cSrcweir             @param  _rAllreadyCopiedObjects This is an out/in put param which contains all already copied objects.
95cdf0e10cSrcweir         */
96cdf0e10cSrcweir         void Copy(::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rAllreadyCopiedObjects);
97cdf0e10cSrcweir 
98cdf0e10cSrcweir         void Copy(::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rAllreadyCopiedObjects,bool _bEraseAnddNoClone);
99cdf0e10cSrcweir 
100cdf0e10cSrcweir         /** paste a new control in this section
101cdf0e10cSrcweir             @param  _aAllreadyCopiedObjects objects to paste into the section. Only objects are pasted where the name is equal to the section name.
102cdf0e10cSrcweir             @param  _bForce If set to <TRUE/> than the objects will be copied into this section. The name is not compared in this case.
103cdf0e10cSrcweir         */
104cdf0e10cSrcweir         void Paste(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _aAllreadyCopiedObjects,bool _bForce = false);
105cdf0e10cSrcweir 
106cdf0e10cSrcweir         /** Deletes the current selection in this section
107cdf0e10cSrcweir         *
108cdf0e10cSrcweir         */
109cdf0e10cSrcweir         void Delete();
110cdf0e10cSrcweir 
111cdf0e10cSrcweir         /** All objects will be marked.
112cdf0e10cSrcweir         */
113cdf0e10cSrcweir         void SelectAll(const sal_uInt16 _nObjectType);
114cdf0e10cSrcweir 
115cdf0e10cSrcweir         /** makes the grid visible
116cdf0e10cSrcweir         *
117cdf0e10cSrcweir         * \param _bVisible when <TRUE/> the grid is made visible
118cdf0e10cSrcweir         */
119cdf0e10cSrcweir         void SetGridVisible(sal_Bool _bVisible);
120cdf0e10cSrcweir 
getSectionWindow() const121cdf0e10cSrcweir         inline OSectionWindow*      getSectionWindow() const { return m_pParent; }
getSectionView() const122cdf0e10cSrcweir         inline OSectionView&        getSectionView() const { return *m_pView; }
getPage() const123cdf0e10cSrcweir         inline OReportPage*         getPage() const { return m_pPage; }
getSection() const124cdf0e10cSrcweir         inline ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > getSection() const { return m_xSection; }
125cdf0e10cSrcweir 
SetDialogModelChanged(sal_Bool bChanged=sal_True)126cdf0e10cSrcweir         void            SetDialogModelChanged( sal_Bool bChanged = sal_True ) { m_bDialogModelChanged = bChanged; }
IsDialogModelChanged() const127cdf0e10cSrcweir         sal_Bool            IsDialogModelChanged() const { return m_bDialogModelChanged; }
GetMode() const128cdf0e10cSrcweir         DlgEdMode       GetMode() const { return m_eMode; }
129cdf0e10cSrcweir         void            SetMode( DlgEdMode m_eMode );
130cdf0e10cSrcweir 
131cdf0e10cSrcweir         /** checks if the keycode is known by the child windows
132cdf0e10cSrcweir             @param  _rCode  the keycode
133cdf0e10cSrcweir             @return <TRUE/> if the keycode is handled otherwise <FALSE/>
134cdf0e10cSrcweir         */
135cdf0e10cSrcweir         sal_Bool        handleKeyEvent(const KeyEvent& _rEvent);
136cdf0e10cSrcweir 
137cdf0e10cSrcweir         /** returns the current control report model or <NULL/>
138cdf0e10cSrcweir         */
139cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > getCurrentControlModel() const;
140cdf0e10cSrcweir 
141cdf0e10cSrcweir         /** fills the vector with all selected control models
142cdf0e10cSrcweir             /param  _rSelection The vector will be filled and will not be cleared before.
143cdf0e10cSrcweir         */
144cdf0e10cSrcweir         void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const;
145cdf0e10cSrcweir 
146cdf0e10cSrcweir         /** creates a default object (custom shape)
147cdf0e10cSrcweir         *
148cdf0e10cSrcweir         * @param _sType
149cdf0e10cSrcweir         */
150cdf0e10cSrcweir         void createDefault(const ::rtl::OUString& _sType);
151cdf0e10cSrcweir 
152cdf0e10cSrcweir         /** creates a new default custom shape
153cdf0e10cSrcweir         *
154cdf0e10cSrcweir         * \param _sType
155cdf0e10cSrcweir         * \param _pObj
156cdf0e10cSrcweir         */
157cdf0e10cSrcweir         void createDefault(const ::rtl::OUString& _sType,SdrObject* _pObj);
158cdf0e10cSrcweir         void stopScrollTimer();
159cdf0e10cSrcweir 
160*093b492cSmseidel         /** deactivate the current active ole object if any
161cdf0e10cSrcweir         */
162cdf0e10cSrcweir         void    deactivateOle();
163cdf0e10cSrcweir 
164cdf0e10cSrcweir         /** returns true when an ole object is currently active
165cdf0e10cSrcweir         */
166cdf0e10cSrcweir         bool isUiActive() const;
167cdf0e10cSrcweir     };
168cdf0e10cSrcweir //==================================================================
169cdf0e10cSrcweir }   //rptui
170cdf0e10cSrcweir //==================================================================
171cdf0e10cSrcweir #endif // REPORT_REPORTSECTION_HXX
172*093b492cSmseidel 
173*093b492cSmseidel /* vim: set noet sw=4 ts=4: */
174