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_UITOOLS_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_UITOOLS_HXX
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 <com/sun/star/uno/XComponentContext.hpp>
30 #include "ReportSection.hxx"
31 #include <rtl/ref.hxx>
32 #include <vcl/taskpanelist.hxx>
33 #include <comphelper/stl_types.hxx>
39 namespace tools
{ class Rectangle
; }
42 class OPropertyChangeMultiplexer
;
43 class OPropertyChangeListener
;
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
52 template<typename T
> sal_Int32
getPositionInIndexAccess(
53 const css::uno::Reference
< css::container::XIndexAccess
>& _xCollection
54 ,const css::uno::Reference
< T
>& _xSearch
)
56 sal_Int32 nCount
= _xCollection
->getCount();
57 sal_Int32 i
= (nCount
== 0) ? -1 : 0;
60 css::uno::Reference
< T
> xObject(_xCollection
->getByIndex(i
),css::uno::UNO_QUERY
);
61 if ( xObject
== _xSearch
)
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
70 void adjustSectionName(const css::uno::Reference
< css::report::XGroup
>& _xGroup
,sal_Int32 _nPos
);
72 /** add a listener for the properties size, left margin, right margin to the page style
74 * \param _xReportDefinition
78 ::rtl::Reference
< comphelper::OPropertyChangeMultiplexer
> addStyleListener( const css::uno::Reference
< css::report::XReportDefinition
>& _xReportDefinition
79 ,::comphelper::OPropertyChangeListener
* _pListener
);
81 /** opens the common character font dialog
84 const css::uno::Reference
< css::report::XReportControlFormat
>& _xReportControlFormat
,
85 const css::uno::Reference
< css::awt::XWindow
>& _xWindow
,
86 css::uno::Sequence
< css::beans::NamedValue
>& _out_rNewValues
89 /** opens the area dialog for shapes
92 const css::uno::Reference
< css::report::XShape
>& _xShape
93 ,const css::uno::Reference
< css::awt::XWindow
>& _xWindow
96 /** opens the formula dialog
98 the formula chosen by the user
100 we're really inspecting a database report (well, a RowSet at least)
102 <TRUE/> if and only if the user successfully chose a clause
104 bool openDialogFormula_nothrow( OUString
& _in_out_rFormula
105 , const css::uno::Reference
< css::uno::XComponentContext
>& _xContext
106 , const css::uno::Reference
< css::awt::XWindow
>& _xWindow
107 , const css::uno::Reference
< css::beans::XPropertySet
>& _xRowSet
110 /** applies the character settings previously obtained via openCharDialog
112 void applyCharacterSettings(
113 const css::uno::Reference
< css::report::XReportControlFormat
>& _rxReportControlFormat
,
114 const css::uno::Sequence
< css::beans::NamedValue
>& _rSettings
117 /** notifySystemWindow adds or remove the given window _pToRegister at the Systemwindow found when search _pWindow.
119 The window which is used to search for the SystemWindow.
121 The window which should be added or removed on the TaskPaneList.
123 The member function which should be called at the SystemWindow when found.
125 ::comphelper::mem_fun(&TaskPaneList::AddWindow)
126 ::comphelper::mem_fun(&TaskPaneList::RemoveWindow)
128 void notifySystemWindow(vcl::Window
const * pWindow
, vcl::Window
* pToRegister
, const ::comphelper::mem_fun1_t
<TaskPaneList
, vcl::Window
*>& rMemFunc
);
131 const sal_Int16 ISOVER_IGNORE_CUSTOMSHAPES
= 1;
133 /** checks whether the given rectangle overlapps another OUnoObject object in that view.
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/>
140 SdrObject
* isOver(const tools::Rectangle
& _rRect
,SdrPage
const & _rPage
,SdrView
const & _rView
,bool _bAllObjects
= false,SdrObject
const * _pIgnore
= nullptr, sal_Int16 _nIgnoreType
=0);
142 SdrObject
* isOver(const tools::Rectangle
& _rRect
,SdrPage
const & _rPage
,SdrView
const & _rView
,bool _bAllObjects
, std::unique_ptr
<SdrUnoObj
, SdrObjectFreeOp
> _pIgnoreList
[], int _nIgnoreListLength
);
144 /** checks whether the given OUnoObject object rectangle overlapps another object in that view.
149 * \return the object which is overlapped, otherwise <NULL/>. If the given object is not of type OUnoObject <NULL/> will be returned.
151 SdrObject
* isOver(SdrObject
const * _pObj
,SdrPage
const & _rPage
,SdrView
const & _rView
);
153 /** retrieves the names of the parameters of the command which the given RowSet is bound to
155 css::uno::Sequence
< OUString
>
156 getParameterNames( const css::uno::Reference
< css::sdbc::XRowSet
>& _rxRowSet
);
158 /** ensures that no control overlaps the given one.
160 * \param pControl the control which should place in the section without overlapping
161 * \param _pReportSection the section
162 * \param _bInsert sal_True when the control should be inserted, otherwise not.
164 void correctOverlapping(SdrObject
* pControl
,OReportSection
const & _aReportSection
,bool _bInsert
= true);
166 /** returns a Rectangle of a given SdrObject
168 * \param pControl the SdrObject
171 tools::Rectangle
getRectangleFromControl(SdrObject
* pControl
);
173 /** sets the map mode at the window
174 @param _aZoom the zoom scale
175 @param _rWindow where to set the map mode
177 void setZoomFactor(const Fraction
& _aZoom
, vcl::Window
& _rWindow
);
179 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_UITOOLS_HXX
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */