tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / uitest / libreoffice / calc / document.py
blob7bd8e5feef46718cd3239b81f7c4c655ec731bdd
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 def get_sheet_from_doc(document, index=None, name=None):
9 """ Returns a sheet object for a Spreadsheet document
11 Keyword arguments:
12 index -- the 0-based index of the sheet (may not be used together with name)
13 name -- the name of the sheet (may not be used together with index)
14 """
15 return document.getSheets()[index]
17 def get_cell_by_position(document, tab, column, row):
18 """ Get the cell object through its position in a document
20 Keyword arguments:
21 document -- The document that should be used
22 tab -- The 0-based sheet number
23 column -- The 0-based column number
24 row -- The 0-based row number
25 """
26 sheet = get_sheet_from_doc(document, tab)
27 return sheet[row,column]
29 def get_column(document, column, tab = 0):
30 """ Get the column object through the column index
32 Keyword arguments:
33 document -- The document that should be used
34 tab -- The 0-based sheet number
35 column -- The 0-based column number
36 """
37 sheet = get_sheet_from_doc(document, tab)
38 return sheet.getColumns()[column]
40 def get_row(document, row, tab = 0):
41 """ Get the row object through the row index
43 Keyword arguments:
44 document -- The document that should be used
45 tab -- The 0-based sheet number
46 column -- The 0-based row number
47 """
48 sheet = get_sheet_from_doc(document, tab)
49 return sheet.getRows()[row]
51 def is_row_hidden(document, row, tab = 0):
52 """ Check whether a row object is hidden
54 Keyword arguments:
55 document -- The document that should be used
56 tab -- The 0-based sheet number
57 column -- The 0-based row number
58 """
59 xRow = get_row(document, row, tab)
60 bVisible = xRow.getPropertyValue("IsVisible")
61 return not bVisible
63 # vim: set shiftwidth=4 softtabstop=4 expandtab: