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