Пример #1
0
 private void ApplyWholeTableBackground(ref CellFormatData cfd)
 {
     cfd.FillData.ResetForegroundColour(cfd.FillData.BackGroundColour.m_type, cfd.FillData.BackGroundColour.m_colourValue);
 }
Пример #2
0
 private void ResetBackgroundFillThemeColour(string colourIndex, ref CellFormatData cfd)
 {
     int iColourIndex = Int32.Parse(colourIndex);
     int i = 1;
     foreach (KeyValuePair<string, SchemeColour> kvp in m_predefinedObjectsHelper.SchemeColours)
     {
         if (i == iColourIndex)
         {
             SchemeColour sc = kvp.Value;
             if (sc.m_value == "windowText")
             {
                 cfd.FillData.ResetBackgroundColour(ColourType.Indexed, ColourData.systemForeground);
             }
             else if (sc.m_value == "window")
             {
                 cfd.FillData.ResetBackgroundColour(ColourType.Indexed, ColourData.systemBackground);
             }
             else
             {
                 cfd.FillData.ResetBackgroundColour(ColourType.RGB, sc.m_value);
             }
             break;
         }
         i++;
     }
 }
Пример #3
0
        private void ApplyFont(DxfStyleData dsd, ref CellFormatData cfd)
        {
            if (dsd.Font != null && dsd.Font.Colour.m_type != ColourType.NotSet)
            {
                cfd.ApplyFont = "1";

                if (dsd.Font.Colour.m_type == ColourType.Theme)
                {
                    ResetFontThemeColour(dsd.Font.Colour.m_colourValue, ref cfd);
                }
            }
        }
Пример #4
0
        private void ApplyFill(DxfStyleData dsd, ref CellFormatData cfd)
        {
            if (dsd.Fill != null && dsd.Fill.PatternFill != PatternType.None)
            {
                cfd.ApplyFill = ColourData.apply;
                cfd.FillData.PatternFill = dsd.Fill.PatternFill;

                if (dsd.Fill.ForeGroundColour.m_type == ColourType.Theme)
                {
                    ResetForegroundFillThemeColour(dsd.Fill.ForeGroundColour.m_colourValue, ref cfd);
                }

                if (dsd.Fill.BackGroundColour.m_type == ColourType.Theme)
                {
                    ResetBackgroundFillThemeColour(dsd.Fill.BackGroundColour.m_colourValue, ref cfd);
                }
            }
        }
Пример #5
0
        //the order they are applied is based on the Pt4 - language reference documentation
        private void ApplyEachStyleInTurn(PredefinedTableData ptd, ref CellFormatData cfd)
        {
            if (m_currentTableStyle != ptd.StyleName)
            {
                m_currentTableStyle = ptd.StyleName;
                m_currentTableFilter = new XlsxPredefinedTableXmlFilter(m_currentTableStyle, m_commonNamespaces);
                m_currentTableFilter.Read();
            }

            if (m_currentTableFilter != null && m_currentTableFilter.TableStyleElements!=null && m_currentTableFilter.TableStyleElements.Count > 0)
            {
                if (m_currentTableFilter.TableStyleElements.ContainsKey("wholeTable"))
                {
                    ApplyStyle(m_currentTableFilter.TableStyleElements["wholeTable"], ref cfd);
                }

                if ((ptd.CurrentCellStyle & TableCellStyle.firstColumnStripe) != 0)
                {
                    ApplyStyle(m_currentTableFilter.TableStyleElements["firstColumnStripe"], ref cfd);
                }
                if ((ptd.CurrentCellStyle & TableCellStyle.firstRowStripe) != 0)
                {
                    ApplyStyle(m_currentTableFilter.TableStyleElements["firstRowStripe"], ref cfd);
                }
                if ((ptd.CurrentCellStyle & TableCellStyle.lastColumn) != 0)
                {
                    ApplyStyle(m_currentTableFilter.TableStyleElements["lastColumn"], ref cfd);
                }
                if ((ptd.CurrentCellStyle & TableCellStyle.firstColumn) != 0)
                {
                    ApplyStyle(m_currentTableFilter.TableStyleElements["firstColumn"], ref cfd);
                }
                if ((ptd.CurrentCellStyle & TableCellStyle.headerRow) != 0)
                {
                    ApplyStyle(m_currentTableFilter.TableStyleElements["headerRow"], ref cfd);
                }
                if ((ptd.CurrentCellStyle & TableCellStyle.totalRow) != 0)
                {
                    ApplyStyle(m_currentTableFilter.TableStyleElements["totalRow"], ref cfd);
                }
                if (ptd.CurrentCellStyle == TableCellStyle.wholeTable)
                {//if it is only whole table it uses the fill.background, so reset the foreground to this to simplify comparison
                    ApplyWholeTableBackground(ref cfd);
                }
            }
        }
Пример #6
0
 private void ApplyStyle(DxfStyleData dsd, ref CellFormatData cfd)
 {
     ApplyFont(dsd, ref cfd);
     ApplyFill(dsd, ref cfd);
 }
Пример #7
0
        private void ApplyCurrentCellStyleOverride(ref CellFormatData cfd)
        {
            if (m_currentCellStyleBasedCFD != null)
            {
                if (m_currentCellStyleBasedCFD.ApplyFill == ColourData.apply)
                {
                    cfd.FillData.PatternFill = m_currentCellStyleBasedCFD.FillData.PatternFill;
                    if ( m_currentCellStyleBasedCFD.FillData.BackGroundColour.m_type != ColourType.NotSet && 
                        !(m_currentCellStyleBasedCFD.FillData.BackGroundColour.m_type == ColourType.Indexed 
                          && (m_currentCellStyleBasedCFD.FillData.BackGroundColour.m_colourValue == ColourData.systemForeground || 
                          m_currentCellStyleBasedCFD.FillData.BackGroundColour.m_colourValue == ColourData.systemBackground)))
                    {
                        cfd.FillData.ResetBackgroundColour(m_currentCellStyleBasedCFD.FillData.BackGroundColour.m_type, m_currentCellStyleBasedCFD.FillData.BackGroundColour.m_colourValue);
                    }
                    if (m_currentCellStyleBasedCFD.FillData.ForeGroundColour.m_type != ColourType.NotSet &&
                        !(m_currentCellStyleBasedCFD.FillData.ForeGroundColour.m_type == ColourType.Indexed
                          && (m_currentCellStyleBasedCFD.FillData.ForeGroundColour.m_colourValue == ColourData.systemForeground ||
                          m_currentCellStyleBasedCFD.FillData.ForeGroundColour.m_colourValue == ColourData.systemBackground)))
                    {
                        cfd.FillData.ResetForegroundColour(m_currentCellStyleBasedCFD.FillData.BackGroundColour.m_type, m_currentCellStyleBasedCFD.FillData.ForeGroundColour.m_colourValue);
                    }
                }

                if (m_currentCellStyleBasedCFD.ApplyFont == ColourData.apply)
                {
                    if (m_currentCellStyleBasedCFD.FontData.Colour.m_type != ColourType.NotSet)
                    {
                        cfd.FontData.ResetColourData(m_currentCellStyleBasedCFD.FontData.Colour.m_type, m_currentCellStyleBasedCFD.FontData.Colour.m_colourValue);
                    }
                }
                cfd.FontData.FontSize = m_currentCellStyleBasedCFD.FontData.FontSize;
            }
        }
Пример #8
0
        private void ResolveCurrentCellStyle(string cellRef, PredefinedTableData ptd)
        {
            CellFormatData cfd = new CellFormatData();

            ApplyEachStyleInTurn(ptd, ref cfd);
            ApplyCurrentCellStyleOverride(ref cfd);
            ResolveStateBasedOnCellFormatData(cfd);
        }
Пример #9
0
        private void ResolveStateBasedOnCellFormatData(CellFormatData cfd)
        {
            if (m_interestedInWhiteText)
            {
                if (m_inTable)
                {
                    if (cfd.IsTableWhiteText())
                    {
                        m_inWhiteText = true;
                    }
                }
                else
                {
                    if (cfd.IsWhiteText())
                    {
                        m_inWhiteText = true;
                    }
                }
            }

            if (m_interestedInSmallText && cfd.IsSmallText())
            {
                m_inSmallText = true;
            }

            if (m_interestedInRedactedText)
            {
                if (m_inTable && cfd.IsTableRedactedText())
                {
                    m_inRedactedText = true;
                }
                else if (!m_inTable && cfd.IsRedactedText())
                {
                    m_inRedactedText = true;
                }
            }
        }
Пример #10
0
        private void SetCurrentCellFormatData(XmlNodeInformation nodeInfo, Dictionary<string, CellFormatData> cellFormatsLookup)
        {
            m_currentCellStyleBasedCFD = null;
            string styleIndex = nodeInfo.GetAttributeValue("s");

            if(!cellFormatsLookup.TryGetValue(styleIndex, out m_currentCellStyleBasedCFD))
            {
				//System.Diagnostics.Debug.WriteLine("Invalid styleIndex passed to StateTracker");
            }
        }
Пример #11
0
        private void HandleFormatInfo(XmlNodeInformation nodeInfo)
        {
            if (m_inStyleXf)
            {
                CellFormatData fd = new CellFormatData();
                fd.ApplyFill = nodeInfo.GetAttributeValue("applyFill");
                fd.ApplyFont = nodeInfo.GetAttributeValue("applyFont");
                fd.FillId = nodeInfo.GetAttributeValue("fillId");
                fd.FontId = nodeInfo.GetAttributeValue("fontId");
                m_styleFormats.Add(m_styleFormats.Count.ToString(), fd);
            }
            else
            {
                CellFormatData fd = new CellFormatData();
                string xfId = nodeInfo.GetAttributeValue("xfId");
                CellFormatData currentStyleFd = m_styleFormats[xfId];

                fd.ApplyFill = nodeInfo.GetAttributeValue("applyFill");
                if (fd.ApplyFill != ColourData.apply)
                    fd.FillId = currentStyleFd.FillId;
                else
                    fd.FillId = nodeInfo.GetAttributeValue("fillId");

                fd.ApplyFont = nodeInfo.GetAttributeValue("applyFont");
                if (fd.ApplyFont != ColourData.apply)
                    fd.FontId = currentStyleFd.FontId;
                else
                    fd.FontId = nodeInfo.GetAttributeValue("fontId");

                m_cellFormats.Add(m_cellFormats.Count.ToString(), fd);
            }
        }