Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef RPTUI_UITOOLS_HXX
29 : : #define RPTUI_UITOOLS_HXX
30 : :
31 : : #include <com/sun/star/report/XGroup.hpp>
32 : : #include <com/sun/star/report/XReportControlFormat.hpp>
33 : : #include <com/sun/star/report/XShape.hpp>
34 : : #include <com/sun/star/awt/XWindow.hpp>
35 : : #include <com/sun/star/beans/NamedValue.hpp>
36 : : #include <com/sun/star/container/XIndexAccess.hpp>
37 : : #include <com/sun/star/sdbc/XRowSet.hpp>
38 : : #include "ReportSection.hxx"
39 : : #include <rtl/ref.hxx>
40 : : #include <vcl/taskpanelist.hxx>
41 : : #include <comphelper/stl_types.hxx>
42 : : #include <functional>
43 : :
44 : : class SdrPage;
45 : : class SdrObject;
46 : : class SdrUnoObj;
47 : : class SdrView;
48 : : class Rectangle;
49 : : namespace comphelper
50 : : {
51 : : class OPropertyChangeMultiplexer;
52 : : class OPropertyChangeListener;
53 : : }
54 : : namespace rptui
55 : : {
56 : : /** returns the position of the object inside the index container
57 : : @param _xReportDefinition the report definition to get the groups
58 : : @param _xGroup the group to search
59 : : @return returns the position of the group in the list, otherwise -1
60 : : */
61 : 0 : template<typename T> sal_Int32 getPositionInIndexAccess(
62 : : const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _xCollection
63 : : ,const ::com::sun::star::uno::Reference< T >& _xSearch)
64 : : {
65 : 0 : sal_Int32 nCount = _xCollection->getCount();
66 : 0 : sal_Int32 i = (nCount == 0) ? -1 : 0;
67 : 0 : for (;i<nCount ; ++i)
68 : : {
69 : 0 : ::com::sun::star::uno::Reference< T > xObject(_xCollection->getByIndex(i),::com::sun::star::uno::UNO_QUERY);
70 : 0 : if ( xObject == _xSearch )
71 : 0 : break;
72 : : }
73 : 0 : return i;
74 : : }
75 : :
76 : : /** set the name of the header and footer of the group by the expression appended by the localized name of the section
77 : : @param _xGroup the group where the header/footer name is set by the expression of the group
78 : : */
79 : : void adjustSectionName(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xGroup,sal_Int32 _nPos);
80 : :
81 : : /** add a listener for the properties size, left margin, right margin to the page style
82 : : *
83 : : * \param _xReportDefinition
84 : : * \param _pListener
85 : : * \return
86 : : */
87 : : ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> addStyleListener( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xReportDefinition
88 : : ,::comphelper::OPropertyChangeListener* _pListener);
89 : :
90 : : /** opens the common character font dialog
91 : : */
92 : : bool openCharDialog(
93 : : const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlFormat>& _xReportControlFormat,
94 : : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _xWindow,
95 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _out_rNewValues
96 : : );
97 : :
98 : : /** opens the area dialog for shapes
99 : : */
100 : : bool openAreaDialog(
101 : : const ::com::sun::star::uno::Reference< ::com::sun::star::report::XShape >& _xShape
102 : : ,const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _xWindow
103 : : );
104 : :
105 : : /** opens the formula dialog
106 : : @param _out_rFormula
107 : : the formula chosen by the user
108 : : @precond
109 : : we're really inspecting a database report (well, a RowSet at least)
110 : : @return
111 : : <TRUE/> if and only if the user successfully chose a clause
112 : : */
113 : : bool openDialogFormula_nothrow( ::rtl::OUString& _in_out_rFormula
114 : : , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext
115 : : , const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _xWindow
116 : : , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet
117 : : );
118 : :
119 : : /** applies the character settings previously obtained via openCharDialog
120 : : */
121 : : void applyCharacterSettings(
122 : : const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlFormat >& _rxReportControlFormat,
123 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rSettings
124 : : );
125 : :
126 : : /** notifySystemWindow adds or remove the given window _pToRegister at the Systemwindow found when search _pWindow.
127 : : @param _pWindow
128 : : The window which is used to search for the SystemWindow.
129 : : @param _pToRegister
130 : : The window which should be added or removed on the TaskPaneList.
131 : : @param _rMemFunc
132 : : The member function which should be called at the SystemWindow when found.
133 : : Possible values are:
134 : : ::comphelper::mem_fun(&TaskPaneList::AddWindow)
135 : : ::comphelper::mem_fun(&TaskPaneList::RemoveWindow)
136 : : */
137 : : void notifySystemWindow(Window* _pWindow,Window* _pToRegister, ::comphelper::mem_fun1_t<TaskPaneList,Window*> _rMemFunc);
138 : :
139 : :
140 : : const sal_Int16 ISOVER_IGNORE_CUSTOMSHAPES = 1;
141 : :
142 : : /** checks whether the given rectangle overlapps another OUnoObject object in that view.
143 : : *
144 : : * \param _rRect
145 : : * \param _rPage
146 : : * \param _bAllObjects if <TRUE/> all objects are taken into account, otherwise only not marked ones
147 : : * \return the object which is overlapped, otherwise <NULL/>
148 : : */
149 : : SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects = false,SdrObject* _pIgnore = NULL, sal_Int16 _nIgnoreType=0);
150 : :
151 : : SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects, SdrUnoObj* _pIgnoreList[], int _nIgnoreListLength);
152 : :
153 : : /** checks whether the given OUnoObject object rectangle overlapps another object in that view.
154 : : *
155 : : * \param _pObj
156 : : * \param _rPage
157 : : * \param _rView
158 : : * \param _bAllObjects if <TRUE/> all objects are taken into account, otherwise only not marked ones
159 : : * \return the object which is overlapped, otherwise <NULL/>. If the given object is not of type OUnoObject <NULL/> will be returned.
160 : : */
161 : : SdrObject* isOver(SdrObject* _pObj,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects = false);
162 : :
163 : : /** retrieves the names of the parameters of the command which the given RowSet is bound to
164 : : */
165 : : ::com::sun::star::uno::Sequence< ::rtl::OUString >
166 : : getParameterNames( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet );
167 : :
168 : : /** ensures that no control overlaps the given one.
169 : : *
170 : : * \param pControl the control which should place in the section without overlapping
171 : : * \param _pReportSection the section
172 : : * \param _bInsert sal_True whe the control should be inserted, otherwise not.
173 : : */
174 : : void correctOverlapping(SdrObject* pControl,OReportSection& _aReportSection,bool _bInsert = true);
175 : :
176 : : /** returns a Rectangle of a given SdrObject
177 : : *
178 : : * \param pControl the SdrObject
179 : : */
180 : :
181 : : Rectangle getRectangleFromControl(SdrObject* pControl);
182 : :
183 : : /** sets the map mode at the window
184 : : @param _aZoom the zoom scale
185 : : @param _rWindow where to set the map mode
186 : : */
187 : : void setZoomFactor(const Fraction& _aZoom,Window& _rWindow);
188 : : }
189 : : #endif //RPTUI_UITOOLS_HXX
190 : :
191 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|