fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / filter / excel / expop2.cxx
blobf9726f642403d9404a9b310a19b041fcaf9dfe14
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <unotools/fltrcfg.hxx>
22 #include <sfx2/objsh.hxx>
23 #include <sfx2/docinf.hxx>
24 #include <filter/msfilter/svxmsbas.hxx>
26 #include "scerrors.hxx"
27 #include "scextopt.hxx"
29 #include "root.hxx"
30 #include "excdoc.hxx"
31 #include "exp_op.hxx"
33 #include "xcl97esc.hxx"
35 #include "document.hxx"
36 #include "rangenam.hxx"
37 #include "filtopt.hxx"
38 #include "xltools.hxx"
39 #include "xelink.hxx"
41 #include <com/sun/star/document/XDocumentProperties.hpp>
42 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
44 ExportBiff5::ExportBiff5( XclExpRootData& rExpData, SvStream& rStrm ):
45 ExportTyp( rStrm, &rExpData.mrDoc, rExpData.meTextEnc ),
46 XclExpRoot( rExpData )
48 // only need part of the Root data
49 pExcRoot = &GetOldRoot();
50 pExcRoot->pER = this; // ExcRoot -> XclExpRoot
51 pExcRoot->eDateiTyp = Biff5;
52 pExcDoc = new ExcDocument( *this );
55 ExportBiff5::~ExportBiff5()
57 delete pExcDoc;
60 FltError ExportBiff5::Write()
62 SfxObjectShell* pDocShell = GetDocShell();
63 OSL_ENSURE( pDocShell, "ExportBiff5::Write - no document shell" );
65 tools::SvRef<SotStorage> xRootStrg = GetRootStorage();
66 OSL_ENSURE( xRootStrg.Is(), "ExportBiff5::Write - no root storage" );
68 bool bWriteBasicStrg = false;
69 if( GetBiff() == EXC_BIFF8 )
71 const SvtFilterOptions& rFilterOpt = SvtFilterOptions::Get();
72 bWriteBasicStrg = rFilterOpt.IsLoadExcelBasicStorage();
75 if( pDocShell && xRootStrg.Is() && bWriteBasicStrg )
77 SvxImportMSVBasic aBasicImport( *pDocShell, *xRootStrg );
78 sal_uLong nErr = aBasicImport.SaveOrDelMSVBAStorage( true, EXC_STORAGE_VBA_PROJECT );
79 if( nErr != ERRCODE_NONE )
80 pDocShell->SetError( nErr, OUString( OSL_LOG_PREFIX ) );
83 pExcDoc->ReadDoc(); // ScDoc -> ExcDoc
84 pExcDoc->Write( aOut ); // wechstreamen
86 if( pDocShell && xRootStrg.Is() )
88 using namespace ::com::sun::star;
89 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
90 pDocShell->GetModel(), uno::UNO_QUERY_THROW);
91 uno::Reference<document::XDocumentProperties> xDocProps
92 = xDPS->getDocumentProperties();
93 if ( SvtFilterOptions::Get().IsEnableCalcPreview() )
95 std::shared_ptr<GDIMetaFile> xMetaFile =
96 pDocShell->GetPreviewMetaFile (false);
97 uno::Sequence<sal_uInt8> metaFile(
98 sfx2::convertMetaFile(xMetaFile.get()));
99 sfx2::SaveOlePropertySet(xDocProps, xRootStrg, &metaFile);
101 else
102 sfx2::SaveOlePropertySet(xDocProps, xRootStrg );
105 const XclExpAddressConverter& rAddrConv = GetAddressConverter();
106 if( rAddrConv.IsRowTruncated() )
107 return SCWARN_EXPORT_MAXROW;
108 if( rAddrConv.IsColTruncated() )
109 return SCWARN_EXPORT_MAXCOL;
110 if( rAddrConv.IsTabTruncated() )
111 return SCWARN_EXPORT_MAXTAB;
113 return eERR_OK;
116 ExportBiff8::ExportBiff8( XclExpRootData& rExpData, SvStream& rStrm ) :
117 ExportBiff5( rExpData, rStrm )
119 pExcRoot->eDateiTyp = Biff8;
122 ExportBiff8::~ExportBiff8()
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */