Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / vcl / ITiledRenderable.hxx
blob9fa61258fc7a19b989a70ece035595c68f596eba
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 <tools/gen.hxx>
14 #include <rtl/ustring.hxx>
15 #include <vcl/dllapi.h>
16 #include <vcl/ptrstyle.hxx>
17 #include <vcl/vclptr.hxx>
18 #include <map>
19 #include <com/sun/star/datatransfer/XTransferable.hpp>
20 #include <basegfx/range/b2drange.hxx>
22 namespace com::sun::star::beans { struct PropertyValue; }
23 namespace com::sun::star::datatransfer::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; }
29 class VirtualDevice;
31 namespace vcl
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 SAL_LOPLUGIN_ANNOTATE("crosscast") ITiledRenderable
47 public:
49 typedef std::map<OUString, OUString> StringMap;
51 virtual ~ITiledRenderable();
53 /**
54 * Paint a tile to a given VirtualDevice.
56 * Output parameters are measured in pixels, tile parameters are in
57 * twips.
59 virtual void paintTile( VirtualDevice &rDevice,
60 int nOutputWidth,
61 int nOutputHeight,
62 int nTilePosX,
63 int nTilePosY,
64 tools::Long nTileWidth,
65 tools::Long nTileHeight ) = 0;
67 /**
68 * Get the document size in twips.
70 virtual Size getDocumentSize() = 0;
72 /**
73 * Get the data area size (in Calc last column and row).
75 virtual Size getDataArea(long /*nPart*/)
77 return Size(1, 1);
80 /**
81 * Set the document "part", i.e. slide for a slideshow, and
82 * tab for a spreadsheet.
83 * bool bAllowChangeFocus - used to not disturb other users while editing when
84 * setPart is used for tile rendering only
86 virtual void setPart( int /*nPart*/, bool /*bAllowChangeFocus*/ = true ) {}
88 /**
89 * Get the number of parts -- see setPart for further details.
91 virtual int getParts()
93 return 1;
96 /**
97 * Get the currently displayed/selected part -- see setPart for further
98 * details.
100 virtual int getPart()
102 return 0;
106 * Get the name of the currently displayed part, i.e. sheet in a spreadsheet
107 * or slide in a presentation.
109 virtual OUString getPartName(int)
111 return OUString();
115 * Get the vcl::Window for the document being edited
117 virtual VclPtr<vcl::Window> getDocWindow() = 0;
120 * Get the hash of the currently displayed part, i.e. sheet in a spreadsheet
121 * or slide in a presentation.
123 virtual OUString getPartHash(int nPart) = 0;
125 /// @see lok::Document::setPartMode().
126 virtual void setPartMode(int) {}
129 * Get the currently used EditMode (supported in Impress).
131 virtual int getEditMode()
133 return 0;
137 * Set the currently used EditMode (supported in Impress).
139 virtual void setEditMode(int) {}
142 * Setup various document properties that are needed for the document to
143 * be renderable via tiled rendering.
145 virtual void initializeForTiledRendering(const css::uno::Sequence<css::beans::PropertyValue>& rArguments) = 0;
148 * Posts a keyboard event on the document.
150 * @see lok::Document::postKeyEvent().
152 virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) = 0;
155 * Posts a mouse event on the document.
157 * @see lok::Document::postMouseEvent().
159 virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) = 0;
162 * Sets the start or end of a text selection.
164 * @see lok::Document::setTextSelection().
166 virtual void setTextSelection(int nType, int nX, int nY) = 0;
169 * Gets the selection as a transferable for later processing
171 virtual css::uno::Reference<css::datatransfer::XTransferable> getSelection() = 0;
174 * Adjusts the graphic selection.
176 * @see lok::Document::setGraphicSelection().
178 virtual void setGraphicSelection(int nType, int nX, int nY) = 0;
181 * @see lok::Document::resetSelection().
183 virtual void resetSelection() = 0;
186 * @see lok::Document::getPartPageRectangles().
188 virtual OUString getPartPageRectangles()
190 return OUString();
194 * Get position and content of row/column headers of Calc documents.
196 * @param rRectangle - if not empty, then limit the output only to the area of this rectangle
197 * @return a JSON describing position/content of rows/columns
199 virtual void getRowColumnHeaders(const tools::Rectangle& /*rRectangle*/, tools::JsonWriter& /*rJsonWriter*/)
204 * Generates a serialization of the active (Calc document) sheet's geometry data.
206 * @param bColumns - if true, the column widths/hidden/filtered/groups data
207 * are included depending on the settings of the flags bSizes, bHidden,
208 * bFiltered and bGroups.
209 * @param bRows - if true, the row heights/hidden/filtered/groups data
210 * are included depending on the settings of the flags bSizes, bHidden,
211 * bFiltered and bGroups.
212 * @bSizes - if true, the column-widths and/or row-heights data (represented as a list of spans)
213 * are included depending on the settings of the flags bColumns and bRows.
214 * @bHidden - if true, the hidden columns and/or rows data (represented as a list of spans)
215 * are included depending on the settings of the flags bColumns and bRows.
216 * @bFiltered - if true, the filtered columns and/or rows data (represented as a list of spans)
217 * are included depending on the settings of the flags bColumns and bRows.
218 * @bGroups - if true, the column grouping and/or row grouping data
219 * are included depending on the settings of the flags bColumns and bRows.
220 * @return serialization of the active sheet's geometry data as OString.
222 virtual OString getSheetGeometryData(bool /*bColumns*/, bool /*bRows*/, bool /*bSizes*/,
223 bool /*bHidden*/, bool /*bFiltered*/, bool /*bGroups*/)
225 return "";
229 * Get position and size of cell cursor in Calc - as JSON in the
230 * current' views' co-ordinate system.
231 * (This could maybe also be used for tables in Writer/Impress in future?)
233 virtual void getCellCursor(tools::JsonWriter& /*rJsonWriter*/)
237 virtual PointerStyle getPointer() = 0;
239 /// Sets the clipboard of the component.
240 virtual void setClipboard(const css::uno::Reference<css::datatransfer::clipboard::XClipboard>& xClipboard) = 0;
242 /// If the current contents of the clipboard is something we can paste.
243 virtual bool isMimeTypeSupported() = 0;
246 * Save the client's view so that we can compute the right zoom level
247 * for the mouse events.
248 * @param nTilePixelWidth - tile width in pixels
249 * @param nTilePixelHeight - tile height in pixels
250 * @param nTileTwipWidth - tile width in twips
251 * @param nTileTwipHeight - tile height in twips
253 virtual void setClientZoom(int /*nTilePixelWidth*/,
254 int /*nTilePixelHeight*/,
255 int /*nTileTwipWidth*/,
256 int /*nTileTwipHeight*/)
259 /// @see lok::Document::setClientVisibleArea().
260 virtual void setClientVisibleArea(const tools::Rectangle& /*rRectangle*/)
265 * Show/Hide a single row/column header outline for Calc documents.
267 * @param bColumn - if we are dealing with a column or row group
268 * @param nLevel - the level to which the group belongs
269 * @param nIndex - the group entry index
270 * @param bHidden - the new group state (collapsed/expanded)
272 virtual void setOutlineState(bool /*bColumn*/, int /*nLevel*/, int /*nIndex*/, bool /*bHidden*/)
274 return;
277 /// Implementation for
278 /// lok::Document::getCommandValues(".uno:AcceptTrackedChanges") when there
279 /// is no matching UNO API.
280 virtual void getTrackedChanges(tools::JsonWriter&)
284 /// Implementation for
285 /// lok::Document::getCommandValues(".uno:TrackedChangeAuthors").
286 virtual void getTrackedChangeAuthors(tools::JsonWriter& /*rJsonWriter*/)
290 /// Implementation for
291 /// lok::Document::getCommandValues(".uno:ViewAnnotations");
292 virtual void getPostIts(tools::JsonWriter& /*rJsonWriter*/)
296 /// Implementation for
297 /// lok::Document::getCommandValues(".uno:ViewAnnotationsPosition");
298 virtual void getPostItsPos(tools::JsonWriter& /*rJsonWriter*/)
302 /// Implementation for
303 /// lok::Document::getCommandValues(".uno:RulerState");
304 virtual void getRulerState(tools::JsonWriter& /*rJsonWriter*/)
309 * Used for sheets in spreadsheet documents,
310 * and slides in presentation documents.
312 virtual OUString getPartInfo(int /*nPart*/)
314 return OUString();
318 * Select/Unselect a document "part", i.e. slide for a slideshow, and
319 * tab for a spreadsheet(?).
320 * nSelect: 0 to deselect, 1 to select, and 2 to toggle.
322 virtual void selectPart(int /*nPart*/, int /*nSelect*/) {}
325 * Move selected pages/slides to a new position.
326 * nPosition: the new position to move to.
327 * bDuplicate: to copy (true), or to move (false).
329 virtual void moveSelectedParts(int /*nPosition*/, bool /*bDuplicate*/) {}
331 /// @see lok::Document::completeFunction().
332 virtual void completeFunction(const OUString& /*rFunctionName*/)
337 * It can happen that the underlying implementation is being disposed, but
338 * somebody is trying to access the data...
340 virtual bool isDisposed() const
342 return false;
346 * Execute a form field event in the document.
347 * E.g. select an item from a drop down field's list.
349 virtual void executeFromFieldEvent(const StringMap&)
354 * Returns the rectangles of the input search result JSON
356 virtual std::vector<basegfx::B2DRange> getSearchResultRectangles(const char* /*pPayload*/)
358 return std::vector<basegfx::B2DRange>();
362 * Execute a content control event in the document.
363 * E.g. select a list item from a drop down content control.
365 virtual void executeContentControlEvent(const StringMap&) {}
368 * Allow / disable drawing current text edit (used in Impress for slide previews)
370 virtual void setPaintTextEdit(bool) {}
372 /// Decides if it's OK to call getCommandValues(rCommand).
373 virtual bool supportsCommand(std::u16string_view /*rCommand*/) { return false; }
375 /// Returns a json mapping of the possible values for the given command.
376 virtual void getCommandValues(tools::JsonWriter& /*rJsonWriter*/, std::string_view /*rCommand*/)
381 * Returns an opaque string reflecting the render state of a component
382 * eg. 'PD' - P for non-printing-characters, D for dark-mode.
384 virtual OString getViewRenderState() { return rtl::OString(); }
386 } // namespace vcl
388 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */