Package com._1c.g5.v8.dt.moxel.util
Class MoxelUtil
- java.lang.Object
-
- com._1c.g5.v8.dt.moxel.util.MoxelUtil
-
public final class MoxelUtil extends Object
Утилиты табличного документа.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_LANGUAGE
-
Constructor Summary
Constructors Constructor Description MoxelUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidapplyCellProperties(Cell srcCell, int cellProperties, Cell dstCell)Применить свойства ячейки к ячейке.static FontapplyFontProperties(Font font, Font fontToApply, int fontMask)Применить свойства к ширфту.static voidapplyFormat(ReadOnlyFormat src, Format dst)Применить формат формату.static voidapplyFormatByMask(ReadOnlyFormat src, long propertiesMask, Format dst)Apply format properties by properties maskstatic voidapplyFormatProperties(ReadOnlyFormat src, long propertiesMask, Format dst)Применить свойства, указанные в маске.static intcompareCells(Cell cell1, Cell cell2, int propertiesToCompare)Compare cellsstatic intcompareFonts(Font font1, Font font2, int fontMask)Сравнить шрифты.static longcompareFormats(ReadOnlyFormat format1, ReadOnlyFormat format2, long propertiesMask)Сравнить форматы.static booleancompareLocalStrings(LocalString string1, LocalString string2)Compare two instances ofLocalString.static ColumnscreateColumns()Создать колонки.static ColumnscreateColumnsCopy(Columns columns)Создать копию колонок.static SpreadsheetDocumentcreateEmbeddedSpreadsheetDocument()Создать встраиваемый табличный документ.static LanguageSettingscreateLanguageSettings(IV8Project project)Creates language settings for respective project.static RectcreateRect(int left, int top, int width, int height)Создать прямоугольник.static SpreadsheetDocumentcreateSpreadsheetDocument()Создать табличный документ.static SpreadsheetPointcreateSpreadsheetPoint()Создать точку.static SpreadsheetRectcreateSpreadsheetRect()Создать прямоугольник.static intfillGroups(SpreadsheetDocument sheet, List<com._1c.g5.v8.dt.moxel.util.GroupInfo> allGroups, boolean rowGroups)Fill spreadsheet document's groups structure.static CellgetCell(SpreadsheetDocument document, int rowIndex, int columnIndex)Get document cell.static intgetCellLineIndex(SpreadsheetDocument document, CellLine line)Get index of CellLinestatic intgetColorIndex(SpreadsheetDocument sheet, Color color)static intgetDrawingLineIndex(SpreadsheetDocument document, DrawingLine line)Get index of DrawingLinestatic ReadOnlyFormatgetFormatByKey(SpreadsheetDocument document, int formatIndex)Get format by key.static intgetHorizontalSize(SpreadsheetDocument document, int rowIndex)Get document horizontal size for specified row.static intgetPictureIndex(SpreadsheetDocument sheet, Picture picture)Get picture indexstatic ColumnsgetRowColumns(SpreadsheetDocument document, int rowIndex)Get row columns.static RowgetRowContent(SpreadsheetDocument document, int rowIndex)Get row content.static longgetSettedProperties(ReadOnlyFormat format)Получить маску установленных в формате свойств.static SpreadsheetRectgetShiftedCommentDrawingPosition(CommentDrawing commentDrawing)Получить позицию рисунка примечания.static booleanisCellWithoutProperties(Cell cell)static booleanisEmbedded(SpreadsheetDocument document)Проверить, является ли документ встроенным.static booleanisEmptyFormat(Format format)Проверить, пустой ли формат.static booleanisEmptyFormat(ReadOnlyFormat format)Проверить, пустой ли формат.static booleanisEmptyString(LocalString string)Check ifLocalStringis empty.static booleanisEmptyViewSettings(ViewSettings viewSettings)Check if view settings are emptystatic booleanisFontBooleanPropertySet(Font font, int fontMask, int fontProperty)Проверить, установлено ли свойство шрифта.static CelllookupCell(SpreadsheetDocument document, int rowIndex, int columnIndex)Lookup for cell in spreadsheet document.static CellsheetCellApply(Cell srcCell, Cell dstCell, int cellPropertiesMask, boolean onlyUnassigned)Apply cell properties
-
-
-
Field Detail
-
DEFAULT_LANGUAGE
public static final String DEFAULT_LANGUAGE
- See Also:
- Constant Field Values
-
-
Method Detail
-
createLanguageSettings
public static LanguageSettings createLanguageSettings(IV8Project project)
Creates language settings for respective project.- Parameters:
project-IV8Project, must not benull- Returns:
- created
LanguageSettings, nevernull
-
createSpreadsheetPoint
public static SpreadsheetPoint createSpreadsheetPoint()
Создать точку.
-
createSpreadsheetRect
public static SpreadsheetRect createSpreadsheetRect()
Создать прямоугольник.
-
createRect
public static Rect createRect(int left, int top, int width, int height)
Создать прямоугольник.
-
createSpreadsheetDocument
public static SpreadsheetDocument createSpreadsheetDocument()
Создать табличный документ.
-
createEmbeddedSpreadsheetDocument
public static SpreadsheetDocument createEmbeddedSpreadsheetDocument()
Создать встраиваемый табличный документ.
-
createColumns
public static Columns createColumns()
Создать колонки.
-
getColorIndex
public static int getColorIndex(SpreadsheetDocument sheet, Color color)
-
getPictureIndex
public static int getPictureIndex(SpreadsheetDocument sheet, Picture picture)
Get picture index- Parameters:
sheet- -SpreadsheetDocumentpicture- -Picture
-
applyFormat
public static void applyFormat(ReadOnlyFormat src, Format dst)
Применить формат формату. При этом из источника в приемник копируются только те свойства, которые установлены в источнике.- Parameters:
src- - формат - источник.dst- - формат - приемник.
-
applyFormatProperties
public static void applyFormatProperties(ReadOnlyFormat src, long propertiesMask, Format dst)
Применить свойства, указанные в маске. Если свойство в маске указано, но свойство в исходном формате не установлено, то в результирующем формате свойство удаляется.- Parameters:
propertiesMask- - составляется из FormatProperties.
-
applyFormatByMask
public static void applyFormatByMask(ReadOnlyFormat src, long propertiesMask, Format dst)
Apply format properties by properties mask- Parameters:
src- -ReadOnlyFormat- source formatpropertiesMask- - properties maskdst- -Format- destination format
-
compareFormats
public static long compareFormats(ReadOnlyFormat format1, ReadOnlyFormat format2, long propertiesMask)
Сравнить форматы.- Parameters:
propertiesMask- - свойства, которые нужно сравнивать.- Returns:
- маска, каждый бит в которой указывает одинаковые значения. Единица в бите означает, что свойства одинаковые.
-
getSettedProperties
public static long getSettedProperties(ReadOnlyFormat format)
Получить маску установленных в формате свойств.- Returns:
- маска установленных свойств. 1 соответствует установленному свойству, 0 - не установленному.
-
isEmptyFormat
public static boolean isEmptyFormat(Format format)
Проверить, пустой ли формат.
-
isEmbedded
public static boolean isEmbedded(SpreadsheetDocument document)
Проверить, является ли документ встроенным.
-
isEmptyFormat
public static boolean isEmptyFormat(ReadOnlyFormat format)
Проверить, пустой ли формат.
-
isCellWithoutProperties
public static boolean isCellWithoutProperties(Cell cell)
-
applyCellProperties
public static void applyCellProperties(Cell srcCell, int cellProperties, Cell dstCell)
Применить свойства ячейки к ячейке.- Parameters:
srcCell- - ячейка, формат которой нужно применить.cellProperties- - маска свойств.dstCell- - ячейка, к которой нужно применить свойства.
-
isEmptyViewSettings
public static boolean isEmptyViewSettings(ViewSettings viewSettings)
Check if view settings are empty- Parameters:
viewSettings- -ViewSettings- Returns:
- check result
-
compareCells
public static int compareCells(Cell cell1, Cell cell2, int propertiesToCompare)
Compare cells- Parameters:
cell1- - first cell to comparecell2- - second cell to comparepropertiesToCompare- - properties to compare(mask)- Returns:
- result of compare(mask)
-
getShiftedCommentDrawingPosition
public static SpreadsheetRect getShiftedCommentDrawingPosition(CommentDrawing commentDrawing)
Получить позицию рисунка примечания.
-
compareFonts
public static int compareFonts(Font font1, Font font2, int fontMask)
Сравнить шрифты.- Parameters:
fontMask- - исходная маска составляется из перечисления FontProperties.- Returns:
- маска, каждый бит в которой указывает одинаковые значения. Единица в бите означает, что свойства одинаковые.
-
applyFontProperties
public static Font applyFontProperties(Font font, Font fontToApply, int fontMask)
Применить свойства к ширфту.- Parameters:
font- - исходный шрифт, к которому выполняется применение.fontToApply- - шрифт, который применяется.fontMask- - применяемые свойства. Составляется из FontProperties.- Returns:
- - новый шрифт.
-
isFontBooleanPropertySet
public static boolean isFontBooleanPropertySet(Font font, int fontMask, int fontProperty)
Проверить, установлено ли свойство шрифта. Например, устанолена ли жирность.
-
getCellLineIndex
public static int getCellLineIndex(SpreadsheetDocument document, CellLine line)
Get index of CellLine- Parameters:
document- -SpreadsheetDocumentline- -CellLine- Returns:
- line index
-
getDrawingLineIndex
public static int getDrawingLineIndex(SpreadsheetDocument document, DrawingLine line)
Get index of DrawingLine- Parameters:
document- -SpreadsheetDocumentline- -DrawingLine- Returns:
- line index
-
sheetCellApply
public static Cell sheetCellApply(Cell srcCell, Cell dstCell, int cellPropertiesMask, boolean onlyUnassigned)
Apply cell properties- Parameters:
srcCell- source celldstCell- destination cellcellPropertiesMask- properties maskonlyUnassigned- set only unassigned properties- Returns:
- result cell
-
compareLocalStrings
public static boolean compareLocalStrings(LocalString string1, LocalString string2)
Compare two instances ofLocalString.- Parameters:
string1- first string to compare. Must not benull.string2- second string to compare. Must not benull.- Returns:
trueif strings are equal,falseotherwise.
-
isEmptyString
public static boolean isEmptyString(LocalString string)
Check ifLocalStringis empty.- Parameters:
string-LocalString, may benull- Returns:
trueif local string is empty,falseotherwise
-
lookupCell
public static Cell lookupCell(SpreadsheetDocument document, int rowIndex, int columnIndex)
Lookup for cell in spreadsheet document.- Parameters:
document-SpreadsheetDocument, must not benullrowIndex- row indexcolumnIndex- column index- Returns:
Cellif cell exists,nullotherwise
-
getHorizontalSize
public static int getHorizontalSize(SpreadsheetDocument document, int rowIndex)
Get document horizontal size for specified row.- Parameters:
document-SpreadsheetDocument, must not benullrowIndex- row index- Returns:
- document horizontal size for specified row
-
getRowColumns
public static Columns getRowColumns(SpreadsheetDocument document, int rowIndex)
Get row columns.- Parameters:
document-SpreadsheetDocument, must not benullrowIndex- row index- Returns:
Columns, nevernull
-
getCell
public static Cell getCell(SpreadsheetDocument document, int rowIndex, int columnIndex)
Get document cell. If cell does not exist, create it.- Parameters:
document-SpreadsheetDocument, must not benullrowIndex- row indexcolumnIndex- column index- Returns:
Cell, nevernull
-
getRowContent
public static Row getRowContent(SpreadsheetDocument document, int rowIndex)
Get row content. If row does not exist, create it.- Parameters:
document-SpreadsheetDocument, must not benullrowIndex- row index- Returns:
Row, nevernull
-
getFormatByKey
public static ReadOnlyFormat getFormatByKey(SpreadsheetDocument document, int formatIndex)
Get format by key.- Parameters:
document-SpreadsheetDocument, must not benullformatIndex- format key- Returns:
ReadOnlyFormat, neernull
-
fillGroups
public static int fillGroups(SpreadsheetDocument sheet, List<com._1c.g5.v8.dt.moxel.util.GroupInfo> allGroups, boolean rowGroups)
Fill spreadsheet document's groups structure.- Parameters:
sheet-SpreadsheetDocument, mustNotActiveExceptionbenullallGroups- array ofGroupInfoto fill, must not benullrowGroups- determines whether rows or columns groups structure is filled.- Returns:
- max group depth
-
-