1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DESIGNVIEW_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DESIGNVIEW_HXX
22 #include <dbaccess/dataview.hxx>
23 #include <com/sun/star/report/XSection.hpp>
24 #include <com/sun/star/report/XReportComponent.hpp>
25 #include <vcl/split.hxx>
26 #include <vcl/scrbar.hxx>
27 #include <com/sun/star/container/XNameContainer.hpp>
28 #include <com/sun/star/datatransfer/DataFlavor.hpp>
29 #include <tools/link.hxx>
30 #include <tools/gen.hxx>
31 #include <vcl/timer.hxx>
32 #include <vcl/idle.hxx>
33 #include <svl/hint.hxx>
34 #include <svl/SfxBroadcaster.hxx>
35 #include "ReportDefines.hxx"
36 #include <svtools/colorcfg.hxx>
37 #include <svx/svdedtv.hxx>
38 #include <vcl/tabpage.hxx>
39 #include <vcl/splitwin.hxx>
40 #include "MarkedSection.hxx"
41 #include "ScrollHelper.hxx"
46 namespace vcl
{ class Window
; }
51 class OReportController
;
53 class OAddFieldWindow
;
57 class ODesignView
: public dbaui::ODataView
, public SfxBroadcaster
, public IMarkedSection
60 VclPtr
<SplitWindow
> m_aSplitWin
;
62 css::uno::Reference
< css::uno::XInterface
> m_xReportComponent
;
63 OReportController
& m_rReportController
;
64 VclPtr
<OScrollWindowHelper
> m_aScrollWindow
;
65 VclPtr
<vcl::Window
> m_pTaskPane
;
66 VclPtr
<PropBrw
> m_pPropWin
;
67 VclPtr
<OAddFieldWindow
> m_pAddField
;
68 OSectionView
* m_pCurrentView
;
69 VclPtr
<ONavigator
> m_pReportExplorer
;
73 Size
const m_aGridSizeCoarse
;
74 Size
const m_aGridSizeFine
;
78 DECL_LINK(MarkTimeout
, Timer
*, void);
79 DECL_LINK( SplitHdl
, SplitWindow
*, void );
81 void ImplInitSettings();
83 ODesignView(ODesignView
const &) = delete;
84 void operator =(ODesignView
const &) = delete;
86 // return the Rectangle where I can paint myself
87 virtual void resizeDocumentView(tools::Rectangle
& rRect
) override
;
88 // return the Rectangle where I can paint myself
89 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
92 ODesignView(vcl::Window
* pParent
,
93 const css::uno::Reference
< css::uno::XComponentContext
>&,
94 OReportController
& _rController
);
95 virtual ~ODesignView() override
;
96 virtual void dispose() override
;
99 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) override
;
100 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
101 virtual void GetFocus() override
;
103 virtual void initialize() override
;
105 OReportController
& getController() const { return m_rReportController
; }
107 void SetMode( DlgEdMode m_eMode
);
108 void SetInsertObj( sal_uInt16 eObj
,const OUString
& _sShapeType
= OUString());
109 sal_uInt16
GetInsertObj() const { return m_eActObj
;}
110 OUString
const & GetInsertObjString() const;
111 DlgEdMode
GetMode() const { return m_eMode
; }
113 /** cuts the current selection in this section
117 /** copies the current selection in this section
121 /** returns if paste is allowed
123 * \return <TRUE/> if paste is allowed
125 bool IsPasteAllowed() const;
127 /** paste a new control in this section
131 /** Deletes the current selection in this section
136 /** align all marked objects in all sections
138 void alignMarkedObjects(ControlModification _nControlModification
, bool _bAlignAtSection
);
140 /** All objects will be marked.
142 void SelectAll(const sal_uInt16 _nObjectType
);
144 /// checks if a selection exists
145 bool HasSelection() const;
147 void UpdatePropertyBrowserDelayed(OSectionView
& _rView
);
149 sal_uInt16
getSectionCount() const;
151 /** removes the section at the given position.
153 * \param _nPosition Zero based.
155 void removeSection(sal_uInt16 _nPosition
);
157 /** adds a new section at position _nPosition.
158 If the section is <NULL/> nothing happens.
159 If the position is grater than the current elements, the section will be appended.
161 void addSection(const css::uno::Reference
< css::report::XSection
>& _xSection
162 ,const OUString
& _sColorEntry
163 ,sal_uInt16 _nPosition
= USHRT_MAX
);
165 const Size
& getGridSizeCoarse() const { return m_aGridSizeCoarse
; }
166 const Size
& getGridSizeFine() const { return m_aGridSizeFine
; }
167 void setGridSnap(bool bOn
);
168 void setDragStripes(bool bOn
);
169 /** turns the grid on or off
171 * \param _bGridVisible
173 void toggleGrid(bool _bGridVisible
);
175 void togglePropertyBrowser(bool _bToggleOn
);
177 bool isAddFieldVisible() const;
178 void toggleAddField();
180 bool isReportExplorerVisible() const;
181 void toggleReportExplorer();
183 /** shows or hides the ruler.
185 void showRuler(bool _bShow
);
187 /** unmark all objects on the views.
189 void unmarkAllObjects();
191 /** triggers the property browser with the section
192 @param _xReportComponent the report component
194 void showProperties( const css::uno::Reference
< css::uno::XInterface
>& _xReportComponent
);
195 css::uno::Any
getCurrentlyShownProperty() const;
197 /** returns the current section or the detail section if no section was selected previously
199 css::uno::Reference
< css::report::XSection
> getCurrentSection() const;
201 /** returns the current control report model or <NULL/>
203 css::uno::Reference
< css::report::XReportComponent
> getCurrentControlModel() const;
206 OSectionWindow
* getMarkedSection(NearSectionAccess nsa
= CURRENT
) const override
;
207 OSectionWindow
* getSectionWindow(const css::uno::Reference
< css::report::XSection
>& _xSection
) const;
208 virtual void markSection(const sal_uInt16 _nPos
) override
;
210 /** fills the positions of all collapsed sections.
212 * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections.
214 void fillCollapsedSections(::std::vector
<sal_uInt16
>& _rCollapsedPositions
) const;
216 /** collpase all sections given by their position
218 * \param _aCollpasedSections The position of the sections which should be collapsed.
220 void collapseSections(const css::uno::Sequence
< css::beans::PropertyValue
>& _aCollpasedSections
);
222 OUString
getCurrentPage() const;
223 void setCurrentPage(const OUString
& _sLastActivePage
);
225 /** checks if the keycode is known by the child windows
226 @param _rCode the keycode
227 @return <TRUE/> if the keycode is handled otherwise <FALSE/>
229 bool handleKeyEvent(const KeyEvent
& _rEvent
);
231 /** set the section as marked or not marked
232 @param _pSectionView the section where to set the marked flag
233 @param _bMark the marked flag
235 void setMarked(const css::uno::Reference
< css::report::XSection
>& _xSection
,bool _bMark
);
236 void setMarked(const css::uno::Sequence
< css::uno::Reference
< css::report::XReportComponent
> >& _xShape
,bool _bMark
);
238 /** returns if the view handles the event by itself
240 * \return <FALSE/> is the event is not handled by the view otherwise <TRUE/>
242 bool isHandleEvent() const;
244 sal_uInt32
getMarkedObjectCount() const;
246 /** zoom the ruler and view windows
248 void zoom(const Fraction
& _aZoom
);
250 /** fills the vector with all selected control models
251 /param _rSelection The vector will be filled and will not be cleared before.
253 void fillControlModelSelection(::std::vector
< css::uno::Reference
< css::uno::XInterface
> >& _rSelection
) const;
255 /** calculates the zoom factor.
256 @param _eType which kind of zoom is needed
258 sal_uInt16
getZoomFactor(SvxZoomType _eType
) const;
263 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DESIGNVIEW_HXX
265 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */