Files
libreoffice/reportdesign/source/ui/inc/DesignView.hxx

291 lines
11 KiB
C++
Raw Normal View History

2007-07-09 10:56:41 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2007-07-09 10:56:41 +00:00
*
* Copyright 2008 by Sun Microsystems, Inc.
2007-07-09 10:56:41 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2007-07-09 10:56:41 +00:00
*
* $RCSfile: DesignView.hxx,v $
* $Revision: 1.8 $
2007-07-09 10:56:41 +00:00
*
* This file is part of OpenOffice.org.
2007-07-09 10:56:41 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2007-07-09 10:56:41 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2007-07-09 10:56:41 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2007-07-09 10:56:41 +00:00
*
************************************************************************/
#ifndef RPTUI_DESIGNVIEW_HXX
#define RPTUI_DESIGNVIEW_HXX
2007-07-09 10:56:41 +00:00
#include <dbaccess/dataview.hxx>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/report/XSection.hpp>
#include <com/sun/star/report/XReportComponent.hpp>
#include <vcl/split.hxx>
#include <vcl/scrbar.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/datatransfer/DataFlavor.hpp>
#include <tools/link.hxx>
#include <tools/gen.hxx>
#include <vcl/timer.hxx>
#include <svtools/hint.hxx>
#include <svtools/brdcst.hxx>
#include <comphelper/stl_types.hxx>
#include "ReportDefines.hxx"
#include <svtools/colorcfg.hxx>
#include <boost/shared_ptr.hpp>
#include <svx/svdedtv.hxx>
#include <vcl/tabpage.hxx>
#include <vcl/splitwin.hxx>
2007-07-09 10:56:41 +00:00
#include <MarkedSection.hxx>
#include "ScrollHelper.hxx"
2007-07-09 10:56:41 +00:00
class KeyEvent;
class MouseEvent;
class Timer;
class Window;
namespace rptui
{
class OReportSection;
class OUnoObject;
class OSectionView;
class OReportController;
class PropBrw;
class OAddFieldWindow;
class OReportModel;
class ONavigator;
//==================================================================
//==================================================================
class ODesignView : public dbaui::ODataView, public SfxBroadcaster, public IMarkedSection
{
private:
SplitWindow m_aSplitWin;
2007-07-09 10:56:41 +00:00
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xReportComponent;
OReportController& m_rReportController;
OScrollWindowHelper m_aScrollWindow;
2007-07-09 10:56:41 +00:00
Window* m_pTaskPane;
PropBrw* m_pPropWin;
OAddFieldWindow* m_pAddField;
OSectionView* m_pCurrentView;
ONavigator* m_pReportExplorer;
Timer m_aMarkTimer;
Point m_aScrollOffset;
DlgEdMode m_eMode;
USHORT m_nCurrentPosition;
USHORT m_eActObj;
BOOL m_bFirstDraw;
CWS-TOOLING: integrate CWS aw058 2008-11-19 14:27:57 +0100 aw r263994 : #i95264# corrected line primitive range calculation for hairlines 2008-11-18 11:31:52 +0100 wg r263754 : i96156 2008-11-18 11:22:38 +0100 wg r263752 : i96156 2008-11-13 11:46:49 +0100 aw r263626 : #i93169# used flag the wrong way; true means that nothing was done yet 2008-11-12 15:33:41 +0100 wg r263601 : i96156 2008-11-12 13:22:38 +0100 wg r263592 : i95527 2008-11-12 13:18:51 +0100 wg r263591 : i95527 2008-10-29 13:22:02 +0100 aw r262794 : #i93485# identified reason and with PL's help changed problem accordingly with usage of an old fallback. This will need to be optimized again by HDU when he finds the time. 2008-10-28 18:23:04 +0100 aw r262763 : unxmacxi compiler warning fixed 2008-10-28 18:17:01 +0100 aw r262762 : unxmacxi compiler warning fixed 2008-10-28 17:55:18 +0100 aw r262761 : unxmacxi compiler warning fixed 2008-10-28 13:48:22 +0100 aw r262743 : #i93485# added UnifiedAlphaPrimitive2D to VclRenderer; corrected getB2DRange implementations for hairlines which are view-dependent 2008-10-28 12:40:55 +0100 aw r262735 : #i93485# had to move Pre/PostPaint to LocalPre/PostPaint since PrePaint is a virtual window method 2008-10-27 15:54:10 +0100 aw r262679 : #i19871# adapted the call order to parent implementations in some Nbc methods in SdrPathObj due to errors in SnapRect recalculation when GluePoints are involved 2008-10-24 18:31:48 +0200 aw r262661 : #i77187# disable all buttons in bezier toolbar when move and/or resize protected object is involved 2008-10-24 18:30:16 +0200 aw r262660 : #i77187# simplified and secured model changers, added toolbar update, disabled move drag start when polygon point is selected 2008-10-24 12:57:50 +0200 hdu r262635 : #i93485# use device transformation for SAL layer 2008-10-24 12:41:37 +0200 hdu r262634 : #i93485# use device transformation for SAL layer 2008-10-23 19:46:12 +0200 aw r262630 : mac compiler warning fixed 2008-10-23 18:15:02 +0200 aw r262628 : #i93485# modified dialog previews to use prerendering 2008-10-23 18:14:27 +0200 aw r262627 : #i93485# added assert when render helper uses Window as copy source 2008-10-22 18:07:30 +0200 aw r262610 : #i95264# fixes assertion 2008-10-22 14:31:51 +0200 aw r262606 : #i89661# also enabling DrawTransparent shortcut for VCL-Renderer 2008-10-22 14:10:31 +0200 aw r262604 : #i89661# new HitTest 2D primitive to support BoundRect and HitTest calculations/tests 2008-10-22 14:09:22 +0200 aw r262603 : #i89661# new HitTest tolerance, new TextFrame selection overlay, support for HitTest geometry 2008-10-22 14:08:16 +0200 aw r262602 : #i89661# correcting old HitTest tolerance expansion 2008-10-20 15:31:48 +0200 aw r262321 : #i89661# added patch to test it 2008-10-20 11:50:31 +0200 aw r262310 : #i87762# removed no longer used icons (aw053) 2008-10-17 15:41:48 +0200 aw r262288 : #i93169#, #i93180# FormControl corrections for Primitive handling 2008-10-17 15:40:54 +0200 aw r262287 : #i93169#, #i93180# FormControl corrections for Primitive handling 2008-10-16 11:12:44 +0200 aw r262253 : #i93595# removed superfluous grid interface 2008-10-16 11:11:20 +0200 aw r262252 : #i93595# changed grid display to sub-grid usage and new defaults 2008-10-15 15:09:40 +0200 aw r262234 : #i93597# moved flag for only vertical PageBorder, added reacting on it to primitive creation 2008-10-15 15:09:09 +0200 aw r262233 : #i93597# moved flag for only vertical PageBorder 2008-10-15 15:08:46 +0200 aw r262232 : #i93597# moved flag for only vertical PageBorder, added reacting on it to primitive creation 2008-10-14 16:27:07 +0200 aw r262207 : #i93648# (flushViewObjectContacts) and #i93318# (propertyChange) 2008-10-14 16:25:10 +0200 aw r262206 : #i93318# back to old state since detecting a change is not placed well at the primitive (which is a graphical information at the itme it was fetched). Instead i will add the needed check and flush at the FormControl's VOC 2008-10-14 13:47:38 +0200 aw r262201 : #i93318# added a change listener to the XControlModel and code to make the operator== at control primitive fail
2008-11-19 14:05:59 +00:00
Size m_aGridSizeCoarse;
Size m_aGridSizeFine;
2007-07-09 10:56:41 +00:00
BOOL m_bGridVisible;
BOOL m_bGridSnap;
BOOL m_bDeleted;
2007-07-09 10:56:41 +00:00
DECL_LINK( MarkTimeout, Timer * );
DECL_LINK( SplitHdl, void* );
void ImplInitSettings();
ODesignView(ODesignView&);
void operator =(ODesignView&);
protected:
// return the Rectangle where I can paint myself
virtual void resizeDocumentView(Rectangle& rRect);
// return the Rectangle where I can paint myself
virtual void DataChanged( const DataChangedEvent& rDCEvt );
public:
ODesignView(Window* pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&,
OReportController& _rController);
2007-07-09 10:56:41 +00:00
virtual ~ODesignView();
// window overloads
virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual long PreNotify( NotifyEvent& rNEvt );
virtual void GetFocus();
// set the view readonly or not
virtual void setReadOnly(sal_Bool _bReadOnly);
virtual void initialize();
inline OReportController& getController() const { return m_rReportController; }
2007-07-09 10:56:41 +00:00
void SetMode( DlgEdMode m_eMode );
void SetInsertObj( USHORT eObj,const ::rtl::OUString& _sShapeType = ::rtl::OUString());
USHORT GetInsertObj() const;
rtl::OUString GetInsertObjString() const;
2007-07-09 10:56:41 +00:00
DlgEdMode GetMode() const { return m_eMode; }
/** cuts the current selection in this section
*/
void Cut();
/** copies the current selection in this section
*/
void Copy();
/** returns if paste is allowed
*
* \return <TRUE/> if paste is allowed
*/
BOOL IsPasteAllowed();
/** paste a new control in this section
*/
void Paste();
/** Deletes the current selection in this section
*
*/
void Delete();
/** align all marked objects in all sections
*/
void alignMarkedObjects(sal_Int32 _nControlModification, bool _bAlignAtSection, bool bBoundRects = false);
/** checks if alignment is possible in the current section
*/
sal_Bool isAlignPossible() const;
/** All objects will be marked.
*/
void SelectAll(const sal_uInt16 _nObjectType);
2007-07-09 10:56:41 +00:00
/// checks if a selection exists
BOOL HasSelection();
void UpdatePropertyBrowserDelayed(OSectionView& _rView);
2007-07-09 10:56:41 +00:00
USHORT getSectionCount() const;
/** removes the section at the given position.
*
* \param _nPosition Zero based.
*/
void removeSection(USHORT _nPosition);
/** adds a new section at position _nPosition.
If the section is <NULL/> nothing happens.
If the position is grater than the current elements, the section will be appended.
*/
void addSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
,const ::rtl::OUString& _sColorEntry
,USHORT _nPosition = USHRT_MAX);
CWS-TOOLING: integrate CWS aw058 2008-11-19 14:27:57 +0100 aw r263994 : #i95264# corrected line primitive range calculation for hairlines 2008-11-18 11:31:52 +0100 wg r263754 : i96156 2008-11-18 11:22:38 +0100 wg r263752 : i96156 2008-11-13 11:46:49 +0100 aw r263626 : #i93169# used flag the wrong way; true means that nothing was done yet 2008-11-12 15:33:41 +0100 wg r263601 : i96156 2008-11-12 13:22:38 +0100 wg r263592 : i95527 2008-11-12 13:18:51 +0100 wg r263591 : i95527 2008-10-29 13:22:02 +0100 aw r262794 : #i93485# identified reason and with PL's help changed problem accordingly with usage of an old fallback. This will need to be optimized again by HDU when he finds the time. 2008-10-28 18:23:04 +0100 aw r262763 : unxmacxi compiler warning fixed 2008-10-28 18:17:01 +0100 aw r262762 : unxmacxi compiler warning fixed 2008-10-28 17:55:18 +0100 aw r262761 : unxmacxi compiler warning fixed 2008-10-28 13:48:22 +0100 aw r262743 : #i93485# added UnifiedAlphaPrimitive2D to VclRenderer; corrected getB2DRange implementations for hairlines which are view-dependent 2008-10-28 12:40:55 +0100 aw r262735 : #i93485# had to move Pre/PostPaint to LocalPre/PostPaint since PrePaint is a virtual window method 2008-10-27 15:54:10 +0100 aw r262679 : #i19871# adapted the call order to parent implementations in some Nbc methods in SdrPathObj due to errors in SnapRect recalculation when GluePoints are involved 2008-10-24 18:31:48 +0200 aw r262661 : #i77187# disable all buttons in bezier toolbar when move and/or resize protected object is involved 2008-10-24 18:30:16 +0200 aw r262660 : #i77187# simplified and secured model changers, added toolbar update, disabled move drag start when polygon point is selected 2008-10-24 12:57:50 +0200 hdu r262635 : #i93485# use device transformation for SAL layer 2008-10-24 12:41:37 +0200 hdu r262634 : #i93485# use device transformation for SAL layer 2008-10-23 19:46:12 +0200 aw r262630 : mac compiler warning fixed 2008-10-23 18:15:02 +0200 aw r262628 : #i93485# modified dialog previews to use prerendering 2008-10-23 18:14:27 +0200 aw r262627 : #i93485# added assert when render helper uses Window as copy source 2008-10-22 18:07:30 +0200 aw r262610 : #i95264# fixes assertion 2008-10-22 14:31:51 +0200 aw r262606 : #i89661# also enabling DrawTransparent shortcut for VCL-Renderer 2008-10-22 14:10:31 +0200 aw r262604 : #i89661# new HitTest 2D primitive to support BoundRect and HitTest calculations/tests 2008-10-22 14:09:22 +0200 aw r262603 : #i89661# new HitTest tolerance, new TextFrame selection overlay, support for HitTest geometry 2008-10-22 14:08:16 +0200 aw r262602 : #i89661# correcting old HitTest tolerance expansion 2008-10-20 15:31:48 +0200 aw r262321 : #i89661# added patch to test it 2008-10-20 11:50:31 +0200 aw r262310 : #i87762# removed no longer used icons (aw053) 2008-10-17 15:41:48 +0200 aw r262288 : #i93169#, #i93180# FormControl corrections for Primitive handling 2008-10-17 15:40:54 +0200 aw r262287 : #i93169#, #i93180# FormControl corrections for Primitive handling 2008-10-16 11:12:44 +0200 aw r262253 : #i93595# removed superfluous grid interface 2008-10-16 11:11:20 +0200 aw r262252 : #i93595# changed grid display to sub-grid usage and new defaults 2008-10-15 15:09:40 +0200 aw r262234 : #i93597# moved flag for only vertical PageBorder, added reacting on it to primitive creation 2008-10-15 15:09:09 +0200 aw r262233 : #i93597# moved flag for only vertical PageBorder 2008-10-15 15:08:46 +0200 aw r262232 : #i93597# moved flag for only vertical PageBorder, added reacting on it to primitive creation 2008-10-14 16:27:07 +0200 aw r262207 : #i93648# (flushViewObjectContacts) and #i93318# (propertyChange) 2008-10-14 16:25:10 +0200 aw r262206 : #i93318# back to old state since detecting a change is not placed well at the primitive (which is a graphical information at the itme it was fetched). Instead i will add the needed check and flush at the FormControl's VOC 2008-10-14 13:47:38 +0200 aw r262201 : #i93318# added a change listener to the XControlModel and code to make the operator== at control primitive fail
2008-11-19 14:05:59 +00:00
inline Size getGridSizeCoarse() const { return m_aGridSizeCoarse; }
inline Size getGridSizeFine() const { return m_aGridSizeFine; }
2007-07-09 10:56:41 +00:00
inline BOOL isGridSnap() const { return m_bGridSnap; }
void setGridSnap(BOOL bOn);
void setDragStripes(BOOL bOn);
/** turns the grid on or off
*
* \param _bGridVisible
*/
void toggleGrid(sal_Bool _bGridVisible);
void togglePropertyBrowser(sal_Bool _bToogleOn);
BOOL isAddFieldVisible() const;
void toggleAddField();
BOOL isReportExplorerVisible() const;
void toggleReportExplorer();
/** shows or hides the ruler.
*/
void showRuler(sal_Bool _bShow);
/** unmark all objects on the views without the given one.
*
* @param _pSectionView The view where the objects should not be unmarked.
*/
void unmarkAllObjects(OSectionView* _pSectionView);
/** triggers the property browser with the section
@param _xReportComponent the report component
*/
void showProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xReportComponent);
::com::sun::star::uno::Any getCurrentlyShownProperty() const;
/** returns the current section or the detail section if no section was selected previously
*/
::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > getCurrentSection() const;
/** returns the current control report model or <NULL/>
*/
::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > getCurrentControlModel() const;
// IMarkedSection
::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const;
2007-07-09 10:56:41 +00:00
virtual void markSection(const sal_uInt16 _nPos);
/** fills the positions of all collapsed sections.
*
* \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections.
*/
void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const;
/** collpase all sections given by their position
*
* \param _aCollpasedSections The position of the sections which should be collapsed.
*/
void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections);
::rtl::OUString getCurrentPage() const;
void setCurrentPage(const ::rtl::OUString& _sLastActivePage);
/** checks if the keycode is known by the child windows
@param _rCode the keycode
@return <TRUE/> if the keycode is handled otherwise <FALSE/>
*/
sal_Bool handleKeyEvent(const KeyEvent& _rEvent);
/** set the section as marked or not marked
@param _pSectionView the section where to set the marked flag
@param _bMark the marked flag
*/
void setMarked(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,sal_Bool _bMark);
void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape,sal_Bool _bMark);
/** returns if the view handles the event by itself
*
* \param _nId the command id
* \return <FALSE/> is the event is not handled by the view otherwise <TRUE/>
*/
sal_Bool isHandleEvent(sal_uInt16 _nId) const;
sal_uInt32 getMarkedObjectCount() const;
/** zoom the ruler and view windows
*/
void zoom(const sal_Int16 _nZoom);
/** fills the vector with all selected control models
/param _rSelection The vector will be filled and will not be cleared before.
*/
void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const;
2007-07-09 10:56:41 +00:00
};
//==================================================================
} //rptui
//==================================================================
#endif // RPTUI_DESIGNVIEW_HXX