Fix typo
[LibreOffice.git] / include / vcl / ITiledRenderable.hxx
blob41d1143bf0197353f7eb5b53961723b5ca419ec2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 */
11 #pragma once
13 #include <sfx2/viewsh.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>
19 #include <map>
20 #include <com/sun/star/datatransfer/XTransferable.hpp>
21 #include <basegfx/range/b2drange.hxx>
23 namespace com::sun::star::beans { struct PropertyValue; }
24 namespace com::sun::star::datatransfer::clipboard { class XClipboard; }
25 namespace com::sun::star::uno { template <class interface_type> class Reference; }
26 namespace com::sun::star::uno { template <typename > class Sequence; }
27 namespace vcl { class Window; }
28 namespace tools { class JsonWriter; }
30 class VirtualDevice;
32 namespace vcl
35 * Map directly to css cursor styles to avoid further mapping in the client.
36 * Gtk (via gdk_cursor_new_from_name) also supports the same css cursor styles.
38 * This was created partially with help of the mappings in gtkdata.cxx.
39 * The list is incomplete as some cursor style simply aren't supported
40 * by css, it might turn out to be worth mapping some of these missing cursors
41 * to available cursors?
43 extern const std::map <PointerStyle, OString> gaLOKPointerMap;
46 class VCL_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") ITiledRenderable
48 public:
50 typedef std::map<OUString, OUString> StringMap;
52 virtual ~ITiledRenderable();
54 /**
55 * Paint a tile to a given VirtualDevice.
57 * Output parameters are measured in pixels, tile parameters are in
58 * twips.
60 virtual void paintTile( VirtualDevice &rDevice,
61 int nOutputWidth,
62 int nOutputHeight,
63 int nTilePosX,
64 int nTilePosY,
65 tools::Long nTileWidth,
66 tools::Long nTileHeight ) = 0;
68 /**
69 * Get the document size in twips.
71 virtual Size getDocumentSize() = 0;
73 /**
74 * Get the data area size (in Calc last column and row).
76 virtual Size getDataArea(long /*nPart*/)
78 return Size(1, 1);
81 /**
82 * Set the document "part", i.e. slide for a slideshow, and
83 * tab for a spreadsheet.
84 * bool bAllowChangeFocus - used to not disturb other users while editing when
85 * setPart is used for tile rendering only
87 virtual void setPart( int /*nPart*/, bool /*bAllowChangeFocus*/ = true ) {}
89 /**
90 * Get the number of parts -- see setPart for further details.
92 virtual int getParts()
94 return 1;
97 /**
98 * Get the currently displayed/selected part -- see setPart for further
99 * details.
101 virtual int getPart()
103 return 0;
107 * Get the name of the currently displayed part, i.e. sheet in a spreadsheet
108 * or slide in a presentation.
110 virtual OUString getPartName(int)
112 return OUString();
116 * Get the vcl::Window for the document being edited
118 virtual VclPtr<vcl::Window> getDocWindow() = 0;
121 * Get the hash of the currently displayed part, i.e. sheet in a spreadsheet
122 * or slide in a presentation.
124 virtual OUString getPartHash(int nPart) = 0;
126 /// @see lok::Document::setPartMode().
127 virtual void setPartMode(int) {}
130 * Get the currently used EditMode (supported in Impress).
132 virtual int getEditMode()
134 return 0;
138 * Set the currently used EditMode (supported in Impress).
140 virtual void setEditMode(int) {}
143 * Setup various document properties that are needed for the document to
144 * be renderable via tiled rendering.
146 virtual void initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) = 0;
149 * Posts a keyboard event on the document.
151 * @see lok::Document::postKeyEvent().
153 virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) = 0;
156 * Posts a mouse event on the document.
158 * @see lok::Document::postMouseEvent().
160 virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) = 0;
163 * Sets the start or end of a text selection.
165 * @see lok::Document::setTextSelection().
167 virtual void setTextSelection(int nType, int nX, int nY) = 0;
170 * Gets the info of hyperlink under the mouse position if any.
171 * @see lok::Document::hyperlinkInfoAtPosition().
173 virtual OUString hyperlinkInfoAtPosition(int x, int y) = 0;
176 * Gets the selection as a transferable for later processing
178 virtual css::uno::Reference<css::datatransfer::XTransferable> getSelection() = 0;
181 * Adjusts the graphic selection.
183 * @see lok::Document::setGraphicSelection().
185 virtual void setGraphicSelection(int nType, int nX, int nY) = 0;
188 * @see lok::Document::resetSelection().
190 virtual void resetSelection() = 0;
193 * @see lok::Document::getPartPageRectangles().
195 virtual OUString getPartPageRectangles()
197 return OUString();
201 * Get position and content of row/column headers of Calc documents.
203 * @param rRectangle - if not empty, then limit the output only to the area of this rectangle
204 * @return a JSON describing position/content of rows/columns
206 virtual void getRowColumnHeaders(const tools::Rectangle& /*rRectangle*/, tools::JsonWriter& /*rJsonWriter*/)
211 * Generates a serialization of the active (Calc document) sheet's geometry data.
213 * @param bColumns - if true, the column widths/hidden/filtered/groups data
214 * are included depending on the settings of the flags bSizes, bHidden,
215 * bFiltered and bGroups.
216 * @param bRows - if true, the row heights/hidden/filtered/groups data
217 * are included depending on the settings of the flags bSizes, bHidden,
218 * bFiltered and bGroups.
219 * @bSizes - if true, the column-widths and/or row-heights data (represented as a list of spans)
220 * are included depending on the settings of the flags bColumns and bRows.
221 * @bHidden - if true, the hidden columns and/or rows data (represented as a list of spans)
222 * are included depending on the settings of the flags bColumns and bRows.
223 * @bFiltered - if true, the filtered columns and/or rows data (represented as a list of spans)
224 * are included depending on the settings of the flags bColumns and bRows.
225 * @bGroups - if true, the column grouping and/or row grouping data
226 * are included depending on the settings of the flags bColumns and bRows.
227 * @return serialization of the active sheet's geometry data as OString.
229 virtual OString getSheetGeometryData(bool /*bColumns*/, bool /*bRows*/, bool /*bSizes*/,
230 bool /*bHidden*/, bool /*bFiltered*/, bool /*bGroups*/)
232 return ""_ostr;
236 * Get position and size of cell cursor in Calc - as JSON in the
237 * current' views' co-ordinate system.
238 * (This could maybe also be used for tables in Writer/Impress in future?)
240 virtual void getCellCursor(tools::JsonWriter& /*rJsonWriter*/)
244 virtual PointerStyle getPointer() = 0;
246 /// Sets the clipboard of the component.
247 virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) = 0;
249 /// If the current contents of the clipboard is something we can paste.
250 virtual bool isMimeTypeSupported() = 0;
253 * Save the client's view so that we can compute the right zoom level
254 * for the mouse events.
255 * @param nTilePixelWidth - tile width in pixels
256 * @param nTilePixelHeight - tile height in pixels
257 * @param nTileTwipWidth - tile width in twips
258 * @param nTileTwipHeight - tile height in twips
260 virtual void setClientZoom(int /*nTilePixelWidth*/,
261 int /*nTilePixelHeight*/,
262 int /*nTileTwipWidth*/,
263 int /*nTileTwipHeight*/)
266 /// @see lok::Document::setClientVisibleArea().
267 virtual void setClientVisibleArea(const tools::Rectangle& /*rRectangle*/)
272 * Show/Hide a single row/column header outline for Calc documents.
274 * @param bColumn - if we are dealing with a column or row group
275 * @param nLevel - the level to which the group belongs
276 * @param nIndex - the group entry index
277 * @param bHidden - the new group state (collapsed/expanded)
279 virtual void setOutlineState(bool /*bColumn*/, int /*nLevel*/, int /*nIndex*/, bool /*bHidden*/)
281 return;
284 /// Implementation for
285 /// lok::Document::getCommandValues(".uno:AcceptTrackedChanges") when there
286 /// is no matching UNO API.
287 virtual void getTrackedChanges(tools::JsonWriter&)
291 /// Implementation for
292 /// lok::Document::getCommandValues(".uno:TrackedChangeAuthors").
293 virtual void getTrackedChangeAuthors(tools::JsonWriter& /*rJsonWriter*/)
297 /// Implementation for
298 /// lok::Document::getCommandValues(".uno:ViewAnnotations");
299 virtual void getPostIts(tools::JsonWriter& /*rJsonWriter*/)
303 /// Implementation for
304 /// lok::Document::getCommandValues(".uno:ViewAnnotationsPosition");
305 virtual void getPostItsPos(tools::JsonWriter& /*rJsonWriter*/)
309 /// Implementation for
310 /// lok::Document::getCommandValues(".uno:RulerState");
311 virtual void getRulerState(tools::JsonWriter& /*rJsonWriter*/)
316 * Used for sheets in spreadsheet documents,
317 * and slides in presentation documents.
319 virtual OUString getPartInfo(int /*nPart*/)
321 return OUString();
325 * Select/Unselect a document "part", i.e. slide for a slideshow, and
326 * tab for a spreadsheet(?).
327 * nSelect: 0 to deselect, 1 to select, and 2 to toggle.
329 virtual void selectPart(int /*nPart*/, int /*nSelect*/) {}
332 * Move selected pages/slides to a new position.
333 * nPosition: the new position to move to.
334 * bDuplicate: to copy (true), or to move (false).
336 virtual void moveSelectedParts(int /*nPosition*/, bool /*bDuplicate*/) {}
338 /// @see lok::Document::completeFunction().
339 virtual void completeFunction(const OUString& /*rFunctionName*/)
344 * It can happen that the underlying implementation is being disposed, but
345 * somebody is trying to access the data...
347 virtual bool isDisposed() const
349 return false;
353 * Execute a form field event in the document.
354 * E.g. select an item from a drop down field's list.
356 virtual void executeFromFieldEvent(const StringMap&)
361 * Returns the rectangles of the input search result JSON
363 virtual std::vector<basegfx::B2DRange> getSearchResultRectangles(const char* /*pPayload*/)
365 return std::vector<basegfx::B2DRange>();
369 * Execute a content control event in the document.
370 * E.g. select a list item from a drop down content control.
372 virtual void executeContentControlEvent(const StringMap&) {}
375 * Allow / disable drawing current text edit (used in Impress for slide previews)
377 virtual void setPaintTextEdit(bool) {}
379 /// Decides if it's OK to call getCommandValues(rCommand).
380 virtual bool supportsCommand(std::u16string_view /*rCommand*/) { return false; }
382 /// Returns a json mapping of the possible values for the given command.
383 virtual void getCommandValues(tools::JsonWriter& /*rJsonWriter*/, std::string_view /*rCommand*/)
388 * Returns an opaque string reflecting the render state of a component
389 * eg. 'PD' - P for non-printing-characters, D for dark-mode.
390 * @param pViewShell the view to get the options from, if nullptr the current view shell is used
392 virtual OString getViewRenderState(SfxViewShell* = nullptr) { return rtl::OString(); }
394 } // namespace vcl
396 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */