View | Details | Raw Unified | Return to issue 41688
Collapse All | Expand All

(-)source/filter/inc/qpro.hxx (-4 / +1 lines)
Lines 55-62 Link Here
55
// Stream wrapper class
55
// Stream wrapper class
56
class ScQProReader : public ScBiffReader
56
class ScQProReader : public ScBiffReader
57
{
57
{
58
    ScQProStyle aStyle;
59
    
60
    public:
58
    public:
61
    bool recordsLeft();
59
    bool recordsLeft();
62
    bool IsEndOfFile();
60
    bool IsEndOfFile();
Lines 68-75 class ScQProReader : public ScBiffReader Link Here
68
    ScQProReader( SfxMedium &rMedium, ScDocument* pDoc);
66
    ScQProReader( SfxMedium &rMedium, ScDocument* pDoc);
69
    ~ScQProReader(){ };
67
    ~ScQProReader(){ };
70
    FltError import( ScDocument *pDoc );
68
    FltError import( ScDocument *pDoc );
71
    FltError readSheet( sal_uInt16 ntab, ScDocument* pDoc );
69
    FltError readSheet( sal_uInt16 ntab, ScDocument* pDoc, ScQProStyle *pStyle );
72
    ScQProStyle &getStyleElement() { return aStyle; }
73
};
70
};
74
#endif
71
#endif
75
72
(-)source/filter/inc/qprostyle.hxx (-6 / +12 lines)
Lines 52-66 Link Here
52
                                                                                                                             
52
                                                                                                                             
53
class ScQProStyle
53
class ScQProStyle
54
{
54
{
55
    sal_uInt8 maAlign[ 256 ];
55
    sal_uInt8  maAlign[ 256 ];
56
    sal_uInt8 maFont[ 256 ];
56
    sal_uInt8  maFont[ 256 ];
57
    sal_uInt16 maFontRecord[ 256 ], maFontLimit, maAlignLimit;
57
	sal_uInt16 maFontRecord[ 256 ];
58
    String maFontType[ 256 ];
58
	sal_uInt16 maFontHeight[ 256 ];
59
    String     maFontType[ 256 ];
60
	sal_uInt16 maFontLimit, maAlignLimit;
59
    
61
    
60
    public:
62
    public:
61
    ScQProStyle() { }
63
	ScQProStyle();
62
    void SetFormat( ScDocument *pDoc, sal_uInt8 nCol, sal_uInt16 nRow, sal_uInt8 nTab, sal_uInt16 nStyle );
64
    void SetFormat( ScDocument *pDoc, sal_uInt8 nCol, sal_uInt16 nRow, sal_uInt8 nTab, sal_uInt16 nStyle );
63
    void setFontRecord( sal_uInt16 nIndex, sal_uInt16 nData ) { maFontRecord[ nIndex ] = nData; }
65
    void setFontRecord( sal_uInt16 nIndex, sal_uInt16 nData, sal_uInt16 nPtSize )
66
	{
67
		maFontRecord[ nIndex ] = nData;
68
		maFontHeight[ nIndex ] = nPtSize;
69
	}
64
    void setFontType( sal_uInt16 nIndex, String &aLabel ){ maFontType[ nIndex ] = aLabel; }    
70
    void setFontType( sal_uInt16 nIndex, String &aLabel ){ maFontType[ nIndex ] = aLabel; }    
65
    void setAlign( sal_uInt16 nIndex, sal_uInt8 nData ) { maAlign[ nIndex ] = nData; }
71
    void setAlign( sal_uInt16 nIndex, sal_uInt8 nData ) { maAlign[ nIndex ] = nData; }
66
    void setFont( sal_uInt16 nIndex, sal_uInt8 nData ) { maFont[ nIndex ] = nData; }
72
    void setFont( sal_uInt16 nIndex, sal_uInt8 nData ) { maFont[ nIndex ] = nData; }
(-)source/filter/qpro/qpro.cxx (-15 / +13 lines)
Lines 51-57 Link Here
51
#include "biff.hxx"
51
#include "biff.hxx"
52
#include <tools/stream.hxx>
52
#include <tools/stream.hxx>
53
53
54
FltError ScQProReader::readSheet( sal_uInt16 nTab, ScDocument* pDoc )
54
FltError ScQProReader::readSheet( sal_uInt16 nTab, ScDocument* pDoc, ScQProStyle *pStyle )
55
{
55
{
56
	sal_uInt8  nCol, nDummy;
56
	sal_uInt8  nCol, nDummy;
57
	sal_uInt16 nRow;
57
	sal_uInt16 nRow;
Lines 71-77 FltError ScQProReader::readSheet( sal_uI Link Here
71
                *mpStream >> nCol >> nDummy >> nRow >> nStyle >> nDummy;
71
                *mpStream >> nCol >> nDummy >> nRow >> nStyle >> nDummy;
72
                readString( aLabel, getLength() - 7 );
72
                readString( aLabel, getLength() - 7 );
73
                nStyle = nStyle >> 3;
73
                nStyle = nStyle >> 3;
74
                getStyleElement().SetFormat( pDoc, nCol, nRow, nTab, nStyle );
74
                pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
75
                pDoc->PutCell( nCol, nRow, nTab, new ScStringCell( aLabel ), (BOOL) TRUE );
75
                pDoc->PutCell( nCol, nRow, nTab, new ScStringCell( aLabel ), (BOOL) TRUE );
76
                }
76
                }
77
                break;
77
                break;
Lines 83-89 FltError ScQProReader::readSheet( sal_uI Link Here
83
            case 0x000c: // Blank cell
83
            case 0x000c: // Blank cell
84
                *mpStream >> nCol >> nDummy >> nRow >> nStyle;
84
                *mpStream >> nCol >> nDummy >> nRow >> nStyle;
85
                nStyle = nStyle >> 3; 
85
                nStyle = nStyle >> 3; 
86
                getStyleElement().SetFormat( pDoc, nCol, nRow, nTab, nStyle );
86
                pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
87
                break; 
87
                break; 
88
             
88
             
89
            case 0x000d:{ // Integer cell
89
            case 0x000d:{ // Integer cell
Lines 91-97 FltError ScQProReader::readSheet( sal_uI Link Here
91
                *mpStream >> nCol >> nDummy >> nRow >> nStyle >> nValue;	
91
                *mpStream >> nCol >> nDummy >> nRow >> nStyle >> nValue;	
92
                ScValueCell* pInteger = new ScValueCell( ( double ) nValue ); 
92
                ScValueCell* pInteger = new ScValueCell( ( double ) nValue ); 
93
                nStyle = nStyle >> 3;
93
                nStyle = nStyle >> 3;
94
                getStyleElement().SetFormat( pDoc, nCol, nRow, nTab, nStyle );
94
                pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
95
                pDoc->PutCell(nCol ,nRow, nTab ,pInteger,(BOOL) TRUE);
95
                pDoc->PutCell(nCol ,nRow, nTab ,pInteger,(BOOL) TRUE);
96
                }
96
                }
97
                break;
97
                break;
Lines 101-107 FltError ScQProReader::readSheet( sal_uI Link Here
101
                *mpStream >> nCol >> nDummy >> nRow >> nStyle >> nValue;
101
                *mpStream >> nCol >> nDummy >> nRow >> nStyle >> nValue;
102
                ScValueCell* pFloat = new ScValueCell( nValue );
102
                ScValueCell* pFloat = new ScValueCell( nValue );
103
                nStyle = nStyle >> 3;
103
                nStyle = nStyle >> 3;
104
                getStyleElement().SetFormat( pDoc, nCol, nRow, nTab, nStyle );
104
                pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
105
                pDoc->PutCell( nCol, nRow, nTab, pFloat, (BOOL) TRUE ); 
105
                pDoc->PutCell( nCol, nRow, nTab, pFloat, (BOOL) TRUE ); 
106
                }
106
                }
107
                break;
107
                break;
Lines 117-123 FltError ScQProReader::readSheet( sal_uI Link Here
117
                ScFormulaCell *pFormula = new ScFormulaCell( pDoc, aAddr, pArray );
117
                ScFormulaCell *pFormula = new ScFormulaCell( pDoc, aAddr, pArray );
118
                nStyle = nStyle >> 3;
118
                nStyle = nStyle >> 3;
119
                pFormula->AddRecalcMode( RECALCMODE_ONLOAD_ONCE );
119
                pFormula->AddRecalcMode( RECALCMODE_ONLOAD_ONCE );
120
                getStyleElement().SetFormat( pDoc, nCol, nRow, nTab, nStyle );
120
                pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
121
                pDoc->PutCell( nCol, nRow, nTab, pFormula, ( BOOL ) TRUE );
121
                pDoc->PutCell( nCol, nRow, nTab, pFormula, ( BOOL ) TRUE );
122
                }
122
                }
123
                break;
123
                break;
Lines 135-142 FltError ScImportQuattroPro( SfxMedium & Link Here
135
}
135
}
136
136
137
ScQProReader::ScQProReader( SfxMedium &rMedium, ScDocument *pDoc ):
137
ScQProReader::ScQProReader( SfxMedium &rMedium, ScDocument *pDoc ):
138
    ScBiffReader( rMedium ),
138
    ScBiffReader( rMedium )
139
    aStyle()
140
{
139
{
141
}
140
}
142
141
Lines 146-151 FltError ScQProReader::import( ScDocumen Link Here
146
    sal_uInt16 nVersion;
145
    sal_uInt16 nVersion;
147
    int i = 1 , j = 1;
146
    int i = 1 , j = 1;
148
    int nTab = 0;
147
    int nTab = 0;
148
    ScQProStyle *aStyleElement = new ScQProStyle();
149
    SetEof( FALSE );
149
    SetEof( FALSE );
150
150
151
    if( !recordsLeft() )
151
    if( !recordsLeft() )
Lines 166-172 FltError ScQProReader::import( ScDocumen Link Here
166
                    aName.Append( sal_Unicode( 'A' + nTab ) );
166
                    aName.Append( sal_Unicode( 'A' + nTab ) );
167
                    pDoc->InsertTab( nTab, aName );
167
                    pDoc->InsertTab( nTab, aName );
168
                }
168
                }
169
                eRet = readSheet( nTab, pDoc );
169
                eRet = readSheet( nTab, pDoc, aStyleElement );
170
                nTab++;
170
                nTab++;
171
                break;
171
                break;
172
172
Lines 178-185 FltError ScQProReader::import( ScDocumen Link Here
178
                sal_uInt8 nFormat, nAlign, nFont;
178
                sal_uInt8 nFormat, nAlign, nFont;
179
                sal_Int16 nColor;
179
                sal_Int16 nColor;
180
                *mpStream >> nFormat >> nAlign >> nColor >> nFont;
180
                *mpStream >> nFormat >> nAlign >> nColor >> nFont;
181
                getStyleElement().setAlign( i, nAlign );
181
                aStyleElement->setAlign( i, nAlign );
182
                getStyleElement().setFont( i, nFont );
182
                aStyleElement->setFont( i, nFont );
183
                i++;
183
                i++;
184
                }
184
                }
185
                break;
185
                break;
Lines 188-203 FltError ScQProReader::import( ScDocumen Link Here
188
                sal_uInt16 nPtSize, nFontAttr;
188
                sal_uInt16 nPtSize, nFontAttr;
189
                String aLabel;
189
                String aLabel;
190
                *mpStream >> nPtSize >> nFontAttr;
190
                *mpStream >> nPtSize >> nFontAttr;
191
                getStyleElement().setFontRecord( j, nFontAttr );
191
                aStyleElement->setFontRecord( j, nFontAttr, nPtSize );
192
                readString( aLabel, getLength() - 4 );
192
                readString( aLabel, getLength() - 4 );
193
                getStyleElement().setFontType( j, aLabel );
193
                aStyleElement->setFontType( j, aLabel );
194
                j++;
194
                j++;
195
                }
195
                }
196
                break;
196
                break;
197
        }
197
        }
198
    }
198
    }
199
    getStyleElement().setFontLimit( j );
200
    getStyleElement().setAlignLimit( i );
201
    pDoc->CalcAfterLoad();
199
    pDoc->CalcAfterLoad();
202
    return eRet;
200
    return eRet;
203
}
201
}
(-)source/filter/qpro/qprostyle.cxx (-7 / +16 lines)
Lines 49-54 Link Here
49
#include <svx/wghtitem.hxx>
49
#include <svx/wghtitem.hxx>
50
#include <svx/postitem.hxx>
50
#include <svx/postitem.hxx>
51
#include <svx/crsditem.hxx>
51
#include <svx/crsditem.hxx>
52
#include <svx/fhgtitem.hxx>
52
#include <svx/fontitem.hxx>
53
#include <svx/fontitem.hxx>
53
#include <map>
54
#include <map>
54
                                                                                                                             
55
                                                                                                                             
Lines 60-73 Link Here
60
#include "document.hxx"
61
#include "document.hxx"
61
#include "cell.hxx"
62
#include "cell.hxx"
62
63
64
ScQProStyle::ScQProStyle() :
65
	maFontLimit(0), maAlignLimit(0)
66
{
67
	rtl_fillMemory (maAlign, sizeof (maAlign), 0);
68
	rtl_fillMemory (maFont, sizeof (maFont), 0);
69
	rtl_fillMemory (maFontRecord, sizeof (maFontRecord), 0);
70
	rtl_fillMemory (maFontHeight, sizeof (maFontRecord), 0);
71
	for (int i = 0; i < sizeof (maFontType) / sizeof(maFontType[0]); i++)
72
		maFontType[i] = String();
73
}
74
63
void ScQProStyle::SetFormat( ScDocument *pDoc, sal_uInt8 nCol, sal_uInt16 nRow, sal_uInt8 nTab, sal_uInt16 nStyle )
75
void ScQProStyle::SetFormat( ScDocument *pDoc, sal_uInt8 nCol, sal_uInt16 nRow, sal_uInt8 nTab, sal_uInt16 nStyle )
64
{
76
{
65
    ScPatternAttr aPattern(pDoc->GetPool());
77
    ScPatternAttr aPattern(pDoc->GetPool());
66
    SfxItemSet& rItemSet = aPattern.GetItemSet();
78
    SfxItemSet& rItemSet = aPattern.GetItemSet();
67
79
68
    if( nStyle >= maAlignLimit )
69
        return;
70
71
    sal_uInt8 nTmp = maAlign[ nStyle ];
80
    sal_uInt8 nTmp = maAlign[ nStyle ];
72
    sal_uInt8 nHor = ( nTmp & 0x07 );
81
    sal_uInt8 nHor = ( nTmp & 0x07 );
73
    sal_uInt8 nVer = ( nTmp & 0x18 );
82
    sal_uInt8 nVer = ( nTmp & 0x18 );
Lines 137-144 void ScQProStyle::SetFormat( ScDocument Link Here
137
    }
146
    }
138
                                                                                                                             
147
                                                                                                                             
139
    // Font Attributes
148
    // Font Attributes
140
    if( nStyle >= maFontLimit )
141
        return;
142
    sal_uInt16 nTmpFnt = maFontRecord[ maFont[ nStyle ] ];
149
    sal_uInt16 nTmpFnt = maFontRecord[ maFont[ nStyle ] ];
143
    BOOL bIsBold, bIsItalic, bIsUnderLine, bIsStrikeThrough;
150
    BOOL bIsBold, bIsItalic, bIsUnderLine, bIsStrikeThrough;
144
151
Lines 153-162 void ScQProStyle::SetFormat( ScDocument Link Here
153
        rItemSet.Put( SvxPostureItem( ITALIC_NORMAL, ATTR_FONT_POSTURE ) );
160
        rItemSet.Put( SvxPostureItem( ITALIC_NORMAL, ATTR_FONT_POSTURE ) );
154
    if( bIsUnderLine )
161
    if( bIsUnderLine )
155
        rItemSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE, ATTR_FONT_UNDERLINE ) );
162
        rItemSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE, ATTR_FONT_UNDERLINE ) );
156
                                                                                                                            
163
164
	if (maFontHeight[ maFont [ nStyle ] ])
165
		rItemSet.Put( SvxFontHeightItem( (ULONG) (20 * maFontHeight[ maFont[ nStyle ] ] ) ) );
166
157
    String fntName = maFontType[ maFont[ nStyle ] ];
167
    String fntName = maFontType[ maFont[ nStyle ] ];
158
    rItemSet.Put( SvxFontItem( FAMILY_SYSTEM, fntName, EMPTY_STRING ) );
168
    rItemSet.Put( SvxFontItem( FAMILY_SYSTEM, fntName, EMPTY_STRING ) );
159
                                                                                                                             
169
                                                                                                                             
160
    pDoc->ApplyPattern( nCol, nRow, nTab, aPattern );
170
    pDoc->ApplyPattern( nCol, nRow, nTab, aPattern );
161
}
171
}
162

Return to issue 41688