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