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