[Libreoffice-commits] .: 17 commits - sc/source sc/util
Katarina Machalkova
bubli at kemper.freedesktop.org
Wed Oct 13 11:59:26 PDT 2010
sc/source/filter/excel/excdoc.cxx | 103 ++---
sc/source/filter/excel/excel.cxx | 19 -
sc/source/filter/excel/excrecds.cxx | 28 +
sc/source/filter/excel/expop2.cxx | 70 ----
sc/source/filter/excel/xecontent.cxx | 22 -
sc/source/filter/excel/xeescher.cxx | 29 +
sc/source/filter/excel/xename.cxx | 2
sc/source/filter/excel/xepage.cxx | 50 +-
sc/source/filter/excel/xepivot.cxx | 149 ++++++++
sc/source/filter/excel/xestream.cxx | 424 +++++++++++++++++++-----
sc/source/filter/excel/xestring.cxx | 6
sc/source/filter/excel/xestyle.cxx | 7
sc/source/filter/excel/xetable.cxx | 211 +++---------
sc/source/filter/excel/xlpage.cxx | 30 +
sc/source/filter/inc/XclExpChangeTrack.hxx | 46 ++
sc/source/filter/inc/excdoc.hxx | 2
sc/source/filter/inc/excrecds.hxx | 4
sc/source/filter/inc/exp_op.hxx | 15
sc/source/filter/inc/xcl97esc.hxx | 1
sc/source/filter/inc/xcl97rec.hxx | 31 +
sc/source/filter/inc/xeescher.hxx | 2
sc/source/filter/inc/xepivot.hxx | 1
sc/source/filter/inc/xestream.hxx | 18 -
sc/source/filter/inc/xetable.hxx | 11
sc/source/filter/inc/xlpage.hxx | 6
sc/source/filter/xcl97/XclExpChangeTrack.cxx | 469 ++++++++++++++++++++++++++-
sc/source/filter/xcl97/xcl97esc.cxx | 8
sc/source/filter/xcl97/xcl97rec.cxx | 391 ++++++++++++++++++++--
sc/source/ui/docshell/docsh.cxx | 6
sc/source/ui/unoobj/notesuno.cxx | 6
sc/util/scfilt.map | 3
31 files changed, 1663 insertions(+), 507 deletions(-)
New commits:
commit e6df329808c4b8e3c06cfd8614ffdf71aa967bcc
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 20:56:30 2010 +0200
Fixed build of sc (ctor of XclObjAny has 2 params)
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index 2ef4366..baed64c 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -1162,7 +1162,7 @@ XclMacroHelper::SetMacroLink( const String& rMacroName )
}
XclExpShapeObj::XclExpShapeObj( XclExpObjectManager& rRoot, ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ) :
- XclObjAny( rRoot ),
+ XclObjAny( rRoot, xShape ),
XclMacroHelper( rRoot )
{
if( SdrObject* pSdrObj = ::GetSdrObjectFromXShape( xShape ) )
commit b968c2f1fc8e71dd44d7c67da77603012da7bedb
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 18:18:31 2010 +0200
Merged oox-sc-notes.diff from ooo-build
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index fcb7e20..2ef4366 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -999,7 +999,12 @@ XclExpNote::XclExpNote( const XclExpRoot& rRoot, const ScAddress& rScPos,
// get the main note text
String aNoteText;
if( pScNote )
+ {
aNoteText = pScNote->GetText();
+ const EditTextObject *pEditObj = pScNote->GetEditTextObject();
+ if( pEditObj )
+ mpNoteContents = XclExpStringHelper::CreateString( rRoot, *pEditObj );
+ }
// append additional text
ScGlobal::AddToken( aNoteText, rAddText, '\n', 2 );
maOrigNoteText = aNoteText;
diff --git a/sc/source/ui/unoobj/notesuno.cxx b/sc/source/ui/unoobj/notesuno.cxx
index 321e8d4..f766312 100644
--- a/sc/source/ui/unoobj/notesuno.cxx
+++ b/sc/source/ui/unoobj/notesuno.cxx
@@ -57,16 +57,20 @@
#include <svx/svditer.hxx>
#include <svx/svdpage.hxx>
#include <com/sun/star/drawing/XShapeDescriptor.hpp>
+#include <editeng/unoprnms.hxx>
using namespace com::sun::star;
//------------------------------------------------------------------------
-// keine Properties fuer Text in Notizen
const SvxItemPropertySet* lcl_GetAnnotationPropertySet()
{
static SfxItemPropertyMapEntry aAnnotationPropertyMap_Impl[] =
{
+ SVX_UNOEDIT_CHAR_PROPERTIES,
+ SVX_UNOEDIT_FONT_PROPERTIES,
+ SVX_UNOEDIT_PARA_PROPERTIES,
+ SVX_UNOEDIT_NUMBERING_PROPERTIE, // for completeness of service ParagraphProperties
{0,0,0,0,0,0}
};
static SvxItemPropertySet aAnnotationPropertySet_Impl( aAnnotationPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
commit 26edd0d746a57cd7353c0931dbd4e604abe52b22
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 18:16:07 2010 +0200
Merged ooxml-sc-internal-hlink-export.diff from ooo-build
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index d55042d..215d5d2 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -456,7 +456,16 @@ XclExpHyperlink::XclExpHyperlink( const XclExpRoot& rRoot, const SvxURLField& rU
else if( rUrl.GetChar( 0 ) == '#' ) // hack for #89066#
{
String aTextMark( rUrl.Copy( 1 ) );
- aTextMark.SearchAndReplace( '.', '!' );
+
+ xub_StrLen nSepPos = aTextMark.SearchAndReplace( '.', '!' );
+ String aSheetName( aTextMark.Copy(0, nSepPos));
+
+ if ( aSheetName.Search(' ') != STRING_NOTFOUND && aSheetName.GetChar(0) != '\'')
+ {
+ aTextMark.Insert('\'', nSepPos);
+ aTextMark.Insert('\'', 0);
+ }
+
mxTextMark.reset( new XclExpString( aTextMark, EXC_STR_FORCEUNICODE, 255 ) );
}
@@ -533,13 +542,15 @@ void XclExpHyperlink::WriteEmbeddedData( XclExpStream& rStrm )
void XclExpHyperlink::SaveXml( XclExpXmlStream& rStrm )
{
- OUString sId = rStrm.addRelation( rStrm.GetCurrentStream()->getOutputStream(),
+ OUString sId = msTarget.getLength() ? rStrm.addRelation( rStrm.GetCurrentStream()->getOutputStream(),
XclXmlUtils::ToOUString( "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" ),
msTarget,
- XclXmlUtils::ToOUString( "External" ) );
+ XclXmlUtils::ToOUString( "External" ) ) : OUString();
rStrm.GetCurrentStream()->singleElement( XML_hyperlink,
XML_ref, XclXmlUtils::ToOString( maScPos ).getStr(),
- FSNS( XML_r, XML_id ), XclXmlUtils::ToOString( sId ).getStr(),
+ FSNS( XML_r, XML_id ), sId.getLength()
+ ? XclXmlUtils::ToOString( sId ).getStr()
+ : NULL,
XML_location, mxTextMark.get() != NULL
? XclXmlUtils::ToOString( *mxTextMark ).getStr()
: NULL,
commit 47f4d561b5c44c239925edb84d242abfdb11f12e
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 18:12:42 2010 +0200
Merged ooxml-sc-showdropdown-fix.diff from ooo-build
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index e56ed9c..d55042d 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1162,7 +1162,8 @@ void XclExpDV::SaveXml( XclExpXmlStream& rStrm )
XML_operator, lcl_GetOperatorType( mnFlags ),
XML_prompt, XESTRING_TO_PSZ( maPromptText ),
XML_promptTitle, XESTRING_TO_PSZ( maPromptTitle ),
- XML_showDropDown, XclXmlUtils::ToPsz( ! ::get_flag( mnFlags, EXC_DV_SUPPRESSDROPDOWN ) ),
+ // showDropDown should have been showNoDropDown - check oox/xlsx import for details
+ XML_showDropDown, XclXmlUtils::ToPsz( ::get_flag( mnFlags, EXC_DV_SUPPRESSDROPDOWN ) ),
XML_showErrorMessage, XclXmlUtils::ToPsz( ::get_flag( mnFlags, EXC_DV_SHOWERROR ) ),
XML_showInputMessage, XclXmlUtils::ToPsz( ::get_flag( mnFlags, EXC_DV_SHOWPROMPT ) ),
XML_sqref, XclXmlUtils::ToOString( maScRanges ).getStr(),
commit 2969dce8a1ea07a30eedd4a59bf3f69a89a307ee
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 18:12:19 2010 +0200
Merged ooxml-sc-paneexport.cxx from ooo-build
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 8b63779..7791776 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -48,6 +48,7 @@
#include "compiler.hxx"
#include <../../ui/inc/docsh.hxx>
+#include <../../ui/inc/viewdata.hxx>
#include <excdoc.hxx>
#include <oox/core/tokens.hxx>
@@ -1120,6 +1121,10 @@ bool XclExpXmlStream::exportDocument() throw()
pShell->SetError( nError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
#endif
+ // Get the viewsettings before processing
+ if( pShell->GetViewData() )
+ pShell->GetViewData()->WriteExtOptions( mpRoot->GetExtDocOptions() );
+
OUString const workbook = CREATE_OUSTRING( "xl/workbook.xml" );
PushStream( CreateOutputStream( workbook, workbook,
Reference <XOutputStream>(),
commit e2fe8b83fad41cab0d0db9ca73adfa56b8fd918c
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 18:09:49 2010 +0200
Merged ooxml-sc-page-date.diff from ooo-build
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index b9d87fa..facfe89 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -361,6 +361,7 @@ Exc1904::Exc1904( ScDocument& rDoc )
{
Date* pDate = rDoc.GetFormatTable()->GetNullDate();
bVal = pDate ? (*pDate == Date( 1, 1, 1904 )) : FALSE;
+ bDateCompatibility = pDate ? !( *pDate == Date( 30, 12, 1899 )) : FALSE;
}
@@ -372,9 +373,21 @@ UINT16 Exc1904::GetNum( void ) const
void Exc1904::SaveXml( XclExpXmlStream& rStrm )
{
- rStrm.WriteAttributes(
+ bool bISOIEC = ( rStrm.getVersion() == oox::core::ISOIEC_29500_2008 );
+
+ if( bISOIEC )
+ {
+ rStrm.WriteAttributes(
+ XML_dateCompatibility, XclXmlUtils::ToPsz( bDateCompatibility ),
+ FSEND );
+ }
+
+ if( !bISOIEC || bDateCompatibility )
+ {
+ rStrm.WriteAttributes(
XML_date1904, XclXmlUtils::ToPsz( bVal ),
FSEND );
+ }
}
diff --git a/sc/source/filter/excel/xepage.cxx b/sc/source/filter/excel/xepage.cxx
index 9e30957..b91644c 100644
--- a/sc/source/filter/excel/xepage.cxx
+++ b/sc/source/filter/excel/xepage.cxx
@@ -97,25 +97,37 @@ XclExpSetup::XclExpSetup( const XclPageData& rPageData ) :
void XclExpSetup::SaveXml( XclExpXmlStream& rStrm )
{
- rStrm.GetCurrentStream()->singleElement( XML_pageSetup,
- XML_paperSize, OString::valueOf( (sal_Int32) mrData.mnPaperSize ).getStr(),
- XML_scale, OString::valueOf( (sal_Int32) mrData.mnScaling ).getStr(),
- XML_firstPageNumber, OString::valueOf( (sal_Int32) mrData.mnStartPage ).getStr(),
- XML_fitToWidth, OString::valueOf( (sal_Int32) mrData.mnFitToWidth ).getStr(),
- XML_fitToHeight, OString::valueOf( (sal_Int32) mrData.mnFitToHeight ).getStr(),
- XML_pageOrder, mrData.mbPrintInRows ? "overThenDown" : "downThenOver",
- XML_orientation, mrData.mbPortrait ? "portrait" : "landscape", // OOXTODO: "default"?
- XML_usePrinterDefaults, XclXmlUtils::ToPsz( !mrData.mbValid ),
- XML_blackAndWhite, XclXmlUtils::ToPsz( mrData.mbBlackWhite ),
- XML_draft, XclXmlUtils::ToPsz( mrData.mbDraftQuality ),
- XML_cellComments, mrData.mbPrintNotes ? "atEnd" : "none", // OOXTODO: "asDisplayed"?
- XML_useFirstPageNumber, XclXmlUtils::ToPsz( mrData.mbManualStart ),
- // OOXTODO: XML_errors, // == displayed|blank|dash|NA
- XML_horizontalDpi, OString::valueOf( (sal_Int32) mrData.mnHorPrintRes ).getStr(),
- XML_verticalDpi, OString::valueOf( (sal_Int32) mrData.mnVerPrintRes ).getStr(),
- XML_copies, OString::valueOf( (sal_Int32) mrData.mnCopies ).getStr(),
- // OOXTODO: devMode settings part RelationshipId: FSNS( XML_r, XML_id ),
- FSEND );
+ sax_fastparser::FastAttributeList* pAttrList=rStrm.GetCurrentStream()->createAttrList();
+ if( rStrm.getVersion() != oox::core::ISOIEC_29500_2008 ||
+ mrData.mnStrictPaperSize != EXC_PAPERSIZE_USER )
+ {
+ pAttrList->add( XML_paperSize, OString::valueOf( (sal_Int32) mrData.mnPaperSize ).getStr() );
+ }
+ else
+ {
+ pAttrList->add( XML_paperWidth, OString::valueOf( (sal_Int32) mrData.mnPaperWidth ).concat(OString("mm")).getStr() );
+ pAttrList->add( XML_paperHeight, OString::valueOf( (sal_Int32) mrData.mnPaperHeight ).concat(OString("mm")).getStr() );
+ // pAttrList->add( XML_paperUnits, "mm" );
+ }
+ pAttrList->add( XML_scale, OString::valueOf( (sal_Int32) mrData.mnScaling ).getStr() );
+ pAttrList->add( XML_firstPageNumber, OString::valueOf( (sal_Int32) mrData.mnStartPage ).getStr() );
+ pAttrList->add( XML_fitToWidth, OString::valueOf( (sal_Int32) mrData.mnFitToWidth ).getStr() );
+ pAttrList->add( XML_fitToHeight, OString::valueOf( (sal_Int32) mrData.mnFitToHeight ).getStr() );
+ pAttrList->add( XML_pageOrder, mrData.mbPrintInRows ? "overThenDown" : "downThenOver" );
+ pAttrList->add( XML_orientation, mrData.mbPortrait ? "portrait" : "landscape" ); // OOXTODO: "default"?
+ pAttrList->add( XML_usePrinterDefaults, XclXmlUtils::ToPsz( !mrData.mbValid ) );
+ pAttrList->add( XML_blackAndWhite, XclXmlUtils::ToPsz( mrData.mbBlackWhite ) );
+ pAttrList->add( XML_draft, XclXmlUtils::ToPsz( mrData.mbDraftQuality ) );
+ pAttrList->add( XML_cellComments, mrData.mbPrintNotes ? "atEnd" : "none" ); // OOXTODO: "asDisplayed"?
+ pAttrList->add( XML_useFirstPageNumber, XclXmlUtils::ToPsz( mrData.mbManualStart ) );
+ // OOXTODO: XML_errors, // == displayed|blank|dash|NA
+ pAttrList->add( XML_horizontalDpi, OString::valueOf( (sal_Int32) mrData.mnHorPrintRes ).getStr() );
+ pAttrList->add( XML_verticalDpi, OString::valueOf( (sal_Int32) mrData.mnVerPrintRes ).getStr() );
+ pAttrList->add( XML_copies, OString::valueOf( (sal_Int32) mrData.mnCopies ).getStr() );
+ // OOXTODO: devMode settings part RelationshipId: FSNS( XML_r, XML_id ),
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList > aAttrs(pAttrList);
+ rStrm.GetCurrentStream()->singleElement( XML_pageSetup, aAttrs );
}
void XclExpSetup::WriteBody( XclExpStream& rStrm )
diff --git a/sc/source/filter/excel/xlpage.cxx b/sc/source/filter/excel/xlpage.cxx
index 4af4828..6a68867 100644
--- a/sc/source/filter/excel/xlpage.cxx
+++ b/sc/source/filter/excel/xlpage.cxx
@@ -37,6 +37,7 @@
#include <editeng/brshitem.hxx>
#include "global.hxx"
#include "xlconst.hxx"
+#include <oox/core/xmlfilterbase.hxx>
// Paper size =================================================================
@@ -49,6 +50,8 @@ struct XclPaperSize
#define IN2TWIPS( v ) ((long)((v) * EXC_TWIPS_PER_INCH + 0.5))
#define MM2TWIPS( v ) ((long)((v) * EXC_TWIPS_PER_INCH / CM_PER_INCH / 10.0 + 0.5))
+#define TWIPS2MM( v ) ((long)((v - 0.5) / EXC_TWIPS_PER_INCH * CM_PER_INCH * 10.0))
+
static const XclPaperSize pPaperSizeTable[] =
{
@@ -190,6 +193,8 @@ void XclPageData::SetDefaults()
mfHdrLeftMargin = mfHdrRightMargin = XclTools::GetInchFromHmm( EXC_MARGIN_DEFAULT_HLR );
mfFtrLeftMargin = mfFtrRightMargin = XclTools::GetInchFromHmm( EXC_MARGIN_DEFAULT_FLR );
mnPaperSize = EXC_PAPERSIZE_DEFAULT;
+ mnPaperWidth = 0;
+ mnPaperHeight = 0;
mnCopies = 1;
mnStartPage = 0;
mnScaling = 100;
@@ -223,7 +228,7 @@ Size XclPageData::GetScPaperSize() const
return aSize;
}
-void XclPageData::SetScPaperSize( const Size& rSize, bool bPortrait )
+void XclPageData::SetScPaperSize( const Size& rSize, bool bPortrait, bool bStrictSize )
{
mbPortrait = bPortrait;
mnPaperSize = 0;
@@ -231,6 +236,20 @@ void XclPageData::SetScPaperSize( const Size& rSize, bool bPortrait )
long nHeight = bPortrait ? rSize.Height() : rSize.Width();
long nMaxWDiff = 80;
long nMaxHDiff = 50;
+
+ mnPaperWidth = TWIPS2MM( nWidth );
+ mnPaperHeight = TWIPS2MM( nHeight );
+ if( bStrictSize )
+ {
+ nMaxWDiff = 5;
+ nMaxHDiff = 5;
+ mnStrictPaperSize = EXC_PAPERSIZE_USER;
+ }
+ else
+ {
+ mnPaperSize = 0;
+ }
+
for( const XclPaperSize* pEntry = pPaperSizeTable; pEntry != STATIC_TABLE_END( pPaperSizeTable ); ++pEntry )
{
long nWDiff = Abs( pEntry->mnWidth - nWidth );
@@ -238,11 +257,18 @@ void XclPageData::SetScPaperSize( const Size& rSize, bool bPortrait )
if( ((nWDiff <= nMaxWDiff) && (nHDiff < nMaxHDiff)) ||
((nWDiff < nMaxWDiff) && (nHDiff <= nMaxHDiff)) )
{
- mnPaperSize = static_cast< sal_uInt16 >( pEntry - pPaperSizeTable );
+ sal_uInt16 nIndex = static_cast< sal_uInt16 >( pEntry - pPaperSizeTable );
+ if( !bStrictSize )
+ mnPaperSize = nIndex;
+ else
+ mnStrictPaperSize = mnPaperSize = nIndex;
+
nMaxWDiff = nWDiff;
nMaxHDiff = nHDiff;
}
}
+ if( !bStrictSize )
+ SetScPaperSize( rSize, bPortrait, sal_True );
}
// ============================================================================
diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx
index ba075e9..109a280 100644
--- a/sc/source/filter/inc/excrecds.hxx
+++ b/sc/source/filter/inc/excrecds.hxx
@@ -286,6 +286,8 @@ public:
virtual UINT16 GetNum( void ) const;
virtual void SaveXml( XclExpXmlStream& rStrm );
+private:
+ BOOL bDateCompatibility;
};
diff --git a/sc/source/filter/inc/xlpage.hxx b/sc/source/filter/inc/xlpage.hxx
index 4878ba9..ea5cfc4 100644
--- a/sc/source/filter/inc/xlpage.hxx
+++ b/sc/source/filter/inc/xlpage.hxx
@@ -89,6 +89,7 @@ const sal_uInt16 EXC_SETUP_STARTPAGE = 0x0080;
const sal_uInt16 EXC_SETUP_NOTES_END = 0x0200;
const sal_uInt16 EXC_PAPERSIZE_DEFAULT = 0;
+const sal_uInt16 EXC_PAPERSIZE_USER = 0xFFFF;
// ============================================================================
@@ -118,6 +119,9 @@ struct XclPageData : ScfNoCopy
double mfFtrLeftMargin; /// Left margin to footer.
double mfFtrRightMargin; /// Right margin to footer.
sal_uInt16 mnPaperSize; /// Index into paper size table.
+ sal_uInt16 mnStrictPaperSize; /// Same as papersize - but for ooxml (considering stricter dimensions)
+ sal_uInt16 mnPaperWidth; /// Paper Width in mm
+ sal_uInt16 mnPaperHeight; /// Paper Height in mm
sal_uInt16 mnCopies; /// Number of copies.
sal_uInt16 mnStartPage; /// Start page number.
sal_uInt16 mnScaling; /// Scaling in percent.
@@ -147,7 +151,7 @@ struct XclPageData : ScfNoCopy
/** Returns the real paper size (twips) from the paper size index and paper orientation. */
Size GetScPaperSize() const;
/** Sets the Excel paper size index and paper orientation from Calc paper size (twips). */
- void SetScPaperSize( const Size& rSize, bool bPortrait );
+ void SetScPaperSize( const Size& rSize, bool bPortrait, bool bStrict = sal_False );
};
// ============================================================================
commit ad17361f991e06ba2b48ba5bc806e1589488fa44
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 17:59:35 2010 +0200
Merged xlsx-shared-xlsx-export-perf-rowbuffer.diff from ooo-build
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 352b8e2..df1273f 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -1999,9 +1999,7 @@ void XclExpRow::SaveXml( XclExpXmlStream& rStrm )
XclExpRowBuffer::XclExpRowBuffer( const XclExpRoot& rRoot ) :
XclExpRoot( rRoot ),
maOutlineBfr( rRoot ),
- maDimensions( rRoot ),
- mpLastUsedRow( 0 ),
- mnLastUsedXclRow( 0 )
+ maDimensions( rRoot )
{
}
@@ -2019,63 +2017,34 @@ void XclExpRowBuffer::CreateRows( SCROW nFirstFreeScRow )
void XclExpRowBuffer::Finalize( XclExpDefaultRowData& rDefRowData, const ScfUInt16Vec& rColXFIndexes )
{
- size_t nPos, nSize;
-
// *** Finalize all rows *** ----------------------------------------------
GetProgressBar().ActivateFinalRowsSegment();
- // unused blank cell records will be removed
- for( nPos = 0, nSize = maRowList.GetSize(); nPos < nSize; ++nPos )
- maRowList.GetRecord( nPos )->Finalize( rColXFIndexes );
+ RowMap::iterator itr, itrBeg = maRowMap.begin(), itrEnd = maRowMap.end();
+ for (itr = itrBeg; itr != itrEnd; ++itr)
+ itr->second->Finalize(rColXFIndexes);
// *** Default row format *** ---------------------------------------------
typedef ::std::map< XclExpDefaultRowData, size_t > XclExpDefRowDataMap;
XclExpDefRowDataMap aDefRowMap;
- // find default row format for rows beyond used area
- sal_uInt32 nDefaultXclRow = maRowList.IsEmpty() ? 0 : (maRowList.GetLastRecord()->GetXclRow() + 1);
XclExpDefaultRowData aMaxDefData;
size_t nMaxDefCount = 0;
- /* #i30411# Files saved with SO7/OOo1.x with nonstandard default column
- formatting cause big Excel files, because all rows from row 1 to row
- 32000 are exported. Now, if the used area goes exactly to row 32000,
- ignore all rows >32000.
- #i59220# Tolerance of +-128 rows for inserted/removed rows. */
- if( (nDefaultXclRow < 31872) || (nDefaultXclRow > 32128) )
- {
- sal_uInt16 nLastXclRow = static_cast< sal_uInt16 >( GetMaxPos().Row() );
- if( nDefaultXclRow <= nLastXclRow )
- {
- // create a dummy ROW record and fill aMaxDefData
- XclExpRowOutlineBuffer aOutlineBfr( GetRoot() );
- XclExpRow aRow( GetRoot(), nLastXclRow, aOutlineBfr, true );
- aMaxDefData = XclExpDefaultRowData( aRow );
- aDefRowMap[ aMaxDefData ] = nMaxDefCount =
- static_cast< size_t >( nLastXclRow - nDefaultXclRow + 1 );
- }
- }
-
// only look for default format in existing rows, if there are more than unused
- nSize = maRowList.GetSize();
- if( nMaxDefCount < nSize )
+ for (itr = itrBeg; itr != itrEnd; ++itr)
{
- for( nPos = 0; nPos < nSize; ++nPos )
+ const RowRef& rRow = itr->second;
+ if (rRow->IsDefaultable())
{
- XclExpRowRef xRow = maRowList.GetRecord( nPos );
- /* Collect formats of unused rows (rows without cells), which are able
- to be defaulted (i.e. no explicit format or outline level). */
- if( xRow->IsDefaultable() )
+ XclExpDefaultRowData aDefData( *rRow );
+ size_t& rnDefCount = aDefRowMap[ aDefData ];
+ ++rnDefCount;
+ if( rnDefCount > nMaxDefCount )
{
- XclExpDefaultRowData aDefData( *xRow );
- size_t& rnDefCount = aDefRowMap[ aDefData ];
- ++rnDefCount;
- if( rnDefCount > nMaxDefCount )
- {
- nMaxDefCount = rnDefCount;
- aMaxDefData = aDefData;
- }
+ nMaxDefCount = rnDefCount;
+ aMaxDefData = aDefData;
}
}
}
@@ -2090,24 +2059,23 @@ void XclExpRowBuffer::Finalize( XclExpDefaultRowData& rDefRowData, const ScfUInt
sal_uInt32 nFirstUsedXclRow = SAL_MAX_UINT32;
sal_uInt32 nFirstFreeXclRow = 0;
- for( nPos = 0, nSize = maRowList.GetSize(); nPos < nSize; ++nPos )
+ for (itr = itrBeg; itr != itrEnd; ++itr)
{
- XclExpRowRef xRow = maRowList.GetRecord( nPos );
-
+ const RowRef& rRow = itr->second;
// disable unused rows
- xRow->DisableIfDefault( aMaxDefData );
+ rRow->DisableIfDefault( aMaxDefData );
// find used column range
- if( !xRow->IsEmpty() ) // empty rows return (0...0) as used range
+ if( !rRow->IsEmpty() ) // empty rows return (0...0) as used range
{
- nFirstUsedXclCol = ::std::min( nFirstUsedXclCol, xRow->GetFirstUsedXclCol() );
- nFirstFreeXclCol = ::std::max( nFirstFreeXclCol, xRow->GetFirstFreeXclCol() );
+ nFirstUsedXclCol = ::std::min( nFirstUsedXclCol, rRow->GetFirstUsedXclCol() );
+ nFirstFreeXclCol = ::std::max( nFirstFreeXclCol, rRow->GetFirstFreeXclCol() );
}
// find used row range
- if( xRow->IsEnabled() )
+ if( rRow->IsEnabled() )
{
- sal_uInt16 nXclRow = xRow->GetXclRow();
+ sal_uInt16 nXclRow = rRow->GetXclRow();
nFirstUsedXclRow = ::std::min< sal_uInt32 >( nFirstUsedXclRow, nXclRow );
nFirstFreeXclRow = ::std::max< sal_uInt32 >( nFirstFreeXclRow, nXclRow + 1 );
}
@@ -2128,27 +2096,29 @@ void XclExpRowBuffer::Save( XclExpStream& rStrm )
maDimensions.Save( rStrm );
// save in blocks of 32 rows, each block contains first all ROWs, then all cells
- size_t nSize = maRowList.GetSize();
- size_t nBlockStart = 0;
- sal_uInt16 nStartXclRow = (nSize == 0) ? 0 : maRowList.GetRecord( 0 )->GetXclRow();
+ size_t nSize = maRowMap.size();
+ RowMap::iterator itr, itrBeg = maRowMap.begin(), itrEnd = maRowMap.end();
+ RowMap::iterator itrBlkStart = maRowMap.begin(), itrBlkEnd = maRowMap.begin();
+ sal_uInt16 nStartXclRow = (nSize == 0) ? 0 : itrBeg->second->GetXclRow();
- while( nBlockStart < nSize )
+
+ for (itr = itrBeg; itr != itrEnd; ++itr)
{
// find end of row block
- size_t nBlockEnd = nBlockStart + 1;
- while( (nBlockEnd < nSize) && (maRowList.GetRecord( nBlockEnd )->GetXclRow() - nStartXclRow < EXC_ROW_ROWBLOCKSIZE) )
- ++nBlockEnd;
+ ++itrBlkEnd;
+ while( (itrBlkEnd != itrEnd) && (itrBlkEnd->second->GetXclRow() - nStartXclRow < EXC_ROW_ROWBLOCKSIZE) )
+ ++itrBlkEnd;
// write the ROW records
- size_t nPos;
- for( nPos = nBlockStart; nPos < nBlockEnd; ++nPos )
- maRowList.GetRecord( nPos )->Save( rStrm );
+ RowMap::iterator itRow;
+ for( itRow = itrBlkStart; itRow != itrBlkEnd; ++itRow )
+ itRow->second->Save( rStrm );
// write the cell records
- for( nPos = nBlockStart; nPos < nBlockEnd; ++nPos )
- maRowList.GetRecord( nPos )->WriteCellList( rStrm );
+ for( itRow = itrBlkStart; itRow != itrBlkEnd; ++itRow )
+ itRow->second->WriteCellList( rStrm );
- nBlockStart = nBlockEnd;
+ itrBlkStart = itrBlkEnd;
nStartXclRow += EXC_ROW_ROWBLOCKSIZE;
}
}
@@ -2156,23 +2126,22 @@ void XclExpRowBuffer::Save( XclExpStream& rStrm )
void XclExpRowBuffer::SaveXml( XclExpXmlStream& rStrm )
{
sal_Int32 nNonEmpty = 0;
-
- size_t nRows = maRowList.GetSize();
- for( size_t i = 0; i < nRows; ++i)
- if( maRowList.GetRecord( i )->IsEnabled() )
+ RowMap::iterator itr = maRowMap.begin(), itrEnd = maRowMap.end();
+ for (; itr != itrEnd; ++itr)
+ if (itr->second->IsEnabled())
++nNonEmpty;
- if( nNonEmpty == 0 )
+ if (nNonEmpty == 0)
{
rStrm.GetCurrentStream()->singleElement( XML_sheetData, FSEND );
+ return;
}
- else
- {
- sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
- rWorksheet->startElement( XML_sheetData, FSEND );
- maRowList.SaveXml( rStrm );
- rWorksheet->endElement( XML_sheetData );
- }
+
+ sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
+ rWorksheet->startElement( XML_sheetData, FSEND );
+ for (itr = maRowMap.begin(); itr != itrEnd; ++itr)
+ itr->second->SaveXml(rStrm);
+ rWorksheet->endElement( XML_sheetData );
}
XclExpDimensions* XclExpRowBuffer::GetDimensions()
@@ -2182,18 +2151,14 @@ XclExpDimensions* XclExpRowBuffer::GetDimensions()
XclExpRow& XclExpRowBuffer::GetOrCreateRow( sal_uInt16 nXclRow, bool bRowAlwaysEmpty )
{
- if( !mpLastUsedRow || (mnLastUsedXclRow != nXclRow) )
+ RowMap::iterator itr = maRowMap.find(nXclRow);
+ if (itr == maRowMap.end())
{
- // fill up missing ROW records
- // do not use sal_uInt16 for nFirstFreeXclRow, would cause loop in full sheets
- for( size_t nFirstFreeXclRow = maRowList.GetSize(); nFirstFreeXclRow <= nXclRow; ++nFirstFreeXclRow )
- maRowList.AppendNewRecord( new XclExpRow(
- GetRoot(), static_cast< sal_uInt16 >( nFirstFreeXclRow ), maOutlineBfr, bRowAlwaysEmpty ) );
-
- mpLastUsedRow = maRowList.GetRecord( nXclRow ).get();
- mnLastUsedXclRow = nXclRow;
+ RowRef p(new XclExpRow(GetRoot(), nXclRow, maOutlineBfr, bRowAlwaysEmpty));
+ ::std::pair<RowMap::iterator, bool> r = maRowMap.insert(RowMap::value_type(nXclRow, p));
+ itr = r.first;
}
- return *mpLastUsedRow;
+ return *itr->second;
}
// ============================================================================
@@ -2260,7 +2225,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) :
// range for cell iterator
SCCOL nLastIterScCol = nMaxScCol;
- SCROW nLastIterScRow = ulimit_cast< SCROW >( nLastUsedScRow + 128, nMaxScRow );
+ SCROW nLastIterScRow = ulimit_cast< SCROW >( nLastUsedScRow, nMaxScRow );
ScUsedAreaIterator aIt( &rDoc, nScTab, 0, 0, nLastIterScCol, nLastIterScRow );
// activate the correct segment and sub segment at the progress bar
diff --git a/sc/source/filter/inc/xetable.hxx b/sc/source/filter/inc/xetable.hxx
index ff20f56..c344ec2 100644
--- a/sc/source/filter/inc/xetable.hxx
+++ b/sc/source/filter/inc/xetable.hxx
@@ -38,6 +38,9 @@
#include "xeformula.hxx"
#include "xestyle.hxx"
+#include <boost/shared_ptr.hpp>
+#include <map>
+
/* ============================================================================
Export of cell tables including row and column description.
- Managing all used and formatted cells in a sheet.
@@ -980,14 +983,12 @@ private:
XclExpRow& GetOrCreateRow( sal_uInt16 nXclRow, bool bRowAlwaysEmpty );
private:
- typedef XclExpRecordList< XclExpRow > XclExpRowList;
- typedef XclExpRowList::RecordRefType XclExpRowRef;
+ typedef ::boost::shared_ptr<XclExpRow> RowRef;
+ typedef ::std::map<sal_uInt32, RowRef> RowMap;
- XclExpRowList maRowList; /// List of all ROW records.
+ RowMap maRowMap;
XclExpRowOutlineBuffer maOutlineBfr; /// Buffer for row outline groups.
XclExpDimensions maDimensions; /// DIMENSIONS record for used area.
- XclExpRow* mpLastUsedRow; /// Last used row for faster access.
- sal_uInt16 mnLastUsedXclRow; /// Last used row for faster access.
};
// ============================================================================
commit 230ed9ef8b6efb7ebc75b5e6d90e35cb680cad70
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 17:58:15 2010 +0200
Merged xlsx-shared-xlsx-export-no-more-svstream-sotstorage.diff from ooo-build
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index bf1569b..8b63779 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -1096,9 +1096,10 @@ bool XclExpXmlStream::exportDocument() throw()
{
ScDocShell* pShell = getDocShell();
ScDocument* pDoc = pShell->GetDocument();
- SfxMedium* pMedium = pShell->GetMedium();
- SvStream* pMediumStream = pMedium->GetOutStream();
- SotStorageRef rStorage = new SotStorage( pMediumStream, false );
+ // NOTE: Don't use SotStorage or SvStream any more, and never call
+ // SfxMedium::GetOutStream() anywhere in the xlsx export filter code!
+ // Instead, write via XOutputStream instance.
+ SotStorageRef rStorage = static_cast<SotStorage*>(NULL);
XclExpRootData aData( EXC_BIFF8, *pShell->GetMedium (), rStorage, *pDoc, RTL_TEXTENCODING_DONTKNOW );
aData.meOutput = EXC_OUTPUT_XML_2007;
@@ -1107,7 +1108,7 @@ bool XclExpXmlStream::exportDocument() throw()
mpRoot = &aRoot;
aRoot.GetOldRoot().pER = &aRoot;
aRoot.GetOldRoot().eDateiTyp = Biff8;
-
+#if 0 // FIXME: Re-write this block without using SotStorage.
if ( SvtFilterOptions* pOptions = SvtFilterOptions::Get() )
if ( pShell && pOptions->IsLoadExcelBasicStorage() )
if ( sal_uInt32 nError
@@ -1118,7 +1119,7 @@ bool XclExpXmlStream::exportDocument() throw()
{
pShell->SetError( nError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
}
-
+#endif
OUString const workbook = CREATE_OUSTRING( "xl/workbook.xml" );
PushStream( CreateOutputStream( workbook, workbook,
Reference <XOutputStream>(),
commit 41dce2a8e86caa9c2dff1e7b9da9246e4f258ad1
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 17:57:34 2010 +0200
Merged xlsx-shared-oox-calc-export-sotstorage-init.diff from ooo-build
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 5ee9cb7..bf1569b 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -54,6 +54,10 @@
#include <formula/grammar.hxx>
#include <oox/export/drawingml.hxx>
+#include <sfx2/docfile.hxx>
+#include <sfx2/objsh.hxx>
+#include <sfx2/app.hxx>
+
#define DEBUG_XL_ENCRYPTION 0
using ::com::sun::star::beans::PropertyValue;
@@ -1092,7 +1096,9 @@ bool XclExpXmlStream::exportDocument() throw()
{
ScDocShell* pShell = getDocShell();
ScDocument* pDoc = pShell->GetDocument();
- SotStorageRef rStorage = dynamic_cast <SotStorage*>( Reference<XStorage>( pShell->GetStorage() ).get() );
+ SfxMedium* pMedium = pShell->GetMedium();
+ SvStream* pMediumStream = pMedium->GetOutStream();
+ SotStorageRef rStorage = new SotStorage( pMediumStream, false );
XclExpRootData aData( EXC_BIFF8, *pShell->GetMedium (), rStorage, *pDoc, RTL_TEXTENCODING_DONTKNOW );
aData.meOutput = EXC_OUTPUT_XML_2007;
commit 68c780b3efc0afc65db44a50aea067cb606f4f90
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 17:56:46 2010 +0200
Merged xlsx-shared-oox-calc-export-export-pivot-content.diff from ooo-build
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index 2e6294f..9a1989a 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -740,6 +740,8 @@ void XclExpPivotCache::Save( XclExpStream& rStrm )
void XclExpPivotCache::SaveXml( XclExpXmlStream& rStrm )
{
DBG_ASSERT( mbValid, "XclExpPivotCache::Save - invalid pivot cache" );
+#ifdef XLSX_PIVOT_CACHE /* <pivotCache> without xl/pivotCaches/ cacheStream
+ results in a broken .xlsx */
sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
OUString sId = OUStringBuffer()
.appendAscii("rId")
@@ -758,6 +760,7 @@ void XclExpPivotCache::SaveXml( XclExpXmlStream& rStrm )
// create the pivot cache storage stream
// OOXTODO: WriteCacheStream();
rWorkbook->endElement( XML_pivotCache );
+#endif /* XLSX_PIVOT_CACHE */
}
// private --------------------------------------------------------------------
@@ -1871,12 +1874,15 @@ void XclExpPivotTableManager::WritePivotCaches( XclExpStream& rStrm )
void XclExpPivotTableManager::WritePivotCachesXml( XclExpXmlStream& rStrm )
{
+#ifdef XLSX_PIVOT_CACHE /* <pivotCache> without xl/pivotCaches/ cacheStream
+ results in a broken .xlsx */
if( maPCacheList.IsEmpty() )
return;
sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
rWorkbook->startElement( XML_pivotCaches, FSEND );
maPCacheList.SaveXml( rStrm );
rWorkbook->endElement( XML_pivotCaches );
+#endif /* XLSX_PIVOT_CACHE */
}
void XclExpPivotTableManager::WritePivotTables( XclExpStream& rStrm, SCTAB nScTab )
commit bd47174b3fcadda86fa6f568a90cdf97721d884f
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 17:55:59 2010 +0200
Merged xlsx-shared-xlsx-export-cell-style-max-builtin.diff from ooo-build
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 4c1814b..a4b3d36 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -2242,7 +2242,10 @@ void XclExpStyle::SaveXml( XclExpXmlStream& rStrm )
rStrm.GetCurrentStream()->singleElement( XML_cellStyle,
XML_name, sName.getStr(),
XML_xfId, OString::valueOf( nXFId ).getStr(),
- XML_builtinId, OString::valueOf( (sal_Int32) mnStyleId ).getStr(),
+/* mso-excel 2007 complains when it finds builtinId >= 55, it is not
+ * bothered by multiple 54 values. */
+#define CELL_STYLE_MAX_BUILTIN_ID 55
+ XML_builtinId, OString::valueOf( std::min( static_cast<sal_Int32>( CELL_STYLE_MAX_BUILTIN_ID - 1 ), static_cast <sal_Int32>( mnStyleId ) ) ).getStr(),
// OOXTODO: XML_iLevel,
// OOXTODO: XML_hidden,
XML_customBuiltin, XclXmlUtils::ToPsz( ! IsBuiltIn() ),
commit 469bdf8c402b8149f31a14698fec622c4e6f2ae1
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 17:55:23 2010 +0200
Merged xlsx-shared-xlsx-export-skip-auto-format.diff from ooo-build
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index 1d97d18..2e6294f 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -1399,7 +1399,9 @@ void XclExpPivotTable::SaveXml( XclExpXmlStream& rStrm )
XML_enableDrill, XclXmlUtils::ToPsz( maPTExtInfo.mnFlags & EXC_SXEX_DRILLDOWN ), // ???
// OOXTODO: XML_enableFieldProperties, [ SXEx fEnableFieldDialog (maPTExtInfo.mnFlags) ]
// OOXTODO: XML_preserveFormatting, [ SXEx fPreserveFormatting (maPTExtInfo.mnFlags) ]
- XML_useAutoFormatting,
+#if 0
+ // XML_useAutoFormatting, [???],
+#endif
// OOXTODO: XML_pageWrap, [ SXEx cWrapPage (maPTExtInfo.mnFlags) ]
// OOXTODO: XML_pageOverThenDown, [ SXEx fAcrossPageLay (maPTExtInfo.mnFlags) ]
// OOXTODO: XML_subtotalHiddenItems, [ SXEx fSubtotalHiddenPageItems (maPTExtInfo.mnFlags) ]
commit f6a7fcff8868858d50799af4320c45a8cb8b5c79
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 17:54:42 2010 +0200
Merged xlsx-shared-xlsx-export-simple-autofilter.diff from ooo-buil
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index 6285895..b9d87fa 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -843,6 +843,7 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab ) :
XclExpRoot( rRoot ),
pFilterMode( NULL ),
pFilterInfo( NULL )
+ , mbAutoFilter (false)
{
ScDBCollection& rDBColl = GetDatabaseRanges();
XclExpNameManager& rNameMgr = GetNameManager();
@@ -943,6 +944,9 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab ) :
if( !maFilterList.IsEmpty() )
pFilterMode = new XclExpFiltermode;
pFilterInfo = new XclExpAutofilterinfo( aRange.aStart, nColCnt );
+
+ if (maFilterList.IsEmpty () && !bConflict)
+ mbAutoFilter = true;
}
}
}
@@ -1000,7 +1004,7 @@ void ExcAutoFilterRecs::Save( XclExpStream& rStrm )
void ExcAutoFilterRecs::SaveXml( XclExpXmlStream& rStrm )
{
- if( maFilterList.IsEmpty() )
+ if( maFilterList.IsEmpty() && !mbAutoFilter )
return;
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
@@ -1008,7 +1012,8 @@ void ExcAutoFilterRecs::SaveXml( XclExpXmlStream& rStrm )
XML_ref, XclXmlUtils::ToOString( maRef ).getStr(),
FSEND );
// OOXTODO: XML_extLst, XML_sortState
- maFilterList.SaveXml( rStrm );
+ if( !maFilterList.IsEmpty() )
+ maFilterList.SaveXml( rStrm );
rWorksheet->endElement( XML_autoFilter );
}
diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx
index 4a99a7b..ba075e9 100644
--- a/sc/source/filter/inc/excrecds.hxx
+++ b/sc/source/filter/inc/excrecds.hxx
@@ -472,6 +472,7 @@ private:
XclExpFiltermode* pFilterMode;
XclExpAutofilterinfo* pFilterInfo;
ScRange maRef;
+ bool mbAutoFilter;
};
// ----------------------------------------------------------------------------
commit 5fced3b5d58afa378cce03c8937ff8c39d546ea1
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 17:53:56 2010 +0200
Merged xlsx-shared-xlsx-export-set-xml-2007-flavour.diff from ooo-build
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 4bdb0a4..5ee9cb7 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -1095,6 +1095,7 @@ bool XclExpXmlStream::exportDocument() throw()
SotStorageRef rStorage = dynamic_cast <SotStorage*>( Reference<XStorage>( pShell->GetStorage() ).get() );
XclExpRootData aData( EXC_BIFF8, *pShell->GetMedium (), rStorage, *pDoc, RTL_TEXTENCODING_DONTKNOW );
+ aData.meOutput = EXC_OUTPUT_XML_2007;
XclExpRoot aRoot( aData );
mpRoot = &aRoot;
commit 9db5edb4a753b684b99bf3bde060fd727b22d69a
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 17:51:38 2010 +0200
Merged xlsx-shared-xlsx-arabic-export-crash.diff from ooo-build
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 7e32694..352b8e2 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -899,7 +899,7 @@ void XclExpFormulaCell::SaveXml( XclExpXmlStream& rStrm )
rWorksheet->startElement( XML_f,
// OOXTODO: XML_t, ST_CellFormulaType
- XML_aca, XclXmlUtils::ToPsz( mxTokArr->IsVolatile() || (mxAddRec.is() && mxAddRec->IsVolatile()) ),
+ XML_aca, XclXmlUtils::ToPsz( (mxTokArr.is() && mxTokArr->IsVolatile()) || (mxAddRec.is() && mxAddRec->IsVolatile()) ),
// OOXTODO: XML_ref, ST_Ref
// OOXTODO: XML_dt2D, bool
// OOXTODO: XML_dtr, bool
commit 1f3075f834ea6b524b9e56992c24f82225db521d
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 17:50:08 2010 +0200
Merged xlsx-shared-xlsx-shared-import-and-export.diff from ooo-build
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index cc4cfce..1f8d6a6 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -781,19 +781,17 @@ void ExcDocument::Write( SvStream& rSvStrm )
pExpChangeTrack->Write();
}
-void ExcDocument::WriteXml( SvStream& rStrm )
+void ExcDocument::WriteXml( XclExpXmlStream& rStrm )
{
- XclExpXmlStream aStrm( ::comphelper::getProcessServiceFactory(), rStrm, GetRoot() );
-
SfxObjectShell* pDocShell = GetDocShell();
using namespace ::com::sun::star;
uno::Reference<document::XDocumentPropertiesSupplier> xDPS( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
- aStrm.exportDocumentProperties( xDocProps );
+ rStrm.exportDocumentProperties( xDocProps );
- sax_fastparser::FSHelperPtr& rWorkbook = aStrm.GetCurrentStream();
+ sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
rWorkbook->startElement( XML_workbook,
XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
FSNS(XML_xmlns, XML_r), "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
@@ -810,7 +808,7 @@ void ExcDocument::WriteXml( SvStream& rStrm )
{
InitializeSave();
- aHeader.WriteXml( aStrm );
+ aHeader.WriteXml( rStrm );
for( size_t nTab = 0, nTabCount = maTableList.GetSize(); nTab < nTabCount; ++nTab )
{
@@ -821,17 +819,17 @@ void ExcDocument::WriteXml( SvStream& rStrm )
xBoundsheet->SetStreamPos( aXclStrm.GetSvStreamPos() );
#endif
// write the table
- maTableList.GetRecord( nTab )->WriteXml( aStrm );
+ maTableList.GetRecord( nTab )->WriteXml( rStrm );
}
}
if( pExpChangeTrack )
- pExpChangeTrack->WriteXml( aStrm );
+ pExpChangeTrack->WriteXml( rStrm );
rWorkbook->endElement( XML_workbook );
rWorkbook.reset();
- aStrm.commitStorage();
+ rStrm.commitStorage();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx
index e4207f8..c4c8230 100644
--- a/sc/source/filter/excel/excel.cxx
+++ b/sc/source/filter/excel/excel.cxx
@@ -262,25 +262,10 @@ static FltError lcl_ExportExcelBiff( SfxMedium& rMedium, ScDocument *pDocument,
return eRet;
}
-static FltError lcl_ExportExcel2007Xml( SfxMedium& rMedium, ScDocument *pDocument,
- SvStream* pMedStrm, CharSet eNach )
-{
- SotStorageRef xRootStrg = (SotStorage*) 0;
-
- XclExpRootData aExpData( EXC_BIFF8, rMedium, xRootStrg, *pDocument, eNach );
- aExpData.meOutput = EXC_OUTPUT_XML_2007;
-
- ExportXml2007 aFilter( aExpData, *pMedStrm );
-
- FltError eRet = aFilter.Write();
-
- return eRet;
-}
-
FltError ScFormatFilterPluginImpl::ScExportExcel5( SfxMedium& rMedium, ScDocument *pDocument,
ExportFormatExcel eFormat, CharSet eNach )
{
- if( eFormat != ExpBiff5 && eFormat != ExpBiff8 && eFormat != Exp2007Xml )
+ if( eFormat != ExpBiff5 && eFormat != ExpBiff8 )
return eERR_NI;
// check the passed Calc document
@@ -295,8 +280,6 @@ FltError ScFormatFilterPluginImpl::ScExportExcel5( SfxMedium& rMedium, ScDocumen
FltError eRet = eERR_UNKN_BIFF;
if( eFormat == ExpBiff5 || eFormat == ExpBiff8 )
eRet = lcl_ExportExcelBiff( rMedium, pDocument, pMedStrm, eFormat == ExpBiff8, eNach );
- else if( eFormat == Exp2007Xml )
- eRet = lcl_ExportExcel2007Xml( rMedium, pDocument, pMedStrm, eNach );
return eRet;
}
diff --git a/sc/source/filter/excel/expop2.cxx b/sc/source/filter/excel/expop2.cxx
index 10db502..4e89ed0 100644
--- a/sc/source/filter/excel/expop2.cxx
+++ b/sc/source/filter/excel/expop2.cxx
@@ -148,60 +148,4 @@ ExportBiff8::ExportBiff8( XclExpRootData& rExpData, SvStream& rStrm ) :
ExportBiff8::~ExportBiff8()
{
}
-
-
-ExportXml2007::ExportXml2007( XclExpRootData& rExpData, SvStream& rStrm )
- : ExportTyp( rStrm, &rExpData.mrDoc, rExpData.meTextEnc )
- , XclExpRoot( rExpData )
-{
- pExcRoot = &GetOldRoot();
- pExcRoot->pER = this;
- pExcRoot->eDateiTyp = Biff8;
- pExcDoc = new ExcDocument( *this );
-}
-
-
-ExportXml2007::~ExportXml2007()
-{
- delete pExcDoc;
-}
-
-
-FltError ExportXml2007::Write()
-{
- SfxObjectShell* pDocShell = GetDocShell();
- DBG_ASSERT( pDocShell, "ExportXml2007::Write - no document shell" );
-
- SotStorageRef xRootStrg = GetRootStorage();
- DBG_ASSERT( xRootStrg.Is(), "ExportXml2007::Write - no root storage" );
-
- bool bWriteBasicCode = false;
- bool bWriteBasicStrg = false;
-
- if( SvtFilterOptions* pFilterOpt = SvtFilterOptions::Get() )
- {
- bWriteBasicCode = pFilterOpt->IsLoadExcelBasicCode();
- bWriteBasicStrg = pFilterOpt->IsLoadExcelBasicStorage();
- }
-
- if( pDocShell && xRootStrg.Is() && bWriteBasicStrg )
- {
- SvxImportMSVBasic aBasicImport( *pDocShell, *xRootStrg, bWriteBasicCode, bWriteBasicStrg );
- ULONG nErr = aBasicImport.SaveOrDelMSVBAStorage( TRUE, EXC_STORAGE_VBA_PROJECT );
- if( nErr != ERRCODE_NONE )
- pDocShell->SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
- }
-
- pExcDoc->ReadDoc(); // ScDoc -> ExcDoc
- pExcDoc->WriteXml( aOut ); // wechstreamen
-
- //! TODO: separate warnings for columns and sheets
- const XclExpAddressConverter& rAddrConv = GetAddressConverter();
- if( rAddrConv.IsColTruncated() || rAddrConv.IsRowTruncated() || rAddrConv.IsTabTruncated() )
- return SCWARN_EXPORT_MAXROW;
-
- return eERR_OK;
-}
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index 5f67972..4bdb0a4 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -47,6 +47,9 @@
#include "rangelst.hxx"
#include "compiler.hxx"
+#include <../../ui/inc/docsh.hxx>
+#include <excdoc.hxx>
+
#include <oox/core/tokens.hxx>
#include <formula/grammar.hxx>
#include <oox/export/drawingml.hxx>
@@ -54,14 +57,20 @@
#define DEBUG_XL_ENCRYPTION 0
using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::embed::XStorage;
using ::com::sun::star::io::XOutputStream;
using ::com::sun::star::io::XStream;
using ::com::sun::star::lang::XComponent;
using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::lang::XServiceInfo;
+using ::com::sun::star::lang::XSingleServiceFactory;
+using ::com::sun::star::registry::InvalidRegistryException;
+using ::com::sun::star::registry::XRegistryKey;
+using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::XInterface;
using ::rtl::OString;
using ::rtl::OUString;
using ::utl::OStreamWrapper;
@@ -951,29 +960,10 @@ sax_fastparser::FSHelperPtr XclXmlUtils::WriteFontData( sax_fastparser::FSHelper
// ============================================================================
-XclExpXmlStream::XclExpXmlStream( const Reference< XMultiServiceFactory >& rSMgr, SvStream& rStrm, const XclExpRoot& rRoot )
- : XmlFilterBase( rSMgr )
- , mrRoot( rRoot )
+XclExpXmlStream::XclExpXmlStream( const Reference< XMultiServiceFactory >& rSMgr )
+ : XmlFilterBase( rSMgr ),
+ mpRoot( NULL )
{
- Sequence< PropertyValue > aArgs( 1 );
- const OUString sStream( RTL_CONSTASCII_USTRINGPARAM( "StreamForOutput" ) );
- aArgs[0].Name = sStream;
- aArgs[0].Value <<= Reference< XStream > ( new OStreamWrapper( rStrm ) );
-
- XServiceInfo* pInfo = rRoot.GetDocModelObj();
- Reference< XComponent > aComponent( pInfo, UNO_QUERY );
- setSourceDocument( aComponent );
- filter( aArgs );
-
- PushStream( CreateOutputStream(
- OUString::createFromAscii( "xl/workbook.xml" ),
- OUString::createFromAscii( "xl/workbook.xml" ),
- Reference< XOutputStream >(),
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
- "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" ) );
-
- DrawingML::ResetCounters();
- XclObjList::ResetCounters();
}
XclExpXmlStream::~XclExpXmlStream()
@@ -1086,14 +1076,57 @@ oox::drawingml::chart::ChartConverter& XclExpXmlStream::getChartConverter()
return * (oox::drawingml::chart::ChartConverter*) NULL;
}
-bool XclExpXmlStream::exportDocument() throw()
+ScDocShell* XclExpXmlStream::getDocShell()
{
- return false;
+ Reference< XInterface > xModel( getModel(), UNO_QUERY );
+
+ ScModelObj *pObj = dynamic_cast < ScModelObj* >( xModel.get() );
+
+ if ( pObj )
+ return reinterpret_cast < ScDocShell* >( pObj->GetEmbeddedObject() );
+
+ return 0;
}
-::rtl::OUString XclExpXmlStream::implGetImplementationName() const
+bool XclExpXmlStream::exportDocument() throw()
{
- return CREATE_OUSTRING( "TODO" );
+ ScDocShell* pShell = getDocShell();
+ ScDocument* pDoc = pShell->GetDocument();
+ SotStorageRef rStorage = dynamic_cast <SotStorage*>( Reference<XStorage>( pShell->GetStorage() ).get() );
+
+ XclExpRootData aData( EXC_BIFF8, *pShell->GetMedium (), rStorage, *pDoc, RTL_TEXTENCODING_DONTKNOW );
+ XclExpRoot aRoot( aData );
+
+ mpRoot = &aRoot;
+ aRoot.GetOldRoot().pER = &aRoot;
+ aRoot.GetOldRoot().eDateiTyp = Biff8;
+
+ if ( SvtFilterOptions* pOptions = SvtFilterOptions::Get() )
+ if ( pShell && pOptions->IsLoadExcelBasicStorage() )
+ if ( sal_uInt32 nError
+ = SvxImportMSVBasic( *pShell, *rStorage,
+ pOptions->IsLoadExcelBasicCode(),
+ pOptions->IsLoadExcelBasicStorage() )
+ .SaveOrDelMSVBAStorage( true, EXC_STORAGE_VBA_PROJECT) )
+ {
+ pShell->SetError( nError, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
+ }
+
+ OUString const workbook = CREATE_OUSTRING( "xl/workbook.xml" );
+ PushStream( CreateOutputStream( workbook, workbook,
+ Reference <XOutputStream>(),
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" ) );
+
+ // destruct at the end of the block
+ {
+ ExcDocument aDocRoot( aRoot );
+ aDocRoot.ReadDoc();
+ aDocRoot.WriteXml( *this );
+ }
+
+ mpRoot = NULL;
+ return true;
}
void XclExpXmlStream::Trace( const char* format, ...)
@@ -1104,4 +1137,99 @@ void XclExpXmlStream::Trace( const char* format, ...)
va_end( ap );
}
+//////////////////////////////////////////////////////////////////////////
+// UNO stuff so that the filter is registered
+//////////////////////////////////////////////////////////////////////////
+
+#define IMPL_NAME "com.sun.star.comp.oox.ExcelFilterExport"
+
+OUString XlsxExport_getImplementationName()
+{
+ return OUString( RTL_CONSTASCII_USTRINGPARAM( IMPL_NAME ) );
+}
+
+::rtl::OUString XclExpXmlStream::implGetImplementationName() const
+{
+ return CREATE_OUSTRING( "TODO" );
+}
+
+
+Sequence< OUString > SAL_CALL XlsxExport_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.ExportFilter" ) );
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+Reference< XInterface > SAL_CALL XlsxExport_createInstance(const Reference< XMultiServiceFactory > & rSMgr ) throw( Exception )
+{
+ return (cppu::OWeakObject*) new XclExpXmlStream( rSMgr );
+}
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
+{
+ *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+}
+
+SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo( void* /* pServiceManager */, void* pRegistryKey )
+{
+ sal_Bool bRet = sal_False;
+
+ if( pRegistryKey )
+ {
+ try
+ {
+ Reference< XRegistryKey > xNewKey1(
+ static_cast< XRegistryKey* >( pRegistryKey )->createKey(
+ OUString::createFromAscii( IMPL_NAME "/UNO/SERVICES/" ) ) );
+ xNewKey1->createKey( XlsxExport_getSupportedServiceNames().getConstArray()[0] );
+
+ bRet = sal_True;
+ }
+ catch( InvalidRegistryException& )
+ {
+ OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
+ }
+ }
+
+ return bRet;
+}
+
+// ------------------------
+// - component_getFactory -
+// ------------------------
+
+SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
+{
+ Reference< XSingleServiceFactory > xFactory;
+ void* pRet = 0;
+
+ if ( rtl_str_compare( pImplName, IMPL_NAME ) == 0 )
+ {
+ const OUString aServiceName( OUString::createFromAscii( IMPL_NAME ) );
+
+ xFactory = Reference< XSingleServiceFactory >( ::cppu::createSingleFactory(
+ reinterpret_cast< XMultiServiceFactory* >( pServiceManager ),
+ XlsxExport_getImplementationName(),
+ XlsxExport_createInstance,
+ XlsxExport_getSupportedServiceNames() ) );
+ }
+
+ if ( xFactory.is() )
+ {
+ xFactory->acquire();
+ pRet = xFactory.get();
+ }
+
+ return pRet;
+}
+
+#ifdef __cplusplus
+}
+#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/inc/excdoc.hxx b/sc/source/filter/inc/excdoc.hxx
index a05305d..25687f2 100644
--- a/sc/source/filter/inc/excdoc.hxx
+++ b/sc/source/filter/inc/excdoc.hxx
@@ -110,7 +110,7 @@ public:
void ReadDoc( void );
void Write( SvStream& rSvStrm );
- void WriteXml( SvStream& rSvStrm );
+ void WriteXml( XclExpXmlStream& );
};
diff --git a/sc/source/filter/inc/exp_op.hxx b/sc/source/filter/inc/exp_op.hxx
index a115c7b..6a8c150 100644
--- a/sc/source/filter/inc/exp_op.hxx
+++ b/sc/source/filter/inc/exp_op.hxx
@@ -127,21 +127,6 @@ public:
};
-class ExportXml2007 : public ExportTyp, protected XclExpRoot
-{
-private:
- ExcDocument* pExcDoc;
-
-protected:
- RootData* pExcRoot;
-
-public:
- ExportXml2007( XclExpRootData& rExpData, SvStream& rStrm );
- virtual ~ExportXml2007();
- FltError Write();
-};
-
-
#endif
diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx
index 0cf6e4c..87cff88 100644
--- a/sc/source/filter/inc/xestream.hxx
+++ b/sc/source/filter/inc/xestream.hxx
@@ -257,6 +257,7 @@ private:
(s.Len() && s.GetChar( 0 ) != 0 ? XclXmlUtils::ToOString( s ).getStr() : NULL)
class ScAddress;
+class ScDocShell;
class ScDocument;
class ScFormulaCell;
class ScRange;
@@ -305,11 +306,11 @@ public:
class XclExpXmlStream : public oox::core::XmlFilterBase
{
public:
- XclExpXmlStream( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr, SvStream& rStrm, const XclExpRoot& rRoot );
+ XclExpXmlStream( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr );
virtual ~XclExpXmlStream();
/** Returns the filter root data. */
- inline const XclExpRoot& GetRoot() const { return mrRoot; }
+ inline const XclExpRoot& GetRoot() const { return *mpRoot; }
sax_fastparser::FSHelperPtr& GetCurrentStream();
void PushStream( sax_fastparser::FSHelperPtr aStream );
@@ -341,12 +342,13 @@ public:
void Trace( const char* format, ...);
private:
virtual ::rtl::OUString implGetImplementationName() const;
+ ScDocShell *getDocShell();
typedef std::map< ::rtl::OUString,
std::pair< ::rtl::OUString,
sax_fastparser::FSHelperPtr > > XclExpXmlPathToStateMap;
- const XclExpRoot& mrRoot; /// Filter root data.
+ const XclExpRoot* mpRoot;
std::stack< sax_fastparser::FSHelperPtr > maStreams;
XclExpXmlPathToStateMap maOpenedStreamMap;
};
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 6c3a98e..a4c5ea4 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -172,7 +172,6 @@ static const sal_Char __FAR_DATA pFilterExcel95[] = "MS Excel 95";
static const sal_Char __FAR_DATA pFilterEx95Temp[] = "MS Excel 95 Vorlage/Template";
static const sal_Char __FAR_DATA pFilterExcel97[] = "MS Excel 97";
static const sal_Char __FAR_DATA pFilterEx97Temp[] = "MS Excel 97 Vorlage/Template";
-static const sal_Char __FAR_DATA pFilterEx07Xml[] = "Calc MS Excel 2007 XML";
static const sal_Char __FAR_DATA pFilterDBase[] = "dBase";
static const sal_Char __FAR_DATA pFilterDif[] = "DIF";
static const sal_Char __FAR_DATA pFilterSylk[] = "SYLK";
@@ -2091,8 +2090,7 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
}
else if (aFltName.EqualsAscii(pFilterExcel5) || aFltName.EqualsAscii(pFilterExcel95) ||
aFltName.EqualsAscii(pFilterExcel97) || aFltName.EqualsAscii(pFilterEx5Temp) ||
- aFltName.EqualsAscii(pFilterEx95Temp) || aFltName.EqualsAscii(pFilterEx97Temp) ||
- aFltName.EqualsAscii(pFilterEx07Xml))
+ aFltName.EqualsAscii(pFilterEx95Temp) || aFltName.EqualsAscii(pFilterEx97Temp))
{
WaitObject aWait( GetActiveDialogParent() );
@@ -2134,8 +2132,6 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
ExportFormatExcel eFormat = ExpBiff5;
if( aFltName.EqualsAscii( pFilterExcel97 ) || aFltName.EqualsAscii( pFilterEx97Temp ) )
eFormat = ExpBiff8;
- if( aFltName.EqualsAscii( pFilterEx07Xml ) )
- eFormat = Exp2007Xml;
FltError eError = ScFormatFilter::Get().ScExportExcel5( rMed, &aDocument, eFormat, RTL_TEXTENCODING_MS_1252 );
if( eError && !GetError() )
diff --git a/sc/util/scfilt.map b/sc/util/scfilt.map
index 642b8db..ea169e1 100644
--- a/sc/util/scfilt.map
+++ b/sc/util/scfilt.map
@@ -1,6 +1,9 @@
UDK_3_0_0 {
global:
ScFilterCreate;
+ component_getImplementationEnvironment;
+ component_writeInfo;
+ component_getFactory;
local:
*;
};
commit d96bc3bf83a539526c783825f569c82f9147bcc7
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Wed Oct 13 17:44:47 2010 +0200
Merged xlsx-shared-xlsx-snapshot.diff from ooo-build
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index 0245521..cc4cfce 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -85,6 +85,8 @@
#include <math.h>
+#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <oox/core/tokens.hxx>
using ::rtl::OString;
@@ -120,27 +122,22 @@ static void lcl_AddCalcPr( XclExpRecordList<>& aRecList, ExcTable& self )
aRecList.AppendNewRecord( new XclExpXmlEndSingleElementRecord() ); // XML_calcPr
}
-#if 0
-// removed during rebase, because scsheetprotection02 is not yet up-stream :-(
static void lcl_AddWorkbookProtection( XclExpRecordList<>& aRecList, ExcTable& self )
{
aRecList.AppendNewRecord( new XclExpXmlStartSingleElementRecord( XML_workbookProtection ) );
+
const ScDocProtection* pProtect = self.GetDoc().GetDocProtection();
if (pProtect && pProtect->isProtected())
{
aRecList.AppendNewRecord( new XclExpWindowProtection(pProtect->isOptionEnabled(ScDocProtection::WINDOWS)) );
aRecList.AppendNewRecord( new XclExpProtection(pProtect->isOptionEnabled(ScDocProtection::STRUCTURE)) );
+#if ENABLE_SHEET_PROTECTION
aRecList.AppendNewRecord( new XclExpPassHash(pProtect->getPasswordHash(PASSHASH_XL)) );
+#endif
}
- if( self.GetBiff() == EXC_BIFF8 )
- {
- aRecList.AppendNewRecord( new XclExpProt4Rev );
- aRecList.AppendNewRecord( new XclExpProt4RevPass );
- }
aRecList.AppendNewRecord( new XclExpXmlEndSingleElementRecord() ); // XML_workbookProtection
}
-#endif
static void lcl_AddScenariosAndFilters( XclExpRecordList<>& aRecList, const XclExpRoot& rRoot, SCTAB nScTab )
{
@@ -268,30 +265,25 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList )
}
// document protection options
- const ScDocProtection* pProtect = GetDoc().GetDocProtection();
- if (pProtect && pProtect->isProtected())
+ if( GetOutput() == EXC_OUTPUT_BINARY )
{
- Add( new XclExpWindowProtection(pProtect->isOptionEnabled(ScDocProtection::WINDOWS)) );
- Add( new XclExpProtection(pProtect->isOptionEnabled(ScDocProtection::STRUCTURE)) );
-#if ENABLE_SHEET_PROTECTION
- Add( new XclExpPassHash(pProtect->getPasswordHash(PASSHASH_XL)) );
-#endif
- }
+ lcl_AddWorkbookProtection( aRecList, *this );
- if( GetBiff() == EXC_BIFF8 )
- {
- Add( new XclExpProt4Rev );
- Add( new XclExpProt4RevPass );
- }
+ if( GetBiff() == EXC_BIFF8 )
+ {
+ Add( new XclExpProt4Rev );
+ Add( new XclExpProt4RevPass );
+ }
- // document protection options
- if( GetOutput() == EXC_OUTPUT_BINARY )
- {
- //lcl_AddWorkbookProtection( aRecList, *this );
lcl_AddBookviews( aRecList, *this );
}
Add( new XclExpXmlStartSingleElementRecord( XML_workbookPr ) );
+ if ( GetBiff() == EXC_BIFF8 && GetOutput() != EXC_OUTPUT_BINARY )
+ {
+ Add( new XclExpBoolRecord(0x0040, false, XML_backupFile ) ); // BACKUP
+ Add( new XclExpBoolRecord(0x008D, false, XML_showObjects ) ); // HIDEOBJ
+ }
if ( GetBiff() == EXC_BIFF8 )
{
@@ -375,7 +367,7 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList )
if( GetOutput() != EXC_OUTPUT_BINARY )
{
- //lcl_AddWorkbookProtection( aRecList, *this );
+ lcl_AddWorkbookProtection( aRecList, *this );
lcl_AddBookviews( aRecList, *this );
}
@@ -636,6 +628,9 @@ void ExcTable::FillAsXmlTable( SCTAB nCodeNameIdx )
}
}
+ // all MSODRAWING and OBJ stuff of this sheet goes here
+ aRecList.AppendRecord( GetObjectManager().ProcessDrawing( GetSdrPage( mnScTab ) ) );
+
// EOF
Add( new ExcEof );
}
@@ -788,25 +783,33 @@ void ExcDocument::Write( SvStream& rSvStrm )
void ExcDocument::WriteXml( SvStream& rStrm )
{
+ XclExpXmlStream aStrm( ::comphelper::getProcessServiceFactory(), rStrm, GetRoot() );
+
+ SfxObjectShell* pDocShell = GetDocShell();
+
+ using namespace ::com::sun::star;
+ uno::Reference<document::XDocumentPropertiesSupplier> xDPS( pDocShell->GetModel(), uno::UNO_QUERY_THROW );
+ uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
+
+ aStrm.exportDocumentProperties( xDocProps );
+
+ sax_fastparser::FSHelperPtr& rWorkbook = aStrm.GetCurrentStream();
+ rWorkbook->startElement( XML_workbook,
+ XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
+ FSNS(XML_xmlns, XML_r), "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
+ FSEND );
+ rWorkbook->singleElement( XML_fileVersion,
+ XML_appName, "Calc",
+ // OOXTODO: XML_codeName
+ // OOXTODO: XML_lastEdited
+ // OOXTODO: XML_lowestEdited
+ // OOXTODO: XML_rupBuild
+ FSEND );
+
if( !maTableList.IsEmpty() )
{
InitializeSave();
- XclExpXmlStream aStrm( ::comphelper::getProcessServiceFactory(), rStrm, GetRoot() );
-
- sax_fastparser::FSHelperPtr& rWorkbook = aStrm.GetCurrentStream();
- rWorkbook->startElement( XML_workbook,
- XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
- FSNS(XML_xmlns, XML_r), "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
- FSEND );
- rWorkbook->singleElement( XML_fileVersion,
- XML_appName, "Calc",
- // OOXTODO: XML_codeName
- // OOXTODO: XML_lastEdited
- // OOXTODO: XML_lowestEdited
- // OOXTODO: XML_rupBuild
- FSEND );
-
aHeader.WriteXml( aStrm );
for( size_t nTab = 0, nTabCount = maTableList.GetSize(); nTab < nTabCount; ++nTab )
@@ -820,15 +823,15 @@ void ExcDocument::WriteXml( SvStream& rStrm )
// write the table
maTableList.GetRecord( nTab )->WriteXml( aStrm );
}
-
- rWorkbook->endElement( XML_workbook );
- rWorkbook.reset();
- aStrm.commitStorage();
}
-#if 0
+
if( pExpChangeTrack )
- pExpChangeTrack->WriteXml();
-#endif
+ pExpChangeTrack->WriteXml( aStrm );
+
+ rWorkbook->endElement( XML_workbook );
+ rWorkbook.reset();
+
+ aStrm.commitStorage();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index e37fb20..6285895 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -155,6 +155,10 @@ void ExcRecord::WriteBody( XclExpStream& rStrm )
SaveCont( rStrm );
}
+void ExcRecord::SaveXml( XclExpXmlStream& rStrm )
+{
+}
+
//--------------------------------------------------------- class ExcEmptyRec -
diff --git a/sc/source/filter/excel/expop2.cxx b/sc/source/filter/excel/expop2.cxx
index e018710..10db502 100644
--- a/sc/source/filter/excel/expop2.cxx
+++ b/sc/source/filter/excel/expop2.cxx
@@ -195,20 +195,6 @@ FltError ExportXml2007::Write()
pExcDoc->ReadDoc(); // ScDoc -> ExcDoc
pExcDoc->WriteXml( aOut ); // wechstreamen
- if( pDocShell && xRootStrg.Is() )
- {
- using namespace ::com::sun::star;
- uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
- pDocShell->GetModel(), uno::UNO_QUERY_THROW);
- uno::Reference<document::XDocumentProperties> xDocProps
- = xDPS->getDocumentProperties();
- ::boost::shared_ptr<GDIMetaFile> pMetaFile =
- pDocShell->GetPreviewMetaFile (sal_False);
- uno::Sequence<sal_uInt8> metaFile(
- sfx2::convertMetaFile(pMetaFile.get()));
- sfx2::SaveOlePropertySet(xDocProps, xRootStrg, &metaFile);
- }
-
//! TODO: separate warnings for columns and sheets
const XclExpAddressConverter& rAddrConv = GetAddressConverter();
if( rAddrConv.IsColTruncated() || rAddrConv.IsRowTruncated() || rAddrConv.IsTabTruncated() )
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index e46c4af..fcb7e20 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -69,6 +69,7 @@
#include "svx/unoapi.hxx"
#include <oox/core/tokens.hxx>
+#include <oox/export/drawingml.hxx>
using ::rtl::OString;
using ::rtl::OUString;
@@ -90,6 +91,7 @@ using ::com::sun::star::form::binding::XListEntrySource;
using ::com::sun::star::script::ScriptEventDescriptor;
using ::com::sun::star::table::CellAddress;
using ::com::sun::star::table::CellRangeAddress;
+using ::oox::drawingml::DrawingML;
// Escher client anchor =======================================================
@@ -298,6 +300,17 @@ void XclExpImgData::Save( XclExpStream& rStrm )
}
}
+void XclExpImgData::SaveXml( XclExpXmlStream& rStrm )
+{
+ sax_fastparser::FSHelperPtr pWorksheet = rStrm.GetCurrentStream();
+
+ DrawingML aDML( pWorksheet, &rStrm, DrawingML::DOCUMENT_XLSX );
+ OUString rId = aDML.WriteImage( maGraphic );
+ pWorksheet->singleElement( XML_picture,
+ FSNS( XML_r, XML_id ), XclXmlUtils::ToOString( rId ).getStr(),
+ FSEND );
+}
+
// ============================================================================
XclExpControlHelper::XclExpControlHelper( const XclExpRoot& rRoot ) :
@@ -1004,7 +1017,7 @@ XclExpNote::XclExpNote( const XclExpRoot& rRoot, const ScAddress& rScPos,
if( pScNote )
if( SdrCaptionObj* pCaption = pScNote->GetOrCreateCaption( maScPos ) )
if( const OutlinerParaObject* pOPO = pCaption->GetOutlinerParaObject() )
- mnObjId = rRoot.GetObjectManager().AddObj( new XclObjComment( rRoot.GetObjectManager(), pCaption->GetLogicRect(), pOPO->GetTextObject(), pCaption, mbVisible ) );
+ mnObjId = rRoot.GetObjectManager().AddObj( new XclObjComment( rRoot.GetObjectManager(), pCaption->GetLogicRect(), pOPO->GetTextObject(), pCaption, mbVisible, maScPos ) );
SetRecSize( 9 + maAuthor.GetSize() );
}
@@ -1089,9 +1102,14 @@ void XclExpNote::WriteXml( sal_Int32 nAuthorId, XclExpXmlStream& rStrm )
FSEND );
rComments->startElement( XML_text, FSEND );
// OOXTODO: phoneticPr, rPh, r
+#if 0
rComments->startElement( XML_t, FSEND );
rComments->writeEscaped( XclXmlUtils::ToOUString( maOrigNoteText ) );
rComments->endElement ( XML_t );
+#else
+ if( mpNoteContents.is() )
+ mpNoteContents->WriteXml( rStrm );
+#endif
rComments->endElement( XML_text );
rComments->endElement( XML_comment );
}
@@ -1173,7 +1191,7 @@ struct OUStringLess : public std::binary_function<OUString, OUString, bool>
{
bool operator()(const OUString& x, const OUString& y) const
{
- return x.compareTo( y ) <= 0;
+ return x.compareTo( y ) < 0;
}
};
diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx
index 42f2c08..0d2056a 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -563,7 +563,7 @@ sal_uInt16 XclExpNameManagerImpl::CreateName( const ScRangeData& rRangeData )
xName->SetTokenArray( xTokArr );
String sSymbol;
- rRangeData.GetSymbol( sSymbol, formula::FormulaGrammar::GRAM_NATIVE_XL_A1 );
+ rRangeData.GetSymbol( sSymbol, formula::FormulaGrammar::GRAM_ENGLISH_XL_A1 );
xName->SetSymbol( sSymbol );
/* Try to replace by existing built-in name - complete token array is
diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index 7b09f06..1d97d18 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -1346,6 +1346,147 @@ void XclExpPivotTable::Save( XclExpStream& rStrm )
}
}
+void XclExpPivotTable::SaveXml( XclExpXmlStream& rStrm )
+{
+ if( !mbValid )
+ return;
+ sax_fastparser::FSHelperPtr aPivotTableDefinition = rStrm.CreateOutputStream(
+ XclXmlUtils::GetStreamName( "xl/", "pivotTables/pivotTable", mnOutScTab+1),
+ XclXmlUtils::GetStreamName( "../", "pivotTables/pivotTable", mnOutScTab+1),
+ rStrm.GetCurrentStream()->getOutputStream(),
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml",
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable");
+ rStrm.PushStream( aPivotTableDefinition );
+
+ aPivotTableDefinition->startElement( XML_pivotTableDefinition,
+ XML_xmlns, "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
+ XML_name, XclXmlUtils::ToOString( maPTInfo.maTableName ).getStr(),
+ XML_cacheId, OString::valueOf( (sal_Int32) maPTInfo.mnCacheIdx ).getStr(),
+ XML_dataOnRows, XclXmlUtils::ToPsz( maPTInfo.mnDataAxis == EXC_SXVD_AXIS_COL ),
+ XML_dataPosition, OString::valueOf( (sal_Int32) maPTInfo.mnDataPos ).getStr(),
+ XML_autoFormatId, OString::valueOf( (sal_Int32) maPTInfo.mnAutoFmtIdx ).getStr(),
+ // OOXTODO: XML_applyNumberFormats, [ SXVIEW fAtrNum (maPTInfo.mnFlags) ]
+ // OOXTODO: XML_applyBorderFormats, [ SXVIEW fAtrBdr (maPTInfo.mnFlags) ]
+ // OOXTODO: XML_applyFontFormats, [ SXVIEW fAtrFnt (maPTInfo.mnFlags) ]
+ // OOXTODO: XML_applyPatternFormats, [ SXVIEW fAtrPat (maPTInfo.mnFlags) ]
+ // OOXTODO: XML_applyAlignmentFormats, [ SXVIEW fAtrAlc (maPTInfo.mnFlags) ]
+ // OOXTODO: XML_applyWidthHeightFormats, [ SXVIEW fAtrProc (maPTInfo.mnFlags) ]
+ XML_dataCaption, XclXmlUtils::ToOString( maPTInfo.maDataName ).getStr(),
+ // OOXTODO: XML_grandTotalCaption, [ SxViewEx9 chGrand ]
+ // OOXTODO: XML_errorCaption, [ SXEx stError ]
+ // OOXTODO: XML_showError, [ SXEx fDisplayErrorString ]
+ // OOXTODO: XML_missingCaption, [ SXEx stDisplayNull ]
+ // OOXTODO: XML_showMissing, [ SXEx fDisplayNullString ]
+ // OOXTODO: XML_pageStyle, [ SXEx stPageFieldStyle ]
+ // OOXTODO: XML_pivotTableStyle, [ SXEx stTableStyle ]
+ // OOXTODO: XML_vacatedStyle, [ SXEx stVacateStyle ]
+ // OOXTODO: XML_tag, [ SXEx stTag ]
+ // OOXTODO: XML_updatedVersion, [ app-dependent ]
+ // OOXTODO: XML_minRefreshableVersion, [ app-dependent ]
+ // OOXTODO: XML_asteriskTotals, [ QsiSXTag/SXView9Save fHideTotAnnotation ]
+ // OOXTODO: XML_showItems, [ ??? ]
+ // OOXTODO: XML_editData, [ ??? ]
+ // OOXTODO: XML_disableFieldList, [ SXEx fEnableFieldDialog? ]
+ // OOXTODO: XML_showCalcMbrs, [ ??? ]
+ // OOXTODO: XML_visualTotals, [ ??? ]
+ // OOXTODO: XML_showMultipleLabel, [ SXEx fMergeLabels? ]
+ // OOXTODO: XML_showDataDropDown, [ SXEx fEnableDrillDown? ]
+ // OOXTODO: XML_showDrill, [ ??? ]
+ // OOXTODO: XML_printDrill, [ ??? ]
+ // OOXTODO: XML_showMemberPropertyTips,
+ // OOXTODO: XML_showDataTips,
+ // OOXTODO: XML_enableWizard,
+ XML_enableDrill, XclXmlUtils::ToPsz( maPTExtInfo.mnFlags & EXC_SXEX_DRILLDOWN ), // ???
+ // OOXTODO: XML_enableFieldProperties, [ SXEx fEnableFieldDialog (maPTExtInfo.mnFlags) ]
+ // OOXTODO: XML_preserveFormatting, [ SXEx fPreserveFormatting (maPTExtInfo.mnFlags) ]
+ XML_useAutoFormatting,
+ // OOXTODO: XML_pageWrap, [ SXEx cWrapPage (maPTExtInfo.mnFlags) ]
+ // OOXTODO: XML_pageOverThenDown, [ SXEx fAcrossPageLay (maPTExtInfo.mnFlags) ]
+ // OOXTODO: XML_subtotalHiddenItems, [ SXEx fSubtotalHiddenPageItems (maPTExtInfo.mnFlags) ]
+ XML_rowGrandTotals, XclXmlUtils::ToPsz( maPTInfo.mnFlags & EXC_SXVIEW_ROWGRAND ),
+ XML_colGrandTotals, XclXmlUtils::ToPsz( maPTInfo.mnFlags & EXC_SXVIEW_COLGRAND ),
+ // OOXTODO: XML_fieldPrintTitles,
+ // OOXTODO: XML_itemPrintTitles,
+ // OOXTODO: XML_mergeItem,
+ // OOXTODO: XML_showDropZones,
+ // OOXTODO: XML_createdVersion,
+ // OOXTODO: XML_indent,
+ // OOXTODO: XML_showEmptyRow,
+ // OOXTODO: XML_showEmptyCol,
+ // OOXTODO: XML_showHeaders,
+ // OOXTODO: XML_compact,
+ // OOXTODO: XML_outline,
+ // OOXTODO: XML_outlineData,
+ // OOXTODO: XML_compactData,
+ // OOXTODO: XML_published,
+ // OOXTODO: XML_gridDropZones,
+ // OOXTODO: XML_immersive,
+ // OOXTODO: XML_multipleFieldFilters,
+ // OOXTODO: XML_chartFormat,
+ // OOXTODO: XML_rowHeaderCaption,
+ // OOXTODO: XML_colHeaderCaption,
+ // OOXTODO: XML_fieldListSortAscending,
+ // OOXTODO: XML_mdxSubqueries,
+ // OOXTODO: XML_customListSort,
+ FSEND );
+
+ aPivotTableDefinition->singleElement( XML_location,
+ XML_ref, XclXmlUtils::ToOString( maPTInfo.maOutXclRange ).getStr(),
+ XML_firstHeaderRow, OString::valueOf( (sal_Int32) maPTInfo.mnFirstHeadRow ).getStr(),
+ XML_firstDataRow, OString::valueOf( (sal_Int32) maPTInfo.maDataXclPos.mnRow ).getStr(),
+ XML_firstDataCol, OString::valueOf( (sal_Int32) maPTInfo.maDataXclPos.mnCol ).getStr(),
+ XML_rowPageCount, OString::valueOf( (sal_Int32) maPTInfo.mnDataRows ).getStr(), // OOXTODO?
+ XML_colPageCount, OString::valueOf( (sal_Int32) maPTInfo.mnDataCols ).getStr(), // OOXTODO?
+ FSEND );
+
+ // OOXTODO: XML_pivotFields
+
+ // maPTInfo.mnFields?
+ if( maPTInfo.mnRowFields )
+ {
+ aPivotTableDefinition->startElement( XML_rowFields,
+ XML_count, OString::valueOf( (sal_Int32) maPTInfo.mnRowFields ).getStr(),
+ FSEND );
+ aPivotTableDefinition->endElement( XML_rowFields );
+ }
+
+ // OOXTODO: XML_rowItems
+
+ if( maPTInfo.mnColFields )
+ {
+ aPivotTableDefinition->startElement( XML_colFields,
+ XML_count, OString::valueOf( (sal_Int32) maPTInfo.mnColFields ).getStr(),
+ FSEND );
+ aPivotTableDefinition->endElement( XML_colFields );
+ }
+
+ // OOXTODO: XML_colItems
+
+ if( maPTInfo.mnPageFields )
+ {
+ aPivotTableDefinition->startElement( XML_pageFields,
+ XML_count, OString::valueOf( (sal_Int32) maPTInfo.mnPageFields ).getStr(),
+ FSEND );
+ aPivotTableDefinition->endElement( XML_pageFields );
+ }
+
+ if( maPTInfo.mnDataFields )
+ {
+ aPivotTableDefinition->startElement( XML_dataFields,
+ XML_count, OString::valueOf( (sal_Int32) maPTInfo.mnDataFields ).getStr(),
+ FSEND );
+ aPivotTableDefinition->endElement( XML_dataFields );
+ }
+
+ // OOXTODO: XML_formats, XML_conditionalFormats, XML_chartFormats,
+ // XML_pivotHierarchies, XML_pivotTableStyleInfo, XML_filters,
+ // XML_rowHierarchiesUsage, XML_colHierarchiesUsage, XML_ext
+
+ aPivotTableDefinition->endElement( XML_pivotTableDefinition );
+
+ rStrm.PopStream();
+}
+
// private --------------------------------------------------------------------
XclExpPTField* XclExpPivotTable::GetFieldAcc( const String& rName )
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index d666c38..5f67972 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -43,11 +43,13 @@
#include "xlstring.hxx"
#include "xeroot.hxx"
#include "xestyle.hxx"
+#include "xcl97rec.hxx"
#include "rangelst.hxx"
#include "compiler.hxx"
#include <oox/core/tokens.hxx>
#include <formula/grammar.hxx>
+#include <oox/export/drawingml.hxx>
#define DEBUG_XL_ENCRYPTION 0
@@ -644,6 +646,70 @@ void XclExpBiff8Encrypter::EncryptBytes( SvStream& rStrm, vector<sal_uInt8>& aBy
mnOldPos = nStrmPos;
}
+static const char* lcl_GetErrorString( USHORT nScErrCode )
+{
+ sal_uInt8 nXclErrCode = XclTools::GetXclErrorCode( nScErrCode );
+ switch( nXclErrCode )
+ {
+ case EXC_ERR_NULL: return "#NULL!";
+ case EXC_ERR_DIV0: return "#DIV/0!";
+ case EXC_ERR_VALUE: return "#VALUE!";
+ case EXC_ERR_REF: return "#REF!";
+ case EXC_ERR_NAME: return "#NAME?";
+ case EXC_ERR_NUM: return "#NUM!";
+ case EXC_ERR_NA:
+ default: return "#N/A";
+ }
+}
+
+void XclXmlUtils::GetFormulaTypeAndValue( ScFormulaCell& rCell, const char*& rsType, OUString& rsValue )
+{
+ switch( rCell.GetFormatType() )
+ {
+ case NUMBERFORMAT_NUMBER:
+ {
+ // either value or error code
+ USHORT nScErrCode = rCell.GetErrCode();
+ if( nScErrCode )
+ {
+ rsType = "e";
+ rsValue = ToOUString( lcl_GetErrorString( nScErrCode ) );
+ }
+ else
+ {
+ rsType = "n";
+ rsValue = OUString::valueOf( rCell.GetValue() );
+ }
+ }
+ break;
+
+ case NUMBERFORMAT_TEXT:
+ {
+ rsType = "str";
+ String aResult;
+ rCell.GetString( aResult );
+ rsValue = ToOUString( aResult );
+ }
+ break;
+
+ case NUMBERFORMAT_LOGICAL:
+ {
+ rsType = "b";
+ rsValue = ToOUString( rCell.GetValue() == 0.0 ? "0" : "1" );
+ }
+ break;
+
+ default:
+ {
+ rsType = "inlineStr";
+ String aResult;
+ rCell.GetString( aResult );
+ rsValue = ToOUString( aResult );
+ }
+ break;
+ }
+}
+
rtl::OUString XclXmlUtils::GetStreamName( const char* sStreamDir, const char* sStream, sal_Int32 nId )
{
rtl::OUStringBuffer sBuf;
@@ -735,6 +801,11 @@ static ScRange lcl_ToRange( const XclRange& rRange )
return aRange;
}
+rtl::OString XclXmlUtils::ToOString( const XclRange& rRange )
+{
+ return ToOString( lcl_ToRange( rRange ) );
+}
+
rtl::OString XclXmlUtils::ToOString( const XclRangeList& rRanges )
{
ScRangeList aRanges;
@@ -767,7 +838,7 @@ OUString XclXmlUtils::ToOUString( const String& s )
rtl::OUString XclXmlUtils::ToOUString( ScDocument& rDocument, const ScAddress& rAddress, ScTokenArray* pTokenArray )
{
ScCompiler aCompiler( &rDocument, rAddress, *pTokenArray);
- aCompiler.SetGrammar(FormulaGrammar::GRAM_NATIVE_XL_A1);
+ aCompiler.SetGrammar(FormulaGrammar::GRAM_ENGLISH_XL_A1);
String s;
aCompiler.CreateStringFromTokenArray( s );
return ToOUString( s );
@@ -784,6 +855,100 @@ const char* XclXmlUtils::ToPsz( bool b )
return b ? "true" : "false";
}
+sax_fastparser::FSHelperPtr XclXmlUtils::WriteElement( sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, sal_Int32 nValue )
+{
+ pStream->startElement( nElement, FSEND );
+ pStream->write( nValue );
+ pStream->endElement( nElement );
+
+ return pStream;
+}
+
+sax_fastparser::FSHelperPtr XclXmlUtils::WriteElement( sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, sal_Int64 nValue )
+{
+ pStream->startElement( nElement, FSEND );
+ pStream->write( nValue );
+ pStream->endElement( nElement );
+
+ return pStream;
+}
+
+sax_fastparser::FSHelperPtr XclXmlUtils::WriteElement( sax_fastparser::FSHelperPtr pStream, sal_Int32 nElement, const char* sValue )
+{
+ pStream->startElement( nElement, FSEND );
+ pStream->write( sValue );
+ pStream->endElement( nElement );
+
+ return pStream;
+}
+
+static void lcl_WriteValue( sax_fastparser::FSHelperPtr& rStream, sal_Int32 nElement, const char* pValue )
+{
+ if( !pValue )
+ return;
+ rStream->singleElement( nElement,
+ XML_val, pValue,
+ FSEND );
+}
+
+static const char* lcl_GetUnderlineStyle( FontUnderline eUnderline, bool& bHaveUnderline )
+{
+ bHaveUnderline = true;
+ switch( eUnderline )
+ {
+ // OOXTODO: doubleAccounting, singleAccounting
+ // OOXTODO: what should be done with the other FontUnderline values?
+ case UNDERLINE_SINGLE: return "single";
+ case UNDERLINE_DOUBLE: return "double";
+ case UNDERLINE_NONE:
+ default: bHaveUnderline = false; return "none";
+ }
+}
+
+static const char* lcl_ToVerticalAlignmentRun( SvxEscapement eEscapement, bool& bHaveAlignment )
+{
+ bHaveAlignment = true;
+ switch( eEscapement )
+ {
+ case SVX_ESCAPEMENT_SUPERSCRIPT: return "superscript";
+ case SVX_ESCAPEMENT_SUBSCRIPT: return "subscript";
+ case SVX_ESCAPEMENT_OFF:
+ default: bHaveAlignment = false; return "baseline";
+ }
+}
+
+sax_fastparser::FSHelperPtr XclXmlUtils::WriteFontData( sax_fastparser::FSHelperPtr pStream, const XclFontData& rFontData, sal_Int32 nFontId )
+{
+ bool bHaveUnderline, bHaveVertAlign;
+ const char* pUnderline = lcl_GetUnderlineStyle( rFontData.GetScUnderline(), bHaveUnderline );
+ const char* pVertAlign = lcl_ToVerticalAlignmentRun( rFontData.GetScEscapement(), bHaveVertAlign );
+
+ lcl_WriteValue( pStream, nFontId, XclXmlUtils::ToOString( rFontData.maName ).getStr() );
+ lcl_WriteValue( pStream, XML_charset, rFontData.mnCharSet != 0 ? OString::valueOf( (sal_Int32) rFontData.mnCharSet ).getStr() : NULL );
+ lcl_WriteValue( pStream, XML_family, OString::valueOf( (sal_Int32) rFontData.mnFamily ).getStr() );
+ lcl_WriteValue( pStream, XML_b, rFontData.mnWeight > 400 ? XclXmlUtils::ToPsz( rFontData.mnWeight > 400 ) : NULL );
+ lcl_WriteValue( pStream, XML_i, rFontData.mbItalic ? XclXmlUtils::ToPsz( rFontData.mbItalic ) : NULL );
+ lcl_WriteValue( pStream, XML_strike, rFontData.mbStrikeout ? XclXmlUtils::ToPsz( rFontData.mbStrikeout ) : NULL );
+ lcl_WriteValue( pStream, XML_outline, rFontData.mbOutline ? XclXmlUtils::ToPsz( rFontData.mbOutline ) : NULL );
+ lcl_WriteValue( pStream, XML_shadow, rFontData.mbShadow ? XclXmlUtils::ToPsz( rFontData.mbShadow ) : NULL );
+ // OOXTODO: lcl_WriteValue( rStream, XML_condense, ); // mac compatibility setting
+ // OOXTODO: lcl_WriteValue( rStream, XML_extend, ); // compatibility setting
+ if( rFontData.maColor != Color( 0xFF, 0xFF, 0xFF, 0xFF ) )
+ pStream->singleElement( XML_color,
+ // OOXTODO: XML_auto, bool
+ // OOXTODO: XML_indexed, uint
+ XML_rgb, XclXmlUtils::ToOString( rFontData.maColor ).getStr(),
+ // OOXTODO: XML_theme, index into <clrScheme/>
+ // OOXTODO: XML_tint, double
+ FSEND );
+ lcl_WriteValue( pStream, XML_sz, OString::valueOf( (double) (rFontData.mnHeight / 20.0) ) ); // Twips->Pt
+ lcl_WriteValue( pStream, XML_u, bHaveUnderline ? pUnderline : NULL );
+ lcl_WriteValue( pStream, XML_vertAlign, bHaveVertAlign ? pVertAlign : NULL );
+
+ return pStream;
+}
+
+
// ============================================================================
XclExpXmlStream::XclExpXmlStream( const Reference< XMultiServiceFactory >& rSMgr, SvStream& rStrm, const XclExpRoot& rRoot )
@@ -806,6 +971,9 @@ XclExpXmlStream::XclExpXmlStream( const Reference< XMultiServiceFactory >& rSMgr
Reference< XOutputStream >(),
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" ) );
+
+ DrawingML::ResetCounters();
+ XclObjList::ResetCounters();
}
XclExpXmlStream::~XclExpXmlStream()
@@ -868,75 +1036,6 @@ sax_fastparser::FSHelperPtr& XclExpXmlStream::WriteAttributes( sal_Int32 nAttrib
return rStream;
}
-
-static void lcl_WriteValue( sax_fastparser::FSHelperPtr& rStream, sal_Int32 nElement, const char* pValue )
-{
- if( !pValue )
- return;
- rStream->singleElement( nElement,
- XML_val, pValue,
- FSEND );
-}
-
-static const char* lcl_GetUnderlineStyle( FontUnderline eUnderline, bool& bHaveUnderline )
-{
- bHaveUnderline = true;
- switch( eUnderline )
- {
- // OOXTODO: doubleAccounting, singleAccounting
- // OOXTODO: what should be done with the other FontUnderline values?
- case UNDERLINE_SINGLE: return "single";
- case UNDERLINE_DOUBLE: return "double";
- case UNDERLINE_NONE:
- default: bHaveUnderline = false; return "none";
- }
-}
-
-static const char* lcl_ToVerticalAlignmentRun( SvxEscapement eEscapement, bool& bHaveAlignment )
-{
- bHaveAlignment = true;
- switch( eEscapement )
- {
- case SVX_ESCAPEMENT_SUPERSCRIPT: return "superscript";
- case SVX_ESCAPEMENT_SUBSCRIPT: return "subscript";
- case SVX_ESCAPEMENT_OFF:
- default: bHaveAlignment = false; return "baseline";
- }
-}
-
-sax_fastparser::FSHelperPtr& XclExpXmlStream::WriteFontData( const XclFontData& rFontData, sal_Int32 nFontId )
-{
- bool bHaveUnderline, bHaveVertAlign;
- const char* pUnderline = lcl_GetUnderlineStyle( rFontData.GetScUnderline(), bHaveUnderline );
- const char* pVertAlign = lcl_ToVerticalAlignmentRun( rFontData.GetScEscapement(), bHaveVertAlign );
-
- sax_fastparser::FSHelperPtr& rStream = GetCurrentStream();
-
- lcl_WriteValue( rStream, nFontId, XclXmlUtils::ToOString( rFontData.maName ).getStr() );
- lcl_WriteValue( rStream, XML_charset, rFontData.mnCharSet != 0 ? OString::valueOf( (sal_Int32) rFontData.mnCharSet ).getStr() : NULL );
- lcl_WriteValue( rStream, XML_family, OString::valueOf( (sal_Int32) rFontData.mnFamily ).getStr() );
- lcl_WriteValue( rStream, XML_b, rFontData.mnWeight > 400 ? XclXmlUtils::ToPsz( rFontData.mnWeight > 400 ) : NULL );
- lcl_WriteValue( rStream, XML_i, rFontData.mbItalic ? XclXmlUtils::ToPsz( rFontData.mbItalic ) : NULL );
- lcl_WriteValue( rStream, XML_strike, rFontData.mbStrikeout ? XclXmlUtils::ToPsz( rFontData.mbStrikeout ) : NULL );
- lcl_WriteValue( rStream, XML_outline, rFontData.mbOutline ? XclXmlUtils::ToPsz( rFontData.mbOutline ) : NULL );
- lcl_WriteValue( rStream, XML_shadow, rFontData.mbShadow ? XclXmlUtils::ToPsz( rFontData.mbShadow ) : NULL );
- // OOXTODO: lcl_WriteValue( rStream, XML_condense, ); // mac compatibility setting
- // OOXTODO: lcl_WriteValue( rStream, XML_extend, ); // compatibility setting
- if( rFontData.maColor != Color( 0xFF, 0xFF, 0xFF, 0xFF ) )
- rStream->singleElement( XML_color,
- // OOXTODO: XML_auto, bool
- // OOXTODO: XML_indexed, uint
- XML_rgb, XclXmlUtils::ToOString( rFontData.maColor ).getStr(),
- // OOXTODO: XML_theme, index into <clrScheme/>
- // OOXTODO: XML_tint, double
- FSEND );
- lcl_WriteValue( rStream, XML_sz, OString::valueOf( (double) (rFontData.mnHeight / 20.0) ) ); // Twips->Pt
- lcl_WriteValue( rStream, XML_u, bHaveUnderline ? pUnderline : NULL );
- lcl_WriteValue( rStream, XML_vertAlign, bHaveVertAlign ? pVertAlign : NULL );
-
- return rStream;
-}
-
sax_fastparser::FSHelperPtr XclExpXmlStream::CreateOutputStream (
const OUString& sFullStream,
const OUString& sRelativeStream,
diff --git a/sc/source/filter/excel/xestring.cxx b/sc/source/filter/excel/xestring.cxx
index 63fd3c8..b75bb2c 100644
--- a/sc/source/filter/excel/xestring.cxx
+++ b/sc/source/filter/excel/xestring.cxx
@@ -31,6 +31,8 @@
#include <algorithm>
#include <stdio.h>
+#include "xlstyle.hxx"
+#include "xestyle.hxx"
#include "xestream.hxx"
#include "xlstyle.hxx"
#include "xestyle.hxx"
@@ -453,7 +455,7 @@ static sal_uInt16 lcl_WriteRun( XclExpXmlStream& rStrm, const ScfUInt16Vec& rBuf
{
const XclFontData& rFontData = pFont->GetFontData();
rWorksheet->startElement( XML_rPr, FSEND );
- rStrm.WriteFontData( rFontData, XML_rFont );
+ XclXmlUtils::WriteFontData( rWorksheet, rFontData, XML_rFont );
rWorksheet->endElement( XML_rPr );
}
rWorksheet->startElement( XML_t,
@@ -462,7 +464,7 @@ static sal_uInt16 lcl_WriteRun( XclExpXmlStream& rStrm, const ScfUInt16Vec& rBuf
rWorksheet->writeEscaped( XclXmlUtils::ToOUString( rBuffer, nStart, nLength ) );
rWorksheet->endElement( XML_t );
rWorksheet->endElement( XML_r );
- return static_cast<sal_uInt16>(nStart + nLength);
+ return nStart + nLength;
}
void XclExpString::WriteXml( XclExpXmlStream& rStrm ) const
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 3f69d90..4c1814b 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -982,7 +982,7 @@ void XclExpFont::SaveXml( XclExpXmlStream& rStrm )
{
sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream();
rStyleSheet->startElement( XML_font, FSEND );
- rStrm.WriteFontData( maData, XML_name );
+ XclXmlUtils::WriteFontData( rStyleSheet, maData, XML_name );
// OOXTODO: XML_scheme; //scheme/@val values: "major", "minor", "none"
rStyleSheet->endElement( XML_font );
}
diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx
index 075e445..7e32694 100644
--- a/sc/source/filter/excel/xetable.cxx
+++ b/sc/source/filter/excel/xetable.cxx
@@ -883,76 +883,12 @@ void XclExpFormulaCell::Save( XclExpStream& rStrm )
mxStringRec->Save( rStrm );
}
-static const char* lcl_GetErrorString( USHORT nScErrCode )
-{
- sal_uInt8 nXclErrCode = XclTools::GetXclErrorCode( nScErrCode );
- switch( nXclErrCode )
- {
- case EXC_ERR_NULL: return "#NULL!";
- case EXC_ERR_DIV0: return "#DIV/0!";
- case EXC_ERR_VALUE: return "#VALUE!";
- case EXC_ERR_REF: return "#REF!";
- case EXC_ERR_NAME: return "#NAME?";
- case EXC_ERR_NUM: return "#NUM!";
- case EXC_ERR_NA:
- default: return "#N/A";
- }
-}
-
-static void lcl_GetFormulaInfo( ScFormulaCell& rCell, const char** pType, OUString& rValue)
-{
- switch( rCell.GetFormatType() )
- {
- case NUMBERFORMAT_NUMBER:
- {
- // either value or error code
- USHORT nScErrCode = rCell.GetErrCode();
- if( nScErrCode )
- {
- *pType = "e";
- rValue = XclXmlUtils::ToOUString( lcl_GetErrorString( nScErrCode ) );
- }
- else
- {
- *pType = "n";
- rValue = OUString::valueOf( rCell.GetValue() );
- }
- }
- break;
-
- case NUMBERFORMAT_TEXT:
- {
- *pType = "str";
- String aResult;
- rCell.GetString( aResult );
- rValue = XclXmlUtils::ToOUString( aResult );
- }
- break;
-
- case NUMBERFORMAT_LOGICAL:
- {
- *pType = "b";
- rValue = XclXmlUtils::ToOUString( rCell.GetValue() == 0.0 ? "0" : "1" );
- }
- break;
-
- default:
- {
- *pType = "inlineStr";
- String aResult;
- rCell.GetString( aResult );
- rValue = XclXmlUtils::ToOUString( aResult );
- }
- break;
- }
-}
-
void XclExpFormulaCell::SaveXml( XclExpXmlStream& rStrm )
{
const char* sType = NULL;
OUString sValue;
- lcl_GetFormulaInfo( mrScFmlaCell, &sType, sValue );
+ XclXmlUtils::GetFormulaTypeAndValue( mrScFmlaCell, sType, sValue );
sax_fastparser::FSHelperPtr& rWorksheet = rStrm.GetCurrentStream();
rWorksheet->startElement( XML_c,
XML_r, XclXmlUtils::ToOString( GetXclPos() ).getStr(),
diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx
index 24b723e..8e25c80 100644
--- a/sc/source/filter/inc/XclExpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclExpChangeTrack.hxx
@@ -238,6 +238,8 @@ public:
virtual UINT16 GetNum() const;
virtual sal_Size GetLen() const;
+
+ virtual void SaveXml( XclExpXmlStream& rStrm );
};
//___________________________________________________________________
@@ -247,6 +249,7 @@ class XclExpChTrInfo : public ExcRecord
{
private:
XclExpString sUsername;
+ sal_Int32 mnLogNumber;
DateTime aDateTime;
sal_uInt8 aGUID[ 16 ];
@@ -256,15 +259,19 @@ public:
inline XclExpChTrInfo(
const String& rUsername,
const DateTime& rDateTime,
- const sal_uInt8* pGUID );
+ const sal_uInt8* pGUID,
+ sal_Int32 nLogNumber );
virtual ~XclExpChTrInfo();
virtual UINT16 GetNum() const;
virtual sal_Size GetLen() const;
+
+ virtual void SaveXml( XclExpXmlStream& rStrm );
};
-inline XclExpChTrInfo::XclExpChTrInfo( const String& rUsername, const DateTime& rDateTime, const sal_uInt8* pGUID ) :
+inline XclExpChTrInfo::XclExpChTrInfo( const String& rUsername, const DateTime& rDateTime, const sal_uInt8* pGUID, sal_Int32 nLogNumber ) :
sUsername( rUsername ),
+ mnLogNumber( nLogNumber ),
aDateTime( rDateTime )
{
memcpy( aGUID, pGUID, 16 );
@@ -322,6 +329,7 @@ class XclExpChTrTabId : public ExcRecord
private:
sal_uInt16* pBuffer;
sal_uInt16 nTabCount;
+ bool mbInRevisionHeaders;
inline void Clear() { if( pBuffer ) delete[] pBuffer; pBuffer = NULL; }
@@ -329,14 +337,16 @@ private:
public:
inline XclExpChTrTabId( sal_uInt16 nCount ) :
- pBuffer( NULL ), nTabCount( nCount ) {}
- XclExpChTrTabId( const XclExpChTrTabIdBuffer& rBuffer );
+ pBuffer( NULL ), nTabCount( nCount ), mbInRevisionHeaders( false ) {}
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list