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 REPORT_REPORTSECTION_HXX 24cdf0e10cSrcweir #define REPORT_REPORTSECTION_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <vcl/window.hxx> 27cdf0e10cSrcweir #include "RptPage.hxx" 28cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp> 29cdf0e10cSrcweir #include <comphelper/propmultiplex.hxx> 30cdf0e10cSrcweir #include "cppuhelper/basemutex.hxx" 31cdf0e10cSrcweir #include "ReportDefines.hxx" 32cdf0e10cSrcweir #include "dlgedfunc.hxx" 33cdf0e10cSrcweir #include <svtools/transfer.hxx> 34cdf0e10cSrcweir #include <rtl/ref.hxx> 35cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 36cdf0e10cSrcweir #include <memory> 37cdf0e10cSrcweir 38cdf0e10cSrcweir namespace rptui 39cdf0e10cSrcweir { 40cdf0e10cSrcweir class OReportModel; 41cdf0e10cSrcweir class OReportPage; 42cdf0e10cSrcweir class OSectionView; 43cdf0e10cSrcweir class OSectionWindow; 44cdf0e10cSrcweir 45cdf0e10cSrcweir class OReportSection : public Window 46cdf0e10cSrcweir , public ::cppu::BaseMutex 47cdf0e10cSrcweir , public ::comphelper::OPropertyChangeListener 48cdf0e10cSrcweir , public DropTargetHelper 49cdf0e10cSrcweir { 50cdf0e10cSrcweir OReportPage* m_pPage; 51cdf0e10cSrcweir OSectionView* m_pView; 52cdf0e10cSrcweir OSectionWindow* m_pParent; 53cdf0e10cSrcweir ::std::auto_ptr<DlgEdFunc> m_pFunc; 54cdf0e10cSrcweir ::boost::shared_ptr<OReportModel> m_pModel; 55cdf0e10cSrcweir ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pMulti; 56cdf0e10cSrcweir ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener; 57cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > m_xSection; 58cdf0e10cSrcweir sal_Int32 m_nPaintEntranceCount; 59cdf0e10cSrcweir 60cdf0e10cSrcweir DlgEdMode m_eMode; 61cdf0e10cSrcweir sal_Bool m_bDialogModelChanged; 62cdf0e10cSrcweir sal_Bool m_bInDrag; 63cdf0e10cSrcweir 64cdf0e10cSrcweir /** fills the section with all control from the report section 65cdf0e10cSrcweir */ 66cdf0e10cSrcweir void fill(); 67cdf0e10cSrcweir /** checks all objects if they fit in the new paper width. 68cdf0e10cSrcweir */ 69cdf0e10cSrcweir void impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth,sal_Int32 i_nLeftMargin,sal_Int32 i_nRightMargin); 70cdf0e10cSrcweir 71cdf0e10cSrcweir OReportSection(OReportSection&); 72cdf0e10cSrcweir void operator =(OReportSection&); 73cdf0e10cSrcweir protected: 74cdf0e10cSrcweir // DropTargetHelper overridables 75cdf0e10cSrcweir virtual sal_Int8 AcceptDrop( const AcceptDropEvent& _rEvt ); 76cdf0e10cSrcweir virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& _rEvt ); 77cdf0e10cSrcweir 78cdf0e10cSrcweir // window overrides 79cdf0e10cSrcweir virtual void Paint( const Rectangle& rRect ); 80cdf0e10cSrcweir virtual void MouseMove( const MouseEvent& rMEvt ); 81cdf0e10cSrcweir virtual void Command( const CommandEvent& rCEvt ); 82cdf0e10cSrcweir virtual void Resize(); 83cdf0e10cSrcweir 84cdf0e10cSrcweir // OPropertyChangeListener 85cdf0e10cSrcweir virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException); 86cdf0e10cSrcweir public: 87cdf0e10cSrcweir OReportSection(OSectionWindow* _pParent,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection); 88cdf0e10cSrcweir virtual ~OReportSection(); 89cdf0e10cSrcweir 90cdf0e10cSrcweir // window overrides 91cdf0e10cSrcweir virtual void MouseButtonDown( const MouseEvent& rMEvt ); 92cdf0e10cSrcweir virtual void MouseButtonUp( const MouseEvent& rMEvt ); 93cdf0e10cSrcweir 94cdf0e10cSrcweir /** copies the current selection in this section 95cdf0e10cSrcweir @param _rAllreadyCopiedObjects This is an out/in put param which contains all already copied objects. 96cdf0e10cSrcweir */ 97cdf0e10cSrcweir void Copy(::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rAllreadyCopiedObjects); 98cdf0e10cSrcweir 99cdf0e10cSrcweir void Copy(::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rAllreadyCopiedObjects,bool _bEraseAnddNoClone); 100cdf0e10cSrcweir 101cdf0e10cSrcweir /** paste a new control in this section 102cdf0e10cSrcweir @param _aAllreadyCopiedObjects objects to paste into the section. Only objects are pasted where the name is equal to the section name. 103cdf0e10cSrcweir @param _bForce If set to <TRUE/> than the objects will be copied into this section. The name is not compared in this case. 104cdf0e10cSrcweir */ 105cdf0e10cSrcweir void Paste(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _aAllreadyCopiedObjects,bool _bForce = false); 106cdf0e10cSrcweir 107cdf0e10cSrcweir /** Deletes the current selection in this section 108cdf0e10cSrcweir * 109cdf0e10cSrcweir */ 110cdf0e10cSrcweir void Delete(); 111cdf0e10cSrcweir 112cdf0e10cSrcweir /** All objects will be marked. 113cdf0e10cSrcweir */ 114cdf0e10cSrcweir void SelectAll(const sal_uInt16 _nObjectType); 115cdf0e10cSrcweir 116cdf0e10cSrcweir /** makes the grid visible 117cdf0e10cSrcweir * 118cdf0e10cSrcweir * \param _bVisible when <TRUE/> the grid is made visible 119cdf0e10cSrcweir */ 120cdf0e10cSrcweir void SetGridVisible(sal_Bool _bVisible); 121cdf0e10cSrcweir getSectionWindow() const122cdf0e10cSrcweir inline OSectionWindow* getSectionWindow() const { return m_pParent; } getSectionView() const123cdf0e10cSrcweir inline OSectionView& getSectionView() const { return *m_pView; } getPage() const124cdf0e10cSrcweir inline OReportPage* getPage() const { return m_pPage; } getSection() const125cdf0e10cSrcweir inline ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > getSection() const { return m_xSection; } 126cdf0e10cSrcweir SetDialogModelChanged(sal_Bool bChanged=sal_True)127cdf0e10cSrcweir void SetDialogModelChanged( sal_Bool bChanged = sal_True ) { m_bDialogModelChanged = bChanged; } IsDialogModelChanged() const128cdf0e10cSrcweir sal_Bool IsDialogModelChanged() const { return m_bDialogModelChanged; } GetMode() const129cdf0e10cSrcweir DlgEdMode GetMode() const { return m_eMode; } 130cdf0e10cSrcweir void SetMode( DlgEdMode m_eMode ); 131cdf0e10cSrcweir 132cdf0e10cSrcweir /** checks if the keycode is known by the child windows 133cdf0e10cSrcweir @param _rCode the keycode 134cdf0e10cSrcweir @return <TRUE/> if the keycode is handled otherwise <FALSE/> 135cdf0e10cSrcweir */ 136cdf0e10cSrcweir sal_Bool handleKeyEvent(const KeyEvent& _rEvent); 137cdf0e10cSrcweir 138cdf0e10cSrcweir /** returns the current control report model or <NULL/> 139cdf0e10cSrcweir */ 140cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > getCurrentControlModel() const; 141cdf0e10cSrcweir 142cdf0e10cSrcweir /** fills the vector with all selected control models 143cdf0e10cSrcweir /param _rSelection The vector will be filled and will not be cleared before. 144cdf0e10cSrcweir */ 145cdf0e10cSrcweir void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const; 146cdf0e10cSrcweir 147cdf0e10cSrcweir /** creates a default object (custom shape) 148cdf0e10cSrcweir * 149cdf0e10cSrcweir * @param _sType 150cdf0e10cSrcweir */ 151cdf0e10cSrcweir void createDefault(const ::rtl::OUString& _sType); 152cdf0e10cSrcweir 153cdf0e10cSrcweir /** creates a new default custom shape 154cdf0e10cSrcweir * 155cdf0e10cSrcweir * \param _sType 156cdf0e10cSrcweir * \param _pObj 157cdf0e10cSrcweir */ 158cdf0e10cSrcweir void createDefault(const ::rtl::OUString& _sType,SdrObject* _pObj); 159cdf0e10cSrcweir void stopScrollTimer(); 160cdf0e10cSrcweir 161cdf0e10cSrcweir /** deactivate the currect active ole object if any 162cdf0e10cSrcweir */ 163cdf0e10cSrcweir void deactivateOle(); 164cdf0e10cSrcweir 165cdf0e10cSrcweir /** returns true when an ole object is currently active 166cdf0e10cSrcweir */ 167cdf0e10cSrcweir bool isUiActive() const; 168cdf0e10cSrcweir }; 169cdf0e10cSrcweir //================================================================== 170cdf0e10cSrcweir } //rptui 171cdf0e10cSrcweir //================================================================== 172cdf0e10cSrcweir #endif // REPORT_REPORTSECTION_HXX 173cdf0e10cSrcweir 174