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 RPTUI_REPORT_WINDOW_HXX 24 #define RPTUI_REPORT_WINDOW_HXX 25 26 #include <com/sun/star/report/XSection.hpp> 27 #include "ReportDefines.hxx" 28 #include "StartMarker.hxx" 29 #include <svtools/ruler.hxx> 30 #include <svx/svdedtv.hxx> 31 #include <svx/zoomitem.hxx> 32 33 #include <vector> 34 #include <boost/shared_ptr.hpp> 35 #include <comphelper/propmultiplex.hxx> 36 37 #include <MarkedSection.hxx> 38 #include "ViewsWindow.hxx" 39 40 class Splitter; 41 42 namespace rptui 43 { 44 class ODesignView; 45 class OReportSection; 46 class OScrollWindowHelper; 47 class OSectionView; 48 class OReportModel; 49 class OEndMarker; 50 class OReportPage; 51 class DlgEdFunc; 52 class DlgEdFactory; 53 54 class OReportWindow : public Window 55 , public IMarkedSection 56 , public ::cppu::BaseMutex 57 , public ::comphelper::OPropertyChangeListener 58 { 59 Ruler m_aHRuler; 60 ODesignView* m_pView; 61 OScrollWindowHelper* m_pParent; 62 OViewsWindow m_aViewsWindow; 63 ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener; 64 ::std::auto_ptr<DlgEdFactory> 65 m_pObjFac; 66 67 void ImplInitSettings(); 68 69 sal_Int32 GetTotalHeight() const; 70 sal_Int32 impl_getRealPixelWidth() const; 71 72 OReportWindow(OReportWindow&); 73 void operator =(OReportWindow&); 74 protected: 75 virtual void DataChanged( const DataChangedEvent& rDCEvt ); 76 // OPropertyChangeListener 77 virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException); 78 public: 79 OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView); 80 virtual ~OReportWindow(); 81 82 /** late ctor 83 */ 84 void initialize(); 85 // WINDOW overloads 86 virtual void Resize(); 87 getReportView() const88 inline ODesignView* getReportView() const { return m_pView; } getScrollWindow() const89 inline OScrollWindowHelper* getScrollWindow() const { return m_pParent; } 90 91 void SetMode( DlgEdMode m_eMode ); 92 void SetInsertObj( sal_uInt16 eObj,const ::rtl::OUString& _sShapeType = ::rtl::OUString()); 93 rtl::OUString GetInsertObjString() const; 94 void setGridSnap(sal_Bool bOn); 95 void setDragStripes(sal_Bool bOn); 96 97 /** copies the current selection in this section 98 */ 99 void Copy(); 100 101 /** returns if paste is allowed 102 * 103 * \return <TRUE/> if paste is allowed 104 */ 105 sal_Bool IsPasteAllowed() const; 106 107 /** paste a new control in this section 108 */ 109 void Paste(); 110 111 /** Deletes the current selection in this section 112 * 113 */ 114 void Delete(); 115 116 /** All objects will be marked. 117 */ 118 void SelectAll(const sal_uInt16 _nObjectType); 119 120 /** returns <TRUE/> when a object is marked 121 */ 122 sal_Bool HasSelection() const; 123 124 Point getThumbPos() const; 125 126 /** removes the section at the given position. 127 * 128 * \param _nPosition Zero based. 129 */ 130 void removeSection(sal_uInt16 _nPosition); 131 132 /** adds a new section at position _nPosition. 133 If the section is <NULL/> nothing happens. 134 If the position is grater than the current elements, the section will be appended. 135 */ 136 void addSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection 137 ,const ::rtl::OUString& _sColorEntry 138 ,sal_uInt16 _nPosition = USHRT_MAX); 139 140 sal_uInt16 getSectionCount() const; 141 142 /** turns the grid on or off 143 * 144 * \param _bVisible 145 */ 146 void toggleGrid(sal_Bool _bVisible); 147 148 149 /** shows the ruler 150 */ 151 void showRuler(sal_Bool _bShow); 152 getRulerHeight() const153 inline sal_Int32 getRulerHeight() const { return m_aHRuler.GetSizePixel().Height(); } 154 155 /** returns the total width of the first section 156 */ 157 sal_Int32 GetTotalWidth() const; 158 159 /** calculate the max width of the markers 160 * 161 * @param _bWithEnd if <TRUE/> the end marker will be used for calculation as well otherwise not. 162 * \return the max width 163 */ 164 sal_Int32 getMaxMarkerWidth(sal_Bool _bWithEnd) const; 165 166 void ScrollChildren(const Point& _aThumbPos); 167 168 void notifySizeChanged(); 169 170 /** unmark all objects on the views without the given one. 171 * 172 * @param _pSectionView The view where the objects should not be unmarked. 173 */ 174 void unmarkAllObjects(OSectionView* _pSectionView); 175 176 /** triggers the property browser with the report component or section 177 @param _xReportComponent 178 */ 179 void showProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xReportComponent); 180 181 /** checks if the keycode is known by the child windows 182 @param _rCode the keycode 183 @return <TRUE/> if the keycode is handled otherwise <FALSE/> 184 */ 185 sal_Bool handleKeyEvent(const KeyEvent& _rEvent); 186 187 /** the the section as marked or not marked 188 @param _pSectionView the section where to set the marked flag 189 @param _bMark the marked flag 190 */ 191 void setMarked(OSectionView* _pSectionView,sal_Bool _bMark); 192 void setMarked(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,sal_Bool _bMark); 193 void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape,sal_Bool _bMark); 194 195 // IMarkedSection 196 ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const; 197 ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; 198 virtual void markSection(const sal_uInt16 _nPos); 199 200 201 /** fills the positions of all collapsed sections. 202 * 203 * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections. 204 */ 205 void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const; 206 207 /** collpase all sections given by their position 208 * 209 * \param _aCollpasedSections The position of the sections which should be collapsed. 210 */ 211 void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections); 212 213 /** align all marked objects in all sections 214 * 215 * \param eHor 216 * \param eVert 217 * \param bBoundRects 218 */ 219 void alignMarkedObjects(sal_Int32 _nControlModification, bool _bAlignAtSection, bool bBoundRects = false); 220 221 sal_uInt32 getMarkedObjectCount() const; 222 223 /** zoom the ruler and view windows 224 */ 225 void zoom(const Fraction& _aZoom); 226 227 /** fills the vector with all selected control models 228 /param _rSelection The vector will be filled and will not be cleared before. 229 */ 230 void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const; 231 232 /** calculates the zoom factor. 233 @param _eType which kind of zoom is needed 234 */ 235 sal_uInt16 getZoomFactor(SvxZoomType _eType) const; 236 }; 237 //================================================================== 238 } //rptui 239 //================================================================== 240 #endif // RPTUI_REPORT_WINDOW_HXX 241 242