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/.
11 #ifndef INCLUDED_VCL_ITILEDRENDERABLE_HXX
12 #define INCLUDED_VCL_ITILEDRENDERABLE_HXX
14 #include <tools/gen.hxx>
15 #include <rtl/ustring.hxx>
16 #include <vcl/dllapi.h>
17 #include <vcl/ptrstyle.hxx>
18 #include <vcl/vclptr.hxx>
20 #include <com/sun/star/datatransfer/XTransferable.hpp>
22 namespace com::sun::star::beans
{ struct PropertyValue
; }
23 namespace com::sun::star::datatransfer
{ namespace clipboard
{ class XClipboard
; } }
24 namespace com::sun::star::uno
{ template <class interface_type
> class Reference
; }
25 namespace com::sun::star::uno
{ template <typename
> class Sequence
; }
26 namespace vcl
{ class Window
; }
27 namespace tools
{ class JsonWriter
; }
34 * Map directly to css cursor styles to avoid further mapping in the client.
35 * Gtk (via gdk_cursor_new_from_name) also supports the same css cursor styles.
37 * This was created partially with help of the mappings in gtkdata.cxx.
38 * The list is incomplete as some cursor style simply aren't supported
39 * by css, it might turn out to be worth mapping some of these missing cursors
40 * to available cursors?
42 extern const std::map
<PointerStyle
, OString
> gaLOKPointerMap
;
45 class VCL_DLLPUBLIC ITiledRenderable
49 typedef std::map
<const OUString
, OUString
> StringMap
;
51 virtual ~ITiledRenderable();
54 * Paint a tile to a given VirtualDevice.
56 * Output parameters are measured in pixels, tile parameters are in
59 virtual void paintTile( VirtualDevice
&rDevice
,
65 long nTileHeight
) = 0;
68 * Get the document size in twips.
70 virtual Size
getDocumentSize() = 0;
73 * Set the document "part", i.e. slide for a slideshow, and
74 * tab for a spreadsheet.
76 virtual void setPart( int ) {}
79 * Get the number of parts -- see setPart for further details.
81 virtual int getParts()
87 * Get the currently displayed/selected part -- see setPart for further
96 * Get the name of the currently displayed part, i.e. sheet in a spreadsheet
97 * or slide in a presentation.
99 virtual OUString
getPartName(int)
105 * Get the vcl::Window for the document being edited
107 virtual VclPtr
<vcl::Window
> getDocWindow() = 0;
110 * Get the hash of the currently displayed part, i.e. sheet in a spreadsheet
111 * or slide in a presentation.
113 virtual OUString
getPartHash(int nPart
) = 0;
115 /// @see lok::Document::setPartMode().
116 virtual void setPartMode(int) {}
119 * Setup various document properties that are needed for the document to
120 * be renderable via tiled rendering.
122 virtual void initializeForTiledRendering(const css::uno::Sequence
<css::beans::PropertyValue
>& rArguments
) = 0;
125 * Posts a keyboard event on the document.
127 * @see lok::Document::postKeyEvent().
129 virtual void postKeyEvent(int nType
, int nCharCode
, int nKeyCode
) = 0;
132 * Posts a mouse event on the document.
134 * @see lok::Document::postMouseEvent().
136 virtual void postMouseEvent(int nType
, int nX
, int nY
, int nCount
, int nButtons
, int nModifier
) = 0;
139 * Sets the start or end of a text selection.
141 * @see lok::Document::setTextSelection().
143 virtual void setTextSelection(int nType
, int nX
, int nY
) = 0;
146 * Gets the selection as a transferable for later processing
148 virtual css::uno::Reference
<css::datatransfer::XTransferable
> getSelection() = 0;
151 * Adjusts the graphic selection.
153 * @see lok::Document::setGraphicSelection().
155 virtual void setGraphicSelection(int nType
, int nX
, int nY
) = 0;
158 * @see lok::Document::resetSelection().
160 virtual void resetSelection() = 0;
163 * @see lok::Document::getPartPageRectangles().
165 virtual OUString
getPartPageRectangles()
171 * Get position and content of row/column headers of Calc documents.
173 * @param rRectangle - if not empty, then limit the output only to the area of this rectangle
174 * @return a JSON describing position/content of rows/columns
176 virtual OUString
getRowColumnHeaders(const tools::Rectangle
& /*rRectangle*/)
182 * Generates a serialization of the active (Calc document) sheet's geometry data.
184 * @param bColumns - if true, the column widths/hidden/filtered/groups data
185 * are included depending on the settings of the flags bSizes, bHidden,
186 * bFiltered and bGroups.
187 * @param bRows - if true, the row heights/hidden/filtered/groups data
188 * are included depending on the settings of the flags bSizes, bHidden,
189 * bFiltered and bGroups.
190 * @bSizes - if true, the column-widths and/or row-heights data (represented as a list of spans)
191 * are included depending on the settings of the flags bColumns and bRows.
192 * @bHidden - if true, the hidden columns and/or rows data (represented as a list of spans)
193 * are included depending on the settings of the flags bColumns and bRows.
194 * @bFiltered - if true, the filtered columns and/or rows data (represented as a list of spans)
195 * are included depending on the settings of the flags bColumns and bRows.
196 * @bGroups - if true, the column grouping and/or row grouping data
197 * are included depending on the settings of the flags bColumns and bRows.
198 * @return serialization of the active sheet's geometry data as OString.
200 virtual OString
getSheetGeometryData(bool /*bColumns*/, bool /*bRows*/, bool /*bSizes*/,
201 bool /*bHidden*/, bool /*bFiltered*/, bool /*bGroups*/)
207 * Get position and size of cell cursor in Calc - as JSON in the
208 * current' views' co-ordinate system.
209 * (This could maybe also be used for tables in Writer/Impress in future?)
211 virtual OString
getCellCursor()
216 virtual PointerStyle
getPointer() = 0;
218 /// Sets the clipboard of the component.
219 virtual void setClipboard(const css::uno::Reference
<css::datatransfer::clipboard::XClipboard
>& xClipboard
) = 0;
221 /// If the current contents of the clipboard is something we can paste.
222 virtual bool isMimeTypeSupported() = 0;
225 * Save the client's view so that we can compute the right zoom level
226 * for the mouse events.
227 * @param nTilePixelWidth - tile width in pixels
228 * @param nTilePixelHeight - tile height in pixels
229 * @param nTileTwipWidth - tile width in twips
230 * @param nTileTwipHeight - tile height in twips
232 virtual void setClientZoom(int /*nTilePixelWidth*/,
233 int /*nTilePixelHeight*/,
234 int /*nTileTwipWidth*/,
235 int /*nTileTwipHeight*/)
238 /// @see lok::Document::setClientVisibleArea().
239 virtual void setClientVisibleArea(const tools::Rectangle
& /*rRectangle*/)
244 * Show/Hide a single row/column header outline for Calc documents.
246 * @param bColumn - if we are dealing with a column or row group
247 * @param nLevel - the level to which the group belongs
248 * @param nIndex - the group entry index
249 * @param bHidden - the new group state (collapsed/expanded)
251 virtual void setOutlineState(bool /*bColumn*/, int /*nLevel*/, int /*nIndex*/, bool /*bHidden*/)
256 /// Implementation for
257 /// lok::Document::getCommandValues(".uno:AcceptTrackedChanges") when there
258 /// is no matching UNO API.
259 virtual void getTrackedChanges(tools::JsonWriter
&)
263 /// Implementation for
264 /// lok::Document::getCommandValues(".uno:TrackedChangeAuthors").
265 virtual OUString
getTrackedChangeAuthors()
270 /// Implementation for
271 /// lok::Document::getCommandValues(".uno:ViewAnnotations");
272 virtual OUString
getPostIts()
277 /// Implementation for
278 /// lok::Document::getCommandValues(".uno:ViewAnnotationsPosition");
279 virtual OUString
getPostItsPos()
284 /// Implementation for
285 /// lok::Document::getCommandValues(".uno:RulerState");
286 virtual OUString
getRulerState()
292 * Used for sheets in spreadsheet documents,
293 * and slides in presentation documents.
295 virtual OUString
getPartInfo(int /*nPart*/)
301 * Select/Unselect a document "part", i.e. slide for a slideshow, and
302 * tab for a spreadsheet(?).
303 * nSelect: 0 to deselect, 1 to select, and 2 to toggle.
305 virtual void selectPart(int /*nPart*/, int /*nSelect*/) {}
308 * Move selected pages/slides to a new position.
309 * nPosition: the new position to move to.
310 * bDuplicate: to copy (true), or to move (false).
312 virtual void moveSelectedParts(int /*nPosition*/, bool /*bDuplicate*/) {}
314 /// @see lok::Document::completeFunction().
315 virtual void completeFunction(const OUString
& /*rFunctionName*/)
320 * Execute a form field event in the document.
321 * E.g. select an item from a drop down field's list.
323 virtual void executeFromFieldEvent(const StringMap
&)
328 * It can happen that the underlying implementation is being disposed, but
329 * somebedy is trying to access the data...
331 virtual bool isDisposed() const
338 #endif // INCLUDED_VCL_ITILEDRENDERABLE_HXX
340 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */