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

(-)source/filter/inc/xihelper.hxx (+39 lines)
Lines 289-294 Link Here
289
    inline const ScTokenArray*  GetTokArray() const { return mpTokArr.get(); }
289
    inline const ScTokenArray*  GetTokArray() const { return mpTokArr.get(); }
290
};
290
};
291
291
292
/** Contains the array address and value of the DDE cached cell. */
293
class XclImpDde : public XclImpCachedValue
294
{
295
private:
296
    sal_uInt16                  mnCol;          /// Column index of the cached cell.
297
    sal_uInt16                  mnRow;          /// Row index of the cached cell.
298
299
public:
300
    /** Reads a cached value and stores it with its array address. */
301
    explicit                    XclImpDde( XclImpStream& rStrm, sal_uInt16 nCol, sal_uInt16 nRow );
302
303
    inline sal_uInt16           GetCol() const    { return mnCol; }
304
    inline sal_uInt16           GetRow() const    { return mnRow; }
305
306
};
307
308
class XclImpCachedMatrix
309
{
310
protected:
311
    typedef ScfDelList< XclImpDde > XclImpDdeList;
312
313
    XclImpDdeList               maDdeList;       /// List of DDE cached cell values.
314
315
    sal_uInt16                  mnColumns;       /// Number of cached columns 
316
    sal_uInt16                  mnRows;          /// Number of cached rows 
317
318
public:
319
    explicit                    XclImpCachedMatrix( sal_uInt16 nCols, sal_uInt16 nRows);
320
321
    /** Stores the contents of an external referenced cell in the DDE list. */
322
    inline void                 AppendDde( XclImpDde* pDde ) { maDdeList.Append( pDde ); }
323
324
    inline sal_uInt16           GetColumns() const { return mnColumns; }
325
    inline sal_uInt16           GetRows() const    { return mnRows; }
326
    /** Returns the first member of the DDE List (maDdeList). */
327
    inline const XclImpDde*     GetFirst() const   { return maDdeList.First(); }
328
    /** Returns the next member of the DDE List (maDdeList). */
329
    inline const XclImpDde*     GetNext() const    { return maDdeList.Next(); }
330
};
292
331
293
// ============================================================================
332
// ============================================================================
294
333
(-)source/filter/inc/xilink.hxx (-2 / +10 lines)
Lines 71-77 Link Here
71
class ScDocument;
71
class ScDocument;
72
class ScTokenArray;
72
class ScTokenArray;
73
class XclImpStream;
73
class XclImpStream;
74
74
	
75
75
76
/* ============================================================================
76
/* ============================================================================
77
Classes for import of different kinds of internal/external references.
77
Classes for import of different kinds of internal/external references.
Lines 126-139 Link Here
126
class XclImpExtName
126
class XclImpExtName
127
{
127
{
128
private:
128
private:
129
    typedef ::std::auto_ptr< XclImpCachedMatrix > XclImpCachedMatrixPtr;
130
131
    XclImpCachedMatrixPtr       mpDdeMatrix;        /// Cached results of the DDE link.
129
    String                      maName;             /// The name of the external name.
132
    String                      maName;             /// The name of the external name.
130
    String                      maAddInName;        /// The converted Calc add-in function name.
133
    String                      maAddInName;        /// The converted Calc add-in function name.
131
    sal_uInt32                  mnStorageId;        /// Storage ID for OLE object storages.
134
    sal_uInt32                  mnStorageId;        /// Storage ID for OLE object storages.
132
    XclImpExtNameType           meType;             /// Type of the external name.
135
    XclImpExtNameType           meType;             /// Type of the external name.
133
136
	                    
134
public:
137
public:
135
    /** Reads the external name from the stream. */
138
    /** Reads the external name from the stream. */
136
    explicit                    XclImpExtName( XclImpStream& rStrm );
139
    explicit                    XclImpExtName( XclImpStream& rStrm );
140
141
    /** Create and apply the cached list of this DDE Link to the document. */
142
    void                        CreateDdeData( ScDocument& rDoc, 
143
                                    const String& rApplc, 
144
                                    const String& rExtDoc) const;
137
145
138
    inline XclImpExtNameType    GetType() const         { return meType; }
146
    inline XclImpExtNameType    GetType() const         { return meType; }
139
    inline const String&        GetName() const         { return maName; }
147
    inline const String&        GetName() const         { return maName; }
(-)source/filter/excel/xihelper.cxx (+11 lines)
Lines 726-731 Link Here
726
{
726
{
727
}
727
}
728
728
729
// Matrix Cached Values ==============================================================
730
731
XclImpCachedMatrix::XclImpCachedMatrix(sal_uInt16 nColumns, sal_uInt16 nRows) :
732
    mnColumns(nColumns),
733
    mnRows(nRows)
734
{
735
}
736
737
XclImpCachedMatrix::~XclImpCachedMatrix()
738
{
739
}
729
740
730
// ============================================================================
741
// ============================================================================
731
742
(-)source/filter/excel/xilink.cxx (-2 / +56 lines)
Lines 123-131 Link Here
123
{
123
{
124
    sal_uInt16 nFlags;
124
    sal_uInt16 nFlags;
125
    sal_uInt8 nLen;
125
    sal_uInt8 nLen;
126
    rStrm >> nFlags >> mnStorageId >> nLen;
127
    rStrm.AppendUniString( maName, nLen );
128
126
127
    rStrm >> nFlags >> mnStorageId >> nLen ;
128
    rStrm.AppendUniString( maName, nLen );
129
    
129
    if( ::get_flag( nFlags, EXC_EXTN_BUILTIN ) || !::get_flag( nFlags, EXC_EXTN_OLE_OR_DDE ) )
130
    if( ::get_flag( nFlags, EXC_EXTN_BUILTIN ) || !::get_flag( nFlags, EXC_EXTN_OLE_OR_DDE ) )
130
    {
131
    {
131
        meType = xlExtName;
132
        meType = xlExtName;
Lines 134-142 Link Here
134
    }
135
    }
135
    else
136
    else
136
        meType = ::get_flagvalue( nFlags, EXC_EXTN_OLE, xlExtOLE, xlExtDDE );
137
        meType = ::get_flagvalue( nFlags, EXC_EXTN_OLE, xlExtOLE, xlExtDDE );
138
139
    if(meType == xlExtDDE && (rStrm.GetRecLeft() > 1))
140
    {
141
        sal_uInt8 nLastCol;
142
        sal_uInt16 nLastRow;
143
        rStrm >> nLastCol >> nLastRow;
144
145
        if( nLastRow <= MAXROW && nLastCol <= MAXCOL )
146
        {
147
            mpDdeMatrix.reset( new XclImpCachedMatrix(nLastCol + 1, nLastRow + 1));
148
        
149
            for( sal_uInt16 nRow = 0; nRow < nLastRow+1 && (rStrm.GetRecLeft() > 1); ++nRow )
150
                for( sal_uInt16 nCol = 0; nCol < nLastCol+1 && (rStrm.GetRecLeft() > 1); ++nCol )
151
                    mpDdeMatrix->AppendDde( new XclImpDde( rStrm, nCol, nRow ));
152
        }
153
    }
137
}
154
}
138
155
139
156
157
void XclImpExtName::CreateDdeData( ScDocument& rDoc, const String& rApplic,const String& rTopic  )const
158
{
159
    rDoc.CreateDdeLink( rApplic, rTopic, GetName() );
160
    sal_uInt16 nPosition;
161
    if(!rDoc.FindDdeLink(rApplic, rTopic, GetName(), SC_DDE_IGNOREMODE, nPosition))
162
        return ;
163
164
    if(!mpDdeMatrix.get())
165
        return ;
166
167
    ScMatrix* pMatrix = NULL;
168
    if(!(rDoc.CreateDdeLinkResultDimension(nPosition, mpDdeMatrix->GetColumns(), mpDdeMatrix->GetRows(), pMatrix)) || !pMatrix)
169
        return ;
170
171
172
    bool bString, bEmpty = false;
173
    for( const XclImpDde* pDde = mpDdeMatrix->GetFirst(); pDde; pDde = mpDdeMatrix->GetNext() )
174
    {
175
        switch( pDde->GetType() )
176
        {
177
            case EXC_CACHEDVAL_DOUBLE: bString = bEmpty = false; break;
178
            case EXC_CACHEDVAL_STRING: bString = true; bEmpty = false; break;
179
            case EXC_CACHEDVAL_BOOL:   bString = bEmpty = false; break;
180
            case EXC_CACHEDVAL_ERROR:  bString = bEmpty = false; break;
181
            default: bString = false;  bEmpty = true; break;
182
        }
183
	rDoc.SetDdeLinkResult(pMatrix,pDde->GetCol(),pDde->GetRow(),*(pDde->GetString()),pDde->GetValue(), bString, bEmpty);
184
    }
185
}
186
140
// ----------------------------------------------------------------------------
187
// ----------------------------------------------------------------------------
141
188
142
const XclImpExtName* XclImpExtNameList::GetName( sal_uInt16 nXclIndex ) const
189
const XclImpExtName* XclImpExtNameList::GetName( sal_uInt16 nXclIndex ) const
Lines 178-183 Link Here
178
        }
225
        }
179
        break;
226
        break;
180
    }
227
    }
228
}
229
230
XclImpDde::XclImpDde( XclImpStream& rStrm, sal_uInt16 nCol, sal_uInt16 nRow ) :
231
    XclImpCachedValue( rStrm ),
232
    mnCol( nCol ),
233
    mnRow( nRow )
234
{
181
}
235
}
182
236
183
237
(-)source/filter/excel/excform8.cxx (-2 / +1 lines)
Lines 668-675 Link Here
668
                            aPool   << ocDde << ocOpen << nPar1 << ocSep << nPar2 << ocSep
668
                            aPool   << ocDde << ocOpen << nPar1 << ocSep << nPar2 << ocSep
669
                                    << nMerk0 << ocClose;
669
                                    << nMerk0 << ocClose;
670
                            aPool >> aStack;
670
                            aPool >> aStack;
671
671
                            pExtName->CreateDdeData(*(pExcRoot->pDoc), aAppl, aExtDoc);
672
                            pExcRoot->pDoc->CreateDdeLink( aAppl, aExtDoc, pExtName->GetName() );
673
                        }
672
                        }
674
                        else if( (pExtName->GetType() == xlExtName) && pSupbook->IsAddIn() )
673
                        else if( (pExtName->GetType() == xlExtName) && pSupbook->IsAddIn() )
675
                            aStack << aPool.Store( ocNoName, pExtName->GetAddInName() );
674
                            aStack << aPool.Store( ocNoName, pExtName->GetAddInName() );

Return to issue 15367