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 RPTUI_DESIGNVIEW_HXX 24cdf0e10cSrcweir #define RPTUI_DESIGNVIEW_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <dbaccess/dataview.hxx> 27cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp> 28cdf0e10cSrcweir #include <com/sun/star/report/XSection.hpp> 29cdf0e10cSrcweir #include <com/sun/star/report/XReportComponent.hpp> 30cdf0e10cSrcweir #include <vcl/split.hxx> 31cdf0e10cSrcweir #include <vcl/scrbar.hxx> 32cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 33cdf0e10cSrcweir #include <com/sun/star/datatransfer/DataFlavor.hpp> 34cdf0e10cSrcweir #include <tools/link.hxx> 35cdf0e10cSrcweir #include <tools/gen.hxx> 36cdf0e10cSrcweir #include <vcl/timer.hxx> 37cdf0e10cSrcweir #include <svl/hint.hxx> 38cdf0e10cSrcweir #include <svl/brdcst.hxx> 39cdf0e10cSrcweir #include <comphelper/stl_types.hxx> 40cdf0e10cSrcweir #include "ReportDefines.hxx" 41cdf0e10cSrcweir #include <svtools/colorcfg.hxx> 42cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 43cdf0e10cSrcweir #include <svx/svdedtv.hxx> 44cdf0e10cSrcweir #include <vcl/tabpage.hxx> 45cdf0e10cSrcweir #include <vcl/splitwin.hxx> 46cdf0e10cSrcweir #include <MarkedSection.hxx> 47cdf0e10cSrcweir #include "ScrollHelper.hxx" 48cdf0e10cSrcweir 49cdf0e10cSrcweir class KeyEvent; 50cdf0e10cSrcweir class MouseEvent; 51cdf0e10cSrcweir class Timer; 52cdf0e10cSrcweir class Window; 53cdf0e10cSrcweir 54cdf0e10cSrcweir namespace rptui 55cdf0e10cSrcweir { 56cdf0e10cSrcweir class OReportSection; 57cdf0e10cSrcweir class OUnoObject; 58cdf0e10cSrcweir class OSectionView; 59cdf0e10cSrcweir class OReportController; 60cdf0e10cSrcweir class PropBrw; 61cdf0e10cSrcweir class OAddFieldWindow; 62cdf0e10cSrcweir class OReportModel; 63cdf0e10cSrcweir class ONavigator; 64cdf0e10cSrcweir //================================================================== 65cdf0e10cSrcweir //================================================================== 66cdf0e10cSrcweir class ODesignView : public dbaui::ODataView, public SfxBroadcaster, public IMarkedSection 67cdf0e10cSrcweir { 68cdf0e10cSrcweir private: 69cdf0e10cSrcweir SplitWindow m_aSplitWin; 70cdf0e10cSrcweir 71cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xReportComponent; 72cdf0e10cSrcweir OReportController& m_rReportController; 73cdf0e10cSrcweir OScrollWindowHelper m_aScrollWindow; 74cdf0e10cSrcweir Window* m_pTaskPane; 75cdf0e10cSrcweir PropBrw* m_pPropWin; 76cdf0e10cSrcweir OAddFieldWindow* m_pAddField; 77cdf0e10cSrcweir OSectionView* m_pCurrentView; 78cdf0e10cSrcweir ONavigator* m_pReportExplorer; 79cdf0e10cSrcweir Timer m_aMarkTimer; 80cdf0e10cSrcweir Point m_aScrollOffset; 81cdf0e10cSrcweir DlgEdMode m_eMode; 82cdf0e10cSrcweir sal_uInt16 m_nCurrentPosition; 83cdf0e10cSrcweir sal_uInt16 m_eActObj; 84cdf0e10cSrcweir sal_Bool m_bFirstDraw; 85cdf0e10cSrcweir Size m_aGridSizeCoarse; 86cdf0e10cSrcweir Size m_aGridSizeFine; 87cdf0e10cSrcweir sal_Bool m_bGridVisible; 88cdf0e10cSrcweir sal_Bool m_bGridSnap; 89cdf0e10cSrcweir sal_Bool m_bDeleted; 90cdf0e10cSrcweir 91cdf0e10cSrcweir 92cdf0e10cSrcweir DECL_LINK( MarkTimeout, Timer * ); 93cdf0e10cSrcweir DECL_LINK( SplitHdl, void* ); 94cdf0e10cSrcweir 95cdf0e10cSrcweir void ImplInitSettings(); 96cdf0e10cSrcweir 97cdf0e10cSrcweir ODesignView(ODesignView&); 98cdf0e10cSrcweir void operator =(ODesignView&); 99cdf0e10cSrcweir protected: 100cdf0e10cSrcweir // return the Rectangle where I can paint myself 101cdf0e10cSrcweir virtual void resizeDocumentView(Rectangle& rRect); 102cdf0e10cSrcweir // return the Rectangle where I can paint myself 103cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 104cdf0e10cSrcweir 105cdf0e10cSrcweir public: 106cdf0e10cSrcweir ODesignView(Window* pParent, 107cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&, 108cdf0e10cSrcweir OReportController& _rController); 109cdf0e10cSrcweir virtual ~ODesignView(); 110cdf0e10cSrcweir 111cdf0e10cSrcweir // window overloads 112cdf0e10cSrcweir virtual void MouseButtonDown( const MouseEvent& rMEvt ); 113cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 114cdf0e10cSrcweir virtual void GetFocus(); 115cdf0e10cSrcweir 116cdf0e10cSrcweir // set the view readonly or not 117cdf0e10cSrcweir virtual void setReadOnly(sal_Bool _bReadOnly); 118cdf0e10cSrcweir 119cdf0e10cSrcweir virtual void initialize(); 120cdf0e10cSrcweir getController() const121cdf0e10cSrcweir inline OReportController& getController() const { return m_rReportController; } 122cdf0e10cSrcweir 123cdf0e10cSrcweir void SetMode( DlgEdMode m_eMode ); 124cdf0e10cSrcweir void SetInsertObj( sal_uInt16 eObj,const ::rtl::OUString& _sShapeType = ::rtl::OUString()); 125cdf0e10cSrcweir sal_uInt16 GetInsertObj() const; 126cdf0e10cSrcweir rtl::OUString GetInsertObjString() const; GetMode() const127cdf0e10cSrcweir DlgEdMode GetMode() const { return m_eMode; } 128cdf0e10cSrcweir 129cdf0e10cSrcweir /** cuts the current selection in this section 130cdf0e10cSrcweir */ 131cdf0e10cSrcweir void Cut(); 132cdf0e10cSrcweir 133cdf0e10cSrcweir /** copies the current selection in this section 134cdf0e10cSrcweir */ 135cdf0e10cSrcweir void Copy(); 136cdf0e10cSrcweir 137cdf0e10cSrcweir /** returns if paste is allowed 138cdf0e10cSrcweir * 139cdf0e10cSrcweir * \return <TRUE/> if paste is allowed 140cdf0e10cSrcweir */ 141cdf0e10cSrcweir sal_Bool IsPasteAllowed() const; 142cdf0e10cSrcweir 143cdf0e10cSrcweir /** paste a new control in this section 144cdf0e10cSrcweir */ 145cdf0e10cSrcweir void Paste(); 146cdf0e10cSrcweir 147cdf0e10cSrcweir /** Deletes the current selection in this section 148cdf0e10cSrcweir * 149cdf0e10cSrcweir */ 150cdf0e10cSrcweir void Delete(); 151cdf0e10cSrcweir 152cdf0e10cSrcweir /** align all marked objects in all sections 153cdf0e10cSrcweir */ 154cdf0e10cSrcweir void alignMarkedObjects(sal_Int32 _nControlModification, bool _bAlignAtSection, bool bBoundRects = false); 155cdf0e10cSrcweir 156cdf0e10cSrcweir #if 0 157cdf0e10cSrcweir /** checks if alignment is possible in the current section 158cdf0e10cSrcweir */ 159cdf0e10cSrcweir sal_Bool isAlignPossible() const; 160cdf0e10cSrcweir #endif 161cdf0e10cSrcweir 162cdf0e10cSrcweir /** All objects will be marked. 163cdf0e10cSrcweir */ 164cdf0e10cSrcweir void SelectAll(const sal_uInt16 _nObjectType); 165cdf0e10cSrcweir 166cdf0e10cSrcweir /// checks if a selection exists 167cdf0e10cSrcweir sal_Bool HasSelection() const; 168cdf0e10cSrcweir 169cdf0e10cSrcweir void UpdatePropertyBrowserDelayed(OSectionView& _rView); 170cdf0e10cSrcweir 171cdf0e10cSrcweir sal_uInt16 getSectionCount() const; 172cdf0e10cSrcweir 173cdf0e10cSrcweir /** removes the section at the given position. 174cdf0e10cSrcweir * 175cdf0e10cSrcweir * \param _nPosition Zero based. 176cdf0e10cSrcweir */ 177cdf0e10cSrcweir void removeSection(sal_uInt16 _nPosition); 178cdf0e10cSrcweir 179cdf0e10cSrcweir /** adds a new section at position _nPosition. 180cdf0e10cSrcweir If the section is <NULL/> nothing happens. 181cdf0e10cSrcweir If the position is grater than the current elements, the section will be appended. 182cdf0e10cSrcweir */ 183cdf0e10cSrcweir void addSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection 184cdf0e10cSrcweir ,const ::rtl::OUString& _sColorEntry 185cdf0e10cSrcweir ,sal_uInt16 _nPosition = USHRT_MAX); 186cdf0e10cSrcweir getGridSizeCoarse() const187cdf0e10cSrcweir inline Size getGridSizeCoarse() const { return m_aGridSizeCoarse; } getGridSizeFine() const188cdf0e10cSrcweir inline Size getGridSizeFine() const { return m_aGridSizeFine; } isGridSnap() const189cdf0e10cSrcweir inline sal_Bool isGridSnap() const { return m_bGridSnap; } 190cdf0e10cSrcweir void setGridSnap(sal_Bool bOn); 191cdf0e10cSrcweir void setDragStripes(sal_Bool bOn); 192cdf0e10cSrcweir /** turns the grid on or off 193cdf0e10cSrcweir * 194cdf0e10cSrcweir * \param _bGridVisible 195cdf0e10cSrcweir */ 196cdf0e10cSrcweir void toggleGrid(sal_Bool _bGridVisible); 197cdf0e10cSrcweir 198cdf0e10cSrcweir void togglePropertyBrowser(sal_Bool _bToogleOn); 199cdf0e10cSrcweir 200cdf0e10cSrcweir sal_Bool isAddFieldVisible() const; 201cdf0e10cSrcweir void toggleAddField(); 202cdf0e10cSrcweir 203cdf0e10cSrcweir sal_Bool isReportExplorerVisible() const; 204cdf0e10cSrcweir void toggleReportExplorer(); 205cdf0e10cSrcweir 206cdf0e10cSrcweir /** shows or hides the ruler. 207cdf0e10cSrcweir */ 208cdf0e10cSrcweir void showRuler(sal_Bool _bShow); 209cdf0e10cSrcweir 210cdf0e10cSrcweir /** unmark all objects on the views without the given one. 211cdf0e10cSrcweir * 212cdf0e10cSrcweir * @param _pSectionView The view where the objects should not be unmarked. 213cdf0e10cSrcweir */ 214cdf0e10cSrcweir void unmarkAllObjects(OSectionView* _pSectionView); 215cdf0e10cSrcweir 216cdf0e10cSrcweir /** triggers the property browser with the section 217cdf0e10cSrcweir @param _xReportComponent the report component 218cdf0e10cSrcweir */ 219cdf0e10cSrcweir void showProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xReportComponent); 220cdf0e10cSrcweir ::com::sun::star::uno::Any getCurrentlyShownProperty() const; 221cdf0e10cSrcweir 222cdf0e10cSrcweir /** returns the current section or the detail section if no section was selected previously 223cdf0e10cSrcweir */ 224cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > getCurrentSection() const; 225cdf0e10cSrcweir 226cdf0e10cSrcweir /** returns the current control report model or <NULL/> 227cdf0e10cSrcweir */ 228cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > getCurrentControlModel() const; 229cdf0e10cSrcweir 230cdf0e10cSrcweir // IMarkedSection 231cdf0e10cSrcweir ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const; 232cdf0e10cSrcweir ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; 233cdf0e10cSrcweir virtual void markSection(const sal_uInt16 _nPos); 234cdf0e10cSrcweir 235cdf0e10cSrcweir /** fills the positions of all collapsed sections. 236cdf0e10cSrcweir * 237cdf0e10cSrcweir * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections. 238cdf0e10cSrcweir */ 239cdf0e10cSrcweir void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const; 240cdf0e10cSrcweir 241cdf0e10cSrcweir /** collpase all sections given by their position 242cdf0e10cSrcweir * 243cdf0e10cSrcweir * \param _aCollpasedSections The position of the sections which should be collapsed. 244cdf0e10cSrcweir */ 245cdf0e10cSrcweir void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections); 246cdf0e10cSrcweir 247cdf0e10cSrcweir ::rtl::OUString getCurrentPage() const; 248cdf0e10cSrcweir void setCurrentPage(const ::rtl::OUString& _sLastActivePage); 249cdf0e10cSrcweir 250cdf0e10cSrcweir /** checks if the keycode is known by the child windows 251cdf0e10cSrcweir @param _rCode the keycode 252cdf0e10cSrcweir @return <TRUE/> if the keycode is handled otherwise <FALSE/> 253cdf0e10cSrcweir */ 254cdf0e10cSrcweir sal_Bool handleKeyEvent(const KeyEvent& _rEvent); 255cdf0e10cSrcweir 256cdf0e10cSrcweir /** set the section as marked or not marked 257cdf0e10cSrcweir @param _pSectionView the section where to set the marked flag 258cdf0e10cSrcweir @param _bMark the marked flag 259cdf0e10cSrcweir */ 260cdf0e10cSrcweir void setMarked(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,sal_Bool _bMark); 261cdf0e10cSrcweir void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape,sal_Bool _bMark); 262cdf0e10cSrcweir 263cdf0e10cSrcweir /** returns if the view handles the event by itself 264cdf0e10cSrcweir * 265cdf0e10cSrcweir * \param _nId the command id 266cdf0e10cSrcweir * \return <FALSE/> is the event is not handled by the view otherwise <TRUE/> 267cdf0e10cSrcweir */ 268cdf0e10cSrcweir sal_Bool isHandleEvent(sal_uInt16 _nId) const; 269cdf0e10cSrcweir 270cdf0e10cSrcweir sal_uInt32 getMarkedObjectCount() const; 271cdf0e10cSrcweir 272cdf0e10cSrcweir /** zoom the ruler and view windows 273cdf0e10cSrcweir */ 274cdf0e10cSrcweir void zoom(const Fraction& _aZoom); 275cdf0e10cSrcweir 276cdf0e10cSrcweir /** fills the vector with all selected control models 277cdf0e10cSrcweir /param _rSelection The vector will be filled and will not be cleared before. 278cdf0e10cSrcweir */ 279cdf0e10cSrcweir void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const; 280cdf0e10cSrcweir 281cdf0e10cSrcweir /** returns the selected field from the add field dialog 282cdf0e10cSrcweir */ 283cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getSelectedFieldDescriptors(); 284cdf0e10cSrcweir 285cdf0e10cSrcweir /** calculates the zoom factor. 286cdf0e10cSrcweir @param _eType which kind of zoom is needed 287cdf0e10cSrcweir */ 288cdf0e10cSrcweir sal_uInt16 getZoomFactor(SvxZoomType _eType) const; 289cdf0e10cSrcweir }; 290cdf0e10cSrcweir //================================================================== 291cdf0e10cSrcweir } //rptui 292cdf0e10cSrcweir //================================================================== 293cdf0e10cSrcweir #endif // RPTUI_DESIGNVIEW_HXX 294cdf0e10cSrcweir 295