Skip to content

Commit

Permalink
Merge fixes from production
Browse files Browse the repository at this point in the history
  • Loading branch information
wqweto committed Oct 25, 2017
1 parent 37892f1 commit d74ca15
Show file tree
Hide file tree
Showing 12 changed files with 589 additions and 241 deletions.
92 changes: 66 additions & 26 deletions src/cBiff12CellStyle.cls
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,7 @@ Attribute VB_Exposed = False
'=========================================================================
Option Explicit
DefObj A-Z
'Private Const MODULE_NAME As String = "cBiff12CellStyle"

#Const ImplUseShared = BIFF12_USESHARED

'=========================================================================
' Public enums
'=========================================================================

#If ImplUseShared = 0 Then

Public Enum UcsHorAlignmentEnum
ucsHalLeft = 0
ucsHalRight = 1
ucsHalCenter = 2
End Enum

#End If
Private Const STR_MODULE_NAME As String = "cBiff12CellStyle"

'=========================================================================
' API
Expand All @@ -50,14 +34,19 @@ Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination
' Constants and member variables
'=========================================================================

Private m_lIndex As Long
Private m_sFontName As String
Private m_sFormat As String
Private m_uState As UcsCellStyleType
Private m_lFmtIndex As Long
Private m_lFontIndex As Long
Private m_lFillIndex As Long
Private m_lBorderIndex As Long
Private m_lIndex As Long
Private m_sFontName As String
Private m_sFormat As String
Private m_uState As UcsCellStyleType
Private m_lFmtIndex As Long
Private m_lFontIndex As Long
Private m_lFillIndex As Long
Private m_lBorderIndex As Long
'--- debug
Private m_sInstanceName As String
#If DebugMode Then
Private m_sDebugID As String
#End If

Private Type UcsCellStyleType
FontName As String * 32
Expand All @@ -67,15 +56,33 @@ Private Type UcsCellStyleType
ForeColor As Long
BackColor As Long
HorAlign As UcsHorAlignmentEnum
VertAlign As UcsVertAlignmentEnum
BorderLeftColor As Long
BorderTopColor As Long
BorderRightColor As Long
BorderBottomColor As Long
WrapText As Boolean
ShrinkText As Boolean
Indent As Long
Format As String * 64
End Type

'=========================================================================
' Error management
'=========================================================================

Friend Property Get frInstanceName() As String
frInstanceName = m_sInstanceName
End Property

'Private Property Get MODULE_NAME() As String
' #If DebugMode Then
' MODULE_NAME = GetModuleInstance(STR_MODULE_NAME, frInstanceName, m_sDebugID)
' #Else
' MODULE_NAME = GetModuleInstance(STR_MODULE_NAME, frInstanceName)
' #End If
'End Property

'=========================================================================
' Properties
'=========================================================================
Expand Down Expand Up @@ -158,6 +165,17 @@ Property Let HorAlign(ByVal eValue As UcsHorAlignmentEnum)
End If
End Property

Property Get VertAlign() As UcsVertAlignmentEnum
VertAlign = m_uState.VertAlign
End Property

Property Let VertAlign(ByVal eValue As UcsVertAlignmentEnum)
If m_uState.VertAlign <> eValue Then
m_uState.VertAlign = eValue
m_lIndex = -1
End If
End Property

Property Get BorderLeftColor() As Long
BorderLeftColor = m_uState.BorderLeftColor
End Property
Expand Down Expand Up @@ -213,6 +231,17 @@ Property Let WrapText(ByVal bValue As Boolean)
End If
End Property

Property Get ShrinkText() As Boolean
ShrinkText = m_uState.ShrinkText
End Property

Property Let ShrinkText(ByVal bValue As Boolean)
If m_uState.ShrinkText <> bValue Then
m_uState.ShrinkText = bValue
m_lIndex = -1
End If
End Property

Property Get LeftIndent() As Long
LeftIndent = m_uState.Indent
End Property
Expand Down Expand Up @@ -293,18 +322,29 @@ End Property
'=========================================================================

Private Sub Class_Initialize()
#If DebugMode Then
DebugInstanceInit STR_MODULE_NAME, m_sDebugID, Me
#End If
'--- prevent fixed-length strings filled with Chr(0)
m_uState.FontName = vbNullString
m_uState.Format = vbNullString
With New StdFont
With SystemIconFont
FontName = .Name
FontSize = .Size
End With
ForeColor = vbBlack
VertAlign = ucsValMiddle
'--- use -1 for transparent
BackColor = -1
BorderLeftColor = -1
BorderTopColor = -1
BorderRightColor = -1
BorderBottomColor = -1
End Sub

#If DebugMode Then
Private Sub Class_Terminate()
DebugInstanceTerm STR_MODULE_NAME, m_sDebugID
End Sub
#End If

Loading

0 comments on commit d74ca15

Please sign in to comment.