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