26#include <rtl/strbuf.hxx>
82 sal_uInt16 nMaxRecSize = 0 );
90 void StartRecord( sal_uInt16 nRecId, std::size_t nRecSize );
110 std::size_t
Write(
const void* pData, std::size_t nBytes );
216 void Init(
const css::uno::Sequence< css::beans::NamedValue >& aEncryptionData );
218 static sal_uInt32
GetBlockPos( std::size_t nStrmPos );
232#define XESTRING_TO_PSZ(s) \
233 (s.Len() && s.GetChar( 0 ) != 0 ? XclXmlUtils::ToOString( s ).getStr() : nullptr)
244namespace sc {
class CompileFormulaContext; }
255 static OUString
GetStreamName(
const char* sStreamDir,
const char* sStream, sal_Int32 nId );
275 pStream->startElement(nElement);
276 pStream->write(
value);
277 pStream->endElement(nElement);
287 XclExpXmlStream(
const css::uno::Reference< css::uno::XComponentContext >& rCC,
bool bExportVBA,
bool bExportTemplate );
299 template <
typename Str,
typename... Args>
303 if constexpr(
sizeof...(rest) > 0)
311 const OUString& sFullStream,
312 std::u16string_view sRelativeStream,
313 const css::uno::Reference< css::io::XOutputStream >& xParentRelation,
314 const char* sContentType,
315 std::u16string_view sRelationshipType,
316 OUString* pRelationshipId =
nullptr );
335 WriteAttribute(nAttr, OStringToOUString(sVal, RTL_TEXTENCODING_UTF8));
340 WriteAttribute(nAttr, OUString(sVal, strlen(sVal), RTL_TEXTENCODING_UTF8));
347 typedef std::map< OUString,
bool mbValid
Last known stream position.
static sal_uInt32 GetBlockPos(std::size_t nStrmPos)
XclExpBiff8Encrypter(const XclExpRoot &rRoot)
void Encrypt(SvStream &rStrm, sal_uInt8 nData)
void GetSaltDigest(sal_uInt8 pnSaltDigest[16]) const
void Init(const css::uno::Sequence< css::beans::NamedValue > &aEncryptionData)
void GetSalt(sal_uInt8 pnSalt[16]) const
::msfilter::MSCodec_Std97 maCodec
void GetDocId(sal_uInt8 pnDocId[16]) const
sal_uInt8 mpnSaltDigest[16]
static sal_uInt16 GetOffsetInBlock(std::size_t nStrmPos)
sal_uInt8 mpnDocId[16]
Crypto algorithm implementation.
void EncryptBytes(SvStream &rStrm, ::std::vector< sal_uInt8 > &aBytes)
Access to global data from other classes.
This class is used to export Excel record streams.
void StartContinue()
Writes CONTINUE header, internal setup.
void UpdateRecSize()
Rewrites correct record length, if different from calculated.
XclExpStream(SvStream &rOutStrm, const XclExpRoot &rRoot, sal_uInt16 nMaxRecSize=0)
Constructs the Excel record export stream.
void InitRecord(sal_uInt16 nRecId)
Writes header data, internal setup.
sal_uInt16 mnHeaderSize
Maximum size of data slices (parts that cannot be split).
void WriteCharBuffer(const ScfUInt8Vec &rBuffer)
Writes 8-bit character buffer.
std::size_t mnLastSizePos
Predicted size received from calling function.
void WriteRawZeroBytes(std::size_t nBytes)
Writes a raw sequence of zero bytes.
void WriteZeroBytes(std::size_t nBytes)
Writes a sequence of nBytes zero bytes (respects slice setting).
XclExpEncrypterRef mxEncrypter
sal_uInt16 mnMaxSliceSize
Current maximum, either mnMaxRecSize or mnMaxContSize.
void WriteZeroBytesToRecord(std::size_t nBytes)
sal_uInt16 mnCurrSize
Record size written in last record header.
sal_uInt16 GetRawRecPos() const
Returns the position inside of current record (starts by 0 in every CONTINUE).
sal_uInt16 mnCurrMaxSize
Maximum size of CONTINUE content.
void WriteUnicodeBuffer(const ScfUInt16Vec &rBuffer, sal_uInt8 nFlags)
Writes Unicode buffer as 8/16 bit, repeats nFlags at start of a CONTINUE record.
sal_uInt64 GetSvStreamPos() const
Returns the absolute position of the system stream.
bool mbUseEncrypter
Filter root data.
sal_uInt16 PrepareWrite()
Creates CONTINUE record at end of record.
sal_uInt16 mnSliceSize
Count of bytes already written in current record.
void CopyFromStream(SvStream &rInStrm, sal_uInt64 nBytes=STREAM_SEEK_TO_END)
Copies nBytes bytes from current position of the stream rInStrm.
void EnableEncryption(bool bEnable=true)
void SetEncrypter(XclExpEncrypterRef const &xEncrypter)
bool mbInRec
Stream position of size field in current header.
void SetSliceSize(sal_uInt16 nSize)
Sets data slice length.
void UpdateSizeVars(std::size_t nSize)
Recalculates mnCurrSize and mnSliceSize.
bool HasValidEncrypter() const
void StartRecord(sal_uInt16 nRecId, std::size_t nRecSize)
Starts a new record: writes header data, stores calculated record size.
void WriteByteString(const OString &rString)
Writes string length field and OString buffer.
std::size_t Write(const void *pData, std::size_t nBytes)
Writes nBytes bytes from memory.
XclExpStream & operator<<(sal_Int8 nValue)
void SetSvStreamPos(sal_uInt64 nPos)
Sets position of system stream (only allowed outside of records).
void EndRecord()
Checks and corrects real record length.
const XclExpRoot & mrRoot
Reference to the system output stream.
sal_uInt16 mnMaxContSize
Maximum size of record content.
std::size_t mnPredictSize
Count of bytes already written in current slice.
const XclExpRoot & GetRoot() const
Returns the filter root data.
This class stores an unformatted or formatted string for Excel export.
sax_fastparser::FSHelperPtr GetStreamForPath(const OUString &rPath)
ScDocShell * getDocShell()
virtual ::oox::ole::VbaProject * implCreateVbaProject() const override
virtual oox::vml::Drawing * getVmlDrawing() override
void WriteAttributes(sal_Int32 nAttribute, Str &&value, Args &&... rest)
void WriteAttribute(sal_Int32 nAttr, std::u16string_view sVal)
void validateTabNames(std::vector< OUString > &aOriginalTabNames)
const XclExpRoot * mpRoot
virtual oox::drawingml::table::TableStyleListPtr getTableStyles() override
std::map< OUString, std::pair< OUString, sax_fastparser::FSHelperPtr > > XclExpXmlPathToStateMap
virtual const oox::drawingml::Theme * getCurrentTheme() const override
sax_fastparser::FSHelperPtr & GetCurrentStream()
void renameTab(SCTAB aTab, OUString aNewName)
std::stack< sax_fastparser::FSHelperPtr > maStreams
void WriteAttribute(sal_Int32 nAttr, const char *sVal)
virtual bool importDocument() noexcept override
XclExpXmlPathToStateMap maOpenedStreamMap
virtual oox::drawingml::chart::ChartConverter * getChartConverter() override
sax_fastparser::FSHelperPtr CreateOutputStream(const OUString &sFullStream, std::u16string_view sRelativeStream, const css::uno::Reference< css::io::XOutputStream > &xParentRelation, const char *sContentType, std::u16string_view sRelationshipType, OUString *pRelationshipId=nullptr)
virtual bool exportDocument() override
void PushStream(sax_fastparser::FSHelperPtr const &aStream)
virtual ~XclExpXmlStream() override
XclExpXmlStream(const css::uno::Reference< css::uno::XComponentContext > &rCC, bool bExportVBA, bool bExportTemplate)
virtual OUString SAL_CALL getImplementationName() override
void restoreTabNames(const std::vector< OUString > &aOriginalTabNames)
const XclExpRoot & GetRoot() const
Returns the filter root data.
A 2D cell range address list with Excel column and row indexes.
XclXmlUtils & operator=(const XclXmlUtils &)=delete
XclXmlUtils(const XclXmlUtils &)=delete
static OString ToOString(const Color &rColor)
static sax_fastparser::FSHelperPtr WriteFontData(sax_fastparser::FSHelperPtr pStream, const XclFontData &rFontData, sal_Int32 nNameId)
static void GetFormulaTypeAndValue(ScFormulaCell &rCell, const char *&sType, OUString &rValue)
static sax_fastparser::FSHelperPtr WriteElement(sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, const T &value)
static OUString ToOUString(const char *s)
static OUString GetStreamName(const char *sStreamDir, const char *sStream, sal_Int32 nId)
std::shared_ptr< TableStyleList > TableStyleListPtr
std::shared_ptr< FastSerializerHelper > FSHelperPtr
CAUTION! The following defines must be in the same namespace as the respective type.
A 2D cell address struct with Excel column and row indexes.
This struct helps reading and writing Excel fonts.
std::shared_ptr< XclExpBiff8Encrypter > XclExpEncrypterRef