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 REPORT_REPORTSECTION_HXX
20 #define REPORT_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 Window
42 , public ::cppu::BaseMutex
43 , public ::comphelper::OPropertyChangeListener
44 , public DropTargetHelper
47 OSectionView
* m_pView
;
48 OSectionWindow
* m_pParent
;
49 ::std::auto_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 sal_Bool m_bDialogModelChanged
;
60 /** fills the section with all control from the report section
63 /** checks all objects if they fit in the new paper width.
65 void impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth
,sal_Int32 i_nLeftMargin
,sal_Int32 i_nRightMargin
);
67 OReportSection(OReportSection
&);
68 void operator =(OReportSection
&);
70 // DropTargetHelper overridables
71 virtual sal_Int8
AcceptDrop( const AcceptDropEvent
& _rEvt
);
72 virtual sal_Int8
ExecuteDrop( const ExecuteDropEvent
& _rEvt
);
75 virtual void Paint( const Rectangle
& rRect
);
76 virtual void MouseMove( const MouseEvent
& rMEvt
);
77 virtual void Command( const CommandEvent
& rCEvt
);
78 virtual void Resize();
80 // OPropertyChangeListener
81 virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent
& _rEvent
) throw( ::com::sun::star::uno::RuntimeException
);
83 OReportSection(OSectionWindow
* _pParent
,const ::com::sun::star::uno::Reference
< ::com::sun::star::report::XSection
>& _xSection
);
84 virtual ~OReportSection();
87 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
88 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
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(sal_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( sal_Bool bChanged
= sal_True
) { m_bDialogModelChanged
= bChanged
; }
124 sal_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 sal_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 void createDefault(const OUString
& _sType
,SdrObject
* _pObj
);
155 void stopScrollTimer();
157 /** deactivate the currect active ole object if any
159 void deactivateOle();
161 /** returns true when an ole object is currently active
163 bool isUiActive() const;
165 //==================================================================
167 //==================================================================
168 #endif // REPORT_REPORTSECTION_HXX
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */