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