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_REPORTSECTION_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTSECTION_HXX
22 #include <vcl/window.hxx>
23 #include "RptPage.hxx"
24 #include <com/sun/star/beans/NamedValue.hpp>
25 #include <comphelper/propmultiplex.hxx>
26 #include <cppuhelper/basemutex.hxx>
27 #include "ReportDefines.hxx"
28 #include "dlgedfunc.hxx"
29 #include <svtools/transfer.hxx>
30 #include <rtl/ref.hxx>
31 #include <boost/shared_ptr.hpp>
41 class OReportSection
: public vcl::Window
42 , public ::cppu::BaseMutex
43 , public ::comphelper::OPropertyChangeListener
44 , public DropTargetHelper
47 OSectionView
* m_pView
;
48 VclPtr
<OSectionWindow
> m_pParent
;
49 ::std::unique_ptr
<DlgEdFunc
> m_pFunc
;
50 ::boost::shared_ptr
<OReportModel
> m_pModel
;
51 ::rtl::Reference
< comphelper::OPropertyChangeMultiplexer
> m_pMulti
;
52 ::rtl::Reference
< comphelper::OPropertyChangeMultiplexer
> m_pReportListener
;
53 ::com::sun::star::uno::Reference
< ::com::sun::star::report::XSection
> m_xSection
;
54 sal_Int32 m_nPaintEntranceCount
;
57 bool m_bDialogModelChanged
;
59 /** fills the section with all control from the report section
62 /** checks all objects if they fit in the new paper width.
64 void impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth
,sal_Int32 i_nLeftMargin
,sal_Int32 i_nRightMargin
);
66 OReportSection(OReportSection
&) SAL_DELETED_FUNCTION
;
67 void operator =(OReportSection
&) SAL_DELETED_FUNCTION
;
69 // DropTargetHelper overridables
70 virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& _rEvt
) SAL_OVERRIDE
;
71 virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& _rEvt
) SAL_OVERRIDE
;
74 virtual void Paint( vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
) SAL_OVERRIDE
;
75 virtual void MouseMove( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
76 virtual void Command( const CommandEvent
& rCEvt
) SAL_OVERRIDE
;
77 virtual void Resize() SAL_OVERRIDE
;
79 // OPropertyChangeListener
80 virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent
& _rEvent
) throw( ::com::sun::star::uno::RuntimeException
) SAL_OVERRIDE
;
82 OReportSection(OSectionWindow
* _pParent
,const ::com::sun::star::uno::Reference
< ::com::sun::star::report::XSection
>& _xSection
);
83 virtual ~OReportSection();
84 virtual void dispose() SAL_OVERRIDE
;
87 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
88 virtual void MouseButtonUp( const MouseEvent
& rMEvt
) SAL_OVERRIDE
;
90 /** copies the current selection in this section
91 @param _rAllreadyCopiedObjects This is an out/in put param which contains all already copied objects.
93 void Copy(::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& _rAllreadyCopiedObjects
);
95 void Copy(::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& _rAllreadyCopiedObjects
,bool _bEraseAnddNoClone
);
97 /** paste a new control in this section
98 @param _aAllreadyCopiedObjects objects to paste into the section. Only objects are pasted where the name is equal to the section name.
99 @param _bForce If set to <TRUE/> than the objects will be copied into this section. The name is not compared in this case.
101 void Paste(const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::NamedValue
>& _aAllreadyCopiedObjects
,bool _bForce
= false);
103 /** Deletes the current selection in this section
108 /** All objects will be marked.
110 void SelectAll(const sal_uInt16 _nObjectType
);
112 /** makes the grid visible
114 * \param _bVisible when <TRUE/> the grid is made visible
116 void SetGridVisible(bool _bVisible
);
118 inline OSectionWindow
* getSectionWindow() const { return m_pParent
; }
119 inline OSectionView
& getSectionView() const { return *m_pView
; }
120 inline OReportPage
* getPage() const { return m_pPage
; }
121 inline ::com::sun::star::uno::Reference
< ::com::sun::star::report::XSection
> getSection() const { return m_xSection
; }
123 void SetDialogModelChanged( bool bChanged
= true ) { m_bDialogModelChanged
= bChanged
; }
124 bool IsDialogModelChanged() const { return m_bDialogModelChanged
; }
125 DlgEdMode
GetMode() const { return m_eMode
; }
126 void SetMode( DlgEdMode m_eMode
);
128 /** checks if the keycode is known by the child windows
129 @param _rCode the keycode
130 @return <TRUE/> if the keycode is handled otherwise <FALSE/>
132 bool handleKeyEvent(const KeyEvent
& _rEvent
);
134 /** returns the current control report model or <NULL/>
136 ::com::sun::star::uno::Reference
< ::com::sun::star::report::XReportComponent
> getCurrentControlModel() const;
138 /** fills the vector with all selected control models
139 /param _rSelection The vector will be filled and will not be cleared before.
141 void fillControlModelSelection(::std::vector
< ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
> >& _rSelection
) const;
143 /** creates a default object (custom shape)
147 void createDefault(const OUString
& _sType
);
149 /** creates a new default custom shape
154 static void createDefault(const OUString
& _sType
,SdrObject
* _pObj
);
155 void stopScrollTimer();
157 /** deactivate the current active ole object if any
159 void deactivateOle();
161 /** returns true when an ole object is currently active
163 bool isUiActive() const;
168 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTSECTION_HXX
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */