summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2009-04-22 10:06:26 +0000
committerIvo Hinkelmann <ihi@openoffice.org>2009-04-22 10:06:26 +0000
commit0554b3bf93e56f8304529a93d961fa3fa60c199d (patch)
tree9f72e55aa3310502de84f74c4db5764559338d53 /oox
parentf9ce9a1d243d8a4e550b8f9aea92246c21ad6a73 (diff)
CWS-TOOLING: integrate CWS dr67
2009-04-08 13:23:56 +0200 dr r270638 : #i100534# reverted 2009-04-08 10:14:55 +0200 dr r270621 : CWS-TOOLING: rebase CWS dr67 to trunk@270033 (milestone: DEV300:m45) 2009-04-07 21:06:33 +0200 dr r270610 : #i100534# sc does not link in debug mode 2009-03-12 11:20:09 +0100 dr r269375 : #i10000# wae 2009-03-11 19:43:55 +0100 dr r269351 : #i10000# adjust oox namespace ids according to oox/inc/oox/core/namespaces.hxx 2009-03-11 15:38:52 +0100 dr r269339 : CWS-TOOLING: rebase CWS dr67 to trunk@269297 (milestone: DEV300:m43) 2009-02-27 15:20:21 +0100 dr r268598 : CWS-TOOLING: rebase CWS dr67 to trunk@268395 (milestone: DEV300:m42) 2009-02-19 13:32:17 +0100 dr r268277 : moved hf parser into page settings 2009-02-19 12:25:15 +0100 dr r268272 : renamed some structs according to chart filter 2009-02-16 15:51:31 +0100 dr r267823 : #i97873# import autosort settings from BIFF8/OOBIN/OOXML 2009-02-06 17:09:29 +0100 dr r267477 : #i97873# minor changes 2009-02-06 16:38:56 +0100 dr r267473 : #i97873# import date grouping settings from BIFF5/BIFF8/OOBIN/OOXML 2009-02-06 16:38:11 +0100 dr r267472 : #i97873# check min/max/step of passed GroupInfo 2009-02-06 16:35:13 +0100 dr r267471 : #i97873# more doc for createDategroup() 2009-02-06 13:53:42 +0100 dr r267459 : #i97873# make XDataPilotGrouping::createDateGroup() implementation working and robust against wrong input data 2009-02-06 13:52:16 +0100 dr r267458 : #i97873# fix and extend IDL doc for datapilot grouping 2009-02-06 12:35:49 +0100 dr r267453 : fix other IDLC warnings in sheet module 2009-02-06 12:05:19 +0100 dr r267448 : #i97873# fix and extend IDL doc for datapilot grouping 2009-02-02 17:58:46 +0100 dr r267284 : #i10000# rebase errors 2009-02-02 17:52:21 +0100 dr r267282 : #i10000# rebase errors 2009-02-02 17:35:58 +0100 dr r267280 : #i10000# rebase errors 2009-02-02 15:58:04 +0100 dr r267274 : CWS-TOOLING: rebase CWS dr67 to trunk@267171 (milestone: DEV300:m41) 2009-02-02 09:16:32 +0100 dr r267247 : #i97873# typo 2009-01-30 17:09:09 +0100 dr r267215 : #i97873# import numeric grouping settings for datapilot fields from BIFF5/BIFF8/OOBIN/OOXML 2009-01-29 16:36:24 +0100 dr r267154 : #i97873# import datapilot discrete grouping from BIFF5/BIFF8/OOBIN/OOXLS 2009-01-29 16:33:37 +0100 dr r267152 : #i97873# do not kill _all_ the other group fields when writing back DataPilotField::GroupInfo property 2009-01-29 14:15:45 +0100 dr r267133 : #i93839# remove ScChengeTrack::Load and ::Store, adapt xls export filter 2009-01-28 13:30:37 +0100 dr r267056 : #i98397# enhance DataPilot API: allow to rename groups and items in a group field 2009-01-28 12:09:05 +0100 dr r267051 : #i98397# enhance DataPilot API: allow to rename groups and items in a group field 2009-01-27 16:13:58 +0100 dr r267005 : #i97873# minor changes in DataPilot API implementation as preparation for additional changes needed for OOX import filter 2009-01-27 10:08:01 +0100 dr r266961 : #i97873# changing orientation of a DP field moves it to last position in new dimension 2009-01-27 10:06:50 +0100 dr r266960 : #i97873# changing orientation of a DP field moves it to last position in new dimension 2009-01-23 12:52:31 +0100 dr r266808 : #i97873# DP documentation extended 2009-01-21 20:07:15 +0100 dr r266702 : #i97873# this trivial patch adds BIFF5/BIFF8 pivot table import to the oox filter 2009-01-20 16:06:23 +0100 dr r266592 : select BIFF filter via env.var 2009-01-16 18:51:01 +0100 dr r266452 : #i97873# import page fields 2009-01-16 15:05:36 +0100 dr r266420 : #i97873# field item settings (collapsed/hidden), settings of hidden fields 2009-01-15 16:01:17 +0100 dr r266377 : #i97873# import OOXML7/OOBIN7 autoshow settings 2009-01-14 15:24:27 +0100 dr r266310 : #i97873# import auto show settings generated by MSO2003 2009-01-14 12:29:44 +0100 dr r266281 : #i97873# set global dp settings 2009-01-13 15:04:30 +0100 dr r266229 : #i98029# SdrGroupObj does not remember predefined bounding rectangle anymore 2009-01-13 14:46:50 +0100 dr r266225 : #i98029# SdrGroupObj does not remember predefined bounding rectangle anymore 2009-01-12 15:04:22 +0100 dr r266161 : #i97873# remove misleading hasDataLayoutField() 2009-01-12 15:03:42 +0100 dr r266160 : #i97873# remove misleading hasDataLayoutField() 2009-01-12 14:57:33 +0100 dr r266159 : #i97900# reverted previous change, adjusted code to new EnableRTL() behaviour 2009-01-12 14:52:43 +0100 dr r266158 : #i97900# reverted previous change, adjusted code to new EnableRTL() behaviour 2009-01-09 16:34:55 +0100 dr r266098 : #i97900# RTL handling in TabBar changed with CWS rtlcontrols 2009-01-09 16:32:16 +0100 dr r266097 : #i97900# RTL handling in TabBar changed with CWS rtlcontrols 2009-01-09 12:02:39 +0100 dr r266072 : #i97623# RTL handling changed after CWS rtlcontrols 2009-01-09 09:48:53 +0100 dr r266050 : #i158444# SXLI must be filled completely before starting CONTINUE 2009-01-08 18:50:08 +0100 dr r266032 : #158444# allow to disable dump of record positions 2009-01-08 15:46:45 +0100 dr r266020 : #i97873# data layout field handling 2009-01-08 15:45:45 +0100 dr r266019 : #i97873# data layout field handling 2009-01-08 15:42:25 +0100 dr r266018 : #i97873# data layout field handling 2009-01-02 17:28:32 +0100 dr r265844 : #i10000# unxmacxi warning 2009-01-02 16:59:13 +0100 dr r265842 : #i10000# rebase corrections 2009-01-02 16:44:44 +0100 dr r265838 : #i10000# rebase corrections 2009-01-02 11:32:44 +0100 dr r265834 : CWS-TOOLING: rebase CWS dr67 to trunk@265758 (milestone: DEV300:m38) 2008-12-29 16:55:40 +0100 dr r265822 : more pivot table import, field layout settings 2008-12-29 14:27:35 +0100 dr r265817 : more pivot table import, additions for data field settings 2008-12-26 14:39:21 +0100 dr r265805 : updates 2008-12-19 16:31:39 +0100 dr r265734 : typo 2008-12-19 16:30:00 +0100 dr r265733 : add API for sequence of DP field subtotal functions 2008-12-19 16:29:43 +0100 dr r265732 : add API for sequence of DP field subtotal functions 2008-12-19 16:29:07 +0100 dr r265731 : add API for sequence of DP field subtotal functions 2008-12-18 18:07:58 +0100 dr r265710 : #i96758# try to cache row default formatting and apply it at row ranges instead of single rows 2008-12-18 16:00:25 +0100 dr r265698 : more additions to pivot import 2008-12-17 13:38:19 +0100 dr r265599 : do not assert HIDDEN orientation 2008-12-12 13:51:29 +0100 dr r265415 : minor typos 2008-12-12 10:15:04 +0100 dr r265394 : pivot cache import extended to XLSB, added creation of cache data for missing/external sheets 2008-12-04 13:16:16 +0100 dr r264837 : #i96860# remove old dumper files 2008-12-04 12:17:38 +0100 dr r264834 : #i96858# XTO broken, if textbox is empty but contains formatting 2008-12-04 12:16:38 +0100 dr r264833 : #i96858# XTO broken, if textbox is empty but contains formatting 2008-12-03 14:51:05 +0100 dr r264784 : #i10000# warnings 2008-12-03 14:32:46 +0100 dr r264778 : #i10000# warning 2008-12-03 11:28:38 +0100 dr r264758 : #i96758# ignore zero-sized objects 2008-12-03 10:09:34 +0100 dr r264748 : #i96758# change ::oox::Property(Set|Map) keys to sal_Int32 property identifiers, to save construction of property names 2008-12-01 16:09:02 +0100 dr r264615 : #i96758# headerdoc 2008-12-01 14:49:04 +0100 dr r264607 : #i96758# import performance of formatted documents 2008-11-26 17:08:15 +0100 dr r264424 : make it more simple 2008-11-26 16:31:41 +0100 dr r264419 : c:crossesAt is for crossing axis, not for own axis. This is different to BIFF 2008-11-26 13:55:55 +0100 dr r264382 : #i86346# import of MissingValueTreatment from XLSX 2008-11-26 12:49:38 +0100 dr r264370 : #i86346# import/export of MissingValueTreatment from/to XLS 2008-11-25 17:48:59 +0100 dr r264320 : update row height with single progress bar when using 'IsAdjustHeightEnabled' document property 2008-11-25 17:24:26 +0100 dr r264319 : #i96438# disable importing comment text until API is fixed 2008-11-25 17:11:30 +0100 dr r264318 : #i90124# set control tooltips, patch from npower 2008-11-25 15:09:28 +0100 dr r264309 : #i94028# #i94991# update drawing objects when changing row height 2008-11-24 15:21:35 +0100 dr r264224 : prevent ::rtl::OUString::copy assertion 2008-11-24 15:19:39 +0100 dr r264223 : #i95183# #158573# handle non-ascii characters in sheet names in OOXML import 2008-11-24 12:54:30 +0100 dr r264221 : #i94157# support ESC key to leave full-screen in page preview 2008-11-21 18:15:17 +0100 dr r264165 : #i90360# disable chart perspective if it is set to 0 2008-11-21 18:14:41 +0100 dr r264164 : #i90360# disable chart perspective if it is set to 0 2008-11-21 17:43:26 +0100 dr r264155 : #i96140# missing parenth 2008-11-21 17:36:35 +0100 dr r264154 : #i96438# first steps of note import 2008-11-20 15:15:03 +0100 dr r264059 : get rid of ContextWrapper 2008-11-18 11:39:52 +0100 dr r263755 : #i78476# moved to CWS dr67
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/oox/core/binarycodec.hxx2
-rw-r--r--oox/inc/oox/core/contexthandler2.hxx38
-rw-r--r--oox/inc/oox/core/fragmenthandler2.hxx4
-rw-r--r--oox/inc/oox/drawingml/chart/axiscontext.hxx12
-rw-r--r--oox/inc/oox/drawingml/chart/axisconverter.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/chartcontextbase.hxx2
-rw-r--r--oox/inc/oox/drawingml/chart/chartspacefragment.hxx2
-rw-r--r--oox/inc/oox/drawingml/chart/datasourcecontext.hxx6
-rw-r--r--oox/inc/oox/drawingml/chart/modelbase.hxx1
-rw-r--r--oox/inc/oox/drawingml/chart/plotareacontext.hxx6
-rw-r--r--oox/inc/oox/drawingml/chart/seriescontext.hxx30
-rw-r--r--oox/inc/oox/drawingml/chart/titlecontext.hxx8
-rw-r--r--oox/inc/oox/drawingml/chart/typegroupcontext.hxx18
-rw-r--r--oox/inc/oox/drawingml/fillproperties.hxx52
-rw-r--r--oox/inc/oox/drawingml/lineproperties.hxx46
-rw-r--r--oox/inc/oox/drawingml/themefragmenthandler.hxx2
-rw-r--r--oox/inc/oox/dump/biffdumper.hxx15
-rw-r--r--oox/inc/oox/dump/dumperbase.hxx1
-rw-r--r--oox/inc/oox/dump/xlsbdumper.hxx9
-rw-r--r--oox/inc/oox/helper/attributelist.hxx8
-rw-r--r--oox/inc/oox/helper/containerhelper.hxx111
-rw-r--r--oox/inc/oox/helper/propertymap.hxx67
-rw-r--r--oox/inc/oox/helper/propertysequence.hxx177
-rw-r--r--oox/inc/oox/helper/propertyset.hxx34
-rw-r--r--oox/inc/oox/ole/vbainputstream.hxx4
-rw-r--r--oox/inc/oox/ppt/timenode.hxx6
-rw-r--r--oox/inc/oox/xls/addressconverter.hxx119
-rw-r--r--oox/inc/oox/xls/autofiltercontext.hxx2
-rw-r--r--oox/inc/oox/xls/biffcodec.hxx86
-rw-r--r--oox/inc/oox/xls/biffhelper.hxx100
-rw-r--r--oox/inc/oox/xls/biffinputstream.hxx9
-rw-r--r--oox/inc/oox/xls/chartsheetfragment.hxx6
-rw-r--r--oox/inc/oox/xls/commentsbuffer.hxx105
-rw-r--r--oox/inc/oox/xls/commentsfragment.hxx77
-rw-r--r--oox/inc/oox/xls/condformatbuffer.hxx20
-rw-r--r--oox/inc/oox/xls/condformatcontext.hxx4
-rw-r--r--oox/inc/oox/xls/connectionsfragment.hxx3
-rw-r--r--oox/inc/oox/xls/defnamesbuffer.hxx28
-rw-r--r--oox/inc/oox/xls/drawingfragment.hxx78
-rw-r--r--oox/inc/oox/xls/excelfilter.hxx2
-rw-r--r--oox/inc/oox/xls/excelhandlers.hxx56
-rw-r--r--oox/inc/oox/xls/externallinkbuffer.hxx18
-rw-r--r--oox/inc/oox/xls/externallinkfragment.hxx14
-rw-r--r--oox/inc/oox/xls/formulabase.hxx18
-rw-r--r--oox/inc/oox/xls/numberformatsbuffer.hxx28
-rw-r--r--oox/inc/oox/xls/pagesettings.hxx37
-rw-r--r--oox/inc/oox/xls/pivotcachebuffer.hxx514
-rw-r--r--oox/inc/oox/xls/pivotcachefragment.hxx114
-rw-r--r--oox/inc/oox/xls/pivottablebuffer.hxx435
-rw-r--r--oox/inc/oox/xls/pivottablefragment.hxx72
-rw-r--r--oox/inc/oox/xls/querytablefragment.hxx6
-rw-r--r--oox/inc/oox/xls/richstring.hxx43
-rw-r--r--oox/inc/oox/xls/richstringcontext.hxx3
-rw-r--r--oox/inc/oox/xls/sharedformulabuffer.hxx1
-rw-r--r--oox/inc/oox/xls/sharedstringsfragment.hxx5
-rw-r--r--oox/inc/oox/xls/sheetcellrangemap.hxx88
-rw-r--r--oox/inc/oox/xls/sheetdatacontext.hxx12
-rw-r--r--oox/inc/oox/xls/stylesbuffer.hxx337
-rw-r--r--oox/inc/oox/xls/stylesfragment.hxx112
-rw-r--r--oox/inc/oox/xls/stylespropertyhelper.hxx272
-rw-r--r--oox/inc/oox/xls/tablebuffer.hxx35
-rw-r--r--oox/inc/oox/xls/tablefragment.hxx7
-rw-r--r--oox/inc/oox/xls/themebuffer.hxx8
-rw-r--r--oox/inc/oox/xls/unitconverter.hxx22
-rw-r--r--oox/inc/oox/xls/viewsettings.hxx44
-rw-r--r--oox/inc/oox/xls/workbookfragment.hxx13
-rw-r--r--oox/inc/oox/xls/workbookhelper.hxx136
-rw-r--r--oox/inc/oox/xls/workbooksettings.hxx20
-rw-r--r--oox/inc/oox/xls/worksheetbuffer.hxx29
-rw-r--r--oox/inc/oox/xls/worksheetfragment.hxx50
-rw-r--r--oox/inc/oox/xls/worksheethelper.hxx85
-rw-r--r--oox/inc/oox/xls/worksheetsettings.hxx12
-rw-r--r--oox/source/core/contexthandler2.cxx22
-rw-r--r--oox/source/core/fragmenthandler2.cxx8
-rw-r--r--oox/source/drawingml/chart/axiscontext.cxx90
-rw-r--r--oox/source/drawingml/chart/axisconverter.cxx34
-rw-r--r--oox/source/drawingml/chart/chartcontextbase.cxx8
-rw-r--r--oox/source/drawingml/chart/chartspaceconverter.cxx17
-rw-r--r--oox/source/drawingml/chart/chartspacefragment.cxx25
-rw-r--r--oox/source/drawingml/chart/chartspacemodel.cxx2
-rw-r--r--oox/source/drawingml/chart/datasourcecontext.cxx63
-rw-r--r--oox/source/drawingml/chart/datasourceconverter.cxx3
-rw-r--r--oox/source/drawingml/chart/objectformatter.cxx77
-rw-r--r--oox/source/drawingml/chart/plotareacontext.cxx26
-rw-r--r--oox/source/drawingml/chart/plotareaconverter.cxx67
-rw-r--r--oox/source/drawingml/chart/seriescontext.cxx144
-rw-r--r--oox/source/drawingml/chart/seriesconverter.cxx41
-rw-r--r--oox/source/drawingml/chart/titlecontext.cxx49
-rw-r--r--oox/source/drawingml/chart/typegroupcontext.cxx120
-rw-r--r--oox/source/drawingml/chart/typegroupconverter.cxx37
-rw-r--r--oox/source/drawingml/customshapegeometry.cxx1
-rw-r--r--oox/source/drawingml/customshapeproperties.cxx30
-rw-r--r--oox/source/drawingml/fillproperties.cxx127
-rw-r--r--oox/source/drawingml/graphicshapecontext.cxx16
-rw-r--r--oox/source/drawingml/hyperlinkcontext.cxx12
-rw-r--r--oox/source/drawingml/lineproperties.cxx96
-rw-r--r--oox/source/drawingml/shape.cxx51
-rw-r--r--oox/source/drawingml/table/tablecell.cxx37
-rw-r--r--oox/source/drawingml/textbody.cxx13
-rw-r--r--oox/source/drawingml/textbodypropertiescontext.cxx20
-rw-r--r--oox/source/drawingml/textcharacterproperties.cxx55
-rw-r--r--oox/source/drawingml/textparagraph.cxx8
-rw-r--r--oox/source/drawingml/textparagraphproperties.cxx106
-rw-r--r--oox/source/drawingml/textparagraphpropertiescontext.cxx39
-rw-r--r--oox/source/drawingml/textrun.cxx3
-rw-r--r--oox/source/drawingml/themefragmenthandler.cxx17
-rw-r--r--oox/source/dump/biffdumper.cxx365
-rw-r--r--oox/source/dump/biffdumper.ini418
-rw-r--r--oox/source/dump/dumperbase.cxx12
-rw-r--r--oox/source/dump/dumperbase.ini8
-rw-r--r--oox/source/dump/xlsbdumper.cxx331
-rw-r--r--oox/source/dump/xlsbdumper.ini400
-rw-r--r--oox/source/helper/attributelist.cxx24
-rw-r--r--oox/source/helper/makefile.mk1
-rw-r--r--oox/source/helper/propertymap.cxx296
-rw-r--r--oox/source/helper/propertysequence.cxx159
-rw-r--r--oox/source/helper/propertyset.cxx72
-rw-r--r--oox/source/ole/vbainputstream.cxx6
-rw-r--r--oox/source/ppt/commontimenodecontext.cxx2
-rw-r--r--oox/source/ppt/pptshapepropertiescontext.cxx4
-rw-r--r--oox/source/ppt/presentationfragmenthandler.cxx11
-rw-r--r--oox/source/ppt/slidepersist.cxx6
-rw-r--r--oox/source/ppt/slidetransition.cxx11
-rw-r--r--oox/source/ppt/soundactioncontext.cxx5
-rw-r--r--oox/source/ppt/timenode.cxx13
-rw-r--r--oox/source/token/genproperties.pl46
-rw-r--r--oox/source/token/makefile.mk12
-rw-r--r--oox/source/token/properties.txt339
-rw-r--r--oox/source/token/propertylist.cxx (renamed from oox/inc/oox/xls/headerfooterparser.hxx)45
-rw-r--r--oox/source/xls/addressconverter.cxx97
-rw-r--r--oox/source/xls/autofiltercontext.cxx70
-rw-r--r--oox/source/xls/biffcodec.cxx219
-rw-r--r--oox/source/xls/biffinputstream.cxx13
-rw-r--r--oox/source/xls/chartsheetfragment.cxx114
-rw-r--r--oox/source/xls/commentsbuffer.cxx145
-rw-r--r--oox/source/xls/commentsfragment.cxx156
-rw-r--r--oox/source/xls/condformatbuffer.cxx249
-rw-r--r--oox/source/xls/condformatcontext.cxx15
-rw-r--r--oox/source/xls/connectionsfragment.cxx64
-rw-r--r--oox/source/xls/defnamesbuffer.cxx296
-rw-r--r--oox/source/xls/drawingfragment.cxx153
-rw-r--r--oox/source/xls/excelfilter.cxx13
-rw-r--r--oox/source/xls/excelhandlers.cxx50
-rw-r--r--oox/source/xls/externallinkbuffer.cxx121
-rw-r--r--oox/source/xls/externallinkfragment.cxx208
-rw-r--r--oox/source/xls/formulabase.cxx38
-rw-r--r--oox/source/xls/formulaparser.cxx32
-rw-r--r--oox/source/xls/headerfooterparser.cxx638
-rw-r--r--oox/source/xls/makefile.mk6
-rw-r--r--oox/source/xls/numberformatsbuffer.cxx39
-rw-r--r--oox/source/xls/pagesettings.cxx995
-rw-r--r--oox/source/xls/pivotcachebuffer.cxx1551
-rw-r--r--oox/source/xls/pivotcachefragment.cxx453
-rw-r--r--oox/source/xls/pivottablebuffer.cxx1562
-rw-r--r--oox/source/xls/pivottablefragment.cxx335
-rw-r--r--oox/source/xls/querytablefragment.cxx22
-rw-r--r--oox/source/xls/richstring.cxx104
-rw-r--r--oox/source/xls/richstringcontext.cxx84
-rw-r--r--oox/source/xls/sharedformulabuffer.cxx14
-rw-r--r--oox/source/xls/sharedstringsfragment.cxx32
-rw-r--r--oox/source/xls/sheetcellrangemap.cxx167
-rw-r--r--oox/source/xls/sheetdatacontext.cxx281
-rw-r--r--oox/source/xls/stylesbuffer.cxx1416
-rw-r--r--oox/source/xls/stylesfragment.cxx392
-rw-r--r--oox/source/xls/stylespropertyhelper.cxx393
-rw-r--r--oox/source/xls/tablebuffer.cxx69
-rw-r--r--oox/source/xls/tablefragment.cxx33
-rw-r--r--oox/source/xls/themebuffer.cxx11
-rw-r--r--oox/source/xls/unitconverter.cxx127
-rw-r--r--oox/source/xls/viewsettings.cxx566
-rw-r--r--oox/source/xls/workbookfragment.cxx334
-rw-r--r--oox/source/xls/workbookhelper.cxx400
-rw-r--r--oox/source/xls/workbooksettings.cxx132
-rw-r--r--oox/source/xls/worksheetbuffer.cxx105
-rw-r--r--oox/source/xls/worksheetfragment.cxx806
-rw-r--r--oox/source/xls/worksheethelper.cxx706
-rw-r--r--oox/source/xls/worksheetsettings.cxx169
177 files changed, 13801 insertions, 8191 deletions
diff --git a/oox/inc/oox/core/binarycodec.hxx b/oox/inc/oox/core/binarycodec.hxx
index 79ed77d26d22..bb33c214f42d 100644
--- a/oox/inc/oox/core/binarycodec.hxx
+++ b/oox/inc/oox/core/binarycodec.hxx
@@ -99,7 +99,7 @@ public:
*/
void startBlock();
- /** Decodes a block of memory inplace.
+ /** Decodes a block of memory.
@precond
The codec must be initialized with the initKey() function before
diff --git a/oox/inc/oox/core/contexthandler2.hxx b/oox/inc/oox/core/contexthandler2.hxx
index 1226718805b0..74bb33a8231e 100644
--- a/oox/inc/oox/core/contexthandler2.hxx
+++ b/oox/inc/oox/core/contexthandler2.hxx
@@ -44,36 +44,6 @@ namespace core {
// ============================================================================
-class ContextHandler2Helper;
-
-/** Wrapper for a context handler object.
-
- This wrapper is used by the ContextHandler2 class to simplify returning
- either the own context handler instance, a new context handler, or null to
- indicate an unsupported context. The implicit constructors allow to return
- either a C++ bool value (true = own context instance, false = null) or a
- new context handler (any class derived from ContextHandler, can be null
- too) in the implementation of the virtual
- ContextHandler2::onCreateContext() or
- ContextHandler2::onCreateRecordContext() functions. This wrapper takes
- ownership of the passed context handler internally, thus it is possible to
- simply pass a new heap-allocated object.
- */
-class ContextWrapper
-{
-public:
- inline /*implicit*/ ContextWrapper( bool bThis ) : mbThis( bThis ) {}
- inline /*implicit*/ ContextWrapper( ContextHandler* pContext ) : mxContext( pContext ), mbThis( false ) {}
-
- ContextHandler* getContextHandler( ContextHandler2Helper& rThis ) const;
-
-private:
- ContextHandlerRef mxContext;
- bool mbThis;
-};
-
-// ============================================================================
-
struct ContextInfo;
/** Helper class that provides a context identifier stack.
@@ -116,7 +86,7 @@ public:
Usually 'true' should be returned to improve performance by reusing the
same instance to process several elements. Used by OOXML import only.
*/
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) = 0;
+ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) = 0;
/** Will be called if a new context element has been started.
@@ -139,7 +109,7 @@ public:
Usually 'true' should be returned to improve performance by reusing the
same instance to process several elements. Used by OOBIN import only.
*/
- virtual ContextWrapper onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ) = 0;
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm ) = 0;
/** Will be called if a new record in a binary stream has been started.
@@ -268,11 +238,11 @@ public:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onStartElement( const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
- virtual ContextWrapper onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
virtual void onStartRecord( RecordInputStream& rStrm );
virtual void onEndRecord();
};
diff --git a/oox/inc/oox/core/fragmenthandler2.hxx b/oox/inc/oox/core/fragmenthandler2.hxx
index 17fea564e181..1e32d1049a1e 100644
--- a/oox/inc/oox/core/fragmenthandler2.hxx
+++ b/oox/inc/oox/core/fragmenthandler2.hxx
@@ -95,11 +95,11 @@ public:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onStartElement( const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
- virtual ContextWrapper onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
virtual void onStartRecord( RecordInputStream& rStrm );
virtual void onEndRecord();
diff --git a/oox/inc/oox/drawingml/chart/axiscontext.hxx b/oox/inc/oox/drawingml/chart/axiscontext.hxx
index cdaee210e4f1..4bbec01163a7 100644
--- a/oox/inc/oox/drawingml/chart/axiscontext.hxx
+++ b/oox/inc/oox/drawingml/chart/axiscontext.hxx
@@ -49,7 +49,7 @@ public:
explicit AxisDispUnitsContext( ::oox::core::ContextHandler2Helper& rParent, AxisDispUnitsModel& rModel );
virtual ~AxisDispUnitsContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -65,7 +65,7 @@ public:
explicit AxisContextBase( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
virtual ~AxisContextBase();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -78,7 +78,7 @@ public:
explicit CatAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
virtual ~CatAxisContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -91,7 +91,7 @@ public:
explicit DateAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
virtual ~DateAxisContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -104,7 +104,7 @@ public:
explicit SerAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
virtual ~SerAxisContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -117,7 +117,7 @@ public:
explicit ValAxisContext( ::oox::core::ContextHandler2Helper& rParent, AxisModel& rModel );
virtual ~ValAxisContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/chart/axisconverter.hxx b/oox/inc/oox/drawingml/chart/axisconverter.hxx
index 9235cb1b3b35..94054d8ae0e1 100644
--- a/oox/inc/oox/drawingml/chart/axisconverter.hxx
+++ b/oox/inc/oox/drawingml/chart/axisconverter.hxx
@@ -69,6 +69,7 @@ public:
void convertFromModel(
const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& rxCoordSystem,
TypeGroupConverter& rTypeGroup,
+ const AxisModel* pCrossingAxis,
sal_Int32 nAxesSetIdx,
sal_Int32 nAxisIdx );
};
diff --git a/oox/inc/oox/drawingml/chart/chartcontextbase.hxx b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx
index 2fa3762f75f0..0ca7fad9ff74 100644
--- a/oox/inc/oox/drawingml/chart/chartcontextbase.hxx
+++ b/oox/inc/oox/drawingml/chart/chartcontextbase.hxx
@@ -79,7 +79,7 @@ public:
explicit ShapePrWrapperContext( ::oox::core::ContextHandler2Helper& rParent, Shape& rModel );
virtual ~ShapePrWrapperContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/chart/chartspacefragment.hxx b/oox/inc/oox/drawingml/chart/chartspacefragment.hxx
index 2587540c9e70..f6a07f1468b3 100644
--- a/oox/inc/oox/drawingml/chart/chartspacefragment.hxx
+++ b/oox/inc/oox/drawingml/chart/chartspacefragment.hxx
@@ -53,7 +53,7 @@ public:
ChartSpaceModel& rModel );
virtual ~ChartSpaceFragment();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/chart/datasourcecontext.hxx b/oox/inc/oox/drawingml/chart/datasourcecontext.hxx
index 916d3b3aa135..dbe9f0c706f8 100644
--- a/oox/inc/oox/drawingml/chart/datasourcecontext.hxx
+++ b/oox/inc/oox/drawingml/chart/datasourcecontext.hxx
@@ -54,7 +54,7 @@ public:
explicit DoubleSequenceContext( ::oox::core::ContextHandler2Helper& rParent, DataSequenceModel& rModel );
virtual ~DoubleSequenceContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
private:
@@ -72,7 +72,7 @@ public:
explicit StringSequenceContext( ::oox::core::ContextHandler2Helper& rParent, DataSequenceModel& rModel );
virtual ~StringSequenceContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
private:
@@ -92,7 +92,7 @@ public:
explicit DataSourceContext( ::oox::core::ContextHandler2Helper& rParent, DataSourceModel& rModel );
virtual ~DataSourceContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/chart/modelbase.hxx b/oox/inc/oox/drawingml/chart/modelbase.hxx
index 31af69f4978a..b1e5ae088f0d 100644
--- a/oox/inc/oox/drawingml/chart/modelbase.hxx
+++ b/oox/inc/oox/drawingml/chart/modelbase.hxx
@@ -48,6 +48,7 @@ class ModelRef : public ::boost::shared_ptr< ModelType >
{
public:
inline explicit ModelRef() {}
+ inline ModelRef( const ::boost::shared_ptr< ModelType >& rxModel ) : ::boost::shared_ptr< ModelType >( rxModel ) {}
inline ~ModelRef() {}
inline bool is() const { return this->get() != 0; }
diff --git a/oox/inc/oox/drawingml/chart/plotareacontext.hxx b/oox/inc/oox/drawingml/chart/plotareacontext.hxx
index b9e9150ef143..d5c448fc4c3a 100644
--- a/oox/inc/oox/drawingml/chart/plotareacontext.hxx
+++ b/oox/inc/oox/drawingml/chart/plotareacontext.hxx
@@ -49,7 +49,7 @@ public:
explicit View3DContext( ::oox::core::ContextHandler2Helper& rParent, View3DModel& rModel );
virtual ~View3DContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -65,7 +65,7 @@ public:
explicit WallFloorContext( ::oox::core::ContextHandler2Helper& rParent, WallFloorModel& rModel );
virtual ~WallFloorContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -80,7 +80,7 @@ public:
explicit PlotAreaContext( ::oox::core::ContextHandler2Helper& rParent, PlotAreaModel& rModel );
virtual ~PlotAreaContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/chart/seriescontext.hxx b/oox/inc/oox/drawingml/chart/seriescontext.hxx
index 22a5c0ceef5e..bbc280d79d60 100644
--- a/oox/inc/oox/drawingml/chart/seriescontext.hxx
+++ b/oox/inc/oox/drawingml/chart/seriescontext.hxx
@@ -49,7 +49,7 @@ public:
explicit DataLabelContext( ::oox::core::ContextHandler2Helper& rParent, DataLabelModel& rModel );
virtual ~DataLabelContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
};
@@ -65,7 +65,7 @@ public:
explicit DataLabelsContext( ::oox::core::ContextHandler2Helper& rParent, DataLabelsModel& rModel );
virtual ~DataLabelsContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
};
@@ -81,7 +81,7 @@ public:
explicit ErrorBarContext( ::oox::core::ContextHandler2Helper& rParent, ErrorBarModel& rModel );
virtual ~ErrorBarContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -96,7 +96,7 @@ public:
explicit TrendlineLabelContext( ::oox::core::ContextHandler2Helper& rParent, TrendlineLabelModel& rModel );
virtual ~TrendlineLabelContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -111,7 +111,7 @@ public:
explicit TrendlineContext( ::oox::core::ContextHandler2Helper& rParent, TrendlineModel& rModel );
virtual ~TrendlineContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
};
@@ -127,7 +127,7 @@ public:
explicit DataPointContext( ::oox::core::ContextHandler2Helper& rParent, DataPointModel& rModel );
virtual ~DataPointContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -142,7 +142,7 @@ public:
explicit SeriesContextBase( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
virtual ~SeriesContextBase();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -155,7 +155,7 @@ public:
explicit AreaSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
virtual ~AreaSeriesContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -168,7 +168,7 @@ public:
explicit BarSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
virtual ~BarSeriesContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -181,7 +181,7 @@ public:
explicit BubbleSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
virtual ~BubbleSeriesContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -195,7 +195,7 @@ public:
explicit LineSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
virtual ~LineSeriesContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -209,7 +209,7 @@ public:
explicit PieSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
virtual ~PieSeriesContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -222,7 +222,7 @@ public:
explicit RadarSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
virtual ~RadarSeriesContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -235,7 +235,7 @@ public:
explicit ScatterSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
virtual ~ScatterSeriesContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -248,7 +248,7 @@ public:
explicit SurfaceSeriesContext( ::oox::core::ContextHandler2Helper& rParent, SeriesModel& rModel );
virtual ~SurfaceSeriesContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/chart/titlecontext.hxx b/oox/inc/oox/drawingml/chart/titlecontext.hxx
index fec253ac3003..73238bcad7e6 100644
--- a/oox/inc/oox/drawingml/chart/titlecontext.hxx
+++ b/oox/inc/oox/drawingml/chart/titlecontext.hxx
@@ -50,7 +50,7 @@ public:
explicit LayoutContext( ::oox::core::ContextHandler2Helper& rParent, LayoutModel& rModel );
virtual ~LayoutContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -65,7 +65,7 @@ public:
explicit TextContext( ::oox::core::ContextHandler2Helper& rParent, TextModel& rModel );
virtual ~TextContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
};
@@ -81,7 +81,7 @@ public:
explicit TitleContext( ::oox::core::ContextHandler2Helper& rParent, TitleModel& rModel );
virtual ~TitleContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -96,7 +96,7 @@ public:
explicit LegendContext( ::oox::core::ContextHandler2Helper& rParent, LegendModel& rModel );
virtual ~LegendContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/chart/typegroupcontext.hxx b/oox/inc/oox/drawingml/chart/typegroupcontext.hxx
index 92b0fc5992fa..bd8cf4ff26d1 100644
--- a/oox/inc/oox/drawingml/chart/typegroupcontext.hxx
+++ b/oox/inc/oox/drawingml/chart/typegroupcontext.hxx
@@ -49,7 +49,7 @@ public:
explicit UpDownBarsContext( ::oox::core::ContextHandler2Helper& rParent, UpDownBarsModel& rModel );
virtual ~UpDownBarsContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -67,7 +67,7 @@ public:
explicit AreaTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~AreaTypeGroupContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -80,7 +80,7 @@ public:
explicit BarTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~BarTypeGroupContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -93,7 +93,7 @@ public:
explicit BubbleTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~BubbleTypeGroupContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -107,7 +107,7 @@ public:
explicit LineTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~LineTypeGroupContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -121,7 +121,7 @@ public:
explicit PieTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~PieTypeGroupContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -134,7 +134,7 @@ public:
explicit RadarTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~RadarTypeGroupContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -147,7 +147,7 @@ public:
explicit ScatterTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~ScatterTypeGroupContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
@@ -161,7 +161,7 @@ public:
explicit SurfaceTypeGroupContext( ::oox::core::ContextHandler2Helper& rParent, TypeGroupModel& rModel );
virtual ~SurfaceTypeGroupContext();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
diff --git a/oox/inc/oox/drawingml/fillproperties.hxx b/oox/inc/oox/drawingml/fillproperties.hxx
index b28919bbb304..4dff4c2b7c44 100644
--- a/oox/inc/oox/drawingml/fillproperties.hxx
+++ b/oox/inc/oox/drawingml/fillproperties.hxx
@@ -46,32 +46,40 @@ namespace drawingml {
// ============================================================================
-struct FillPropertyNames
+enum FillPropertyId
{
- ::rtl::OUString maFillStyle;
- ::rtl::OUString maFillColor;
- ::rtl::OUString maFillTransparence;
- ::rtl::OUString maFillGradient;
- ::rtl::OUString maFillBitmap;
- ::rtl::OUString maFillBitmapMode;
- ::rtl::OUString maFillBitmapTile;
- ::rtl::OUString maFillBitmapStretch;
- ::rtl::OUString maFillBitmapLogicalSize;
- ::rtl::OUString maFillBitmapSizeX;
- ::rtl::OUString maFillBitmapSizeY;
- ::rtl::OUString maFillBitmapOffsetX;
- ::rtl::OUString maFillBitmapOffsetY;
- ::rtl::OUString maFillBitmapRectanglePoint;
+ FillStyleId,
+ FillColorId,
+ FillTransparenceId,
+ FillGradientId,
+ FillBitmapId,
+ FillBitmapModeId,
+ FillBitmapTileId,
+ FillBitmapStretchId,
+ FillBitmapLogicalSizeId,
+ FillBitmapSizeXId,
+ FillBitmapSizeYId,
+ FillBitmapOffsetXId,
+ FillBitmapOffsetYId,
+ FillBitmapRectanglePointId,
+ FillId_END
+};
+
+struct FillPropertyIds
+{
+ const sal_Int32* mpnPropertyIds;
bool mbNamedFillGradient;
bool mbNamedFillBitmap;
bool mbTransformGraphic;
- explicit FillPropertyNames();
- explicit FillPropertyNames(
- const sal_Char* const* ppcPropertyNames,
+ explicit FillPropertyIds(
+ const sal_Int32* pnPropertyIds,
bool bNamedFillGradient,
bool bNamedFillBitmap,
bool bTransformGraphic );
+
+ inline bool has( FillPropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; }
+ inline sal_Int32 operator[]( FillPropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; }
};
// ============================================================================
@@ -103,8 +111,8 @@ struct FillProperties
OptValue< sal_Int32 > moTileSY;
OptValue< sal_Int32 > moTileAlign; /// Anchor point inside bitmap.
- static FillPropertyNames DEFAULTNAMES; /// Default fill property names for shape fill.
- static FillPropertyNames DEFAULTPICNAMES; /// Default fill property names for pictures.
+ static FillPropertyIds DEFAULT_IDS; /// Default fill property identifiers for shape fill.
+ static FillPropertyIds DEFAULT_PICIDS; /// Default fill property identifiers for pictures.
/** Overwrites all members that are explicitly set in rSourceProps. */
void assignUsed( const FillProperties& rSourceProps );
@@ -116,7 +124,7 @@ struct FillProperties
/** Writes the properties to the passed property map. */
void pushToPropMap(
PropertyMap& rPropMap,
- const FillPropertyNames& rPropNames,
+ const FillPropertyIds& rPropIds,
const ::oox::core::XmlFilterBase& rFilter,
::oox::core::ModelObjectContainer& rObjContainer,
sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;
@@ -124,7 +132,7 @@ struct FillProperties
/** Writes the properties to the passed property set. */
void pushToPropSet(
PropertySet& rPropSet,
- const FillPropertyNames& rPropNames,
+ const FillPropertyIds& rPropIds,
const ::oox::core::XmlFilterBase& rFilter,
::oox::core::ModelObjectContainer& rObjContainer,
sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;
diff --git a/oox/inc/oox/drawingml/lineproperties.hxx b/oox/inc/oox/drawingml/lineproperties.hxx
index 790340576920..ac9bd3232aa5 100644
--- a/oox/inc/oox/drawingml/lineproperties.hxx
+++ b/oox/inc/oox/drawingml/lineproperties.hxx
@@ -38,28 +38,36 @@ namespace drawingml {
// ============================================================================
-struct LinePropertyNames
+enum LinePropertyId
{
- ::rtl::OUString maLineStyle;
- ::rtl::OUString maLineWidth;
- ::rtl::OUString maLineColor;
- ::rtl::OUString maLineTransparence;
- ::rtl::OUString maLineDash;
- ::rtl::OUString maLineJoint;
- ::rtl::OUString maLineStart;
- ::rtl::OUString maLineStartWidth;
- ::rtl::OUString maLineStartCenter;
- ::rtl::OUString maLineEnd;
- ::rtl::OUString maLineEndWidth;
- ::rtl::OUString maLineEndCenter;
+ LineStyleId,
+ LineWidthId,
+ LineColorId,
+ LineTransparenceId,
+ LineDashId,
+ LineJointId,
+ LineStartId,
+ LineStartWidthId,
+ LineStartCenterId,
+ LineEndId,
+ LineEndWidthId,
+ LineEndCenterId,
+ LineId_END
+};
+
+struct LinePropertyIds
+{
+ const sal_Int32* mpnPropertyIds;
bool mbNamedLineDash;
bool mbNamedLineMarker;
- explicit LinePropertyNames();
- explicit LinePropertyNames(
- const sal_Char* const* ppcPropertyNames,
+ explicit LinePropertyIds(
+ const sal_Int32* pnPropertyIds,
bool bNamedLineDash,
bool bNamedLineMarker );
+
+ inline bool has( LinePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; }
+ inline sal_Int32 operator[]( LinePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; }
};
// ============================================================================
@@ -86,7 +94,7 @@ struct LineProperties
OptValue< sal_Int32 > moLineCap; /// Line cap (OOXML token).
OptValue< sal_Int32 > moLineJoint; /// Line joint type (OOXML token).
- static LinePropertyNames DEFAULTNAMES; /// Default line property names.
+ static LinePropertyIds DEFAULT_IDS; /// Default line property identifiers.
/** Overwrites all members that are explicitly set in rSourceProps. */
void assignUsed( const LineProperties& rSourceProps );
@@ -94,7 +102,7 @@ struct LineProperties
/** Writes the properties to the passed property map. */
void pushToPropMap(
PropertyMap& rPropMap,
- const LinePropertyNames& rPropNames,
+ const LinePropertyIds& rPropIds,
const ::oox::core::XmlFilterBase& rFilter,
::oox::core::ModelObjectContainer& rObjContainer,
sal_Int32 nPhClr ) const;
@@ -102,7 +110,7 @@ struct LineProperties
/** Writes the properties to the passed property map. */
void pushToPropSet(
PropertySet& rPropSet,
- const LinePropertyNames& rPropNames,
+ const LinePropertyIds& rPropIds,
const ::oox::core::XmlFilterBase& rFilter,
::oox::core::ModelObjectContainer& rObjContainer,
sal_Int32 nPhClr ) const;
diff --git a/oox/inc/oox/drawingml/themefragmenthandler.hxx b/oox/inc/oox/drawingml/themefragmenthandler.hxx
index d8d923ef590d..9091bd92d861 100644
--- a/oox/inc/oox/drawingml/themefragmenthandler.hxx
+++ b/oox/inc/oox/drawingml/themefragmenthandler.hxx
@@ -49,7 +49,7 @@ public:
Theme& rTheme );
virtual ~ThemeFragmentHandler();
- virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
private:
Theme& mrTheme;
diff --git a/oox/inc/oox/dump/biffdumper.hxx b/oox/inc/oox/dump/biffdumper.hxx
index 2a6fe0d8d30a..85f761e3e587 100644
--- a/oox/inc/oox/dump/biffdumper.hxx
+++ b/oox/inc/oox/dump/biffdumper.hxx
@@ -40,7 +40,7 @@
namespace oox { namespace xls {
class BiffInputStream;
- class BinFontPortionList;
+ class FontPortionModelList;
struct FunctionInfo;
class FunctionProvider;
} }
@@ -169,7 +169,7 @@ protected:
void writeBooleanItem( const String& rName, sal_uInt8 nBool );
void writeErrorCodeItem( const String& rName, sal_uInt8 nErrCode );
- void writeFontPortions( const ::oox::xls::BinFontPortionList& rPortions );
+ void writeFontPortions( const ::oox::xls::FontPortionModelList& rPortions );
template< typename Type >
void writeRectItem( const String& rName,
@@ -414,6 +414,9 @@ private:
sal_uInt16 dumpFormatIdx( const String& rName = EMPTY_STRING );
sal_uInt16 dumpXfIdx( const String& rName = EMPTY_STRING, bool bBiff2Style = false );
+ ::rtl::OUString dumpPivotString( const String& rName, sal_uInt16 nStrLen );
+ ::rtl::OUString dumpPivotString( const String& rName );
+
sal_uInt16 dumpCellHeader( bool bBiff2Style = false );
void dumpBoolErr();
@@ -455,7 +458,7 @@ private:
sal_uInt16 mnFormatIdx;
sal_uInt16 mnPTRowFields;
sal_uInt16 mnPTColFields;
- sal_uInt16 mnPTSxliIdx;
+ sal_uInt16 mnPTRowColItemsIdx;
bool mbHasCodePage;
bool mbHasDff;
};
@@ -465,7 +468,11 @@ private:
class PivotCacheStreamObject : public RecordStreamObject
{
public:
- explicit PivotCacheStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName );
+ explicit PivotCacheStreamObject(
+ const ObjectBase& rParent,
+ const BinaryInputStreamRef& rxStrm,
+ ::oox::xls::BiffType eBiff,
+ const ::rtl::OUString& rSysFileName );
protected:
virtual void implDumpRecordBody();
diff --git a/oox/inc/oox/dump/dumperbase.hxx b/oox/inc/oox/dump/dumperbase.hxx
index bccf3b7e56b1..fea1726d787e 100644
--- a/oox/inc/oox/dump/dumperbase.hxx
+++ b/oox/inc/oox/dump/dumperbase.hxx
@@ -1820,6 +1820,7 @@ private:
sal_Int64 mnRecPos;
sal_Int64 mnRecId;
sal_Int64 mnRecSize;
+ bool mbShowRecPos;
};
// ============================================================================
diff --git a/oox/inc/oox/dump/xlsbdumper.hxx b/oox/inc/oox/dump/xlsbdumper.hxx
index b41f97a7163a..dafa3901ea6e 100644
--- a/oox/inc/oox/dump/xlsbdumper.hxx
+++ b/oox/inc/oox/dump/xlsbdumper.hxx
@@ -37,8 +37,8 @@
#if OOX_INCLUDE_DUMPER
namespace oox { namespace xls {
- class BinFontPortionList;
- class BinPhoneticPortionList;
+ class FontPortionModelList;
+ class PhoneticPortionModelList;
struct FunctionInfo;
class FunctionProvider;
} }
@@ -74,8 +74,8 @@ protected:
void writeBooleanItem( const String& rName, sal_uInt8 nBool );
void writeErrorCodeItem( const String& rName, sal_uInt8 nErrCode );
- void writeFontPortions( const ::oox::xls::BinFontPortionList& rPortions );
- void writePhoneticPortions( const ::oox::xls::BinPhoneticPortionList& rPhonetics );
+ void writeFontPortions( const ::oox::xls::FontPortionModelList& rPortions );
+ void writePhoneticPortions( const ::oox::xls::PhoneticPortionModelList& rPhonetics );
// ------------------------------------------------------------------------
@@ -83,6 +83,7 @@ protected:
sal_uInt8 dumpErrorCode( const String& rName = EMPTY_STRING );
::rtl::OUString dumpString( const String& rName = EMPTY_STRING, bool bRich = false, bool b32BitLen = true );
void dumpColor( const String& rName = EMPTY_STRING );
+ ::com::sun::star::util::DateTime dumpPivotDateTime( const String& rName = EMPTY_STRING );
sal_Int32 dumpColIndex( const String& rName = EMPTY_STRING );
sal_Int32 dumpRowIndex( const String& rName = EMPTY_STRING );
diff --git a/oox/inc/oox/helper/attributelist.hxx b/oox/inc/oox/helper/attributelist.hxx
index 09cfedd5eb2b..1b206298ed9d 100644
--- a/oox/inc/oox/helper/attributelist.hxx
+++ b/oox/inc/oox/helper/attributelist.hxx
@@ -31,6 +31,7 @@
#ifndef OOX_HELPER_ATTRIBUTELIST_HXX
#define OOX_HELPER_ATTRIBUTELIST_HXX
+#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
#include "oox/helper/helper.hxx"
#include "tokens.hxx"
@@ -84,6 +85,9 @@ public:
/** Returns the boolean value of the specified attribute. */
OptValue< bool > getBool( sal_Int32 nElement ) const;
+ /** Returns the date/time value of the specified attribute. */
+ OptValue< ::com::sun::star::util::DateTime > getDateTime( sal_Int32 nElement ) const;
+
// defaulted return values ------------------------------------------------
/** Returns the token identifier of the value of the specified attribute,
@@ -118,6 +122,10 @@ public:
default value if the attribute is missing or not convertible to bool. */
bool getBool( sal_Int32 nElement, bool bDefault ) const;
+ /** Returns the date/time value of the specified attribute, or the default
+ value if the attribute is missing or not convertible to a date/time value. */
+ ::com::sun::star::util::DateTime getDateTime( sal_Int32 nElement, const ::com::sun::star::util::DateTime& rDefault ) const;
+
private:
::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >
mxAttribs;
diff --git a/oox/inc/oox/helper/containerhelper.hxx b/oox/inc/oox/helper/containerhelper.hxx
index f2b52321b85d..f0d3d638cfe3 100644
--- a/oox/inc/oox/helper/containerhelper.hxx
+++ b/oox/inc/oox/helper/containerhelper.hxx
@@ -41,6 +41,7 @@
namespace rtl { class OUString; }
namespace com { namespace sun { namespace star {
+ namespace container { class XIndexAccess; }
namespace container { class XIndexContainer; }
namespace container { class XNameAccess; }
namespace container { class XNameContainer; }
@@ -107,6 +108,13 @@ public:
forEach( ::boost::bind( pFunc, _1, aParam ) );
}
+ /** Calls the passed member function of ObjType on every contained object. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) );
+ }
+
private:
template< typename FunctorType >
struct Functor
@@ -178,6 +186,13 @@ public:
forEach( ::boost::bind( pFunc, _1, aParam ) );
}
+ /** Calls the passed member function of ObjType on every contained object. */
+ template< typename FuncType, typename ParamType1, typename ParamType2 >
+ inline void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
+ {
+ forEach( ::boost::bind( pFunc, _1, aParam1, aParam2 ) );
+ }
+
private:
template< typename FunctorType >
struct Functor
@@ -363,7 +378,49 @@ public:
const ::com::sun::star::uno::Any& rObject,
bool bRenameOldExisting = false );
- // vector and matrix ------------------------------------------------------
+ // std::vector and std::map element access --------------------------------
+
+ /** Returns the pointer to an existing element of the passed vector, or a
+ null pointer, if the passed index is out of bounds. */
+ template< typename Type >
+ static const Type* getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex );
+
+ /** Returns the pointer to an existing element of the passed vector, or a
+ null pointer, if the passed index is out of bounds. */
+ template< typename Type >
+ static Type* getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex );
+
+ /** Returns the reference to an existing element of the passed vector, or
+ the passed default value, if the passed index is out of bounds. */
+ template< typename Type >
+ static const Type& getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex, const Type& rDefault );
+
+ /** Returns the reference to an existing element of the passed vector, or
+ the passed default value, if the passed index is out of bounds. */
+ template< typename Type >
+ static Type& getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex, Type& rDefault );
+
+ /** Returns the pointer to an existing element of the passed map, or a null
+ pointer, if an element with the passed key does not exist. */
+ template< typename Type, typename KeyType >
+ static const Type* getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey );
+
+ /** Returns the pointer to an existing element of the passed map, or a null
+ pointer, if an element with the passed key does not exist. */
+ template< typename Type, typename KeyType >
+ static Type* getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey );
+
+ /** Returns the reference to an existing element of the passed map, or the
+ passed default value, if an element with the passed key does not exist. */
+ template< typename Type, typename KeyType >
+ static const Type& getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey, const Type& rDefault );
+
+ /** Returns the reference to an existing element of the passed map, or the
+ passed default value, if an element with the passed key does not exist. */
+ template< typename Type, typename KeyType >
+ static Type& getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey, Type& rDefault );
+
+ // vector/matrix to Sequence ----------------------------------------------
/** Creates a UNO sequence from a std::vector with copies of all elements.
@@ -392,6 +449,58 @@ public:
// ----------------------------------------------------------------------------
template< typename Type >
+const Type* ContainerHelper::getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex )
+{
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : 0;
+}
+
+template< typename Type >
+Type* ContainerHelper::getVectorElement( ::std::vector< Type >& rVector, sal_Int32 nIndex )
+{
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? &rVector[ static_cast< size_t >( nIndex ) ] : 0;
+}
+
+template< typename Type >
+const Type& ContainerHelper::getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex, const Type& rDefault )
+{
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? rVector[ static_cast< size_t >( nIndex ) ] : rDefault;
+}
+
+template< typename Type >
+Type& ContainerHelper::getVectorElement( const ::std::vector< Type >& rVector, sal_Int32 nIndex, Type& rDefault )
+{
+ return ((0 <= nIndex) && (static_cast< size_t >( nIndex ) < rVector.size())) ? rVector[ static_cast< size_t >( nIndex ) ] : rDefault;
+}
+
+template< typename Type, typename KeyType >
+const Type* ContainerHelper::getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey )
+{
+ typename ::std::map< KeyType, Type >::const_iterator aIt = rMap.find( nKey );
+ return (aIt == rMap.end()) ? 0 : &aIt->second;
+}
+
+template< typename Type, typename KeyType >
+Type* ContainerHelper::getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey )
+{
+ typename ::std::map< KeyType, Type >::iterator aIt = rMap.find( nKey );
+ return (aIt == rMap.end()) ? 0 : &aIt->second;
+}
+
+template< typename Type, typename KeyType >
+const Type& ContainerHelper::getMapElement( const ::std::map< KeyType, Type >& rMap, KeyType nKey, const Type& rDefault )
+{
+ typename ::std::map< KeyType, Type >::const_iterator aIt = rMap.find( nKey );
+ return (aIt == rMap.end()) ? rDefault : aIt->second;
+}
+
+template< typename Type, typename KeyType >
+Type& ContainerHelper::getMapElement( ::std::map< KeyType, Type >& rMap, KeyType nKey, Type& rDefault )
+{
+ typename ::std::map< KeyType, Type >::iterator aIt = rMap.find( nKey );
+ return (aIt == rMap.end()) ? rDefault : aIt->second;
+}
+
+template< typename Type >
::com::sun::star::uno::Sequence< Type > ContainerHelper::vectorToSequence( const ::std::vector< Type >& rVector )
{
if( rVector.empty() )
diff --git a/oox/inc/oox/helper/propertymap.hxx b/oox/inc/oox/helper/propertymap.hxx
index 9a368d1be093..a3e84c4b73fe 100644
--- a/oox/inc/oox/helper/propertymap.hxx
+++ b/oox/inc/oox/helper/propertymap.hxx
@@ -31,36 +31,73 @@
#ifndef OOX_HELPER_PROPERTYMAP_HXX
#define OOX_HELPER_PROPERTYMAP_HXX
+#include <vector>
#include <map>
-#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
+#include <rtl/ustring.hxx>
+#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-#include "oox/helper/helper.hxx"
+
+namespace com { namespace sun { namespace star { namespace beans {
+ struct PropertyValue;
+ class XPropertySet;
+} } } }
namespace oox {
-typedef std::map< ::rtl::OUString, com::sun::star::uno::Any > PropertyMapBase;
+// ============================================================================
+
+/** A vector that contains all predefined property names used in the filters. */
+struct PropertyNamesList : public ::std::vector< ::rtl::OUString >
+{
+ explicit PropertyNamesList();
+};
+
+// ============================================================================
+
+typedef ::std::map< sal_Int32, ::com::sun::star::uno::Any > PropertyMapBase;
+/** A helper that maps property identifiers to property values.
+
+ The property identifiers are generated on compile time and refer to the
+ property name strings that are held by a static vector. The identifier to
+ name mapping is done internally while the properties are written to
+ property sets.
+ */
class PropertyMap : public PropertyMapBase
{
public:
- bool hasProperty( const ::rtl::OUString& rName ) const;
- const com::sun::star::uno::Any* getPropertyValue( const ::rtl::OUString& rName ) const;
+ /** Returns the name of the passed property identifier. */
+ static const ::rtl::OUString& getPropertyName( sal_Int32 nPropId );
+
+ /** Returns true, if the map contains a property with the passed identifier. */
+ inline bool hasProperty( sal_Int32 nPropId ) const
+ { return find( nPropId ) != end(); }
+
+ /** Returns the property value of the specified property, or 0 if not found. */
+ const ::com::sun::star::uno::Any* getProperty( sal_Int32 nPropId ) const;
+ /** Sets the specified property to the passed value. Does nothing, if the
+ identifier is invalid. */
template< typename Type >
- inline void setProperty( const ::rtl::OUString& rName, const Type& rValue )
- { if( rName.getLength() > 0 ) (*this)[ rName ] <<= rValue; }
+ inline void setProperty( sal_Int32 nPropId, const Type& rValue )
+ { if( nPropId >= 0 ) (*this)[ nPropId ] <<= rValue; }
- void makeSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rSequence ) const;
- void makeSequence( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rSequence ) const;
- void makeSequence( ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues ) const;
+ /** Returns a sequence of property values, filled with all contained properties. */
+ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
+ makePropertyValueSequence() const;
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > makePropertySet() const;
- void dump_debug(const char *pMessage = NULL);
+ /** Fills the passed sequences of names and anys with all contained properties. */
+ void fillSequences(
+ ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames,
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& rValues ) const;
+
+ /** Creates and fills a new instance supporting the XPropertySet interface. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
+ makePropertySet() const;
};
+// ============================================================================
+
} // namespace oox
#endif
diff --git a/oox/inc/oox/helper/propertysequence.hxx b/oox/inc/oox/helper/propertysequence.hxx
deleted file mode 100644
index e03660f4bb0c..000000000000
--- a/oox/inc/oox/helper/propertysequence.hxx
+++ /dev/null
@@ -1,177 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: propertysequence.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef OOX_HELPER_PROPERTYSEQUENCE_HXX
-#define OOX_HELPER_PROPERTYSEQUENCE_HXX
-
-#include <vector>
-#include <rtl/ustring.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-namespace com { namespace sun { namespace star {
- namespace beans { struct PropertyValue; }
-} } }
-
-namespace oox {
-
-class PropertySet;
-
-// ============================================================================
-
-/** Generic helper class for reading multiple properties from and writing
- multiple properties to UNO property sets.
-
- Usage:
- 1) Call the constructor with a null-terminated array of ASCII strings. The
- array is not required to be ordered alphabetically. Sorting will be
- handled internally.
-
- 2a) To READ properties from a property set: Call the readFromPropertySet()
- function or use the operator<< stream operator with the property set,
- then get the properties with the readValue() functions or the
- operator>> stream operator. The properties are returned in order of the
- array of property names passed in the constructor.
-
- 2b) To WRITE properties to a property set: Set the values with the
- writeValue() functions or the operator<< stream operator. The order of
- the properties is equal to the array of property names passed in the
- constructor. Finally, call the writeToPropertySet() function or use the
- operator>> stream operator passing the property set.
- */
-class PropertySequence
-{
-public:
- /** Constructs a new property sequence object from the passed property names.
-
- @param ppcPropNames A null-terminated array of ASCII property names.
- @param ppcPropNames2 An optional array of additional property names.
- @param ppcPropNames3 An optional array of additional property names.
- */
- explicit PropertySequence(
- const sal_Char* const* ppcPropNames,
- const sal_Char* const* ppcPropNames2 = 0,
- const sal_Char* const* ppcPropNames3 = 0 );
-
- /** Makes all anys of type void by calling their clear() function. */
- void clearAllAnys();
-
- // read properties --------------------------------------------------------
-
- /** Reads all values from the passed property set. */
- void readFromPropertySet( const PropertySet& rPropSet );
-
- /** Reads the next value from the value sequence. */
- template< typename Type >
- bool readValue( Type& rValue );
-
- /** Reads an any from the value sequence. */
- bool readValue( ::com::sun::star::uno::Any& rAny );
-
- // write properties -------------------------------------------------------
-
- /** Writes the next value to the value sequence. */
- template< typename Type >
- void writeValue( const Type& rValue );
-
- /** Writes an any to the value sequence. */
- void writeValue( const ::com::sun::star::uno::Any& rAny );
-
- /** Writes all values to the passed property set. */
- void writeToPropertySet( PropertySet& rPropSet );
-
- /** Creates a sequence of com.sun.star.beans.PropertyValue objects. */
- ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
- createPropertySequence();
-
- // ------------------------------------------------------------------------
-private:
- /** Returns a pointer to the next Any to be written to. */
- ::com::sun::star::uno::Any* getNextAny();
-
-private:
- typedef ::com::sun::star::uno::Sequence< ::rtl::OUString > OUStringSequence;
- typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > UnoAnySequence;
- typedef ::std::vector< sal_Int32 > Int32Vec;
-
- OUStringSequence maNameSeq; /// Sequence of property names.
- UnoAnySequence maValueSeq; /// Sequence of property values.
- Int32Vec maNameOrder; /// Maps initial order to alphabetical order.
- size_t mnNextIndex; /// Counter for next Any to be processed.
-};
-
-// ----------------------------------------------------------------------------
-
-template< typename Type >
-bool PropertySequence::readValue( Type& rValue )
-{
- ::com::sun::star::uno::Any* pAny = getNextAny();
- return pAny && (*pAny >>= rValue);
-}
-
-template< typename Type >
-void PropertySequence::writeValue( const Type& rValue )
-{
- if( ::com::sun::star::uno::Any* pAny = getNextAny() )
- *pAny <<= rValue;
-}
-
-template< typename Type >
-inline PropertySequence& operator>>( PropertySequence& rPropSeq, Type& rValue )
-{
- rPropSeq.readValue( rValue );
- return rPropSeq;
-}
-
-template< typename Type >
-inline PropertySequence& operator<<( PropertySequence& rPropSeq, const Type& rValue )
-{
- rPropSeq.writeValue( rValue );
- return rPropSeq;
-}
-
-inline PropertySequence& operator<<( PropertySequence& rPropSeq, const PropertySet& rPropSet )
-{
- rPropSeq.readFromPropertySet( rPropSet );
- return rPropSeq;
-}
-
-inline PropertySequence& operator>>( PropertySequence& rPropSeq, PropertySet& rPropSet )
-{
- rPropSeq.writeToPropertySet( rPropSet );
- return rPropSeq;
-}
-
-// ============================================================================
-
-} // namespace oox
-
-#endif
-
diff --git a/oox/inc/oox/helper/propertyset.hxx b/oox/inc/oox/helper/propertyset.hxx
index 2e7e387ecbf1..7d18c87a9e85 100644
--- a/oox/inc/oox/helper/propertyset.hxx
+++ b/oox/inc/oox/helper/propertyset.hxx
@@ -88,20 +88,16 @@ public:
/** Gets the specified property from the property set.
@return true, if the any could be filled with the property value. */
- bool getAnyProperty(
- ::com::sun::star::uno::Any& orValue,
- const ::rtl::OUString& rPropName ) const;
+ bool getAnyProperty( ::com::sun::star::uno::Any& orValue, sal_Int32 nPropId ) const;
/** Gets the specified property from the property set.
@return true, if the passed variable could be filled with the property value. */
template< typename Type >
- inline bool getProperty(
- Type& orValue,
- const ::rtl::OUString& rPropName ) const;
+ inline bool getProperty( Type& orValue, sal_Int32 nPropId ) const;
/** Gets the specified boolean property from the property set.
@return true = property contains true; false = property contains false or error occured. */
- bool getBoolProperty( const ::rtl::OUString& rPropName ) const;
+ bool getBoolProperty( sal_Int32 nPropId ) const;
/** Gets the specified properties from the property set. Tries to use the XMultiPropertySet interface.
@param orValues (out-parameter) The related property values.
@@ -113,15 +109,11 @@ public:
// Set properties ---------------------------------------------------------
/** Puts the passed any into the property set. */
- void setAnyProperty(
- const ::rtl::OUString& rPropName,
- const ::com::sun::star::uno::Any& rValue );
+ void setAnyProperty( sal_Int32 nPropId, const ::com::sun::star::uno::Any& rValue );
/** Puts the passed value into the property set. */
template< typename Type >
- inline void setProperty(
- const ::rtl::OUString& rPropName,
- const Type& rValue );
+ inline void setProperty( sal_Int32 nPropId, const Type& rValue );
/** Puts the passed properties into the property set. Tries to use the XMultiPropertySet interface.
@param rPropNames The property names. MUST be ordered alphabetically.
@@ -136,6 +128,14 @@ public:
// ------------------------------------------------------------------------
private:
+ /** Gets the specified property from the property set.
+ @return true, if the any could be filled with the property value. */
+ bool getAnyProperty( ::com::sun::star::uno::Any& orValue, const ::rtl::OUString& rPropName ) const;
+
+ /** Puts the passed any into the property set. */
+ void setAnyProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rValue );
+
+private:
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
mxPropSet; /// The mandatory property set interface.
::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet >
@@ -145,16 +145,16 @@ private:
// ----------------------------------------------------------------------------
template< typename Type >
-inline bool PropertySet::getProperty( Type& orValue, const ::rtl::OUString& rPropName ) const
+inline bool PropertySet::getProperty( Type& orValue, sal_Int32 nPropId ) const
{
::com::sun::star::uno::Any aAny;
- return getAnyProperty( aAny, rPropName ) && (aAny >>= orValue);
+ return getAnyProperty( aAny, nPropId ) && (aAny >>= orValue);
}
template< typename Type >
-inline void PropertySet::setProperty( const ::rtl::OUString& rPropName, const Type& rValue )
+inline void PropertySet::setProperty( sal_Int32 nPropId, const Type& rValue )
{
- setAnyProperty( rPropName, ::com::sun::star::uno::Any( rValue ) );
+ setAnyProperty( nPropId, ::com::sun::star::uno::Any( rValue ) );
}
// ============================================================================
diff --git a/oox/inc/oox/ole/vbainputstream.hxx b/oox/inc/oox/ole/vbainputstream.hxx
index 8116a1e7d0da..c2d6d649d3ef 100644
--- a/oox/inc/oox/ole/vbainputstream.hxx
+++ b/oox/inc/oox/ole/vbainputstream.hxx
@@ -28,8 +28,8 @@
*
************************************************************************/
-#ifndef OOX_HELPER_VBAINPUTSTREAM_HXX
-#define OOX_HELPER_VBAINPUTSTREAM_HXX
+#ifndef OOX_OLE_VBAINPUTSTREAM_HXX
+#define OOX_OLE_VBAINPUTSTREAM_HXX
#include <vector>
#include "oox/helper/binaryinputstream.hxx"
diff --git a/oox/inc/oox/ppt/timenode.hxx b/oox/inc/oox/ppt/timenode.hxx
index de8f57854287..c1485c591c88 100644
--- a/oox/inc/oox/ppt/timenode.hxx
+++ b/oox/inc/oox/ppt/timenode.hxx
@@ -56,11 +56,13 @@ namespace oox { namespace ppt {
class TimeNode
{
public:
+ typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any > UserDataMap;
+
TimeNode( sal_Int16 nNodeType );
virtual ~TimeNode();
NodePropertyMap & getNodeProperties() { return maNodeProperties; }
- PropertyMap & getUserData() { return maUserData; }
+ UserDataMap & getUserData() { return maUserData; }
void addChild( const TimeNodePtr & pChildPtr )
{ maChildren.push_back( pChildPtr ); }
@@ -120,7 +122,7 @@ namespace oox { namespace ppt {
rtl::OUString msId;
NodePropertyMap maNodeProperties;
- PropertyMap maUserData; // a sequence to be stored as "UserData" property
+ UserDataMap maUserData; // a sequence to be stored as "UserData" property
SlideTransition maTransitionFilter;
AnimTargetElementPtr mpTarget;
bool mbHasEndSyncValue; // set to true if we try to get the endSync.
diff --git a/oox/inc/oox/xls/addressconverter.hxx b/oox/inc/oox/xls/addressconverter.hxx
index bf1de1d00297..a62d1aa4a87d 100644
--- a/oox/inc/oox/xls/addressconverter.hxx
+++ b/oox/inc/oox/xls/addressconverter.hxx
@@ -284,12 +284,13 @@ public:
sal_Int32 nLength = SAL_MAX_INT32 );
/** Tries to parse an encoded name of an external link target in BIFF
- documents, e.g. from EXTERNSHEET, SUPBOOK, or DCONREF records.
+ documents, e.g. from EXTERNSHEET or SUPBOOK records.
@param orClassName (out-parameter) DDE server name or OLE class name.
@param orTargetUrl (out-parameter) Target URL, DDE topic or OLE object name.
@param orSheetName (out-parameter) Sheet name in target document.
@param rBiffEncoded Encoded name of the external link target.
+ @param bFromDConRec True = path from DCONREF/DCONNAME/DCONBINAME records, false = other records.
@return Type of the decoded target.
*/
@@ -297,7 +298,8 @@ public:
::rtl::OUString& orClassName,
::rtl::OUString& orTargetUrl,
::rtl::OUString& orSheetName,
- const ::rtl::OUString& rBiffTargetUrl );
+ const ::rtl::OUString& rBiffTargetUrl,
+ bool bFromDConRec = false );
// ------------------------------------------------------------------------
@@ -450,34 +452,51 @@ public:
/** Checks the passed cell range if it fits into the spreadsheet limits.
@param rRange The cell range address to be checked.
+ @param bAllowOverflow true = Allow ranges that start inside the
+ supported sheet limits but may end outside of these limits.
+ false = Do not allow ranges that overflow the supported limits.
@param bTrackOverflow true = Update the internal overflow flags, if
the passed range contains cells outside of the supported sheet
limits.
@return true = Cell range is valid. This function returns also true,
- if only parts of the range are outside the current sheet limits.
- Returns false, if the entire range is outside the sheet limits.
+ if only parts of the range are outside the current sheet limits and
+ such an overflow is allowed via parameter bAllowOverflow. Returns
+ false, if the entire range is outside the sheet limits, or if
+ overflow is not allowed via parameter bAllowOverflow.
*/
bool checkCellRange(
const ::com::sun::star::table::CellRangeAddress& rRange,
- bool bTrackOverflow );
+ bool bAllowOverflow, bool bTrackOverflow );
+
+ /** Checks the passed cell range, may try to fit it to current sheet limits.
- /** Tries to restrict the passed cell range to current sheet limits.
+ First, this function reorders the column and row indexes so that the
+ starting indexes are less than or equal to the end indexes. Then,
+ depending on the parameter bAllowOverflow, the range is just checked or
+ cropped to the current sheet limits.
@param orRange (in-out-parameter) Converts the passed cell range
into a valid cell range address. If the passed range contains cells
outside the currently supported spreadsheet limits, it will be
cropped to these limits.
+ @param bAllowOverflow true = Allow ranges that start inside the
+ supported sheet limits but may end outside of these limits. The
+ cell range returned in orRange will be cropped to these limits.
+ false = Do not allow ranges that overflow the supported limits. The
+ function will return false when the range overflows the sheet limits.
@param bTrackOverflow true = Update the internal overflow flags, if
the original range contains cells outside of the supported sheet
limits.
@return true = Converted range address is valid. This function
- returns also true, if the range has been cropped, but still
- contains cells inside the current sheet limits. Returns false, if
- the entire range is outside the sheet limits.
+ returns also true, if overflowing ranges are allowed via parameter
+ bAllowOverflow and the range has been cropped, but still contains
+ cells inside the current sheet limits. Returns false, if the entire
+ range is outside the sheet limits or overflowing ranges are not
+ allowed via parameter bAllowOverflow.
*/
bool validateCellRange(
::com::sun::star::table::CellRangeAddress& orRange,
- bool bTrackOverflow );
+ bool bAllowOverflow, bool bTrackOverflow );
/** Converts the passed string to a cell range address, without checking
any sheet limits.
@@ -496,24 +515,31 @@ public:
@param orRange (out-parameter) Returns the converted cell range
address. If the original range in the passed string contains cells
- outside the currently supported spreadsheet limits, it will be
- cropped to these limits. Example: the range string "A1:ZZ100000"
- may be converted to the range A1:IV65536.
+ outside the currently supported spreadsheet limits, and parameter
+ bAllowOverflow is set to true, the range will be cropped to these
+ limits. Example: the range string "A1:ZZ100000" may be converted to
+ the range A1:IV65536.
@param rString Cell range string in A1 notation.
@param nSheet Sheet index to be inserted into orRange (will be checked).
+ @param bAllowOverflow true = Allow ranges that start inside the
+ supported sheet limits but may end outside of these limits. The
+ cell range returned in orRange will be cropped to these limits.
+ false = Do not allow ranges that overflow the supported limits.
@param bTrackOverflow true = Update the internal overflow flags, if
the original range contains cells outside of the supported sheet
limits.
@return true = Converted and returned range is valid. This function
- returns also true, if the range has been cropped, but still
- contains cells inside the current sheet limits. Returns false, if
- the entire range is outside the sheet limits.
+ returns also true, if overflowing ranges are allowed via parameter
+ bAllowOverflow and the range has been cropped, but still contains
+ cells inside the current sheet limits. Returns false, if the entire
+ range is outside the sheet limits or overflowing ranges are not
+ allowed via parameter bAllowOverflow.
*/
bool convertToCellRange(
::com::sun::star::table::CellRangeAddress& orRange,
const ::rtl::OUString& rString,
sal_Int16 nSheet,
- bool bTrackOverflow );
+ bool bAllowOverflow, bool bTrackOverflow );
/** Converts the passed range to a cell range address, without checking any
sheet limits.
@@ -530,41 +556,52 @@ public:
/** Tries to convert the passed range to a cell range address.
@param orRange (out-parameter) Returns the converted cell range
- address. If the original range in the passed string contains cells
- outside the currently supported spreadsheet limits, it will be
- cropped to these limits.
+ address. If the passed original range contains cells outside the
+ currently supported spreadsheet limits, and parameter bAllowOverflow
+ is set to true, the range will be cropped to these limits.
@param rBinRange Binary cell range struct.
@param nSheet Sheet index to be inserted into orRange (will be checked).
+ @param bAllowOverflow true = Allow ranges that start inside the
+ supported sheet limits but may end outside of these limits. The
+ cell range returned in orRange will be cropped to these limits.
+ false = Do not allow ranges that overflow the supported limits.
@param bTrackOverflow true = Update the internal overflow flags, if
the original range contains cells outside of the supported sheet
limits.
@return true = Converted and returned range is valid. This function
- returns also true, if the range has been cropped, but still
- contains cells inside the current sheet limits. Returns false, if
- the entire range is outside the sheet limits.
+ returns also true, if overflowing ranges are allowed via parameter
+ bAllowOverflow and the range has been cropped, but still contains
+ cells inside the current sheet limits. Returns false, if the entire
+ range is outside the sheet limits or if overflowing ranges are not
+ allowed via parameter bAllowOverflow.
*/
bool convertToCellRange(
::com::sun::star::table::CellRangeAddress& orRange,
const BinRange& rBinRange,
sal_Int16 nSheet,
- bool bTrackOverflow );
+ bool bAllowOverflow, bool bTrackOverflow );
// ------------------------------------------------------------------------
/** Checks the passed cell range list if it fits into the spreadsheet limits.
@param rRanges The cell range list to be checked.
+ @param bAllowOverflow true = Allow ranges that start inside the
+ supported sheet limits but may end outside of these limits.
+ false = Do not allow ranges that overflow the supported limits.
@param bTrackOverflow true = Update the internal overflow flags, if
the passed range list contains cells outside of the supported sheet
limits.
@return true = All cell ranges are valid. This function returns also
- true, if only parts of the ranges are outside the current sheet
- limits. Returns false, if one of the ranges is completely outside
- the sheet limits.
+ true, if overflowing ranges are allowed via parameter bAllowOverflow
+ and only parts of the ranges are outside the current sheet limits.
+ Returns false, if one of the ranges is completely outside the sheet
+ limits or if overflowing ranges are not allowed via parameter
+ bAllowOverflow.
*/
bool checkCellRangeList(
const ApiCellRangeList& rRanges,
- bool bTrackOverflow );
+ bool bAllowOverflow, bool bTrackOverflow );
/** Tries to restrict the passed cell range list to current sheet limits.
@@ -624,20 +661,26 @@ private:
void initializeMaxPos(
sal_Int16 nMaxXlsTab, sal_Int32 nMaxXlsCol, sal_Int32 nMaxXlsRow );
- void initializeEncodedUrl(
- sal_Unicode cUrlThisWorkbook, sal_Unicode cUrlExternal,
- sal_Unicode cUrlThisSheet, sal_Unicode cUrlInternal,
- sal_Unicode cUrlSameSheet );
-
private:
+ struct ControlCharacters
+ {
+ sal_Unicode mcThisWorkbook; /// Control character: Link to current workbook.
+ sal_Unicode mcExternal; /// Control character: Link to external workbook/sheet.
+ sal_Unicode mcThisSheet; /// Control character: Link to current sheet.
+ sal_Unicode mcInternal; /// Control character: Link to internal sheet.
+ sal_Unicode mcSameSheet; /// Control character: Link to same sheet (special '!A1' syntax).
+
+ void set(
+ sal_Unicode cThisWorkbook, sal_Unicode cExternal,
+ sal_Unicode cThisSheet, sal_Unicode cInternal,
+ sal_Unicode cSameSheet );
+ };
+
::com::sun::star::table::CellAddress maMaxApiPos; /// Maximum valid cell address in Calc.
::com::sun::star::table::CellAddress maMaxXlsPos; /// Maximum valid cell address in Excel.
::com::sun::star::table::CellAddress maMaxPos; /// Maximum valid cell address in Calc/Excel.
- sal_Unicode mcUrlThisWorkbook; /// Control character: Link to current workbook.
- sal_Unicode mcUrlExternal; /// Control character: Link to external workbook/sheet.
- sal_Unicode mcUrlThisSheet; /// Control character: Link to current sheet.
- sal_Unicode mcUrlInternal; /// Control character: Link to internal sheet.
- sal_Unicode mcUrlSameSheet; /// Control character: Link to same sheet (special '!A1' syntax).
+ ControlCharacters maLinkChars; /// Control characters for external link import (BIFF).
+ ControlCharacters maDConChars; /// Control characters for DCON* record import (BIFF).
bool mbColOverflow; /// Flag for "columns overflow".
bool mbRowOverflow; /// Flag for "rows overflow".
bool mbTabOverflow; /// Flag for "tables overflow".
diff --git a/oox/inc/oox/xls/autofiltercontext.hxx b/oox/inc/oox/xls/autofiltercontext.hxx
index b6b484975874..7b4d65ba9120 100644
--- a/oox/inc/oox/xls/autofiltercontext.hxx
+++ b/oox/inc/oox/xls/autofiltercontext.hxx
@@ -86,7 +86,7 @@ public:
protected:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onStartElement( const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
diff --git a/oox/inc/oox/xls/biffcodec.hxx b/oox/inc/oox/xls/biffcodec.hxx
index 5656ead8be80..165a608d46fd 100644
--- a/oox/inc/oox/xls/biffcodec.hxx
+++ b/oox/inc/oox/xls/biffcodec.hxx
@@ -31,6 +31,7 @@
#ifndef OOX_XLS_BIFFCODEC_HXX
#define OOX_XLS_BIFFCODEC_HXX
+#include <vector>
#include "oox/core/binarycodec.hxx"
#include "oox/xls/workbookhelper.hxx"
@@ -47,19 +48,6 @@ const sal_Int64 BIFF_RCF_BLOCKSIZE = 1024;
// ============================================================================
-/** Helper functions for BIFF stream codecs. */
-class BiffCodecHelper
-{
-public:
- /** Returns the fixed password for workbook protection. */
- static const ::rtl::OString& getBiff5WbProtPassword();
-
- /** Returns the fixed password for workbook protection. */
- static const ::rtl::OUString& getBiff8WbProtPassword();
-};
-
-// ============================================================================
-
/** Base class for BIFF stream decoders. */
class BiffDecoderBase : public WorkbookHelper
{
@@ -67,6 +55,9 @@ public:
explicit BiffDecoderBase( const WorkbookHelper& rHelper );
virtual ~BiffDecoderBase();
+ /** Derived classes return a clone of the decoder for usage in new streams. */
+ inline BiffDecoderBase* clone() { return implClone(); }
+
/** Returns the current error code of the decoder. */
inline sal_Int32 getErrorCode() const { return mnError; }
/** Returns true, if the decoder has been constructed successfully.
@@ -81,10 +72,16 @@ public:
sal_uInt16 nBytes );
protected:
+ /** Copy constructor for cloning. */
+ BiffDecoderBase( const BiffDecoderBase& rDecoder );
+
/** Sets the decoder to a state showing whether the password was correct. */
void setHasValidPassword( bool bValid );
private:
+ /** Derived classes return a clone of the decoder for usage in new streams. */
+ virtual BiffDecoderBase* implClone() = 0;
+
/** Implementation of decryption of a memory block. */
virtual void implDecode(
sal_uInt8* pnDestData,
@@ -119,11 +116,15 @@ public:
sal_uInt16 nKey, sal_uInt16 nHash );
private:
+ /** Copy constructor for cloning. */
+ BiffDecoder_XOR( const BiffDecoder_XOR& rDecoder );
+
/** Initializes the wrapped codec object. After that, internal status can
be querried with isValid(). */
- void init(
- const ::rtl::OString& rPass,
- sal_uInt16 nKey, sal_uInt16 nHash );
+ void init( const ::rtl::OString& rPass );
+
+ /** Returns a clone of the decoder for usage in new streams. */
+ virtual BiffDecoder_XOR* implClone();
/** Implementation of decryption of a memory block. */
virtual void implDecode(
@@ -134,6 +135,9 @@ private:
private:
::oox::core::BinaryCodec_XOR maCodec; /// Cipher algorithm implementation.
+ ::rtl::OString maPass;
+ sal_uInt16 mnKey;
+ sal_uInt16 mnHash;
};
// ============================================================================
@@ -161,13 +165,15 @@ public:
sal_uInt8 pnSaltHash[ 16 ] );
private:
+ /** Copy constructor for cloning. */
+ BiffDecoder_RCF( const BiffDecoder_RCF& rDecoder );
+
/** Initializes the wrapped codec object. After that, internal status can
be querried with isValid(). */
- void init(
- const ::rtl::OUString& rPass,
- sal_uInt8 pnDocId[ 16 ],
- sal_uInt8 pnSaltData[ 16 ],
- sal_uInt8 pnSaltHash[ 16 ] );
+ void init( const ::rtl::OUString& rPass );
+
+ /** Returns a clone of the decoder for usage in new streams. */
+ virtual BiffDecoder_RCF* implClone();
/** Implementation of decryption of a memory block. */
virtual void implDecode(
@@ -178,6 +184,44 @@ private:
private:
::oox::core::BinaryCodec_RCF maCodec; /// Cipher algorithm implementation.
+ ::rtl::OUString maPass;
+ ::std::vector< sal_uInt8 > maDocId;
+ ::std::vector< sal_uInt8 > maSaltData;
+ ::std::vector< sal_uInt8 > maSaltHash;
+};
+
+// ============================================================================
+
+/** Helper for BIFF stream codecs. Holds the used codec object. */
+class BiffCodecHelper : public WorkbookHelper
+{
+public:
+ explicit BiffCodecHelper( const WorkbookHelper& rHelper );
+
+ /** Returns the fixed password for workbook protection. */
+ static const ::rtl::OString& getBiff5WbProtPassword();
+ /** Returns the fixed password for workbook protection. */
+ static const ::rtl::OUString& getBiff8WbProtPassword();
+
+ /** Looks for a password provided via API, or queries it via GUI. */
+ ::rtl::OUString queryPassword();
+
+ /** Imports the FILEPASS record and sets a decoder at the stream. */
+ bool importFilePass( BiffInputStream& rStrm );
+ /** Clones the contained decoder object if existing and sets it at the passed stream. */
+ void cloneDecoder( BiffInputStream& rStrm );
+
+private:
+ void importFilePass_XOR( BiffInputStream& rStrm );
+ void importFilePass_RCF( BiffInputStream& rStrm );
+ void importFilePass_Strong( BiffInputStream& rStrm );
+ void importFilePass2( BiffInputStream& rStrm );
+ void importFilePass8( BiffInputStream& rStrm );
+
+private:
+ BiffDecoderRef mxDecoder; /// The decoder for import filter.
+ ::rtl::OUString maPassword; /// Password for stream encoder/decoder.
+ bool mbHasPassword; /// True = password already querried.
};
// ============================================================================
diff --git a/oox/inc/oox/xls/biffhelper.hxx b/oox/inc/oox/xls/biffhelper.hxx
index 0069f5ee5bb8..09d3ffcba2b4 100644
--- a/oox/inc/oox/xls/biffhelper.hxx
+++ b/oox/inc/oox/xls/biffhelper.hxx
@@ -42,6 +42,8 @@ class BiffOutputStream;
// OOBIN record identifiers ===================================================
const sal_Int32 OOBIN_ID_ARRAY = 0x01AA;
+const sal_Int32 OOBIN_ID_AUTOFILTER = 0x00A1;
+const sal_Int32 OOBIN_ID_AUTOSORTSCOPE = 0x01CB;
const sal_Int32 OOBIN_ID_BINARYINDEXBLOCK = 0x002A;
const sal_Int32 OOBIN_ID_BINARYINDEXROWS = 0x0028;
const sal_Int32 OOBIN_ID_BOOKVIEWS = 0x0087;
@@ -74,6 +76,12 @@ const sal_Int32 OOBIN_ID_COLOR = 0x023C;
const sal_Int32 OOBIN_ID_COLORS = 0x01D9;
const sal_Int32 OOBIN_ID_COLORSCALE = 0x01D5;
const sal_Int32 OOBIN_ID_COLS = 0x0186;
+const sal_Int32 OOBIN_ID_COMMENT = 0x027B;
+const sal_Int32 OOBIN_ID_COMMENTAUTHOR = 0x0278;
+const sal_Int32 OOBIN_ID_COMMENTAUTHORS = 0x0276;
+const sal_Int32 OOBIN_ID_COMMENTLIST = 0x0279;
+const sal_Int32 OOBIN_ID_COMMENTS = 0x0274;
+const sal_Int32 OOBIN_ID_COMMENTTEXT = 0x027D;
const sal_Int32 OOBIN_ID_CONDFORMATTING = 0x01CD;
const sal_Int32 OOBIN_ID_CONTROL = 0x0284;
const sal_Int32 OOBIN_ID_CONTROLS = 0x0283;
@@ -116,6 +124,7 @@ const sal_Int32 OOBIN_ID_EXTSHEETNAMES = 0x0167;
const sal_Int32 OOBIN_ID_FILEVERSION = 0x0080;
const sal_Int32 OOBIN_ID_FILL = 0x002D;
const sal_Int32 OOBIN_ID_FILLS = 0x025B;
+const sal_Int32 OOBIN_ID_FILTERCOLUMN = 0x00A3;
const sal_Int32 OOBIN_ID_FONT = 0x002B;
const sal_Int32 OOBIN_ID_FONTS = 0x0263;
const sal_Int32 OOBIN_ID_FORMULA_STRING = 0x0008;
@@ -147,9 +156,56 @@ const sal_Int32 OOBIN_ID_OLEOBJECTS = 0x027E;
const sal_Int32 OOBIN_ID_PAGEMARGINS = 0x01DC;
const sal_Int32 OOBIN_ID_PAGESETUP = 0x01DE;
const sal_Int32 OOBIN_ID_PANE = 0x0097;
+const sal_Int32 OOBIN_ID_PCDEFINITION = 0x00B3;
+const sal_Int32 OOBIN_ID_PCDFDISCRETEPR = 0x00E1;
+const sal_Int32 OOBIN_ID_PCDFGROUPITEMS = 0x00DD;
+const sal_Int32 OOBIN_ID_PCDFIELD = 0x00B7;
+const sal_Int32 OOBIN_ID_PCDFIELDGROUP = 0x00DB;
+const sal_Int32 OOBIN_ID_PCDFIELDS = 0x00B5;
+const sal_Int32 OOBIN_ID_PCDFRANGEPR = 0x00DF;
+const sal_Int32 OOBIN_ID_PCDFSHAREDITEMS = 0x00BD;
+const sal_Int32 OOBIN_ID_PCDSHEETSOURCE = 0x00BB;
+const sal_Int32 OOBIN_ID_PCDSOURCE = 0x00B9;
+const sal_Int32 OOBIN_ID_PCITEM_ARRAY = 0x00BF;
+const sal_Int32 OOBIN_ID_PCITEM_BOOL = 0x0016;
+const sal_Int32 OOBIN_ID_PCITEM_DATE = 0x0019;
+const sal_Int32 OOBIN_ID_PCITEM_DOUBLE = 0x0015;
+const sal_Int32 OOBIN_ID_PCITEM_ERROR = 0x0017;
+const sal_Int32 OOBIN_ID_PCITEM_INDEX = 0x001A;
+const sal_Int32 OOBIN_ID_PCITEM_MISSING = 0x0014;
+const sal_Int32 OOBIN_ID_PCITEM_STRING = 0x0018;
+const sal_Int32 OOBIN_ID_PCITEMA_BOOL = 0x001D;
+const sal_Int32 OOBIN_ID_PCITEMA_DATE = 0x0020;
+const sal_Int32 OOBIN_ID_PCITEMA_DOUBLE = 0x001C;
+const sal_Int32 OOBIN_ID_PCITEMA_ERROR = 0x001E;
+const sal_Int32 OOBIN_ID_PCITEMA_MISSING = 0x001B;
+const sal_Int32 OOBIN_ID_PCITEMA_STRING = 0x001F;
+const sal_Int32 OOBIN_ID_PCRECORD = 0x0021;
+const sal_Int32 OOBIN_ID_PCRECORDDT = 0x0022;
+const sal_Int32 OOBIN_ID_PCRECORDS = 0x00C1;
const sal_Int32 OOBIN_ID_PHONETICPR = 0x0219;
const sal_Int32 OOBIN_ID_PICTURE = 0x0232;
+const sal_Int32 OOBIN_ID_PIVOTAREA = 0x00F7;
+const sal_Int32 OOBIN_ID_PIVOTCACHE = 0x0182;
+const sal_Int32 OOBIN_ID_PIVOTCACHES = 0x0180;
const sal_Int32 OOBIN_ID_PRINTOPTIONS = 0x01DD;
+const sal_Int32 OOBIN_ID_PTCOLFIELDS = 0x0137;
+const sal_Int32 OOBIN_ID_PTDATAFIELD = 0x0125;
+const sal_Int32 OOBIN_ID_PTDATAFIELDS = 0x0127;
+const sal_Int32 OOBIN_ID_PTDEFINITION = 0x0118;
+const sal_Int32 OOBIN_ID_PTFIELD = 0x011D;
+const sal_Int32 OOBIN_ID_PTFIELDS = 0x011F;
+const sal_Int32 OOBIN_ID_PTFILTER = 0x0259;
+const sal_Int32 OOBIN_ID_PTFILTERS = 0x0257;
+const sal_Int32 OOBIN_ID_PTFITEM = 0x011A;
+const sal_Int32 OOBIN_ID_PTFITEMS = 0x011B;
+const sal_Int32 OOBIN_ID_PTLOCATION = 0x013A;
+const sal_Int32 OOBIN_ID_PTPAGEFIELD = 0x0121;
+const sal_Int32 OOBIN_ID_PTPAGEFIELDS = 0x0123;
+const sal_Int32 OOBIN_ID_PTREFERENCE = 0x00FB;
+const sal_Int32 OOBIN_ID_PTREFERENCEITEM = 0x017E;
+const sal_Int32 OOBIN_ID_PTREFERENCES = 0x00F9;
+const sal_Int32 OOBIN_ID_PTROWFIELDS = 0x0135;
const sal_Int32 OOBIN_ID_RGBCOLOR = 0x01DB;
const sal_Int32 OOBIN_ID_ROW = 0x0000;
const sal_Int32 OOBIN_ID_ROWBREAKS = 0x0188;
@@ -171,6 +227,7 @@ const sal_Int32 OOBIN_ID_TABLEPART = 0x0295;
const sal_Int32 OOBIN_ID_TABLEPARTS = 0x0294;
const sal_Int32 OOBIN_ID_TABLESTYLEINFO = 0x0201;
const sal_Int32 OOBIN_ID_TABLESTYLES = 0x01FC;
+const sal_Int32 OOBIN_ID_TOP10FILTER = 0x00AA;
const sal_Int32 OOBIN_ID_VOLTYPE = 0x0204;
const sal_Int32 OOBIN_ID_VOLTYPEMAIN = 0x0206;
const sal_Int32 OOBIN_ID_VOLTYPES = 0x0202;
@@ -286,6 +343,7 @@ const sal_uInt16 BIFF2_ID_DATATABLE2 = 0x0037;
const sal_uInt16 BIFF_ID_DATAVALIDATION = 0x01BE;
const sal_uInt16 BIFF_ID_DATAVALIDATIONS = 0x01B2;
const sal_uInt16 BIFF_ID_DATEMODE = 0x0022;
+const sal_uInt16 BIFF_ID_DCONBINAME = 0x01B5;
const sal_uInt16 BIFF_ID_DCONNAME = 0x0052;
const sal_uInt16 BIFF_ID_DCONREF = 0x0051;
const sal_uInt16 BIFF_ID_DEFCOLWIDTH = 0x0055;
@@ -342,16 +400,44 @@ const sal_uInt16 BIFF2_ID_NUMBER = 0x0003;
const sal_uInt16 BIFF3_ID_NUMBER = 0x0203;
const sal_uInt16 BIFF_ID_OBJ = 0x005D;
const sal_uInt16 BIFF_ID_OBJECTPROTECT = 0x0063;
+const sal_uInt16 BIFF_ID_PAGESETUP = 0x00A1;
const sal_uInt16 BIFF_ID_PALETTE = 0x0092;
const sal_uInt16 BIFF_ID_PANE = 0x0041;
const sal_uInt16 BIFF_ID_PASSWORD = 0x0013;
+const sal_uInt16 BIFF_ID_PCDEFINITION = 0x00C6;
+const sal_uInt16 BIFF_ID_PCDEFINITION2 = 0x0122;
+const sal_uInt16 BIFF_ID_PCDFDISCRETEPR = 0x00D9;
+const sal_uInt16 BIFF_ID_PCDFIELD = 0x00C7;
+const sal_uInt16 BIFF_ID_PCDFIELDINDEX = 0x0103;
+const sal_uInt16 BIFF_ID_PCDFORMULAFIELD = 0x00F9;
+const sal_uInt16 BIFF_ID_PCDFRANGEPR = 0x00D8;
+const sal_uInt16 BIFF_ID_PCDFSQLTYPE = 0x01BB;
+const sal_uInt16 BIFF_ID_PCDSOURCE = 0x00E3;
+const sal_uInt16 BIFF_ID_PCITEM_BOOL = 0x00CA;
+const sal_uInt16 BIFF_ID_PCITEM_DATE = 0x00CE;
+const sal_uInt16 BIFF_ID_PCITEM_DOUBLE = 0x00C9;
+const sal_uInt16 BIFF_ID_PCITEM_ERROR = 0x00CB;
+const sal_uInt16 BIFF_ID_PCITEM_INDEXLIST = 0x00C8;
+const sal_uInt16 BIFF_ID_PCITEM_INTEGER = 0x00CC;
+const sal_uInt16 BIFF_ID_PCITEM_MISSING = 0x00CF;
+const sal_uInt16 BIFF_ID_PCITEM_STRING = 0x00CD;
const sal_uInt16 BIFF_ID_PHONETICPR = 0x00EF;
const sal_uInt16 BIFF_ID_PICTURE = 0x00E9;
+const sal_uInt16 BIFF_ID_PIVOTCACHE = 0x00D5;
const sal_uInt16 BIFF_ID_PRECISION = 0x000E;
const sal_uInt16 BIFF_ID_PRINTGRIDLINES = 0x002B;
const sal_uInt16 BIFF_ID_PRINTHEADERS = 0x002A;
const sal_uInt16 BIFF_ID_PROJEXTSHEET = 0x00A3;
const sal_uInt16 BIFF_ID_PROTECT = 0x0012;
+const sal_uInt16 BIFF_ID_PTDATAFIELD = 0x00C5;
+const sal_uInt16 BIFF_ID_PTDEFINITION = 0x00B0;
+const sal_uInt16 BIFF_ID_PTDEFINITION2 = 0x00F1;
+const sal_uInt16 BIFF_ID_PTFIELD = 0x00B1;
+const sal_uInt16 BIFF_ID_PTFIELD2 = 0x0100;
+const sal_uInt16 BIFF_ID_PTFITEM = 0x00B2;
+const sal_uInt16 BIFF_ID_PTPAGEFIELDS = 0x00B6;
+const sal_uInt16 BIFF_ID_PTROWCOLFIELDS = 0x00B4;
+const sal_uInt16 BIFF_ID_PTROWCOLITEMS = 0x00B5;
const sal_uInt16 BIFF_ID_REFMODE = 0x000F;
const sal_uInt16 BIFF_ID_RIGHTMARGIN = 0x0027;
const sal_uInt16 BIFF_ID_RK = 0x027E;
@@ -363,7 +449,6 @@ const sal_uInt16 BIFF_ID_SCL = 0x00A0;
const sal_uInt16 BIFF_ID_SCENPROTECT = 0x00DD;
const sal_uInt16 BIFF_ID_SCREENTIP = 0x0800;
const sal_uInt16 BIFF_ID_SELECTION = 0x001D;
-const sal_uInt16 BIFF_ID_PAGESETUP = 0x00A1;
const sal_uInt16 BIFF_ID_SHAREDFMLA = 0x04BC;
const sal_uInt16 BIFF_ID_SHEET = 0x0085;
const sal_uInt16 BIFF_ID_SHEETHEADER = 0x008F;
@@ -371,21 +456,10 @@ const sal_uInt16 BIFF_ID_SHEETPR = 0x0081;
const sal_uInt16 BIFF_ID_SHEETPROTECTION = 0x0867;
const sal_uInt16 BIFF_ID_SST = 0x00FC;
const sal_uInt16 BIFF_ID_STANDARDWIDTH = 0x0099;
-const sal_uInt16 BIFF_ID_SXDATETIME = 0x00CE;
-const sal_uInt16 BIFF_ID_SXDB = 0x00C6;
-const sal_uInt16 BIFF_ID_SXDI = 0x00C5;
-const sal_uInt16 BIFF_ID_SXEXT = 0x00DC;
-const sal_uInt16 BIFF_ID_SXFIELD = 0x00C7;
-const sal_uInt16 BIFF_ID_SXIVD = 0x00B4;
-const sal_uInt16 BIFF_ID_SXLI = 0x00B5;
-const sal_uInt16 BIFF_ID_SXSTRING = 0x00CD;
-const sal_uInt16 BIFF_ID_SXVD = 0x00B1;
-const sal_uInt16 BIFF_ID_SXVDEX = 0x0100;
-const sal_uInt16 BIFF_ID_SXVI = 0x00B2;
-const sal_uInt16 BIFF_ID_SXVIEW = 0x00B0;
const sal_uInt16 BIFF2_ID_STRING = 0x0007;
const sal_uInt16 BIFF3_ID_STRING = 0x0207;
const sal_uInt16 BIFF_ID_STYLE = 0x0293;
+const sal_uInt16 BIFF_ID_SXEXT = 0x00DC;
const sal_uInt16 BIFF_ID_TOPMARGIN = 0x0028;
const sal_uInt16 BIFF_ID_TXO = 0x01B6;
const sal_uInt16 BIFF_ID_UNCALCED = 0x005E;
diff --git a/oox/inc/oox/xls/biffinputstream.hxx b/oox/inc/oox/xls/biffinputstream.hxx
index 899909021c64..08d707a67175 100644
--- a/oox/inc/oox/xls/biffinputstream.hxx
+++ b/oox/inc/oox/xls/biffinputstream.hxx
@@ -55,7 +55,7 @@ public:
inline const BinaryInputStream& getBaseStream() const { return mrInStrm; }
/** Sets a decoder object and decrypts buffered record data. */
- void setDecoder( BiffDecoderRef xDecoder );
+ void setDecoder( const BiffDecoderRef& rxDecoder );
/** Returns the current decoder object. */
inline BiffDecoderRef getDecoder() const { return mxDecoder; }
/** Enables/disables usage of current decoder. */
@@ -146,7 +146,7 @@ private:
record (not the record header) will be encrypted by Excel if the file has
been stored with password protection. The functions setDecoder() and
enableDecoder() control the usage of the decryption algorithms.
- setDecoder() sets´a new decryption algorithm and initially enables it.
+ setDecoder() sets a new decryption algorithm and initially enables it.
enableDecoder( false ) may be used to stop the usage of the decryption
temporarily (sometimes record contents are never encrypted, e.g. all BOF
records or the stream position in SHEET records). Decryption will be
@@ -220,10 +220,7 @@ public:
Enables decryption of record contents for the rest of the stream.
*/
- void setDecoder( BiffDecoderRef xDecoder );
-
- /** Returns the current decoder object. */
- BiffDecoderRef getDecoder() const;
+ void setDecoder( const BiffDecoderRef& rxDecoder );
/** Enables/disables usage of current decoder.
diff --git a/oox/inc/oox/xls/chartsheetfragment.hxx b/oox/inc/oox/xls/chartsheetfragment.hxx
index dfb08230f5d5..d1effba29166 100644
--- a/oox/inc/oox/xls/chartsheetfragment.hxx
+++ b/oox/inc/oox/xls/chartsheetfragment.hxx
@@ -50,12 +50,10 @@ public:
protected:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onStartElement( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
- virtual ContextWrapper onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
// oox.core.FragmentHandler2 interface ------------------------------------
diff --git a/oox/inc/oox/xls/commentsbuffer.hxx b/oox/inc/oox/xls/commentsbuffer.hxx
new file mode 100644
index 000000000000..663f94878a6d
--- /dev/null
+++ b/oox/inc/oox/xls/commentsbuffer.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: commentsbuffer.hxx,v $
+ * $Revision: 1.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_XLS_COMMENTSBUFFER_HXX
+#define OOX_XLS_COMMENTSBUFFER_HXX
+
+#include "oox/xls/richstring.hxx"
+#include "oox/xls/worksheethelper.hxx"
+
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+struct CommentModel
+{
+ ::com::sun::star::table::CellRangeAddress
+ maRange; /// Position of the comment in the worksheet.
+ RichStringRef mxText; /// Formatted text of the comment.
+ sal_Int32 mnAuthorId; /// Identifier of the comment's author.
+
+ explicit CommentModel();
+};
+
+// ----------------------------------------------------------------------------
+
+class Comment : public WorksheetHelper
+{
+public:
+ explicit Comment( const WorksheetHelper& rHelper );
+
+ /** Imports a cell comment from the passed attributes of the comment element. */
+ void importComment( const AttributeList& rAttribs );
+ /** Imports a cell comment from the passed stream of a COMMENT record. */
+ void importComment( RecordInputStream& rStrm );
+
+ /** Creates and returns a new rich-string object for the comment text. */
+ RichStringRef createText();
+
+ /** Finalizes the formatted string of the comment. */
+ void finalizeImport();
+
+private:
+ CommentModel maModel;
+};
+
+typedef ::boost::shared_ptr< Comment > CommentRef;
+
+// ============================================================================
+
+class CommentsBuffer : public WorksheetHelper
+{
+public:
+ explicit CommentsBuffer( const WorksheetHelper& rHelper );
+
+ /** Appends a new author to the list of comment authors. */
+ void appendAuthor( const ::rtl::OUString& rAuthor );
+ /** Creates and returns a new comment. */
+ CommentRef createComment();
+
+ /** Finalizes the formatted string of all comments. */
+ void finalizeImport();
+
+private:
+ typedef ::std::vector< ::rtl::OUString > OUStringVector;
+ typedef RefVector< Comment > CommentVector;
+
+ OUStringVector maAuthors;
+ CommentVector maComments;
+};
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
+
+#endif
+
diff --git a/oox/inc/oox/xls/commentsfragment.hxx b/oox/inc/oox/xls/commentsfragment.hxx
new file mode 100644
index 000000000000..e23369e9909c
--- /dev/null
+++ b/oox/inc/oox/xls/commentsfragment.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: commentsfragment.hxx,v $
+ * $Revision: 1.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ***********************************************************************/
+
+#ifndef OOX_XLS_COMMENTSFRAGMENT_HXX
+#define OOX_XLS_COMMENTSFRAGMENT_HXX
+
+#include "oox/xls/commentsbuffer.hxx"
+#include "oox/xls/excelhandlers.hxx"
+
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+class OoxCommentsFragment : public OoxWorksheetFragmentBase
+{
+public:
+ explicit OoxCommentsFragment(
+ const WorksheetHelper& rHelper,
+ const ::rtl::OUString& rFragmentPath );
+protected:
+ // oox.core.ContextHandler2Helper interface -------------------------------
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onEndElement( const ::rtl::OUString& rChars );
+
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual void onEndRecord();
+
+ // oox.core.FragmentHandler2 interface ------------------------------------
+
+ virtual const ::oox::core::RecordInfo* getRecordInfos() const;
+
+private:
+ /** Imports comment data from the comment element. */
+ void importComment( const AttributeList& rAttribs );
+ /** Imports comment data from the COMMENT record. */
+ void importComment( RecordInputStream& rStrm );
+
+private:
+ CommentRef mxComment;
+};
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
+
+#endif
+
diff --git a/oox/inc/oox/xls/condformatbuffer.hxx b/oox/inc/oox/xls/condformatbuffer.hxx
index cf4d2e6c1d1e..fad078942da2 100644
--- a/oox/inc/oox/xls/condformatbuffer.hxx
+++ b/oox/inc/oox/xls/condformatbuffer.hxx
@@ -45,8 +45,8 @@ namespace xls {
// ============================================================================
-/** Cointains OOX data for a single rule in a conditional formatting. */
-struct OoxCondFormatRuleData
+/** Model for a single rule in a conditional formatting. */
+struct CondFormatRuleModel
{
typedef ::std::vector< TokensFormulaContext > ContextVector;
@@ -65,7 +65,7 @@ struct OoxCondFormatRuleData
bool mbAboveAverage; /// In average rules: True = above average, false = below.
bool mbEqualAverage; /// In average rules: True = include average, false = exclude.
- explicit OoxCondFormatRuleData();
+ explicit CondFormatRuleModel();
/** Sets the passed OOBIN or BIFF operator for condition type cellIs. */
void setBinOperator( sal_Int32 nOperator );
@@ -100,24 +100,24 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetConditionalEntries >& rxEntries );
/** Returns the priority of this rule. */
- inline sal_Int32 getPriority() const { return maOoxData.mnPriority; }
+ inline sal_Int32 getPriority() const { return maModel.mnPriority; }
private:
const CondFormat& mrCondFormat;
- OoxCondFormatRuleData maOoxData;
+ CondFormatRuleModel maModel;
};
typedef ::boost::shared_ptr< CondFormatRule > CondFormatRuleRef;
// ============================================================================
-/** Cointains OOX data for a conditional formatting. */
-struct OoxCondFormatData
+/** Model for a conditional formatting object. */
+struct CondFormatModel
{
ApiCellRangeList maRanges; /// Cell ranges for this conditional format.
bool mbPivot; /// Conditional formatting belongs to pivot table.
- explicit OoxCondFormatData();
+ explicit CondFormatModel();
};
// ============================================================================
@@ -145,7 +145,7 @@ public:
void finalizeImport();
/** Returns the cell ranges this conditional formatting belongs to. */
- inline const ApiCellRangeList& getRanges() const { return maOoxData.maRanges; }
+ inline const ApiCellRangeList& getRanges() const { return maModel.maRanges; }
private:
CondFormatRuleRef createRule();
@@ -154,7 +154,7 @@ private:
private:
typedef RefMap< sal_Int32, CondFormatRule > CondFormatRuleMap;
- OoxCondFormatData maOoxData; /// Data of this conditional formatting.
+ CondFormatModel maModel; /// Model of this conditional formatting.
CondFormatRuleMap maRules; /// Maps formatting rules by priority.
};
diff --git a/oox/inc/oox/xls/condformatcontext.hxx b/oox/inc/oox/xls/condformatcontext.hxx
index 072abb0e2a92..be17451dd8b7 100644
--- a/oox/inc/oox/xls/condformatcontext.hxx
+++ b/oox/inc/oox/xls/condformatcontext.hxx
@@ -47,11 +47,11 @@ public:
protected:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onStartElement( const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
- virtual ContextWrapper onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
virtual void onStartRecord( RecordInputStream& rStrm );
private:
diff --git a/oox/inc/oox/xls/connectionsfragment.hxx b/oox/inc/oox/xls/connectionsfragment.hxx
index b53695da3688..111cd151a6ca 100644
--- a/oox/inc/oox/xls/connectionsfragment.hxx
+++ b/oox/inc/oox/xls/connectionsfragment.hxx
@@ -49,8 +49,7 @@ public:
protected:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onStartElement( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
private:
void importConnection( const AttributeList& rAttribs );
diff --git a/oox/inc/oox/xls/defnamesbuffer.hxx b/oox/inc/oox/xls/defnamesbuffer.hxx
index b3f08d9e537b..88e4f7272d8e 100644
--- a/oox/inc/oox/xls/defnamesbuffer.hxx
+++ b/oox/inc/oox/xls/defnamesbuffer.hxx
@@ -66,7 +66,7 @@ const sal_Unicode OOX_DEFNAME_UNKNOWN = '\x0E';
// ============================================================================
-struct OoxDefinedNameData
+struct DefinedNameModel
{
::rtl::OUString maName; /// The original name.
::rtl::OUString maFormula; /// The formula string.
@@ -77,7 +77,7 @@ struct OoxDefinedNameData
bool mbVBName; /// True = VBasic macro, false = sheet macro.
bool mbHidden; /// True = name hidden in UI.
- explicit OoxDefinedNameData();
+ explicit DefinedNameModel();
};
// ============================================================================
@@ -89,17 +89,17 @@ public:
explicit DefinedNameBase( const WorkbookHelper& rHelper, sal_Int32 nLocalSheet );
/** Returns true, if this defined name is global in the document. */
- inline bool isGlobalName() const { return maOoxData.mnSheet < 0; }
+ inline bool isGlobalName() const { return maModel.mnSheet < 0; }
/** Returns the original name as imported from or exported to the file. */
- inline const ::rtl::OUString& getOoxName() const { return maOoxData.maName; }
+ inline const ::rtl::OUString& getModelName() const { return maModel.maName; }
/** Returns the name as used in the Calc document. */
- inline const ::rtl::OUString& getDocName() const { return maFinalName; }
+ inline const ::rtl::OUString& getCalcName() const { return maCalcName; }
/** Returns the 0-based sheet index for local names, or -1 for global names. */
- inline sal_Int32 getSheetIndex() const { return maOoxData.mnSheet; }
+ inline sal_Int32 getSheetIndex() const { return maModel.mnSheet; }
/** Returns the original name as imported from or exported to the file. */
- const ::rtl::OUString& getUpcaseOoxName() const;
+ const ::rtl::OUString& getUpcaseModelName() const;
/** Returns an Any with a SingleReference or ComplexReference, or an empty Any. */
::com::sun::star::uno::Any getReference( const ::com::sun::star::table::CellAddress& rBaseAddress ) const;
@@ -115,9 +115,9 @@ protected:
void setReference( const ApiTokenSequence& rTokens );
protected:
- OoxDefinedNameData maOoxData; /// OOX data for this defined name.
- mutable ::rtl::OUString maUpOoxName; /// OOX name converted to uppercase ASCII.
- ::rtl::OUString maFinalName; /// Final name used in the Calc document.
+ DefinedNameModel maModel; /// Model data for this defined name.
+ mutable ::rtl::OUString maUpModelName; /// Model name converted to uppercase ASCII.
+ ::rtl::OUString maCalcName; /// Final name used in the Calc document.
private:
::com::sun::star::uno::Any maRefAny; /// Single cell/range reference.
@@ -147,10 +147,12 @@ public:
/** Returns true, if this defined name is a special builtin name. */
inline bool isBuiltinName() const { return mcBuiltinId != OOX_DEFNAME_UNKNOWN; }
/** Returns true, if this defined name is a macro function call. */
- inline bool isMacroFunction() const { return maOoxData.mbMacro && maOoxData.mbFunction; }
+ inline bool isMacroFunction() const { return maModel.mbMacro && maModel.mbFunction; }
/** Returns the token index used in API token arrays (com.sun.star.sheet.FormulaToken). */
inline sal_Int32 getTokenIndex() const { return mnTokenIndex; }
+ /** Tries to resolve the defined name to an absolute cell range. */
+ bool getAbsoluteRange( ::com::sun::star::table::CellRangeAddress& orRange ) const;
private:
/** Imports the OOX or OOBIN formula, using the passed formula context. */
@@ -197,11 +199,11 @@ public:
DefinedNameRef getByIndex( sal_Int32 nIndex ) const;
/** Returns a defined name by token index (index in XDefinedNames container). */
DefinedNameRef getByTokenIndex( sal_Int32 nIndex ) const;
- /** Returns a defined name by its OOX name.
+ /** Returns a defined name by its model name.
@param nSheet The sheet index for local names or -1 for global names.
If no local name is found, tries to find a matching global name.
@return Reference to the defined name or empty reference. */
- DefinedNameRef getByOoxName( const ::rtl::OUString& rOoxName, sal_Int32 nSheet = -1 ) const;
+ DefinedNameRef getByModelName( const ::rtl::OUString& rModelName, sal_Int32 nSheet = -1 ) const;
private:
DefinedNameRef createDefinedName();
diff --git a/oox/inc/oox/xls/drawingfragment.hxx b/oox/inc/oox/xls/drawingfragment.hxx
index 22edbf3618f3..d081192aec00 100644
--- a/oox/inc/oox/xls/drawingfragment.hxx
+++ b/oox/inc/oox/xls/drawingfragment.hxx
@@ -41,88 +41,105 @@ namespace xls {
// ============================================================================
-struct OoxAnchorPosition
+/** Absolute position in spreadsheet (in EMUs) independent from cells. */
+struct AnchorPosModel
{
- sal_Int64 mnX;
- sal_Int64 mnY;
+ sal_Int64 mnX; /// Absolute X coordinate (EMUs).
+ sal_Int64 mnY; /// Absolute Y coordinate (EMUs).
- explicit OoxAnchorPosition();
+ explicit AnchorPosModel();
inline bool isValid() const { return (mnX >= 0) && (mnY >= 0); }
};
// ----------------------------------------------------------------------------
-struct OoxAnchorSize
+/** Absolute size in spreadsheet (in EMUs). */
+struct AnchorSizeModel
{
- sal_Int64 mnWidth;
- sal_Int64 mnHeight;
+ sal_Int64 mnWidth; /// Total width (EMUs).
+ sal_Int64 mnHeight; /// Total height (EMUs).
- explicit OoxAnchorSize();
+ explicit AnchorSizeModel();
inline bool isValid() const { return (mnWidth >= 0) && (mnHeight >= 0); }
};
// ----------------------------------------------------------------------------
-struct OoxAnchorCell
+/** Position in spreadsheet (cell position and offset inside cell in EMUs). */
+struct AnchorCellModel
{
- sal_Int32 mnCol;
- sal_Int32 mnRow;
- sal_Int64 mnColOffset;
- sal_Int64 mnRowOffset;
+ sal_Int32 mnCol; /// Column index.
+ sal_Int32 mnRow; /// Row index.
+ sal_Int64 mnColOffset; /// X offset in column mnCol (EMUs).
+ sal_Int64 mnRowOffset; /// Y offset in row mnRow (EMUs).
- explicit OoxAnchorCell();
+ explicit AnchorCellModel();
inline bool isValid() const { return (mnCol >= 0) && (mnRow >= 0); }
};
// ----------------------------------------------------------------------------
-struct OoxAnchorClientData
+/** Application-specific client data of a shape. */
+struct AnchorClientDataModel
{
bool mbLocksWithSheet;
bool mbPrintsWithSheet;
- explicit OoxAnchorClientData();
+ explicit AnchorClientDataModel();
};
// ============================================================================
+/** Contains the position of a shape in the spreadsheet. Supports different
+ shape anchor modes (absolute, one-cell, two-cell). */
class ShapeAnchor : public WorksheetHelper
{
public:
explicit ShapeAnchor( const WorksheetHelper& rHelper );
- void importAbsoluteAnchor( const AttributeList& rAttribs );
- void importOneCellAnchor( const AttributeList& rAttribs );
- void importTwoCellAnchor( const AttributeList& rAttribs );
+ /** Imports the shape anchor (one of the elements xdr:absoluteAnchor, xdr:oneCellAnchor, xdr:twoCellAnchor). */
+ void importAnchor( sal_Int32 nElement, const AttributeList& rAttribs );
+ /** Imports the absolute anchor position from the xdr:pos element. */
void importPos( const AttributeList& rAttribs );
+ /** Imports the absolute anchor size from the xdr:ext element. */
void importExt( const AttributeList& rAttribs );
+ /** Imports the shape client data from the xdr:clientData element. */
void importClientData( const AttributeList& rAttribs );
+ /** Sets an attribute of the cell-dependent anchor position from xdr:from and xdr:to elements. */
void setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, const ::rtl::OUString& rValue );
+ /** Returns true, if the anchor contains valid position and size settings. */
+ bool isValidAnchor() const;
+
+#if 0 // unused code
+ /** Calculates the resulting shape anchor in 1/100 mm. */
::com::sun::star::awt::Rectangle
calcApiLocation(
const ::com::sun::star::awt::Size& rApiSheetSize,
- const OoxAnchorSize& rEmuSheetSize ) const;
+ const AnchorSizeModel& rEmuSheetSize ) const;
+#endif
+ /** Calculates the resulting shape anchor in EMUs. */
::com::sun::star::awt::Rectangle
- calcEmuLocation( const OoxAnchorSize& rEmuSheetSize ) const;
+ calcEmuLocation( const AnchorSizeModel& rEmuSheetSize ) const;
private:
enum AnchorType { ANCHOR_ABSOLUTE, ANCHOR_ONECELL, ANCHOR_TWOCELL, ANCHOR_INVALID };
- AnchorType meType;
- OoxAnchorPosition maPos;
- OoxAnchorSize maSize;
- OoxAnchorCell maFrom;
- OoxAnchorCell maTo;
- OoxAnchorClientData maClientData;
- sal_Int32 mnEditAs;
+ AnchorType meType; /// Type of this shape anchor.
+ AnchorPosModel maPos; /// Top-left position, if anchor is of type absolute.
+ AnchorSizeModel maSize; /// Anchor size, if anchor is not of type two-cell.
+ AnchorCellModel maFrom; /// Top-left position, if anchor is not of type absolute.
+ AnchorCellModel maTo; /// Bottom-right position, if anchor is of type two-cell.
+ AnchorClientDataModel maClientData; /// Shape client data.
+ sal_Int32 mnEditAs; /// Anchor mode as shown in the UI.
};
typedef ::boost::shared_ptr< ShapeAnchor > ShapeAnchorRef;
// ============================================================================
+/** Fragment handler for a complete sheet drawing. */
class OoxDrawingFragment : public OoxWorksheetFragmentBase
{
public:
@@ -133,15 +150,14 @@ public:
protected:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onStartElement( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
private:
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
mxDrawPage; /// Drawing page of this sheet.
::com::sun::star::awt::Size maApiSheetSize; /// Sheet size in 1/100 mm.
- OoxAnchorSize maEmuSheetSize; /// Sheet size in EMU.
+ AnchorSizeModel maEmuSheetSize; /// Sheet size in EMU.
::oox::drawingml::ShapePtr mxShape; /// Current top-level shape.
ShapeAnchorRef mxAnchor; /// Current anchor of top-level shape.
};
diff --git a/oox/inc/oox/xls/excelfilter.hxx b/oox/inc/oox/xls/excelfilter.hxx
index 7f80e1b6a995..65cfefd74270 100644
--- a/oox/inc/oox/xls/excelfilter.hxx
+++ b/oox/inc/oox/xls/excelfilter.hxx
@@ -62,7 +62,7 @@ private:
virtual ::rtl::OUString implGetImplementationName() const;
private:
- WorkbookHelper* mpHelper;
+ WorkbookHelper* mpHelper; /// Nonowning pointer to helper base.
};
// ============================================================================
diff --git a/oox/inc/oox/xls/excelhandlers.hxx b/oox/inc/oox/xls/excelhandlers.hxx
index 1c7a511e826d..de5a0ca644a0 100644
--- a/oox/inc/oox/xls/excelhandlers.hxx
+++ b/oox/inc/oox/xls/excelhandlers.hxx
@@ -43,11 +43,6 @@
namespace oox {
namespace xls {
-typedef ::oox::core::ContextHandler2 OoxContextHandler;
-typedef ::oox::core::FragmentHandler2 OoxFragmentHandler;
-
-typedef ::oox::core::ContextWrapper ContextWrapper;
-
// ============================================================================
// ============================================================================
@@ -55,7 +50,7 @@ typedef ::oox::core::ContextWrapper ContextWrapper;
Used to import contexts in global workbook fragments.
*/
-class OoxWorkbookContextBase : public OoxContextHandler, public WorkbookHelper
+class OoxWorkbookContextBase : public ::oox::core::ContextHandler2, public WorkbookHelper
{
public:
template< typename ParentType >
@@ -66,7 +61,7 @@ public:
template< typename ParentType >
OoxWorkbookContextBase::OoxWorkbookContextBase( ParentType& rParent ) :
- OoxContextHandler( rParent ),
+ ::oox::core::ContextHandler2( rParent ),
WorkbookHelper( rParent )
{
}
@@ -77,7 +72,7 @@ OoxWorkbookContextBase::OoxWorkbookContextBase( ParentType& rParent ) :
Used to import contexts in sheet fragments.
*/
-class OoxWorksheetContextBase : public OoxContextHandler, public WorksheetHelperRoot
+class OoxWorksheetContextBase : public ::oox::core::ContextHandler2, public WorksheetHelperRoot
{
public:
template< typename ParentType >
@@ -96,14 +91,14 @@ public:
template< typename ParentType >
OoxWorksheetContextBase::OoxWorksheetContextBase( ParentType& rParent,
ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int32 nSheet ) :
- OoxContextHandler( rParent ),
+ ::oox::core::ContextHandler2( rParent ),
WorksheetHelperRoot( rParent, xProgressBar, eSheetType, nSheet )
{
}
template< typename ParentType >
OoxWorksheetContextBase::OoxWorksheetContextBase( ParentType& rParent ) :
- OoxContextHandler( rParent ),
+ ::oox::core::ContextHandler2( rParent ),
WorksheetHelperRoot( rParent )
{
}
@@ -114,7 +109,7 @@ OoxWorksheetContextBase::OoxWorksheetContextBase( ParentType& rParent ) :
Used to import global workbook fragments.
*/
-class OoxWorkbookFragmentBase : public OoxFragmentHandler, public WorkbookHelper
+class OoxWorkbookFragmentBase : public ::oox::core::FragmentHandler2, public WorkbookHelper
{
public:
explicit OoxWorkbookFragmentBase(
@@ -128,7 +123,7 @@ public:
Used to import sheet fragments.
*/
-class OoxWorksheetFragmentBase : public OoxFragmentHandler, public WorksheetHelperRoot
+class OoxWorksheetFragmentBase : public ::oox::core::FragmentHandler2, public WorksheetHelperRoot
{
public:
explicit OoxWorksheetFragmentBase(
@@ -272,14 +267,38 @@ BiffWorksheetContextBase::BiffWorksheetContextBase( const ParentType& rParent )
// ============================================================================
-class BiffFragmentHandler : public BiffHandlerBase
+namespace prv {
+
+struct BiffFragmentStreamOwner
+{
+ typedef ::boost::shared_ptr< BinaryXInputStream > XInputStreamRef;
+ typedef ::boost::shared_ptr< BiffInputStream > BiffInputStreamRef;
+
+ XInputStreamRef mxXInStrm;
+ BiffInputStreamRef mxBiffStrm;
+
+ explicit BiffFragmentStreamOwner( const ::oox::core::FilterBase& rFilter, const ::rtl::OUString& rStrmName );
+ virtual ~BiffFragmentStreamOwner();
+};
+
+} // namespace prv
+
+// ----------------------------------------------------------------------------
+
+class BiffFragmentHandler : private prv::BiffFragmentStreamOwner, public BiffHandlerBase
{
public:
/** Imports the fragment, returns true, if EOF record has been reached. */
virtual bool importFragment() = 0;
protected:
- explicit BiffFragmentHandler( BiffInputStream& rStrm );
+ /** Opens the stream with the passed full name. */
+ explicit BiffFragmentHandler(
+ const ::oox::core::FilterBase& rFilter,
+ const ::rtl::OUString& rStrmName );
+
+ /** Reuses the stream of the passed fragment. */
+ explicit BiffFragmentHandler( const BiffFragmentHandler& rHandler );
/** Starts a new fragment in a workbbok stream and returns the fragment type.
@@ -316,7 +335,8 @@ class BiffWorkbookFragmentBase : public BiffFragmentHandler, public WorkbookHelp
protected:
explicit BiffWorkbookFragmentBase(
const WorkbookHelper& rHelper,
- BiffInputStream& rStrm );
+ const ::rtl::OUString& rStrmName,
+ bool bCloneDecoder = false );
};
// ============================================================================
@@ -333,14 +353,12 @@ protected:
ISegmentProgressBarRef xProgressBar,
WorksheetType eSheetType,
sal_Int32 nSheet );
-
- explicit BiffWorksheetFragmentBase(
- const WorksheetHelper& rHelper,
- BiffInputStream& rStrm );
};
// ============================================================================
+/** Special fragment handler for worksheets that have to be skipped.
+ */
class BiffSkipWorksheetFragment : public BiffWorksheetFragmentBase
{
public:
diff --git a/oox/inc/oox/xls/externallinkbuffer.hxx b/oox/inc/oox/xls/externallinkbuffer.hxx
index d01e372484d8..a50170544813 100644
--- a/oox/inc/oox/xls/externallinkbuffer.hxx
+++ b/oox/inc/oox/xls/externallinkbuffer.hxx
@@ -51,7 +51,7 @@ namespace xls {
// ============================================================================
-struct OoxExternalNameData
+struct ExternalNameModel
{
bool mbBuiltIn; /// Name is a built-in name.
bool mbNotify; /// Notify application on data change.
@@ -60,7 +60,7 @@ struct OoxExternalNameData
bool mbOleObj; /// Name is an OLE object.
bool mbIconified; /// Iconified object link.
- explicit OoxExternalNameData();
+ explicit ExternalNameModel();
};
// ============================================================================
@@ -107,7 +107,7 @@ public:
void importExternalName( BiffInputStream& rStrm );
/** Returns true, if the name refers to an OLE object. */
- inline bool isOleObject() const { return maOoxExtNameData.mbOleObj; }
+ inline bool isOleObject() const { return maExtNameModel.mbOleObj; }
/** Returns the sheet cache index if this is a sheet-local external name. */
sal_Int32 getSheetCacheIndex() const;
@@ -130,7 +130,7 @@ private:
typedef Matrix< ::com::sun::star::uno::Any > ResultMatrix;
const ExternalLink& mrParentLink; /// External link this name belongs to.
- OoxExternalNameData maOoxExtNameData; /// Additional name data.
+ ExternalNameModel maExtNameModel; /// Additional name data.
ResultMatrix maResults; /// DDE/OLE link results.
ResultMatrix::iterator maCurrIt; /// Current position in result matrix.
sal_uInt32 mnStorageId; /// OLE storage identifier (BIFF).
@@ -314,13 +314,13 @@ typedef ::boost::shared_ptr< ExternalLink > ExternalLinkRef;
EXTERNALREF records, BIFF8: EXTERNALBOOK records), and provides sheet
indexes into the sheet list of the external document.
*/
-struct OoxRefSheets
+struct RefSheetsModel
{
sal_Int32 mnExtRefId; /// Zero-based index into list of external documents.
sal_Int32 mnTabId1; /// Zero-based index to first sheet in external document.
sal_Int32 mnTabId2; /// Zero-based index to last sheet in external document.
- explicit OoxRefSheets();
+ explicit RefSheetsModel();
void readOobData( RecordInputStream& rStrm );
void readBiff8Data( BiffInputStream& rStrm );
@@ -373,15 +373,15 @@ private:
ExternalLinkRef createExternalLink();
/** Returns the specified sheet indexes for a reference identifier. */
- const OoxRefSheets* getRefSheets( sal_Int32 nRefId ) const;
+ const RefSheetsModel* getRefSheets( sal_Int32 nRefId ) const;
private:
typedef RefVector< ExternalLink > ExternalLinkVec;
- typedef ::std::vector< OoxRefSheets > OoxRefSheetsVec;
+ typedef ::std::vector< RefSheetsModel > RefSheetsModelVec;
ExternalLinkVec maLinks; /// List of link structures for all kinds of links.
ExternalLinkVec maExtLinks; /// Real external links needed for formula parser.
- OoxRefSheetsVec maRefSheets; /// Sheet indexes for reference ids.
+ RefSheetsModelVec maRefSheets; /// Sheet indexes for reference ids.
bool mbUseRefSheets; /// True = use maRefSheets list (OOBIN only).
};
diff --git a/oox/inc/oox/xls/externallinkfragment.hxx b/oox/inc/oox/xls/externallinkfragment.hxx
index f72a3b7afe99..62996b55531a 100644
--- a/oox/inc/oox/xls/externallinkfragment.hxx
+++ b/oox/inc/oox/xls/externallinkfragment.hxx
@@ -56,12 +56,10 @@ public:
protected:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onStartElement( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
- virtual ContextWrapper onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
private:
/** Imports cell settings from a c element. */
@@ -101,19 +99,17 @@ public:
protected:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onStartElement( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
- virtual ContextWrapper onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
// oox.core.FragmentHandler2 interface ------------------------------------
virtual const ::oox::core::RecordInfo* getRecordInfos() const;
private:
- ContextWrapper createSheetDataContext( sal_Int32 nSheetId );
+ ::oox::core::ContextHandlerRef createSheetDataContext( sal_Int32 nSheetId );
private:
ExternalLink& mrExtLink;
diff --git a/oox/inc/oox/xls/formulabase.hxx b/oox/inc/oox/xls/formulabase.hxx
index eee841e5fec7..957f9d59eef2 100644
--- a/oox/inc/oox/xls/formulabase.hxx
+++ b/oox/inc/oox/xls/formulabase.hxx
@@ -720,6 +720,21 @@ public:
::com::sun::star::uno::Any
extractReference( const ApiTokenSequence& rTokens ) const;
+ /** Tries to extract an absolute cell range from a formula token sequence.
+
+ @param orRange (output parameter) The extracted cell range address.
+ Only valid, if the function returns true.
+
+ @param rTokens The token sequence to be parsed. Should contain exactly
+ one address token or cell range address token. The token sequence
+ may contain whitespace tokens.
+
+ @return True, if orRange contains the extracted cell range address.
+ */
+ bool extractAbsoluteRange(
+ ::com::sun::star::table::CellRangeAddress& orRange,
+ const ApiTokenSequence& rTokens ) const;
+
/** Tries to extract a cell range list from a formula token sequence.
@param orRanges (output parameter) If the token sequence is valid,
@@ -774,9 +789,6 @@ public:
ApiTokenSequence& orTokens,
sal_Unicode cStringSep,
bool bTrimLeadingSpaces ) const;
-
-private:
- const ::rtl::OUString maAbsNameProp; /// Property name for absolute name of cells and ranges.
};
// ============================================================================
diff --git a/oox/inc/oox/xls/numberformatsbuffer.hxx b/oox/inc/oox/xls/numberformatsbuffer.hxx
index 897f0ed7dfae..0ff2b973df7b 100644
--- a/oox/inc/oox/xls/numberformatsbuffer.hxx
+++ b/oox/inc/oox/xls/numberformatsbuffer.hxx
@@ -33,24 +33,36 @@
#include <com/sun/star/lang/Locale.hpp>
#include "oox/helper/containerhelper.hxx"
-#include "oox/xls/stylespropertyhelper.hxx"
+#include "oox/xls/workbookhelper.hxx"
namespace com { namespace sun { namespace star {
namespace util { class XNumberFormats; }
} } }
+namespace oox { class PropertyMap; }
+
namespace oox {
namespace xls {
// ============================================================================
-struct OoxNumFmtData
+struct NumFmtModel
{
::com::sun::star::lang::Locale maLocale;
::rtl::OUString maFmtCode;
sal_Int16 mnPredefId;
- explicit OoxNumFmtData();
+ explicit NumFmtModel();
+};
+
+// ----------------------------------------------------------------------------
+
+/** Contains all API number format attributes. */
+struct ApiNumFmtData
+{
+ sal_Int32 mnIndex; /// API number format index.
+
+ explicit ApiNumFmtData();
};
// ----------------------------------------------------------------------------
@@ -77,11 +89,11 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats >& rxNumFmts,
const ::com::sun::star::lang::Locale& rFromLocale );
- /** Writes the number format to the passed property set. */
- void writeToPropertySet( PropertySet& rPropSet ) const;
+ /** Writes the number format to the passed property map. */
+ void writeToPropertyMap( PropertyMap& rPropMap ) const;
private:
- OoxNumFmtData maOoxData;
+ NumFmtModel maModel;
ApiNumFmtData maApiData;
};
@@ -107,8 +119,8 @@ public:
/** Final processing after import of all style settings. */
void finalizeImport();
- /** Writes the specified number format to the passed property set. */
- void writeToPropertySet( PropertySet& rPropSet, sal_Int32 nNumFmtId ) const;
+ /** Writes the specified number format to the passed property map. */
+ void writeToPropertyMap( PropertyMap& rPropMap, sal_Int32 nNumFmtId ) const;
private:
/** Inserts built-in number formats for the current system language. */
diff --git a/oox/inc/oox/xls/pagesettings.hxx b/oox/inc/oox/xls/pagesettings.hxx
index acbce7a9ed3a..f17218ed4bc2 100644
--- a/oox/inc/oox/xls/pagesettings.hxx
+++ b/oox/inc/oox/xls/pagesettings.hxx
@@ -31,21 +31,20 @@
#ifndef OOX_XLS_PAGESETTINGS_HXX
#define OOX_XLS_PAGESETTINGS_HXX
-#include "oox/helper/propertysequence.hxx"
#include "oox/xls/worksheethelper.hxx"
-#include "oox/xls/headerfooterparser.hxx"
-namespace oox { namespace core {
- class Relations;
-} }
+namespace oox { class PropertySet; }
+namespace oox { namespace core { class Relations; } }
namespace oox {
namespace xls {
+class HeaderFooterParser;
+
// ============================================================================
/** Holds page style data for a single sheet. */
-struct OoxPageData
+struct PageSettingsModel
{
::rtl::OUString maBinSettPath; /// Relation identifier of binary printer settings.
::rtl::OUString maPicturePath; /// Relation identifier of background image.
@@ -85,7 +84,7 @@ struct OoxPageData
bool mbPrintGrid; /// True = print grid lines.
bool mbPrintHeadings; /// True = print column/row headings.
- explicit OoxPageData();
+ explicit PageSettingsModel();
/** Sets the OOBIN or BIFF print errors mode. */
void setBinPrintErrors( sal_uInt8 nPrintErrors );
@@ -158,40 +157,41 @@ public:
void finalizeImport();
private:
- OoxPageData maOoxData;
+ PageSettingsModel maModel;
};
// ============================================================================
-class PageSettingsPropertyHelper : public WorkbookHelper
+class PageSettingsConverter : public WorkbookHelper
{
public:
- explicit PageSettingsPropertyHelper( const WorkbookHelper& rHelper );
+ explicit PageSettingsConverter( const WorkbookHelper& rHelper );
+ virtual ~PageSettingsConverter();
/** Writes all properties to the passed property set of a page style object. */
void writePageSettingsProperties(
PropertySet& rPropSet,
- const OoxPageData& rData,
+ const PageSettingsModel& rModel,
WorksheetType eSheetType );
private:
struct HFHelperData
{
- ::rtl::OUString maLeftProp;
- ::rtl::OUString maRightProp;
+ sal_Int32 mnLeftPropId;
+ sal_Int32 mnRightPropId;
sal_Int32 mnHeight;
sal_Int32 mnBodyDist;
bool mbHasContent;
bool mbShareOddEven;
bool mbDynamicHeight;
- explicit HFHelperData( const ::rtl::OUString& rLeftProp, const ::rtl::OUString& rRightProp );
+ explicit HFHelperData( sal_Int32 nLeftPropId, sal_Int32 nRightPropId );
};
private:
void convertHeaderFooterData(
PropertySet& rPropSet,
- HFHelperData& rHFData,
+ HFHelperData& orHFData,
const ::rtl::OUString rOddContent,
const ::rtl::OUString rEvenContent,
bool bUseEvenContent,
@@ -200,13 +200,12 @@ private:
sal_Int32 writeHeaderFooter(
PropertySet& rPropSet,
- const ::rtl::OUString& rPropName,
+ sal_Int32 nPropId,
const ::rtl::OUString& rContent );
private:
- HeaderFooterParser maHFParser;
- PropertySequence maPageProps;
- PropertySequence maGraphicProps;
+ typedef ::std::auto_ptr< HeaderFooterParser > HeaderFooterParserPtr;
+ HeaderFooterParserPtr mxHFParser;
HFHelperData maHeaderData;
HFHelperData maFooterData;
};
diff --git a/oox/inc/oox/xls/pivotcachebuffer.hxx b/oox/inc/oox/xls/pivotcachebuffer.hxx
new file mode 100644
index 000000000000..c12b33eec25f
--- /dev/null
+++ b/oox/inc/oox/xls/pivotcachebuffer.hxx
@@ -0,0 +1,514 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: pivottablebuffer.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_XLS_PIVOTCACHEBUFFER_HXX
+#define OOX_XLS_PIVOTCACHEBUFFER_HXX
+
+#include <com/sun/star/util/DateTime.hpp>
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
+#include "oox/helper/containerhelper.hxx"
+#include "oox/xls/workbookhelper.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace sheet { class XDataPilotField; }
+} } }
+
+namespace oox { namespace core { class Relations; } }
+
+namespace oox {
+namespace xls {
+
+class WorksheetHelper;
+
+// ============================================================================
+
+class PivotCacheItem
+{
+public:
+ explicit PivotCacheItem();
+
+ /** Reads the string value from a pivot cache item. */
+ void readString( const AttributeList& rAttribs );
+ /** Reads the double value from a pivot cache item. */
+ void readNumeric( const AttributeList& rAttribs );
+ /** Reads the date/time value from a pivot cache item. */
+ void readDate( const AttributeList& rAttribs );
+ /** Reads the boolean value from a pivot cache item. */
+ void readBool( const AttributeList& rAttribs );
+ /** Reads the error code value from a pivot cache item. */
+ void readError( const AttributeList& rAttribs, const UnitConverter& rUnitConverter );
+ /** Reads the index of a shared item. */
+ void readIndex( const AttributeList& rAttribs );
+
+ /** Reads the string value from a pivot cache item. */
+ void readString( RecordInputStream& rStrm );
+ /** Reads the double value from a pivot cache item. */
+ void readDouble( RecordInputStream& rStrm );
+ /** Reads the date/time value from a pivot cache item. */
+ void readDate( RecordInputStream& rStrm );
+ /** Reads the boolean value from a pivot cache item. */
+ void readBool( RecordInputStream& rStrm );
+ /** Reads the error code value from a pivot cache item. */
+ void readError( RecordInputStream& rStrm );
+ /** Reads the index of a shared item. */
+ void readIndex( RecordInputStream& rStrm );
+
+ /** Reads the string value from a pivot cache item. */
+ void readString( BiffInputStream& rStrm, const WorkbookHelper& rHelper );
+ /** Reads the double value from a pivot cache item. */
+ void readDouble( BiffInputStream& rStrm );
+ /** Reads the integer value from a pivot cache item. */
+ void readInteger( BiffInputStream& rStrm );
+ /** Reads the date/time value from a pivot cache item. */
+ void readDate( BiffInputStream& rStrm );
+ /** Reads the boolean value from a pivot cache item. */
+ void readBool( BiffInputStream& rStrm );
+ /** Reads the error code value from a pivot cache item. */
+ void readError( BiffInputStream& rStrm );
+
+ /** Returns the type of the item. */
+ inline sal_Int32 getType() const { return mnType; }
+ /** Returns the value of the item. */
+ inline const ::com::sun::star::uno::Any& getValue() const { return maValue; }
+ /** Returns the string representation of the item. */
+ ::rtl::OUString getName() const;
+
+private:
+ ::com::sun::star::uno::Any maValue; /// Value of the item.
+ sal_Int32 mnType; /// Value type (OOX token identifier).
+};
+
+// ----------------------------------------------------------------------------
+
+class PivotCacheItemList : public WorkbookHelper
+{
+public:
+ explicit PivotCacheItemList( const WorkbookHelper& rHelper );
+
+ /** Imports the item from the passed attribute list. */
+ void importItem( sal_Int32 nElement, const AttributeList& rAttribs );
+ /** Imports the item from the passed stream and record. */
+ void importItem( sal_Int32 nRecId, RecordInputStream& rStrm );
+ /** Imports a complete item list from the passed stream. */
+ void importItemList( BiffInputStream& rStrm, sal_uInt16 nCount );
+
+ /** Returns true, if this item list is empty. */
+ inline bool empty() const { return maItems.empty(); }
+ /** Returns the size of the item list. */
+ inline size_t size() const { return maItems.size(); }
+
+ /** Returns the specified item. */
+ const PivotCacheItem* getCacheItem( sal_Int32 nItemIdx ) const;
+ /** Returns the names of all items. */
+ void getCacheItemNames( ::std::vector< ::rtl::OUString >& orItemNames ) const;
+
+private:
+ /** Creates and returns a new item at the end of the items list. */
+ PivotCacheItem& createItem();
+ /** Imports an array of items from the PCITEM_ARRAY record */
+ void importArray( RecordInputStream& rStrm );
+
+private:
+ typedef ::std::vector< PivotCacheItem > CacheItemVector;
+ CacheItemVector maItems; /// All items of this list.
+};
+
+// ============================================================================
+
+struct PCFieldModel
+{
+ ::rtl::OUString maName; /// Fixed name of the cache field.
+ ::rtl::OUString maCaption; /// Caption of the ccahe field.
+ ::rtl::OUString maPropertyName; /// OLAP property name.
+ ::rtl::OUString maFormula; /// Formula of a calculated field.
+ sal_Int32 mnNumFmtId; /// Number format for all items.
+ sal_Int32 mnSqlType; /// Data type from ODBC data source.
+ sal_Int32 mnHierarchy; /// Hierarchy this field is part of.
+ sal_Int32 mnLevel; /// Hierarchy level this field is part of.
+ sal_Int32 mnMappingCount; /// Number of property mappings.
+ bool mbDatabaseField; /// True = field from source data; false = calculated field.
+ bool mbServerField; /// True = ODBC server-based page field.
+ bool mbUniqueList; /// True = list of unique ODBC items exists.
+ bool mbMemberPropField; /// True = contains OLAP member properties.
+
+ explicit PCFieldModel();
+};
+
+// ----------------------------------------------------------------------------
+
+struct PCSharedItemsModel
+{
+ bool mbHasSemiMixed; /// True = has (blank|string|bool|error) item(s), maybe other types.
+ bool mbHasNonDate; /// True = has non-date item(s), maybe date items.
+ bool mbHasDate; /// True = has date item(s), maybe other types.
+ bool mbHasString; /// True = has (string|bool|error) item(s), maybe other types.
+ bool mbHasBlank; /// True = has blank item(s), maybe other types.
+ bool mbHasMixed; /// True = has [(string|bool|error) and (number|date)] or (number and date).
+ bool mbIsNumeric; /// True = has numeric item(s), maybe other types except date.
+ bool mbIsInteger; /// True = has numeric item(s) with only integers, maybe other types except date.
+ bool mbHasLongText; /// True = contains strings with >255 charascters.
+ bool mbHasLongIndexes; /// True = indexes to shared items are 16-bit (BIFF only).
+
+ explicit PCSharedItemsModel();
+};
+
+// ----------------------------------------------------------------------------
+
+struct PCFieldGroupModel
+{
+ ::com::sun::star::util::DateTime maStartDate; /// Manual or calculated start date for range grouping.
+ ::com::sun::star::util::DateTime maEndDate; /// Manual or calculated end date for range grouping.
+ double mfStartValue; /// Manual or calculated start value for range grouping.
+ double mfEndValue; /// Manual or calculated end value for range grouping.
+ double mfInterval; /// Interval for numeric range grouping.
+ sal_Int32 mnParentField; /// Index of cache field that contains item groups based on this field.
+ sal_Int32 mnBaseField; /// Index of cache field this grouped field is based on.
+ sal_Int32 mnGroupBy; /// Type of numeric or date range grouping.
+ bool mbRangeGroup; /// True = items are grouped by numeric ranges or date ranges.
+ bool mbDateGroup; /// True = items are grouped by date ranges or by item names.
+ bool mbAutoStart; /// True = start value for range groups is calculated from source data.
+ bool mbAutoEnd; /// True = end value for range groups is calculated from source data.
+
+ explicit PCFieldGroupModel();
+
+ /** Sets the group-by value for BIFF/OOBIN import. */
+ void setBinGroupBy( sal_uInt8 nGroupBy );
+};
+
+// ----------------------------------------------------------------------------
+
+/** Helper struct for mapping original item names from/to group item names. */
+struct PivotCacheGroupItem
+{
+ ::rtl::OUString maOrigName;
+ ::rtl::OUString maGroupName;
+
+ inline explicit PivotCacheGroupItem( const ::rtl::OUString& rItemName ) :
+ maOrigName( rItemName ), maGroupName( rItemName ) {}
+};
+
+typedef ::std::vector< PivotCacheGroupItem > PivotCacheGroupItemVector;
+
+// ----------------------------------------------------------------------------
+
+class PivotCacheField : public WorkbookHelper
+{
+public:
+ explicit PivotCacheField( const WorkbookHelper& rHelper, bool bIsDatabaseField );
+
+ /** Imports pivot cache field settings from the cacheField element. */
+ void importCacheField( const AttributeList& rAttribs );
+ /** Imports shared items settings from the sharedItems element. */
+ void importSharedItems( const AttributeList& rAttribs );
+ /** Imports a shared item from the passed element. */
+ void importSharedItem( sal_Int32 nElement, const AttributeList& rAttribs );
+ /** Imports grouping settings from the fieldGroup element. */
+ void importFieldGroup( const AttributeList& rAttribs );
+ /** Imports numeric grouping settings from the rangePr element. */
+ void importRangePr( const AttributeList& rAttribs );
+ /** Imports an item of the mapping between group items and base items from the passed element. */
+ void importDiscretePrItem( sal_Int32 nElement, const AttributeList& rAttribs );
+ /** Imports a group item from the passed element. */
+ void importGroupItem( sal_Int32 nElement, const AttributeList& rAttribs );
+
+ /** Imports pivot cache field settings from the PCDFIELD record. */
+ void importPCDField( RecordInputStream& rStrm );
+ /** Imports shared items settings from the PCDFSHAREDITEMS record. */
+ void importPCDFSharedItems( RecordInputStream& rStrm );
+ /** Imports one or more shared items from the passed record. */
+ void importPCDFSharedItem( sal_Int32 nRecId, RecordInputStream& rStrm );
+ /** Imports grouping settings from the PCDFIELDGROUP record. */
+ void importPCDFieldGroup( RecordInputStream& rStrm );
+ /** Imports numeric grouping settings from the PCDFRANGEPR record. */
+ void importPCDFRangePr( RecordInputStream& rStrm );
+ /** Imports an item of the mapping between group items and base items from the passed record. */
+ void importPCDFDiscretePrItem( sal_Int32 nRecId, RecordInputStream& rStrm );
+ /** Imports one or more group items from the passed record. */
+ void importPCDFGroupItem( sal_Int32 nRecId, RecordInputStream& rStrm );
+
+ /** Imports pivot cache field settings from the PCDFIELD record. */
+ void importPCDField( BiffInputStream& rStrm );
+ /** Imports numeric grouping settings from the PCDFRANGEPR record. */
+ void importPCDFRangePr( BiffInputStream& rStrm );
+ /** Imports the mapping between group items and base items from the PCDFDISCRETEPR record. */
+ void importPCDFDiscretePr( BiffInputStream& rStrm );
+
+ /** Returns true, if the field is based on source data, or false if it is grouped or calculated. */
+ inline bool isDatabaseField() const { return maFieldModel.mbDatabaseField; }
+
+ /** Returns true, if the field contains a list of shared items. */
+ inline bool hasSharedItems() const { return !maSharedItems.empty(); }
+ /** Returns true, if the field contains a list of grouping items. */
+ inline bool hasGroupItems() const { return !maGroupItems.empty(); }
+ /** Returns true, if the field has inplace numeric grouping settings. */
+ inline bool hasNumericGrouping() const { return maFieldGroupModel.mbRangeGroup && !maFieldGroupModel.mbDateGroup; }
+ /** Returns true, if the field has inplace date grouping settings. */
+ inline bool hasDateGrouping() const { return maFieldGroupModel.mbRangeGroup && maFieldGroupModel.mbDateGroup; }
+ /** Returns true, if the field has a parent group field that groups the items of this field. */
+ inline bool hasParentGrouping() const { return maFieldGroupModel.mnParentField >= 0; }
+
+ /** Returns the name of the cache field. */
+ inline const ::rtl::OUString& getName() const { return maFieldModel.maName; }
+ /** Returns the index of the parent group field that groups the items of this field. */
+ inline sal_Int32 getParentGroupField() const { return maFieldGroupModel.mnParentField; }
+ /** Returns the index of the base field grouping is based on. */
+ inline sal_Int32 getGroupBaseField() const { return maFieldGroupModel.mnBaseField; }
+
+ /** Returns the shared or group item with the specified index. */
+ const PivotCacheItem* getCacheItem( sal_Int32 nItemIdx ) const;
+ /** Returns the names of all shared or group items. */
+ void getCacheItemNames( ::std::vector< ::rtl::OUString >& orItemNames ) const;
+
+ /** Creates inplace numeric grouping settings. */
+ void convertNumericGrouping(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >& rxDPField ) const;
+ /** Creates inplace date grouping settings or a new date group field. */
+ ::rtl::OUString createDateGroupField(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >& rxBaseDPField ) const;
+ /** Creates a new grouped DataPilot field and returns its name. */
+ ::rtl::OUString createParentGroupField(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >& rxBaseDPField,
+ PivotCacheGroupItemVector& orItemNames ) const;
+
+ /** Writes the title of the field into the passed sheet at the passed address. */
+ void writeSourceHeaderCell( WorksheetHelper& rSheetHelper,
+ sal_Int32 nCol, sal_Int32 nRow ) const;
+ /** Writes a source field item value into the passed sheet. */
+ void writeSourceDataCell( WorksheetHelper& rSheetHelper,
+ sal_Int32 nCol, sal_Int32 nRow,
+ const PivotCacheItem& rItem ) const;
+
+ /** Reads an item from the PCRECORD record and writes it to the passed sheet. */
+ void importPCRecordItem( RecordInputStream& rStrm,
+ WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const;
+ /** Reads an item index from the PCITEM_INDEXLIST record and writes the item to the passed sheet. */
+ void importPCItemIndex( BiffInputStream& rStrm,
+ WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const;
+
+
+private:
+ /** Tries to write the passed value to the passed sheet position. */
+ void writeItemToSourceDataCell( WorksheetHelper& rSheetHelper,
+ sal_Int32 nCol, sal_Int32 nRow, const PivotCacheItem& rItem ) const;
+ /** Tries to write the value of a shared item to the passed sheet position. */
+ void writeSharedItemToSourceDataCell( WorksheetHelper& rSheetHelper,
+ sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nItemIdx ) const;
+
+private:
+ typedef ::std::vector< sal_Int32 > IndexVector;
+
+ PivotCacheItemList maSharedItems; /// All shared items of this field.
+ PivotCacheItemList maGroupItems; /// All group items of this field.
+ IndexVector maDiscreteItems; /// Mapping between group and base items.
+ PCFieldModel maFieldModel; /// Settings for this cache field.
+ PCSharedItemsModel maSharedItemsModel; /// Settings for shared items.
+ PCFieldGroupModel maFieldGroupModel; /// Settings for item grouping.
+};
+
+// ============================================================================
+
+struct PCDefinitionModel
+{
+ ::rtl::OUString maRelId; /// Relation identifier for cache records fragment.
+ ::rtl::OUString maRefreshedBy; /// Name of user who last refreshed the cache.
+ double mfRefreshedDate; /// Date/time of last refresh.
+ sal_Int32 mnRecords; /// Number of data records in the cache.
+ sal_Int32 mnMissItemsLimit; /// Limit for discarding unused items.
+ sal_uInt16 mnDatabaseFields; /// Number of database (source data) fields (BIFF only).
+ bool mbInvalid; /// True = cache needs refresh.
+ bool mbSaveData; /// True = cached item values are present.
+ bool mbRefreshOnLoad; /// True = try to refresh cache on load.
+ bool mbOptimizeMemory; /// True = application may optimize memory usage.
+ bool mbEnableRefresh; /// True = refreshing cache is enabled in UI.
+ bool mbBackgroundQuery; /// True = application queries data asynchonously.
+ bool mbUpgradeOnRefresh; /// True = application may upgrade cache version.
+ bool mbTupleCache; /// True = cache stores OLAP functions.
+ bool mbSupportSubquery; /// True = data source supports subqueries.
+ bool mbSupportDrill; /// True = data source supports drilldown.
+
+ explicit PCDefinitionModel();
+};
+
+// ----------------------------------------------------------------------------
+
+struct PCSourceModel
+{
+ sal_Int32 mnSourceType; /// Type of the source data (sheet, consolidation, scenario, external).
+ sal_Int32 mnConnectionId; /// Connection identifier for external data source.
+
+ explicit PCSourceModel();
+};
+
+// ----------------------------------------------------------------------------
+
+struct PCWorksheetSourceModel
+{
+ ::rtl::OUString maRelId; /// Relation identifier for an external document URL.
+ ::rtl::OUString maSheet; /// Sheet name for cell range or sheet-local defined names.
+ ::rtl::OUString maDefName; /// Defined name containing a cell range if present.
+ ::com::sun::star::table::CellRangeAddress
+ maRange; /// Source cell range of the data.
+
+ explicit PCWorksheetSourceModel();
+};
+
+// ----------------------------------------------------------------------------
+
+class PivotCache : public WorkbookHelper
+{
+public:
+ explicit PivotCache( const WorkbookHelper& rHelper );
+
+ /** Reads pivot cache global settings from the pivotCacheDefinition element. */
+ void importPivotCacheDefinition( const AttributeList& rAttribs );
+ /** Reads cache source settings from the cacheSource element. */
+ void importCacheSource( const AttributeList& rAttribs );
+ /** Reads sheet source settings from the worksheetSource element. */
+ void importWorksheetSource( const AttributeList& rAttribs, const ::oox::core::Relations& rRelations );
+
+ /** Reads pivot cache global settings from the PCDEFINITION record. */
+ void importPCDefinition( RecordInputStream& rStrm );
+ /** Reads cache source settings from the PCDSOURCE record. */
+ void importPCDSource( RecordInputStream& rStrm );
+ /** Reads sheet source settings from the PCDSHEETSOURCE record. */
+ void importPCDSheetSource( RecordInputStream& rStrm, const ::oox::core::Relations& rRelations );
+
+ /** Reads cache source settings from the PCDSOURCE record. */
+ void importPCDSource( BiffInputStream& rStrm );
+ /** Reads pivot cache global settings from the PCDEFINITION record. */
+ void importPCDefinition( BiffInputStream& rStrm );
+
+ /** Creates and returns a new pivot cache field. */
+ PivotCacheField& createCacheField( bool bInitDatabaseField = false );
+ /** Checks validity of source data and creates a dummy data sheet for external sheet sources. */
+ void finalizeImport();
+
+ /** Returns true, if the pivot cache is based on a valid data source, so
+ that pivot tables can be created based on this pivot cache. */
+ inline bool isValidDataSource() const { return mbValidSource; }
+ /** Returns true, if the pivot cache is based on a dummy sheet created in finalizeImport. */
+ inline bool isBasedOnDummySheet() const { return mbDummySheet; }
+ /** Returns the internal cell range the cache is based on. */
+ inline const ::com::sun::star::table::CellRangeAddress&
+ getSourceRange() const { return maSheetSrcModel.maRange; }
+ /** Returns the relation identifier of the pivot cache records fragment. */
+ inline const ::rtl::OUString& getRecordsRelId() const { return maDefModel.maRelId; }
+
+ /** Returns the number of pivot cache fields. */
+ sal_Int32 getCacheFieldCount() const;
+ /** Returns the cache field with the specified index. */
+ const PivotCacheField* getCacheField( sal_Int32 nFieldIdx ) const;
+ /** Returns the source column index of the field with the passed index. */
+ sal_Int32 getCacheDatabaseIndex( sal_Int32 nFieldIdx ) const;
+
+ /** Writes the titles of all source fields into the passed sheet. */
+ void writeSourceHeaderCells( WorksheetHelper& rSheetHelper ) const;
+ /** Writes a source field item value into the passed sheet. */
+ void writeSourceDataCell( WorksheetHelper& rSheetHelper,
+ sal_Int32 nCol, sal_Int32 nRow,
+ const PivotCacheItem& rItem ) const;
+
+ /** Reads a PCRECORD record and writes all item values to the passed sheet. */
+ void importPCRecord( RecordInputStream& rStrm,
+ WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const;
+ /** Reads a PCITEM_INDEXLIST record and writes all item values to the passed sheet. */
+ void importPCItemIndexList( BiffInputStream& rStrm,
+ WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const;
+
+private:
+ /** Reads the worksheet source range from the DCONREF record. */
+ void importDConRef( BiffInputStream& rStrm );
+ /** Reads the defined name used for source data from the DCONNAME record. */
+ void importDConName( BiffInputStream& rStrm );
+ /** Reads the built-in defined name used for source data from the DCONBINAME record. */
+ void importDConBIName( BiffInputStream& rStrm );
+ /** Reads the sheet name and URL from the DCONREF, DCONNAME, or DCONBINAME records. */
+ void importDConUrl( BiffInputStream& rStrm );
+
+ /** Finalizes the pivot cache if it is based on internal sheet data. */
+ void finalizeInternalSheetSource();
+ /** Finalizes the pivot cache if it is based on sheet data of an external spreadsheet document. */
+ void finalizeExternalSheetSource();
+ /** Creates a dummy sheet that will be filled with the pivot cache data. */
+ void prepareSourceDataSheet();
+
+private:
+ typedef RefVector< PivotCacheField > PivotCacheFieldVector;
+ typedef ::std::vector< sal_Int32 > IndexVector;
+
+ PivotCacheFieldVector maFields; /// All pivot cache fields.
+ PivotCacheFieldVector maDatabaseFields; /// All cache fields that are based on source data.
+ IndexVector maDatabaseIndexes; /// Database field index for all fields.
+ PCDefinitionModel maDefModel; /// Global pivot cache settings.
+ PCSourceModel maSourceModel; /// Pivot cache source settings.
+ PCWorksheetSourceModel maSheetSrcModel; /// Sheet source data if cache type is sheet.
+ ::rtl::OUString maTargetUrl; /// URL of an external source document.
+ bool mbValidSource; /// True = pivot cache is based on supported data source.
+ bool mbDummySheet; /// True = pivot cache is based on a dummy sheet.
+};
+
+// ============================================================================
+
+class PivotCacheBuffer : public WorkbookHelper
+{
+public:
+ explicit PivotCacheBuffer( const WorkbookHelper& rHelper );
+
+ /** Registers a pivot cache definition fragment. The fragment will be loaded on demand (OOX/OOBIN only). */
+ void registerPivotCacheFragment( sal_Int32 nCacheId, const ::rtl::OUString& rFragmentPath );
+ /** Reads the reference to a pivot cache stream. The stream will be loaded on demand (BIFF only). */
+ void importPivotCacheRef( BiffInputStream& rStrm );
+
+ /** Imports and stores a pivot cache definition fragment on first call,
+ returns the imported cache on subsequent calls with the same identifier. */
+ PivotCache* importPivotCacheFragment( sal_Int32 nCacheId );
+
+private:
+ /** Creates and returns a new pivot cache object with the passed identifier. */
+ PivotCache& createPivotCache( sal_Int32 nCacheId );
+
+private:
+ typedef ::std::map< sal_Int32, ::rtl::OUString > FragmentPathMap;
+ typedef RefMap< sal_Int32, PivotCache > PivotCacheMap;
+ typedef ::std::vector< sal_Int32 > PivotCacheIdVector;
+
+ FragmentPathMap maFragmentPaths;
+ PivotCacheMap maCaches;
+ PivotCacheIdVector maCacheIds;
+};
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
+
+#endif
+
diff --git a/oox/inc/oox/xls/pivotcachefragment.hxx b/oox/inc/oox/xls/pivotcachefragment.hxx
index 4f988fc434ba..dff1868db438 100644
--- a/oox/inc/oox/xls/pivotcachefragment.hxx
+++ b/oox/inc/oox/xls/pivotcachefragment.hxx
@@ -32,44 +32,122 @@
#define OOX_XLS_PIVOTCACHEFRAGMENT_HXX
#include "oox/xls/excelhandlers.hxx"
-#include "oox/xls/pivottablebuffer.hxx"
-#include "oox/xls/worksheethelper.hxx"
namespace oox {
namespace xls {
+class PivotCache;
+class PivotCacheField;
+
+// ============================================================================
+
+class OoxPivotCacheFieldContext : public OoxWorkbookContextBase
+{
+public:
+ explicit OoxPivotCacheFieldContext(
+ OoxWorkbookFragmentBase& rFragment,
+ PivotCacheField& rCacheField );
+
+protected:
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onStartElement( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual void onStartRecord( RecordInputStream& rStrm );
+
+private:
+ PivotCacheField& mrCacheField;
+};
+
// ============================================================================
-class OoxPivotCacheFragment : public OoxWorkbookFragmentBase
+class OoxPivotCacheDefinitionFragment : public OoxWorkbookFragmentBase
{
public:
- explicit OoxPivotCacheFragment(
+ explicit OoxPivotCacheDefinitionFragment(
const WorkbookHelper& rHelper,
const ::rtl::OUString& rFragmentPath,
- sal_uInt32 nCacheId );
+ PivotCache& rPivotCache );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual const ::oox::core::RecordInfo* getRecordInfos() const;
+ virtual void finalizeImport();
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onStartElement( const AttributeList& rAttribs );
+private:
+ PivotCache& mrPivotCache;
+};
- // oox.core.FragmentHandler2 interface ------------------------------------
+// ============================================================================
- virtual void finalizeImport();
+class OoxPivotCacheRecordsFragment : public OoxWorksheetFragmentBase
+{
+public:
+ explicit OoxPivotCacheRecordsFragment(
+ const WorkbookHelper& rHelper,
+ const ::rtl::OUString& rFragmentPath,
+ const PivotCache& rPivotCache );
+
+protected:
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual const ::oox::core::RecordInfo* getRecordInfos() const;
+
+private:
+ void startCacheRecord();
+ void importPCRecord( RecordInputStream& rStrm );
+ void importPCRecordItem( sal_Int32 nRecId, RecordInputStream& rStrm );
+
+private:
+ const PivotCache& mrPivotCache;
+ sal_Int32 mnCol;
+ sal_Int32 mnRow;
+ bool mbInRecord;
+};
+
+// ============================================================================
+// ============================================================================
+
+class BiffPivotCacheFragment : public BiffWorkbookFragmentBase
+{
+public:
+ explicit BiffPivotCacheFragment(
+ const WorkbookHelper& rHelper,
+ const ::rtl::OUString& rStrmName,
+ PivotCache& rPivotCache );
+
+ /** Imports the entire fragment, returns true, if EOF record has been reached. */
+ virtual bool importFragment();
private:
- void importPivotCacheDefinition( const AttributeList& rAttribs );
- void importCacheSource( const AttributeList& rAttribs );
- void importWorksheetSource( const AttributeList& rAttribs );
- void importCacheField( const AttributeList& rAttribs );
+ PivotCache& mrPivotCache;
+};
+
+// ============================================================================
+
+class BiffPivotCacheRecordsContext : public BiffWorksheetContextBase
+{
+public:
+ explicit BiffPivotCacheRecordsContext(
+ const BiffWorkbookFragmentBase& rFragment,
+ const PivotCache& rPivotCache );
+
+ /** Reads the current record from stream and tries to insert a cell into
+ the source data sheet. */
+ virtual void importRecord();
private:
- PivotCacheData maPCacheData;
- PivotCacheField maPCacheField;
+ void startNextRow();
- sal_uInt32 mnCacheId;
- bool mbValidSource;
+private:
+ typedef ::std::vector< sal_Int32 > ColumnIndexVector;
+
+ const PivotCache& mrPivotCache;
+ ColumnIndexVector maUnsharedCols; /// Column indexes of all unshared cache fields.
+ size_t mnColIdx; /// Current index into maUnsharedCols.
+ sal_Int32 mnRow; /// Current row in source data (0-based).
+ bool mbHasShared; /// True = pivot cache contains fields with shared items.
+ bool mbInRow; /// True = a data row has been started.
};
// ============================================================================
diff --git a/oox/inc/oox/xls/pivottablebuffer.hxx b/oox/inc/oox/xls/pivottablebuffer.hxx
index b7f45ddea863..3bfb418b14a2 100644
--- a/oox/inc/oox/xls/pivottablebuffer.hxx
+++ b/oox/inc/oox/xls/pivottablebuffer.hxx
@@ -31,134 +31,416 @@
#ifndef OOX_XLS_PIVOTTABLEBUFFER_HXX
#define OOX_XLS_PIVOTTABLEBUFFER_HXX
-#include <hash_map>
-#include <vector>
-#include <boost/shared_ptr.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
-#include "oox/xls/sheetcellrangemap.hxx"
+#include "oox/helper/containerhelper.hxx"
+#include "oox/xls/pivotcachebuffer.hxx"
#include "oox/xls/workbookhelper.hxx"
+namespace com { namespace sun { namespace star {
+ namespace sheet { class XDataPilotDescriptor; }
+ namespace sheet { class XDataPilotField; }
+} } }
+
namespace oox {
namespace xls {
+class PivotTable;
+
// ============================================================================
-struct PivotCacheField
+struct PTFieldItemModel
{
- ::rtl::OUString maName;
- ::std::vector< ::rtl::OUString > maItems;
+ sal_Int32 mnCacheItem; /// Index to shared item in pivot cache.
+ sal_Int32 mnType; /// Type of the item.
+ bool mbShowDetails; /// True = show item details (items of child fields).
+ bool mbHidden; /// True = item is hidden.
+
+ explicit PTFieldItemModel();
+
+ /** Sets item type for BIFF/OOBIN import. */
+ void setBinType( sal_uInt16 nType );
};
-typedef ::std::vector< PivotCacheField > PivotCacheFields;
+// ----------------------------------------------------------------------------
+
+struct PTFieldModel
+{
+ sal_Int32 mnAxis; /// Axis this field is assigned to (none, row, column, page).
+ sal_Int32 mnNumFmtId; /// Number format for field items.
+ sal_Int32 mnAutoShowItems; /// Number of items (or percent/sum) to be shown in auto show filter.
+ sal_Int32 mnAutoShowRankBy; /// Index of the data field auto show filter is based on.
+ sal_Int32 mnSortType; /// Autosorting type.
+ sal_Int32 mnSortRefField; /// Reference field for autosorting.
+ sal_Int32 mnSortRefItem; /// Item in reference field for autosorting.
+ bool mbDataField; /// True = field appears in data area.
+ bool mbDefaultSubtotal; /// True = show default subtotals.
+ bool mbSumSubtotal; /// True = show sum subtotals.
+ bool mbCountASubtotal; /// True = show count all subtotals.
+ bool mbAverageSubtotal; /// True = show average subtotals.
+ bool mbMaxSubtotal; /// True = show maximum subtotals.
+ bool mbMinSubtotal; /// True = show minimum subtotals.
+ bool mbProductSubtotal; /// True = show product subtotals.
+ bool mbCountSubtotal; /// True = show count numbers subtotals.
+ bool mbStdDevSubtotal; /// True = show standard deviation subtotals.
+ bool mbStdDevPSubtotal; /// True = show standard deviation of population subtotals.
+ bool mbVarSubtotal; /// True = show variance subtotals.
+ bool mbVarPSubtotal; /// True = show variance of population subtotals.
+ bool mbShowAll; /// True = show items without data.
+ bool mbOutline; /// True = show in outline view, false = show in tabular view.
+ bool mbSubtotalTop; /// True = show subtotals on top of items in outline or compact mode.
+ bool mbInsertBlankRow; /// True = insert blank rows after items.
+ bool mbInsertPageBreak; /// True = insert page breaks after items.
+ bool mbAutoShow; /// True = auto show (top 10) filter enabled.
+ bool mbTopAutoShow; /// True = auto show filter shows top entries, false = bottom.
+ bool mbMultiPageItems; /// True = multiple items selectable in page diemsion.
+
+ explicit PTFieldModel();
+
+ /** Sets axis type for BIFF/OOBIN import. */
+ void setBinAxis( sal_uInt8 nAxisFlags );
+};
// ----------------------------------------------------------------------------
-struct PivotCacheData
+struct PTPageFieldModel
{
- enum SourceType
- {
- WORKSHEET,
- EXTERNAL
- };
- SourceType meSourceType;
+ ::rtl::OUString maName; /// Unique name of the page field.
+ sal_Int32 mnField; /// Base pivot field.
+ sal_Int32 mnItem; /// Index of field item that is shown by the page field.
+
+ explicit PTPageFieldModel();
+};
- struct BaseSource {};
+// ----------------------------------------------------------------------------
- struct WorksheetSource : public BaseSource
- {
- ::rtl::OUString maSrcRange;
- ::rtl::OUString maSheetName;
- };
+struct PTDataFieldModel
+{
+ ::rtl::OUString maName; /// Name of the data field.
+ sal_Int32 mnField; /// Base pivot field.
+ sal_Int32 mnSubtotal; /// Subtotal aggregation function.
+ sal_Int32 mnShowDataAs; /// Show data as, based on another field.
+ sal_Int32 mnBaseField; /// Base field for 'show data as'.
+ sal_Int32 mnBaseItem; /// Base item for 'show data as'.
+ sal_Int32 mnNumFmtId; /// Number format for the result.
+
+ explicit PTDataFieldModel();
+
+ /** Sets the subtotal aggregation function for BIFF/OOBIN import. */
+ void setBinSubtotal( sal_Int32 nSubtotal );
+ /** Sets the 'show data as' type for BIFF/OOBIN import. */
+ void setBinShowDataAs( sal_Int32 nShowDataAs );
+};
- struct ExternalSource : public BaseSource
- {
- };
+// ----------------------------------------------------------------------------
- typedef ::boost::shared_ptr< BaseSource > SourceRef;
- SourceRef mpSourceProp;
+class PivotTableField : public WorkbookHelper
+{
+public:
+ explicit PivotTableField( PivotTable& rPivotTable, sal_Int32 nFieldIndex );
+
+ /** Imports pivot field settings from the pivotField element. */
+ void importPivotField( const AttributeList& rAttribs );
+ /** Imports settings of an item in this pivot field from the item element. */
+ void importItem( const AttributeList& rAttribs );
+ /** Imports pivot field reference settings from the reference element. */
+ void importReference( const AttributeList& rAttribs );
+ /** Imports pivot field item reference settings from the x element. */
+ void importReferenceItem( const AttributeList& rAttribs );
+
+ /** Imports pivot field settings from the PTFIELD record. */
+ void importPTField( RecordInputStream& rStrm );
+ /** Imports settings of an item in this pivot field from the PTFITEM record. */
+ void importPTFItem( RecordInputStream& rStrm );
+ /** Imports pivot field reference settings from the PTREFERENCE record. */
+ void importPTReference( RecordInputStream& rStrm );
+ /** Imports pivot field item reference settings from the PTREFERENCEITEM record. */
+ void importPTReferenceItem( RecordInputStream& rStrm );
+
+ /** Imports pivot field settings from the PTFIELD and following records. */
+ void importPTField( BiffInputStream& rStrm );
+ /** Imports pivot field settings from the PTFIELD2 record. */
+ void importPTField2( BiffInputStream& rStrm );
+ /** Imports settings of an item in this pivot field from the PTFITEM record. */
+ void importPTFItem( BiffInputStream& rStrm );
+
+ /** Finalizes the field after import, creates grouping and other settings. */
+ void finalizeImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotDescriptor >& rxDPDesc );
+ /** Finalizes the grouped date field after import. */
+ void finalizeDateGroupingImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >& rxBaseDPField,
+ sal_Int32 nBaseFieldIdx );
+ /** Finalizes the grouped field after import. */
+ void finalizeParentGroupingImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >& rxBaseDPField,
+ PivotCacheGroupItemVector& orItemNames );
+
+ /** Returns the name of the DataPilot field in the fields collection. */
+ inline const ::rtl::OUString& getDPFieldName() const { return maDPFieldName; }
+
+ /** Converts dimension and other settings for a row field. */
+ void convertRowField();
+ /** Converts dimension and other settings for a column field. */
+ void convertColField();
+ /** Converts dimension and other settings for a hidden field. */
+ void convertHiddenField();
+ /** Converts dimension and other settings for a page field */
+ void convertPageField( const PTPageFieldModel& rPageField );
+ /** Converts dimension and other settings for a data field. */
+ void convertDataField( const PTDataFieldModel& rDataField );
- PivotCacheFields maFields;
+private:
+ /** Converts dimension and other settings for row, column, page, or hidden fields. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >
+ convertRowColPageField( sal_Int32 nAxis );
- PivotCacheData();
+private:
+ typedef ::std::vector< PTFieldItemModel > ItemModelVector;
- WorksheetSource* getWorksheetSource() const;
- ExternalSource* getExternalSource() const;
+ PivotTable& mrPivotTable; /// The parent pivot table object.
+ ItemModelVector maItems; /// All items of this field.
+ PTFieldModel maModel; /// Pivot field settings.
+ ::rtl::OUString maDPFieldName; /// Name of the field in DataPilot field collection.
+ sal_Int32 mnFieldIndex; /// Zero-based index of this field.
};
// ============================================================================
-struct PivotTableField
+struct PTFilterModel
{
- enum AxisType
- {
- COLUMN,
- ROW,
- PAGE,
- VALUES
- };
+ ::rtl::OUString maName; /// Name of the field filter.
+ ::rtl::OUString maDescription; /// Description of the field filter.
+ ::rtl::OUString maStrValue1; /// First string value for label filter.
+ ::rtl::OUString maStrValue2; /// Second string value for label filter.
+ double mfValue; /// Number of items or percent or sum to be shown.
+ sal_Int32 mnField; /// Base pivot field.
+ sal_Int32 mnMemPropField; /// Member property field.
+ sal_Int32 mnType; /// Filter type.
+ sal_Int32 mnEvalOrder; /// Evaluation order index.
+ sal_Int32 mnId; /// Unique identifier.
+ sal_Int32 mnMeasureField; /// Data field for filter calculation.
+ sal_Int32 mnMeasureHier; /// Hierarchy for filter calculation.
+ bool mbTopFilter; /// True = filter shows top entries, false = bottom.
+
+ explicit PTFilterModel();
+};
- AxisType meAxis;
+// ----------------------------------------------------------------------------
- ::std::vector< sal_uInt32 > maItems; /// IDs pointing to corresponding items in pivot cache field.
- bool mbDataField;
+class PivotTableFilter : public WorkbookHelper
+{
+public:
+ explicit PivotTableFilter( const PivotTable& rPivotTable );
- PivotTableField();
-};
+ /** Reads the settings of a field filter from the filter element. */
+ void importFilter( const AttributeList& rAttribs );
+ /** Reads additional settings of a field filter from the top10 element. */
+ void importTop10( const AttributeList& rAttribs );
-typedef ::std::vector< PivotTableField > PivotTableFields;
+ /** Reads the settings of a field filter from the PTFILTER record. */
+ void importPTFilter( RecordInputStream& rStrm );
+ /** Reads additional settings of a field filter from the TOP10FILTER record. */
+ void importTop10Filter( RecordInputStream& rStrm );
-// ----------------------------------------------------------------------------
+ /** Applies the filter to the associated pivot table field if possible. */
+ void finalizeImport();
-struct PivotTableData
-{
- ::com::sun::star::table::CellRangeAddress maRange; /// destination cell range
- sal_uInt32 mnCacheId; /// cache ID
+private:
+ const PivotTable& mrPivotTable;
+ PTFilterModel maModel;
+};
- PivotTableFields maFields;
+// ============================================================================
- PivotTableData();
+struct PTDefinitionModel
+{
+ ::rtl::OUString maName;
+ ::rtl::OUString maDataCaption;
+ ::rtl::OUString maGrandTotalCaption;
+ ::rtl::OUString maRowHeaderCaption;
+ ::rtl::OUString maColHeaderCaption;
+ ::rtl::OUString maErrorCaption;
+ ::rtl::OUString maMissingCaption;
+ ::rtl::OUString maPageStyle;
+ ::rtl::OUString maPivotTableStyle;
+ ::rtl::OUString maVacatedStyle;
+ ::rtl::OUString maTag;
+ sal_Int32 mnCacheId;
+ sal_Int32 mnDataPosition;
+ sal_Int32 mnPageWrap;
+ sal_Int32 mnIndent;
+ sal_Int32 mnChartFormat;
+ sal_uInt16 mnRowFields;
+ sal_uInt16 mnColFields;
+ bool mbDataOnRows;
+ bool mbShowError;
+ bool mbShowMissing;
+ bool mbShowItems;
+ bool mbDisableFieldList;
+ bool mbShowCalcMembers;
+ bool mbVisualTotals;
+ bool mbShowDataDropDown;
+ bool mbShowDrill;
+ bool mbPrintDrill;
+ bool mbEnableDrill;
+ bool mbPreserveFormatting;
+ bool mbPageOverThenDown;
+ bool mbSubtotalHiddenItems;
+ bool mbRowGrandTotals;
+ bool mbColGrandTotals;
+ bool mbFieldPrintTitles;
+ bool mbItemPrintTitles;
+ bool mbMergeItem;
+ bool mbShowEmptyRow;
+ bool mbShowEmptyCol;
+ bool mbShowHeaders;
+ bool mbFieldListSortAsc;
+ bool mbCustomListSort;
+
+ explicit PTDefinitionModel();
};
// ----------------------------------------------------------------------------
-class PivotTableBuffer : public WorkbookHelper
+struct PTLocationModel
{
-public:
- explicit PivotTableBuffer( const WorkbookHelper& rHelper );
-
- /** Returns a pointer to the pivot cache instance by ID. */
- const PivotCacheData* getPivotCache( sal_uInt32 nCacheId ) const;
+ ::com::sun::star::table::CellRangeAddress
+ maRange; /// Target cell range for the pivot table.
+ sal_Int32 mnFirstHeaderRow; /// First row of header cells (relative in pivot table).
+ sal_Int32 mnFirstDataRow; /// First row of data cells (relative in pivot table).
+ sal_Int32 mnFirstDataCol; /// First column of data cells (relative in pivot table).
+ sal_Int32 mnRowPageCount; /// Number of rows in page filter area.
+ sal_Int32 mnColPageCount; /// Number of columns in page filter area.
+
+ explicit PTLocationModel();
+};
- /** Sets a new pivot cache data. It will overwrite an existing cache data if
- any exists at the specified ID location. */
- void setPivotCache( sal_uInt32 nCacheId, const PivotCacheData& aData );
+// ----------------------------------------------------------------------------
- PivotTableData* getPivotTable( const ::rtl::OUString& aName );
+class PivotTable : public WorkbookHelper
+{
+public:
+ explicit PivotTable( const WorkbookHelper& rHelper );
+
+ /** Reads global pivot table settings from the pivotTableDefinition element. */
+ void importPivotTableDefinition( const AttributeList& rAttribs );
+ /** Reads the location of the pivot table from the location element. */
+ void importLocation( const AttributeList& rAttribs, sal_Int16 nSheet );
+ /** Reads the index of a field located in the row dimension. */
+ void importRowField( const AttributeList& rAttribs );
+ /** Reads the index of a field located in the column dimension. */
+ void importColField( const AttributeList& rAttribs );
+ /** Reads the settings of a field located in the page dimension from the pageField element. */
+ void importPageField( const AttributeList& rAttribs );
+ /** Reads the settings of a field located in the data dimension from the dataField element. */
+ void importDataField( const AttributeList& rAttribs );
+
+ /** Reads global pivot table settings from the PTDEFINITION record. */
+ void importPTDefinition( RecordInputStream& rStrm );
+ /** Reads the location of the pivot table from the PTLOCATION record. */
+ void importPTLocation( RecordInputStream& rStrm, sal_Int16 nSheet );
+ /** Reads the indexes of all fields located in the row dimension from a PTROWFIELDS record. */
+ void importPTRowFields( RecordInputStream& rStrm );
+ /** Reads the indexes of all fields located in the column dimension from a PTCOLFIELDS record. */
+ void importPTColFields( RecordInputStream& rStrm );
+ /** Reads the settings of a field located in the page dimension from the PTPAGEFIELD record. */
+ void importPTPageField( RecordInputStream& rStrm );
+ /** Reads the settings of a field located in the data dimension from the PTDATAFIELD record. */
+ void importPTDataField( RecordInputStream& rStrm );
+
+ /** Reads global pivot table settings from the PTDEFINITION record. */
+ void importPTDefinition( BiffInputStream& rStrm, sal_Int16 nSheet );
+ /** Reads additional global pivot table settings from the PTDEFINITION2 record. */
+ void importPTDefinition2( BiffInputStream& rStrm );
+ /** Reads the indexes of all fields located in the row or column dimension from a PTROWCOLFIELDS record. */
+ void importPTRowColFields( BiffInputStream& rStrm );
+ /** Reads the settings of all fields located in the page dimension from a PTPAGEFIELDS record. */
+ void importPTPageFields( BiffInputStream& rStrm );
+ /** Reads the settings of a field located in the data dimension from a PTDATAFIELD record. */
+ void importPTDataField( BiffInputStream& rStrm );
+
+ /** Creates and returns a new pivot table field. */
+ PivotTableField& createTableField();
+ /** Creates and returns a new pivot table filter. */
+ PivotTableFilter& createTableFilter();
+ /** Inserts the pivot table into the sheet. */
+ void finalizeImport();
+ /** Creates all date group fields for the specified cache field after import. */
+ void finalizeDateGroupingImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >& rxBaseDPField,
+ sal_Int32 nBaseFieldIdx );
+ /** Creates all grouped fields for the specified cache field after import. */
+ void finalizeParentGroupingImport(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >& rxBaseDPField,
+ const PivotCacheField& rBaseCacheField,
+ PivotCacheGroupItemVector& orItemNames );
+
+ /** Returns the associated data pilot field for the specified pivot table field. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >
+ getDataPilotField( const ::rtl::OUString& rFieldName ) const;
+ /** Returns the associated data pilot field for the specified pivot table field. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >
+ getDataPilotField( sal_Int32 nFieldIdx ) const;
+ /** Returns the data layout field used to store all data fields in row/col dimension. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField >
+ getDataLayoutField() const;
+
+ /** Returns the cache field with the specified index. */
+ const PivotCacheField* getCacheField( sal_Int32 nFieldIdx ) const;
+ /** Returns the base cache field of the data field item with the specified index. */
+ const PivotCacheField* getCacheFieldOfDataField( sal_Int32 nDataItemIdx ) const;
+ /** Returns the source column index of the pivot field with the passed index, or -1. */
+ sal_Int32 getCacheDatabaseIndex( sal_Int32 nFieldIdx ) const;
- void setPivotTable( const ::rtl::OUString& aName, const PivotTableData& aData );
+private:
+ typedef RefVector< PivotTableField > PivotTableFieldVector;
+ typedef RefVector< PivotTableFilter > PivotTableFilterVector;
+ typedef ::std::vector< sal_Int32 > IndexVector;
+ typedef ::std::vector< PTPageFieldModel > PageFieldVector;
+ typedef ::std::vector< PTDataFieldModel > DataFieldVector;
- /** Check if a given cell address overlaps one of pivot table destination
- ranges. */
- bool isOverlapping( const ::com::sun::star::table::CellAddress& aCellAddress ) const;
+private:
+ /** Returns a pivot table field by its index. */
+ PivotTableField* getTableField( sal_Int32 nFieldIdx );
- void finalizeImport() const;
+ /** Reads a field index for the row or column dimension. */
+ static void importField( IndexVector& orFields, const AttributeList& rAttribs );
+ /** Reads an array of field indexes for the row or column dimension. */
+ static void importFields( IndexVector& orFields, RecordInputStream& rStrm );
+ /** Reads an array of field indexes for the row or column dimension. */
+ static void importFields( IndexVector& orFields, BiffInputStream& rStrm, sal_Int32 nCount );
private:
+ PivotTableFieldVector maFields; /// All pivot table fields.
+ PivotTableField maDataField; /// Data layout field.
+ IndexVector maRowFields; /// Indexes to fields in row dimension.
+ IndexVector maColFields; /// Indexes to fields in column dimension.
+ PageFieldVector maPageFields; /// Settings for all fields in page dimension.
+ DataFieldVector maDataFields; /// Settings for all fields in data area.
+ PivotTableFilterVector maFilters; /// All field filters.
+ PTDefinitionModel maDefModel; /// Global pivot table settings.
+ PTLocationModel maLocationModel; /// Location settings of the pivot table.
+ const PivotCache* mpPivotCache; /// The pivot cache this table is based on.
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotDescriptor >
+ mxDPDescriptor; /// Descriptor of the DataPilot object.
+};
+
+// ============================================================================
- typedef ::std::hash_map< sal_uInt32, PivotCacheData > PivotCacheMapType;
- typedef ::std::hash_map< ::rtl::OUString, PivotTableData, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > PivotTableMapType;
+class PivotTableBuffer : public WorkbookHelper
+{
+public:
+ explicit PivotTableBuffer( const WorkbookHelper& rHelper );
- void writePivotTable( const ::rtl::OUString& aName, const PivotTableData& aData ) const;
+ /** Creates and returns a new pivot table. */
+ PivotTable& createPivotTable();
- bool getSourceRange( const ::rtl::OUString& aSheetName, const ::rtl::OUString& aRefName,
- ::com::sun::star::table::CellRangeAddress& rRange ) const;
+ /** Inserts all pivot tables into the sheet. */
+ void finalizeImport();
private:
-
- PivotCacheMapType maPivotCacheMap; /// A collection of pivot cache data organized by IDs.
- PivotTableMapType maPivotTableMap; /// A collection of pivot table data organized by IDs.
- SheetCellRangeMap maCellRangeMap;
+ typedef RefVector< PivotTable > PivotTableVector;
+ PivotTableVector maTables;
};
// ============================================================================
@@ -167,3 +449,4 @@ private:
} // namespace oox
#endif
+
diff --git a/oox/inc/oox/xls/pivottablefragment.hxx b/oox/inc/oox/xls/pivottablefragment.hxx
index 9bed8ed04396..d83723d0a5f8 100644
--- a/oox/inc/oox/xls/pivottablefragment.hxx
+++ b/oox/inc/oox/xls/pivottablefragment.hxx
@@ -32,12 +32,53 @@
#define OOX_XLS_PIVOTTABLEFRAGMENT_HXX
#include "oox/xls/excelhandlers.hxx"
-#include "oox/xls/pivottablebuffer.hxx"
#include "oox/xls/worksheethelper.hxx"
namespace oox {
namespace xls {
+class PivotTable;
+class PivotTableField;
+class PivotTableFilter;
+
+// ============================================================================
+
+class OoxPivotTableFieldContext : public OoxWorksheetContextBase
+{
+public:
+ explicit OoxPivotTableFieldContext(
+ OoxWorksheetFragmentBase& rFragment,
+ PivotTableField& rTableField );
+
+protected:
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onStartElement( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual void onStartRecord( RecordInputStream& rStrm );
+
+private:
+ PivotTableField& mrTableField;
+};
+
+// ============================================================================
+
+class OoxPivotTableFilterContext : public OoxWorksheetContextBase
+{
+public:
+ explicit OoxPivotTableFilterContext(
+ OoxWorksheetFragmentBase& rFragment,
+ PivotTableFilter& rTableFilter );
+
+protected:
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onStartElement( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual void onStartRecord( RecordInputStream& rStrm );
+
+private:
+ PivotTableFilter& mrTableFilter;
+};
+
// ============================================================================
class OoxPivotTableFragment : public OoxWorksheetFragmentBase
@@ -48,26 +89,27 @@ public:
const ::rtl::OUString& rFragmentPath );
protected:
- // oox.core.ContextHandler2Helper interface -------------------------------
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+ virtual const ::oox::core::RecordInfo* getRecordInfos() const;
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onStartElement( const AttributeList& rAttribs );
+private:
+ PivotTable& mrPivotTable;
+};
- // oox.core.FragmentHandler2 interface ------------------------------------
+// ============================================================================
+// ============================================================================
- virtual void finalizeImport();
+class BiffPivotTableContext : public BiffWorksheetContextBase
+{
+public:
+ explicit BiffPivotTableContext( const BiffWorksheetFragmentBase& rFragment, PivotTable& rPivotTable );
-private:
- void importLocation( const AttributeList& rAttribs );
- void importPivotTableDefinition( const AttributeList& rAttribs );
- void importPivotFields( const AttributeList& rAttribs );
- void importPivotField( const AttributeList& rAttribs );
+ /** Imports all records related to the current pivot table. */
+ virtual void importRecord();
private:
- ::rtl::OUString maName;
- PivotTableData maData;
-
- bool mbValidRange;
+ PivotTable& mrPivotTable;
};
// ============================================================================
diff --git a/oox/inc/oox/xls/querytablefragment.hxx b/oox/inc/oox/xls/querytablefragment.hxx
index 9220a2ee0418..45e99b040f4b 100644
--- a/oox/inc/oox/xls/querytablefragment.hxx
+++ b/oox/inc/oox/xls/querytablefragment.hxx
@@ -48,11 +48,7 @@ public:
protected:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onStartElement( const AttributeList& rAttribs );
-
-private:
- void importQueryTable( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
};
// ============================================================================
diff --git a/oox/inc/oox/xls/richstring.hxx b/oox/inc/oox/xls/richstring.hxx
index f1dc8cfa6baa..23a0801531ae 100644
--- a/oox/inc/oox/xls/richstring.hxx
+++ b/oox/inc/oox/xls/richstring.hxx
@@ -64,7 +64,7 @@ public:
/** Sets text data for this portion. */
void setText( const ::rtl::OUString& rText );
/** Creates and returns a new font formatting object. */
- FontRef importFont( const AttributeList& rAttribs );
+ FontRef createFont();
/** Links this portion to a font object from the global font list. */
void setFontId( sal_Int32 nFontId );
@@ -99,15 +99,15 @@ enum BiffFontPortionMode
This object stores the position of a formatted character in a rich-string
and the identifier of a font from the global font list used to format this
- and the following characters.
+ and the following characters. Used in binary filters only.
*/
-struct BinFontPortionData
+struct FontPortionModel
{
sal_Int32 mnPos; /// First character in the string.
sal_Int32 mnFontId; /// Font identifier for the next characters.
- explicit inline BinFontPortionData() : mnPos( 0 ), mnFontId( -1 ) {}
- explicit inline BinFontPortionData( sal_Int32 nPos, sal_Int32 nFontId ) :
+ explicit inline FontPortionModel() : mnPos( 0 ), mnFontId( -1 ) {}
+ explicit inline FontPortionModel( sal_Int32 nPos, sal_Int32 nFontId ) :
mnPos( nPos ), mnFontId( nFontId ) {}
void read( RecordInputStream& rStrm );
@@ -117,13 +117,13 @@ struct BinFontPortionData
// ----------------------------------------------------------------------------
/** A vector with all font portions in a rich-string. */
-class BinFontPortionList : public ::std::vector< BinFontPortionData >
+class FontPortionModelList : public ::std::vector< FontPortionModel >
{
public:
- inline explicit BinFontPortionList() {}
+ inline explicit FontPortionModelList() {}
/** Appends a rich-string font identifier. */
- void appendPortion( const BinFontPortionData& rPortion );
+ void appendPortion( const FontPortionModel& rPortion );
/** Reads count and font identifiers from the passed stream. */
void importPortions( RecordInputStream& rStrm );
/** Reads nCount font identifiers from the passed stream. */
@@ -134,13 +134,13 @@ public:
// ============================================================================
-struct OoxPhoneticData
+struct PhoneticDataModel
{
sal_Int32 mnFontId; /// Font identifier for text formatting.
sal_Int32 mnType; /// Phonetic text type.
sal_Int32 mnAlignment; /// Phonetic portion alignment.
- explicit OoxPhoneticData();
+ explicit PhoneticDataModel();
/** Sets the passed data from binary import. */
void setBinData( sal_Int32 nType, sal_Int32 nAlignment );
@@ -166,7 +166,7 @@ public:
void importStringData( BiffInputStream& rStrm );
private:
- OoxPhoneticData maOoxData;
+ PhoneticDataModel maModel;
};
// ============================================================================
@@ -194,15 +194,16 @@ typedef ::boost::shared_ptr< RichStringPhonetic > RichStringPhoneticRef;
// ----------------------------------------------------------------------------
-/** Represents a phonetic text portion in a rich-string with phonetic text. */
-struct BinPhoneticPortionData
+/** Represents a phonetic text portion in a rich-string with phonetic text.
+ Used in binary filters only. */
+struct PhoneticPortionModel
{
sal_Int32 mnPos; /// First character in phonetic text.
sal_Int32 mnBasePos; /// First character in base text.
sal_Int32 mnBaseLen; /// Number of characters in base text.
- explicit inline BinPhoneticPortionData() : mnPos( -1 ), mnBasePos( -1 ), mnBaseLen( 0 ) {}
- explicit inline BinPhoneticPortionData( sal_Int32 nPos, sal_Int32 nBasePos, sal_Int32 nBaseLen ) :
+ explicit inline PhoneticPortionModel() : mnPos( -1 ), mnBasePos( -1 ), mnBaseLen( 0 ) {}
+ explicit inline PhoneticPortionModel( sal_Int32 nPos, sal_Int32 nBasePos, sal_Int32 nBaseLen ) :
mnPos( nPos ), mnBasePos( nBasePos ), mnBaseLen( nBaseLen ) {}
void read( RecordInputStream& rStrm );
@@ -212,13 +213,13 @@ struct BinPhoneticPortionData
// ----------------------------------------------------------------------------
/** A vector with all phonetic portions in a rich-string. */
-class BinPhoneticPortionList : public ::std::vector< BinPhoneticPortionData >
+class PhoneticPortionModelList : public ::std::vector< PhoneticPortionModel >
{
public:
- inline explicit BinPhoneticPortionList() {}
+ inline explicit PhoneticPortionModelList() {}
/** Appends a rich-string phonetic portion. */
- void appendPortion( const BinPhoneticPortionData& rPortion );
+ void appendPortion( const PhoneticPortionModel& rPortion );
/** Reads all phonetic portions from the passed stream. */
void importPortions( RecordInputStream& rStrm );
/** Reads phonetic portion data from the passed stream. */
@@ -265,11 +266,11 @@ private:
RichStringPhoneticRef createPhonetic();
/** Create base text portions from the passed string and character formatting. */
- void createFontPortions( const ::rtl::OString& rText, rtl_TextEncoding eDefaultTextEnc, BinFontPortionList& rPortions );
+ void createFontPortions( const ::rtl::OString& rText, rtl_TextEncoding eDefaultTextEnc, FontPortionModelList& rPortions );
/** Create base text portions from the passed string and character formatting. */
- void createFontPortions( const ::rtl::OUString& rText, BinFontPortionList& rPortions );
+ void createFontPortions( const ::rtl::OUString& rText, FontPortionModelList& rPortions );
/** Create phonetic text portions from the passed string and portion data. */
- void createPhoneticPortions( const ::rtl::OUString& rText, BinPhoneticPortionList& rPortions, sal_Int32 nBaseLen );
+ void createPhoneticPortions( const ::rtl::OUString& rText, PhoneticPortionModelList& rPortions, sal_Int32 nBaseLen );
private:
typedef RefVector< RichStringPortion > PortionVec;
diff --git a/oox/inc/oox/xls/richstringcontext.hxx b/oox/inc/oox/xls/richstringcontext.hxx
index 5327a79970df..30f304b47630 100644
--- a/oox/inc/oox/xls/richstringcontext.hxx
+++ b/oox/inc/oox/xls/richstringcontext.hxx
@@ -48,8 +48,7 @@ public:
protected:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onStartElement( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
private:
diff --git a/oox/inc/oox/xls/sharedformulabuffer.hxx b/oox/inc/oox/xls/sharedformulabuffer.hxx
index 0345b11fb276..2a0d2bc2b5db 100644
--- a/oox/inc/oox/xls/sharedformulabuffer.hxx
+++ b/oox/inc/oox/xls/sharedformulabuffer.hxx
@@ -102,7 +102,6 @@ private:
typedef ::std::map< BinAddress, sal_Int32 > TokenIndexMap;
typedef ::std::auto_ptr< ExtCellFormulaContext > ContextPtr;
- const ::rtl::OUString maIsSharedProp; /// Property name for shared formula name flag.
TokenIndexMap maIndexMap; /// Maps shared formula base address to defined name identifier.
ContextPtr mxLastContext; /// Cached formula context for leading formula cell.
};
diff --git a/oox/inc/oox/xls/sharedstringsfragment.hxx b/oox/inc/oox/xls/sharedstringsfragment.hxx
index 1f574762a666..cb276ba60fb6 100644
--- a/oox/inc/oox/xls/sharedstringsfragment.hxx
+++ b/oox/inc/oox/xls/sharedstringsfragment.hxx
@@ -48,10 +48,9 @@ public:
protected:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual ContextWrapper onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
// oox.core.FragmentHandler2 interface ------------------------------------
diff --git a/oox/inc/oox/xls/sheetcellrangemap.hxx b/oox/inc/oox/xls/sheetcellrangemap.hxx
deleted file mode 100644
index ff49394d8063..000000000000
--- a/oox/inc/oox/xls/sheetcellrangemap.hxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: sheetcellrangemap.hxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef OOX_XLS_SHEETCELLRANGEMAP_HXX
-#define OOX_XLS_SHEETCELLRANGEMAP_HXX
-
-#include <hash_map>
-#include <map>
-#include <vector>
-#include <sal/types.h>
-
-namespace com { namespace sun { namespace star { namespace table {
- struct CellRangeAddress;
- struct CellAddress;
-}}}}
-
-namespace oox {
-namespace xls {
-
-/** This class is used to simulate a cell address "hit" against a set of
- cell range addresses. All addresses are 3-dimensional (sheet, row,
- column). */
-class SheetCellRangeMap
-{
-public:
- explicit SheetCellRangeMap();
- ~SheetCellRangeMap() throw();
-
- /** Add a new cell range to the map. */
- void addCellRange( const ::com::sun::star::table::CellRangeAddress& aRangeAddr );
-
- /** Test if a given cell address overlaps one of the registered cell
- ranges. */
- bool isOverlapping( const ::com::sun::star::table::CellAddress& aCellAddr ) const;
-
-public:
- typedef ::std::vector<size_t> AreaIdSetType;
- typedef ::std::map<sal_Int32, AreaIdSetType> EndAreaIdMapType;
- typedef ::std::map<sal_Int32, EndAreaIdMapType> StartEndMapType;
-
-private:
- struct SheetSet
- {
- SheetCellRangeMap::StartEndMapType maColRanges;
- SheetCellRangeMap::StartEndMapType maRowRanges;
- };
- typedef ::std::hash_map< sal_Int16, SheetSet > SheetMapType;
-
- void addRange( StartEndMapType& rRangeMap, sal_Int32 nStart, sal_Int32 nEnd, size_t nAreaId );
- bool expandSearch( const EndAreaIdMapType& rEndMap, const ::com::sun::star::table::CellAddress& aCellAddr, bool bColumn ) const;
- bool searchColumns( const SheetSet& rSheet, const ::com::sun::star::table::CellAddress& aCellAddr ) const;
-
-private:
- SheetMapType maSheetMap;
- ::std::vector< ::com::sun::star::table::CellRangeAddress > maAreas;
-};
-
-} // namespace xls
-} // namespace oox
-
-#endif
diff --git a/oox/inc/oox/xls/sheetdatacontext.hxx b/oox/inc/oox/xls/sheetdatacontext.hxx
index 4705789de77d..200486b03d87 100644
--- a/oox/inc/oox/xls/sheetdatacontext.hxx
+++ b/oox/inc/oox/xls/sheetdatacontext.hxx
@@ -56,12 +56,10 @@ public:
protected:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onStartElement( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
- virtual ContextWrapper onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
private:
/** Different types of cell records. */
@@ -106,8 +104,8 @@ private:
void importDataTable( RecordInputStream& rStrm );
private:
- OoxCellData maCurrCell; /// Position and formatting of current imported cell.
- OoxDataTableData maTableData; /// Additional data for table operation ranges.
+ CellModel maCurrCell; /// Position and formatting of current imported cell.
+ DataTableModel maTableData; /// Additional data for table operation ranges.
BinAddress maCurrPos; /// Current position for binary import.
RichStringRef mxInlineStr; /// Inline rich string from 'is' element.
};
@@ -164,7 +162,7 @@ private:
void importDataTable();
private:
- OoxCellData maCurrCell; /// Position and formatting of current imported cell.
+ CellModel maCurrCell; /// Position and formatting of current imported cell.
sal_uInt32 mnFormulaIgnoreSize; /// Number of bytes to be ignored in FORMULA record.
sal_uInt32 mnArrayIgnoreSize; /// Number of bytes to be ignored in ARRAY record.
sal_uInt16 mnBiff2XfId; /// Current XF identifier from IXFE record.
diff --git a/oox/inc/oox/xls/stylesbuffer.hxx b/oox/inc/oox/xls/stylesbuffer.hxx
index 69c570c92a12..0ee6a3f0a5a8 100644
--- a/oox/inc/oox/xls/stylesbuffer.hxx
+++ b/oox/inc/oox/xls/stylesbuffer.hxx
@@ -31,14 +31,21 @@
#ifndef OOX_XLS_STYLESBUFFER_HXX
#define OOX_XLS_STYLESBUFFER_HXX
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#include <com/sun/star/util/CellProtection.hpp>
+#include <com/sun/star/table/CellHoriJustify.hpp>
+#include <com/sun/star/table/CellOrientation.hpp>
+#include <com/sun/star/table/CellVertJustify.hpp>
+#include <com/sun/star/table/TableBorder.hpp>
#include "oox/helper/containerhelper.hxx"
-#include "oox/xls/stylespropertyhelper.hxx"
#include "oox/xls/numberformatsbuffer.hxx"
namespace com { namespace sun { namespace star {
namespace awt { struct FontDescrtiptor; }
} } }
+namespace oox { class PropertySet; }
+
#define OOX_XLS_USE_DEFAULT_STYLE 0
namespace oox {
@@ -58,6 +65,24 @@ const sal_Int32 OOX_COLOR_NOTEBACK = 80; /// Note background colo
const sal_Int32 OOX_COLOR_NOTETEXT = 81; /// Note text color.
const sal_Int32 OOX_COLOR_FONTAUTO = 0x7FFF; /// Font auto color (system window text color).
+// ----------------------------------------------------------------------------
+
+const sal_Int32 API_RGB_TRANSPARENT = -1; /// Transparent color for API calls.
+const sal_Int32 API_RGB_BLACK = 0; /// Black color for API calls.
+
+const sal_Int16 API_LINE_NONE = 0;
+const sal_Int16 API_LINE_HAIR = 2;
+const sal_Int16 API_LINE_THIN = 35;
+const sal_Int16 API_LINE_MEDIUM = 88;
+const sal_Int16 API_LINE_THICK = 141;
+
+const sal_Int16 API_ESCAPE_NONE = 0; /// No escapement.
+const sal_Int16 API_ESCAPE_SUPERSCRIPT = 101; /// Superscript: raise characters automatically (magic value 101).
+const sal_Int16 API_ESCAPE_SUBSCRIPT = -101; /// Subscript: lower characters automatically (magic value -101).
+
+const sal_Int8 API_ESCAPEHEIGHT_NONE = 100; /// Relative character height if not escaped.
+const sal_Int8 API_ESCAPEHEIGHT_DEFAULT = 58; /// Relative character height if escaped.
+
// ============================================================================
class Color
@@ -146,7 +171,7 @@ private:
// ============================================================================
/** Contains all XML font attributes, e.g. from a font or rPr element. */
-struct OoxFontData
+struct FontModel
{
::rtl::OUString maName; /// Font name.
Color maColor; /// Font color.
@@ -162,7 +187,7 @@ struct OoxFontData
bool mbOutline; /// True = outlined characters.
bool mbShadow; /// True = shadowed chgaracters.
- explicit OoxFontData();
+ explicit FontModel();
void setBinScheme( sal_uInt8 nScheme );
void setBiffHeight( sal_uInt16 nHeight );
@@ -171,16 +196,75 @@ struct OoxFontData
void setBiffEscapement( sal_uInt16 nEscapement );
};
+// ----------------------------------------------------------------------------
+
+/** Enumerates different types of API font property sets. */
+enum FontPropertyType
+{
+ FONT_PROPTYPE_CELL, /// Font properties in a spreadsheet cell (table::Cell service).
+ FONT_PROPTYPE_TEXT /// Font properties in a text object (text::Text service).
+};
+
+// ----------------------------------------------------------------------------
+
+/** Contains used flags for all API font attributes. */
+struct ApiFontUsedFlags
+{
+ bool mbNameUsed; /// True = font name/family/char set are used.
+ bool mbColorUsed; /// True = font color is used.
+ bool mbSchemeUsed; /// True = font scheme is used.
+ bool mbHeightUsed; /// True = font height is used.
+ bool mbUnderlineUsed; /// True = underline style is used.
+ bool mbEscapementUsed; /// True = escapement style is used.
+ bool mbWeightUsed; /// True = font weight (boldness) is used.
+ bool mbPostureUsed; /// True = font posture (italic) is used.
+ bool mbStrikeoutUsed; /// True = strike out style is used.
+ bool mbOutlineUsed; /// True = outline style is used.
+ bool mbShadowUsed; /// True = shadow style is used.
+
+ explicit ApiFontUsedFlags( bool bAllUsed );
+};
+
+// ----------------------------------------------------------------------------
+
+/** Contains API font name, family, and charset for a script type. */
+struct ApiScriptFontName
+{
+ ::rtl::OUString maName; /// Font name.
+ sal_Int16 mnFamily; /// Font family.
+ sal_Int16 mnCharSet; /// Font character set.
+
+ explicit ApiScriptFontName();
+};
+
+// ----------------------------------------------------------------------------
+
+/** Contains all API font attributes. */
+struct ApiFontData
+{
+ typedef ::com::sun::star::awt::FontDescriptor ApiFontDescriptor;
+
+ ApiScriptFontName maLatinFont; /// Font name for latin scripts.
+ ApiScriptFontName maAsianFont; /// Font name for east-asian scripts.
+ ApiScriptFontName maCmplxFont; /// Font name for complex scripts.
+ ApiFontDescriptor maDesc; /// Font descriptor (height in twips, weight in %).
+ sal_Int32 mnColor; /// Font color.
+ sal_Int16 mnEscapement; /// Escapement style.
+ sal_Int8 mnEscapeHeight; /// Escapement font height.
+ bool mbOutline; /// True = outlined characters.
+ bool mbShadow; /// True = shadowed chgaracters.
+
+ explicit ApiFontData();
+};
+
// ============================================================================
class Font : public WorkbookHelper
{
public:
explicit Font( const WorkbookHelper& rHelper, bool bDxf );
- explicit Font( const WorkbookHelper& rHelper, const OoxFontData& rFontData );
+ explicit Font( const WorkbookHelper& rHelper, const FontModel& rModel );
- /** Returns true, if the passed element represents a supported font context. */
- static bool isSupportedContext( sal_Int32 nElement, sal_Int32 nParentContext );
/** Sets font formatting attributes for the passed element. */
void importAttribs( sal_Int32 nElement, const AttributeList& rAttribs );
@@ -210,9 +294,9 @@ public:
/** Sets the font attributes from the font block of a CFRULE record. */
void importCfRule( BiffInputStream& rStrm );
- /** Returns the OOX font data structure. This function can be called before
+ /** Returns the font model structure. This function can be called before
finalizeImport() has been called. */
- inline const OoxFontData& getFontData() const { return maOoxData; }
+ inline const FontModel& getModel() const { return maModel; }
/** Returns the text encoding for strings used with this font. This
function can be called before finalizeImport() has been called. */
rtl_TextEncoding getFontEncoding() const;
@@ -227,6 +311,10 @@ public:
needs an rich text cell for this attribute. */
bool needsRichTextFormat() const;
+ /** Writes all font attributes to the passed property map. */
+ void writeToPropertyMap(
+ PropertyMap& rPropMap,
+ FontPropertyType ePropType ) const;
/** Writes all font attributes to the passed property set. */
void writeToPropertySet(
PropertySet& rPropSet,
@@ -244,7 +332,7 @@ private:
void importFontName8( BiffInputStream& rStrm );
private:
- OoxFontData maOoxData;
+ FontModel maModel;
ApiFontData maApiData;
ApiFontUsedFlags maUsedFlags;
bool mbDxf;
@@ -255,7 +343,7 @@ typedef ::boost::shared_ptr< Font > FontRef;
// ============================================================================
/** Contains all XML cell alignment attributes, e.g. from an alignment element. */
-struct OoxAlignmentData
+struct AlignmentModel
{
sal_Int32 mnHorAlign; /// Horizontal alignment.
sal_Int32 mnVerAlign; /// Vertical alignment.
@@ -266,7 +354,7 @@ struct OoxAlignmentData
bool mbShrink; /// True = shrink to fit cell size.
bool mbJustLastLine; /// True = justify last line in block text.
- explicit OoxAlignmentData();
+ explicit AlignmentModel();
/** Sets horizontal alignment from the passed OOBIN or BIFF data. */
void setBinHorAlign( sal_uInt8 nHorAlign );
@@ -276,6 +364,29 @@ struct OoxAlignmentData
void setBinTextOrient( sal_uInt8 nTextOrient );
};
+// ----------------------------------------------------------------------------
+
+/** Contains all API cell alignment attributes. */
+struct ApiAlignmentData
+{
+ typedef ::com::sun::star::table::CellHoriJustify ApiCellHoriJustify;
+ typedef ::com::sun::star::table::CellVertJustify ApiCellVertJustify;
+ typedef ::com::sun::star::table::CellOrientation ApiCellOrientation;
+
+ ApiCellHoriJustify meHorJustify; /// Horizontal alignment.
+ ApiCellVertJustify meVerJustify; /// Vertical alignment.
+ ApiCellOrientation meOrientation; /// Normal or stacked text.
+ sal_Int32 mnRotation; /// Text rotation angle.
+ sal_Int16 mnWritingMode; /// CTL text direction.
+ sal_Int16 mnIndent; /// Indentation.
+ bool mbWrapText; /// True = multi-line text.
+ bool mbShrink; /// True = shrink to fit cell size.
+
+ explicit ApiAlignmentData();
+};
+
+bool operator==( const ApiAlignmentData& rLeft, const ApiAlignmentData& rRight );
+
// ============================================================================
class Alignment : public WorkbookHelper
@@ -302,16 +413,16 @@ public:
/** Final processing after import of all style settings. */
void finalizeImport();
- /** Returns the OOX alignment data struct. */
- inline const OoxAlignmentData& getOoxData() const { return maOoxData; }
+ /** Returns the alignment model structure. */
+ inline const AlignmentModel& getModel() const { return maModel; }
/** Returns the converted API alignment data struct. */
inline const ApiAlignmentData& getApiData() const { return maApiData; }
- /** Writes all alignment attributes to the passed property set. */
- void writeToPropertySet( PropertySet& rPropSet ) const;
+ /** Writes all alignment attributes to the passed property map. */
+ void writeToPropertyMap( PropertyMap& rPropMap ) const;
private:
- OoxAlignmentData maOoxData; /// Data from alignment element.
+ AlignmentModel maModel; /// Alignment model data.
ApiAlignmentData maApiData; /// Alignment data converted to API constants.
};
@@ -320,14 +431,28 @@ typedef ::boost::shared_ptr< Alignment > AlignmentRef;
// ============================================================================
/** Contains all XML cell protection attributes, e.g. from a protection element. */
-struct OoxProtectionData
+struct ProtectionModel
{
bool mbLocked; /// True = locked against editing.
bool mbHidden; /// True = formula is hidden.
- explicit OoxProtectionData();
+ explicit ProtectionModel();
+};
+
+// ----------------------------------------------------------------------------
+
+/** Contains all API cell protection attributes. */
+struct ApiProtectionData
+{
+ typedef ::com::sun::star::util::CellProtection ApiCellProtection;
+
+ ApiCellProtection maCellProt;
+
+ explicit ApiProtectionData();
};
+bool operator==( const ApiProtectionData& rLeft, const ApiProtectionData& rRight );
+
// ============================================================================
class Protection : public WorkbookHelper
@@ -348,16 +473,16 @@ public:
/** Final processing after import of all style settings. */
void finalizeImport();
- /** Returns the OOX protection data struct. */
- inline const OoxProtectionData& getOoxData() const { return maOoxData; }
+ /** Returns the protection model structure. */
+ inline const ProtectionModel& getModel() const { return maModel; }
/** Returns the converted API protection data struct. */
inline const ApiProtectionData& getApiData() const { return maApiData; }
- /** Writes all protection attributes to the passed property set. */
- void writeToPropertySet( PropertySet& rPropSet ) const;
+ /** Writes all protection attributes to the passed property map. */
+ void writeToPropertyMap( PropertyMap& rPropMap ) const;
private:
- OoxProtectionData maOoxData; /// Data from protection element.
+ ProtectionModel maModel; /// Protection model data.
ApiProtectionData maApiData; /// Protection data converted to API constants.
};
@@ -366,13 +491,13 @@ typedef ::boost::shared_ptr< Protection > ProtectionRef;
// ============================================================================
/** Contains XML attributes of a single border line. */
-struct OoxBorderLineData
+struct BorderLineModel
{
Color maColor; /// Borderline color.
sal_Int32 mnStyle; /// Border line style.
bool mbUsed; /// True = line format used.
- explicit OoxBorderLineData( bool bDxf );
+ explicit BorderLineModel( bool bDxf );
/** Sets the passed OOBIN or BIFF line style. */
void setBiffStyle( sal_Int32 nLineStyle );
@@ -383,17 +508,34 @@ struct OoxBorderLineData
// ----------------------------------------------------------------------------
/** Contains XML attributes of a complete cell border. */
-struct OoxBorderData
+struct BorderModel
{
- OoxBorderLineData maLeft; /// Left line format.
- OoxBorderLineData maRight; /// Right line format.
- OoxBorderLineData maTop; /// Top line format.
- OoxBorderLineData maBottom; /// Bottom line format.
- OoxBorderLineData maDiagonal; /// Diagonal line format.
+ BorderLineModel maLeft; /// Left line format.
+ BorderLineModel maRight; /// Right line format.
+ BorderLineModel maTop; /// Top line format.
+ BorderLineModel maBottom; /// Bottom line format.
+ BorderLineModel maDiagonal; /// Diagonal line format.
bool mbDiagTLtoBR; /// True = top-left to bottom-right on.
bool mbDiagBLtoTR; /// True = bottom-left to top-right on.
- explicit OoxBorderData( bool bDxf );
+ explicit BorderModel( bool bDxf );
+};
+
+// ----------------------------------------------------------------------------
+
+/** Contains API attributes of a complete cell border. */
+struct ApiBorderData
+{
+ typedef ::com::sun::star::table::TableBorder ApiTableBorder;
+ typedef ::com::sun::star::table::BorderLine ApiBorderLine;
+
+ ApiTableBorder maBorder; /// Left/right/top/bottom line format.
+ ApiBorderLine maTLtoBR; /// Diagonal top-left to bottom-right line format.
+ ApiBorderLine maBLtoTR; /// Diagonal bottom-left to top-right line format.
+ bool mbBorderUsed; /// True = left/right/top/bottom line format used.
+ bool mbDiagUsed; /// True = diagonal line format used.
+
+ explicit ApiBorderData();
};
// ============================================================================
@@ -403,8 +545,6 @@ class Border : public WorkbookHelper
public:
explicit Border( const WorkbookHelper& rHelper, bool bDxf );
- /** Returns true, if the passed element represents a supported border context. */
- static bool isSupportedContext( sal_Int32 nElement, sal_Int32 nParentContext );
/** Sets global border attributes from the border element. */
void importBorder( const AttributeList& rAttribs );
/** Sets border attributes for the border line with the passed element identifier. */
@@ -414,7 +554,7 @@ public:
/** Imports the BORDER record from the passed stream. */
void importBorder( RecordInputStream& rStrm );
- /** Imports a boder from a DXF record from the passed stream. */
+ /** Imports a border from a DXF record from the passed stream. */
void importDxfBorder( sal_Int32 nElement, RecordInputStream& rStrm );
/** Sets the border attributes from the passed BIFF2 XF record data. */
@@ -431,20 +571,20 @@ public:
/** Final processing after import of all style settings. */
void finalizeImport();
- /** Writes all border attributes to the passed property set. */
- void writeToPropertySet( PropertySet& rPropSet ) const;
+ /** Writes all border attributes to the passed property map. */
+ void writeToPropertyMap( PropertyMap& rPropMap ) const;
private:
/** Returns the border line struct specified by the passed XML token identifier. */
- OoxBorderLineData* getBorderLine( sal_Int32 nElement );
+ BorderLineModel* getBorderLine( sal_Int32 nElement );
/** Converts border line data to an API struct, returns true, if the line is marked as used. */
bool convertBorderLine(
::com::sun::star::table::BorderLine& rBorderLine,
- const OoxBorderLineData& rLineData );
+ const BorderLineModel& rModel );
private:
- OoxBorderData maOoxData;
+ BorderModel maModel;
ApiBorderData maApiData;
bool mbDxf;
};
@@ -454,7 +594,7 @@ typedef ::boost::shared_ptr< Border > BorderRef;
// ============================================================================
/** Contains XML pattern fill attributes from the patternFill element. */
-struct OoxPatternFillData
+struct PatternFillModel
{
Color maPatternColor; /// Pattern foreground color.
Color maFillColor; /// Background fill color.
@@ -463,7 +603,7 @@ struct OoxPatternFillData
bool mbFillColorUsed; /// True = background fill color used.
bool mbPatternUsed; /// True = pattern used.
- explicit OoxPatternFillData( bool bDxf );
+ explicit PatternFillModel( bool bDxf );
/** Sets the passed OOBIN or BIFF pattern identifier. */
void setBinPattern( sal_Int32 nPattern );
@@ -474,7 +614,7 @@ struct OoxPatternFillData
// ----------------------------------------------------------------------------
/** Contains XML gradient fill attributes from the gradientFill element. */
-struct OoxGradientFillData
+struct GradientFillModel
{
typedef ::std::map< double, Color > ColorMap;
@@ -486,7 +626,7 @@ struct OoxGradientFillData
double mfBottom; /// Bottom convergence for type path.
ColorMap maColors; /// Gradient colors.
- explicit OoxGradientFillData();
+ explicit GradientFillModel();
/** Reads OOBIN gradient settings from a FILL or DXF record. */
void readGradient( RecordInputStream& rStrm );
@@ -494,6 +634,18 @@ struct OoxGradientFillData
void readGradientStop( RecordInputStream& rStrm, bool bDxf );
};
+// ----------------------------------------------------------------------------
+
+/** Contains API fill attributes. */
+struct ApiSolidFillData
+{
+ sal_Int32 mnColor; /// Fill color.
+ bool mbTransparent; /// True = transparent area.
+ bool mbUsed; /// True = fill data is valid.
+
+ explicit ApiSolidFillData();
+};
+
// ============================================================================
/** Contains cell fill attributes, either a pattern fill or a gradient fill. */
@@ -502,8 +654,6 @@ class Fill : public WorkbookHelper
public:
explicit Fill( const WorkbookHelper& rHelper, bool bDxf );
- /** Returns true, if the passed element represents a supported fill context. */
- static bool isSupportedContext( sal_Int32 nElement, sal_Int32 nParentContext );
/** Sets attributes of a patternFill element. */
void importPatternFill( const AttributeList& rAttribs );
/** Sets the pattern color from the fgColor element. */
@@ -542,15 +692,15 @@ public:
/** Final processing after import of all style settings. */
void finalizeImport();
- /** Writes all fill attributes to the passed property set. */
- void writeToPropertySet( PropertySet& rPropSet ) const;
+ /** Writes all fill attributes to the passed property map. */
+ void writeToPropertyMap( PropertyMap& rPropMap ) const;
private:
- typedef ::boost::shared_ptr< OoxPatternFillData > OoxPatternRef;
- typedef ::boost::shared_ptr< OoxGradientFillData > OoxGradientRef;
+ typedef ::boost::shared_ptr< PatternFillModel > PatternModelRef;
+ typedef ::boost::shared_ptr< GradientFillModel > GradientModelRef;
- OoxPatternRef mxOoxPattData;
- OoxGradientRef mxOoxGradData;
+ PatternModelRef mxPatternModel;
+ GradientModelRef mxGradientModel;
ApiSolidFillData maApiData;
bool mbDxf;
};
@@ -560,7 +710,7 @@ typedef ::boost::shared_ptr< Fill > FillRef;
// ============================================================================
/** Contains all data for a cell format or cell style. */
-struct OoxXfData
+struct XfModel
{
sal_Int32 mnStyleXfId; /// Index to parent style XF.
sal_Int32 mnFontId; /// Index to font data list.
@@ -575,7 +725,7 @@ struct OoxXfData
bool mbBorderUsed; /// True = border data used.
bool mbAreaUsed; /// True = area data used.
- explicit OoxXfData();
+ explicit XfModel();
};
// ============================================================================
@@ -620,6 +770,8 @@ public:
/** Returns true, if any "attribute used" flags are ste in this XF. */
bool hasAnyUsedFlags() const;
+ /** Writes all formatting attributes to the passed property map. */
+ void writeToPropertyMap( PropertyMap& rPropMap ) const;
/** Writes all formatting attributes to the passed property set. */
void writeToPropertySet( PropertySet& rPropSet ) const;
@@ -630,7 +782,7 @@ private:
void updateUsedFlags( const Xf& rStyleXf );
private:
- OoxXfData maOoxData; /// Data from cellXf or cellStyleXf element.
+ XfModel maModel; /// Cell XF or style XF model data.
Alignment maAlignment; /// Cell alignment data.
Protection maProtection; /// Cell protection data.
};
@@ -644,18 +796,19 @@ class Dxf : public WorkbookHelper
public:
explicit Dxf( const WorkbookHelper& rHelper );
- /** Appends and returns a new font object. */
- FontRef importFont( const AttributeList& rAttribs );
+ /** Creates a new empty font object. */
+ FontRef createFont( bool bAlwaysNew = true );
+ /** Creates a new empty border object. */
+ BorderRef createBorder( bool bAlwaysNew = true );
+ /** Creates a new empty fill object. */
+ FillRef createFill( bool bAlwaysNew = true );
+
/** Inserts a new number format code. */
void importNumFmt( const AttributeList& rAttribs );
/** Sets all attributes from the alignment element. */
void importAlignment( const AttributeList& rAttribs );
/** Sets all attributes from the protection element. */
void importProtection( const AttributeList& rAttribs );
- /** Appends and returns a new cell border object. */
- BorderRef importBorder( const AttributeList& rAttribs );
- /** Appends and returns a new cell fill object. */
- FillRef importFill( const AttributeList& rAttribs );
/** Imports the DXF record from the passed stream. */
void importDxf( RecordInputStream& rStrm );
@@ -670,11 +823,6 @@ public:
const ::rtl::OUString& createDxfStyle( sal_Int32 nDxfId );
private:
- void createFont( bool bAlwaysNew );
- void createBorder( bool bAlwaysNew );
- void createFill( bool bAlwaysNew );
-
-private:
FontRef mxFont; /// Font data.
NumberFormatRef mxNumFmt; /// Number format data.
AlignmentRef mxAlignment; /// Alignment data.
@@ -689,7 +837,7 @@ typedef ::boost::shared_ptr< Dxf > DxfRef;
// ============================================================================
/** Contains attributes of a cell style, e.g. from the cellStyle element. */
-struct OoxCellStyleData
+struct CellStyleModel
{
::rtl::OUString maName; /// Cell style name.
sal_Int32 mnXfId; /// Formatting for this cell style.
@@ -699,7 +847,7 @@ struct OoxCellStyleData
bool mbCustom; /// True = customized builtin style.
bool mbHidden; /// True = style not visible in GUI.
- explicit OoxCellStyleData();
+ explicit CellStyleModel();
/** Returns true, if this style is a builtin style. */
inline bool isBuiltin() const { return mbBuiltin && (mnBuiltinId >= 0); }
@@ -724,16 +872,16 @@ public:
void importStyle( BiffInputStream& rStrm );
/** Returns true, if this style represents the default document cell style. */
- inline bool isDefaultStyle() const { return maOoxData.isDefaultStyle(); }
+ inline bool isDefaultStyle() const { return maModel.isDefaultStyle(); }
/** Returns the XF identifier for this cell style. */
- inline sal_Int32 getXfId() const { return maOoxData.mnXfId; }
+ inline sal_Int32 getXfId() const { return maModel.mnXfId; }
/** Creates the style sheet described by the style XF with the passed identifier. */
const ::rtl::OUString& createCellStyle( sal_Int32 nXfId, bool bSkipDefaultBuiltin = false );
private:
- OoxCellStyleData maOoxData;
- ::rtl::OUString maFinalName; /// Final style name used in API.
+ CellStyleModel maModel;
+ ::rtl::OUString maCalcName; /// Final style name used in API.
};
typedef ::boost::shared_ptr< CellStyle > CellStyleRef;
@@ -768,35 +916,15 @@ public:
/** Appends a new color to the color palette. */
void importPaletteColor( const AttributeList& rAttribs );
- /** Appends and returns a new font object. */
- FontRef importFont( const AttributeList& rAttribs );
/** Inserts a new number format code. */
NumberFormatRef importNumFmt( const AttributeList& rAttribs );
- /** Appends and returns a new cell border object. */
- BorderRef importBorder( const AttributeList& rAttribs );
- /** Appends and returns a new cell fill object. */
- FillRef importFill( const AttributeList& rAttribs );
- /** Appends and returns a new cell format or cell style object. */
- XfRef importXf( sal_Int32 nContext, const AttributeList& rAttribs );
- /** Appends and returns a new differential cell format object. */
- DxfRef importDxf( const AttributeList& rAttribs );
/** Appends and returns a new named cell style object. */
CellStyleRef importCellStyle( const AttributeList& rAttribs );
/** Appends a new color to the color palette. */
void importPaletteColor( RecordInputStream& rStrm );
- /** Imports the FONT record from the passed stream. */
- void importFont( RecordInputStream& rStrm );
/** Imports the NUMFMT record from the passed stream. */
void importNumFmt( RecordInputStream& rStrm );
- /** Imports the BORDER record from the passed stream. */
- void importBorder( RecordInputStream& rStrm );
- /** Imports the FILL record from the passed stream. */
- void importFill( RecordInputStream& rStrm );
- /** Imports a cell format or cell style object from the passed stream. */
- void importXf( sal_Int32 nContext, RecordInputStream& rStrm );
- /** Imports a new differential cell format object from the passed stream. */
- void importDxf( RecordInputStream& rStrm );
/** Imports the CELLSTYLE record from the passed stream. */
void importCellStyle( RecordInputStream& rStrm );
@@ -831,8 +959,8 @@ public:
FontRef getFontFromCellXf( sal_Int32 nXfId ) const;
/** Returns the default application font (used in the "Normal" cell style). */
FontRef getDefaultFont() const;
- /** Returns the default application font data (used in the "Normal" cell style). */
- const OoxFontData& getDefaultFontData() const;
+ /** Returns the model of the default application font (used in the "Normal" cell style). */
+ const FontModel& getDefaultFontModel() const;
/** Creates the style sheet described by the style XF with the passed identifier. */
const ::rtl::OUString& createCellStyle( sal_Int32 nXfId ) const;
@@ -844,14 +972,19 @@ public:
const ::rtl::OUString& getDefaultStyleName() const;
#endif
- /** Writes the font attributes of the specified font data to the passed property set. */
- void writeFontToPropertySet( PropertySet& rPropSet, sal_Int32 nFontId ) const;
- /** Writes the specified number format to the passed property set. */
- void writeNumFmtToPropertySet( PropertySet& rPropSet, sal_Int32 nNumFmtId ) const;
- /** Writes the border attributes of the specified border data to the passed property set. */
- void writeBorderToPropertySet( PropertySet& rPropSet, sal_Int32 nBorderId ) const;
- /** Writes the fill attributes of the specified fill data to the passed property set. */
- void writeFillToPropertySet( PropertySet& rPropSet, sal_Int32 nFillId ) const;
+ /** Writes the font attributes of the specified font data to the passed property map. */
+ void writeFontToPropertyMap( PropertyMap& rPropMap, sal_Int32 nFontId ) const;
+ /** Writes the specified number format to the passed property map. */
+ void writeNumFmtToPropertyMap( PropertyMap& rPropMap, sal_Int32 nNumFmtId ) const;
+ /** Writes the border attributes of the specified border data to the passed property map. */
+ void writeBorderToPropertyMap( PropertyMap& rPropMap, sal_Int32 nBorderId ) const;
+ /** Writes the fill attributes of the specified fill data to the passed property map. */
+ void writeFillToPropertyMap( PropertyMap& rPropMap, sal_Int32 nFillId ) const;
+ /** Writes the cell formatting attributes of the specified XF to the passed property map. */
+ void writeCellXfToPropertyMap( PropertyMap& rPropMap, sal_Int32 nXfId ) const;
+ /** Writes the cell formatting attributes of the specified style XF to the passed property map. */
+ void writeStyleXfToPropertyMap( PropertyMap& rPropMap, sal_Int32 nXfId ) const;
+
/** Writes the cell formatting attributes of the specified XF to the passed property set. */
void writeCellXfToPropertySet( PropertySet& rPropSet, sal_Int32 nXfId ) const;
/** Writes the cell formatting attributes of the specified style XF to the passed property set. */
diff --git a/oox/inc/oox/xls/stylesfragment.hxx b/oox/inc/oox/xls/stylesfragment.hxx
index e0eada56e3c8..a66ccf86017c 100644
--- a/oox/inc/oox/xls/stylesfragment.hxx
+++ b/oox/inc/oox/xls/stylesfragment.hxx
@@ -39,6 +39,102 @@ namespace xls {
// ============================================================================
+class OoxIndexedColorsContext : public OoxWorkbookContextBase
+{
+public:
+ explicit OoxIndexedColorsContext( OoxWorkbookFragmentBase& rFragment );
+
+protected:
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+};
+
+// ============================================================================
+
+class OoxFontContext : public OoxWorkbookContextBase
+{
+public:
+ template< typename ParentType >
+ inline explicit OoxFontContext( ParentType& rParent, const FontRef& rxFont ) :
+ OoxWorkbookContextBase( rParent ), mxFont( rxFont ) {}
+
+protected:
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ FontRef mxFont;
+};
+
+// ============================================================================
+
+class OoxBorderContext : public OoxWorkbookContextBase
+{
+public:
+ template< typename ParentType >
+ inline explicit OoxBorderContext( ParentType& rParent, const BorderRef& rxBorder ) :
+ OoxWorkbookContextBase( rParent ), mxBorder( rxBorder ) {}
+
+protected:
+ virtual void onStartElement( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ BorderRef mxBorder;
+};
+
+// ============================================================================
+
+class OoxFillContext : public OoxWorkbookContextBase
+{
+public:
+ template< typename ParentType >
+ inline explicit OoxFillContext( ParentType& rParent, const FillRef& rxFill ) :
+ OoxWorkbookContextBase( rParent ), mxFill( rxFill ), mfGradPos( -1.0 ) {}
+
+protected:
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ FillRef mxFill;
+ double mfGradPos; /// Gradient color position.
+};
+
+// ============================================================================
+
+class OoxXfContext : public OoxWorkbookContextBase
+{
+public:
+ template< typename ParentType >
+ inline explicit OoxXfContext( ParentType& rParent, const XfRef& rxXf, bool bCellXf ) :
+ OoxWorkbookContextBase( rParent ), mxXf( rxXf ), mbCellXf( bCellXf ) {}
+
+protected:
+ virtual void onStartElement( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ XfRef mxXf;
+ bool mbCellXf; /// True = cell XF, false = style XF.
+};
+
+// ============================================================================
+
+class OoxDxfContext : public OoxWorkbookContextBase
+{
+public:
+ template< typename ParentType >
+ inline explicit OoxDxfContext( ParentType& rParent, const DxfRef& rxDxf ) :
+ OoxWorkbookContextBase( rParent ), mxDxf( rxDxf ) {}
+
+protected:
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+private:
+ DxfRef mxDxf;
+};
+
+// ============================================================================
+
class OoxStylesFragment : public OoxWorkbookFragmentBase
{
public:
@@ -49,25 +145,13 @@ public:
protected:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onStartElement( const AttributeList& rAttribs );
- virtual void onEndElement( const ::rtl::OUString& rChars );
-
- virtual ContextWrapper onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
// oox.core.FragmentHandler2 interface ------------------------------------
virtual const ::oox::core::RecordInfo* getRecordInfos() const;
virtual void finalizeImport();
-
-private:
- FontRef mxFont; /// Current font object.
- BorderRef mxBorder; /// Current cell border object.
- FillRef mxFill; /// Current cell area fill object.
- XfRef mxXf; /// Current cell format/style object.
- DxfRef mxDxf; /// Current differential format object.
- double mfGradPos; /// Gradient color position.
};
// ============================================================================
diff --git a/oox/inc/oox/xls/stylespropertyhelper.hxx b/oox/inc/oox/xls/stylespropertyhelper.hxx
deleted file mode 100644
index ed94d089448b..000000000000
--- a/oox/inc/oox/xls/stylespropertyhelper.hxx
+++ /dev/null
@@ -1,272 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: stylespropertyhelper.hxx,v $
- * $Revision: 1.3.22.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef OOX_XLS_STYLESPROPERTYHELPER_HXX
-#define OOX_XLS_STYLESPROPERTYHELPER_HXX
-
-#include <com/sun/star/awt/FontDescriptor.hpp>
-#include <com/sun/star/util/CellProtection.hpp>
-#include <com/sun/star/table/CellHoriJustify.hpp>
-#include <com/sun/star/table/CellVertJustify.hpp>
-#include <com/sun/star/table/CellOrientation.hpp>
-#include <com/sun/star/table/TableBorder.hpp>
-#include "oox/helper/propertysequence.hxx"
-#include "oox/xls/workbookhelper.hxx"
-
-namespace oox {
-namespace xls {
-
-// ============================================================================
-
-const sal_Int32 API_RGB_TRANSPARENT = -1; /// Transparent color for API calls.
-const sal_Int32 API_RGB_BLACK = 0; /// Black color for API calls.
-
-const sal_Int16 API_LINE_NONE = 0;
-const sal_Int16 API_LINE_HAIR = 2;
-const sal_Int16 API_LINE_THIN = 35;
-const sal_Int16 API_LINE_MEDIUM = 88;
-const sal_Int16 API_LINE_THICK = 141;
-
-const sal_Int16 API_ESCAPE_NONE = 0; /// No escapement.
-const sal_Int16 API_ESCAPE_SUPERSCRIPT = 101; /// Superscript: raise characters automatically (magic value 101).
-const sal_Int16 API_ESCAPE_SUBSCRIPT = -101; /// Subscript: lower characters automatically (magic value -101).
-
-const sal_Int8 API_ESCAPEHEIGHT_NONE = 100; /// Relative character height if not escaped.
-const sal_Int8 API_ESCAPEHEIGHT_DEFAULT = 58; /// Relative character height if escaped.
-
-// ============================================================================
-
-/** Contains used flags for all API font attributes. */
-struct ApiFontUsedFlags
-{
- bool mbNameUsed; /// True = font name/family/char set are used.
- bool mbColorUsed; /// True = font color is used.
- bool mbSchemeUsed; /// True = font scheme is used.
- bool mbHeightUsed; /// True = font height is used.
- bool mbUnderlineUsed; /// True = underline style is used.
- bool mbEscapementUsed; /// True = escapement style is used.
- bool mbWeightUsed; /// True = font weight (boldness) is used.
- bool mbPostureUsed; /// True = font posture (italic) is used.
- bool mbStrikeoutUsed; /// True = strike out style is used.
- bool mbOutlineUsed; /// True = outline style is used.
- bool mbShadowUsed; /// True = shadow style is used.
-
- explicit ApiFontUsedFlags( bool bAllUsed );
-};
-
-// ----------------------------------------------------------------------------
-
-/** Contains API font name, family, and charset for a script type. */
-struct ApiScriptFontName
-{
- ::rtl::OUString maName; /// Font name.
- sal_Int16 mnFamily; /// Font family.
- sal_Int16 mnCharSet; /// Font character set.
-
- explicit ApiScriptFontName();
-};
-
-// ----------------------------------------------------------------------------
-
-/** Contains all API font attributes. */
-struct ApiFontData
-{
- typedef ::com::sun::star::awt::FontDescriptor ApiFontDescriptor;
-
- ApiScriptFontName maLatinFont; /// Font name for latin scripts.
- ApiScriptFontName maAsianFont; /// Font name for east-asian scripts.
- ApiScriptFontName maCmplxFont; /// Font name for complex scripts.
- ApiFontDescriptor maDesc; /// Font descriptor (height in twips, weight in %).
- sal_Int32 mnColor; /// Font color.
- sal_Int16 mnEscapement; /// Escapement style.
- sal_Int8 mnEscapeHeight; /// Escapement font height.
- bool mbOutline; /// True = outlined characters.
- bool mbShadow; /// True = shadowed chgaracters.
-
- explicit ApiFontData();
-};
-
-// ============================================================================
-
-/** Contains all API number format attributes. */
-struct ApiNumFmtData
-{
- sal_Int32 mnIndex; /// API number format index.
-
- explicit ApiNumFmtData();
-};
-
-// ============================================================================
-
-/** Contains all API cell alignment attributes. */
-struct ApiAlignmentData
-{
- typedef ::com::sun::star::table::CellHoriJustify ApiCellHoriJustify;
- typedef ::com::sun::star::table::CellVertJustify ApiCellVertJustify;
- typedef ::com::sun::star::table::CellOrientation ApiCellOrientation;
-
- ApiCellHoriJustify meHorJustify; /// Horizontal alignment.
- ApiCellVertJustify meVerJustify; /// Vertical alignment.
- ApiCellOrientation meOrientation; /// Normal or stacked text.
- sal_Int32 mnRotation; /// Text rotation angle.
- sal_Int16 mnWritingMode; /// CTL text direction.
- sal_Int16 mnIndent; /// Indentation.
- bool mbWrapText; /// True = multi-line text.
- bool mbShrink; /// True = shrink to fit cell size.
-
- explicit ApiAlignmentData();
-};
-
-bool operator==( const ApiAlignmentData& rLeft, const ApiAlignmentData& rRight );
-
-// ============================================================================
-
-/** Contains all API cell protection attributes. */
-struct ApiProtectionData
-{
- typedef ::com::sun::star::util::CellProtection ApiCellProtection;
-
- ApiCellProtection maCellProt;
-
- explicit ApiProtectionData();
-};
-
-bool operator==( const ApiProtectionData& rLeft, const ApiProtectionData& rRight );
-
-// ============================================================================
-
-/** Contains API attributes of a complete cell border. */
-struct ApiBorderData
-{
- typedef ::com::sun::star::table::TableBorder ApiTableBorder;
- typedef ::com::sun::star::table::BorderLine ApiBorderLine;
-
- ApiTableBorder maBorder; /// Left/right/top/bottom line format.
- ApiBorderLine maTLtoBR; /// Diagonal top-left to bottom-right line format.
- ApiBorderLine maBLtoTR; /// Diagonal bottom-left to top-right line format.
- bool mbBorderUsed; /// True = left/right/top/bottom line format used.
- bool mbDiagUsed; /// True = diagonal line format used.
-
- explicit ApiBorderData();
-};
-
-// ============================================================================
-
-/** Contains API fill attributes. */
-struct ApiSolidFillData
-{
- sal_Int32 mnColor; /// Fill color.
- bool mbTransparent; /// True = transparent area.
- bool mbUsed; /// True = fill data is valid.
-
- explicit ApiSolidFillData();
-};
-
-// ============================================================================
-
-/** Enumerates different types of API font property sets. */
-enum FontPropertyType
-{
- FONT_PROPTYPE_CELL, /// Font properties in a spreadsheet cell.
- FONT_PROPTYPE_RICHTEXT /// Font properties in a rich text cell or header/footer.
-};
-
-// ============================================================================
-
-/** Helper for all styles related properties.
-
- This helper contains helper functions to write different cell formatting
- attributes to property sets.
- */
-class StylesPropertyHelper : public WorkbookHelper
-{
-public:
- explicit StylesPropertyHelper( const WorkbookHelper& rHelper );
-
- /** Writes font properties to the passed property set. */
- void writeFontProperties(
- PropertySet& rPropSet,
- const ApiFontData& rFontData,
- const ApiFontUsedFlags& rUsedFlags,
- FontPropertyType ePropType );
-
- /** Writes number format properties to the passed property set. */
- void writeNumFmtProperties(
- PropertySet& rPropSet,
- const ApiNumFmtData& rNumFmtData );
-
- /** Writes cell alignment properties to the passed property set. */
- void writeAlignmentProperties(
- PropertySet& rPropSet,
- const ApiAlignmentData& rAlignData );
-
- /** Writes cell propection properties to the passed property set. */
- void writeProtectionProperties(
- PropertySet& rPropSet,
- const ApiProtectionData& rProtData );
-
- /** Writes cell border properties to the passed property set. */
- void writeBorderProperties(
- PropertySet& rPropSet,
- const ApiBorderData& rBorderData );
-
- /** Writes cell fill properties to the passed property set. */
- void writeSolidFillProperties(
- PropertySet& rPropSet,
- const ApiSolidFillData& rFillData );
-
-private:
- PropertySequence maLatinFontNameProps;
- PropertySequence maAsianFontNameProps;
- PropertySequence maCmplxFontNameProps;
- PropertySequence maFontHeightProps;
- PropertySequence maFontWeightProps;
- PropertySequence maFontPostureProps;
- PropertySequence maFontEscapeProps;
- PropertySequence maAlignProps;
- PropertySequence maDiagBorderProps;
- PropertySequence maSolidFillProps;
- const ::rtl::OUString maCharColorProp;
- const ::rtl::OUString maCharUnderlineProp;
- const ::rtl::OUString maCharStrikeoutProp;
- const ::rtl::OUString maCharContouredProp;
- const ::rtl::OUString maCharShadowedProp;
- const ::rtl::OUString maNumFmtProp;
- const ::rtl::OUString maCellProtProp;
- const ::rtl::OUString maBorderProp;
-};
-
-// ============================================================================
-
-} // namespace xls
-} // namespace oox
-
-#endif
-
diff --git a/oox/inc/oox/xls/tablebuffer.hxx b/oox/inc/oox/xls/tablebuffer.hxx
index 8fbca280c46f..6844a39f2fb6 100644
--- a/oox/inc/oox/xls/tablebuffer.hxx
+++ b/oox/inc/oox/xls/tablebuffer.hxx
@@ -40,10 +40,10 @@ namespace xls {
// ============================================================================
-struct OoxTableData
+struct TableModel
{
::com::sun::star::table::CellRangeAddress
- maRange; /// Range of the table in the worksheet.
+ maRange; /// Original (unchecked) range of the table.
::rtl::OUString maProgName; /// Programmatical name.
::rtl::OUString maDisplayName; /// Display name.
sal_Int32 mnId; /// Unique table identifier.
@@ -51,7 +51,7 @@ struct OoxTableData
sal_Int32 mnHeaderRows; /// Number of header rows.
sal_Int32 mnTotalsRows; /// Number of totals rows.
- explicit OoxTableData();
+ explicit TableModel();
};
// ----------------------------------------------------------------------------
@@ -70,23 +70,29 @@ public:
void finalizeImport();
/** Returns the table identifier. */
- inline sal_Int32 getTableId() const { return maOoxData.mnId; }
+ inline sal_Int32 getTableId() const { return maModel.mnId; }
/** Returns the token index used in API token arrays (com.sun.star.sheet.FormulaToken). */
inline sal_Int32 getTokenIndex() const { return mnTokenIndex; }
+ /** Returns the display name of the table. */
+ inline const ::rtl::OUString& getDisplayName() const { return maModel.maDisplayName; }
+ /** Returns the original (unchecked) total range of the table. */
+ inline const ::com::sun::star::table::CellRangeAddress& getOriginalRange() const { return maModel.maRange; }
/** Returns the cell range of this table. */
- inline const ::com::sun::star::table::CellRangeAddress& getRange() const { return maOoxData.maRange; }
+ inline const ::com::sun::star::table::CellRangeAddress& getRange() const { return maDestRange; }
/** Returns the number of columns of this table. */
- inline sal_Int32 getWidth() const { return maOoxData.maRange.EndColumn - maOoxData.maRange.StartColumn + 1; }
+ inline sal_Int32 getWidth() const { return maDestRange.EndColumn - maDestRange.StartColumn + 1; }
/** Returns the number of rows of this table. */
- inline sal_Int32 getHeight() const { return maOoxData.maRange.EndRow - maOoxData.maRange.StartRow + 1; }
+ inline sal_Int32 getHeight() const { return maDestRange.EndRow - maDestRange.StartRow + 1; }
/** Returns the number of header rows in the table range. */
- inline sal_Int32 getHeaderRows() const { return maOoxData.mnHeaderRows; }
+ inline sal_Int32 getHeaderRows() const { return maModel.mnHeaderRows; }
/** Returns the number of totals rows in the table range. */
- inline sal_Int32 getTotalsRows() const { return maOoxData.mnTotalsRows; }
+ inline sal_Int32 getTotalsRows() const { return maModel.mnTotalsRows; }
private:
- OoxTableData maOoxData;
+ TableModel maModel;
+ ::com::sun::star::table::CellRangeAddress
+ maDestRange; /// Validated range of the table in the worksheet.
sal_Int32 mnTokenIndex; /// Token index used in API token array.
};
@@ -109,13 +115,18 @@ public:
/** Returns a table by its identifier. */
TableRef getTable( sal_Int32 nTableId ) const;
+ /** Returns a table by its display name. */
+ TableRef getTable( const ::rtl::OUString& rDispName ) const;
private:
void insertTable( TableRef xTable );
private:
- typedef RefMap< sal_Int32, Table > TableMap;
- TableMap maTables;
+ typedef RefMap< sal_Int32, Table > TableIdMap;
+ typedef RefMap< ::rtl::OUString, Table > TableNameMap;
+
+ TableIdMap maIdTables;
+ TableNameMap maNameTables;
};
// ============================================================================
diff --git a/oox/inc/oox/xls/tablefragment.hxx b/oox/inc/oox/xls/tablefragment.hxx
index 88a53f5bd2e4..e74843e52dbf 100644
--- a/oox/inc/oox/xls/tablefragment.hxx
+++ b/oox/inc/oox/xls/tablefragment.hxx
@@ -49,11 +49,8 @@ public:
protected:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onStartElement( const AttributeList& rAttribs );
-
- virtual ContextWrapper onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
// oox.core.FragmentHandler2 interface ------------------------------------
diff --git a/oox/inc/oox/xls/themebuffer.hxx b/oox/inc/oox/xls/themebuffer.hxx
index 51b42bc465c6..ca0a80d983fe 100644
--- a/oox/inc/oox/xls/themebuffer.hxx
+++ b/oox/inc/oox/xls/themebuffer.hxx
@@ -37,7 +37,7 @@
namespace oox {
namespace xls {
-struct OoxFontData;
+struct FontModel;
// ============================================================================
@@ -53,11 +53,11 @@ public:
sal_Int32 getColorByIndex( sal_Int32 nIndex ) const;
/** Returns the default font data for the current file type. */
- inline const OoxFontData& getDefaultFontData() const { return *mxDefFontData; }
+ inline const FontModel& getDefaultFontModel() const { return *mxDefFontModel; }
private:
- typedef ::std::auto_ptr< OoxFontData > OoxFontDataPtr;
- OoxFontDataPtr mxDefFontData;
+ typedef ::std::auto_ptr< FontModel > FontModelPtr;
+ FontModelPtr mxDefFontModel;
};
// ============================================================================
diff --git a/oox/inc/oox/xls/unitconverter.hxx b/oox/inc/oox/xls/unitconverter.hxx
index 42c996c1335a..32b89b0b4218 100644
--- a/oox/inc/oox/xls/unitconverter.hxx
+++ b/oox/inc/oox/xls/unitconverter.hxx
@@ -35,6 +35,10 @@
#include <map>
#include "oox/xls/workbookhelper.hxx"
+namespace com { namespace sun { namespace star {
+ namespace util { struct Date; struct DateTime; }
+} } }
+
namespace oox {
namespace xls {
@@ -74,6 +78,8 @@ public:
/** Final processing after import of all style settings. */
void finalizeImport();
+ /** Updates internal nulldate for date/serial conversion. */
+ void finalizeNullDate( const ::com::sun::star::util::Date& rNullDate );
/** Converts the passed value between the passed units. */
double scaleValue( double fValue, Unit eFromUnit, Unit eToUnit ) const;
@@ -83,19 +89,31 @@ public:
/** Converts the passed value from 1/100 millimeters to the passed unit. */
double scaleFromMm100( sal_Int32 nMm100, Unit eUnit ) const;
+ /** Returns the serial value of the passed datetime, based on current nulldate. */
+ double calcSerialFromDateTime( const ::com::sun::star::util::DateTime& rDateTime ) const;
+ /** Returns the datetime of the passed serial value, based on current nulldate. */
+ ::com::sun::star::util::DateTime calcDateTimeFromSerial( double fSerial ) const;
+
+ /** Returns an error string from the passed BIFF error code. */
+ ::rtl::OUString calcOoxErrorCode( sal_uInt8 nErrorCode ) const;
/** Returns a BIFF error code from the passed error string. */
sal_uInt8 calcBiffErrorCode( const ::rtl::OUString& rErrorCode ) const;
private:
+ /** Adds an error code to the internal maps. */
+ void addErrorCode( sal_uInt8 nErrorCode, const ::rtl::OUString& rErrorCode );
/** Returns the conversion coefficient for the passed unit. */
double getCoefficient( Unit eUnit ) const;
private:
typedef ::std::vector< double > DoubleVector;
- typedef ::std::map< ::rtl::OUString, sal_uInt8 > ErrorCodeMap;
+ typedef ::std::map< ::rtl::OUString, sal_uInt8 > OoxErrorCodeMap;
+ typedef ::std::map< sal_uInt8, ::rtl::OUString > BiffErrorCodeMap;
DoubleVector maCoeffs; /// Coefficients for unit conversion.
- ErrorCodeMap maErrorCodes; /// Maps error code strings to BIFF error constants.
+ OoxErrorCodeMap maOoxErrCodes; /// Maps error code strings to BIFF error constants.
+ BiffErrorCodeMap maBiffErrCodes; /// Maps BIFF error constants to error code strings.
+ sal_Int32 mnNullDate; /// Nulldate of this workbook (number of days since 0000-01-01).
};
// ============================================================================
diff --git a/oox/inc/oox/xls/viewsettings.hxx b/oox/inc/oox/xls/viewsettings.hxx
index 68bb25e31f80..fceb1bc1a63c 100644
--- a/oox/inc/oox/xls/viewsettings.hxx
+++ b/oox/inc/oox/xls/viewsettings.hxx
@@ -44,23 +44,23 @@ namespace xls {
// ============================================================================
/** Contains all settings for a selection in a single pane of a sheet. */
-struct OoxSheetSelectionData
+struct PaneSelectionModel
{
::com::sun::star::table::CellAddress maActiveCell; /// Position of active cell (cursor).
ApiCellRangeList maSelection; /// Selected cell ranges.
sal_Int32 mnActiveCellId; /// Index of active cell in selection list.
- explicit OoxSheetSelectionData();
+ explicit PaneSelectionModel();
};
// ----------------------------------------------------------------------------
/** Contains all view settings for a single sheet. */
-struct OoxSheetViewData
+struct SheetViewModel
{
- typedef RefMap< sal_Int32, OoxSheetSelectionData > OoxSelectionDataMap;
+ typedef RefMap< sal_Int32, PaneSelectionModel > PaneSelectionModelMap;
- OoxSelectionDataMap maSelMap; /// Selections of all panes.
+ PaneSelectionModelMap maPaneSelMap; /// Selections of all panes.
Color maGridColor; /// Grid color.
::com::sun::star::table::CellAddress maFirstPos; /// First visible cell.
::com::sun::star::table::CellAddress maSecondPos; /// First visible cell in additional panes.
@@ -84,7 +84,7 @@ struct OoxSheetViewData
bool mbShowOutline; /// True = show outlines.
bool mbZoomToFit; /// True = zoom chart sheet to fit window.
- explicit OoxSheetViewData();
+ explicit SheetViewModel();
/** Returns true, if page break preview is active. */
bool isPageBreakPreview() const;
@@ -94,14 +94,14 @@ struct OoxSheetViewData
sal_Int32 getPageBreakZoom() const;
/** Returns the selection data, if available, otherwise 0. */
- const OoxSheetSelectionData* getSelectionData( sal_Int32 nPaneId ) const;
+ const PaneSelectionModel* getPaneSelection( sal_Int32 nPaneId ) const;
/** Returns the selection data of the active pane. */
- const OoxSheetSelectionData* getActiveSelectionData() const;
+ const PaneSelectionModel* getActiveSelection() const;
/** Returns read/write access to the selection data of the specified pane. */
- OoxSheetSelectionData& createSelectionData( sal_Int32 nPaneId );
+ PaneSelectionModel& createPaneSelection( sal_Int32 nPaneId );
};
-typedef ::boost::shared_ptr< OoxSheetViewData > OoxSheetViewDataRef;
+typedef ::boost::shared_ptr< SheetViewModel > SheetViewModelRef;
// ----------------------------------------------------------------------------
@@ -141,17 +141,17 @@ public:
void finalizeImport();
private:
- OoxSheetViewDataRef createSheetViewData();
+ SheetViewModelRef createSheetView();
private:
- typedef RefVector< OoxSheetViewData > SheetViewDataVec;
- SheetViewDataVec maSheetDatas;
+ typedef RefVector< SheetViewModel > SheetViewModelVec;
+ SheetViewModelVec maSheetViews;
};
// ============================================================================
/** Contains all view settings for the entire document. */
-struct OoxWorkbookViewData
+struct WorkbookViewModel
{
sal_Int32 mnWinX; /// X position of the workbook window (twips).
sal_Int32 mnWinY; /// Y position of the workbook window (twips).
@@ -166,10 +166,10 @@ struct OoxWorkbookViewData
bool mbShowVerScroll; /// True = show vertical sheet scrollbars.
bool mbMinimized; /// True = workbook window is minimized.
- explicit OoxWorkbookViewData();
+ explicit WorkbookViewModel();
};
-typedef ::boost::shared_ptr< OoxWorkbookViewData > OoxWorkbookViewDataRef;
+typedef ::boost::shared_ptr< WorkbookViewModel > WorkbookViewModelRef;
// ----------------------------------------------------------------------------
@@ -187,7 +187,7 @@ public:
/** Stores converted view settings for a specific worksheet. */
void setSheetViewSettings( sal_Int32 nSheet,
- const OoxSheetViewDataRef& rxViewData,
+ const SheetViewModelRef& rxSheetView,
const ::com::sun::star::uno::Any& rProperties );
/** Converts all imported document view settings. */
@@ -197,15 +197,15 @@ public:
sal_Int32 getActiveSheetIndex() const;
private:
- OoxWorkbookViewData& createWorkbookViewData();
+ WorkbookViewModel& createWorkbookView();
private:
- typedef RefVector< OoxWorkbookViewData > WorkbookViewDataVec;
- typedef RefMap< sal_Int32, OoxSheetViewData > SheetViewDataMap;
+ typedef RefVector< WorkbookViewModel > WorkbookViewModelVec;
+ typedef RefMap< sal_Int32, SheetViewModel > SheetViewModelMap;
typedef ::std::map< sal_Int32, ::com::sun::star::uno::Any > SheetPropertiesMap;
- WorkbookViewDataVec maBookDatas; /// Workbook view datas.
- SheetViewDataMap maSheetDatas; /// Active view data for each sheet.
+ WorkbookViewModelVec maBookViews; /// Workbook view models.
+ SheetViewModelMap maSheetViews; /// Active view model for each sheet.
SheetPropertiesMap maSheetProps; /// Converted property sequences for each sheet.
};
diff --git a/oox/inc/oox/xls/workbookfragment.hxx b/oox/inc/oox/xls/workbookfragment.hxx
index 2ca6291c341f..a691fcf5cf57 100644
--- a/oox/inc/oox/xls/workbookfragment.hxx
+++ b/oox/inc/oox/xls/workbookfragment.hxx
@@ -51,12 +51,10 @@ public:
protected:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onStartElement( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
- virtual ContextWrapper onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
// oox.core.FragmentHandler2 interface ------------------------------------
@@ -69,8 +67,10 @@ private:
void importPivotCache( const AttributeList& rAttribs );
void importExternalRef( RecordInputStream& rStrm );
+ void importPivotCache( RecordInputStream& rStrm );
void importExternalLinkFragment( ExternalLink& rExtLink );
+ void importPivotCacheDefFragment( const ::rtl::OUString& rRelId, sal_Int32 nCacheId );
private:
DefinedNameRef mxCurrName;
@@ -81,7 +81,7 @@ private:
class BiffWorkbookFragment : public BiffWorkbookFragmentBase
{
public:
- explicit BiffWorkbookFragment( const WorkbookHelper& rHelper, BiffInputStream& rStrm );
+ explicit BiffWorkbookFragment( const WorkbookHelper& rHelper, const ::rtl::OUString& rStrmName );
/** Imports the entire workbook stream, including all contained worksheets. */
virtual bool importFragment();
@@ -95,9 +95,6 @@ private:
bool importSheetFragment(
ISegmentProgressBar& rProgressBar,
BiffFragmentType eFragment, sal_Int32 nSheet );
-
- /** Imports the FILEPASS record and sets a decoder at the passed stream. */
- bool importFilePass();
};
// ============================================================================
diff --git a/oox/inc/oox/xls/workbookhelper.hxx b/oox/inc/oox/xls/workbookhelper.hxx
index e9f5ed99d256..9f278a670271 100644
--- a/oox/inc/oox/xls/workbookhelper.hxx
+++ b/oox/inc/oox/xls/workbookhelper.hxx
@@ -32,6 +32,7 @@
#define OOX_XLS_WORKBOOKHELPER_HXX
#include <boost/shared_ptr.hpp>
+#include <osl/time.h>
#include <rtl/ref.hxx>
#include <com/sun/star/uno/Reference.hxx>
#include "oox/xls/biffhelper.hxx"
@@ -40,6 +41,10 @@ namespace com { namespace sun { namespace star {
namespace container { class XNameAccess; }
namespace container { class XNameContainer; }
namespace awt { class XDevice; }
+ namespace table { struct CellAddress; }
+ namespace table { struct CellRangeAddress; }
+ namespace table { class XCell; }
+ namespace table { class XCellRange; }
namespace sheet { class XSpreadsheetDocument; }
namespace sheet { class XSpreadsheet; }
namespace sheet { class XNamedRanges; }
@@ -69,32 +74,98 @@ namespace oox { namespace drawingml {
namespace oox {
namespace xls {
-// ============================================================================
+// DEBUG ======================================================================
-/** An enumeration for all supported spreadsheet filter types. */
-enum FilterType
+// Set this define to 1 to show the load/save time of a document in an assertion (nonpro only).
+#define OOX_SHOW_LOADSAVE_TIME 0
+
+// ----------------------------------------------------------------------------
+
+#define OOX_LOADSAVE_TIMER( eTimerType ) (void)0
+
+#if OSL_DEBUG_LEVEL > 0
+namespace dbg {
+
+// ----------------------------------------------------------------------------
+
+#if OOX_SHOW_LOADSAVE_TIME > 0
+
+enum TimerType
{
- FILTER_OOX, /// MS Excel OOXML (Office Open XML) or OOBIN.
- FILTER_BIFF, /// MS Excel BIFF (Binary Interchange File Format).
- FILTER_UNKNOWN /// Unknown filter type.
+ TIMER_IMPORTFORMULA,
+ TIMER_IMPORTSHEETFRAGMENT,
+ TIMER_ONCREATESHEETCONTEXT,
+ TIMER_IMPORTROW,
+ TIMER_CONVERTROWFORMAT,
+ TIMER_CONVERTCOLUMNFORMAT,
+ TIMER_IMPORTCELL,
+ TIMER_ONENDSHEETELEMENT,
+ TIMER_SETCELL,
+ TIMER_SETCELLFORMAT,
+ TIMER_MERGECELLFORMAT,
+ TIMER_WRITECELLPROPERTIES,
+ TIMER_FINALIZESHEETDATA,
+ TIMER_FINALIZEDRAWING,
+ TIMER_FINALIZEBOOKDATA,
+
+ // TIMER_TOTAL must be the last entry!
+ TIMER_TOTAL
};
-// ============================================================================
+// ----------------------------------------------------------------------------
-#if OSL_DEBUG_LEVEL > 0
+struct TimeCount;
-class WorkbookHelperDebug
+class Timer
{
public:
- inline explicit WorkbookHelperDebug( sal_Int32& rnCount ) : mrnCount( rnCount ) { ++mrnCount; }
- inline explicit WorkbookHelperDebug( const WorkbookHelperDebug& rCopy ) : mrnCount( rCopy.mrnCount ) { ++mrnCount; }
- virtual ~WorkbookHelperDebug() { --mrnCount; }
+ explicit Timer( TimeCount& rTimeCount );
+ ~Timer();
private:
- sal_Int32& mrnCount;
+ TimeCount& mrTimeCount;
+ TimeValue maStartTime;
};
+// ----------------------------------------------------------------------------
+
+#undef OOX_LOADSAVE_TIMER
+#define OOX_LOADSAVE_TIMER( TimerType ) ::oox::xls::dbg::Timer aDbgTimer##TimerType( getTimeCount( ::oox::xls::dbg::TIMER_##TimerType ) )
+
#endif
+// ----------------------------------------------------------------------------
+
+struct WorkbookData;
+
+class WorkbookHelper
+{
+protected:
+ explicit WorkbookHelper( WorkbookData& rBookData );
+ explicit WorkbookHelper( const WorkbookHelper& rCopy );
+ virtual ~WorkbookHelper();
+#if OOX_SHOW_LOADSAVE_TIME > 0
+public:
+ TimeCount& getTimeCount( TimerType eType ) const;
+#endif
+private:
+ WorkbookData& mrDbgBookData;
+};
+
+// ----------------------------------------------------------------------------
+
+} // namespace dbg
+#endif
+
+// ============================================================================
+
+/** An enumeration for all supported spreadsheet filter types. */
+enum FilterType
+{
+ FILTER_OOX, /// MS Excel OOXML (Office Open XML) or OOBIN.
+ FILTER_BIFF, /// MS Excel BIFF (Binary Interchange File Format).
+ FILTER_UNKNOWN /// Unknown filter type.
+};
+
// ============================================================================
class WorkbookData;
@@ -108,13 +179,14 @@ class ExternalLinkBuffer;
class DefinedNamesBuffer;
class TableBuffer;
class WebQueryBuffer;
+class PivotCacheBuffer;
class PivotTableBuffer;
class FormulaParser;
class UnitConverter;
class AddressConverter;
class ExcelChartConverter;
-class StylesPropertyHelper;
-class PageSettingsPropertyHelper;
+class PageSettingsConverter;
+class BiffCodecHelper;
/** Helper class to provice access to global workbook data.
@@ -125,7 +197,7 @@ class PageSettingsPropertyHelper;
*/
class WorkbookHelper
#if OSL_DEBUG_LEVEL > 0
- : private WorkbookHelperDebug
+ : public dbg::WorkbookHelper
#endif
{
public:
@@ -155,9 +227,6 @@ public:
/** Returns a reference to the source/target spreadsheet document model. */
::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheetDocument >
getDocument() const;
- /** Returns a reference to the specified spreadsheet in the document model. */
- ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >
- getSheet( sal_Int32 nSheet ) const;
/** Returns the reference device of the document. */
::com::sun::star::uno::Reference< ::com::sun::star::awt::XDevice >
getReferenceDevice() const;
@@ -174,6 +243,18 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
getDdeLinks() const;
+ /** Returns a reference to the specified spreadsheet in the document model. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >
+ getSheetFromDoc( sal_Int32 nSheet ) const;
+ /** Returns the XCell interface for the passed cell address. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >
+ getCellFromDoc(
+ const ::com::sun::star::table::CellAddress& rAddress ) const;
+ /** Returns the XCellRange interface for the passed cell range address. */
+ ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange >
+ getCellRangeFromDoc(
+ const ::com::sun::star::table::CellRangeAddress& rRange ) const;
+
/** Returns the cell or page styles container from the Calc document. */
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
getStyleFamily( bool bPageStyles ) const;
@@ -219,7 +300,9 @@ public:
TableBuffer& getTables() const;
/** Returns the web queries. */
WebQueryBuffer& getWebQueries() const;
- /** Returns the pivot tables. */
+ /** Returns the collection of pivot caches. */
+ PivotCacheBuffer& getPivotCaches() const;
+ /** Returns the collection of pivot tables. */
PivotTableBuffer& getPivotTables() const;
// converters -------------------------------------------------------------
@@ -232,13 +315,8 @@ public:
AddressConverter& getAddressConverter() const;
/** Returns the chart object converter. */
ExcelChartConverter& getChartConverter() const;
-
- // property helpers -------------------------------------------------------
-
- /** Returns the converter for properties related to cell styles. */
- StylesPropertyHelper& getStylesPropertyHelper() const;
- /** Returns the converter for properties related to page and print settings. */
- PageSettingsPropertyHelper& getPageSettingsPropertyHelper() const;
+ /** Returns the page and print settings converter. */
+ PageSettingsConverter& getPageSettingsConverter() const;
// OOX specific -----------------------------------------------------------
@@ -271,8 +349,8 @@ public:
/** Recreates global buffers that are used per sheet in specific BIFF versions. */
void createBuffersPerSheet();
- /** Looks for a password provided via API, or queries it via GUI. */
- ::rtl::OUString queryPassword() const;
+ /** Returns the codec helper that stores the encoder/decoder object. */
+ BiffCodecHelper& getCodecHelper() const;
private:
WorkbookData& mrBookData;
diff --git a/oox/inc/oox/xls/workbooksettings.hxx b/oox/inc/oox/xls/workbooksettings.hxx
index b32ed381ccd8..683747c03ed6 100644
--- a/oox/inc/oox/xls/workbooksettings.hxx
+++ b/oox/inc/oox/xls/workbooksettings.hxx
@@ -33,13 +33,15 @@
#include "oox/xls/workbookhelper.hxx"
+namespace com { namespace sun { namespace star { namespace util { struct Date; } } } }
+
namespace oox {
namespace xls {
// ============================================================================
/** Global workbook settings. */
-struct OoxWorkbookPrData
+struct WorkbookSettingsModel
{
::rtl::OUString maCodeName; /// VBA codename for the workbook.
sal_Int32 mnShowObjectMode; /// Specifies how objects are shown.
@@ -48,7 +50,7 @@ struct OoxWorkbookPrData
bool mbDateMode1904; /// True = null date is 1904-01-01.
bool mbSaveExtLinkValues; /// True = save cached cell values for external links.
- explicit OoxWorkbookPrData();
+ explicit WorkbookSettingsModel();
/** Sets OOBIN or BIFF object visibility mode. */
void setBinObjectMode( sal_uInt16 nObjMode );
@@ -57,7 +59,7 @@ struct OoxWorkbookPrData
// ============================================================================
/** Workbook calculation settings. */
-struct OoxCalcPrData
+struct CalcSettingsModel
{
double mfIterateDelta; /// Minimum change in circular references.
sal_Int32 mnCalcId; /// Calculation engine identifier.
@@ -72,7 +74,7 @@ struct OoxCalcPrData
bool mbConcurrent; /// True = concurrent calculation enabled.
bool mbUseNlr; /// True = use natural language references in formulas.
- explicit OoxCalcPrData();
+ explicit CalcSettingsModel();
};
// ============================================================================
@@ -126,10 +128,16 @@ public:
/** Returns the show objects mode (considered a view setting in Calc). */
sal_Int16 getApiShowObjectMode() const;
+ /** Returns the nulldate of this workbook. */
+ ::com::sun::star::util::Date getNullDate() const;
+
+private:
+ /** Updates date mode and unit converter nulldate. */
+ void setDateMode( bool bDateMode1904 );
private:
- OoxWorkbookPrData maOoxBookData;
- OoxCalcPrData maOoxCalcData;
+ WorkbookSettingsModel maBookSettings;
+ CalcSettingsModel maCalcSettings;
};
// ============================================================================
diff --git a/oox/inc/oox/xls/worksheetbuffer.hxx b/oox/inc/oox/xls/worksheetbuffer.hxx
index f7b82fe7164e..a4ebdedef7e2 100644
--- a/oox/inc/oox/xls/worksheetbuffer.hxx
+++ b/oox/inc/oox/xls/worksheetbuffer.hxx
@@ -46,7 +46,7 @@ namespace xls {
// ============================================================================
/** Contains data from the 'sheet' element describing a sheet in the workbook. */
-struct OoxSheetInfo
+struct SheetInfoModel
{
::rtl::OUString maRelId; /// Relation identifier for the sheet substream.
::rtl::OUString maName; /// Original name of the sheet.
@@ -54,7 +54,7 @@ struct OoxSheetInfo
sal_Int32 mnSheetId; /// Sheet identifier.
sal_Int32 mnState; /// Visibility state.
- explicit OoxSheetInfo();
+ explicit SheetInfoModel();
};
// ============================================================================
@@ -80,28 +80,33 @@ public:
/** Imports the SHEET record from the passed BIFF stream. */
void importSheet( BiffInputStream& rStrm );
- /** Returns the number of sheets contained in the workbook. */
+ /** Inserts a new empty sheet into the document. Looks for an unused name.
+ @return Internal index of the new sheet. */
+ sal_Int16 insertEmptySheet( const ::rtl::OUString& rPreferredName, bool bVisible );
+
+ /** Returns the number of original sheets contained in the workbook. */
sal_Int32 getSheetCount() const;
/** Returns the OOX relation identifier of the specified sheet. */
::rtl::OUString getSheetRelId( sal_Int32 nSheet ) const;
/** Returns the finalized name of the specified sheet. */
- ::rtl::OUString getFinalSheetName( sal_Int32 nSheet ) const;
+ ::rtl::OUString getCalcSheetName( sal_Int32 nSheet ) const;
/** Returns the finalized name of the sheet with the passed original name. */
- ::rtl::OUString getFinalSheetName( const ::rtl::OUString& rName ) const;
+ ::rtl::OUString getCalcSheetName( const ::rtl::OUString& rModelName ) const;
/** Returns the index of the sheet with the passed original name. */
- sal_Int32 getFinalSheetIndex( const ::rtl::OUString& rName ) const;
+ sal_Int32 getCalcSheetIndex( const ::rtl::OUString& rModelName ) const;
private:
- const OoxSheetInfo* getSheetInfo( sal_Int32 nSheet ) const;
+ typedef ::std::pair< sal_Int16, ::rtl::OUString > IndexNamePair;
+
+ const SheetInfoModel* getSheetInfo( sal_Int32 nSheet ) const;
- ::rtl::OUString insertSheet( const ::rtl::OUString& rName, sal_Int16 nSheet, bool bVisible );
- void insertSheet( const OoxSheetInfo& rSheetInfo );
+ IndexNamePair insertSheet( const ::rtl::OUString& rPreferredName, sal_Int16 nSheet, bool bVisible );
+ void insertSheet( const SheetInfoModel& rModel );
private:
- typedef ::std::vector< OoxSheetInfo > SheetInfoVec;
+ typedef ::std::vector< SheetInfoModel > SheetInfoModelVec;
- const ::rtl::OUString maIsVisibleProp;
- SheetInfoVec maSheetInfos;
+ SheetInfoModelVec maSheetInfos;
};
// ============================================================================
diff --git a/oox/inc/oox/xls/worksheetfragment.hxx b/oox/inc/oox/xls/worksheetfragment.hxx
index 827614d3ec80..5ff21fbdb6c5 100644
--- a/oox/inc/oox/xls/worksheetfragment.hxx
+++ b/oox/inc/oox/xls/worksheetfragment.hxx
@@ -38,6 +38,31 @@ namespace xls {
// ============================================================================
+class OoxDataValidationsContext : public OoxWorksheetContextBase
+{
+public:
+ explicit OoxDataValidationsContext( OoxWorksheetFragmentBase& rFragment );
+
+protected:
+ // oox.core.ContextHandler2Helper interface -------------------------------
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onEndElement( const ::rtl::OUString& rChars );
+
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
+
+private:
+ /** Imports the dataValidation element containing data validation settings. */
+ void importDataValidation( const AttributeList& rAttribs );
+ /** Imports the DATAVALIDATION record containing data validation settings. */
+ void importDataValidation( RecordInputStream& rStrm );
+
+private:
+ ::std::auto_ptr< ValidationModel > mxValModel;
+};
+
+// ============================================================================
+
class OoxWorksheetFragment : public OoxWorksheetFragmentBase
{
public:
@@ -51,12 +76,10 @@ public:
protected:
// oox.core.ContextHandler2Helper interface -------------------------------
- virtual ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
- virtual void onStartElement( const AttributeList& rAttribs );
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
virtual void onEndElement( const ::rtl::OUString& rChars );
- virtual ContextWrapper onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
- virtual void onStartRecord( RecordInputStream& rStrm );
+ virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm );
// oox.core.FragmentHandler2 interface ------------------------------------
@@ -75,12 +98,10 @@ private:
void importCol( const AttributeList& rAttribs );
/** Imports a merged cell range from a mergeCell element. */
void importMergeCell( const AttributeList& rAttribs );
- /** Imports the dataValidation element containing data validation settings. */
- void importDataValidation( const AttributeList& rAttribs );
/** Imports the hyperlink element containing a hyperlink for a cell range. */
void importHyperlink( const AttributeList& rAttribs );
/** Imports individual break that is either within row or column break context. */
- void importBrk( const AttributeList& rAttribs );
+ void importBrk( const AttributeList& rAttribs, bool bRowBreak );
/** Imports the the relation identifier for the DrawingML part. */
void importDrawing( const AttributeList& rAttribs );
/** Imports the the relation identifier for the legacy VML drawing part. */
@@ -100,10 +121,8 @@ private:
void importMergeCell( RecordInputStream& rStrm );
/** Imports a hyperlink for a cell range from a HYPERLINK record. */
void importHyperlink( RecordInputStream& rStrm );
- /** Imports the DATAVALIDATION record containing data validation settings. */
- void importDataValidation( RecordInputStream& rStrm );
/** Imports the BRK record for an individual row or column page break. */
- void importBrk( RecordInputStream& rStrm );
+ void importBrk( RecordInputStream& rStrm, bool bRowBreak );
/** Imports the DRAWING record containing the relation identifier for the DrawingML part. */
void importDrawing( RecordInputStream& rStrm );
/** Imports the LEGACYDRAWING record containing the relation identifier for the VML drawing part. */
@@ -112,13 +131,12 @@ private:
void importOleObject( RecordInputStream& rStrm );
/** Imports additional data for an OCX form control. */
void importControl( RecordInputStream& rStrm );
-
-private:
- ::std::auto_ptr< OoxValidationData > mxValData;
};
// ============================================================================
+class BiffPivotTableContext;
+
class BiffWorksheetFragment : public BiffWorksheetFragmentBase
{
public:
@@ -127,6 +145,7 @@ public:
ISegmentProgressBarRef xProgressBar,
WorksheetType eSheetType,
sal_Int32 nSheet );
+ virtual ~BiffWorksheetFragment();
/** Imports the entire worksheet fragment, returns true, if EOF record has been reached. */
virtual bool importFragment();
@@ -158,8 +177,13 @@ private:
void importMergedCells();
/** Imports the HORPAGEBREAKS or VERPAGEBREAKS record and inserts page breaks. */
void importPageBreaks( bool bRowBreak );
+ /** Imports a pivot table. */
+ void importPTDefinition();
/** Imports the STANDARDWIDTH record and sets standard column width. */
void importStandardWidth();
+
+private:
+ ::boost::shared_ptr< BiffPivotTableContext > mxPTContext;
};
// ============================================================================
diff --git a/oox/inc/oox/xls/worksheethelper.hxx b/oox/inc/oox/xls/worksheethelper.hxx
index b3cdfad49b71..7d788bd168af 100644
--- a/oox/inc/oox/xls/worksheethelper.hxx
+++ b/oox/inc/oox/xls/worksheethelper.hxx
@@ -38,6 +38,7 @@
namespace com { namespace sun { namespace star {
namespace awt { struct Point; }
namespace awt { struct Size; }
+ namespace util { struct DateTime; }
namespace table { class XTableColumns; }
namespace table { class XTableRows; }
namespace table { class XCell; }
@@ -55,6 +56,7 @@ class BinRangeList;
class WorksheetSettings;
class SharedFormulaBuffer;
class CondFormatBuffer;
+class CommentsBuffer;
class PageSettings;
class SheetViewSettings;
@@ -75,7 +77,7 @@ enum WorksheetType
// ============================================================================
/** Stores some data about a cell. */
-struct OoxCellData
+struct CellModel
{
::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > mxCell;
::com::sun::star::table::CellAddress maAddress;
@@ -89,13 +91,14 @@ struct OoxCellData
bool mbHasValueStr; /// True = contents of maValueStr are valid.
bool mbShowPhonetic; /// True = show phonetic text.
- inline explicit OoxCellData() { reset(); }
+ inline explicit CellModel() { reset(); }
void reset();
};
// ----------------------------------------------------------------------------
-struct OoxDataTableData
+/** Stores data about a data table a.k.a. multiple operation range. */
+struct DataTableModel
{
::rtl::OUString maRef1; /// String containing first reference cell for data table formulas.
::rtl::OUString maRef2; /// String containing second reference cell for data table formulas.
@@ -104,13 +107,13 @@ struct OoxDataTableData
bool mbRef1Deleted; /// True = first reference cell deleted.
bool mbRef2Deleted; /// True = second reference cell deleted.
- explicit OoxDataTableData();
+ explicit DataTableModel();
};
// ----------------------------------------------------------------------------
/** Stores formatting data about a range of columns. */
-struct OoxColumnData
+struct ColumnModel
{
sal_Int32 mnFirstCol; /// 1-based (!) index of first column.
sal_Int32 mnLastCol; /// 1-based (!) index of last column.
@@ -121,16 +124,16 @@ struct OoxColumnData
bool mbHidden; /// True = column is hidden.
bool mbCollapsed; /// True = column outline is collapsed.
- explicit OoxColumnData();
+ explicit ColumnModel();
/** Expands this entry with the passed column range, if column settings are equal. */
- bool tryExpand( const OoxColumnData& rNewData );
+ bool tryExpand( const ColumnModel& rModel );
};
// ----------------------------------------------------------------------------
/** Stores formatting data about a range of rows. */
-struct OoxRowData
+struct RowModel
{
sal_Int32 mnFirstRow; /// 1-based (!) index of first row.
sal_Int32 mnLastRow; /// 1-based (!) index of last row.
@@ -145,29 +148,29 @@ struct OoxRowData
bool mbThickTop; /// True = row has extra space above text.
bool mbThickBottom; /// True = row has extra space below text.
- explicit OoxRowData();
+ explicit RowModel();
/** Expands this entry with the passed row range, if row settings are equal. */
- bool tryExpand( const OoxRowData& rNewData );
+ bool tryExpand( const RowModel& rModel );
};
// ----------------------------------------------------------------------------
/** Stores formatting data about a page break. */
-struct OoxPageBreakData
+struct PageBreakModel
{
sal_Int32 mnColRow; /// 0-based (!) index of column/row.
sal_Int32 mnMin; /// Start of limited break.
sal_Int32 mnMax; /// End of limited break.
bool mbManual; /// True = manual page break.
- explicit OoxPageBreakData();
+ explicit PageBreakModel();
};
// ----------------------------------------------------------------------------
/** Stores data about a hyperlink range. */
-struct OoxHyperlinkData
+struct HyperlinkModel
{
::com::sun::star::table::CellRangeAddress maRange;
::rtl::OUString maTarget;
@@ -176,13 +179,13 @@ struct OoxHyperlinkData
::rtl::OUString maFrame;
::rtl::OUString maTooltip;
- explicit OoxHyperlinkData();
+ explicit HyperlinkModel();
};
// ----------------------------------------------------------------------------
/** Stores data about ranges with data validation settings. */
-struct OoxValidationData
+struct ValidationModel
{
ApiCellRangeList maRanges;
ApiTokenSequence maTokens1;
@@ -199,7 +202,7 @@ struct OoxValidationData
bool mbNoDropDown;
bool mbAllowBlank;
- explicit OoxValidationData();
+ explicit ValidationModel();
/** Sets the passed OOBIN or BIFF validation type. */
void setBinType( sal_uInt8 nType );
@@ -212,7 +215,7 @@ struct OoxValidationData
// ----------------------------------------------------------------------------
/** Stores data about embedded objects. */
-struct OoxOleObjectData
+struct OleObjectModel
{
::rtl::OUString maProgId;
::rtl::OUString maStoragePath;
@@ -221,19 +224,19 @@ struct OoxOleObjectData
sal_Int32 mnShapeId;
bool mbAutoLoad;
- explicit OoxOleObjectData();
+ explicit OleObjectModel();
};
// ----------------------------------------------------------------------------
/** Stores data about embedded form controls. */
-struct OoxFormControlData
+struct FormControlModel
{
::rtl::OUString maStoragePath;
::rtl::OUString maName;
sal_Int32 mnShapeId;
- explicit OoxFormControlData();
+ explicit FormControlModel();
};
// ============================================================================
@@ -252,7 +255,7 @@ public:
sal_Int16 getSheetIndex() const;
/** Returns the XSpreadsheet interface of the current sheet. */
const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >&
- getXSpreadsheet() const;
+ getSheet() const;
/** Returns the XCell interface for the passed cell address. */
::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >
@@ -334,6 +337,8 @@ public:
SharedFormulaBuffer& getSharedFormulas() const;
/** Returns the conditional formattings in this sheet. */
CondFormatBuffer& getCondFormats() const;
+ /** Returns the buffer for all cell comments in this sheet. */
+ CommentsBuffer& getComments() const;
/** Returns the page/print settings for this sheet. */
PageSettings& getPageSettings() const;
/** Returns the view settings for this sheet. */
@@ -348,6 +353,10 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell,
sal_Int32 nStringId,
sal_Int32 nXfId ) const;
+ /** Sets the passed date/time value to the cell and adjusts number format. */
+ void setDateTimeCell(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell,
+ const ::com::sun::star::util::DateTime& rDateTime ) const;
/** Sets the passed boolean value to the cell and adjusts number format. */
void setBooleanCell(
const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell,
@@ -360,27 +369,32 @@ public:
void setErrorCell(
const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell,
sal_uInt8 nErrorCode ) const;
- /** Sets cell contents to the cell specified in the passed cell data object. */
- void setOoxCell( OoxCellData& orCellData ) const;
+ /** Sets cell contents to the cell specified in the passed cell model. */
+ void setCell( CellModel& orModel ) const;
+
+ /** Sets a standard number format (constant from com.sun.star.util.NumberFormat) to the passed cell. */
+ void setStandardNumFmt(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >& rxCell,
+ sal_Int16 nStdNumFmt ) const;
/** Changes the current sheet type. */
void setSheetType( WorksheetType eSheetType );
/** Sets the dimension (used area) of the sheet. */
void setDimension( const ::com::sun::star::table::CellRangeAddress& rRange );
/** Stores the cell formatting data of the current cell. */
- void setCellFormat( const OoxCellData& rCellData );
+ void setCellFormat( const CellModel& rModel );
/** Merges the cells in the passed cell range. */
void setMergedRange( const ::com::sun::star::table::CellRangeAddress& rRange );
/** Sets a column or row page break described in the passed struct. */
- void setPageBreak( const OoxPageBreakData& rData, bool bRowBreak );
+ void setPageBreak( const PageBreakModel& rModel, bool bRowBreak );
/** Inserts the hyperlink URL into the spreadsheet. */
- void setHyperlink( const OoxHyperlinkData& rHyperlink );
+ void setHyperlink( const HyperlinkModel& rModel );
/** Inserts the data validation settings into the spreadsheet. */
- void setValidation( const OoxValidationData& rValData );
+ void setValidation( const ValidationModel& rModel );
/** Sets a multiple table operation to the passed range. */
void setTableOperation(
const ::com::sun::star::table::CellRangeAddress& rRange,
- const OoxDataTableData& rTableData ) const;
+ const DataTableModel& rModel ) const;
/** Sets the passed label ranges to the current sheet. */
void setLabelRanges(
const ApiCellRangeList& rColRanges,
@@ -390,9 +404,9 @@ public:
/** Sets the path to the legacy VML drawing fragment of this sheet. */
void setVmlDrawingPath( const ::rtl::OUString& rVmlDrawingPath );
/** Sets additional data for an OLE object. */
- void setOleObject( const OoxOleObjectData& rOleObjectData );
+ void setOleObject( const OleObjectModel& rModel );
/** Sets additional data for an OCX form control. */
- void setFormControl( const OoxFormControlData& rFormControlData );
+ void setFormControl( const FormControlModel& rModel );
/** Sets base width for all columns (without padding pixels). This value
is only used, if width has not been set with setDefaultColumnWidth(). */
@@ -400,10 +414,12 @@ public:
/** Sets default width for all columns. This function overrides the base
width set with the setBaseColumnWidth() function. */
void setDefaultColumnWidth( double fWidth );
+ /** Converts default cell formatting for a range of columns. */
+ void setDefaultColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId );
/** Sets column settings for a specific range of columns.
@descr Column default formatting is converted directly, other settings
are cached and converted in the finalizeWorksheetImport() call. */
- void setColumnData( const OoxColumnData& rData );
+ void setColumnModel( const ColumnModel& rModel );
/** Sets default height and hidden state for all unused rows in the sheet. */
void setDefaultRowSettings(
@@ -412,12 +428,7 @@ public:
/** Sets row settings for a specific range of rows.
@descr Row default formatting is converted directly, other settings
are cached and converted in the finalizeWorksheetImport() call. */
- void setRowData( const OoxRowData& rData );
-
- /** Converts column default cell formatting. */
- void convertColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId );
- /** Converts row default cell formatting. */
- void convertRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId );
+ void setRowModel( const RowModel& rModel );
/** Initial conversion before importing the worksheet. */
void initializeWorksheetImport();
diff --git a/oox/inc/oox/xls/worksheetsettings.hxx b/oox/inc/oox/xls/worksheetsettings.hxx
index 051b010de154..717ea9dd8865 100644
--- a/oox/inc/oox/xls/worksheetsettings.hxx
+++ b/oox/inc/oox/xls/worksheetsettings.hxx
@@ -40,7 +40,7 @@ namespace xls {
// ============================================================================
/** Sheet and outline settings. */
-struct OoxSheetPrData
+struct SheetSettingsModel
{
::rtl::OUString maCodeName; /// VBA module codename.
Color maTabColor; /// Sheet tab color.
@@ -49,13 +49,13 @@ struct OoxSheetPrData
bool mbSummaryBelow; /// True = row outline symbols below group.
bool mbSummaryRight; /// True = column outline symbols right of group.
- explicit OoxSheetPrData();
+ explicit SheetSettingsModel();
};
// ============================================================================
/** Sheet protection settings. */
-struct OoxSheetProtectionData
+struct SheetProtectionModel
{
sal_uInt16 mnPasswordHash; /// Hash value from sheet protection password.
bool mbSheet; /// True = sheet protection enabled, locked cells are protcted.
@@ -75,7 +75,7 @@ struct OoxSheetProtectionData
bool mbPivotTables; /// True = pivot tables locked.
bool mbSelectUnlocked; /// True = select unlocked cells locked.
- explicit OoxSheetProtectionData();
+ explicit SheetProtectionModel();
};
// ============================================================================
@@ -131,8 +131,8 @@ public:
private:
PhoneticSettings maPhoneticSett;
- OoxSheetPrData maOoxSheetData;
- OoxSheetProtectionData maOoxProtData;
+ SheetSettingsModel maSheetSettings;
+ SheetProtectionModel maSheetProt;
};
// ============================================================================
diff --git a/oox/source/core/contexthandler2.cxx b/oox/source/core/contexthandler2.cxx
index a1444d7cf81f..f31c080fd0f6 100644
--- a/oox/source/core/contexthandler2.cxx
+++ b/oox/source/core/contexthandler2.cxx
@@ -44,13 +44,6 @@ namespace core {
// ============================================================================
-ContextHandler* ContextWrapper::getContextHandler( ContextHandler2Helper& rThis ) const
-{
- return mbThis ? &rThis.queryContextHandler() : mxContext.get();
-}
-
-// ============================================================================
-
/** Information about a processed context element. */
struct ContextInfo
{
@@ -110,8 +103,8 @@ bool ContextHandler2Helper::isRootElement() const
Reference< XFastContextHandler > ContextHandler2Helper::implCreateChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs )
{
appendCollectedChars();
- ContextWrapper aWrapper = onCreateContext( nElement, AttributeList( rxAttribs ) );
- return aWrapper.getContextHandler( *this );
+ ContextHandlerRef xContext = onCreateContext( nElement, AttributeList( rxAttribs ) );
+ return Reference< XFastContextHandler >( xContext.get() );
}
void ContextHandler2Helper::implStartCurrentContext( sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs )
@@ -144,8 +137,7 @@ void ContextHandler2Helper::implEndCurrentContext( sal_Int32 nElement )
ContextHandlerRef ContextHandler2Helper::implCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
{
- ContextWrapper aWrapper = onCreateRecordContext( nRecId, rStrm );
- return aWrapper.getContextHandler( *this );
+ return onCreateRecordContext( nRecId, rStrm );
}
void ContextHandler2Helper::implStartRecord( sal_Int32 nRecId, RecordInputStream& rStrm )
@@ -252,9 +244,9 @@ void ContextHandler2::endRecord( sal_Int32 nRecId )
// oox.core.ContextHandler2Helper interface -----------------------------------
-ContextWrapper ContextHandler2::onCreateContext( sal_Int32, const AttributeList& )
+ContextHandlerRef ContextHandler2::onCreateContext( sal_Int32, const AttributeList& )
{
- return false;
+ return 0;
}
void ContextHandler2::onStartElement( const AttributeList& )
@@ -265,9 +257,9 @@ void ContextHandler2::onEndElement( const OUString& )
{
}
-ContextWrapper ContextHandler2::onCreateRecordContext( sal_Int32, RecordInputStream& )
+ContextHandlerRef ContextHandler2::onCreateRecordContext( sal_Int32, RecordInputStream& )
{
- return false;
+ return 0;
}
void ContextHandler2::onStartRecord( RecordInputStream& )
diff --git a/oox/source/core/fragmenthandler2.cxx b/oox/source/core/fragmenthandler2.cxx
index 5f17c7fc95c7..f808340c68f1 100644
--- a/oox/source/core/fragmenthandler2.cxx
+++ b/oox/source/core/fragmenthandler2.cxx
@@ -112,9 +112,9 @@ void FragmentHandler2::endRecord( sal_Int32 nRecId )
// oox.core.ContextHandler2Helper interface -----------------------------------
-ContextWrapper FragmentHandler2::onCreateContext( sal_Int32, const AttributeList& )
+ContextHandlerRef FragmentHandler2::onCreateContext( sal_Int32, const AttributeList& )
{
- return false;
+ return 0;
}
void FragmentHandler2::onStartElement( const AttributeList& )
@@ -125,9 +125,9 @@ void FragmentHandler2::onEndElement( const OUString& )
{
}
-ContextWrapper FragmentHandler2::onCreateRecordContext( sal_Int32, RecordInputStream& )
+ContextHandlerRef FragmentHandler2::onCreateRecordContext( sal_Int32, RecordInputStream& )
{
- return false;
+ return 0;
}
void FragmentHandler2::onStartRecord( RecordInputStream& )
diff --git a/oox/source/drawingml/chart/axiscontext.cxx b/oox/source/drawingml/chart/axiscontext.cxx
index 31bd24332e7f..00ca3d740bb7 100644
--- a/oox/source/drawingml/chart/axiscontext.cxx
+++ b/oox/source/drawingml/chart/axiscontext.cxx
@@ -35,8 +35,8 @@
#include "oox/drawingml/chart/titlecontext.hxx"
using ::rtl::OUString;
+using ::oox::core::ContextHandlerRef;
using ::oox::core::ContextHandler2Helper;
-using ::oox::core::ContextWrapper;
namespace oox {
namespace drawingml {
@@ -53,7 +53,7 @@ AxisDispUnitsContext::~AxisDispUnitsContext()
{
}
-ContextWrapper AxisDispUnitsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef AxisDispUnitsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -62,12 +62,12 @@ ContextWrapper AxisDispUnitsContext::onCreateContext( sal_Int32 nElement, const
{
case C_TOKEN( builtInUnit ):
mrModel.mnBuiltInUnit = rAttribs.getToken( XML_val, XML_thousands );
- return false;
+ return 0;
case C_TOKEN( custUnit ):
mrModel.mfCustomUnit = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
case C_TOKEN( dispUnitsLbl ):
- return true;
+ return this;
}
break;
@@ -85,7 +85,7 @@ ContextWrapper AxisDispUnitsContext::onCreateContext( sal_Int32 nElement, const
}
break;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -99,7 +99,7 @@ AxisContextBase::~AxisContextBase()
{
}
-ContextWrapper AxisContextBase::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef AxisContextBase::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -111,42 +111,42 @@ ContextWrapper AxisContextBase::onCreateContext( sal_Int32 nElement, const Attri
{
case C_TOKEN( axId ):
mrModel.mnAxisId = rAttribs.getInteger( XML_val, -1 );
- return false;
+ return 0;
case C_TOKEN( crossAx ):
mrModel.mnCrossAxisId = rAttribs.getInteger( XML_val, -1 );
- return false;
+ return 0;
case C_TOKEN( crosses ):
mrModel.mnCrossMode = rAttribs.getToken( XML_val, XML_autoZero );
- return false;
+ return 0;
case C_TOKEN( crossesAt ):
mrModel.mofCrossesAt = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
case C_TOKEN( delete ):
// default is 'false', not 'true' as specified
mrModel.mbDeleted = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( majorGridlines ):
return new ShapePrWrapperContext( *this, mrModel.mxMajorGridLines.create() );
case C_TOKEN( majorTickMark ):
// default is 'out', not 'cross' as specified
mrModel.mnMajorTickMark = rAttribs.getToken( XML_val, XML_out );
- return false;
+ return 0;
case C_TOKEN( minorGridlines ):
return new ShapePrWrapperContext( *this, mrModel.mxMinorGridLines.create() );
case C_TOKEN( minorTickMark ):
// default is 'none', not 'cross' as specified
mrModel.mnMinorTickMark = rAttribs.getToken( XML_val, XML_none );
- return false;
+ return 0;
case C_TOKEN( numFmt ):
mrModel.maNumberFormat.setAttributes( rAttribs );
- return false;
+ return 0;
case C_TOKEN( scaling ):
- return true;
+ return this;
case C_TOKEN( spPr ):
return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
case C_TOKEN( tickLblPos ):
mrModel.mnTickLabelPos = rAttribs.getToken( XML_val, XML_nextTo );
- return false;
+ return 0;
case C_TOKEN( title ):
return new TitleContext( *this, mrModel.mxTitle.create() );
case C_TOKEN( txPr ):
@@ -159,20 +159,20 @@ ContextWrapper AxisContextBase::onCreateContext( sal_Int32 nElement, const Attri
{
case C_TOKEN( logBase ):
mrModel.mofLogBase = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
case C_TOKEN( max ):
mrModel.mofMax = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
case C_TOKEN( min ):
mrModel.mofMin = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
case C_TOKEN( orientation ):
mrModel.mnOrientation = rAttribs.getToken( XML_val, XML_minMax );
- return false;
+ return 0;
}
break;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -186,33 +186,33 @@ CatAxisContext::~CatAxisContext()
{
}
-ContextWrapper CatAxisContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef CatAxisContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
case C_TOKEN( auto ):
// default is 'false', not 'true' as specified
mrModel.mbAuto = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( axPos ):
mrModel.mnAxisPos = rAttribs.getToken( XML_val, XML_TOKEN_INVALID );
- return false;
+ return 0;
case C_TOKEN( lblAlgn ):
mrModel.mnLabelAlign = rAttribs.getToken( XML_val, XML_ctr );
- return false;
+ return 0;
case C_TOKEN( lblOffset ):
mrModel.mnLabelOffset = rAttribs.getInteger( XML_val, 100 );
- return false;
+ return 0;
case C_TOKEN( noMultiLvlLbl ):
// default is 'false', not 'true' as specified
mrModel.mbNoMultiLevel = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( tickLblSkip ):
mrModel.mnTickLabelSkip = rAttribs.getInteger( XML_val, 0 );
- return false;
+ return 0;
case C_TOKEN( tickMarkSkip ):
mrModel.mnTickMarkSkip = rAttribs.getInteger( XML_val, 0 );
- return false;
+ return 0;
}
return AxisContextBase::onCreateContext( nElement, rAttribs );
}
@@ -228,32 +228,32 @@ DateAxisContext::~DateAxisContext()
{
}
-ContextWrapper DateAxisContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef DateAxisContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
case C_TOKEN( auto ):
// default is 'false', not 'true' as specified
mrModel.mbAuto = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( baseTimeUnit ):
mrModel.mnBaseTimeUnit = rAttribs.getToken( XML_val, XML_days );
- return false;
+ return 0;
case C_TOKEN( lblOffset ):
mrModel.mnLabelOffset = rAttribs.getInteger( XML_val, 100 );
- return false;
+ return 0;
case C_TOKEN( majorTimeUnit ):
mrModel.mnMajorTimeUnit = rAttribs.getToken( XML_val, XML_days );
- return false;
+ return 0;
case C_TOKEN( majorUnit ):
mrModel.mofMajorUnit = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
case C_TOKEN( minorTimeUnit ):
mrModel.mnMinorTimeUnit = rAttribs.getToken( XML_val, XML_days );
- return false;
+ return 0;
case C_TOKEN( minorUnit ):
mrModel.mofMinorUnit = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
}
return AxisContextBase::onCreateContext( nElement, rAttribs );
}
@@ -269,16 +269,16 @@ SerAxisContext::~SerAxisContext()
{
}
-ContextWrapper SerAxisContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef SerAxisContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
case C_TOKEN( tickLblSkip ):
mrModel.mnTickLabelSkip = rAttribs.getInteger( XML_val, 0 );
- return false;
+ return 0;
case C_TOKEN( tickMarkSkip ):
mrModel.mnTickMarkSkip = rAttribs.getInteger( XML_val, 0 );
- return false;
+ return 0;
}
return AxisContextBase::onCreateContext( nElement, rAttribs );
}
@@ -294,21 +294,21 @@ ValAxisContext::~ValAxisContext()
{
}
-ContextWrapper ValAxisContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef ValAxisContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
case C_TOKEN( crossBetween ):
mrModel.mnCrossBetween = rAttribs.getToken( XML_val, XML_between );
- return false;
+ return 0;
case C_TOKEN( dispUnits ):
return new AxisDispUnitsContext( *this, mrModel.mxDispUnits.create() );
case C_TOKEN( majorUnit ):
mrModel.mofMajorUnit = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
case C_TOKEN( minorUnit ):
mrModel.mofMinorUnit = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
}
return AxisContextBase::onCreateContext( nElement, rAttribs );
}
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx
index 52f8c7979113..57fe9955305f 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -40,6 +40,7 @@
#include "oox/drawingml/chart/axismodel.hxx"
#include "oox/drawingml/chart/titleconverter.hxx"
#include "oox/drawingml/chart/typegroupconverter.hxx"
+#include "properties.hxx"
using ::rtl::OUString;
using ::com::sun::star::uno::Any;
@@ -105,11 +106,14 @@ AxisConverter::~AxisConverter()
}
void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCoordSystem,
- TypeGroupConverter& rTypeGroup, sal_Int32 nAxesSetIdx, sal_Int32 nAxisIdx )
+ TypeGroupConverter& rTypeGroup, const AxisModel* pCrossingAxis, sal_Int32 nAxesSetIdx, sal_Int32 nAxisIdx )
{
Reference< XAxis > xAxis;
try
{
+ namespace cssc = ::com::sun::star::chart;
+ namespace cssc2 = ::com::sun::star::chart2;
+
const TypeGroupInfo& rTypeInfo = rTypeGroup.getTypeInfo();
ObjectFormatter& rFormatter = getFormatter();
@@ -117,12 +121,12 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
xAxis.set( createInstance( CREATE_OUSTRING( "com.sun.star.chart2.Axis" ) ), UNO_QUERY_THROW );
PropertySet aAxisProp( xAxis );
// #i58688# axis enabled
- aAxisProp.setProperty( CREATE_OUSTRING( "Show" ), !mrModel.mbDeleted );
+ aAxisProp.setProperty( PROP_Show, !mrModel.mbDeleted );
// axis line, tick, and gridline properties ---------------------------
// show axis labels
- aAxisProp.setProperty( CREATE_OUSTRING( "DisplayLabels" ), mrModel.mnTickLabelPos != XML_none );
+ aAxisProp.setProperty( PROP_DisplayLabels, mrModel.mnTickLabelPos != XML_none );
// no X axis line in radar charts
if( (nAxisIdx == API_X_AXIS) && (rTypeInfo.meTypeCategory == TYPECATEGORY_RADAR) )
mrModel.mxShapeProp.getOrCreate().getLineProperties().maLineFill.moFillType = XML_noFill;
@@ -132,12 +136,12 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
rFormatter.convertTextRotation( aAxisProp, mrModel.mxTextProp );
// tick mark style
- aAxisProp.setProperty( CREATE_OUSTRING( "MajorTickmarks" ), lclGetTickMark( mrModel.mnMajorTickMark ) );
- aAxisProp.setProperty( CREATE_OUSTRING( "MinorTickmarks" ), lclGetTickMark( mrModel.mnMinorTickMark ) );
+ aAxisProp.setProperty( PROP_MajorTickmarks, lclGetTickMark( mrModel.mnMajorTickMark ) );
+ aAxisProp.setProperty( PROP_MinorTickmarks, lclGetTickMark( mrModel.mnMinorTickMark ) );
// main grid
PropertySet aGridProp( xAxis->getGridProperties() );
- aGridProp.setProperty( CREATE_OUSTRING( "Show" ), mrModel.mxMajorGridLines.is() );
+ aGridProp.setProperty( PROP_Show, mrModel.mxMajorGridLines.is() );
if( mrModel.mxMajorGridLines.is() )
rFormatter.convertFrameFormatting( aGridProp, mrModel.mxMajorGridLines, OBJECTTYPE_MAJORGRIDLINE );
@@ -146,7 +150,7 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
if( aSubGridPropSeq.hasElements() )
{
PropertySet aSubGridProp( aSubGridPropSeq[ 0 ] );
- aSubGridProp.setProperty( CREATE_OUSTRING( "Show" ), mrModel.mxMinorGridLines.is() );
+ aSubGridProp.setProperty( PROP_Show, mrModel.mxMinorGridLines.is() );
if( mrModel.mxMinorGridLines.is() )
rFormatter.convertFrameFormatting( aSubGridProp, mrModel.mxMinorGridLines, OBJECTTYPE_MINORGRIDLINE );
}
@@ -191,11 +195,12 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
case ApiAxisType::SERIES:
{
// do not overlap text
- aAxisProp.setProperty( CREATE_OUSTRING( "TextOverlap" ), false );
+ aAxisProp.setProperty( PROP_TextOverlap, false );
// do not break text into several lines
- aAxisProp.setProperty( CREATE_OUSTRING( "TextBreak" ), false );
+ aAxisProp.setProperty( PROP_TextBreak, false );
// origin (min-cross or max-cross not supported, fall back to auto-cross)
- lclSetValueOrClearAny( aScaleData.Origin, mrModel.mofCrossesAt );
+ if( pCrossingAxis && (mrModel.mnCrossAxisId == pCrossingAxis->mnAxisId) )
+ lclSetValueOrClearAny( aScaleData.Origin, pCrossingAxis->mofCrossesAt );
//! TODO #i58731# show n-th category
}
break;
@@ -219,7 +224,8 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
lclSetScaledValueOrClearAny( aScaleData.Minimum, mrModel.mofMin, xLogScaling );
lclSetScaledValueOrClearAny( aScaleData.Maximum, mrModel.mofMax, xLogScaling );
// origin (min-cross or max-cross not supported, fall back to auto-cross)
- lclSetScaledValueOrClearAny( aScaleData.Origin, mrModel.mofCrossesAt, xLogScaling );
+ if( pCrossingAxis && (mrModel.mnCrossAxisId == pCrossingAxis->mnAxisId) )
+ lclSetScaledValueOrClearAny( aScaleData.Origin, pCrossingAxis->mofCrossesAt, xLogScaling );
// major increment
IncrementData& rIncrementData = aScaleData.IncrementData;
lclSetValueOrClearAny( rIncrementData.Distance, mrModel.mofMajorUnit );
@@ -248,8 +254,7 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
((nAxisIdx == API_Y_AXIS) && (rTypeInfo.meTypeCategory == TYPECATEGORY_PIE)) ||
((nAxisIdx == API_X_AXIS) && (rTypeInfo.meTypeCategory == TYPECATEGORY_RADAR));
bool bReverse = (mrModel.mnOrientation == XML_maxMin) != bMirrorDirection;
- namespace cssc = ::com::sun::star::chart2;
- aScaleData.Orientation = bReverse ? cssc::AxisOrientation_REVERSE : cssc::AxisOrientation_MATHEMATICAL;
+ aScaleData.Orientation = bReverse ? cssc2::AxisOrientation_REVERSE : cssc2::AxisOrientation_MATHEMATICAL;
// write back scaling data
xAxis->setScaleData( aScaleData );
@@ -261,7 +266,8 @@ void AxisConverter::convertFromModel( const Reference< XCoordinateSystem >& rxCo
// axis position ------------------------------------------------------
- aAxisProp.setProperty( CREATE_OUSTRING( "CrossoverPosition" ), (nAxesSetIdx == API_PRIM_AXESSET) ? ::com::sun::star::chart::ChartAxisPosition_START : ::com::sun::star::chart::ChartAxisPosition_END );
+ cssc::ChartAxisPosition ePosition = (nAxesSetIdx == API_PRIM_AXESSET) ? cssc::ChartAxisPosition_START : cssc::ChartAxisPosition_END;
+ aAxisProp.setProperty( PROP_CrossoverPosition, ePosition );
// axis title ---------------------------------------------------------
diff --git a/oox/source/drawingml/chart/chartcontextbase.cxx b/oox/source/drawingml/chart/chartcontextbase.cxx
index dedc571c7bca..a65f56dbfc5f 100644
--- a/oox/source/drawingml/chart/chartcontextbase.cxx
+++ b/oox/source/drawingml/chart/chartcontextbase.cxx
@@ -33,7 +33,7 @@
#include "oox/drawingml/shapepropertiescontext.hxx"
using ::oox::core::ContextHandler2Helper;
-using ::oox::core::ContextWrapper;
+using ::oox::core::ContextHandlerRef;
namespace oox {
namespace drawingml {
@@ -50,11 +50,9 @@ ShapePrWrapperContext::~ShapePrWrapperContext()
{
}
-ContextWrapper ShapePrWrapperContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef ShapePrWrapperContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
{
- if( isRootElement() && (nElement == C_TOKEN( spPr )) )
- return new ShapePropertiesContext( *this, mrModel );
- return false;
+ return (isRootElement() && (nElement == C_TOKEN( spPr ))) ? new ShapePropertiesContext( *this, mrModel ) : 0;
}
// ============================================================================
diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx
index 0e01b3a02d79..40e82cd39abf 100644
--- a/oox/source/drawingml/chart/chartspaceconverter.cxx
+++ b/oox/source/drawingml/chart/chartspaceconverter.cxx
@@ -33,11 +33,13 @@
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XTitled.hpp>
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/chart/MissingValueTreatment.hpp>
#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/chart/chartconverter.hxx"
#include "oox/drawingml/chart/chartspacemodel.hxx"
#include "oox/drawingml/chart/plotareaconverter.hxx"
#include "oox/drawingml/chart/titleconverter.hxx"
+#include "properties.hxx"
using ::rtl::OUString;
using ::com::sun::star::uno::Reference;
@@ -126,6 +128,21 @@ void ChartSpaceConverter::convertFromModel()
LegendConverter aLegendConv( *this, *mrModel.mxLegend );
aLegendConv.convertFromModel( getChartDocument()->getFirstDiagram() );
}
+
+ // treatment of missing values
+ if( xDiagram.is() )
+ {
+ using namespace ::com::sun::star::chart::MissingValueTreatment;
+ sal_Int32 nMissingValues = LEAVE_GAP;
+ switch( mrModel.mnDispBlanksAs )
+ {
+ case XML_gap: nMissingValues = LEAVE_GAP; break;
+ case XML_zero: nMissingValues = USE_ZERO; break;
+ case XML_span: nMissingValues = CONTINUE; break;
+ }
+ PropertySet aDiaProp( xDiagram );
+ aDiaProp.setProperty( PROP_MissingValueTreatment, nMissingValues );
+ }
}
// ============================================================================
diff --git a/oox/source/drawingml/chart/chartspacefragment.cxx b/oox/source/drawingml/chart/chartspacefragment.cxx
index 46e1be6357dc..c1d23d5d9dbd 100644
--- a/oox/source/drawingml/chart/chartspacefragment.cxx
+++ b/oox/source/drawingml/chart/chartspacefragment.cxx
@@ -37,7 +37,7 @@
#include "oox/drawingml/chart/titlecontext.hxx"
using ::rtl::OUString;
-using ::oox::core::ContextWrapper;
+using ::oox::core::ContextHandlerRef;
using ::oox::core::XmlFilterBase;
namespace oox {
@@ -55,23 +55,28 @@ ChartSpaceFragment::~ChartSpaceFragment()
{
}
-ContextWrapper ChartSpaceFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef ChartSpaceFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nElement == C_TOKEN( chartSpace ));
+ switch( nElement )
+ {
+ case C_TOKEN( chartSpace ):
+ return this;
+ }
+ break;
case C_TOKEN( chartSpace ):
switch( nElement )
{
case C_TOKEN( chart ):
- return true;
+ return this;
case C_TOKEN( spPr ):
return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
case C_TOKEN( style ):
mrModel.mnStyle = rAttribs.getInteger( XML_val, 2 );
- return false;
+ return 0;
case C_TOKEN( txPr ):
return new TextBodyContext( *this, mrModel.mxTextProp.create() );
}
@@ -83,12 +88,12 @@ ContextWrapper ChartSpaceFragment::onCreateContext( sal_Int32 nElement, const At
case C_TOKEN( autoTitleDeleted ):
// default is 'false', not 'true' as specified
mrModel.mbAutoTitleDel = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( backWall ):
return new WallFloorContext( *this, mrModel.mxBackWall.create() );
case C_TOKEN( dispBlanksAs ):
mrModel.mnDispBlanksAs = rAttribs.getToken( XML_val, XML_zero );
- return false;
+ return 0;
case C_TOKEN( floor ):
return new WallFloorContext( *this, mrModel.mxFloor.create() );
case C_TOKEN( legend ):
@@ -98,11 +103,11 @@ ContextWrapper ChartSpaceFragment::onCreateContext( sal_Int32 nElement, const At
case C_TOKEN( plotVisOnly ):
// default is 'false', not 'true' as specified
mrModel.mbPlotVisOnly = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( showDLblsOverMax ):
// default is 'false', not 'true' as specified
mrModel.mbShowLabelsOverMax = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( sideWall ):
return new WallFloorContext( *this, mrModel.mxSideWall.create() );
case C_TOKEN( title ):
@@ -112,7 +117,7 @@ ContextWrapper ChartSpaceFragment::onCreateContext( sal_Int32 nElement, const At
}
break;
}
- return false;
+ return 0;
}
// ============================================================================
diff --git a/oox/source/drawingml/chart/chartspacemodel.cxx b/oox/source/drawingml/chart/chartspacemodel.cxx
index af023960a2fd..d969030751d1 100644
--- a/oox/source/drawingml/chart/chartspacemodel.cxx
+++ b/oox/source/drawingml/chart/chartspacemodel.cxx
@@ -38,7 +38,7 @@ namespace chart {
// ============================================================================
ChartSpaceModel::ChartSpaceModel() :
- mnDispBlanksAs( XML_zero ),
+ mnDispBlanksAs( XML_gap ), // not zero as specified
mnStyle( 2 ),
mbAutoTitleDel( false ),
mbPlotVisOnly( false ),
diff --git a/oox/source/drawingml/chart/datasourcecontext.cxx b/oox/source/drawingml/chart/datasourcecontext.cxx
index 0f3fdf501030..56d35992892c 100644
--- a/oox/source/drawingml/chart/datasourcecontext.cxx
+++ b/oox/source/drawingml/chart/datasourcecontext.cxx
@@ -34,7 +34,7 @@
using ::rtl::OUString;
using ::oox::core::ContextHandler2Helper;
-using ::oox::core::ContextWrapper;
+using ::oox::core::ContextHandlerRef;
namespace oox {
namespace drawingml {
@@ -52,33 +52,43 @@ DoubleSequenceContext::~DoubleSequenceContext()
{
}
-ContextWrapper DoubleSequenceContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef DoubleSequenceContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
case C_TOKEN( numRef ):
- return (nElement == C_TOKEN( f )) ||
- (nElement == C_TOKEN( numCache ));
+ switch( nElement )
+ {
+ case C_TOKEN( f ):
+ case C_TOKEN( numCache ):
+ return this;
+ }
+ break;
case C_TOKEN( numCache ):
case C_TOKEN( numLit ):
switch( nElement )
{
case C_TOKEN( formatCode ):
- return true;
+ return this;
case C_TOKEN( ptCount ):
mrModel.mnPointCount = rAttribs.getInteger( XML_val, -1 );
- return false;
+ return 0;
case C_TOKEN( pt ):
mnPtIndex = rAttribs.getInteger( XML_idx, -1 );
- return true;
+ return this;
}
break;
case C_TOKEN( pt ):
- return (nElement == C_TOKEN( v ));
+ switch( nElement )
+ {
+ case C_TOKEN( v ):
+ return this;
+ }
+ break;
}
- return false;
+ return 0;
}
void DoubleSequenceContext::onEndElement( const OUString& rChars )
@@ -109,16 +119,26 @@ StringSequenceContext::~StringSequenceContext()
{
}
-ContextWrapper StringSequenceContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef StringSequenceContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
case C_TOKEN( multiLvlStrRef ):
- return (nElement == C_TOKEN( f ));
+ switch( nElement )
+ {
+ case C_TOKEN( f ):
+ return this;
+ }
+ break;
case C_TOKEN( strRef ):
- return (nElement == C_TOKEN( f )) ||
- (nElement == C_TOKEN( strCache ));
+ switch( nElement )
+ {
+ case C_TOKEN( f ):
+ case C_TOKEN( strCache ):
+ return this;
+ }
+ break;
case C_TOKEN( strCache ):
case C_TOKEN( strLit ):
@@ -126,17 +146,22 @@ ContextWrapper StringSequenceContext::onCreateContext( sal_Int32 nElement, const
{
case C_TOKEN( ptCount ):
mrModel.mnPointCount = rAttribs.getInteger( XML_val, -1 );
- return false;
+ return 0;
case C_TOKEN( pt ):
mnPtIndex = rAttribs.getInteger( XML_idx, -1 );
- return true;
+ return this;
}
break;
case C_TOKEN( pt ):
- return (nElement == C_TOKEN( v ));
+ switch( nElement )
+ {
+ case C_TOKEN( v ):
+ return this;
+ }
+ break;
}
- return false;
+ return 0;
}
void StringSequenceContext::onEndElement( const OUString& rChars )
@@ -164,7 +189,7 @@ DataSourceContext::~DataSourceContext()
{
}
-ContextWrapper DataSourceContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef DataSourceContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
{
switch( getCurrentElement() )
{
@@ -199,7 +224,7 @@ ContextWrapper DataSourceContext::onCreateContext( sal_Int32 nElement, const Att
}
break;
}
- return false;
+ return 0;
}
// ============================================================================
diff --git a/oox/source/drawingml/chart/datasourceconverter.cxx b/oox/source/drawingml/chart/datasourceconverter.cxx
index be55030f7cef..56a0cda06386 100644
--- a/oox/source/drawingml/chart/datasourceconverter.cxx
+++ b/oox/source/drawingml/chart/datasourceconverter.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/chart2/XChartDocument.hpp>
#include "oox/drawingml/chart/chartconverter.hxx"
#include "oox/drawingml/chart/datasourcemodel.hxx"
+#include "properties.hxx"
using ::rtl::OUString;
using ::com::sun::star::uno::Reference;
@@ -60,7 +61,7 @@ Reference< XDataSequence > DataSequenceConverter::createDataSequence( const OUSt
// set sequence role
PropertySet aSeqProp( xDataSeq );
- aSeqProp.setProperty( CREATE_OUSTRING( "Role" ), rRole );
+ aSeqProp.setProperty( PROP_Role, rRole );
return xDataSeq;
}
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index 79c74d4c52db..e758ebcda45c 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -42,6 +42,7 @@
#include "oox/drawingml/textparagraph.hxx"
#include "oox/drawingml/theme.hxx"
#include "oox/drawingml/chart/chartspacemodel.hxx"
+#include "properties.hxx"
#include "tokens.hxx"
using ::rtl::OStringBuffer;
@@ -560,12 +561,12 @@ static const ObjectTypeFormatEntry spObjTypeFormatEntries[] =
// ----------------------------------------------------------------------------
-const sal_Char* const sppcCommonLineNames[] = { "LineStyle", "LineWidth", "LineColor", "LineTransparence", "LineDashName", "", "", "", "", "", "", "", 0 };
-const sal_Char* const sppcLinearLineNames[] = { "LineStyle", "LineWidth", "Color", "Transparency", "LineDashName", "", "", "", "", "", "", "", 0 };
-const sal_Char* const sppcFilledLineNames[] = { "BorderStyle", "BorderWidth", "BorderColor", "BorderTransparency", "BorderDashName", "", "", "", "", "", "", "", 0 };
+const sal_Int32 spnCommonLineIds[ LineId_END ] = { PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, PROP_LineDashName, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID };
+const sal_Int32 spnLinearLineIds[ LineId_END ] = { PROP_LineStyle, PROP_LineWidth, PROP_Color, PROP_Transparency, PROP_LineDashName, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID };
+const sal_Int32 spnFilledLineIds[ LineId_END ] = { PROP_BorderStyle, PROP_BorderWidth, PROP_BorderColor, PROP_BorderTransparency, PROP_BorderDashName, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID };
-const sal_Char* const sppcCommonFillNames[] = { "FillStyle", "FillColor", "FillTransparence", "FillGradientName", "FillBitmapName", "FillBitmapMode", "", "", "", "", "", "", "", "", 0 };
-const sal_Char* const sppcFilledFillNames[] = { "FillStyle", "Color", "Transparency", "GradientName", "FillBitmapName", "FillBitmapMode", "", "", "", "", "", "", "", "", 0 };
+const sal_Int32 spnCommonFillIds[ FillId_END ] = { PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_FillGradientName, PROP_FillBitmapName, PROP_FillBitmapMode, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID };
+const sal_Int32 spnFilledFillIds[ FillId_END ] = { PROP_FillStyle, PROP_Color, PROP_Transparency, PROP_GradientName, PROP_FillBitmapName, PROP_FillBitmapMode, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID };
} // namespace
@@ -619,7 +620,7 @@ public:
private:
LinePropertiesPtr mxAutoLine; /// Automatic line properties.
- LinePropertyNames& mrLinePropNames; /// Property names for border/line formatting.
+ LinePropertyIds& mrLinePropIds; /// Property identifiers for border/line formatting.
};
// ----------------------------------------------------------------------------
@@ -640,7 +641,7 @@ public:
private:
FillPropertiesPtr mxAutoFill; /// Automatic fill properties.
- FillPropertyNames& mrFillPropNames; /// Property names for fill formatting.
+ FillPropertyIds& mrFillPropIds; /// Property identifiers for fill formatting.
};
// ----------------------------------------------------------------------------
@@ -743,11 +744,11 @@ struct ObjectFormatterData
const XmlFilterBase& mrFilter; /// Base filter object.
ObjectTypeFormatterMap maTypeFormatters; /// Formatters for all types of objects in a chart.
ModelObjectContainer maObjContainer; /// Container for named drawing formatting (dashes, gradients, bitmaps).
- LinePropertyNames maCommonLineNames; /// Property names for common border formatting.
- LinePropertyNames maLinearLineNames; /// Property names for line formatting of linear series.
- LinePropertyNames maFilledLineNames; /// Property names for line formatting of filled series.
- FillPropertyNames maCommonFillNames; /// Property names for common area fill.
- FillPropertyNames maFilledFillNames; /// Property names for area fill of filled series.
+ LinePropertyIds maCommonLineIds; /// Property identifiers for common border formatting.
+ LinePropertyIds maLinearLineIds; /// Property identifiers for line formatting of linear series.
+ LinePropertyIds maFilledLineIds; /// Property identifiers for line formatting of filled series.
+ FillPropertyIds maCommonFillIds; /// Property identifiers for common area fill.
+ FillPropertyIds maFilledFillIds; /// Property identifiers for area fill of filled series.
Reference< XNumberFormats > mxNumFmts; /// Number formats collection of container document.
Reference< XNumberFormatTypes > mxNumTypes; /// Number format types collection of container document.
Locale maEnUsLocale; /// Locale struct containing en-US.
@@ -761,8 +762,8 @@ struct ObjectFormatterData
ObjectTypeFormatter* getTypeFormatter( ObjectType eObjType );
- LinePropertyNames& getLinePropertyNames( PropertyType ePropType );
- FillPropertyNames& getFillPropertyNames( PropertyType ePropType );
+ LinePropertyIds& getLinePropertyIds( PropertyType ePropType );
+ FillPropertyIds& getFillPropertyIds( PropertyType ePropType );
};
// ============================================================================
@@ -861,7 +862,7 @@ sal_Int32 DetailFormatterBase::getSchemeColor( sal_Int32 nColorToken, sal_Int32
LineFormatter::LineFormatter( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry, PropertyType ePropType ) :
DetailFormatterBase( rData, pAutoFormatEntry ),
- mrLinePropNames( rData.getLinePropertyNames( ePropType ) )
+ mrLinePropIds( rData.getLinePropertyIds( ePropType ) )
{
if( pAutoFormatEntry )
{
@@ -883,14 +884,14 @@ void LineFormatter::convertFormatting( PropertySet& rPropSet, const ModelRef< Sh
aLineProps.assignUsed( *mxAutoLine );
if( rxShapeProp.is() )
aLineProps.assignUsed( rxShapeProp->getLineProperties() );
- aLineProps.pushToPropSet( rPropSet, mrLinePropNames, mrData.mrFilter, mrData.maObjContainer, getPhColor( nSeriesIdx ) );
+ aLineProps.pushToPropSet( rPropSet, mrLinePropIds, mrData.mrFilter, mrData.maObjContainer, getPhColor( nSeriesIdx ) );
}
// ============================================================================
FillFormatter::FillFormatter( ObjectFormatterData& rData, const AutoFormatEntry* pAutoFormatEntry, PropertyType ePropType ) :
DetailFormatterBase( rData, pAutoFormatEntry ),
- mrFillPropNames( rData.getFillPropertyNames( ePropType ) )
+ mrFillPropIds( rData.getFillPropertyIds( ePropType ) )
{
if( pAutoFormatEntry )
{
@@ -909,7 +910,7 @@ void FillFormatter::convertFormatting( PropertySet& rPropSet, const ModelRef< Sh
aFillProps.assignUsed( *mxAutoFill );
if( rxShapeProp.is() )
aFillProps.assignUsed( rxShapeProp->getFillProperties() );
- aFillProps.pushToPropSet( rPropSet, mrFillPropNames, mrData.mrFilter, mrData.maObjContainer, 0, getPhColor( nSeriesIdx ) );
+ aFillProps.pushToPropSet( rPropSet, mrFillPropIds, mrData.mrFilter, mrData.maObjContainer, 0, getPhColor( nSeriesIdx ) );
}
// ============================================================================
@@ -1028,11 +1029,11 @@ void ObjectTypeFormatter::convertAutomaticFill( PropertySet& rPropSet, sal_Int32
ObjectFormatterData::ObjectFormatterData( const XmlFilterBase& rFilter, const Reference< XChartDocument >& rxChartDoc, const ChartSpaceModel& rChartSpace ) :
mrFilter( rFilter ),
maObjContainer( Reference< XModel >( rxChartDoc, UNO_QUERY ) ),
- maCommonLineNames( sppcCommonLineNames, true, false ),
- maLinearLineNames( sppcLinearLineNames, true, false ),
- maFilledLineNames( sppcFilledLineNames, true, false ),
- maCommonFillNames( sppcCommonFillNames, true, true, false ),
- maFilledFillNames( sppcFilledFillNames, true, true, false ),
+ maCommonLineIds( spnCommonLineIds, true, false ),
+ maLinearLineIds( spnLinearLineIds, true, false ),
+ maFilledLineIds( spnFilledLineIds, true, false ),
+ maCommonFillIds( spnCommonFillIds, true, true, false ),
+ maFilledFillIds( spnFilledFillIds, true, true, false ),
maEnUsLocale( CREATE_OUSTRING( "en" ), CREATE_OUSTRING( "US" ), OUString() ),
mnMaxSeriesIdx( -1 )
{
@@ -1058,26 +1059,26 @@ ObjectTypeFormatter* ObjectFormatterData::getTypeFormatter( ObjectType eObjType
return maTypeFormatters.get( eObjType ).get();
}
-LinePropertyNames& ObjectFormatterData::getLinePropertyNames( PropertyType ePropType )
+LinePropertyIds& ObjectFormatterData::getLinePropertyIds( PropertyType ePropType )
{
switch( ePropType )
{
- case PROPERTYTYPE_COMMON: return maCommonLineNames;
- case PROPERTYTYPE_LINEARSERIES: return maLinearLineNames;
- case PROPERTYTYPE_FILLEDSERIES: return maFilledLineNames;
+ case PROPERTYTYPE_COMMON: return maCommonLineIds;
+ case PROPERTYTYPE_LINEARSERIES: return maLinearLineIds;
+ case PROPERTYTYPE_FILLEDSERIES: return maFilledLineIds;
}
- return maCommonLineNames;
+ return maCommonLineIds;
}
-FillPropertyNames& ObjectFormatterData::getFillPropertyNames( PropertyType ePropType )
+FillPropertyIds& ObjectFormatterData::getFillPropertyIds( PropertyType ePropType )
{
switch( ePropType )
{
- case PROPERTYTYPE_COMMON: return maCommonFillNames;
- case PROPERTYTYPE_LINEARSERIES: return maCommonFillNames;
- case PROPERTYTYPE_FILLEDSERIES: return maFilledFillNames;
+ case PROPERTYTYPE_COMMON: return maCommonFillIds;
+ case PROPERTYTYPE_LINEARSERIES: return maCommonFillIds;
+ case PROPERTYTYPE_FILLEDSERIES: return maFilledFillIds;
}
- return maCommonFillNames;
+ return maCommonFillIds;
}
// ============================================================================
@@ -1132,11 +1133,11 @@ void ObjectFormatter::convertTextRotation( PropertySet& rPropSet, const ModelRef
// Chart2 expects rotation angle as double value in range of [0,360)
double fAngle = static_cast< double >( rxTextProp->getTextProperties().moRotation.get( 0 ) ) / 60000.0;
while( fAngle < 0.0 ) fAngle += 360.0;
- rPropSet.setProperty( CREATE_OUSTRING( "TextRotation" ), fAngle );
+ rPropSet.setProperty( PROP_TextRotation, fAngle );
sal_Int32 nVert = rxTextProp->getTextProperties().moVert.get( XML_horz );
bool bStacked = (nVert == XML_wordArtVert) || (nVert == XML_wordArtVertRtl);
- rPropSet.setProperty( CREATE_OUSTRING( "StackCharacters" ), bStacked );
+ rPropSet.setProperty( PROP_StackCharacters, bStacked );
}
}
@@ -1144,10 +1145,10 @@ void ObjectFormatter::convertNumberFormat( PropertySet& rPropSet, const NumberFo
{
if( mxData->mxNumFmts.is() )
{
- OUString aPropName = bPercentFormat ? CREATE_OUSTRING( "PercentageNumberFormat" ) : CREATE_OUSTRING( "NumberFormat" );
+ sal_Int32 nPropId = bPercentFormat ? PROP_PercentageNumberFormat : PROP_NumberFormat;
if( rNumberFormat.mbSourceLinked || (rNumberFormat.maFormatCode.getLength() == 0) )
{
- rPropSet.setProperty( aPropName, Any() );
+ rPropSet.setProperty( nPropId, Any() );
}
else try
{
@@ -1155,7 +1156,7 @@ void ObjectFormatter::convertNumberFormat( PropertySet& rPropSet, const NumberFo
mxData->mxNumTypes->getStandardIndex( mxData->maFromLocale ) :
mxData->mxNumFmts->addNewConverted( rNumberFormat.maFormatCode, mxData->maEnUsLocale, mxData->maFromLocale );
if( nIndex >= 0 )
- rPropSet.setProperty( aPropName, nIndex );
+ rPropSet.setProperty( nPropId, nIndex );
}
catch( Exception& )
{
diff --git a/oox/source/drawingml/chart/plotareacontext.cxx b/oox/source/drawingml/chart/plotareacontext.cxx
index 148861cf3798..789b341cccf0 100644
--- a/oox/source/drawingml/chart/plotareacontext.cxx
+++ b/oox/source/drawingml/chart/plotareacontext.cxx
@@ -36,7 +36,7 @@
#include "oox/drawingml/chart/typegroupcontext.hxx"
using ::oox::core::ContextHandler2Helper;
-using ::oox::core::ContextWrapper;
+using ::oox::core::ContextHandlerRef;
namespace oox {
namespace drawingml {
@@ -53,7 +53,7 @@ View3DContext::~View3DContext()
{
}
-ContextWrapper View3DContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef View3DContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -62,29 +62,29 @@ ContextWrapper View3DContext::onCreateContext( sal_Int32 nElement, const Attribu
{
case C_TOKEN( depthPercent ):
mrModel.mnDepthPercent = rAttribs.getInteger( XML_val, 100 );
- return false;
+ return 0;
case C_TOKEN( hPercent ):
mrModel.monHeightPercent = rAttribs.getInteger( XML_val, 100 );
- return false;
+ return 0;
case C_TOKEN( perspective ):
mrModel.mnPerspective = rAttribs.getInteger( XML_val, 30 );
- return false;
+ return 0;
case C_TOKEN( rAngAx ):
// default is 'false', not 'true' as specified
mrModel.mbRightAngled = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( rotX ):
// default value dependent on chart type
mrModel.monRotationX = rAttribs.getInteger( XML_val );
- return false;
+ return 0;
case C_TOKEN( rotY ):
// default value dependent on chart type
mrModel.monRotationY = rAttribs.getInteger( XML_val );
- return false;
+ return 0;
}
break;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -98,7 +98,7 @@ WallFloorContext::~WallFloorContext()
{
}
-ContextWrapper WallFloorContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef WallFloorContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
{
switch( getCurrentElement() )
{
@@ -112,7 +112,7 @@ ContextWrapper WallFloorContext::onCreateContext( sal_Int32 nElement, const Attr
}
break;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -126,7 +126,7 @@ PlotAreaContext::~PlotAreaContext()
{
}
-ContextWrapper PlotAreaContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef PlotAreaContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
{
switch( getCurrentElement() )
{
@@ -174,7 +174,7 @@ ContextWrapper PlotAreaContext::onCreateContext( sal_Int32 nElement, const Attri
}
break;
}
- return false;
+ return 0;
}
// ============================================================================
diff --git a/oox/source/drawingml/chart/plotareaconverter.cxx b/oox/source/drawingml/chart/plotareaconverter.cxx
index f3baa2cf28d0..1790ff5a7ad5 100644
--- a/oox/source/drawingml/chart/plotareaconverter.cxx
+++ b/oox/source/drawingml/chart/plotareaconverter.cxx
@@ -38,6 +38,7 @@
#include "oox/drawingml/chart/axisconverter.hxx"
#include "oox/drawingml/chart/plotareamodel.hxx"
#include "oox/drawingml/chart/typegroupconverter.hxx"
+#include "properties.hxx"
using ::rtl::OUString;
using ::com::sun::star::uno::Reference;
@@ -69,15 +70,6 @@ struct AxesSetModel
inline ~AxesSetModel() {}
};
-void lclCopyOrCreate( AxesSetModel::AxisMap& orToAxes, const AxesSetModel::AxisMap& rFromAxes, sal_Int32 nAxisIdx, sal_Int32 nDefTypeId )
-{
- AxesSetModel::AxisMap::mapped_type xAxis = rFromAxes.get( nAxisIdx );
- if( xAxis.get() )
- orToAxes[ nAxisIdx ] = xAxis;
- else
- orToAxes.create( nAxisIdx, nDefTypeId ).mbDeleted = true; // missing axis is invisible
-}
-
// ============================================================================
/** Axes set converter. This is a helper class for the plot area converter. */
@@ -121,6 +113,14 @@ AxesSetConverter::~AxesSetConverter()
{
}
+ModelRef< AxisModel > lclGetOrCreateAxis( const AxesSetModel::AxisMap& rFromAxes, sal_Int32 nAxisIdx, sal_Int32 nDefTypeId )
+{
+ ModelRef< AxisModel > xAxis = rFromAxes.get( nAxisIdx );
+ if( !xAxis )
+ xAxis.create( nDefTypeId ).mbDeleted = true; // missing axis is invisible
+ return xAxis;
+}
+
void AxesSetConverter::convertFromModel( const Reference< XDiagram >& rxDiagram,
View3DModel& rView3DModel, sal_Int32 nAxesSetIdx, bool bSupportsVaryColorsByPoint )
{
@@ -168,22 +168,24 @@ void AxesSetConverter::convertFromModel( const Reference< XDiagram >& rxDiagram,
aView3DConv.convertFromModel( rxDiagram, rFirstTypeGroup );
}
- /* Convert all chart type groups. Each type group will add its series to
- the data provider attached to the chart document. */
+ /* Convert all chart type groups. Each type group will add its series
+ to the data provider attached to the chart document. */
if( xCoordSystem.is() )
{
// create missing axis models
- AxesSetModel::AxisMap aAxes;
- lclCopyOrCreate( aAxes, mrModel.maAxes, API_X_AXIS, rFirstTypeGroup.getTypeInfo().mbCategoryAxis ? C_TOKEN( catAx ) : C_TOKEN( valAx ));
- lclCopyOrCreate( aAxes, mrModel.maAxes, API_Y_AXIS, C_TOKEN( valAx ) );
- if( rFirstTypeGroup.isDeep3dChart() )
- lclCopyOrCreate( aAxes, mrModel.maAxes, API_Z_AXIS, C_TOKEN( serAx ) );
+ ModelRef< AxisModel > xXAxis = lclGetOrCreateAxis( mrModel.maAxes, API_X_AXIS, rFirstTypeGroup.getTypeInfo().mbCategoryAxis ? C_TOKEN( catAx ) : C_TOKEN( valAx ) );
+ ModelRef< AxisModel > xYAxis = lclGetOrCreateAxis( mrModel.maAxes, API_Y_AXIS, C_TOKEN( valAx ) );
// convert all axes
- for( AxesSetModel::AxisMap::iterator aAIt = aAxes.begin(), aAEnd = aAxes.end(); aAIt != aAEnd; ++aAIt )
+ AxisConverter aXAxisConv( *this, *xXAxis );
+ aXAxisConv.convertFromModel( xCoordSystem, rFirstTypeGroup, xYAxis.get(), nAxesSetIdx, API_X_AXIS );
+ AxisConverter aYAxisConv( *this, *xYAxis );
+ aYAxisConv.convertFromModel( xCoordSystem, rFirstTypeGroup, xXAxis.get(), nAxesSetIdx, API_Y_AXIS );
+ if( rFirstTypeGroup.isDeep3dChart() )
{
- AxisConverter aAxisConv( *this, *aAIt->second );
- aAxisConv.convertFromModel( xCoordSystem, rFirstTypeGroup, nAxesSetIdx, aAIt->first );
+ ModelRef< AxisModel > xZAxis = lclGetOrCreateAxis( mrModel.maAxes, API_Z_AXIS, C_TOKEN( serAx ) );
+ AxisConverter aZAxisConv( *this, *xZAxis );
+ aZAxisConv.convertFromModel( xCoordSystem, rFirstTypeGroup, 0, nAxesSetIdx, API_Z_AXIS );
}
// convert all chart type groups, this converts all series data and formatting
@@ -254,23 +256,24 @@ void View3DConverter::convertFromModel( const Reference< XDiagram >& rxDiagram,
buggy here, the XML plugin of MSO 2003 writes the correct perspective in
the range from 0 to 100. We will emulate the wrong behaviour of MSO 2007. */
sal_Int32 nPerspective = getLimitedValue< sal_Int32, sal_Int32 >( mrModel.mnPerspective / 2, 0, 100 );
- // projection mode (parallel axes, if right-angled)
- cssd::ProjectionMode eProjMode = bRightAngled ? cssd::ProjectionMode_PARALLEL : cssd::ProjectionMode_PERSPECTIVE;
+ // projection mode (parallel axes, if right-angled, #i90360# or if perspective is at 0%)
+ bool bParallel = bRightAngled || (nPerspective == 0);
+ cssd::ProjectionMode eProjMode = bParallel ? cssd::ProjectionMode_PARALLEL : cssd::ProjectionMode_PERSPECTIVE;
// set rotation properties
- aPropSet.setProperty( CREATE_OUSTRING( "RotationVertical" ), nRotationY );
- aPropSet.setProperty( CREATE_OUSTRING( "RotationHorizontal" ), nRotationX );
- aPropSet.setProperty( CREATE_OUSTRING( "Perspective" ), nPerspective );
- aPropSet.setProperty( CREATE_OUSTRING( "RightAngledAxes" ), bRightAngled );
- aPropSet.setProperty( CREATE_OUSTRING( "D3DScenePerspective" ), eProjMode );
+ aPropSet.setProperty( PROP_RotationVertical, nRotationY );
+ aPropSet.setProperty( PROP_RotationHorizontal, nRotationX );
+ aPropSet.setProperty( PROP_Perspective, nPerspective );
+ aPropSet.setProperty( PROP_RightAngledAxes, bRightAngled );
+ aPropSet.setProperty( PROP_D3DScenePerspective, eProjMode );
// set light settings
- aPropSet.setProperty( CREATE_OUSTRING( "D3DSceneShadeMode" ), cssd::ShadeMode_FLAT );
- aPropSet.setProperty( CREATE_OUSTRING( "D3DSceneAmbientColor" ), nAmbientColor );
- aPropSet.setProperty( CREATE_OUSTRING( "D3DSceneLightOn1" ), false );
- aPropSet.setProperty( CREATE_OUSTRING( "D3DSceneLightOn2" ), true );
- aPropSet.setProperty( CREATE_OUSTRING( "D3DSceneLightColor2" ), nLightColor );
- aPropSet.setProperty( CREATE_OUSTRING( "D3DSceneLightDirection2" ), cssd::Direction3D( 0.2, 0.4, 1.0 ) );
+ aPropSet.setProperty( PROP_D3DSceneShadeMode, cssd::ShadeMode_FLAT );
+ aPropSet.setProperty( PROP_D3DSceneAmbientColor, nAmbientColor );
+ aPropSet.setProperty( PROP_D3DSceneLightOn1, false );
+ aPropSet.setProperty( PROP_D3DSceneLightOn2, true );
+ aPropSet.setProperty( PROP_D3DSceneLightColor2, nLightColor );
+ aPropSet.setProperty( PROP_D3DSceneLightDirection2, cssd::Direction3D( 0.2, 0.4, 1.0 ) );
}
// ============================================================================
diff --git a/oox/source/drawingml/chart/seriescontext.cxx b/oox/source/drawingml/chart/seriescontext.cxx
index cd09ceb74268..6367247cf9c0 100644
--- a/oox/source/drawingml/chart/seriescontext.cxx
+++ b/oox/source/drawingml/chart/seriescontext.cxx
@@ -38,7 +38,7 @@
using ::rtl::OUString;
using ::oox::core::ContextHandler2;
using ::oox::core::ContextHandler2Helper;
-using ::oox::core::ContextWrapper;
+using ::oox::core::ContextHandlerRef;
namespace oox {
namespace drawingml {
@@ -48,7 +48,7 @@ namespace chart {
namespace {
-ContextWrapper lclDataLabelSharedCreateContext(
+ContextHandlerRef lclDataLabelSharedCreateContext(
ContextHandler2& rContext, sal_Int32 nElement, const AttributeList& rAttribs, DataLabelModelBase& orModel )
{
if( rContext.isRootElement() ) switch( nElement )
@@ -56,40 +56,40 @@ ContextWrapper lclDataLabelSharedCreateContext(
case C_TOKEN( delete ):
// default is 'false', not 'true' as specified
orModel.mbDeleted = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( dLblPos ):
orModel.monLabelPos = rAttribs.getToken( XML_val, XML_TOKEN_INVALID );
- return false;
+ return 0;
case C_TOKEN( numFmt ):
orModel.maNumberFormat.setAttributes( rAttribs );
- return false;
+ return 0;
case C_TOKEN( showBubbleSize ):
orModel.mobShowBubbleSize = rAttribs.getBool( XML_val );
- return false;
+ return 0;
case C_TOKEN( showCatName ):
orModel.mobShowCatName = rAttribs.getBool( XML_val );
- return false;
+ return 0;
case C_TOKEN( showLegendKey ):
orModel.mobShowLegendKey = rAttribs.getBool( XML_val );
- return false;
+ return 0;
case C_TOKEN( showPercent ):
orModel.mobShowPercent = rAttribs.getBool( XML_val );
- return false;
+ return 0;
case C_TOKEN( showSerName ):
orModel.mobShowSerName = rAttribs.getBool( XML_val );
- return false;
+ return 0;
case C_TOKEN( showVal ):
orModel.mobShowVal = rAttribs.getBool( XML_val );
- return false;
+ return 0;
case C_TOKEN( separator ):
// collect separator text in onEndElement()
- return true;
+ return &rContext;
case C_TOKEN( spPr ):
return new ShapePropertiesContext( rContext, orModel.mxShapeProp.create() );
case C_TOKEN( txPr ):
return new TextBodyContext( rContext, orModel.mxTextProp.create() );
}
- return false;
+ return 0;
}
void lclDataLabelSharedEndElement( ContextHandler2& rContext, const OUString& rChars, DataLabelModelBase& orModel )
@@ -115,13 +115,13 @@ DataLabelContext::~DataLabelContext()
{
}
-ContextWrapper DataLabelContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef DataLabelContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
case C_TOKEN( idx ):
mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
- return false;
+ return 0;
case C_TOKEN( layout ):
return new LayoutContext( *this, mrModel.mxLayout.create() );
case C_TOKEN( tx ):
@@ -146,7 +146,7 @@ DataLabelsContext::~DataLabelsContext()
{
}
-ContextWrapper DataLabelsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef DataLabelsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
@@ -157,7 +157,7 @@ ContextWrapper DataLabelsContext::onCreateContext( sal_Int32 nElement, const Att
case C_TOKEN( showLeaderLines ):
// default is 'false', not 'true' as specified
mrModel.mbShowLeaderLines = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
}
return lclDataLabelSharedCreateContext( *this, nElement, rAttribs, mrModel );
}
@@ -178,34 +178,34 @@ ErrorBarContext::~ErrorBarContext()
{
}
-ContextWrapper ErrorBarContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef ErrorBarContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
case C_TOKEN( errBarType ):
mrModel.mnTypeId = rAttribs.getToken( XML_val, XML_both );
- return false;
+ return 0;
case C_TOKEN( errDir ):
mrModel.mnDirection = rAttribs.getToken( XML_val, XML_TOKEN_INVALID );
- return false;
+ return 0;
case C_TOKEN( errValType ):
mrModel.mnValueType = rAttribs.getToken( XML_val, XML_fixedVal );
- return false;
+ return 0;
case C_TOKEN( minus ):
return new DataSourceContext( *this, mrModel.maSources.create( ErrorBarModel::MINUS ) );
case C_TOKEN( noEndCap ):
// default is 'false', not 'true' as specified
mrModel.mbNoEndCap = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( plus ):
return new DataSourceContext( *this, mrModel.maSources.create( ErrorBarModel::PLUS ) );
case C_TOKEN( spPr ):
return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
case C_TOKEN( val ):
mrModel.mfValue = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -219,7 +219,7 @@ TrendlineLabelContext::~TrendlineLabelContext()
{
}
-ContextWrapper TrendlineLabelContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef TrendlineLabelContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
@@ -227,7 +227,7 @@ ContextWrapper TrendlineLabelContext::onCreateContext( sal_Int32 nElement, const
return new LayoutContext( *this, mrModel.mxLayout.create() );
case C_TOKEN( numFmt ):
mrModel.maNumberFormat.setAttributes( rAttribs );
- return false;
+ return 0;
case C_TOKEN( spPr ):
return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
case C_TOKEN( tx ):
@@ -235,7 +235,7 @@ ContextWrapper TrendlineLabelContext::onCreateContext( sal_Int32 nElement, const
case C_TOKEN( txPr ):
return new TextBodyContext( *this, mrModel.mxTextProp.create() );
}
- return false;
+ return 0;
}
// ============================================================================
@@ -249,44 +249,44 @@ TrendlineContext::~TrendlineContext()
{
}
-ContextWrapper TrendlineContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef TrendlineContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
case C_TOKEN( backward ):
mrModel.mfBackward = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
case C_TOKEN( dispEq ):
// default is 'false', not 'true' as specified
mrModel.mbDispEquation = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( dispRSqr ):
// default is 'false', not 'true' as specified
mrModel.mbDispRSquared = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( forward ):
mrModel.mfForward = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
case C_TOKEN( intercept ):
mrModel.mfIntercept = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
case C_TOKEN( name ):
- return true;
+ return this; // collect name in onEndElement()
case C_TOKEN( order ):
mrModel.mnOrder = rAttribs.getInteger( XML_val, 2 );
- return false;
+ return 0;
case C_TOKEN( period ):
mrModel.mnPeriod = rAttribs.getInteger( XML_val, 2 );
- return false;
+ return 0;
case C_TOKEN( spPr ):
return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
case C_TOKEN( trendlineLbl ):
return new TrendlineLabelContext( *this, mrModel.mxLabel.create() );
case C_TOKEN( trendlineType ):
mrModel.mnTypeId = rAttribs.getToken( XML_val, XML_linear );
- return false;
+ return 0;
}
- return false;
+ return 0;
}
void TrendlineContext::onEndElement( const ::rtl::OUString& rChars )
@@ -310,7 +310,7 @@ DataPointContext::~DataPointContext()
{
}
-ContextWrapper DataPointContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef DataPointContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -319,20 +319,20 @@ ContextWrapper DataPointContext::onCreateContext( sal_Int32 nElement, const Attr
{
case C_TOKEN( bubble3D ):
mrModel.mobBubble3d = rAttribs.getBool( XML_val );
- return false;
+ return 0;
case C_TOKEN( explosion ):
// if the 'val' attribute is missing, series explosion remains unchanged
mrModel.monExplosion = rAttribs.getInteger( XML_val );
- return false;
+ return 0;
case C_TOKEN( idx ):
mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
- return false;
+ return 0;
case C_TOKEN( invertIfNegative ):
// default is 'false', not 'true' as specified (value not derived from series!)
mrModel.mbInvertNeg = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( marker ):
- return true;
+ return this;
case C_TOKEN( spPr ):
return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
}
@@ -343,16 +343,16 @@ ContextWrapper DataPointContext::onCreateContext( sal_Int32 nElement, const Attr
{
case C_TOKEN( size ):
mrModel.monMarkerSize = rAttribs.getInteger( XML_val, 5 );
- return false;
+ return 0;
case C_TOKEN( spPr ):
return new ShapePropertiesContext( *this, mrModel.mxMarkerProp.create() );
case C_TOKEN( symbol ):
mrModel.monMarkerSymbol = rAttribs.getToken( XML_val, XML_none );
- return false;
+ return 0;
}
break;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -366,7 +366,7 @@ SeriesContextBase::~SeriesContextBase()
{
}
-ContextWrapper SeriesContextBase::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef SeriesContextBase::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -375,10 +375,10 @@ ContextWrapper SeriesContextBase::onCreateContext( sal_Int32 nElement, const Att
{
case C_TOKEN( idx ):
mrModel.mnIndex = rAttribs.getInteger( XML_val, -1 );
- return false;
+ return 0;
case C_TOKEN( order ):
mrModel.mnOrder = rAttribs.getInteger( XML_val, -1 );
- return false;
+ return 0;
case C_TOKEN( spPr ):
return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
case C_TOKEN( tx ):
@@ -391,16 +391,16 @@ ContextWrapper SeriesContextBase::onCreateContext( sal_Int32 nElement, const Att
{
case C_TOKEN( size ):
mrModel.mnMarkerSize = rAttribs.getInteger( XML_val, 5 );
- return false;
+ return 0;
case C_TOKEN( spPr ):
return new ShapePropertiesContext( *this, mrModel.mxMarkerProp.create() );
case C_TOKEN( symbol ):
mrModel.mnMarkerSymbol = rAttribs.getToken( XML_val, XML_none );
- return false;
+ return 0;
}
break;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -414,7 +414,7 @@ AreaSeriesContext::~AreaSeriesContext()
{
}
-ContextWrapper AreaSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef AreaSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -450,7 +450,7 @@ BarSeriesContext::~BarSeriesContext()
{
}
-ContextWrapper BarSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef BarSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -468,11 +468,11 @@ ContextWrapper BarSeriesContext::onCreateContext( sal_Int32 nElement, const Attr
case C_TOKEN( invertIfNegative ):
// default is 'false', not 'true' as specified
mrModel.mbInvertNeg = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( shape ):
// missing attribute does not change shape type to 'box' as specified
mrModel.monShape = rAttribs.getToken( XML_val );
- return false;
+ return 0;
case C_TOKEN( trendline ):
return new TrendlineContext( *this, mrModel.maTrendlines.create() );
case C_TOKEN( val ):
@@ -494,7 +494,7 @@ BubbleSeriesContext::~BubbleSeriesContext()
{
}
-ContextWrapper BubbleSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef BubbleSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -504,7 +504,7 @@ ContextWrapper BubbleSeriesContext::onCreateContext( sal_Int32 nElement, const A
case C_TOKEN( bubble3D ):
// default is 'false', not 'true' as specified
mrModel.mbBubble3d = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( bubbleSize ):
return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::POINTS ) );
case C_TOKEN( dLbls ):
@@ -516,7 +516,7 @@ ContextWrapper BubbleSeriesContext::onCreateContext( sal_Int32 nElement, const A
case C_TOKEN( invertIfNegative ):
// default is 'false', not 'true' as specified
mrModel.mbInvertNeg = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( trendline ):
return new TrendlineContext( *this, mrModel.maTrendlines.create() );
case C_TOKEN( xVal ):
@@ -540,7 +540,7 @@ LineSeriesContext::~LineSeriesContext()
{
}
-ContextWrapper LineSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef LineSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -556,11 +556,11 @@ ContextWrapper LineSeriesContext::onCreateContext( sal_Int32 nElement, const Att
case C_TOKEN( errBars ):
return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
case C_TOKEN( marker ):
- return true;
+ return this;
case C_TOKEN( smooth ):
// default is 'false', not 'true' as specified
mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( trendline ):
return new TrendlineContext( *this, mrModel.maTrendlines.create() );
case C_TOKEN( val ):
@@ -582,7 +582,7 @@ PieSeriesContext::~PieSeriesContext()
{
}
-ContextWrapper PieSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef PieSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -597,7 +597,7 @@ ContextWrapper PieSeriesContext::onCreateContext( sal_Int32 nElement, const Attr
return new DataPointContext( *this, mrModel.maPoints.create() );
case C_TOKEN( explosion ):
mrModel.mnExplosion = rAttribs.getInteger( XML_val, 0 );
- return false;
+ return 0;
case C_TOKEN( val ):
return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
}
@@ -617,7 +617,7 @@ RadarSeriesContext::~RadarSeriesContext()
{
}
-ContextWrapper RadarSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef RadarSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -631,11 +631,11 @@ ContextWrapper RadarSeriesContext::onCreateContext( sal_Int32 nElement, const At
case C_TOKEN( dPt ):
return new DataPointContext( *this, mrModel.maPoints.create() );
case C_TOKEN( marker ):
- return true;
+ return this;
case C_TOKEN( smooth ):
// default is 'false', not 'true' as specified
mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( val ):
return new DataSourceContext( *this, mrModel.maSources.create( SeriesModel::VALUES ) );
}
@@ -655,7 +655,7 @@ ScatterSeriesContext::~ScatterSeriesContext()
{
}
-ContextWrapper ScatterSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef ScatterSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -669,11 +669,11 @@ ContextWrapper ScatterSeriesContext::onCreateContext( sal_Int32 nElement, const
case C_TOKEN( errBars ):
return new ErrorBarContext( *this, mrModel.maErrorBars.create() );
case C_TOKEN( marker ):
- return true;
+ return this;
case C_TOKEN( smooth ):
// default is 'false', not 'true' as specified
mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( trendline ):
return new TrendlineContext( *this, mrModel.maTrendlines.create() );
case C_TOKEN( xVal ):
@@ -697,7 +697,7 @@ SurfaceSeriesContext::~SurfaceSeriesContext()
{
}
-ContextWrapper SurfaceSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef SurfaceSeriesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
diff --git a/oox/source/drawingml/chart/seriesconverter.cxx b/oox/source/drawingml/chart/seriesconverter.cxx
index 621108a2d019..c58cba9de8b2 100644
--- a/oox/source/drawingml/chart/seriesconverter.cxx
+++ b/oox/source/drawingml/chart/seriesconverter.cxx
@@ -42,6 +42,7 @@
#include "oox/drawingml/chart/titleconverter.hxx"
#include "oox/drawingml/chart/typegroupconverter.hxx"
#include "oox/drawingml/chart/typegroupmodel.hxx"
+#include "properties.hxx"
using ::rtl::OUString;
using ::com::sun::star::uno::Reference;
@@ -127,7 +128,7 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt
if( bHasAnyElement || rDataLabel.mbDeleted )
{
DataPointLabel aPointLabel( bShowValue, bShowPercent, bShowCateg, bShowSymbol );
- rPropSet.setProperty( CREATE_OUSTRING( "Label" ), aPointLabel );
+ rPropSet.setProperty( PROP_Label, aPointLabel );
}
if( !rDataLabel.mbDeleted )
@@ -140,7 +141,7 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt
// data label separator (do not overwrite series separator, if no explicit point separator is present)
if( bDataSeriesLabel || rDataLabel.moaSeparator.has() )
- rPropSet.setProperty( CREATE_OUSTRING( "LabelSeparator" ), rDataLabel.moaSeparator.get( CREATE_OUSTRING( "; " ) ) );
+ rPropSet.setProperty( PROP_LabelSeparator, rDataLabel.moaSeparator.get( CREATE_OUSTRING( "; " ) ) );
// data label placement (do not overwrite series placement, if no explicit point placement is present)
if( bDataSeriesLabel || rDataLabel.monLabelPos.has() )
@@ -159,7 +160,7 @@ void lclConvertLabelFormatting( PropertySet& rPropSet, ObjectFormatter& rFormatt
case XML_r: nPlacement = csscd::RIGHT; break;
case XML_bestFit: nPlacement = csscd::AVOID_OVERLAP; break;
}
- rPropSet.setProperty( CREATE_OUSTRING( "LabelPlacement" ), nPlacement );
+ rPropSet.setProperty( PROP_LabelPlacement, nPlacement );
}
}
}
@@ -237,8 +238,8 @@ void ErrorBarConverter::convertFromModel( const Reference< XDataSeries >& rxData
PropertySet aBarProp( xErrorBar );
// plus/minus bars
- aBarProp.setProperty( CREATE_OUSTRING( "ShowPositiveError" ), bShowPos );
- aBarProp.setProperty( CREATE_OUSTRING( "ShowNegativeError" ), bShowNeg );
+ aBarProp.setProperty( PROP_ShowPositiveError, bShowPos );
+ aBarProp.setProperty( PROP_ShowNegativeError, bShowNeg );
// type of displayed error
namespace cssc = ::com::sun::star::chart;
@@ -247,7 +248,7 @@ void ErrorBarConverter::convertFromModel( const Reference< XDataSeries >& rxData
case XML_cust:
{
// #i87806# manual error bars
- aBarProp.setProperty( CREATE_OUSTRING( "ErrorBarStyle" ), cssc::ErrorBarStyle::FROM_DATA );
+ aBarProp.setProperty( PROP_ErrorBarStyle, cssc::ErrorBarStyle::FROM_DATA );
// attach data sequences to erorr bar
Reference< XDataSink > xDataSink( xErrorBar, UNO_QUERY );
if( xDataSink.is() )
@@ -277,21 +278,21 @@ void ErrorBarConverter::convertFromModel( const Reference< XDataSeries >& rxData
}
break;
case XML_fixedVal:
- aBarProp.setProperty( CREATE_OUSTRING( "ErrorBarStyle" ), cssc::ErrorBarStyle::ABSOLUTE );
- aBarProp.setProperty( CREATE_OUSTRING( "PositiveError" ), mrModel.mfValue );
- aBarProp.setProperty( CREATE_OUSTRING( "NegativeError" ), mrModel.mfValue );
+ aBarProp.setProperty( PROP_ErrorBarStyle, cssc::ErrorBarStyle::ABSOLUTE );
+ aBarProp.setProperty( PROP_PositiveError, mrModel.mfValue );
+ aBarProp.setProperty( PROP_NegativeError, mrModel.mfValue );
break;
case XML_percentage:
- aBarProp.setProperty( CREATE_OUSTRING( "ErrorBarStyle" ), cssc::ErrorBarStyle::RELATIVE );
- aBarProp.setProperty( CREATE_OUSTRING( "PositiveError" ), mrModel.mfValue );
- aBarProp.setProperty( CREATE_OUSTRING( "NegativeError" ), mrModel.mfValue );
+ aBarProp.setProperty( PROP_ErrorBarStyle, cssc::ErrorBarStyle::RELATIVE );
+ aBarProp.setProperty( PROP_PositiveError, mrModel.mfValue );
+ aBarProp.setProperty( PROP_NegativeError, mrModel.mfValue );
break;
case XML_stdDev:
- aBarProp.setProperty( CREATE_OUSTRING( "ErrorBarStyle" ), cssc::ErrorBarStyle::STANDARD_DEVIATION );
- aBarProp.setProperty( CREATE_OUSTRING( "Weight" ), mrModel.mfValue );
+ aBarProp.setProperty( PROP_ErrorBarStyle, cssc::ErrorBarStyle::STANDARD_DEVIATION );
+ aBarProp.setProperty( PROP_Weight, mrModel.mfValue );
break;
case XML_stdErr:
- aBarProp.setProperty( CREATE_OUSTRING( "ErrorBarStyle" ), cssc::ErrorBarStyle::STANDARD_ERROR );
+ aBarProp.setProperty( PROP_ErrorBarStyle, cssc::ErrorBarStyle::STANDARD_ERROR );
break;
default:
OSL_ENSURE( false, "ErrorBarConverter::convertFromModel - unknown error bar type" );
@@ -306,8 +307,8 @@ void ErrorBarConverter::convertFromModel( const Reference< XDataSeries >& rxData
PropertySet aSeriesProp( rxDataSeries );
switch( mrModel.mnDirection )
{
- case XML_x: aSeriesProp.setProperty( CREATE_OUSTRING( "ErrorBarX" ), xErrorBar ); break;
- case XML_y: aSeriesProp.setProperty( CREATE_OUSTRING( "ErrorBarY" ), xErrorBar ); break;
+ case XML_x: aSeriesProp.setProperty( PROP_ErrorBarX, xErrorBar ); break;
+ case XML_y: aSeriesProp.setProperty( PROP_ErrorBarY, xErrorBar ); break;
default: OSL_ENSURE( false, "ErrorBarConverter::convertFromModel - invalid error bar direction" );
}
}
@@ -381,8 +382,8 @@ void TrendlineConverter::convertFromModel( const Reference< XDataSeries >& rxDat
// #i83100# show equation and correlation coefficient
PropertySet aLabelProp( xRegCurve->getEquationProperties() );
- aLabelProp.setProperty( CREATE_OUSTRING( "ShowEquation" ), mrModel.mbDispEquation );
- aLabelProp.setProperty( CREATE_OUSTRING( "ShowCorrelationCoefficient" ), mrModel.mbDispRSquared );
+ aLabelProp.setProperty( PROP_ShowEquation, mrModel.mbDispEquation );
+ aLabelProp.setProperty( PROP_ShowCorrelationCoefficient, mrModel.mbDispRSquared );
// #i83100# formatting of the equation text box
if( mrModel.mbDispEquation || mrModel.mbDispRSquared )
@@ -528,7 +529,7 @@ Reference< XDataSeries > SeriesConverter::createDataSeries( const TypeGroupConve
// set the (unused) property default value used by the Chart2 templates (true for pie/doughnut charts)
bool bIsPie = rTypeInfo.meTypeCategory == TYPECATEGORY_PIE;
- aSeriesProp.setProperty( CREATE_OUSTRING( "VaryColorsByPoint" ), bIsPie );
+ aSeriesProp.setProperty( PROP_VaryColorsByPoint, bIsPie );
// own area formatting for every data point (TODO: varying line color not supported)
// #i91271# always set area formatting for every point in pie/doughnut charts to override their automatic point formatting
diff --git a/oox/source/drawingml/chart/titlecontext.cxx b/oox/source/drawingml/chart/titlecontext.cxx
index b372c16ee4e3..05006ce2f8fd 100644
--- a/oox/source/drawingml/chart/titlecontext.cxx
+++ b/oox/source/drawingml/chart/titlecontext.cxx
@@ -37,7 +37,7 @@
using ::rtl::OUString;
using ::oox::core::ContextHandler2Helper;
-using ::oox::core::ContextWrapper;
+using ::oox::core::ContextHandlerRef;
namespace oox {
namespace drawingml {
@@ -54,47 +54,52 @@ LayoutContext::~LayoutContext()
{
}
-ContextWrapper LayoutContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef LayoutContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
case C_TOKEN( layout ):
- return (nElement == C_TOKEN( manualLayout ));
+ switch( nElement )
+ {
+ case C_TOKEN( manualLayout ):
+ return this;
+ }
+ break;
case C_TOKEN( manualLayout ):
switch( nElement )
{
case C_TOKEN( x ):
mrModel.mfX = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
case C_TOKEN( y ):
mrModel.mfY = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
case C_TOKEN( w ):
mrModel.mfW = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
case C_TOKEN( h ):
mrModel.mfH = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
case C_TOKEN( xMode ):
mrModel.mnXMode = rAttribs.getToken( XML_val, XML_factor );
- return false;
+ return 0;
case C_TOKEN( yMode ):
mrModel.mnYMode = rAttribs.getToken( XML_val, XML_factor );
- return false;
+ return 0;
case C_TOKEN( wMode ):
mrModel.mnWMode = rAttribs.getToken( XML_val, XML_factor );
- return false;
+ return 0;
case C_TOKEN( hMode ):
mrModel.mnHMode = rAttribs.getToken( XML_val, XML_factor );
- return false;
+ return 0;
case C_TOKEN( layoutTarget ):
mrModel.mnTarget = rAttribs.getToken( XML_val, XML_outer );
- return false;
+ return 0;
}
break;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -108,7 +113,7 @@ TextContext::~TextContext()
{
}
-ContextWrapper TextContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef TextContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
{
switch( getCurrentElement() )
{
@@ -122,7 +127,7 @@ ContextWrapper TextContext::onCreateContext( sal_Int32 nElement, const Attribute
return new StringSequenceContext( *this, mrModel.mxDataSeq.create() );
case C_TOKEN( v ):
OSL_ENSURE( !mrModel.mxDataSeq, "TextContext::onCreateContext - multiple data sequences" );
- return true;
+ return this; // collect value in onEndElement()
}
break;
}
@@ -151,7 +156,7 @@ TitleContext::~TitleContext()
{
}
-ContextWrapper TitleContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef TitleContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -163,7 +168,7 @@ ContextWrapper TitleContext::onCreateContext( sal_Int32 nElement, const Attribut
case C_TOKEN( overlay ):
// default is 'false', not 'true' as specified
mrModel.mbOverlay = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( spPr ):
return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
case C_TOKEN( tx ):
@@ -173,7 +178,7 @@ ContextWrapper TitleContext::onCreateContext( sal_Int32 nElement, const Attribut
}
break;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -187,7 +192,7 @@ LegendContext::~LegendContext()
{
}
-ContextWrapper LegendContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef LegendContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -198,11 +203,11 @@ ContextWrapper LegendContext::onCreateContext( sal_Int32 nElement, const Attribu
return new LayoutContext( *this, mrModel.mxLayout.create() );
case C_TOKEN( legendPos ):
mrModel.mnPosition = rAttribs.getToken( XML_val, XML_r );
- return false;
+ return 0;
case C_TOKEN( overlay ):
// default is 'false', not 'true' as specified
mrModel.mbOverlay = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( spPr ):
return new ShapePropertiesContext( *this, mrModel.mxShapeProp.create() );
case C_TOKEN( txPr ):
@@ -210,7 +215,7 @@ ContextWrapper LegendContext::onCreateContext( sal_Int32 nElement, const Attribu
}
break;
}
- return false;
+ return 0;
}
// ============================================================================
diff --git a/oox/source/drawingml/chart/typegroupcontext.cxx b/oox/source/drawingml/chart/typegroupcontext.cxx
index 208d9a469fcf..b2367dc87b8b 100644
--- a/oox/source/drawingml/chart/typegroupcontext.cxx
+++ b/oox/source/drawingml/chart/typegroupcontext.cxx
@@ -33,7 +33,7 @@
#include "oox/drawingml/chart/typegroupmodel.hxx"
using ::oox::core::ContextHandler2Helper;
-using ::oox::core::ContextWrapper;
+using ::oox::core::ContextHandlerRef;
namespace oox {
namespace drawingml {
@@ -50,7 +50,7 @@ UpDownBarsContext::~UpDownBarsContext()
{
}
-ContextWrapper UpDownBarsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef UpDownBarsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
@@ -61,13 +61,13 @@ ContextWrapper UpDownBarsContext::onCreateContext( sal_Int32 nElement, const Att
return new ShapePrWrapperContext( *this, mrModel.mxDownBars.create() );
case C_TOKEN( gapWidth ):
mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
- return false;
+ return 0;
case C_TOKEN( upBars ):
return new ShapePrWrapperContext( *this, mrModel.mxUpBars.create() );
}
break;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -81,31 +81,31 @@ AreaTypeGroupContext::~AreaTypeGroupContext()
{
}
-ContextWrapper AreaTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef AreaTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
case C_TOKEN( axId ):
mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
- return false;
+ return 0;
case C_TOKEN( dLbls ):
return new DataLabelsContext( *this, mrModel.mxLabels.create() );
case C_TOKEN( dropLines ):
return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
case C_TOKEN( gapDepth ):
mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
- return false;
+ return 0;
case C_TOKEN( grouping ):
mrModel.mnGrouping = rAttribs.getToken( XML_val, XML_standard );
- return false;
+ return 0;
case C_TOKEN( ser ):
return new AreaSeriesContext( *this, mrModel.maSeries.create() );
case C_TOKEN( varyColors ):
// default is 'false', not 'true' as specified
mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -119,44 +119,44 @@ BarTypeGroupContext::~BarTypeGroupContext()
{
}
-ContextWrapper BarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef BarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
case C_TOKEN( axId ):
mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
- return false;
+ return 0;
case C_TOKEN( barDir ):
mrModel.mnBarDir = rAttribs.getToken( XML_val, XML_col );
- return false;
+ return 0;
case C_TOKEN( dLbls ):
return new DataLabelsContext( *this, mrModel.mxLabels.create() );
case C_TOKEN( gapDepth ):
mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
- return false;
+ return 0;
case C_TOKEN( gapWidth ):
mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
- return false;
+ return 0;
case C_TOKEN( grouping ):
// default is 'standard', not 'clustered' as specified
mrModel.mnGrouping = rAttribs.getToken( XML_val, XML_standard );
- return false;
+ return 0;
case C_TOKEN( overlap ):
mrModel.mnOverlap = rAttribs.getInteger( XML_val, 0 );
- return false;
+ return 0;
case C_TOKEN( ser ):
return new BarSeriesContext( *this, mrModel.maSeries.create() );
case C_TOKEN( serLines ):
return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
case C_TOKEN( shape ):
mrModel.mnShape = rAttribs.getToken( XML_val, XML_box );
- return false;
+ return 0;
case C_TOKEN( varyColors ):
// default is 'false', not 'true' as specified
mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -170,20 +170,20 @@ BubbleTypeGroupContext::~BubbleTypeGroupContext()
{
}
-ContextWrapper BubbleTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef BubbleTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
case C_TOKEN( axId ):
mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
- return false;
+ return 0;
case C_TOKEN( bubble3D ):
// default is 'false', not 'true' as specified
mrModel.mbBubble3d = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( bubbleScale ):
mrModel.mnBubbleScale = rAttribs.getInteger( XML_val, 100 );
- return false;
+ return 0;
case C_TOKEN( dLbls ):
return new DataLabelsContext( *this, mrModel.mxLabels.create() );
case C_TOKEN( ser ):
@@ -191,16 +191,16 @@ ContextWrapper BubbleTypeGroupContext::onCreateContext( sal_Int32 nElement, cons
case C_TOKEN( showNegBubbles ):
// default is 'false', not 'true' as specified
mrModel.mbShowNegBubbles = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( sizeRepresents ):
mrModel.mnSizeRepresents = rAttribs.getToken( XML_val, XML_area );
- return false;
+ return 0;
case C_TOKEN( varyColors ):
// default is 'false', not 'true' as specified
mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -214,43 +214,43 @@ LineTypeGroupContext::~LineTypeGroupContext()
{
}
-ContextWrapper LineTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef LineTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
case C_TOKEN( axId ):
mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
- return false;
+ return 0;
case C_TOKEN( dLbls ):
return new DataLabelsContext( *this, mrModel.mxLabels.create() );
case C_TOKEN( dropLines ):
return new ShapePrWrapperContext( *this, mrModel.mxDropLines.create() );
case C_TOKEN( gapDepth ):
mrModel.mnGapDepth = rAttribs.getInteger( XML_val, 150 );
- return false;
+ return 0;
case C_TOKEN( grouping ):
mrModel.mnGrouping = rAttribs.getToken( XML_val, XML_standard );
- return false;
+ return 0;
case C_TOKEN( hiLowLines ):
return new ShapePrWrapperContext( *this, mrModel.mxHiLowLines.create() );
case C_TOKEN( marker ):
// default is 'false', not 'true' as specified
mrModel.mbShowMarker = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( ser ):
return new LineSeriesContext( *this, mrModel.maSeries.create() );
case C_TOKEN( smooth ):
// default is 'false', not 'true' as specified
mrModel.mbSmooth = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
case C_TOKEN( upDownBars ):
return new UpDownBarsContext( *this, mrModel.mxUpDownBars.create() );
case C_TOKEN( varyColors ):
// default is 'false', not 'true' as specified
mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -264,7 +264,7 @@ PieTypeGroupContext::~PieTypeGroupContext()
{
}
-ContextWrapper PieTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef PieTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
@@ -272,35 +272,35 @@ ContextWrapper PieTypeGroupContext::onCreateContext( sal_Int32 nElement, const A
return new DataLabelsContext( *this, mrModel.mxLabels.create() );
case C_TOKEN( firstSliceAng ):
mrModel.mnFirstAngle = rAttribs.getInteger( XML_val, 0 );
- return false;
+ return 0;
case C_TOKEN( gapWidth ):
mrModel.mnGapWidth = rAttribs.getInteger( XML_val, 150 );
- return false;
+ return 0;
case C_TOKEN( holeSize ):
mrModel.mnHoleSize = rAttribs.getInteger( XML_val, 10 );
- return false;
+ return 0;
case C_TOKEN( ofPieType ):
mrModel.mnOfPieType = rAttribs.getToken( XML_val, XML_pie );
- return false;
+ return 0;
case C_TOKEN( secondPieSize ):
mrModel.mnSecondPieSize = rAttribs.getInteger( XML_val, 75 );
- return false;
+ return 0;
case C_TOKEN( ser ):
return new PieSeriesContext( *this, mrModel.maSeries.create() );
case C_TOKEN( serLines ):
return new ShapePrWrapperContext( *this, mrModel.mxSerLines.create() );
case C_TOKEN( splitPos ):
mrModel.mfSplitPos = rAttribs.getDouble( XML_val, 0.0 );
- return false;
+ return 0;
case C_TOKEN( splitType ):
mrModel.mnSplitType = rAttribs.getToken( XML_val, XML_auto );
- return false;
+ return 0;
case C_TOKEN( varyColors ):
// default is 'false', not 'true' as specified
mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -314,26 +314,26 @@ RadarTypeGroupContext::~RadarTypeGroupContext()
{
}
-ContextWrapper RadarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef RadarTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
case C_TOKEN( axId ):
mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
- return false;
+ return 0;
case C_TOKEN( dLbls ):
return new DataLabelsContext( *this, mrModel.mxLabels.create() );
case C_TOKEN( radarStyle ):
mrModel.mnRadarStyle = rAttribs.getToken( XML_val, XML_standard );
- return false;
+ return 0;
case C_TOKEN( ser ):
return new RadarSeriesContext( *this, mrModel.maSeries.create() );
case C_TOKEN( varyColors ):
// default is 'false', not 'true' as specified
mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -347,26 +347,26 @@ ScatterTypeGroupContext::~ScatterTypeGroupContext()
{
}
-ContextWrapper ScatterTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef ScatterTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
case C_TOKEN( axId ):
mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
- return false;
+ return 0;
case C_TOKEN( dLbls ):
return new DataLabelsContext( *this, mrModel.mxLabels.create() );
case C_TOKEN( scatterStyle ):
mrModel.mnScatterStyle = rAttribs.getInteger( XML_val, XML_marker );
- return false;
+ return 0;
case C_TOKEN( ser ):
return new ScatterSeriesContext( *this, mrModel.maSeries.create() );
case C_TOKEN( varyColors ):
// default is 'false', not 'true' as specified
mrModel.mbVaryColors = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
}
- return false;
+ return 0;
}
// ============================================================================
@@ -380,21 +380,21 @@ SurfaceTypeGroupContext::~SurfaceTypeGroupContext()
{
}
-ContextWrapper SurfaceTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef SurfaceTypeGroupContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
if( isRootElement() ) switch( nElement )
{
case C_TOKEN( axId ):
mrModel.maAxisIds.push_back( rAttribs.getInteger( XML_val, -1 ) );
- return false;
+ return 0;
case C_TOKEN( ser ):
return new SurfaceSeriesContext( *this, mrModel.maSeries.create() );
case C_TOKEN( wireframe ):
// default is 'false', not 'true' as specified
mrModel.mbWireframe = rAttribs.getBool( XML_val, false );
- return false;
+ return 0;
}
- return false;
+ return 0;
}
// ============================================================================
diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx
index 6b75d41f7147..2b5d95d86e6a 100644
--- a/oox/source/drawingml/chart/typegroupconverter.cxx
+++ b/oox/source/drawingml/chart/typegroupconverter.cxx
@@ -43,6 +43,7 @@
#include "oox/drawingml/lineproperties.hxx"
#include "oox/drawingml/chart/seriesconverter.hxx"
#include "oox/drawingml/chart/typegroupmodel.hxx"
+#include "properties.hxx"
using ::rtl::OUString;
using ::com::sun::star::uno::Reference;
@@ -131,7 +132,7 @@ void UpDownBarsConverter::convertFromModel( const Reference< XChartType >& rxCha
// upbar format
Reference< XPropertySet > xWhitePropSet;
- if( aTypeProp.getProperty( xWhitePropSet, CREATE_OUSTRING( "WhiteDay" ) ) )
+ if( aTypeProp.getProperty( xWhitePropSet, PROP_WhiteDay ) )
{
PropertySet aPropSet( xWhitePropSet );
getFormatter().convertFrameFormatting( aPropSet, mrModel.mxUpBars, OBJECTTYPE_UPBAR );
@@ -139,7 +140,7 @@ void UpDownBarsConverter::convertFromModel( const Reference< XChartType >& rxCha
// downbar format
Reference< XPropertySet > xBlackPropSet;
- if( aTypeProp.getProperty( xBlackPropSet, CREATE_OUSTRING( "BlackDay" ) ) )
+ if( aTypeProp.getProperty( xBlackPropSet, PROP_BlackDay ) )
{
PropertySet aPropSet( xBlackPropSet );
getFormatter().convertFrameFormatting( aPropSet, mrModel.mxDownBars, OBJECTTYPE_DOWNBAR );
@@ -295,7 +296,7 @@ Reference< XCoordinateSystem > TypeGroupConverter::createCoordinateSystem()
if( maTypeInfo.mbSwappedAxesSet )
{
PropertySet aPropSet( xCoordSystem );
- aPropSet.setProperty( CREATE_OUSTRING( "SwapXAndYAxis" ), true );
+ aPropSet.setProperty( PROP_SwapXAndYAxis, true );
}
return xCoordSystem;
@@ -337,14 +338,14 @@ void TypeGroupConverter::convertFromModel( const Reference< XDiagram >& rxDiagra
{
Sequence< sal_Int32 > aInt32Seq( 2 );
aInt32Seq[ 0 ] = aInt32Seq[ 1 ] = mrModel.mnOverlap;
- aTypeProp.setProperty( CREATE_OUSTRING( "OverlapSequence" ), aInt32Seq );
+ aTypeProp.setProperty( PROP_OverlapSequence, aInt32Seq );
aInt32Seq[ 0 ] = aInt32Seq[ 1 ] = mrModel.mnGapWidth;
- aTypeProp.setProperty( CREATE_OUSTRING( "GapwidthSequence" ), aInt32Seq );
+ aTypeProp.setProperty( PROP_GapwidthSequence, aInt32Seq );
}
break;
case TYPECATEGORY_PIE:
{
- aTypeProp.setProperty( CREATE_OUSTRING( "UseRings" ), maTypeInfo.meTypeId == TYPEID_DOUGHNUT );
+ aTypeProp.setProperty( PROP_UseRings, maTypeInfo.meTypeId == TYPEID_DOUGHNUT );
/* #i85166# starting angle of first pie slice. 3D pie charts
use Y rotation setting in view3D element. Of-pie charts do
not support pie rotation. */
@@ -407,18 +408,18 @@ void TypeGroupConverter::convertFromModel( const Reference< XDiagram >& rxDiagra
xDataSink->setData( ContainerHelper::vectorToSequence( aLabeledSeqVec ) );
// formatting of high/low lines
- aTypeProp.setProperty( CREATE_OUSTRING( "ShowHighLow" ), true );
+ aTypeProp.setProperty( PROP_ShowHighLow, true );
PropertySet aSeriesProp( xDataSeries );
if( mrModel.mxHiLowLines.is() )
getFormatter().convertFrameFormatting( aSeriesProp, mrModel.mxHiLowLines, OBJECTTYPE_HILOLINE );
else
// hi/low-lines cannot be switched off via "ShowHighLow" property (?)
- aSeriesProp.setProperty( CREATE_OUSTRING( "LineStyle" ), ::com::sun::star::drawing::LineStyle_NONE );
+ aSeriesProp.setProperty( PROP_LineStyle, ::com::sun::star::drawing::LineStyle_NONE );
// formatting of up/down bars
bool bUpDownBars = mrModel.mxUpDownBars.is();
- aTypeProp.setProperty( CREATE_OUSTRING( "Japanese" ), bUpDownBars );
- aTypeProp.setProperty( CREATE_OUSTRING( "ShowFirst" ), bUpDownBars );
+ aTypeProp.setProperty( PROP_Japanese, bUpDownBars );
+ aTypeProp.setProperty( PROP_ShowFirst, bUpDownBars );
if( bUpDownBars )
{
UpDownBarsConverter aUpDownConv( *this, *mrModel.mxUpDownBars );
@@ -456,7 +457,7 @@ void TypeGroupConverter::convertFromModel( const Reference< XDiagram >& rxDiagra
// set existence of bar connector lines at diagram (only in stacked 2D bar charts)
if( mrModel.mxSerLines.is() && !mb3dChart && (maTypeInfo.meTypeCategory == TYPECATEGORY_BAR) && (isStacked() || isPercent()) )
- aDiaProp.setProperty( CREATE_OUSTRING( "ConnectBars" ), true );
+ aDiaProp.setProperty( PROP_ConnectBars, true );
}
catch( Exception& )
{
@@ -493,7 +494,7 @@ void TypeGroupConverter::convertMarker( PropertySet& rPropSet, sal_Int32 nOoxSym
aSymbol.Size.Width = aSymbol.Size.Height = nSize;
// set the property
- rPropSet.setProperty( CREATE_OUSTRING( "Symbol" ), aSymbol );
+ rPropSet.setProperty( PROP_Symbol, aSymbol );
}
}
@@ -503,7 +504,7 @@ void TypeGroupConverter::convertLineSmooth( PropertySet& rPropSet, bool bOoxSmoo
{
namespace cssc = ::com::sun::star::chart2;
cssc::CurveStyle eCurveStyle = bOoxSmooth ? cssc::CurveStyle_CUBIC_SPLINES : cssc::CurveStyle_LINES;
- rPropSet.setProperty( CREATE_OUSTRING( "CurveStyle" ), eCurveStyle );
+ rPropSet.setProperty( PROP_CurveStyle, eCurveStyle );
}
}
@@ -524,7 +525,7 @@ void TypeGroupConverter::convertBarGeometry( PropertySet& rPropSet, sal_Int32 nO
case XML_pyramidToMax: nGeom3d = cssc::DataPointGeometry3D::PYRAMID; break;
default: OSL_ENSURE( false, "TypeGroupConverter::convertBarGeometry - unknown 3D bar shape type" );
}
- rPropSet.setProperty( CREATE_OUSTRING( "Geometry3D" ), nGeom3d );
+ rPropSet.setProperty( PROP_Geometry3D, nGeom3d );
}
}
@@ -534,7 +535,7 @@ void TypeGroupConverter::convertPieRotation( PropertySet& rPropSet, sal_Int32 nO
{
// map OOXML [0,360] clockwise (0deg top) to Chart2 counterclockwise (0deg left)
sal_Int32 nAngle = (450 - nOoxAngle) % 360;
- rPropSet.setProperty( CREATE_OUSTRING( "StartingAngle" ), nAngle );
+ rPropSet.setProperty( PROP_StartingAngle, nAngle );
}
}
@@ -544,7 +545,7 @@ void TypeGroupConverter::convertPieExplosion( PropertySet& rPropSet, sal_Int32 n
{
// pie explosion restricted to 100% in Chart2, set as double in range [0,1]
double fOffset = getLimitedValue< double >( nOoxExplosion / 100.0, 0.0, 1.0 );
- rPropSet.setProperty( CREATE_OUSTRING( "Offset" ), fOffset );
+ rPropSet.setProperty( PROP_Offset, fOffset );
}
}
@@ -564,10 +565,10 @@ void TypeGroupConverter::insertDataSeries( const Reference< XChartType >& rxChar
eStacking = cssc::StackingDirection_Y_STACKING;
else if( isDeep3dChart() )
eStacking = cssc::StackingDirection_Z_STACKING;
- aSeriesProp.setProperty( CREATE_OUSTRING( "StackingDirection" ), eStacking );
+ aSeriesProp.setProperty( PROP_StackingDirection, eStacking );
// additional series properties
- aSeriesProp.setProperty( CREATE_OUSTRING( "AttachedAxisIndex" ), nAxesSetIdx );
+ aSeriesProp.setProperty( PROP_AttachedAxisIndex, nAxesSetIdx );
// insert series into container
try
diff --git a/oox/source/drawingml/customshapegeometry.cxx b/oox/source/drawingml/customshapegeometry.cxx
index 9a4cc7e4056f..2e9be5e987ff 100644
--- a/oox/source/drawingml/customshapegeometry.cxx
+++ b/oox/source/drawingml/customshapegeometry.cxx
@@ -40,7 +40,6 @@
#include "tokens.hxx"
using ::rtl::OUString;
-using ::com::sun::star::beans::NamedValue;
using namespace ::oox::core;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::xml::sax;
diff --git a/oox/source/drawingml/customshapeproperties.cxx b/oox/source/drawingml/customshapeproperties.cxx
index b6c440e63a3a..5a1756e6d110 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -30,8 +30,10 @@
#include "oox/drawingml/customshapeproperties.hxx"
#include "oox/helper/helper.hxx"
+#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/core/namespaces.hxx"
+#include "properties.hxx"
#include "tokens.hxx"
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -64,7 +66,6 @@ void CustomShapeProperties::apply( const CustomShapePropertiesPtr& /* rSourceCus
void CustomShapeProperties::pushToPropSet( const ::oox::core::XmlFilterBase& /* rFilterBase */,
const Reference < XPropertySet >& xPropSet, const Reference < XShape > & xShape ) const
{
- const OUString sType = CREATE_OUSTRING( "Type" );
if ( maShapePresetType.getLength() )
{
//const uno::Reference < drawing::XShape > xShape( xPropSet, UNO_QUERY );
@@ -72,7 +73,8 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::XmlFilterBase& /*
if( xDefaulter.is() )
xDefaulter->createCustomShapeDefaults( maShapePresetType );
- const rtl::OUString sCustomShapeGeometry( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) );
+ const OUString sType = CREATE_OUSTRING( "Type" );
+ const OUString sCustomShapeGeometry( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) );
uno::Any aGeoPropSet = xPropSet->getPropertyValue( sCustomShapeGeometry );
uno::Sequence< beans::PropertyValue > aGeoPropSeq;
if ( aGeoPropSet >>= aGeoPropSeq )
@@ -102,12 +104,15 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::XmlFilterBase& /*
for ( j = 0; j < maAdjustmentValues.size(); j++ )
{
- sal_uInt32 nVal = maAdjustmentValues[ j ].maName.copy( 3 ).toInt32();
- if ( nVal-- )
+ if( maAdjustmentValues[ j ].maName.getLength() > 3 )
{
- double fNewAdj = getValue( maAdjustmentValues, nVal );
- aAdjustmentSeq[ nVal ].State = beans::PropertyState_DIRECT_VALUE;
- aAdjustmentSeq[ nVal ].Value <<= fNewAdj;
+ sal_uInt32 nVal = maAdjustmentValues[ j ].maName.copy( 3 ).toInt32();
+ if ( nVal-- )
+ {
+ double fNewAdj = getValue( maAdjustmentValues, nVal );
+ aAdjustmentSeq[ nVal ].State = beans::PropertyState_DIRECT_VALUE;
+ aAdjustmentSeq[ nVal ].Value <<= fNewAdj;
+ }
}
}
aGeoPropSeq[ i ].Value <<= aAdjustmentSeq;
@@ -124,15 +129,12 @@ void CustomShapeProperties::pushToPropSet( const ::oox::core::XmlFilterBase& /*
else
{
PropertyMap aPropertyMap;
- OUString sShapeType( CREATE_OUSTRING( "non-primitive" ) );
- aPropertyMap[ sType ] <<= sShapeType;
-
+ aPropertyMap[ PROP_Type ] <<= CREATE_OUSTRING( "non-primitive" );
// converting the vector to a sequence
- Sequence< PropertyValue > aSeq;
- aPropertyMap.makeSequence( aSeq );
- static const rtl::OUString sCustomShapeGeometry( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) );
- xPropSet->setPropertyValue( sCustomShapeGeometry, Any( aSeq ) );
+ Sequence< PropertyValue > aSeq = aPropertyMap.makePropertyValueSequence();
+ PropertySet aPropSet( xPropSet );
+ aPropSet.setProperty( PROP_CustomShapeGeometry, aSeq );
}
}
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 836b44621546..8db948576d56 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -44,6 +44,7 @@
#include "oox/core/xmlfilterbase.hxx"
#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
+#include "properties.hxx"
#include "tokens.hxx"
using namespace ::com::sun::star;
@@ -65,20 +66,40 @@ namespace drawingml {
namespace {
-static const sal_Char* const sppcDefaultFillNames[] =
+static const sal_Int32 spnDefaultFillIds[ FillId_END ] =
{
- "FillStyle", "FillColor", "FillTransparence", "FillGradient",
- "FillBitmap", "FillBitmapMode", "FillBitmapTile", "FillBitmapStretch",
- "FillBitmapLogicalSize", "FillBitmapSizeX", "FillBitmapSizeY",
- "FillBitmapOffsetX", "FillBitmapOffsetY", "FillBitmapRectanglePoint", 0
+ PROP_FillStyle,
+ PROP_FillColor,
+ PROP_FillTransparence,
+ PROP_FillGradient,
+ PROP_FillBitmap,
+ PROP_FillBitmapMode,
+ PROP_FillBitmapTile,
+ PROP_FillBitmapStretch,
+ PROP_FillBitmapLogicalSize,
+ PROP_FillBitmapSizeX,
+ PROP_FillBitmapSizeY,
+ PROP_FillBitmapOffsetX,
+ PROP_FillBitmapOffsetY,
+ PROP_FillBitmapRectanglePoint
};
-static const sal_Char* const sppcDefaultPicNames[] =
+static const sal_Int32 spnDefaultPicIds[ FillId_END ] =
{
- "FillStyle", "FillColor", "FillTransparence", "FillGradient",
- "Graphic", "FillBitmapMode", "FillBitmapTile", "FillBitmapStretch",
- "FillBitmapLogicalSize", "FillBitmapSizeX", "FillBitmapSizeY",
- "FillBitmapOffsetX", "FillBitmapOffsetY", "FillBitmapRectanglePoint", 0
+ PROP_FillStyle,
+ PROP_FillColor,
+ PROP_FillTransparence,
+ PROP_FillGradient,
+ PROP_Graphic,
+ PROP_FillBitmapMode,
+ PROP_FillBitmapTile,
+ PROP_FillBitmapStretch,
+ PROP_FillBitmapLogicalSize,
+ PROP_FillBitmapSizeX,
+ PROP_FillBitmapSizeY,
+ PROP_FillBitmapOffsetX,
+ PROP_FillBitmapOffsetY,
+ PROP_FillBitmapRectanglePoint
};
BitmapMode lclGetBitmapMode( sal_Int32 nToken )
@@ -183,39 +204,19 @@ Reference< XGraphic > lclTransformGraphic( const Reference< XGraphic >& rxGraphi
// ============================================================================
-FillPropertyNames::FillPropertyNames() :
- mbNamedFillGradient( false ),
- mbNamedFillBitmap( false ),
- mbTransformGraphic( false )
-{
-}
-
-FillPropertyNames::FillPropertyNames( const sal_Char* const* ppcPropertyNames, bool bNamedFillGradient, bool bNamedFillBitmap, bool bTransformGraphic ) :
- maFillStyle( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maFillColor( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maFillTransparence( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maFillGradient( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maFillBitmap( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maFillBitmapMode( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maFillBitmapTile( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maFillBitmapStretch( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maFillBitmapLogicalSize( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maFillBitmapSizeX( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maFillBitmapSizeY( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maFillBitmapOffsetX( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maFillBitmapOffsetY( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maFillBitmapRectanglePoint( OUString::createFromAscii( *ppcPropertyNames++ ) ),
+FillPropertyIds::FillPropertyIds( const sal_Int32* pnPropertyIds, bool bNamedFillGradient, bool bNamedFillBitmap, bool bTransformGraphic ) :
+ mpnPropertyIds( pnPropertyIds ),
mbNamedFillGradient( bNamedFillGradient ),
mbNamedFillBitmap( bNamedFillBitmap ),
mbTransformGraphic( bTransformGraphic )
{
- OSL_ENSURE( !*ppcPropertyNames, "FillPropertyNames::FillPropertyNames - unexpected trailing property names" );
+ OSL_ENSURE( mpnPropertyIds != 0, "FillPropertyIds::FillPropertyIds - missing property identifiers" );
}
// ============================================================================
-FillPropertyNames FillProperties::DEFAULTNAMES( sppcDefaultFillNames, false, false, false );
-FillPropertyNames FillProperties::DEFAULTPICNAMES( sppcDefaultPicNames, false, false, true );
+FillPropertyIds FillProperties::DEFAULT_IDS( spnDefaultFillIds, false, false, false );
+FillPropertyIds FillProperties::DEFAULT_PICIDS( spnDefaultPicIds, false, false, true );
void FillProperties::assignUsed( const FillProperties& rSourceProps )
{
@@ -264,7 +265,7 @@ Color FillProperties::getBestSolidColor() const
return aSolidColor;
}
-void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FillPropertyNames& rPropNames,
+void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FillPropertyIds& rPropIds,
const XmlFilterBase& rFilter, ModelObjectContainer& rObjContainer,
sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const
{
@@ -284,16 +285,16 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FillPropertyNam
case XML_solidFill:
if( maFillColor.isUsed() )
{
- rPropMap.setProperty( rPropNames.maFillColor, maFillColor.getColor( rFilter, nPhClr ) );
+ rPropMap.setProperty( rPropIds[ FillColorId ], maFillColor.getColor( rFilter, nPhClr ) );
if( maFillColor.hasTransparence() )
- rPropMap.setProperty( rPropNames.maFillTransparence, maFillColor.getTransparence() );
+ rPropMap.setProperty( rPropIds[ FillTransparenceId ], maFillColor.getTransparence() );
eFillStyle = FillStyle_SOLID;
}
break;
case XML_gradFill:
- // do not create gradient struct without property name...
- if( rPropNames.maFillGradient.getLength() > 0 )
+ // do not create gradient struct if property is not supported...
+ if( rPropIds.has( FillGradientId ) )
{
awt::Gradient aGradient;
aGradient.Angle = 900;
@@ -321,49 +322,49 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FillPropertyNam
}
// push gradient or named gradient to property map
- if( rPropNames.mbNamedFillGradient )
+ if( rPropIds.mbNamedFillGradient )
{
OUString aGradientName = rObjContainer.insertFillGradient( aGradient );
if( aGradientName.getLength() > 0 )
{
- rPropMap.setProperty( rPropNames.maFillGradient, aGradientName );
+ rPropMap.setProperty( rPropIds[ FillGradientId ], aGradientName );
eFillStyle = FillStyle_GRADIENT;
}
}
else
{
- rPropMap.setProperty( rPropNames.maFillGradient, aGradient );
+ rPropMap.setProperty( rPropIds[ FillGradientId ], aGradient );
eFillStyle = FillStyle_GRADIENT;
}
}
break;
case XML_blipFill:
- // do not start complex graphic transformation without property name...
- if( mxGraphic.is() && (rPropNames.maFillBitmap.getLength() > 0) )
+ // do not start complex graphic transformation if property is not supported...
+ if( mxGraphic.is() && rPropIds.has( FillBitmapId ) )
{
// TODO: "rotate with shape" is not possible with our current core
// created transformed graphic
- Reference< XGraphic > xGraphic = rPropNames.mbTransformGraphic ?
+ Reference< XGraphic > xGraphic = rPropIds.mbTransformGraphic ?
lclTransformGraphic( mxGraphic, maColorChangeFrom, maColorChangeTo, rFilter, nPhClr ) :
mxGraphic;
if( xGraphic.is() )
{
// push bitmap or named bitmap to property map
- if( rPropNames.mbNamedFillBitmap )
+ if( rPropIds.mbNamedFillBitmap )
{
OUString aBitmapName = rObjContainer.insertFillBitmap( Reference< awt::XBitmap >( xGraphic, UNO_QUERY ) );
if( aBitmapName.getLength() > 0 )
{
- rPropMap.setProperty( rPropNames.maFillBitmap, aBitmapName );
+ rPropMap.setProperty( rPropIds[ FillBitmapId ], aBitmapName );
eFillStyle = FillStyle_BITMAP;
}
}
else
{
- rPropMap.setProperty( rPropNames.maFillBitmap, xGraphic );
+ rPropMap.setProperty( rPropIds[ FillBitmapId ], xGraphic );
eFillStyle = FillStyle_BITMAP;
}
}
@@ -373,34 +374,34 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FillPropertyNam
{
// bitmap mode (single, repeat, stretch)
BitmapMode eBitmapMode = lclGetBitmapMode( moBitmapMode.get( XML_TOKEN_INVALID ) );
- rPropMap.setProperty( rPropNames.maFillBitmapMode, eBitmapMode );
+ rPropMap.setProperty( rPropIds[ FillBitmapModeId ], eBitmapMode );
// anchor position inside bitmap
RectanglePoint eRectPoint = lclGetRectanglePoint( moTileAlign.get( XML_tl ) );
- rPropMap.setProperty( rPropNames.maFillBitmapRectanglePoint, eRectPoint );
+ rPropMap.setProperty( rPropIds[ FillBitmapRectanglePointId ], eRectPoint );
// additional settings for repeated bitmap
if( eBitmapMode == BitmapMode_REPEAT )
{
- rPropMap.setProperty( rPropNames.maFillBitmapTile, true );
- rPropMap.setProperty( rPropNames.maFillBitmapStretch, true );
- rPropMap.setProperty( rPropNames.maFillBitmapLogicalSize, true );
+ rPropMap.setProperty( rPropIds[ FillBitmapTileId ], true );
+ rPropMap.setProperty( rPropIds[ FillBitmapStretchId ], true );
+ rPropMap.setProperty( rPropIds[ FillBitmapLogicalSizeId ], true );
// size of one bitmap tile
awt::Size aOriginalSize = lclGetOriginalSize( rFilter, mxGraphic );
if( (aOriginalSize.Width > 0) && (aOriginalSize.Height > 0) )
{
sal_Int32 nFillBmpSizeX = static_cast< sal_Int32 >( (aOriginalSize.Width / 100000.0) * moTileSX.get( 100000 ) );
- rPropMap.setProperty( rPropNames.maFillBitmapSizeX, nFillBmpSizeX );
+ rPropMap.setProperty( rPropIds[ FillBitmapSizeXId ], nFillBmpSizeX );
sal_Int32 nFillBmpSizeY = static_cast< sal_Int32 >( (aOriginalSize.Height / 100000.0) * moTileSY.get( 100000 ) );
- rPropMap.setProperty( rPropNames.maFillBitmapSizeY, nFillBmpSizeY );
+ rPropMap.setProperty( rPropIds[ FillBitmapSizeYId ], nFillBmpSizeY );
}
// offset of the first bitmap tile
// if( moTileX.has() )
-// rPropMap.setProperty( rPropNames.maFillBitmapOffsetX, static_cast< sal_Int16 >( moTileX.get() / 360 ) );
+// rPropMap.setProperty( rPropIds[ FillBitmapOffsetXId ], static_cast< sal_Int16 >( moTileX.get() / 360 ) );
// if( moTileY.has() )
-// rPropMap.setProperty( rPropNames.maFillBitmapOffsetY, static_cast< sal_Int16 >( moTileY.get() / 360 ) );
+// rPropMap.setProperty( rPropIds[ FillBitmapOffsetYId ], static_cast< sal_Int16 >( moTileY.get() / 360 ) );
}
}
}
@@ -412,9 +413,9 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FillPropertyNam
Color aColor = getBestSolidColor();
if( aColor.isUsed() )
{
- rPropMap.setProperty( rPropNames.maFillColor, aColor.getColor( rFilter, nPhClr ) );
+ rPropMap.setProperty( rPropIds[ FillColorId ], aColor.getColor( rFilter, nPhClr ) );
if( aColor.hasTransparence() )
- rPropMap.setProperty( rPropNames.maFillTransparence, aColor.getTransparence() );
+ rPropMap.setProperty( rPropIds[ FillTransparenceId ], aColor.getTransparence() );
eFillStyle = FillStyle_SOLID;
}
}
@@ -427,16 +428,16 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FillPropertyNam
}
// set final fill style property
- rPropMap.setProperty( rPropNames.maFillStyle, eFillStyle );
+ rPropMap.setProperty( rPropIds[ FillStyleId ], eFillStyle );
}
}
-void FillProperties::pushToPropSet( PropertySet& rPropSet, const FillPropertyNames& rPropNames,
+void FillProperties::pushToPropSet( PropertySet& rPropSet, const FillPropertyIds& rPropIds,
const XmlFilterBase& rFilter, ModelObjectContainer& rObjContainer,
sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const
{
PropertyMap aPropMap;
- pushToPropMap( aPropMap, rPropNames, rFilter, rObjContainer, nShapeRotation, nPhClr );
+ pushToPropMap( aPropMap, rPropIds, rFilter, rObjContainer, nShapeRotation, nPhClr );
rPropSet.setProperties( aPropMap );
}
diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx
index ed41e31ea2e9..6c3edccdbf42 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -42,6 +42,7 @@
#include "oox/drawingml/chart/chartconverter.hxx"
#include "oox/drawingml/chart/chartspacefragment.hxx"
#include "oox/drawingml/chart/chartspacemodel.hxx"
+#include "properties.hxx"
#include "tokens.hxx"
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/io/XStream.hpp>
@@ -185,8 +186,7 @@ PresentationOle2006Context::~PresentationOle2006Context()
OUString aPersistName( xEmbeddedResolver->resolveEmbeddedObjectURL( aURL ) );
aPersistName = aPersistName.copy( sProtocol.getLength() );
- static const OUString sPersistName = CREATE_OUSTRING( "PersistName" );
- mpShapePtr->getShapeProperties()[ sPersistName ] <<= aPersistName;
+ mpShapePtr->getShapeProperties()[ PROP_PersistName ] <<= aPersistName;
}
Reference< XComponent > xComp( xEmbeddedResolver, UNO_QUERY_THROW );
xComp->dispose();
@@ -215,12 +215,8 @@ PresentationOle2006Context::~PresentationOle2006Context()
Reference< graphic::XGraphic > xGraphic = xGraphicProvider->queryGraphic( aArgs );
if ( xGraphic.is() )
{
- static const OUString sEmptyGraphicURL;
- static const OUString sGraphicURL = CREATE_OUSTRING( "GraphicURL" );
- mpShapePtr->getShapeProperties()[ sGraphicURL ] <<= sEmptyGraphicURL;
-
- static const OUString sThumbnailGraphic = CREATE_OUSTRING( "Graphic" );
- mpShapePtr->getShapeProperties()[ sThumbnailGraphic ] <<= xGraphic;
+ mpShapePtr->getShapeProperties()[ PROP_GraphicURL ] <<= OUString();
+ mpShapePtr->getShapeProperties()[ PROP_Graphic ] <<= xGraphic;
}
}
catch( Exception& )
@@ -375,11 +371,11 @@ void CreateChartCallback::onCreateXShape( const Reference< drawing::XShape >& rx
{
// set the chart2 OLE class ID at the OLE shape
PropertySet aShapeProp( rxShape );
- aShapeProp.setProperty( CREATE_OUSTRING( "CLSID" ), CREATE_OUSTRING( "12dcae26-281f-416f-a234-c3086127382e" ) );
+ aShapeProp.setProperty( PROP_CLSID, CREATE_OUSTRING( "12dcae26-281f-416f-a234-c3086127382e" ) );
// get the XModel interface of the embedded object from the OLE shape
Reference< frame::XModel > xDocModel;
- aShapeProp.getProperty( xDocModel, CREATE_OUSTRING( "Model" ) );
+ aShapeProp.getProperty( xDocModel, PROP_Model );
// load the chart data from the XML fragment
chart::ChartSpaceModel aModel;
diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx
index e9b27494660f..8759f59eddcd 100644
--- a/oox/source/drawingml/hyperlinkcontext.cxx
+++ b/oox/source/drawingml/hyperlinkcontext.cxx
@@ -40,6 +40,7 @@
#include "oox/core/skipcontext.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/embeddedwavaudiofile.hxx"
+#include "properties.hxx"
#include "tokens.hxx"
using ::rtl::OUString;
@@ -61,18 +62,13 @@ HyperLinkContext::HyperLinkContext( ContextHandler& rParent,
if( sHref.getLength() > 0 )
{
OSL_TRACE("OOX: URI href %s", ::rtl::OUStringToOString (sHref, RTL_TEXTENCODING_UTF8).pData->buffer);
- const OUString sURL( CREATE_OUSTRING( "URL" ) );
- maProperties[ sURL ] <<= getFilter().getAbsoluteUrl( sHref );
+ maProperties[ PROP_URL ] <<= getFilter().getAbsoluteUrl( sHref );
OUString sTooltip = xAttributes->getOptionalValue( NMSP_RELATIONSHIPS|XML_tooltip );
- const OUString sRepresentation( CREATE_OUSTRING( "Representation" ) );
- maProperties[ sRepresentation ] <<= sTooltip;
+ maProperties[ PROP_Representation ] <<= sTooltip;
OUString sFrame = xAttributes->getOptionalValue( NMSP_RELATIONSHIPS|XML_tgtFrame );
if( sFrame.getLength() )
- {
- const OUString sTargetFrame( CREATE_OUSTRING( "TargetFrame" ) );
- maProperties[ sTargetFrame ] <<= sFrame;
- }
+ maProperties[ PROP_TargetFrame ] <<= sFrame;
// sValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "" ) );
// const rtl::OUString sUnvisitedCharStyleName( CREATE_OUSTRING( "UnvisitedCharStyleName" ) );
diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx
index d46d46edc5d7..d072082b0045 100644
--- a/oox/source/drawingml/lineproperties.cxx
+++ b/oox/source/drawingml/lineproperties.cxx
@@ -44,6 +44,7 @@
#include "oox/core/xmlfilterbase.hxx"
#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
+#include "properties.hxx"
#include "tokens.hxx"
using namespace ::com::sun::star::drawing;
@@ -64,12 +65,20 @@ namespace drawingml {
namespace {
-static const sal_Char* const sppcDefaultLineNames[] =
+static const sal_Int32 spnDefaultLineIds[ LineId_END ] =
{
- "LineStyle", "LineWidth", "LineColor", "LineTransparence", "LineDash", "LineJoint",
- "LineStartName", "LineStartWidth", "LineStartCenter",
- "LineEndName", "LineEndWidth", "LineEndCenter",
- 0
+ PROP_LineStyle,
+ PROP_LineWidth,
+ PROP_LineColor,
+ PROP_LineTransparence,
+ PROP_LineDash,
+ PROP_LineJoint,
+ PROP_LineStartName,
+ PROP_LineStartWidth,
+ PROP_LineStartCenter,
+ PROP_LineEndName,
+ PROP_LineEndWidth,
+ PROP_LineEndCenter
};
// ----------------------------------------------------------------------------
@@ -114,7 +123,7 @@ sal_Int32 lclGetArrowSize( sal_Int32 nToken )
// ----------------------------------------------------------------------------
void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties& rArrowProps,
- const LinePropertyNames& rPropNames, ModelObjectContainer& rObjContainer, sal_Int32 nLineWidth, bool bLineEnd )
+ const LinePropertyIds& rPropIds, ModelObjectContainer& rObjContainer, sal_Int32 nLineWidth, bool bLineEnd )
{
PolyPolygonBezierCoords aMarker;
OUString aMarkerName;
@@ -173,7 +182,7 @@ void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties&
nMarkerWidth = static_cast< sal_Int32 >( fArrowWidth * nApiLineWidth );
// test if the arrow already exists, do not create it again in this case
- if( !rPropNames.mbNamedLineMarker || !rObjContainer.hasLineMarker( aMarkerName ) )
+ if( !rPropIds.mbNamedLineMarker || !rObjContainer.hasLineMarker( aMarkerName ) )
{
// pass X and Y as percentage to OOX_ARROW_POINT
#define OOX_ARROW_POINT( x, y ) Point( static_cast< sal_Int32 >( fArrowWidth * x ), static_cast< sal_Int32 >( fArrowLength * y ) )
@@ -238,7 +247,7 @@ void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties&
aMarker.Flags.realloc( 1 );
aMarker.Flags[ 0 ] = ContainerHelper::vectorToSequence( aFlags );
- if( rPropNames.mbNamedLineMarker && !rObjContainer.insertLineMarker( aMarkerName, aMarker ) )
+ if( rPropIds.mbNamedLineMarker && !rObjContainer.insertLineMarker( aMarkerName, aMarker ) )
aMarkerName = OUString();
}
else
@@ -253,21 +262,21 @@ void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties&
{
if( bLineEnd )
{
- if( rPropNames.mbNamedLineMarker )
- rPropMap.setProperty( rPropNames.maLineEnd, aMarkerName );
+ if( rPropIds.mbNamedLineMarker )
+ rPropMap.setProperty( rPropIds[ LineEndId ], aMarkerName );
else
- rPropMap.setProperty( rPropNames.maLineEnd, aMarker );
- rPropMap.setProperty( rPropNames.maLineEndWidth, nMarkerWidth );
- rPropMap.setProperty( rPropNames.maLineEndCenter, bMarkerCenter );
+ rPropMap.setProperty( rPropIds[ LineEndId ], aMarker );
+ rPropMap.setProperty( rPropIds[ LineEndWidthId ], nMarkerWidth );
+ rPropMap.setProperty( rPropIds[ LineEndCenterId ], bMarkerCenter );
}
else
{
- if( rPropNames.mbNamedLineMarker )
- rPropMap.setProperty( rPropNames.maLineStart, aMarkerName );
+ if( rPropIds.mbNamedLineMarker )
+ rPropMap.setProperty( rPropIds[ LineStartId ], aMarkerName );
else
- rPropMap.setProperty( rPropNames.maLineStart, aMarker );
- rPropMap.setProperty( rPropNames.maLineStartWidth, nMarkerWidth );
- rPropMap.setProperty( rPropNames.maLineStartCenter, bMarkerCenter );
+ rPropMap.setProperty( rPropIds[ LineStartId ], aMarker );
+ rPropMap.setProperty( rPropIds[ LineStartWidthId ], nMarkerWidth );
+ rPropMap.setProperty( rPropIds[ LineStartCenterId ], bMarkerCenter );
}
}
}
@@ -276,29 +285,12 @@ void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties&
// ============================================================================
-LinePropertyNames::LinePropertyNames() :
- mbNamedLineDash( false ),
- mbNamedLineMarker( false )
-{
-}
-
-LinePropertyNames::LinePropertyNames( const sal_Char* const* ppcPropertyNames, bool bNamedLineDash, bool bNamedLineMarker ) :
- maLineStyle( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maLineWidth( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maLineColor( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maLineTransparence( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maLineDash( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maLineJoint( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maLineStart( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maLineStartWidth( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maLineStartCenter( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maLineEnd( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maLineEndWidth( OUString::createFromAscii( *ppcPropertyNames++ ) ),
- maLineEndCenter( OUString::createFromAscii( *ppcPropertyNames++ ) ),
+LinePropertyIds::LinePropertyIds( const sal_Int32* pnPropertyIds, bool bNamedLineDash, bool bNamedLineMarker ) :
+ mpnPropertyIds( pnPropertyIds ),
mbNamedLineDash( bNamedLineDash ),
mbNamedLineMarker( bNamedLineMarker )
{
- OSL_ENSURE( !*ppcPropertyNames, "LinePropertyNames::LinePropertyNames - unexpected trailing property names" );
+ OSL_ENSURE( mpnPropertyIds != 0, "LinePropertyIds::LinePropertyIds - missing property identifiers" );
}
// ============================================================================
@@ -312,7 +304,7 @@ void LineArrowProperties::assignUsed( const LineArrowProperties& rSourceProps )
// ============================================================================
-LinePropertyNames LineProperties::DEFAULTNAMES( sppcDefaultLineNames, false, true );
+LinePropertyIds LineProperties::DEFAULT_IDS( spnDefaultLineIds, false, true );
void LineProperties::assignUsed( const LineProperties& rSourceProps )
{
@@ -325,7 +317,7 @@ void LineProperties::assignUsed( const LineProperties& rSourceProps )
moLineJoint.assignIfUsed( rSourceProps.moLineJoint );
}
-void LineProperties::pushToPropMap( PropertyMap& rPropMap, const LinePropertyNames& rPropNames,
+void LineProperties::pushToPropMap( PropertyMap& rPropMap, const LinePropertyIds& rPropIds,
const XmlFilterBase& rFilter, ModelObjectContainer& rObjContainer, sal_Int32 nPhClr ) const
{
// line fill type must exist, otherwise ignore other properties
@@ -381,53 +373,53 @@ void LineProperties::pushToPropMap( PropertyMap& rPropMap, const LinePropertyNam
break;
}
- if( rPropNames.mbNamedLineDash )
+ if( rPropIds.mbNamedLineDash )
{
OUString aDashName = rObjContainer.insertLineDash( aLineDash );
if( aDashName.getLength() > 0 )
{
- rPropMap.setProperty( rPropNames.maLineDash, aDashName );
+ rPropMap.setProperty( rPropIds[ LineDashId ], aDashName );
eLineStyle = LineStyle_DASH;
}
}
else
{
- rPropMap.setProperty( rPropNames.maLineDash, aLineDash );
+ rPropMap.setProperty( rPropIds[ LineDashId ], aLineDash );
eLineStyle = LineStyle_DASH;
}
}
// set final line style property
- rPropMap.setProperty( rPropNames.maLineStyle, eLineStyle );
+ rPropMap.setProperty( rPropIds[ LineStyleId ], eLineStyle );
// line joint type
if( moLineJoint.has() )
- rPropMap.setProperty( rPropNames.maLineJoint, lclGetLineJoint( moLineJoint.get() ) );
+ rPropMap.setProperty( rPropIds[ LineJointId ], lclGetLineJoint( moLineJoint.get() ) );
// convert line width from EMUs to 1/100 mm
if( moLineWidth.has() )
- rPropMap.setProperty( rPropNames.maLineWidth, GetCoordinate( moLineWidth.get() ) );
+ rPropMap.setProperty( rPropIds[ LineWidthId ], GetCoordinate( moLineWidth.get() ) );
// line color and transparence
Color aLineColor = maLineFill.getBestSolidColor();
if( aLineColor.isUsed() )
{
- rPropMap.setProperty( rPropNames.maLineColor, aLineColor.getColor( rFilter, nPhClr ) );
+ rPropMap.setProperty( rPropIds[ LineColorId ], aLineColor.getColor( rFilter, nPhClr ) );
if( aLineColor.hasTransparence() )
- rPropMap.setProperty( rPropNames.maLineTransparence, aLineColor.getTransparence() );
+ rPropMap.setProperty( rPropIds[ LineTransparenceId ], aLineColor.getTransparence() );
}
// line markers
- lclPushMarkerProperties( rPropMap, maStartArrow, rPropNames, rObjContainer, moLineWidth.get( 0 ), false );
- lclPushMarkerProperties( rPropMap, maEndArrow, rPropNames, rObjContainer, moLineWidth.get( 0 ), true );
+ lclPushMarkerProperties( rPropMap, maStartArrow, rPropIds, rObjContainer, moLineWidth.get( 0 ), false );
+ lclPushMarkerProperties( rPropMap, maEndArrow, rPropIds, rObjContainer, moLineWidth.get( 0 ), true );
}
}
-void LineProperties::pushToPropSet( PropertySet& rPropSet, const LinePropertyNames& rPropNames,
+void LineProperties::pushToPropSet( PropertySet& rPropSet, const LinePropertyIds& rPropIds,
const XmlFilterBase& rFilter, ModelObjectContainer& rObjContainer, sal_Int32 nPhClr ) const
{
PropertyMap aPropMap;
- pushToPropMap( aPropMap, rPropNames, rFilter, rObjContainer, nPhClr );
+ pushToPropMap( aPropMap, rPropIds, rFilter, rObjContainer, nPhClr );
rPropSet.setProperties( aPropMap );
}
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 6d2dcf0f677b..7954b08135ba 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -37,6 +37,7 @@
#include "oox/core/namespaces.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/helper/propertyset.hxx"
+#include "properties.hxx"
#include "tokens.hxx"
#include <tools/solar.h> // for the F_PI180 define
@@ -99,20 +100,13 @@ table::TablePropertiesPtr Shape::getTableProperties()
void Shape::setDefaults()
{
- const OUString sTextAutoGrowHeight( RTL_CONSTASCII_USTRINGPARAM( "TextAutoGrowHeight" ) );
- const OUString sTextWordWrap( RTL_CONSTASCII_USTRINGPARAM( "TextWordWrap" ) );
- const OUString sTextLeftDistance( RTL_CONSTASCII_USTRINGPARAM( "TextLeftDistance" ) );
- const OUString sTextUpperDistance( RTL_CONSTASCII_USTRINGPARAM( "TextUpperDistance" ) );
- const OUString sTextRightDistance( RTL_CONSTASCII_USTRINGPARAM( "TextRightDistance" ) );
- const OUString sTextLowerDistance( RTL_CONSTASCII_USTRINGPARAM( "TextLowerDistance" ) );
- const OUString sCharHeight( RTL_CONSTASCII_USTRINGPARAM( "CharHeight" ) );
- maShapeProperties[ sTextAutoGrowHeight ] <<= false;
- maShapeProperties[ sTextWordWrap ] <<= true;
- maShapeProperties[ sTextLeftDistance ] <<= static_cast< sal_Int32 >( 250 );
- maShapeProperties[ sTextUpperDistance ] <<= static_cast< sal_Int32 >( 125 );
- maShapeProperties[ sTextRightDistance ] <<= static_cast< sal_Int32 >( 250 );
- maShapeProperties[ sTextLowerDistance ] <<= static_cast< sal_Int32 >( 125 );
- maShapeProperties[ sCharHeight ] <<= static_cast< float >( 18.0 );
+ maShapeProperties[ PROP_TextAutoGrowHeight ] <<= false;
+ maShapeProperties[ PROP_TextWordWrap ] <<= true;
+ maShapeProperties[ PROP_TextLeftDistance ] <<= static_cast< sal_Int32 >( 250 );
+ maShapeProperties[ PROP_TextUpperDistance ] <<= static_cast< sal_Int32 >( 125 );
+ maShapeProperties[ PROP_TextRightDistance ] <<= static_cast< sal_Int32 >( 250 );
+ maShapeProperties[ PROP_TextLowerDistance ] <<= static_cast< sal_Int32 >( 125 );
+ maShapeProperties[ PROP_CharHeight ] <<= static_cast< float >( 18.0 );
}
void Shape::setServiceName( const sal_Char* pServiceName )
@@ -304,8 +298,7 @@ Reference< XShape > Shape::createAndInsert(
uno::Sequence< uno::Sequence< awt::Point > > aPolyPolySequence( 1 );
aPolyPolySequence.getArray()[ 0 ] = aPointSequence;
- static const OUString sPolyPolygon(RTL_CONSTASCII_USTRINGPARAM("PolyPolygon"));
- maShapeProperties[ sPolyPolygon ] <<= aPolyPolySequence;
+ maShapeProperties[ PROP_PolyPolygon ] <<= aPolyPolySequence;
}
else if ( rServiceName == OUString::createFromAscii( "com.sun.star.drawing.ConnectorShape" ) )
{
@@ -319,10 +312,8 @@ Reference< XShape > Shape::createAndInsert(
awt::Point aAWTStartPosition( static_cast< sal_Int32 >( aStartPosition.getX() ), static_cast< sal_Int32 >( aStartPosition.getY() ) );
awt::Point aAWTEndPosition( static_cast< sal_Int32 >( aEndPosition.getX() ), static_cast< sal_Int32 >( aEndPosition.getY() ) );
- static const OUString sStartPosition(RTL_CONSTASCII_USTRINGPARAM("StartPosition"));
- maShapeProperties[ sStartPosition ] <<= aAWTStartPosition;
- static const OUString sEndPosition(RTL_CONSTASCII_USTRINGPARAM("EndPosition"));
- maShapeProperties[ sEndPosition ] <<= aAWTEndPosition;
+ maShapeProperties[ PROP_StartPosition ] <<= aAWTStartPosition;
+ maShapeProperties[ PROP_EndPosition ] <<= aAWTEndPosition;
}
else
{
@@ -341,8 +332,7 @@ Reference< XShape > Shape::createAndInsert(
aMatrix.Line3.Column2 = aTransformation.get(2,1);
aMatrix.Line3.Column3 = aTransformation.get(2,2);
- static const OUString sTransformation(RTL_CONSTASCII_USTRINGPARAM("Transformation"));
- maShapeProperties[ sTransformation ] <<= aMatrix;
+ maShapeProperties[ PROP_Transformation ] <<= aMatrix;
}
Reference< lang::XMultiServiceFactory > xServiceFact( rFilterBase.getModel(), UNO_QUERY_THROW );
if ( !mxShape.is() )
@@ -401,23 +391,20 @@ Reference< XShape > Shape::createAndInsert(
// applying properties
PropertySet aPropSet( xSet );
if ( rServiceName == OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) )
- mpGraphicPropertiesPtr->pushToPropSet( aPropSet, FillProperties::DEFAULTPICNAMES, rFilterBase, rFilterBase.getModelObjectContainer(), 0, -1 );
+ mpGraphicPropertiesPtr->pushToPropSet( aPropSet, FillProperties::DEFAULT_PICIDS, rFilterBase, rFilterBase.getModelObjectContainer(), 0, -1 );
if ( mpTablePropertiesPtr.get() && ( rServiceName == OUString::createFromAscii( "com.sun.star.drawing.TableShape" ) ) )
mpTablePropertiesPtr->pushToPropSet( rFilterBase, xSet, mpMasterTextListStyle );
- aFillProperties.pushToPropSet( aPropSet, FillProperties::DEFAULTNAMES, rFilterBase, rFilterBase.getModelObjectContainer(), mnRotation, nFillPhClr );
- aLineProperties.pushToPropSet( aPropSet, LineProperties::DEFAULTNAMES, rFilterBase, rFilterBase.getModelObjectContainer(), nLinePhClr );
+ aFillProperties.pushToPropSet( aPropSet, FillProperties::DEFAULT_IDS, rFilterBase, rFilterBase.getModelObjectContainer(), mnRotation, nFillPhClr );
+ aLineProperties.pushToPropSet( aPropSet, LineProperties::DEFAULT_IDS, rFilterBase, rFilterBase.getModelObjectContainer(), nLinePhClr );
// applying autogrowheight property before setting shape size, because
// the shape size might be changed if currently autogrowheight is true
// we must also check that the PropertySet supports the property.
Reference< XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
- static const rtl::OUString sTextAutoGrowHeight( RTL_CONSTASCII_USTRINGPARAM( "TextAutoGrowHeight" ) );
- if( xSetInfo->hasPropertyByName( sTextAutoGrowHeight ) )
- {
- const Any* pAutoGrowHeight = aShapeProperties.getPropertyValue( sTextAutoGrowHeight );
- if ( pAutoGrowHeight )
- xSet->setPropertyValue( sTextAutoGrowHeight, Any( false ) );
- }
+ const OUString& rPropName = PropertyMap::getPropertyName( PROP_TextAutoGrowHeight );
+ if( xSetInfo.is() && xSetInfo->hasPropertyByName( rPropName ) )
+ if( /*const Any* pAutoGrowHeight =*/ aShapeProperties.getProperty( PROP_TextAutoGrowHeight ) )
+ xSet->setPropertyValue( rPropName, Any( false ) );
aPropSet.setProperties( aShapeProperties );
diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx
index 6e2125f03208..d0b48048cbd8 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -33,6 +33,7 @@
#include "oox/drawingml/textbody.hxx"
#include "oox/core/namespaces.hxx"
#include "oox/core/xmlfilterbase.hxx"
+#include "properties.hxx"
#include "tokens.hxx"
#include "oox/helper/propertyset.hxx"
#include <com/sun/star/container/XNameContainer.hpp>
@@ -75,8 +76,8 @@ TableCell::~TableCell()
}
void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase,
- Reference< XPropertySet >& rxPropSet, oox::drawingml::LineProperties& rLineProperties,
- const rtl::OUString& sPropertyName )
+ Reference< XPropertySet >& rxPropSet, oox::drawingml::LineProperties& rLineProperties,
+ sal_Int32 nPropId )
{
BorderLine aBorderLine( 0, 0, 0, 0 );
if( rLineProperties.maLineFill.moFillType.differsFrom( XML_noFill ) )
@@ -89,7 +90,7 @@ void applyLineAttributes( const ::oox::core::XmlFilterBase& rFilterBase,
}
PropertySet aPropSet( rxPropSet );
- aPropSet.setProperty( sPropertyName, aBorderLine );
+ aPropSet.setProperty( nPropId, aBorderLine );
}
void applyBorder( TableStylePart& rTableStylePart, sal_Int32 nLineType, oox::drawingml::LineProperties& rLineProperties )
@@ -173,12 +174,6 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
getTextBody()->insertAt( rFilterBase, xText, xAt, aTextStyleProps, pMasterTextListStyle );
Reference< XPropertySet > xPropSet( rxCell, UNO_QUERY_THROW );
- static const rtl::OUString sLeftBorder( RTL_CONSTASCII_USTRINGPARAM( "LeftBorder" ) );
- static const rtl::OUString sRightBorder( RTL_CONSTASCII_USTRINGPARAM( "RightBorder" ) );
- static const rtl::OUString sTopBorder( RTL_CONSTASCII_USTRINGPARAM( "TopBorder" ) );
- static const rtl::OUString sBottomBorder( RTL_CONSTASCII_USTRINGPARAM( "BottomBorder" ) );
- static const rtl::OUString sDiagonalTLBR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalTLBR" ) );
- static const rtl::OUString sDiagonalBLTR( RTL_CONSTASCII_USTRINGPARAM ( "DiagonalBLTR" ) );
oox::drawingml::FillProperties aFillProperties;
oox::drawingml::LineProperties aLinePropertiesLeft;
oox::drawingml::LineProperties aLinePropertiesRight;
@@ -353,22 +348,22 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
}
}
aLinePropertiesLeft.assignUsed( maLinePropertiesLeft );
- aLinePropertiesLeft.assignUsed( maLinePropertiesRight );
- aLinePropertiesLeft.assignUsed( maLinePropertiesTop );
- aLinePropertiesLeft.assignUsed( maLinePropertiesBottom );
- aLinePropertiesLeft.assignUsed( maLinePropertiesTopLeftToBottomRight );
- aLinePropertiesLeft.assignUsed( maLinePropertiesBottomLeftToTopRight );
- applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesLeft, sLeftBorder );
- applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesRight, sRightBorder );
- applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTop, sTopBorder );
- applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottom, sBottomBorder );
- applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTopLeftToBottomRight, sDiagonalTLBR );
- applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottomLeftToTopRight, sDiagonalBLTR );
+ aLinePropertiesRight.assignUsed( maLinePropertiesRight );
+ aLinePropertiesTop.assignUsed( maLinePropertiesTop );
+ aLinePropertiesBottom.assignUsed( maLinePropertiesBottom );
+ aLinePropertiesTopLeftToBottomRight.assignUsed( maLinePropertiesTopLeftToBottomRight );
+ aLinePropertiesBottomLeftToTopRight.assignUsed( maLinePropertiesBottomLeftToTopRight );
+ applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesLeft, PROP_LeftBorder );
+ applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesRight, PROP_RightBorder );
+ applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTop, PROP_TopBorder );
+ applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottom, PROP_BottomBorder );
+ applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesTopLeftToBottomRight, PROP_DiagonalTLBR );
+ applyLineAttributes( rFilterBase, xPropSet, aLinePropertiesBottomLeftToTopRight, PROP_DiagonalBLTR );
aFillProperties.assignUsed( maFillProperties );
PropertySet aPropSet( xPropSet );
// TODO: phClr?
- aFillProperties.pushToPropSet( aPropSet, FillProperties::DEFAULTNAMES,
+ aFillProperties.pushToPropSet( aPropSet, FillProperties::DEFAULT_IDS,
rFilterBase, rFilterBase.getModelObjectContainer(), 0, -1 );
}
diff --git a/oox/source/drawingml/textbody.cxx b/oox/source/drawingml/textbody.cxx
index 61a478ff9644..4a98210e8a25 100644
--- a/oox/source/drawingml/textbody.cxx
+++ b/oox/source/drawingml/textbody.cxx
@@ -63,19 +63,6 @@ void TextBody::insertAt(
const TextCharacterProperties& rTextStyleProperties,
const TextListStylePtr& pMasterTextListStylePtr ) const
{
-#ifdef DEBUG
- if ( false )
- {
- const TextParagraphPropertiesVector& rListStyle( pMasterTextListStylePtr->getListStyle() );
- TextParagraphPropertiesVector::const_iterator aIter( rListStyle.begin() );
- while( aIter != rListStyle.end() )
- {
- (*aIter)->getTextParagraphPropertyMap().dump_debug("TextParagraph paragraph props");
- aIter++;
- }
- }
-#endif
-
TextListStyle aCombinedTextStyle;
aCombinedTextStyle.apply( *pMasterTextListStylePtr );
aCombinedTextStyle.apply( maTextListStyle );
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx
index d2db0b13500a..a68880066665 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -36,6 +36,7 @@
#include "oox/helper/attributelist.hxx"
#include "oox/helper/propertymap.hxx"
#include "oox/core/namespaces.hxx"
+#include "properties.hxx"
#include "tokens.hxx"
using ::rtl::OUString;
@@ -58,29 +59,25 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent,
// ST_TextWrappingType
sal_Int32 nWrappingType = aAttribs.getToken( XML_wrap, XML_square );
- mrTextBodyProp.maPropertyMap[ CREATE_OUSTRING( "TextWordWrap" ) ] <<= (nWrappingType == XML_square);
+ mrTextBodyProp.maPropertyMap[ PROP_TextWordWrap ] <<= (nWrappingType == XML_square);
// ST_Coordinate
- const OUString sTextLeftDistance( RTL_CONSTASCII_USTRINGPARAM( "TextLeftDistance" ) );
- const OUString sTextUpperDistance( RTL_CONSTASCII_USTRINGPARAM( "TextUpperDistance" ) );
- const OUString sTextRightDistance( RTL_CONSTASCII_USTRINGPARAM( "TextRightDistance" ) );
- const OUString sTextLowerDistance( RTL_CONSTASCII_USTRINGPARAM( "TextLowerDistance" ) );
OUString sValue;
sValue = xAttributes->getOptionalValue( XML_lIns );
sal_Int32 nLeftInset = ( sValue.getLength() != 0 ? GetCoordinate( sValue ) : 91440 / 360 );
- mrTextBodyProp.maPropertyMap[ sTextLeftDistance ] <<= static_cast< sal_Int32 >( nLeftInset );
+ mrTextBodyProp.maPropertyMap[ PROP_TextLeftDistance ] <<= static_cast< sal_Int32 >( nLeftInset );
sValue = xAttributes->getOptionalValue( XML_tIns );
sal_Int32 nTopInset = ( sValue.getLength() != 0 ? GetCoordinate( sValue ) : 91440 / 360 );
- mrTextBodyProp.maPropertyMap[ sTextUpperDistance ] <<= static_cast< sal_Int32 >( nTopInset );
+ mrTextBodyProp.maPropertyMap[ PROP_TextUpperDistance ] <<= static_cast< sal_Int32 >( nTopInset );
sValue = xAttributes->getOptionalValue( XML_rIns );
sal_Int32 nRightInset = ( sValue.getLength() != 0 ? GetCoordinate( sValue ) : 91440 / 360 );
- mrTextBodyProp.maPropertyMap[ sTextRightDistance ] <<= static_cast< sal_Int32 >( nRightInset );
+ mrTextBodyProp.maPropertyMap[ PROP_TextRightDistance ] <<= static_cast< sal_Int32 >( nRightInset );
sValue = xAttributes->getOptionalValue( XML_bIns );
sal_Int32 nBottonInset = ( sValue.getLength() != 0 ? GetCoordinate( sValue ) : 45720 / 360 );
- mrTextBodyProp.maPropertyMap[ sTextLowerDistance ] <<= static_cast< sal_Int32 >( nBottonInset );
+ mrTextBodyProp.maPropertyMap[ PROP_TextLowerDistance ] <<= static_cast< sal_Int32 >( nBottonInset );
// ST_TextAnchoringType
@@ -124,7 +121,6 @@ void TextBodyPropertiesContext::endFastElement( sal_Int32 ) throw (SAXException,
Reference< XFastContextHandler > TextBodyPropertiesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& /*xAttributes*/) throw (SAXException, RuntimeException)
{
Reference< XFastContextHandler > xRet;
- const OUString sTextAutoGrowHeight( RTL_CONSTASCII_USTRINGPARAM( "TextAutoGrowHeight" ) );
switch( aElementToken )
{
// Sequence
@@ -134,11 +130,11 @@ Reference< XFastContextHandler > TextBodyPropertiesContext::createFastChildConte
// EG_TextAutofit
case NMSP_DRAWINGML|XML_noAutofit:
- mrTextBodyProp.maPropertyMap[ sTextAutoGrowHeight ] <<= false; // CT_TextNoAutofit
+ mrTextBodyProp.maPropertyMap[ PROP_TextAutoGrowHeight ] <<= false; // CT_TextNoAutofit
break;
case NMSP_DRAWINGML|XML_normAutofit: // CT_TextNormalAutofit
case NMSP_DRAWINGML|XML_spAutoFit:
- mrTextBodyProp.maPropertyMap[ sTextAutoGrowHeight ] <<= true;
+ mrTextBodyProp.maPropertyMap[ PROP_TextAutoGrowHeight ] <<= true;
break;
case NMSP_DRAWINGML|XML_scene3d: // CT_Scene3D
diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx
index 28c11ad46780..a5ef7558701f 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -35,6 +35,7 @@
#include "oox/helper/helper.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
+#include "properties.hxx"
#include "tokens.hxx"
using ::rtl::OUString;
@@ -77,29 +78,29 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
if( maLatinFont.getFontData( aFontName, nFontPitch, nFontFamily, rFilter ) )
{
- rPropMap[ CREATE_OUSTRING( "CharFontName" ) ] <<= aFontName;
- rPropMap[ CREATE_OUSTRING( "CharFontPitch" ) ] <<= nFontPitch;
- rPropMap[ CREATE_OUSTRING( "CharFontFamily" ) ] <<= nFontFamily;
+ rPropMap[ PROP_CharFontName ] <<= aFontName;
+ rPropMap[ PROP_CharFontPitch ] <<= nFontPitch;
+ rPropMap[ PROP_CharFontFamily ] <<= nFontFamily;
}
if( maAsianFont.getFontData( aFontName, nFontPitch, nFontFamily, rFilter ) )
{
- rPropMap[ CREATE_OUSTRING( "CharFontNameAsian" ) ] <<= aFontName;
- rPropMap[ CREATE_OUSTRING( "CharFontPitchAsian" ) ] <<= nFontFamily;
- rPropMap[ CREATE_OUSTRING( "CharFontFamilyAsian" ) ] <<= nFontPitch;
+ rPropMap[ PROP_CharFontNameAsian ] <<= aFontName;
+ rPropMap[ PROP_CharFontPitchAsian ] <<= nFontFamily;
+ rPropMap[ PROP_CharFontFamilyAsian ] <<= nFontPitch;
}
if( maComplexFont.getFontData( aFontName, nFontPitch, nFontFamily, rFilter ) )
{
- rPropMap[ CREATE_OUSTRING( "CharFontNameComplex" ) ] <<= aFontName;
- rPropMap[ CREATE_OUSTRING( "CharFontPitchComplex" ) ] <<= nFontPitch;
- rPropMap[ CREATE_OUSTRING( "CharFontFamilyComplex" ) ] <<= nFontFamily;
+ rPropMap[ PROP_CharFontNameComplex ] <<= aFontName;
+ rPropMap[ PROP_CharFontPitchComplex ] <<= nFontPitch;
+ rPropMap[ PROP_CharFontFamilyComplex ] <<= nFontFamily;
}
// symbol font not supported
if( maCharColor.isUsed() )
- rPropMap[ CREATE_OUSTRING( "CharColor" ) ] <<= maCharColor.getColor( rFilter );
+ rPropMap[ PROP_CharColor ] <<= maCharColor.getColor( rFilter );
if( moLang.has() && (moLang.get().getLength() > 0) )
{
@@ -114,38 +115,38 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
{
aLocale.Language = moLang.get();
}
- rPropMap[ CREATE_OUSTRING( "CharLocale" ) ] <<= aLocale;
- rPropMap[ CREATE_OUSTRING( "CharLocaleAsian" ) ] <<= aLocale;
- rPropMap[ CREATE_OUSTRING( "CharLocaleComplex" ) ] <<= aLocale;
+ rPropMap[ PROP_CharLocale ] <<= aLocale;
+ rPropMap[ PROP_CharLocaleAsian ] <<= aLocale;
+ rPropMap[ PROP_CharLocaleComplex ] <<= aLocale;
}
if( moHeight.has() )
{
float fHeight = GetFontHeight( moHeight.get() );
- rPropMap[ CREATE_OUSTRING( "CharHeight" ) ] <<= fHeight;
- rPropMap[ CREATE_OUSTRING( "CharHeightAsian" ) ] <<= fHeight;
- rPropMap[ CREATE_OUSTRING( "CharHeightComplex" ) ] <<= fHeight;
+ rPropMap[ PROP_CharHeight ] <<= fHeight;
+ rPropMap[ PROP_CharHeightAsian ] <<= fHeight;
+ rPropMap[ PROP_CharHeightComplex ] <<= fHeight;
}
- rPropMap[ CREATE_OUSTRING( "CharUnderline" ) ] <<= GetFontUnderline( moUnderline.get( XML_none ) );
- rPropMap[ CREATE_OUSTRING( "CharStrikeout" ) ] <<= GetFontStrikeout( moStrikeout.get( XML_noStrike ) );
- rPropMap[ CREATE_OUSTRING( "CharCaseMap" ) ] <<= GetCaseMap( moCaseMap.get( XML_none ) );
+ rPropMap[ PROP_CharUnderline ] <<= GetFontUnderline( moUnderline.get( XML_none ) );
+ rPropMap[ PROP_CharStrikeout ] <<= GetFontStrikeout( moStrikeout.get( XML_noStrike ) );
+ rPropMap[ PROP_CharCaseMap ] <<= GetCaseMap( moCaseMap.get( XML_none ) );
float fWeight = moBold.get( false ) ? awt::FontWeight::BOLD : awt::FontWeight::NORMAL;
- rPropMap[ CREATE_OUSTRING( "CharWeight" ) ] <<= fWeight;
- rPropMap[ CREATE_OUSTRING( "CharWeightAsian" ) ] <<= fWeight;
- rPropMap[ CREATE_OUSTRING( "CharWeightComplex" ) ] <<= fWeight;
+ rPropMap[ PROP_CharWeight ] <<= fWeight;
+ rPropMap[ PROP_CharWeightAsian ] <<= fWeight;
+ rPropMap[ PROP_CharWeightComplex ] <<= fWeight;
awt::FontSlant eSlant = moItalic.get( false ) ? awt::FontSlant_ITALIC : awt::FontSlant_NONE;
- rPropMap[ CREATE_OUSTRING( "CharPosture" ) ] <<= eSlant;
- rPropMap[ CREATE_OUSTRING( "CharPostureAsian" ) ] <<= eSlant;
- rPropMap[ CREATE_OUSTRING( "CharPostureComplex" ) ] <<= eSlant;
+ rPropMap[ PROP_CharPosture ] <<= eSlant;
+ rPropMap[ PROP_CharPostureAsian ] <<= eSlant;
+ rPropMap[ PROP_CharPostureComplex ] <<= eSlant;
bool bUnderlineFillFollowText = moUnderlineFillFollowText.get( false );
if( moUnderline.has() && maUnderlineColor.isUsed() && !bUnderlineFillFollowText )
{
- rPropMap[ CREATE_OUSTRING( "CharUnderlineHasColor" ) ] <<= true;
- rPropMap[ CREATE_OUSTRING( "CharUnderlineColor" ) ] <<= maUnderlineColor.getColor( rFilter );
+ rPropMap[ PROP_CharUnderlineHasColor ] <<= true;
+ rPropMap[ PROP_CharUnderlineColor ] <<= maUnderlineColor.getColor( rFilter );
}
}
diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx
index 383d02d987f3..df63fad1fde8 100644
--- a/oox/source/drawingml/textparagraph.cxx
+++ b/oox/source/drawingml/textparagraph.cxx
@@ -89,14 +89,6 @@ void TextParagraph::insertAt(
}
xAt->gotoEnd( sal_True );
-#ifdef DEBUG
- if ( false )
- {
- if ( pTextParagraphStyle.get() )
- pTextParagraphStyle->getTextParagraphPropertyMap().dump_debug("TextParagraph paragraph props");
- }
-#endif
-
PropertyMap aioBulletList;
Reference< XPropertySet > xProps( xStart, UNO_QUERY);
float fCharacterSize = 18;
diff --git a/oox/source/drawingml/textparagraphproperties.cxx b/oox/source/drawingml/textparagraphproperties.cxx
index fb061956d01e..c8197e3d78a3 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -36,11 +36,13 @@
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <com/sun/star/awt/XBitmap.hpp>
#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
#include "oox/helper/helper.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/core/namespaces.hxx"
#include "oox/drawingml/drawingmltypes.hxx"
+#include "properties.hxx"
#include "tokens.hxx"
using rtl::OUString;
@@ -282,30 +284,15 @@ void BulletList::apply( const BulletList& rSource )
void BulletList::pushToPropMap( const ::oox::core::XmlFilterBase& rFilterBase, PropertyMap& rPropMap ) const
{
if( msNumberingPrefix.hasValue() )
- {
-// OSL_TRACE( "OOX: numb prefix found");
- const rtl::OUString sPrefix( CREATE_OUSTRING( "Prefix" ) );
- rPropMap[ sPrefix ] = msNumberingPrefix;
- }
+ rPropMap[ PROP_Prefix ] = msNumberingPrefix;
if( msNumberingSuffix.hasValue() )
- {
-// OSL_TRACE( "OOX: numb suffix found");
- const rtl::OUString sSuffix( CREATE_OUSTRING( "Suffix" ) );
- rPropMap[ sSuffix ] = msNumberingSuffix;
- }
+ rPropMap[ PROP_Suffix ] = msNumberingSuffix;
if( mnStartAt.hasValue() )
- {
- const rtl::OUString sStartWith( CREATE_OUSTRING( "StartWith" ) );
- rPropMap[ sStartWith ] = mnStartAt;
- }
- const rtl::OUString sAdjust( CREATE_OUSTRING( "Adjust" ) );
- rPropMap[ sAdjust ] <<= HoriOrientation::LEFT;
+ rPropMap[ PROP_StartWith ] = mnStartAt;
+ rPropMap[ PROP_Adjust ] <<= HoriOrientation::LEFT;
if( mnNumberingType.hasValue() )
- {
- const rtl::OUString sNumberingType( CREATE_OUSTRING( "NumberingType" ) );
- rPropMap[ sNumberingType ] = mnNumberingType;
- }
+ rPropMap[ PROP_NumberingType ] = mnNumberingType;
OUString aBulletFontName;
sal_Int16 nBulletFontPitch = 0;
@@ -321,38 +308,23 @@ void BulletList::pushToPropMap( const ::oox::core::XmlFilterBase& rFilterBase, P
aFontDesc.Name = aBulletFontName;
aFontDesc.Pitch = nBulletFontPitch;
aFontDesc.Family = nBulletFontFamily;
- const rtl::OUString sBulletFont( CREATE_OUSTRING( "BulletFont" ) );
- rPropMap[ sBulletFont ] <<= aFontDesc;
- const rtl::OUString sBulletFontName( CREATE_OUSTRING( "BulletFontName" ) );
- rPropMap[ sBulletFontName ] <<= aBulletFontName;
+ rPropMap[ PROP_BulletFont ] <<= aFontDesc;
+ rPropMap[ PROP_BulletFontName ] <<= aBulletFontName;
}
if ( msBulletChar.hasValue() )
- {
- const rtl::OUString sBulletChar( CREATE_OUSTRING( "BulletChar" ) );
- rPropMap[ sBulletChar ] = msBulletChar;
- }
+ rPropMap[ PROP_BulletChar ] = msBulletChar;
if ( maGraphic.hasValue() )
{
- const rtl::OUString sGraphic( CREATE_OUSTRING( "Graphic" ) );
Reference< com::sun::star::awt::XBitmap > xBitmap( maGraphic, UNO_QUERY );
if ( xBitmap.is() )
- rPropMap[ sGraphic ] <<= xBitmap;
+ rPropMap[ PROP_Graphic ] <<= xBitmap;
}
if( mnSize.hasValue() )
- {
- const rtl::OUString sBulletRelSize( CREATE_OUSTRING( "BulletRelSize" ) );
- rPropMap[ sBulletRelSize ] = mnSize;
- }
+ rPropMap[ PROP_BulletRelSize ] = mnSize;
if ( maStyleName.hasValue() )
- {
- const OUString sCharStyleName( CREATE_OUSTRING( "CharStyleName" ) );
- rPropMap[ sCharStyleName ] <<= maStyleName;
- }
+ rPropMap[ PROP_CharStyleName ] <<= maStyleName;
if ( maBulletColorPtr->isUsed() )
- {
- const rtl::OUString sBulletColor( CREATE_OUSTRING( "BulletColor" ) );
- rPropMap[ sBulletColor ] <<= maBulletColorPtr->getColor( rFilterBase );
- }
+ rPropMap[ PROP_BulletColor ] <<= maBulletColorPtr->getColor( rFilterBase );
}
TextParagraphProperties::TextParagraphProperties()
@@ -391,31 +363,21 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase& r
else if ( pMasterBuList && pMasterBuList->mnNumberingType.hasValue() )
pMasterBuList->mnNumberingType >>= nNumberingType;
if ( nNumberingType == NumberingType::NUMBER_NONE )
- {
- const OUString sNumberingLevel( CREATE_OUSTRING( "NumberingLevel" ) );
- aPropSet.setProperty< sal_Int16 >( sNumberingLevel, -1 );
- }
+ aPropSet.setProperty< sal_Int16 >( PROP_NumberingLevel, -1 );
maBulletList.pushToPropMap( rFilterBase, rioBulletMap );
if ( maParaTopMargin.bHasValue )
- {
- const OUString sParaTopMargin( CREATE_OUSTRING( "ParaTopMargin" ) );
- xPropSet->setPropertyValue( sParaTopMargin, Any( maParaTopMargin.toMargin( getCharHeightPoints( 18.0 ) ) ) );
- }
+ aPropSet.setProperty( PROP_ParaTopMargin, maParaTopMargin.toMargin( getCharHeightPoints( 18.0 ) ) );
if ( maParaBottomMargin.bHasValue )
- {
- const OUString sParaBottomMargin( CREATE_OUSTRING( "ParaBottomMargin" ) );
- xPropSet->setPropertyValue( sParaBottomMargin, Any( maParaBottomMargin.toMargin( getCharHeightPoints( 18.0 ) ) ) );
- }
+ aPropSet.setProperty( PROP_ParaBottomMargin, maParaBottomMargin.toMargin( getCharHeightPoints( 18.0 ) ) );
if ( nNumberingType == NumberingType::BITMAP )
{
- const rtl::OUString sGraphicSize( OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "GraphicSize" ) ) );
fCharacterSize = getCharHeightPoints( fCharacterSize );
com::sun::star::awt::Size aBulletSize;
aBulletSize.Width = aBulletSize.Height = static_cast< sal_Int32 >( ( fCharacterSize * ( 2540.0 / 72.0 ) * 0.8 ) );
- rioBulletMap[ sGraphicSize ] <<= aBulletSize;
+ rioBulletMap[ PROP_GraphicSize ] <<= aBulletSize;
}
boost::optional< sal_Int32 > noParaLeftMargin( moParaLeftMargin );
@@ -425,47 +387,37 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase& r
{
if ( noParaLeftMargin )
{
- const rtl::OUString sLeftMargin( OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "LeftMargin" ) ) );
- rioBulletMap[ sLeftMargin ] <<= static_cast< sal_Int32 >( *noParaLeftMargin );
+ rioBulletMap[ PROP_LeftMargin ] <<= static_cast< sal_Int32 >( *noParaLeftMargin );
noParaLeftMargin = boost::optional< sal_Int32 >( 0 );
}
if ( noFirstLineIndentation )
{
- const rtl::OUString sFirstLineOffset( OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "FirstLineOffset" ) ) );
- rioBulletMap[ sFirstLineOffset ] <<= static_cast< sal_Int32 >( *noFirstLineIndentation );
+ rioBulletMap[ PROP_FirstLineOffset ] <<= static_cast< sal_Int32 >( *noFirstLineIndentation );
noFirstLineIndentation = boost::optional< sal_Int32 >( 0 );
}
}
if ( bApplyBulletMap )
{
- Any aValue;
Reference< XIndexReplace > xNumRule;
- const rtl::OUString sNumberingRules( OUString::intern( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) ) );
- aValue = xPropSet->getPropertyValue( sNumberingRules );
- aValue >>= xNumRule;
-
+ aPropSet.getProperty( xNumRule, PROP_NumberingRules );
OSL_ENSURE( xNumRule.is(), "can't get Numbering rules");
+
if( xNumRule.is() )
{
- Sequence< PropertyValue > aBulletPropSeq;
- rioBulletMap.makeSequence( aBulletPropSeq );
- if( aBulletPropSeq.hasElements() )
+ if( !rioBulletMap.empty() )
+ {
+ Sequence< PropertyValue > aBulletPropSeq = rioBulletMap.makePropertyValueSequence();
xNumRule->replaceByIndex( getLevel(), makeAny( aBulletPropSeq ) );
+ }
- xPropSet->setPropertyValue( sNumberingRules, makeAny( xNumRule ) );
+ aPropSet.setProperty( PROP_NumberingRules, xNumRule );
}
}
if ( noParaLeftMargin )
- {
- const OUString sParaLeftMargin( CREATE_OUSTRING( "ParaLeftMargin" ) );
- xPropSet->setPropertyValue( sParaLeftMargin, Any( *noParaLeftMargin ) );
- }
+ aPropSet.setProperty( PROP_ParaLeftMargin, *noParaLeftMargin );
if ( noFirstLineIndentation )
- {
- const OUString sParaFirstLineIndent( CREATE_OUSTRING( "ParaFirstLineIndent" ) );
- xPropSet->setPropertyValue( sParaFirstLineIndent, Any( *noFirstLineIndentation ) );
- }
+ aPropSet.setProperty( PROP_ParaFirstLineIndent, *noFirstLineIndentation );
}
float TextParagraphProperties::getCharHeightPoints( float fDefault ) const
diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx b/oox/source/drawingml/textparagraphpropertiescontext.cxx
index 1de845ffd2f6..2d689ac630f1 100644
--- a/oox/source/drawingml/textparagraphpropertiescontext.cxx
+++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx
@@ -38,6 +38,7 @@
#include "oox/drawingml/fillproperties.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/core/namespaces.hxx"
+#include "properties.hxx"
#include "textspacingcontext.hxx"
#include "texttabstoplistcontext.hxx"
#include "tokens.hxx"
@@ -71,8 +72,7 @@ TextParagraphPropertiesContext::TextParagraphPropertiesContext( ContextHandler&
if ( xAttribs->hasAttribute( XML_algn ) )
{
sal_Int32 nAlign = xAttribs->getOptionalValueToken( XML_algn, XML_l );
- const OUString sParaAdjust( CREATE_OUSTRING( "ParaAdjust" ) );
- rPropertyMap[ sParaAdjust ] <<= GetParaAdjust( nAlign );
+ rPropertyMap[ PROP_ParaAdjust ] <<= GetParaAdjust( nAlign );
}
// OSL_TRACE( "OOX: para adjust %d", GetParaAdjust( nAlign ));
// TODO see to do the same with RubyAdjust
@@ -87,8 +87,7 @@ TextParagraphPropertiesContext::TextParagraphPropertiesContext( ContextHandler&
if ( xAttribs->hasAttribute( XML_latinLnBrk ) )
{
bool bLatinLineBrk = attribs.getBool( XML_latinLnBrk, true );
- const OUString sParaIsHyphenation( CREATE_OUSTRING( "ParaIsHyphenation" ) );
- rPropertyMap[ sParaIsHyphenation ] <<= bLatinLineBrk;
+ rPropertyMap[ PROP_ParaIsHyphenation ] <<= bLatinLineBrk;
}
// TODO see what to do with Asian hyphenation
@@ -99,8 +98,7 @@ TextParagraphPropertiesContext::TextParagraphPropertiesContext( ContextHandler&
if ( xAttribs->hasAttribute( XML_hangingPunct ) )
{
bool bHangingPunct = attribs.getBool( XML_hangingPunct, false );
- const OUString sParaIsHangingPunctuation( CREATE_OUSTRING( "ParaIsHangingPunctuation" ) );
- rPropertyMap[ sParaIsHangingPunctuation ] <<= bHangingPunct;
+ rPropertyMap[ PROP_ParaIsHangingPunctuation ] <<= bHangingPunct;
}
// ST_Coordinate
@@ -138,15 +136,13 @@ TextParagraphPropertiesContext::TextParagraphPropertiesContext( ContextHandler&
{
sValue = xAttribs->getOptionalValue( XML_marR );
sal_Int32 nMarR = ( sValue.getLength() == 0 ? 0 : GetCoordinate( sValue ) );
- const OUString sParaRightMargin( CREATE_OUSTRING( "ParaRightMargin" ) );
- rPropertyMap[ sParaRightMargin ] <<= nMarR;
+ rPropertyMap[ PROP_ParaRightMargin ] <<= nMarR;
}
if ( xAttribs->hasAttribute( XML_rtl ) )
{
bool bRtl = attribs.getBool( XML_rtl, false );
- const OUString sTextWritingMode( CREATE_OUSTRING( "TextWritingMode" ) );
- rPropertyMap[ sTextWritingMode ] <<= ( bRtl ? WritingMode_RL_TB : WritingMode_LR_TB );
+ rPropertyMap[ PROP_TextWritingMode ] <<= ( bRtl ? WritingMode_RL_TB : WritingMode_LR_TB );
}
}
@@ -156,11 +152,8 @@ TextParagraphPropertiesContext::~TextParagraphPropertiesContext()
{
PropertyMap& rPropertyMap( mrTextParagraphProperties.getTextParagraphPropertyMap() );
if ( maLineSpacing.bHasValue )
- {
- const OUString sParaLineSpacing( CREATE_OUSTRING( "ParaLineSpacing" ) );
- //OSL_TRACE( "OOX: ParaLineSpacing unit = %d, value = %d", maLineSpacing.nUnit, maLineSpacing.nValue );
- rPropertyMap[ sParaLineSpacing ] <<= maLineSpacing.toLineSpacing();
- }
+ rPropertyMap[ PROP_ParaLineSpacing ] <<= maLineSpacing.toLineSpacing();
+
::std::list< TabStop >::size_type nTabCount = maTabList.size();
if( nTabCount != 0 )
{
@@ -168,25 +161,17 @@ TextParagraphPropertiesContext::~TextParagraphPropertiesContext()
TabStop * aArray = aSeq.getArray();
OSL_ENSURE( aArray != NULL, "sequence array is NULL" );
::std::copy( maTabList.begin(), maTabList.end(), aArray );
- const OUString sParaTabStops( CREATE_OUSTRING( "ParaTabStops" ) );
- rPropertyMap[ sParaTabStops ] <<= aSeq;
+ rPropertyMap[ PROP_ParaTabStops ] <<= aSeq;
}
if ( mpFillPropertiesPtr && mpFillPropertiesPtr->mxGraphic.is() )
mrBulletList.setGraphic( mpFillPropertiesPtr->mxGraphic );
if( mrBulletList.is() )
- {
- const rtl::OUString sIsNumbering( CREATE_OUSTRING( "IsNumbering" ) );
- rPropertyMap[ sIsNumbering ] <<= sal_True;
- }
+ rPropertyMap[ PROP_IsNumbering ] <<= sal_True;
sal_Int16 nLevel = mrTextParagraphProperties.getLevel();
-// OSL_TRACE("OOX: numbering level = %d", nLevel );
- const OUString sNumberingLevel( CREATE_OUSTRING( "NumberingLevel" ) );
- rPropertyMap[ sNumberingLevel ] <<= (sal_Int16)nLevel;
- sal_Bool bTmp = sal_True;
- const OUString sNumberingIsNumber( CREATE_OUSTRING( "NumberingIsNumber" ) );
- rPropertyMap[ sNumberingIsNumber ] <<= bTmp;
+ rPropertyMap[ PROP_NumberingLevel ] <<= nLevel;
+ rPropertyMap[ PROP_NumberingIsNumber ] <<= sal_True;
}
// --------------------------------------------------------------------
diff --git a/oox/source/drawingml/textrun.cxx b/oox/source/drawingml/textrun.cxx
index b097d41583eb..2d8422b2f018 100644
--- a/oox/source/drawingml/textrun.cxx
+++ b/oox/source/drawingml/textrun.cxx
@@ -38,6 +38,7 @@
#include "oox/helper/helper.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/core/xmlfilterbase.hxx"
+#include "properties.hxx"
using ::rtl::OUString;
using namespace ::com::sun::star::uno;
@@ -92,7 +93,7 @@ void TextRun::insertAt(
{
PropertySet aFieldProps( xField );
aFieldProps.setProperties( maTextCharacterProperties.maHyperlinkPropertyMap );
- aFieldProps.setProperty( CREATE_OUSTRING( "Representation" ), getText() );
+ aFieldProps.setProperty( PROP_Representation, getText() );
Reference< XTextContent > xContent( xField, UNO_QUERY);
xText->insertTextContent( xStart, xContent, sal_False );
diff --git a/oox/source/drawingml/themefragmenthandler.cxx b/oox/source/drawingml/themefragmenthandler.cxx
index 6eb6cbd57d23..aa19fc612a1c 100644
--- a/oox/source/drawingml/themefragmenthandler.cxx
+++ b/oox/source/drawingml/themefragmenthandler.cxx
@@ -51,13 +51,18 @@ ThemeFragmentHandler::~ThemeFragmentHandler()
{
}
-ContextWrapper ThemeFragmentHandler::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef ThemeFragmentHandler::onCreateContext( sal_Int32 nElement, const AttributeList& )
{
// CT_OfficeStyleSheet
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return nElement == (NMSP_DRAWINGML|XML_theme);
+ switch( nElement )
+ {
+ case NMSP_DRAWINGML|XML_theme:
+ return this;
+ }
+ break;
case NMSP_DRAWINGML|XML_theme:
switch( nElement )
@@ -67,15 +72,15 @@ ContextWrapper ThemeFragmentHandler::onCreateContext( sal_Int32 nElement, const
case NMSP_DRAWINGML|XML_objectDefaults: // CT_ObjectStyleDefaults
return new objectDefaultContext( *this, mrTheme );
case NMSP_DRAWINGML|XML_extraClrSchemeLst: // CT_ColorSchemeList
- return false;
+ return 0;
case NMSP_DRAWINGML|XML_custClrLst: // CustomColorList
- return false;
+ return 0;
case NMSP_DRAWINGML|XML_ext: // CT_OfficeArtExtension
- return false;
+ return 0;
}
break;
}
- return false;
+ return 0;
}
// ============================================================================
diff --git a/oox/source/dump/biffdumper.cxx b/oox/source/dump/biffdumper.cxx
index 0f2f08cee885..3cf420d80bb8 100644
--- a/oox/source/dump/biffdumper.cxx
+++ b/oox/source/dump/biffdumper.cxx
@@ -407,13 +407,13 @@ void BiffObjectBase::writeErrorCodeItem( const String& rName, sal_uInt8 nErrCode
writeHexItem( rName, nErrCode, mxErrCodes );
}
-void BiffObjectBase::writeFontPortions( const BinFontPortionList& rPortions )
+void BiffObjectBase::writeFontPortions( const FontPortionModelList& rPortions )
{
if( !rPortions.empty() )
{
writeDecItem( "font-count", static_cast< sal_uInt32 >( rPortions.size() ) );
TableGuard aTabGuard( out(), 14 );
- for( BinFontPortionList::const_iterator aIt = rPortions.begin(), aEnd = rPortions.end(); aIt != aEnd; ++aIt )
+ for( FontPortionModelList::const_iterator aIt = rPortions.begin(), aEnd = rPortions.end(); aIt != aEnd; ++aIt )
{
MultiItemsGuard aMultiGuard( out() );
writeDecItem( "char-pos", aIt->mnPos );
@@ -430,7 +430,7 @@ OUString BiffObjectBase::dumpByteString( const String& rName, BiffStringFlags nF
bool b8BitLength = getFlag( nFlags, BIFF_STR_8BITLENGTH );
OString aString = mxBiffStrm->readByteString( !b8BitLength );
- BinFontPortionList aPortions;
+ FontPortionModelList aPortions;
if( getFlag( nFlags, BIFF_STR_EXTRAFONTS ) )
aPortions.importPortions( *mxBiffStrm, false );
@@ -441,16 +441,16 @@ OUString BiffObjectBase::dumpByteString( const String& rName, BiffStringFlags nF
{
// add leading and trailing string position to ease the following loop
if( aPortions.empty() || (aPortions.front().mnPos > 0) )
- aPortions.insert( aPortions.begin(), BinFontPortionData( 0, -1 ) );
+ aPortions.insert( aPortions.begin(), FontPortionModel( 0, -1 ) );
if( aPortions.back().mnPos < nStrLen )
- aPortions.push_back( BinFontPortionData( nStrLen, -1 ) );
+ aPortions.push_back( FontPortionModel( nStrLen, -1 ) );
// use global text encoding, if nothing special is specified
if( eDefaultTextEnc == RTL_TEXTENCODING_DONTKNOW )
eDefaultTextEnc = getBiffData().getTextEncoding();
// create all string portions according to the font id vector
- for( BinFontPortionList::const_iterator aIt = aPortions.begin(); aIt->mnPos < nStrLen; ++aIt )
+ for( FontPortionModelList::const_iterator aIt = aPortions.begin(); aIt->mnPos < nStrLen; ++aIt )
{
sal_Int32 nPortionLen = (aIt + 1)->mnPos - aIt->mnPos;
if( nPortionLen > 0 )
@@ -494,7 +494,7 @@ OUString BiffObjectBase::dumpUniString( const String& rName, BiffStringFlags nFl
if( nFontCount > 0 )
{
IndentGuard aIndGuard( out() );
- BinFontPortionList aPortions;
+ FontPortionModelList aPortions;
aPortions.importPortions( *mxBiffStrm, nFontCount, BIFF_FONTPORTION_16BIT );
writeFontPortions( aPortions );
}
@@ -1530,7 +1530,7 @@ WorkbookStreamObject::WorkbookStreamObject( const ObjectBase& rParent, const Bin
mxFillPatterns = rCfg.getNameList( "FILLPATTERNS" );
mnPTRowFields = 0;
mnPTColFields = 0;
- mnPTSxliIdx = 0;
+ mnPTRowColItemsIdx = 0;
mbHasDff = false;
initializePerSheet();
}
@@ -1578,7 +1578,7 @@ void WorkbookStreamObject::implDumpRecordBody()
if( nRecSize >= 6 ) dumpDec< sal_uInt16 >( "build-id" );
if( nRecSize >= 8 ) dumpDec< sal_uInt16 >( "build-year" );
if( nRecSize >= 12 ) dumpHex< sal_uInt32 >( "history-flags", "BOF-HISTORY-FLAGS" );
- if( nRecSize >= 16 ) dumpDec< sal_uInt32 >( "lowest-ver" );
+ if( nRecSize >= 16 ) dumpHex< sal_uInt32 >( "lowest-version", "BOF-LOWESTVERSION-FLAGS" );
if( (eBiff == BIFF4) && (getLastRecId() != BIFF_ID_OBJ) )
initializePerSheet();
break;
@@ -1969,14 +1969,20 @@ void WorkbookStreamObject::implDumpRecordBody()
}
break;
+ case BIFF_ID_DCONBINAME:
+ dumpDec< sal_uInt8 >( "builtin-id", "DEFINEDNAME-BUILTINID" );
+ dumpUnused( 3 );
+ dumpString( "source-link", BIFF_STR_8BITLENGTH, BIFF_STR_SMARTFLAGS );
+ break;
+
case BIFF_ID_DCONNAME:
dumpString( "source-name", BIFF_STR_8BITLENGTH );
- dumpString( "source-link", BIFF_STR_8BITLENGTH );
+ dumpString( "source-link", BIFF_STR_8BITLENGTH, BIFF_STR_SMARTFLAGS );
break;
case BIFF_ID_DCONREF:
dumpRange( "source-range", false );
- dumpString( "source-link", BIFF_STR_8BITLENGTH );
+ dumpString( "source-link", BIFF_STR_8BITLENGTH, BIFF_STR_SMARTFLAGS );
break;
case BIFF2_ID_DATATABLE:
@@ -2306,6 +2312,10 @@ void WorkbookStreamObject::implDumpRecordBody()
dumpDec< sal_uInt8 >( "active-pane", "PANE-ID" );
break;
+ case BIFF_ID_PCITEM_STRING:
+ dumpString( "value" );
+ break;
+
case BIFF_ID_PHONETICPR:
dumpDec< sal_uInt16 >( "font-id", "FONTNAMES" );
dumpHex< sal_uInt16 >( "flags", "PHONETICPR-FLAGS" );
@@ -2318,6 +2328,138 @@ void WorkbookStreamObject::implDumpRecordBody()
dumpByteString( "sheet-link", BIFF_STR_8BITLENGTH );
break;
+ case BIFF_ID_PTDATAFIELD:
+ dumpDec< sal_Int16 >( "field" );
+ dumpDec< sal_uInt16 >( "subtotal", "PTDATAFIELD-SUBTOTAL" );
+ dumpDec< sal_uInt16 >( "show-data-as", "PTDATAFIELD-SHOWDATAAS" );
+ dumpDec< sal_Int16 >( "base-field" );
+ dumpDec< sal_Int16 >( "base-item", "PTDATAFIELD-BASEITEM" );
+ dumpFormatIdx();
+ dumpPivotString( "name" );
+ break;
+
+ case BIFF_ID_PTDEFINITION:
+ {
+ dumpRange( "output-range" );
+ dumpRowIndex( "first-header-row-idx" );
+ dumpAddress( "first-data-pos" );
+ dumpDec< sal_uInt16 >( "cache-idx" );
+ dumpUnused( 2 );
+ dumpDec< sal_uInt16 >( "default-data-axis", "PTFIELD-AXISTYPE" );
+ dumpDec< sal_Int16 >( "default-data-pos", "PTDEFINITION-DATAFIELD-POS" );
+ dumpDec< sal_uInt16 >( "field-count" );
+ mnPTRowFields = dumpDec< sal_uInt16 >( "row-field-count" );
+ mnPTColFields = dumpDec< sal_uInt16 >( "column-field-count" );
+ dumpDec< sal_uInt16 >( "page-field-count" );
+ dumpDec< sal_uInt16 >( "data-field-count" );
+ dumpDec< sal_uInt16 >( "data-row-count" );
+ dumpDec< sal_uInt16 >( "data-column-count" );
+ dumpHex< sal_uInt16 >( "flags", "PTDEFINITION-FLAGS" );
+ dumpDec< sal_uInt16 >( "auto-format-idx" );
+ sal_uInt16 nTabNameLen = dumpDec< sal_uInt16 >( "table-name-len" );
+ sal_uInt16 nDataNameLen = dumpDec< sal_uInt16 >( "data-name-len" );
+ dumpPivotString( "table-name", nTabNameLen );
+ dumpPivotString( "data-name", nDataNameLen );
+ mnPTRowColItemsIdx = 0;
+ }
+ break;
+
+ case BIFF_ID_PTDEFINITION2:
+ {
+ dumpDec< sal_uInt16 >( "format-rec-count" );
+ sal_uInt16 nErrCaptLen = dumpDec< sal_uInt16 >( "error-caption-len" );
+ sal_uInt16 nMissCaptLen = dumpDec< sal_uInt16 >( "missing-caption-len" );
+ sal_uInt16 nTagLen = dumpDec< sal_uInt16 >( "tag-len" );
+ dumpDec< sal_uInt16 >( "select-rec-count" );
+ dumpDec< sal_uInt16 >( "page-rows" );
+ dumpDec< sal_uInt16 >( "page-cols" );
+ dumpHex< sal_uInt32 >( "flags", "PTDEFINITION2-FLAGS" );
+ sal_uInt16 nPageStyleLen = dumpDec< sal_uInt16 >( "page-field-style-len" );
+ sal_uInt16 nTabStyleLen = dumpDec< sal_uInt16 >( "pivot-table-style-len" );
+ sal_uInt16 nVacStyleLen = dumpDec< sal_uInt16 >( "vacated-style-len" );
+ dumpPivotString( "error-caption", nErrCaptLen );
+ dumpPivotString( "missing-caption", nMissCaptLen );
+ dumpPivotString( "tag", nTagLen );
+ dumpPivotString( "page-field-style", nPageStyleLen );
+ dumpPivotString( "pivot-table-style", nTabStyleLen );
+ dumpPivotString( "vacated-style", nVacStyleLen );
+ }
+ break;
+
+ case BIFF_ID_PTFIELD:
+ dumpDec< sal_uInt16 >( "axis-type", "PTFIELD-AXISTYPE" );
+ dumpDec< sal_uInt16 >( "subtotal-count" );
+ dumpHex< sal_uInt16 >( "subtotals", "PTFIELD-SUBTOTALS" );
+ dumpDec< sal_uInt16 >( "item-count" );
+ dumpPivotString( "field-name" );
+ break;
+
+ case BIFF_ID_PTFIELD2:
+ dumpHex< sal_uInt32 >( "flags", "PTFIELD2-FLAGS" );
+ dumpDec< sal_Int16 >( "autosort-basefield-idx" );
+ dumpDec< sal_Int16 >( "autoshow-basefield-idx" );
+ dumpFormatIdx();
+ if( rStrm.getRemaining() >= 2 )
+ {
+ sal_uInt16 nFuncNameLen = dumpDec< sal_uInt16 >( "subtotal-func-name-len" );
+ dumpUnused( 8 );
+ dumpPivotString( "subtotal-func-name", nFuncNameLen );
+ }
+ break;
+
+ case BIFF_ID_PTFITEM:
+ dumpDec< sal_uInt16 >( "item-type", "PTFITEM-ITEMTYPE" );
+ dumpHex< sal_uInt16 >( "flags", "PTFITEM-FLAGS" );
+ dumpDec< sal_Int16 >( "cache-idx", "PTFITEM-CACHEIDX" );
+ dumpPivotString( "item-name" );
+ break;
+
+ case BIFF_ID_PTPAGEFIELDS:
+ {
+ out().resetItemIndex();
+ TableGuard aTabGuard( out(), 17, 17, 17 );
+ while( rStrm.getRemaining() >= 6 )
+ {
+ writeEmptyItem( "#page-field" );
+ MultiItemsGuard aMultiGuard( out() );
+ IndentGuard aIndGuard( out() );
+ dumpDec< sal_Int16 >( "base-field" );
+ dumpDec< sal_Int16 >( "item", "PTPAGEFIELDS-ITEM" );
+ dumpDec< sal_uInt16 >( "dropdown-obj-id" );
+ }
+ }
+ break;
+
+ case BIFF_ID_PTROWCOLFIELDS:
+ out().resetItemIndex();
+ for( sal_Int64 nIdx = 0, nCount = rStrm.getRemaining() / 2; nIdx < nCount; ++nIdx )
+ dumpDec< sal_Int16 >( "#field-idx" );
+ break;
+
+ case BIFF_ID_PTROWCOLITEMS:
+ if( mnPTRowColItemsIdx < 2 )
+ {
+ sal_uInt16 nCount = (mnPTRowColItemsIdx == 0) ? mnPTRowFields : mnPTColFields;
+ sal_Int64 nLineSize = 8 + 2 * nCount;
+ out().resetItemIndex();
+ while( rStrm.getRemaining() >= nLineSize )
+ {
+ writeEmptyItem( "#line-data" );
+ IndentGuard aIndGuard( out() );
+ MultiItemsGuard aMultiGuard( out() );
+ dumpDec< sal_uInt16 >( "ident-count" );
+ dumpDec< sal_uInt16 >( "item-type", "PTROWCOLITEMS-ITEMTYPE" );
+ dumpDec< sal_uInt16 >( "used-count" );
+ dumpHex< sal_uInt16 >( "flags", "PTROWCOLITEMS-FLAGS" );
+ OUStringBuffer aItemList;
+ for( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx )
+ StringHelper::appendToken( aItemList, in().readInt16() );
+ writeInfoItem( "item-idxs", aItemList.makeStringAndClear() );
+ }
+ ++mnPTRowColItemsIdx;
+ }
+ break;
+
case BIFF_ID_RK:
dumpCellHeader();
dumpRk( "value" );
@@ -2354,7 +2496,7 @@ void WorkbookStreamObject::implDumpRecordBody()
getBiffData().setTextEncoding( getBiffData().getXfEncoding( nXfIdx ) );
dumpString( "value" );
getBiffData().setTextEncoding( eOldTextEnc );
- BinFontPortionList aPortions;
+ FontPortionModelList aPortions;
aPortions.importPortions( rStrm, eBiff == BIFF8 );
writeFontPortions( aPortions );
}
@@ -2433,20 +2575,6 @@ void WorkbookStreamObject::implDumpRecordBody()
}
break;
- case BIFF_ID_SXDI:
- {
- dumpDec< sal_uInt16 >( "field-idx" );
- dumpDec< sal_uInt16 >( "function", "SXDI-FUNC" );
- dumpDec< sal_uInt16 >( "data-format", "SXDI-FORMAT" );
- dumpDec< sal_uInt16 >( "format-basefield-idx" );
- dumpDec< sal_uInt16 >( "format-baseitem-idx", "SXDI-BASEITEM" );
- dumpFormatIdx();
- sal_uInt16 nNameLen = dumpDec< sal_uInt16 >( "item-name-len", "SX-NAMELEN" );
- if( nNameLen != BIFF_PT_NOSTRING )
- writeStringItem( "item-name", rStrm.readUniString( nNameLen ) );
- }
- break;
-
case BIFF_ID_SXEXT:
if( eBiff == BIFF8 )
{
@@ -2459,96 +2587,6 @@ void WorkbookStreamObject::implDumpRecordBody()
}
break;
- case BIFF_ID_SXIVD:
- out().resetItemIndex();
- for( sal_Int64 nIdx = 0, nCount = rStrm.getRemaining() / 2; nIdx < nCount; ++nIdx )
- dumpDec< sal_uInt16 >( "#field-idx" );
- break;
-
- case BIFF_ID_SXLI:
- if( mnPTSxliIdx < 2 )
- {
- sal_uInt16 nCount = (mnPTSxliIdx == 0) ? mnPTRowFields : mnPTColFields;
- sal_Int64 nLineSize = 8 + 2 * nCount;
- out().resetItemIndex();
- while( rStrm.getRemaining() >= nLineSize )
- {
- writeEmptyItem( "#line-data" );
- IndentGuard aIndGuard( out() );
- MultiItemsGuard aMultiGuard( out() );
- dumpDec< sal_uInt16 >( "ident-count" );
- dumpDec< sal_uInt16 >( "item-type", "SXLI-ITEMTYPE" );
- dumpDec< sal_uInt16 >( "used-count" );
- dumpHex< sal_uInt16 >( "flags", "SXLI-FLAGS" );
- OUStringBuffer aItemList;
- for( sal_uInt16 nIdx = 0; nIdx < nCount; ++nIdx )
- StringHelper::appendToken( aItemList, in().readuInt16() );
- writeInfoItem( "item-idxs", aItemList.makeStringAndClear() );
- }
- ++mnPTSxliIdx;
- }
- break;
-
- case BIFF_ID_SXSTRING:
- dumpString( "value" );
- break;
-
- case BIFF_ID_SXVD:
- {
- dumpDec< sal_uInt16 >( "axis-type", "SXVD-AXISTYPE" );
- dumpDec< sal_uInt16 >( "subtotal-count" );
- dumpHex< sal_uInt16 >( "subtotals", "SXVD-SUBTOTALS" );
- dumpDec< sal_uInt16 >( "item-count" );
- sal_uInt16 nNameLen = dumpDec< sal_uInt16 >( "field-name-len", "SX-NAMELEN" );
- if( nNameLen != BIFF_PT_NOSTRING )
- writeStringItem( "field-name", rStrm.readUniString( nNameLen ) );
- }
- break;
-
- case BIFF_ID_SXVDEX:
- dumpHex< sal_uInt32 >( "flags", "SXVDEX-FLAGS" );
- dumpDec< sal_uInt16 >( "autosort-basefield-idx" );
- dumpDec< sal_uInt16 >( "autoshow-basefield-idx" );
- dumpFormatIdx();
- break;
-
- case BIFF_ID_SXVI:
- {
- dumpDec< sal_uInt16 >( "item-type", "SXVI-ITEMTYPE" );
- dumpHex< sal_uInt16 >( "flags", "SXVI-FLAGS" );
- dumpDec< sal_uInt16 >( "cache-idx" );
- sal_uInt16 nNameLen = dumpDec< sal_uInt16 >( "item-name-len", "SX-NAMELEN" );
- if( nNameLen != BIFF_PT_NOSTRING )
- writeStringItem( "item-name", rStrm.readUniString( nNameLen ) );
- }
- break;
-
- case BIFF_ID_SXVIEW:
- {
- dumpRange( "output-range" );
- dumpRowIndex( "first-header-row-idx" );
- dumpAddress( "first-data-pos" );
- dumpDec< sal_uInt16 >( "cache-idx" );
- dumpUnused( 2 );
- dumpDec< sal_uInt16 >( "default-data-axis", "SXVD-AXISTYPE" );
- dumpDec< sal_Int16 >( "default-data-pos" );
- dumpDec< sal_uInt16 >( "field-count" );
- mnPTRowFields = dumpDec< sal_uInt16 >( "row-field-count" );
- mnPTColFields = dumpDec< sal_uInt16 >( "column-field-count" );
- dumpDec< sal_uInt16 >( "page-field-count" );
- dumpDec< sal_uInt16 >( "data-field-count" );
- dumpDec< sal_uInt16 >( "data-row-count" );
- dumpDec< sal_uInt16 >( "data-column-count" );
- dumpHex< sal_uInt16 >( "flags", "SXVIEW-FLAGS" );
- dumpDec< sal_uInt16 >( "auto-format-idx" );
- sal_uInt16 nTabNameLen = dumpDec< sal_uInt16 >( "table-name-len" );
- sal_uInt16 nDataNameLen = dumpDec< sal_uInt16 >( "data-name-len" );
- writeStringItem( "table-name", rStrm.readUniString( nTabNameLen ) );
- writeStringItem( "data-name", rStrm.readUniString( nDataNameLen ) );
- mnPTSxliIdx = 0;
- }
- break;
-
case BIFF_ID_TXO:
dumpHex< sal_uInt16 >( "flags", "TXO-FLAGS" );
dumpDec< sal_uInt16 >( "orientation", "TEXTORIENTATION" );
@@ -2680,6 +2718,25 @@ sal_uInt16 WorkbookStreamObject::dumpXfIdx( const String& rName, bool bBiff2Styl
return nXfIdx;
}
+OUString WorkbookStreamObject::dumpPivotString( const String& rName, sal_uInt16 nStrLen )
+{
+ OUString aString;
+ if( nStrLen != BIFF_PT_NOSTRING )
+ {
+ aString = (getBiff() == BIFF8) ?
+ getBiffStream().readUniString( nStrLen ) :
+ getBiffStream().readCharArray( nStrLen, getBiffData().getTextEncoding() );
+ writeStringItem( rName, aString );
+ }
+ return aString;
+}
+
+OUString WorkbookStreamObject::dumpPivotString( const String& rName )
+{
+ sal_uInt16 nStrLen = dumpDec< sal_uInt16 >( "string-len", "PIVOT-NAMELEN" );
+ return dumpPivotString( rName, nStrLen );
+}
+
sal_uInt16 WorkbookStreamObject::dumpCellHeader( bool bBiff2Style )
{
dumpAddress();
@@ -3391,7 +3448,7 @@ void WorkbookStreamObject::dumpObjRecString( const String& rName, sal_uInt16 nTe
void WorkbookStreamObject::dumpObjRecTextFmt( sal_uInt16 nFormatSize )
{
- BinFontPortionList aPortions;
+ FontPortionModelList aPortions;
aPortions.importPortions( getBiffStream(), nFormatSize / 8, BIFF_FONTPORTION_OBJ );
writeFontPortions( aPortions );
}
@@ -3442,9 +3499,9 @@ void WorkbookStreamObject::dumpObjRecPictFmla( sal_uInt16 nFmlaSize )
// ============================================================================
-PivotCacheStreamObject::PivotCacheStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, const ::rtl::OUString& rSysFileName )
+PivotCacheStreamObject::PivotCacheStreamObject( const ObjectBase& rParent, const BinaryInputStreamRef& rxStrm, BiffType eBiff, const ::rtl::OUString& rSysFileName )
{
- RecordStreamObject::construct( rParent, rxStrm, BIFF8, rSysFileName );
+ RecordStreamObject::construct( rParent, rxStrm, eBiff, rSysFileName );
}
void PivotCacheStreamObject::implDumpRecordBody()
@@ -3454,42 +3511,56 @@ void PivotCacheStreamObject::implDumpRecordBody()
switch( nRecId )
{
- case BIFF_ID_SXDATETIME:
- {
- sal_uInt16 nYear, nMonth;
- sal_uInt8 nDay, nHour, nMin, nSec;
- rStrm >> nYear >> nMonth >> nDay >> nHour >> nMin >> nSec;
- DateTime aDateTime( 0, nSec, nMin, nHour, nDay, nMonth, nYear );
- writeDateTimeItem( "value", aDateTime );
- }
+ case BIFF_ID_PCDEFINITION:
+ dumpDec< sal_Int32 >( "source-records" );
+ dumpHex< sal_uInt16 >( "cache-id" );
+ dumpHex< sal_uInt16 >( "flags", "PCDEFINITION-FLAGS" );
+ dumpUnused( 2 );
+ dumpDec< sal_uInt16 >( "sourcedata-field-count" );
+ dumpDec< sal_uInt16 >( "cache-field-count" );
+ dumpDec< sal_uInt16 >( "report-record-count" );
+ dumpDec< sal_uInt16 >( "database-type", "PCDSOURCE-TYPE" );
+ dumpString( "user-name" );
break;
- case BIFF_ID_SXDB:
- dumpDec< sal_uInt32 >( "source-records" );
- dumpHex< sal_uInt16 >( "stream-id" );
- dumpHex< sal_uInt16 >( "flags", "SXDB-FLAGS" );
- dumpDec< sal_uInt16 >( "block-records" );
- dumpDec< sal_uInt16 >( "standard-field-count" );
- dumpDec< sal_uInt16 >( "total-field-count" );
- dumpUnused( 2 );
- dumpDec< sal_uInt16 >( "database-type", "SXDB-TYPE" );
- dumpUniString( "user-name" );
+ case BIFF_ID_PCDEFINITION2:
+ dumpDec< double >( "refreshed-date" );
+ dumpDec< sal_Int32 >( "formula-count" );
break;
- case BIFF_ID_SXFIELD:
- dumpHex< sal_uInt16 >( "flags", "SXFIELD-FLAGS" );
- dumpDec< sal_uInt16 >( "group-child-field" );
+ case BIFF_ID_PCDFDISCRETEPR:
+ out().resetItemIndex();
+ while( !rStrm.isEof() && (rStrm.getRemaining() >= 2) )
+ dumpDec< sal_uInt16 >( "#item-index" );
+ break;
+
+ case BIFF_ID_PCDFIELD:
+ dumpHex< sal_uInt16 >( "flags", "PCDFIELD-FLAGS" );
+ dumpDec< sal_uInt16 >( "group-parent-field" );
dumpDec< sal_uInt16 >( "group-base-field" );
- dumpDec< sal_uInt16 >( "visible-items" );
+ dumpDec< sal_uInt16 >( "unique-items" );
dumpDec< sal_uInt16 >( "group-items" );
dumpDec< sal_uInt16 >( "base-items" );
- dumpDec< sal_uInt16 >( "original-items" );
+ dumpDec< sal_uInt16 >( "shared-items" );
if( rStrm.getRemaining() >= 3 )
- dumpUniString( "item-name" );
+ dumpString( "item-name" );
break;
- case BIFF_ID_SXSTRING:
- dumpUniString( "value" );
+ case BIFF_ID_PCITEM_DATE:
+ {
+ DateTime aDateTime;
+ aDateTime.Year = in().readuInt16();
+ aDateTime.Month = in().readuInt16();
+ aDateTime.Day = in().readuInt8();
+ aDateTime.Hours = in().readuInt8();
+ aDateTime.Minutes = in().readuInt8();
+ aDateTime.Seconds = in().readuInt8();
+ writeDateTimeItem( "value", aDateTime );
+ }
+ break;
+
+ case BIFF_ID_PCITEM_STRING:
+ dumpString( "value" );
break;
}
}
@@ -3508,8 +3579,10 @@ void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, cons
{
if( (rStrgPath.getLength() == 0) && (rStrmName.equalsAscii( "Book" ) || rStrmName.equalsAscii( "Workbook" )) )
WorkbookStreamObject( *this, rxStrm, rSysFileName ).dump();
+ else if( rStrgPath.equalsAscii( "_SX_DB" ) )
+ PivotCacheStreamObject( *this, rxStrm, BIFF5, rSysFileName ).dump();
else if( rStrgPath.equalsAscii( "_SX_DB_CUR" ) )
- PivotCacheStreamObject( *this, rxStrm, rSysFileName ).dump();
+ PivotCacheStreamObject( *this, rxStrm, BIFF8, rSysFileName ).dump();
else
OleStorageObject::implDumpStream( rxStrm, rStrgPath, rStrmName, rSysFileName );
}
diff --git a/oox/source/dump/biffdumper.ini b/oox/source/dump/biffdumper.ini
index 99b05ccbf3d0..3a3abfb17725 100644
--- a/oox/source/dump/biffdumper.ini
+++ b/oox/source/dump/biffdumper.ini
@@ -6,15 +6,14 @@ include-config-file=dumperbase.ini
include-config-file=dffdumper.ini
include-config-file=oledumper.ini
-# Enable entire dumper (default=off). This option does not affect the option
-# 'enable-import'.
-# 0=off, 1=on, missing: setting from dumperbase.ini
+# Enable entire dumper. This option does not affect the option 'enable-import'.
+# 0=off, 1=on, missing = use setting from dumperbase.ini
# enable-dumper=1
-# Enable import after dumping (default=on). Disabling this option allows
-# to dump a file without loading it. This option is independent from the
-# 'enable-dumper' option.
-# 0=off, 1=on, missing: setting from dumperbase.ini
+# Enable import after dumping. Disabling this option allows to dump a file
+# without loading it. This option is independent from the 'enable-dumper'
+# option.
+# 0=off, 1=on, missing = use setting from dumperbase.ini
# enable-import=1
# BIFF record settings -------------------------------------------------------
@@ -121,6 +120,11 @@ constlist=CONSTVALUE-TYPE
16=error
end
+constlist=PIVOT-NAMELEN
+ default=
+ 0xFFFF=name-in-cache
+end
+
# DFF ------------------------------------------------------------------------
flagslist=DFF-CLIENTANCHOR-FLAGS
@@ -226,6 +230,7 @@ multilist=RECORD-NAMES-BIFF2
0x0050=DCON,DCONREF,DCONNAME,,,DEFCOLWIDTH,,
# worksheet records new in BIFF3, but supported in BIFF2 streams
0x0200=DIMENSION,BLANK,,NUMBER,LABEL,BOOLERR,,
+ 0x0208=,,,INDEX,,,,
0x027E=RK
# BIFF5 style BOF
0x0809=BOF
@@ -296,13 +301,13 @@ multilist=RECORD-NAMES-BIFF5
0x0031=FONT
0x0098=,,,FILTERMODE,,AUTOFILTERINFO,AUTOFILTER,
0x00A8=,,,,,,SCENMAN,SCENARIO
- 0x00B0=SXVIEW,SXVD,SXVI,,SXIVD,SXLI,SXPI,
+ 0x00B0=PTDEFINITION,PTFIELD,PTFITEM,,PTROWCOLFIELDS,PTROWCOLITEMS,PTPAGEFIELDS,
0x00B8=DOCROUTE,RECIPNAME,,,SHAREDFMLA,MULTRK,MULTBLANK,
- 0x00C0=,MMS,ADDMENU,DELMENU,,SXDI,SXDB,SXFIELD
- 0x00C8=SXINDEXLIST,SXDOUBLE,SXBOOLEAN,SXERROR,SXINTEGER,SXSTRING,SXDATETIME,SXEMPTY
- 0x00D0=SXTBL,SXTBRGITEM,SXTBPG,OBPROJ,,SXIDSTM,RSTRING,DBCELL
- 0x00D8=SXNUMGROUP,SXGROUPINFO,BOOKBOOL,REVERT,SXEXT|PARAMQRY,SCENPROTECT,OLESIZE,UDDESC
- 0x00E0=XF,INTERFACEHDR,INTERFACEEND,SXVS,,,,
+ 0x00C0=,MMS,ADDMENU,DELMENU,,PTDATAFIELD,PCDEFINITION,PCDFIELD
+ 0x00C8=PCITEM_INDEXLIST,PCITEM_DOUBLE,PCITEM_BOOL,PCITEM_ERROR,PCITEM_INTEGER,PCITEM_STRING,PCITEM_DATE,PCITEM_MISSING
+ 0x00D0=SXTBL,SXTBRGITEM,SXTBPG,OBPROJ,,PIVOTCACHE,RSTRING,DBCELL
+ 0x00D8=PCDFRANGEPR,PCDFDISCRETEPR,BOOKBOOL,REVERT,SXEXT|PARAMQRY,SCENPROTECT,OLESIZE,UDDESC
+ 0x00E0=XF,INTERFACEHDR,INTERFACEEND,PCDSOURCE,,,,
0x0206=FORMULA
# chart records
exclude=0x1004,0x102D,0x102F,0x1036,0x1037,0x1038,0x103B
@@ -317,10 +322,10 @@ multilist=RECORD-NAMES-BIFF8
# worksheet/workbook records
0x00E0=,,,,,CELLMERGING,,
0x00E8=,IMGDATA,,MSODRAWINGGROUP,MSODRAWING,MSODRAWINGSELECTION,,PHONETICPR
- 0x00F0=SXRULE,SXEX,SXFILT,,,,SXNAME,SXSELECT
- 0x00F8=SXPAIR,SXFMLA,,SXFORMAT,SST,LABELSST,,EXTSST
- 0x0100=SXVDEX,,,SXFORMULA,,,,
- 0x0120=,,SXDBEX,,,,,
+ 0x00F0=,PTDEFINITION2,,,,,,
+ 0x00F8=,PCDFORMULAFIELD,,,SST,LABELSST,,EXTSST
+ 0x0100=PTFIELD2,,,PCDFIELDINDEX,,,,
+ 0x0120=,,PCDEFINITION2,,,,,
0x0130=,,,,,,,CHTRINSERT
0x0138=CHTRINFO,,,CHTRCELLCONTENT,,TABID,,
0x0140=CHTRMOVERANGE,,,,,,,
@@ -329,8 +334,8 @@ multilist=RECORD-NAMES-BIFF8
0x0160=USESELFS,DSF,XL5MODIFY,,,,,
0x0190=,,,,,,CHTRHEADER,
0x01A8=,USERBVIEW,USERSVIEWBEGIN,USERSVIEWEND,,QSI,EXTERNALBOOK,PROT4REV
- 0x01B0=CFHEADER,CFRULE,DATAVALIDATIONS,,,DCONBIN,TXO,REFRESHALL
- 0x01B8=HYPERLINK,NLRDELNAME,CODENAME,SXFDBTYPE,PROT4REVPASS,,DATAVALIDATION,
+ 0x01B0=CFHEADER,CFRULE,DATAVALIDATIONS,,,DCONBINAME,TXO,REFRESHALL
+ 0x01B8=HYPERLINK,NLRDELNAME,CODENAME,PCDFSQLTYPE,PROT4REVPASS,,DATAVALIDATION,
0x0800=SCREENTIP,,,WEBQRYSETTINGS,WEBQRYTABLES,,,
0x0850=,CHWRAPPEDRECORD,,,,,,CHUNITPROPERTIES
0x0858=CHPIVOTREF,,,,,,,
@@ -409,11 +414,11 @@ constlist=SIMPLE-RECORDS-BIFF5
0x00CA=uint16,bool,value
0x00CB=uint16,hex,error-code,ERRORCODES
0x00CC=int16,dec,value
- 0x00D5=uint16,hex,pivotcache-stream-id
- 0x00D8=uint16,hex,flags,SXNUMGROUP-FLAGS
+ 0x00D5=uint16,hex,cache-id
+ 0x00D8=uint16,hex,flags,PCDFRANGEPR-FLAGS
0x00DA=uint16,bool,strip-cached-values
0x00DD=uint16,bool,scenarios-protected
- 0x00E3=uint16,dec,source-type,SXVS-TYPE
+ 0x00E3=uint16,dec,source-type,PCDSOURCE-TYPE
0x1040=uint16,hex,flags,CHRADAR-FLAGS
0x105D=uint16,hex,flags,CHSERIESFORMAT-FLAGS
end
@@ -425,7 +430,7 @@ constlist=SIMPLE-RECORDS-BIFF8
0x0161=uint16,bool,double-stream
0x01AF=uint16,bool,revlog-protected
0x01B7=uint16,bool,refresh-all
- 0x01BB=uint16,dec,sql-data-type,SXFDBTYPE-DATATYPE
+ 0x01BB=uint16,dec,sql-data-type,PCDFSQLTYPE-DATATYPE
0x01BC=uint16,hex,password-hash
0x1065=uint16,dec,series-idx
end
@@ -462,7 +467,11 @@ constlist=BOF-SHEETTYPE
0x0100=workspace
end
-flagslist=BOF-HISTORY-FLAGS
+shortlist=BOF-EXCELVERSION,0,excel-97,excel-2000,excel-2002,excel-2003,excel-2007
+shortlist=BOF-LOWESTVERSION-BIFF,6,biff8
+
+combilist=BOF-HISTORY-FLAGS
+ ignore=0x000000C0
0x00000001=windows
0x00000002=risc
0x00000004=beta
@@ -470,7 +479,15 @@ flagslist=BOF-HISTORY-FLAGS
0x00000010=mac-any
0x00000020=beta-any
0x00000100=risc-any
- # missing mac here?
+ 0x00000200=out-of-mem
+ 0x00000400=out-of-mem-renderer
+ 0x00002000=font-limit-255
+ 0x0003C000=uint8,dec,max-version-saved,BOF-EXCELVERSION
+end
+
+combilist=BOF-LOWESTVERSION-FLAGS
+ 0x000000FF=uint8,dec,biff-version,BOF-LOWESTVERSION-BIFF
+ 0x00000F00=uint8,dec,version-saved,BOF-EXCELVERSION
end
# CALCMODE -------------------------------------------------------------------
@@ -987,6 +1004,8 @@ flagslist=DEFINEDNAME-FLAGS-BIFF3
0x0020=builtin
end
+shortlist=DEFINEDNAME-BUILTINID,0,consolidate-area,auto-open,auto-close,extract,database,criteria,print-area,print-titles,recorder,data-form,auto-activate,auto-deactivate,sheet-title,filterdatabase
+
combilist=DEFINEDNAME-FLAGS-BIFF4
include=DEFINEDNAME-FLAGS-BIFF3
0x0FC0=uint16,dec,func-group,DEFINEDNAME-FUNCGROUP
@@ -1326,6 +1345,58 @@ unitconverter=PAGESETUP-DPI,1,dpi
shortlist=PANE-ID,0,bottom-right,top-right,bottom-left,top-left
+# PCDEFINITION ---------------------------------------------------------------
+
+flagslist=PCDEFINITION-FLAGS
+ 0x0001=save-data
+ 0x0002=invalid
+ 0x0004=refresh-on-load
+ 0x0008=optimize-memory
+ 0x0010=background-query
+ 0x0020=enable-refresh
+end
+
+# PCDFIELD -------------------------------------------------------------------
+
+flagslist=PCDFIELD-FLAGS
+ 0x0001=has-items
+ 0x0002=has-unshared-items
+ 0x0004=calculated
+ 0x0008=has-parent
+ 0x0010=range-group
+ 0x0020=is-numeric
+ 0x0040=is-integer
+ 0x0080=has-semi-mixed-types
+ 0x0100=has-min-max
+ 0x0200=16bit-indexes
+ 0x0400=has-non-date
+ 0x0800=has-date
+end
+
+# PCDFRANGEPR ----------------------------------------------------------------
+
+combilist=PCDFRANGEPR-FLAGS
+ ignore=0xFFE0
+ 0x0001=auto-start
+ 0x0002=auto-end
+ 0x001C=uint8,dec,group-by,PCDFRANGEPR-GROUPBY
+end
+
+shortlist=PCDFRANGEPR-GROUPBY,0,numeric,seconds,minutes,hours,days,months,quarters,years
+
+# PCDFSQLTYPE ----------------------------------------------------------------
+
+shortlist=PCDFSQLTYPE-DATATYPE,0,unknown,char,numeric,decimal,int32,int16,float,real,double,,,datetime,var-char
+
+# PCDSOURCE ------------------------------------------------------------------
+
+flagslist=PCDSOURCE-TYPE
+ 0x0001=spreadsheet
+ 0x0002=extern
+ 0x0004=consolidation-area
+ 0x0010=scenario
+end
+
# PHONETICPR -----------------------------------------------------------------
shortlist=PHONETICPR-TYPE,0,halfwidth-katakana,fullwidth-katakana,hiragana,no-conversion
@@ -1341,6 +1412,134 @@ end
shortlist=PROJEXTSHEET-TYPE,0,sheet,macro,chart
+# PTDATAFIELD ----------------------------------------------------------------
+
+shortlist=PTDATAFIELD-SUBTOTAL,0,sum,count-all,average,max,min,product,count-num,std-dev,std-dev-p,variance,variance-p
+shortlist=PTDATAFIELD-SHOWDATAAS,0,normal,diff-from,percent-of,percent-diff-from,running-total-in,percent-of-row,percent-of-column,percent-of-total,index
+
+multilist=PTDATAFIELD-BASEITEM
+ default=
+ 0x7FFB=previous-item,next-item
+end
+
+# PTDEFINITION ---------------------------------------------------------------
+
+flagslist=PTDEFINITION-FLAGS
+ 0x0001=row-grandtotals
+ 0x0002=column-grandtotals
+ 0x0008=auto-format
+ 0x0010=size-auto-format
+ 0x0020=font-auto-format
+ 0x0040=align-auto-format
+ 0x0080=border-auto-format
+ 0x0100=pattern-auto-format
+ 0x0200=number-auto-format
+end
+
+constlist=PTDEFINITION-DATAFIELD-POS
+ default=
+ -1=append
+end
+
+# PTDEFINITION2 --------------------------------------------------------------
+
+combilist=PTDEFINITION2-FLAGS
+ 0x00000001=page-over-then-down
+ 0x000001FE=dec,uint8,page-wrap
+ 0x00010000=enable-wizard
+ 0x00020000=enable-drill
+ 0x00040000=enable-field-props
+ 0x00080000=preserve-formatting
+ 0x00100000=merge-labels
+ 0x00200000=show-error
+ 0x00400000=show-missing
+ 0x00800000=multiple-page-items
+end
+
+# PTFIELD --------------------------------------------------------------------
+
+flagslist=PTFIELD-AXISTYPE
+ 0x0001=row
+ 0x0002=column
+ 0x0004=page
+ 0x0008=data
+end
+
+flagslist=PTFIELD-SUBTOTALS
+ 0x0001=default
+ 0x0002=sum
+ 0x0004=count-all
+ 0x0008=average
+ 0x0010=max
+ 0x0020=min
+ 0x0040=product
+ 0x0080=count-num
+ 0x0100=std-dev
+ 0x0200=std-dev-p
+ 0x0400=variance
+ 0x0800=variance-p
+end
+
+# PTFIELD2 -------------------------------------------------------------------
+
+combilist=PTFIELD2-FLAGS
+ 0x00000001=show-all-items
+ 0x00000002=drag-to-row
+ 0x00000004=drag-to-column
+ 0x00000008=drag-to-page
+ 0x00000010=drag-to-hide
+ 0x00000080=server-based
+ 0x00000200=autosort
+ 0x00000400=ascend-sort
+ 0x00000800=autoshow
+ 0x00001000=autoshow-top
+ 0x00002000=calculated
+ 0x00200000=outline
+ 0x00400000=insert-blank-row
+ 0x00800000=subtotal-top
+ 0xFF000000=uint8,dec,autoshow-item-count
+end
+
+# PTFITEM --------------------------------------------------------------------
+
+multilist=PTFITEM-ITEMTYPE
+ 0=data,default,sum,count-all,average,max,min,product,count-num,std-dev,std-dev-p,variance,variance-p,grandtotal
+ 254=page,none
+end
+
+flagslist=PTFITEM-FLAGS
+ 0x0001=hidden
+ 0x0002=hide-detail
+ 0x0008=calculated
+ 0x0010=missing
+end
+
+constlist=PTFITEM-CACHEIDX
+ default=
+ -1=no-cache-item
+end
+
+# PTPAGEFIELDS ---------------------------------------------------------------
+
+constlist=PTPAGEFIELDS-ITEM
+ default=
+ 0x7FFD=all
+end
+
+# PTROWCOLITEMS --------------------------------------------------------------
+
+shortlist=PTROWCOLITEMS-ITEMTYPE,0,data,default,sum,count-all,average,max,min,product,count-num,std-dev,std-dev-p,variance,variance-p,grandtotal,blank-line
+
+combilist=PTROWCOLITEMS-FLAGS
+ ignore=0xC000
+ 0x0001=field-name
+ 0x01FE=uint16,dec,data-field-idx
+ 0x0200=subtotal
+ 0x0400=blocktotal
+ 0x0800=grandtotal
+ 0x1000=multi-data
+end
+
# REFMODE --------------------------------------------------------------------
shortlist=REFMODE,0,R1C1,A1
@@ -1427,41 +1626,6 @@ end
shortlist=STYLE-BUILTIN,0,normal,rowlevel,collevel,comma,currency,percent,comma-0,currency-0,hyperlink,followed-hyperlink
-# common for pivot tables ----------------------------------------------------
-
-constlist=SX-NAMELEN
- default=
- 0xFFFF=name-in-cache
-end
-
-# SXDB -----------------------------------------------------------------------
-
-flagslist=SXDB-FLAGS
- 0x0001=save-data
- 0x0002=invalid
- 0x0004=refresh-on-load
- 0x0008=opt-cache
- 0x0010=backgr-query
- 0x0020=enable-refresh
-end
-
-constlist=SXDB-TYPE
- 1=worksheet
- 2=external
- 4=consolidation
- 8=scenario
-end
-
-# SXDI -----------------------------------------------------------------------
-
-shortlist=SXDI-FUNC,0,sum,count-all,average,max,min,product,count-num,std-dev,std-dev-p,variance,variance-p
-shortlist=SXDI-FORMAT,0,normal,diff-from,percent-of,percent-diff-from,running-total-in,percent-of-row,percent-of-column,percent-of-total,index
-
-multilist=SXDI-BASEITEM
- default=
- 0x7FFB=previous-item,next-item
-end
-
# SXEXT ----------------------------------------------------------------------
combilist=SXEXT-FLAGS
@@ -1476,140 +1640,6 @@ end
shortlist=SXEXT-SOURCETYPE,1,odbc,dao,,webquery
-# SXFDBTYPE ------------------------------------------------------------------
-
-shortlist=SXFDBTYPE-DATATYPE,0,unknown,char,numeric,decimal,integer,small-int,float,real,double,datetime,,,var-char
-
-# SXFIELD --------------------------------------------------------------------
-
-combilist=SXFIELD-FLAGS
- 0x0001=has-items
- 0x0002=postpone-items
- 0x0004=calculated
- 0x0008=has-child
- 0x0010=numeric-group
- 0x0020=16bit-indexes
- 0x0DE0=uint16,hex,data-type,SXFIELD-TYPE,noshift
-end
-
-constlist=SXFIELD-TYPE
- 0x0000=none
- 0x0480=string-only
- 0x0520=integer-optdouble
- 0x0560=double-only
- 0x05A0=string-integer-optdouble
- 0x05E0=string-double-only
- 0x0900=date-only
- 0x0980=date-empty-only
- 0x0D00=date-number
- 0x0D80=date-string-optnumber
-end
-
-# SXLI -----------------------------------------------------------------------
-
-shortlist=SXLI-ITEMTYPE,0,data,default,sum,count-num,average,max,min,product,count-num,std-dev,std-dev-p,variance,variance-p,grandtotal,blank-line
-
-combilist=SXLI-FLAGS
- 0x0001=field-name
- 0x01FE=uint16,dec,data-field-idx
- 0x0200=subtotal
- 0x0400=blocktotal
- 0x0800=grandtotal
- 0x1000=multi-data
-end
-
-# SXNUMGROUP -----------------------------------------------------------------
-
-combilist=SXNUMGROUP-FLAGS
- 0x0001=auto-min
- 0x0002=auto-max
- 0x003C=uint8,dec,data-type,SXNUMGROUP-TYPE
-end
-
-shortlist=SXNUMGROUP-TYPE,1,second,minute,hour,day,month,quarter,year,numeric
-
-# SXVD -----------------------------------------------------------------------
-
-flagslist=SXVD-AXISTYPE
- 0x0001=row
- 0x0002=column
- 0x0004=page
- 0x0008=data
-end
-
-flagslist=SXVD-SUBTOTALS
- 0x0001=default
- 0x0002=sum
- 0x0004=count-all
- 0x0008=average
- 0x0010=max
- 0x0020=min
- 0x0040=product
- 0x0080=count-num
- 0x0100=std-dev
- 0x0200=std-dev-p
- 0x0400=variance
- 0x0800=variance-p
-end
-
-# SXVDEX ---------------------------------------------------------------------
-
-combilist=SXVDEX-FLAGS
- 0x00000001=show-all-items
- 0x00000002=drag-to-row
- 0x00000004=drag-to-column
- 0x00000008=drag-to-page
- 0x00000010=drag-to-hide
- 0x00000080=server-based
- 0x00000200=autosort
- 0x00000400=autosort-ascending
- 0x00000800=autoshow
- 0x00001000=autoshow-top-values
- 0x00002000=calculated
- 0x00200000=layout-report
- 0x00400000=layout-blank
- 0x00800000=layout-top
- 0xFF000000=uint8,dec,autoshow-item-count
-end
-
-# SXVI -----------------------------------------------------------------------
-
-multilist=SXVI-ITEMTYPE
- 0=data,default,sum,count-num,average,max,min,product,count-num,std-dev,std-dev-p,variance,variance-p,grandtotal
- 254=page,none
-end
-
-flagslist=SXVI-FLAGS
- 0x0001=hidden
- 0x0002=hide-detail
- 0x0004=calculated
- 0x0008=missing
-end
-
-# SXVIEW ---------------------------------------------------------------------
-
-flagslist=SXVIEW-FLAGS
- 0x0001=row-grandtotals
- 0x0002=column-grandtotals
- 0x0008=auto-format
- 0x0010=size-auto-format
- 0x0020=font-auto-format
- 0x0040=align-auto-format
- 0x0080=border-auto-format
- 0x0100=pattern-auto-format
- 0x0200=number-auto-format
-end
-
-# SXVS -----------------------------------------------------------------------
-
-flagslist=SXVS-TYPE
- 0x0001=spreadsheet
- 0x0002=extern
- 0x0004=consolidation-area
- 0x0008=pivot-table
- 0x0010=scenario
-end
-
# TXO ------------------------------------------------------------------------
combilist=TXO-FLAGS
diff --git a/oox/source/dump/dumperbase.cxx b/oox/source/dump/dumperbase.cxx
index fdea7c9c6e8d..581bd8fbc898 100644
--- a/oox/source/dump/dumperbase.cxx
+++ b/oox/source/dump/dumperbase.cxx
@@ -140,12 +140,11 @@ Reference< XTextInputStream > InputOutputHelper::openTextInputStream(
Reference< XActiveDataSink > xDataSink( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TextInputStream" ) ), UNO_QUERY_THROW );
xDataSink->setInputStream( rxInStrm );
xTextInStrm.set( xDataSink, UNO_QUERY_THROW );
+ xTextInStrm->setEncoding( rEncoding );
}
catch( Exception& )
{
}
- if( xTextInStrm.is() )
- xTextInStrm->setEncoding( rEncoding );
return xTextInStrm;
}
@@ -181,12 +180,11 @@ Reference< XTextOutputStream > InputOutputHelper::openTextOutputStream(
Reference< XActiveDataSource > xDataSource( rxFactory->createInstance( CREATE_OUSTRING( "com.sun.star.io.TextOutputStream" ) ), UNO_QUERY_THROW );
xDataSource->setOutputStream( rxOutStrm );
xTextOutStrm.set( xDataSource, UNO_QUERY_THROW );
+ xTextOutStrm->setEncoding( rEncoding );
}
catch( Exception& )
{
}
- if( xTextOutStrm.is() )
- xTextOutStrm->setEncoding( rEncoding );
return xTextOutStrm;
}
@@ -3062,7 +3060,7 @@ void RecordObjectBase::implDump()
}
// remaining undumped data
- else if( !in().isEof() && (in().tell() == nRecPos) )
+ if( !in().isEof() && (in().tell() == nRecPos) )
dumpRawBinary( mnRecSize, false );
else
dumpRemainingTo( nRecPos + mnRecSize );
@@ -3083,13 +3081,15 @@ void RecordObjectBase::constructRecObjBase( const BinaryInputStreamRef& rxBaseSt
maRecNames = rRecNames;
maSimpleRecs = rSimpleRecs;
mnRecPos = mnRecId = mnRecSize = 0;
+ if( InputObjectBase::implIsValid() )
+ mbShowRecPos = cfg().getBoolOption( "show-record-position", true );
}
void RecordObjectBase::writeHeader()
{
MultiItemsGuard aMultiGuard( out() );
writeEmptyItem( "REC" );
- if( mxBaseStrm->isSeekable() )
+ if( mbShowRecPos && mxBaseStrm->isSeekable() )
writeShortHexItem( "pos", mnRecPos, "CONV-DEC" );
writeShortHexItem( "size", mnRecSize, "CONV-DEC" );
ItemGuard aItem( out(), "id" );
diff --git a/oox/source/dump/dumperbase.ini b/oox/source/dump/dumperbase.ini
index 03ecb9a6b514..bf51365642c0 100644
--- a/oox/source/dump/dumperbase.ini
+++ b/oox/source/dump/dumperbase.ini
@@ -32,6 +32,11 @@ max-binary-data-size=128
# 0=off, 1=on
show-trailing-unknown=1
+# Shows the absolute stream position of records in the record header field
+# (default=on).
+# 0=off, 1=on
+show-record-position=0
+
# name lists =================================================================
#
# Syntax descriptions
@@ -187,7 +192,7 @@ show-trailing-unknown=1
# exclude = <bitmask>[,<bitmask>...]
# ignore = <bitfield>
# <bitmask> = <constname> | !<constname> | !<constname0>!<constname1>
-# <bitfield> = <datatype>,<dataformat>,<bitfieldname>[,<LISTNAME>]
+# <bitfield> = <datatype>,<dataformat>,<bitfieldname>[,<LISTNAME>[,noshift]]
# end
#
# - include (optional): See constlist above.
@@ -201,6 +206,7 @@ show-trailing-unknown=1
# - <bitfieldname>: The name of the embedded bitfield.
# - <LISTAME>: Optional name list with names for the values of the embedded
# bitfield.
+# - noshift: If set, the extracted value is not shifted to the right.
#
# ----------------------------------------------------------------------------
#
diff --git a/oox/source/dump/xlsbdumper.cxx b/oox/source/dump/xlsbdumper.cxx
index 682e2357595b..52866cc7b7ca 100644
--- a/oox/source/dump/xlsbdumper.cxx
+++ b/oox/source/dump/xlsbdumper.cxx
@@ -44,6 +44,7 @@
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
using ::com::sun::star::uno::Reference;
+using ::com::sun::star::util::DateTime;
using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::io::XInputStream;
using ::oox::core::FilterBase;
@@ -145,14 +146,14 @@ void RecordObjectBase::writeErrorCodeItem( const String& rName, sal_uInt8 nErrCo
writeHexItem( rName, nErrCode, mxErrCodes );
}
-void RecordObjectBase::writeFontPortions( const BinFontPortionList& rPortions )
+void RecordObjectBase::writeFontPortions( const FontPortionModelList& rPortions )
{
if( !rPortions.empty() )
{
writeDecItem( "font-count", static_cast< sal_uInt32 >( rPortions.size() ) );
IndentGuard aIndGuard( out() );
TableGuard aTabGuard( out(), 14 );
- for( BinFontPortionList::const_iterator aIt = rPortions.begin(), aEnd = rPortions.end(); aIt != aEnd; ++aIt )
+ for( FontPortionModelList::const_iterator aIt = rPortions.begin(), aEnd = rPortions.end(); aIt != aEnd; ++aIt )
{
MultiItemsGuard aMultiGuard( out() );
writeDecItem( "char-pos", aIt->mnPos );
@@ -161,14 +162,14 @@ void RecordObjectBase::writeFontPortions( const BinFontPortionList& rPortions )
}
}
-void RecordObjectBase::writePhoneticPortions( const BinPhoneticPortionList& rPortions )
+void RecordObjectBase::writePhoneticPortions( const PhoneticPortionModelList& rPortions )
{
if( !rPortions.empty() )
{
writeDecItem( "portion-count", static_cast< sal_uInt32 >( rPortions.size() ) );
IndentGuard aIndGuard( out() );
TableGuard aTabGuard( out(), 14, 21 );
- for( BinPhoneticPortionList::const_iterator aIt = rPortions.begin(), aEnd = rPortions.end(); aIt != aEnd; ++aIt )
+ for( PhoneticPortionModelList::const_iterator aIt = rPortions.begin(), aEnd = rPortions.end(); aIt != aEnd; ++aIt )
{
MultiItemsGuard aMultiGuard( out() );
writeDecItem( "char-pos", aIt->mnPos );
@@ -207,7 +208,7 @@ OUString RecordObjectBase::dumpString( const String& rName, bool bRich, bool b32
if( getFlag( nFlags, OOBIN_STRINGFLAG_FONTS ) )
{
IndentGuard aIndGuard( out() );
- BinFontPortionList aPortions;
+ FontPortionModelList aPortions;
aPortions.importPortions( *mxStrm );
writeFontPortions( aPortions );
}
@@ -217,7 +218,7 @@ OUString RecordObjectBase::dumpString( const String& rName, bool bRich, bool b32
{
IndentGuard aIndGuard( out() );
dumpString( "phonetic-text" );
- BinPhoneticPortionList aPortions;
+ PhoneticPortionModelList aPortions;
aPortions.importPortions( *mxStrm );
writePhoneticPortions( aPortions );
dumpDec< sal_uInt16 >( "font-id", "FONTNAMES" );
@@ -243,6 +244,19 @@ void RecordObjectBase::dumpColor( const String& rName )
dumpColorABGR();
}
+DateTime RecordObjectBase::dumpPivotDateTime( const String& rName )
+{
+ DateTime aDateTime;
+ aDateTime.Year = in().readuInt16();
+ aDateTime.Month = in().readuInt16();
+ aDateTime.Day = in().readuInt8();
+ aDateTime.Hours = in().readuInt8();
+ aDateTime.Minutes = in().readuInt8();
+ aDateTime.Seconds = in().readuInt8();
+ writeDateTimeItem( rName, aDateTime );
+ return aDateTime;
+}
+
sal_Int32 RecordObjectBase::dumpColIndex( const String& rName )
{
sal_Int32 nCol;
@@ -1191,6 +1205,20 @@ void RecordStreamObject::implDumpRecordBody()
dumpColor();
break;
+ case OOBIN_ID_COMMENT:
+ dumpDec< sal_Int32 >( "author-id" );
+ dumpRange( "ref" );
+ dumpGuid();
+ break;
+
+ case OOBIN_ID_COMMENTAUTHOR:
+ dumpString( "author" );
+ break;
+
+ case OOBIN_ID_COMMENTTEXT:
+ dumpString( "text", true );
+ break;
+
case OOBIN_ID_CONDFORMATTING:
dumpDec< sal_Int32 >( "cfrule-count" );
dumpDec< sal_Int32 >( "pivot-table", "BOOLEAN" );
@@ -1651,6 +1679,159 @@ void RecordStreamObject::implDumpRecordBody()
dumpHex< sal_uInt8 >( "flags", "PANE-FLAGS" );
break;
+ case OOBIN_ID_PCDEFINITION:
+ {
+ dumpDec< sal_uInt8 >( "refreshed-version" );
+ dumpDec< sal_uInt8 >( "min-refresh-version" );
+ dumpDec< sal_uInt8 >( "created-version" );
+ dumpHex< sal_uInt8 >( "flags-1", "PCDEFINITION-FLAGS1" );
+ dumpDec< sal_Int32 >( "missing-items-limit", "PCDEFINITION-MISSINGITEMS" );
+ dumpDec< double >( "refreshed-date" );
+ sal_uInt8 nFlags2 = dumpHex< sal_uInt8 >( "flags-2", "PCDEFINITION-FLAGS2" );
+ dumpDec< sal_Int32 >( "record-count" );
+ if( nFlags2 & 0x01 ) dumpString( "refreshed-by" );
+ if( nFlags2 & 0x02 ) dumpString( "rel-id" );
+ }
+ break;
+
+ case OOBIN_ID_PCDFIELD:
+ {
+ sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "PCDFIELD-FLAGS" );
+ dumpDec< sal_Int32 >( "numfmt-id" );
+ dumpDec< sal_Int16 >( "sql-datatype" );
+ dumpDec< sal_Int32 >( "hierarchy" );
+ dumpDec< sal_Int32 >( "hierarchy-level" );
+ sal_Int32 nMappingCount = dumpDec< sal_Int32 >( "property-mapping-count" );
+ dumpString( "name" );
+ if( nFlags & 0x0008 ) dumpString( "caption" );
+ if( nFlags & 0x0100 ) mxFmlaObj->dumpNameFormula( "formula" );
+ if( nMappingCount > 0 )
+ {
+ sal_Int32 nBytes = dumpDec< sal_Int32 >( "property-mapping-size" );
+ dumpArray( "property-mapping-indexes", nBytes );
+ }
+ if( nFlags & 0x0200 ) dumpString( "property-name" );
+ }
+ break;
+
+ case OOBIN_ID_PCDFIELDGROUP:
+ dumpDec< sal_Int32 >( "parent-field" );
+ dumpDec< sal_Int32 >( "base-field" );
+ break;
+
+ case OOBIN_ID_PCDFRANGEPR:
+ dumpDec< sal_uInt8 >( "group-by", "PCDFRANGEPR-GROUPBY" );
+ dumpHex< sal_uInt8 >( "flags", "PCDFRANGEPR-FLAGS" );
+ dumpDec< double >( "start-value" );
+ dumpDec< double >( "end-value" );
+ dumpDec< double >( "interval" );
+ break;
+
+ case OOBIN_ID_PCDFSHAREDITEMS:
+ {
+ sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "PCDFSHAREDITEMS-FLAGS" );
+ dumpDec< sal_Int32 >( "count" );
+ if( nFlags & 0x0100 ) dumpDec< double >( "min-value" );
+ if( nFlags & 0x0100 ) dumpDec< double >( "max-value" );
+ }
+ break;
+
+ case OOBIN_ID_PCDSHEETSOURCE:
+ {
+ sal_uInt8 nIsDefName = dumpBoolean( "is-def-name" );
+ dumpBoolean( "is-builtin-def-name" );
+ sal_uInt8 nFlags = dumpHex< sal_uInt8 >( "flags", "PCDWORKSHEETSOURCE-FLAGS" );
+ if( nFlags & 0x02 ) dumpString( "sheet-name" );
+ if( nFlags & 0x01 ) dumpString( "rel-id" );
+ if( nIsDefName == 0 ) dumpRange(); else dumpString( "def-name" );
+ }
+ break;
+
+ case OOBIN_ID_PCDSOURCE:
+ dumpDec< sal_Int32 >( "source-type", "PCDSOURCE-TYPE" );
+ dumpDec< sal_Int32 >( "connection-id" );
+ break;
+
+ case OOBIN_ID_PCITEM_ARRAY:
+ {
+ sal_uInt16 nType = dumpDec< sal_uInt16 >( "type", "PCITEM_ARRAY-TYPE" );
+ sal_Int32 nCount = dumpDec< sal_Int32 >( "count" );
+ out().resetItemIndex();
+ for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
+ {
+ switch( nType )
+ {
+ case 1: dumpDec< double >( "#value" ); break;
+ case 2: dumpString( "#value" ); break;
+ case 16: dumpErrorCode( "#value" ); break;
+ case 32: dumpPivotDateTime( "#value" ); break;
+ default: nIdx = nCount;
+ }
+ }
+ }
+ break;
+
+ case OOBIN_ID_PCITEM_BOOL:
+ dumpBoolean( "value" );
+ break;
+
+ case OOBIN_ID_PCITEM_DATE:
+ dumpPivotDateTime( "value" );
+ break;
+
+ case OOBIN_ID_PCITEM_DOUBLE:
+ dumpDec< double >( "value" );
+ // TODO: server formatting
+ break;
+
+ case OOBIN_ID_PCITEM_ERROR:
+ dumpErrorCode( "value" );
+ // TODO: server formatting
+ break;
+
+ case OOBIN_ID_PCITEM_INDEX:
+ dumpDec< sal_Int32 >( "index" );
+ break;
+
+ case OOBIN_ID_PCITEM_MISSING:
+ // TODO: server formatting
+ break;
+
+
+ case OOBIN_ID_PCITEM_STRING:
+ dumpString( "value" );
+ // TODO: server formatting
+ break;
+
+ case OOBIN_ID_PCITEMA_BOOL:
+ dumpBoolean( "value" );
+ // TODO: additional info
+ break;
+
+ case OOBIN_ID_PCITEMA_DATE:
+ dumpPivotDateTime( "value" );
+ // TODO: additional info
+ break;
+
+ case OOBIN_ID_PCITEMA_DOUBLE:
+ dumpDec< double >( "value" );
+ // TODO: additional info
+ break;
+
+ case OOBIN_ID_PCITEMA_ERROR:
+ dumpErrorCode( "value" );
+ // TODO: additional info
+ break;
+
+ case OOBIN_ID_PCITEMA_MISSING:
+ // TODO: additional info
+ break;
+
+ case OOBIN_ID_PCITEMA_STRING:
+ dumpString( "value" );
+ // TODO: additional info
+ break;
+
case OOBIN_ID_PHONETICPR:
dumpDec< sal_uInt16 >( "font-id", "FONTNAMES" );
dumpDec< sal_Int32 >( "type", "PHONETICPR-TYPE" );
@@ -1661,6 +1842,134 @@ void RecordStreamObject::implDumpRecordBody()
dumpString( "rel-id" );
break;
+ case OOBIN_ID_PIVOTAREA:
+ dumpDec< sal_Int32 >( "field" );
+ dumpDec< sal_uInt8 >( "type", "PIVOTAREA-TYPE" );
+ dumpHex< sal_uInt8 >( "flags-1", "PIVOTAREA-FLAGS1" );
+ dumpHex< sal_uInt16 >( "flags-2", "PIVOTAREA-FLAGS2" );
+ break;
+
+ case OOBIN_ID_PIVOTCACHE:
+ dumpDec< sal_Int32 >( "cache-id" );
+ dumpString( "rel-id" );
+ break;
+
+ case OOBIN_ID_PTCOLFIELDS:
+ dumpDec< sal_Int32 >( "count" );
+ out().resetItemIndex();
+ while( in().getRemaining() >= 4 )
+ dumpDec< sal_Int32 >( "#field", "PT-FIELDINDEX" );
+ break;
+
+ case OOBIN_ID_PTDATAFIELD:
+ dumpDec< sal_Int32 >( "field" );
+ dumpDec< sal_Int32 >( "subtotal", "PTDATAFIELD-SUBTOTAL" );
+ dumpDec< sal_Int32 >( "show-data-as", "PTDATAFIELD-SHOWDATAAS" );
+ dumpDec< sal_Int32 >( "base-field" );
+ dumpDec< sal_Int32 >( "base-item", "PTDATAFIELD-BASEITEM" );
+ dumpDec< sal_Int32 >( "number-format" );
+ if( dumpBool< sal_uInt8 >( "has-name" ) )
+ dumpString( "name" );
+ break;
+
+ case OOBIN_ID_PTDEFINITION:
+ {
+ dumpDec< sal_uInt8 >( "created-version" );
+ dumpHex< sal_uInt8 >( "flags-1", "PTDEFINITION-FLAGS1" );
+ dumpHex< sal_uInt16 >( "flags-2", "PTDEFINITION-FLAGS2" );
+ sal_uInt32 nFlags3 = dumpHex< sal_uInt32 >( "flags-3", "PTDEFINITION-FLAGS3" );
+ sal_uInt32 nFlags4 = dumpHex< sal_uInt32 >( "flags-4", "PTDEFINITION-FLAGS4" );
+ dumpDec< sal_uInt8 >( "datafield-axis", "PTDEFINITION-DATAFIELD-AXIS" );
+ dumpDec< sal_uInt8 >( "page-wrap" );
+ dumpDec< sal_uInt8 >( "refreshed-version" );
+ dumpDec< sal_uInt8 >( "min-refresh-version" );
+ dumpDec< sal_Int32 >( "datafield-position", "PTDEFINITION-DATAFIELD-POS" );
+ dumpDec< sal_Int16 >( "autoformat-id" );
+ dumpUnused( 2 );
+ dumpDec< sal_Int32 >( "next-chart-id" );
+ dumpDec< sal_Int32 >( "cache-id" );
+ dumpString( "name" );
+ if( nFlags3 & 0x00080000 ) dumpString( "data-caption" );
+ if( nFlags3 & 0x00100000 ) dumpString( "grand-total-caption" );
+ if( (nFlags4 & 0x00000040) == 0 ) dumpString( "error-caption" );
+ if( (nFlags4 & 0x00000080) == 0 ) dumpString( "missing-caption" );
+ if( nFlags3 & 0x00200000 ) dumpString( "page-field-style" );
+ if( nFlags3 & 0x00400000 ) dumpString( "pivot-table-style" );
+ if( nFlags3 & 0x00800000 ) dumpString( "vacated-style" );
+ if( nFlags3 & 0x40000000 ) dumpString( "tag" );
+ if( nFlags4 & 0x00000800 ) dumpString( "col-header-caption" );
+ if( nFlags4 & 0x00000400 ) dumpString( "row-header-caption" );
+ }
+ break;
+
+ case OOBIN_ID_PTFIELD:
+ dumpHex< sal_uInt32 >( "flags-1", "PTFIELD-FLAGS1" );
+ dumpDec< sal_Int32 >( "num-fmt" );
+ dumpHex< sal_uInt32 >( "flags-2", "PTFIELD-FLAGS2" );
+ dumpDec< sal_Int32 >( "autoshow-items" );
+ dumpDec< sal_Int32 >( "autoshow-datafield-idx" );
+ break;
+
+ case OOBIN_ID_PTFILTER:
+ {
+ dumpDec< sal_Int32 >( "field" );
+ dumpDec< sal_Int32 >( "member-prop-field" );
+ dumpDec< sal_Int32 >( "type", "PTFILTER-TYPE" );
+ dumpUnused( 4 );
+ dumpDec< sal_Int32 >( "unique-id" );
+ dumpDec< sal_Int32 >( "measure-data-field" );
+ dumpDec< sal_Int32 >( "measure-data-hierarchy" );
+ sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "PTFILTER-FLAGS" );
+ if( nFlags & 0x0001 ) dumpString( "name" );
+ if( nFlags & 0x0002 ) dumpString( "description" );
+ if( nFlags & 0x0004 ) dumpString( "str-value1" );
+ if( nFlags & 0x0008 ) dumpString( "str-value2" );
+ }
+ break;
+
+ case OOBIN_ID_PTFITEM:
+ {
+ dumpDec< sal_uInt8 >( "type", "PTFITEM-TYPE" );
+ sal_uInt16 nFlags = dumpHex< sal_uInt16 >( "flags", "PTFITEM-FLAGS" );
+ dumpDec< sal_Int32 >( "cache-idx" );
+ if( nFlags & 0x0010 ) dumpString( "display-name" );
+ }
+ break;
+
+ case OOBIN_ID_PTLOCATION:
+ dumpRange( "location" );
+ dumpDec< sal_Int32 >( "first-header-row" );
+ dumpDec< sal_Int32 >( "first-data-row" );
+ dumpDec< sal_Int32 >( "first-data-col" );
+ dumpDec< sal_Int32 >( "page-row-count" );
+ dumpDec< sal_Int32 >( "page-col-count" );
+ break;
+
+ case OOBIN_ID_PTPAGEFIELD:
+ {
+ dumpDec< sal_Int32 >( "field" );
+ dumpDec< sal_Int32 >( "cache-item", "PTPAGEFIELD-ITEM" );
+ dumpDec< sal_Int32 >( "olap-hierarchy" );
+ sal_uInt8 nFlags = dumpHex< sal_uInt8 >( "flags", "PTPAGEFIELD-FLAGS" );
+ if( nFlags & 0x01 ) dumpString( "unique-name" );
+ if( nFlags & 0x02 ) dumpString( "olap-caption" );
+ }
+ break;
+
+ case OOBIN_ID_PTREFERENCE:
+ dumpDec< sal_Int32 >( "field", "PT-FIELDINDEX" );
+ dumpDec< sal_Int32 >( "item-count" );
+ dumpHex< sal_uInt16 >( "flags-1", "PTREFERENCE-FLAGS1" );
+ dumpHex< sal_uInt8 >( "flags-2", "PTREFERENCE-FLAGS2" );
+ break;
+
+ case OOBIN_ID_PTROWFIELDS:
+ dumpDec< sal_Int32 >( "count" );
+ out().resetItemIndex();
+ while( in().getRemaining() >= 4 )
+ dumpDec< sal_Int32 >( "#field", "PT-FIELDINDEX" );
+ break;
+
case OOBIN_ID_ROW:
dumpRowIndex();
dumpDec< sal_Int32 >( "custom-xf-id" );
@@ -1782,10 +2091,16 @@ void RecordStreamObject::implDumpRecordBody()
break;
case OOBIN_ID_TABLESTYLEINFO:
- dumpHex< sal_uInt16 >( "flags" );
+ dumpHex< sal_uInt16 >( "flags", "TABLESTYLEINFO-FLAGS" );
dumpString( "style-name" );
break;
+ case OOBIN_ID_TOP10FILTER:
+ dumpHex< sal_uInt8 >( "flags", "TOP10FILTER-FLAGS" );
+ dumpDec< double >( "value" );
+ dumpDec< double >( "cell-value" );
+ break;
+
case OOBIN_ID_VOLTYPEMAIN:
dumpString( "first" );
break;
@@ -1889,6 +2204,8 @@ void RootStorageObject::implDumpStream( const BinaryInputStreamRef& rxStrm, cons
rStrgPath.equalsAscii( "xl/dialogsheets" ) ||
rStrgPath.equalsAscii( "xl/externalLinks" ) ||
rStrgPath.equalsAscii( "xl/macrosheets" ) ||
+ rStrgPath.equalsAscii( "xl/pivotCache" ) ||
+ rStrgPath.equalsAscii( "xl/pivotTables" ) ||
rStrgPath.equalsAscii( "xl/tables" ) ||
rStrgPath.equalsAscii( "xl/worksheets" ) )
{
diff --git a/oox/source/dump/xlsbdumper.ini b/oox/source/dump/xlsbdumper.ini
index f8253ab40351..593fcfb85a48 100644
--- a/oox/source/dump/xlsbdumper.ini
+++ b/oox/source/dump/xlsbdumper.ini
@@ -5,15 +5,14 @@
include-config-file=dumperbase.ini
include-config-file=oledumper.ini
-# Enable entire dumper (default=off). This option does not affect the option
-# 'enable-import'.
-# 0=off, 1=on, missing: setting from dumperbase.ini
+# Enable entire dumper. This option does not affect the option 'enable-import'.
+# 0=off, 1=on, missing = use setting from dumperbase.ini
# enable-dumper=1
-# Enable import after dumping (default=on). Disabling this option allows
-# to dump a file without loading it. This option is independent from the
-# 'enable-dumper' option.
-# 0=off, 1=on, missing: setting from dumperbase.ini
+# Enable import after dumping. Disabling this option allows to dump a file
+# without loading it. This option is independent from the 'enable-dumper'
+# option.
+# 0=off, 1=on, missing = use setting from dumperbase.ini
# enable-import=1
# name lists =================================================================
@@ -163,9 +162,9 @@ shortlist=ARRAYVALUE-TYPE,0,number,string,boolean,,error
multilist=RECORD-NAMES
0x0000=ROW,CELL_BLANK,CELL_RK,CELL_ERROR,CELL_BOOL,CELL_DOUBLE,CELL_STRING,CELL_SI
0x0008=FORMULA_STRING,FORMULA_DOUBLE,FORMULA_BOOL,FORMULA_ERROR,MULTCELL_BLANK,MULTCELL_RK,MULTCELL_ERROR,MULTCELL_BOOL
- 0x0010=MULTCELL_DOUBLE,MULTCELL_STRING,MULTCELL_SI,SI,,,,
-
- 0x0020=,,,,,,,DEFINEDNAME
+ 0x0010=MULTCELL_DOUBLE,MULTCELL_STRING,MULTCELL_SI,SI,PCITEM_MISSING,PCITEM_DOUBLE,PCITEM_BOOL,PCITEM_ERROR
+ 0x0018=PCITEM_STRING,PCITEM_DATE,PCITEM_INDEX,PCITEMA_MISSING,PCITEMA_DOUBLE,PCITEMA_BOOL,PCITEMA_ERROR,PCITEMA_STRING
+ 0x0020=PCITEMA_DATE,PCRECORD,PCRECORDDT,FRT,FRT_END,,,DEFINEDNAME
0x0028=BINARYINDEXROWS,,BINARYINDEXBLOCK,FONT,NUMFMT,FILL,BORDER,XF
0x0030=CELLSTYLE,,,,,,,
0x0038=,,,,COL,MULTCELL_RSTRING,CELL_RSTRING,CALCCHAINCELL
@@ -175,25 +174,38 @@ multilist=RECORD-NAMES
0x0088=BOOKVIEWS_END,SHEETVIEW,SHEETVIEW_END,CHARTSHEETVIEWS,CHARTSHEETVIEWS_END,CHARTSHEETVIEW,CHARTSHEETVIEW_END,SHEETS
0x0090=SHEETS_END,SHEETDATA,SHEETDATA_END,SHEETPR,DIMENSION,,,PANE
0x0098=SELECTION,WORKBOOKPR,SMARTTAGPR,FILERECOVERYPR,SHEET,CALCPR,WORKBOOKVIEW,SST
- 0x00A0=SST_END,AUTOFILTER,AUTOFILTER_END,FILTERCOLUMN,FILTERCOLUMN_END,,,
+ 0x00A0=SST_END,AUTOFILTER,AUTOFILTER_END,FILTERCOLUMN,FILTERCOLUMN_END,FILTERS,FILTERS_END,FILTER
+ 0x00A8=COLORFILTER,ICONFILTER,TOP10FILTER,DYNAMICFILTER,CUSTOMFILTERS,CUSTOMFILTERS_END,CUSTOMFILTER,AUTOFILTERDATEGROUPITEM
+ 0x00B0=MERGECELL,MERGECELLS,MERGECELLS_END,PCDEFINITION,PCDEFINITION_END,PCDFIELDS,PCDFIELDS_END,PCDFIELD
+ 0x00B8=PCDFIELD_END,PCDSOURCE,PCDSOURCE_END,PCDSHEETSOURCE,PCDSHEETSOURCE_END,PCDFSHAREDITEMS,PCDFSHAREDITEMS_END,PCITEM_ARRAY
+ 0x00C0=PCITEM_ARRAY_END,PCRECORDS,PCRECORDS_END,,,,,
+
+ 0x00D8=,,,PCDFIELDGROUP,PCDFIELDGROUP_END,PCDFGROUPITEMS,PCDFGROUPITEMS_END,PCDFRANGEPR
+ 0x00E0=PCDFRANGEPR_END,PCDFDISCRETEPR,PCDFDISCRETEPR_END,,,,,
- 0x00B0=,MERGECELLS,MERGECELLS_END,,,,,
+ 0x00F0=,,,,,,,PIVOTAREA
+ 0x00F8=PIVOTAREA_END,PTREFERENCES,PTREFERENCES_END,PTREFERENCE,PTREFERENCE_END,,,
0x0110=,,,,,BINARYINDEX_END,STYLESHEET,STYLESHEET_END
+ 0x0118=PTDEFINITION,PTFITEM_END,PTFITEM,PTFITEMS,PTFITEMS_END,PTFIELD,PTFIELD_END,PTFIELDS
+ 0x0120=PTFIELDS_END,PTPAGEFIELD,PTPAGEFIELD_END,PTPAGEFIELDS,PTPAGEFIELDS_END,PTDATAFIELD,PTDATAFIELD_END,PTDATAFIELDS
+ 0x0128=PTDATAFIELDS_END,,,,,,,
+ 0x0130=,,,,,PTROWFIELDS,PTROWFIELDS_END,PTCOLFIELDS
+ 0x0138=PTCOLFIELDS_END,PTLOCATION_END,PTLOCATION,PTDEFINITION_END,,,,
0x0150=,,,,,,,TABLE
0x0158=TABLE_END,TABLECOLUMNS,TABLECOLUMNS_END,TABLECOLUMN,TABLECOLUMN_END,,,CALCEDCOLUMNFMLA
0x0160=,EXTERNALREFS,EXTERNALREFS_END,EXTERNALREF,,EXTERNALSELF,EXTERNALSAME,EXTSHEETNAMES
0x0168=EXTERNALBOOK,,EXTERNALSHEETS,EXTSHEETDATA,EXTSHEETDATA_END,,EXTROW,EXTCELL_BLANK
0x0170=EXTCELL_DOUBLE,EXTCELL_BOOL,EXTCELL_ERROR,EXTCELL_STRING,,,,
-
- 0x0180=,,,,,,COLS,COLS_END
+ 0x0178=,,,,,,PTREFERENCEITEM,PTREFERENCEITEM_END
+ 0x0180=PIVOTCACHES,PIVOTCACHES_END,PIVOTCACHE,PIVOTCACHE_END,,,COLS,COLS_END
0x0188=ROWBREAKS,ROWBREAKS_END,COLBREAKS,COLBREAKS_END,BRK,CUSTOMWORKBOOKVIEW,,
0x01A0=,,,,,,CUSTOMSHEETVIEWS,CUSTOMSHEETVIEW
0x01A8=CUSTOMSHEETVIEW_END,CUSTOMSHEETVIEWS_END,ARRAY,SHAREDFMLA,DATATABLE,,,
- 0x01C8=,,,,,CONDFORMATTING,CONDFORMATTING_END,CFRULE
+ 0x01C8=,,,AUTOSORTSCOPE,AUTOSORTSCOPE_END,CONDFORMATTING,CONDFORMATTING_END,CFRULE
0x01D0=CFRULE_END,ICONSET,ICONSET_END,DATABAR,DATABAR_END,COLORSCALE,COLORSCALE_END,CFVO
0x01D8=,COLORS,COLORS_END,RGBCOLOR,PAGEMARGINS,PRINTOPTIONS,PAGESETUP,HEADERFOOTER
0x01E0=HEADERFOOTER_END,,,,,SHEETFORMATPR,,
@@ -210,12 +222,12 @@ multilist=RECORD-NAMES
0x0238=,MRUCOLORS,MRUCOLORS_END,,COLOR,DATAVALIDATIONS,DATAVALIDATIONS_END,
0x0240=,EXTERNALNAME,DDEITEMVALUES,DDEITEMVALUES_END,DDEITEM_DOUBLE,DDEITEM_ERROR,DDEITEM_STRING,DDEITEM_EMPTY
0x0248=DDEITEM_BOOL,EXTERNALNAMEREF,EXTERNALNAMEFLAGS,EXTERNALNAME_END,EXTERNALBOOK_END,,,
-
- 0x0258=,,,FILLS,FILLS_END,,,
+ 0x0250=,,,,,,,PTFILTERS
+ 0x0258=PTFILTERS_END,PTFILTER,PTFILTER_END,FILLS,FILLS_END,,,
0x0260=,,,FONTS,FONTS_END,BORDERS,BORDERS_END,NUMFMTS
0x0268=NUMFMTS_END,CELLXFS,CELLXFS_END,CELLSTYLES,CELLSTYLES_END,,,
- 0x0270=,,CELLSTYLEXFS,CELLSTYLEXFS_END
- 0x0278=,,,,,,OLEOBJECTS,OLEOBJECT
+ 0x0270=,,CELLSTYLEXFS,CELLSTYLEXFS_END,COMMENTS,COMMENTS_END,COMMENTAUTHORS,COMMENTAUTHORS_END
+ 0x0278=COMMENTAUTHOR,COMMENTLIST,COMMENTLIST_END,COMMENT,COMMENT_END,COMMENTTEXT,OLEOBJECTS,OLEOBJECT
0x0280=OLEOBJECTS_END,,,CONTROLS,CONTROL,CONTROLS_END,,
0x0288=,,,CHARTSHEETPR,CHARTPAGESETUP,CUSTOMCHARTVIEWS,CUSTOMCHARTVIEWS_END,CUSTOMCHARTVIEW
0x0290=CUSTOMCHARTVIEW_END,,,,TABLEPARTS,TABLEPART,TABLEPARTS_END,SHEETCALCPR
@@ -225,7 +237,17 @@ end
# simple records -------------------------------------------------------------
constlist=SIMPLE-RECORDS
+ 0x001A=int32,dec,item-index
+ 0x00B5=int32,dec,count
+ 0x00C1=int32,dec,count
+ 0x00DD=int32,dec,count
+ 0x00E1=int32,dec,count
+ 0x00F9=int32,dec,count
+ 0x011B=int32,dec,count
+ 0x011F=int32,dec,count
+ 0x0123=int32,dec,count
0x0159=int32,dec,count
+ 0x017E=int32,dec,item-index
0x01DD=uint16,hex,flags,PRINTOPTIONS-FLAGS
0x01F9=int32,dec,count
0x0204=int32,dec,type,VOLTYPE-TYPE
@@ -233,6 +255,7 @@ constlist=SIMPLE-RECORDS
0x0244=double,dec,value
0x0245=uint8,dec,error-code,ERRORCODES
0x0248=uint8,dec,value,BOOLEAN
+ 0x0257=int32,dec,count
0x025B=int32,dec,count
0x0263=int32,dec,count
0x0265=int32,dec,count
@@ -537,11 +560,117 @@ flagslist=PANE-FLAGS
0x02=remove-split-with-freeze
end
+# PCDEFINITION ---------------------------------------------------------------
+
+flagslist=PCDEFINITION-FLAGS1
+ 0x01=save-data
+ 0x02=invalid
+ 0x04=refresh-on-load
+ 0x08=optimize-memory
+ 0x10=enable-refresh
+ 0x20=background-query
+ 0x40=upgrade-on-refresh
+ 0x80=tupel-cache
+end
+
+constlist=PCDEFINITION-MISSINGITEMS
+ default=
+ -1=clear-automatic
+ 0=clear-always
+end
+
+flagslist=PCDEFINITION-FLAGS2
+ 0x01=has-username
+ 0x02=has-rel-id
+ 0x04=support-subquery
+ 0x08=support-drilldown
+end
+
+# PCDFIELD -------------------------------------------------------------------
+
+flagslist=PCDFIELD-FLAGS
+ 0x0001=server-field
+ 0x0002=no-unique-items
+ 0x0004=database-field
+ 0x0008=has-caption
+ 0x0010=member-property-field
+ 0x0100=has-formula
+ 0x0200=has-property-name
+end
+
+# PCDFRANGEPR ----------------------------------------------------------------
+
+shortlist=PCDFRANGEPR-GROUPBY,0,numeric,seconds,minutes,hours,days,months,quarters,years
+
+flagslist=PCDFRANGEPR-FLAGS
+ 0x01=auto-start
+ 0x02=auto-end
+ 0x04=date-group
+end
+
+# PCDFSHAREDITEMS ------------------------------------------------------------
+
+flagslist=PCDFSHAREDITEMS-FLAGS
+ 0x0001=has-semi-mixed-types
+ 0x0002=has-non-date
+ 0x0004=has-date
+ 0x0008=has-string-bool-err
+ 0x0010=has-blank
+ 0x0020=has-mixed-types
+ 0x0040=is-numeric
+ 0x0080=is-integer
+ 0x0100=has-min-max
+ 0x0200=long-text
+end
+
+# PCDSOURCE ------------------------------------------------------------------
+
+shortlist=PCDSOURCE-TYPE,0,worksheet,external,consolidation,scenario
+
+# PCDWORKSHEETSOURCE ---------------------------------------------------------
+
+flagslist=PCDWORKSHEETSOURCE-FLAGS
+ 0x01=has-rel-id
+ 0x02=has-sheet
+end
+
+# PCITEM_ARRAY ---------------------------------------------------------------
+
+constlist=PCITEM_ARRAY-TYPE
+ 0x0001=double
+ 0x0002=string
+ 0x0010=error
+ 0x0020=date
+end
+
# PHONETICPR -----------------------------------------------------------------
shortlist=PHONETICPR-TYPE,0,halfwidth-katakana,fullwidth-katakana,hiragana,no-conversion
shortlist=PHONETICPR-ALIGNMENT,0,no-control,left,center,distributed
+# PIVOTAREA ------------------------------------------------------------------
+
+shortlist=PIVOTAREA-TYPE,0,none,normal,data,all,origin,button,top-right
+
+flagslist=PIVOTAREA-FLAGS1
+ 0x01=data-only
+ 0x02=label-only
+ 0x04=grand-row
+ 0x08=grand-col
+ 0x10=cache-based
+ 0x20=line-mode
+ 0x40=part
+ 0x80=fuzzy
+end
+
+combilist=PIVOTAREA-FLAGS2
+ 0x0001=row
+ 0x0002=col
+ 0x0004=page
+ 0x0008=data
+ 0x0FF0=uint8,dec,pos-on-axis
+end
+
# PRINTOPTIONS ---------------------------------------------------------------
flagslist=PRINTOPTIONS-FLAGS
@@ -552,6 +681,229 @@ flagslist=PRINTOPTIONS-FLAGS
0x0010=gridlines-set
end
+# Pivot table globals --------------------------------------------------------
+
+constlist=PT-FIELDINDEX
+ default=
+ -2=data-field
+end
+
+# PTDATAFIELD ----------------------------------------------------------------
+
+shortlist=PTDATAFIELD-SUBTOTAL,0,sum,count-all,average,max,min,product,count-num,std-dev,std-dev-p,var,var-p
+shortlist=PTDATAFIELD-SHOWDATAAS,0,normal,difference,percent,percent-diff,run-total,percent-of-row,percent-of-col,percent-of-total,index
+
+constlist=PTDATAFIELD-BASEITEM
+ default=
+ 0x001000FC=previous-item
+ 0x001000FD=next-item
+end
+
+# PTDEFINITION ---------------------------------------------------------------
+
+flagslist=PTDEFINITION-FLAGS1
+ 0x01=show-items
+ 0x02=edit-data
+ 0x04=disable-field-list
+ 0x08=refresh-on-load
+ 0x10=hide-calc-members
+ 0x20=with-hidden-totals
+ 0x40=show-multiple-label
+end
+
+combilist=PTDEFINITION-FLAGS2
+ 0x0001=hide-data-drop-down
+ 0x0010=hide-drill
+ 0x0020=print-drill
+ 0x0040=show-member-prop-tips
+ 0x0080=hide-data-tips
+ 0x7F00=uint8,dec,indent
+ 0x8000=hide-headers
+end
+
+flagslist=PTDEFINITION-FLAGS3
+ ignore=0x00010000
+ 0x00000001=hide-drop-zones
+ 0x00000002=no-asterisk-totals
+ 0x00000004=show-empty-row
+ 0x00000008=show-empty-col
+ 0x00000010=enable-wizard
+ 0x00000020=enable-drill
+ 0x00000040=enable-field-props
+ 0x00000080=preserve-formatting
+ 0x00000100=use-auto-formatting
+ 0x00000200=show-error
+ 0x00000400=show-missing
+ 0x00000800=page-over-then-down
+ 0x00001000=multiple-page-items
+ 0x00002000=row-grand-totals
+ 0x00004000=col-grand-totals
+ 0x00008000=field-print-titles
+ 0x00020000=item-print-titles
+ 0x00040000=merge-labels
+ 0x00080000=has-data-caption
+ 0x00100000=has-grand-total-caption
+ 0x00200000=has-page-field-style
+ 0x00400000=has-pivot-table-style
+ 0x00800000=has-vacated-style
+ 0x01000000=apply-num-fmt
+ 0x02000000=apply-font
+ 0x04000000=apply-alignment
+ 0x08000000=apply-border
+ 0x10000000=apply-pattern
+ 0x20000000=protected
+ 0x40000000=has-tag
+end
+
+flagslist=PTDEFINITION-FLAGS4
+ 0x00000001=compact
+ 0x00000002=outline
+ 0x00000004=outline-data
+ 0x00000008=compact-data
+ 0x00000010=no-grid-drop-zones
+ 0x00000020=published
+ 0x00000040=!has-error-caption
+ 0x00000080=!has-missing-caption
+ 0x00000100=immersive-off
+ 0x00000200=single-field-filters
+ 0x00000400=has-row-header-caption
+ 0x00000800=has-col-header-caption
+ 0x00001000=field-list-sort-asc
+ 0x00004000=no-custom-list-sort
+end
+
+shortlist=PTDEFINITION-DATAFIELD-AXIS,1,row-axis,col-axis
+
+constlist=PTDEFINITION-DATAFIELD-POS
+ default=
+ -1=append
+end
+
+# PTFIELD --------------------------------------------------------------------
+
+flagslist=PTFIELD-FLAGS1
+ 0x00000001=row
+ 0x00000002=col
+ 0x00000004=page
+ 0x00000008=data
+ 0x00000100=default
+ 0x00000200=sum
+ 0x00000400=count-all
+ 0x00000800=average
+ 0x00001000=max
+ 0x00002000=min
+ 0x00004000=product
+ 0x00008000=count-num
+ 0x00010000=std-dev
+ 0x00020000=std-dev-p
+ 0x00040000=variance
+ 0x00080000=variance-p
+ 0x01000000=drilled-level
+ 0x02000000=hide-dropdown
+ 0x04000000=hidden-level
+ 0x08000000=has-member-prop-caption
+ 0x10000000=compact
+ 0x20000000=has-display-name
+ 0x40000000=has-subtotal-caption
+ 0x80000000=source-ordered
+end
+
+flagslist=PTFIELD-FLAGS2
+ 0x00000001=drag-to-row
+ 0x00000002=drag-to-col
+ 0x00000004=drag-to-page
+ 0x00000008=drag-to-hide
+ 0x00000010=drag-to-data
+ 0x00000020=show-all-items
+ 0x00000040=outline
+ 0x00000080=insert-blank-row
+ 0x00000100=subtotal-top
+ 0x00000200=server-based
+ 0x00000800=insert-page-break
+ 0x00001000=autosort
+ 0x00002000=ascend-sort
+ 0x00004000=autoshow
+ 0x00008000=autoshow-top
+ 0x00010000=hide-new-items
+ 0x00020000=has-value-filter
+ 0x00040000=exclude-new-items
+ 0x00080000=multiple-page-items
+ 0x00100000=simple-data-sort
+ 0x00200000=show-member-prop-report
+ 0x00400000=show-member-prop-tooltip
+ 0x00800000=show-member-prop-caption
+ 0x01000000=items-drilled
+end
+
+# PTFILTER -------------------------------------------------------------------
+
+multilist=PTFILTER-TYPE
+ 0=unknown,count,percent,sum,caption-equal,caption-not-equal,caption-begins-width,caption-not-begins-with,caption-ends-width,caption-not-ends-with
+ 10=caption-contains,caption-not-contains,caption-greater-than,caption-greater-equal,caption-less-than,caption-less-equal,caption-between,caption-not-between,value-equal,value-not-equal
+ 20=value-greater-than,value-greater-equal,value-less-than,value-less-equal,value-between,value-not-between,date-equal,date-older-than,date-newer-than,date-between
+ 30=date-tomorrow,date-today,date-yesterday,date-next-week,date-this-week,date-last-week,date-next-month,date-this-month,date-last-month,date-next-quarter
+ 40=date-this-quarter,date-last-quarter,date-next-year,date-this-year,date-last-year,year-to-date,date-q1,date-q2,date-q3,date-q4
+ 50=date-jan,date-feb,date-mar,date-apr,date-may,date-jun,date-jul,date-aug,date-sep,date-oct
+ 60=date-nov,date-dec,date-not-equal,date-older-equal,date-newer-equal,date-not-between
+end
+
+flagslist=PTFILTER-FLAGS
+ 0x0001=has-name
+ 0x0002=has-description
+ 0x0004=has-str-value1
+ 0x0008=has-str-value2
+end
+
+# PTFITEM --------------------------------------------------------------------
+
+shortlist=PTFITEM-TYPE,0,data,default,sum,count-all,average,max,min,product,count-mumbers,std-dev,std-dev-p,var,var-p,grand-total,blank
+
+flagslist=PTFITEM-FLAGS
+ 0x0001=hidden
+ 0x0002=hide-detail
+ 0x0004=calculated
+ 0x0008=missing
+ 0x0010=has-name
+ 0x0020=drilled-member
+ 0x0040=can-have-children
+ 0x0080=collapsed-member
+ 0x0100=olap-filter-selected
+end
+
+# PTPAGEFIELD ----------------------------------------------------------------
+
+constlist=PTPAGEFIELD-ITEM
+ default=
+ 0x001000FE=mutiple-items
+end
+
+flagslist=PTPAGEFIELD-FLAGS
+ 0x01=has-unique-name
+ 0x02=has-member-caption
+end
+
+# PTREFERENCE ----------------------------------------------------------------
+
+flagslist=PTREFERENCE-FLAGS1
+ 0x0001=data
+ 0x0002=default
+ 0x0004=sum
+ 0x0008=count-all
+ 0x0010=average
+ 0x0020=max
+ 0x0040=min
+ 0x0080=product
+ 0x0100=count-num
+ 0x0200=std-dev
+ 0x0400=std-dev-p
+ 0x0800=variance
+ 0x1000=variance-p
+end
+
+flagslist=PTREFERENCE-FLAGS2
+ 0x01=selected
+end
+
# ROW ------------------------------------------------------------------------
combilist=ROW-FLAGS1
@@ -643,6 +995,16 @@ flagslist=TABLESTYLEINFO-FLAGS
0x0002=show-last-column
0x0004=show-row-stripes
0x0008=show-column-stripes
+ 0x0010=show-row-headers
+ 0x0020=show-column-headers
+end
+
+# TOP10FILTER ----------------------------------------------------------------
+
+flagslist=TOP10FILTER-FLAGS
+ 0x01=!bottom!top
+ 0x02=percent
+ 0x04=applied
end
# VOLTYPE --------------------------------------------------------------------
diff --git a/oox/source/helper/attributelist.cxx b/oox/source/helper/attributelist.cxx
index 7a5b0a99e61e..708ecd82c533 100644
--- a/oox/source/helper/attributelist.cxx
+++ b/oox/source/helper/attributelist.cxx
@@ -34,6 +34,7 @@
using ::rtl::OUString;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Exception;
+using ::com::sun::star::util::DateTime;
using ::com::sun::star::xml::sax::XFastAttributeList;
namespace oox {
@@ -114,6 +115,24 @@ OptValue< bool > AttributeList::getBool( sal_Int32 nElement ) const
return OptValue< bool >( onValue.has(), onValue.get() != 0 );
}
+OptValue< DateTime > AttributeList::getDateTime( sal_Int32 nElement ) const
+{
+ OUString aValue = mxAttribs->getOptionalValue( nElement );
+ DateTime aDateTime;
+ bool bValid = (aValue.getLength() == 19) && (aValue[ 4 ] == '-') && (aValue[ 7 ] == '-') &&
+ (aValue[ 10 ] == 'T') && (aValue[ 13 ] == ':') && (aValue[ 16 ] == ':');
+ if( bValid )
+ {
+ aDateTime.Year = static_cast< sal_uInt16 >( aValue.copy( 0, 4 ).toInt32() );
+ aDateTime.Month = static_cast< sal_uInt16 >( aValue.copy( 5, 2 ).toInt32() );
+ aDateTime.Day = static_cast< sal_uInt16 >( aValue.copy( 8, 2 ).toInt32() );
+ aDateTime.Hours = static_cast< sal_uInt16 >( aValue.copy( 11, 2 ).toInt32() );
+ aDateTime.Minutes = static_cast< sal_uInt16 >( aValue.copy( 14, 2 ).toInt32() );
+ aDateTime.Seconds = static_cast< sal_uInt16 >( aValue.copy( 17, 2 ).toInt32() );
+ }
+ return OptValue< DateTime >( bValid, aDateTime );
+}
+
// defaulted return values ----------------------------------------------------
sal_Int32 AttributeList::getToken( sal_Int32 nElement, sal_Int32 nDefault ) const
@@ -163,6 +182,11 @@ bool AttributeList::getBool( sal_Int32 nElement, bool bDefault ) const
return getBool( nElement ).get( bDefault );
}
+DateTime AttributeList::getDateTime( sal_Int32 nElement, const DateTime& rDefault ) const
+{
+ return getDateTime( nElement ).get( rDefault );
+}
+
// ============================================================================
} // namespace oox
diff --git a/oox/source/helper/makefile.mk b/oox/source/helper/makefile.mk
index d584c14d2c07..7677a1fa3329 100644
--- a/oox/source/helper/makefile.mk
+++ b/oox/source/helper/makefile.mk
@@ -53,7 +53,6 @@ SLOFILES = \
$(SLO)$/olestorage.obj \
$(SLO)$/progressbar.obj \
$(SLO)$/propertymap.obj \
- $(SLO)$/propertysequence.obj \
$(SLO)$/propertyset.obj \
$(SLO)$/recordinputstream.obj \
$(SLO)$/storagebase.obj \
diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx
index ea604463abe8..ccc5cfdd62b4 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -29,163 +29,55 @@
************************************************************************/
#include "oox/helper/propertymap.hxx"
-
-#include <string>
-#include <stdio.h>
#include <osl/mutex.hxx>
#include <cppuhelper/implbase2.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include "properties.hxx"
using ::rtl::OUString;
-using ::osl::MutexGuard;
-using ::osl::Mutex;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::lang;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::lang::IllegalArgumentException;
+using ::com::sun::star::lang::WrappedTargetException;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::beans::PropertyValue;
+using ::com::sun::star::beans::PropertyVetoException;
+using ::com::sun::star::beans::UnknownPropertyException;
+using ::com::sun::star::beans::XPropertyChangeListener;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::beans::XPropertySetInfo;
+using ::com::sun::star::beans::XVetoableChangeListener;
namespace oox {
-bool PropertyMap::hasProperty( const ::rtl::OUString& rName ) const
-{
- return find( rName ) != end();
-}
+// ============================================================================
-const Any* PropertyMap::getPropertyValue( const ::rtl::OUString& rName ) const
-{
- PropertyMapBase::const_iterator aIter( find( rName ) );
- return aIter != end() ? &((*aIter).second) : NULL;
-}
+namespace {
-void PropertyMap::makeSequence( Sequence< NamedValue >& rSequence ) const
-{
- rSequence.realloc( size() );
- NamedValue* pValues = rSequence.getArray();
- const_iterator aIter( begin() );
- const_iterator aEnd( end() );
+/** Thread-save singleton of a vector of all supported property names. */
+struct PropertyNamesPool : public ::rtl::Static< PropertyNamesList, PropertyNamesPool > {};
- for( ; aIter != aEnd; aIter++, pValues++ )
- {
- pValues->Name = (*aIter).first;
- pValues->Value = (*aIter).second;
- }
-}
+// ----------------------------------------------------------------------------
+typedef ::cppu::WeakImplHelper2< XPropertySet, XPropertySetInfo > GenericPropertySetImplBase;
-void PropertyMap::makeSequence( Sequence< PropertyValue >& rSequence ) const
-{
- rSequence.realloc( size() );
- PropertyValue* pValues = rSequence.getArray();
- const_iterator aIter( begin() );
- const_iterator aEnd( end() );
-
- for( ; aIter != aEnd; aIter++, pValues++ )
- {
- pValues->Name = (*aIter).first;
- pValues->Value = (*aIter).second;
- pValues->State = PropertyState_DIRECT_VALUE;
- }
-}
-
-void PropertyMap::makeSequence( Sequence< OUString >& rNames, Sequence< Any >& rValues ) const
-{
- rNames.realloc( size() );
- rValues.realloc( size() );
- OUString* pNames = rNames.getArray();
- Any* pValues = rValues.getArray();
- const_iterator aIter( begin() );
- const_iterator aEnd( end() );
-
- for( ; aIter != aEnd; aIter++, pNames++, pValues++ )
- {
- *pNames = (*aIter).first;
- *pValues = (*aIter).second;
- }
-}
-
-
-void PropertyMap::dump_debug(const char *pMessage)
-{
- const_iterator aIter( begin() );
- const_iterator aEnd( end() );
-
- if( pMessage != NULL)
- {
- OSL_TRACE("OOX: %s", pMessage);
- }
-
- if(aIter == aEnd)
- {
- OSL_TRACE("OOX: Properties empty");
- return;
- }
-
- OSL_TRACE("OOX: Properties");
-
- for( ; aIter != aEnd; aIter++ )
- {
- std::string value;
- const Any & any = (*aIter).second;
- try {
- char buffer[256];
- if(!any.hasValue() )
- {
- value = "*empty*";
- }
- else if(any.has<OUString>() )
- {
- OUString aStr;
- any >>= aStr;
- value = OUStringToOString( aStr, RTL_TEXTENCODING_ASCII_US ).getStr();
- }
- else if(any.has<sal_Int16>())
- {
- sal_Int16 v = 0;
- any >>= v;
- sprintf(buffer, "%d", (int)v);
- value = buffer;
- }
- else if(any.has<sal_Int32>())
- {
- sal_Int32 v = 0;
- any >>= v;
- sprintf(buffer, "%d", (int)v);
- value = buffer;
- }
- else if(any.has<sal_Bool>())
- {
- sal_Bool v = sal_False;
- any >>= v;
- sprintf(buffer, "%d", (int)v);
- value = buffer;
- }
- else
- {
- value = "contains a: ";
- value += OUStringToOString(any.getValueTypeName(), RTL_TEXTENCODING_ASCII_US ).getStr();
- }
- }
- catch( ... )
- {
- value = "unable to convert from ";
- value += OUStringToOString(any.getValueTypeName(), RTL_TEXTENCODING_ASCII_US ).getStr();
- }
- OSL_TRACE("OOX: -> %s = %s", OUStringToOString( (*aIter).first, RTL_TEXTENCODING_ASCII_US ).getStr(),
- value.c_str());
- }
-}
+/** This class implements a generic XPropertySet.
-/** this class implements a generic XPropertySet
- Properties of all names and types can be set and later retrieved
- TODO: move this to comphelper or better find an existing implementation */
-class GenericPropertySet : public ::cppu::WeakImplHelper2< XPropertySet, XPropertySetInfo >,
- private PropertyMapBase,
- private Mutex
+ Properties of all names and types can be set and later retrieved.
+ TODO: move this to comphelper or better find an existing implementation
+ */
+class GenericPropertySet : public GenericPropertySetImplBase, private ::osl::Mutex
{
public:
- GenericPropertySet();
- GenericPropertySet( const PropertyMapBase& rProperties );
+ explicit GenericPropertySet();
+ explicit GenericPropertySet( const PropertyMap& rPropMap );
// XPropertySet
- virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (RuntimeException);
+ virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (RuntimeException);
virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException);
virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const Reference< XPropertyChangeListener >& xListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
@@ -194,18 +86,26 @@ public:
virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const Reference< XVetoableChangeListener >& aListener ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException);
// XPropertySetInfo
- virtual Sequence< Property > SAL_CALL getProperties( ) throw (RuntimeException);
+ virtual Sequence< Property > SAL_CALL getProperties() throw (RuntimeException);
virtual Property SAL_CALL getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException);
- virtual ::sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw (RuntimeException);
+ virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) throw (RuntimeException);
+
+private:
+ typedef ::std::map< OUString, Any > PropertyNameMap;
+ PropertyNameMap maPropMap;
};
+// ----------------------------------------------------------------------------
+
GenericPropertySet::GenericPropertySet()
{
}
-GenericPropertySet::GenericPropertySet( const PropertyMapBase& rProperties )
-: PropertyMapBase( rProperties )
+GenericPropertySet::GenericPropertySet( const PropertyMap& rPropMap )
{
+ const PropertyNamesList& rPropNames = PropertyNamesPool::get();
+ for( PropertyMap::const_iterator aIt = rPropMap.begin(), aEnd = rPropMap.end(); aIt != aEnd; ++aIt )
+ maPropMap[ rPropNames[ aIt->first ] ] = aIt->second;
}
Reference< XPropertySetInfo > SAL_CALL GenericPropertySet::getPropertySetInfo() throw (RuntimeException)
@@ -213,69 +113,117 @@ Reference< XPropertySetInfo > SAL_CALL GenericPropertySet::getPropertySetInfo()
return this;
}
-void SAL_CALL GenericPropertySet::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
+void SAL_CALL GenericPropertySet::setPropertyValue( const OUString& rPropertyName, const Any& rValue ) throw (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
{
- MutexGuard aGuard( *this );
- (*this)[ aPropertyName ] = aValue;
+ ::osl::MutexGuard aGuard( *this );
+ maPropMap[ rPropertyName ] = rValue;
}
-Any SAL_CALL GenericPropertySet::getPropertyValue( const OUString& PropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
+Any SAL_CALL GenericPropertySet::getPropertyValue( const OUString& rPropertyName ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException)
{
- iterator aIter( find( PropertyName ) );
- if( aIter == end() )
+ PropertyNameMap::iterator aIt = maPropMap.find( rPropertyName );
+ if( aIt == maPropMap.end() )
throw UnknownPropertyException();
-
- return (*aIter).second;
+ return aIt->second;
}
-void SAL_CALL GenericPropertySet::addPropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {}
+// listeners are not supported by this implementation
+void SAL_CALL GenericPropertySet::addPropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {}
void SAL_CALL GenericPropertySet::removePropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {}
void SAL_CALL GenericPropertySet::addVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {}
void SAL_CALL GenericPropertySet::removeVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) throw (UnknownPropertyException, WrappedTargetException, RuntimeException) {}
// XPropertySetInfo
-Sequence< Property > SAL_CALL GenericPropertySet::getProperties( ) throw (RuntimeException)
+Sequence< Property > SAL_CALL GenericPropertySet::getProperties() throw (RuntimeException)
{
- Sequence< Property > aRet( size() );
- Property* pProperty = aRet.getArray();
-
- for( iterator aIter = begin(); aIter != end(); aIter++, pProperty++ )
+ Sequence< Property > aSeq( static_cast< sal_Int32 >( maPropMap.size() ) );
+ Property* pProperty = aSeq.getArray();
+ for( PropertyNameMap::iterator aIt = maPropMap.begin(), aEnd = maPropMap.end(); aIt != aEnd; ++aIt, ++pProperty )
{
- pProperty->Name = (*aIter).first;
+ pProperty->Name = aIt->first;
pProperty->Handle = 0;
- pProperty->Type = (*aIter).second.getValueType();
+ pProperty->Type = aIt->second.getValueType();
pProperty->Attributes = 0;
}
-
- return aRet;
+ return aSeq;
}
-Property SAL_CALL GenericPropertySet::getPropertyByName( const OUString& aName ) throw (UnknownPropertyException, RuntimeException)
+Property SAL_CALL GenericPropertySet::getPropertyByName( const OUString& rPropertyName ) throw (UnknownPropertyException, RuntimeException)
{
- iterator aIter( find( aName ) );
- if( aIter == end() )
+ PropertyNameMap::iterator aIt = maPropMap.find( rPropertyName );
+ if( aIt == maPropMap.end() )
throw UnknownPropertyException();
-
Property aProperty;
- aProperty.Name = (*aIter).first;
+ aProperty.Name = aIt->first;
aProperty.Handle = 0;
- aProperty.Type = (*aIter).second.getValueType();
+ aProperty.Type = aIt->second.getValueType();
aProperty.Attributes = 0;
-
return aProperty;
}
-::sal_Bool SAL_CALL GenericPropertySet::hasPropertyByName( const OUString& Name ) throw (RuntimeException)
+sal_Bool SAL_CALL GenericPropertySet::hasPropertyByName( const OUString& rPropertyName ) throw (RuntimeException)
{
- return find( Name ) != end();
+ return maPropMap.find( rPropertyName ) != maPropMap.end();
}
+} // namespace
-Reference< XPropertySet > PropertyMap::makePropertySet() const
+// ============================================================================
+
+const OUString& PropertyMap::getPropertyName( sal_Int32 nPropId )
{
- Reference< XPropertySet > xSet( new GenericPropertySet(*this) );
- return xSet;
+ OSL_ENSURE( (0 <= nPropId) && (nPropId < PROP_COUNT), "PropertyMap::getPropertyName - invalid property identifier" );
+ return PropertyNamesPool::get()[ nPropId ];
}
+const Any* PropertyMap::getProperty( sal_Int32 nPropId ) const
+{
+ const_iterator aIt = find( nPropId );
+ return (aIt == end()) ? 0 : &aIt->second;
}
+Sequence< PropertyValue > PropertyMap::makePropertyValueSequence() const
+{
+ Sequence< PropertyValue > aSeq( static_cast< sal_Int32 >( size() ) );
+ if( !empty() )
+ {
+ const PropertyNamesList& rPropNames = PropertyNamesPool::get();
+ PropertyValue* pValues = aSeq.getArray();
+ for( const_iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt, ++pValues )
+ {
+ OSL_ENSURE( (0 <= aIt->first) && (aIt->first < PROP_COUNT), "PropertyMap::makePropertyValueSequence - invalid property identifier" );
+ pValues->Name = rPropNames[ aIt->first ];
+ pValues->Value = aIt->second;
+ pValues->State = ::com::sun::star::beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ return aSeq;
+}
+
+void PropertyMap::fillSequences( Sequence< OUString >& rNames, Sequence< Any >& rValues ) const
+{
+ rNames.realloc( static_cast< sal_Int32 >( size() ) );
+ rValues.realloc( static_cast< sal_Int32 >( size() ) );
+ if( !empty() )
+ {
+ const PropertyNamesList& rPropNames = PropertyNamesPool::get();
+ OUString* pNames = rNames.getArray();
+ Any* pValues = rValues.getArray();
+ for( const_iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt, ++pNames, ++pValues )
+ {
+ OSL_ENSURE( (0 <= aIt->first) && (aIt->first < PROP_COUNT), "PropertyMap::fillSequences - invalid property identifier" );
+ *pNames = rPropNames[ aIt->first ];
+ *pValues = aIt->second;
+ }
+ }
+}
+
+Reference< XPropertySet > PropertyMap::makePropertySet() const
+{
+ return new GenericPropertySet( *this );
+}
+
+// ============================================================================
+
+} // namespace oox
+
diff --git a/oox/source/helper/propertysequence.cxx b/oox/source/helper/propertysequence.cxx
deleted file mode 100644
index f63291fd2196..000000000000
--- a/oox/source/helper/propertysequence.cxx
+++ /dev/null
@@ -1,159 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: propertysequence.cxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "oox/helper/propertysequence.hxx"
-#include "oox/helper/propertyset.hxx"
-#include <algorithm>
-#include <osl/diagnose.h>
-#include <com/sun/star/beans/PropertyValue.hpp>
-
-using ::rtl::OUString;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::beans::PropertyValue;
-
-namespace oox {
-
-// ============================================================================
-
-PropertySequence::PropertySequence( const sal_Char* const* ppcPropNames,
- const sal_Char* const* ppcPropNames2, const sal_Char* const* ppcPropNames3 ) :
- mnNextIndex( 0 )
-{
- OSL_ENSURE( ppcPropNames, "PropertySequence::PropertySequence - no strings found" );
-
- // create OUStrings from ASCII property names
- typedef ::std::pair< OUString, size_t > IndexedOUString;
- typedef ::std::vector< IndexedOUString > IndexedOUStringVec;
- IndexedOUStringVec aPropNameVec;
- size_t nVecIdx = 0;
- while( *ppcPropNames )
- {
- OUString aPropName = OUString::createFromAscii( *ppcPropNames++ );
- aPropNameVec.push_back( IndexedOUString( aPropName, nVecIdx++ ) );
- }
- if( ppcPropNames2 ) while( *ppcPropNames2 )
- {
- OUString aPropName = OUString::createFromAscii( *ppcPropNames2++ );
- aPropNameVec.push_back( IndexedOUString( aPropName, nVecIdx++ ) );
- }
- if( ppcPropNames3 ) while( *ppcPropNames3 )
- {
- OUString aPropName = OUString::createFromAscii( *ppcPropNames3++ );
- aPropNameVec.push_back( IndexedOUString( aPropName, nVecIdx++ ) );
- }
-
- // sorts the pairs, which will be sorted by first component (the property name)
- ::std::sort( aPropNameVec.begin(), aPropNameVec.end() );
-
- // resize member sequences
- size_t nSize = aPropNameVec.size();
- maNameSeq.realloc( static_cast< sal_Int32 >( nSize ) );
- maValueSeq.realloc( static_cast< sal_Int32 >( nSize ) );
- maNameOrder.resize( nSize );
-
- // fill the property name sequence and store original sort order
- sal_Int32 nSeqIdx = 0;
- for( IndexedOUStringVec::const_iterator aIt = aPropNameVec.begin(),
- aEnd = aPropNameVec.end(); aIt != aEnd; ++aIt, ++nSeqIdx )
- {
- maNameSeq[ nSeqIdx ] = aIt->first;
- maNameOrder[ aIt->second ] = nSeqIdx;
- }
-}
-
-void PropertySequence::clearAllAnys()
-{
- for( sal_Int32 nIdx = 0, nLen = maValueSeq.getLength(); nIdx < nLen; ++nIdx )
- maValueSeq[ nIdx ].clear();
-}
-
-// read properties ------------------------------------------------------------
-
-void PropertySequence::readFromPropertySet( const PropertySet& rPropSet )
-{
- rPropSet.getProperties( maValueSeq, maNameSeq );
- mnNextIndex = 0;
-}
-
-bool PropertySequence::readValue( Any& rAny )
-{
- Any* pAny = getNextAny();
- if( pAny ) rAny = *pAny;
- return pAny != 0;
-}
-
-// write properties -----------------------------------------------------------
-
-void PropertySequence::writeValue( const Any& rAny )
-{
- if( Any* pAny = getNextAny() )
- *pAny = rAny;
-}
-
-void PropertySequence::writeToPropertySet( PropertySet& rPropSet )
-{
- OSL_ENSURE( mnNextIndex == maNameOrder.size(), "PropertySequence::writeToPropertySet - sequence not complete" );
- rPropSet.setProperties( maNameSeq, maValueSeq );
- mnNextIndex = 0;
-}
-
-Sequence< PropertyValue > PropertySequence::createPropertySequence()
-{
- OSL_ENSURE( mnNextIndex == maNameOrder.size(), "PropertySequence::createPropertySequence - sequence not complete" );
- Sequence< PropertyValue > aPropSeq( maNameSeq.getLength() );
- PropertyValue* pProp = aPropSeq.getArray();
- PropertyValue* pPropEnd = pProp + aPropSeq.getLength();
- const OUString* pName = maNameSeq.getConstArray();
- const Any* pValue = maValueSeq.getConstArray();
- for( ; pProp != pPropEnd; ++pProp, ++pName, ++pValue )
- {
- pProp->Name = *pName;
- pProp->Value = *pValue;
- }
- mnNextIndex = 0;
- return aPropSeq;
-}
-
-// private --------------------------------------------------------------------
-
-Any* PropertySequence::getNextAny()
-{
- OSL_ENSURE( mnNextIndex < maNameOrder.size(), "PropertySequence::getNextAny - sequence overflow" );
- Any* pAny = 0;
- if( mnNextIndex < maNameOrder.size() )
- pAny = &maValueSeq[ maNameOrder[ mnNextIndex++ ] ];
- return pAny;
-}
-
-// ============================================================================
-
-} // namespace oox
-
diff --git a/oox/source/helper/propertyset.cxx b/oox/source/helper/propertyset.cxx
index 438495f92363..e7bb19107036 100644
--- a/oox/source/helper/propertyset.cxx
+++ b/oox/source/helper/propertyset.cxx
@@ -55,30 +55,16 @@ void PropertySet::set( const Reference< XPropertySet >& rxPropSet )
// Get properties -------------------------------------------------------------
-bool PropertySet::getAnyProperty( Any& orValue, const OUString& rPropName ) const
+bool PropertySet::getAnyProperty( Any& orValue, sal_Int32 nPropId ) const
{
- bool bHasValue = false;
- try
- {
- if( mxPropSet.is() )
- {
- orValue = mxPropSet->getPropertyValue( rPropName );
- bHasValue = true;
- }
- }
- catch( Exception& )
- {
- OSL_ENSURE( false, OStringBuffer( "PropertySet::getAnyProperty - cannot get property \"" ).
- append( OUStringToOString( rPropName, RTL_TEXTENCODING_ASCII_US ) ).append( '"' ).getStr() );
- }
- return bHasValue;
+ return getAnyProperty( orValue, PropertyMap::getPropertyName( nPropId ) );
}
-bool PropertySet::getBoolProperty( const OUString& rPropName ) const
+bool PropertySet::getBoolProperty( sal_Int32 nPropId ) const
{
Any aAny;
bool bValue = false;
- return getAnyProperty( aAny, rPropName ) && (aAny >>= bValue) && bValue;
+ return getAnyProperty( aAny, nPropId ) && (aAny >>= bValue) && bValue;
}
void PropertySet::getProperties( Sequence< Any >& orValues, const Sequence< OUString >& rPropNames ) const
@@ -108,18 +94,9 @@ void PropertySet::getProperties( Sequence< Any >& orValues, const Sequence< OUSt
// Set properties -------------------------------------------------------------
-void PropertySet::setAnyProperty( const OUString& rPropName, const Any& rValue )
+void PropertySet::setAnyProperty( sal_Int32 nPropId, const Any& rValue )
{
- try
- {
- if( mxPropSet.is() )
- mxPropSet->setPropertyValue( rPropName, rValue );
- }
- catch( Exception& )
- {
- OSL_ENSURE( false, OStringBuffer( "PropertySet::setAnyProperty - cannot set property \"" ).
- append( OUStringToOString( rPropName, RTL_TEXTENCODING_ASCII_US ) ).append( '"' ).getStr() );
- }
+ setAnyProperty( PropertyMap::getPropertyName( nPropId ), rValue );
}
void PropertySet::setProperties( const Sequence< OUString >& rPropNames, const Sequence< Any >& rValues )
@@ -154,11 +131,46 @@ void PropertySet::setProperties( const PropertyMap& rPropertyMap )
{
Sequence< OUString > aPropNames;
Sequence< Any > aValues;
- rPropertyMap.makeSequence( aPropNames, aValues );
+ rPropertyMap.fillSequences( aPropNames, aValues );
setProperties( aPropNames, aValues );
}
}
+// private --------------------------------------------------------------------
+
+bool PropertySet::getAnyProperty( Any& orValue, const OUString& rPropName ) const
+{
+ bool bHasValue = false;
+ try
+ {
+ if( mxPropSet.is() )
+ {
+ orValue = mxPropSet->getPropertyValue( rPropName );
+ bHasValue = true;
+ }
+ }
+ catch( Exception& )
+ {
+ OSL_ENSURE( false, OStringBuffer( "PropertySet::getAnyProperty - cannot get property \"" ).
+ append( OUStringToOString( rPropName, RTL_TEXTENCODING_ASCII_US ) ).append( '"' ).getStr() );
+ }
+ return bHasValue;
+}
+
+void PropertySet::setAnyProperty( const OUString& rPropName, const Any& rValue )
+{
+ try
+ {
+ if( mxPropSet.is() )
+ mxPropSet->setPropertyValue( rPropName, rValue );
+ }
+ catch( Exception& )
+ {
+ OSL_ENSURE( false, OStringBuffer( "PropertySet::setAnyProperty - cannot set property \"" ).
+ append( OUStringToOString( rPropName, RTL_TEXTENCODING_ASCII_US ) ).append( '"' ).getStr() );
+ }
+}
+
// ============================================================================
} // namespace oox
diff --git a/oox/source/ole/vbainputstream.cxx b/oox/source/ole/vbainputstream.cxx
index ba6032940155..6dc8aad88f4f 100644
--- a/oox/source/ole/vbainputstream.cxx
+++ b/oox/source/ole/vbainputstream.cxx
@@ -114,14 +114,14 @@ bool VbaInputStream::updateChunk()
if( mbEof ) return false;
// check header signature
- OSL_ENSURE( (nHeader & VBACHUNK_SIGMASK) == VBACHUNK_SIG, "VbaInputStream::readChunk - invalid chunk signature" );
+ OSL_ENSURE( (nHeader & VBACHUNK_SIGMASK) == VBACHUNK_SIG, "VbaInputStream::updateChunk - invalid chunk signature" );
mbEof = (nHeader & VBACHUNK_SIGMASK) != VBACHUNK_SIG;
if( mbEof ) return false;
// decode length of chunk data and compression flag
bool bCompressed = getFlag( nHeader, VBACHUNK_COMPRESSED );
sal_uInt16 nChunkLen = (nHeader & VBACHUNK_LENMASK) + 1;
- OSL_ENSURE( bCompressed || (nChunkLen == 4096), "VbaInputStream::readChunk - invalid uncompressed chunk size" );
+ OSL_ENSURE( bCompressed || (nChunkLen == 4096), "VbaInputStream::updateChunk - invalid uncompressed chunk size" );
if( bCompressed )
{
maChunk.clear();
@@ -144,7 +144,7 @@ bool VbaInputStream::updateChunk()
// extract offset from high nBitCount bits, plus 1
sal_uInt16 nOffset = extractValue< sal_uInt16 >( nCopyToken, 16 - nBitCount, nBitCount ) + 1;
mbEof = (nOffset > maChunk.size()) || (maChunk.size() + nLength > 4096);
- OSL_ENSURE( !mbEof, "VbaInputStream::readChunk - invalid offset or size in copy token" );
+ OSL_ENSURE( !mbEof, "VbaInputStream::updateChunk - invalid offset or size in copy token" );
if( !mbEof )
{
// append data to buffer
diff --git a/oox/source/ppt/commontimenodecontext.cxx b/oox/source/ppt/commontimenodecontext.cxx
index 40dcd4980583..291727a5e1aa 100644
--- a/oox/source/ppt/commontimenodecontext.cxx
+++ b/oox/source/ppt/commontimenodecontext.cxx
@@ -389,7 +389,7 @@ static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId
sal_Int32 nInt; // some temporary int value for float conversions
NodePropertyMap & aProps = pNode->getNodeProperties();
- PropertyMap & aUserData = pNode->getUserData();
+ TimeNode::UserDataMap & aUserData = pNode->getUserData();
if( attribs.hasAttribute( XML_accel ) )
{
diff --git a/oox/source/ppt/pptshapepropertiescontext.cxx b/oox/source/ppt/pptshapepropertiescontext.cxx
index 46f9d3a54ed5..1c669dc126a8 100644
--- a/oox/source/ppt/pptshapepropertiescontext.cxx
+++ b/oox/source/ppt/pptshapepropertiescontext.cxx
@@ -44,6 +44,7 @@
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/drawingml/customshapegeometry.hxx"
#include "oox/drawingml/textbodycontext.hxx"
+#include "properties.hxx"
#include "tokens.hxx"
using rtl::OUString;
@@ -72,8 +73,7 @@ Reference< XFastContextHandler > PPTShapePropertiesContext::createFastChildConte
{
case NMSP_DRAWINGML | XML_xfrm:
{
- static const OUString sIsPlaceholderDependent( RTL_CONSTASCII_USTRINGPARAM( "IsPlaceholderDependent" ) );
- mrShape.getShapeProperties()[ sIsPlaceholderDependent ] <<= Any( sal_False );
+ mrShape.getShapeProperties()[ PROP_IsPlaceholderDependent ] <<= sal_False;
xRet = ShapePropertiesContext::createFastChildContext( aElementToken, xAttribs );
}
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index a91d428dc0c5..09b089075173 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -89,17 +89,6 @@ void PresentationFragmentHandler::endDocument() throw (SAXException, RuntimeExce
{
PowerPointImport& rFilter = dynamic_cast< PowerPointImport& >( getFilter() );
-#ifdef DEBUG
- if ( false )
- {
- if ( mpTextListStyle.get() )
- {
- ::oox::drawingml::TextParagraphPropertiesPtr rParaProps( mpTextListStyle->getListStyle()[ 0 ] );
- rParaProps->getTextParagraphPropertyMap().dump_debug("TextParagraph paragraph props");
- }
- }
-
-#endif
Reference< frame::XModel > xModel( rFilter.getModel() );
Reference< drawing::XDrawPage > xSlide;
sal_uInt32 nSlide;
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index 468d6547a25e..2644a5b36ba0 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -180,7 +180,7 @@ void SlidePersist::createBackground( const XmlFilterBase& rFilterBase )
uno::Reference< beans::XPropertySet > xPropertySet( aPropMap.makePropertySet() );
PropertySet aPropSet( xPropertySet );
mpBackgroundPropertiesPtr->pushToPropSet(
- aPropSet, ::oox::drawingml::FillProperties::DEFAULTNAMES,
+ aPropSet, ::oox::drawingml::FillProperties::DEFAULT_IDS,
rFilterBase, rFilterBase.getModelObjectContainer(), 0, -1 );
xPagePropSet->setPropertyValue( sBackground, Any( xPropertySet ) );
}
@@ -201,10 +201,6 @@ void setTextStyle( Reference< beans::XPropertySet >& rxPropSet, const XmlFilterB
}
PropertyMap& rTextParagraphPropertyMap( pTextParagraphPropertiesPtr->getTextParagraphPropertyMap() );
-#ifdef DEBUG
- if ( false )
- rTextParagraphPropertyMap.dump_debug("TextParagraph paragraph props");
-#endif
PropertySet aPropSet( rxPropSet );
aPropSet.setProperties( rTextParagraphPropertyMap );
diff --git a/oox/source/ppt/slidetransition.cxx b/oox/source/ppt/slidetransition.cxx
index c5417e93f247..f64e6eb25b50 100644
--- a/oox/source/ppt/slidetransition.cxx
+++ b/oox/source/ppt/slidetransition.cxx
@@ -40,6 +40,7 @@
#include "oox/helper/propertymap.hxx"
#include "oox/core/namespaces.hxx"
#include "pptfilterhelpers.hxx"
+#include "properties.hxx"
#include "tokens.hxx"
using rtl::OUString;
@@ -85,11 +86,11 @@ namespace oox { namespace ppt {
{
try
{
- aProps[ CREATE_OUSTRING( "TransitionType" ) ] = Any( mnTransitionType );
- aProps[ CREATE_OUSTRING( "TransitionSubtype" ) ] = Any( mnTransitionSubType );
- aProps[ CREATE_OUSTRING( "TransitionDirection" ) ] = Any( mbTransitionDirectionNormal );
- aProps[ CREATE_OUSTRING( "Speed" ) ] = Any( mnAnimationSpeed );
- aProps[ CREATE_OUSTRING( "TransitionFadeColor" ) ] = Any( mnFadeColor );
+ aProps[ PROP_TransitionType ] <<= mnTransitionType;
+ aProps[ PROP_TransitionSubtype ] <<= mnTransitionSubType;
+ aProps[ PROP_TransitionDirection ] <<= mbTransitionDirectionNormal;
+ aProps[ PROP_Speed ] <<= mnAnimationSpeed;
+ aProps[ PROP_TransitionFadeColor ] <<= mnFadeColor;
}
catch( Exception& )
{
diff --git a/oox/source/ppt/soundactioncontext.cxx b/oox/source/ppt/soundactioncontext.cxx
index ba92c10c6988..24a675b072d4 100644
--- a/oox/source/ppt/soundactioncontext.cxx
+++ b/oox/source/ppt/soundactioncontext.cxx
@@ -37,6 +37,7 @@
#include "oox/helper/propertymap.hxx"
#include "oox/core/namespaces.hxx"
#include "oox/drawingml/embeddedwavaudiofile.hxx"
+#include "properties.hxx"
#include "tokens.hxx"
using rtl::OUString;
@@ -89,8 +90,8 @@ namespace oox { namespace ppt {
#endif
if ( url.getLength() != 0 )
{
- maSlideProperties[ CREATE_OUSTRING( "Sound" ) ] = Any( url );
- maSlideProperties[ CREATE_OUSTRING( "SoundOn" ) ] = Any( sal_True );
+ maSlideProperties[ PROP_Sound ] <<= url;
+ maSlideProperties[ PROP_SoundOn ] <<= sal_True;
}
}
// else if( mbStopSound )
diff --git a/oox/source/ppt/timenode.cxx b/oox/source/ppt/timenode.cxx
index 3c85ad77ba66..0fe214b4de6b 100644
--- a/oox/source/ppt/timenode.cxx
+++ b/oox/source/ppt/timenode.cxx
@@ -290,11 +290,16 @@ namespace oox { namespace ppt {
xNode->setEndSync(aValue);
}
- Sequence< NamedValue > aUserDataSeq;
- maUserData.makeSequence(aUserDataSeq);
- if( aUserDataSeq.getLength() )
+ if( !maUserData.empty() )
{
- maNodeProperties[ NP_USERDATA ] = makeAny(aUserDataSeq);
+ Sequence< NamedValue > aUserDataSeq( static_cast< sal_Int32 >( maUserData.size() ) );
+ NamedValue* pValues = aUserDataSeq.getArray();
+ for( UserDataMap::const_iterator aIt = maUserData.begin(), aEnd = maUserData.end(); aIt != aEnd; ++aIt, ++pValues )
+ {
+ pValues->Name = aIt->first;
+ pValues->Value = aIt->second;
+ }
+ maNodeProperties[ NP_USERDATA ] <<= aUserDataSeq;
}
Reference< XAnimate > xAnimate( xNode, UNO_QUERY );
diff --git a/oox/source/token/genproperties.pl b/oox/source/token/genproperties.pl
new file mode 100644
index 000000000000..9dbe15c8ac12
--- /dev/null
+++ b/oox/source/token/genproperties.pl
@@ -0,0 +1,46 @@
+$ARGV0 = shift @ARGV;
+$ARGV1 = shift @ARGV;
+$ARGV2 = shift @ARGV;
+
+open ( PROPS, $ARGV0 ) || die "can't open properties source file: $!";
+my %props;
+
+while ( <PROPS> )
+{
+ chomp( $_ );
+ $_ =~ s/\s*//g;
+ $_ =~ /^[A-Z][a-zA-Z0-9]*$/ or die "invalid character in property '$_'";
+ $id = "PROP_$_";
+ $props{$_} = $id;
+}
+close ( TOKENS );
+
+open ( HXX, ">$ARGV1" ) or die "can't open properties.hxx file: $!";
+open ( WORDS, ">$ARGV2" ) or die "can't open propertynames.inc file: $!";
+
+print ( HXX "#ifndef OOX_PROPERTIES_HXX\n" );
+print ( HXX "#define OOX_PROPERTIES_HXX\n\n" );
+print ( HXX "#include <sal/types.h>\n" );
+print ( HXX "namespace oox {\n\n" );
+
+print ( WORDS "static const sal_Char* propertywordlist[] = {\n" );
+
+$i = 0;
+foreach( sort( keys( %props ) ) )
+{
+ print ( HXX "const sal_Int32 $props{$_} = $i;\n" );
+ print ( WORDS " \"$_\",\n" );
+ ++$i;
+}
+
+print ( HXX "const sal_Int32 PROP_COUNT = $i;\n" );
+print ( HXX "const sal_Int32 PROP_INVALID = -1;\n\n" );
+print ( HXX "} // namespace oox\n" );
+print ( HXX "#endif\n" );
+
+print ( WORDS " \"\"\n" );
+print ( WORDS "};\n" );
+
+close ( HXX );
+close ( WORDS );
+
diff --git a/oox/source/token/makefile.mk b/oox/source/token/makefile.mk
index 6461819be3ef..c7846d5c4cf2 100644
--- a/oox/source/token/makefile.mk
+++ b/oox/source/token/makefile.mk
@@ -1,7 +1,7 @@
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
+#
# Copyright 2008 by Sun Microsystems, Inc.
#
# OpenOffice.org - a multi-platform office productivity suite
@@ -43,14 +43,15 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
-SLOFILES = \
+SLOFILES = \
+ $(SLO)$/propertylist.obj \
$(SLO)$/tokenmap.obj
# --- Targets -------------------------------------------------------
.INCLUDE : target.mk
-$(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx :
+$(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$/propertywords.inc $(INCCOM)$/properties.hxx :
@@noop $(assign do_phony:=.PHONY)
$(MISC)$/do_tokens $(do_phony) : tokens.txt gentoken.pl $(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx
@@ -61,3 +62,8 @@ $(INCCOM)$/tokens.inc : $(MISC)$/tokens.gperf $(MISC)$/do_tokens
$(SLO)$/tokenmap.obj : $(INCCOM)$/tokens.inc $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(MISC)$/do_tokens
+$(MISC)$/do_properties $(do_phony) : properties.txt genproperties.pl $(INCCOM)$/properties.hxx $(INCCOM)$/propertywords.inc
+ $(PERL) genproperties.pl properties.txt $(INCCOM)$/properties.hxx $(INCCOM)$/propertywords.inc && $(TOUCH) $@
+
+$(SLO)$/propertylist.obj : $(INCCOM)$/propertywords.inc $(INCCOM)$/properties.hxx $(MISC)$/do_properties
+
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
new file mode 100644
index 000000000000..a52cd0d5a75f
--- /dev/null
+++ b/oox/source/token/properties.txt
@@ -0,0 +1,339 @@
+AbsoluteName
+ActiveSplitRange
+ActiveTable
+Adjust
+AttachedAxisIndex
+AutoFilter
+AutoShowInfo
+BackGraphicLocation
+BackGraphicURL
+BlackDay
+BorderColor
+BorderDashName
+BorderStyle
+BorderTransparency
+BorderWidth
+BottomBorder
+BottomMargin
+BulletChar
+BulletColor
+BulletFont
+BulletFontName
+BulletRelSize
+CLSID
+CalcAsShown
+CellBackColor
+CellProtection
+CellStyle
+CenterHorizontally
+CenterVertically
+CharCaseMap
+CharColor
+CharContoured
+CharEscapement
+CharEscapementHeight
+CharFontCharSet
+CharFontCharSetAsian
+CharFontCharSetComplex
+CharFontFamily
+CharFontFamilyAsian
+CharFontFamilyComplex
+CharFontName
+CharFontNameAsian
+CharFontNameComplex
+CharFontPitch
+CharFontPitchAsian
+CharFontPitchComplex
+CharHeight
+CharHeightAsian
+CharHeightComplex
+CharLocale
+CharLocaleAsian
+CharLocaleComplex
+CharPosture
+CharPostureAsian
+CharPostureComplex
+CharShadowed
+CharStrikeout
+CharStyleName
+CharUnderline
+CharUnderlineColor
+CharUnderlineHasColor
+CharWeight
+CharWeightAsian
+CharWeightComplex
+Color
+ColumnGrand
+ColumnLabelRanges
+CompileEnglish
+ConditionalFormat
+ConnectBars
+ContainsHeader
+CrossoverPosition
+CursorPositionX
+CursorPositionY
+CurveStyle
+CustomShapeGeometry
+D3DSceneAmbientColor
+D3DSceneLightColor2
+D3DSceneLightDirection2
+D3DSceneLightOn1
+D3DSceneLightOn2
+D3DScenePerspective
+D3DSceneShadeMode
+DDELinks
+DatabaseRanges
+DiagonalBLTR
+DiagonalTLBR
+DisplayLabels
+DrillDownOnDoubleClick
+EndPosition
+ErrorAlertStyle
+ErrorBarStyle
+ErrorBarX
+ErrorBarY
+ErrorMessage
+ErrorTitle
+ExternalDocLinks
+ExternalLinks
+FileFormat
+FillBitmap
+FillBitmapLogicalSize
+FillBitmapMode
+FillBitmapName
+FillBitmapOffsetX
+FillBitmapOffsetY
+FillBitmapRectanglePoint
+FillBitmapSizeX
+FillBitmapSizeY
+FillBitmapStretch
+FillBitmapTile
+FillColor
+FillGradient
+FillGradientName
+FillStyle
+FillTransparence
+FirstLineOffset
+FirstPageNumber
+FooterBodyDistance
+FooterHeight
+FooterIsDynamicHeight
+FooterIsOn
+FooterIsShared
+FormulaConvention
+Function
+GapwidthSequence
+Geometry3D
+GradientName
+Graphic
+GraphicSize
+GraphicURL
+GridColor
+GroupInfo
+HasAutoShowInfo
+HasColumnRowHeaders
+HasHorizontalScrollBar
+HasLayoutInfo
+HasReference
+HasSheetTabs
+HasSortInfo
+HasVerticalScrollBar
+HeaderBodyDistance
+HeaderHeight
+HeaderIsDynamicHeight
+HeaderIsOn
+HeaderIsShared
+Height
+HoriJustify
+HorizontalSplitMode
+HorizontalSplitPositionTwips
+IgnoreBlankCells
+IgnoreCase
+IgnoreLeadingSpaces
+InputMessage
+InputTitle
+IsAdjustHeightEnabled
+IsCellBackgroundTransparent
+IsChangeReadOnlyEnabled
+IsDate
+IsExecuteLinkEnabled
+IsHidden
+IsIterationEnabled
+IsLandscape
+IsLoaded
+IsNumbering
+IsOutlineSymbolsSet
+IsPlaceholderDependent
+IsSharedFormula
+IsStartOfNewPage
+IsTextWrapped
+IsUndoEnabled
+IsVisible
+IterationCount
+IterationEpsilon
+Japanese
+Label
+LabelPlacement
+LabelSeparator
+LayoutInfo
+LeftBorder
+LeftMargin
+LeftPageFooterContent
+LeftPageHeaderContent
+LineColor
+LineDash
+LineDashName
+LineEndCenter
+LineEndName
+LineEndWidth
+LineJoint
+LineStartCenter
+LineStartName
+LineStartWidth
+LineStyle
+LineTransparence
+LineWidth
+LookUpLabels
+MajorTickmarks
+MaxFieldCount
+MinorTickmarks
+MissingValueTreatment
+Model
+NamedRanges
+NegativeError
+NullDate
+NumberFormat
+NumberingIsNumber
+NumberingLevel
+NumberingRules
+NumberingType
+Offset
+OpCodeMap
+Orientation
+OverlapSequence
+PageScale
+PageStyle
+PageViewZoomValue
+ParaAdjust
+ParaBottomMargin
+ParaFirstLineIndent
+ParaIndent
+ParaIsHangingPunctuation
+ParaIsHyphenation
+ParaLeftMargin
+ParaLineSpacing
+ParaRightMargin
+ParaTabStops
+ParaTopMargin
+PercentageNumberFormat
+PersistName
+Perspective
+PolyPolygon
+Position
+PositionBottom
+PositionLeft
+PositionRight
+PositionTop
+PositiveError
+Prefix
+PrintAnnotations
+PrintDownFirst
+PrintGrid
+PrintHeaders
+Reference
+ReferenceDevice
+ReferencePosition
+RegularExpressions
+RelativeHorizontalTabbarWidth
+Representation
+RightAngledAxes
+RightBorder
+RightMargin
+RightPageFooterContent
+RightPageHeaderContent
+Role
+RotateAngle
+RotateReference
+RotationHorizontal
+RotationVertical
+RowGrand
+RowLabelRanges
+ScaleToPages
+ScaleToPagesX
+ScaleToPagesY
+SelectedPage
+Show
+ShowCharts
+ShowCorrelationCoefficient
+ShowDetail
+ShowDrawing
+ShowEmpty
+ShowEquation
+ShowErrorMessage
+ShowFilterButton
+ShowFirst
+ShowFormulas
+ShowGrid
+ShowHighLow
+ShowInputMessage
+ShowList
+ShowNegativeError
+ShowObjects
+ShowPageBreakPreview
+ShowPositiveError
+ShowZeroValues
+ShrinkToFit
+Size
+SortInfo
+Sound
+SoundOn
+Speed
+StackCharacters
+StackingDirection
+StartPosition
+StartWith
+StartingAngle
+Subtotals
+Suffix
+SwapXAndYAxis
+Symbol
+TableBorder
+TableLayout
+TableSelected
+Tables
+TargetFrame
+TextAutoGrowHeight
+TextBreak
+TextLeftDistance
+TextLowerDistance
+TextOverlap
+TextRightDistance
+TextRotation
+TextUpperDistance
+TextWordWrap
+TextWritingMode
+TokenIndex
+TopBorder
+TopMargin
+Transformation
+TransitionDirection
+TransitionFadeColor
+TransitionSubtype
+TransitionType
+Transparency
+Type
+URL
+UseRegularExpressions
+UseRings
+UseSelectedPage
+Validation
+VaryColorsByPoint
+VertJustify
+VerticalSplitMode
+VerticalSplitPositionTwips
+Weight
+WhiteDay
+Width
+WritingMode
+ZoomType
+ZoomValue
diff --git a/oox/inc/oox/xls/headerfooterparser.hxx b/oox/source/token/propertylist.cxx
index c65ac3da65dd..b6be034daabc 100644
--- a/oox/inc/oox/xls/headerfooterparser.hxx
+++ b/oox/source/token/propertylist.cxx
@@ -6,8 +6,8 @@
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: headerfooterparser.hxx,v $
- * $Revision: 1.3 $
+ * $RCSfile: tokenmap.cxx,v $
+ * $Revision: 1.4 $
*
* This file is part of OpenOffice.org.
*
@@ -28,45 +28,24 @@
*
************************************************************************/
-#ifndef OOX_XLS_HEADERFOOTERPARSER_HXX
-#define OOX_XLS_HEADERFOOTERPARSER_HXX
-
-#include <memory>
-#include "oox/xls/workbookhelper.hxx"
-
-namespace com { namespace sun { namespace star {
- namespace sheet { class XHeaderFooterContent; }
-} } }
+#include <rtl/ustring.hxx>
+#include "properties.hxx"
+#include "oox/helper/propertymap.hxx"
namespace oox {
-namespace xls {
-// ============================================================================
+#include "propertywords.inc"
-class HeaderFooterParserImpl;
+// ============================================================================
-class HeaderFooterParser : public WorkbookHelper
+PropertyNamesList::PropertyNamesList()
{
-public:
- explicit HeaderFooterParser( const WorkbookHelper& rHelper );
- virtual ~HeaderFooterParser();
-
- /** Parses the passed string and creates the header/footer contents. */
- void parse(
- const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XHeaderFooterContent >& rxContext,
- const ::rtl::OUString& rData );
-
- /** Returns the total height of the converted header or footer in points. */
- double getTotalHeight() const;
-
-private:
- ::std::auto_ptr< HeaderFooterParserImpl > mxImpl;
-};
+ reserve( static_cast< size_t >( PROP_COUNT ) );
+ for( sal_Int32 nIdx = 0; nIdx < PROP_COUNT; ++nIdx )
+ push_back( ::rtl::OUString::createFromAscii( propertywordlist[ nIdx ] ) );
+}
// ============================================================================
-} // namespace xls
} // namespace oox
-#endif
-
diff --git a/oox/source/xls/addressconverter.cxx b/oox/source/xls/addressconverter.cxx
index 60f46771f3de..a5e2b7c7b64d 100644
--- a/oox/source/xls/addressconverter.cxx
+++ b/oox/source/xls/addressconverter.cxx
@@ -97,6 +97,9 @@ const sal_Unicode BIFF_URL_LIBRARY = '\x08'; /// Library directory in app
const sal_Unicode BIFF4_URL_SHEET = '\x09'; /// BIFF4 internal sheet.
const sal_Unicode BIFF_URL_UNC = '@'; /// UNC path root.
+const sal_Unicode BIFF_DCON_ENCODED = '\x01'; /// First character of an encoded path from DCON* records.
+const sal_Unicode BIFF_DCON_INTERN = '\x02'; /// First character of an encoded sheet name from DCON* records.
+
inline sal_uInt16 lclGetBiffAddressSize( bool bCol16Bit, bool bRow32Bit )
{
@@ -235,15 +238,11 @@ void BinRangeList::writeSubList( BiffOutputStream& rStrm, size_t nBegin, size_t
AddressConverter::AddressConverter( const WorkbookHelper& rHelper ) :
WorkbookHelper( rHelper ),
- mcUrlThisWorkbook( 0 ),
- mcUrlExternal( 0 ),
- mcUrlThisSheet( 0 ),
- mcUrlInternal( 0 ),
- mcUrlSameSheet( 0 ),
mbColOverflow( false ),
mbRowOverflow( false ),
mbTabOverflow( false )
{
+ maDConChars.set( 0xFFFF, '\x01', 0xFFFF, '\x02', 0xFFFF );
switch( getFilterType() )
{
case FILTER_OOX:
@@ -253,23 +252,23 @@ AddressConverter::AddressConverter( const WorkbookHelper& rHelper ) :
{
case BIFF2:
initializeMaxPos( BIFF2_MAXTAB, BIFF2_MAXCOL, BIFF2_MAXROW );
- initializeEncodedUrl( 0xFFFF, '\x01', '\x02', 0xFFFF, 0xFFFF );
+ maLinkChars.set( 0xFFFF, '\x01', '\x02', 0xFFFF, 0xFFFF );
break;
case BIFF3:
initializeMaxPos( BIFF3_MAXTAB, BIFF3_MAXCOL, BIFF3_MAXROW );
- initializeEncodedUrl( 0xFFFF, '\x01', '\x02', 0xFFFF, 0xFFFF );
+ maLinkChars.set( 0xFFFF, '\x01', '\x02', 0xFFFF, 0xFFFF );
break;
case BIFF4:
initializeMaxPos( BIFF4_MAXTAB, BIFF4_MAXCOL, BIFF4_MAXROW );
- initializeEncodedUrl( 0xFFFF, '\x01', '\x02', 0xFFFF, '\x00' );
+ maLinkChars.set( 0xFFFF, '\x01', '\x02', 0xFFFF, '\x00' );
break;
case BIFF5:
initializeMaxPos( BIFF5_MAXTAB, BIFF5_MAXCOL, BIFF5_MAXROW );
- initializeEncodedUrl( '\x04', '\x01', '\x02', '\x03', '\x00' );
+ maLinkChars.set( '\x04', '\x01', '\x02', '\x03', '\x00' );
break;
case BIFF8:
initializeMaxPos( BIFF8_MAXTAB, BIFF8_MAXCOL, BIFF8_MAXROW );
- initializeEncodedUrl( '\x04', '\x01', 0xFFFF, '\x02', '\x00' );
+ maLinkChars.set( '\x04', '\x01', 0xFFFF, '\x02', '\x00' );
break;
case BIFF_UNKNOWN: break;
}
@@ -386,12 +385,14 @@ bool lclAppendUrlChar( OUStringBuffer& orUrl, sal_Unicode cChar, bool bEncodeSpe
} // namespace
BiffTargetType AddressConverter::parseBiffTargetUrl(
- OUString& orClassName, OUString& orTargetUrl, OUString& orSheetName, const OUString& rBiffTargetUrl )
+ OUString& orClassName, OUString& orTargetUrl, OUString& orSheetName,
+ const OUString& rBiffTargetUrl, bool bFromDConRec )
{
OUStringBuffer aTargetUrl;
OUStringBuffer aSheetName;
// default target type: some URL with/without sheet name, may be overridden below
BiffTargetType eTargetType = BIFF_TARGETTYPE_URL;
+ const ControlCharacters& rCChars = bFromDConRec ? maDConChars : maLinkChars;
enum
{
@@ -417,16 +418,16 @@ BiffTargetType AddressConverter::parseBiffTargetUrl(
switch( eState )
{
case STATE_START:
- if( (cChar == mcUrlThisWorkbook) || (cChar == mcUrlThisSheet) || (cChar == mcUrlSameSheet) )
+ if( (cChar == rCChars.mcThisWorkbook) || (cChar == rCChars.mcThisSheet) || (cChar == rCChars.mcSameSheet) )
{
if( pcChar + 1 < pcEnd )
eState = STATE_ERROR;
- if( cChar == mcUrlSameSheet )
+ if( cChar == rCChars.mcSameSheet )
eTargetType = BIFF_TARGETTYPE_SAMESHEET;
}
- else if( cChar == mcUrlExternal )
+ else if( cChar == rCChars.mcExternal )
eState = (pcChar + 1 < pcEnd) ? STATE_ENCODED_PATH_START : STATE_ERROR;
- else if( cChar == mcUrlInternal )
+ else if( cChar == rCChars.mcInternal )
eState = (pcChar + 1 < pcEnd) ? STATE_SHEETNAME : STATE_ERROR;
else
eState = lclAppendUrlChar( aTargetUrl, cChar, true ) ? STATE_UNENCODED : STATE_ERROR;
@@ -500,7 +501,7 @@ BiffTargetType AddressConverter::parseBiffTargetUrl(
if( cChar == BIFF_URL_SUBDIR )
{
orClassName = aTargetUrl.makeStringAndClear();
- eState = STATE_DDE_OLE;
+ eState = bFromDConRec ? STATE_ERROR : STATE_DDE_OLE;
eTargetType = BIFF_TARGETTYPE_DDE_OLE;
}
else if( cChar == '[' )
@@ -535,13 +536,21 @@ BiffTargetType AddressConverter::parseBiffTargetUrl(
}
}
- orTargetUrl = aTargetUrl.makeStringAndClear();
- orSheetName = aSheetName.makeStringAndClear();
-
OSL_ENSURE( (eState != STATE_ERROR) && (pcChar == pcEnd),
OStringBuffer( "AddressConverter::parseBiffTargetUrl - parser error in target \"" ).
append( OUStringToOString( rBiffTargetUrl, RTL_TEXTENCODING_UTF8 ) ).append( '"' ).getStr() );
bool bParserOk = (eState != STATE_ERROR) && (eState != STATE_UNSUPPORTED) && (pcChar == pcEnd);
+
+ if( bParserOk )
+ {
+ orTargetUrl = aTargetUrl.makeStringAndClear();
+ orSheetName = aSheetName.makeStringAndClear();
+ }
+ else
+ {
+ orClassName = orTargetUrl = orSheetName = OUString();
+ }
+
return bParserOk ? eTargetType : BIFF_TARGETTYPE_UNKNOWN;
}
@@ -639,23 +648,23 @@ CellAddress AddressConverter::createValidCellAddress(
// ----------------------------------------------------------------------------
-bool AddressConverter::checkCellRange( const CellRangeAddress& rRange, bool bTrackOverflow )
+bool AddressConverter::checkCellRange( const CellRangeAddress& rRange, bool bAllowOverflow, bool bTrackOverflow )
{
- checkCol( rRange.EndColumn, bTrackOverflow );
- checkRow( rRange.EndRow, bTrackOverflow );
return
+ (checkCol( rRange.EndColumn, bTrackOverflow ) || bAllowOverflow) && // bAllowOverflow after checkCol to track overflow!
+ (checkRow( rRange.EndRow, bTrackOverflow ) || bAllowOverflow) && // bAllowOverflow after checkRow to track overflow!
checkTab( rRange.Sheet, bTrackOverflow ) &&
checkCol( rRange.StartColumn, bTrackOverflow ) &&
checkRow( rRange.StartRow, bTrackOverflow );
}
-bool AddressConverter::validateCellRange( CellRangeAddress& orRange, bool bTrackOverflow )
+bool AddressConverter::validateCellRange( CellRangeAddress& orRange, bool bAllowOverflow, bool bTrackOverflow )
{
if( orRange.StartColumn > orRange.EndColumn )
::std::swap( orRange.StartColumn, orRange.EndColumn );
if( orRange.StartRow > orRange.EndRow )
::std::swap( orRange.StartRow, orRange.EndRow );
- if( !checkCellRange( orRange, bTrackOverflow ) )
+ if( !checkCellRange( orRange, bAllowOverflow, bTrackOverflow ) )
return false;
if( orRange.EndColumn > maMaxPos.Column )
orRange.EndColumn = maMaxPos.Column;
@@ -672,11 +681,11 @@ bool AddressConverter::convertToCellRangeUnchecked( CellRangeAddress& orRange,
}
bool AddressConverter::convertToCellRange( CellRangeAddress& orRange,
- const OUString& rString, sal_Int16 nSheet, bool bTrackOverflow )
+ const OUString& rString, sal_Int16 nSheet, bool bAllowOverflow, bool bTrackOverflow )
{
return
convertToCellRangeUnchecked( orRange, rString, nSheet ) &&
- validateCellRange( orRange, bTrackOverflow );
+ validateCellRange( orRange, bAllowOverflow, bTrackOverflow );
}
void AddressConverter::convertToCellRangeUnchecked( CellRangeAddress& orRange,
@@ -690,18 +699,18 @@ void AddressConverter::convertToCellRangeUnchecked( CellRangeAddress& orRange,
}
bool AddressConverter::convertToCellRange( CellRangeAddress& orRange,
- const BinRange& rBinRange, sal_Int16 nSheet, bool bTrackOverflow )
+ const BinRange& rBinRange, sal_Int16 nSheet, bool bAllowOverflow, bool bTrackOverflow )
{
convertToCellRangeUnchecked( orRange, rBinRange, nSheet );
- return validateCellRange( orRange, bTrackOverflow );
+ return validateCellRange( orRange, bAllowOverflow, bTrackOverflow );
}
// ----------------------------------------------------------------------------
-bool AddressConverter::checkCellRangeList( const ApiCellRangeList& rRanges, bool bTrackOverflow )
+bool AddressConverter::checkCellRangeList( const ApiCellRangeList& rRanges, bool bAllowOverflow, bool bTrackOverflow )
{
for( ApiCellRangeList::const_iterator aIt = rRanges.begin(), aEnd = rRanges.end(); aIt != aEnd; ++aIt )
- if( !checkCellRange( *aIt, bTrackOverflow ) )
+ if( !checkCellRange( *aIt, bAllowOverflow, bTrackOverflow ) )
return false;
return true;
}
@@ -709,7 +718,7 @@ bool AddressConverter::checkCellRangeList( const ApiCellRangeList& rRanges, bool
void AddressConverter::validateCellRangeList( ApiCellRangeList& orRanges, bool bTrackOverflow )
{
for( size_t nIndex = orRanges.size(); nIndex > 0; --nIndex )
- if( !validateCellRange( orRanges[ nIndex - 1 ], bTrackOverflow ) )
+ if( !validateCellRange( orRanges[ nIndex - 1 ], true, bTrackOverflow ) )
orRanges.erase( orRanges.begin() + nIndex - 1 );
}
@@ -722,7 +731,7 @@ void AddressConverter::convertToCellRangeList( ApiCellRangeList& orRanges,
while( (0 <= nPos) && (nPos < nLen) )
{
OUString aToken = rString.getToken( 0, ' ', nPos );
- if( (aToken.getLength() > 0) && convertToCellRange( aRange, aToken, nSheet, bTrackOverflow ) )
+ if( (aToken.getLength() > 0) && convertToCellRange( aRange, aToken, nSheet, true, bTrackOverflow ) )
orRanges.push_back( aRange );
}
}
@@ -732,12 +741,23 @@ void AddressConverter::convertToCellRangeList( ApiCellRangeList& orRanges,
{
CellRangeAddress aRange;
for( BinRangeList::const_iterator aIt = rBinRanges.begin(), aEnd = rBinRanges.end(); aIt != aEnd; ++aIt )
- if( convertToCellRange( aRange, *aIt, nSheet, bTrackOverflow ) )
+ if( convertToCellRange( aRange, *aIt, nSheet, true, bTrackOverflow ) )
orRanges.push_back( aRange );
}
// private --------------------------------------------------------------------
+void AddressConverter::ControlCharacters::set(
+ sal_Unicode cThisWorkbook, sal_Unicode cExternal,
+ sal_Unicode cThisSheet, sal_Unicode cInternal, sal_Unicode cSameSheet )
+{
+ mcThisWorkbook = cThisWorkbook;
+ mcExternal = cExternal;
+ mcThisSheet = cThisSheet;
+ mcInternal = cInternal;
+ mcSameSheet = cSameSheet;
+}
+
void AddressConverter::initializeMaxPos(
sal_Int16 nMaxXlsTab, sal_Int32 nMaxXlsCol, sal_Int32 nMaxXlsRow )
{
@@ -760,17 +780,6 @@ void AddressConverter::initializeMaxPos(
}
}
-void AddressConverter::initializeEncodedUrl(
- sal_Unicode cUrlThisWorkbook, sal_Unicode cUrlExternal,
- sal_Unicode cUrlThisSheet, sal_Unicode cUrlInternal, sal_Unicode cUrlSameSheet )
-{
- mcUrlThisWorkbook = cUrlThisWorkbook;
- mcUrlExternal = cUrlExternal;
- mcUrlThisSheet = cUrlThisSheet;
- mcUrlInternal = cUrlInternal;
- mcUrlSameSheet = cUrlSameSheet;
-}
-
// ============================================================================
} // namespace xls
diff --git a/oox/source/xls/autofiltercontext.cxx b/oox/source/xls/autofiltercontext.cxx
index e36818504f30..42a373b3d440 100644
--- a/oox/source/xls/autofiltercontext.cxx
+++ b/oox/source/xls/autofiltercontext.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/sheet/FilterConnection.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/i18n/XLocaleData.hpp>
+#include "properties.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/core/filterbase.hxx"
@@ -65,7 +66,6 @@ using ::com::sun::star::sheet::TableFilterField;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
-using ::std::list;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Sequence;
@@ -81,6 +81,7 @@ using ::com::sun::star::sheet::XSheetFilterDescriptor;
using ::com::sun::star::i18n::LocaleDataItem;
using ::com::sun::star::i18n::XLocaleData;
using ::com::sun::star::lang::Locale;
+using ::oox::core::ContextHandlerRef;
namespace oox {
namespace xls {
@@ -131,23 +132,42 @@ OoxAutoFilterContext::OoxAutoFilterContext( OoxWorksheetFragmentBase& rFragment
// oox.core.ContextHandler2Helper interface -----------------------------------
-ContextWrapper OoxAutoFilterContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxAutoFilterContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
{
switch( getCurrentElement() )
{
case XLS_TOKEN( autoFilter ):
- return (nElement == XLS_TOKEN( filterColumn ));
+ switch( nElement )
+ {
+ case XLS_TOKEN( filterColumn ): return this;
+ }
+ break;
+
case XLS_TOKEN( filterColumn ):
- return (nElement == XLS_TOKEN( filters )) ||
- (nElement == XLS_TOKEN( customFilters )) ||
- (nElement == XLS_TOKEN( top10 )) ||
- (nElement == XLS_TOKEN( dynamicFilter ));
+ switch( nElement )
+ {
+ case XLS_TOKEN( filters ):
+ case XLS_TOKEN( customFilters ):
+ case XLS_TOKEN( top10 ):
+ case XLS_TOKEN( dynamicFilter ): return this;
+ }
+ break;
+
case XLS_TOKEN( filters ):
- return (nElement == XLS_TOKEN( filter ));
+ switch( nElement )
+ {
+ case XLS_TOKEN( filter ): return this;
+ }
+ break;
+
case XLS_TOKEN( customFilters ):
- return (nElement == XLS_TOKEN( customFilter ));
+ switch( nElement )
+ {
+ case XLS_TOKEN( customFilter ): return this;
+ }
+ break;
}
- return false;
+ return 0;
}
void OoxAutoFilterContext::onStartElement( const AttributeList& rAttribs )
@@ -357,15 +377,11 @@ void OoxAutoFilterContext::setAutoFilter()
// Create a new database range, add filters to it and refresh the database
// for that to take effect.
- Reference< XDatabaseRanges > xDBRanges;
+ Reference< XDatabaseRanges > xDBRanges = getDatabaseRanges();
+ if ( !xDBRanges.is() )
{
- PropertySet aDocProp( getDocument() );
- aDocProp.getProperty( xDBRanges, CREATE_OUSTRING("DatabaseRanges") );
- if ( !xDBRanges.is() )
- {
- OSL_ENSURE(false, "OoxAutoFilterContext::setAutoFilter: DBRange empty");
- return;
- }
+ OSL_ENSURE( false, "OoxAutoFilterContext::setAutoFilter: DBRange empty" );
+ return;
}
Reference< XNameAccess > xNA( xDBRanges, UNO_QUERY_THROW );
@@ -376,7 +392,7 @@ void OoxAutoFilterContext::setAutoFilter()
if ( xDB.is() )
{
PropertySet aProp( xDB );
- aProp.setProperty( CREATE_OUSTRING("AutoFilter"), true );
+ aProp.setProperty( PROP_AutoFilter, true );
}
sal_Int32 nSize = maFields.size();
@@ -385,9 +401,9 @@ void OoxAutoFilterContext::setAutoFilter()
if ( xDescriptor.is() )
{
PropertySet aProp( xDescriptor );
- aProp.setProperty( CREATE_OUSTRING("ContainsHeader"), true );
- aProp.setProperty( CREATE_OUSTRING("UseRegularExpressions"), mbUseRegex );
- aProp.getProperty( nMaxFieldCount, CREATE_OUSTRING("MaxFieldCount") );
+ aProp.setProperty( PROP_ContainsHeader, true );
+ aProp.setProperty( PROP_UseRegularExpressions, mbUseRegex );
+ aProp.getProperty( nMaxFieldCount, PROP_MaxFieldCount );
}
else
{
@@ -406,7 +422,7 @@ void OoxAutoFilterContext::setAutoFilter()
xExtDescriptor->begin();
- list< FilterFieldItem >::const_iterator itr = maFields.begin(), itrEnd = maFields.end();
+ ::std::list< FilterFieldItem >::const_iterator itr = maFields.begin(), itrEnd = maFields.end();
for (sal_Int32 i = 0; itr != itrEnd && i < nMaxFieldCount; ++itr, ++i)
{
#if DEBUG_OOX_AUTOFILTER
@@ -432,7 +448,7 @@ void OoxAutoFilterContext::setAutoFilter()
#else
Sequence< TableFilterField > aFields(nSize);
- list< FilterFieldItem >::const_iterator itr = maFields.begin(), itrEnd = maFields.end();
+ ::std::list< FilterFieldItem >::const_iterator itr = maFields.begin(), itrEnd = maFields.end();
for (sal_Int32 i = 0; itr != itrEnd && i < nMaxFieldCount; ++itr, ++i)
{
#if DEBUG_OOX_AUTOFILTER
@@ -480,7 +496,7 @@ void OoxAutoFilterContext::setFilterNames()
#if USE_SC_MULTI_STRING_FILTER_PATCH
Sequence< OUString > aStrList(size);
- list< OUString >::const_iterator itr = maFilterNames.begin(), itrEnd = maFilterNames.end();
+ ::std::list< OUString >::const_iterator itr = maFilterNames.begin(), itrEnd = maFilterNames.end();
for (sal_Int32 i = 0; itr != itrEnd; ++itr, ++i)
aStrList[i] = *itr;
@@ -501,7 +517,7 @@ void OoxAutoFilterContext::setFilterNames()
mbUseRegex = true;
}
- list< OUString >::const_iterator itr = maFilterNames.begin(), itrEnd = maFilterNames.end();
+ ::std::list< OUString >::const_iterator itr = maFilterNames.begin(), itrEnd = maFilterNames.end();
bool bFirst = true;
for (; itr != itrEnd; ++itr)
{
@@ -529,7 +545,7 @@ void OoxAutoFilterContext::importAutoFilter( const AttributeList& rAttribs )
initialize();
mbValidAddress = getAddressConverter().convertToCellRange(
- maAutoFilterRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex(), true );
+ maAutoFilterRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex(), true, true );
}
void OoxAutoFilterContext::importFilterColumn( const AttributeList& rAttribs )
diff --git a/oox/source/xls/biffcodec.cxx b/oox/source/xls/biffcodec.cxx
index 72734038e612..b76f51ad0e7e 100644
--- a/oox/source/xls/biffcodec.cxx
+++ b/oox/source/xls/biffcodec.cxx
@@ -31,6 +31,7 @@
#include "oox/xls/biffcodec.hxx"
#include <osl/thread.h>
#include <string.h>
+#include "oox/xls/biffinputstream.hxx"
using ::rtl::OString;
using ::rtl::OUString;
@@ -41,26 +42,18 @@ namespace xls {
// ============================================================================
-const OString& BiffCodecHelper::getBiff5WbProtPassword()
-{
- static const OString saPass( "VelvetSweatshop" );
- return saPass;
-}
-
-const OUString& BiffCodecHelper::getBiff8WbProtPassword()
-{
- static const OUString saPass = OStringToOUString( getBiff5WbProtPassword(), RTL_TEXTENCODING_ASCII_US );
- return saPass;
-}
-
-// ============================================================================
-
BiffDecoderBase::BiffDecoderBase( const WorkbookHelper& rHelper ) :
WorkbookHelper( rHelper ),
mnError( CODEC_ERROR_UNSUPP_CRYPT )
{
}
+BiffDecoderBase::BiffDecoderBase( const BiffDecoderBase& rDecoder ) :
+ WorkbookHelper( rDecoder ),
+ mnError( rDecoder.mnError )
+{
+}
+
BiffDecoderBase::~BiffDecoderBase()
{
}
@@ -85,19 +78,28 @@ void BiffDecoderBase::setHasValidPassword( bool bValid )
BiffDecoder_XOR::BiffDecoder_XOR( const WorkbookHelper& rHelper, sal_uInt16 nKey, sal_uInt16 nHash ) :
BiffDecoderBase( rHelper ),
- maCodec( ::oox::core::BinaryCodec_XOR::CODEC_EXCEL )
+ maCodec( ::oox::core::BinaryCodec_XOR::CODEC_EXCEL ),
+ mnKey( nKey ),
+ mnHash( nHash )
{
- init( BiffCodecHelper::getBiff5WbProtPassword(), nKey, nHash );
+ init( BiffCodecHelper::getBiff5WbProtPassword() );
if( !isValid() )
- {
- OString aPass = OUStringToOString( queryPassword(), osl_getThreadTextEncoding() );
- init( aPass, nKey, nHash );
- }
+ init( OUStringToOString( getCodecHelper().queryPassword(), osl_getThreadTextEncoding() ) );
}
-void BiffDecoder_XOR::init( const OString& rPass, sal_uInt16 nKey, sal_uInt16 nHash )
+BiffDecoder_XOR::BiffDecoder_XOR( const BiffDecoder_XOR& rDecoder ) :
+ BiffDecoderBase( rDecoder ),
+ maCodec( ::oox::core::BinaryCodec_XOR::CODEC_EXCEL ),
+ mnKey( rDecoder.mnKey ),
+ mnHash( rDecoder.mnHash )
{
- sal_Int32 nLen = rPass.getLength();
+ init( rDecoder.maPass );
+}
+
+void BiffDecoder_XOR::init( const OString& rPass )
+{
+ maPass = rPass;
+ sal_Int32 nLen = maPass.getLength();
bool bValid = (0 < nLen) && (nLen < 16);
if( bValid )
@@ -105,16 +107,21 @@ void BiffDecoder_XOR::init( const OString& rPass, sal_uInt16 nKey, sal_uInt16 nH
// copy byte string to sal_uInt8 array
sal_uInt8 pnPassw[ 16 ];
memset( pnPassw, 0, sizeof( pnPassw ) );
- memcpy( pnPassw, rPass.getStr(), static_cast< size_t >( nLen ) );
+ memcpy( pnPassw, maPass.getStr(), static_cast< size_t >( nLen ) );
// init codec
maCodec.initKey( pnPassw );
- bValid = maCodec.verifyKey( nKey, nHash );
+ bValid = maCodec.verifyKey( mnKey, mnHash );
}
setHasValidPassword( bValid );
}
+BiffDecoder_XOR* BiffDecoder_XOR::implClone()
+{
+ return new BiffDecoder_XOR( *this );
+}
+
void BiffDecoder_XOR::implDecode( sal_uInt8* pnDestData, const sal_uInt8* pnSrcData, sal_Int64 nStreamPos, sal_uInt16 nBytes )
{
maCodec.startBlock();
@@ -144,16 +151,29 @@ sal_Int32 lclGetRcfOffset( sal_Int64 nStreamPos )
BiffDecoder_RCF::BiffDecoder_RCF( const WorkbookHelper& rHelper,
sal_uInt8 pnDocId[ 16 ], sal_uInt8 pnSaltData[ 16 ], sal_uInt8 pnSaltHash[ 16 ] ) :
- BiffDecoderBase( rHelper )
+ BiffDecoderBase( rHelper ),
+ maDocId( pnDocId, pnDocId + 16 ),
+ maSaltData( pnSaltData, pnSaltData + 16 ),
+ maSaltHash( pnSaltHash, pnSaltHash + 16 )
{
- init( BiffCodecHelper::getBiff8WbProtPassword(), pnDocId, pnSaltData, pnSaltHash );
+ init( BiffCodecHelper::getBiff8WbProtPassword() );
if( !isValid() )
- init( queryPassword(), pnDocId, pnSaltData, pnSaltHash );
+ init( getCodecHelper().queryPassword() );
+}
+
+BiffDecoder_RCF::BiffDecoder_RCF( const BiffDecoder_RCF& rDecoder ) :
+ BiffDecoderBase( rDecoder ),
+ maDocId( rDecoder.maDocId ),
+ maSaltData( rDecoder.maSaltData ),
+ maSaltHash( rDecoder.maSaltHash )
+{
+ init( rDecoder.maPass );
}
-void BiffDecoder_RCF::init( const OUString& rPass, sal_uInt8 pnDocId[ 16 ], sal_uInt8 pnSaltData[ 16 ], sal_uInt8 pnSaltHash[ 16 ] )
+void BiffDecoder_RCF::init( const OUString& rPass )
{
- sal_Int32 nLen = rPass.getLength();
+ maPass = rPass;
+ sal_Int32 nLen = maPass.getLength();
bool bValid = (0 < nLen) && (nLen < 16);
if( bValid )
@@ -161,20 +181,25 @@ void BiffDecoder_RCF::init( const OUString& rPass, sal_uInt8 pnDocId[ 16 ], sal_
// copy string to sal_uInt16 array
sal_uInt16 pnPassw[ 16 ];
memset( pnPassw, 0, sizeof( pnPassw ) );
- const sal_Unicode* pcChar = rPass.getStr();
+ const sal_Unicode* pcChar = maPass.getStr();
const sal_Unicode* pcCharEnd = pcChar + nLen;
sal_uInt16* pnCurrPass = pnPassw;
for( ; pcChar < pcCharEnd; ++pcChar, ++pnCurrPass )
*pnCurrPass = static_cast< sal_uInt16 >( *pcChar );
// init codec
- maCodec.initKey( pnPassw, pnDocId );
- bValid = maCodec.verifyKey( pnSaltData, pnSaltHash );
+ maCodec.initKey( pnPassw, &maDocId.front() );
+ bValid = maCodec.verifyKey( &maSaltData.front(), &maSaltHash.front() );
}
setHasValidPassword( bValid );
}
+BiffDecoder_RCF* BiffDecoder_RCF::implClone()
+{
+ return new BiffDecoder_RCF( *this );
+}
+
void BiffDecoder_RCF::implDecode( sal_uInt8* pnDestData, const sal_uInt8* pnSrcData, sal_Int64 nStreamPos, sal_uInt16 nBytes )
{
sal_uInt8* pnCurrDest = pnDestData;
@@ -202,6 +227,136 @@ void BiffDecoder_RCF::implDecode( sal_uInt8* pnDestData, const sal_uInt8* pnSrcD
// ============================================================================
+namespace {
+
+const sal_uInt16 BIFF_FILEPASS_BIFF2 = 0x0000;
+const sal_uInt16 BIFF_FILEPASS_BIFF8 = 0x0001;
+const sal_uInt16 BIFF_FILEPASS_BIFF8_RCF = 0x0001;
+const sal_uInt16 BIFF_FILEPASS_BIFF8_STRONG = 0x0002;
+
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+BiffCodecHelper::BiffCodecHelper( const WorkbookHelper& rHelper ) :
+ WorkbookHelper( rHelper ),
+ mbHasPassword( false )
+{
+}
+
+const OString& BiffCodecHelper::getBiff5WbProtPassword()
+{
+ static const OString saPass( "VelvetSweatshop" );
+ return saPass;
+}
+
+const OUString& BiffCodecHelper::getBiff8WbProtPassword()
+{
+ static const OUString saPass = OStringToOUString( getBiff5WbProtPassword(), RTL_TEXTENCODING_ASCII_US );
+ return saPass;
+}
+
+OUString BiffCodecHelper::queryPassword()
+{
+ if( !mbHasPassword )
+ {
+ //! TODO
+ maPassword = OUString();
+ // set to true, even if dialog has been cancelled (never ask twice)
+ mbHasPassword = true;
+ }
+ return maPassword;
+}
+
+bool BiffCodecHelper::importFilePass( BiffInputStream& rStrm )
+{
+ OSL_ENSURE( !mxDecoder, "BiffCodecHelper::importFilePass - multiple FILEPASS records" );
+ rStrm.enableDecoder( false );
+ mxDecoder.reset();
+ if( getBiff() == BIFF8 ) importFilePass8( rStrm ); else importFilePass2( rStrm );
+
+ // set decoder at import stream
+ rStrm.setDecoder( mxDecoder );
+ //! TODO remember encryption state for export
+// mrStrm.GetRoot().GetExtDocOptions().GetDocSettings().mbEncrypted = true;
+
+ return mxDecoder.get() && mxDecoder->isValid();
+}
+
+void BiffCodecHelper::cloneDecoder( BiffInputStream& rStrm )
+{
+ if( mxDecoder.get() )
+ rStrm.setDecoder( BiffDecoderRef( mxDecoder->clone() ) );
+}
+
+// private --------------------------------------------------------------------
+
+void BiffCodecHelper::importFilePass_XOR( BiffInputStream& rStrm )
+{
+ OSL_ENSURE( rStrm.getRemaining() == 4, "BiffCodecHelper::importFilePass_XOR - wrong record size" );
+ if( rStrm.getRemaining() == 4 )
+ {
+ sal_uInt16 nBaseKey, nHash;
+ rStrm >> nBaseKey >> nHash;
+ mxDecoder.reset( new BiffDecoder_XOR( *this, nBaseKey, nHash ) );
+ }
+}
+
+void BiffCodecHelper::importFilePass_RCF( BiffInputStream& rStrm )
+{
+ OSL_ENSURE( rStrm.getRemaining() == 48, "BiffCodecHelper::importFilePass_RCF - wrong record size" );
+ if( rStrm.getRemaining() == 48 )
+ {
+ sal_uInt8 pnDocId[ 16 ];
+ sal_uInt8 pnSaltData[ 16 ];
+ sal_uInt8 pnSaltHash[ 16 ];
+ rStrm.readMemory( pnDocId, 16 );
+ rStrm.readMemory( pnSaltData, 16 );
+ rStrm.readMemory( pnSaltHash, 16 );
+ mxDecoder.reset( new BiffDecoder_RCF( *this, pnDocId, pnSaltData, pnSaltHash ) );
+ }
+}
+
+void BiffCodecHelper::importFilePass_Strong( BiffInputStream& /*rStrm*/ )
+{
+ // not supported
+}
+
+void BiffCodecHelper::importFilePass2( BiffInputStream& rStrm )
+{
+ importFilePass_XOR( rStrm );
+}
+
+void BiffCodecHelper::importFilePass8( BiffInputStream& rStrm )
+{
+ switch( rStrm.readuInt16() )
+ {
+ case BIFF_FILEPASS_BIFF2:
+ importFilePass_XOR( rStrm );
+ break;
+
+ case BIFF_FILEPASS_BIFF8:
+ rStrm.skip( 2 );
+ switch( rStrm.readuInt16() )
+ {
+ case BIFF_FILEPASS_BIFF8_RCF:
+ importFilePass_RCF( rStrm );
+ break;
+ case BIFF_FILEPASS_BIFF8_STRONG:
+ importFilePass_Strong( rStrm );
+ break;
+ default:
+ OSL_ENSURE( false, "BiffCodecHelper::importFilePass8 - unknown BIFF8 encryption sub mode" );
+ }
+ break;
+
+ default:
+ OSL_ENSURE( false, "BiffCodecHelper::importFilePass8 - unknown encryption mode" );
+ }
+}
+
+// ============================================================================
+
} // namespace xls
} // namespace oox
diff --git a/oox/source/xls/biffinputstream.cxx b/oox/source/xls/biffinputstream.cxx
index 1d9a3c0b0bbf..d19b62de27a6 100644
--- a/oox/source/xls/biffinputstream.cxx
+++ b/oox/source/xls/biffinputstream.cxx
@@ -73,9 +73,9 @@ void BiffInputRecordBuffer::restartAt( sal_Int64 nPos )
mbValidHeader = false;
}
-void BiffInputRecordBuffer::setDecoder( BiffDecoderRef xDecoder )
+void BiffInputRecordBuffer::setDecoder( const BiffDecoderRef& rxDecoder )
{
- mxDecoder = xDecoder;
+ mxDecoder = rxDecoder;
enableDecoder( true );
updateDecoded();
}
@@ -230,14 +230,9 @@ void BiffInputStream::rewindRecord()
// decoder --------------------------------------------------------------------
-void BiffInputStream::setDecoder( BiffDecoderRef xDecoder )
+void BiffInputStream::setDecoder( const BiffDecoderRef& rxDecoder )
{
- maRecBuffer.setDecoder( xDecoder );
-}
-
-BiffDecoderRef BiffInputStream::getDecoder() const
-{
- return maRecBuffer.getDecoder();
+ maRecBuffer.setDecoder( rxDecoder );
}
void BiffInputStream::enableDecoder( bool bEnable )
diff --git a/oox/source/xls/chartsheetfragment.cxx b/oox/source/xls/chartsheetfragment.cxx
index d6fd382ff484..3df5ff9c3e2a 100644
--- a/oox/source/xls/chartsheetfragment.cxx
+++ b/oox/source/xls/chartsheetfragment.cxx
@@ -38,6 +38,7 @@
#include "oox/xls/worksheetsettings.hxx"
using ::rtl::OUString;
+using ::oox::core::ContextHandlerRef;
using ::oox::core::RecordInfo;
namespace oox {
@@ -53,47 +54,46 @@ OoxChartsheetFragment::OoxChartsheetFragment( const WorkbookHelper& rHelper,
// oox.core.ContextHandler2Helper interface -----------------------------------
-ContextWrapper OoxChartsheetFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxChartsheetFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nElement == XLS_TOKEN( chartsheet ));
+ if( nElement == XLS_TOKEN( chartsheet ) ) return this;
+ break;
+
case XLS_TOKEN( chartsheet ):
- return (nElement == XLS_TOKEN( sheetPr )) ||
- (nElement == XLS_TOKEN( sheetProtection )) ||
- (nElement == XLS_TOKEN( sheetViews )) ||
- (nElement == XLS_TOKEN( pageMargins )) ||
- (nElement == XLS_TOKEN( pageSetup )) ||
- (nElement == XLS_TOKEN( headerFooter )) ||
- (nElement == XLS_TOKEN( picture )) ||
- (nElement == XLS_TOKEN( drawing ));
+ switch( nElement )
+ {
+ case XLS_TOKEN( sheetViews ): return this;
+
+ case XLS_TOKEN( sheetPr ): getWorksheetSettings().importChartSheetPr( rAttribs ); break;
+ case XLS_TOKEN( sheetProtection ): getWorksheetSettings().importChartProtection( rAttribs ); break;
+ case XLS_TOKEN( pageMargins ): getPageSettings().importPageMargins( rAttribs ); break;
+ case XLS_TOKEN( pageSetup ): getPageSettings().importChartPageSetup( getRelations(), rAttribs ); break;
+ case XLS_TOKEN( headerFooter ): getPageSettings().importHeaderFooter( rAttribs ); return this;
+ case XLS_TOKEN( picture ): getPageSettings().importPicture( getRelations(), rAttribs ); break;
+ case XLS_TOKEN( drawing ): importDrawing( rAttribs ); break;
+ }
+ break;
+
case XLS_TOKEN( sheetViews ):
- return (nElement == XLS_TOKEN( sheetView ));
- case XLS_TOKEN( headerFooter ):
- return (nElement == XLS_TOKEN( firstHeader )) ||
- (nElement == XLS_TOKEN( firstFooter )) ||
- (nElement == XLS_TOKEN( oddHeader )) ||
- (nElement == XLS_TOKEN( oddFooter )) ||
- (nElement == XLS_TOKEN( evenHeader )) ||
- (nElement == XLS_TOKEN( evenFooter ));
- }
- return false;
-}
+ if( nElement == XLS_TOKEN( sheetView ) ) getSheetViewSettings().importChartSheetView( rAttribs );
+ break;
-void OoxChartsheetFragment::onStartElement( const AttributeList& rAttribs )
-{
- switch( getCurrentElement() )
- {
- case XLS_TOKEN( sheetPr ): getWorksheetSettings().importChartSheetPr( rAttribs ); break;
- case XLS_TOKEN( sheetProtection ): getWorksheetSettings().importChartProtection( rAttribs ); break;
- case XLS_TOKEN( sheetView ): getSheetViewSettings().importChartSheetView( rAttribs ); break;
- case XLS_TOKEN( pageMargins ): getPageSettings().importPageMargins( rAttribs ); break;
- case XLS_TOKEN( pageSetup ): getPageSettings().importChartPageSetup( getRelations(), rAttribs ); break;
- case XLS_TOKEN( headerFooter ): getPageSettings().importHeaderFooter( rAttribs ); break;
- case XLS_TOKEN( picture ): getPageSettings().importPicture( getRelations(), rAttribs ); break;
- case XLS_TOKEN( drawing ): importDrawing( rAttribs ); break;
+ case XLS_TOKEN( headerFooter ):
+ switch( nElement )
+ {
+ case XLS_TOKEN( firstHeader ):
+ case XLS_TOKEN( firstFooter ):
+ case XLS_TOKEN( oddHeader ):
+ case XLS_TOKEN( oddFooter ):
+ case XLS_TOKEN( evenHeader ):
+ case XLS_TOKEN( evenFooter ): return this; // collect contents in onEndElement()
+ }
+ break;
}
+ return 0;
}
void OoxChartsheetFragment::onEndElement( const OUString& rChars )
@@ -111,40 +111,34 @@ void OoxChartsheetFragment::onEndElement( const OUString& rChars )
}
}
-ContextWrapper OoxChartsheetFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& )
+ContextHandlerRef OoxChartsheetFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nRecId == OOBIN_ID_WORKSHEET);
+ if( nRecId == OOBIN_ID_WORKSHEET ) return this;
+ break;
+
case OOBIN_ID_WORKSHEET:
- return (nRecId == OOBIN_ID_CHARTSHEETPR) ||
- (nRecId == OOBIN_ID_CHARTPROTECTION) ||
- (nRecId == OOBIN_ID_CHARTSHEETVIEWS) ||
- (nRecId == OOBIN_ID_PAGEMARGINS) ||
- (nRecId == OOBIN_ID_CHARTPAGESETUP) ||
- (nRecId == OOBIN_ID_HEADERFOOTER) ||
- (nRecId == OOBIN_ID_PICTURE) ||
- (nRecId == OOBIN_ID_DRAWING);
- case OOBIN_ID_CHARTSHEETVIEWS:
- return (nRecId == OOBIN_ID_CHARTSHEETVIEW);
- }
- return false;
-}
+ switch( nRecId )
+ {
+ case OOBIN_ID_CHARTSHEETVIEWS: return this;
+
+ case OOBIN_ID_CHARTSHEETPR: getWorksheetSettings().importChartSheetPr( rStrm ); break;
+ case OOBIN_ID_CHARTPROTECTION: getWorksheetSettings().importChartProtection( rStrm ); break;
+ case OOBIN_ID_PAGEMARGINS: getPageSettings().importPageMargins( rStrm ); break;
+ case OOBIN_ID_CHARTPAGESETUP: getPageSettings().importChartPageSetup( getRelations(), rStrm ); break;
+ case OOBIN_ID_HEADERFOOTER: getPageSettings().importHeaderFooter( rStrm ); break;
+ case OOBIN_ID_PICTURE: getPageSettings().importPicture( getRelations(), rStrm ); break;
+ case OOBIN_ID_DRAWING: importDrawing( rStrm ); break;
+ }
+ break;
-void OoxChartsheetFragment::onStartRecord( RecordInputStream& rStrm )
-{
- switch( getCurrentElement() )
- {
- case OOBIN_ID_CHARTSHEETPR: getWorksheetSettings().importChartSheetPr( rStrm ); break;
- case OOBIN_ID_CHARTPROTECTION: getWorksheetSettings().importChartProtection( rStrm ); break;
- case OOBIN_ID_CHARTSHEETVIEW: getSheetViewSettings().importChartSheetView( rStrm ); break;
- case OOBIN_ID_PAGEMARGINS: getPageSettings().importPageMargins( rStrm ); break;
- case OOBIN_ID_CHARTPAGESETUP: getPageSettings().importChartPageSetup( getRelations(), rStrm ); break;
- case OOBIN_ID_HEADERFOOTER: getPageSettings().importHeaderFooter( rStrm ); break;
- case OOBIN_ID_PICTURE: getPageSettings().importPicture( getRelations(), rStrm ); break;
- case OOBIN_ID_DRAWING: importDrawing( rStrm ); break;
+ case OOBIN_ID_CHARTSHEETVIEWS:
+ if( nRecId == OOBIN_ID_CHARTSHEETVIEW ) getSheetViewSettings().importChartSheetView( rStrm );
+ break;
}
+ return 0;
}
// oox.core.FragmentHandler2 interface ----------------------------------------
diff --git a/oox/source/xls/commentsbuffer.cxx b/oox/source/xls/commentsbuffer.cxx
new file mode 100644
index 000000000000..1f725bfd7fbc
--- /dev/null
+++ b/oox/source/xls/commentsbuffer.cxx
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: tablebuffer.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/xls/commentsbuffer.hxx"
+#include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
+#include <com/sun/star/sheet/XSheetAnnotationShapeSupplier.hpp>
+#include <com/sun/star/sheet/XSheetAnnotations.hpp>
+#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include "oox/helper/attributelist.hxx"
+#include "oox/helper/recordinputstream.hxx"
+#include "oox/xls/addressconverter.hxx"
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_SET_THROW;
+using ::com::sun::star::table::CellAddress;
+using ::com::sun::star::sheet::XSheetAnnotationAnchor;
+using ::com::sun::star::sheet::XSheetAnnotationShapeSupplier;
+using ::com::sun::star::sheet::XSheetAnnotations;
+using ::com::sun::star::sheet::XSheetAnnotationsSupplier;
+using ::com::sun::star::text::XText;
+
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+CommentModel::CommentModel() :
+ mnAuthorId( -1 )
+{
+}
+
+// ----------------------------------------------------------------------------
+
+Comment::Comment( const WorksheetHelper& rHelper ) :
+ WorksheetHelper( rHelper )
+{
+}
+
+void Comment::importComment( const AttributeList& rAttribs )
+{
+ maModel.mnAuthorId = rAttribs.getInteger( XML_authorId, -1 );
+ // cell range will be checked while inserting the comment into the document
+ getAddressConverter().convertToCellRangeUnchecked( maModel.maRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex() );
+}
+
+void Comment::importComment( RecordInputStream& rStrm )
+{
+ BinRange aBinRange;
+ rStrm >> maModel.mnAuthorId >> aBinRange;
+ // cell range will be checked while inserting the comment into the document
+ getAddressConverter().convertToCellRangeUnchecked( maModel.maRange, aBinRange, getSheetIndex() );
+}
+
+RichStringRef Comment::createText()
+{
+ maModel.mxText.reset( new RichString( *this ) );
+ return maModel.mxText;
+}
+
+void Comment::finalizeImport()
+{
+ // OOBIN format stores cell range instead of cell address, use first cell of this range
+ OSL_ENSURE( (maModel.maRange.StartColumn == maModel.maRange.EndColumn) &&
+ (maModel.maRange.StartRow == maModel.maRange.EndRow),
+ "Comment::finalizeImport - comment anchor should be a single cell" );
+ CellAddress aNotePos( maModel.maRange.Sheet, maModel.maRange.StartColumn, maModel.maRange.StartRow );
+ if( getAddressConverter().checkCellAddress( aNotePos, true ) && maModel.mxText.get() ) try
+ {
+ maModel.mxText->finalizeImport();
+ Reference< XSheetAnnotationsSupplier > xAnnosSupp( getSheet(), UNO_QUERY_THROW );
+ Reference< XSheetAnnotations > xAnnos( xAnnosSupp->getAnnotations(), UNO_SET_THROW );
+ // create note with dummy non-empty string (required by implementation)
+ xAnnos->insertNew( aNotePos, OUString( sal_Unicode( ' ' ) ) );
+ // receive craeted note from cell (insertNew does not return the note)
+// Reference< XSheetAnnotationAnchor > xAnnoAnchor( getCell( aNotePos ), UNO_QUERY_THROW );
+// Reference< XSheetAnnotationShapeSupplier > xAnnoShapeSupp( xAnnoAnchor->getAnnotation(), UNO_QUERY_THROW );
+// Reference< XText > xNoteText( xAnnoShapeSupp->getAnnotationShape(), UNO_QUERY_THROW );
+// xNoteText->setString( OUString() );
+// maModel.mxText->convert( xNoteText, -1 );
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+// ============================================================================
+
+CommentsBuffer::CommentsBuffer( const WorksheetHelper& rHelper ) :
+ WorksheetHelper( rHelper )
+{
+}
+
+void CommentsBuffer::appendAuthor( const OUString& rAuthor )
+{
+ maAuthors.push_back( rAuthor );
+}
+
+CommentRef CommentsBuffer::createComment()
+{
+ CommentRef xComment( new Comment( *this ) );
+ maComments.push_back( xComment );
+ return xComment;
+}
+
+void CommentsBuffer::finalizeImport()
+{
+ maComments.forEachMem( &Comment::finalizeImport );
+}
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
+
diff --git a/oox/source/xls/commentsfragment.cxx b/oox/source/xls/commentsfragment.cxx
new file mode 100644
index 000000000000..843211ba09b8
--- /dev/null
+++ b/oox/source/xls/commentsfragment.cxx
@@ -0,0 +1,156 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: commentsfragment.cxx,v $
+ * $Revision: 1.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/xls/commentsfragment.hxx"
+#include "oox/xls/richstringcontext.hxx"
+
+using ::rtl::OUString;
+using ::oox::core::ContextHandlerRef;
+using ::oox::core::RecordInfo;
+
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+OoxCommentsFragment::OoxCommentsFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
+ OoxWorksheetFragmentBase( rHelper, rFragmentPath )
+{
+}
+
+// oox.core.ContextHandler2Helper interface -----------------------------------
+
+ContextHandlerRef OoxCommentsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case XML_ROOT_CONTEXT:
+ if( nElement == XLS_TOKEN( comments ) ) return this;
+ break;
+ case XLS_TOKEN( comments ):
+ if( nElement == XLS_TOKEN( authors ) ) return this;
+ if( nElement == XLS_TOKEN( commentList ) ) return this;
+ break;
+ case XLS_TOKEN( authors ):
+ if( nElement == XLS_TOKEN( author ) ) return this; // collect author in onEndElement()
+ break;
+ case XLS_TOKEN( commentList ):
+ if( nElement == XLS_TOKEN( comment ) ) { importComment( rAttribs ); return this; }
+ break;
+ case XLS_TOKEN( comment ):
+ if( (nElement == XLS_TOKEN( text )) && mxComment.get() )
+ return new OoxRichStringContext( *this, mxComment->createText() );
+ break;
+ }
+ return 0;
+}
+
+void OoxCommentsFragment::onEndElement( const OUString& rChars )
+{
+ switch( getCurrentElement() )
+ {
+ case XLS_TOKEN( author ):
+ getComments().appendAuthor( rChars );
+ break;
+ case XLS_TOKEN( comment ):
+ mxComment.reset();
+ break;
+ }
+}
+
+ContextHandlerRef OoxCommentsFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+{
+ switch( getCurrentElement() )
+ {
+ case XML_ROOT_CONTEXT:
+ if( nRecId == OOBIN_ID_COMMENTS ) return this;
+ break;
+ case OOBIN_ID_COMMENTS:
+ if( nRecId == OOBIN_ID_COMMENTAUTHORS ) return this;
+ if( nRecId == OOBIN_ID_COMMENTLIST ) return this;
+ break;
+ case OOBIN_ID_COMMENTAUTHORS:
+ if( nRecId == OOBIN_ID_COMMENTAUTHOR ) getComments().appendAuthor( rStrm.readString() );
+ break;
+ case OOBIN_ID_COMMENTLIST:
+ if( nRecId == OOBIN_ID_COMMENT ) { importComment( rStrm ); return this; }
+ break;
+ case OOBIN_ID_COMMENT:
+ if( (nRecId == OOBIN_ID_COMMENTTEXT) && mxComment.get() )
+ mxComment->createText()->importString( rStrm, true );
+ break;
+ }
+ return 0;
+}
+
+void OoxCommentsFragment::onEndRecord()
+{
+ switch( getCurrentElement() )
+ {
+ case OOBIN_ID_COMMENT:
+ mxComment.reset();
+ break;
+ }
+}
+
+// oox.core.FragmentHandler2 interface ----------------------------------------
+
+const RecordInfo* OoxCommentsFragment::getRecordInfos() const
+{
+ static const RecordInfo spRecInfos[] =
+ {
+ { OOBIN_ID_COMMENT, OOBIN_ID_COMMENT + 1 },
+ { OOBIN_ID_COMMENTAUTHORS, OOBIN_ID_COMMENTAUTHORS + 1 },
+ { OOBIN_ID_COMMENTLIST, OOBIN_ID_COMMENTLIST + 1 },
+ { OOBIN_ID_COMMENTS, OOBIN_ID_COMMENTS + 1 },
+ { -1, -1 }
+ };
+ return spRecInfos;
+}
+
+// private --------------------------------------------------------------------
+
+void OoxCommentsFragment::importComment( const AttributeList& rAttribs )
+{
+ mxComment = getComments().createComment();
+ mxComment->importComment( rAttribs );
+}
+
+void OoxCommentsFragment::importComment( RecordInputStream& rStrm )
+{
+ mxComment = getComments().createComment();
+ mxComment->importComment( rStrm );
+}
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
+
diff --git a/oox/source/xls/condformatbuffer.cxx b/oox/source/xls/condformatbuffer.cxx
index f56fb7a3e891..99ac65bc1bcc 100644
--- a/oox/source/xls/condformatbuffer.cxx
+++ b/oox/source/xls/condformatbuffer.cxx
@@ -43,6 +43,7 @@
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include "properties.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/helper/recordinputstream.hxx"
@@ -146,7 +147,7 @@ void lclAppendProperty( ::std::vector< PropertyValue >& orProps, const OUString&
// ============================================================================
-OoxCondFormatRuleData::OoxCondFormatRuleData() :
+CondFormatRuleModel::CondFormatRuleModel() :
mnPriority( -1 ),
mnType( XML_TOKEN_INVALID ),
mnOperator( XML_TOKEN_INVALID ),
@@ -162,7 +163,7 @@ OoxCondFormatRuleData::OoxCondFormatRuleData() :
{
}
-void OoxCondFormatRuleData::setBinOperator( sal_Int32 nOperator )
+void CondFormatRuleModel::setBinOperator( sal_Int32 nOperator )
{
static const sal_Int32 spnOperators[] = {
XML_TOKEN_INVALID, XML_between, XML_notBetween, XML_equal, XML_notEqual,
@@ -170,7 +171,7 @@ void OoxCondFormatRuleData::setBinOperator( sal_Int32 nOperator )
mnOperator = STATIC_ARRAY_SELECT( spnOperators, nOperator, XML_TOKEN_INVALID );
}
-void OoxCondFormatRuleData::setOobTextType( sal_Int32 nOperator )
+void CondFormatRuleModel::setOobTextType( sal_Int32 nOperator )
{
// note: type XML_notContainsText vs. operator XML_notContains
static const sal_Int32 spnTypes[] = { XML_containsText, XML_notContainsText, XML_beginsWith, XML_endsWith };
@@ -189,19 +190,19 @@ CondFormatRule::CondFormatRule( const CondFormat& rCondFormat ) :
void CondFormatRule::importCfRule( const AttributeList& rAttribs )
{
- maOoxData.maText = rAttribs.getString( XML_text, OUString() );
- maOoxData.mnPriority = rAttribs.getInteger( XML_priority, -1 );
- maOoxData.mnType = rAttribs.getToken( XML_type, XML_TOKEN_INVALID );
- maOoxData.mnOperator = rAttribs.getToken( XML_operator, XML_TOKEN_INVALID );
- maOoxData.mnTimePeriod = rAttribs.getToken( XML_timePeriod, XML_TOKEN_INVALID );
- maOoxData.mnRank = rAttribs.getInteger( XML_rank, 0 );
- maOoxData.mnStdDev = rAttribs.getInteger( XML_stdDev, 0 );
- maOoxData.mnDxfId = rAttribs.getInteger( XML_dxfId, -1 );
- maOoxData.mbStopIfTrue = rAttribs.getBool( XML_stopIfTrue, false );
- maOoxData.mbBottom = rAttribs.getBool( XML_bottom, false );
- maOoxData.mbPercent = rAttribs.getBool( XML_percent, false );
- maOoxData.mbAboveAverage = rAttribs.getBool( XML_aboveAverage, true );
- maOoxData.mbEqualAverage = rAttribs.getBool( XML_equalAverage, false );
+ maModel.maText = rAttribs.getString( XML_text, OUString() );
+ maModel.mnPriority = rAttribs.getInteger( XML_priority, -1 );
+ maModel.mnType = rAttribs.getToken( XML_type, XML_TOKEN_INVALID );
+ maModel.mnOperator = rAttribs.getToken( XML_operator, XML_TOKEN_INVALID );
+ maModel.mnTimePeriod = rAttribs.getToken( XML_timePeriod, XML_TOKEN_INVALID );
+ maModel.mnRank = rAttribs.getInteger( XML_rank, 0 );
+ maModel.mnStdDev = rAttribs.getInteger( XML_stdDev, 0 );
+ maModel.mnDxfId = rAttribs.getInteger( XML_dxfId, -1 );
+ maModel.mbStopIfTrue = rAttribs.getBool( XML_stopIfTrue, false );
+ maModel.mbBottom = rAttribs.getBool( XML_bottom, false );
+ maModel.mbPercent = rAttribs.getBool( XML_percent, false );
+ maModel.mbAboveAverage = rAttribs.getBool( XML_aboveAverage, true );
+ maModel.mbEqualAverage = rAttribs.getBool( XML_equalAverage, false );
}
void CondFormatRule::appendFormula( const OUString& rFormula )
@@ -209,16 +210,16 @@ void CondFormatRule::appendFormula( const OUString& rFormula )
TokensFormulaContext aContext( true, false );
aContext.setBaseAddress( mrCondFormat.getRanges().getBaseAddress() );
getFormulaParser().importFormula( aContext, rFormula );
- maOoxData.maFormulas.push_back( aContext );
+ maModel.maFormulas.push_back( aContext );
}
void CondFormatRule::importCfRule( RecordInputStream& rStrm )
{
sal_Int32 nType, nSubType, nOperator, nFmla1Size, nFmla2Size, nFmla3Size;
sal_uInt16 nFlags;
- rStrm >> nType >> nSubType >> maOoxData.mnDxfId >> maOoxData.mnPriority >> nOperator;
+ rStrm >> nType >> nSubType >> maModel.mnDxfId >> maModel.mnPriority >> nOperator;
rStrm.skip( 8 );
- rStrm >> nFlags >> nFmla1Size >> nFmla2Size >> nFmla3Size >> maOoxData.maText;
+ rStrm >> nFlags >> nFmla1Size >> nFmla2Size >> nFmla3Size >> maModel.maText;
/* Import the formulas. For no obvious reason, the sizes of the formulas
are already stored before. Nevertheless the following formulas contain
@@ -232,7 +233,7 @@ void CondFormatRule::importCfRule( RecordInputStream& rStrm )
TokensFormulaContext aContext( true, false );
aContext.setBaseAddress( mrCondFormat.getRanges().getBaseAddress() );
getFormulaParser().importFormula( aContext, rStrm );
- maOoxData.maFormulas.push_back( aContext );
+ maModel.maFormulas.push_back( aContext );
// second formula
OSL_ENSURE( (nFmla2Size >= 0) || (nFmla3Size == 0), "CondFormatRule::importCfRule - missing second formula" );
@@ -240,23 +241,23 @@ void CondFormatRule::importCfRule( RecordInputStream& rStrm )
if( rStrm.getRemaining() >= 8 )
{
getFormulaParser().importFormula( aContext, rStrm );
- maOoxData.maFormulas.push_back( aContext );
+ maModel.maFormulas.push_back( aContext );
// third formula
OSL_ENSURE( (nFmla3Size > 0) == (rStrm.getRemaining() >= 8), "CondFormatRule::importCfRule - formula size mismatch" );
if( rStrm.getRemaining() >= 8 )
{
getFormulaParser().importFormula( aContext, rStrm );
- maOoxData.maFormulas.push_back( aContext );
+ maModel.maFormulas.push_back( aContext );
}
}
}
// flags
- maOoxData.mbStopIfTrue = getFlag( nFlags, OOBIN_CFRULE_STOPIFTRUE );
- maOoxData.mbBottom = getFlag( nFlags, OOBIN_CFRULE_BOTTOM );
- maOoxData.mbPercent = getFlag( nFlags, OOBIN_CFRULE_PERCENT );
- maOoxData.mbAboveAverage = getFlag( nFlags, OOBIN_CFRULE_ABOVEAVERAGE );
+ maModel.mbStopIfTrue = getFlag( nFlags, OOBIN_CFRULE_STOPIFTRUE );
+ maModel.mbBottom = getFlag( nFlags, OOBIN_CFRULE_BOTTOM );
+ maModel.mbPercent = getFlag( nFlags, OOBIN_CFRULE_PERCENT );
+ maModel.mbAboveAverage = getFlag( nFlags, OOBIN_CFRULE_ABOVEAVERAGE );
// no flag for equalAverage, must be determined from subtype below...
// Convert the type/operator settings. This is a real mess...
@@ -264,9 +265,9 @@ void CondFormatRule::importCfRule( RecordInputStream& rStrm )
{
case OOBIN_CFRULE_TYPE_CELLIS:
OSL_ENSURE( nSubType == OOBIN_CFRULE_SUB_CELLIS, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
- maOoxData.mnType = XML_cellIs;
- maOoxData.setBinOperator( nOperator );
- OSL_ENSURE( maOoxData.mnOperator != XML_TOKEN_INVALID, "CondFormatRule::importCfRule - unknown operator" );
+ maModel.mnType = XML_cellIs;
+ maModel.setBinOperator( nOperator );
+ OSL_ENSURE( maModel.mnOperator != XML_TOKEN_INVALID, "CondFormatRule::importCfRule - unknown operator" );
break;
case OOBIN_CFRULE_TYPE_EXPRESSION:
// here we have to look at the subtype to find the real type...
@@ -274,135 +275,135 @@ void CondFormatRule::importCfRule( RecordInputStream& rStrm )
{
case OOBIN_CFRULE_SUB_EXPRESSION:
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
- maOoxData.mnType = XML_expression;
+ maModel.mnType = XML_expression;
break;
case OOBIN_CFRULE_SUB_UNIQUE:
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
- maOoxData.mnType = XML_uniqueValues;
+ maModel.mnType = XML_uniqueValues;
break;
case OOBIN_CFRULE_SUB_TEXT:
- maOoxData.setOobTextType( nOperator );
- OSL_ENSURE( maOoxData.mnType != XML_TOKEN_INVALID, "CondFormatRule::importCfRule - unexpected operator value" );
+ maModel.setOobTextType( nOperator );
+ OSL_ENSURE( maModel.mnType != XML_TOKEN_INVALID, "CondFormatRule::importCfRule - unexpected operator value" );
break;
case OOBIN_CFRULE_SUB_BLANK:
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
- maOoxData.mnType = XML_containsBlanks;
+ maModel.mnType = XML_containsBlanks;
break;
case OOBIN_CFRULE_SUB_NOTBLANK:
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
- maOoxData.mnType = XML_notContainsBlanks;
+ maModel.mnType = XML_notContainsBlanks;
break;
case OOBIN_CFRULE_SUB_ERROR:
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
- maOoxData.mnType = XML_containsErrors;
+ maModel.mnType = XML_containsErrors;
break;
case OOBIN_CFRULE_SUB_NOTERROR:
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
- maOoxData.mnType = XML_notContainsErrors;
+ maModel.mnType = XML_notContainsErrors;
break;
case OOBIN_CFRULE_SUB_TODAY:
OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_TODAY, "CondFormatRule::importCfRule - unexpected time operator value" );
- maOoxData.mnType = XML_timePeriod;
- maOoxData.mnTimePeriod = XML_today;
+ maModel.mnType = XML_timePeriod;
+ maModel.mnTimePeriod = XML_today;
break;
case OOBIN_CFRULE_SUB_TOMORROW:
OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_TOMORROW, "CondFormatRule::importCfRule - unexpected time operator value" );
- maOoxData.mnType = XML_timePeriod;
- maOoxData.mnTimePeriod = XML_tomorrow;
+ maModel.mnType = XML_timePeriod;
+ maModel.mnTimePeriod = XML_tomorrow;
break;
case OOBIN_CFRULE_SUB_YESTERDAY:
OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_YESTERDAY, "CondFormatRule::importCfRule - unexpected time operator value" );
- maOoxData.mnType = XML_timePeriod;
- maOoxData.mnTimePeriod = XML_yesterday;
+ maModel.mnType = XML_timePeriod;
+ maModel.mnTimePeriod = XML_yesterday;
break;
case OOBIN_CFRULE_SUB_LAST7DAYS:
OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_LAST7DAYS, "CondFormatRule::importCfRule - unexpected time operator value" );
- maOoxData.mnType = XML_timePeriod;
- maOoxData.mnTimePeriod = XML_last7Days;
+ maModel.mnType = XML_timePeriod;
+ maModel.mnTimePeriod = XML_last7Days;
break;
case OOBIN_CFRULE_SUB_LASTMONTH:
OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_LASTMONTH, "CondFormatRule::importCfRule - unexpected time operator value" );
- maOoxData.mnType = XML_timePeriod;
- maOoxData.mnTimePeriod = XML_lastMonth;
+ maModel.mnType = XML_timePeriod;
+ maModel.mnTimePeriod = XML_lastMonth;
break;
case OOBIN_CFRULE_SUB_NEXTMONTH:
OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_NEXTMONTH, "CondFormatRule::importCfRule - unexpected time operator value" );
- maOoxData.mnType = XML_timePeriod;
- maOoxData.mnTimePeriod = XML_nextMonth;
+ maModel.mnType = XML_timePeriod;
+ maModel.mnTimePeriod = XML_nextMonth;
break;
case OOBIN_CFRULE_SUB_THISWEEK:
OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_THISWEEK, "CondFormatRule::importCfRule - unexpected time operator value" );
- maOoxData.mnType = XML_timePeriod;
- maOoxData.mnTimePeriod = XML_thisWeek;
+ maModel.mnType = XML_timePeriod;
+ maModel.mnTimePeriod = XML_thisWeek;
break;
case OOBIN_CFRULE_SUB_NEXTWEEK:
OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_NEXTWEEK, "CondFormatRule::importCfRule - unexpected time operator value" );
- maOoxData.mnType = XML_timePeriod;
- maOoxData.mnTimePeriod = XML_nextWeek;
+ maModel.mnType = XML_timePeriod;
+ maModel.mnTimePeriod = XML_nextWeek;
break;
case OOBIN_CFRULE_SUB_LASTWEEK:
OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_LASTWEEK, "CondFormatRule::importCfRule - unexpected time operator value" );
- maOoxData.mnType = XML_timePeriod;
- maOoxData.mnTimePeriod = XML_lastWeek;
+ maModel.mnType = XML_timePeriod;
+ maModel.mnTimePeriod = XML_lastWeek;
break;
case OOBIN_CFRULE_SUB_THISMONTH:
OSL_ENSURE( nOperator == OOBIN_CFRULE_TIMEOP_THISMONTH, "CondFormatRule::importCfRule - unexpected time operator value" );
- maOoxData.mnType = XML_timePeriod;
- maOoxData.mnTimePeriod = XML_thisMonth;
+ maModel.mnType = XML_timePeriod;
+ maModel.mnTimePeriod = XML_thisMonth;
break;
case OOBIN_CFRULE_SUB_ABOVEAVERAGE:
- OSL_ENSURE( maOoxData.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" );
- maOoxData.mnType = XML_aboveAverage;
- maOoxData.mnStdDev = nOperator; // operator field used for standard deviation
- maOoxData.mbAboveAverage = true;
- maOoxData.mbEqualAverage = false; // does not exist as real flag...
+ OSL_ENSURE( maModel.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" );
+ maModel.mnType = XML_aboveAverage;
+ maModel.mnStdDev = nOperator; // operator field used for standard deviation
+ maModel.mbAboveAverage = true;
+ maModel.mbEqualAverage = false; // does not exist as real flag...
break;
case OOBIN_CFRULE_SUB_BELOWAVERAGE:
- OSL_ENSURE( !maOoxData.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" );
- maOoxData.mnType = XML_aboveAverage;
- maOoxData.mnStdDev = nOperator; // operator field used for standard deviation
- maOoxData.mbAboveAverage = false;
- maOoxData.mbEqualAverage = false; // does not exist as real flag...
+ OSL_ENSURE( !maModel.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" );
+ maModel.mnType = XML_aboveAverage;
+ maModel.mnStdDev = nOperator; // operator field used for standard deviation
+ maModel.mbAboveAverage = false;
+ maModel.mbEqualAverage = false; // does not exist as real flag...
break;
case OOBIN_CFRULE_SUB_DUPLICATE:
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
- maOoxData.mnType = XML_duplicateValues;
+ maModel.mnType = XML_duplicateValues;
break;
case OOBIN_CFRULE_SUB_EQABOVEAVERAGE:
- OSL_ENSURE( maOoxData.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" );
- maOoxData.mnType = XML_aboveAverage;
- maOoxData.mnStdDev = nOperator; // operator field used for standard deviation
- maOoxData.mbAboveAverage = true;
- maOoxData.mbEqualAverage = true; // does not exist as real flag...
+ OSL_ENSURE( maModel.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" );
+ maModel.mnType = XML_aboveAverage;
+ maModel.mnStdDev = nOperator; // operator field used for standard deviation
+ maModel.mbAboveAverage = true;
+ maModel.mbEqualAverage = true; // does not exist as real flag...
break;
case OOBIN_CFRULE_SUB_EQBELOWAVERAGE:
- OSL_ENSURE( !maOoxData.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" );
- maOoxData.mnType = XML_aboveAverage;
- maOoxData.mnStdDev = nOperator; // operator field used for standard deviation
- maOoxData.mbAboveAverage = false;
- maOoxData.mbEqualAverage = true; // does not exist as real flag...
+ OSL_ENSURE( !maModel.mbAboveAverage, "CondFormatRule::importCfRule - wrong above-average flag" );
+ maModel.mnType = XML_aboveAverage;
+ maModel.mnStdDev = nOperator; // operator field used for standard deviation
+ maModel.mbAboveAverage = false;
+ maModel.mbEqualAverage = true; // does not exist as real flag...
break;
}
break;
case OOBIN_CFRULE_TYPE_COLORSCALE:
OSL_ENSURE( nSubType == OOBIN_CFRULE_SUB_COLORSCALE, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
- maOoxData.mnType = XML_colorScale;
+ maModel.mnType = XML_colorScale;
break;
case OOBIN_CFRULE_TYPE_DATABAR:
OSL_ENSURE( nSubType == OOBIN_CFRULE_SUB_DATABAR, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
- maOoxData.mnType = XML_dataBar;
+ maModel.mnType = XML_dataBar;
break;
case OOBIN_CFRULE_TYPE_TOPTEN:
OSL_ENSURE( nSubType == OOBIN_CFRULE_SUB_TOPTEN, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
- maOoxData.mnType = XML_top10;
- maOoxData.mnRank = nOperator; // operator field used for rank value
+ maModel.mnType = XML_top10;
+ maModel.mnRank = nOperator; // operator field used for rank value
break;
case OOBIN_CFRULE_TYPE_ICONSET:
OSL_ENSURE( nSubType == OOBIN_CFRULE_SUB_ICONSET, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
- maOoxData.mnType = XML_iconSet;
+ maModel.mnType = XML_iconSet;
break;
default:
OSL_ENSURE( false, "CondFormatRule::importCfRule - unknown rule type" );
@@ -418,13 +419,13 @@ void CondFormatRule::importCfRule( BiffInputStream& rStrm, sal_Int32 nPriority )
rStrm.skip( 2 );
static const sal_Int32 spnTypeIds[] = { XML_TOKEN_INVALID, XML_cellIs, XML_expression };
- maOoxData.mnType = STATIC_ARRAY_SELECT( spnTypeIds, nType, XML_TOKEN_INVALID );
+ maModel.mnType = STATIC_ARRAY_SELECT( spnTypeIds, nType, XML_TOKEN_INVALID );
- maOoxData.setBinOperator( nOperator );
- maOoxData.mnPriority = nPriority;
- maOoxData.mbStopIfTrue = true;
+ maModel.setBinOperator( nOperator );
+ maModel.mnPriority = nPriority;
+ maModel.mbStopIfTrue = true;
- DxfRef xDxf = getStyles().createDxf( &maOoxData.mnDxfId );
+ DxfRef xDxf = getStyles().createDxf( &maModel.mnDxfId );
xDxf->importCfRule( rStrm, nFlags );
xDxf->finalizeImport();
@@ -435,11 +436,11 @@ void CondFormatRule::importCfRule( BiffInputStream& rStrm, sal_Int32 nPriority )
TokensFormulaContext aContext( true, false );
aContext.setBaseAddress( mrCondFormat.getRanges().getBaseAddress() );
getFormulaParser().importFormula( aContext, rStrm, &nFmla1Size );
- maOoxData.maFormulas.push_back( aContext );
+ maModel.maFormulas.push_back( aContext );
if( nFmla2Size > 0 )
{
getFormulaParser().importFormula( aContext, rStrm, &nFmla2Size );
- maOoxData.maFormulas.push_back( aContext );
+ maModel.maFormulas.push_back( aContext );
}
}
}
@@ -451,47 +452,47 @@ void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries >
/* Replacement formula for unsupported rule types (text comparison rules,
time period rules, cell type rules). The replacement formulas below may
contain several placeholders:
- - '#B' will be replaced by the current base address (may occur
- several times).
+ - '#B' will be replaced by the current relative base address (may
+ occur several times).
- '#R' will be replaced by the entire range list of the conditional
formatting (absolute addresses).
- '#T' will be replaced by the quoted comparison text.
- '#L' will be replaced by the length of the comparison text (from
the 'text' attribute) used in text comparison rules.
- - '#K' will be replaced by the rank (from the 'rank' attribute) used in
- top-10 rules.
+ - '#K' will be replaced by the rank (from the 'rank' attribute) used
+ in top-10 rules.
- '#M' will be replaced by the top/bottom flag (from the 'bottom'
attribute) used in the RANK function in top-10 rules.
*/
OUString aReplaceFormula;
- switch( maOoxData.mnType )
+ switch( maModel.mnType )
{
case XML_cellIs:
- eOperator = CondFormatBuffer::convertToApiOperator( maOoxData.mnOperator );
+ eOperator = CondFormatBuffer::convertToApiOperator( maModel.mnOperator );
break;
case XML_expression:
eOperator = ::com::sun::star::sheet::ConditionOperator_FORMULA;
break;
case XML_containsText:
- OSL_ENSURE( maOoxData.mnOperator == XML_containsText, "CondFormatRule::finalizeImport - unexpected operator" );
+ OSL_ENSURE( maModel.mnOperator == XML_containsText, "CondFormatRule::finalizeImport - unexpected operator" );
aReplaceFormula = CREATE_OUSTRING( "NOT(ISERROR(SEARCH(#T,#B)))" );
break;
case XML_notContainsText:
// note: type XML_notContainsText vs. operator XML_notContains
- OSL_ENSURE( maOoxData.mnOperator == XML_notContains, "CondFormatRule::finalizeImport - unexpected operator" );
+ OSL_ENSURE( maModel.mnOperator == XML_notContains, "CondFormatRule::finalizeImport - unexpected operator" );
aReplaceFormula = CREATE_OUSTRING( "ISERROR(SEARCH(#T,#B))" );
break;
case XML_beginsWith:
- OSL_ENSURE( maOoxData.mnOperator == XML_beginsWith, "CondFormatRule::finalizeImport - unexpected operator" );
+ OSL_ENSURE( maModel.mnOperator == XML_beginsWith, "CondFormatRule::finalizeImport - unexpected operator" );
aReplaceFormula = CREATE_OUSTRING( "LEFT(#B,#L)=#T" );
break;
case XML_endsWith:
- OSL_ENSURE( maOoxData.mnOperator == XML_endsWith, "CondFormatRule::finalizeImport - unexpected operator" );
+ OSL_ENSURE( maModel.mnOperator == XML_endsWith, "CondFormatRule::finalizeImport - unexpected operator" );
aReplaceFormula = CREATE_OUSTRING( "RIGHT(#B,#L)=#T" );
break;
case XML_timePeriod:
- switch( maOoxData.mnTimePeriod )
+ switch( maModel.mnTimePeriod )
{
case XML_yesterday:
aReplaceFormula = CREATE_OUSTRING( "FLOOR(#B,1)=TODAY()-1" );
@@ -540,18 +541,18 @@ void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries >
aReplaceFormula = CREATE_OUSTRING( "NOT(ISERROR(#B))" );
break;
case XML_top10:
- if( maOoxData.mbPercent )
+ if( maModel.mbPercent )
aReplaceFormula = CREATE_OUSTRING( "RANK(#B,#R,#M)/COUNT(#R)<=#K%" );
else
aReplaceFormula = CREATE_OUSTRING( "RANK(#B,#R,#M)<=#K" );
break;
case XML_aboveAverage:
- if( maOoxData.mnStdDev == 0 )
+ if( maModel.mnStdDev == 0 )
{
- if( maOoxData.mbAboveAverage )
- aReplaceFormula = maOoxData.mbEqualAverage ? CREATE_OUSTRING( "#B>=AVERAGE(#R)" ) : CREATE_OUSTRING( "#B>AVERAGE(#R)" );
+ if( maModel.mbAboveAverage )
+ aReplaceFormula = maModel.mbEqualAverage ? CREATE_OUSTRING( "#B>=AVERAGE(#R)" ) : CREATE_OUSTRING( "#B>AVERAGE(#R)" );
else
- aReplaceFormula = maOoxData.mbEqualAverage ? CREATE_OUSTRING( "#B<=AVERAGE(#R)" ) : CREATE_OUSTRING( "#B<AVERAGE(#R)" );
+ aReplaceFormula = maModel.mbEqualAverage ? CREATE_OUSTRING( "#B<=AVERAGE(#R)" ) : CREATE_OUSTRING( "#B<AVERAGE(#R)" );
}
break;
}
@@ -577,20 +578,20 @@ void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries >
case 'T': // comparison text
if( aText.getLength() == 0 )
// quote the comparison text, and handle embedded quote characters
- aText = FormulaProcessorBase::generateApiString( maOoxData.maText );
+ aText = FormulaProcessorBase::generateApiString( maModel.maText );
aReplaceFormula = aReplaceFormula.replaceAt( nStrPos, 2, aText );
break;
case 'L': // length of comparison text
aReplaceFormula = aReplaceFormula.replaceAt( nStrPos, 2,
- OUString::valueOf( maOoxData.maText.getLength() ) );
+ OUString::valueOf( maModel.maText.getLength() ) );
break;
case 'K': // top-10 rank
aReplaceFormula = aReplaceFormula.replaceAt( nStrPos, 2,
- OUString::valueOf( maOoxData.mnRank ) );
+ OUString::valueOf( maModel.mnRank ) );
break;
case 'M': // top-10 top/bottom flag
aReplaceFormula = aReplaceFormula.replaceAt( nStrPos, 2,
- OUString::valueOf( static_cast< sal_Int32 >( maOoxData.mbBottom ? 1 : 0 ) ) );
+ OUString::valueOf( static_cast< sal_Int32 >( maModel.mbBottom ? 1 : 0 ) ) );
break;
default:
OSL_ENSURE( false, "CondFormatRule::finalizeImport - unknown placeholder" );
@@ -598,22 +599,22 @@ void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries >
}
// set the replacement formula
- maOoxData.maFormulas.clear();
+ maModel.maFormulas.clear();
appendFormula( aReplaceFormula );
eOperator = ::com::sun::star::sheet::ConditionOperator_FORMULA;
}
- if( rxEntries.is() && (eOperator != ::com::sun::star::sheet::ConditionOperator_NONE) && !maOoxData.maFormulas.empty() )
+ if( rxEntries.is() && (eOperator != ::com::sun::star::sheet::ConditionOperator_NONE) && !maModel.maFormulas.empty() )
{
::std::vector< PropertyValue > aProps;
// create condition properties
lclAppendProperty( aProps, CREATE_OUSTRING( "Operator" ), eOperator );
- lclAppendProperty( aProps, CREATE_OUSTRING( "Formula1" ), maOoxData.maFormulas[ 0 ].getTokens() );
- if( maOoxData.maFormulas.size() >= 2 )
- lclAppendProperty( aProps, CREATE_OUSTRING( "Formula2" ), maOoxData.maFormulas[ 1 ].getTokens() );
+ lclAppendProperty( aProps, CREATE_OUSTRING( "Formula1" ), maModel.maFormulas[ 0 ].getTokens() );
+ if( maModel.maFormulas.size() >= 2 )
+ lclAppendProperty( aProps, CREATE_OUSTRING( "Formula2" ), maModel.maFormulas[ 1 ].getTokens() );
// style name for the formatting attributes
- OUString aStyleName = getStyles().createDxfStyle( maOoxData.mnDxfId );
+ OUString aStyleName = getStyles().createDxfStyle( maModel.mnDxfId );
if( aStyleName.getLength() > 0 )
lclAppendProperty( aProps, CREATE_OUSTRING( "StyleName" ), aStyleName );
@@ -630,7 +631,7 @@ void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries >
// ============================================================================
-OoxCondFormatData::OoxCondFormatData() :
+CondFormatModel::CondFormatModel() :
mbPivot( false )
{
}
@@ -644,8 +645,8 @@ CondFormat::CondFormat( const WorksheetHelper& rHelper ) :
void CondFormat::importConditionalFormatting( const AttributeList& rAttribs )
{
- getAddressConverter().convertToCellRangeList( maOoxData.maRanges, rAttribs.getString( XML_sqref, OUString() ), getSheetIndex(), true );
- maOoxData.mbPivot = rAttribs.getBool( XML_pivot, false );
+ getAddressConverter().convertToCellRangeList( maModel.maRanges, rAttribs.getString( XML_sqref, OUString() ), getSheetIndex(), true );
+ maModel.mbPivot = rAttribs.getBool( XML_pivot, false );
}
CondFormatRuleRef CondFormat::importCfRule( const AttributeList& rAttribs )
@@ -661,7 +662,7 @@ void CondFormat::importCondFormatting( RecordInputStream& rStrm )
BinRangeList aRanges;
rStrm.skip( 8 );
rStrm >> aRanges;
- getAddressConverter().convertToCellRangeList( maOoxData.maRanges, aRanges, getSheetIndex(), true );
+ getAddressConverter().convertToCellRangeList( maModel.maRanges, aRanges, getSheetIndex(), true );
}
void CondFormat::importCfRule( RecordInputStream& rStrm )
@@ -679,7 +680,7 @@ void CondFormat::importCfHeader( BiffInputStream& rStrm )
rStrm >> nRuleCount;
rStrm.skip( 10 );
rStrm >> aRanges;
- getAddressConverter().convertToCellRangeList( maOoxData.maRanges, aRanges, getSheetIndex(), true );
+ getAddressConverter().convertToCellRangeList( maModel.maRanges, aRanges, getSheetIndex(), true );
// import following list of CFRULE records
for( sal_uInt16 nRule = 0; (nRule < nRuleCount) && (rStrm.getNextRecId() == BIFF_ID_CFRULE) && rStrm.startNextRecord(); ++nRule )
@@ -692,17 +693,17 @@ void CondFormat::importCfHeader( BiffInputStream& rStrm )
void CondFormat::finalizeImport()
{
- Reference< XSheetCellRanges > xRanges = getCellRangeList( maOoxData.maRanges );
+ Reference< XSheetCellRanges > xRanges = getCellRangeList( maModel.maRanges );
if( xRanges.is() )
{
PropertySet aPropSet( xRanges );
Reference< XSheetConditionalEntries > xEntries;
- aPropSet.getProperty( xEntries, CREATE_OUSTRING( "ConditionalFormat" ) );
+ aPropSet.getProperty( xEntries, PROP_ConditionalFormat );
if( xEntries.is() )
{
// maRules is sorted by rule priority
maRules.forEachMem( &CondFormatRule::finalizeImport, xEntries );
- aPropSet.setProperty( CREATE_OUSTRING( "ConditionalFormat" ), xEntries );
+ aPropSet.setProperty( PROP_ConditionalFormat, xEntries );
}
}
}
diff --git a/oox/source/xls/condformatcontext.cxx b/oox/source/xls/condformatcontext.cxx
index 8b6b0f64ed65..85a0f49a7746 100644
--- a/oox/source/xls/condformatcontext.cxx
+++ b/oox/source/xls/condformatcontext.cxx
@@ -31,6 +31,7 @@
#include "oox/xls/condformatcontext.hxx"
using ::rtl::OUString;
+using ::oox::core::ContextHandlerRef;
namespace oox {
namespace xls {
@@ -44,16 +45,16 @@ OoxCondFormatContext::OoxCondFormatContext( OoxWorksheetFragmentBase& rFragment
// oox.core.ContextHandler2Helper interface -----------------------------------
-ContextWrapper OoxCondFormatContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxCondFormatContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
{
switch( getCurrentElement() )
{
case XLS_TOKEN( conditionalFormatting ):
- return (nElement == XLS_TOKEN( cfRule ));
+ return (nElement == XLS_TOKEN( cfRule )) ? this : 0;
case XLS_TOKEN( cfRule ):
- return (nElement == XLS_TOKEN( formula ));
+ return (nElement == XLS_TOKEN( formula )) ? this : 0;
}
- return false;
+ return 0;
}
void OoxCondFormatContext::onStartElement( const AttributeList& rAttribs )
@@ -79,14 +80,14 @@ void OoxCondFormatContext::onEndElement( const OUString& rChars )
}
}
-ContextWrapper OoxCondFormatContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& )
+ContextHandlerRef OoxCondFormatContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& )
{
switch( getCurrentElement() )
{
case OOBIN_ID_CONDFORMATTING:
- return (nRecId == OOBIN_ID_CFRULE);
+ return (nRecId == OOBIN_ID_CFRULE) ? this : 0;
}
- return false;
+ return 0;
}
void OoxCondFormatContext::onStartRecord( RecordInputStream& rStrm )
diff --git a/oox/source/xls/connectionsfragment.cxx b/oox/source/xls/connectionsfragment.cxx
index df3d6da8fbf2..d034aa7d6b07 100644
--- a/oox/source/xls/connectionsfragment.cxx
+++ b/oox/source/xls/connectionsfragment.cxx
@@ -33,13 +33,7 @@
#include "oox/xls/webquerybuffer.hxx"
using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::sheet::XSpreadsheet;
-using ::com::sun::star::xml::sax::SAXException;
+using ::oox::core::ContextHandlerRef;
namespace oox {
namespace xls {
@@ -49,50 +43,44 @@ OoxConnectionsFragment::OoxConnectionsFragment( const WorkbookHelper& rHelper, c
{
}
-ContextWrapper OoxConnectionsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxConnectionsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nElement == XLS_TOKEN( connections ));
+ if( nElement == XLS_TOKEN( connections ) ) return this;
+ break;
+
case XLS_TOKEN( connections ):
- return (nElement == XLS_TOKEN( connection ));
- case XLS_TOKEN( connection ):
- return (nElement == XLS_TOKEN( webPr )) ||
- (nElement == XLS_TOKEN( textPr )) ||
- (nElement == XLS_TOKEN( dbPr )) ||
- (nElement == XLS_TOKEN( olapPr )) ||
- (nElement == XLS_TOKEN( parameters ));
- case XLS_TOKEN( webPr ):
- return (nElement == XLS_TOKEN( tables ));
- case XLS_TOKEN( tables ):
- return (nElement == XLS_TOKEN( m )) ||
- (nElement == XLS_TOKEN( s )) ||
- (nElement == XLS_TOKEN( x ));
- }
- return false;
-}
+ switch( nElement )
+ {
+ case XLS_TOKEN( connection ): importConnection( rAttribs ); return this;
+ }
+ break;
-void OoxConnectionsFragment::onStartElement( const AttributeList& rAttribs )
-{
- switch ( getCurrentElement() )
- {
case XLS_TOKEN( connection ):
- importConnection( rAttribs );
+ switch( nElement )
+ {
+ case XLS_TOKEN( webPr ): importWebPr( rAttribs ); return this;
+ }
break;
+
case XLS_TOKEN( webPr ):
- importWebPr( rAttribs );
+ switch( nElement )
+ {
+ case XLS_TOKEN( tables ): importTables( rAttribs ); return this;
+ }
break;
+
case XLS_TOKEN( tables ):
- importTables( rAttribs );
- break;
- case XLS_TOKEN( s ):
- importS( rAttribs );
- break;
- case XLS_TOKEN( x ):
- importX( rAttribs );
+ switch( nElement )
+ {
+ case XLS_TOKEN( s ): importS( rAttribs ); break;
+ case XLS_TOKEN( x ): importX( rAttribs ); break;
+ }
break;
}
+ return 0;
}
void OoxConnectionsFragment::importConnection( const AttributeList& rAttribs )
diff --git a/oox/source/xls/defnamesbuffer.cxx b/oox/source/xls/defnamesbuffer.cxx
index b9197ea6edb2..0d03c93d21a6 100644
--- a/oox/source/xls/defnamesbuffer.cxx
+++ b/oox/source/xls/defnamesbuffer.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/sheet/SingleReference.hpp>
#include <com/sun/star/sheet/XFormulaTokens.hpp>
#include <com/sun/star/sheet/XPrintAreas.hpp>
+#include "properties.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/xls/addressconverter.hxx"
@@ -49,6 +50,7 @@ using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::table::CellAddress;
+using ::com::sun::star::table::CellRangeAddress;
using ::com::sun::star::sheet::ComplexReference;
using ::com::sun::star::sheet::SingleReference;
using ::com::sun::star::sheet::XFormulaTokens;
@@ -83,11 +85,90 @@ const sal_uInt8 BIFF2_DEFNAME_FUNC = 0x02; /// BIFF2 function/comma
const sal_uInt16 BIFF_DEFNAME_GLOBAL = 0; /// 0 = Globally defined name.
+// ----------------------------------------------------------------------------
+
+const sal_Char* const spcLegacyPrefix = "Excel_BuiltIn_";
+const sal_Char* const spcOoxPrefix = "_xlnm.";
+
+const sal_Char* const sppcBaseNames[] =
+{
+ "Consolidate_Area", /* OOX */
+ "Auto_Open",
+ "Auto_Close",
+ "Extract", /* OOX */
+ "Database", /* OOX */
+ "Criteria", /* OOX */
+ "Print_Area", /* OOX */
+ "Print_Titles", /* OOX */
+ "Recorder",
+ "Data_Form",
+ "Auto_Activate",
+ "Auto_Deactivate",
+ "Sheet_Title", /* OOX */
+ "_FilterDatabase" /* OOX */
+};
+
+/** Localized names for _xlnm._FilterDatabase as used in BIFF5. */
+const sal_Char* const sppcFilterDbNames[] =
+{
+ "_FilterDatabase", // English
+ "_FilterDatenbank" // German
+};
+
+OUString lclGetBaseName( sal_Unicode cBuiltinId )
+{
+ OSL_ENSURE( cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ), "lclGetBaseName - unknown builtin name" );
+ OUStringBuffer aBuffer;
+ if( cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ) )
+ aBuffer.appendAscii( sppcBaseNames[ cBuiltinId ] );
+ else
+ aBuffer.append( static_cast< sal_Int32 >( cBuiltinId ) );
+ return aBuffer.makeStringAndClear();
+}
+
+OUString lclGetBuiltinName( sal_Unicode cBuiltinId )
+{
+ return OUStringBuffer().appendAscii( spcOoxPrefix ).append( lclGetBaseName( cBuiltinId ) ).makeStringAndClear();
+}
+
+sal_Unicode lclGetBuiltinIdFromOox( const OUString& rOoxName )
+{
+ OUString aPrefix = OUString::createFromAscii( spcOoxPrefix );
+ sal_Int32 nPrefixLen = aPrefix.getLength();
+ if( rOoxName.matchIgnoreAsciiCase( aPrefix ) )
+ {
+ for( sal_Unicode cBuiltinId = 0; cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ); ++cBuiltinId )
+ {
+ OUString aBaseName = lclGetBaseName( cBuiltinId );
+ sal_Int32 nBaseNameLen = aBaseName.getLength();
+ if( (rOoxName.getLength() == nPrefixLen + nBaseNameLen) && rOoxName.matchIgnoreAsciiCase( aBaseName, nPrefixLen ) )
+ return cBuiltinId;
+ }
+ }
+ return OOX_DEFNAME_UNKNOWN;
+}
+
+sal_Unicode lclGetBuiltinIdFromOob( const OUString& rOobName )
+{
+ for( sal_Unicode cBuiltinId = 0; cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ); ++cBuiltinId )
+ if( rOobName.equalsIgnoreAsciiCaseAscii( sppcBaseNames[ cBuiltinId ] ) )
+ return cBuiltinId;
+ return OOX_DEFNAME_UNKNOWN;
+}
+
+bool lclIsFilterDatabaseName( const OUString& rName )
+{
+ for( const sal_Char* const* ppcName = sppcFilterDbNames; ppcName < STATIC_ARRAY_END( sppcFilterDbNames ); ++ppcName )
+ if( rName.equalsIgnoreAsciiCaseAscii( *ppcName ) )
+ return true;
+ return false;
+}
+
} // namespace
// ============================================================================
-OoxDefinedNameData::OoxDefinedNameData() :
+DefinedNameModel::DefinedNameModel() :
mnSheet( -1 ),
mnFuncGroupId( -1 ),
mbMacro( false ),
@@ -139,21 +220,21 @@ void lclConvertSingleRefFlags( SingleReference& orApiRef, const CellAddress& rBa
DefinedNameBase::DefinedNameBase( const WorkbookHelper& rHelper, sal_Int32 nLocalSheet ) :
WorkbookHelper( rHelper )
{
- maOoxData.mnSheet = nLocalSheet;
+ maModel.mnSheet = nLocalSheet;
}
-const OUString& DefinedNameBase::getUpcaseOoxName() const
+const OUString& DefinedNameBase::getUpcaseModelName() const
{
- if( maUpOoxName.getLength() == 0 )
- maUpOoxName = maOoxData.maName.toAsciiUpperCase();
- return maUpOoxName;
+ if( maUpModelName.getLength() == 0 )
+ maUpModelName = maModel.maName.toAsciiUpperCase();
+ return maUpModelName;
}
Any DefinedNameBase::getReference( const CellAddress& rBaseAddress ) const
{
- if( maRefAny.hasValue() && (maOoxData.maName.getLength() >= 2) && (maOoxData.maName[ 0 ] == '\x01') )
+ if( maRefAny.hasValue() && (maModel.maName.getLength() >= 2) && (maModel.maName[ 0 ] == '\x01') )
{
- sal_Unicode cFlagsChar = getUpcaseOoxName()[ 1 ];
+ sal_Unicode cFlagsChar = getUpcaseModelName()[ 1 ];
if( ('A' <= cFlagsChar) && (cFlagsChar <= 'P') )
{
sal_uInt16 nFlags = static_cast< sal_uInt16 >( cFlagsChar - 'A' );
@@ -179,10 +260,10 @@ Any DefinedNameBase::getReference( const CellAddress& rBaseAddress ) const
void DefinedNameBase::importOoxFormula( FormulaContext& rContext )
{
- if( maOoxData.maFormula.getLength() > 0 )
+ if( maModel.maFormula.getLength() > 0 )
{
- rContext.setBaseAddress( CellAddress( static_cast< sal_Int16 >( maOoxData.mnSheet ), 0, 0 ) );
- getFormulaParser().importFormula( rContext, maOoxData.maFormula );
+ rContext.setBaseAddress( CellAddress( static_cast< sal_Int16 >( maModel.mnSheet ), 0, 0 ) );
+ getFormulaParser().importFormula( rContext, maModel.maFormula );
}
else
getFormulaParser().convertErrorToFormula( rContext, BIFF_ERR_NAME );
@@ -190,13 +271,13 @@ void DefinedNameBase::importOoxFormula( FormulaContext& rContext )
void DefinedNameBase::importOobFormula( FormulaContext& rContext, RecordInputStream& rStrm )
{
- rContext.setBaseAddress( CellAddress( static_cast< sal_Int16 >( maOoxData.mnSheet ), 0, 0 ) );
+ rContext.setBaseAddress( CellAddress( static_cast< sal_Int16 >( maModel.mnSheet ), 0, 0 ) );
getFormulaParser().importFormula( rContext, rStrm );
}
void DefinedNameBase::importBiffFormula( FormulaContext& rContext, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize )
{
- rContext.setBaseAddress( CellAddress( static_cast< sal_Int16 >( maOoxData.mnSheet ), 0, 0 ) );
+ rContext.setBaseAddress( CellAddress( static_cast< sal_Int16 >( maModel.mnSheet ), 0, 0 ) );
if( !pnFmlaSize || (*pnFmlaSize > 0) )
getFormulaParser().importFormula( rContext, rStrm, pnFmlaSize );
else
@@ -210,89 +291,6 @@ void DefinedNameBase::setReference( const ApiTokenSequence& rTokens )
// ============================================================================
-namespace {
-
-const sal_Char* const spcLegacyPrefix = "Excel_BuiltIn_";
-const sal_Char* const spcOoxPrefix = "_xlnm.";
-
-const sal_Char* const sppcBaseNames[] =
-{
- "Consolidate_Area", /* OOX */
- "Auto_Open",
- "Auto_Close",
- "Extract", /* OOX */
- "Database", /* OOX */
- "Criteria", /* OOX */
- "Print_Area", /* OOX */
- "Print_Titles", /* OOX */
- "Recorder",
- "Data_Form",
- "Auto_Activate",
- "Auto_Deactivate",
- "Sheet_Title", /* OOX */
- "_FilterDatabase" /* OOX */
-};
-
-/** Localized names for _xlnm._FilterDatabase as used in BIFF5. */
-const sal_Char* const sppcFilterDbNames[] =
-{
- "_FilterDatabase", // English
- "_FilterDatenbank" // German
-};
-
-OUString lclGetBaseName( sal_Unicode cBuiltinId )
-{
- OSL_ENSURE( cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ), "lclGetBaseName - unknown builtin name" );
- OUStringBuffer aBuffer;
- if( cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ) )
- aBuffer.appendAscii( sppcBaseNames[ cBuiltinId ] );
- else
- aBuffer.append( static_cast< sal_Int32 >( cBuiltinId ) );
- return aBuffer.makeStringAndClear();
-}
-
-OUString lclGetFinalName( sal_Unicode cBuiltinId )
-{
- return OUStringBuffer().appendAscii( spcOoxPrefix ).append( lclGetBaseName( cBuiltinId ) ).makeStringAndClear();
-}
-
-sal_Unicode lclGetBuiltinIdFromOox( const OUString& rOoxName )
-{
- OUString aPrefix = OUString::createFromAscii( spcOoxPrefix );
- sal_Int32 nPrefixLen = aPrefix.getLength();
- if( rOoxName.matchIgnoreAsciiCase( aPrefix ) )
- {
- for( sal_Unicode cBuiltinId = 0; cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ); ++cBuiltinId )
- {
- OUString aBaseName = lclGetBaseName( cBuiltinId );
- sal_Int32 nBaseNameLen = aBaseName.getLength();
- if( (rOoxName.getLength() == nPrefixLen + nBaseNameLen) && rOoxName.matchIgnoreAsciiCase( aBaseName, nPrefixLen ) )
- return cBuiltinId;
- }
- }
- return OOX_DEFNAME_UNKNOWN;
-}
-
-sal_Unicode lclGetBuiltinIdFromOob( const OUString& rOobName )
-{
- for( sal_Unicode cBuiltinId = 0; cBuiltinId < STATIC_ARRAY_SIZE( sppcBaseNames ); ++cBuiltinId )
- if( rOobName.equalsIgnoreAsciiCaseAscii( sppcBaseNames[ cBuiltinId ] ) )
- return cBuiltinId;
- return OOX_DEFNAME_UNKNOWN;
-}
-
-bool lclIsFilterDatabaseName( const OUString& rName )
-{
- for( const sal_Char* const* ppcName = sppcFilterDbNames; ppcName < STATIC_ARRAY_END( sppcFilterDbNames ); ++ppcName )
- if( rName.equalsIgnoreAsciiCaseAscii( *ppcName ) )
- return true;
- return false;
-}
-
-} // namespace
-
-// ----------------------------------------------------------------------------
-
DefinedName::DefinedName( const WorkbookHelper& rHelper, sal_Int32 nLocalSheet ) :
DefinedNameBase( rHelper, nLocalSheet ),
mnTokenIndex( -1 ),
@@ -303,19 +301,19 @@ DefinedName::DefinedName( const WorkbookHelper& rHelper, sal_Int32 nLocalSheet )
void DefinedName::importDefinedName( const AttributeList& rAttribs )
{
- maOoxData.maName = rAttribs.getString( XML_name, OUString() );
- maOoxData.mnSheet = rAttribs.getInteger( XML_localSheetId, -1 );
- maOoxData.mnFuncGroupId = rAttribs.getInteger( XML_functionGroupId, -1 );
- maOoxData.mbMacro = rAttribs.getBool( XML_xlm, false );
- maOoxData.mbFunction = rAttribs.getBool( XML_function, false );
- maOoxData.mbVBName = rAttribs.getBool( XML_vbProcedure, false );
- maOoxData.mbHidden = rAttribs.getBool( XML_hidden, false );
- mcBuiltinId = lclGetBuiltinIdFromOox( maOoxData.maName );
+ maModel.maName = rAttribs.getString( XML_name, OUString() );
+ maModel.mnSheet = rAttribs.getInteger( XML_localSheetId, -1 );
+ maModel.mnFuncGroupId = rAttribs.getInteger( XML_functionGroupId, -1 );
+ maModel.mbMacro = rAttribs.getBool( XML_xlm, false );
+ maModel.mbFunction = rAttribs.getBool( XML_function, false );
+ maModel.mbVBName = rAttribs.getBool( XML_vbProcedure, false );
+ maModel.mbHidden = rAttribs.getBool( XML_hidden, false );
+ mcBuiltinId = lclGetBuiltinIdFromOox( maModel.maName );
}
void DefinedName::setFormula( const OUString& rFormula )
{
- maOoxData.maFormula = rFormula;
+ maModel.maFormula = rFormula;
}
void DefinedName::importDefinedName( RecordInputStream& rStrm )
@@ -323,21 +321,21 @@ void DefinedName::importDefinedName( RecordInputStream& rStrm )
sal_uInt32 nFlags;
rStrm >> nFlags;
rStrm.skip( 1 ); // keyboard shortcut
- rStrm >> maOoxData.mnSheet >> maOoxData.maName;
+ rStrm >> maModel.mnSheet >> maModel.maName;
// macro function/command, hidden flag
- maOoxData.mnFuncGroupId = extractValue< sal_Int32 >( nFlags, 6, 9 );
- maOoxData.mbMacro = getFlag( nFlags, OOBIN_DEFNAME_MACRO );
- maOoxData.mbFunction = getFlag( nFlags, OOBIN_DEFNAME_FUNC );
- maOoxData.mbVBName = getFlag( nFlags, OOBIN_DEFNAME_VBNAME );
- maOoxData.mbHidden = getFlag( nFlags, OOBIN_DEFNAME_HIDDEN );
+ maModel.mnFuncGroupId = extractValue< sal_Int32 >( nFlags, 6, 9 );
+ maModel.mbMacro = getFlag( nFlags, OOBIN_DEFNAME_MACRO );
+ maModel.mbFunction = getFlag( nFlags, OOBIN_DEFNAME_FUNC );
+ maModel.mbVBName = getFlag( nFlags, OOBIN_DEFNAME_VBNAME );
+ maModel.mbHidden = getFlag( nFlags, OOBIN_DEFNAME_HIDDEN );
// get builtin name index from name
if( getFlag( nFlags, OOBIN_DEFNAME_BUILTIN ) )
- mcBuiltinId = lclGetBuiltinIdFromOob( maOoxData.maName );
+ mcBuiltinId = lclGetBuiltinIdFromOob( maModel.maName );
// unhide built-in names (_xlnm._FilterDatabase is always hidden)
if( isBuiltinName() )
- maOoxData.mbHidden = false;
+ maModel.mbHidden = false;
// store token array data
sal_Int64 nRecPos = rStrm.tell();
@@ -372,52 +370,52 @@ void DefinedName::importDefinedName( BiffInputStream& rStrm )
rStrm >> nShortCut >> nNameLen;
mnFmlaSize = rStrm.readuInt8();
setFlag( nFlags, BIFF_DEFNAME_FUNC, getFlag( nFlagsBiff2, BIFF2_DEFNAME_FUNC ) );
- maOoxData.maName = rStrm.readCharArray( nNameLen, getTextEncoding() );
+ maModel.maName = rStrm.readCharArray( nNameLen, getTextEncoding() );
}
break;
case BIFF3:
case BIFF4:
rStrm >> nFlags >> nShortCut >> nNameLen >> mnFmlaSize;
- maOoxData.maName = rStrm.readCharArray( nNameLen, getTextEncoding() );
+ maModel.maName = rStrm.readCharArray( nNameLen, getTextEncoding() );
break;
case BIFF5:
rStrm >> nFlags >> nShortCut >> nNameLen >> mnFmlaSize >> nRefId >> nTabId;
rStrm.skip( 4 );
- maOoxData.maName = rStrm.readCharArray( nNameLen, getTextEncoding() );
+ maModel.maName = rStrm.readCharArray( nNameLen, getTextEncoding() );
break;
case BIFF8:
rStrm >> nFlags >> nShortCut >> nNameLen >> mnFmlaSize >> nRefId >> nTabId;
rStrm.skip( 4 );
- maOoxData.maName = rStrm.readUniString( nNameLen );
+ maModel.maName = rStrm.readUniString( nNameLen );
break;
case BIFF_UNKNOWN: break;
}
rStrm.enableNulChars( false );
// macro function/command, hidden flag
- maOoxData.mnFuncGroupId = extractValue< sal_Int32 >( nFlags, 6, 6 );
- maOoxData.mbMacro = getFlag( nFlags, BIFF_DEFNAME_MACRO );
- maOoxData.mbFunction = getFlag( nFlags, BIFF_DEFNAME_FUNC );
- maOoxData.mbVBName = getFlag( nFlags, BIFF_DEFNAME_VBNAME );
- maOoxData.mbHidden = getFlag( nFlags, BIFF_DEFNAME_HIDDEN );
+ maModel.mnFuncGroupId = extractValue< sal_Int32 >( nFlags, 6, 6 );
+ maModel.mbMacro = getFlag( nFlags, BIFF_DEFNAME_MACRO );
+ maModel.mbFunction = getFlag( nFlags, BIFF_DEFNAME_FUNC );
+ maModel.mbVBName = getFlag( nFlags, BIFF_DEFNAME_VBNAME );
+ maModel.mbHidden = getFlag( nFlags, BIFF_DEFNAME_HIDDEN );
// get builtin name index from name
if( getFlag( nFlags, BIFF_DEFNAME_BUILTIN ) )
{
- OSL_ENSURE( maOoxData.maName.getLength() == 1, "DefinedName::importDefinedName - wrong builtin name" );
- if( maOoxData.maName.getLength() > 0 )
- mcBuiltinId = maOoxData.maName[ 0 ];
+ OSL_ENSURE( maModel.maName.getLength() == 1, "DefinedName::importDefinedName - wrong builtin name" );
+ if( maModel.maName.getLength() > 0 )
+ mcBuiltinId = maModel.maName[ 0 ];
}
/* In BIFF5, _xlnm._FilterDatabase appears as hidden user name without
built-in flag, and even worse, localized. */
- else if( (eBiff == BIFF5) && lclIsFilterDatabaseName( maOoxData.maName ) )
+ else if( (eBiff == BIFF5) && lclIsFilterDatabaseName( maModel.maName ) )
{
mcBuiltinId = OOX_DEFNAME_FILTERDATABASE;
}
// unhide built-in names (_xlnm._FilterDatabase is always hidden)
if( isBuiltinName() )
- maOoxData.mbHidden = false;
+ maModel.mbHidden = false;
// get sheet index for sheet-local names in BIFF5-BIFF8
switch( getBiff() )
@@ -431,13 +429,13 @@ void DefinedName::importDefinedName( BiffInputStream& rStrm )
if( nRefId != BIFF_DEFNAME_GLOBAL )
if( const ExternalLink* pExtLink = getExternalLinks().getExternalLink( nRefId ).get() )
if( pExtLink->getLinkType() == LINKTYPE_INTERNAL )
- maOoxData.mnSheet = pExtLink->getSheetIndex();
+ maModel.mnSheet = pExtLink->getSheetIndex();
break;
case BIFF8:
// convert one-based sheet index to zero-based
OSL_ENSURE( nTabId >= 0, "DefinedName::importDefinedName - invalid local sheet index" );
if( nTabId != BIFF_DEFNAME_GLOBAL )
- maOoxData.mnSheet = nTabId - 1;
+ maModel.mnSheet = nTabId - 1;
break;
case BIFF_UNKNOWN:
break;
@@ -450,20 +448,20 @@ void DefinedName::importDefinedName( BiffInputStream& rStrm )
void DefinedName::createNameObject()
{
// do not create hidden names and names for (macro) functions
- if( maOoxData.mbHidden || maOoxData.mbFunction )
+ if( maModel.mbHidden || maModel.mbFunction )
return;
// convert original name to final Calc name
- if( maOoxData.mbVBName )
- maFinalName = maOoxData.maName;
+ if( maModel.mbVBName )
+ maCalcName = maModel.maName;
else if( isBuiltinName() )
- maFinalName = lclGetFinalName( mcBuiltinId );
+ maCalcName = lclGetBuiltinName( mcBuiltinId );
else
- maFinalName = maOoxData.maName; //! TODO convert to valid name
+ maCalcName = maModel.maName; //! TODO convert to valid name
// append sheet index for local names in multi-sheet documents
if( isWorkbookFile() && !isGlobalName() )
- maFinalName = OUStringBuffer( maFinalName ).append( sal_Unicode( '_' ) ).append( maOoxData.mnSheet + 1 ).makeStringAndClear();
+ maCalcName = OUStringBuffer( maCalcName ).append( sal_Unicode( '_' ) ).append( maModel.mnSheet + 1 ).makeStringAndClear();
// special flags for this name
sal_Int32 nNameFlags = 0;
@@ -475,11 +473,11 @@ void DefinedName::createNameObject()
case OOX_DEFNAME_PRINTTITLES: nNameFlags = COLUMN_HEADER | ROW_HEADER; break;
}
- // create the name and insert it into the document, maFinalName will be changed to the resulting name
- mxNamedRange = createNamedRangeObject( maFinalName, nNameFlags );
+ // create the name and insert it into the document, maCalcName will be changed to the resulting name
+ mxNamedRange = createNamedRangeObject( maCalcName, nNameFlags );
// index of this defined name used in formula token arrays
PropertySet aPropSet( mxNamedRange );
- aPropSet.getProperty( mnTokenIndex, CREATE_OUSTRING( "TokenIndex" ) );
+ aPropSet.getProperty( mnTokenIndex, PROP_TokenIndex );
}
void DefinedName::convertFormula()
@@ -510,18 +508,18 @@ void DefinedName::convertFormula()
{
case OOX_DEFNAME_PRINTAREA:
{
- Reference< XPrintAreas > xPrintAreas( getSheet( maOoxData.mnSheet ), UNO_QUERY );
+ Reference< XPrintAreas > xPrintAreas( getSheetFromDoc( maModel.mnSheet ), UNO_QUERY );
ApiCellRangeList aPrintRanges;
- getFormulaParser().extractCellRangeList( aPrintRanges, xTokens->getTokens(), maOoxData.mnSheet );
+ getFormulaParser().extractCellRangeList( aPrintRanges, xTokens->getTokens(), maModel.mnSheet );
if( xPrintAreas.is() && !aPrintRanges.empty() )
xPrintAreas->setPrintAreas( ContainerHelper::vectorToSequence( aPrintRanges ) );
}
break;
case OOX_DEFNAME_PRINTTITLES:
{
- Reference< XPrintAreas > xPrintAreas( getSheet( maOoxData.mnSheet ), UNO_QUERY );
+ Reference< XPrintAreas > xPrintAreas( getSheetFromDoc( maModel.mnSheet ), UNO_QUERY );
ApiCellRangeList aTitleRanges;
- getFormulaParser().extractCellRangeList( aTitleRanges, xTokens->getTokens(), maOoxData.mnSheet );
+ getFormulaParser().extractCellRangeList( aTitleRanges, xTokens->getTokens(), maModel.mnSheet );
if( xPrintAreas.is() && !aTitleRanges.empty() )
{
bool bHasRowTitles = false;
@@ -549,7 +547,7 @@ void DefinedName::convertFormula()
break;
}
}
- else if( mxBiffStrm.get() && maOoxData.mbHidden && (maOoxData.maName.getLength() > 0) && (maOoxData.maName[ 0 ] == '\x01') )
+ else if( mxBiffStrm.get() && maModel.mbHidden && (maModel.maName.getLength() > 0) && (maModel.maName[ 0 ] == '\x01') )
{
// import BIFF2-BIFF4 external references
TokensFormulaContext aContext( true, true );
@@ -558,6 +556,14 @@ void DefinedName::convertFormula()
}
}
+bool DefinedName::getAbsoluteRange( CellRangeAddress& orRange ) const
+{
+ /* ScNamedRangeObj::XCellRangeReferrer::getReferredCells is buggy with
+ relative references, so we extract an absolute reference by hand. */
+ Reference< XFormulaTokens > xTokens( mxNamedRange, UNO_QUERY );
+ return xTokens.is() && getFormulaParser().extractAbsoluteRange( orRange, xTokens->getTokens() );
+}
+
void DefinedName::implImportOoxFormula( FormulaContext& rContext )
{
if( mxFormula.get() )
@@ -635,14 +641,14 @@ DefinedNameRef DefinedNamesBuffer::getByTokenIndex( sal_Int32 nIndex ) const
return maDefNameMap.get( nIndex );
}
-DefinedNameRef DefinedNamesBuffer::getByOoxName( const OUString& rOoxName, sal_Int32 nSheet ) const
+DefinedNameRef DefinedNamesBuffer::getByModelName( const OUString& rModelName, sal_Int32 nSheet ) const
{
DefinedNameRef xGlobalName; // a found global name
DefinedNameRef xLocalName; // a found local name
for( DefNameVector::const_iterator aIt = maDefNames.begin(), aEnd = maDefNames.end(); (aIt != aEnd) && !xLocalName; ++aIt )
{
DefinedNameRef xCurrName = *aIt;
- if( xCurrName->getOoxName() == rOoxName )
+ if( xCurrName->getModelName() == rModelName )
{
if( xCurrName->getSheetIndex() == nSheet )
xLocalName = xCurrName;
diff --git a/oox/source/xls/drawingfragment.cxx b/oox/source/xls/drawingfragment.cxx
index 6424f02e26c7..3351ffed784e 100644
--- a/oox/source/xls/drawingfragment.cxx
+++ b/oox/source/xls/drawingfragment.cxx
@@ -47,6 +47,7 @@ using ::com::sun::star::awt::Size;
using ::com::sun::star::awt::Rectangle;
using ::com::sun::star::drawing::XDrawPageSupplier;
using ::com::sun::star::table::CellAddress;
+using ::oox::core::ContextHandlerRef;
using ::oox::drawingml::ConnectorShapeContext;
using ::oox::drawingml::GraphicalObjectFrameContext;
using ::oox::drawingml::GraphicShapeContext;
@@ -60,7 +61,7 @@ namespace xls {
// ============================================================================
-OoxAnchorPosition::OoxAnchorPosition() :
+AnchorPosModel::AnchorPosModel() :
mnX( -1 ),
mnY( -1 )
{
@@ -68,7 +69,7 @@ OoxAnchorPosition::OoxAnchorPosition() :
// ----------------------------------------------------------------------------
-OoxAnchorSize::OoxAnchorSize() :
+AnchorSizeModel::AnchorSizeModel() :
mnWidth( -1 ),
mnHeight( -1 )
{
@@ -76,7 +77,7 @@ OoxAnchorSize::OoxAnchorSize() :
// ----------------------------------------------------------------------------
-OoxAnchorCell::OoxAnchorCell() :
+AnchorCellModel::AnchorCellModel() :
mnCol( -1 ),
mnRow( -1 ),
mnColOffset( 0 ),
@@ -86,7 +87,7 @@ OoxAnchorCell::OoxAnchorCell() :
// ----------------------------------------------------------------------------
-OoxAnchorClientData::OoxAnchorClientData() :
+AnchorClientDataModel::AnchorClientDataModel() :
mbLocksWithSheet( true ),
mbPrintsWithSheet( true )
{
@@ -101,20 +102,23 @@ ShapeAnchor::ShapeAnchor( const WorksheetHelper& rHelper ) :
{
}
-void ShapeAnchor::importAbsoluteAnchor( const AttributeList& )
+void ShapeAnchor::importAnchor( sal_Int32 nElement, const AttributeList& rAttribs )
{
- meType = ANCHOR_ABSOLUTE;
-}
-
-void ShapeAnchor::importOneCellAnchor( const AttributeList& )
-{
- meType = ANCHOR_ONECELL;
-}
-
-void ShapeAnchor::importTwoCellAnchor( const AttributeList& rAttribs )
-{
- meType = ANCHOR_TWOCELL;
- mnEditAs = rAttribs.getToken( XML_editAs, XML_twoCell );
+ switch( nElement )
+ {
+ case XDR_TOKEN( absoluteAnchor ):
+ meType = ANCHOR_ABSOLUTE;
+ break;
+ case XDR_TOKEN( oneCellAnchor ):
+ meType = ANCHOR_ONECELL;
+ break;
+ case XDR_TOKEN( twoCellAnchor ):
+ meType = ANCHOR_TWOCELL;
+ mnEditAs = rAttribs.getToken( XML_editAs, XML_twoCell );
+ break;
+ default:
+ OSL_ENSURE( false, "ShapeAnchor::importAnchor - unexpected element" );
+ }
}
void ShapeAnchor::importPos( const AttributeList& rAttribs )
@@ -139,7 +143,7 @@ void ShapeAnchor::importClientData( const AttributeList& rAttribs )
void ShapeAnchor::setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, const OUString& rValue )
{
- OoxAnchorCell* pAnchorCell = 0;
+ AnchorCellModel* pAnchorCell = 0;
switch( nParentContext )
{
case XDR_TOKEN( from ):
@@ -163,7 +167,37 @@ void ShapeAnchor::setCellPos( sal_Int32 nElement, sal_Int32 nParentContext, cons
}
}
-Rectangle ShapeAnchor::calcApiLocation( const Size& rApiSheetSize, const OoxAnchorSize& rEmuSheetSize ) const
+bool ShapeAnchor::isValidAnchor() const
+{
+ bool bValid = false;
+ switch( meType )
+ {
+ case ANCHOR_ABSOLUTE:
+ OSL_ENSURE( maPos.isValid(), "ShapeAnchor::isValidAnchor - invalid position" );
+ OSL_ENSURE( maSize.isValid(), "ShapeAnchor::isValidAnchor - invalid size" );
+ bValid = maPos.isValid() && maSize.isValid() && (maSize.mnWidth > 0) && (maSize.mnHeight > 0);
+ break;
+ case ANCHOR_ONECELL:
+ OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::isValidAnchor - invalid from position" );
+ OSL_ENSURE( maSize.isValid(), "ShapeAnchor::isValidAnchor - invalid size" );
+ bValid = maFrom.isValid() && maSize.isValid() && (maSize.mnWidth > 0) && (maSize.mnHeight > 0);
+ break;
+ case ANCHOR_TWOCELL:
+ OSL_ENSURE( maFrom.isValid(), "ShapeAnchor::isValidAnchor - invalid from position" );
+ OSL_ENSURE( maTo.isValid(), "ShapeAnchor::isValidAnchor - invalid to position" );
+ bValid = maFrom.isValid() && maTo.isValid() &&
+ ((maFrom.mnCol < maTo.mnCol) || ((maFrom.mnCol == maTo.mnCol) && (maFrom.mnColOffset < maTo.mnColOffset))) &&
+ ((maFrom.mnRow < maTo.mnRow) || ((maFrom.mnRow == maTo.mnRow) && (maFrom.mnRowOffset < maTo.mnRowOffset)));
+ break;
+ case ANCHOR_INVALID:
+ OSL_ENSURE( false, "ShapeAnchor::isValidAnchor - invalid anchor" );
+ break;
+ }
+ return bValid;
+}
+
+#if 0 // unused code
+Rectangle ShapeAnchor::calcApiLocation( const Size& rApiSheetSize, const AnchorSizeModel& rEmuSheetSize ) const
{
AddressConverter& rAddrConv = getAddressConverter();
UnitConverter& rUnitConv = getUnitConverter();
@@ -241,8 +275,9 @@ Rectangle ShapeAnchor::calcApiLocation( const Size& rApiSheetSize, const OoxAnch
return aApiLoc;
}
+#endif
-Rectangle ShapeAnchor::calcEmuLocation( const OoxAnchorSize& rEmuSheetSize ) const
+Rectangle ShapeAnchor::calcEmuLocation( const AnchorSizeModel& rEmuSheetSize ) const
{
AddressConverter& rAddrConv = getAddressConverter();
UnitConverter& rUnitConv = getUnitConverter();
@@ -340,7 +375,7 @@ Rectangle ShapeAnchor::calcEmuLocation( const OoxAnchorSize& rEmuSheetSize ) con
OoxDrawingFragment::OoxDrawingFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
OoxWorksheetFragmentBase( rHelper, rFragmentPath )
{
- Reference< XDrawPageSupplier > xDrawPageSupp( getXSpreadsheet(), UNO_QUERY );
+ Reference< XDrawPageSupplier > xDrawPageSupp( getSheet(), UNO_QUERY );
if( xDrawPageSupp.is() )
mxDrawPage.set( xDrawPageSupp->getDrawPage(), UNO_QUERY );
OSL_ENSURE( mxDrawPage.is(), "OoxDrawingFragment::OoxDrawingFragment - missing drawing page" );
@@ -352,16 +387,26 @@ OoxDrawingFragment::OoxDrawingFragment( const WorksheetHelper& rHelper, const OU
// oox.core.ContextHandler2Helper interface -----------------------------------
-ContextWrapper OoxDrawingFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxDrawingFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nElement == XDR_TOKEN( wsDr ));
+ if( nElement == XDR_TOKEN( wsDr ) ) return this;
+ break;
+
case XDR_TOKEN( wsDr ):
- return (nElement == XDR_TOKEN( absoluteAnchor )) ||
- (nElement == XDR_TOKEN( oneCellAnchor )) ||
- (nElement == XDR_TOKEN( twoCellAnchor ));
+ switch( nElement )
+ {
+ case XDR_TOKEN( absoluteAnchor ):
+ case XDR_TOKEN( oneCellAnchor ):
+ case XDR_TOKEN( twoCellAnchor ):
+ mxAnchor.reset( new ShapeAnchor( *this ) );
+ mxAnchor->importAnchor( nElement, rAttribs );
+ return this;
+ }
+ break;
+
case XDR_TOKEN( absoluteAnchor ):
case XDR_TOKEN( oneCellAnchor ):
case XDR_TOKEN( twoCellAnchor ):
@@ -382,48 +427,28 @@ ContextWrapper OoxDrawingFragment::onCreateContext( sal_Int32 nElement, const At
case XDR_TOKEN( grpSp ):
mxShape.reset( new Shape( "com.sun.star.drawing.GroupShape" ) );
return new ShapeGroupContext( *this, ShapePtr(), mxShape );
+
+ case XDR_TOKEN( from ):
+ case XDR_TOKEN( to ): return this;
+
+ case XDR_TOKEN( pos ): if( mxAnchor.get() ) mxAnchor->importPos( rAttribs ); break;
+ case XDR_TOKEN( ext ): if( mxAnchor.get() ) mxAnchor->importExt( rAttribs ); break;
+ case XDR_TOKEN( clientData ): if( mxAnchor.get() ) mxAnchor->importClientData( rAttribs ); break;
}
- return (nElement == XDR_TOKEN( pos )) ||
- (nElement == XDR_TOKEN( ext )) ||
- (nElement == XDR_TOKEN( from )) ||
- (nElement == XDR_TOKEN( to )) ||
- (nElement == XDR_TOKEN( clientData ));
+ break;
+
case XDR_TOKEN( from ):
case XDR_TOKEN( to ):
- return (nElement == XDR_TOKEN( col )) ||
- (nElement == XDR_TOKEN( row )) ||
- (nElement == XDR_TOKEN( colOff )) ||
- (nElement == XDR_TOKEN( rowOff ));
- }
- return false;
-}
-
-void OoxDrawingFragment::onStartElement( const AttributeList& rAttribs )
-{
- switch( getCurrentElement() )
- {
- case XDR_TOKEN( absoluteAnchor ):
- mxAnchor.reset( new ShapeAnchor( *this ) );
- mxAnchor->importAbsoluteAnchor( rAttribs );
- break;
- case XDR_TOKEN( oneCellAnchor ):
- mxAnchor.reset( new ShapeAnchor( *this ) );
- mxAnchor->importOneCellAnchor( rAttribs );
- break;
- case XDR_TOKEN( twoCellAnchor ):
- mxAnchor.reset( new ShapeAnchor( *this ) );
- mxAnchor->importTwoCellAnchor( rAttribs );
- break;
- case XDR_TOKEN( pos ):
- if( mxAnchor.get() ) mxAnchor->importPos( rAttribs );
- break;
- case XDR_TOKEN( ext ):
- if( mxAnchor.get() ) mxAnchor->importExt( rAttribs );
- break;
- case XDR_TOKEN( clientData ):
- if( mxAnchor.get() ) mxAnchor->importClientData( rAttribs );
+ switch( nElement )
+ {
+ case XDR_TOKEN( col ):
+ case XDR_TOKEN( row ):
+ case XDR_TOKEN( colOff ):
+ case XDR_TOKEN( rowOff ): return this; // collect index in onEndElement()
+ }
break;
}
+ return 0;
}
void OoxDrawingFragment::onEndElement( const OUString& rChars )
@@ -439,7 +464,7 @@ void OoxDrawingFragment::onEndElement( const OUString& rChars )
case XDR_TOKEN( absoluteAnchor ):
case XDR_TOKEN( oneCellAnchor ):
case XDR_TOKEN( twoCellAnchor ):
- if( mxDrawPage.is() && mxShape.get() && mxAnchor.get() )
+ if( mxDrawPage.is() && mxShape.get() && mxAnchor.get() && mxAnchor->isValidAnchor() )
{
Rectangle aLoc = mxAnchor->calcEmuLocation( maEmuSheetSize );
if( (aLoc.X >= 0) && (aLoc.Y >= 0) && (aLoc.Width >= 0) && (aLoc.Height >= 0) )
diff --git a/oox/source/xls/excelfilter.cxx b/oox/source/xls/excelfilter.cxx
index cb02ba32279d..4f3fce123387 100644
--- a/oox/source/xls/excelfilter.cxx
+++ b/oox/source/xls/excelfilter.cxx
@@ -199,18 +199,11 @@ bool ExcelBiffFilter::importDocument() throw()
// detect BIFF version and workbook stream name
OUString aWorkbookName;
BiffType eBiff = BiffDetector::detectStorageBiffVersion( aWorkbookName, getStorage() );
- BinaryXInputStream aInStrm( getStorage()->openInputStream( aWorkbookName ), aWorkbookName.getLength() > 0 );
- OSL_ENSURE( (eBiff != BIFF_UNKNOWN) && !aInStrm.isEof(), "ExcelBiffFilter::ExcelBiffFilter - invalid file format" );
-
- if( (eBiff != BIFF_UNKNOWN) && !aInStrm.isEof() )
+ OSL_ENSURE( eBiff != BIFF_UNKNOWN, "ExcelBiffFilter::ExcelBiffFilter - invalid file format" );
+ if( eBiff != BIFF_UNKNOWN )
{
WorkbookHelperRoot aHelper( *this, eBiff );
- if( aHelper.isValid() )
- {
- BiffInputStream aBiffStream( aInStrm );
- BiffWorkbookFragment aFragment( aHelper, aBiffStream );
- bRet = aFragment.importFragment();
- }
+ bRet = aHelper.isValid() && BiffWorkbookFragment( aHelper, aWorkbookName ).importFragment();
}
return bRet;
}
diff --git a/oox/source/xls/excelhandlers.cxx b/oox/source/xls/excelhandlers.cxx
index a3db6c284416..3941bb306177 100644
--- a/oox/source/xls/excelhandlers.cxx
+++ b/oox/source/xls/excelhandlers.cxx
@@ -29,10 +29,12 @@
************************************************************************/
#include "oox/xls/excelhandlers.hxx"
+#include "oox/core/filterbase.hxx"
#include "oox/xls/biffinputstream.hxx"
using ::rtl::OUString;
-using ::oox::core::XmlFilterBase;
+using ::oox::core::FilterBase;
+using ::oox::core::FragmentHandler2;
namespace oox {
namespace xls {
@@ -42,7 +44,7 @@ namespace xls {
OoxWorkbookFragmentBase::OoxWorkbookFragmentBase(
const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
- OoxFragmentHandler( rHelper.getOoxFilter(), rFragmentPath ),
+ FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
WorkbookHelper( rHelper )
{
}
@@ -51,14 +53,14 @@ OoxWorkbookFragmentBase::OoxWorkbookFragmentBase(
OoxWorksheetFragmentBase::OoxWorksheetFragmentBase( const WorkbookHelper& rHelper,
const OUString& rFragmentPath, ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int32 nSheet ) :
- OoxFragmentHandler( rHelper.getOoxFilter(), rFragmentPath ),
+ FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
WorksheetHelperRoot( rHelper, xProgressBar, eSheetType, nSheet )
{
}
OoxWorksheetFragmentBase::OoxWorksheetFragmentBase(
const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
- OoxFragmentHandler( rHelper.getOoxFilter(), rFragmentPath ),
+ FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
WorksheetHelperRoot( rHelper )
{
}
@@ -110,8 +112,32 @@ BiffContextHandler::BiffContextHandler( const BiffHandlerBase& rParent ) :
// ============================================================================
-BiffFragmentHandler::BiffFragmentHandler( BiffInputStream& rStrm ) :
- BiffHandlerBase( rStrm )
+namespace prv {
+
+BiffFragmentStreamOwner::BiffFragmentStreamOwner( const FilterBase& rFilter, const OUString& rStrmName )
+{
+ // do not automatically close the root stream (indicated by empty stream name)
+ mxXInStrm.reset( new BinaryXInputStream( rFilter.openInputStream( rStrmName ), rStrmName.getLength() > 0 ) );
+ mxBiffStrm.reset( new BiffInputStream( *mxXInStrm ) );
+}
+
+BiffFragmentStreamOwner::~BiffFragmentStreamOwner()
+{
+}
+
+} // namespace prv
+
+// ----------------------------------------------------------------------------
+
+BiffFragmentHandler::BiffFragmentHandler( const FilterBase& rFilter, const OUString& rStrmName ) :
+ prv::BiffFragmentStreamOwner( rFilter, rStrmName ),
+ BiffHandlerBase( *mxBiffStrm )
+{
+}
+
+BiffFragmentHandler::BiffFragmentHandler( const BiffFragmentHandler& rHandler ) :
+ prv::BiffFragmentStreamOwner( rHandler ),
+ BiffHandlerBase( rHandler )
{
}
@@ -191,10 +217,12 @@ bool BiffFragmentHandler::skipFragment()
// ============================================================================
-BiffWorkbookFragmentBase::BiffWorkbookFragmentBase( const WorkbookHelper& rHelper, BiffInputStream& rStrm ) :
- BiffFragmentHandler( rStrm ),
+BiffWorkbookFragmentBase::BiffWorkbookFragmentBase( const WorkbookHelper& rHelper, const OUString& rStrmName, bool bCloneDecoder ) :
+ BiffFragmentHandler( rHelper.getBaseFilter(), rStrmName ),
WorkbookHelper( rHelper )
{
+ if( bCloneDecoder )
+ getCodecHelper().cloneDecoder( mrStrm );
}
// ============================================================================
@@ -206,12 +234,6 @@ BiffWorksheetFragmentBase::BiffWorksheetFragmentBase( const BiffWorkbookFragment
{
}
-BiffWorksheetFragmentBase::BiffWorksheetFragmentBase( const WorksheetHelper& rHelper, BiffInputStream& rStrm ) :
- BiffFragmentHandler( rStrm ),
- WorksheetHelperRoot( rHelper )
-{
-}
-
// ============================================================================
BiffSkipWorksheetFragment::BiffSkipWorksheetFragment(
diff --git a/oox/source/xls/externallinkbuffer.cxx b/oox/source/xls/externallinkbuffer.cxx
index f05d28ce799c..d46adb8f0c45 100644
--- a/oox/source/xls/externallinkbuffer.cxx
+++ b/oox/source/xls/externallinkbuffer.cxx
@@ -93,7 +93,7 @@ const sal_uInt16 BIFF_EXTNAME_ICONIFIED = 0x8000;
// ============================================================================
-OoxExternalNameData::OoxExternalNameData() :
+ExternalNameModel::ExternalNameModel() :
mbBuiltIn( false ),
mbNotify( false ),
mbPreferPic( false ),
@@ -115,20 +115,20 @@ ExternalName::ExternalName( const ExternalLink& rParentLink, sal_Int32 nLocalShe
void ExternalName::importDefinedName( const AttributeList& rAttribs )
{
- maOoxData.maName = rAttribs.getString( XML_name, OUString() );
- OSL_ENSURE( maOoxData.maName.getLength() > 0, "ExternalName::importDefinedName - empty name" );
+ maModel.maName = rAttribs.getString( XML_name, OUString() );
+ OSL_ENSURE( maModel.maName.getLength() > 0, "ExternalName::importDefinedName - empty name" );
// zero-based index into sheet list of externalBook
- maOoxData.mnSheet = rAttribs.getInteger( XML_sheetId, -1 );
+ maModel.mnSheet = rAttribs.getInteger( XML_sheetId, -1 );
}
void ExternalName::importDdeItem( const AttributeList& rAttribs )
{
- maOoxData.maName = rAttribs.getString( XML_name, OUString() );
- OSL_ENSURE( maOoxData.maName.getLength() > 0, "ExternalName::importDdeItem - empty name" );
- maOoxExtNameData.mbOleObj = false;
- maOoxExtNameData.mbStdDocName = rAttribs.getBool( XML_ole, false );
- maOoxExtNameData.mbNotify = rAttribs.getBool( XML_advise, false );
- maOoxExtNameData.mbPreferPic = rAttribs.getBool( XML_preferPic, false );
+ maModel.maName = rAttribs.getString( XML_name, OUString() );
+ OSL_ENSURE( maModel.maName.getLength() > 0, "ExternalName::importDdeItem - empty name" );
+ maExtNameModel.mbOleObj = false;
+ maExtNameModel.mbStdDocName = rAttribs.getBool( XML_ole, false );
+ maExtNameModel.mbNotify = rAttribs.getBool( XML_advise, false );
+ maExtNameModel.mbPreferPic = rAttribs.getBool( XML_preferPic, false );
}
void ExternalName::importValues( const AttributeList& rAttribs )
@@ -138,18 +138,18 @@ void ExternalName::importValues( const AttributeList& rAttribs )
void ExternalName::importOleItem( const AttributeList& rAttribs )
{
- maOoxData.maName = rAttribs.getString( XML_name, OUString() );
- OSL_ENSURE( maOoxData.maName.getLength() > 0, "ExternalName::importOleItem - empty name" );
- maOoxExtNameData.mbOleObj = true;
- maOoxExtNameData.mbNotify = rAttribs.getBool( XML_advise, false );
- maOoxExtNameData.mbPreferPic = rAttribs.getBool( XML_preferPic, false );
- maOoxExtNameData.mbIconified = rAttribs.getBool( XML_icon, false );
+ maModel.maName = rAttribs.getString( XML_name, OUString() );
+ OSL_ENSURE( maModel.maName.getLength() > 0, "ExternalName::importOleItem - empty name" );
+ maExtNameModel.mbOleObj = true;
+ maExtNameModel.mbNotify = rAttribs.getBool( XML_advise, false );
+ maExtNameModel.mbPreferPic = rAttribs.getBool( XML_preferPic, false );
+ maExtNameModel.mbIconified = rAttribs.getBool( XML_icon, false );
}
void ExternalName::importExternalName( RecordInputStream& rStrm )
{
- rStrm >> maOoxData.maName;
- OSL_ENSURE( maOoxData.maName.getLength() > 0, "ExternalName::importExternalName - empty name" );
+ rStrm >> maModel.maName;
+ OSL_ENSURE( maModel.maName.getLength() > 0, "ExternalName::importExternalName - empty name" );
}
void ExternalName::importExternalNameFlags( RecordInputStream& rStrm )
@@ -158,14 +158,14 @@ void ExternalName::importExternalNameFlags( RecordInputStream& rStrm )
sal_Int32 nSheetId;
rStrm >> nFlags >> nSheetId;
// index into sheet list of EXTSHEETNAMES (one-based in OOBIN)
- maOoxData.mnSheet = nSheetId - 1;
+ maModel.mnSheet = nSheetId - 1;
// no flag for built-in names, as in OOX...
- maOoxExtNameData.mbNotify = getFlag( nFlags, OOBIN_EXTNAME_AUTOMATIC );
- maOoxExtNameData.mbPreferPic = getFlag( nFlags, OOBIN_EXTNAME_PREFERPIC );
- maOoxExtNameData.mbStdDocName = getFlag( nFlags, OOBIN_EXTNAME_STDDOCNAME );
- maOoxExtNameData.mbOleObj = getFlag( nFlags, OOBIN_EXTNAME_OLEOBJECT );
- maOoxExtNameData.mbIconified = getFlag( nFlags, OOBIN_EXTNAME_ICONIFIED );
- OSL_ENSURE( (mrParentLink.getLinkType() == LINKTYPE_OLE) == maOoxExtNameData.mbOleObj,
+ maExtNameModel.mbNotify = getFlag( nFlags, OOBIN_EXTNAME_AUTOMATIC );
+ maExtNameModel.mbPreferPic = getFlag( nFlags, OOBIN_EXTNAME_PREFERPIC );
+ maExtNameModel.mbStdDocName = getFlag( nFlags, OOBIN_EXTNAME_STDDOCNAME );
+ maExtNameModel.mbOleObj = getFlag( nFlags, OOBIN_EXTNAME_OLEOBJECT );
+ maExtNameModel.mbIconified = getFlag( nFlags, OOBIN_EXTNAME_ICONIFIED );
+ OSL_ENSURE( (mrParentLink.getLinkType() == LINKTYPE_OLE) == maExtNameModel.mbOleObj,
"ExternalName::importExternalNameFlags - wrong OLE flag in external name" );
}
@@ -202,18 +202,18 @@ void ExternalName::importExternalName( BiffInputStream& rStrm )
if( getBiff() >= BIFF3 )
{
rStrm >> nFlags;
- maOoxExtNameData.mbBuiltIn = getFlag( nFlags, BIFF_EXTNAME_BUILTIN );
- maOoxExtNameData.mbNotify = getFlag( nFlags, BIFF_EXTNAME_AUTOMATIC );
- maOoxExtNameData.mbPreferPic = getFlag( nFlags, BIFF_EXTNAME_PREFERPIC );
+ maExtNameModel.mbBuiltIn = getFlag( nFlags, BIFF_EXTNAME_BUILTIN );
+ maExtNameModel.mbNotify = getFlag( nFlags, BIFF_EXTNAME_AUTOMATIC );
+ maExtNameModel.mbPreferPic = getFlag( nFlags, BIFF_EXTNAME_PREFERPIC );
// BIFF5-BIFF8: sheet index for sheet-local names, OLE settings
if( getBiff() >= BIFF5 )
{
- maOoxExtNameData.mbStdDocName = getFlag( nFlags, BIFF_EXTNAME_STDDOCNAME );
- maOoxExtNameData.mbOleObj = getFlag( nFlags, BIFF_EXTNAME_OLEOBJECT );
- maOoxExtNameData.mbIconified = getFlag( nFlags, BIFF_EXTNAME_ICONIFIED );
+ maExtNameModel.mbStdDocName = getFlag( nFlags, BIFF_EXTNAME_STDDOCNAME );
+ maExtNameModel.mbOleObj = getFlag( nFlags, BIFF_EXTNAME_OLEOBJECT );
+ maExtNameModel.mbIconified = getFlag( nFlags, BIFF_EXTNAME_ICONIFIED );
- if( maOoxExtNameData.mbOleObj )
+ if( maExtNameModel.mbOleObj )
{
rStrm >> mnStorageId;
}
@@ -229,22 +229,22 @@ void ExternalName::importExternalName( BiffInputStream& rStrm )
The value zero means this external name is a global name.
*/
rStrm.skip( 2 );
- maOoxData.mnSheet = rStrm.readuInt16();
+ maModel.mnSheet = rStrm.readuInt16();
}
}
}
- maOoxData.maName = (getBiff() == BIFF8) ?
+ maModel.maName = (getBiff() == BIFF8) ?
rStrm.readUniString( rStrm.readuInt8() ) :
rStrm.readByteString( false, getTextEncoding() );
- OSL_ENSURE( maOoxData.maName.getLength() > 0, "ExternalName::importExternalName - empty name" );
+ OSL_ENSURE( maModel.maName.getLength() > 0, "ExternalName::importExternalName - empty name" );
switch( mrParentLink.getLinkType() )
{
case LINKTYPE_INTERNAL:
case LINKTYPE_EXTERNAL:
// cell references that are stored in hidden external names (seen in BIFF3-BIFF4)
- if( (getBiff() <= BIFF4) && (maOoxData.maName.getLength() > 0) && (maOoxData.maName[ 0 ] == '\x01') && (rStrm.getRemaining() > 2) )
+ if( (getBiff() <= BIFF4) && (maModel.maName.getLength() > 0) && (maModel.maName[ 0 ] == '\x01') && (rStrm.getRemaining() > 2) )
{
TokensFormulaContext aContext( true, true );
importBiffFormula( aContext, rStrm );
@@ -308,8 +308,8 @@ sal_Int32 ExternalName::getSheetCacheIndex() const
{
case FILTER_OOX:
// OOXML/OOBIN: zero-based index into sheet list, -1 means global name
- if( maOoxData.mnSheet >= 0 )
- nCacheIdx = mrParentLink.getSheetIndex( maOoxData.mnSheet );
+ if( maModel.mnSheet >= 0 )
+ nCacheIdx = mrParentLink.getSheetIndex( maModel.mnSheet );
break;
case FILTER_BIFF:
switch( getBiff() )
@@ -319,14 +319,14 @@ sal_Int32 ExternalName::getSheetCacheIndex() const
case BIFF4:
break;
case BIFF5:
- if( maOoxData.mnSheet > 0 )
- if( const ExternalLink* pExtLink = getExternalLinks().getExternalLink( maOoxData.mnSheet ).get() )
+ if( maModel.mnSheet > 0 )
+ if( const ExternalLink* pExtLink = getExternalLinks().getExternalLink( maModel.mnSheet ).get() )
if( pExtLink->getLinkType() == LINKTYPE_EXTERNAL )
nCacheIdx = pExtLink->getSheetIndex();
break;
case BIFF8:
- if( maOoxData.mnSheet > 0 )
- nCacheIdx = mrParentLink.getSheetIndex( maOoxData.mnSheet - 1 );
+ if( maModel.mnSheet > 0 )
+ nCacheIdx = mrParentLink.getSheetIndex( maModel.mnSheet - 1 );
break;
case BIFF_UNKNOWN:
break;
@@ -340,9 +340,9 @@ sal_Int32 ExternalName::getSheetCacheIndex() const
bool ExternalName::getDdeItemInfo( DDEItemInfo& orItemInfo ) const
{
- if( (mrParentLink.getLinkType() == LINKTYPE_DDE) && (maOoxData.maName.getLength() > 0) )
+ if( (mrParentLink.getLinkType() == LINKTYPE_DDE) && (maModel.maName.getLength() > 0) )
{
- orItemInfo.Item = maOoxData.maName;
+ orItemInfo.Item = maModel.maName;
orItemInfo.Results = ContainerHelper::matrixToSequenceSequence( maResults );
return true;
}
@@ -351,13 +351,13 @@ bool ExternalName::getDdeItemInfo( DDEItemInfo& orItemInfo ) const
bool ExternalName::getDdeLinkData( OUString& orDdeServer, OUString& orDdeTopic, OUString& orDdeItem )
{
- if( (mrParentLink.getLinkType() == LINKTYPE_DDE) && (maOoxData.maName.getLength() > 0) )
+ if( (mrParentLink.getLinkType() == LINKTYPE_DDE) && (maModel.maName.getLength() > 0) )
{
// try to create a DDE link and to set the imported link results
if( !mbDdeLinkCreated ) try
{
Reference< XDDELinks > xDdeLinks( getDdeLinks(), UNO_QUERY_THROW );
- mxDdeLink = xDdeLinks->addDDELink( mrParentLink.getClassName(), mrParentLink.getTargetUrl(), maOoxData.maName, ::com::sun::star::sheet::DDELinkMode_DEFAULT );
+ mxDdeLink = xDdeLinks->addDDELink( mrParentLink.getClassName(), mrParentLink.getTargetUrl(), maModel.maName, ::com::sun::star::sheet::DDELinkMode_DEFAULT );
if( !maResults.empty() )
{
Reference< XDDELinkResults > xResults( mxDdeLink, UNO_QUERY_THROW );
@@ -566,7 +566,7 @@ void ExternalLink::importExternSheet( BiffInputStream& rStrm )
switch( meLinkType )
{
case LINKTYPE_INTERNAL:
- maIndexes.push_back( getWorksheets().getFinalSheetIndex( aSheetName ) );
+ maIndexes.push_back( getWorksheets().getCalcSheetIndex( aSheetName ) );
break;
case LINKTYPE_EXTERNAL:
insertExternalSheet( aSheetName );
@@ -667,8 +667,7 @@ sal_Int32 ExternalLink::getSheetIndex( sal_Int32 nTabId ) const
{
OSL_ENSURE( (nTabId == 0) || (getFilterType() == FILTER_OOX) || (getBiff() == BIFF8),
"ExternalLink::getSheetIndex - invalid sheet index" );
- return ((0 <= nTabId) && (static_cast< size_t >( nTabId ) < maIndexes.size())) ?
- maIndexes[ static_cast< size_t >( nTabId ) ] : -1;
+ return ContainerHelper::getVectorElement< sal_Int32 >( maIndexes, nTabId, -1 );
}
void ExternalLink::getSheetRange( LinkSheetRange& orSheetRange, sal_Int32 nTabId1, sal_Int32 nTabId2 ) const
@@ -727,11 +726,11 @@ void ExternalLink::getSheetRange( LinkSheetRange& orSheetRange, sal_Int32 nTabId
Reference< XExternalSheetCache > ExternalLink::getExternalSheetCache( sal_Int32 nTabId )
{
- if( mxDocLink.is() && (0 <= nTabId) && (static_cast< size_t >( nTabId ) < maIndexes.size()) ) try
+ const sal_Int32* pnCacheId = ContainerHelper::getVectorElement( maIndexes, nTabId );
+ if( mxDocLink.is() && pnCacheId ) try
{
- sal_Int32 nCacheId = maIndexes[ static_cast< size_t >( nTabId ) ];
// existing mxDocLink implies that this is an external link
- Reference< XExternalSheetCache > xSheetCache( mxDocLink->getByIndex( nCacheId ), UNO_QUERY_THROW );
+ Reference< XExternalSheetCache > xSheetCache( mxDocLink->getByIndex( *pnCacheId ), UNO_QUERY_THROW );
return xSheetCache;
}
catch( Exception& )
@@ -853,19 +852,19 @@ ExternalNameRef ExternalLink::createExternalName()
// ============================================================================
-OoxRefSheets::OoxRefSheets() :
+RefSheetsModel::RefSheetsModel() :
mnExtRefId( -1 ),
mnTabId1( -1 ),
mnTabId2( -1 )
{
}
-void OoxRefSheets::readOobData( RecordInputStream& rStrm )
+void RefSheetsModel::readOobData( RecordInputStream& rStrm )
{
rStrm >> mnExtRefId >> mnTabId1 >> mnTabId2;
}
-void OoxRefSheets::readBiff8Data( BiffInputStream& rStrm )
+void RefSheetsModel::readBiff8Data( BiffInputStream& rStrm )
{
mnExtRefId = rStrm.readuInt16();
mnTabId1 = rStrm.readInt16();
@@ -927,7 +926,7 @@ void ExternalLinkBuffer::importExternalSheets( RecordInputStream& rStrm )
maRefSheets.reserve( nMaxCount );
for( size_t nRefId = 0; !rStrm.isEof() && (nRefId < nMaxCount); ++nRefId )
{
- OoxRefSheets aRefSheets;
+ RefSheetsModel aRefSheets;
aRefSheets.readOobData( rStrm );
maRefSheets.push_back( aRefSheets );
}
@@ -964,7 +963,7 @@ void ExternalLinkBuffer::importExternSheet8( BiffInputStream& rStrm )
maRefSheets.reserve( nRefCount );
for( sal_uInt16 nRefId = 0; !rStrm.isEof() && (nRefId < nRefCount); ++nRefId )
{
- OoxRefSheets aRefSheets;
+ RefSheetsModel aRefSheets;
aRefSheets.readBiff8Data( rStrm );
maRefSheets.push_back( aRefSheets );
}
@@ -990,7 +989,7 @@ ExternalLinkRef ExternalLinkBuffer::getExternalLink( sal_Int32 nRefId ) const
if( !mbUseRefSheets )
xExtLink = maLinks.get( nRefId - 1 );
// OOBIN: zero-based index into ref-sheets list
- else if( const OoxRefSheets* pRefSheets = getRefSheets( nRefId ) )
+ else if( const RefSheetsModel* pRefSheets = getRefSheets( nRefId ) )
xExtLink = maLinks.get( pRefSheets->mnExtRefId );
break;
case FILTER_BIFF:
@@ -1018,7 +1017,7 @@ ExternalLinkRef ExternalLinkBuffer::getExternalLink( sal_Int32 nRefId ) const
break;
case BIFF8:
// zero-based index into REF list in EXTERNSHEET record
- if( const OoxRefSheets* pRefSheets = getRefSheets( nRefId ) )
+ if( const RefSheetsModel* pRefSheets = getRefSheets( nRefId ) )
xExtLink = maLinks.get( pRefSheets->mnExtRefId );
break;
case BIFF_UNKNOWN: break;
@@ -1043,7 +1042,7 @@ LinkSheetRange ExternalLinkBuffer::getSheetRange( sal_Int32 nRefId ) const
OSL_ENSURE( ((getFilterType() == FILTER_OOX) && mbUseRefSheets) || (getBiff() == BIFF8), "ExternalLinkBuffer::getSheetRange - wrong BIFF version" );
LinkSheetRange aSheetRange;
if( const ExternalLink* pExtLink = getExternalLink( nRefId ).get() )
- if( const OoxRefSheets* pRefSheets = getRefSheets( nRefId ) )
+ if( const RefSheetsModel* pRefSheets = getRefSheets( nRefId ) )
pExtLink->getSheetRange( aSheetRange, pRefSheets->mnTabId1, pRefSheets->mnTabId2 );
return aSheetRange;
}
@@ -1057,7 +1056,7 @@ ExternalLinkRef ExternalLinkBuffer::createExternalLink()
return xExtLink;
}
-const OoxRefSheets* ExternalLinkBuffer::getRefSheets( sal_Int32 nRefId ) const
+const RefSheetsModel* ExternalLinkBuffer::getRefSheets( sal_Int32 nRefId ) const
{
return ((0 <= nRefId) && (static_cast< size_t >( nRefId ) < maRefSheets.size())) ?
&maRefSheets[ static_cast< size_t >( nRefId ) ] : 0;
diff --git a/oox/source/xls/externallinkfragment.cxx b/oox/source/xls/externallinkfragment.cxx
index 3eff38fc8d85..d985ad5ecf8e 100644
--- a/oox/source/xls/externallinkfragment.cxx
+++ b/oox/source/xls/externallinkfragment.cxx
@@ -42,6 +42,7 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::table::CellAddress;
using ::com::sun::star::sheet::XExternalSheetCache;
+using ::oox::core::ContextHandlerRef;
using ::oox::core::RecordInfo;
using ::oox::core::Relation;
@@ -60,28 +61,21 @@ OoxExternalSheetDataContext::OoxExternalSheetDataContext(
// oox.core.ContextHandler2Helper interface -----------------------------------
-ContextWrapper OoxExternalSheetDataContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxExternalSheetDataContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
case XLS_TOKEN( sheetData ):
- return (nElement == XLS_TOKEN( row ));
+ if( nElement == XLS_TOKEN( row ) ) return this;
+ break;
case XLS_TOKEN( row ):
- return (nElement == XLS_TOKEN( cell ));
- case XLS_TOKEN( cell ):
- return (nElement == XLS_TOKEN( v ));
- }
- return false;
-}
-
-void OoxExternalSheetDataContext::onStartElement( const AttributeList& rAttribs )
-{
- switch( getCurrentElement() )
- {
+ if( nElement == XLS_TOKEN( cell ) ) { importCell( rAttribs ); return this; }
+ break;
case XLS_TOKEN( cell ):
- importCell( rAttribs );
+ if( nElement == XLS_TOKEN( v ) ) return this; // collect characters in onEndElement()
break;
}
+ return 0;
}
void OoxExternalSheetDataContext::onEndElement( const OUString& rChars )
@@ -107,33 +101,25 @@ void OoxExternalSheetDataContext::onEndElement( const OUString& rChars )
}
}
-ContextWrapper OoxExternalSheetDataContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& )
+ContextHandlerRef OoxExternalSheetDataContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
{
switch( getCurrentElement() )
{
case OOBIN_ID_EXTSHEETDATA:
- return (nRecId == OOBIN_ID_EXTROW);
+ if( nRecId == OOBIN_ID_EXTROW ) { maCurrPos.Row = rStrm.readInt32(); return this; }
+ break;
case OOBIN_ID_EXTROW:
- return (nRecId == OOBIN_ID_EXTCELL_BLANK) ||
- (nRecId == OOBIN_ID_EXTCELL_BOOL) ||
- (nRecId == OOBIN_ID_EXTCELL_DOUBLE) ||
- (nRecId == OOBIN_ID_EXTCELL_ERROR) ||
- (nRecId == OOBIN_ID_EXTCELL_STRING);
- }
- return false;
-}
-
-void OoxExternalSheetDataContext::onStartRecord( RecordInputStream& rStrm )
-{
- switch( getCurrentElement() )
- {
- case OOBIN_ID_EXTCELL_BLANK: importExtCellBlank( rStrm ); break;
- case OOBIN_ID_EXTCELL_BOOL: importExtCellBool( rStrm ); break;
- case OOBIN_ID_EXTCELL_DOUBLE: importExtCellDouble( rStrm ); break;
- case OOBIN_ID_EXTCELL_ERROR: importExtCellError( rStrm ); break;
- case OOBIN_ID_EXTCELL_STRING: importExtCellString( rStrm ); break;
- case OOBIN_ID_EXTROW: maCurrPos.Row = rStrm.readInt32(); break;
+ switch( nRecId )
+ {
+ case OOBIN_ID_EXTCELL_BLANK: importExtCellBlank( rStrm ); break;
+ case OOBIN_ID_EXTCELL_BOOL: importExtCellBool( rStrm ); break;
+ case OOBIN_ID_EXTCELL_DOUBLE: importExtCellDouble( rStrm ); break;
+ case OOBIN_ID_EXTCELL_ERROR: importExtCellError( rStrm ); break;
+ case OOBIN_ID_EXTCELL_STRING: importExtCellString( rStrm ); break;
+ }
+ break;
}
+ return 0;
}
// private --------------------------------------------------------------------
@@ -200,62 +186,81 @@ OoxExternalLinkFragment::OoxExternalLinkFragment( const WorkbookHelper& rHelper,
// oox.core.ContextHandler2Helper interface -----------------------------------
-ContextWrapper OoxExternalLinkFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+ContextHandlerRef OoxExternalLinkFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nElement == XLS_TOKEN( externalLink ));
+ if( nElement == XLS_TOKEN( externalLink ) ) return this;
+ break;
+
case XLS_TOKEN( externalLink ):
- return (nElement == XLS_TOKEN( externalBook )) ||
- (nElement == XLS_TOKEN( ddeLink )) ||
- (nElement == XLS_TOKEN( oleLink ));
+ switch( nElement )
+ {
+ case XLS_TOKEN( externalBook ): mrExtLink.importExternalBook( getRelations(), rAttribs ); return this;
+ case XLS_TOKEN( ddeLink ): mrExtLink.importDdeLink( rAttribs ); return this;
+ case XLS_TOKEN( oleLink ): mrExtLink.importOleLink( getRelations(), rAttribs ); return this;
+ }
+ break;
+
case XLS_TOKEN( externalBook ):
- return (nElement == XLS_TOKEN( sheetNames )) ||
- (nElement == XLS_TOKEN( definedNames )) ||
- (nElement == XLS_TOKEN( sheetDataSet ));
+ switch( nElement )
+ {
+ case XLS_TOKEN( sheetNames ):
+ case XLS_TOKEN( definedNames ):
+ case XLS_TOKEN( sheetDataSet ): return this;
+ }
+ break;
+
case XLS_TOKEN( sheetNames ):
- return (nElement == XLS_TOKEN( sheetName ));
+ if( nElement == XLS_TOKEN( sheetName ) ) mrExtLink.importSheetName( rAttribs );
+ break;
case XLS_TOKEN( definedNames ):
- return (nElement == XLS_TOKEN( definedName ));
+ if( nElement == XLS_TOKEN( definedName ) ) mrExtLink.importDefinedName( rAttribs );
+ break;
case XLS_TOKEN( sheetDataSet ):
if( (nElement == XLS_TOKEN( sheetData )) && (mrExtLink.getLinkType() == LINKTYPE_EXTERNAL) )
return createSheetDataContext( rAttribs.getInteger( XML_sheetId, -1 ) );
break;
+
case XLS_TOKEN( ddeLink ):
- return (nElement == XLS_TOKEN( ddeItems ));
+ if( nElement == XLS_TOKEN( ddeItems ) ) return this;
+ break;
case XLS_TOKEN( ddeItems ):
- return (nElement == XLS_TOKEN( ddeItem ));
+ if( nElement == XLS_TOKEN( ddeItem ) )
+ {
+ mxExtName = mrExtLink.importDdeItem( rAttribs );
+ return this;
+ }
+ break;
case XLS_TOKEN( ddeItem ):
- return (nElement == XLS_TOKEN( values ));
+ if( nElement == XLS_TOKEN( values ) )
+ {
+ if( mxExtName.get() ) mxExtName->importValues( rAttribs );
+ return this;
+ }
+ break;
case XLS_TOKEN( values ):
- return (nElement == XLS_TOKEN( value ));
+ if( nElement == XLS_TOKEN( value ) )
+ {
+ mnResultType = rAttribs.getToken( XML_t, XML_n );
+ return this;
+ }
+ break;
case XLS_TOKEN( value ):
- return (nElement == XLS_TOKEN( val ));
+ if( nElement == XLS_TOKEN( val ) ) return this; // collect value in onEndElement()
+ break;
+
case XLS_TOKEN( oleLink ):
- return (nElement == XLS_TOKEN( oleItems ));
+ if( nElement == XLS_TOKEN( oleItems ) ) return this;
+ break;
case XLS_TOKEN( oleItems ):
- return (nElement == XLS_TOKEN( oleItem ));
+ if( nElement == XLS_TOKEN( oleItem ) ) mxExtName = mrExtLink.importOleItem( rAttribs );
+ break;
}
return false;
}
-void OoxExternalLinkFragment::onStartElement( const AttributeList& rAttribs )
-{
- switch( getCurrentElement() )
- {
- case XLS_TOKEN( externalBook ): mrExtLink.importExternalBook( getRelations(), rAttribs ); break;
- case XLS_TOKEN( sheetName ): mrExtLink.importSheetName( rAttribs ); break;
- case XLS_TOKEN( definedName ): mrExtLink.importDefinedName( rAttribs ); break;
- case XLS_TOKEN( ddeLink ): mrExtLink.importDdeLink( rAttribs ); break;
- case XLS_TOKEN( ddeItem ): mxExtName = mrExtLink.importDdeItem( rAttribs ); break;
- case XLS_TOKEN( values ): if( mxExtName.get() ) mxExtName->importValues( rAttribs ); break;
- case XLS_TOKEN( value ): mnResultType = rAttribs.getToken( XML_t, XML_n ); break;
- case XLS_TOKEN( oleLink ): mrExtLink.importOleLink( getRelations(), rAttribs ); break;
- case XLS_TOKEN( oleItem ): mxExtName = mrExtLink.importOleItem( rAttribs ); break;
- }
-}
-
void OoxExternalLinkFragment::onEndElement( const OUString& rChars )
{
switch( getCurrentElement() )
@@ -285,46 +290,53 @@ void OoxExternalLinkFragment::onEndElement( const OUString& rChars )
}
}
-ContextWrapper OoxExternalLinkFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+ContextHandlerRef OoxExternalLinkFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nRecId == OOBIN_ID_EXTERNALBOOK);
+ if( nRecId == OOBIN_ID_EXTERNALBOOK )
+ {
+ mrExtLink.importExternalBook( getRelations(), rStrm );
+ return this;
+ }
+ break;
+
case OOBIN_ID_EXTERNALBOOK:
- if( (nRecId == OOBIN_ID_EXTSHEETDATA) && (mrExtLink.getLinkType() == LINKTYPE_EXTERNAL) )
- return createSheetDataContext( rStrm.readInt32() );
- return (nRecId == OOBIN_ID_EXTSHEETNAMES) ||
- (nRecId == OOBIN_ID_EXTERNALNAME);
+ switch( nRecId )
+ {
+ case OOBIN_ID_EXTSHEETDATA:
+ if( mrExtLink.getLinkType() == LINKTYPE_EXTERNAL )
+ return createSheetDataContext( rStrm.readInt32() );
+ break;
+
+ case OOBIN_ID_EXTSHEETNAMES: mrExtLink.importExtSheetNames( rStrm ); break;
+ case OOBIN_ID_EXTERNALNAME: mxExtName = mrExtLink.importExternalName( rStrm ); return this;
+ }
+ break;
+
case OOBIN_ID_EXTERNALNAME:
- return (nRecId == OOBIN_ID_EXTERNALNAMEFLAGS) ||
- (nRecId == OOBIN_ID_DDEITEMVALUES);
- case OOBIN_ID_DDEITEMVALUES:
- return (nRecId == OOBIN_ID_DDEITEM_BOOL) ||
- (nRecId == OOBIN_ID_DDEITEM_DOUBLE) ||
- (nRecId == OOBIN_ID_DDEITEM_ERROR) ||
- (nRecId == OOBIN_ID_DDEITEM_STRING);
- }
- return false;
-}
+ switch( nRecId )
+ {
+ case OOBIN_ID_EXTERNALNAMEFLAGS: if( mxExtName.get() ) mxExtName->importExternalNameFlags( rStrm ); break;
+ case OOBIN_ID_DDEITEMVALUES: if( mxExtName.get() ) mxExtName->importDdeItemValues( rStrm ); return this;
+ }
+ break;
-void OoxExternalLinkFragment::onStartRecord( RecordInputStream& rStrm )
-{
- switch( getCurrentElement() )
- {
- case OOBIN_ID_EXTERNALBOOK: mrExtLink.importExternalBook( getRelations(), rStrm ); break;
- case OOBIN_ID_EXTSHEETNAMES: mrExtLink.importExtSheetNames( rStrm ); break;
- case OOBIN_ID_EXTERNALNAME: mxExtName = mrExtLink.importExternalName( rStrm ); break;
- case OOBIN_ID_EXTERNALNAMEFLAGS: if( mxExtName.get() ) mxExtName->importExternalNameFlags( rStrm ); break;
- case OOBIN_ID_DDEITEMVALUES: if( mxExtName.get() ) mxExtName->importDdeItemValues( rStrm ); break;
- case OOBIN_ID_DDEITEM_BOOL: if( mxExtName.get() ) mxExtName->importDdeItemBool( rStrm ); break;
- case OOBIN_ID_DDEITEM_DOUBLE: if( mxExtName.get() ) mxExtName->importDdeItemDouble( rStrm ); break;
- case OOBIN_ID_DDEITEM_ERROR: if( mxExtName.get() ) mxExtName->importDdeItemError( rStrm ); break;
- case OOBIN_ID_DDEITEM_STRING: if( mxExtName.get() ) mxExtName->importDdeItemString( rStrm ); break;
+ case OOBIN_ID_DDEITEMVALUES:
+ switch( nRecId )
+ {
+ case OOBIN_ID_DDEITEM_BOOL: if( mxExtName.get() ) mxExtName->importDdeItemBool( rStrm ); break;
+ case OOBIN_ID_DDEITEM_DOUBLE: if( mxExtName.get() ) mxExtName->importDdeItemDouble( rStrm ); break;
+ case OOBIN_ID_DDEITEM_ERROR: if( mxExtName.get() ) mxExtName->importDdeItemError( rStrm ); break;
+ case OOBIN_ID_DDEITEM_STRING: if( mxExtName.get() ) mxExtName->importDdeItemString( rStrm ); break;
+ }
+ break;
}
+ return 0;
}
-ContextWrapper OoxExternalLinkFragment::createSheetDataContext( sal_Int32 nSheetId )
+ContextHandlerRef OoxExternalLinkFragment::createSheetDataContext( sal_Int32 nSheetId )
{
return new OoxExternalSheetDataContext( *this, mrExtLink.getExternalSheetCache( nSheetId ) );
}
diff --git a/oox/source/xls/formulabase.cxx b/oox/source/xls/formulabase.cxx
index 6696c211e61d..2c5fed66ce30 100644
--- a/oox/source/xls/formulabase.cxx
+++ b/oox/source/xls/formulabase.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/sheet/FormulaMapGroupSpecialOffset.hpp>
#include <com/sun/star/sheet/XFormulaOpCodeMapper.hpp>
#include <com/sun/star/sheet/XFormulaTokens.hpp>
+#include "properties.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/helper/recordinputstream.hxx"
#include "oox/core/filterbase.hxx"
@@ -1254,13 +1255,15 @@ void SimpleFormulaContext::setTokens( const ApiTokenSequence& rTokens )
namespace {
+const sal_Int32 nForbiddenFlags = COLUMN_DELETED | ROW_DELETED | SHEET_DELETED | COLUMN_RELATIVE | ROW_RELATIVE | SHEET_RELATIVE | RELATIVE_NAME;
+
bool lclConvertToCellAddress( CellAddress& orAddress, const SingleReference& rSingleRef, sal_Int32 nFilterBySheet )
{
orAddress = CellAddress( static_cast< sal_Int16 >( rSingleRef.Sheet ),
rSingleRef.Column, rSingleRef.Row );
return
((nFilterBySheet < 0) || (nFilterBySheet == rSingleRef.Sheet)) &&
- !getFlag( rSingleRef.Flags, COLUMN_DELETED | ROW_DELETED | SHEET_DELETED );
+ !getFlag( rSingleRef.Flags, nForbiddenFlags );
}
bool lclConvertToCellRange( CellRangeAddress& orRange, const ComplexReference& rComplexRef, sal_Int32 nFilterBySheet )
@@ -1271,8 +1274,8 @@ bool lclConvertToCellRange( CellRangeAddress& orRange, const ComplexReference& r
return
(rComplexRef.Reference1.Sheet == rComplexRef.Reference2.Sheet) &&
((nFilterBySheet < 0) || (nFilterBySheet == rComplexRef.Reference1.Sheet)) &&
- !getFlag( rComplexRef.Reference1.Flags, COLUMN_DELETED | ROW_DELETED | SHEET_DELETED ) &&
- !getFlag( rComplexRef.Reference2.Flags, COLUMN_DELETED | ROW_DELETED | SHEET_DELETED );
+ !getFlag( rComplexRef.Reference1.Flags, nForbiddenFlags ) &&
+ !getFlag( rComplexRef.Reference2.Flags, nForbiddenFlags );
}
enum TokenToRangeListState { STATE_REF, STATE_SEP, STATE_OPEN, STATE_CLOSE, STATE_ERROR };
@@ -1283,7 +1286,7 @@ TokenToRangeListState lclProcessRef( ApiCellRangeList& orRanges, const Any& rDat
if( rData >>= aSingleRef )
{
CellAddress aAddress;
- // ignore invalid addresses (with #REF! errors), but to not stop parsing
+ // ignore invalid addresses (with #REF! errors), but do not stop parsing
if( lclConvertToCellAddress( aAddress, aSingleRef, nFilterBySheet ) )
orRanges.push_back( CellRangeAddress( aAddress.Sheet, aAddress.Column, aAddress.Row, aAddress.Column, aAddress.Row ) );
return STATE_REF;
@@ -1292,7 +1295,7 @@ TokenToRangeListState lclProcessRef( ApiCellRangeList& orRanges, const Any& rDat
if( rData >>= aComplexRef )
{
CellRangeAddress aRange;
- // ignore invalid ranges (with #REF! errors), but to not stop parsing
+ // ignore invalid ranges (with #REF! errors), but do not stop parsing
if( lclConvertToCellRange( aRange, aComplexRef, nFilterBySheet ) )
orRanges.push_back( aRange );
return STATE_REF;
@@ -1317,8 +1320,7 @@ TokenToRangeListState lclProcessClose( sal_Int32& ornParenLevel )
// ----------------------------------------------------------------------------
FormulaProcessorBase::FormulaProcessorBase( const WorkbookHelper& rHelper ) :
- OpCodeProvider( rHelper ),
- maAbsNameProp( CREATE_OUSTRING( "AbsoluteName" ) )
+ OpCodeProvider( rHelper )
{
}
@@ -1379,9 +1381,8 @@ OUString FormulaProcessorBase::generateApiAddressString( const CellAddress& rAdd
OUString aCellName;
try
{
- Reference< XCellRange > xSheet( getSheet( rAddress.Sheet ), UNO_QUERY_THROW );
- PropertySet aCellProp( xSheet->getCellByPosition( rAddress.Column, rAddress.Row ) );
- aCellProp.getProperty( aCellName, maAbsNameProp );
+ PropertySet aCellProp( getCellFromDoc( rAddress ) );
+ aCellProp.getProperty( aCellName, PROP_AbsoluteName );
}
catch( Exception& )
{
@@ -1395,9 +1396,8 @@ OUString FormulaProcessorBase::generateApiRangeString( const CellRangeAddress& r
OUString aRangeName;
try
{
- Reference< XCellRange > xSheet( getSheet( rRange.Sheet ), UNO_QUERY_THROW );
- PropertySet aRangeProp( xSheet->getCellRangeByPosition( rRange.StartColumn, rRange.StartRow, rRange.EndColumn, rRange.EndRow ) );
- aRangeProp.getProperty( aRangeName, maAbsNameProp );
+ PropertySet aRangeProp( getCellRangeFromDoc( rRange ) );
+ aRangeProp.getProperty( aRangeName, PROP_AbsoluteName );
}
catch( Exception& )
{
@@ -1472,6 +1472,18 @@ Any FormulaProcessorBase::extractReference( const ApiTokenSequence& rTokens ) co
return Any();
}
+bool FormulaProcessorBase::extractAbsoluteRange( CellRangeAddress& orRange, const ApiTokenSequence& rTokens ) const
+{
+ ApiCellRangeList aRanges;
+ lclProcessRef( aRanges, extractReference( rTokens ), -1 );
+ if( !aRanges.empty() )
+ {
+ orRange = aRanges.front();
+ return true;
+ }
+ return false;
+}
+
void FormulaProcessorBase::extractCellRangeList( ApiCellRangeList& orRanges,
const ApiTokenSequence& rTokens, sal_Int32 nFilterBySheet ) const
{
diff --git a/oox/source/xls/formulaparser.cxx b/oox/source/xls/formulaparser.cxx
index 161802b6c63c..7657dff34449 100644
--- a/oox/source/xls/formulaparser.cxx
+++ b/oox/source/xls/formulaparser.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/sheet/ReferenceFlags.hpp>
#include <com/sun/star/sheet/SingleReference.hpp>
#include <com/sun/star/sheet/XFormulaParser.hpp>
+#include "properties.hxx"
#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/helper/recordinputstream.hxx"
@@ -655,17 +656,17 @@ bool FormulaParserImpl::pushEmbeddedRefOperand( const DefinedNameBase& rName, bo
Any aRefAny = rName.getReference( mpContext->getBaseAddress() );
if( aRefAny.hasValue() )
return pushAnyOperand( aRefAny, OPCODE_PUSH );
- if( bPushBadToken && (rName.getOoxName().getLength() > 0) && (rName.getOoxName()[ 0 ] >= ' ') )
- return pushValueOperand( rName.getOoxName(), OPCODE_BAD );
+ if( bPushBadToken && (rName.getModelName().getLength() > 0) && (rName.getModelName()[ 0 ] >= ' ') )
+ return pushValueOperand( rName.getModelName(), OPCODE_BAD );
return pushBiffErrorOperand( BIFF_ERR_NAME );
}
bool FormulaParserImpl::pushDefinedNameOperand( const DefinedNameRef& rxDefName )
{
- if( !rxDefName || (rxDefName->getOoxName().getLength() == 0) )
+ if( !rxDefName || (rxDefName->getModelName().getLength() == 0) )
return pushBiffErrorOperand( BIFF_ERR_NAME );
if( rxDefName->isMacroFunction() )
- return pushValueOperand( rxDefName->getOoxName(), OPCODE_MACRO );
+ return pushValueOperand( rxDefName->getModelName(), OPCODE_MACRO );
if( rxDefName->getTokenIndex() >= 0 )
return pushValueOperand( rxDefName->getTokenIndex(), OPCODE_NAME );
return pushEmbeddedRefOperand( *rxDefName, true );
@@ -698,12 +699,12 @@ bool FormulaParserImpl::pushExternalNameOperand( const ExternalNameRef& rxExtNam
case LINKTYPE_ANALYSIS:
// TODO: need support for localized addin function names
- if( const FunctionInfo* pFuncInfo = getFuncInfoFromOoxFuncName( rxExtName->getUpcaseOoxName() ) )
+ if( const FunctionInfo* pFuncInfo = getFuncInfoFromOoxFuncName( rxExtName->getUpcaseModelName() ) )
return pushExternalFuncOperand( *pFuncInfo );
break;
case LINKTYPE_LIBRARY:
- if( const FunctionInfo* pFuncInfo = getFuncInfoFromOoxFuncName( rxExtName->getUpcaseOoxName() ) )
+ if( const FunctionInfo* pFuncInfo = getFuncInfoFromOoxFuncName( rxExtName->getUpcaseModelName() ) )
if( (pFuncInfo->meFuncLibType != FUNCLIB_UNKNOWN) && (pFuncInfo->meFuncLibType == rExtLink.getFuncLibraryType()) )
return pushExternalFuncOperand( *pFuncInfo );
break;
@@ -1111,7 +1112,7 @@ const FunctionInfo* FormulaParserImpl::convertExternCallParam( ApiToken& orFuncT
if( const DefinedName* pDefName = getDefinedNames().getByTokenIndex( nTokenIndex ).get() )
{
orFuncToken.OpCode = OPCODE_BAD;
- orFuncToken.Data <<= pDefName->getDocName();
+ orFuncToken.Data <<= pDefName->getCalcName();
}
}
}
@@ -1248,7 +1249,6 @@ private:
private:
Reference< XFormulaParser > mxParser;
PropertySet maParserProps;
- const OUString maRefPosProp;
sal_Int64 mnAddDataPos; /// Current stream position for additional data (tExp, tArray, tMemArea).
bool mbNeedExtRefs; /// True = parser needs initialization of external reference info.
};
@@ -1257,7 +1257,6 @@ private:
OoxFormulaParserImpl::OoxFormulaParserImpl( const OpCodeProvider& rOpCodeProv ) :
FormulaParserImpl( rOpCodeProv ),
- maRefPosProp( CREATE_OUSTRING( "ReferencePosition" ) ),
mnAddDataPos( 0 ),
mbNeedExtRefs( true )
{
@@ -1271,10 +1270,10 @@ OoxFormulaParserImpl::OoxFormulaParserImpl( const OpCodeProvider& rOpCodeProv )
}
OSL_ENSURE( mxParser.is(), "OoxFormulaParserImpl::OoxFormulaParserImpl - cannot create formula parser" );
maParserProps.set( mxParser );
- maParserProps.setProperty( CREATE_OUSTRING( "CompileEnglish" ), true );
- maParserProps.setProperty( CREATE_OUSTRING( "FormulaConvention" ), ::com::sun::star::sheet::AddressConvention::XL_OOX );
- maParserProps.setProperty( CREATE_OUSTRING( "IgnoreLeadingSpaces" ), false );
- maParserProps.setProperty( CREATE_OUSTRING( "OpCodeMap" ), getOoxParserMap() );
+ maParserProps.setProperty( PROP_CompileEnglish, true );
+ maParserProps.setProperty( PROP_FormulaConvention, ::com::sun::star::sheet::AddressConvention::XL_OOX );
+ maParserProps.setProperty( PROP_IgnoreLeadingSpaces, false );
+ maParserProps.setProperty( PROP_OpCodeMap, getOoxParserMap() );
}
void OoxFormulaParserImpl::importOoxFormula(
@@ -1284,10 +1283,10 @@ void OoxFormulaParserImpl::importOoxFormula(
{
if( mbNeedExtRefs )
{
- maParserProps.setProperty( CREATE_OUSTRING( "ExternalLinks" ), getExternalLinks().getLinkInfos() );
+ maParserProps.setProperty( PROP_ExternalLinks, getExternalLinks().getLinkInfos() );
mbNeedExtRefs = false;
}
- maParserProps.setProperty( maRefPosProp, rContext.getBaseAddress() );
+ maParserProps.setProperty( PROP_ReferencePosition, rContext.getBaseAddress() );
initializeImport( rContext );
finalizeImport( mxParser->parseFormula( rFormulaString ) );
}
@@ -2730,16 +2729,19 @@ FormulaParser::~FormulaParser()
void FormulaParser::importFormula( FormulaContext& rContext, const OUString& rFormulaString ) const
{
+ OOX_LOADSAVE_TIMER( IMPORTFORMULA );
mxImpl->importOoxFormula( rContext, rFormulaString );
}
void FormulaParser::importFormula( FormulaContext& rContext, RecordInputStream& rStrm ) const
{
+ OOX_LOADSAVE_TIMER( IMPORTFORMULA );
mxImpl->importOobFormula( rContext, rStrm );
}
void FormulaParser::importFormula( FormulaContext& rContext, BiffInputStream& rStrm, const sal_uInt16* pnFmlaSize ) const
{
+ OOX_LOADSAVE_TIMER( IMPORTFORMULA );
mxImpl->importBiffFormula( rContext, rStrm, pnFmlaSize );
}
diff --git a/oox/source/xls/headerfooterparser.cxx b/oox/source/xls/headerfooterparser.cxx
deleted file mode 100644
index 9a0fd993d2d1..000000000000
--- a/oox/source/xls/headerfooterparser.cxx
+++ /dev/null
@@ -1,638 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: headerfooterparser.cxx,v $
- * $Revision: 1.4 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "oox/xls/headerfooterparser.hxx"
-#include <vector>
-#include <set>
-#include <rtl/ustrbuf.hxx>
-#include <rtl/strbuf.hxx>
-#include <com/sun/star/awt/FontStrikeout.hpp>
-#include <com/sun/star/awt/FontSlant.hpp>
-#include <com/sun/star/awt/FontUnderline.hpp>
-#include <com/sun/star/awt/FontWeight.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/sheet/XHeaderFooterContent.hpp>
-#include <com/sun/star/text/XText.hpp>
-#include <com/sun/star/text/XTextCursor.hpp>
-#include <com/sun/star/text/XTextContent.hpp>
-#include <com/sun/star/text/FilenameDisplayFormat.hpp>
-#include "oox/helper/attributelist.hxx"
-#include "oox/helper/propertyset.hxx"
-#include "oox/xls/stylesbuffer.hxx"
-#include "oox/xls/themebuffer.hxx"
-
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-using ::rtl::OString;
-using ::rtl::OStringBuffer;
-using ::rtl::OUStringToOString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::lang::XMultiServiceFactory;
-using ::com::sun::star::sheet::XHeaderFooterContent;
-using ::com::sun::star::text::XText;
-using ::com::sun::star::text::XTextCursor;
-using ::com::sun::star::text::XTextContent;
-using ::com::sun::star::text::XTextRange;
-
-namespace oox {
-namespace xls {
-
-// ============================================================================
-
-enum HFPortionId
-{
- HF_LEFT,
- HF_CENTER,
- HF_RIGHT,
- HF_COUNT
-};
-
-// ----------------------------------------------------------------------------
-
-struct HFPortionInfo
-{
- Reference< XText > mxText; /// XText interface of this portion.
- Reference< XTextCursor > mxStart; /// Start position of current text range for formatting.
- Reference< XTextCursor > mxEnd; /// End position of current text range for formatting.
- double mfTotalHeight; /// Sum of heights of previous lines in points.
- double mfCurrHeight; /// Height of the current text line in points.
-
- bool initialize( const Reference< XText >& rxText );
-};
-
-bool HFPortionInfo::initialize( const Reference< XText >& rxText )
-{
- mfTotalHeight = mfCurrHeight = 0.0;
- mxText = rxText;
- if( mxText.is() )
- {
- mxStart = mxText->createTextCursor();
- mxEnd = mxText->createTextCursor();
- }
- bool bRet = mxText.is() && mxStart.is() && mxEnd.is();
- OSL_ENSURE( bRet, "HFPortionInfo::initialize - missing interfaces" );
- return bRet;
-}
-
-// ----------------------------------------------------------------------------
-
-class HeaderFooterParserImpl : public WorkbookHelper
-{
-public:
- explicit HeaderFooterParserImpl( const WorkbookHelper& rHelper );
-
- /** Parses the passed string and creates the header/footer contents. */
- void parse(
- const Reference< XHeaderFooterContent >& rxContext,
- const OUString& rData );
-
- /** Returns the total height of the converted header or footer in points. */
- double getTotalHeight() const;
-
-private:
- /** Returns the current edit engine text object. */
- inline HFPortionInfo& getPortion() { return maPortions[ meCurrPortion ]; }
- /** Returns the start cursor of the current text range. */
- inline const Reference< XTextCursor >& getStartPos() { return getPortion().mxStart; }
- /** Returns the end cursor of the current text range. */
- inline const Reference< XTextCursor >& getEndPos() { return getPortion().mxEnd; }
-
- /** Returns the current line height of the specified portion. */
- double getCurrHeight( HFPortionId ePortion ) const;
- /** Returns the current line height. */
- double getCurrHeight() const;
-
- /** Updates the current line height of the specified portion, using the current font size. */
- void updateCurrHeight( HFPortionId ePortion );
- /** Updates the current line height, using the current font size. */
- void updateCurrHeight();
-
- /** Sets the font attributes at the current selection. */
- void setAttributes();
- /** Appends and clears internal string buffer. */
- void appendText();
- /** Appends a line break and adjusts internal text height data. */
- void appendLineBreak();
-
- /** Creates a text field from the passed service name. */
- Reference< XTextContent > createField( const OUString& rServiceName ) const;
- /** Appends the passed text field. */
- void appendField( const Reference< XTextContent >& rxContent );
-
- /** Sets the passed font name if it is valid. */
- void convertFontName( const OUString& rStyle );
- /** Converts a font style given as string. */
- void convertFontStyle( const OUString& rStyle );
- /** Converts a font color given as string. */
- void convertFontColor( const OUString& rColor );
-
- /** Finalizes current portion: sets font attributes and updates text height data. */
- void finalizePortion();
- /** Changes current header/footer portion. */
- void setNewPortion( HFPortionId ePortion );
-
-private:
- typedef ::std::vector< HFPortionInfo > HFPortionInfoVec;
- typedef ::std::set< OString > OStringSet;
-
- OUString maPageNumberService;
- OUString maPageCountService;
- OUString maSheetNameService;
- OUString maFileNameService;
- OUString maDateTimeService;
- OUString maIsDateProp;
- OUString maFileFormatProp;
- OStringSet maBoldNames; /// All names for bold font style in lowercase UTF-8.
- OStringSet maItalicNames; /// All names for italic font style in lowercase UTF-8.
- HFPortionInfoVec maPortions;
- HFPortionId meCurrPortion; /// Identifier of current H/F portion.
- OUStringBuffer maBuffer; /// Text data to append to current text range.
- OoxFontData maFontData; /// Font attributes of current text range.
-};
-
-
-HeaderFooterParserImpl::HeaderFooterParserImpl( const WorkbookHelper& rHelper ) :
- WorkbookHelper( rHelper ),
- maPageNumberService( CREATE_OUSTRING( "com.sun.star.text.TextField.PageNumber" ) ),
- maPageCountService( CREATE_OUSTRING( "com.sun.star.text.TextField.PageCount" ) ),
- maSheetNameService( CREATE_OUSTRING( "com.sun.star.text.TextField.SheetName" ) ),
- maFileNameService( CREATE_OUSTRING( "com.sun.star.text.TextField.FileName" ) ),
- maDateTimeService( CREATE_OUSTRING( "com.sun.star.text.TextField.DateTime" ) ),
- maIsDateProp( CREATE_OUSTRING( "IsDate" ) ),
- maFileFormatProp( CREATE_OUSTRING( "FileFormat" ) ),
- maPortions( static_cast< size_t >( HF_COUNT ) ),
- meCurrPortion( HF_CENTER )
-{
- // different names for bold font style (lowercase)
- maBoldNames.insert( CREATE_OSTRING( "bold" ) );
- maBoldNames.insert( CREATE_OSTRING( "fett" ) );
- maBoldNames.insert( CREATE_OSTRING( "demibold" ) );
- maBoldNames.insert( CREATE_OSTRING( "halbfett" ) );
- maBoldNames.insert( CREATE_OSTRING( "black" ) );
- maBoldNames.insert( CREATE_OSTRING( "heavy" ) );
-
- // different names for italic font style (lowercase)
- maItalicNames.insert( CREATE_OSTRING( "italic" ) );
- maItalicNames.insert( CREATE_OSTRING( "kursiv" ) );
- maItalicNames.insert( CREATE_OSTRING( "oblique" ) );
- maItalicNames.insert( CREATE_OSTRING( "schr\303\204g" ) ); // with uppercase A umlaut
- maItalicNames.insert( CREATE_OSTRING( "schr\303\244g" ) ); // with lowercase A umlaut
-}
-
-void HeaderFooterParserImpl::parse( const Reference< XHeaderFooterContent >& rxContext, const OUString& rData )
-{
- if( !rxContext.is() || (rData.getLength() == 0) ||
- !maPortions[ HF_LEFT ].initialize( rxContext->getLeftText() ) ||
- !maPortions[ HF_CENTER ].initialize( rxContext->getCenterText() ) ||
- !maPortions[ HF_RIGHT ].initialize( rxContext->getRightText() ) )
- return;
-
- meCurrPortion = HF_CENTER;
- maBuffer.setLength( 0 );
- maFontData = getStyles().getDefaultFontData();
- OUStringBuffer aFontName; // current font name
- OUStringBuffer aFontStyle; // current font style
- sal_Int32 nFontHeight = 0; // current font height
-
- /** State of the parser. */
- enum
- {
- STATE_TEXT, /// Literal text data.
- STATE_TOKEN, /// Control token following a '&' character.
- STATE_FONTNAME, /// Font name ('&' is followed by '"', reads until next '"' or ',').
- STATE_FONTSTYLE, /// Font style name (font part after ',', reads until next '"').
- STATE_FONTHEIGHT /// Font height ('&' is followed by num. digits, reads until non-digit).
- }
- eState = STATE_TEXT;
-
- const sal_Unicode* pcChar = rData.getStr();
- const sal_Unicode* pcEnd = pcChar + rData.getLength();
- for( ; (pcChar != pcEnd) && (*pcChar != 0); ++pcChar )
- {
- sal_Unicode cChar = *pcChar;
- switch( eState )
- {
- case STATE_TEXT:
- {
- switch( cChar )
- {
- case '&': // new token
- appendText();
- eState = STATE_TOKEN;
- break;
- case '\n': // line break
- appendText();
- appendLineBreak();
- break;
- default:
- maBuffer.append( cChar );
- }
- }
- break;
-
- case STATE_TOKEN:
- {
- // default: back to text mode, may be changed in specific cases
- eState = STATE_TEXT;
- // ignore case of token codes
- if( ('a' <= cChar) && (cChar <= 'z') )
- (cChar -= 'a') += 'A';
- switch( cChar )
- {
- case '&': maBuffer.append( cChar ); break; // the '&' character
-
- case 'L': setNewPortion( HF_LEFT ); break; // left portion
- case 'C': setNewPortion( HF_CENTER ); break; // center portion
- case 'R': setNewPortion( HF_RIGHT ); break; // right portion
-
- case 'P': // page number
- appendField( createField( maPageNumberService ) );
- break;
- case 'N': // total page count
- appendField( createField( maPageCountService ) );
- break;
- case 'A': // current sheet name
- appendField( createField( maSheetNameService ) );
- break;
-
- case 'F': // file name
- {
- Reference< XTextContent > xContent = createField( maFileNameService );
- PropertySet aPropSet( xContent );
- aPropSet.setProperty( maFileFormatProp, ::com::sun::star::text::FilenameDisplayFormat::NAME_AND_EXT );
- appendField( xContent );
- }
- break;
- case 'Z': // file path (without file name), BIFF8 and OOX only
- if( (getFilterType() == FILTER_OOX) || ((getFilterType() == FILTER_BIFF) && (getBiff() == BIFF8)) )
- {
- Reference< XTextContent > xContent = createField( maFileNameService );
- PropertySet aPropSet( xContent );
- // FilenameDisplayFormat::PATH not supported by Calc
- aPropSet.setProperty( maFileFormatProp, ::com::sun::star::text::FilenameDisplayFormat::FULL );
- appendField( xContent );
- /* path only is not supported -- if we find a '&Z&F'
- combination for path/name, skip the '&F' part */
- if( (pcChar + 2 < pcEnd) && (pcChar[ 1 ] == '&') && ((pcChar[ 2 ] == 'f') || (pcChar[ 2 ] == 'F')) )
- pcChar += 2;
- }
- break;
- case 'D': // date
- {
- Reference< XTextContent > xContent = createField( maDateTimeService );
- PropertySet aPropSet( xContent );
- aPropSet.setProperty( maIsDateProp, true );
- appendField( xContent );
- }
- break;
- case 'T': // time
- {
- Reference< XTextContent > xContent = createField( maDateTimeService );
- PropertySet aPropSet( xContent );
- aPropSet.setProperty( maIsDateProp, false );
- appendField( xContent );
- }
- break;
-
- case 'B': // bold
- setAttributes();
- maFontData.mbBold = !maFontData.mbBold;
- break;
- case 'I': // italic
- setAttributes();
- maFontData.mbItalic = !maFontData.mbItalic;
- break;
- case 'U': // underline
- setAttributes();
- maFontData.mnUnderline = (maFontData.mnUnderline == XML_single) ? XML_none : XML_single;
- break;
- case 'E': // double underline
- setAttributes();
- maFontData.mnUnderline = (maFontData.mnUnderline == XML_double) ? XML_none : XML_double;
- break;
- case 'S': // strikeout
- setAttributes();
- maFontData.mbStrikeout = !maFontData.mbStrikeout;
- break;
- case 'X': // superscript
- setAttributes();
- maFontData.mnEscapement = (maFontData.mnEscapement == XML_superscript) ? XML_baseline : XML_superscript;
- break;
- case 'Y': // subsrcipt
- setAttributes();
- maFontData.mnEscapement = (maFontData.mnEscapement == XML_subscript) ? XML_baseline : XML_subscript;
- break;
- case 'O': // outlined
- setAttributes();
- maFontData.mbOutline = !maFontData.mbOutline;
- break;
- case 'H': // shadow
- setAttributes();
- maFontData.mbShadow = !maFontData.mbShadow;
- break;
-
- case 'K': // text color (not in BIFF)
- if( (getFilterType() == FILTER_OOX) && (pcChar + 6 < pcEnd) )
- {
- setAttributes();
- // eat the following 6 characters
- convertFontColor( OUString( pcChar + 1, 6 ) );
- pcChar += 6;
- }
- break;
-
- case '\"': // font name
- aFontName.setLength( 0 );
- aFontStyle.setLength( 0 );
- eState = STATE_FONTNAME;
- break;
- default:
- if( ('0' <= cChar) && (cChar <= '9') ) // font size
- {
- nFontHeight = cChar - '0';
- eState = STATE_FONTHEIGHT;
- }
- }
- }
- break;
-
- case STATE_FONTNAME:
- {
- switch( cChar )
- {
- case '\"':
- setAttributes();
- convertFontName( aFontName.makeStringAndClear() );
- eState = STATE_TEXT;
- break;
- case ',':
- eState = STATE_FONTSTYLE;
- break;
- default:
- aFontName.append( cChar );
- }
- }
- break;
-
- case STATE_FONTSTYLE:
- {
- switch( cChar )
- {
- case '\"':
- setAttributes();
- convertFontName( aFontName.makeStringAndClear() );
- convertFontStyle( aFontStyle.makeStringAndClear() );
- eState = STATE_TEXT;
- break;
- default:
- aFontStyle.append( cChar );
- }
- }
- break;
-
- case STATE_FONTHEIGHT:
- {
- if( ('0' <= cChar) && (cChar <= '9') )
- {
- if( nFontHeight >= 0 )
- {
- nFontHeight *= 10;
- nFontHeight += (cChar - '0');
- if( nFontHeight > 1000 )
- nFontHeight = -1;
- }
- }
- else
- {
- if( nFontHeight > 0 )
- {
- setAttributes();
- maFontData.mfHeight = nFontHeight;
- }
- --pcChar;
- eState = STATE_TEXT;
- }
- }
- break;
- }
- }
-
- // finalize
- finalizePortion();
- maPortions[ HF_LEFT ].mfTotalHeight += getCurrHeight( HF_LEFT );
- maPortions[ HF_CENTER ].mfTotalHeight += getCurrHeight( HF_CENTER );
- maPortions[ HF_RIGHT ].mfTotalHeight += getCurrHeight( HF_RIGHT );
-}
-
-double HeaderFooterParserImpl::getTotalHeight() const
-{
- return ::std::max( maPortions[ HF_LEFT ].mfTotalHeight,
- ::std::max( maPortions[ HF_CENTER ].mfTotalHeight, maPortions[ HF_RIGHT ].mfTotalHeight ) );
-}
-
-// private --------------------------------------------------------------------
-
-double HeaderFooterParserImpl::getCurrHeight( HFPortionId ePortion ) const
-{
- double fMaxHt = maPortions[ ePortion ].mfCurrHeight;
- return (fMaxHt == 0.0) ? maFontData.mfHeight : fMaxHt;
-}
-
-double HeaderFooterParserImpl::getCurrHeight() const
-{
- return getCurrHeight( meCurrPortion );
-}
-
-void HeaderFooterParserImpl::updateCurrHeight( HFPortionId ePortion )
-{
- double& rfMaxHt = maPortions[ ePortion ].mfCurrHeight;
- rfMaxHt = ::std::max( rfMaxHt, maFontData.mfHeight );
-}
-
-void HeaderFooterParserImpl::updateCurrHeight()
-{
- updateCurrHeight( meCurrPortion );
-}
-
-void HeaderFooterParserImpl::setAttributes()
-{
- Reference< XTextRange > xRange( getStartPos(), UNO_QUERY );
- getEndPos()->gotoRange( xRange, sal_False );
- getEndPos()->gotoEnd( sal_True );
- if( !getEndPos()->isCollapsed() )
- {
- Font aFont( *this, maFontData );
- aFont.finalizeImport();
- PropertySet aPropSet( getEndPos() );
- aFont.writeToPropertySet( aPropSet, FONT_PROPTYPE_RICHTEXT );
- getStartPos()->gotoEnd( sal_False );
- getEndPos()->gotoEnd( sal_False );
- }
-}
-
-void HeaderFooterParserImpl::appendText()
-{
- if( maBuffer.getLength() > 0 )
- {
- getEndPos()->gotoEnd( sal_False );
- getEndPos()->setString( maBuffer.makeStringAndClear() );
- updateCurrHeight();
- }
-}
-
-void HeaderFooterParserImpl::appendLineBreak()
-{
- getEndPos()->gotoEnd( sal_False );
- getEndPos()->setString( OUString( sal_Unicode( '\n' ) ) );
- getPortion().mfTotalHeight += getCurrHeight();
- getPortion().mfCurrHeight = 0;
-}
-
-Reference< XTextContent > HeaderFooterParserImpl::createField( const OUString& rServiceName ) const
-{
- Reference< XTextContent > xContent;
- try
- {
- Reference< XMultiServiceFactory > xFactory( getDocument(), UNO_QUERY_THROW );
- xContent.set( xFactory->createInstance( rServiceName ), UNO_QUERY_THROW );
- }
- catch( Exception& )
- {
- OSL_ENSURE( false,
- OStringBuffer( "HeaderFooterParserImpl::createField - error while creating text field \"" ).
- append( OUStringToOString( rServiceName, RTL_TEXTENCODING_ASCII_US ) ).
- append( '"' ).getStr() );
- }
- return xContent;
-}
-
-void HeaderFooterParserImpl::appendField( const Reference< XTextContent >& rxContent )
-{
- getEndPos()->gotoEnd( sal_False );
- try
- {
- Reference< XTextRange > xRange( getEndPos(), UNO_QUERY_THROW );
- getPortion().mxText->insertTextContent( xRange, rxContent, sal_False );
- updateCurrHeight();
- }
- catch( Exception& )
- {
- }
-}
-
-void HeaderFooterParserImpl::convertFontName( const OUString& rName )
-{
- if( rName.getLength() > 0 )
- {
- // single dash is document default font
- if( (rName.getLength() == 1) && (rName[ 0 ] == '-') )
- maFontData.maName = getStyles().getDefaultFontData().maName;
- else
- maFontData.maName = rName;
- }
-}
-
-void HeaderFooterParserImpl::convertFontStyle( const OUString& rStyle )
-{
- maFontData.mbBold = maFontData.mbItalic = false;
- sal_Int32 nPos = 0;
- sal_Int32 nLen = rStyle.getLength();
- while( (0 <= nPos) && (nPos < nLen) )
- {
- OString aToken = OUStringToOString( rStyle.getToken( 0, ' ', nPos ), RTL_TEXTENCODING_UTF8 ).toAsciiLowerCase();
- if( aToken.getLength() > 0 )
- {
- if( maBoldNames.count( aToken ) > 0 )
- maFontData.mbBold = true;
- else if( maItalicNames.count( aToken ) > 0 )
- maFontData.mbItalic = true;
- }
- }
-}
-
-void HeaderFooterParserImpl::convertFontColor( const OUString& rColor )
-{
- OSL_ENSURE( rColor.getLength() == 6, "HeaderFooterParserImpl::convertFontColor - invalid font color code" );
- if( (rColor[ 2 ] == '+') || (rColor[ 2 ] == '-') )
- // theme color: TTSNNN (TT = decimal theme index, S = +/-, NNN = decimal tint/shade in percent)
- maFontData.maColor.setTheme(
- rColor.copy( 0, 2 ).toInt32(),
- static_cast< double >( rColor.copy( 2 ).toInt32() ) / 100.0 );
- else
- // RGB color: RRGGBB
- maFontData.maColor.setRgb( rColor.toInt32( 16 ) );
-}
-
-void HeaderFooterParserImpl::finalizePortion()
-{
- appendText();
- setAttributes();
-}
-
-void HeaderFooterParserImpl::setNewPortion( HFPortionId ePortion )
-{
- if( ePortion != meCurrPortion )
- {
- finalizePortion();
- meCurrPortion = ePortion;
- maFontData = getStyles().getDefaultFontData();
- }
-}
-
-// ============================================================================
-
-HeaderFooterParser::HeaderFooterParser( const WorkbookHelper& rHelper ) :
- WorkbookHelper( rHelper ),
- mxImpl( new HeaderFooterParserImpl( rHelper ) )
-{
-}
-
-HeaderFooterParser::~HeaderFooterParser()
-{
-}
-
-void HeaderFooterParser::parse( const Reference< XHeaderFooterContent >& rxContext, const OUString& rData )
-{
- mxImpl->parse( rxContext, rData );
-}
-
-double HeaderFooterParser::getTotalHeight() const
-{
- return mxImpl->getTotalHeight();
-}
-
-// ============================================================================
-
-} // namespace xls
-} // namespace oox
-
diff --git a/oox/source/xls/makefile.mk b/oox/source/xls/makefile.mk
index 00b47545fc9b..a8771bfca85a 100644
--- a/oox/source/xls/makefile.mk
+++ b/oox/source/xls/makefile.mk
@@ -53,6 +53,8 @@ SLOFILES = \
$(SLO)$/biffinputstream.obj \
$(SLO)$/biffoutputstream.obj \
$(SLO)$/chartsheetfragment.obj \
+ $(SLO)$/commentsbuffer.obj \
+ $(SLO)$/commentsfragment.obj \
$(SLO)$/condformatbuffer.obj \
$(SLO)$/condformatcontext.obj \
$(SLO)$/connectionsfragment.obj \
@@ -65,9 +67,9 @@ SLOFILES = \
$(SLO)$/externallinkfragment.obj \
$(SLO)$/formulabase.obj \
$(SLO)$/formulaparser.obj \
- $(SLO)$/headerfooterparser.obj \
$(SLO)$/numberformatsbuffer.obj \
$(SLO)$/pagesettings.obj \
+ $(SLO)$/pivotcachebuffer.obj \
$(SLO)$/pivotcachefragment.obj \
$(SLO)$/pivottablebuffer.obj \
$(SLO)$/pivottablefragment.obj \
@@ -77,11 +79,9 @@ SLOFILES = \
$(SLO)$/sharedformulabuffer.obj \
$(SLO)$/sharedstringsbuffer.obj \
$(SLO)$/sharedstringsfragment.obj \
- $(SLO)$/sheetcellrangemap.obj \
$(SLO)$/sheetdatacontext.obj \
$(SLO)$/stylesbuffer.obj \
$(SLO)$/stylesfragment.obj \
- $(SLO)$/stylespropertyhelper.obj \
$(SLO)$/tablebuffer.obj \
$(SLO)$/tablefragment.obj \
$(SLO)$/themebuffer.obj \
diff --git a/oox/source/xls/numberformatsbuffer.cxx b/oox/source/xls/numberformatsbuffer.cxx
index 5edda6513545..76fb57ed2302 100644
--- a/oox/source/xls/numberformatsbuffer.cxx
+++ b/oox/source/xls/numberformatsbuffer.cxx
@@ -39,7 +39,9 @@
#include <rtl/string.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
+#include "properties.hxx"
#include "oox/helper/attributelist.hxx"
+#include "oox/helper/propertymap.hxx"
#include "oox/helper/recordinputstream.hxx"
#include "oox/core/filterbase.hxx"
#include "oox/xls/biffinputstream.hxx"
@@ -1811,13 +1813,20 @@ static const BuiltinFormatTable spBuiltinFormatTables[] =
// ============================================================================
-OoxNumFmtData::OoxNumFmtData() :
+NumFmtModel::NumFmtModel() :
mnPredefId( -1 )
{
}
// ----------------------------------------------------------------------------
+ApiNumFmtData::ApiNumFmtData() :
+ mnIndex( 0 )
+{
+}
+
+// ----------------------------------------------------------------------------
+
namespace {
sal_Int32 lclCreatePredefinedFormat( const Reference< XNumberFormats >& rxNumFmts,
@@ -1910,35 +1919,35 @@ NumberFormat::NumberFormat( const WorkbookHelper& rHelper ) :
void NumberFormat::setFormatCode( const OUString& rFmtCode )
{
- maOoxData.maFmtCode = rFmtCode;
+ maModel.maFmtCode = rFmtCode;
}
void NumberFormat::setFormatCode( const Locale& rLocale, const sal_Char* pcFmtCode )
{
- maOoxData.maLocale = rLocale;
- maOoxData.maFmtCode = OStringToOUString( OString( pcFmtCode ), RTL_TEXTENCODING_UTF8 );
- maOoxData.mnPredefId = -1;
+ maModel.maLocale = rLocale;
+ maModel.maFmtCode = OStringToOUString( OString( pcFmtCode ), RTL_TEXTENCODING_UTF8 );
+ maModel.mnPredefId = -1;
}
void NumberFormat::setPredefinedId( const Locale& rLocale, sal_Int16 nPredefId )
{
- maOoxData.maLocale = rLocale;
- maOoxData.maFmtCode = OUString();
- maOoxData.mnPredefId = nPredefId;
+ maModel.maLocale = rLocale;
+ maModel.maFmtCode = OUString();
+ maModel.mnPredefId = nPredefId;
}
sal_Int32 NumberFormat::finalizeImport( const Reference< XNumberFormats >& rxNumFmts, const Locale& rFromLocale )
{
- if( rxNumFmts.is() && (maOoxData.maFmtCode.getLength() > 0) )
- maApiData.mnIndex = lclCreateFormat( rxNumFmts, maOoxData.maFmtCode, maOoxData.maLocale, rFromLocale );
+ if( rxNumFmts.is() && (maModel.maFmtCode.getLength() > 0) )
+ maApiData.mnIndex = lclCreateFormat( rxNumFmts, maModel.maFmtCode, maModel.maLocale, rFromLocale );
else
- maApiData.mnIndex = lclCreatePredefinedFormat( rxNumFmts, maOoxData.mnPredefId, maOoxData.maLocale );
+ maApiData.mnIndex = lclCreatePredefinedFormat( rxNumFmts, maModel.mnPredefId, maModel.maLocale );
return maApiData.mnIndex;
}
-void NumberFormat::writeToPropertySet( PropertySet& rPropSet ) const
+void NumberFormat::writeToPropertyMap( PropertyMap& rPropMap ) const
{
- getStylesPropertyHelper().writeNumFmtProperties( rPropSet, maApiData );
+ rPropMap[ PROP_NumberFormat ] <<= maApiData.mnIndex;
}
// ============================================================================
@@ -2037,10 +2046,10 @@ void NumberFormatsBuffer::finalizeImport()
maNumFmts.forEach( NumberFormatFinalizer( *this ) );
}
-void NumberFormatsBuffer::writeToPropertySet( PropertySet& rPropSet, sal_Int32 nNumFmtId ) const
+void NumberFormatsBuffer::writeToPropertyMap( PropertyMap& rPropMap, sal_Int32 nNumFmtId ) const
{
if( const NumberFormat* pNumFmt = maNumFmts.get( nNumFmtId ).get() )
- pNumFmt->writeToPropertySet( rPropSet );
+ pNumFmt->writeToPropertyMap( rPropMap );
}
void NumberFormatsBuffer::insertBuiltinFormats()
diff --git a/oox/source/xls/pagesettings.cxx b/oox/source/xls/pagesettings.cxx
index a06b473cd24c..c7dd02797147 100644
--- a/oox/source/xls/pagesettings.cxx
+++ b/oox/source/xls/pagesettings.cxx
@@ -29,28 +29,46 @@
************************************************************************/
#include "oox/xls/pagesettings.hxx"
+#include <set>
#include <algorithm>
+#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/awt/Size.hpp>
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/sheet/XHeaderFooterContent.hpp>
#include <com/sun/star/style/GraphicLocation.hpp>
+#include <com/sun/star/text/FilenameDisplayFormat.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include "properties.hxx"
#include "oox/helper/attributelist.hxx"
+#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/helper/recordinputstream.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/excelhandlers.hxx"
+#include "oox/xls/stylesbuffer.hxx"
#include "oox/xls/unitconverter.hxx"
+using ::rtl::OString;
+using ::rtl::OStringBuffer;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::container::XNamed;
+using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::awt::Size;
using ::com::sun::star::sheet::XHeaderFooterContent;
using ::com::sun::star::style::XStyle;
+using ::com::sun::star::text::XText;
+using ::com::sun::star::text::XTextCursor;
+using ::com::sun::star::text::XTextContent;
+using ::com::sun::star::text::XTextRange;
using ::oox::core::Relations;
namespace oox {
@@ -105,7 +123,7 @@ const sal_uInt16 BIFF_PAGESETUP_NOTES_END = 0x0200;
// ============================================================================
-OoxPageData::OoxPageData() :
+PageSettingsModel::PageSettingsModel() :
mfLeftMargin( OOX_MARGIN_DEFAULT_LR ),
mfRightMargin( OOX_MARGIN_DEFAULT_LR ),
mfTopMargin( OOX_MARGIN_DEFAULT_TB ),
@@ -138,7 +156,7 @@ OoxPageData::OoxPageData() :
{
}
-void OoxPageData::setBinPrintErrors( sal_uInt8 nPrintErrors )
+void PageSettingsModel::setBinPrintErrors( sal_uInt8 nPrintErrors )
{
static const sal_Int32 spnErrorIds[] = { XML_displayed, XML_none, XML_dash, XML_NA };
mnPrintErrors = STATIC_ARRAY_SELECT( spnErrorIds, nPrintErrors, XML_none );
@@ -153,168 +171,168 @@ PageSettings::PageSettings( const WorksheetHelper& rHelper ) :
void PageSettings::importPrintOptions( const AttributeList& rAttribs )
{
- maOoxData.mbHorCenter = rAttribs.getBool( XML_horizontalCentered, false );
- maOoxData.mbVerCenter = rAttribs.getBool( XML_verticalCentered, false );
- maOoxData.mbPrintGrid = rAttribs.getBool( XML_gridLines, false );
- maOoxData.mbPrintHeadings = rAttribs.getBool( XML_headings, false );
+ maModel.mbHorCenter = rAttribs.getBool( XML_horizontalCentered, false );
+ maModel.mbVerCenter = rAttribs.getBool( XML_verticalCentered, false );
+ maModel.mbPrintGrid = rAttribs.getBool( XML_gridLines, false );
+ maModel.mbPrintHeadings = rAttribs.getBool( XML_headings, false );
}
void PageSettings::importPageMargins( const AttributeList& rAttribs )
{
- maOoxData.mfLeftMargin = rAttribs.getDouble( XML_left, OOX_MARGIN_DEFAULT_LR );
- maOoxData.mfRightMargin = rAttribs.getDouble( XML_right, OOX_MARGIN_DEFAULT_LR );
- maOoxData.mfTopMargin = rAttribs.getDouble( XML_top, OOX_MARGIN_DEFAULT_TB );
- maOoxData.mfBottomMargin = rAttribs.getDouble( XML_bottom, OOX_MARGIN_DEFAULT_TB );
- maOoxData.mfHeaderMargin = rAttribs.getDouble( XML_header, OOX_MARGIN_DEFAULT_HF );
- maOoxData.mfFooterMargin = rAttribs.getDouble( XML_footer, OOX_MARGIN_DEFAULT_HF );
+ maModel.mfLeftMargin = rAttribs.getDouble( XML_left, OOX_MARGIN_DEFAULT_LR );
+ maModel.mfRightMargin = rAttribs.getDouble( XML_right, OOX_MARGIN_DEFAULT_LR );
+ maModel.mfTopMargin = rAttribs.getDouble( XML_top, OOX_MARGIN_DEFAULT_TB );
+ maModel.mfBottomMargin = rAttribs.getDouble( XML_bottom, OOX_MARGIN_DEFAULT_TB );
+ maModel.mfHeaderMargin = rAttribs.getDouble( XML_header, OOX_MARGIN_DEFAULT_HF );
+ maModel.mfFooterMargin = rAttribs.getDouble( XML_footer, OOX_MARGIN_DEFAULT_HF );
}
void PageSettings::importPageSetup( const Relations& rRelations, const AttributeList& rAttribs )
{
- maOoxData.maBinSettPath = rRelations.getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
- maOoxData.mnPaperSize = rAttribs.getInteger( XML_paperSize, 1 );
- maOoxData.mnCopies = rAttribs.getInteger( XML_copies, 1 );
- maOoxData.mnScale = rAttribs.getInteger( XML_scale, 100 );
- maOoxData.mnFirstPage = rAttribs.getInteger( XML_firstPageNumber, 1 );
- maOoxData.mnFitToWidth = rAttribs.getInteger( XML_fitToWidth, 1 );
- maOoxData.mnFitToHeight = rAttribs.getInteger( XML_fitToHeight, 1 );
- maOoxData.mnHorPrintRes = rAttribs.getInteger( XML_horizontalDpi, 600 );
- maOoxData.mnVerPrintRes = rAttribs.getInteger( XML_verticalDpi, 600 );
- maOoxData.mnOrientation = rAttribs.getToken( XML_orientation, XML_default );
- maOoxData.mnPageOrder = rAttribs.getToken( XML_pageOrder, XML_downThenOver );
- maOoxData.mnCellComments = rAttribs.getToken( XML_cellComments, XML_none );
- maOoxData.mnPrintErrors = rAttribs.getToken( XML_errors, XML_displayed );
- maOoxData.mbValidSettings = rAttribs.getBool( XML_usePrinterDefaults, true );
- maOoxData.mbUseFirstPage = rAttribs.getBool( XML_useFirstPageNumber, false );
- maOoxData.mbBlackWhite = rAttribs.getBool( XML_blackAndWhite, false );
- maOoxData.mbDraftQuality = rAttribs.getBool( XML_draft, false );
+ maModel.maBinSettPath = rRelations.getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
+ maModel.mnPaperSize = rAttribs.getInteger( XML_paperSize, 1 );
+ maModel.mnCopies = rAttribs.getInteger( XML_copies, 1 );
+ maModel.mnScale = rAttribs.getInteger( XML_scale, 100 );
+ maModel.mnFirstPage = rAttribs.getInteger( XML_firstPageNumber, 1 );
+ maModel.mnFitToWidth = rAttribs.getInteger( XML_fitToWidth, 1 );
+ maModel.mnFitToHeight = rAttribs.getInteger( XML_fitToHeight, 1 );
+ maModel.mnHorPrintRes = rAttribs.getInteger( XML_horizontalDpi, 600 );
+ maModel.mnVerPrintRes = rAttribs.getInteger( XML_verticalDpi, 600 );
+ maModel.mnOrientation = rAttribs.getToken( XML_orientation, XML_default );
+ maModel.mnPageOrder = rAttribs.getToken( XML_pageOrder, XML_downThenOver );
+ maModel.mnCellComments = rAttribs.getToken( XML_cellComments, XML_none );
+ maModel.mnPrintErrors = rAttribs.getToken( XML_errors, XML_displayed );
+ maModel.mbValidSettings = rAttribs.getBool( XML_usePrinterDefaults, true );
+ maModel.mbUseFirstPage = rAttribs.getBool( XML_useFirstPageNumber, false );
+ maModel.mbBlackWhite = rAttribs.getBool( XML_blackAndWhite, false );
+ maModel.mbDraftQuality = rAttribs.getBool( XML_draft, false );
}
void PageSettings::importChartPageSetup( const Relations& rRelations, const AttributeList& rAttribs )
{
- maOoxData.maBinSettPath = rRelations.getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
- maOoxData.mnPaperSize = rAttribs.getInteger( XML_paperSize, 1 );
- maOoxData.mnCopies = rAttribs.getInteger( XML_copies, 1 );
- maOoxData.mnFirstPage = rAttribs.getInteger( XML_firstPageNumber, 1 );
- maOoxData.mnHorPrintRes = rAttribs.getInteger( XML_horizontalDpi, 600 );
- maOoxData.mnVerPrintRes = rAttribs.getInteger( XML_verticalDpi, 600 );
- maOoxData.mnOrientation = rAttribs.getToken( XML_orientation, XML_default );
- maOoxData.mbValidSettings = rAttribs.getBool( XML_usePrinterDefaults, true );
- maOoxData.mbUseFirstPage = rAttribs.getBool( XML_useFirstPageNumber, false );
- maOoxData.mbBlackWhite = rAttribs.getBool( XML_blackAndWhite, false );
- maOoxData.mbDraftQuality = rAttribs.getBool( XML_draft, false );
+ maModel.maBinSettPath = rRelations.getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
+ maModel.mnPaperSize = rAttribs.getInteger( XML_paperSize, 1 );
+ maModel.mnCopies = rAttribs.getInteger( XML_copies, 1 );
+ maModel.mnFirstPage = rAttribs.getInteger( XML_firstPageNumber, 1 );
+ maModel.mnHorPrintRes = rAttribs.getInteger( XML_horizontalDpi, 600 );
+ maModel.mnVerPrintRes = rAttribs.getInteger( XML_verticalDpi, 600 );
+ maModel.mnOrientation = rAttribs.getToken( XML_orientation, XML_default );
+ maModel.mbValidSettings = rAttribs.getBool( XML_usePrinterDefaults, true );
+ maModel.mbUseFirstPage = rAttribs.getBool( XML_useFirstPageNumber, false );
+ maModel.mbBlackWhite = rAttribs.getBool( XML_blackAndWhite, false );
+ maModel.mbDraftQuality = rAttribs.getBool( XML_draft, false );
}
void PageSettings::importHeaderFooter( const AttributeList& rAttribs )
{
- maOoxData.mbUseEvenHF = rAttribs.getBool( XML_differentOddEven, false );
- maOoxData.mbUseFirstHF = rAttribs.getBool( XML_differentFirst, false );
+ maModel.mbUseEvenHF = rAttribs.getBool( XML_differentOddEven, false );
+ maModel.mbUseFirstHF = rAttribs.getBool( XML_differentFirst, false );
}
void PageSettings::importHeaderFooterCharacters( const OUString& rChars, sal_Int32 nElement )
{
switch( nElement )
{
- case XLS_TOKEN( oddHeader ): maOoxData.maOddHeader += rChars; break;
- case XLS_TOKEN( oddFooter ): maOoxData.maOddFooter += rChars; break;
- case XLS_TOKEN( evenHeader ): maOoxData.maEvenHeader += rChars; break;
- case XLS_TOKEN( evenFooter ): maOoxData.maEvenFooter += rChars; break;
- case XLS_TOKEN( firstHeader ): maOoxData.maFirstHeader += rChars; break;
- case XLS_TOKEN( firstFooter ): maOoxData.maFirstFooter += rChars; break;
+ case XLS_TOKEN( oddHeader ): maModel.maOddHeader += rChars; break;
+ case XLS_TOKEN( oddFooter ): maModel.maOddFooter += rChars; break;
+ case XLS_TOKEN( evenHeader ): maModel.maEvenHeader += rChars; break;
+ case XLS_TOKEN( evenFooter ): maModel.maEvenFooter += rChars; break;
+ case XLS_TOKEN( firstHeader ): maModel.maFirstHeader += rChars; break;
+ case XLS_TOKEN( firstFooter ): maModel.maFirstFooter += rChars; break;
}
}
void PageSettings::importPicture( const Relations& rRelations, const AttributeList& rAttribs )
{
- maOoxData.maPicturePath = rRelations.getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
+ maModel.maPicturePath = rRelations.getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
}
void PageSettings::importPageMargins( RecordInputStream& rStrm )
{
- rStrm >> maOoxData.mfLeftMargin >> maOoxData.mfRightMargin
- >> maOoxData.mfTopMargin >> maOoxData.mfBottomMargin
- >> maOoxData.mfHeaderMargin >> maOoxData.mfFooterMargin;
+ rStrm >> maModel.mfLeftMargin >> maModel.mfRightMargin
+ >> maModel.mfTopMargin >> maModel.mfBottomMargin
+ >> maModel.mfHeaderMargin >> maModel.mfFooterMargin;
}
void PageSettings::importPrintOptions( RecordInputStream& rStrm )
{
sal_uInt16 nFlags;
rStrm >> nFlags;
- maOoxData.mbHorCenter = getFlag( nFlags, OOBIN_PRINTOPT_HORCENTER );
- maOoxData.mbVerCenter = getFlag( nFlags, OOBIN_PRINTOPT_VERCENTER );
- maOoxData.mbPrintGrid = getFlag( nFlags, OOBIN_PRINTOPT_PRINTGRID );
- maOoxData.mbPrintHeadings = getFlag( nFlags, OOBIN_PRINTOPT_PRINTHEADING );
+ maModel.mbHorCenter = getFlag( nFlags, OOBIN_PRINTOPT_HORCENTER );
+ maModel.mbVerCenter = getFlag( nFlags, OOBIN_PRINTOPT_VERCENTER );
+ maModel.mbPrintGrid = getFlag( nFlags, OOBIN_PRINTOPT_PRINTGRID );
+ maModel.mbPrintHeadings = getFlag( nFlags, OOBIN_PRINTOPT_PRINTHEADING );
}
void PageSettings::importPageSetup( const Relations& rRelations, RecordInputStream& rStrm )
{
OUString aRelId;
sal_uInt16 nFlags;
- rStrm >> maOoxData.mnPaperSize >> maOoxData.mnScale
- >> maOoxData.mnHorPrintRes >> maOoxData.mnVerPrintRes
- >> maOoxData.mnCopies >> maOoxData.mnFirstPage
- >> maOoxData.mnFitToWidth >> maOoxData.mnFitToHeight
+ rStrm >> maModel.mnPaperSize >> maModel.mnScale
+ >> maModel.mnHorPrintRes >> maModel.mnVerPrintRes
+ >> maModel.mnCopies >> maModel.mnFirstPage
+ >> maModel.mnFitToWidth >> maModel.mnFitToHeight
>> nFlags >> aRelId;
- maOoxData.setBinPrintErrors( extractValue< sal_uInt8 >( nFlags, 9, 2 ) );
- maOoxData.maBinSettPath = rRelations.getFragmentPathFromRelId( aRelId );
- maOoxData.mnOrientation = getFlagValue( nFlags, OOBIN_PAGESETUP_DEFAULTORIENT, XML_default, getFlagValue( nFlags, OOBIN_PAGESETUP_LANDSCAPE, XML_landscape, XML_portrait ) );
- maOoxData.mnPageOrder = getFlagValue( nFlags, OOBIN_PAGESETUP_INROWS, XML_overThenDown, XML_downThenOver );
- maOoxData.mnCellComments = getFlagValue( nFlags, OOBIN_PAGESETUP_PRINTNOTES, getFlagValue( nFlags, OOBIN_PAGESETUP_NOTES_END, XML_atEnd, XML_asDisplayed ), XML_none );
- maOoxData.mbValidSettings = !getFlag( nFlags, OOBIN_PAGESETUP_INVALID );
- maOoxData.mbUseFirstPage = getFlag( nFlags, OOBIN_PAGESETUP_USEFIRSTPAGE );
- maOoxData.mbBlackWhite = getFlag( nFlags, OOBIN_PAGESETUP_BLACKWHITE );
- maOoxData.mbDraftQuality = getFlag( nFlags, OOBIN_PAGESETUP_DRAFTQUALITY );
+ maModel.setBinPrintErrors( extractValue< sal_uInt8 >( nFlags, 9, 2 ) );
+ maModel.maBinSettPath = rRelations.getFragmentPathFromRelId( aRelId );
+ maModel.mnOrientation = getFlagValue( nFlags, OOBIN_PAGESETUP_DEFAULTORIENT, XML_default, getFlagValue( nFlags, OOBIN_PAGESETUP_LANDSCAPE, XML_landscape, XML_portrait ) );
+ maModel.mnPageOrder = getFlagValue( nFlags, OOBIN_PAGESETUP_INROWS, XML_overThenDown, XML_downThenOver );
+ maModel.mnCellComments = getFlagValue( nFlags, OOBIN_PAGESETUP_PRINTNOTES, getFlagValue( nFlags, OOBIN_PAGESETUP_NOTES_END, XML_atEnd, XML_asDisplayed ), XML_none );
+ maModel.mbValidSettings = !getFlag( nFlags, OOBIN_PAGESETUP_INVALID );
+ maModel.mbUseFirstPage = getFlag( nFlags, OOBIN_PAGESETUP_USEFIRSTPAGE );
+ maModel.mbBlackWhite = getFlag( nFlags, OOBIN_PAGESETUP_BLACKWHITE );
+ maModel.mbDraftQuality = getFlag( nFlags, OOBIN_PAGESETUP_DRAFTQUALITY );
}
void PageSettings::importChartPageSetup( const Relations& rRelations, RecordInputStream& rStrm )
{
OUString aRelId;
sal_uInt16 nFirstPage, nFlags;
- rStrm >> maOoxData.mnPaperSize >> maOoxData.mnHorPrintRes >> maOoxData.mnVerPrintRes
- >> maOoxData.mnCopies >> nFirstPage >> nFlags >> aRelId;
- maOoxData.maBinSettPath = rRelations.getFragmentPathFromRelId( aRelId );
- maOoxData.mnFirstPage = nFirstPage; // 16-bit in CHARTPAGESETUP
- maOoxData.mnOrientation = getFlagValue( nFlags, OOBIN_CHARTPAGESETUP_DEFAULTORIENT, XML_default, getFlagValue( nFlags, OOBIN_CHARTPAGESETUP_LANDSCAPE, XML_landscape, XML_portrait ) );
- maOoxData.mbValidSettings = !getFlag( nFlags, OOBIN_CHARTPAGESETUP_INVALID );
- maOoxData.mbUseFirstPage = getFlag( nFlags, OOBIN_CHARTPAGESETUP_USEFIRSTPAGE );
- maOoxData.mbBlackWhite = getFlag( nFlags, OOBIN_CHARTPAGESETUP_BLACKWHITE );
- maOoxData.mbDraftQuality = getFlag( nFlags, OOBIN_CHARTPAGESETUP_DRAFTQUALITY );
+ rStrm >> maModel.mnPaperSize >> maModel.mnHorPrintRes >> maModel.mnVerPrintRes
+ >> maModel.mnCopies >> nFirstPage >> nFlags >> aRelId;
+ maModel.maBinSettPath = rRelations.getFragmentPathFromRelId( aRelId );
+ maModel.mnFirstPage = nFirstPage; // 16-bit in CHARTPAGESETUP
+ maModel.mnOrientation = getFlagValue( nFlags, OOBIN_CHARTPAGESETUP_DEFAULTORIENT, XML_default, getFlagValue( nFlags, OOBIN_CHARTPAGESETUP_LANDSCAPE, XML_landscape, XML_portrait ) );
+ maModel.mbValidSettings = !getFlag( nFlags, OOBIN_CHARTPAGESETUP_INVALID );
+ maModel.mbUseFirstPage = getFlag( nFlags, OOBIN_CHARTPAGESETUP_USEFIRSTPAGE );
+ maModel.mbBlackWhite = getFlag( nFlags, OOBIN_CHARTPAGESETUP_BLACKWHITE );
+ maModel.mbDraftQuality = getFlag( nFlags, OOBIN_CHARTPAGESETUP_DRAFTQUALITY );
}
void PageSettings::importHeaderFooter( RecordInputStream& rStrm )
{
sal_uInt16 nFlags;
rStrm >> nFlags
- >> maOoxData.maOddHeader >> maOoxData.maOddFooter
- >> maOoxData.maEvenHeader >> maOoxData.maEvenFooter
- >> maOoxData.maFirstHeader >> maOoxData.maFirstFooter;
- maOoxData.mbUseEvenHF = getFlag( nFlags, OOBIN_HEADERFOOTER_DIFFEVEN );
- maOoxData.mbUseFirstHF = getFlag( nFlags, OOBIN_HEADERFOOTER_DIFFFIRST );
+ >> maModel.maOddHeader >> maModel.maOddFooter
+ >> maModel.maEvenHeader >> maModel.maEvenFooter
+ >> maModel.maFirstHeader >> maModel.maFirstFooter;
+ maModel.mbUseEvenHF = getFlag( nFlags, OOBIN_HEADERFOOTER_DIFFEVEN );
+ maModel.mbUseFirstHF = getFlag( nFlags, OOBIN_HEADERFOOTER_DIFFFIRST );
}
void PageSettings::importPicture( const Relations& rRelations, RecordInputStream& rStrm )
{
- maOoxData.maPicturePath = rRelations.getFragmentPathFromRelId( rStrm.readString() );
+ maModel.maPicturePath = rRelations.getFragmentPathFromRelId( rStrm.readString() );
}
void PageSettings::importLeftMargin( BiffInputStream& rStrm )
{
- rStrm >> maOoxData.mfLeftMargin;
+ rStrm >> maModel.mfLeftMargin;
}
void PageSettings::importRightMargin( BiffInputStream& rStrm )
{
- rStrm >> maOoxData.mfRightMargin;
+ rStrm >> maModel.mfRightMargin;
}
void PageSettings::importTopMargin( BiffInputStream& rStrm )
{
- rStrm >> maOoxData.mfTopMargin;
+ rStrm >> maModel.mfTopMargin;
}
void PageSettings::importBottomMargin( BiffInputStream& rStrm )
{
- rStrm >> maOoxData.mfBottomMargin;
+ rStrm >> maModel.mfBottomMargin;
}
void PageSettings::importPageSetup( BiffInputStream& rStrm )
@@ -322,72 +340,72 @@ void PageSettings::importPageSetup( BiffInputStream& rStrm )
sal_uInt16 nPaperSize, nScale, nFirstPage, nFitToWidth, nFitToHeight, nFlags;
rStrm >> nPaperSize >> nScale >> nFirstPage >> nFitToWidth >> nFitToHeight >> nFlags;
- maOoxData.mnPaperSize = nPaperSize; // equal in BIFF and OOX
- maOoxData.mnScale = nScale;
- maOoxData.mnFirstPage = nFirstPage;
- maOoxData.mnFitToWidth = nFitToWidth;
- maOoxData.mnFitToHeight = nFitToHeight;
- maOoxData.mnOrientation = getFlagValue( nFlags, BIFF_PAGESETUP_PORTRAIT, XML_portrait, XML_landscape );
- maOoxData.mnPageOrder = getFlagValue( nFlags, BIFF_PAGESETUP_INROWS, XML_overThenDown, XML_downThenOver );
- maOoxData.mbValidSettings = !getFlag( nFlags, BIFF_PAGESETUP_INVALID );
- maOoxData.mbUseFirstPage = true;
- maOoxData.mbBlackWhite = getFlag( nFlags, BIFF_PAGESETUP_BLACKWHITE );
+ maModel.mnPaperSize = nPaperSize; // equal in BIFF and OOX
+ maModel.mnScale = nScale;
+ maModel.mnFirstPage = nFirstPage;
+ maModel.mnFitToWidth = nFitToWidth;
+ maModel.mnFitToHeight = nFitToHeight;
+ maModel.mnOrientation = getFlagValue( nFlags, BIFF_PAGESETUP_PORTRAIT, XML_portrait, XML_landscape );
+ maModel.mnPageOrder = getFlagValue( nFlags, BIFF_PAGESETUP_INROWS, XML_overThenDown, XML_downThenOver );
+ maModel.mbValidSettings = !getFlag( nFlags, BIFF_PAGESETUP_INVALID );
+ maModel.mbUseFirstPage = true;
+ maModel.mbBlackWhite = getFlag( nFlags, BIFF_PAGESETUP_BLACKWHITE );
if( getBiff() >= BIFF5 )
{
sal_uInt16 nHorPrintRes, nVerPrintRes, nCopies;
- rStrm >> nHorPrintRes >> nVerPrintRes >> maOoxData.mfHeaderMargin >> maOoxData.mfFooterMargin >> nCopies;
+ rStrm >> nHorPrintRes >> nVerPrintRes >> maModel.mfHeaderMargin >> maModel.mfFooterMargin >> nCopies;
- maOoxData.mnCopies = nCopies;
- maOoxData.mnOrientation = getFlagValue( nFlags, BIFF_PAGESETUP_DEFAULTORIENT, XML_default, maOoxData.mnOrientation );
- maOoxData.mnHorPrintRes = nHorPrintRes;
- maOoxData.mnVerPrintRes = nVerPrintRes;
- maOoxData.mnCellComments = getFlagValue( nFlags, BIFF_PAGESETUP_PRINTNOTES, XML_asDisplayed, XML_none );
- maOoxData.mbUseFirstPage = getFlag( nFlags, BIFF_PAGESETUP_USEFIRSTPAGE );
- maOoxData.mbDraftQuality = getFlag( nFlags, BIFF_PAGESETUP_DRAFTQUALITY );
+ maModel.mnCopies = nCopies;
+ maModel.mnOrientation = getFlagValue( nFlags, BIFF_PAGESETUP_DEFAULTORIENT, XML_default, maModel.mnOrientation );
+ maModel.mnHorPrintRes = nHorPrintRes;
+ maModel.mnVerPrintRes = nVerPrintRes;
+ maModel.mnCellComments = getFlagValue( nFlags, BIFF_PAGESETUP_PRINTNOTES, XML_asDisplayed, XML_none );
+ maModel.mbUseFirstPage = getFlag( nFlags, BIFF_PAGESETUP_USEFIRSTPAGE );
+ maModel.mbDraftQuality = getFlag( nFlags, BIFF_PAGESETUP_DRAFTQUALITY );
if( getBiff() == BIFF8 )
{
- maOoxData.setBinPrintErrors( extractValue< sal_uInt8 >( nFlags, 10, 2 ) );
- maOoxData.mnCellComments = getFlagValue( nFlags, BIFF_PAGESETUP_PRINTNOTES, getFlagValue( nFlags, BIFF_PAGESETUP_NOTES_END, XML_atEnd, XML_asDisplayed ), XML_none );
+ maModel.setBinPrintErrors( extractValue< sal_uInt8 >( nFlags, 10, 2 ) );
+ maModel.mnCellComments = getFlagValue( nFlags, BIFF_PAGESETUP_PRINTNOTES, getFlagValue( nFlags, BIFF_PAGESETUP_NOTES_END, XML_atEnd, XML_asDisplayed ), XML_none );
}
}
}
void PageSettings::importHorCenter( BiffInputStream& rStrm )
{
- maOoxData.mbHorCenter = rStrm.readuInt16() != 0;
+ maModel.mbHorCenter = rStrm.readuInt16() != 0;
}
void PageSettings::importVerCenter( BiffInputStream& rStrm )
{
- maOoxData.mbVerCenter = rStrm.readuInt16() != 0;
+ maModel.mbVerCenter = rStrm.readuInt16() != 0;
}
void PageSettings::importPrintHeaders( BiffInputStream& rStrm )
{
- maOoxData.mbPrintHeadings = rStrm.readuInt16() != 0;
+ maModel.mbPrintHeadings = rStrm.readuInt16() != 0;
}
void PageSettings::importPrintGridLines( BiffInputStream& rStrm )
{
- maOoxData.mbPrintGrid = rStrm.readuInt16() != 0;
+ maModel.mbPrintGrid = rStrm.readuInt16() != 0;
}
void PageSettings::importHeader( BiffInputStream& rStrm )
{
if( rStrm.getRemaining() > 0 )
- maOoxData.maOddHeader = (getBiff() == BIFF8) ? rStrm.readUniString() : rStrm.readByteString( false, getTextEncoding() );
+ maModel.maOddHeader = (getBiff() == BIFF8) ? rStrm.readUniString() : rStrm.readByteString( false, getTextEncoding() );
else
- maOoxData.maOddHeader = OUString();
+ maModel.maOddHeader = OUString();
}
void PageSettings::importFooter( BiffInputStream& rStrm )
{
if( rStrm.getRemaining() > 0 )
- maOoxData.maOddFooter = (getBiff() == BIFF8) ? rStrm.readUniString() : rStrm.readByteString( false, getTextEncoding() );
+ maModel.maOddFooter = (getBiff() == BIFF8) ? rStrm.readUniString() : rStrm.readByteString( false, getTextEncoding() );
else
- maOoxData.maOddFooter = OUString();
+ maModel.maOddFooter = OUString();
}
void PageSettings::importPicture( BiffInputStream& /*rStrm*/ )
@@ -396,13 +414,13 @@ void PageSettings::importPicture( BiffInputStream& /*rStrm*/ )
void PageSettings::setFitToPagesMode( bool bFitToPages )
{
- maOoxData.mbFitToPages = bFitToPages;
+ maModel.mbFitToPages = bFitToPages;
}
void PageSettings::finalizeImport()
{
OUStringBuffer aStyleNameBuffer( CREATE_OUSTRING( "PageStyle_" ) );
- Reference< XNamed > xSheetName( getXSpreadsheet(), UNO_QUERY );
+ Reference< XNamed > xSheetName( getSheet(), UNO_QUERY );
if( xSheetName.is() )
aStyleNameBuffer.append( xSheetName->getName() );
else
@@ -411,52 +429,566 @@ void PageSettings::finalizeImport()
Reference< XStyle > xStyle = createStyleObject( aStyleName, true );
PropertySet aStyleProps( xStyle );
- getPageSettingsPropertyHelper().writePageSettingsProperties( aStyleProps, maOoxData, getSheetType() );
+ getPageSettingsConverter().writePageSettingsProperties( aStyleProps, maModel, getSheetType() );
- PropertySet aSheetProps( getXSpreadsheet() );
- aSheetProps.setProperty( CREATE_OUSTRING( "PageStyle" ), aStyleName );
+ PropertySet aSheetProps( getSheet() );
+ aSheetProps.setProperty( PROP_PageStyle, aStyleName );
}
// ============================================================================
+// ============================================================================
+
+enum HFPortionId
+{
+ HF_LEFT,
+ HF_CENTER,
+ HF_RIGHT,
+ HF_COUNT
+};
+
+// ----------------------------------------------------------------------------
+
+struct HFPortionInfo
+{
+ Reference< XText > mxText; /// XText interface of this portion.
+ Reference< XTextCursor > mxStart; /// Start position of current text range for formatting.
+ Reference< XTextCursor > mxEnd; /// End position of current text range for formatting.
+ double mfTotalHeight; /// Sum of heights of previous lines in points.
+ double mfCurrHeight; /// Height of the current text line in points.
+
+ bool initialize( const Reference< XText >& rxText );
+};
+
+bool HFPortionInfo::initialize( const Reference< XText >& rxText )
+{
+ mfTotalHeight = mfCurrHeight = 0.0;
+ mxText = rxText;
+ if( mxText.is() )
+ {
+ mxStart = mxText->createTextCursor();
+ mxEnd = mxText->createTextCursor();
+ }
+ bool bRet = mxText.is() && mxStart.is() && mxEnd.is();
+ OSL_ENSURE( bRet, "HFPortionInfo::initialize - missing interfaces" );
+ return bRet;
+}
+
+// ============================================================================
+
+class HeaderFooterParser : public WorkbookHelper
+{
+public:
+ explicit HeaderFooterParser( const WorkbookHelper& rHelper );
+
+ /** Parses the passed string and creates the header/footer contents.
+ @returns The total height of the converted header or footer in points. */
+ double parse(
+ const Reference< XHeaderFooterContent >& rxContext,
+ const OUString& rData );
+
+private:
+ /** Returns the current edit engine text object. */
+ inline HFPortionInfo& getPortion() { return maPortions[ meCurrPortion ]; }
+ /** Returns the start cursor of the current text range. */
+ inline const Reference< XTextCursor >& getStartPos() { return getPortion().mxStart; }
+ /** Returns the end cursor of the current text range. */
+ inline const Reference< XTextCursor >& getEndPos() { return getPortion().mxEnd; }
+
+ /** Returns the current line height of the specified portion. */
+ double getCurrHeight( HFPortionId ePortion ) const;
+ /** Returns the current line height. */
+ double getCurrHeight() const;
+
+ /** Updates the current line height of the specified portion, using the current font size. */
+ void updateCurrHeight( HFPortionId ePortion );
+ /** Updates the current line height, using the current font size. */
+ void updateCurrHeight();
+
+ /** Sets the font attributes at the current selection. */
+ void setAttributes();
+ /** Appends and clears internal string buffer. */
+ void appendText();
+ /** Appends a line break and adjusts internal text height data. */
+ void appendLineBreak();
+
+ /** Creates a text field from the passed service name. */
+ Reference< XTextContent > createField( const OUString& rServiceName ) const;
+ /** Appends the passed text field. */
+ void appendField( const Reference< XTextContent >& rxContent );
+
+ /** Sets the passed font name if it is valid. */
+ void convertFontName( const OUString& rStyle );
+ /** Converts a font style given as string. */
+ void convertFontStyle( const OUString& rStyle );
+ /** Converts a font color given as string. */
+ void convertFontColor( const OUString& rColor );
+
+ /** Finalizes current portion: sets font attributes and updates text height data. */
+ void finalizePortion();
+ /** Changes current header/footer portion. */
+ void setNewPortion( HFPortionId ePortion );
+
+private:
+ typedef ::std::vector< HFPortionInfo > HFPortionInfoVec;
+ typedef ::std::set< OString > OStringSet;
+
+ const OUString maPageNumberService;
+ const OUString maPageCountService;
+ const OUString maSheetNameService;
+ const OUString maFileNameService;
+ const OUString maDateTimeService;
+ const OStringSet maBoldNames; /// All names for bold font style in lowercase UTF-8.
+ const OStringSet maItalicNames; /// All names for italic font style in lowercase UTF-8.
+ HFPortionInfoVec maPortions;
+ HFPortionId meCurrPortion; /// Identifier of current H/F portion.
+ OUStringBuffer maBuffer; /// Text data to append to current text range.
+ FontModel maFontModel; /// Font attributes of current text range.
+};
+
+// ----------------------------------------------------------------------------
namespace {
-/** Property names for page style settings. */
-const sal_Char* const sppcPageNames[] =
-{
- "IsLandscape",
- "FirstPageNumber",
- "PrintDownFirst",
- "PrintAnnotations",
- "CenterHorizontally",
- "CenterVertically",
- "PrintGrid",
- "PrintHeaders",
- "LeftMargin",
- "RightMargin",
- "TopMargin",
- "BottomMargin",
- "HeaderIsOn",
- "HeaderIsShared",
- "HeaderIsDynamicHeight",
- "HeaderHeight",
- "HeaderBodyDistance",
- "FooterIsOn",
- "FooterIsShared",
- "FooterIsDynamicHeight",
- "FooterHeight",
- "FooterBodyDistance",
- 0
+// different names for bold font style (lowercase)
+static const sal_Char* const sppcBoldNames[] =
+{
+ "bold",
+ "fett", // German 'bold'
+ "demibold",
+ "halbfett", // German 'demibold'
+ "black",
+ "heavy"
};
-/** Property names for page background graphic. */
-const sal_Char* const sppcGraphicNames[] =
+// different names for italic font style (lowercase)
+static const sal_Char* const sppcItalicNames[] =
{
- "BackGraphicURL",
- "BackGraphicLocation",
- 0
+ "italic",
+ "kursiv", // German 'italic'
+ "oblique",
+ "schr\303\204g", // German 'oblique' with uppercase A umlaut
+ "schr\303\244g" // German 'oblique' with lowercase A umlaut
};
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+HeaderFooterParser::HeaderFooterParser( const WorkbookHelper& rHelper ) :
+ WorkbookHelper( rHelper ),
+ maPageNumberService( CREATE_OUSTRING( "com.sun.star.text.TextField.PageNumber" ) ),
+ maPageCountService( CREATE_OUSTRING( "com.sun.star.text.TextField.PageCount" ) ),
+ maSheetNameService( CREATE_OUSTRING( "com.sun.star.text.TextField.SheetName" ) ),
+ maFileNameService( CREATE_OUSTRING( "com.sun.star.text.TextField.FileName" ) ),
+ maDateTimeService( CREATE_OUSTRING( "com.sun.star.text.TextField.DateTime" ) ),
+ maBoldNames( sppcBoldNames, STATIC_ARRAY_END( sppcBoldNames ) ),
+ maItalicNames( sppcItalicNames, STATIC_ARRAY_END( sppcItalicNames ) ),
+ maPortions( static_cast< size_t >( HF_COUNT ) ),
+ meCurrPortion( HF_CENTER )
+{
+}
+
+double HeaderFooterParser::parse( const Reference< XHeaderFooterContent >& rxContext, const OUString& rData )
+{
+ if( !rxContext.is() || (rData.getLength() == 0) ||
+ !maPortions[ HF_LEFT ].initialize( rxContext->getLeftText() ) ||
+ !maPortions[ HF_CENTER ].initialize( rxContext->getCenterText() ) ||
+ !maPortions[ HF_RIGHT ].initialize( rxContext->getRightText() ) )
+ return 0.0;
+
+ meCurrPortion = HF_CENTER;
+ maBuffer.setLength( 0 );
+ maFontModel = getStyles().getDefaultFontModel();
+ OUStringBuffer aFontName; // current font name
+ OUStringBuffer aFontStyle; // current font style
+ sal_Int32 nFontHeight = 0; // current font height
+
+ /** State of the parser. */
+ enum
+ {
+ STATE_TEXT, /// Literal text data.
+ STATE_TOKEN, /// Control token following a '&' character.
+ STATE_FONTNAME, /// Font name ('&' is followed by '"', reads until next '"' or ',').
+ STATE_FONTSTYLE, /// Font style name (font part after ',', reads until next '"').
+ STATE_FONTHEIGHT /// Font height ('&' is followed by num. digits, reads until non-digit).
+ }
+ eState = STATE_TEXT;
+
+ const sal_Unicode* pcChar = rData.getStr();
+ const sal_Unicode* pcEnd = pcChar + rData.getLength();
+ for( ; (pcChar != pcEnd) && (*pcChar != 0); ++pcChar )
+ {
+ sal_Unicode cChar = *pcChar;
+ switch( eState )
+ {
+ case STATE_TEXT:
+ {
+ switch( cChar )
+ {
+ case '&': // new token
+ appendText();
+ eState = STATE_TOKEN;
+ break;
+ case '\n': // line break
+ appendText();
+ appendLineBreak();
+ break;
+ default:
+ maBuffer.append( cChar );
+ }
+ }
+ break;
+
+ case STATE_TOKEN:
+ {
+ // default: back to text mode, may be changed in specific cases
+ eState = STATE_TEXT;
+ // ignore case of token codes
+ if( ('a' <= cChar) && (cChar <= 'z') )
+ (cChar -= 'a') += 'A';
+ switch( cChar )
+ {
+ case '&': maBuffer.append( cChar ); break; // the '&' character
+
+ case 'L': setNewPortion( HF_LEFT ); break; // left portion
+ case 'C': setNewPortion( HF_CENTER ); break; // center portion
+ case 'R': setNewPortion( HF_RIGHT ); break; // right portion
+
+ case 'P': // page number
+ appendField( createField( maPageNumberService ) );
+ break;
+ case 'N': // total page count
+ appendField( createField( maPageCountService ) );
+ break;
+ case 'A': // current sheet name
+ appendField( createField( maSheetNameService ) );
+ break;
+
+ case 'F': // file name
+ {
+ Reference< XTextContent > xContent = createField( maFileNameService );
+ PropertySet aPropSet( xContent );
+ aPropSet.setProperty( PROP_FileFormat, ::com::sun::star::text::FilenameDisplayFormat::NAME_AND_EXT );
+ appendField( xContent );
+ }
+ break;
+ case 'Z': // file path (without file name), BIFF8 and OOX only
+ if( (getFilterType() == FILTER_OOX) || ((getFilterType() == FILTER_BIFF) && (getBiff() == BIFF8)) )
+ {
+ Reference< XTextContent > xContent = createField( maFileNameService );
+ PropertySet aPropSet( xContent );
+ // FilenameDisplayFormat::PATH not supported by Calc
+ aPropSet.setProperty( PROP_FileFormat, ::com::sun::star::text::FilenameDisplayFormat::FULL );
+ appendField( xContent );
+ /* path only is not supported -- if we find a '&Z&F'
+ combination for path/name, skip the '&F' part */
+ if( (pcChar + 2 < pcEnd) && (pcChar[ 1 ] == '&') && ((pcChar[ 2 ] == 'f') || (pcChar[ 2 ] == 'F')) )
+ pcChar += 2;
+ }
+ break;
+ case 'D': // date
+ {
+ Reference< XTextContent > xContent = createField( maDateTimeService );
+ PropertySet aPropSet( xContent );
+ aPropSet.setProperty( PROP_IsDate, true );
+ appendField( xContent );
+ }
+ break;
+ case 'T': // time
+ {
+ Reference< XTextContent > xContent = createField( maDateTimeService );
+ PropertySet aPropSet( xContent );
+ aPropSet.setProperty( PROP_IsDate, false );
+ appendField( xContent );
+ }
+ break;
+
+ case 'B': // bold
+ setAttributes();
+ maFontModel.mbBold = !maFontModel.mbBold;
+ break;
+ case 'I': // italic
+ setAttributes();
+ maFontModel.mbItalic = !maFontModel.mbItalic;
+ break;
+ case 'U': // underline
+ setAttributes();
+ maFontModel.mnUnderline = (maFontModel.mnUnderline == XML_single) ? XML_none : XML_single;
+ break;
+ case 'E': // double underline
+ setAttributes();
+ maFontModel.mnUnderline = (maFontModel.mnUnderline == XML_double) ? XML_none : XML_double;
+ break;
+ case 'S': // strikeout
+ setAttributes();
+ maFontModel.mbStrikeout = !maFontModel.mbStrikeout;
+ break;
+ case 'X': // superscript
+ setAttributes();
+ maFontModel.mnEscapement = (maFontModel.mnEscapement == XML_superscript) ? XML_baseline : XML_superscript;
+ break;
+ case 'Y': // subsrcipt
+ setAttributes();
+ maFontModel.mnEscapement = (maFontModel.mnEscapement == XML_subscript) ? XML_baseline : XML_subscript;
+ break;
+ case 'O': // outlined
+ setAttributes();
+ maFontModel.mbOutline = !maFontModel.mbOutline;
+ break;
+ case 'H': // shadow
+ setAttributes();
+ maFontModel.mbShadow = !maFontModel.mbShadow;
+ break;
+
+ case 'K': // text color (not in BIFF)
+ if( (getFilterType() == FILTER_OOX) && (pcChar + 6 < pcEnd) )
+ {
+ setAttributes();
+ // eat the following 6 characters
+ convertFontColor( OUString( pcChar + 1, 6 ) );
+ pcChar += 6;
+ }
+ break;
+
+ case '\"': // font name
+ aFontName.setLength( 0 );
+ aFontStyle.setLength( 0 );
+ eState = STATE_FONTNAME;
+ break;
+ default:
+ if( ('0' <= cChar) && (cChar <= '9') ) // font size
+ {
+ nFontHeight = cChar - '0';
+ eState = STATE_FONTHEIGHT;
+ }
+ }
+ }
+ break;
+
+ case STATE_FONTNAME:
+ {
+ switch( cChar )
+ {
+ case '\"':
+ setAttributes();
+ convertFontName( aFontName.makeStringAndClear() );
+ eState = STATE_TEXT;
+ break;
+ case ',':
+ eState = STATE_FONTSTYLE;
+ break;
+ default:
+ aFontName.append( cChar );
+ }
+ }
+ break;
+
+ case STATE_FONTSTYLE:
+ {
+ switch( cChar )
+ {
+ case '\"':
+ setAttributes();
+ convertFontName( aFontName.makeStringAndClear() );
+ convertFontStyle( aFontStyle.makeStringAndClear() );
+ eState = STATE_TEXT;
+ break;
+ default:
+ aFontStyle.append( cChar );
+ }
+ }
+ break;
+
+ case STATE_FONTHEIGHT:
+ {
+ if( ('0' <= cChar) && (cChar <= '9') )
+ {
+ if( nFontHeight >= 0 )
+ {
+ nFontHeight *= 10;
+ nFontHeight += (cChar - '0');
+ if( nFontHeight > 1000 )
+ nFontHeight = -1;
+ }
+ }
+ else
+ {
+ if( nFontHeight > 0 )
+ {
+ setAttributes();
+ maFontModel.mfHeight = nFontHeight;
+ }
+ --pcChar;
+ eState = STATE_TEXT;
+ }
+ }
+ break;
+ }
+ }
+
+ // finalize
+ finalizePortion();
+ maPortions[ HF_LEFT ].mfTotalHeight += getCurrHeight( HF_LEFT );
+ maPortions[ HF_CENTER ].mfTotalHeight += getCurrHeight( HF_CENTER );
+ maPortions[ HF_RIGHT ].mfTotalHeight += getCurrHeight( HF_RIGHT );
+
+ return ::std::max( maPortions[ HF_LEFT ].mfTotalHeight,
+ ::std::max( maPortions[ HF_CENTER ].mfTotalHeight, maPortions[ HF_RIGHT ].mfTotalHeight ) );
+}
+
+// private --------------------------------------------------------------------
+
+double HeaderFooterParser::getCurrHeight( HFPortionId ePortion ) const
+{
+ double fMaxHt = maPortions[ ePortion ].mfCurrHeight;
+ return (fMaxHt == 0.0) ? maFontModel.mfHeight : fMaxHt;
+}
+
+double HeaderFooterParser::getCurrHeight() const
+{
+ return getCurrHeight( meCurrPortion );
+}
+
+void HeaderFooterParser::updateCurrHeight( HFPortionId ePortion )
+{
+ double& rfMaxHt = maPortions[ ePortion ].mfCurrHeight;
+ rfMaxHt = ::std::max( rfMaxHt, maFontModel.mfHeight );
+}
+
+void HeaderFooterParser::updateCurrHeight()
+{
+ updateCurrHeight( meCurrPortion );
+}
+
+void HeaderFooterParser::setAttributes()
+{
+ Reference< XTextRange > xRange( getStartPos(), UNO_QUERY );
+ getEndPos()->gotoRange( xRange, sal_False );
+ getEndPos()->gotoEnd( sal_True );
+ if( !getEndPos()->isCollapsed() )
+ {
+ Font aFont( *this, maFontModel );
+ aFont.finalizeImport();
+ PropertySet aPropSet( getEndPos() );
+ aFont.writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT );
+ getStartPos()->gotoEnd( sal_False );
+ getEndPos()->gotoEnd( sal_False );
+ }
+}
+
+void HeaderFooterParser::appendText()
+{
+ if( maBuffer.getLength() > 0 )
+ {
+ getEndPos()->gotoEnd( sal_False );
+ getEndPos()->setString( maBuffer.makeStringAndClear() );
+ updateCurrHeight();
+ }
+}
+
+void HeaderFooterParser::appendLineBreak()
+{
+ getEndPos()->gotoEnd( sal_False );
+ getEndPos()->setString( OUString( sal_Unicode( '\n' ) ) );
+ getPortion().mfTotalHeight += getCurrHeight();
+ getPortion().mfCurrHeight = 0;
+}
+
+Reference< XTextContent > HeaderFooterParser::createField( const OUString& rServiceName ) const
+{
+ Reference< XTextContent > xContent;
+ try
+ {
+ Reference< XMultiServiceFactory > xFactory( getDocument(), UNO_QUERY_THROW );
+ xContent.set( xFactory->createInstance( rServiceName ), UNO_QUERY_THROW );
+ }
+ catch( Exception& )
+ {
+ OSL_ENSURE( false,
+ OStringBuffer( "HeaderFooterParser::createField - error while creating text field \"" ).
+ append( OUStringToOString( rServiceName, RTL_TEXTENCODING_ASCII_US ) ).
+ append( '"' ).getStr() );
+ }
+ return xContent;
+}
+
+void HeaderFooterParser::appendField( const Reference< XTextContent >& rxContent )
+{
+ getEndPos()->gotoEnd( sal_False );
+ try
+ {
+ Reference< XTextRange > xRange( getEndPos(), UNO_QUERY_THROW );
+ getPortion().mxText->insertTextContent( xRange, rxContent, sal_False );
+ updateCurrHeight();
+ }
+ catch( Exception& )
+ {
+ }
+}
+
+void HeaderFooterParser::convertFontName( const OUString& rName )
+{
+ if( rName.getLength() > 0 )
+ {
+ // single dash is document default font
+ if( (rName.getLength() == 1) && (rName[ 0 ] == '-') )
+ maFontModel.maName = getStyles().getDefaultFontModel().maName;
+ else
+ maFontModel.maName = rName;
+ }
+}
+
+void HeaderFooterParser::convertFontStyle( const OUString& rStyle )
+{
+ maFontModel.mbBold = maFontModel.mbItalic = false;
+ sal_Int32 nPos = 0;
+ sal_Int32 nLen = rStyle.getLength();
+ while( (0 <= nPos) && (nPos < nLen) )
+ {
+ OString aToken = OUStringToOString( rStyle.getToken( 0, ' ', nPos ), RTL_TEXTENCODING_UTF8 ).toAsciiLowerCase();
+ if( aToken.getLength() > 0 )
+ {
+ if( maBoldNames.count( aToken ) > 0 )
+ maFontModel.mbBold = true;
+ else if( maItalicNames.count( aToken ) > 0 )
+ maFontModel.mbItalic = true;
+ }
+ }
+}
+
+void HeaderFooterParser::convertFontColor( const OUString& rColor )
+{
+ OSL_ENSURE( rColor.getLength() == 6, "HeaderFooterParser::convertFontColor - invalid font color code" );
+ if( (rColor[ 2 ] == '+') || (rColor[ 2 ] == '-') )
+ // theme color: TTSNNN (TT = decimal theme index, S = +/-, NNN = decimal tint/shade in percent)
+ maFontModel.maColor.setTheme(
+ rColor.copy( 0, 2 ).toInt32(),
+ static_cast< double >( rColor.copy( 2 ).toInt32() ) / 100.0 );
+ else
+ // RGB color: RRGGBB
+ maFontModel.maColor.setRgb( rColor.toInt32( 16 ) );
+}
+
+void HeaderFooterParser::finalizePortion()
+{
+ appendText();
+ setAttributes();
+}
+
+void HeaderFooterParser::setNewPortion( HFPortionId ePortion )
+{
+ if( ePortion != meCurrPortion )
+ {
+ finalizePortion();
+ meCurrPortion = ePortion;
+ maFontModel = getStyles().getDefaultFontModel();
+ }
+}
+
+// ============================================================================
+
+namespace {
+
/** Paper size in 1/100 millimeters. */
struct ApiPaperSize
{
@@ -544,9 +1076,9 @@ static const ApiPaperSize spPaperSizeTable[] =
// ----------------------------------------------------------------------------
-PageSettingsPropertyHelper::HFHelperData::HFHelperData( const OUString& rLeftProp, const OUString& rRightProp ) :
- maLeftProp( rLeftProp ),
- maRightProp( rRightProp ),
+PageSettingsConverter::HFHelperData::HFHelperData( sal_Int32 nLeftPropId, sal_Int32 nRightPropId ) :
+ mnLeftPropId( nLeftPropId ),
+ mnRightPropId( nRightPropId ),
mnHeight( 0 ),
mnBodyDist( 0 ),
mbHasContent( false ),
@@ -557,18 +1089,20 @@ PageSettingsPropertyHelper::HFHelperData::HFHelperData( const OUString& rLeftPro
// ----------------------------------------------------------------------------
-PageSettingsPropertyHelper::PageSettingsPropertyHelper( const WorkbookHelper& rHelper ) :
+PageSettingsConverter::PageSettingsConverter( const WorkbookHelper& rHelper ) :
WorkbookHelper( rHelper ),
- maHFParser( rHelper ),
- maPageProps( sppcPageNames ),
- maGraphicProps( sppcGraphicNames ),
- maHeaderData( CREATE_OUSTRING( "LeftPageHeaderContent" ), CREATE_OUSTRING( "RightPageHeaderContent" ) ),
- maFooterData( CREATE_OUSTRING( "LeftPageFooterContent" ), CREATE_OUSTRING( "RightPageFooterContent" ) )
+ mxHFParser( new HeaderFooterParser( rHelper ) ),
+ maHeaderData( PROP_LeftPageHeaderContent, PROP_RightPageHeaderContent ),
+ maFooterData( PROP_LeftPageFooterContent, PROP_RightPageFooterContent )
{
}
-void PageSettingsPropertyHelper::writePageSettingsProperties(
- PropertySet& rPropSet, const OoxPageData& rData, WorksheetType eSheetType )
+PageSettingsConverter::~PageSettingsConverter()
+{
+}
+
+void PageSettingsConverter::writePageSettingsProperties(
+ PropertySet& rPropSet, const PageSettingsModel& rModel, WorksheetType eSheetType )
{
// special handling for chart sheets
bool bChartSheet = eSheetType == SHEETTYPE_CHARTSHEET;
@@ -577,133 +1111,136 @@ void PageSettingsPropertyHelper::writePageSettingsProperties(
if( bChartSheet )
{
// always fit chart sheet to 1 page
- rPropSet.setProperty< sal_Int16 >( CREATE_OUSTRING( "ScaleToPages" ), 1 );
+ rPropSet.setProperty< sal_Int16 >( PROP_ScaleToPages, 1 );
}
- else if( rData.mbFitToPages )
+ else if( rModel.mbFitToPages )
{
// fit to number of pages
- rPropSet.setProperty( CREATE_OUSTRING( "ScaleToPagesX" ), getLimitedValue< sal_Int16, sal_Int32 >( rData.mnFitToWidth, 0, 1000 ) );
- rPropSet.setProperty( CREATE_OUSTRING( "ScaleToPagesY" ), getLimitedValue< sal_Int16, sal_Int32 >( rData.mnFitToHeight, 0, 1000 ) );
+ rPropSet.setProperty( PROP_ScaleToPagesX, getLimitedValue< sal_Int16, sal_Int32 >( rModel.mnFitToWidth, 0, 1000 ) );
+ rPropSet.setProperty( PROP_ScaleToPagesY, getLimitedValue< sal_Int16, sal_Int32 >( rModel.mnFitToHeight, 0, 1000 ) );
}
else
{
// scale may be 0 which indicates uninitialized
- sal_Int16 nScale = (rData.mbValidSettings && (rData.mnScale > 0)) ? getLimitedValue< sal_Int16, sal_Int32 >( rData.mnScale, 10, 400 ) : 100;
- rPropSet.setProperty( CREATE_OUSTRING( "PageScale" ), nScale );
+ sal_Int16 nScale = (rModel.mbValidSettings && (rModel.mnScale > 0)) ? getLimitedValue< sal_Int16, sal_Int32 >( rModel.mnScale, 10, 400 ) : 100;
+ rPropSet.setProperty( PROP_PageScale, nScale );
}
// paper orientation
- bool bLandscape = rData.mnOrientation == XML_landscape;
+ bool bLandscape = rModel.mnOrientation == XML_landscape;
// default orientation for current sheet type (chart sheets default to landscape)
- if( !rData.mbValidSettings || (rData.mnOrientation == XML_default) )
+ if( !rModel.mbValidSettings || (rModel.mnOrientation == XML_default) )
bLandscape = bChartSheet;
// paper size
- if( rData.mbValidSettings && (0 < rData.mnPaperSize) && (rData.mnPaperSize < static_cast< sal_Int32 >( STATIC_ARRAY_SIZE( spPaperSizeTable ) )) )
+ if( rModel.mbValidSettings && (0 < rModel.mnPaperSize) && (rModel.mnPaperSize < static_cast< sal_Int32 >( STATIC_ARRAY_SIZE( spPaperSizeTable ) )) )
{
- const ApiPaperSize& rPaperSize = spPaperSizeTable[ rData.mnPaperSize ];
+ const ApiPaperSize& rPaperSize = spPaperSizeTable[ rModel.mnPaperSize ];
Size aSize( rPaperSize.mnWidth, rPaperSize.mnHeight );
if( bLandscape )
::std::swap( aSize.Width, aSize.Height );
- rPropSet.setProperty( CREATE_OUSTRING( "Size" ), aSize );
+ rPropSet.setProperty( PROP_Size, aSize );
}
// header/footer
- convertHeaderFooterData( rPropSet, maHeaderData, rData.maOddHeader, rData.maEvenHeader, rData.mbUseEvenHF, rData.mfTopMargin, rData.mfHeaderMargin );
- convertHeaderFooterData( rPropSet, maFooterData, rData.maOddFooter, rData.maEvenFooter, rData.mbUseEvenHF, rData.mfBottomMargin, rData.mfFooterMargin );
+ convertHeaderFooterData( rPropSet, maHeaderData, rModel.maOddHeader, rModel.maEvenHeader, rModel.mbUseEvenHF, rModel.mfTopMargin, rModel.mfHeaderMargin );
+ convertHeaderFooterData( rPropSet, maFooterData, rModel.maOddFooter, rModel.maEvenFooter, rModel.mbUseEvenHF, rModel.mfBottomMargin, rModel.mfFooterMargin );
// write all properties to property set
const UnitConverter& rUnitConv = getUnitConverter();
- maPageProps
- << bLandscape
- << getLimitedValue< sal_Int16, sal_Int32 >( rData.mbUseFirstPage ? rData.mnFirstPage : 0, 0, 9999 )
- << (rData.mnPageOrder == XML_downThenOver)
- << (rData.mnCellComments == XML_asDisplayed)
- << rData.mbHorCenter
- << rData.mbVerCenter
- << (!bChartSheet && rData.mbPrintGrid) // no gridlines in chart sheets
- << (!bChartSheet && rData.mbPrintHeadings) // no column/row headings in chart sheets
- << rUnitConv.scaleToMm100( rData.mfLeftMargin, UNIT_INCH )
- << rUnitConv.scaleToMm100( rData.mfRightMargin, UNIT_INCH )
- // #i23296# In Calc, "TopMargin" property is distance to top of header if enabled
- << rUnitConv.scaleToMm100( maHeaderData.mbHasContent ? rData.mfHeaderMargin : rData.mfTopMargin, UNIT_INCH )
- // #i23296# In Calc, "BottomMargin" property is distance to bottom of footer if enabled
- << rUnitConv.scaleToMm100( maFooterData.mbHasContent ? rData.mfFooterMargin : rData.mfBottomMargin, UNIT_INCH )
- << maHeaderData.mbHasContent
- << maHeaderData.mbShareOddEven
- << maHeaderData.mbDynamicHeight
- << maHeaderData.mnHeight
- << maHeaderData.mnBodyDist
- << maFooterData.mbHasContent
- << maFooterData.mbShareOddEven
- << maFooterData.mbDynamicHeight
- << maFooterData.mnHeight
- << maFooterData.mnBodyDist
- >> rPropSet;
+ PropertyMap aPropMap;
+ aPropMap[ PROP_IsLandscape ] <<= bLandscape;
+ aPropMap[ PROP_FirstPageNumber ] <<= getLimitedValue< sal_Int16, sal_Int32 >( rModel.mbUseFirstPage ? rModel.mnFirstPage : 0, 0, 9999 );
+ aPropMap[ PROP_PrintDownFirst ] <<= (rModel.mnPageOrder == XML_downThenOver);
+ aPropMap[ PROP_PrintAnnotations ] <<= (rModel.mnCellComments == XML_asDisplayed);
+ aPropMap[ PROP_CenterHorizontally ] <<= rModel.mbHorCenter;
+ aPropMap[ PROP_CenterVertically ] <<= rModel.mbVerCenter;
+ aPropMap[ PROP_PrintGrid ] <<= (!bChartSheet && rModel.mbPrintGrid); // no gridlines in chart sheets
+ aPropMap[ PROP_PrintHeaders ] <<= (!bChartSheet && rModel.mbPrintHeadings); // no column/row headings in chart sheets
+ aPropMap[ PROP_LeftMargin ] <<= rUnitConv.scaleToMm100( rModel.mfLeftMargin, UNIT_INCH );
+ aPropMap[ PROP_RightMargin ] <<= rUnitConv.scaleToMm100( rModel.mfRightMargin, UNIT_INCH );
+ // #i23296# In Calc, "TopMargin" property is distance to top of header if enabled
+ aPropMap[ PROP_TopMargin ] <<= rUnitConv.scaleToMm100( maHeaderData.mbHasContent ? rModel.mfHeaderMargin : rModel.mfTopMargin, UNIT_INCH );
+ // #i23296# In Calc, "BottomMargin" property is distance to bottom of footer if enabled
+ aPropMap[ PROP_BottomMargin ] <<= rUnitConv.scaleToMm100( maFooterData.mbHasContent ? rModel.mfFooterMargin : rModel.mfBottomMargin, UNIT_INCH );
+ aPropMap[ PROP_HeaderIsOn ] <<= maHeaderData.mbHasContent;
+ aPropMap[ PROP_HeaderIsShared ] <<= maHeaderData.mbShareOddEven;
+ aPropMap[ PROP_HeaderIsDynamicHeight ] <<= maHeaderData.mbDynamicHeight;
+ aPropMap[ PROP_HeaderHeight ] <<= maHeaderData.mnHeight;
+ aPropMap[ PROP_HeaderBodyDistance ] <<= maHeaderData.mnBodyDist;
+ aPropMap[ PROP_FooterIsOn ] <<= maFooterData.mbHasContent;
+ aPropMap[ PROP_FooterIsShared ] <<= maFooterData.mbShareOddEven;
+ aPropMap[ PROP_FooterIsDynamicHeight ] <<= maFooterData.mbDynamicHeight;
+ aPropMap[ PROP_FooterHeight ] <<= maFooterData.mnHeight;
+ aPropMap[ PROP_FooterBodyDistance ] <<= maFooterData.mnBodyDist;
+ rPropSet.setProperties( aPropMap );
// background image
- OSL_ENSURE( (getFilterType() == FILTER_OOX) || (rData.maPicturePath.getLength() == 0),
- "PageSettingsPropertyHelper::writePageSettingsProperties - unexpected background picture" );
- if( (getFilterType() == FILTER_OOX) && (rData.maPicturePath.getLength() > 0) )
+ OSL_ENSURE( (getFilterType() == FILTER_OOX) || (rModel.maPicturePath.getLength() == 0),
+ "PageSettingsConverter::writePageSettingsProperties - unexpected background picture" );
+ if( (getFilterType() == FILTER_OOX) && (rModel.maPicturePath.getLength() > 0) )
{
- OUString aPictureUrl = getOoxFilter().copyPictureStream( rData.maPicturePath );
+ OUString aPictureUrl = getOoxFilter().copyPictureStream( rModel.maPicturePath );
if( aPictureUrl.getLength() > 0 )
- maGraphicProps << aPictureUrl << ::com::sun::star::style::GraphicLocation_TILED >> rPropSet;
+ {
+ rPropSet.setProperty( PROP_BackGraphicURL, aPictureUrl );
+ rPropSet.setProperty( PROP_BackGraphicLocation, ::com::sun::star::style::GraphicLocation_TILED );
+ }
}
}
-void PageSettingsPropertyHelper::convertHeaderFooterData(
- PropertySet& rPropSet, HFHelperData& rHFData,
+void PageSettingsConverter::convertHeaderFooterData(
+ PropertySet& rPropSet, HFHelperData& orHFData,
const OUString rOddContent, const OUString rEvenContent, bool bUseEvenContent,
double fPageMargin, double fContentMargin )
{
bool bHasOddContent = rOddContent.getLength() > 0;
bool bHasEvenContent = bUseEvenContent && (rEvenContent.getLength() > 0);
- sal_Int32 nOddHeight = bHasOddContent ? writeHeaderFooter( rPropSet, rHFData.maRightProp, rOddContent ) : 0;
- sal_Int32 nEvenHeight = bHasEvenContent ? writeHeaderFooter( rPropSet, rHFData.maLeftProp, rEvenContent ) : 0;
+ sal_Int32 nOddHeight = bHasOddContent ? writeHeaderFooter( rPropSet, orHFData.mnRightPropId, rOddContent ) : 0;
+ sal_Int32 nEvenHeight = bHasEvenContent ? writeHeaderFooter( rPropSet, orHFData.mnLeftPropId, rEvenContent ) : 0;
- rHFData.mnHeight = 750;
- rHFData.mnBodyDist = 250;
- rHFData.mbHasContent = bHasOddContent || bHasEvenContent;
- rHFData.mbShareOddEven = !bUseEvenContent;
- rHFData.mbDynamicHeight = true;
+ orHFData.mnHeight = 750;
+ orHFData.mnBodyDist = 250;
+ orHFData.mbHasContent = bHasOddContent || bHasEvenContent;
+ orHFData.mbShareOddEven = !bUseEvenContent;
+ orHFData.mbDynamicHeight = true;
- if( rHFData.mbHasContent )
+ if( orHFData.mbHasContent )
{
// use maximum height of odd/even header/footer
- rHFData.mnHeight = ::std::max( nOddHeight, nEvenHeight );
+ orHFData.mnHeight = ::std::max( nOddHeight, nEvenHeight );
/* Calc contains distance between bottom of header and top of page
body in "HeaderBodyDistance" property, and distance between bottom
of page body and top of footer in "FooterBodyDistance" property */
- rHFData.mnBodyDist = getUnitConverter().scaleToMm100( fPageMargin - fContentMargin, UNIT_INCH ) - rHFData.mnHeight;
+ orHFData.mnBodyDist = getUnitConverter().scaleToMm100( fPageMargin - fContentMargin, UNIT_INCH ) - orHFData.mnHeight;
/* #i23296# Distance less than 0 means, header or footer overlays page
body. As this is not possible in Calc, set fixed header or footer
height (crop header/footer) to get correct top position of page body. */
- rHFData.mbDynamicHeight = rHFData.mnBodyDist >= 0;
+ orHFData.mbDynamicHeight = orHFData.mnBodyDist >= 0;
/* "HeaderHeight" property is in fact distance from top of header to
top of page body (including "HeaderBodyDistance").
"FooterHeight" property is in fact distance from bottom of page
body to bottom of footer (including "FooterBodyDistance"). */
- rHFData.mnHeight += rHFData.mnBodyDist;
+ orHFData.mnHeight += orHFData.mnBodyDist;
// negative body distance not allowed
- rHFData.mnBodyDist = ::std::max< sal_Int32 >( rHFData.mnBodyDist, 0 );
+ orHFData.mnBodyDist = ::std::max< sal_Int32 >( orHFData.mnBodyDist, 0 );
}
}
-sal_Int32 PageSettingsPropertyHelper::writeHeaderFooter(
- PropertySet& rPropSet, const OUString& rPropName, const OUString& rContent )
+sal_Int32 PageSettingsConverter::writeHeaderFooter(
+ PropertySet& rPropSet, sal_Int32 nPropId, const OUString& rContent )
{
- OSL_ENSURE( rContent.getLength() > 0, "PageSettingsPropertyHelper::writeHeaderFooter - empty h/f string found" );
+ OSL_ENSURE( rContent.getLength() > 0, "PageSettingsConverter::writeHeaderFooter - empty h/f string found" );
sal_Int32 nHeight = 0;
if( rContent.getLength() > 0 )
{
Reference< XHeaderFooterContent > xHFContent;
- if( rPropSet.getProperty( xHFContent, rPropName ) && xHFContent.is() )
+ if( rPropSet.getProperty( xHFContent, nPropId ) && xHFContent.is() )
{
- maHFParser.parse( xHFContent, rContent );
- rPropSet.setProperty( rPropName, xHFContent );
- nHeight = getUnitConverter().scaleToMm100( maHFParser.getTotalHeight(), UNIT_POINT );
+ double fTotalHeight = mxHFParser->parse( xHFContent, rContent );
+ rPropSet.setProperty( nPropId, xHFContent );
+ nHeight = getUnitConverter().scaleToMm100( fTotalHeight, UNIT_POINT );
}
}
return nHeight;
diff --git a/oox/source/xls/pivotcachebuffer.cxx b/oox/source/xls/pivotcachebuffer.cxx
new file mode 100644
index 000000000000..2639126bb4af
--- /dev/null
+++ b/oox/source/xls/pivotcachebuffer.cxx
@@ -0,0 +1,1551 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: pivottablebuffer.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/xls/pivotcachebuffer.hxx"
+#include <set>
+#include <rtl/ustrbuf.hxx>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/sheet/DataPilotFieldGroupBy.hpp>
+#include <com/sun/star/sheet/DataPilotFieldGroupInfo.hpp>
+#include <com/sun/star/sheet/XDataPilotFieldGrouping.hpp>
+#include "properties.hxx"
+#include "oox/helper/attributelist.hxx"
+#include "oox/helper/propertyset.hxx"
+#include "oox/helper/recordinputstream.hxx"
+#include "oox/core/filterbase.hxx"
+#include "oox/xls/biffinputstream.hxx"
+#include "oox/xls/defnamesbuffer.hxx"
+#include "oox/xls/excelhandlers.hxx"
+#include "oox/xls/pivotcachefragment.hxx"
+#include "oox/xls/tablebuffer.hxx"
+#include "oox/xls/unitconverter.hxx"
+#include "oox/xls/worksheetbuffer.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::container::XIndexAccess;
+using ::com::sun::star::container::XNameAccess;
+using ::com::sun::star::container::XNamed;
+using ::com::sun::star::util::DateTime;
+using ::com::sun::star::table::CellAddress;
+using ::com::sun::star::sheet::DataPilotFieldGroupInfo;
+using ::com::sun::star::table::XCell;
+using ::com::sun::star::sheet::XDataPilotField;
+using ::com::sun::star::sheet::XDataPilotFieldGrouping;
+using ::oox::core::Relations;
+
+namespace oox {
+namespace xls {
+
+// ============================================================================
+
+namespace {
+
+const sal_uInt16 OOBIN_PCDFIELD_SERVERFIELD = 0x0001;
+const sal_uInt16 OOBIN_PCDFIELD_NOUNIQUEITEMS = 0x0002;
+const sal_uInt16 OOBIN_PCDFIELD_DATABASEFIELD = 0x0004;
+const sal_uInt16 OOBIN_PCDFIELD_HASCAPTION = 0x0008;
+const sal_uInt16 OOBIN_PCDFIELD_MEMBERPROPFIELD = 0x0010;
+const sal_uInt16 OOBIN_PCDFIELD_HASFORMULA = 0x0100;
+const sal_uInt16 OOBIN_PCDFIELD_HASPROPERTYNAME = 0x0200;
+
+const sal_uInt16 OOBIN_PCDFSITEMS_HASSEMIMIXED = 0x0001;
+const sal_uInt16 OOBIN_PCDFSITEMS_HASNONDATE = 0x0002;
+const sal_uInt16 OOBIN_PCDFSITEMS_HASDATE = 0x0004;
+const sal_uInt16 OOBIN_PCDFSITEMS_HASSTRING = 0x0008;
+const sal_uInt16 OOBIN_PCDFSITEMS_HASBLANK = 0x0010;
+const sal_uInt16 OOBIN_PCDFSITEMS_HASMIXED = 0x0020;
+const sal_uInt16 OOBIN_PCDFSITEMS_ISNUMERIC = 0x0040;
+const sal_uInt16 OOBIN_PCDFSITEMS_ISINTEGER = 0x0080;
+const sal_uInt16 OOBIN_PCDFSITEMS_HASMINMAX = 0x0100;
+const sal_uInt16 OOBIN_PCDFSITEMS_HASLONGTEXT = 0x0200;
+
+const sal_uInt16 OOBIN_PCITEM_ARRAY_DOUBLE = 0x0001;
+const sal_uInt16 OOBIN_PCITEM_ARRAY_STRING = 0x0002;
+const sal_uInt16 OOBIN_PCITEM_ARRAY_ERROR = 0x0010;
+const sal_uInt16 OOBIN_PCITEM_ARRAY_DATE = 0x0020;
+
+const sal_uInt8 OOBIN_PCDFRANGEPR_AUTOSTART = 0x01;
+const sal_uInt8 OOBIN_PCDFRANGEPR_AUTOEND = 0x02;
+const sal_uInt8 OOBIN_PCDFRANGEPR_DATEGROUP = 0x04;
+
+const sal_uInt8 OOBIN_PCDEFINITION_SAVEDATA = 0x01;
+const sal_uInt8 OOBIN_PCDEFINITION_INVALID = 0x02;
+const sal_uInt8 OOBIN_PCDEFINITION_REFRESHONLOAD = 0x04;
+const sal_uInt8 OOBIN_PCDEFINITION_OPTIMIZEMEMORY = 0x08;
+const sal_uInt8 OOBIN_PCDEFINITION_ENABLEREFRESH = 0x10;
+const sal_uInt8 OOBIN_PCDEFINITION_BACKGROUNDQUERY = 0x20;
+const sal_uInt8 OOBIN_PCDEFINITION_UPGRADEONREFR = 0x40;
+const sal_uInt8 OOBIN_PCDEFINITION_TUPELCACHE = 0x80;
+
+const sal_uInt8 OOBIN_PCDEFINITION_HASUSERNAME = 0x01;
+const sal_uInt8 OOBIN_PCDEFINITION_HASRELID = 0x02;
+const sal_uInt8 OOBIN_PCDEFINITION_SUPPORTSUBQUERY = 0x04;
+const sal_uInt8 OOBIN_PCDEFINITION_SUPPORTDRILL = 0x08;
+
+const sal_uInt8 OOBIN_PCDWBSOURCE_HASRELID = 0x01;
+const sal_uInt8 OOBIN_PCDWBSOURCE_HASSHEET = 0x02;
+
+const sal_uInt16 BIFF_PCDSOURCE_WORKSHEET = 0x0001;
+const sal_uInt16 BIFF_PCDSOURCE_EXTERNAL = 0x0002;
+const sal_uInt16 BIFF_PCDSOURCE_CONSOLIDATION = 0x0004;
+const sal_uInt16 BIFF_PCDSOURCE_SCENARIO = 0x0010;
+
+const sal_uInt16 BIFF_PC_NOSTRING = 0xFFFF;
+
+const sal_uInt16 BIFF_PCDFIELD_HASITEMS = 0x0001;
+const sal_uInt16 BIFF_PCDFIELD_HASUNSHAREDITEMS = 0x0002;
+const sal_uInt16 BIFF_PCDFIELD_CALCULATED = 0x0004;
+const sal_uInt16 BIFF_PCDFIELD_HASPARENT = 0x0008;
+const sal_uInt16 BIFF_PCDFIELD_RANGEGROUP = 0x0010;
+const sal_uInt16 BIFF_PCDFIELD_ISNUMERIC = 0x0020;
+const sal_uInt16 BIFF_PCDFIELD_HASSEMIMIXED = 0x0080;
+const sal_uInt16 BIFF_PCDFIELD_HASMINMAX = 0x0100;
+const sal_uInt16 BIFF_PCDFIELD_HASLONGINDEX = 0x0200;
+const sal_uInt16 BIFF_PCDFIELD_HASNONDATE = 0x0400;
+const sal_uInt16 BIFF_PCDFIELD_HASDATE = 0x0800;
+const sal_uInt16 BIFF_PCDFIELD_SERVERFIELD = 0x2000;
+const sal_uInt16 BIFF_PCDFIELD_NOUNIQUEITEMS = 0x4000;
+
+const sal_uInt16 BIFF_PCDFRANGEPR_AUTOSTART = 0x0001;
+const sal_uInt16 BIFF_PCDFRANGEPR_AUTOEND = 0x0002;
+
+const sal_uInt16 BIFF_PCDEFINITION_SAVEDATA = 0x0001;
+const sal_uInt16 BIFF_PCDEFINITION_INVALID = 0x0002;
+const sal_uInt16 BIFF_PCDEFINITION_REFRESHONLOAD = 0x0004;
+const sal_uInt16 BIFF_PCDEFINITION_OPTIMIZEMEMORY = 0x0008;
+const sal_uInt16 BIFF_PCDEFINITION_BACKGROUNDQUERY = 0x0010;
+const sal_uInt16 BIFF_PCDEFINITION_ENABLEREFRESH = 0x0020;
+
+// ----------------------------------------------------------------------------
+
+/** Adjusts the weird date format read from binary streams.
+
+ Dates before 1900-Mar-01 are stored including the non-existing leap day
+ 1900-02-29. Time values (without date) are stored as times of day
+ 1900-Jan-00. Nothing has to be done when the workbook is stored in 1904
+ date mode (dates before 1904-Jan-01 will not occur in this case).
+ */
+void lclAdjustBinDateTime( DateTime& orDateTime )
+{
+ if( (orDateTime.Year == 1900) && (orDateTime.Month <= 2) )
+ {
+ OSL_ENSURE( (orDateTime.Month == 1) || ((orDateTime.Month == 2) && (orDateTime.Day > 0)), "lclAdjustBinDateTime - invalid date" );
+ switch( orDateTime.Month )
+ {
+ case 2: if( orDateTime.Day > 1 ) --orDateTime.Day; else { orDateTime.Day += 30; --orDateTime.Month; } break;
+ case 1: if( orDateTime.Day > 1 ) --orDateTime.Day; else { orDateTime.Day += 30; orDateTime.Month = 12; --orDateTime.Year; } break;
+ }
+ }
+}
+
+} // namespace
+
+// ============================================================================
+
+PivotCacheItem::PivotCacheItem() :
+ mnType( XML_m )
+{
+}
+
+void PivotCacheItem::readString( const AttributeList& rAttribs )
+{
+ maValue <<= rAttribs.getString( XML_v, OUString() );
+ mnType = XML_s;
+}
+
+void PivotCacheItem::readNumeric( const AttributeList& rAttribs )
+{
+ maValue <<= rAttribs.getDouble( XML_v, 0.0 );
+ mnType = XML_n;
+}
+
+void PivotCacheItem::readDate( const AttributeList& rAttribs )
+{
+ maValue <<= rAttribs.getDateTime( XML_v, DateTime() );
+ mnType = XML_d;
+}
+
+void PivotCacheItem::readBool( const AttributeList& rAttribs )
+{
+ maValue <<= rAttribs.getBool( XML_v, false );
+ mnType = XML_b;
+}
+
+void PivotCacheItem::readError( const AttributeList& rAttribs, const UnitConverter& rUnitConverter )
+{
+ maValue <<= static_cast< sal_Int32 >( rUnitConverter.calcBiffErrorCode( rAttribs.getString( XML_v, OUString() ) ) );
+ mnType = XML_e;
+}
+
+void PivotCacheItem::readIndex( const AttributeList& rAttribs )
+{
+ maValue <<= rAttribs.getInteger( XML_v, -1 );
+ mnType = XML_x;
+}
+
+void PivotCacheItem::readString( RecordInputStream& rStrm )
+{
+ maValue <<= rStrm.readString();
+ mnType = XML_s;
+}
+
+void PivotCacheItem::readDouble( RecordInputStream& rStrm )
+{
+ maValue <<= rStrm.readDouble();
+ mnType = XML_n;
+}
+
+void PivotCacheItem::readDate( RecordInputStream& rStrm )
+{
+ DateTime aDateTime;
+ aDateTime.Year = rStrm.readuInt16();
+ aDateTime.Month = rStrm.readuInt16();
+ aDateTime.Day = rStrm.readuInt8();
+ aDateTime.Hours = rStrm.readuInt8();
+ aDateTime.Minutes = rStrm.readuInt8();
+ aDateTime.Seconds = rStrm.readuInt8();
+ lclAdjustBinDateTime( aDateTime );
+ maValue <<= aDateTime;
+ mnType = XML_d;
+}
+
+void PivotCacheItem::readBool( RecordInputStream& rStrm )
+{
+ maValue <<= (rStrm.readuInt8() != 0);
+ mnType = XML_b;
+}
+
+void PivotCacheItem::readError( RecordInputStream& rStrm )
+{
+ maValue <<= static_cast< sal_Int32 >( rStrm.readuInt8() );
+ mnType = XML_e;
+}
+
+void PivotCacheItem::readIndex( RecordInputStream& rStrm )
+{
+ maValue <<= rStrm.readInt32();
+ mnType = XML_x;
+}
+
+void PivotCacheItem::readString( BiffInputStream& rStrm, const WorkbookHelper& rHelper )
+{
+ maValue <<= (rHelper.getBiff() == BIFF8) ? rStrm.readUniString() : rStrm.readByteString( true, rHelper.getTextEncoding() );
+ mnType = XML_s;
+}
+
+void PivotCacheItem::readDouble( BiffInputStream& rStrm )
+{
+ maValue <<= rStrm.readDouble();
+ mnType = XML_n;
+}
+
+void PivotCacheItem::readInteger( BiffInputStream& rStrm )
+{
+ maValue <<= rStrm.readInt16();
+ mnType = XML_i; // fake, used for BIFF only
+}
+
+void PivotCacheItem::readDate( BiffInputStream& rStrm )
+{
+ DateTime aDateTime;
+ aDateTime.Year = rStrm.readuInt16();
+ aDateTime.Month = rStrm.readuInt16();
+ aDateTime.Day = rStrm.readuInt8();
+ aDateTime.Hours = rStrm.readuInt8();
+ aDateTime.Minutes = rStrm.readuInt8();
+ aDateTime.Seconds = rStrm.readuInt8();
+ lclAdjustBinDateTime( aDateTime );
+ maValue <<= aDateTime;
+ mnType = XML_d;
+}
+
+void PivotCacheItem::readBool( BiffInputStream& rStrm )
+{
+ maValue <<= (rStrm.readuInt8() != 0);
+ mnType = XML_b;
+}
+
+void PivotCacheItem::readError( BiffInputStream& rStrm )
+{
+ maValue <<= static_cast< sal_Int32 >( rStrm.readuInt8() );
+ mnType = XML_e;
+}
+
+OUString PivotCacheItem::getName() const
+{
+ switch( mnType )
+ {
+ case XML_m: return OUString();
+ case XML_s: return maValue.get< OUString >();
+ case XML_n: return OUString::valueOf( maValue.get< double >() ); // !TODO
+ case XML_i: return OUString::valueOf( maValue.get< sal_Int32 >() );
+ case XML_d: return OUString(); // !TODO
+ case XML_b: return OUString::valueOf( static_cast< sal_Bool >( maValue.get< bool >() ) ); // !TODO
+ case XML_e: return OUString(); // !TODO
+ }
+ OSL_ENSURE( false, "PivotCacheItem::getName - invalid data type" );
+ return OUString();
+}
+
+// ----------------------------------------------------------------------------
+
+PivotCacheItemList::PivotCacheItemList( const WorkbookHelper& rHelper ) :
+ WorkbookHelper( rHelper )
+{
+}
+
+void PivotCacheItemList::importItem( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ PivotCacheItem& rItem = createItem();
+ switch( nElement )
+ {
+ case XLS_TOKEN( m ): break;
+ case XLS_TOKEN( s ): rItem.readString( rAttribs ); break;
+ case XLS_TOKEN( n ): rItem.readNumeric( rAttribs ); break;
+ case XLS_TOKEN( d ): rItem.readDate( rAttribs ); break;
+ case XLS_TOKEN( b ): rItem.readBool( rAttribs ); break;
+ case XLS_TOKEN( e ): rItem.readError( rAttribs, getUnitConverter() ); break;
+ default: OSL_ENSURE( false, "PivotCacheItemList::importItem - unknown element type" );
+ }
+}
+
+void PivotCacheItemList::importItem( sal_Int32 nRecId, RecordInputStream& rStrm )
+{
+ if( nRecId == OOBIN_ID_PCITEM_ARRAY )
+ {
+ importArray( rStrm );
+ return;
+ }
+
+ PivotCacheItem& rItem = createItem();
+ switch( nRecId )
+ {
+ case OOBIN_ID_PCITEM_MISSING:
+ case OOBIN_ID_PCITEMA_MISSING: break;
+ case OOBIN_ID_PCITEM_STRING:
+ case OOBIN_ID_PCITEMA_STRING: rItem.readString( rStrm ); break;
+ case OOBIN_ID_PCITEM_DOUBLE:
+ case OOBIN_ID_PCITEMA_DOUBLE: rItem.readDouble( rStrm ); break;
+ case OOBIN_ID_PCITEM_DATE:
+ case OOBIN_ID_PCITEMA_DATE: rItem.readDate( rStrm ); break;
+ case OOBIN_ID_PCITEM_BOOL:
+ case OOBIN_ID_PCITEMA_BOOL: rItem.readBool( rStrm ); break;
+ case OOBIN_ID_PCITEM_ERROR:
+ case OOBIN_ID_PCITEMA_ERROR: rItem.readError( rStrm ); break;
+ default: OSL_ENSURE( false, "PivotCacheItemList::importItem - unknown record type" );
+ }
+}
+
+void PivotCacheItemList::importItemList( BiffInputStream& rStrm, sal_uInt16 nCount )
+{
+ bool bLoop = true;
+ for( sal_uInt16 nItemIdx = 0; bLoop && (nItemIdx < nCount); ++nItemIdx )
+ {
+ bLoop = rStrm.startNextRecord();
+ if( bLoop ) switch( rStrm.getRecId() )
+ {
+ case BIFF_ID_PCITEM_MISSING: createItem(); break;
+ case BIFF_ID_PCITEM_STRING: createItem().readString( rStrm, *this ); break;
+ case BIFF_ID_PCITEM_DOUBLE: createItem().readDouble( rStrm ); break;
+ case BIFF_ID_PCITEM_INTEGER: createItem().readInteger( rStrm ); break;
+ case BIFF_ID_PCITEM_DATE: createItem().readDate( rStrm ); break;
+ case BIFF_ID_PCITEM_BOOL: createItem().readBool( rStrm ); break;
+ case BIFF_ID_PCITEM_ERROR: createItem().readError( rStrm ); break;
+ default: rStrm.rewindRecord(); bLoop = false;
+ }
+ }
+ OSL_ENSURE( bLoop, "PivotCacheItemList::importItemList - could not read all cache item records" );
+}
+
+const PivotCacheItem* PivotCacheItemList::getCacheItem( sal_Int32 nItemIdx ) const
+{
+ return ContainerHelper::getVectorElement( maItems, nItemIdx );
+}
+
+void PivotCacheItemList::getCacheItemNames( ::std::vector< OUString >& orItemNames ) const
+{
+ orItemNames.clear();
+ orItemNames.reserve( maItems.size() );
+ for( CacheItemVector::const_iterator aIt = maItems.begin(), aEnd = maItems.end(); aIt != aEnd; ++aIt )
+ orItemNames.push_back( aIt->getName() );
+}
+
+// private --------------------------------------------------------------------
+
+PivotCacheItem& PivotCacheItemList::createItem()
+{
+ maItems.resize( maItems.size() + 1 );
+ return maItems.back();
+}
+
+void PivotCacheItemList::importArray( RecordInputStream& rStrm )
+{
+ sal_uInt16 nType = rStrm.readuInt16();
+ sal_Int32 nCount = rStrm.readInt32();
+ for( sal_Int32 nIdx = 0; !rStrm.isEof() && (nIdx < nCount); ++nIdx )
+ {
+ switch( nType )
+ {
+ case OOBIN_PCITEM_ARRAY_DOUBLE: createItem().readDouble( rStrm ); break;
+ case OOBIN_PCITEM_ARRAY_STRING: createItem().readString( rStrm ); break;
+ case OOBIN_PCITEM_ARRAY_ERROR: createItem().readError( rStrm ); break;
+ case OOBIN_PCITEM_ARRAY_DATE: createItem().readDate( rStrm ); break;
+ default:
+ OSL_ENSURE( false, "PivotCacheItemList::importArray - unknown data type" );
+ nIdx = nCount;
+ }
+ }
+}
+
+// ============================================================================
+
+PCFieldModel::PCFieldModel() :
+ mnNumFmtId( 0 ),
+ mnSqlType( 0 ),
+ mnHierarchy( 0 ),
+ mnLevel( 0 ),
+ mnMappingCount( 0 ),
+ mbDatabaseField( true ),
+ mbServerField( false ),
+ mbUniqueList( true ),
+ mbMemberPropField( false )
+{
+}
+
+// ----------------------------------------------------------------------------
+
+PCSharedItemsModel::PCSharedItemsModel() :
+ mbHasSemiMixed( true ),
+ mbHasNonDate( true ),
+ mbHasDate( false ),
+ mbHasString( true ),
+ mbHasBlank( false ),
+ mbHasMixed( false ),
+ mbIsNumeric( false ),
+ mbIsInteger( false ),
+ mbHasLongText( false ),
+ mbHasLongIndexes( false )
+{
+}
+
+// ----------------------------------------------------------------------------
+
+PCFieldGroupModel::PCFieldGroupModel() :
+ mfStartValue( 0.0 ),
+ mfEndValue( 0.0 ),
+ mfInterval( 1.0 ),
+ mnParentField( -1 ),
+ mnBaseField( -1 ),
+ mnGroupBy( XML_range ),
+ mbRangeGroup( false ),
+ mbDateGroup( false ),
+ mbAutoStart( true ),
+ mbAutoEnd( true )
+{
+}
+
+void PCFieldGroupModel::setBinGroupBy( sal_uInt8 nGroupBy )
+{
+ static const sal_Int32 spnGroupBy[] = { XML_range,
+ XML_seconds, XML_minutes, XML_hours, XML_days, XML_months, XML_quarters, XML_years };
+ mnGroupBy = STATIC_ARRAY_SELECT( spnGroupBy, nGroupBy, XML_range );
+}
+
+// ----------------------------------------------------------------------------
+
+PivotCacheField::PivotCacheField( const WorkbookHelper& rHelper, bool bIsDatabaseField ) :
+ WorkbookHelper( rHelper ),
+ maSharedItems( rHelper ),
+ maGroupItems( rHelper )
+{
+ maFieldModel.mbDatabaseField = bIsDatabaseField;
+}
+
+void PivotCacheField::importCacheField( const AttributeList& rAttribs )
+{
+ maFieldModel.maName = rAttribs.getString( XML_name, OUString() );
+ maFieldModel.maCaption = rAttribs.getString( XML_caption, OUString() );
+ maFieldModel.maPropertyName = rAttribs.getString( XML_propertyName, OUString() );
+ maFieldModel.maFormula = rAttribs.getString( XML_formula, OUString() );
+ maFieldModel.mnNumFmtId = rAttribs.getInteger( XML_numFmtId, 0 );
+ maFieldModel.mnSqlType = rAttribs.getInteger( XML_sqlType, 0 );
+ maFieldModel.mnHierarchy = rAttribs.getInteger( XML_hierarchy, 0 );
+ maFieldModel.mnLevel = rAttribs.getInteger( XML_level, 0 );
+ maFieldModel.mnMappingCount = rAttribs.getInteger( XML_mappingCount, 0 );
+ maFieldModel.mbDatabaseField = rAttribs.getBool( XML_databaseField, true );
+ maFieldModel.mbServerField = rAttribs.getBool( XML_serverField, false );
+ maFieldModel.mbUniqueList = rAttribs.getBool( XML_uniqueList, true );
+ maFieldModel.mbMemberPropField = rAttribs.getBool( XML_memberPropertyField, false );
+}
+
+void PivotCacheField::importSharedItems( const AttributeList& rAttribs )
+{
+ OSL_ENSURE( maSharedItems.empty(), "PivotCacheField::importSharedItems - multiple shared items elements" );
+ maSharedItemsModel.mbHasSemiMixed = rAttribs.getBool( XML_containsSemiMixedTypes, true );
+ maSharedItemsModel.mbHasNonDate = rAttribs.getBool( XML_containsNonDate, true );
+ maSharedItemsModel.mbHasDate = rAttribs.getBool( XML_containsDate, false );
+ maSharedItemsModel.mbHasString = rAttribs.getBool( XML_containsString, true );
+ maSharedItemsModel.mbHasBlank = rAttribs.getBool( XML_containsBlank, false );
+ maSharedItemsModel.mbHasMixed = rAttribs.getBool( XML_containsMixedTypes, false );
+ maSharedItemsModel.mbIsNumeric = rAttribs.getBool( XML_containsNumber, false );
+ maSharedItemsModel.mbIsInteger = rAttribs.getBool( XML_containsInteger, false );
+ maSharedItemsModel.mbHasLongText = rAttribs.getBool( XML_longText, false );
+}
+
+void PivotCacheField::importSharedItem( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ maSharedItems.importItem( nElement, rAttribs );
+}
+
+void PivotCacheField::importFieldGroup( const AttributeList& rAttribs )
+{
+ maFieldGroupModel.mnParentField = rAttribs.getInteger( XML_par, -1 );
+ maFieldGroupModel.mnBaseField = rAttribs.getInteger( XML_base, -1 );
+}
+
+void PivotCacheField::importRangePr( const AttributeList& rAttribs )
+{
+ maFieldGroupModel.maStartDate = rAttribs.getDateTime( XML_startDate, DateTime() );
+ maFieldGroupModel.maEndDate = rAttribs.getDateTime( XML_endDate, DateTime() );
+ maFieldGroupModel.mfStartValue = rAttribs.getDouble( XML_startNum, 0.0 );
+ maFieldGroupModel.mfEndValue = rAttribs.getDouble( XML_endNum, 0.0 );
+ maFieldGroupModel.mfInterval = rAttribs.getDouble( XML_groupInterval, 1.0 );
+ maFieldGroupModel.mnGroupBy = rAttribs.getToken( XML_groupBy, XML_range );
+ maFieldGroupModel.mbRangeGroup = true;
+ maFieldGroupModel.mbDateGroup = maFieldGroupModel.mnGroupBy != XML_range;
+ maFieldGroupModel.mbAutoStart = rAttribs.getBool( XML_autoStart, true );
+ maFieldGroupModel.mbAutoEnd = rAttribs.getBool( XML_autoEnd, true );
+}
+
+void PivotCacheField::importDiscretePrItem( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ OSL_ENSURE( nElement == XLS_TOKEN( x ), "PivotCacheField::importDiscretePrItem - unexpected element" );
+ if( nElement == XLS_TOKEN( x ) )
+ maDiscreteItems.push_back( rAttribs.getInteger( XML_v, -1 ) );
+}
+
+void PivotCacheField::importGroupItem( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ maGroupItems.importItem( nElement, rAttribs );
+}
+
+void PivotCacheField::importPCDField( RecordInputStream& rStrm )
+{
+ sal_uInt16 nFlags;
+ rStrm >> nFlags >> maFieldModel.mnNumFmtId;
+ maFieldModel.mnSqlType = rStrm.readInt16();
+ rStrm >> maFieldModel.mnHierarchy >> maFieldModel.mnLevel >> maFieldModel.mnMappingCount >> maFieldModel.maName;
+ if( getFlag( nFlags, OOBIN_PCDFIELD_HASCAPTION ) )
+ rStrm >> maFieldModel.maCaption;
+ if( getFlag( nFlags, OOBIN_PCDFIELD_HASFORMULA ) )
+ rStrm.skip( ::std::max< sal_Int32 >( rStrm.readInt32(), 0 ) );
+ if( maFieldModel.mnMappingCount > 0 )
+ rStrm.skip( ::std::max< sal_Int32 >( rStrm.readInt32(), 0 ) );
+ if( getFlag( nFlags, OOBIN_PCDFIELD_HASPROPERTYNAME ) )
+ rStrm >> maFieldModel.maPropertyName;
+
+ maFieldModel.mbDatabaseField = getFlag( nFlags, OOBIN_PCDFIELD_DATABASEFIELD );
+ maFieldModel.mbServerField = getFlag( nFlags, OOBIN_PCDFIELD_SERVERFIELD );
+ maFieldModel.mbUniqueList = !getFlag( nFlags, OOBIN_PCDFIELD_NOUNIQUEITEMS );
+ maFieldModel.mbMemberPropField = getFlag( nFlags, OOBIN_PCDFIELD_MEMBERPROPFIELD );
+}
+
+void PivotCacheField::importPCDFSharedItems( RecordInputStream& rStrm )
+{
+ sal_uInt16 nFlags;
+ rStrm >> nFlags;
+ maSharedItemsModel.mbHasSemiMixed = getFlag( nFlags, OOBIN_PCDFSITEMS_HASSEMIMIXED );
+ maSharedItemsModel.mbHasNonDate = getFlag( nFlags, OOBIN_PCDFSITEMS_HASNONDATE );
+ maSharedItemsModel.mbHasDate = getFlag( nFlags, OOBIN_PCDFSITEMS_HASDATE );
+ maSharedItemsModel.mbHasString = getFlag( nFlags, OOBIN_PCDFSITEMS_HASSTRING );
+ maSharedItemsModel.mbHasBlank = getFlag( nFlags, OOBIN_PCDFSITEMS_HASBLANK );
+ maSharedItemsModel.mbHasMixed = getFlag( nFlags, OOBIN_PCDFSITEMS_HASMIXED );
+ maSharedItemsModel.mbIsNumeric = getFlag( nFlags, OOBIN_PCDFSITEMS_ISNUMERIC );
+ maSharedItemsModel.mbIsInteger = getFlag( nFlags, OOBIN_PCDFSITEMS_ISINTEGER );
+ maSharedItemsModel.mbHasLongText = getFlag( nFlags, OOBIN_PCDFSITEMS_HASLONGTEXT );
+}
+
+void PivotCacheField::importPCDFSharedItem( sal_Int32 nRecId, RecordInputStream& rStrm )
+{
+ maSharedItems.importItem( nRecId, rStrm );
+}
+
+void PivotCacheField::importPCDFieldGroup( RecordInputStream& rStrm )
+{
+ rStrm >> maFieldGroupModel.mnParentField >> maFieldGroupModel.mnBaseField;
+}
+
+void PivotCacheField::importPCDFRangePr( RecordInputStream& rStrm )
+{
+ sal_uInt8 nGroupBy, nFlags;
+ rStrm >> nGroupBy >> nFlags >> maFieldGroupModel.mfStartValue >> maFieldGroupModel.mfEndValue >> maFieldGroupModel.mfInterval;
+
+ maFieldGroupModel.setBinGroupBy( nGroupBy );
+ maFieldGroupModel.mbRangeGroup = true;
+ maFieldGroupModel.mbDateGroup = getFlag( nFlags, OOBIN_PCDFRANGEPR_DATEGROUP );
+ maFieldGroupModel.mbAutoStart = getFlag( nFlags, OOBIN_PCDFRANGEPR_AUTOSTART );
+ maFieldGroupModel.mbAutoEnd = getFlag( nFlags, OOBIN_PCDFRANGEPR_AUTOEND );
+
+ OSL_ENSURE( maFieldGroupModel.mbDateGroup == (maFieldGroupModel.mnGroupBy != XML_range), "PivotCacheField::importPCDFRangePr - wrong date flag" );
+ if( maFieldGroupModel.mbDateGroup )
+ {
+ maFieldGroupModel.maStartDate = getUnitConverter().calcDateTimeFromSerial( maFieldGroupModel.mfStartValue );
+ maFieldGroupModel.maEndDate = getUnitConverter().calcDateTimeFromSerial( maFieldGroupModel.mfEndValue );
+ }
+}
+
+void PivotCacheField::importPCDFDiscretePrItem( sal_Int32 nRecId, RecordInputStream& rStrm )
+{
+ OSL_ENSURE( nRecId == OOBIN_ID_PCITEM_INDEX, "PivotCacheField::importPCDFDiscretePrItem - unexpected record" );
+ if( nRecId == OOBIN_ID_PCITEM_INDEX )
+ maDiscreteItems.push_back( rStrm.readInt32() );
+}
+
+void PivotCacheField::importPCDFGroupItem( sal_Int32 nRecId, RecordInputStream& rStrm )
+{
+ maGroupItems.importItem( nRecId, rStrm );
+}
+
+void PivotCacheField::importPCDField( BiffInputStream& rStrm )
+{
+ sal_uInt16 nFlags, nGroupItems, nBaseItems, nSharedItems;
+ rStrm >> nFlags;
+ maFieldGroupModel.mnParentField = rStrm.readuInt16();
+ maFieldGroupModel.mnBaseField = rStrm.readuInt16();
+ rStrm.skip( 2 ); // number of unique items (either shared or group)
+ rStrm >> nGroupItems >> nBaseItems >> nSharedItems;
+ maFieldModel.maName = (getBiff() == BIFF8) ? rStrm.readUniString() : rStrm.readByteString( true, getTextEncoding() );
+
+ maFieldModel.mbServerField = getFlag( nFlags, BIFF_PCDFIELD_SERVERFIELD );
+ maFieldModel.mbUniqueList = !getFlag( nFlags, BIFF_PCDFIELD_NOUNIQUEITEMS );
+ maSharedItemsModel.mbHasSemiMixed = getFlag( nFlags, BIFF_PCDFIELD_HASSEMIMIXED );
+ maSharedItemsModel.mbHasNonDate = getFlag( nFlags, BIFF_PCDFIELD_HASNONDATE );
+ maSharedItemsModel.mbHasDate = getFlag( nFlags, BIFF_PCDFIELD_HASDATE );
+ maSharedItemsModel.mbIsNumeric = getFlag( nFlags, BIFF_PCDFIELD_ISNUMERIC );
+ maSharedItemsModel.mbHasLongIndexes = getFlag( nFlags, BIFF_PCDFIELD_HASLONGINDEX );
+ maFieldGroupModel.mbRangeGroup = getFlag( nFlags, BIFF_PCDFIELD_RANGEGROUP );
+
+ // in BIFF, presence of parent group field is denoted by a flag
+ if( !getFlag( nFlags, BIFF_PCDFIELD_HASPARENT ) )
+ maFieldGroupModel.mnParentField = -1;
+
+ // following PCDFSQLTYPE record contains SQL type
+ if( (rStrm.getNextRecId() == BIFF_ID_PCDFSQLTYPE) && rStrm.startNextRecord() )
+ maFieldModel.mnSqlType = rStrm.readInt16();
+
+ // read group items, if any
+ if( nGroupItems > 0 )
+ {
+ OSL_ENSURE( getFlag( nFlags, BIFF_PCDFIELD_HASITEMS ), "PivotCacheField::importPCDField - missing items flag" );
+ maGroupItems.importItemList( rStrm, nGroupItems );
+
+ sal_uInt16 nNextRecId = rStrm.getNextRecId();
+ bool bHasRangePr = nNextRecId == BIFF_ID_PCDFRANGEPR;
+ bool bHasDiscretePr = nNextRecId == BIFF_ID_PCDFDISCRETEPR;
+
+ OSL_ENSURE( bHasRangePr || bHasDiscretePr, "PivotCacheField::importPCDField - missing group properties record" );
+ OSL_ENSURE( bHasRangePr == maFieldGroupModel.mbRangeGroup, "PivotCacheField::importPCDField - invalid range grouping flag" );
+ if( bHasRangePr && rStrm.startNextRecord() )
+ importPCDFRangePr( rStrm );
+ else if( bHasDiscretePr && rStrm.startNextRecord() )
+ importPCDFDiscretePr( rStrm );
+ }
+
+ // read the shared items, if any
+ if( nSharedItems > 0 )
+ {
+ OSL_ENSURE( getFlag( nFlags, BIFF_PCDFIELD_HASITEMS ), "PivotCacheField::importPCDField - missing items flag" );
+ maSharedItems.importItemList( rStrm, nSharedItems );
+ }
+}
+
+void PivotCacheField::importPCDFRangePr( BiffInputStream& rStrm )
+{
+ sal_uInt16 nFlags;
+ rStrm >> nFlags;
+ maFieldGroupModel.setBinGroupBy( extractValue< sal_uInt8 >( nFlags, 2, 3 ) );
+ maFieldGroupModel.mbRangeGroup = true;
+ maFieldGroupModel.mbDateGroup = maFieldGroupModel.mnGroupBy != XML_range;
+ maFieldGroupModel.mbAutoStart = getFlag( nFlags, BIFF_PCDFRANGEPR_AUTOSTART );
+ maFieldGroupModel.mbAutoEnd = getFlag( nFlags, BIFF_PCDFRANGEPR_AUTOEND );
+
+ /* Start, end, and interval are stored in 3 separate item records. Type of
+ the items is dependent on numeric/date mode. Numeric groups expect
+ three PCITEM_DOUBLE records, date groups expect two PCITEM_DATE records
+ and one PCITEM_INT record. */
+ PivotCacheItemList aLimits( *this );
+ aLimits.importItemList( rStrm, 3 );
+ OSL_ENSURE( aLimits.size() == 3, "PivotCacheField::importPCDFRangePr - missing grouping records" );
+ const PivotCacheItem* pStartValue = aLimits.getCacheItem( 0 );
+ const PivotCacheItem* pEndValue = aLimits.getCacheItem( 1 );
+ const PivotCacheItem* pInterval = aLimits.getCacheItem( 2 );
+ if( pStartValue && pEndValue && pInterval )
+ {
+ if( maFieldGroupModel.mbDateGroup )
+ {
+ bool bHasTypes = (pStartValue->getType() == XML_d) && (pEndValue->getType() == XML_d) && (pInterval->getType() == XML_i);
+ OSL_ENSURE( bHasTypes, "PivotCacheField::importPCDFRangePr - wrong data types in grouping items" );
+ if( bHasTypes )
+ {
+ maFieldGroupModel.maStartDate = pStartValue->getValue().get< DateTime >();
+ maFieldGroupModel.maEndDate = pEndValue->getValue().get< DateTime >();
+ maFieldGroupModel.mfInterval = pInterval->getValue().get< sal_Int16 >();
+ }
+ }
+ else
+ {
+ bool bHasTypes = (pStartValue->getType() == XML_n) && (pEndValue->getType() == XML_n) && (pInterval->getType() == XML_n);
+ OSL_ENSURE( bHasTypes, "PivotCacheField::importPCDFRangePr - wrong data types in grouping items" );
+ if( bHasTypes )
+ {
+ maFieldGroupModel.mfStartValue = pStartValue->getValue().get< double >();
+ maFieldGroupModel.mfEndValue = pEndValue->getValue().get< double >();
+ maFieldGroupModel.mfInterval = pInterval->getValue().get< double >();
+ }
+ }
+ }
+}
+
+void PivotCacheField::importPCDFDiscretePr( BiffInputStream& rStrm )
+{
+ sal_Int32 nCount = static_cast< sal_Int32 >( rStrm.getLength() / 2 );
+ for( sal_Int32 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex )
+ maDiscreteItems.push_back( rStrm.readuInt16() );
+}
+
+const PivotCacheItem* PivotCacheField::getCacheItem( sal_Int32 nItemIdx ) const
+{
+ if( hasGroupItems() )
+ return maGroupItems.getCacheItem( nItemIdx );
+ if( hasSharedItems() )
+ return maSharedItems.getCacheItem( nItemIdx );
+ return 0;
+}
+
+void PivotCacheField::getCacheItemNames( ::std::vector< OUString >& orItemNames ) const
+{
+ if( hasGroupItems() )
+ maGroupItems.getCacheItemNames( orItemNames );
+ else if( hasSharedItems() )
+ maSharedItems.getCacheItemNames( orItemNames );
+}
+
+void PivotCacheField::convertNumericGrouping( const Reference< XDataPilotField >& rxDPField ) const
+{
+ OSL_ENSURE( hasGroupItems() && hasNumericGrouping(), "PivotCacheField::convertNumericGrouping - not a numeric group field" );
+ PropertySet aPropSet( rxDPField );
+ if( hasGroupItems() && hasNumericGrouping() && aPropSet.is() )
+ {
+ DataPilotFieldGroupInfo aGroupInfo;
+ aGroupInfo.HasAutoStart = maFieldGroupModel.mbAutoStart;
+ aGroupInfo.HasAutoEnd = maFieldGroupModel.mbAutoEnd;
+ aGroupInfo.HasDateValues = sal_False;
+ aGroupInfo.Start = maFieldGroupModel.mfStartValue;
+ aGroupInfo.End = maFieldGroupModel.mfEndValue;
+ aGroupInfo.Step = maFieldGroupModel.mfInterval;
+ aGroupInfo.GroupBy = 0;
+ aPropSet.setProperty( PROP_GroupInfo, aGroupInfo );
+ }
+}
+
+OUString PivotCacheField::createDateGroupField( const Reference< XDataPilotField >& rxBaseDPField ) const
+{
+ OSL_ENSURE( hasGroupItems() && hasDateGrouping(), "PivotCacheField::createDateGroupField - not a numeric group field" );
+ Reference< XDataPilotField > xDPGroupField;
+ PropertySet aPropSet( rxBaseDPField );
+ if( hasGroupItems() && hasDateGrouping() && aPropSet.is() )
+ {
+ bool bDayRanges = (maFieldGroupModel.mnGroupBy == XML_days) && (maFieldGroupModel.mfInterval >= 2.0);
+
+ DataPilotFieldGroupInfo aGroupInfo;
+ aGroupInfo.HasAutoStart = maFieldGroupModel.mbAutoStart;
+ aGroupInfo.HasAutoEnd = maFieldGroupModel.mbAutoEnd;
+ aGroupInfo.HasDateValues = sal_True;
+ aGroupInfo.Start = getUnitConverter().calcSerialFromDateTime( maFieldGroupModel.maStartDate );
+ aGroupInfo.End = getUnitConverter().calcSerialFromDateTime( maFieldGroupModel.maEndDate );
+ aGroupInfo.Step = bDayRanges ? maFieldGroupModel.mfInterval : 0.0;
+
+ using namespace ::com::sun::star::sheet::DataPilotFieldGroupBy;
+ switch( maFieldGroupModel.mnGroupBy )
+ {
+ case XML_years: aGroupInfo.GroupBy = YEARS; break;
+ case XML_quarters: aGroupInfo.GroupBy = QUARTERS; break;
+ case XML_months: aGroupInfo.GroupBy = MONTHS; break;
+ case XML_days: aGroupInfo.GroupBy = DAYS; break;
+ case XML_hours: aGroupInfo.GroupBy = HOURS; break;
+ case XML_minutes: aGroupInfo.GroupBy = MINUTES; break;
+ case XML_seconds: aGroupInfo.GroupBy = SECONDS; break;
+ default: OSL_ENSURE( false, "PivotCacheField::convertRangeGrouping - unknown date/time interval" );
+ }
+
+ try
+ {
+ Reference< XDataPilotFieldGrouping > xDPGrouping( rxBaseDPField, UNO_QUERY_THROW );
+ xDPGroupField = xDPGrouping->createDateGroup( aGroupInfo );
+ }
+ catch( Exception& )
+ {
+ }
+ }
+
+ Reference< XNamed > xFieldName( xDPGroupField, UNO_QUERY );
+ return xFieldName.is() ? xFieldName->getName() : OUString();
+}
+
+OUString PivotCacheField::createParentGroupField( const Reference< XDataPilotField >& rxBaseDPField, PivotCacheGroupItemVector& orItemNames ) const
+{
+ OSL_ENSURE( hasGroupItems() && !maDiscreteItems.empty(), "PivotCacheField::createParentGroupField - not a group field" );
+ OSL_ENSURE( maDiscreteItems.size() == orItemNames.size(), "PivotCacheField::createParentGroupField - number of item names does not match grouping info" );
+ Reference< XDataPilotFieldGrouping > xDPGrouping( rxBaseDPField, UNO_QUERY );
+ if( !xDPGrouping.is() ) return OUString();
+
+ // map the group item indexes from maGroupItems to all item indexes from maDiscreteItems
+ typedef ::std::vector< sal_Int32 > GroupItemList;
+ typedef ::std::vector< GroupItemList > GroupItemMap;
+ GroupItemMap aItemMap( maGroupItems.size() );
+ for( IndexVector::const_iterator aBeg = maDiscreteItems.begin(), aIt = aBeg, aEnd = maDiscreteItems.end(); aIt != aEnd; ++aIt )
+ if( GroupItemList* pItems = ContainerHelper::getVectorElement( aItemMap, *aIt ) )
+ pItems->push_back( static_cast< sal_Int32 >( aIt - aBeg ) );
+
+ // process all groups
+ Reference< XDataPilotField > xDPGroupField;
+ for( GroupItemMap::iterator aBeg = aItemMap.begin(), aIt = aBeg, aEnd = aItemMap.end(); aIt != aEnd; ++aIt )
+ {
+ OSL_ENSURE( !aIt->empty(), "PivotCacheField::createParentGroupField - item/group should not be empty" );
+ // if the item count is greater than 1, the item is a group of items
+ if( aIt->size() > 1 )
+ {
+ /* Insert the names of the items that are part of this group. Calc
+ expects the names of the members of the field whose members are
+ grouped (which may be the names of groups too). Excel provides
+ the names of the base field items instead (no group names
+ involved). Therefore, the passed collection of current item
+ names as they are already grouped is used here to resolve the
+ item names. */
+ ::std::vector< OUString > aMembers;
+ for( GroupItemList::iterator aBeg2 = aIt->begin(), aIt2 = aBeg2, aEnd2 = aIt->end(); aIt2 != aEnd2; ++aIt2 )
+ if( const PivotCacheGroupItem* pName = ContainerHelper::getVectorElement( orItemNames, *aIt2 ) )
+ if( ::std::find( aMembers.begin(), aMembers.end(), pName->maGroupName ) == aMembers.end() )
+ aMembers.push_back( pName->maGroupName );
+
+ /* Check again, that this is not just a group that is not grouped
+ further with other items. */
+ if( aMembers.size() > 1 ) try
+ {
+ // only the first call of createNameGroup() returns the new field
+ Reference< XDataPilotField > xDPNewField = xDPGrouping->createNameGroup( ContainerHelper::vectorToSequence( aMembers ) );
+ OSL_ENSURE( xDPGroupField.is() != xDPNewField.is(), "PivotCacheField::createParentGroupField - missing group field" );
+ if( !xDPGroupField.is() )
+ xDPGroupField = xDPNewField;
+
+ // get current grouping info
+ DataPilotFieldGroupInfo aGroupInfo;
+ PropertySet aPropSet( xDPGroupField );
+ aPropSet.getProperty( aGroupInfo, PROP_GroupInfo );
+
+ /* Find the group object and the auto-generated group name.
+ The returned field contains all groups derived from the
+ previous field if that is grouped too. To find the correct
+ group, the first item used to create the group is serached.
+ Calc provides the original item names of the base field
+ when the group is querried for its members. Its does not
+ provide the names of members that are already groups in the
+ field used to create the new groups. (Is this a bug?)
+ Therefore, a name from the passed list of original item
+ names is used to find the correct group. */
+ OUString aFirstItem;
+ if( const PivotCacheGroupItem* pName = ContainerHelper::getVectorElement( orItemNames, aIt->front() ) )
+ aFirstItem = pName->maOrigName;
+ Reference< XNamed > xGroupName;
+ OUString aAutoName;
+ Reference< XIndexAccess > xGroupsIA( aGroupInfo.Groups, UNO_QUERY_THROW );
+ for( sal_Int32 nIdx = 0, nCount = xGroupsIA->getCount(); (nIdx < nCount) && (aAutoName.getLength() == 0); ++nIdx ) try
+ {
+ Reference< XNameAccess > xItemsNA( xGroupsIA->getByIndex( nIdx ), UNO_QUERY_THROW );
+ if( xItemsNA->hasByName( aFirstItem ) )
+ {
+ xGroupName.set( xGroupsIA->getByIndex( nIdx ), UNO_QUERY_THROW );
+ aAutoName = xGroupName->getName();
+ }
+ }
+ catch( Exception& )
+ {
+ }
+ OSL_ENSURE( aAutoName.getLength() > 0, "PivotCacheField::createParentGroupField - cannot find auto-generated group name" );
+
+ // get the real group name from the list of group items
+ OUString aGroupName;
+ if( const PivotCacheItem* pGroupItem = maGroupItems.getCacheItem( static_cast< sal_Int32 >( aIt - aBeg ) ) )
+ aGroupName = pGroupItem->getName();
+ OSL_ENSURE( aGroupName.getLength() > 0, "PivotCacheField::createParentGroupField - cannot find group name" );
+ if( aGroupName.getLength() == 0 )
+ aGroupName = aAutoName;
+
+ if( xGroupName.is() && (aGroupName.getLength() > 0) )
+ {
+ // replace the auto-generated group name with the real name
+ if( aAutoName != aGroupName )
+ {
+ xGroupName->setName( aGroupName );
+ aPropSet.setProperty( PROP_GroupInfo, aGroupInfo );
+ }
+ // replace original item names in passed vector with group name
+ for( GroupItemList::iterator aIt2 = aIt->begin(), aEnd2 = aIt->end(); aIt2 != aEnd2; ++aIt2 )
+ if( PivotCacheGroupItem* pName = ContainerHelper::getVectorElement( orItemNames, *aIt2 ) )
+ pName->maGroupName = aGroupName;
+ }
+ }
+ catch( Exception& )
+ {
+ }
+ }
+ }
+
+ Reference< XNamed > xFieldName( xDPGroupField, UNO_QUERY );
+ return xFieldName.is() ? xFieldName->getName() : OUString();
+}
+
+void PivotCacheField::writeSourceHeaderCell( WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const
+{
+ rSheetHelper.setStringCell( rSheetHelper.getCell( CellAddress( rSheetHelper.getSheetIndex(), nCol, nRow ) ), maFieldModel.maName );
+}
+
+void PivotCacheField::writeSourceDataCell( WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow, const PivotCacheItem& rItem ) const
+{
+ bool bHasIndex = rItem.getType() == XML_x;
+ OSL_ENSURE( bHasIndex != maSharedItems.empty(), "PivotCacheField::writeSourceDataCell - shared items missing or not expected" );
+ if( bHasIndex )
+ writeSharedItemToSourceDataCell( rSheetHelper, nCol, nRow, rItem.getValue().get< sal_Int32 >() );
+ else
+ writeItemToSourceDataCell( rSheetHelper, nCol, nRow, rItem );
+}
+
+void PivotCacheField::importPCRecordItem( RecordInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const
+{
+ if( hasSharedItems() )
+ {
+ writeSharedItemToSourceDataCell( rSheetHelper, nCol, nRow, rStrm.readInt32() );
+ }
+ else
+ {
+ PivotCacheItem aItem;
+ if( maSharedItemsModel.mbIsNumeric )
+ aItem.readDouble( rStrm );
+ else if( maSharedItemsModel.mbHasDate && !maSharedItemsModel.mbHasString )
+ aItem.readDate( rStrm );
+ else
+ aItem.readString( rStrm );
+ writeItemToSourceDataCell( rSheetHelper, nCol, nRow, aItem );
+ }
+}
+
+void PivotCacheField::importPCItemIndex( BiffInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow ) const
+{
+ OSL_ENSURE( hasSharedItems(), "PivotCacheField::importPCItemIndex - invalid call, no shared items found" );
+ sal_Int32 nIndex = maSharedItemsModel.mbHasLongIndexes ? rStrm.readuInt16() : rStrm.readuInt8();
+ writeSharedItemToSourceDataCell( rSheetHelper, nCol, nRow, nIndex );
+}
+
+// private --------------------------------------------------------------------
+
+void PivotCacheField::writeItemToSourceDataCell( WorksheetHelper& rSheetHelper,
+ sal_Int32 nCol, sal_Int32 nRow, const PivotCacheItem& rItem ) const
+{
+ if( rItem.getType() != XML_m )
+ {
+ Reference< XCell > xCell = rSheetHelper.getCell( CellAddress( rSheetHelper.getSheetIndex(), nCol, nRow ) );
+ if( xCell.is() ) switch( rItem.getType() )
+ {
+ case XML_s: rSheetHelper.setStringCell( xCell, rItem.getValue().get< OUString >() ); break;
+ case XML_n: xCell->setValue( rItem.getValue().get< double >() ); break;
+ case XML_i: xCell->setValue( rItem.getValue().get< sal_Int16 >() ); break;
+ case XML_d: rSheetHelper.setDateTimeCell( xCell, rItem.getValue().get< DateTime >() ); break;
+ case XML_b: rSheetHelper.setBooleanCell( xCell, rItem.getValue().get< bool >() ); break;
+ case XML_e: rSheetHelper.setErrorCell( xCell, static_cast< sal_uInt8 >( rItem.getValue().get< sal_Int32 >() ) ); break;
+ default: OSL_ENSURE( false, "PivotCacheField::writeItemToSourceDataCell - unexpected item data type" );
+ }
+ }
+}
+
+void PivotCacheField::writeSharedItemToSourceDataCell(
+ WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nItemIdx ) const
+{
+ if( const PivotCacheItem* pCacheItem = maSharedItems.getCacheItem( nItemIdx ) )
+ writeItemToSourceDataCell( rSheetHelper, nCol, nRow, *pCacheItem );
+}
+
+// ============================================================================
+
+PCDefinitionModel::PCDefinitionModel() :
+ mfRefreshedDate( 0.0 ),
+ mnRecords( 0 ),
+ mnMissItemsLimit( 0 ),
+ mnDatabaseFields( 0 ),
+ mbInvalid( false ),
+ mbSaveData( true ),
+ mbRefreshOnLoad( false ),
+ mbOptimizeMemory( false ),
+ mbEnableRefresh( true ),
+ mbBackgroundQuery( false ),
+ mbUpgradeOnRefresh( false ),
+ mbTupleCache( false ),
+ mbSupportSubquery( false ),
+ mbSupportDrill( false )
+{
+}
+
+// ----------------------------------------------------------------------------
+
+PCSourceModel::PCSourceModel() :
+ mnSourceType( XML_TOKEN_INVALID ),
+ mnConnectionId( 0 )
+{
+}
+
+// ----------------------------------------------------------------------------
+
+PCWorksheetSourceModel::PCWorksheetSourceModel()
+{
+ maRange.StartColumn = maRange.StartRow = maRange.EndColumn = maRange.EndRow = -1;
+}
+
+// ----------------------------------------------------------------------------
+
+PivotCache::PivotCache( const WorkbookHelper& rHelper ) :
+ WorkbookHelper( rHelper ),
+ mbValidSource( false ),
+ mbDummySheet( false )
+{
+}
+
+void PivotCache::importPivotCacheDefinition( const AttributeList& rAttribs )
+{
+ maDefModel.maRelId = rAttribs.getString( R_TOKEN( id ), OUString() );
+ maDefModel.maRefreshedBy = rAttribs.getString( XML_refreshedBy, OUString() );
+ maDefModel.mfRefreshedDate = rAttribs.getDouble( XML_refreshedDate, 0.0 );
+ maDefModel.mnRecords = rAttribs.getInteger( XML_recordCount, 0 );
+ maDefModel.mnMissItemsLimit = rAttribs.getInteger( XML_missingItemsLimit, 0 );
+ maDefModel.mbInvalid = rAttribs.getBool( XML_invalid, false );
+ maDefModel.mbSaveData = rAttribs.getBool( XML_saveData, true );
+ maDefModel.mbRefreshOnLoad = rAttribs.getBool( XML_refreshOnLoad, false );
+ maDefModel.mbOptimizeMemory = rAttribs.getBool( XML_optimizeMemory, false );
+ maDefModel.mbEnableRefresh = rAttribs.getBool( XML_enableRefresh, true );
+ maDefModel.mbBackgroundQuery = rAttribs.getBool( XML_backgroundQuery, false );
+ maDefModel.mbUpgradeOnRefresh = rAttribs.getBool( XML_upgradeOnRefresh, false );
+ maDefModel.mbTupleCache = rAttribs.getBool( XML_tupleCache, false );
+ maDefModel.mbSupportSubquery = rAttribs.getBool( XML_supportSubquery, false );
+ maDefModel.mbSupportDrill = rAttribs.getBool( XML_supportAdvancedDrill, false );
+}
+
+void PivotCache::importCacheSource( const AttributeList& rAttribs )
+{
+ maSourceModel.mnSourceType = rAttribs.getToken( XML_type, XML_TOKEN_INVALID );
+ maSourceModel.mnConnectionId = rAttribs.getInteger( XML_connectionId, 0 );
+}
+
+void PivotCache::importWorksheetSource( const AttributeList& rAttribs, const Relations& rRelations )
+{
+ maSheetSrcModel.maRelId = rAttribs.getString( R_TOKEN( id ), OUString() );
+ maSheetSrcModel.maSheet = rAttribs.getString( XML_sheet, OUString() );
+ maSheetSrcModel.maDefName = rAttribs.getString( XML_name, OUString() );
+
+ // resolve URL of external document
+ maTargetUrl = rRelations.getTargetFromRelId( maSheetSrcModel.maRelId );
+ // store range address unchecked with sheet index 0, will be resolved/checked later
+ getAddressConverter().convertToCellRangeUnchecked( maSheetSrcModel.maRange, rAttribs.getString( XML_ref, OUString() ), 0 );
+}
+
+void PivotCache::importPCDefinition( RecordInputStream& rStrm )
+{
+ sal_uInt8 nFlags1, nFlags2;
+ rStrm.skip( 3 ); // create/refresh version id's
+ rStrm >> nFlags1 >> maDefModel.mnMissItemsLimit >> maDefModel.mfRefreshedDate >> nFlags2 >> maDefModel.mnRecords;
+ if( getFlag( nFlags2, OOBIN_PCDEFINITION_HASUSERNAME ) )
+ rStrm >> maDefModel.maRefreshedBy;
+ if( getFlag( nFlags2, OOBIN_PCDEFINITION_HASRELID ) )
+ rStrm >> maDefModel.maRelId;
+
+ maDefModel.mbInvalid = getFlag( nFlags1, OOBIN_PCDEFINITION_INVALID );
+ maDefModel.mbSaveData = getFlag( nFlags1, OOBIN_PCDEFINITION_SAVEDATA );
+ maDefModel.mbRefreshOnLoad = getFlag( nFlags1, OOBIN_PCDEFINITION_REFRESHONLOAD );
+ maDefModel.mbOptimizeMemory = getFlag( nFlags1, OOBIN_PCDEFINITION_OPTIMIZEMEMORY );
+ maDefModel.mbEnableRefresh = getFlag( nFlags1, OOBIN_PCDEFINITION_ENABLEREFRESH );
+ maDefModel.mbBackgroundQuery = getFlag( nFlags1, OOBIN_PCDEFINITION_BACKGROUNDQUERY );
+ maDefModel.mbUpgradeOnRefresh = getFlag( nFlags1, OOBIN_PCDEFINITION_UPGRADEONREFR );
+ maDefModel.mbTupleCache = getFlag( nFlags1, OOBIN_PCDEFINITION_TUPELCACHE );
+ maDefModel.mbSupportSubquery = getFlag( nFlags2, OOBIN_PCDEFINITION_SUPPORTSUBQUERY );
+ maDefModel.mbSupportDrill = getFlag( nFlags2, OOBIN_PCDEFINITION_SUPPORTDRILL );
+}
+
+void PivotCache::importPCDSource( RecordInputStream& rStrm )
+{
+ sal_Int32 nSourceType;
+ rStrm >> nSourceType >> maSourceModel.mnConnectionId;
+ static const sal_Int32 spnSourceTypes[] = { XML_worksheet, XML_external, XML_consolidation, XML_scenario };
+ maSourceModel.mnSourceType = STATIC_ARRAY_SELECT( spnSourceTypes, nSourceType, XML_TOKEN_INVALID );
+}
+
+void PivotCache::importPCDSheetSource( RecordInputStream& rStrm, const Relations& rRelations )
+{
+ sal_uInt8 nIsDefName, nIsBuiltinName, nFlags;
+ rStrm >> nIsDefName >> nIsBuiltinName >> nFlags;
+ if( getFlag( nFlags, OOBIN_PCDWBSOURCE_HASSHEET ) )
+ rStrm >> maSheetSrcModel.maSheet;
+ if( getFlag( nFlags, OOBIN_PCDWBSOURCE_HASRELID ) )
+ rStrm >> maSheetSrcModel.maRelId;
+
+ // read cell range or defined name
+ if( nIsDefName == 0 )
+ {
+ BinRange aBinRange;
+ rStrm >> aBinRange;
+ // store range address unchecked with sheet index 0, will be resolved/checked later
+ getAddressConverter().convertToCellRangeUnchecked( maSheetSrcModel.maRange, aBinRange, 0 );
+ }
+ else
+ {
+ rStrm >> maSheetSrcModel.maDefName;
+ if( nIsBuiltinName != 0 )
+ maSheetSrcModel.maDefName = CREATE_OUSTRING( "_xlnm." ) + maSheetSrcModel.maDefName;
+ }
+
+ // resolve URL of external document
+ maTargetUrl = rRelations.getTargetFromRelId( maSheetSrcModel.maRelId );
+}
+
+void PivotCache::importPCDSource( BiffInputStream& rStrm )
+{
+ switch( rStrm.readuInt16() )
+ {
+ case BIFF_PCDSOURCE_WORKSHEET:
+ {
+ maSourceModel.mnSourceType = XML_worksheet;
+ sal_uInt16 nNextRecId = rStrm.getNextRecId();
+ switch( nNextRecId )
+ {
+ case BIFF_ID_DCONREF: if( rStrm.startNextRecord() ) importDConRef( rStrm ); break;
+ case BIFF_ID_DCONNAME: if( rStrm.startNextRecord() ) importDConName( rStrm ); break;
+ case BIFF_ID_DCONBINAME: if( rStrm.startNextRecord() ) importDConBIName( rStrm ); break;
+ }
+ }
+ break;
+ case BIFF_PCDSOURCE_EXTERNAL:
+ maSourceModel.mnSourceType = XML_external;
+ break;
+ case BIFF_PCDSOURCE_CONSOLIDATION:
+ maSourceModel.mnSourceType = XML_consolidation;
+ break;
+ case BIFF_PCDSOURCE_SCENARIO:
+ maSourceModel.mnSourceType = XML_scenario;
+ break;
+ default:
+ maSourceModel.mnSourceType = XML_TOKEN_INVALID;
+ }
+}
+
+void PivotCache::importPCDefinition( BiffInputStream& rStrm )
+{
+ sal_uInt16 nFlags, nUserNameLen;
+ rStrm >> maDefModel.mnRecords;
+ rStrm.skip( 2 ); // repeated cache ID
+ rStrm >> nFlags;
+ rStrm.skip( 2 ); // unused
+ rStrm >> maDefModel.mnDatabaseFields;
+ rStrm.skip( 6 ); // total field count, report record count, (repeated) cache type
+ rStrm >> nUserNameLen;
+ if( nUserNameLen != BIFF_PC_NOSTRING )
+ maDefModel.maRefreshedBy = (getBiff() == BIFF8) ?
+ rStrm.readUniString( nUserNameLen ) :
+ rStrm.readCharArray( nUserNameLen, getTextEncoding() );
+
+ maDefModel.mbInvalid = getFlag( nFlags, BIFF_PCDEFINITION_INVALID );
+ maDefModel.mbSaveData = getFlag( nFlags, BIFF_PCDEFINITION_SAVEDATA );
+ maDefModel.mbRefreshOnLoad = getFlag( nFlags, BIFF_PCDEFINITION_REFRESHONLOAD );
+ maDefModel.mbOptimizeMemory = getFlag( nFlags, BIFF_PCDEFINITION_OPTIMIZEMEMORY );
+ maDefModel.mbEnableRefresh = getFlag( nFlags, BIFF_PCDEFINITION_ENABLEREFRESH );
+ maDefModel.mbBackgroundQuery = getFlag( nFlags, BIFF_PCDEFINITION_BACKGROUNDQUERY );
+
+ if( (rStrm.getNextRecId() == BIFF_ID_PCDEFINITION2) && rStrm.startNextRecord() )
+ rStrm >> maDefModel.mfRefreshedDate;
+}
+
+PivotCacheField& PivotCache::createCacheField( bool bInitDatabaseField )
+{
+ bool bIsDatabaseField = !bInitDatabaseField || (maFields.size() < maDefModel.mnDatabaseFields);
+ PivotCacheFieldVector::value_type xCacheField( new PivotCacheField( *this, bIsDatabaseField ) );
+ maFields.push_back( xCacheField );
+ return *xCacheField;
+}
+
+void PivotCache::finalizeImport()
+{
+ // collect all fields that are based on source data (needed to finalize source data below)
+ OSL_ENSURE( !maFields.empty(), "PivotCache::finalizeImport - no pivot cache fields found" );
+ for( PivotCacheFieldVector::const_iterator aIt = maFields.begin(), aEnd = maFields.end(); aIt != aEnd; ++aIt )
+ {
+ if( (*aIt)->isDatabaseField() )
+ {
+ OSL_ENSURE( (aIt == maFields.begin()) || (*(aIt - 1))->isDatabaseField(),
+ "PivotCache::finalizeImport - database field follows a calculated field" );
+ maDatabaseIndexes.push_back( static_cast< sal_Int32 >( maDatabaseFields.size() ) );
+ maDatabaseFields.push_back( *aIt );
+ }
+ else
+ {
+ maDatabaseIndexes.push_back( -1 );
+ }
+ }
+ OSL_ENSURE( !maDatabaseFields.empty(), "PivotCache::finalizeImport - no pivot cache source fields found" );
+
+ // finalize source data depending on source type
+ switch( maSourceModel.mnSourceType )
+ {
+ case XML_worksheet:
+ {
+ // decide whether an external document is used
+ bool bInternal = (maTargetUrl.getLength() == 0) && (maSheetSrcModel.maRelId.getLength() == 0);
+ bool bExternal = maTargetUrl.getLength() > 0; // relation ID may be empty, e.g. BIFF import
+ OSL_ENSURE( bInternal || bExternal, "PivotCache::finalizeImport - invalid external document URL" );
+ if( bInternal )
+ finalizeInternalSheetSource();
+ else if( bExternal )
+ finalizeExternalSheetSource();
+ }
+ break;
+
+ // currently, we only support worksheet data sources
+ case XML_external:
+ break;
+ case XML_consolidation:
+ break;
+ case XML_scenario:
+ break;
+ }
+}
+
+sal_Int32 PivotCache::getCacheFieldCount() const
+{
+ return static_cast< sal_Int32 >( maFields.size() );
+}
+
+const PivotCacheField* PivotCache::getCacheField( sal_Int32 nFieldIdx ) const
+{
+ return maFields.get( nFieldIdx ).get();
+}
+
+sal_Int32 PivotCache::getCacheDatabaseIndex( sal_Int32 nFieldIdx ) const
+{
+ return ContainerHelper::getVectorElement< sal_Int32 >( maDatabaseIndexes, nFieldIdx, -1 );
+}
+
+void PivotCache::writeSourceHeaderCells( WorksheetHelper& rSheetHelper ) const
+{
+ OSL_ENSURE( static_cast< size_t >( maSheetSrcModel.maRange.EndColumn - maSheetSrcModel.maRange.StartColumn + 1 ) == maDatabaseFields.size(),
+ "PivotCache::writeSourceHeaderCells - source cell range width does not match number of source fields" );
+ sal_Int32 nCol = maSheetSrcModel.maRange.StartColumn;
+ sal_Int32 nMaxCol = getAddressConverter().getMaxApiAddress().Column;
+ sal_Int32 nRow = maSheetSrcModel.maRange.StartRow;
+ for( PivotCacheFieldVector::const_iterator aIt = maDatabaseFields.begin(), aEnd = maDatabaseFields.end(); (aIt != aEnd) && (nCol <= nMaxCol); ++aIt, ++nCol )
+ (*aIt)->writeSourceHeaderCell( rSheetHelper, nCol, nRow );
+}
+
+void PivotCache::writeSourceDataCell( WorksheetHelper& rSheetHelper, sal_Int32 nCol, sal_Int32 nRow, const PivotCacheItem& rItem ) const
+{
+ OSL_ENSURE( (0 <= nCol) && (nCol <= maSheetSrcModel.maRange.EndColumn - maSheetSrcModel.maRange.StartColumn), "PivotCache::writeSourceDataCell - invalid column index" );
+ OSL_ENSURE( (0 < nRow) && (nRow <= maSheetSrcModel.maRange.EndRow - maSheetSrcModel.maRange.StartRow), "PivotCache::writeSourceDataCell - invalid row index" );
+ if( const PivotCacheField* pCacheField = maDatabaseFields.get( nCol ).get() )
+ pCacheField->writeSourceDataCell( rSheetHelper, maSheetSrcModel.maRange.StartColumn + nCol, maSheetSrcModel.maRange.StartRow + nRow, rItem );
+}
+
+void PivotCache::importPCRecord( RecordInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const
+{
+ OSL_ENSURE( (0 < nRow) && (nRow <= maSheetSrcModel.maRange.EndRow - maSheetSrcModel.maRange.StartRow), "PivotCache::importPCRecord - invalid row index" );
+ sal_Int32 nCol = maSheetSrcModel.maRange.StartColumn;
+ sal_Int32 nMaxCol = getAddressConverter().getMaxApiAddress().Column;
+ nRow += maSheetSrcModel.maRange.StartRow;
+ for( PivotCacheFieldVector::const_iterator aIt = maDatabaseFields.begin(), aEnd = maDatabaseFields.end(); !rStrm.isEof() && (aIt != aEnd) && (nCol <= nMaxCol); ++aIt, ++nCol )
+ (*aIt)->importPCRecordItem( rStrm, rSheetHelper, nCol, nRow );
+}
+
+void PivotCache::importPCItemIndexList( BiffInputStream& rStrm, WorksheetHelper& rSheetHelper, sal_Int32 nRow ) const
+{
+ OSL_ENSURE( (0 < nRow) && (nRow <= maSheetSrcModel.maRange.EndRow - maSheetSrcModel.maRange.StartRow), "PivotCache::importPCItemIndexList - invalid row index" );
+ sal_Int32 nCol = maSheetSrcModel.maRange.StartColumn;
+ sal_Int32 nMaxCol = getAddressConverter().getMaxApiAddress().Column;
+ nRow += maSheetSrcModel.maRange.StartRow;
+ for( PivotCacheFieldVector::const_iterator aIt = maDatabaseFields.begin(), aEnd = maDatabaseFields.end(); !rStrm.isEof() && (aIt != aEnd) && (nCol <= nMaxCol); ++aIt, ++nCol )
+ if( (*aIt)->hasSharedItems() )
+ (*aIt)->importPCItemIndex( rStrm, rSheetHelper, nCol, nRow );
+}
+
+// private --------------------------------------------------------------------
+
+void PivotCache::importDConRef( BiffInputStream& rStrm )
+{
+ BinRange aBinRange;
+ aBinRange.read( rStrm, false ); // always 8-bit column indexes
+ // store range address unchecked with sheet index 0, will be resolved/checked later
+ getAddressConverter().convertToCellRangeUnchecked( maSheetSrcModel.maRange, aBinRange, 0 );
+
+ // the URL with (required) sheet name and optional URL of an external document
+ importDConUrl( rStrm );
+ OSL_ENSURE( maSheetSrcModel.maSheet.getLength() > 0, "PivotCache::importDConRef - missing sheet name" );
+}
+
+void PivotCache::importDConName( BiffInputStream& rStrm )
+{
+ maSheetSrcModel.maDefName = (getBiff() == BIFF8) ? rStrm.readUniString() : rStrm.readByteString( false, getTextEncoding() );
+ OSL_ENSURE( maSheetSrcModel.maDefName.getLength() > 0, "PivotCache::importDConName - missing defined name" );
+ importDConUrl( rStrm );
+}
+
+void PivotCache::importDConBIName( BiffInputStream& rStrm )
+{
+ sal_uInt8 nNameId = rStrm.readuInt8();
+ rStrm.skip( 3 );
+ maSheetSrcModel.maDefName = OUString( sal_Unicode( nNameId ) );
+ importDConUrl( rStrm );
+}
+
+void PivotCache::importDConUrl( BiffInputStream& rStrm )
+{
+ // the URL with sheet name and optional URL of an external document
+ OUString aEncodedUrl;
+ if( getBiff() == BIFF8 )
+ {
+ // empty string does not contain a flags byte, cannot use simple readUniString() here...
+ sal_uInt16 nChars = rStrm.readuInt16();
+ if( nChars > 0 )
+ aEncodedUrl = rStrm.readUniString( nChars );
+ }
+ else
+ {
+ aEncodedUrl = rStrm.readByteString( false, getTextEncoding() );
+ }
+
+ if( aEncodedUrl.getLength() > 0 )
+ {
+ OUString aClassName;
+ getAddressConverter().parseBiffTargetUrl( aClassName, maTargetUrl, maSheetSrcModel.maSheet, aEncodedUrl, true );
+ }
+}
+
+void PivotCache::finalizeInternalSheetSource()
+{
+ // resolve sheet name to sheet index
+ sal_Int32 nSheet = getWorksheets().getCalcSheetIndex( maSheetSrcModel.maSheet );
+
+ // if cache is based on a defined name or table, try to resolve to cell range
+ if( maSheetSrcModel.maDefName.getLength() > 0 )
+ {
+ // local or global defined name
+ if( const DefinedName* pDefName = getDefinedNames().getByModelName( maSheetSrcModel.maDefName, nSheet ).get() )
+ {
+ mbValidSource = pDefName->getAbsoluteRange( maSheetSrcModel.maRange );
+ }
+ // table
+ else if( const Table* pTable = getTables().getTable( maSheetSrcModel.maDefName ).get() )
+ {
+ // get original range from table, but exclude the totals row(s)
+ maSheetSrcModel.maRange = pTable->getOriginalRange();
+ mbValidSource = (pTable->getHeight() - pTable->getTotalsRows()) > 1;
+ if( mbValidSource )
+ maSheetSrcModel.maRange.EndRow -= pTable->getTotalsRows();
+ }
+ }
+ // else try the cell range (if the sheet exists)
+ else if( nSheet >= 0 )
+ {
+ // insert sheet index into the range, range address will be checked below
+ maSheetSrcModel.maRange.Sheet = static_cast< sal_Int16 >( nSheet );
+ mbValidSource = true;
+ }
+ // else sheet has been deleted, generate the source data from cache
+ else if( maSheetSrcModel.maSheet.getLength() > 0 )
+ {
+ prepareSourceDataSheet();
+ // return here to skip the source range check below
+ return;
+ }
+
+ // check range location, do not allow ranges that overflow the sheet partly
+ mbValidSource = mbValidSource &&
+ getAddressConverter().checkCellRange( maSheetSrcModel.maRange, false, true ) &&
+ (maSheetSrcModel.maRange.StartRow < maSheetSrcModel.maRange.EndRow);
+}
+
+void PivotCache::finalizeExternalSheetSource()
+{
+ /* If pivot cache is based on external sheet data, try to restore sheet
+ data from cache records. No support for external defined names or tables,
+ sheet name and path to cache records fragment (OOX only) are required. */
+ bool bHasRelation = (getFilterType() == FILTER_BIFF) || (maDefModel.maRelId.getLength() > 0);
+ if( bHasRelation && (maSheetSrcModel.maDefName.getLength() == 0) && (maSheetSrcModel.maSheet.getLength() > 0) )
+ prepareSourceDataSheet();
+}
+
+void PivotCache::prepareSourceDataSheet()
+{
+ // data will be inserted in top-left cell, sheet index is still set to 0 (will be set below)
+ maSheetSrcModel.maRange.EndColumn -= maSheetSrcModel.maRange.StartColumn;
+ maSheetSrcModel.maRange.StartColumn = 0;
+ maSheetSrcModel.maRange.EndRow -= maSheetSrcModel.maRange.StartRow;
+ maSheetSrcModel.maRange.StartRow = 0;
+ // check range location, do not allow ranges that overflow the sheet partly
+ if( getAddressConverter().checkCellRange( maSheetSrcModel.maRange, false, true ) )
+ {
+ OUString aSheetName = CREATE_OUSTRING( "DPCache_" ) + maSheetSrcModel.maSheet;
+ maSheetSrcModel.maRange.Sheet = getWorksheets().insertEmptySheet( aSheetName, false );
+ mbValidSource = mbDummySheet = maSheetSrcModel.maRange.Sheet >= 0;
+ }
+}
+
+// ============================================================================
+
+PivotCacheBuffer::PivotCacheBuffer( const WorkbookHelper& rHelper ) :
+ WorkbookHelper( rHelper )
+{
+}
+
+void PivotCacheBuffer::registerPivotCacheFragment( sal_Int32 nCacheId, const OUString& rFragmentPath )
+{
+ OSL_ENSURE( nCacheId >= 0, "PivotCacheBuffer::registerPivotCacheFragment - invalid pivot cache identifier" );
+ OSL_ENSURE( maFragmentPaths.count( nCacheId ) == 0, "PivotCacheBuffer::registerPivotCacheFragment - fragment path exists already" );
+ if( (nCacheId >= 0) && (rFragmentPath.getLength() > 0) )
+ maFragmentPaths[ nCacheId ] = rFragmentPath;
+}
+
+void PivotCacheBuffer::importPivotCacheRef( BiffInputStream& rStrm )
+{
+ // read the PIVOTCACHE record that contains the stream ID
+ sal_Int32 nCacheId = rStrm.readuInt16();
+ OSL_ENSURE( maFragmentPaths.count( nCacheId ) == 0, "PivotCacheBuffer::importPivotCacheRef - cache stream exists already" );
+ OUStringBuffer aStrmName;
+ static const sal_Unicode spcHexChars[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
+ for( sal_uInt8 nBit = 0; nBit < 16; nBit += 4 )
+ aStrmName.insert( 0, spcHexChars[ extractValue< size_t >( nCacheId, nBit, 4 ) ] );
+ aStrmName.insert( 0, (getBiff() == BIFF8) ? CREATE_OUSTRING( "_SX_DB_CUR/" ) : CREATE_OUSTRING( "_SX_DB/" ) );
+ maFragmentPaths[ nCacheId ] = aStrmName.makeStringAndClear();
+
+ // try to read PCDSOURCE record (will read following data location records too)
+ sal_uInt16 nNextRecId = rStrm.getNextRecId();
+ OSL_ENSURE( nNextRecId == BIFF_ID_PCDSOURCE, "PivotCacheBuffer::importPivotCacheRef - PCDSOURCE record expected" );
+ if( (nNextRecId == BIFF_ID_PCDSOURCE) && rStrm.startNextRecord() )
+ createPivotCache( nCacheId ).importPCDSource( rStrm );
+}
+
+PivotCache* PivotCacheBuffer::importPivotCacheFragment( sal_Int32 nCacheId )
+{
+ switch( getFilterType() )
+ {
+ /* BIFF filter: Pivot table provides 0-based index into list of pivot
+ cache source links (PIVOTCACHE/PCDSOURCE/... record blocks in
+ workbook stream). First, this index has to be resolved to the cache
+ identifier that is used to manage the cache stream names (the
+ maFragmentPaths member). The cache object itself exists already
+ before the first call for the cache source index (see
+ PivotCacheBuffer::importPivotCacheRef() above), because source data
+ link is part of workbook data, not of the cache stream. To detect
+ subsequent calls with an already initialized cache, the entry in
+ maFragmentPaths will be removed after reading the cache stream. */
+ case FILTER_BIFF:
+ {
+ /* Resolve cache index to cache identifier and try to find pivot
+ cache. Cache must exist already for a valid cache index. */
+ nCacheId = ContainerHelper::getVectorElement< sal_Int32 >( maCacheIds, nCacheId, -1 );
+ PivotCache* pCache = maCaches.get( nCacheId ).get();
+ if( !pCache )
+ return 0;
+
+ /* Try to find fragment path entry (stream name). If missing, the
+ stream has been read already, and the cache can be returned. */
+ FragmentPathMap::iterator aIt = maFragmentPaths.find( nCacheId );
+ if( aIt != maFragmentPaths.end() )
+ {
+ /* Import the cache stream. This may create a dummy data sheet
+ for external sheet sources. */
+ BiffPivotCacheFragment( *this, aIt->second, *pCache ).importFragment();
+ // remove the fragment entry to mark that the cache is initialized
+ maFragmentPaths.erase( aIt );
+ }
+ return pCache;
+ }
+
+ /* OOX/OOBIN filter: On first call for the cache ID, the pivot cache
+ object is created and inserted into maCaches. Then, the cache
+ definition fragment is read and the cache is returned. On
+ subsequent calls, the created cache will be found in maCaches and
+ returned immediately. */
+ case FILTER_OOX:
+ {
+ // try to find an imported pivot cache
+ if( PivotCache* pCache = maCaches.get( nCacheId ).get() )
+ return pCache;
+
+ // check if a fragment path exists for the passed cache identifier
+ FragmentPathMap::iterator aIt = maFragmentPaths.find( nCacheId );
+ if( aIt == maFragmentPaths.end() )
+ return 0;
+
+ /* Import the cache fragment. This may create a dummy data sheet
+ for external sheet sources. */
+ PivotCache& rCache = createPivotCache( nCacheId );
+ importOoxFragment( new OoxPivotCacheDefinitionFragment( *this, aIt->second, rCache ) );
+ return &rCache;
+ }
+
+ case FILTER_UNKNOWN:
+ OSL_ENSURE( false, "PivotCacheBuffer::importPivotCacheFragment - unknown filter type" );
+ }
+ return 0;
+}
+
+PivotCache& PivotCacheBuffer::createPivotCache( sal_Int32 nCacheId )
+{
+ maCacheIds.push_back( nCacheId );
+ PivotCacheMap::mapped_type& rxCache = maCaches[ nCacheId ];
+ rxCache.reset( new PivotCache( *this ) );
+ return *rxCache;
+}
+
+// ============================================================================
+
+} // namespace xls
+} // namespace oox
+
diff --git a/oox/source/xls/pivotcachefragment.cxx b/oox/source/xls/pivotcachefragment.cxx
index a41405a4a7be..713e0ed3ac39 100644
--- a/oox/source/xls/pivotcachefragment.cxx
+++ b/oox/source/xls/pivotcachefragment.cxx
@@ -30,132 +30,439 @@
#include "oox/xls/pivotcachefragment.hxx"
#include "oox/helper/attributelist.hxx"
+#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/addressconverter.hxx"
+#include "oox/xls/biffinputstream.hxx"
+#include "oox/xls/pivotcachebuffer.hxx"
using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::RuntimeException;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::sheet::XSpreadsheet;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::xml::sax::SAXException;
+using ::com::sun::star::uno::Any;
+using ::oox::core::ContextHandlerRef;
+using ::oox::core::RecordInfo;
namespace oox {
namespace xls {
-OoxPivotCacheFragment::OoxPivotCacheFragment( const WorkbookHelper& rHelper,
- const OUString& rFragmentPath,
- sal_uInt32 nCacheId ) :
- OoxWorkbookFragmentBase( rHelper, rFragmentPath ),
- mnCacheId( nCacheId ),
- mbValidSource( false )
+// ============================================================================
+
+OoxPivotCacheFieldContext::OoxPivotCacheFieldContext( OoxWorkbookFragmentBase& rFragment, PivotCacheField& rCacheField ) :
+ OoxWorkbookContextBase( rFragment ),
+ mrCacheField( rCacheField )
{
}
-ContextWrapper OoxPivotCacheFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxPivotCacheFieldContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
- case XML_ROOT_CONTEXT:
- return (nElement == XLS_TOKEN( pivotCacheDefinition ));
- case XLS_TOKEN( pivotCacheDefinition ):
- return (nElement == XLS_TOKEN( cacheSource )) ||
- (nElement == XLS_TOKEN( cacheFields ));
- case XLS_TOKEN( cacheSource ):
- return (nElement == XLS_TOKEN( worksheetSource ));
- case XLS_TOKEN( cacheFields ):
- return (nElement == XLS_TOKEN( cacheField ));
case XLS_TOKEN( cacheField ):
- return (nElement == XLS_TOKEN( sharedItems ));
- case XLS_TOKEN( sharedItems ):
- return (nElement == XLS_TOKEN( s ));
+ if( nElement == XLS_TOKEN( sharedItems ) ) { mrCacheField.importSharedItems( rAttribs ); return this; }
+ if( nElement == XLS_TOKEN( fieldGroup ) ) { mrCacheField.importFieldGroup( rAttribs ); return this; }
+ break;
+
+ case XLS_TOKEN( fieldGroup ):
+ switch( nElement )
+ {
+ case XLS_TOKEN( rangePr ): mrCacheField.importRangePr( rAttribs ); break;
+ case XLS_TOKEN( discretePr ): return this;
+ case XLS_TOKEN( groupItems ): return this;
+ }
+ break;
+
+ case XLS_TOKEN( sharedItems ): mrCacheField.importSharedItem( nElement, rAttribs ); break;
+ case XLS_TOKEN( discretePr ): mrCacheField.importDiscretePrItem( nElement, rAttribs ); break;
+ case XLS_TOKEN( groupItems ): mrCacheField.importGroupItem( nElement, rAttribs ); break;
}
- return false;
+ return 0;
+}
+
+void OoxPivotCacheFieldContext::onStartElement( const AttributeList& rAttribs )
+{
+ if( isRootElement() )
+ mrCacheField.importCacheField( rAttribs );
}
-void OoxPivotCacheFragment::onStartElement( const AttributeList& rAttribs )
+ContextHandlerRef OoxPivotCacheFieldContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
{
- switch ( getCurrentElement() )
+ switch( getCurrentElement() )
{
+ case OOBIN_ID_PCDFIELD:
+ switch( nRecId )
+ {
+ case OOBIN_ID_PCDFSHAREDITEMS: mrCacheField.importPCDFSharedItems( rStrm ); return this;
+ case OOBIN_ID_PCDFIELDGROUP: mrCacheField.importPCDFieldGroup( rStrm ); return this;
+ }
+ break;
+
+ case OOBIN_ID_PCDFIELDGROUP:
+ switch( nRecId )
+ {
+ case OOBIN_ID_PCDFRANGEPR: mrCacheField.importPCDFRangePr( rStrm ); break;
+ case OOBIN_ID_PCDFDISCRETEPR: return this;
+ case OOBIN_ID_PCDFGROUPITEMS: return this;
+ }
+ break;
+
+ case OOBIN_ID_PCDFSHAREDITEMS: mrCacheField.importPCDFSharedItem( nRecId, rStrm ); break;
+ case OOBIN_ID_PCDFDISCRETEPR: mrCacheField.importPCDFDiscretePrItem( nRecId, rStrm ); break;
+ case OOBIN_ID_PCDFGROUPITEMS: mrCacheField.importPCDFGroupItem( nRecId, rStrm ); break;
+ }
+ return 0;
+}
+
+void OoxPivotCacheFieldContext::onStartRecord( RecordInputStream& rStrm )
+{
+ if( isRootElement() )
+ mrCacheField.importPCDField( rStrm );
+}
+
+// ============================================================================
+
+OoxPivotCacheDefinitionFragment::OoxPivotCacheDefinitionFragment(
+ const WorkbookHelper& rHelper, const OUString& rFragmentPath, PivotCache& rPivotCache ) :
+ OoxWorkbookFragmentBase( rHelper, rFragmentPath ),
+ mrPivotCache( rPivotCache )
+{
+}
+
+ContextHandlerRef OoxPivotCacheDefinitionFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case XML_ROOT_CONTEXT:
+ if( nElement == XLS_TOKEN( pivotCacheDefinition ) ) { mrPivotCache.importPivotCacheDefinition( rAttribs ); return this; }
+ break;
+
case XLS_TOKEN( pivotCacheDefinition ):
- importPivotCacheDefinition( rAttribs );
+ switch( nElement )
+ {
+ case XLS_TOKEN( cacheSource ): mrPivotCache.importCacheSource( rAttribs ); return this;
+ case XLS_TOKEN( cacheFields ): return this;
+ }
break;
+
case XLS_TOKEN( cacheSource ):
- importCacheSource( rAttribs );
- break;
- case XLS_TOKEN( worksheetSource ):
- if ( mbValidSource )
- importWorksheetSource( rAttribs );
+ if( nElement == XLS_TOKEN( worksheetSource ) ) mrPivotCache.importWorksheetSource( rAttribs, getRelations() );
break;
+
case XLS_TOKEN( cacheFields ):
- if ( mbValidSource )
- maPCacheData.maFields.reserve( rAttribs.getUnsignedInteger(XML_count, 1) );
+ if( nElement == XLS_TOKEN( cacheField ) ) return new OoxPivotCacheFieldContext( *this, mrPivotCache.createCacheField() );
break;
- case XLS_TOKEN( cacheField ):
- if ( mbValidSource )
- importCacheField( rAttribs );
+ }
+ return 0;
+}
+
+ContextHandlerRef OoxPivotCacheDefinitionFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+{
+ switch( getCurrentElement() )
+ {
+ case XML_ROOT_CONTEXT:
+ if( nRecId == OOBIN_ID_PCDEFINITION ) { mrPivotCache.importPCDefinition( rStrm ); return this; }
break;
- case XLS_TOKEN( sharedItems ):
- if ( mbValidSource )
- maPCacheData.maFields.back().maItems.reserve( rAttribs.getUnsignedInteger(XML_count, 1) );
+
+ case OOBIN_ID_PCDEFINITION:
+ switch( nRecId )
+ {
+ case OOBIN_ID_PCDSOURCE: mrPivotCache.importPCDSource( rStrm ); return this;
+ case OOBIN_ID_PCDFIELDS: return this;
+ }
break;
- case XLS_TOKEN( s ):
- if ( mbValidSource )
- maPCacheData.maFields.back().maItems.push_back( rAttribs.getString( XML_v, OUString() ) );
+
+ case OOBIN_ID_PCDSOURCE:
+ if( nRecId == OOBIN_ID_PCDSHEETSOURCE ) mrPivotCache.importPCDSheetSource( rStrm, getRelations() );
+ break;
+
+ case OOBIN_ID_PCDFIELDS:
+ if( nRecId == OOBIN_ID_PCDFIELD ) return new OoxPivotCacheFieldContext( *this, mrPivotCache.createCacheField() );
break;
}
+ return 0;
}
-void OoxPivotCacheFragment::finalizeImport()
+const RecordInfo* OoxPivotCacheDefinitionFragment::getRecordInfos() const
{
- if( mbValidSource )
- getPivotTables().setPivotCache( mnCacheId, maPCacheData );
+ static const RecordInfo spRecInfos[] =
+ {
+ { OOBIN_ID_PCDEFINITION, OOBIN_ID_PCDEFINITION + 1 },
+ { OOBIN_ID_PCDFDISCRETEPR, OOBIN_ID_PCDFDISCRETEPR + 1 },
+ { OOBIN_ID_PCDFGROUPITEMS, OOBIN_ID_PCDFGROUPITEMS + 1 },
+ { OOBIN_ID_PCDFIELD, OOBIN_ID_PCDFIELD + 1 },
+ { OOBIN_ID_PCDFIELDGROUP, OOBIN_ID_PCDFIELDGROUP + 1 },
+ { OOBIN_ID_PCDFIELDS, OOBIN_ID_PCDFIELDS + 1 },
+ { OOBIN_ID_PCDFRANGEPR, OOBIN_ID_PCDFRANGEPR + 1 },
+ { OOBIN_ID_PCDFSHAREDITEMS, OOBIN_ID_PCDFSHAREDITEMS + 1 },
+ { OOBIN_ID_PCITEM_ARRAY, OOBIN_ID_PCITEM_ARRAY + 1 },
+ { OOBIN_ID_PCDSHEETSOURCE, OOBIN_ID_PCDSHEETSOURCE + 1 },
+ { OOBIN_ID_PCDSOURCE, OOBIN_ID_PCDSOURCE + 1 },
+ { -1, -1 }
+ };
+ return spRecInfos;
}
-void OoxPivotCacheFragment::importPivotCacheDefinition( const AttributeList& /*rAttribs*/ )
+void OoxPivotCacheDefinitionFragment::finalizeImport()
{
+ // finalize the cache (check source range etc.)
+ mrPivotCache.finalizeImport();
+
+ // load the cache records, if the cache is based on a deleted or an external worksheet
+ if( mrPivotCache.isValidDataSource() && mrPivotCache.isBasedOnDummySheet() )
+ {
+ OUString aRecFragmentPath = getRelations().getFragmentPathFromRelId( mrPivotCache.getRecordsRelId() );
+ if( aRecFragmentPath.getLength() > 0 )
+ importOoxFragment( new OoxPivotCacheRecordsFragment( *this, aRecFragmentPath, mrPivotCache ) );
+ }
}
-void OoxPivotCacheFragment::importCacheSource( const AttributeList& rAttribs )
+// ============================================================================
+
+OoxPivotCacheRecordsFragment::OoxPivotCacheRecordsFragment( const WorkbookHelper& rHelper,
+ const OUString& rFragmentPath, const PivotCache& rPivotCache ) :
+ OoxWorksheetFragmentBase( rHelper, rFragmentPath, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, rPivotCache.getSourceRange().Sheet ),
+ mrPivotCache( rPivotCache ),
+ mnCol( 0 ),
+ mnRow( 0 ),
+ mbInRecord( false )
{
- switch ( rAttribs.getToken(XML_type, XML_TOKEN_INVALID) )
+ // prepare sheet: insert column header names into top row
+ rPivotCache.writeSourceHeaderCells( *this );
+}
+
+ContextHandlerRef OoxPivotCacheRecordsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
{
- case XML_worksheet:
- maPCacheData.meSourceType = PivotCacheData::WORKSHEET;
- maPCacheData.mpSourceProp.reset( new PivotCacheData::WorksheetSource );
- mbValidSource = true;
+ case XML_ROOT_CONTEXT:
+ if( nElement == XLS_TOKEN( pivotCacheRecords ) ) return this;
break;
- case XML_external:
- maPCacheData.meSourceType = PivotCacheData::EXTERNAL;
- maPCacheData.mpSourceProp.reset( new PivotCacheData::ExternalSource );
- mbValidSource = true;
+
+ case XLS_TOKEN( pivotCacheRecords ):
+ if( nElement == XLS_TOKEN( r ) ) { startCacheRecord(); return this; }
break;
- default:
- // unsupported case source type.
+
+ case XLS_TOKEN( r ):
+ {
+ PivotCacheItem aItem;
+ switch( nElement )
+ {
+ case XLS_TOKEN( m ): break;
+ case XLS_TOKEN( s ): aItem.readString( rAttribs ); break;
+ case XLS_TOKEN( n ): aItem.readNumeric( rAttribs ); break;
+ case XLS_TOKEN( d ): aItem.readDate( rAttribs ); break;
+ case XLS_TOKEN( b ): aItem.readBool( rAttribs ); break;
+ case XLS_TOKEN( e ): aItem.readError( rAttribs, getUnitConverter() ); break;
+ case XLS_TOKEN( x ): aItem.readIndex( rAttribs ); break;
+ default: OSL_ENSURE( false, "OoxPivotCacheRecordsFragment::onCreateContext - unexpected element" );
+ }
+ mrPivotCache.writeSourceDataCell( *this, mnCol, mnRow, aItem );
+ ++mnCol;
+ }
break;
}
+ return 0;
}
-void OoxPivotCacheFragment::importWorksheetSource( const AttributeList& rAttribs )
+ContextHandlerRef OoxPivotCacheRecordsFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
{
- if ( maPCacheData.meSourceType != PivotCacheData::WORKSHEET )
+ switch( getCurrentElement() )
+ {
+ case XML_ROOT_CONTEXT:
+ if( nRecId == OOBIN_ID_PCRECORDS ) return this;
+ break;
+
+ case OOBIN_ID_PCRECORDS:
+ switch( nRecId )
+ {
+ case OOBIN_ID_PCRECORD: importPCRecord( rStrm ); break;
+ case OOBIN_ID_PCRECORDDT: startCacheRecord(); break;
+ default: importPCRecordItem( nRecId, rStrm ); break;
+ }
+ break;
+ }
+ return 0;
+}
+
+const RecordInfo* OoxPivotCacheRecordsFragment::getRecordInfos() const
+{
+ static const RecordInfo spRecInfos[] =
+ {
+ { OOBIN_ID_PCRECORDS, OOBIN_ID_PCRECORDS + 1 },
+ { -1, -1 }
+ };
+ return spRecInfos;
+}
+
+// private --------------------------------------------------------------------
+
+void OoxPivotCacheRecordsFragment::startCacheRecord()
+{
+ mnCol = 0;
+ ++mnRow;
+ mbInRecord = true;
+}
+
+void OoxPivotCacheRecordsFragment::importPCRecord( RecordInputStream& rStrm )
+{
+ startCacheRecord();
+ mrPivotCache.importPCRecord( rStrm, *this, mnRow );
+ mbInRecord = false;
+}
+
+void OoxPivotCacheRecordsFragment::importPCRecordItem( sal_Int32 nRecId, RecordInputStream& rStrm )
+{
+ if( mbInRecord )
+ {
+ PivotCacheItem aItem;
+ switch( nRecId )
+ {
+ case OOBIN_ID_PCITEM_MISSING: break;
+ case OOBIN_ID_PCITEM_STRING: aItem.readString( rStrm ); break;
+ case OOBIN_ID_PCITEM_DOUBLE: aItem.readDouble( rStrm ); break;
+ case OOBIN_ID_PCITEM_DATE: aItem.readDate( rStrm ); break;
+ case OOBIN_ID_PCITEM_BOOL: aItem.readBool( rStrm ); break;
+ case OOBIN_ID_PCITEM_ERROR: aItem.readError( rStrm ); break;
+ case OOBIN_ID_PCITEM_INDEX: aItem.readIndex( rStrm ); break;
+ default: OSL_ENSURE( false, "OoxPivotCacheRecordsFragment::importPCRecordItem - unexpected record" );
+ }
+ mrPivotCache.writeSourceDataCell( *this, mnCol, mnRow, aItem );
+ ++mnCol;
+ }
+}
+
+// ============================================================================
+// ============================================================================
+
+namespace {
+
+bool lclSeekToPCDField( BiffInputStream& rStrm )
+{
+ sal_Int64 nRecHandle = rStrm.getRecHandle();
+ while( rStrm.startNextRecord() )
+ if( rStrm.getRecId() == BIFF_ID_PCDFIELD )
+ return true;
+ rStrm.startRecordByHandle( nRecHandle );
+ return false;
+}
+
+} // namespace
+
+// ----------------------------------------------------------------------------
+
+BiffPivotCacheFragment::BiffPivotCacheFragment(
+ const WorkbookHelper& rHelper, const ::rtl::OUString& rStrmName, PivotCache& rPivotCache ) :
+ BiffWorkbookFragmentBase( rHelper, rStrmName, true ),
+ mrPivotCache( rPivotCache )
+{
+}
+
+bool BiffPivotCacheFragment::importFragment()
+{
+ if( mrStrm.startNextRecord() && (mrStrm.getRecId() == BIFF_ID_PCDEFINITION) )
+ {
+ // read PCDEFINITION and optional PCDEFINITION2 records
+ mrPivotCache.importPCDefinition( mrStrm );
+
+ // read cache fields as long as another PCDFIELD record can be found
+ while( lclSeekToPCDField( mrStrm ) )
+ mrPivotCache.createCacheField( true ).importPCDField( mrStrm );
+
+ // finalize the cache (check source range etc.)
+ mrPivotCache.finalizeImport();
+
+ // load the cache records, if the cache is based on a deleted or an external worksheet
+ if( mrPivotCache.isValidDataSource() && mrPivotCache.isBasedOnDummySheet() )
+ {
+ /* Last call of lclSeekToPCDField() failed and kept stream position
+ unchanged. Stream should point to source data table now. */
+ BiffPivotCacheRecordsContext aContext( *this, mrPivotCache );
+ if( aContext.isValidSheet() )
+ while( mrStrm.startNextRecord() && (mrStrm.getRecId() != BIFF_ID_EOF) )
+ aContext.importRecord();
+ }
+ }
+
+ return mrStrm.getRecId() == BIFF_ID_EOF;
+}
+
+// ============================================================================
+
+BiffPivotCacheRecordsContext::BiffPivotCacheRecordsContext(
+ const BiffWorkbookFragmentBase& rFragment, const PivotCache& rPivotCache ) :
+ BiffWorksheetContextBase( rFragment, ISegmentProgressBarRef(), SHEETTYPE_WORKSHEET, rPivotCache.getSourceRange().Sheet ),
+ mrPivotCache( rPivotCache ),
+ mnColIdx( 0 ),
+ mnRow( 0 ),
+ mbHasShared( false ),
+ mbInRow( false )
+{
+ // prepare sheet: insert column header names into top row
+ mrPivotCache.writeSourceHeaderCells( *this );
+
+ // find all fields without shared items, remember column indexes in source data
+ for( sal_Int32 nFieldIdx = 0, nFieldCount = mrPivotCache.getCacheFieldCount(), nCol = 0; nFieldIdx < nFieldCount; ++nFieldIdx )
+ {
+ const PivotCacheField* pCacheField = mrPivotCache.getCacheField( nFieldIdx );
+ if( pCacheField && pCacheField->isDatabaseField() )
+ {
+ if( pCacheField->hasSharedItems() )
+ mbHasShared = true;
+ else
+ maUnsharedCols.push_back( nCol );
+ ++nCol;
+ }
+ }
+}
+
+void BiffPivotCacheRecordsContext::importRecord()
+{
+ if( mrStrm.getRecId() == BIFF_ID_PCITEM_INDEXLIST )
+ {
+ OSL_ENSURE( mbHasShared, "BiffPivotCacheRecordsContext::importRecord - unexpected PCITEM_INDEXLIST record" );
+ // PCITEM_INDEXLIST record always in front of a new data row
+ startNextRow();
+ mrPivotCache.importPCItemIndexList( mrStrm, *this, mnRow );
+ mbInRow = !maUnsharedCols.empty(); // mbInRow remains true, if unshared items are expected
return;
+ }
- PivotCacheData::WorksheetSource* pSrc = static_cast<PivotCacheData::WorksheetSource*>(
- maPCacheData.mpSourceProp.get() );
+ PivotCacheItem aItem;
+ switch( mrStrm.getRecId() )
+ {
+ case BIFF_ID_PCITEM_MISSING: break;
+ case BIFF_ID_PCITEM_STRING: aItem.readString( mrStrm, *this ); break;
+ case BIFF_ID_PCITEM_DOUBLE: aItem.readDouble( mrStrm ); break;
+ case BIFF_ID_PCITEM_INTEGER: aItem.readInteger( mrStrm ); break;
+ case BIFF_ID_PCITEM_DATE: aItem.readDate( mrStrm ); break;
+ case BIFF_ID_PCITEM_BOOL: aItem.readBool( mrStrm ); break;
+ case BIFF_ID_PCITEM_ERROR: aItem.readError( mrStrm ); break;
+ default: return; // unknown record, ignore
+ }
- pSrc->maSrcRange = rAttribs.getString( XML_ref, OUString() );
- pSrc->maSheetName = rAttribs.getString( XML_sheet, OUString() );
+ // find next column index, might start new row if no fields with shared items exist
+ if( mbInRow && (mnColIdx == maUnsharedCols.size()) )
+ {
+ OSL_ENSURE( !mbHasShared, "BiffPivotCacheRecordsContext::importRecord - PCITEM_INDEXLIST record missing" );
+ mbInRow = mbHasShared; // do not leave current row if PCITEM_INDEXLIST is expected
+ }
+ // start next row on first call, or on row wrap without shared items
+ if( !mbInRow )
+ startNextRow();
+
+ // write the item data to the sheet cell
+ OSL_ENSURE( mnColIdx < maUnsharedCols.size(), "BiffPivotCacheRecordsContext::importRecord - invalid column index" );
+ if( mnColIdx < maUnsharedCols.size() )
+ mrPivotCache.writeSourceDataCell( *this, maUnsharedCols[ mnColIdx ], mnRow, aItem );
+ ++mnColIdx;
}
-void OoxPivotCacheFragment::importCacheField( const AttributeList& rAttribs )
+void BiffPivotCacheRecordsContext::startNextRow()
{
- PivotCacheField aField;
- aField.maName = rAttribs.getString( XML_name, OUString() );
- maPCacheData.maFields.push_back(aField);
+ mnColIdx = 0;
+ ++mnRow;
+ mbInRow = true;
}
+// ============================================================================
+
} // namespace xls
} // namespace oox
+
diff --git a/oox/source/xls/pivottablebuffer.cxx b/oox/source/xls/pivottablebuffer.cxx
index 03c04b208be3..a49a5cda70ae 100644
--- a/oox/source/xls/pivottablebuffer.cxx
+++ b/oox/source/xls/pivottablebuffer.cxx
@@ -29,242 +29,1528 @@
************************************************************************/
#include "oox/xls/pivottablebuffer.hxx"
-#include "oox/helper/propertyset.hxx"
-#include "oox/xls/addressconverter.hxx"
-#include "oox/xls/worksheetbuffer.hxx"
-
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/container/XElementAccess.hpp>
+#include <set>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/sheet/CellFlags.hpp>
+#include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp>
+#include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp>
+#include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp>
#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
+#include <com/sun/star/sheet/DataPilotFieldReference.hpp>
+#include <com/sun/star/sheet/DataPilotFieldReferenceItemType.hpp>
+#include <com/sun/star/sheet/DataPilotFieldReferenceType.hpp>
+#include <com/sun/star/sheet/DataPilotFieldShowItemsMode.hpp>
+#include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp>
+#include <com/sun/star/sheet/DataPilotFieldSortMode.hpp>
#include <com/sun/star/sheet/GeneralFunction.hpp>
-#include <com/sun/star/sheet/XCellRangeData.hpp>
-#include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
+#include <com/sun/star/sheet/XDataPilotDataLayoutFieldSupplier.hpp>
#include <com/sun/star/sheet/XDataPilotField.hpp>
-#include <com/sun/star/sheet/XDataPilotTables.hpp>
#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp>
-#include <com/sun/star/sheet/XSheetFilterDescriptor.hpp>
-#include <com/sun/star/sheet/XSpreadsheet.hpp>
-#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
-#include <com/sun/star/table/CellRangeAddress.hpp>
-#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/sheet/XSheetOperation.hpp>
+#include "properties.hxx"
+#include "oox/helper/attributelist.hxx"
+#include "oox/helper/propertyset.hxx"
+#include "oox/helper/recordinputstream.hxx"
+#include "oox/xls/addressconverter.hxx"
+#include "oox/xls/biffinputstream.hxx"
+using ::rtl::OUString;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_SET_THROW;
+using ::com::sun::star::beans::XPropertySet;
using ::com::sun::star::container::XIndexAccess;
using ::com::sun::star::container::XNameAccess;
using ::com::sun::star::container::XNamed;
-using ::com::sun::star::sheet::XCellRangeData;
+using ::com::sun::star::table::CellAddress;
+using ::com::sun::star::sheet::DataPilotFieldOrientation;
+using ::com::sun::star::sheet::XDataPilotDataLayoutFieldSupplier;
using ::com::sun::star::sheet::XDataPilotDescriptor;
using ::com::sun::star::sheet::XDataPilotField;
using ::com::sun::star::sheet::XDataPilotTables;
using ::com::sun::star::sheet::XDataPilotTablesSupplier;
-using ::com::sun::star::sheet::XSheetFilterDescriptor;
-using ::com::sun::star::sheet::XSpreadsheet;
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-using ::com::sun::star::table::XCellRange;
-using ::com::sun::star::uno::Exception;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::rtl::OUString;
+using ::com::sun::star::sheet::XSheetOperation;
namespace oox {
namespace xls {
// ============================================================================
-PivotCacheData::PivotCacheData() :
- meSourceType( WORKSHEET ),
- mpSourceProp( static_cast<BaseSource*>(NULL) )
+namespace {
+
+const sal_Int32 OOX_PT_DATALAYOUTFIELD = -2; /// Placeholder index of data layout field.
+
+const sal_Int32 OOX_PT_PREVIOUS_ITEM = 0x001000FC; /// Calculation of data item result is based on previous item.
+const sal_Int32 OOX_PT_NEXT_ITEM = 0x001000FD; /// Calculation of data item result is based on next item.
+
+// ----------------------------------------------------------------------------
+
+const sal_uInt32 OOBIN_PTFIELD_DATAFIELD = 0x00000008;
+const sal_uInt32 OOBIN_PTFIELD_DEFAULT = 0x00000100;
+const sal_uInt32 OOBIN_PTFIELD_SUM = 0x00000200;
+const sal_uInt32 OOBIN_PTFIELD_COUNTA = 0x00000400;
+const sal_uInt32 OOBIN_PTFIELD_AVERAGE = 0x00000800;
+const sal_uInt32 OOBIN_PTFIELD_MAX = 0x00001000;
+const sal_uInt32 OOBIN_PTFIELD_MIN = 0x00002000;
+const sal_uInt32 OOBIN_PTFIELD_PRODUCT = 0x00004000;
+const sal_uInt32 OOBIN_PTFIELD_COUNT = 0x00008000;
+const sal_uInt32 OOBIN_PTFIELD_STDDEV = 0x00010000;
+const sal_uInt32 OOBIN_PTFIELD_STDDEVP = 0x00020000;
+const sal_uInt32 OOBIN_PTFIELD_VAR = 0x00040000;
+const sal_uInt32 OOBIN_PTFIELD_VARP = 0x00080000;
+
+const sal_uInt32 OOBIN_PTFIELD_SHOWALL = 0x00000020;
+const sal_uInt32 OOBIN_PTFIELD_OUTLINE = 0x00000040;
+const sal_uInt32 OOBIN_PTFIELD_INSERTBLANKROW = 0x00000080;
+const sal_uInt32 OOBIN_PTFIELD_SUBTOTALTOP = 0x00000100;
+const sal_uInt32 OOBIN_PTFIELD_INSERTPAGEBREAK = 0x00000800;
+const sal_uInt32 OOBIN_PTFIELD_AUTOSORT = 0x00001000;
+const sal_uInt32 OOBIN_PTFIELD_SORTASCENDING = 0x00002000;
+const sal_uInt32 OOBIN_PTFIELD_AUTOSHOW = 0x00004000;
+const sal_uInt32 OOBIN_PTFIELD_AUTOSHOWTOP = 0x00008000;
+const sal_uInt32 OOBIN_PTFIELD_MULTIPAGEITEMS = 0x00080000;
+
+const sal_uInt16 OOBIN_PTFITEM_HIDDEN = 0x0001;
+const sal_uInt16 OOBIN_PTFITEM_HIDEDETAILS = 0x0002;
+
+const sal_uInt8 OOBIN_PTPAGEFIELD_HASNAME = 0x01;
+const sal_uInt8 OOBIN_PTPAGEFIELD_HASOLAPCAPTION = 0x02;
+const sal_Int32 OOBIN_PTPAGEFIELD_MULTIITEMS = 0x001000FE;
+
+const sal_uInt16 OOBIN_PTFILTER_HASNAME = 0x0001;
+const sal_uInt16 OOBIN_PTFILTER_HASDESCRIPTION = 0x0002;
+const sal_uInt16 OOBIN_PTFILTER_HASSTRVALUE1 = 0x0004;
+const sal_uInt16 OOBIN_PTFILTER_HASSTRVALUE2 = 0x0008;
+
+const sal_uInt8 OOBIN_TOP10FILTER_TOP = 0x01;
+const sal_uInt8 OOBIN_TOP10FILTER_PERCENT = 0x02;
+
+const sal_uInt32 OOBIN_PTDEF_SHOWITEMS = 0x00000100;
+const sal_uInt32 OOBIN_PTDEF_DISABLEFIELDLIST = 0x00000400;
+const sal_uInt32 OOBIN_PTDEF_HIDECALCMEMBERS = 0x00001000;
+const sal_uInt32 OOBIN_PTDEF_WITHHIDDENTOTALS = 0x00002000;
+const sal_uInt32 OOBIN_PTDEF_HIDEDRILL = 0x00100000;
+const sal_uInt32 OOBIN_PTDEF_PRINTDRILL = 0x00200000;
+const sal_uInt32 OOBIN_PTDEF_HIDEHEADERS = 0x80000000;
+
+const sal_uInt32 OOBIN_PTDEF_SHOWEMPTYROW = 0x00000004;
+const sal_uInt32 OOBIN_PTDEF_SHOWEMPTYCOL = 0x00000008;
+const sal_uInt32 OOBIN_PTDEF_ENABLEDRILL = 0x00000020;
+const sal_uInt32 OOBIN_PTDEF_PRESERVEFORMATTING = 0x00000080;
+const sal_uInt32 OOBIN_PTDEF_SHOWERROR = 0x00000200;
+const sal_uInt32 OOBIN_PTDEF_SHOWMISSING = 0x00000400;
+const sal_uInt32 OOBIN_PTDEF_PAGEOVERTHENDOWN = 0x00000800;
+const sal_uInt32 OOBIN_PTDEF_SUBTOTALHIDDENITEMS = 0x00001000;
+const sal_uInt32 OOBIN_PTDEF_ROWGRANDTOTALS = 0x00002000;
+const sal_uInt32 OOBIN_PTDEF_COLGRANDTOTALS = 0x00004000;
+const sal_uInt32 OOBIN_PTDEF_FIELDPRINTTITLES = 0x00008000;
+const sal_uInt32 OOBIN_PTDEF_ITEMPRINTTITLES = 0x00020000;
+const sal_uInt32 OOBIN_PTDEF_MERGEITEM = 0x00040000;
+const sal_uInt32 OOBIN_PTDEF_HASDATACAPTION = 0x00080000;
+const sal_uInt32 OOBIN_PTDEF_HASGRANDTOTALCAPTION = 0x00100000;
+const sal_uInt32 OOBIN_PTDEF_HASPAGESTYLE = 0x00200000;
+const sal_uInt32 OOBIN_PTDEF_HASPIVOTTABLESTYLE = 0x00400000;
+const sal_uInt32 OOBIN_PTDEF_HASVACATEDSTYLE = 0x00800000;
+const sal_uInt32 OOBIN_PTDEF_HASTAG = 0x40000000;
+
+const sal_uInt32 OOBIN_PTDEF_NOERRORCAPTION = 0x00000040;
+const sal_uInt32 OOBIN_PTDEF_NOMISSINGCAPTION = 0x00000080;
+const sal_uInt32 OOBIN_PTDEF_HASROWHEADERCAPTION = 0x00000400;
+const sal_uInt32 OOBIN_PTDEF_HASCOLHEADERCAPTION = 0x00000800;
+const sal_uInt32 OOBIN_PTDEF_FIELDLISTSORTASC = 0x00001000;
+const sal_uInt32 OOBIN_PTDEF_NOCUSTOMLISTSORT = 0x00004000;
+
+const sal_uInt8 OOBIN_PTDEF_ROWAXIS = 1;
+const sal_uInt8 OOBIN_PTDEF_COLAXIS = 2;
+
+// ----------------------------------------------------------------------------
+
+const sal_uInt16 BIFF_PT_NOSTRING = 0xFFFF;
+
+const sal_uInt16 BIFF_PTFIELD_DATAFIELD = 0x0008;
+const sal_uInt16 BIFF_PTFIELD_DEFAULT = 0x0001;
+const sal_uInt16 BIFF_PTFIELD_SUM = 0x0002;
+const sal_uInt16 BIFF_PTFIELD_COUNTA = 0x0004;
+const sal_uInt16 BIFF_PTFIELD_AVERAGE = 0x0008;
+const sal_uInt16 BIFF_PTFIELD_MAX = 0x0010;
+const sal_uInt16 BIFF_PTFIELD_MIN = 0x0020;
+const sal_uInt16 BIFF_PTFIELD_PRODUCT = 0x0040;
+const sal_uInt16 BIFF_PTFIELD_COUNT = 0x0080;
+const sal_uInt16 BIFF_PTFIELD_STDDEV = 0x0100;
+const sal_uInt16 BIFF_PTFIELD_STDDEVP = 0x0200;
+const sal_uInt16 BIFF_PTFIELD_VAR = 0x0400;
+const sal_uInt16 BIFF_PTFIELD_VARP = 0x0800;
+
+const sal_uInt32 BIFF_PTFIELD2_SHOWALL = 0x00000001;
+const sal_uInt32 BIFF_PTFIELD2_AUTOSORT = 0x00000200;
+const sal_uInt32 BIFF_PTFIELD2_SORTASCENDING = 0x00000400;
+const sal_uInt32 BIFF_PTFIELD2_AUTOSHOW = 0x00000800;
+const sal_uInt32 BIFF_PTFIELD2_AUTOSHOWTOP = 0x00001000;
+const sal_uInt32 BIFF_PTFIELD2_OUTLINE = 0x00200000;
+const sal_uInt32 BIFF_PTFIELD2_INSERTBLANKROW = 0x00400000;
+const sal_uInt32 BIFF_PTFIELD2_SUBTOTALTOP = 0x00800000;
+
+const sal_uInt16 BIFF_PTFITEM_HIDDEN = 0x0001;
+const sal_uInt16 BIFF_PTFITEM_HIDEDETAILS = 0x0002;
+
+const sal_uInt16 BIFF_PTDEF_ROWGRANDTOTALS = 0x0001;
+const sal_uInt16 BIFF_PTDEF_COLGRANDTOTALS = 0x0002;
+
+const sal_uInt8 BIFF_PTDEF_ROWAXIS = 1;
+const sal_uInt8 BIFF_PTDEF_COLAXIS = 2;
+
+const sal_uInt32 BIFF_PTDEF2_PAGEOVERTHENDOWN = 0x00000001;
+const sal_uInt32 BIFF_PTDE2F_ENABLEDRILL = 0x00020000;
+const sal_uInt32 BIFF_PTDEF2_PRESERVEFORMATTING = 0x00080000;
+const sal_uInt32 BIFF_PTDEF2_MERGEITEM = 0x00100000;
+const sal_uInt32 BIFF_PTDEF2_SHOWERROR = 0x00200000;
+const sal_uInt32 BIFF_PTDEF2_SHOWMISSING = 0x00400000;
+const sal_uInt32 BIFF_PTDEF2_SUBTOTALHIDDENITEMS = 0x00800000;
+
+const sal_Int16 BIFF_PTPAGEFIELDS_ALLITEMS = 0x7FFD;
+
+const sal_Int16 BIFF_PTDATAFIELD_PREVIOUS = 0x7FFB;
+const sal_Int16 BIFF_PTDATAFIELD_NEXT = 0x7FFC;
+
+// ----------------------------------------------------------------------------
+
+OUString lclReadPivotString( const WorkbookHelper& rHelper, BiffInputStream& rStrm, sal_uInt16 nLen )
{
+ if( nLen == BIFF_PT_NOSTRING )
+ return OUString();
+ return (rHelper.getBiff() == BIFF8) ? rStrm.readUniString( nLen ) : rStrm.readCharArray( nLen, rHelper.getTextEncoding() );
}
-PivotCacheData::WorksheetSource* PivotCacheData::getWorksheetSource() const
+} // namespace
+
+// ============================================================================
+
+PTFieldItemModel::PTFieldItemModel() :
+ mnCacheItem( -1 ),
+ mnType( XML_data ),
+ mbShowDetails( true ),
+ mbHidden( false )
{
- if ( meSourceType != WORKSHEET )
- return NULL;
- return static_cast<WorksheetSource*>( mpSourceProp.get() );
}
-PivotCacheData::ExternalSource* PivotCacheData::getExternalSource() const
+void PTFieldItemModel::setBinType( sal_uInt16 nType )
{
- if ( meSourceType != EXTERNAL )
- return NULL;
- return static_cast<ExternalSource*>( mpSourceProp.get() );
+ static const sal_Int32 spnTypes[] = { XML_data, XML_default,
+ XML_sum, XML_countA, XML_avg, XML_max, XML_min, XML_product, XML_count,
+ XML_stdDev, XML_stdDevP, XML_var, XML_varP, XML_grand, XML_blank };
+ mnType = STATIC_ARRAY_SELECT( spnTypes, nType, XML_data );
}
-// ============================================================================
+// ----------------------------------------------------------------------------
+
+PTFieldModel::PTFieldModel() :
+ mnAxis( XML_TOKEN_INVALID ),
+ mnNumFmtId( 0 ),
+ mnAutoShowItems( 10 ),
+ mnAutoShowRankBy( -1 ),
+ mnSortType( XML_manual ),
+ mnSortRefField( -1 ),
+ mnSortRefItem( -1 ),
+ mbDataField( false ),
+ mbDefaultSubtotal( true ),
+ mbSumSubtotal( false ),
+ mbCountASubtotal( false ),
+ mbAverageSubtotal( false ),
+ mbMaxSubtotal( false ),
+ mbMinSubtotal( false ),
+ mbProductSubtotal( false ),
+ mbCountSubtotal( false ),
+ mbStdDevSubtotal( false ),
+ mbStdDevPSubtotal( false ),
+ mbVarSubtotal( false ),
+ mbVarPSubtotal( false ),
+ mbShowAll( true ),
+ mbOutline( true ),
+ mbSubtotalTop( true ),
+ mbInsertBlankRow( false ),
+ mbInsertPageBreak( false ),
+ mbAutoShow( false ),
+ mbTopAutoShow( true ),
+ mbMultiPageItems( false )
+{
+}
-PivotTableField::PivotTableField() :
- meAxis( ROW ),
- mbDataField( false )
+void PTFieldModel::setBinAxis( sal_uInt8 nAxis )
{
+ /* Weird. The axis field is organized as bit field, but only one of the
+ row/col/page flags are allowed at the same time and refer to the values
+ 'axisRow', 'axisCol', and 'axisPage' of the XML attribute
+ 'pivotField@axis'. Additionally, the fourth bit determines if the field
+ is a data field, which may appear combined with the row/col/page flags.
+ Therefore, this bit is unrelated to the 'axisValues' value of the
+ 'pivotField@axis' attribute, but refers to the 'pivotField@dataField'
+ boolean attribute. */
+ static const sal_Int32 spnAxisIds[] = { XML_TOKEN_INVALID, XML_axisRow, XML_axisCol, XML_TOKEN_INVALID, XML_axisPage };
+ mnAxis = STATIC_ARRAY_SELECT( spnAxisIds, nAxis, XML_TOKEN_INVALID );
}
// ----------------------------------------------------------------------------
-PivotTableData::PivotTableData()
+PTPageFieldModel::PTPageFieldModel() :
+ mnField( -1 ),
+ mnItem( OOBIN_PTPAGEFIELD_MULTIITEMS )
{
}
// ----------------------------------------------------------------------------
-PivotTableBuffer::PivotTableBuffer( const WorkbookHelper& rHelper ) :
- WorkbookHelper( rHelper )
+PTDataFieldModel::PTDataFieldModel() :
+ mnField( -1 ),
+ mnSubtotal( XML_sum ),
+ mnShowDataAs( XML_normal ),
+ mnBaseField( -1 ),
+ mnBaseItem( -1 ),
+ mnNumFmtId( 0 )
+{
+}
+
+void PTDataFieldModel::setBinSubtotal( sal_Int32 nSubtotal )
{
+ static sal_Int32 spnSubtotals[] = { XML_sum, XML_count, XML_average, XML_max, XML_min, XML_product, XML_countNums, XML_stdDev, XML_stdDevp, XML_var, XML_varp };
+ mnSubtotal = STATIC_ARRAY_SELECT( spnSubtotals, nSubtotal, XML_TOKEN_INVALID );
}
-const PivotCacheData* PivotTableBuffer::getPivotCache( sal_uInt32 nCacheId ) const
+void PTDataFieldModel::setBinShowDataAs( sal_Int32 nShowDataAs )
{
- PivotCacheMapType::const_iterator itr = maPivotCacheMap.find(nCacheId),
- itrEnd = maPivotCacheMap.end();
+ static sal_Int32 spnShowDataAs[] = { XML_normal, XML_difference, XML_percent, XML_percentDiff, XML_runTotal, XML_percentOfRow, XML_percentOfCol, XML_percentOfTotal, XML_index };
+ mnShowDataAs = STATIC_ARRAY_SELECT( spnShowDataAs, nShowDataAs, XML_TOKEN_INVALID );
+}
+
+// ----------------------------------------------------------------------------
+
+PivotTableField::PivotTableField( PivotTable& rPivotTable, sal_Int32 nFieldIndex ) :
+ WorkbookHelper( rPivotTable ),
+ mrPivotTable( rPivotTable ),
+ mnFieldIndex( nFieldIndex )
+{
+}
+
+void PivotTableField::importPivotField( const AttributeList& rAttribs )
+{
+ /* The documentation mentions a value 'axisValues' for the attribute
+ 'pivotField@axis'. But this value is not used to mark a data field, as
+ data fields may be inserted in one of the row/column/page dimensions at
+ the same time. Therefore, the boolean attribute 'pivotField@dataField'
+ is really used to mark data fields. */
+ maModel.mnAxis = rAttribs.getToken( XML_axis, XML_TOKEN_INVALID );
+ maModel.mnNumFmtId = rAttribs.getInteger( XML_numFmtId, 0 );
+ maModel.mnAutoShowItems = rAttribs.getInteger( XML_itemPageCount, 10 );
+ maModel.mnAutoShowRankBy = rAttribs.getInteger( XML_rankBy, -1 );
+ maModel.mnSortType = rAttribs.getToken( XML_sortType, XML_manual );
+ maModel.mbDataField = rAttribs.getBool( XML_dataField, false );
+ maModel.mbDefaultSubtotal = rAttribs.getBool( XML_defaultSubtotal, true );
+ maModel.mbSumSubtotal = rAttribs.getBool( XML_sumSubtotal, false );
+ maModel.mbCountASubtotal = rAttribs.getBool( XML_countASubtotal, false );
+ maModel.mbAverageSubtotal = rAttribs.getBool( XML_avgSubtotal, false );
+ maModel.mbMaxSubtotal = rAttribs.getBool( XML_maxSubtotal, false );
+ maModel.mbMinSubtotal = rAttribs.getBool( XML_minSubtotal, false );
+ maModel.mbProductSubtotal = rAttribs.getBool( XML_productSubtotal, false );
+ maModel.mbCountSubtotal = rAttribs.getBool( XML_countSubtotal, false );
+ maModel.mbStdDevSubtotal = rAttribs.getBool( XML_stdDevSubtotal, false );
+ maModel.mbStdDevPSubtotal = rAttribs.getBool( XML_stdDevPSubtotal, false );
+ maModel.mbVarSubtotal = rAttribs.getBool( XML_varSubtotal, false );
+ maModel.mbVarPSubtotal = rAttribs.getBool( XML_varPSubtotal, false );
+ maModel.mbShowAll = rAttribs.getBool( XML_showAll, true );
+ maModel.mbOutline = rAttribs.getBool( XML_outline, true );
+ maModel.mbSubtotalTop = rAttribs.getBool( XML_subtotalTop, true );
+ maModel.mbInsertBlankRow = rAttribs.getBool( XML_insertBlankRow, false );
+ maModel.mbInsertPageBreak = rAttribs.getBool( XML_insertPageBreak, false );
+ maModel.mbAutoShow = rAttribs.getBool( XML_autoShow, false );
+ maModel.mbTopAutoShow = rAttribs.getBool( XML_topAutoShow, true );
+ maModel.mbMultiPageItems = rAttribs.getBool( XML_multipleItemSelectionAllowed, false );
+}
+
+void PivotTableField::importItem( const AttributeList& rAttribs )
+{
+ PTFieldItemModel aModel;
+ aModel.mnCacheItem = rAttribs.getInteger( XML_x, -1 );
+ aModel.mnType = rAttribs.getToken( XML_t, XML_data );
+ aModel.mbShowDetails = rAttribs.getBool( XML_sd, true );
+ aModel.mbHidden = rAttribs.getBool( XML_h, false );
+ maItems.push_back( aModel );
+}
- if ( itr != itrEnd )
- return &itr->second;
+void PivotTableField::importReference( const AttributeList& rAttribs )
+{
+ // field index is stored as unsigned integer
+ maModel.mnSortRefField = static_cast< sal_Int32 >( rAttribs.getUnsignedInteger( XML_field, SAL_MAX_UINT32 ) );
+}
- return NULL;
+void PivotTableField::importReferenceItem( const AttributeList& rAttribs )
+{
+ maModel.mnSortRefItem = rAttribs.getInteger( XML_v, -1 );
}
-void PivotTableBuffer::setPivotCache( sal_uInt32 nCacheId, const PivotCacheData& aData )
+void PivotTableField::importPTField( RecordInputStream& rStrm )
{
- maPivotCacheMap.insert( PivotCacheMapType::value_type(nCacheId, aData) );
+ sal_uInt32 nFlags1, nFlags2;
+ rStrm >> nFlags1 >> maModel.mnNumFmtId >> nFlags2 >> maModel.mnAutoShowItems >> maModel.mnAutoShowRankBy;
+
+ maModel.setBinAxis( extractValue< sal_uInt8 >( nFlags1, 0, 3 ) );
+ maModel.mbDataField = getFlag( nFlags1, OOBIN_PTFIELD_DATAFIELD );
+ maModel.mbDefaultSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_DEFAULT );
+ maModel.mbSumSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_SUM );
+ maModel.mbCountASubtotal = getFlag( nFlags1, OOBIN_PTFIELD_COUNTA );
+ maModel.mbAverageSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_AVERAGE );
+ maModel.mbMaxSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_MAX );
+ maModel.mbMinSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_MIN );
+ maModel.mbProductSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_PRODUCT );
+ maModel.mbCountSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_COUNT );
+ maModel.mbStdDevSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_STDDEV );
+ maModel.mbStdDevPSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_STDDEVP );
+ maModel.mbVarSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_VAR );
+ maModel.mbVarPSubtotal = getFlag( nFlags1, OOBIN_PTFIELD_VARP );
+
+ maModel.mbShowAll = getFlag( nFlags2, OOBIN_PTFIELD_SHOWALL );
+ maModel.mbOutline = getFlag( nFlags2, OOBIN_PTFIELD_OUTLINE );
+ maModel.mbSubtotalTop = getFlag( nFlags2, OOBIN_PTFIELD_SUBTOTALTOP );
+ maModel.mbInsertBlankRow = getFlag( nFlags2, OOBIN_PTFIELD_INSERTBLANKROW );
+ maModel.mbInsertPageBreak = getFlag( nFlags2, OOBIN_PTFIELD_INSERTPAGEBREAK );
+ maModel.mbAutoShow = getFlag( nFlags2, OOBIN_PTFIELD_AUTOSHOW );
+ maModel.mbTopAutoShow = getFlag( nFlags2, OOBIN_PTFIELD_AUTOSHOWTOP );
+ maModel.mbMultiPageItems = getFlag( nFlags2, OOBIN_PTFIELD_MULTIPAGEITEMS );
+
+ bool bAutoSort = getFlag( nFlags2, OOBIN_PTFIELD_AUTOSORT );
+ bool bAscending = getFlag( nFlags2, OOBIN_PTFIELD_SORTASCENDING );
+ maModel.mnSortType = bAutoSort ? (bAscending ? XML_ascending : XML_descending) : XML_manual;
}
-PivotTableData* PivotTableBuffer::getPivotTable( const OUString& aName )
+void PivotTableField::importPTFItem( RecordInputStream& rStrm )
{
- PivotTableMapType::iterator itr = maPivotTableMap.find(aName),
- itrEnd = maPivotTableMap.end();
+ PTFieldItemModel aModel;
+ sal_uInt8 nType;
+ sal_uInt16 nFlags;
+ rStrm >> nType >> nFlags >> aModel.mnCacheItem;
- if ( itr != itrEnd )
- return &itr->second;
+ aModel.setBinType( nType );
+ aModel.mbShowDetails = !getFlag( nFlags, OOBIN_PTFITEM_HIDEDETAILS );
+ aModel.mbHidden = getFlag( nFlags, OOBIN_PTFITEM_HIDDEN );
- return NULL;
+ maItems.push_back( aModel );
}
-void PivotTableBuffer::setPivotTable( const OUString& aName, const PivotTableData& aData )
+void PivotTableField::importPTReference( RecordInputStream& rStrm )
{
- maPivotTableMap.insert( PivotTableMapType::value_type(aName, aData) );
- maCellRangeMap.addCellRange( aData.maRange );
+ rStrm >> maModel.mnSortRefField;
}
-bool PivotTableBuffer::isOverlapping( const CellAddress& aCellAddress ) const
+void PivotTableField::importPTReferenceItem( RecordInputStream& rStrm )
{
- return maCellRangeMap.isOverlapping(aCellAddress);
+ rStrm >> maModel.mnSortRefItem;
}
-void PivotTableBuffer::finalizeImport() const
+void PivotTableField::importPTField( BiffInputStream& rStrm )
{
- PivotTableMapType::const_iterator itr = maPivotTableMap.begin(), itrEnd = maPivotTableMap.end();
- for ( ; itr != itrEnd; ++itr )
- writePivotTable( itr->first, itr->second );
+ sal_uInt16 nAxis, nSubtCount, nSubtotals;
+ rStrm >> nAxis >> nSubtCount >> nSubtotals;
+ rStrm.skip( 2 ); // item count
+
+ maModel.setBinAxis( extractValue< sal_uInt8 >( nAxis, 0, 3 ) );
+ maModel.mbDataField = getFlag( nAxis, BIFF_PTFIELD_DATAFIELD );
+
+ maModel.mbDefaultSubtotal = getFlag( nSubtotals, BIFF_PTFIELD_DEFAULT );
+ maModel.mbSumSubtotal = getFlag( nSubtotals, BIFF_PTFIELD_SUM );
+ maModel.mbCountASubtotal = getFlag( nSubtotals, BIFF_PTFIELD_COUNTA );
+ maModel.mbAverageSubtotal = getFlag( nSubtotals, BIFF_PTFIELD_AVERAGE );
+ maModel.mbMaxSubtotal = getFlag( nSubtotals, BIFF_PTFIELD_MAX );
+ maModel.mbMinSubtotal = getFlag( nSubtotals, BIFF_PTFIELD_MIN );
+ maModel.mbProductSubtotal = getFlag( nSubtotals, BIFF_PTFIELD_PRODUCT );
+ maModel.mbCountSubtotal = getFlag( nSubtotals, BIFF_PTFIELD_COUNT );
+ maModel.mbStdDevSubtotal = getFlag( nSubtotals, BIFF_PTFIELD_STDDEV );
+ maModel.mbStdDevPSubtotal = getFlag( nSubtotals, BIFF_PTFIELD_STDDEVP );
+ maModel.mbVarSubtotal = getFlag( nSubtotals, BIFF_PTFIELD_VAR );
+ maModel.mbVarPSubtotal = getFlag( nSubtotals, BIFF_PTFIELD_VARP );
+
+ // set different defaults for BIFF
+ maModel.mbShowAll = maModel.mbOutline = maModel.mbSubtotalTop = false;
+
+ // read following items
+ while( (rStrm.getNextRecId() == BIFF_ID_PTFITEM) && rStrm.startNextRecord() )
+ importPTFItem( rStrm );
+
+ // read following PTFIELD2 record with additional field settings
+ if( (getBiff() == BIFF8) && (rStrm.getNextRecId() == BIFF_ID_PTFIELD2) && rStrm.startNextRecord() )
+ importPTField2( rStrm );
}
-void PivotTableBuffer::writePivotTable( const OUString& aName, const PivotTableData& aData ) const
+void PivotTableField::importPTField2( BiffInputStream& rStrm )
{
- using namespace ::com::sun::star::sheet;
+ sal_uInt32 nFlags;
+ rStrm >> nFlags;
+ maModel.mnSortRefItem = rStrm.readInt16();
+ maModel.mnAutoShowRankBy = rStrm.readInt16();
+ maModel.mnNumFmtId = rStrm.readuInt16();
+
+ maModel.mnAutoShowItems = extractValue< sal_Int32 >( nFlags, 24, 8 );
+ maModel.mbShowAll = getFlag( nFlags, BIFF_PTFIELD2_SHOWALL );
+ maModel.mbOutline = getFlag( nFlags, BIFF_PTFIELD2_OUTLINE );
+ maModel.mbSubtotalTop = getFlag( nFlags, BIFF_PTFIELD2_SUBTOTALTOP );
+ maModel.mbInsertBlankRow = getFlag( nFlags, BIFF_PTFIELD2_INSERTBLANKROW );
+ maModel.mbAutoShow = getFlag( nFlags, BIFF_PTFIELD2_AUTOSHOW );
+ maModel.mbTopAutoShow = getFlag( nFlags, BIFF_PTFIELD2_AUTOSHOWTOP );
- const PivotCacheData* pCache = getPivotCache( aData.mnCacheId );
- if ( !pCache )
+ bool bAutoSort = getFlag( nFlags, BIFF_PTFIELD2_AUTOSORT );
+ bool bAscending = getFlag( nFlags, BIFF_PTFIELD2_SORTASCENDING );
+ maModel.mnSortType = bAutoSort ? (bAscending ? XML_ascending : XML_descending) : XML_manual;
+ // mnSortRefField == OOX_PT_DATALAYOUTFIELD will indicate sorting by data field
+ if( maModel.mnSortRefItem >= 0 )
+ maModel.mnSortRefField = OOX_PT_DATALAYOUTFIELD;
+}
+
+void PivotTableField::importPTFItem( BiffInputStream& rStrm )
+{
+ PTFieldItemModel aModel;
+ sal_uInt16 nType, nFlags;
+ sal_Int16 nCacheItem;
+ rStrm >> nType >> nFlags >> nCacheItem;
+
+ aModel.setBinType( nType );
+ aModel.mnCacheItem = nCacheItem;
+ aModel.mbShowDetails = !getFlag( nFlags, BIFF_PTFITEM_HIDEDETAILS );
+ aModel.mbHidden = getFlag( nFlags, BIFF_PTFITEM_HIDDEN );
+
+ maItems.push_back( aModel );
+}
+
+void PivotTableField::finalizeImport( const Reference< XDataPilotDescriptor >& rxDPDesc )
+{
+ /* Process all fields based on source data, other fields (e.g. group
+ fields) are processed from here. PivotCacahe::getDatabaseIndex()
+ returns -1 for all fields not based on source data. */
+ Reference< XDataPilotField > xDPField;
+ sal_Int32 nDatabaseIdx = mrPivotTable.getCacheDatabaseIndex( mnFieldIndex );
+ if( (nDatabaseIdx >= 0) && rxDPDesc.is() ) try
{
- OSL_ENSURE( false, "OoxPivotTableFragment::commit: pivot cache data not found" );
- return;
+ // try to get the source field and its name from passed DataPilot descriptor
+ Reference< XIndexAccess > xDPFieldsIA( rxDPDesc->getDataPilotFields(), UNO_SET_THROW );
+ xDPField.set( xDPFieldsIA->getByIndex( nDatabaseIdx ), UNO_QUERY_THROW );
+ Reference< XNamed > xDPFieldName( xDPField, UNO_QUERY_THROW );
+ maDPFieldName = xDPFieldName->getName();
+ OSL_ENSURE( maDPFieldName.getLength() > 0, "PivotTableField::finalizeImport - no field name in source data found" );
+
+ // try to convert grouping settings
+ if( const PivotCacheField* pCacheField = mrPivotTable.getCacheField( mnFieldIndex ) )
+ {
+ // numeric grouping is done inplace, no nested group fields will appear
+ if( pCacheField->hasNumericGrouping() )
+ {
+ pCacheField->convertNumericGrouping( xDPField );
+ }
+ else if( pCacheField->hasDateGrouping() )
+ {
+ // first date group settings are inplace
+ pCacheField->createDateGroupField( xDPField );
+ // create all nested group fields (if any)
+ mrPivotTable.finalizeDateGroupingImport( xDPField, mnFieldIndex );
+ }
+ else if( pCacheField->hasParentGrouping() )
+ {
+ // create a list of all item names, needed to map between original and group items
+ ::std::vector< OUString > aItems;
+ pCacheField->getCacheItemNames( aItems );
+ PivotCacheGroupItemVector aItemNames;
+ for( ::std::vector< OUString >::iterator aIt = aItems.begin(), aEnd = aItems.end(); aIt != aEnd; ++aIt )
+ aItemNames.push_back( PivotCacheGroupItem( *aIt ) );
+ // create all nested group fields (if any)
+ mrPivotTable.finalizeParentGroupingImport( xDPField, *pCacheField, aItemNames );
+ }
+ }
}
+ catch( Exception& )
+ {
+ }
+}
- const CellRangeAddress& aRange = aData.maRange;
- Reference< XSpreadsheet > xSheet = getSheet( aRange.Sheet );
- if ( !xSheet.is() )
- return;
+void PivotTableField::finalizeDateGroupingImport( const Reference< XDataPilotField >& rxBaseDPField, sal_Int32 nBaseFieldIdx )
+{
+ if( maDPFieldName.getLength() == 0 ) // prevent endless loops if file format is broken
+ {
+ if( const PivotCacheField* pCacheField = mrPivotTable.getCacheField( mnFieldIndex ) )
+ {
+ if( !pCacheField->isDatabaseField() && pCacheField->hasDateGrouping() && (pCacheField->getGroupBaseField() == nBaseFieldIdx) )
+ {
+ maDPFieldName = pCacheField->createDateGroupField( rxBaseDPField );
+ OSL_ENSURE( maDPFieldName.getLength() > 0, "PivotTableField::finalizeDateGroupingImport - cannot create date group field" );
+ }
+ }
+ }
+}
- try
+void PivotTableField::finalizeParentGroupingImport( const Reference< XDataPilotField >& rxBaseDPField, PivotCacheGroupItemVector& orItemNames )
+{
+ if( maDPFieldName.getLength() == 0 ) // prevent endless loops if file format is broken
{
- Reference< XDataPilotTablesSupplier > xDPTSupplier( xSheet, UNO_QUERY_THROW );
+ if( const PivotCacheField* pCacheField = mrPivotTable.getCacheField( mnFieldIndex ) )
+ {
+ maDPFieldName = pCacheField->createParentGroupField( rxBaseDPField, orItemNames );
+ // on success, try to create nested group fields
+ Reference< XDataPilotField > xDPField = mrPivotTable.getDataPilotField( maDPFieldName );
+ if( xDPField.is() )
+ mrPivotTable.finalizeParentGroupingImport( xDPField, *pCacheField, orItemNames );
+ }
+ }
+}
- Reference< XDataPilotTables > xDPTables( xDPTSupplier->getDataPilotTables(), UNO_QUERY_THROW );
- Reference< XDataPilotDescriptor > xDPDesc( xDPTables->createDataPilotDescriptor(), UNO_QUERY_THROW );
- if ( pCache->meSourceType != PivotCacheData::WORKSHEET )
- return;
+void PivotTableField::convertRowField()
+{
+ convertRowColPageField( XML_axisRow );
+}
- PivotCacheData::WorksheetSource* pSrc = pCache->getWorksheetSource();
- if ( !pSrc )
- return;
+void PivotTableField::convertColField()
+{
+ convertRowColPageField( XML_axisCol );
+}
- OUString sheetname = pSrc->maSheetName;
- OUString srcrange = pSrc->maSrcRange;
+void PivotTableField::convertHiddenField()
+{
+ convertRowColPageField( XML_TOKEN_INVALID );
+}
- CellRangeAddress aSrcRange;
- if ( !getSourceRange( pSrc->maSheetName, pSrc->maSrcRange, aSrcRange ) )
- return;
+void PivotTableField::convertPageField( const PTPageFieldModel& rPageField )
+{
+ OSL_ENSURE( rPageField.mnField == mnFieldIndex, "PivotTableField::convertPageField - wrong field index" );
+ // convert all settings common for row/column/page fields
+ Reference< XDataPilotField > xDPField = convertRowColPageField( XML_axisPage );
- xDPDesc->setSourceRange(aSrcRange);
- Reference< XIndexAccess > xIA = xDPDesc->getDataPilotFields();
+ if( xDPField.is() )
+ {
+ PropertySet aPropSet( xDPField );
+ using namespace ::com::sun::star::sheet;
- bool bPageAxisExists = false;
+ // find cache item used as 'selected page'
+ sal_Int32 nCacheItem = -1;
+ if( maModel.mbMultiPageItems )
+ {
+ // multiple items may be selected
+ OSL_ENSURE( rPageField.mnItem == OOBIN_PTPAGEFIELD_MULTIITEMS, "PivotTableField::convertPageField - unexpected cache item index" );
+ // try to find a single visible item
+ bool bHasMultiItems = false;
+ for( ItemModelVector::iterator aIt = maItems.begin(), aEnd = maItems.end(); (aIt != aEnd) && !bHasMultiItems; ++aIt )
+ {
+ if( (aIt->mnType == XML_data) && !aIt->mbHidden )
+ {
+ bHasMultiItems = nCacheItem >= 0;
+ nCacheItem = bHasMultiItems ? -1 : aIt->mnCacheItem;
+ }
+ }
+ }
+ else
+ {
+ // single item may be selected
+ if( (0 <= rPageField.mnItem) && (rPageField.mnItem < static_cast< sal_Int32 >( maItems.size() )) )
+ nCacheItem = maItems[ rPageField.mnItem ].mnCacheItem;
+ }
- // Go through all fields in pivot table, and register them.
- sal_Int32 nCount = ::std::min( xIA->getCount(), static_cast<sal_Int32>(aData.maFields.size()) );
- for ( sal_Int32 i = 0; i < nCount; ++i )
+ if( nCacheItem >= 0 )
{
- Reference< XDataPilotField > xField( xIA->getByIndex(i), UNO_QUERY_THROW );
- PropertySet aProp( xField );
- Reference< XNamed > xNamed( xField, UNO_QUERY_THROW );
+ if( const PivotCacheField* pCacheField = mrPivotTable.getCacheField( mnFieldIndex ) )
+ {
+ if( const PivotCacheItem* pSharedItem = pCacheField->getCacheItem( nCacheItem ) )
+ {
+ OUString aSelectedPage = pSharedItem->getName();
+ if( aSelectedPage.getLength() > 0 )
+ aPropSet.setProperty( PROP_SelectedPage, aSelectedPage );
+ }
+ }
+ }
+ }
+}
+
+void PivotTableField::convertDataField( const PTDataFieldModel& rDataField )
+{
+ OSL_ENSURE( rDataField.mnField == mnFieldIndex, "PivotTableField::convertDataField - wrong field index" );
+ OSL_ENSURE( maModel.mbDataField, "PivotTableField::convertDataField - not a data field" );
+ Reference< XDataPilotField > xDPField = mrPivotTable.getDataPilotField( maDPFieldName );
+ if( xDPField.is() )
+ {
+ PropertySet aPropSet( xDPField );
+ using namespace ::com::sun::star::sheet;
+
+ // field orientation
+ aPropSet.setProperty( PROP_Orientation, DataPilotFieldOrientation_DATA );
- PivotTableField::AxisType eAxis = aData.maFields[i].meAxis;
- if ( aData.maFields[i].mbDataField )
- eAxis = PivotTableField::VALUES;
+ /* Field aggregation function. Documentation is a little bit confused
+ about which names to use for the count functions. The name 'count'
+ means 'count all', and 'countNum' means 'count numbers'. On the
+ other hand, for subtotals, 'countA' means 'count all', and 'count'
+ means 'count numbers' (see above). */
+ GeneralFunction eAggFunc = GeneralFunction_SUM;
+ switch( rDataField.mnSubtotal )
+ {
+ case XML_sum: eAggFunc = GeneralFunction_SUM; break;
+ case XML_count: eAggFunc = GeneralFunction_COUNT; break;
+ case XML_average: eAggFunc = GeneralFunction_AVERAGE; break;
+ case XML_max: eAggFunc = GeneralFunction_MAX; break;
+ case XML_min: eAggFunc = GeneralFunction_MIN; break;
+ case XML_product: eAggFunc = GeneralFunction_PRODUCT; break;
+ case XML_countNums: eAggFunc = GeneralFunction_COUNTNUMS; break;
+ case XML_stdDev: eAggFunc = GeneralFunction_STDEV; break;
+ case XML_stdDevp: eAggFunc = GeneralFunction_STDEVP; break;
+ case XML_var: eAggFunc = GeneralFunction_VAR; break;
+ case XML_varp: eAggFunc = GeneralFunction_VARP; break;
+ default: OSL_ENSURE( false, "PivotTableField::convertDataField - unknown aggregation function" );
+ }
+ aPropSet.setProperty( PROP_Function, eAggFunc );
- switch ( eAxis )
+ // field reference ('show data as')
+ DataPilotFieldReference aReference;
+ aReference.ReferenceType = DataPilotFieldReferenceType::NONE;
+ switch( rDataField.mnShowDataAs )
+ {
+ case XML_difference: aReference.ReferenceType = DataPilotFieldReferenceType::ITEM_DIFFERENCE; break;
+ case XML_percent: aReference.ReferenceType = DataPilotFieldReferenceType::ITEM_PERCENTAGE; break;
+ case XML_percentDiff: aReference.ReferenceType = DataPilotFieldReferenceType::ITEM_PERCENTAGE_DIFFERENCE; break;
+ case XML_runTotal: aReference.ReferenceType = DataPilotFieldReferenceType::RUNNING_TOTAL; break;
+ case XML_percentOfRow: aReference.ReferenceType = DataPilotFieldReferenceType::ROW_PERCENTAGE; break;
+ case XML_percentOfCol: aReference.ReferenceType = DataPilotFieldReferenceType::COLUMN_PERCENTAGE; break;
+ case XML_percentOfTotal: aReference.ReferenceType = DataPilotFieldReferenceType::TOTAL_PERCENTAGE; break;
+ case XML_index: aReference.ReferenceType = DataPilotFieldReferenceType::INDEX; break;
+ }
+ if( aReference.ReferenceType != DataPilotFieldReferenceType::NONE )
+ {
+ if( const PivotCacheField* pCacheField = mrPivotTable.getCacheField( rDataField.mnBaseField ) )
{
- case PivotTableField::COLUMN:
- aProp.setProperty( CREATE_OUSTRING("Orientation"), DataPilotFieldOrientation_COLUMN );
- break;
- case PivotTableField::ROW:
- aProp.setProperty( CREATE_OUSTRING("Orientation"), DataPilotFieldOrientation_ROW );
+ aReference.ReferenceField = pCacheField->getName();
+ switch( rDataField.mnBaseItem )
+ {
+ case OOX_PT_PREVIOUS_ITEM:
+ aReference.ReferenceItemType = DataPilotFieldReferenceItemType::PREVIOUS;
break;
- case PivotTableField::PAGE:
- bPageAxisExists = true;
- aProp.setProperty( CREATE_OUSTRING("Orientation"), DataPilotFieldOrientation_PAGE );
+ case OOX_PT_NEXT_ITEM:
+ aReference.ReferenceItemType = DataPilotFieldReferenceItemType::NEXT;
break;
- case PivotTableField::VALUES:
- aProp.setProperty( CREATE_OUSTRING("Orientation"), DataPilotFieldOrientation_DATA );
- break;
- default:
- OSL_ENSURE( false, "OoxPivotTableFragment::commit: unhandled case" );
+ default:
+ aReference.ReferenceItemType = DataPilotFieldReferenceItemType::NAMED;
+ if( const PivotCacheItem* pCacheItem = pCacheField->getCacheItem( rDataField.mnBaseItem ) )
+ aReference.ReferenceItemName = pCacheItem->getName();
+ }
+ aPropSet.setProperty( PROP_Reference, aReference );
}
}
- CellAddress aCell;
- aCell.Sheet = aData.maRange.Sheet;
- aCell.Column = aData.maRange.StartColumn;
- aCell.Row = aData.maRange.StartRow;
- if ( bPageAxisExists )
- aCell.Row -= 2;
-
- xDPTables->insertNewByName( aName, aCell, xDPDesc );
}
- catch ( const Exception& )
+}
+
+// private --------------------------------------------------------------------
+
+Reference< XDataPilotField > PivotTableField::convertRowColPageField( sal_Int32 nAxis )
+{
+ bool bDataLayout = mnFieldIndex == OOX_PT_DATALAYOUTFIELD;
+ Reference< XDataPilotField > xDPField = bDataLayout ? mrPivotTable.getDataLayoutField() : mrPivotTable.getDataPilotField( maDPFieldName );
+ OSL_ENSURE( bDataLayout || (nAxis == maModel.mnAxis), "PivotTableField::convertRowColPageField - field axis mismatch" );
+
+ if( xDPField.is() )
{
- OSL_ENSURE( false, "OoxPivotTableFragment::commit: exception thrown");
- return;
+ PropertySet aPropSet( xDPField );
+ using namespace ::com::sun::star::sheet;
+
+ // field orientation
+ DataPilotFieldOrientation eFieldOrient = DataPilotFieldOrientation_HIDDEN;
+ switch( nAxis )
+ {
+ case XML_axisRow: eFieldOrient = DataPilotFieldOrientation_ROW; break;
+ case XML_axisCol: eFieldOrient = DataPilotFieldOrientation_COLUMN; break;
+ case XML_axisPage: eFieldOrient = DataPilotFieldOrientation_PAGE; break;
+ }
+ if( eFieldOrient != DataPilotFieldOrientation_HIDDEN )
+ aPropSet.setProperty( PROP_Orientation, eFieldOrient );
+
+ // all other settings not for the data layout field
+ if( !bDataLayout )
+ {
+ /* Field subtotal functions. Ignore the 'defaultSubtotal' flag, if
+ explicit functions are set. This is different behaviour between
+ XML (where 'defaultSubtotal' is set regardless of other
+ functions) and binary formats (where 'defaultSubtotal' is not
+ set if other functions are set). */
+ ::std::vector< GeneralFunction > aSubtotals;
+ /* Order of subtotals is fixed in Excel. Documentation is a little
+ bit confused about which names to use for the count functions.
+ For subtotals, 'countA' means 'count all', and 'count' means
+ 'count numbers'. On the other hand, for the data field
+ aggregation function, 'count' means 'count all', and 'countNum'
+ means 'count numbers' (see below). */
+ if( maModel.mbSumSubtotal ) aSubtotals.push_back( GeneralFunction_SUM );
+ if( maModel.mbCountASubtotal ) aSubtotals.push_back( GeneralFunction_COUNT );
+ if( maModel.mbAverageSubtotal ) aSubtotals.push_back( GeneralFunction_AVERAGE );
+ if( maModel.mbMaxSubtotal ) aSubtotals.push_back( GeneralFunction_MAX );
+ if( maModel.mbMinSubtotal ) aSubtotals.push_back( GeneralFunction_MIN );
+ if( maModel.mbProductSubtotal ) aSubtotals.push_back( GeneralFunction_PRODUCT );
+ if( maModel.mbCountSubtotal ) aSubtotals.push_back( GeneralFunction_COUNTNUMS );
+ if( maModel.mbStdDevSubtotal ) aSubtotals.push_back( GeneralFunction_STDEV );
+ if( maModel.mbStdDevPSubtotal ) aSubtotals.push_back( GeneralFunction_STDEVP );
+ if( maModel.mbVarSubtotal ) aSubtotals.push_back( GeneralFunction_VAR );
+ if( maModel.mbVarPSubtotal ) aSubtotals.push_back( GeneralFunction_VARP );
+ // if no function is set manually, check the 'defaultSubtotal' flag
+ if( aSubtotals.empty() && maModel.mbDefaultSubtotal )
+ aSubtotals.push_back( GeneralFunction_AUTO );
+ aPropSet.setProperty( PROP_Subtotals, ContainerHelper::vectorToSequence( aSubtotals ) );
+
+ // layout settings
+ DataPilotFieldLayoutInfo aLayoutInfo;
+ aLayoutInfo.LayoutMode = maModel.mbOutline ?
+ (maModel.mbSubtotalTop ? DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP : DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_BOTTOM) :
+ DataPilotFieldLayoutMode::TABULAR_LAYOUT;
+ aLayoutInfo.AddEmptyLines = maModel.mbInsertBlankRow;
+ aPropSet.setProperty( PROP_LayoutInfo, aLayoutInfo );
+ aPropSet.setProperty( PROP_ShowEmpty, maModel.mbShowAll );
+
+ // auto show (OOXML3/OOBIN3 only)
+ if( maModel.mbAutoShow )
+ {
+ DataPilotFieldAutoShowInfo aAutoShowInfo;
+ aAutoShowInfo.IsEnabled = sal_True;
+ aAutoShowInfo.ShowItemsMode = maModel.mbTopAutoShow ? DataPilotFieldShowItemsMode::FROM_TOP : DataPilotFieldShowItemsMode::FROM_BOTTOM;
+ aAutoShowInfo.ItemCount = maModel.mnAutoShowItems;
+ if( const PivotCacheField* pCacheField = mrPivotTable.getCacheFieldOfDataField( maModel.mnAutoShowRankBy ) )
+ aAutoShowInfo.DataField = pCacheField->getName();
+ aPropSet.setProperty( PROP_AutoShowInfo, aAutoShowInfo );
+ }
+
+ // auto sort
+ DataPilotFieldSortInfo aSortInfo;
+ aSortInfo.IsAscending = maModel.mnSortType == XML_ascending;
+ if( (maModel.mnSortType != XML_ascending) && (maModel.mnSortType != XML_descending) )
+ {
+ aSortInfo.Mode = DataPilotFieldSortMode::MANUAL;
+ }
+ else
+ {
+ const PivotCacheField* pCacheField = (maModel.mnSortRefField == OOX_PT_DATALAYOUTFIELD) ?
+ mrPivotTable.getCacheFieldOfDataField( maModel.mnSortRefItem ) : 0;
+ if( pCacheField )
+ {
+ aSortInfo.Mode = DataPilotFieldSortMode::DATA;
+ aSortInfo.Field = pCacheField->getName();
+ }
+ else
+ {
+ aSortInfo.Mode = DataPilotFieldSortMode::NAME;
+ }
+ }
+ aPropSet.setProperty( PROP_SortInfo, aSortInfo );
+
+ // item settings
+ if( const PivotCacheField* pCacheField = mrPivotTable.getCacheField( mnFieldIndex ) ) try
+ {
+ Reference< XNameAccess > xDPItemsNA( xDPField->getItems(), UNO_QUERY_THROW );
+ for( ItemModelVector::iterator aIt = maItems.begin(), aEnd = maItems.end(); aIt != aEnd; ++aIt )
+ {
+ if( aIt->mnType == XML_data )
+ {
+ if( const PivotCacheItem* pSharedItem = pCacheField->getCacheItem( aIt->mnCacheItem ) ) try
+ {
+ PropertySet aItemProp( xDPItemsNA->getByName( pSharedItem->getName() ) );
+ aItemProp.setProperty( PROP_ShowDetail, aIt->mbShowDetails );
+ aItemProp.setProperty( PROP_IsHidden, aIt->mbHidden );
+ }
+ catch( Exception& )
+ {
+ // catch every failed container access to be able to process following items
+ }
+ }
+ }
+ }
+ catch( Exception& )
+ {
+ }
+ }
}
+ return xDPField;
}
-bool PivotTableBuffer::getSourceRange( const OUString& aSheetName, const OUString& aRefName,
- CellRangeAddress& rRange ) const
+// ============================================================================
+
+PTFilterModel::PTFilterModel() :
+ mfValue( 0.0 ),
+ mnField( -1 ),
+ mnMemPropField( -1 ),
+ mnType( XML_TOKEN_INVALID ),
+ mnEvalOrder( 0 ),
+ mnId( -1 ),
+ mnMeasureField( -1 ),
+ mnMeasureHier( -1 ),
+ mbTopFilter( true )
{
- sal_Int32 nCount = getWorksheets().getSheetCount();
- for ( sal_Int32 nSheet = 0; nSheet < nCount; ++nSheet )
+}
+
+// ----------------------------------------------------------------------------
+
+PivotTableFilter::PivotTableFilter( const PivotTable& rPivotTable ) :
+ WorkbookHelper( rPivotTable ),
+ mrPivotTable( rPivotTable )
+{
+}
+
+void PivotTableFilter::importFilter( const AttributeList& rAttribs )
+{
+ maModel.maName = rAttribs.getString( XML_name, OUString() );
+ maModel.maDescription = rAttribs.getString( XML_description, OUString() );
+ maModel.maStrValue1 = rAttribs.getString( XML_stringValue1, OUString() );
+ maModel.maStrValue2 = rAttribs.getString( XML_stringValue2, OUString() );
+ maModel.mnField = rAttribs.getInteger( XML_fld, -1 );
+ maModel.mnMemPropField = rAttribs.getInteger( XML_mpFld, -1 );
+ maModel.mnType = rAttribs.getToken( XML_type, XML_TOKEN_INVALID );
+ maModel.mnEvalOrder = rAttribs.getInteger( XML_evalOrder, 0 );
+ maModel.mnId = rAttribs.getInteger( XML_id, -1 );
+ maModel.mnMeasureField = rAttribs.getInteger( XML_iMeasureFld, -1 );
+ maModel.mnMeasureHier = rAttribs.getInteger( XML_iMeasureHier, -1 );
+}
+
+void PivotTableFilter::importTop10( const AttributeList& rAttribs )
+{
+ OSL_ENSURE( rAttribs.getBool( XML_percent, false ) == (maModel.mnType == XML_percent),
+ "PivotTableFilter::importTop10 - unexpected value of percent attribute" );
+ maModel.mfValue = rAttribs.getDouble( XML_val, 0.0 );
+ maModel.mbTopFilter = rAttribs.getBool( XML_top, true );
+}
+
+void PivotTableFilter::importPTFilter( RecordInputStream& rStrm )
+{
+ sal_Int32 nType;
+ sal_uInt16 nFlags;
+ rStrm >> maModel.mnField >> maModel.mnMemPropField >> nType;
+ rStrm.skip( 4 ); // unused
+ rStrm >> maModel.mnId >> maModel.mnMeasureField >> maModel.mnMeasureHier >> nFlags;
+ if( getFlag( nFlags, OOBIN_PTFILTER_HASNAME ) )
+ rStrm >> maModel.maName;
+ if( getFlag( nFlags, OOBIN_PTFILTER_HASDESCRIPTION ) )
+ rStrm >> maModel.maDescription;
+ if( getFlag( nFlags, OOBIN_PTFILTER_HASSTRVALUE1 ) )
+ rStrm >> maModel.maStrValue1;
+ if( getFlag( nFlags, OOBIN_PTFILTER_HASSTRVALUE2 ) )
+ rStrm >> maModel.maStrValue2;
+
+ static sal_Int32 spnTypes[] =
+ {
+ XML_unknown,
+ // data field top10 filter (1-3)
+ XML_count, XML_percent, XML_sum,
+ // caption filter (4-17)
+ XML_captionEqual, XML_captionNotEqual,
+ XML_captionBeginsWith, XML_captionNotBeginsWith, XML_captionEndsWith, XML_captionNotEndsWith,
+ XML_captionContains, XML_captionNotContains, XML_captionGreaterThan, XML_captionGreaterThanOrEqual,
+ XML_captionLessThan, XML_captionLessThanOrEqual, XML_captionBetween, XML_captionNotBetween,
+ // value filter (18-25)
+ XML_valueEqual, XML_valueNotEqual, XML_valueGreaterThan, XML_valueGreaterThanOrEqual,
+ XML_valueLessThan, XML_valueLessThanOrEqual, XML_valueBetween, XML_valueNotBetween,
+ // date filter (26-65)
+ XML_dateEqual, XML_dateOlderThan, XML_dateNewerThan, XML_dateBetween,
+ XML_tomorrow, XML_today, XML_yesterday, XML_nextWeek, XML_thisWeek, XML_lastWeek,
+ XML_nextMonth, XML_thisMonth, XML_lastMonth, XML_nextQuarter, XML_thisQuarter, XML_lastQuarter,
+ XML_nextYear, XML_thisYear, XML_lastYear, XML_yearToDate, XML_Q1, XML_Q2, XML_Q3, XML_Q4,
+ XML_M1, XML_M2, XML_M3, XML_M4, XML_M5, XML_M6, XML_M7, XML_M8, XML_M9, XML_M10, XML_M11, XML_M12,
+ XML_dateNotEqual, XML_dateOlderThanOrEqual, XML_dateNewerThanOrEqual, XML_dateNotBetween
+ };
+ maModel.mnType = STATIC_ARRAY_SELECT( spnTypes, nType, XML_TOKEN_INVALID );
+}
+
+void PivotTableFilter::importTop10Filter( RecordInputStream& rStrm )
+{
+ sal_uInt8 nFlags;
+ rStrm >> nFlags >> maModel.mfValue;
+
+ OSL_ENSURE( getFlag( nFlags, OOBIN_TOP10FILTER_PERCENT ) == (maModel.mnType == XML_percent),
+ "PivotTableFilter::importTop10 - unexpected value of percent attribute" );
+ maModel.mbTopFilter = getFlag( nFlags, OOBIN_TOP10FILTER_TOP );
+}
+
+void PivotTableFilter::finalizeImport()
+{
+ // only simple top10 filter supported
+ if( maModel.mnType == XML_count )
+ {
+ PropertySet aPropSet( mrPivotTable.getDataPilotField( maModel.mnField ) );
+ if( aPropSet.is() )
+ {
+ using namespace ::com::sun::star::sheet;
+ DataPilotFieldAutoShowInfo aAutoShowInfo;
+ aAutoShowInfo.IsEnabled = sal_True;
+ aAutoShowInfo.ShowItemsMode = maModel.mbTopFilter ? DataPilotFieldShowItemsMode::FROM_TOP : DataPilotFieldShowItemsMode::FROM_BOTTOM;
+ aAutoShowInfo.ItemCount = getLimitedValue< sal_Int32, double >( maModel.mfValue, 0, SAL_MAX_INT32 );
+ if( const PivotCacheField* pCacheField = mrPivotTable.getCacheFieldOfDataField( maModel.mnMeasureField ) )
+ aAutoShowInfo.DataField = pCacheField->getName();
+ aPropSet.setProperty( PROP_AutoShowInfo, aAutoShowInfo );
+ }
+ }
+}
+
+// ============================================================================
+
+PTDefinitionModel::PTDefinitionModel() :
+ mnCacheId( -1 ),
+ mnDataPosition( 0 ),
+ mnPageWrap( 0 ),
+ mnIndent( 1 ),
+ mnChartFormat( 0 ),
+ mnRowFields( 0 ),
+ mnColFields( 0 ),
+ mbDataOnRows( false ),
+ mbShowError( false ),
+ mbShowMissing( true ),
+ mbShowItems( true ),
+ mbDisableFieldList( false ),
+ mbShowCalcMembers( true ),
+ mbVisualTotals( true ),
+ mbShowDrill( true ),
+ mbPrintDrill( false ),
+ mbEnableDrill( true ),
+ mbPreserveFormatting( true ),
+ mbPageOverThenDown( false ),
+ mbSubtotalHiddenItems( false ),
+ mbRowGrandTotals( true ),
+ mbColGrandTotals( true ),
+ mbFieldPrintTitles( false ),
+ mbItemPrintTitles( false ),
+ mbMergeItem( false ),
+ mbShowEmptyRow( false ),
+ mbShowEmptyCol( false ),
+ mbShowHeaders( true ),
+ mbFieldListSortAsc( false ),
+ mbCustomListSort( true )
+{
+}
+
+// ----------------------------------------------------------------------------
+
+PTLocationModel::PTLocationModel() :
+ mnFirstHeaderRow( 0 ),
+ mnFirstDataRow( 0 ),
+ mnFirstDataCol( 0 ),
+ mnRowPageCount( 0 ),
+ mnColPageCount( 0 )
+{
+}
+
+// ----------------------------------------------------------------------------
+
+PivotTable::PivotTable( const WorkbookHelper& rHelper ) :
+ WorkbookHelper( rHelper ),
+ maDataField( *this, OOX_PT_DATALAYOUTFIELD ),
+ mpPivotCache( 0 )
+{
+}
+
+void PivotTable::importPivotTableDefinition( const AttributeList& rAttribs )
+{
+ maDefModel.maName = rAttribs.getString( XML_name, OUString() );
+ maDefModel.maDataCaption = rAttribs.getString( XML_dataCaption , OUString() );
+ maDefModel.maGrandTotalCaption = rAttribs.getString( XML_grandTotalCaption, OUString() );
+ maDefModel.maRowHeaderCaption = rAttribs.getString( XML_rowHeaderCaption, OUString() );
+ maDefModel.maColHeaderCaption = rAttribs.getString( XML_colHeaderCaption, OUString() );
+ maDefModel.maErrorCaption = rAttribs.getString( XML_errorCaption, OUString() );
+ maDefModel.maMissingCaption = rAttribs.getString( XML_missingCaption, OUString() );
+ maDefModel.maPageStyle = rAttribs.getString( XML_pageStyle, OUString() );
+ maDefModel.maPivotTableStyle = rAttribs.getString( XML_pivotTableStyle, OUString() );
+ maDefModel.maVacatedStyle = rAttribs.getString( XML_vacatedStyle, OUString() );
+ maDefModel.maTag = rAttribs.getString( XML_tag, OUString() );
+ maDefModel.mnCacheId = rAttribs.getInteger( XML_cacheId, -1 );
+ maDefModel.mnDataPosition = rAttribs.getInteger( XML_dataPosition, 0 );
+ maDefModel.mnPageWrap = rAttribs.getInteger( XML_pageWrap, 0 );
+ maDefModel.mnIndent = rAttribs.getInteger( XML_indent, 1 );
+ maDefModel.mnChartFormat = rAttribs.getInteger( XML_chartFormat, 0 );
+ maDefModel.mbDataOnRows = rAttribs.getBool( XML_dataOnRows, false );
+ maDefModel.mbShowError = rAttribs.getBool( XML_showError, false );
+ maDefModel.mbShowMissing = rAttribs.getBool( XML_showMissing, true );
+ maDefModel.mbShowItems = rAttribs.getBool( XML_showItems, true );
+ maDefModel.mbDisableFieldList = rAttribs.getBool( XML_disableFieldList, false );
+ maDefModel.mbShowCalcMembers = rAttribs.getBool( XML_showCalcMbrs, true );
+ maDefModel.mbVisualTotals = rAttribs.getBool( XML_visualTotals, true );
+ maDefModel.mbShowDrill = rAttribs.getBool( XML_showDrill, true );
+ maDefModel.mbPrintDrill = rAttribs.getBool( XML_printDrill, false );
+ maDefModel.mbEnableDrill = rAttribs.getBool( XML_enableDrill, true );
+ maDefModel.mbPreserveFormatting = rAttribs.getBool( XML_preserveFormatting, true );
+ maDefModel.mbPageOverThenDown = rAttribs.getBool( XML_pageOverThenDown, false );
+ maDefModel.mbSubtotalHiddenItems = rAttribs.getBool( XML_subtotalHiddenItems, false );
+ maDefModel.mbRowGrandTotals = rAttribs.getBool( XML_rowGrandTotals, true );
+ maDefModel.mbColGrandTotals = rAttribs.getBool( XML_colGrandTotals, true );
+ maDefModel.mbFieldPrintTitles = rAttribs.getBool( XML_fieldPrintTitles, false );
+ maDefModel.mbItemPrintTitles = rAttribs.getBool( XML_itemPrintTitles, false );
+ maDefModel.mbMergeItem = rAttribs.getBool( XML_mergeItem, false );
+ maDefModel.mbShowEmptyRow = rAttribs.getBool( XML_showEmptyRow, false );
+ maDefModel.mbShowEmptyCol = rAttribs.getBool( XML_showEmptyCol, false );
+ maDefModel.mbShowHeaders = rAttribs.getBool( XML_showHeaders, true );
+ maDefModel.mbFieldListSortAsc = rAttribs.getBool( XML_fieldListSortAscending, false );
+ maDefModel.mbCustomListSort = rAttribs.getBool( XML_customListSort, true );
+}
+
+void PivotTable::importLocation( const AttributeList& rAttribs, sal_Int16 nSheet )
+{
+ getAddressConverter().convertToCellRangeUnchecked( maLocationModel.maRange, rAttribs.getString( XML_ref, OUString() ), nSheet );
+ maLocationModel.mnFirstHeaderRow = rAttribs.getInteger( XML_firstHeaderRow, 0 );
+ maLocationModel.mnFirstDataRow = rAttribs.getInteger( XML_firstDataRow, 0 );
+ maLocationModel.mnFirstDataCol = rAttribs.getInteger( XML_firstDataCol, 0 );
+ maLocationModel.mnRowPageCount = rAttribs.getInteger( XML_rowPageCount, 0 );
+ maLocationModel.mnColPageCount = rAttribs.getInteger( XML_colPageCount, 0 );
+}
+
+void PivotTable::importRowField( const AttributeList& rAttribs )
+{
+ importField( maRowFields, rAttribs );
+}
+
+void PivotTable::importColField( const AttributeList& rAttribs )
+{
+ importField( maColFields, rAttribs );
+}
+
+void PivotTable::importPageField( const AttributeList& rAttribs )
+{
+ PTPageFieldModel aModel;
+ aModel.maName = rAttribs.getString( XML_name, OUString() );
+ aModel.mnField = rAttribs.getInteger( XML_fld, -1 );
+ // specification is wrong, XML_item is not the cache item, but the field item
+ aModel.mnItem = rAttribs.getInteger( XML_item, OOBIN_PTPAGEFIELD_MULTIITEMS );
+ maPageFields.push_back( aModel );
+}
+
+void PivotTable::importDataField( const AttributeList& rAttribs )
+{
+ PTDataFieldModel aModel;
+ aModel.maName = rAttribs.getString( XML_name, OUString() );
+ aModel.mnField = rAttribs.getInteger( XML_fld, -1 );
+ aModel.mnSubtotal = rAttribs.getToken( XML_subtotal, XML_sum );
+ aModel.mnShowDataAs = rAttribs.getToken( XML_showDataAs, XML_normal );
+ aModel.mnBaseField = rAttribs.getInteger( XML_baseField, -1 );
+ aModel.mnBaseItem = rAttribs.getInteger( XML_baseItem, -1 );
+ aModel.mnNumFmtId = rAttribs.getInteger( XML_numFmtId, 0 );
+ maDataFields.push_back( aModel );
+}
+
+void PivotTable::importPTDefinition( RecordInputStream& rStrm )
+{
+ sal_uInt32 nFlags1, nFlags2, nFlags3;
+ sal_uInt8 nDataAxis;
+ rStrm >> nFlags1 >> nFlags2 >> nFlags3 >> nDataAxis;
+ maDefModel.mnPageWrap = rStrm.readuInt8();
+ rStrm.skip( 2 ); // refresh versions
+ rStrm >> maDefModel.mnDataPosition;
+ rStrm.skip( 4 ); // 2 bytes autoformat id, 2 bytes unused
+ rStrm >> maDefModel.mnChartFormat >> maDefModel.mnCacheId >> maDefModel.maName;
+ if( getFlag( nFlags2, OOBIN_PTDEF_HASDATACAPTION ) )
+ rStrm >> maDefModel.maDataCaption;
+ if( getFlag( nFlags2, OOBIN_PTDEF_HASGRANDTOTALCAPTION ) )
+ rStrm >> maDefModel.maGrandTotalCaption;
+ if( !getFlag( nFlags3, OOBIN_PTDEF_NOERRORCAPTION ) ) // missing flag indicates existing string
+ rStrm >> maDefModel.maErrorCaption;
+ if( !getFlag( nFlags3, OOBIN_PTDEF_NOMISSINGCAPTION ) ) // missing flag indicates existing string
+ rStrm >> maDefModel.maMissingCaption;
+ if( getFlag( nFlags2, OOBIN_PTDEF_HASPAGESTYLE ) )
+ rStrm >> maDefModel.maPageStyle;
+ if( getFlag( nFlags2, OOBIN_PTDEF_HASPIVOTTABLESTYLE ) )
+ rStrm >> maDefModel.maPivotTableStyle;
+ if( getFlag( nFlags2, OOBIN_PTDEF_HASVACATEDSTYLE ) )
+ rStrm >> maDefModel.maVacatedStyle;
+ if( getFlag( nFlags2, OOBIN_PTDEF_HASTAG ) )
+ rStrm >> maDefModel.maTag;
+ if( getFlag( nFlags3, OOBIN_PTDEF_HASCOLHEADERCAPTION ) ) // TODO: right order (col/row)? spec is unclear
+ rStrm >> maDefModel.maColHeaderCaption;
+ if( getFlag( nFlags3, OOBIN_PTDEF_HASROWHEADERCAPTION ) )
+ rStrm >> maDefModel.maRowHeaderCaption;
+
+ OSL_ENSURE( (nDataAxis == OOBIN_PTDEF_ROWAXIS) || (nDataAxis == OOBIN_PTDEF_COLAXIS),
+ "PivotTable::importPTDefinition - unexpected axis position for data field" );
+
+ maDefModel.mnIndent = extractValue< sal_uInt8 >( nFlags1, 24, 7 );
+ maDefModel.mbDataOnRows = nDataAxis == OOBIN_PTDEF_ROWAXIS;
+ maDefModel.mbShowError = getFlag( nFlags2, OOBIN_PTDEF_SHOWERROR );
+ maDefModel.mbShowMissing = getFlag( nFlags2, OOBIN_PTDEF_SHOWMISSING );
+ maDefModel.mbShowItems = getFlag( nFlags1, OOBIN_PTDEF_SHOWITEMS );
+ maDefModel.mbDisableFieldList = getFlag( nFlags1, OOBIN_PTDEF_DISABLEFIELDLIST );
+ maDefModel.mbShowCalcMembers = !getFlag( nFlags1, OOBIN_PTDEF_HIDECALCMEMBERS );
+ maDefModel.mbVisualTotals = !getFlag( nFlags1, OOBIN_PTDEF_WITHHIDDENTOTALS );
+ maDefModel.mbShowDrill = !getFlag( nFlags1, OOBIN_PTDEF_HIDEDRILL );
+ maDefModel.mbPrintDrill = getFlag( nFlags1, OOBIN_PTDEF_PRINTDRILL );
+ maDefModel.mbEnableDrill = getFlag( nFlags2, OOBIN_PTDEF_ENABLEDRILL );
+ maDefModel.mbPreserveFormatting = getFlag( nFlags2, OOBIN_PTDEF_PRESERVEFORMATTING );
+ maDefModel.mbPageOverThenDown = getFlag( nFlags2, OOBIN_PTDEF_PAGEOVERTHENDOWN );
+ maDefModel.mbSubtotalHiddenItems = getFlag( nFlags2, OOBIN_PTDEF_SUBTOTALHIDDENITEMS );
+ maDefModel.mbRowGrandTotals = getFlag( nFlags2, OOBIN_PTDEF_ROWGRANDTOTALS );
+ maDefModel.mbColGrandTotals = getFlag( nFlags2, OOBIN_PTDEF_COLGRANDTOTALS );
+ maDefModel.mbFieldPrintTitles = getFlag( nFlags2, OOBIN_PTDEF_FIELDPRINTTITLES );
+ maDefModel.mbItemPrintTitles = getFlag( nFlags2, OOBIN_PTDEF_ITEMPRINTTITLES );
+ maDefModel.mbMergeItem = getFlag( nFlags2, OOBIN_PTDEF_MERGEITEM );
+ maDefModel.mbShowEmptyRow = getFlag( nFlags2, OOBIN_PTDEF_SHOWEMPTYROW );
+ maDefModel.mbShowEmptyCol = getFlag( nFlags2, OOBIN_PTDEF_SHOWEMPTYCOL );
+ maDefModel.mbShowHeaders = !getFlag( nFlags1, OOBIN_PTDEF_HIDEHEADERS );
+ maDefModel.mbFieldListSortAsc = getFlag( nFlags3, OOBIN_PTDEF_FIELDLISTSORTASC );
+ maDefModel.mbCustomListSort = !getFlag( nFlags3, OOBIN_PTDEF_NOCUSTOMLISTSORT );
+}
+
+void PivotTable::importPTLocation( RecordInputStream& rStrm, sal_Int16 nSheet )
+{
+ BinRange aBinRange;
+ rStrm >> aBinRange >> maLocationModel.mnFirstHeaderRow
+ >> maLocationModel.mnFirstDataRow >> maLocationModel.mnFirstDataCol
+ >> maLocationModel.mnRowPageCount >> maLocationModel.mnColPageCount;
+ getAddressConverter().convertToCellRangeUnchecked( maLocationModel.maRange, aBinRange, nSheet );
+}
+
+void PivotTable::importPTRowFields( RecordInputStream& rStrm )
+{
+ importFields( maRowFields, rStrm );
+}
+
+void PivotTable::importPTColFields( RecordInputStream& rStrm )
+{
+ importFields( maColFields, rStrm );
+}
+
+void PivotTable::importPTPageField( RecordInputStream& rStrm )
+{
+ PTPageFieldModel aModel;
+ sal_uInt8 nFlags;
+ rStrm >> aModel.mnField >> aModel.mnItem;
+ rStrm.skip( 4 ); // hierarchy
+ rStrm >> nFlags;
+ if( getFlag( nFlags, OOBIN_PTPAGEFIELD_HASNAME ) )
+ rStrm >> aModel.maName;
+ maPageFields.push_back( aModel );
+}
+
+void PivotTable::importPTDataField( RecordInputStream& rStrm )
+{
+ PTDataFieldModel aModel;
+ sal_Int32 nSubtotal, nShowDataAs;
+ sal_uInt8 nHasName;
+ rStrm >> aModel.mnField >> nSubtotal >> nShowDataAs >> aModel.mnBaseField >> aModel.mnBaseItem >> aModel.mnNumFmtId >> nHasName;
+ if( nHasName == 1 )
+ rStrm >> aModel.maName;
+ aModel.setBinSubtotal( nSubtotal );
+ aModel.setBinShowDataAs( nShowDataAs );
+ maDataFields.push_back( aModel );
+}
+
+void PivotTable::importPTDefinition( BiffInputStream& rStrm, sal_Int16 nSheet )
+{
+ BinRange aBinRange;
+ sal_uInt16 nFlags, nTabNameLen, nDataNameLen;
+ rStrm >> aBinRange;
+ maLocationModel.mnFirstHeaderRow = rStrm.readuInt16();
+ maLocationModel.mnFirstDataRow = rStrm.readuInt16();
+ maLocationModel.mnFirstDataCol = rStrm.readuInt16();
+ maDefModel.mnCacheId = rStrm.readuInt16();
+ rStrm.skip( 2 ); // unused
+ maDefModel.mbDataOnRows = rStrm.readuInt16() == BIFF_PTDEF_ROWAXIS;
+ maDefModel.mnDataPosition = rStrm.readInt16();
+ rStrm.skip( 2 ); // number of fields
+ rStrm >> maDefModel.mnRowFields >> maDefModel.mnColFields;
+ rStrm.skip( 8 ); // number of page fields, data fields, data rows, data columns
+ rStrm >> nFlags;
+ maDefModel.mnChartFormat = rStrm.readuInt16();
+ rStrm >> nTabNameLen >> nDataNameLen;
+ maDefModel.maName = lclReadPivotString( *this, rStrm, nTabNameLen );
+ maDefModel.maDataCaption = lclReadPivotString( *this, rStrm, nDataNameLen );
+
+ maDefModel.mbRowGrandTotals = getFlag( nFlags, BIFF_PTDEF_ROWGRANDTOTALS );
+ maDefModel.mbColGrandTotals = getFlag( nFlags, BIFF_PTDEF_COLGRANDTOTALS );
+
+ getAddressConverter().convertToCellRangeUnchecked( maLocationModel.maRange, aBinRange, nSheet );
+}
+
+void PivotTable::importPTDefinition2( BiffInputStream& rStrm )
+{
+ if( getBiff() == BIFF8 )
+ {
+ sal_uInt16 nErrCaptLen, nMissCaptLen, nTagLen, nPageStyleLen, nTabStyleLen, nVacStyleLen;
+ sal_uInt32 nFlags;
+ rStrm.skip( 2 ); // number of formatting records
+ rStrm >> nErrCaptLen >> nMissCaptLen >> nTagLen;
+ rStrm.skip( 6 ); // number of selection records, page rows, page columns
+ rStrm >> nFlags >> nPageStyleLen >> nTabStyleLen >> nVacStyleLen;
+ maDefModel.maErrorCaption = lclReadPivotString( *this, rStrm, nErrCaptLen );
+ maDefModel.maMissingCaption = lclReadPivotString( *this, rStrm, nMissCaptLen );
+ maDefModel.maTag = lclReadPivotString( *this, rStrm, nTagLen );
+ maDefModel.maPageStyle = lclReadPivotString( *this, rStrm, nPageStyleLen );
+ maDefModel.maPivotTableStyle = lclReadPivotString( *this, rStrm, nTabStyleLen );
+ maDefModel.maVacatedStyle = lclReadPivotString( *this, rStrm, nVacStyleLen );
+
+ maDefModel.mbShowError = getFlag( nFlags, BIFF_PTDEF2_SHOWERROR );
+ maDefModel.mbShowMissing = getFlag( nFlags, BIFF_PTDEF2_SHOWMISSING );
+ maDefModel.mbEnableDrill = getFlag( nFlags, BIFF_PTDE2F_ENABLEDRILL );
+ maDefModel.mbPreserveFormatting = getFlag( nFlags, BIFF_PTDEF2_PRESERVEFORMATTING );
+ maDefModel.mbPageOverThenDown = getFlag( nFlags, BIFF_PTDEF2_PAGEOVERTHENDOWN );
+ maDefModel.mbSubtotalHiddenItems = getFlag( nFlags, BIFF_PTDEF2_SUBTOTALHIDDENITEMS );
+ maDefModel.mbMergeItem = getFlag( nFlags, BIFF_PTDEF2_MERGEITEM );
+ }
+}
+
+void PivotTable::importPTRowColFields( BiffInputStream& rStrm )
+{
+ // first PTROWCOLFIELDS record contains row fields unless there are no row fields
+ if( (maDefModel.mnRowFields > 0) && maRowFields.empty() )
+ importFields( maRowFields, rStrm, maDefModel.mnRowFields );
+ else if( (maDefModel.mnColFields > 0) && maColFields.empty() )
+ importFields( maColFields, rStrm, maDefModel.mnColFields );
+}
+
+void PivotTable::importPTPageFields( BiffInputStream& rStrm )
+{
+ while( rStrm.getRemaining() >= 6 )
+ {
+ PTPageFieldModel aModel;
+ sal_Int16 nField, nItem;
+ rStrm >> nField >> nItem;
+ rStrm.skip( 2 ); // dropdown object ID
+ aModel.mnField = nField;
+ aModel.mnItem = (nItem == BIFF_PTPAGEFIELDS_ALLITEMS) ? OOBIN_PTPAGEFIELD_MULTIITEMS : nItem;
+ maPageFields.push_back( aModel );
+ }
+}
+
+void PivotTable::importPTDataField( BiffInputStream& rStrm )
+{
+ PTDataFieldModel aModel;
+ sal_Int16 nField, nBaseField, nBaseItem;
+ sal_uInt16 nSubtotal, nShowDataAs, nNumFmt, nNameLen;
+ rStrm >> nField >> nSubtotal >> nShowDataAs >> nBaseField >> nBaseItem >> nNumFmt >> nNameLen;
+ aModel.maName = lclReadPivotString( *this, rStrm, nNameLen );
+
+ aModel.mnField = nField;
+ aModel.setBinSubtotal( nSubtotal );
+ aModel.setBinShowDataAs( nShowDataAs );
+ aModel.mnBaseField = nBaseField;
+ switch( nBaseItem )
+ {
+ case BIFF_PTDATAFIELD_PREVIOUS: aModel.mnBaseItem = OOX_PT_PREVIOUS_ITEM; break;
+ case BIFF_PTDATAFIELD_NEXT: aModel.mnBaseItem = OOX_PT_NEXT_ITEM; break;
+ default: aModel.mnBaseItem = nBaseItem;
+ }
+ aModel.mnNumFmtId = nNumFmt;
+
+ maDataFields.push_back( aModel );
+}
+
+PivotTableField& PivotTable::createTableField()
+{
+ sal_Int32 nFieldIndex = static_cast< sal_Int32 >( maFields.size() );
+ PivotTableFieldVector::value_type xTableField( new PivotTableField( *this, nFieldIndex ) );
+ maFields.push_back( xTableField );
+ return *xTableField;
+}
+
+PivotTableFilter& PivotTable::createTableFilter()
+{
+ PivotTableFilterVector::value_type xTableFilter( new PivotTableFilter( *this ) );
+ maFilters.push_back( xTableFilter );
+ return *xTableFilter;
+}
+
+void PivotTable::finalizeImport()
+{
+ if( getAddressConverter().validateCellRange( maLocationModel.maRange, true, true ) )
+ {
+ mpPivotCache = getPivotCaches().importPivotCacheFragment( maDefModel.mnCacheId );
+ if( mpPivotCache && mpPivotCache->isValidDataSource() && (maDefModel.maName.getLength() > 0) )
+ {
+ // clear destination area of the original pivot table
+ try
+ {
+ Reference< XSheetOperation > xSheetOp( getCellRangeFromDoc( maLocationModel.maRange ), UNO_QUERY_THROW );
+ using namespace ::com::sun::star::sheet::CellFlags;
+ xSheetOp->clearContents( VALUE | DATETIME | STRING | FORMULA | HARDATTR | STYLES | EDITATTR | FORMATTED );
+ }
+ catch( Exception& )
+ {
+ }
+
+ try
+ {
+ // create a new data pilot descriptor based on the source data
+ Reference< XDataPilotTablesSupplier > xDPTablesSupp( getSheetFromDoc( maLocationModel.maRange.Sheet ), UNO_QUERY_THROW );
+ Reference< XDataPilotTables > xDPTables( xDPTablesSupp->getDataPilotTables(), UNO_SET_THROW );
+ mxDPDescriptor.set( xDPTables->createDataPilotDescriptor(), UNO_SET_THROW );
+ mxDPDescriptor->setSourceRange( mpPivotCache->getSourceRange() );
+ mxDPDescriptor->setTag( maDefModel.maTag );
+
+ // global data pilot properties
+ PropertySet aDescProp( mxDPDescriptor );
+ aDescProp.setProperty( PROP_ColumnGrand, maDefModel.mbColGrandTotals );
+ aDescProp.setProperty( PROP_RowGrand, maDefModel.mbRowGrandTotals );
+ aDescProp.setProperty( PROP_ShowFilterButton, false );
+ aDescProp.setProperty( PROP_DrillDownOnDoubleClick, maDefModel.mbEnableDrill );
+
+ // finalize all fields, this finds field names and creates grouping fields
+ maFields.forEachMem( &PivotTableField::finalizeImport, mxDPDescriptor );
+
+ // all row fields
+ for( IndexVector::iterator aIt = maRowFields.begin(), aEnd = maRowFields.end(); aIt != aEnd; ++aIt )
+ if( PivotTableField* pField = getTableField( *aIt ) )
+ pField->convertRowField();
+
+ // all column fields
+ for( IndexVector::iterator aIt = maColFields.begin(), aEnd = maColFields.end(); aIt != aEnd; ++aIt )
+ if( PivotTableField* pField = getTableField( *aIt ) )
+ pField->convertColField();
+
+ // all page fields
+ for( PageFieldVector::iterator aIt = maPageFields.begin(), aEnd = maPageFields.end(); aIt != aEnd; ++aIt )
+ if( PivotTableField* pField = getTableField( aIt->mnField ) )
+ pField->convertPageField( *aIt );
+
+ // all hidden fields
+ ::std::set< sal_Int32 > aVisFields;
+ aVisFields.insert( maRowFields.begin(), maRowFields.end() );
+ aVisFields.insert( maColFields.begin(), maColFields.end() );
+ for( PageFieldVector::iterator aIt = maPageFields.begin(), aEnd = maPageFields.end(); aIt != aEnd; ++aIt )
+ aVisFields.insert( aIt->mnField );
+ for( PivotTableFieldVector::iterator aBeg = maFields.begin(), aIt = aBeg, aEnd = maFields.end(); aIt != aEnd; ++aIt )
+ if( aVisFields.count( static_cast< sal_Int32 >( aIt - aBeg ) ) == 0 )
+ (*aIt)->convertHiddenField();
+
+ // all data fields
+ for( DataFieldVector::iterator aIt = maDataFields.begin(), aEnd = maDataFields.end(); aIt != aEnd; ++aIt )
+ if( PivotTableField* pField = getTableField( aIt->mnField ) )
+ pField->convertDataField( *aIt );
+
+ // filters
+ maFilters.forEachMem( &PivotTableFilter::finalizeImport );
+
+ // calculate base position of table
+ CellAddress aPos( maLocationModel.maRange.Sheet, maLocationModel.maRange.StartColumn, maLocationModel.maRange.StartRow );
+ /* If page fields exist, include them into the destination
+ area (they are excluded in Excel). Add an extra blank row. */
+ if( !maPageFields.empty() )
+ aPos.Row = ::std::max< sal_Int32 >( static_cast< sal_Int32 >( aPos.Row - maPageFields.size() - 1 ), 0 );
+
+ // insert the DataPilot table into the sheet
+ xDPTables->insertNewByName( maDefModel.maName, aPos, mxDPDescriptor );
+ }
+ catch( Exception& )
+ {
+ OSL_ENSURE( false, "PivotTable::finalizeImport - exception while creating the pivot table" );
+ }
+ }
+ }
+}
+
+void PivotTable::finalizeDateGroupingImport( const Reference< XDataPilotField >& rxBaseDPField, sal_Int32 nBaseFieldIdx )
+{
+ // process all fields, there is no chaining information in the cache fields
+ maFields.forEachMem( &PivotTableField::finalizeDateGroupingImport, rxBaseDPField, nBaseFieldIdx );
+}
+
+void PivotTable::finalizeParentGroupingImport( const Reference< XDataPilotField >& rxBaseDPField,
+ const PivotCacheField& rBaseCacheField, PivotCacheGroupItemVector& orItemNames )
+{
+ // try to create parent group fields that group the items of the passed base field
+ if( PivotTableField* pParentTableField = maFields.get( rBaseCacheField.getParentGroupField() ).get() )
+ pParentTableField->finalizeParentGroupingImport( rxBaseDPField, orItemNames );
+}
+
+Reference< XDataPilotField > PivotTable::getDataPilotField( const OUString& rFieldName ) const
+{
+ Reference< XDataPilotField > xDPField;
+ if( (rFieldName.getLength() > 0) && mxDPDescriptor.is() ) try
+ {
+ Reference< XNameAccess > xDPFieldsNA( mxDPDescriptor->getDataPilotFields(), UNO_QUERY_THROW );
+ xDPField.set( xDPFieldsNA->getByName( rFieldName ), UNO_QUERY );
+ }
+ catch( Exception& )
+ {
+ }
+ return xDPField;
+}
+
+Reference< XDataPilotField > PivotTable::getDataPilotField( sal_Int32 nFieldIdx ) const
+{
+ Reference< XDataPilotField > xDPField;
+ if( const PivotTableField* pTableField = maFields.get( nFieldIdx ).get() )
+ xDPField = getDataPilotField( pTableField->getDPFieldName() );
+ return xDPField;
+}
+
+Reference< XDataPilotField > PivotTable::getDataLayoutField() const
+{
+ Reference< XDataPilotField > xDPField;
+ try
+ {
+ Reference< XDataPilotDataLayoutFieldSupplier > xDPDataFieldSupp( mxDPDescriptor, UNO_QUERY_THROW );
+ xDPField = xDPDataFieldSupp->getDataLayoutField();
+ }
+ catch( Exception& )
{
- Reference< XNamed > xNamed( getSheet( nSheet ), UNO_QUERY );
- if ( xNamed.is() && !aSheetName.compareTo( xNamed->getName() ) )
- return getAddressConverter().convertToCellRange(
- rRange, aRefName, static_cast< sal_Int16 >( nSheet ), true );
}
- return false;
+ return xDPField;
+}
+
+const PivotCacheField* PivotTable::getCacheField( sal_Int32 nFieldIdx ) const
+{
+ return mpPivotCache ? mpPivotCache->getCacheField( nFieldIdx ) : 0;
+}
+
+const PivotCacheField* PivotTable::getCacheFieldOfDataField( sal_Int32 nDataItemIdx ) const
+{
+ const PTDataFieldModel* pDataField = ContainerHelper::getVectorElement( maDataFields, nDataItemIdx );
+ return pDataField ? getCacheField( pDataField->mnField ) : 0;
+}
+
+sal_Int32 PivotTable::getCacheDatabaseIndex( sal_Int32 nFieldIdx ) const
+{
+ return mpPivotCache ? mpPivotCache->getCacheDatabaseIndex( nFieldIdx ) : -1;
+}
+
+// private --------------------------------------------------------------------
+
+PivotTableField* PivotTable::getTableField( sal_Int32 nFieldIdx )
+{
+ return (nFieldIdx == OOX_PT_DATALAYOUTFIELD) ? &maDataField : maFields.get( nFieldIdx ).get();
+}
+
+void PivotTable::importField( IndexVector& orFields, const AttributeList& rAttribs )
+{
+ orFields.push_back( rAttribs.getInteger( XML_x, -1 ) );
+}
+
+void PivotTable::importFields( IndexVector& orFields, RecordInputStream& rStrm )
+{
+ OSL_ENSURE( orFields.empty(), "PivotTable::importFields - multiple record instances" );
+ orFields.clear();
+ sal_Int32 nCount = rStrm.readInt32();
+ OSL_ENSURE( 4 * nCount == rStrm.getRemaining(), "PivotTable::importFields - invalid field count" );
+ nCount = static_cast< sal_Int32 >( rStrm.getRemaining() / 4 );
+ for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
+ orFields.push_back( rStrm.readInt32() );
+}
+
+void PivotTable::importFields( IndexVector& orFields, BiffInputStream& rStrm, sal_Int32 nCount )
+{
+ OSL_ENSURE( orFields.empty(), "PivotTable::importFields - multiple record instances" );
+ orFields.clear();
+ OSL_ENSURE( 2 * nCount == rStrm.getRemaining(), "PivotTable::importFields - invalid field count" );
+ nCount = static_cast< sal_Int32 >( rStrm.getRemaining() / 2 );
+ for( sal_Int32 nIdx = 0; nIdx < nCount; ++nIdx )
+ orFields.push_back( rStrm.readInt16() );
+}
+
+// ============================================================================
+
+PivotTableBuffer::PivotTableBuffer( const WorkbookHelper& rHelper ) :
+ WorkbookHelper( rHelper )
+{
+}
+
+PivotTable& PivotTableBuffer::createPivotTable()
+{
+ PivotTableVector::value_type xTable( new PivotTable( *this ) );
+ maTables.push_back( xTable );
+ return *xTable;
+}
+
+void PivotTableBuffer::finalizeImport()
+{
+ maTables.forEachMem( &PivotTable::finalizeImport );
}
// ============================================================================
} // namespace xls
} // namespace oox
+
diff --git a/oox/source/xls/pivottablefragment.cxx b/oox/source/xls/pivottablefragment.cxx
index 83475fb97432..73b63b34906e 100644
--- a/oox/source/xls/pivottablefragment.cxx
+++ b/oox/source/xls/pivottablefragment.cxx
@@ -29,159 +29,292 @@
************************************************************************/
#include "oox/xls/pivottablefragment.hxx"
-#include "oox/helper/attributelist.hxx"
-#include "oox/helper/propertyset.hxx"
-#include "oox/xls/addressconverter.hxx"
-
-#include <vector>
+#include "oox/xls/biffinputstream.hxx"
+#include "oox/xls/pivottablebuffer.hxx"
using ::rtl::OUString;
-using ::com::sun::star::table::CellRangeAddress;
+using ::oox::core::ContextHandlerRef;
+using ::oox::core::RecordInfo;
namespace oox {
namespace xls {
-OoxPivotTableFragment::OoxPivotTableFragment(
- const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
- OoxWorksheetFragmentBase( rHelper, rFragmentPath ),
- mbValidRange( false )
+// ============================================================================
+
+OoxPivotTableFieldContext::OoxPivotTableFieldContext( OoxWorksheetFragmentBase& rFragment, PivotTableField& rTableField ) :
+ OoxWorksheetContextBase( rFragment ),
+ mrTableField( rTableField )
{
}
-ContextWrapper OoxPivotTableFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxPivotTableFieldContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
- case XML_ROOT_CONTEXT:
- return (nElement == XLS_TOKEN( pivotTableDefinition ));
- case XLS_TOKEN( pivotTableDefinition ):
- return (nElement == XLS_TOKEN( location )) ||
- (nElement == XLS_TOKEN( pivotFields )) ||
- (nElement == XLS_TOKEN( rowFields )) ||
- (nElement == XLS_TOKEN( rowItems )) ||
- (nElement == XLS_TOKEN( colFields )) ||
- (nElement == XLS_TOKEN( colItems )) ||
- (nElement == XLS_TOKEN( pageFields )) ||
- (nElement == XLS_TOKEN( dataFields )) ||
- (nElement == XLS_TOKEN( pivotTableStyleInfo ));
- case XLS_TOKEN( pivotFields ):
- return (nElement == XLS_TOKEN( pivotField ));
case XLS_TOKEN( pivotField ):
- return (nElement == XLS_TOKEN( items ));
+ switch( nElement )
+ {
+ case XLS_TOKEN( items ): return this;
+ case XLS_TOKEN( autoSortScope ): return this;
+ }
+ break;
case XLS_TOKEN( items ):
- return (nElement == XLS_TOKEN( item ));
- case XLS_TOKEN( rowFields ):
- return (nElement == XLS_TOKEN( field ));
- case XLS_TOKEN( colFields ):
- return (nElement == XLS_TOKEN( field ));
- case XLS_TOKEN( pageFields ):
- return (nElement == XLS_TOKEN( pageField ));
- case XLS_TOKEN( dataFields ):
- return (nElement == XLS_TOKEN( dataField ));
- case XLS_TOKEN( colItems ):
- return (nElement == XLS_TOKEN( i ));
- case XLS_TOKEN( rowItems ):
- return (nElement == XLS_TOKEN( i ));
+ if( nElement == XLS_TOKEN( item ) ) mrTableField.importItem( rAttribs );
+ break;
+ case XLS_TOKEN( autoSortScope ):
+ if( nElement == XLS_TOKEN( pivotArea ) ) return this;
+ break;
+ case XLS_TOKEN( pivotArea ):
+ if( nElement == XLS_TOKEN( references ) ) return this;
+ break;
+ case XLS_TOKEN( references ):
+ if( nElement == XLS_TOKEN( reference ) ) { mrTableField.importReference( rAttribs ); return this; }
+ break;
+ case XLS_TOKEN( reference ):
+ if( nElement == XLS_TOKEN( x ) ) mrTableField.importReferenceItem( rAttribs );
+ break;
}
- return false;
+ return 0;
}
-void OoxPivotTableFragment::onStartElement( const AttributeList& rAttribs )
+void OoxPivotTableFieldContext::onStartElement( const AttributeList& rAttribs )
{
- switch ( getCurrentElement() )
+ if( isRootElement() )
+ mrTableField.importPivotField( rAttribs );
+}
+
+ContextHandlerRef OoxPivotTableFieldContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+{
+ switch( getCurrentElement() )
{
- case XLS_TOKEN( pivotTableDefinition ):
- importPivotTableDefinition( rAttribs );
+ case OOBIN_ID_PTFIELD:
+ switch( nRecId )
+ {
+ case OOBIN_ID_PTFITEMS: return this;
+ case OOBIN_ID_AUTOSORTSCOPE: return this;
+ }
break;
- case XLS_TOKEN( location ):
- importLocation( rAttribs );
+ case OOBIN_ID_PTFITEMS:
+ if( nRecId == OOBIN_ID_PTFITEM ) mrTableField.importPTFItem( rStrm );
break;
- case XLS_TOKEN( pivotFields ):
- importPivotFields( rAttribs );
+ case OOBIN_ID_AUTOSORTSCOPE:
+ if( nRecId == OOBIN_ID_PIVOTAREA ) return this;
break;
- case XLS_TOKEN( pivotField ):
- importPivotField( rAttribs );
+ case OOBIN_ID_PIVOTAREA:
+ if( nRecId == OOBIN_ID_PTREFERENCES ) return this;
+ break;
+ case OOBIN_ID_PTREFERENCES:
+ if( nRecId == OOBIN_ID_PTREFERENCE ) { mrTableField.importPTReference( rStrm ); return this; }
+ break;
+ case OOBIN_ID_PTREFERENCE:
+ if( nRecId == OOBIN_ID_PTREFERENCEITEM ) mrTableField.importPTReferenceItem( rStrm );
break;
}
+ return 0;
}
-void OoxPivotTableFragment::finalizeImport()
+void OoxPivotTableFieldContext::onStartRecord( RecordInputStream& rStrm )
{
- if( mbValidRange )
- getPivotTables().setPivotTable( maName, maData );
+ if( isRootElement() )
+ mrTableField.importPTField( rStrm );
}
-void OoxPivotTableFragment::importLocation( const AttributeList& rAttribs )
+// ============================================================================
+
+OoxPivotTableFilterContext::OoxPivotTableFilterContext( OoxWorksheetFragmentBase& rFragment, PivotTableFilter& rTableFilter ) :
+ OoxWorksheetContextBase( rFragment ),
+ mrTableFilter( rTableFilter )
{
- CellRangeAddress aRange;
- OUString aRangeName = rAttribs.getString( XML_ref, OUString() );
- mbValidRange = getAddressConverter().convertToCellRange(
- aRange, aRangeName, getSheetIndex(), true );
+}
- if ( mbValidRange )
- maData.maRange = aRange;
+ContextHandlerRef OoxPivotTableFilterContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case XLS_TOKEN( filter ):
+ if( nElement == XLS_TOKEN( autoFilter ) ) return this;
+ break;
+ case XLS_TOKEN( autoFilter ):
+ if( nElement == XLS_TOKEN( filterColumn ) ) return this;
+ break;
+ case XLS_TOKEN( filterColumn ):
+ if( nElement == XLS_TOKEN( top10 ) ) mrTableFilter.importTop10( rAttribs );
+ break;
+ }
+ return 0;
}
-void OoxPivotTableFragment::importPivotTableDefinition( const AttributeList& rAttribs )
+void OoxPivotTableFilterContext::onStartElement( const AttributeList& rAttribs )
{
- if ( !rAttribs.hasAttribute( XML_cacheId ) )
- return;
+ if( isRootElement() )
+ mrTableFilter.importFilter( rAttribs );
+}
- maName = rAttribs.getString( XML_name, OUString() );
- maData.mnCacheId = rAttribs.getInteger( XML_cacheId, 0 );
+ContextHandlerRef OoxPivotTableFilterContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+{
+ switch( getCurrentElement() )
+ {
+ case OOBIN_ID_PTFILTER:
+ if( nRecId == OOBIN_ID_AUTOFILTER ) return this;
+ break;
+ case OOBIN_ID_AUTOFILTER:
+ if( nRecId == OOBIN_ID_FILTERCOLUMN ) return this;
+ break;
+ case OOBIN_ID_FILTERCOLUMN:
+ if( nRecId == OOBIN_ID_TOP10FILTER ) mrTableFilter.importTop10Filter( rStrm );
+ break;
+ }
+ return 0;
+}
- // name="PivotTable3"
- // cacheId="0"
- // applyNumberFormats="0"
- // applyBorderFormats="0"
- // applyFontFormats="0"
- // applyPatternFormats="0"
- // applyAlignmentFormats="0"
- // applyWidthHeightFormats="1"
- // dataCaption="Values"
- // updatedVersion="3"
- // minRefreshableVersion="3"
- // showCalcMbrs="0"
- // useAutoFormatting="1"
- // itemPrintTitles="1"
- // createdVersion="3"
- // indent="0"
- // outline="1"
- // outlineData="1"
- // multipleFieldFilters="0"
+void OoxPivotTableFilterContext::onStartRecord( RecordInputStream& rStrm )
+{
+ if( isRootElement() )
+ mrTableFilter.importPTFilter( rStrm );
}
-void OoxPivotTableFragment::importPivotFields( const AttributeList& rAttribs )
+// ============================================================================
+
+OoxPivotTableFragment::OoxPivotTableFragment( const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
+ OoxWorksheetFragmentBase( rHelper, rFragmentPath ),
+ mrPivotTable( rHelper.getPivotTables().createPivotTable() )
{
- maData.maFields.reserve( rAttribs.getUnsignedInteger( XML_count, 1 ) );
}
-void OoxPivotTableFragment::importPivotField( const AttributeList& rAttribs )
+ContextHandlerRef OoxPivotTableFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- maData.maFields.push_back( PivotTableField() );
- PivotTableField& rField = maData.maFields.back();
- rField.mbDataField = rAttribs.getBool( XML_dataField, false );
+ switch( getCurrentElement() )
+ {
+ case XML_ROOT_CONTEXT:
+ if( nElement == XLS_TOKEN( pivotTableDefinition ) ) { mrPivotTable.importPivotTableDefinition( rAttribs ); return this; }
+ break;
- // Possible values are: axisCol, axisRow, axisPage, axisValues
- switch ( rAttribs.getToken( XML_axis, XML_TOKEN_INVALID ) )
+ case XLS_TOKEN( pivotTableDefinition ):
+ switch( nElement )
+ {
+ case XLS_TOKEN( location ): mrPivotTable.importLocation( rAttribs, getSheetIndex() ); break;
+ case XLS_TOKEN( pivotFields ): return this;
+ case XLS_TOKEN( rowFields ): return this;
+ case XLS_TOKEN( colFields ): return this;
+ case XLS_TOKEN( pageFields ): return this;
+ case XLS_TOKEN( dataFields ): return this;
+ case XLS_TOKEN( filters ): return this;
+ }
+ break;
+
+ case XLS_TOKEN( pivotFields ):
+ if( nElement == XLS_TOKEN( pivotField ) ) return new OoxPivotTableFieldContext( *this, mrPivotTable.createTableField() );
+ break;
+ case XLS_TOKEN( rowFields ):
+ if( nElement == XLS_TOKEN( field ) ) mrPivotTable.importRowField( rAttribs );
+ break;
+ case XLS_TOKEN( colFields ):
+ if( nElement == XLS_TOKEN( field ) ) mrPivotTable.importColField( rAttribs );
+ break;
+ case XLS_TOKEN( pageFields ):
+ if( nElement == XLS_TOKEN( pageField ) ) mrPivotTable.importPageField( rAttribs );
+ break;
+ case XLS_TOKEN( dataFields ):
+ if( nElement == XLS_TOKEN( dataField ) ) mrPivotTable.importDataField( rAttribs );
+ break;
+ case XLS_TOKEN( filters ):
+ if( nElement == XLS_TOKEN( filter ) ) return new OoxPivotTableFilterContext( *this, mrPivotTable.createTableFilter() );
+ break;
+ }
+ return 0;
+}
+
+ContextHandlerRef OoxPivotTableFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+{
+ switch( getCurrentElement() )
{
- case XML_axisCol:
- rField.meAxis = PivotTableField::COLUMN;
+ case XML_ROOT_CONTEXT:
+ if( nRecId == OOBIN_ID_PTDEFINITION ) { mrPivotTable.importPTDefinition( rStrm ); return this; }
break;
- case XML_axisRow:
- rField.meAxis = PivotTableField::ROW;
+
+ case OOBIN_ID_PTDEFINITION:
+ switch( nRecId )
+ {
+ case OOBIN_ID_PTLOCATION: mrPivotTable.importPTLocation( rStrm, getSheetIndex() ); break;
+ case OOBIN_ID_PTFIELDS: return this;
+ case OOBIN_ID_PTROWFIELDS: mrPivotTable.importPTRowFields( rStrm ); break;
+ case OOBIN_ID_PTCOLFIELDS: mrPivotTable.importPTColFields( rStrm ); break;
+ case OOBIN_ID_PTPAGEFIELDS: return this;
+ case OOBIN_ID_PTDATAFIELDS: return this;
+ case OOBIN_ID_PTFILTERS: return this;
+ }
break;
- case XML_axisPage:
- rField.meAxis = PivotTableField::PAGE;
+
+ case OOBIN_ID_PTFIELDS:
+ if( nRecId == OOBIN_ID_PTFIELD ) return new OoxPivotTableFieldContext( *this, mrPivotTable.createTableField() );
break;
- case XML_axisValues:
- rField.meAxis = PivotTableField::VALUES;
+ case OOBIN_ID_PTPAGEFIELDS:
+ if( nRecId == OOBIN_ID_PTPAGEFIELD ) mrPivotTable.importPTPageField( rStrm );
break;
- default:
+ case OOBIN_ID_PTDATAFIELDS:
+ if( nRecId == OOBIN_ID_PTDATAFIELD ) mrPivotTable.importPTDataField( rStrm );
+ break;
+ case OOBIN_ID_PTFILTERS:
+ if( nRecId == OOBIN_ID_PTFILTER ) return new OoxPivotTableFilterContext( *this, mrPivotTable.createTableFilter() );
break;
}
+ return 0;
+}
+
+const RecordInfo* OoxPivotTableFragment::getRecordInfos() const
+{
+ static const RecordInfo spRecInfos[] =
+ {
+ { OOBIN_ID_AUTOFILTER, OOBIN_ID_AUTOFILTER + 1 },
+ { OOBIN_ID_AUTOSORTSCOPE, OOBIN_ID_AUTOSORTSCOPE + 1 },
+ { OOBIN_ID_FILTERCOLUMN, OOBIN_ID_FILTERCOLUMN + 1 },
+ { OOBIN_ID_PIVOTAREA, OOBIN_ID_PIVOTAREA + 1 },
+ { OOBIN_ID_PTCOLFIELDS, OOBIN_ID_PTCOLFIELDS + 1 },
+ { OOBIN_ID_PTDATAFIELD, OOBIN_ID_PTDATAFIELD + 1 },
+ { OOBIN_ID_PTDATAFIELDS, OOBIN_ID_PTDATAFIELDS + 1 },
+ { OOBIN_ID_PTDEFINITION, OOBIN_ID_PTDEFINITION + 35 },
+ { OOBIN_ID_PTFIELD, OOBIN_ID_PTFIELD + 1 },
+ { OOBIN_ID_PTFIELDS, OOBIN_ID_PTFIELDS + 1 },
+ { OOBIN_ID_PTFILTER, OOBIN_ID_PTFILTER + 1 },
+ { OOBIN_ID_PTFILTERS, OOBIN_ID_PTFILTERS + 1 },
+ { OOBIN_ID_PTFITEM, OOBIN_ID_PTFITEM - 1 },
+ { OOBIN_ID_PTFITEMS, OOBIN_ID_PTFITEMS + 1 },
+ { OOBIN_ID_PTLOCATION, OOBIN_ID_PTLOCATION - 1 },
+ { OOBIN_ID_PTPAGEFIELD, OOBIN_ID_PTPAGEFIELD + 1 },
+ { OOBIN_ID_PTPAGEFIELDS, OOBIN_ID_PTPAGEFIELDS + 1 },
+ { OOBIN_ID_PTREFERENCE, OOBIN_ID_PTREFERENCE + 1 },
+ { OOBIN_ID_PTREFERENCEITEM, OOBIN_ID_PTREFERENCEITEM + 1 },
+ { OOBIN_ID_PTREFERENCES, OOBIN_ID_PTREFERENCES + 1 },
+ { OOBIN_ID_PTROWFIELDS, OOBIN_ID_PTROWFIELDS + 1 },
+ { -1, -1 }
+ };
+ return spRecInfos;
}
+// ============================================================================
+// ============================================================================
+
+BiffPivotTableContext::BiffPivotTableContext( const BiffWorksheetFragmentBase& rFragment, PivotTable& rPivotTable ) :
+ BiffWorksheetContextBase( rFragment ),
+ mrPivotTable( rPivotTable )
+{
+}
+
+void BiffPivotTableContext::importRecord()
+{
+ switch( mrStrm.getRecId() )
+ {
+ case BIFF_ID_PTDEFINITION: mrPivotTable.importPTDefinition( mrStrm, getSheetIndex() ); break;
+ case BIFF_ID_PTDEFINITION2: mrPivotTable.importPTDefinition2( mrStrm ); break;
+ case BIFF_ID_PTFIELD: mrPivotTable.createTableField().importPTField( mrStrm ); break;
+ case BIFF_ID_PTROWCOLFIELDS: mrPivotTable.importPTRowColFields( mrStrm ); break;
+ case BIFF_ID_PTPAGEFIELDS: mrPivotTable.importPTPageFields( mrStrm ); break;
+ case BIFF_ID_PTDATAFIELD: mrPivotTable.importPTDataField( mrStrm ); break;
+ }
+}
+
+// ============================================================================
+
} // namespace xls
} // namespace oox
diff --git a/oox/source/xls/querytablefragment.cxx b/oox/source/xls/querytablefragment.cxx
index 6e7bf2ef7a70..935c47913ba2 100644
--- a/oox/source/xls/querytablefragment.cxx
+++ b/oox/source/xls/querytablefragment.cxx
@@ -32,7 +32,7 @@
#include "oox/xls/webquerybuffer.hxx"
using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
+using ::oox::core::ContextHandlerRef;
namespace oox {
namespace xls {
@@ -43,29 +43,15 @@ OoxQueryTableFragment::OoxQueryTableFragment(
{
}
-ContextWrapper OoxQueryTableFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxQueryTableFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nElement == XLS_TOKEN( queryTable ));
- }
- return false;
-}
-
-void OoxQueryTableFragment::onStartElement( const AttributeList& rAttribs )
-{
- switch ( getCurrentElement() )
- {
- case XLS_TOKEN( queryTable ):
- importQueryTable( rAttribs );
+ if( nElement == XLS_TOKEN( queryTable ) ) getWebQueries().importQueryTable( rAttribs );
break;
}
-}
-
-void OoxQueryTableFragment::importQueryTable( const AttributeList& rAttribs )
-{
- getWebQueries().importQueryTable( rAttribs );
+ return 0;
}
} // namespace xls
diff --git a/oox/source/xls/richstring.cxx b/oox/source/xls/richstring.cxx
index f914b1c818aa..d4e93f4bf47a 100644
--- a/oox/source/xls/richstring.cxx
+++ b/oox/source/xls/richstring.cxx
@@ -66,7 +66,7 @@ void RichStringPortion::setText( const OUString& rText )
maText = rText;
}
-FontRef RichStringPortion::importFont( const AttributeList& )
+FontRef RichStringPortion::createFont()
{
mxFont.reset( new Font( *this, false ) );
return mxFont;
@@ -92,27 +92,27 @@ void RichStringPortion::convert( const Reference< XText >& rxText, sal_Int32 nXf
if( mxFont.get() )
{
PropertySet aPropSet( xRange );
- mxFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_RICHTEXT );
+ mxFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT );
}
if( const Font* pFont = getStyles().getFontFromCellXf( nXfId ).get() )
{
if( pFont->needsRichTextFormat() )
{
PropertySet aPropSet( xRange );
- pFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_RICHTEXT );
+ pFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT );
}
}
}
// ----------------------------------------------------------------------------
-void BinFontPortionData::read( RecordInputStream& rStrm )
+void FontPortionModel::read( RecordInputStream& rStrm )
{
mnPos = rStrm.readuInt16();
mnFontId = rStrm.readuInt16();
}
-void BinFontPortionData::read( BiffInputStream& rStrm, BiffFontPortionMode eMode )
+void FontPortionModel::read( BiffInputStream& rStrm, BiffFontPortionMode eMode )
{
switch( eMode )
{
@@ -134,17 +134,17 @@ void BinFontPortionData::read( BiffInputStream& rStrm, BiffFontPortionMode eMode
// ----------------------------------------------------------------------------
-void BinFontPortionList::appendPortion( const BinFontPortionData& rPortion )
+void FontPortionModelList::appendPortion( const FontPortionModel& rPortion )
{
// #i33341# real life -- same character index may occur several times
- OSL_ENSURE( empty() || (back().mnPos <= rPortion.mnPos), "BinFontPortionList::appendPortion - wrong char order" );
+ OSL_ENSURE( empty() || (back().mnPos <= rPortion.mnPos), "FontPortionModelList::appendPortion - wrong char order" );
if( empty() || (back().mnPos < rPortion.mnPos) )
push_back( rPortion );
else
back().mnFontId = rPortion.mnFontId;
}
-void BinFontPortionList::importPortions( RecordInputStream& rStrm )
+void FontPortionModelList::importPortions( RecordInputStream& rStrm )
{
sal_Int32 nCount = rStrm.readInt32();
clear();
@@ -153,7 +153,7 @@ void BinFontPortionList::importPortions( RecordInputStream& rStrm )
reserve( getLimitedValue< size_t, sal_Int64 >( nCount, 0, rStrm.getRemaining() / 4 ) );
/* #i33341# real life -- same character index may occur several times
-> use appendPortion() to validate string position. */
- BinFontPortionData aPortion;
+ FontPortionModel aPortion;
for( sal_Int32 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex )
{
aPortion.read( rStrm );
@@ -162,13 +162,13 @@ void BinFontPortionList::importPortions( RecordInputStream& rStrm )
}
}
-void BinFontPortionList::importPortions( BiffInputStream& rStrm, sal_uInt16 nCount, BiffFontPortionMode eMode )
+void FontPortionModelList::importPortions( BiffInputStream& rStrm, sal_uInt16 nCount, BiffFontPortionMode eMode )
{
clear();
reserve( nCount );
/* #i33341# real life -- same character index may occur several times
-> use appendPortion() to validate string position. */
- BinFontPortionData aPortion;
+ FontPortionModel aPortion;
for( sal_uInt16 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex )
{
aPortion.read( rStrm, eMode );
@@ -176,7 +176,7 @@ void BinFontPortionList::importPortions( BiffInputStream& rStrm, sal_uInt16 nCou
}
}
-void BinFontPortionList::importPortions( BiffInputStream& rStrm, bool b16Bit )
+void FontPortionModelList::importPortions( BiffInputStream& rStrm, bool b16Bit )
{
sal_uInt16 nCount = b16Bit ? rStrm.readuInt16() : rStrm.readuInt8();
importPortions( rStrm, nCount, b16Bit ? BIFF_FONTPORTION_16BIT : BIFF_FONTPORTION_8BIT );
@@ -184,14 +184,14 @@ void BinFontPortionList::importPortions( BiffInputStream& rStrm, bool b16Bit )
// ============================================================================
-OoxPhoneticData::OoxPhoneticData() :
+PhoneticDataModel::PhoneticDataModel() :
mnFontId( -1 ),
mnType( XML_fullwidthKatakana ),
mnAlignment( XML_left )
{
}
-void OoxPhoneticData::setBinData( sal_Int32 nType, sal_Int32 nAlignment )
+void PhoneticDataModel::setBinData( sal_Int32 nType, sal_Int32 nAlignment )
{
static const sal_Int32 spnTypeIds[] = { XML_halfwidthKatakana, XML_fullwidthKatakana, XML_hiragana, XML_noConversion };
mnType = STATIC_ARRAY_SELECT( spnTypeIds, nType, XML_fullwidthKatakana );
@@ -209,9 +209,9 @@ PhoneticSettings::PhoneticSettings( const WorkbookHelper& rHelper ) :
void PhoneticSettings::importPhoneticPr( const AttributeList& rAttribs )
{
- maOoxData.mnFontId = rAttribs.getInteger( XML_fontId, -1 );
- maOoxData.mnType = rAttribs.getToken( XML_type, XML_fullwidthKatakana );
- maOoxData.mnAlignment = rAttribs.getToken( XML_alignment, XML_left );
+ maModel.mnFontId = rAttribs.getInteger( XML_fontId, -1 );
+ maModel.mnType = rAttribs.getToken( XML_type, XML_fullwidthKatakana );
+ maModel.mnAlignment = rAttribs.getToken( XML_alignment, XML_left );
}
void PhoneticSettings::importPhoneticPr( RecordInputStream& rStrm )
@@ -219,16 +219,16 @@ void PhoneticSettings::importPhoneticPr( RecordInputStream& rStrm )
sal_uInt16 nFontId;
sal_Int32 nType, nAlignment;
rStrm >> nFontId >> nType >> nAlignment;
- maOoxData.mnFontId = nFontId;
- maOoxData.setBinData( nType, nAlignment );
+ maModel.mnFontId = nFontId;
+ maModel.setBinData( nType, nAlignment );
}
void PhoneticSettings::importPhoneticPr( BiffInputStream& rStrm )
{
sal_uInt16 nFontId, nFlags;
rStrm >> nFontId >> nFlags;
- maOoxData.mnFontId = nFontId;
- maOoxData.setBinData( extractValue< sal_Int32 >( nFlags, 0, 2 ), extractValue< sal_Int32 >( nFlags, 2, 2 ) );
+ maModel.mnFontId = nFontId;
+ maModel.setBinData( extractValue< sal_Int32 >( nFlags, 0, 2 ), extractValue< sal_Int32 >( nFlags, 2, 2 ) );
// following: range list with cells showing phonetic text
}
@@ -236,16 +236,16 @@ void PhoneticSettings::importStringData( RecordInputStream& rStrm )
{
sal_uInt16 nFontId, nFlags;
rStrm >> nFontId >> nFlags;
- maOoxData.mnFontId = nFontId;
- maOoxData.setBinData( extractValue< sal_Int32 >( nFlags, 0, 2 ), extractValue< sal_Int32 >( nFlags, 2, 2 ) );
+ maModel.mnFontId = nFontId;
+ maModel.setBinData( extractValue< sal_Int32 >( nFlags, 0, 2 ), extractValue< sal_Int32 >( nFlags, 2, 2 ) );
}
void PhoneticSettings::importStringData( BiffInputStream& rStrm )
{
sal_uInt16 nFontId, nFlags;
rStrm >> nFontId >> nFlags;
- maOoxData.mnFontId = nFontId;
- maOoxData.setBinData( extractValue< sal_Int32 >( nFlags, 0, 2 ), extractValue< sal_Int32 >( nFlags, 2, 2 ) );
+ maModel.mnFontId = nFontId;
+ maModel.setBinData( extractValue< sal_Int32 >( nFlags, 0, 2 ), extractValue< sal_Int32 >( nFlags, 2, 2 ) );
}
// ============================================================================
@@ -276,14 +276,14 @@ void RichStringPhonetic::setBaseRange( sal_Int32 nBasePos, sal_Int32 nBaseEnd )
// ----------------------------------------------------------------------------
-void BinPhoneticPortionData::read( RecordInputStream& rStrm )
+void PhoneticPortionModel::read( RecordInputStream& rStrm )
{
mnPos = rStrm.readuInt16();
mnBasePos = rStrm.readuInt16();
mnBaseLen = rStrm.readuInt16();
}
-void BinPhoneticPortionData::read( BiffInputStream& rStrm )
+void PhoneticPortionModel::read( BiffInputStream& rStrm )
{
mnPos = rStrm.readuInt16();
mnBasePos = rStrm.readuInt16();
@@ -292,12 +292,12 @@ void BinPhoneticPortionData::read( BiffInputStream& rStrm )
// ----------------------------------------------------------------------------
-void BinPhoneticPortionList::appendPortion( const BinPhoneticPortionData& rPortion )
+void PhoneticPortionModelList::appendPortion( const PhoneticPortionModel& rPortion )
{
// same character index may occur several times
OSL_ENSURE( empty() || ((back().mnPos <= rPortion.mnPos) &&
(back().mnBasePos + back().mnBaseLen <= rPortion.mnBasePos)),
- "BinPhoneticPortionList::appendPortion - wrong char order" );
+ "PhoneticPortionModelList::appendPortion - wrong char order" );
if( empty() || (back().mnPos < rPortion.mnPos) )
{
push_back( rPortion );
@@ -309,14 +309,14 @@ void BinPhoneticPortionList::appendPortion( const BinPhoneticPortionData& rPorti
}
}
-void BinPhoneticPortionList::importPortions( RecordInputStream& rStrm )
+void PhoneticPortionModelList::importPortions( RecordInputStream& rStrm )
{
sal_Int32 nCount = rStrm.readInt32();
clear();
if( nCount > 0 )
{
reserve( getLimitedValue< size_t, sal_Int64 >( nCount, 0, rStrm.getRemaining() / 6 ) );
- BinPhoneticPortionData aPortion;
+ PhoneticPortionModel aPortion;
for( sal_Int32 nIndex = 0; !rStrm.isEof() && (nIndex < nCount); ++nIndex )
{
aPortion.read( rStrm );
@@ -325,22 +325,22 @@ void BinPhoneticPortionList::importPortions( RecordInputStream& rStrm )
}
}
-OUString BinPhoneticPortionList::importPortions( BiffInputStream& rStrm, sal_Int32 nPhoneticSize )
+OUString PhoneticPortionModelList::importPortions( BiffInputStream& rStrm, sal_Int32 nPhoneticSize )
{
OUString aPhoneticText;
sal_uInt16 nPortionCount, nTextLen1, nTextLen2;
rStrm >> nPortionCount >> nTextLen1 >> nTextLen2;
- OSL_ENSURE( nTextLen1 == nTextLen2, "BinPhoneticPortionList::importPortions - wrong phonetic text length" );
+ OSL_ENSURE( nTextLen1 == nTextLen2, "PhoneticPortionModelList::importPortions - wrong phonetic text length" );
if( (nTextLen1 == nTextLen2) && (nTextLen1 > 0) )
{
sal_Int32 nMinSize = 2 * nTextLen1 + 6 * nPortionCount + 14;
- OSL_ENSURE( nMinSize <= nPhoneticSize, "BinPhoneticPortionList::importPortions - wrong size of phonetic data" );
+ OSL_ENSURE( nMinSize <= nPhoneticSize, "PhoneticPortionModelList::importPortions - wrong size of phonetic data" );
if( nMinSize <= nPhoneticSize )
{
aPhoneticText = rStrm.readUnicodeArray( nTextLen1 );
clear();
reserve( nPortionCount );
- BinPhoneticPortionData aPortion;
+ PhoneticPortionModel aPortion;
for( sal_uInt16 nPortion = 0; nPortion < nPortionCount; ++nPortion )
{
aPortion.read( rStrm );
@@ -388,7 +388,7 @@ void RichString::importString( RecordInputStream& rStrm, bool bRich )
if( !rStrm.isEof() && getFlag( nFlags, OOBIN_STRINGFLAG_FONTS ) )
{
- BinFontPortionList aPortions;
+ FontPortionModelList aPortions;
aPortions.importPortions( rStrm );
createFontPortions( aBaseText, aPortions );
}
@@ -400,7 +400,7 @@ void RichString::importString( RecordInputStream& rStrm, bool bRich )
if( !rStrm.isEof() && getFlag( nFlags, OOBIN_STRINGFLAG_PHONETICS ) )
{
OUString aPhoneticText = rStrm.readString();
- BinPhoneticPortionList aPortions;
+ PhoneticPortionModelList aPortions;
aPortions.importPortions( rStrm );
maPhonSettings.importStringData( rStrm );
createPhoneticPortions( aPhoneticText, aPortions, aBaseText.getLength() );
@@ -417,7 +417,7 @@ void RichString::importByteString( BiffInputStream& rStrm, rtl_TextEncoding eDef
if( !rStrm.isEof() && getFlag( nFlags, BIFF_STR_EXTRAFONTS ) )
{
- BinFontPortionList aPortions;
+ FontPortionModelList aPortions;
aPortions.importPortions( rStrm, false );
createFontPortions( aBaseText, eDefaultTextEnc, aPortions );
}
@@ -451,7 +451,7 @@ void RichString::importUniString( BiffInputStream& rStrm, BiffStringFlags nFlags
// #122185# bRich flag may be set, but format runs may be missing
if( !rStrm.isEof() && (nFontCount > 0) )
{
- BinFontPortionList aPortions;
+ FontPortionModelList aPortions;
aPortions.importPortions( rStrm, nFontCount, BIFF_FONTPORTION_16BIT );
createFontPortions( aBaseText, aPortions );
}
@@ -476,7 +476,7 @@ void RichString::importUniString( BiffInputStream& rStrm, BiffStringFlags nFlags
if( (nId == 1) && (nMinSize <= nPhoneticSize) )
{
maPhonSettings.importStringData( rStrm );
- BinPhoneticPortionList aPortions;
+ PhoneticPortionModelList aPortions;
OUString aPhoneticText = aPortions.importPortions( rStrm, nPhoneticSize );
createPhoneticPortions( aPhoneticText, aPortions, aBaseText.getLength() );
}
@@ -515,7 +515,7 @@ RichStringPhoneticRef RichString::createPhonetic()
return xPhonetic;
}
-void RichString::createFontPortions( const OString& rText, rtl_TextEncoding eDefaultTextEnc, BinFontPortionList& rPortions )
+void RichString::createFontPortions( const OString& rText, rtl_TextEncoding eDefaultTextEnc, FontPortionModelList& rPortions )
{
maFontPortions.clear();
sal_Int32 nStrLen = rText.getLength();
@@ -523,12 +523,12 @@ void RichString::createFontPortions( const OString& rText, rtl_TextEncoding eDef
{
// add leading and trailing string position to ease the following loop
if( rPortions.empty() || (rPortions.front().mnPos > 0) )
- rPortions.insert( rPortions.begin(), BinFontPortionData( 0, -1 ) );
+ rPortions.insert( rPortions.begin(), FontPortionModel( 0, -1 ) );
if( rPortions.back().mnPos < nStrLen )
- rPortions.push_back( BinFontPortionData( nStrLen, -1 ) );
+ rPortions.push_back( FontPortionModel( nStrLen, -1 ) );
// create all string portions according to the font id vector
- for( BinFontPortionList::const_iterator aIt = rPortions.begin(); aIt->mnPos < nStrLen; ++aIt )
+ for( FontPortionModelList::const_iterator aIt = rPortions.begin(); aIt->mnPos < nStrLen; ++aIt )
{
sal_Int32 nPortionLen = (aIt + 1)->mnPos - aIt->mnPos;
if( (0 < nPortionLen) && (aIt->mnPos + nPortionLen <= nStrLen) )
@@ -546,7 +546,7 @@ void RichString::createFontPortions( const OString& rText, rtl_TextEncoding eDef
}
}
-void RichString::createFontPortions( const OUString& rText, BinFontPortionList& rPortions )
+void RichString::createFontPortions( const OUString& rText, FontPortionModelList& rPortions )
{
maFontPortions.clear();
sal_Int32 nStrLen = rText.getLength();
@@ -554,12 +554,12 @@ void RichString::createFontPortions( const OUString& rText, BinFontPortionList&
{
// add leading and trailing string position to ease the following loop
if( rPortions.empty() || (rPortions.front().mnPos > 0) )
- rPortions.insert( rPortions.begin(), BinFontPortionData( 0, -1 ) );
+ rPortions.insert( rPortions.begin(), FontPortionModel( 0, -1 ) );
if( rPortions.back().mnPos < nStrLen )
- rPortions.push_back( BinFontPortionData( nStrLen, -1 ) );
+ rPortions.push_back( FontPortionModel( nStrLen, -1 ) );
// create all string portions according to the font id vector
- for( BinFontPortionList::const_iterator aIt = rPortions.begin(); aIt->mnPos < nStrLen; ++aIt )
+ for( FontPortionModelList::const_iterator aIt = rPortions.begin(); aIt->mnPos < nStrLen; ++aIt )
{
sal_Int32 nPortionLen = (aIt + 1)->mnPos - aIt->mnPos;
if( (0 < nPortionLen) && (aIt->mnPos + nPortionLen <= nStrLen) )
@@ -572,7 +572,7 @@ void RichString::createFontPortions( const OUString& rText, BinFontPortionList&
}
}
-void RichString::createPhoneticPortions( const ::rtl::OUString& rText, BinPhoneticPortionList& rPortions, sal_Int32 nBaseLen )
+void RichString::createPhoneticPortions( const ::rtl::OUString& rText, PhoneticPortionModelList& rPortions, sal_Int32 nBaseLen )
{
maPhonPortions.clear();
sal_Int32 nStrLen = rText.getLength();
@@ -580,13 +580,13 @@ void RichString::createPhoneticPortions( const ::rtl::OUString& rText, BinPhonet
{
// no portions - assign phonetic text to entire base text
if( rPortions.empty() )
- rPortions.push_back( BinPhoneticPortionData( 0, 0, nBaseLen ) );
+ rPortions.push_back( PhoneticPortionModel( 0, 0, nBaseLen ) );
// add trailing string position to ease the following loop
if( rPortions.back().mnPos < nStrLen )
- rPortions.push_back( BinPhoneticPortionData( nStrLen, nBaseLen, 0 ) );
+ rPortions.push_back( PhoneticPortionModel( nStrLen, nBaseLen, 0 ) );
// create all phonetic portions according to the portions vector
- for( BinPhoneticPortionList::const_iterator aIt = rPortions.begin(); aIt->mnPos < nStrLen; ++aIt )
+ for( PhoneticPortionModelList::const_iterator aIt = rPortions.begin(); aIt->mnPos < nStrLen; ++aIt )
{
sal_Int32 nPortionLen = (aIt + 1)->mnPos - aIt->mnPos;
if( (0 < nPortionLen) && (aIt->mnPos + nPortionLen <= nStrLen) )
diff --git a/oox/source/xls/richstringcontext.cxx b/oox/source/xls/richstringcontext.cxx
index 90f2e03b2472..c64c52c2598b 100644
--- a/oox/source/xls/richstringcontext.cxx
+++ b/oox/source/xls/richstringcontext.cxx
@@ -29,8 +29,10 @@
************************************************************************/
#include "oox/xls/richstringcontext.hxx"
+#include "oox/xls/stylesfragment.hxx"
using ::rtl::OUString;
+using ::oox::core::ContextHandlerRef;
namespace oox {
namespace xls {
@@ -39,69 +41,53 @@ namespace xls {
// oox.core.ContextHandler2Helper interface -----------------------------------
-ContextWrapper OoxRichStringContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxRichStringContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
- switch( getCurrentElement() )
+ if( isRootElement() )
{
- case XLS_TOKEN( si ):
- case XLS_TOKEN( is ):
- case XLS_TOKEN( text ):
- return (nElement == XLS_TOKEN( t )) ||
- (nElement == XLS_TOKEN( r )) ||
- (nElement == XLS_TOKEN( rPh )) ||
- (nElement == XLS_TOKEN( phoneticPr ));
- case XLS_TOKEN( r ):
- return (nElement == XLS_TOKEN( rPr )) ||
- (nElement == XLS_TOKEN( t ));
- case XLS_TOKEN( rPh ):
- return (nElement == XLS_TOKEN( t ));
- case XLS_TOKEN( rPr ):
- return Font::isSupportedContext( nElement, getCurrentElement() );
+ switch( nElement )
+ {
+ case XLS_TOKEN( t ): mxPortion = mxString->importText( rAttribs ); return this; // collect text in onEndElement()
+ case XLS_TOKEN( r ): mxPortion = mxString->importRun( rAttribs ); return this;
+ case XLS_TOKEN( rPh ): mxPhonetic = mxString->importPhoneticRun( rAttribs ); return this;
+ case XLS_TOKEN( phoneticPr ): mxString->importPhoneticPr( rAttribs ); break;
+ }
}
- return false;
-}
-
-void OoxRichStringContext::onStartElement( const AttributeList& rAttribs )
-{
- sal_Int32 nCurrContext = getCurrentElement();
- switch( nCurrContext )
+ else switch( getCurrentElement() )
{
- case XLS_TOKEN( t ):
- if( !isPreviousElement( XLS_TOKEN( r ) ) && !isPreviousElement( XLS_TOKEN( rPh ) ) )
- mxPortion = mxString->importText( rAttribs );
- break;
case XLS_TOKEN( r ):
- mxPortion = mxString->importRun( rAttribs );
- break;
- case XLS_TOKEN( rPr ):
- if( mxPortion.get() ) mxFont = mxPortion->importFont( rAttribs );
+ switch( nElement )
+ {
+ case XLS_TOKEN( rPr ):
+ if( mxPortion.get() )
+ return new OoxFontContext( *this, mxPortion->createFont() );
+ break;
+
+ case XLS_TOKEN( t ):
+ return this; // collect portion text in onEndElement()
+ }
break;
+
case XLS_TOKEN( rPh ):
- mxPhonetic = mxString->importPhoneticRun( rAttribs );
- break;
- case XLS_TOKEN( phoneticPr ):
- mxString->importPhoneticPr( rAttribs );
+ switch( nElement )
+ {
+ case XLS_TOKEN( t ):
+ return this; // collect phonetic text in onEndElement()
+ }
break;
- default:
- if( isPreviousElement( XLS_TOKEN( rPr ) ) && mxFont.get() )
- mxFont->importAttribs( nCurrContext, rAttribs );
}
+ return 0;
}
void OoxRichStringContext::onEndElement( const OUString& rChars )
{
- switch( getCurrentElement() )
+ if( getCurrentElement() == XLS_TOKEN( t ) )
{
- case XLS_TOKEN( t ):
- switch( getPreviousElement() )
- {
- case XLS_TOKEN( rPh ):
- if( mxPhonetic.get() ) mxPhonetic->setText( rChars );
- break;
- default:
- if( mxPortion.get() ) mxPortion->setText( rChars );
- }
- break;
+ switch( getPreviousElement() )
+ {
+ case XLS_TOKEN( rPh ): if( mxPhonetic.get() ) mxPhonetic->setText( rChars ); break;
+ default: if( mxPortion.get() ) mxPortion->setText( rChars ); break;
+ }
}
}
diff --git a/oox/source/xls/sharedformulabuffer.cxx b/oox/source/xls/sharedformulabuffer.cxx
index 3e0f1ce4a1a3..c6dccfaaab3f 100644
--- a/oox/source/xls/sharedformulabuffer.cxx
+++ b/oox/source/xls/sharedformulabuffer.cxx
@@ -31,6 +31,7 @@
#include "oox/xls/sharedformulabuffer.hxx"
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/sheet/XFormulaTokens.hpp>
+#include "properties.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/addressconverter.hxx"
@@ -90,15 +91,14 @@ void ExtCellFormulaContext::setSharedFormula( const CellAddress& rBaseAddr )
// ============================================================================
SharedFormulaBuffer::SharedFormulaBuffer( const WorksheetHelper& rHelper ) :
- WorksheetHelper( rHelper ),
- maIsSharedProp( CREATE_OUSTRING( "IsSharedFormula" ) )
+ WorksheetHelper( rHelper )
{
}
void SharedFormulaBuffer::importSharedFmla( const OUString& rFormula, const OUString& rSharedRange, sal_Int32 nSharedId, const CellAddress& rBaseAddr )
{
CellRangeAddress aFmlaRange;
- if( getAddressConverter().convertToCellRange( aFmlaRange, rSharedRange, getSheetIndex(), true ) )
+ if( getAddressConverter().convertToCellRange( aFmlaRange, rSharedRange, getSheetIndex(), true, true ) )
{
// create the defined name representing the shared formula
OSL_ENSURE( lclContains( aFmlaRange, rBaseAddr ), "SharedFormulaBuffer::importSharedFmla - invalid range for shared formula" );
@@ -121,7 +121,7 @@ void SharedFormulaBuffer::importSharedFmla( RecordInputStream& rStrm, const Cell
BinRange aRange;
rStrm >> aRange;
CellRangeAddress aFmlaRange;
- if( getAddressConverter().convertToCellRange( aFmlaRange, aRange, getSheetIndex(), true ) )
+ if( getAddressConverter().convertToCellRange( aFmlaRange, aRange, getSheetIndex(), true, true ) )
{
// create the defined name representing the shared formula
OSL_ENSURE( lclContains( aFmlaRange, rBaseAddr ), "SharedFormulaBuffer::importSharedFmla - invalid range for shared formula" );
@@ -144,7 +144,7 @@ void SharedFormulaBuffer::importSharedFmla( BiffInputStream& rStrm, const CellAd
BinRange aRange;
aRange.read( rStrm, false ); // always 8bit column indexes
CellRangeAddress aFmlaRange;
- if( getAddressConverter().convertToCellRange( aFmlaRange, aRange, getSheetIndex(), true ) )
+ if( getAddressConverter().convertToCellRange( aFmlaRange, aRange, getSheetIndex(), true, true ) )
{
// create the defined name representing the shared formula
OSL_ENSURE( lclContains( aFmlaRange, rBaseAddr ), "SharedFormulaBuffer::importSharedFmla - invalid range for shared formula" );
@@ -185,9 +185,9 @@ Reference< XNamedRange > SharedFormulaBuffer::createDefinedName( const BinAddres
append( sal_Unicode( '_' ) ).append( rMapKey.mnCol ).makeStringAndClear();
Reference< XNamedRange > xNamedRange = createNamedRangeObject( aName );
PropertySet aNameProps( xNamedRange );
- aNameProps.setProperty( maIsSharedProp, true );
+ aNameProps.setProperty( PROP_IsSharedFormula, true );
sal_Int32 nTokenIndex = -1;
- if( aNameProps.getProperty( nTokenIndex, CREATE_OUSTRING( "TokenIndex" ) ) && (nTokenIndex >= 0) )
+ if( aNameProps.getProperty( nTokenIndex, PROP_TokenIndex ) && (nTokenIndex >= 0) )
maIndexMap[ rMapKey ] = nTokenIndex;
return xNamedRange;
}
diff --git a/oox/source/xls/sharedstringsfragment.cxx b/oox/source/xls/sharedstringsfragment.cxx
index 227bffd6758e..6d982402c3ef 100644
--- a/oox/source/xls/sharedstringsfragment.cxx
+++ b/oox/source/xls/sharedstringsfragment.cxx
@@ -33,7 +33,7 @@
#include "oox/xls/richstringcontext.hxx"
using ::rtl::OUString;
-using ::com::sun::star::uno::Reference;
+using ::oox::core::ContextHandlerRef;
using ::oox::core::RecordInfo;
namespace oox {
@@ -49,38 +49,38 @@ OoxSharedStringsFragment::OoxSharedStringsFragment(
// oox.core.ContextHandler2Helper interface -----------------------------------
-ContextWrapper OoxSharedStringsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxSharedStringsFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nElement == XLS_TOKEN( sst ));
+ if( nElement == XLS_TOKEN( sst ) )
+ return this;
+ break;
+
case XLS_TOKEN( sst ):
if( nElement == XLS_TOKEN( si ) )
return new OoxRichStringContext( *this, getSharedStrings().createRichString() );
break;
}
- return false;
+ return 0;
}
-ContextWrapper OoxSharedStringsFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& )
+ContextHandlerRef OoxSharedStringsFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nRecId == OOBIN_ID_SST);
- case OOBIN_ID_SST:
- return (nRecId == OOBIN_ID_SI);
- }
- return false;
-}
+ if( nRecId == OOBIN_ID_SST )
+ return this;
+ break;
-void OoxSharedStringsFragment::onStartRecord( RecordInputStream& rStrm )
-{
- switch( getCurrentElement() )
- {
- case OOBIN_ID_SI: getSharedStrings().createRichString()->importString( rStrm, true ); break;
+ case OOBIN_ID_SST:
+ if( nRecId == OOBIN_ID_SI )
+ getSharedStrings().createRichString()->importString( rStrm, true );
+ break;
}
+ return 0;
}
// oox.core.FragmentHandler2 interface ----------------------------------------
diff --git a/oox/source/xls/sheetcellrangemap.cxx b/oox/source/xls/sheetcellrangemap.cxx
deleted file mode 100644
index c31ad7515a7b..000000000000
--- a/oox/source/xls/sheetcellrangemap.cxx
+++ /dev/null
@@ -1,167 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: sheetcellrangemap.cxx,v $
- * $Revision: 1.3 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "oox/xls/sheetcellrangemap.hxx"
-
-#define DEBUG_OOX_CELLRANGE_MAP 0
-
-#include <com/sun/star/table/CellRangeAddress.hpp>
-#include <com/sun/star/table/CellAddress.hpp>
-
-#if DEBUG_OOX_CELLRANGE_MAP
-#include <stdio.h>
-#endif
-
-using ::com::sun::star::table::CellAddress;
-using ::com::sun::star::table::CellRangeAddress;
-
-namespace oox {
-namespace xls {
-
-SheetCellRangeMap::SheetCellRangeMap()
-{
-}
-
-SheetCellRangeMap::~SheetCellRangeMap() throw()
-{
-}
-
-void SheetCellRangeMap::addCellRange( const CellRangeAddress& aRangeAddr )
-{
- size_t nAreaId = maAreas.size();
-
- // First, find the sheet ID.
- SheetMapType::iterator posSheet = maSheetMap.find(aRangeAddr.Sheet);
- if ( posSheet == maSheetMap.end() )
- {
- maSheetMap.insert( SheetMapType::value_type(aRangeAddr.Sheet, SheetSet()) );
- posSheet = maSheetMap.find(aRangeAddr.Sheet);
- OSL_ENSURE( posSheet != maSheetMap.end(), "SheetCellRangeMap::addCellRange: insertion failure" );
- }
- SheetSet& rSheet = posSheet->second;
-
- addRange(rSheet.maColRanges, aRangeAddr.StartColumn, aRangeAddr.EndColumn, nAreaId);
- addRange(rSheet.maRowRanges, aRangeAddr.StartRow, aRangeAddr.EndRow, nAreaId);
-
-#if DEBUG_OOX_CELLRANGE_MAP
- fprintf(stdout, "SheetCellRangeMap::addCellRange: adding (sheet: %d) (col: %ld - %ld) (row: %ld - %ld) (area: %d)\n",
- aRangeAddr.Sheet, aRangeAddr.StartColumn, aRangeAddr.EndColumn, aRangeAddr.StartRow, aRangeAddr.EndRow, nAreaId);fflush(stdout);
-#endif
-
- maAreas.push_back(aRangeAddr);
-}
-
-bool SheetCellRangeMap::isOverlapping( const CellAddress& aCellAddr ) const
-{
- if ( maAreas.empty() )
- return false;
-
- SheetMapType::const_iterator pos = maSheetMap.find(aCellAddr.Sheet);
- if ( pos == maSheetMap.end() )
- // There is no cell range registered for this sheet.
- return false;
-
- const SheetSet& rSheet = pos->second;
- return searchColumns( rSheet, aCellAddr );
-}
-
-void SheetCellRangeMap::addRange( StartEndMapType& rRangeMap, sal_Int32 nStart, sal_Int32 nEnd, size_t nAreaId )
-{
- StartEndMapType::iterator posStart = rRangeMap.find(nStart);
- if ( posStart == rRangeMap.end() )
- {
- EndAreaIdMapType aMap;
- rRangeMap.insert( StartEndMapType::value_type(nStart, aMap) );
- posStart = rRangeMap.find(nStart);
- OSL_ENSURE( posStart != rRangeMap.end(), "TableBuffer::addRangeToSet: insertion failure" );
- }
- EndAreaIdMapType& rEndMap = posStart->second;
-
- EndAreaIdMapType::iterator posEnd = rEndMap.find(nEnd);
- if ( posEnd == rEndMap.end() )
- {
- AreaIdSetType aSet;
- rEndMap.insert( EndAreaIdMapType::value_type(nEnd, aSet) );
- posEnd = rEndMap.find(nEnd);
- OSL_ENSURE( posEnd != rEndMap.end(), "TableBuffer::addRangeToSet: insertion failure" );
- }
-
- AreaIdSetType& rSet = posEnd->second;
- rSet.push_back(nAreaId);
-}
-
-bool SheetCellRangeMap::expandSearch( const EndAreaIdMapType& rEndMap, const CellAddress& rCellAddr, bool bColumn ) const
-{
- sal_Int32 nId = bColumn ? rCellAddr.Column : rCellAddr.Row;
-
- EndAreaIdMapType::const_reverse_iterator itr, itrBeg = rEndMap.rbegin(), itrEnd = rEndMap.rend();
- for ( itr = itrBeg; itr != itrEnd; ++itr )
- {
- if ( itr->first >= nId )
- {
- // The point is in-range.
- const AreaIdSetType& rSet = itr->second;
- AreaIdSetType::const_iterator itr2 = rSet.begin(), itr2End = rSet.end();
- for ( ; itr2 != itr2End; ++itr2 )
- {
- OSL_ENSURE( maAreas.size() > *itr2, "SheetCellRangeMap::expandSearch: size mismatch" );
- const CellRangeAddress& rRange = maAreas[*itr2];
- if ( bColumn && rCellAddr.Row >= rRange.StartRow && rCellAddr.Row <= rRange.EndRow )
- return true;
- if ( !bColumn && rCellAddr.Column >= rRange.StartColumn && rCellAddr.Column <= rRange.EndColumn )
- return true;
- }
- }
- else if ( itr->first < nId )
- // No more enclosing ranges.
- return false;
- }
- return false;
-}
-
-bool SheetCellRangeMap::searchColumns( const SheetSet& rSheet, const CellAddress& aCellAddr ) const
-{
- StartEndMapType::const_iterator itr, itrBeg = rSheet.maColRanges.begin(), itrEnd = rSheet.maColRanges.end();
- for ( itr = itrBeg; itr != itrEnd; ++itr )
- {
- if ( itr->first <= aCellAddr.Column )
- {
- if ( expandSearch(itr->second, aCellAddr, true) )
- return true;
- }
- else if ( itr->first > aCellAddr.Column )
- return false;
- }
- return false;
-}
-
-} // namespace xls
-} // namespace oox
-
diff --git a/oox/source/xls/sheetdatacontext.cxx b/oox/source/xls/sheetdatacontext.cxx
index 635a2810abad..cd741f9649ff 100644
--- a/oox/source/xls/sheetdatacontext.cxx
+++ b/oox/source/xls/sheetdatacontext.cxx
@@ -41,7 +41,6 @@
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/formulaparser.hxx"
-#include "oox/xls/pivottablebuffer.hxx"
#include "oox/xls/richstringcontext.hxx"
#include "oox/xls/sharedformulabuffer.hxx"
#include "oox/xls/unitconverter.hxx"
@@ -59,6 +58,7 @@ using ::com::sun::star::table::XCellRange;
using ::com::sun::star::sheet::XFormulaTokens;
using ::com::sun::star::sheet::XArrayFormulaTokens;
using ::com::sun::star::text::XText;
+using ::oox::core::ContextHandlerRef;
namespace oox {
namespace xls {
@@ -172,42 +172,39 @@ OoxSheetDataContext::OoxSheetDataContext( OoxWorksheetFragmentBase& rFragment )
// oox.core.ContextHandler2Helper interface -----------------------------------
-ContextWrapper OoxSheetDataContext::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxSheetDataContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
+ OOX_LOADSAVE_TIMER( ONCREATESHEETCONTEXT );
switch( getCurrentElement() )
{
case XLS_TOKEN( sheetData ):
- return (nElement == XLS_TOKEN( row ));
+ if( nElement == XLS_TOKEN( row ) ) { importRow( rAttribs ); return this; }
+ break;
+
case XLS_TOKEN( row ):
- return (nElement == XLS_TOKEN( c ));
+ if( nElement == XLS_TOKEN( c ) ) { importCell( rAttribs ); return this; }
+ break;
+
case XLS_TOKEN( c ):
- if( maCurrCell.mxCell.is() )
+ if( maCurrCell.mxCell.is() ) switch( nElement )
{
- if( nElement == XLS_TOKEN( is ) )
- {
+ case XLS_TOKEN( is ):
mxInlineStr.reset( new RichString( *this ) );
return new OoxRichStringContext( *this, mxInlineStr );
- }
- return (nElement == XLS_TOKEN( v )) ||
- (nElement == XLS_TOKEN( f ));
+ case XLS_TOKEN( v ):
+ return this;
+ case XLS_TOKEN( f ):
+ importFormula( rAttribs );
+ return this;
}
break;
}
- return false;
-}
-
-void OoxSheetDataContext::onStartElement( const AttributeList& rAttribs )
-{
- switch( getCurrentElement() )
- {
- case XLS_TOKEN( row ): importRow( rAttribs ); break;
- case XLS_TOKEN( c ): importCell( rAttribs ); break;
- case XLS_TOKEN( f ): importFormula( rAttribs ); break;
- }
+ return 0;
}
void OoxSheetDataContext::onEndElement( const OUString& rChars )
{
+ OOX_LOADSAVE_TIMER( ONENDSHEETELEMENT );
switch( getCurrentElement() )
{
case XLS_TOKEN( v ):
@@ -254,7 +251,7 @@ void OoxSheetDataContext::onEndElement( const OUString& rChars )
if( maCurrCell.maFormulaRef.getLength() > 0 )
{
CellRangeAddress aTableRange;
- if( getAddressConverter().convertToCellRange( aTableRange, maCurrCell.maFormulaRef, getSheetIndex(), true ) )
+ if( getAddressConverter().convertToCellRange( aTableRange, maCurrCell.maFormulaRef, getSheetIndex(), true, true ) )
setTableOperation( aTableRange, maTableData );
}
break;
@@ -276,7 +273,7 @@ void OoxSheetDataContext::onEndElement( const OUString& rChars )
if( maCurrCell.mbHasValueStr )
{
// implemented in WorksheetHelper class
- setOoxCell( maCurrCell );
+ setCell( maCurrCell );
}
else if( (maCurrCell.mnCellType == XML_inlineStr) && mxInlineStr.get() )
{
@@ -301,103 +298,79 @@ void OoxSheetDataContext::onEndElement( const OUString& rChars )
}
}
-ContextWrapper OoxSheetDataContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& )
+ContextHandlerRef OoxSheetDataContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
{
switch( getCurrentElement() )
{
case OOBIN_ID_SHEETDATA:
- return (nRecId == OOBIN_ID_ROW);
- case OOBIN_ID_ROW:
- return (nRecId == OOBIN_ID_ARRAY) ||
- (nRecId == OOBIN_ID_CELL_BOOL) ||
- (nRecId == OOBIN_ID_CELL_BLANK) ||
- (nRecId == OOBIN_ID_CELL_DOUBLE) ||
- (nRecId == OOBIN_ID_CELL_ERROR) ||
- (nRecId == OOBIN_ID_CELL_RK) ||
- (nRecId == OOBIN_ID_CELL_RSTRING) ||
- (nRecId == OOBIN_ID_CELL_SI) ||
- (nRecId == OOBIN_ID_CELL_STRING) ||
- (nRecId == OOBIN_ID_DATATABLE) ||
- (nRecId == OOBIN_ID_FORMULA_BOOL) ||
- (nRecId == OOBIN_ID_FORMULA_DOUBLE) ||
- (nRecId == OOBIN_ID_FORMULA_ERROR) ||
- (nRecId == OOBIN_ID_FORMULA_STRING) ||
- (nRecId == OOBIN_ID_MULTCELL_BOOL) ||
- (nRecId == OOBIN_ID_MULTCELL_BLANK) ||
- (nRecId == OOBIN_ID_MULTCELL_DOUBLE) ||
- (nRecId == OOBIN_ID_MULTCELL_ERROR) ||
- (nRecId == OOBIN_ID_MULTCELL_RK) ||
- (nRecId == OOBIN_ID_MULTCELL_RSTRING) ||
- (nRecId == OOBIN_ID_MULTCELL_SI) ||
- (nRecId == OOBIN_ID_MULTCELL_STRING) ||
- (nRecId == OOBIN_ID_SHAREDFMLA);
- }
- return false;
-}
+ switch( nRecId )
+ {
+ case OOBIN_ID_ROW: importRow( rStrm ); return this;
+ }
+ break;
-void OoxSheetDataContext::onStartRecord( RecordInputStream& rStrm )
-{
- switch( getCurrentElement() )
- {
- case OOBIN_ID_ARRAY: importArray( rStrm ); break;
- case OOBIN_ID_CELL_BOOL: importCellBool( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_CELL_BLANK: importCellBlank( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_CELL_DOUBLE: importCellDouble( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_CELL_ERROR: importCellError( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_CELL_RK: importCellRk( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_CELL_RSTRING: importCellRString( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_CELL_SI: importCellSi( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_CELL_STRING: importCellString( rStrm, CELLTYPE_VALUE ); break;
- case OOBIN_ID_DATATABLE: importDataTable( rStrm ); break;
- case OOBIN_ID_FORMULA_BOOL: importCellBool( rStrm, CELLTYPE_FORMULA ); break;
- case OOBIN_ID_FORMULA_DOUBLE: importCellDouble( rStrm, CELLTYPE_FORMULA ); break;
- case OOBIN_ID_FORMULA_ERROR: importCellError( rStrm, CELLTYPE_FORMULA ); break;
- case OOBIN_ID_FORMULA_STRING: importCellString( rStrm, CELLTYPE_FORMULA ); break;
- case OOBIN_ID_MULTCELL_BOOL: importCellBool( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_MULTCELL_BLANK: importCellBlank( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_MULTCELL_DOUBLE: importCellDouble( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_MULTCELL_ERROR: importCellError( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_MULTCELL_RK: importCellRk( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_MULTCELL_RSTRING: importCellRString( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_MULTCELL_SI: importCellSi( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_MULTCELL_STRING: importCellString( rStrm, CELLTYPE_MULTI ); break;
- case OOBIN_ID_ROW: importRow( rStrm ); break;
- case OOBIN_ID_SHAREDFMLA: importSharedFmla( rStrm ); break;
+ case OOBIN_ID_ROW:
+ switch( nRecId )
+ {
+ case OOBIN_ID_ARRAY: importArray( rStrm ); break;
+ case OOBIN_ID_CELL_BOOL: importCellBool( rStrm, CELLTYPE_VALUE ); break;
+ case OOBIN_ID_CELL_BLANK: importCellBlank( rStrm, CELLTYPE_VALUE ); break;
+ case OOBIN_ID_CELL_DOUBLE: importCellDouble( rStrm, CELLTYPE_VALUE ); break;
+ case OOBIN_ID_CELL_ERROR: importCellError( rStrm, CELLTYPE_VALUE ); break;
+ case OOBIN_ID_CELL_RK: importCellRk( rStrm, CELLTYPE_VALUE ); break;
+ case OOBIN_ID_CELL_RSTRING: importCellRString( rStrm, CELLTYPE_VALUE ); break;
+ case OOBIN_ID_CELL_SI: importCellSi( rStrm, CELLTYPE_VALUE ); break;
+ case OOBIN_ID_CELL_STRING: importCellString( rStrm, CELLTYPE_VALUE ); break;
+ case OOBIN_ID_DATATABLE: importDataTable( rStrm ); break;
+ case OOBIN_ID_FORMULA_BOOL: importCellBool( rStrm, CELLTYPE_FORMULA ); break;
+ case OOBIN_ID_FORMULA_DOUBLE: importCellDouble( rStrm, CELLTYPE_FORMULA ); break;
+ case OOBIN_ID_FORMULA_ERROR: importCellError( rStrm, CELLTYPE_FORMULA ); break;
+ case OOBIN_ID_FORMULA_STRING: importCellString( rStrm, CELLTYPE_FORMULA ); break;
+ case OOBIN_ID_MULTCELL_BOOL: importCellBool( rStrm, CELLTYPE_MULTI ); break;
+ case OOBIN_ID_MULTCELL_BLANK: importCellBlank( rStrm, CELLTYPE_MULTI ); break;
+ case OOBIN_ID_MULTCELL_DOUBLE: importCellDouble( rStrm, CELLTYPE_MULTI ); break;
+ case OOBIN_ID_MULTCELL_ERROR: importCellError( rStrm, CELLTYPE_MULTI ); break;
+ case OOBIN_ID_MULTCELL_RK: importCellRk( rStrm, CELLTYPE_MULTI ); break;
+ case OOBIN_ID_MULTCELL_RSTRING: importCellRString( rStrm, CELLTYPE_MULTI ); break;
+ case OOBIN_ID_MULTCELL_SI: importCellSi( rStrm, CELLTYPE_MULTI ); break;
+ case OOBIN_ID_MULTCELL_STRING: importCellString( rStrm, CELLTYPE_MULTI ); break;
+ case OOBIN_ID_SHAREDFMLA: importSharedFmla( rStrm ); break;
+ }
+ break;
}
+ return 0;
}
// private --------------------------------------------------------------------
void OoxSheetDataContext::importRow( const AttributeList& rAttribs )
{
- OoxRowData aData;
- aData.mnFirstRow = aData.mnLastRow = rAttribs.getInteger( XML_r, -1 );
- aData.mfHeight = rAttribs.getDouble( XML_ht, -1.0 );
- aData.mnXfId = rAttribs.getInteger( XML_s, -1 );
- aData.mnLevel = rAttribs.getInteger( XML_outlineLevel, 0 );
- aData.mbCustomHeight = rAttribs.getBool( XML_customHeight, false );
- aData.mbCustomFormat = rAttribs.getBool( XML_customFormat, false );
- aData.mbShowPhonetic = rAttribs.getBool( XML_ph, false );
- aData.mbHidden = rAttribs.getBool( XML_hidden, false );
- aData.mbCollapsed = rAttribs.getBool( XML_collapsed, false );
- aData.mbThickTop = rAttribs.getBool( XML_thickTop, false );
- aData.mbThickBottom = rAttribs.getBool( XML_thickBot, false );
+ OOX_LOADSAVE_TIMER( IMPORTROW );
+ RowModel aModel;
+ aModel.mnFirstRow = aModel.mnLastRow = rAttribs.getInteger( XML_r, -1 );
+ aModel.mfHeight = rAttribs.getDouble( XML_ht, -1.0 );
+ aModel.mnXfId = rAttribs.getInteger( XML_s, -1 );
+ aModel.mnLevel = rAttribs.getInteger( XML_outlineLevel, 0 );
+ aModel.mbCustomHeight = rAttribs.getBool( XML_customHeight, false );
+ aModel.mbCustomFormat = rAttribs.getBool( XML_customFormat, false );
+ aModel.mbShowPhonetic = rAttribs.getBool( XML_ph, false );
+ aModel.mbHidden = rAttribs.getBool( XML_hidden, false );
+ aModel.mbCollapsed = rAttribs.getBool( XML_collapsed, false );
+ aModel.mbThickTop = rAttribs.getBool( XML_thickTop, false );
+ aModel.mbThickBottom = rAttribs.getBool( XML_thickBot, false );
// set row properties in the current sheet
- setRowData( aData );
+ setRowModel( aModel );
}
void OoxSheetDataContext::importCell( const AttributeList& rAttribs )
{
+ OOX_LOADSAVE_TIMER( IMPORTCELL );
maCurrCell.reset();
maCurrCell.mxCell = getCell( rAttribs.getString( XML_r, OUString() ), &maCurrCell.maAddress );
maCurrCell.mnCellType = rAttribs.getToken( XML_t, XML_n );
maCurrCell.mnXfId = rAttribs.getInteger( XML_s, -1 );
maCurrCell.mbShowPhonetic = rAttribs.getBool( XML_ph, false );
mxInlineStr.reset();
-
- if( maCurrCell.mxCell.is() && getPivotTables().isOverlapping( maCurrCell.maAddress ) )
- // This cell overlaps a pivot table. Skip it.
- maCurrCell.mxCell.clear();
}
void OoxSheetDataContext::importFormula( const AttributeList& rAttribs )
@@ -557,26 +530,26 @@ void OoxSheetDataContext::importCellFormula( RecordInputStream& rStrm )
void OoxSheetDataContext::importRow( RecordInputStream& rStrm )
{
- OoxRowData aData;
+ RowModel aModel;
sal_uInt16 nHeight, nFlags1;
sal_uInt8 nFlags2;
- rStrm >> maCurrPos.mnRow >> aData.mnXfId >> nHeight >> nFlags1 >> nFlags2;
+ rStrm >> maCurrPos.mnRow >> aModel.mnXfId >> nHeight >> nFlags1 >> nFlags2;
- // row index is 0-based in OOBIN, but OoxRowData expects 1-based
- aData.mnFirstRow = aData.mnLastRow = maCurrPos.mnRow + 1;
+ // row index is 0-based in OOBIN, but RowModel expects 1-based
+ aModel.mnFirstRow = aModel.mnLastRow = maCurrPos.mnRow + 1;
// row height is in twips in OOBIN, convert to points
- aData.mfHeight = nHeight / 20.0;
- aData.mnLevel = extractValue< sal_Int32 >( nFlags1, 8, 3 );
- aData.mbCustomHeight = getFlag( nFlags1, OOBIN_ROW_CUSTOMHEIGHT );
- aData.mbCustomFormat = getFlag( nFlags1, OOBIN_ROW_CUSTOMFORMAT );
- aData.mbShowPhonetic = getFlag( nFlags2, OOBIN_ROW_SHOWPHONETIC );
- aData.mbHidden = getFlag( nFlags1, OOBIN_ROW_HIDDEN );
- aData.mbCollapsed = getFlag( nFlags1, OOBIN_ROW_COLLAPSED );
- aData.mbThickTop = getFlag( nFlags1, OOBIN_ROW_THICKTOP );
- aData.mbThickBottom = getFlag( nFlags1, OOBIN_ROW_THICKBOTTOM );
+ aModel.mfHeight = nHeight / 20.0;
+ aModel.mnLevel = extractValue< sal_Int32 >( nFlags1, 8, 3 );
+ aModel.mbCustomHeight = getFlag( nFlags1, OOBIN_ROW_CUSTOMHEIGHT );
+ aModel.mbCustomFormat = getFlag( nFlags1, OOBIN_ROW_CUSTOMFORMAT );
+ aModel.mbShowPhonetic = getFlag( nFlags2, OOBIN_ROW_SHOWPHONETIC );
+ aModel.mbHidden = getFlag( nFlags1, OOBIN_ROW_HIDDEN );
+ aModel.mbCollapsed = getFlag( nFlags1, OOBIN_ROW_COLLAPSED );
+ aModel.mbThickTop = getFlag( nFlags1, OOBIN_ROW_THICKTOP );
+ aModel.mbThickBottom = getFlag( nFlags1, OOBIN_ROW_THICKBOTTOM );
// set row properties in the current sheet
- setRowData( aData );
+ setRowModel( aModel );
}
void OoxSheetDataContext::importArray( RecordInputStream& rStrm )
@@ -604,19 +577,19 @@ void OoxSheetDataContext::importDataTable( RecordInputStream& rStrm )
BinRange aRange;
rStrm >> aRange;
CellRangeAddress aTableRange;
- if( getAddressConverter().convertToCellRange( aTableRange, aRange, getSheetIndex(), true ) )
+ if( getAddressConverter().convertToCellRange( aTableRange, aRange, getSheetIndex(), true, true ) )
{
- OoxDataTableData aTableData;
+ DataTableModel aModel;
BinAddress aRef1, aRef2;
sal_uInt8 nFlags;
rStrm >> aRef1 >> aRef2 >> nFlags;
- aTableData.maRef1 = FormulaProcessorBase::generateAddress2dString( aRef1, false );
- aTableData.maRef2 = FormulaProcessorBase::generateAddress2dString( aRef2, false );
- aTableData.mbRowTable = getFlag( nFlags, OOBIN_DATATABLE_ROW );
- aTableData.mb2dTable = getFlag( nFlags, OOBIN_DATATABLE_2D );
- aTableData.mbRef1Deleted = getFlag( nFlags, OOBIN_DATATABLE_REF1DEL );
- aTableData.mbRef2Deleted = getFlag( nFlags, OOBIN_DATATABLE_REF2DEL );
- setTableOperation( aTableRange, aTableData );
+ aModel.maRef1 = FormulaProcessorBase::generateAddress2dString( aRef1, false );
+ aModel.maRef2 = FormulaProcessorBase::generateAddress2dString( aRef2, false );
+ aModel.mbRowTable = getFlag( nFlags, OOBIN_DATATABLE_ROW );
+ aModel.mb2dTable = getFlag( nFlags, OOBIN_DATATABLE_2D );
+ aModel.mbRef1Deleted = getFlag( nFlags, OOBIN_DATATABLE_REF1DEL );
+ aModel.mbRef2Deleted = getFlag( nFlags, OOBIN_DATATABLE_REF2DEL );
+ setTableOperation( aTableRange, aModel );
}
}
@@ -826,11 +799,11 @@ void BiffSheetDataContext::importLabel()
if( xText.is() )
{
/* the deep secrets of BIFF type and record identifier...
- record id BIFF XF type String type
- 0x0004 2-7 3 byte 8-bit length, byte string
- 0x0004 8 3 byte 16-bit length, unicode string
- 0x0204 2-7 2 byte 16-bit length, byte string
- 0x0204 8 2 byte 16-bit length, unicode string */
+ record id BIFF -> XF type String type
+ 0x0004 2-7 -> 3 byte 8-bit length, byte string
+ 0x0004 8 -> 3 byte 16-bit length, unicode string
+ 0x0204 2-7 -> 2 byte 16-bit length, byte string
+ 0x0204 8 -> 2 byte 16-bit length, unicode string */
RichString aString( *this );
if( getBiff() == BIFF8 )
@@ -908,7 +881,7 @@ void BiffSheetDataContext::importRk()
void BiffSheetDataContext::importRow()
{
- OoxRowData aData;
+ RowModel aModel;
sal_uInt16 nRow, nHeight;
mrStrm >> nRow;
@@ -917,34 +890,34 @@ void BiffSheetDataContext::importRow()
if( getBiff() == BIFF2 )
{
mrStrm.skip( 2 );
- aData.mbCustomFormat = mrStrm.readuInt8() == BIFF2_ROW_CUSTOMFORMAT;
- if( aData.mbCustomFormat )
+ aModel.mbCustomFormat = mrStrm.readuInt8() == BIFF2_ROW_CUSTOMFORMAT;
+ if( aModel.mbCustomFormat )
{
mrStrm.skip( 5 );
- aData.mnXfId = mrStrm.readuInt16();
+ aModel.mnXfId = mrStrm.readuInt16();
}
}
else
{
mrStrm.skip( 4 );
sal_uInt32 nFlags = mrStrm.readuInt32();
- aData.mnXfId = extractValue< sal_Int32 >( nFlags, 16, 12 );
- aData.mnLevel = extractValue< sal_Int32 >( nFlags, 0, 3 );
- aData.mbCustomFormat = getFlag( nFlags, BIFF_ROW_CUSTOMFORMAT );
- aData.mbCustomHeight = getFlag( nFlags, BIFF_ROW_CUSTOMHEIGHT );
- aData.mbShowPhonetic = getFlag( nFlags, BIFF_ROW_SHOWPHONETIC );
- aData.mbHidden = getFlag( nFlags, BIFF_ROW_HIDDEN );
- aData.mbCollapsed = getFlag( nFlags, BIFF_ROW_COLLAPSED );
- aData.mbThickTop = getFlag( nFlags, BIFF_ROW_THICKTOP );
- aData.mbThickBottom = getFlag( nFlags, BIFF_ROW_THICKBOTTOM );
+ aModel.mnXfId = extractValue< sal_Int32 >( nFlags, 16, 12 );
+ aModel.mnLevel = extractValue< sal_Int32 >( nFlags, 0, 3 );
+ aModel.mbCustomFormat = getFlag( nFlags, BIFF_ROW_CUSTOMFORMAT );
+ aModel.mbCustomHeight = getFlag( nFlags, BIFF_ROW_CUSTOMHEIGHT );
+ aModel.mbShowPhonetic = getFlag( nFlags, BIFF_ROW_SHOWPHONETIC );
+ aModel.mbHidden = getFlag( nFlags, BIFF_ROW_HIDDEN );
+ aModel.mbCollapsed = getFlag( nFlags, BIFF_ROW_COLLAPSED );
+ aModel.mbThickTop = getFlag( nFlags, BIFF_ROW_THICKTOP );
+ aModel.mbThickBottom = getFlag( nFlags, BIFF_ROW_THICKBOTTOM );
}
- // row index is 0-based in BIFF, but OoxRowData expects 1-based
- aData.mnFirstRow = aData.mnLastRow = nRow + 1;
+ // row index is 0-based in BIFF, but RowModel expects 1-based
+ aModel.mnFirstRow = aModel.mnLastRow = nRow + 1;
// row height is in twips in BIFF, convert to points
- aData.mfHeight = (nHeight & BIFF_ROW_HEIGHTMASK) / 20.0;
+ aModel.mfHeight = (nHeight & BIFF_ROW_HEIGHTMASK) / 20.0;
// set row properties in the current sheet
- setRowData( aData );
+ setRowModel( aModel );
}
void BiffSheetDataContext::importArray()
@@ -972,39 +945,39 @@ void BiffSheetDataContext::importDataTable()
BinRange aRange;
aRange.read( mrStrm, false ); // columns always 8-bit
CellRangeAddress aTableRange;
- if( getAddressConverter().convertToCellRange( aTableRange, aRange, getSheetIndex(), true ) )
+ if( getAddressConverter().convertToCellRange( aTableRange, aRange, getSheetIndex(), true, true ) )
{
- OoxDataTableData aTableData;
+ DataTableModel aModel;
BinAddress aRef1, aRef2;
switch( mrStrm.getRecId() )
{
case BIFF2_ID_DATATABLE:
mrStrm.skip( 1 );
- aTableData.mbRowTable = mrStrm.readuInt8() != 0;
- aTableData.mb2dTable = false;
+ aModel.mbRowTable = mrStrm.readuInt8() != 0;
+ aModel.mb2dTable = false;
mrStrm >> aRef1;
break;
case BIFF2_ID_DATATABLE2:
mrStrm.skip( 2 );
- aTableData.mb2dTable = true;
+ aModel.mb2dTable = true;
mrStrm >> aRef1 >> aRef2;
break;
case BIFF3_ID_DATATABLE:
{
sal_uInt16 nFlags;
mrStrm >> nFlags >> aRef1 >> aRef2;
- aTableData.mbRowTable = getFlag( nFlags, BIFF_DATATABLE_ROW );
- aTableData.mb2dTable = getFlag( nFlags, BIFF_DATATABLE_2D );
- aTableData.mbRef1Deleted = getFlag( nFlags, BIFF_DATATABLE_REF1DEL );
- aTableData.mbRef2Deleted = getFlag( nFlags, BIFF_DATATABLE_REF2DEL );
+ aModel.mbRowTable = getFlag( nFlags, BIFF_DATATABLE_ROW );
+ aModel.mb2dTable = getFlag( nFlags, BIFF_DATATABLE_2D );
+ aModel.mbRef1Deleted = getFlag( nFlags, BIFF_DATATABLE_REF1DEL );
+ aModel.mbRef2Deleted = getFlag( nFlags, BIFF_DATATABLE_REF2DEL );
}
break;
default:
OSL_ENSURE( false, "BiffSheetDataContext::importDataTable - unknown record id" );
}
- aTableData.maRef1 = FormulaProcessorBase::generateAddress2dString( aRef1, false );
- aTableData.maRef2 = FormulaProcessorBase::generateAddress2dString( aRef2, false );
- setTableOperation( aTableRange, aTableData );
+ aModel.maRef1 = FormulaProcessorBase::generateAddress2dString( aRef1, false );
+ aModel.maRef2 = FormulaProcessorBase::generateAddress2dString( aRef2, false );
+ setTableOperation( aTableRange, aModel );
}
}
diff --git a/oox/source/xls/stylesbuffer.cxx b/oox/source/xls/stylesbuffer.cxx
index 5627c781ba2a..f6a10f51b265 100644
--- a/oox/source/xls/stylesbuffer.cxx
+++ b/oox/source/xls/stylesbuffer.cxx
@@ -29,12 +29,15 @@
************************************************************************/
#include "oox/xls/stylesbuffer.hxx"
+#include <com/sun/star/text/WritingMode2.hpp>
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <com/sun/star/awt/FontFamily.hpp>
-#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontPitch.hpp>
#include <com/sun/star/awt/FontSlant.hpp>
-#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/awt/FontType.hpp>
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/awt/XFont2.hpp>
#include <com/sun/star/style/XStyle.hpp>
@@ -42,9 +45,12 @@
#include <com/sun/star/text/XText.hpp>
#include <rtl/tencinfo.h>
#include <rtl/ustrbuf.hxx>
+#include "properties.hxx"
#include "oox/helper/attributelist.hxx"
+#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/helper/recordinputstream.hxx"
+#include "oox/core/filterbase.hxx"
#include "oox/xls/biffinputstream.hxx"
#include "oox/xls/condformatbuffer.hxx"
#include "oox/xls/excelhandlers.hxx"
@@ -557,9 +563,9 @@ void ColorPalette::importPalette( BiffInputStream& rStrm )
sal_Int32 ColorPalette::getColor( sal_Int32 nPaletteIdx ) const
{
sal_Int32 nColor = API_RGB_TRANSPARENT;
- if( (0 <= nPaletteIdx) && (static_cast< size_t >( nPaletteIdx ) < maColors.size()) )
+ if( const sal_Int32* pnPaletteColor = ContainerHelper::getVectorElement( maColors, nPaletteIdx ) )
{
- nColor = maColors[ nPaletteIdx ];
+ nColor = *pnPaletteColor;
}
else switch( nPaletteIdx )
{
@@ -572,7 +578,7 @@ sal_Int32 ColorPalette::getColor( sal_Int32 nPaletteIdx ) const
// case OOX_COLOR_BUTTONBACK:
// case OOX_COLOR_CHBORDERAUTO:
// case OOX_COLOR_NOTEBACK:
-// case OOX_COLOR_NOTETEXT:
+ case OOX_COLOR_NOTETEXT: nColor = mnWinTextColor; break; // !TODO
case OOX_COLOR_FONTAUTO: nColor = API_RGB_TRANSPARENT; break;
default:
OSL_ENSURE( false, "ColorPalette::getColor - unknown color index" );
@@ -611,7 +617,7 @@ void lclSetFontName( ApiScriptFontName& rFontName, const FontDescriptor& rFontDe
// ----------------------------------------------------------------------------
-OoxFontData::OoxFontData() :
+FontModel::FontModel() :
mnScheme( XML_none ),
mnFamily( OOX_FONTFAMILY_NONE ),
mnCharSet( OOX_FONTCHARSET_ANSI ),
@@ -626,23 +632,23 @@ OoxFontData::OoxFontData() :
{
}
-void OoxFontData::setBinScheme( sal_uInt8 nScheme )
+void FontModel::setBinScheme( sal_uInt8 nScheme )
{
static const sal_Int32 spnSchemes[] = { XML_none, XML_major, XML_minor };
mnScheme = STATIC_ARRAY_SELECT( spnSchemes, nScheme, XML_none );
}
-void OoxFontData::setBiffHeight( sal_uInt16 nHeight )
+void FontModel::setBiffHeight( sal_uInt16 nHeight )
{
mfHeight = nHeight / 20.0; // convert twips to points
}
-void OoxFontData::setBiffWeight( sal_uInt16 nWeight )
+void FontModel::setBiffWeight( sal_uInt16 nWeight )
{
mbBold = nWeight >= BIFF_FONTWEIGHT_BOLD;
}
-void OoxFontData::setBiffUnderline( sal_uInt16 nUnderline )
+void FontModel::setBiffUnderline( sal_uInt16 nUnderline )
{
switch( nUnderline )
{
@@ -655,124 +661,140 @@ void OoxFontData::setBiffUnderline( sal_uInt16 nUnderline )
}
}
-void OoxFontData::setBiffEscapement( sal_uInt16 nEscapement )
+void FontModel::setBiffEscapement( sal_uInt16 nEscapement )
{
static const sal_Int32 spnEscapes[] = { XML_baseline, XML_superscript, XML_subscript };
mnEscapement = STATIC_ARRAY_SELECT( spnEscapes, nEscapement, XML_baseline );
}
+// ----------------------------------------------------------------------------
+
+ApiFontUsedFlags::ApiFontUsedFlags( bool bAllUsed ) :
+ mbNameUsed( bAllUsed ),
+ mbColorUsed( bAllUsed ),
+ mbSchemeUsed( bAllUsed ),
+ mbHeightUsed( bAllUsed ),
+ mbUnderlineUsed( bAllUsed ),
+ mbEscapementUsed( bAllUsed ),
+ mbWeightUsed( bAllUsed ),
+ mbPostureUsed( bAllUsed ),
+ mbStrikeoutUsed( bAllUsed ),
+ mbOutlineUsed( bAllUsed ),
+ mbShadowUsed( bAllUsed )
+{
+}
+
+// ----------------------------------------------------------------------------
+
+ApiScriptFontName::ApiScriptFontName() :
+ mnFamily( ::com::sun::star::awt::FontFamily::DONTKNOW ),
+ mnCharSet( RTL_TEXTENCODING_DONTKNOW )
+{
+}
+
+// ----------------------------------------------------------------------------
+
+ApiFontData::ApiFontData() :
+ maDesc(
+ CREATE_OUSTRING( "Calibri" ),
+ 220, // height 11 points
+ 0,
+ OUString(),
+ ::com::sun::star::awt::FontFamily::DONTKNOW,
+ RTL_TEXTENCODING_DONTKNOW,
+ ::com::sun::star::awt::FontPitch::DONTKNOW,
+ 100.0,
+ ::com::sun::star::awt::FontWeight::NORMAL,
+ ::com::sun::star::awt::FontSlant_NONE,
+ ::com::sun::star::awt::FontUnderline::NONE,
+ ::com::sun::star::awt::FontStrikeout::NONE,
+ 0.0,
+ sal_False,
+ sal_False,
+ ::com::sun::star::awt::FontType::DONTKNOW ),
+ mnColor( API_RGB_TRANSPARENT ),
+ mnEscapement( API_ESCAPE_NONE ),
+ mnEscapeHeight( API_ESCAPEHEIGHT_NONE ),
+ mbOutline( false ),
+ mbShadow( false )
+{
+ maLatinFont.maName = maDesc.Name;
+}
+
// ============================================================================
Font::Font( const WorkbookHelper& rHelper, bool bDxf ) :
WorkbookHelper( rHelper ),
- maOoxData( rHelper.getTheme().getDefaultFontData() ),
+ maModel( rHelper.getTheme().getDefaultFontModel() ),
maUsedFlags( !bDxf ),
mbDxf( bDxf )
{
}
-Font::Font( const WorkbookHelper& rHelper, const OoxFontData& rFontData ) :
+Font::Font( const WorkbookHelper& rHelper, const FontModel& rModel ) :
WorkbookHelper( rHelper ),
- maOoxData( rFontData ),
+ maModel( rModel ),
maUsedFlags( true ),
mbDxf( false )
{
}
-bool Font::isSupportedContext( sal_Int32 nElement, sal_Int32 nParentContext )
-{
- switch( nParentContext )
- {
- case XLS_TOKEN( font ):
- return (nElement == XLS_TOKEN( name )) ||
- (nElement == XLS_TOKEN( scheme )) ||
- (nElement == XLS_TOKEN( charset )) ||
- (nElement == XLS_TOKEN( family )) ||
- (nElement == XLS_TOKEN( sz )) ||
- (nElement == XLS_TOKEN( color )) ||
- (nElement == XLS_TOKEN( u )) ||
- (nElement == XLS_TOKEN( vertAlign )) ||
- (nElement == XLS_TOKEN( b )) ||
- (nElement == XLS_TOKEN( i )) ||
- (nElement == XLS_TOKEN( outline )) ||
- (nElement == XLS_TOKEN( shadow )) ||
- (nElement == XLS_TOKEN( strike ));
-
- case XLS_TOKEN( rPr ):
- return (nElement == XLS_TOKEN( rFont )) ||
- (nElement == XLS_TOKEN( scheme )) ||
- (nElement == XLS_TOKEN( charset )) ||
- (nElement == XLS_TOKEN( family )) ||
- (nElement == XLS_TOKEN( sz )) ||
- (nElement == XLS_TOKEN( color )) ||
- (nElement == XLS_TOKEN( u )) ||
- (nElement == XLS_TOKEN( vertAlign )) ||
- (nElement == XLS_TOKEN( b )) ||
- (nElement == XLS_TOKEN( i )) ||
- (nElement == XLS_TOKEN( outline )) ||
- (nElement == XLS_TOKEN( shadow )) ||
- (nElement == XLS_TOKEN( strike )) ||
- (nElement == XLS_TOKEN( vertAlign ));
- }
- return false;
-}
-
void Font::importAttribs( sal_Int32 nElement, const AttributeList& rAttribs )
{
- const OoxFontData& rDefFontData = getTheme().getDefaultFontData();
+ const FontModel& rDefModel = getTheme().getDefaultFontModel();
switch( nElement )
{
- case XLS_TOKEN( name ):
- case XLS_TOKEN( rFont ):
+ case XLS_TOKEN( name ): // when in <font> element
+ case XLS_TOKEN( rFont ): // when in <rPr> element
if( rAttribs.hasAttribute( XML_val ) )
{
- maOoxData.maName = rAttribs.getString( XML_val, OUString() );
+ maModel.maName = rAttribs.getString( XML_val, OUString() );
maUsedFlags.mbNameUsed = true;
}
break;
case XLS_TOKEN( scheme ):
- maOoxData.mnScheme = rAttribs.getToken( XML_val, rDefFontData.mnScheme );
+ maModel.mnScheme = rAttribs.getToken( XML_val, rDefModel.mnScheme );
break;
case XLS_TOKEN( family ):
- maOoxData.mnFamily = rAttribs.getInteger( XML_val, rDefFontData.mnFamily );
+ maModel.mnFamily = rAttribs.getInteger( XML_val, rDefModel.mnFamily );
break;
case XLS_TOKEN( charset ):
- maOoxData.mnCharSet = rAttribs.getInteger( XML_val, rDefFontData.mnCharSet );
+ maModel.mnCharSet = rAttribs.getInteger( XML_val, rDefModel.mnCharSet );
break;
case XLS_TOKEN( sz ):
- maOoxData.mfHeight = rAttribs.getDouble( XML_val, rDefFontData.mfHeight );
+ maModel.mfHeight = rAttribs.getDouble( XML_val, rDefModel.mfHeight );
maUsedFlags.mbHeightUsed = true;
break;
case XLS_TOKEN( color ):
- maOoxData.maColor.importColor( rAttribs );
+ maModel.maColor.importColor( rAttribs );
maUsedFlags.mbColorUsed = true;
break;
case XLS_TOKEN( u ):
- maOoxData.mnUnderline = rAttribs.getToken( XML_val, XML_single );
+ maModel.mnUnderline = rAttribs.getToken( XML_val, XML_single );
maUsedFlags.mbUnderlineUsed = true;
break;
case XLS_TOKEN( vertAlign ):
- maOoxData.mnEscapement = rAttribs.getToken( XML_val, XML_baseline );
+ maModel.mnEscapement = rAttribs.getToken( XML_val, XML_baseline );
maUsedFlags.mbEscapementUsed = true;
break;
case XLS_TOKEN( b ):
- maOoxData.mbBold = rAttribs.getBool( XML_val, true );
+ maModel.mbBold = rAttribs.getBool( XML_val, true );
maUsedFlags.mbWeightUsed = true;
break;
case XLS_TOKEN( i ):
- maOoxData.mbItalic = rAttribs.getBool( XML_val, true );
+ maModel.mbItalic = rAttribs.getBool( XML_val, true );
maUsedFlags.mbPostureUsed = true;
break;
case XLS_TOKEN( strike ):
- maOoxData.mbStrikeout = rAttribs.getBool( XML_val, true );
+ maModel.mbStrikeout = rAttribs.getBool( XML_val, true );
maUsedFlags.mbStrikeoutUsed = true;
break;
case XLS_TOKEN( outline ):
- maOoxData.mbOutline = rAttribs.getBool( XML_val, true );
+ maModel.mbOutline = rAttribs.getBool( XML_val, true );
maUsedFlags.mbOutlineUsed = true;
break;
case XLS_TOKEN( shadow ):
- maOoxData.mbShadow = rAttribs.getBool( XML_val, true );
+ maModel.mbShadow = rAttribs.getBool( XML_val, true );
maUsedFlags.mbShadowUsed = true;
break;
}
@@ -786,69 +808,69 @@ void Font::importFont( RecordInputStream& rStrm )
sal_uInt8 nUnderline, nFamily, nCharSet, nScheme;
rStrm >> nHeight >> nFlags >> nWeight >> nEscapement >> nUnderline >> nFamily >> nCharSet;
rStrm.skip( 1 );
- rStrm >> maOoxData.maColor >> nScheme >> maOoxData.maName;
+ rStrm >> maModel.maColor >> nScheme >> maModel.maName;
// equal constants in BIFF and OOBIN for weight, underline, and escapement
- maOoxData.setBinScheme( nScheme );
- maOoxData.setBiffHeight( nHeight );
- maOoxData.setBiffWeight( nWeight );
- maOoxData.setBiffUnderline( nUnderline );
- maOoxData.setBiffEscapement( nEscapement );
- maOoxData.mnFamily = nFamily;
- maOoxData.mnCharSet = nCharSet;
+ maModel.setBinScheme( nScheme );
+ maModel.setBiffHeight( nHeight );
+ maModel.setBiffWeight( nWeight );
+ maModel.setBiffUnderline( nUnderline );
+ maModel.setBiffEscapement( nEscapement );
+ maModel.mnFamily = nFamily;
+ maModel.mnCharSet = nCharSet;
// equal flags in BIFF and OOBIN
- maOoxData.mbItalic = getFlag( nFlags, BIFF_FONTFLAG_ITALIC );
- maOoxData.mbStrikeout = getFlag( nFlags, BIFF_FONTFLAG_STRIKEOUT );
- maOoxData.mbOutline = getFlag( nFlags, BIFF_FONTFLAG_OUTLINE );
- maOoxData.mbShadow = getFlag( nFlags, BIFF_FONTFLAG_SHADOW );
+ maModel.mbItalic = getFlag( nFlags, BIFF_FONTFLAG_ITALIC );
+ maModel.mbStrikeout = getFlag( nFlags, BIFF_FONTFLAG_STRIKEOUT );
+ maModel.mbOutline = getFlag( nFlags, BIFF_FONTFLAG_OUTLINE );
+ maModel.mbShadow = getFlag( nFlags, BIFF_FONTFLAG_SHADOW );
}
void Font::importDxfName( RecordInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Font::importDxfName - missing conditional formatting flag" );
- maOoxData.maName = rStrm.readString( false );
+ maModel.maName = rStrm.readString( false );
maUsedFlags.mbColorUsed = true;
}
void Font::importDxfColor( RecordInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Font::importDxfColor - missing conditional formatting flag" );
- rStrm >> maOoxData.maColor;
+ rStrm >> maModel.maColor;
maUsedFlags.mbColorUsed = true;
}
void Font::importDxfScheme( RecordInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Font::importDxfScheme - missing conditional formatting flag" );
- maOoxData.setBinScheme( rStrm.readuInt8() );
+ maModel.setBinScheme( rStrm.readuInt8() );
maUsedFlags.mbSchemeUsed = true;
}
void Font::importDxfHeight( RecordInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Font::importDxfHeight - missing conditional formatting flag" );
- maOoxData.setBiffHeight( rStrm.readuInt16() );
+ maModel.setBiffHeight( rStrm.readuInt16() );
maUsedFlags.mbHeightUsed = true;
}
void Font::importDxfWeight( RecordInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Font::importDxfWeight - missing conditional formatting flag" );
- maOoxData.setBiffWeight( rStrm.readuInt16() );
+ maModel.setBiffWeight( rStrm.readuInt16() );
maUsedFlags.mbWeightUsed = true;
}
void Font::importDxfUnderline( RecordInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Font::importDxfUnderline - missing conditional formatting flag" );
- maOoxData.setBiffUnderline( rStrm.readuInt16() );
+ maModel.setBiffUnderline( rStrm.readuInt16() );
maUsedFlags.mbUnderlineUsed = true;
}
void Font::importDxfEscapement( RecordInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Font::importDxfEscapement - missing conditional formatting flag" );
- maOoxData.setBiffEscapement( rStrm.readuInt16() );
+ maModel.setBiffEscapement( rStrm.readuInt16() );
maUsedFlags.mbEscapementUsed = true;
}
@@ -859,19 +881,19 @@ void Font::importDxfFlag( sal_Int32 nElement, RecordInputStream& rStrm )
switch( nElement )
{
case XML_i:
- maOoxData.mbItalic = bFlag;
+ maModel.mbItalic = bFlag;
maUsedFlags.mbPostureUsed = true;
break;
case XML_strike:
- maOoxData.mbStrikeout = bFlag;
+ maModel.mbStrikeout = bFlag;
maUsedFlags.mbStrikeoutUsed = true;
break;
case XML_outline:
- maOoxData.mbOutline = bFlag;
+ maModel.mbOutline = bFlag;
maUsedFlags.mbOutlineUsed = true;
break;
case XML_shadow:
- maOoxData.mbShadow = bFlag;
+ maModel.mbShadow = bFlag;
maUsedFlags.mbShadowUsed = true;
break;
default:
@@ -913,7 +935,7 @@ void Font::importFont( BiffInputStream& rStrm )
void Font::importFontColor( BiffInputStream& rStrm )
{
OSL_ENSURE( !mbDxf, "Font::importFontColor - unexpected conditional formatting flag" );
- maOoxData.maColor.importColorId( rStrm );
+ maModel.maColor.importColorId( rStrm );
}
void Font::importCfRule( BiffInputStream& rStrm )
@@ -927,8 +949,8 @@ void Font::importCfRule( BiffInputStream& rStrm )
OSL_ENSURE( rStrm.getRemaining() >= 118, "Font::importCfRule - missing record data" );
sal_Int64 nRecPos = rStrm.tell();
- maOoxData.maName = rStrm.readUniString( rStrm.readuInt8() );
- maUsedFlags.mbNameUsed = maOoxData.maName.getLength() > 0;
+ maModel.maName = rStrm.readUniString( rStrm.readuInt8() );
+ maUsedFlags.mbNameUsed = maModel.maName.getLength() > 0;
OSL_ENSURE( !rStrm.isEof() && (rStrm.tell() <= nRecPos + 64), "Font::importCfRule - font name too long" );
rStrm.seek( nRecPos + 64 );
rStrm >> nHeight >> nStyle >> nWeight >> nEscapement >> nUnderline;
@@ -939,24 +961,24 @@ void Font::importCfRule( BiffInputStream& rStrm )
rStrm.skip( 18 );
if( (maUsedFlags.mbColorUsed = (0 <= nColor) && (nColor <= 0x7FFF)) == true )
- maOoxData.maColor.setIndexed( nColor );
+ maModel.maColor.setIndexed( nColor );
if( (maUsedFlags.mbHeightUsed = (0 < nHeight) && (nHeight <= 0x7FFF)) == true )
- maOoxData.setBiffHeight( static_cast< sal_uInt16 >( nHeight ) );
+ maModel.setBiffHeight( static_cast< sal_uInt16 >( nHeight ) );
if( (maUsedFlags.mbUnderlineUsed = !getFlag( nFontFlags3, BIFF_CFRULE_FONT_UNDERL )) == true )
- maOoxData.setBiffUnderline( nUnderline );
+ maModel.setBiffUnderline( nUnderline );
if( (maUsedFlags.mbEscapementUsed = !getFlag( nFontFlags2, BIFF_CFRULE_FONT_ESCAPEM )) == true )
- maOoxData.setBiffEscapement( nEscapement );
+ maModel.setBiffEscapement( nEscapement );
if( (maUsedFlags.mbWeightUsed = maUsedFlags.mbPostureUsed = !getFlag( nFontFlags1, BIFF_CFRULE_FONT_STYLE )) == true )
{
- maOoxData.setBiffWeight( nWeight );
- maOoxData.mbItalic = getFlag( nStyle, BIFF_CFRULE_FONT_STYLE );
+ maModel.setBiffWeight( nWeight );
+ maModel.mbItalic = getFlag( nStyle, BIFF_CFRULE_FONT_STYLE );
}
if( (maUsedFlags.mbStrikeoutUsed = !getFlag( nFontFlags1, BIFF_CFRULE_FONT_STRIKEOUT )) == true )
- maOoxData.mbStrikeout = getFlag( nStyle, BIFF_CFRULE_FONT_STRIKEOUT );
+ maModel.mbStrikeout = getFlag( nStyle, BIFF_CFRULE_FONT_STRIKEOUT );
if( (maUsedFlags.mbOutlineUsed = !getFlag( nFontFlags1, BIFF_CFRULE_FONT_OUTLINE )) == true )
- maOoxData.mbOutline = getFlag( nStyle, BIFF_CFRULE_FONT_OUTLINE );
+ maModel.mbOutline = getFlag( nStyle, BIFF_CFRULE_FONT_OUTLINE );
if( (maUsedFlags.mbShadowUsed = !getFlag( nFontFlags1, BIFF_CFRULE_FONT_SHADOW )) == true )
- maOoxData.mbShadow = getFlag( nStyle, BIFF_CFRULE_FONT_SHADOW );
+ maModel.mbShadow = getFlag( nStyle, BIFF_CFRULE_FONT_SHADOW );
}
rtl_TextEncoding Font::getFontEncoding() const
@@ -965,8 +987,8 @@ rtl_TextEncoding Font::getFontEncoding() const
// #i67768# BIFF2-BIFF4 FONT records do not contain character set
// #i71033# do not use maApiData, this function is used before finalizeImport()
rtl_TextEncoding eFontEnc = RTL_TEXTENCODING_DONTKNOW;
- if( (0 <= maOoxData.mnCharSet) && (maOoxData.mnCharSet <= SAL_MAX_UINT8) )
- eFontEnc = rtl_getTextEncodingFromWindowsCharset( static_cast< sal_uInt8 >( maOoxData.mnCharSet ) );
+ if( (0 <= maModel.mnCharSet) && (maModel.mnCharSet <= SAL_MAX_UINT8) )
+ eFontEnc = rtl_getTextEncodingFromWindowsCharset( static_cast< sal_uInt8 >( maModel.mnCharSet ) );
return (eFontEnc == RTL_TEXTENCODING_DONTKNOW) ? getTextEncoding() : eFontEnc;
}
@@ -975,10 +997,10 @@ void Font::finalizeImport()
namespace cssawt = ::com::sun::star::awt;
// font name
- maApiData.maDesc.Name = maOoxData.maName;
+ maApiData.maDesc.Name = maModel.maName;
// font family
- switch( maOoxData.mnFamily )
+ switch( maModel.mnFamily )
{
case OOX_FONTFAMILY_NONE: maApiData.maDesc.Family = cssawt::FontFamily::DONTKNOW; break;
case OOX_FONTFAMILY_ROMAN: maApiData.maDesc.Family = cssawt::FontFamily::ROMAN; break;
@@ -989,21 +1011,21 @@ void Font::finalizeImport()
}
// character set
- if( (0 <= maOoxData.mnCharSet) && (maOoxData.mnCharSet <= 255) )
+ if( (0 <= maModel.mnCharSet) && (maModel.mnCharSet <= 255) )
maApiData.maDesc.CharSet = static_cast< sal_Int16 >(
- rtl_getTextEncodingFromWindowsCharset( static_cast< sal_uInt8 >( maOoxData.mnCharSet ) ) );
+ rtl_getTextEncodingFromWindowsCharset( static_cast< sal_uInt8 >( maModel.mnCharSet ) ) );
// color, height, weight, slant, strikeout, outline, shadow
- maApiData.mnColor = maOoxData.maColor.getColor( *this, API_RGB_TRANSPARENT );
- maApiData.maDesc.Height = static_cast< sal_Int16 >( maOoxData.mfHeight * 20.0 );
- maApiData.maDesc.Weight = maOoxData.mbBold ? cssawt::FontWeight::BOLD : cssawt::FontWeight::NORMAL;
- maApiData.maDesc.Slant = maOoxData.mbItalic ? cssawt::FontSlant_ITALIC : cssawt::FontSlant_NONE;
- maApiData.maDesc.Strikeout = maOoxData.mbStrikeout ? cssawt::FontStrikeout::SINGLE : cssawt::FontStrikeout::NONE;
- maApiData.mbOutline = maOoxData.mbOutline;
- maApiData.mbShadow = maOoxData.mbShadow;
+ maApiData.mnColor = maModel.maColor.getColor( *this, API_RGB_TRANSPARENT );
+ maApiData.maDesc.Height = static_cast< sal_Int16 >( maModel.mfHeight * 20.0 );
+ maApiData.maDesc.Weight = maModel.mbBold ? cssawt::FontWeight::BOLD : cssawt::FontWeight::NORMAL;
+ maApiData.maDesc.Slant = maModel.mbItalic ? cssawt::FontSlant_ITALIC : cssawt::FontSlant_NONE;
+ maApiData.maDesc.Strikeout = maModel.mbStrikeout ? cssawt::FontStrikeout::SINGLE : cssawt::FontStrikeout::NONE;
+ maApiData.mbOutline = maModel.mbOutline;
+ maApiData.mbShadow = maModel.mbShadow;
// underline
- switch( maOoxData.mnUnderline )
+ switch( maModel.mnUnderline )
{
case XML_double: maApiData.maDesc.Underline = cssawt::FontUnderline::DOUBLE; break;
case XML_doubleAccounting: maApiData.maDesc.Underline = cssawt::FontUnderline::DOUBLE; break;
@@ -1013,7 +1035,7 @@ void Font::finalizeImport()
}
// escapement
- switch( maOoxData.mnEscapement )
+ switch( maModel.mnEscapement )
{
case XML_baseline:
maApiData.mnEscapement = API_ESCAPE_NONE;
@@ -1086,9 +1108,81 @@ bool Font::needsRichTextFormat() const
return maApiData.mnEscapement != API_ESCAPE_NONE;
}
+void Font::writeToPropertyMap( PropertyMap& rPropMap, FontPropertyType ePropType ) const
+{
+ // font name properties
+ if( maUsedFlags.mbNameUsed )
+ {
+ if( maApiData.maLatinFont.maName.getLength() > 0 )
+ {
+ rPropMap[ PROP_CharFontName ] <<= maApiData.maLatinFont.maName;
+ rPropMap[ PROP_CharFontFamily ] <<= maApiData.maLatinFont.mnFamily;
+ rPropMap[ PROP_CharFontCharSet ] <<= maApiData.maLatinFont.mnCharSet;
+ }
+ if( maApiData.maAsianFont.maName.getLength() > 0 )
+ {
+ rPropMap[ PROP_CharFontNameAsian ] <<= maApiData.maAsianFont.maName;
+ rPropMap[ PROP_CharFontFamilyAsian ] <<= maApiData.maAsianFont.mnFamily;
+ rPropMap[ PROP_CharFontCharSetAsian ] <<= maApiData.maAsianFont.mnCharSet;
+ }
+ if( maApiData.maCmplxFont.maName.getLength() > 0 )
+ {
+ rPropMap[ PROP_CharFontNameComplex ] <<= maApiData.maCmplxFont.maName;
+ rPropMap[ PROP_CharFontFamilyComplex ] <<= maApiData.maCmplxFont.mnFamily;
+ rPropMap[ PROP_CharFontCharSetComplex ] <<= maApiData.maCmplxFont.mnCharSet;
+ }
+ }
+ // font height
+ if( maUsedFlags.mbHeightUsed )
+ {
+ float fHeight = static_cast< float >( maApiData.maDesc.Height / 20.0 ); // twips to points
+ rPropMap[ PROP_CharHeight ] <<= fHeight;
+ rPropMap[ PROP_CharHeightAsian ] <<= fHeight;
+ rPropMap[ PROP_CharHeightComplex ] <<= fHeight;
+ }
+ // font weight
+ if( maUsedFlags.mbWeightUsed )
+ {
+ float fWeight = maApiData.maDesc.Weight;
+ rPropMap[ PROP_CharWeight ] <<= fWeight;
+ rPropMap[ PROP_CharWeightAsian ] <<= fWeight;
+ rPropMap[ PROP_CharWeightComplex ] <<= fWeight;
+ }
+ // font posture
+ if( maUsedFlags.mbPostureUsed )
+ {
+ rPropMap[ PROP_CharPosture ] <<= maApiData.maDesc.Slant;
+ rPropMap[ PROP_CharPostureAsian ] <<= maApiData.maDesc.Slant;
+ rPropMap[ PROP_CharPostureComplex ] <<= maApiData.maDesc.Slant;
+ }
+ // character color
+ if( maUsedFlags.mbColorUsed )
+ rPropMap[ PROP_CharColor ] <<= maApiData.mnColor;
+ // underline style
+ if( maUsedFlags.mbUnderlineUsed )
+ rPropMap[ PROP_CharUnderline ] <<= maApiData.maDesc.Underline;
+ // strike out style
+ if( maUsedFlags.mbStrikeoutUsed )
+ rPropMap[ PROP_CharStrikeout ] <<= maApiData.maDesc.Strikeout;
+ // outline style
+ if( maUsedFlags.mbOutlineUsed )
+ rPropMap[ PROP_CharContoured ] <<= maApiData.mbOutline;
+ // shadow style
+ if( maUsedFlags.mbShadowUsed )
+ rPropMap[ PROP_CharShadowed ] <<= maApiData.mbShadow;
+ // escapement
+ if( maUsedFlags.mbEscapementUsed && (ePropType == FONT_PROPTYPE_TEXT) )
+ {
+ rPropMap[ PROP_CharEscapement ] <<= maApiData.mnEscapement;
+ rPropMap[ PROP_CharEscapementHeight ] <<= maApiData.mnEscapeHeight;
+ }
+}
+
void Font::writeToPropertySet( PropertySet& rPropSet, FontPropertyType ePropType ) const
{
- getStylesPropertyHelper().writeFontProperties( rPropSet, maApiData, maUsedFlags, ePropType );
+ PropertyMap aPropMap;
+ writeToPropertyMap( aPropMap, ePropType );
+ rPropSet.setProperties( aPropMap );
}
void Font::importFontData2( BiffInputStream& rStrm )
@@ -1096,16 +1190,16 @@ void Font::importFontData2( BiffInputStream& rStrm )
sal_uInt16 nHeight, nFlags;
rStrm >> nHeight >> nFlags;
- maOoxData.setBiffHeight( nHeight );
- maOoxData.mnFamily = OOX_FONTFAMILY_NONE;
- maOoxData.mnCharSet = OOX_FONTCHARSET_UNUSED; // ensure to not use font charset in byte string import
- maOoxData.mnUnderline = getFlagValue( nFlags, BIFF_FONTFLAG_UNDERLINE, XML_single, XML_none );
- maOoxData.mnEscapement = XML_none;
- maOoxData.mbBold = getFlag( nFlags, BIFF_FONTFLAG_BOLD );
- maOoxData.mbItalic = getFlag( nFlags, BIFF_FONTFLAG_ITALIC );
- maOoxData.mbStrikeout = getFlag( nFlags, BIFF_FONTFLAG_STRIKEOUT );
- maOoxData.mbOutline = getFlag( nFlags, BIFF_FONTFLAG_OUTLINE );
- maOoxData.mbShadow = getFlag( nFlags, BIFF_FONTFLAG_SHADOW );
+ maModel.setBiffHeight( nHeight );
+ maModel.mnFamily = OOX_FONTFAMILY_NONE;
+ maModel.mnCharSet = OOX_FONTCHARSET_UNUSED; // ensure to not use font charset in byte string import
+ maModel.mnUnderline = getFlagValue( nFlags, BIFF_FONTFLAG_UNDERLINE, XML_single, XML_none );
+ maModel.mnEscapement = XML_none;
+ maModel.mbBold = getFlag( nFlags, BIFF_FONTFLAG_BOLD );
+ maModel.mbItalic = getFlag( nFlags, BIFF_FONTFLAG_ITALIC );
+ maModel.mbStrikeout = getFlag( nFlags, BIFF_FONTFLAG_STRIKEOUT );
+ maModel.mbOutline = getFlag( nFlags, BIFF_FONTFLAG_OUTLINE );
+ maModel.mbShadow = getFlag( nFlags, BIFF_FONTFLAG_SHADOW );
}
void Font::importFontData5( BiffInputStream& rStrm )
@@ -1115,27 +1209,27 @@ void Font::importFontData5( BiffInputStream& rStrm )
rStrm >> nWeight >> nEscapement >> nUnderline >> nFamily >> nCharSet;
rStrm.skip( 1 );
- maOoxData.setBiffWeight( nWeight );
- maOoxData.setBiffUnderline( nUnderline );
- maOoxData.setBiffEscapement( nEscapement );
+ maModel.setBiffWeight( nWeight );
+ maModel.setBiffUnderline( nUnderline );
+ maModel.setBiffEscapement( nEscapement );
// equal constants in XML and BIFF for family and charset
- maOoxData.mnFamily = nFamily;
- maOoxData.mnCharSet = nCharSet;
+ maModel.mnFamily = nFamily;
+ maModel.mnCharSet = nCharSet;
}
void Font::importFontName2( BiffInputStream& rStrm )
{
- maOoxData.maName = rStrm.readByteString( false, getTextEncoding() );
+ maModel.maName = rStrm.readByteString( false, getTextEncoding() );
}
void Font::importFontName8( BiffInputStream& rStrm )
{
- maOoxData.maName = rStrm.readUniString( rStrm.readuInt8() );
+ maModel.maName = rStrm.readUniString( rStrm.readuInt8() );
}
// ============================================================================
-OoxAlignmentData::OoxAlignmentData() :
+AlignmentModel::AlignmentModel() :
mnHorAlign( XML_general ),
mnVerAlign( XML_bottom ),
mnTextDir( OOX_XF_TEXTDIR_CONTEXT ),
@@ -1147,7 +1241,7 @@ OoxAlignmentData::OoxAlignmentData() :
{
}
-void OoxAlignmentData::setBinHorAlign( sal_uInt8 nHorAlign )
+void AlignmentModel::setBinHorAlign( sal_uInt8 nHorAlign )
{
static const sal_Int32 spnHorAligns[] = {
XML_general, XML_left, XML_center, XML_right,
@@ -1155,14 +1249,14 @@ void OoxAlignmentData::setBinHorAlign( sal_uInt8 nHorAlign )
mnHorAlign = STATIC_ARRAY_SELECT( spnHorAligns, nHorAlign, XML_general );
}
-void OoxAlignmentData::setBinVerAlign( sal_uInt8 nVerAlign )
+void AlignmentModel::setBinVerAlign( sal_uInt8 nVerAlign )
{
static const sal_Int32 spnVerAligns[] = {
XML_top, XML_center, XML_bottom, XML_justify, XML_distributed };
mnVerAlign = STATIC_ARRAY_SELECT( spnVerAligns, nVerAlign, XML_bottom );
}
-void OoxAlignmentData::setBinTextOrient( sal_uInt8 nTextOrient )
+void AlignmentModel::setBinTextOrient( sal_uInt8 nTextOrient )
{
static const sal_Int32 spnRotations[] = {
OOX_XF_ROTATION_NONE, OOX_XF_ROTATION_STACKED,
@@ -1170,6 +1264,33 @@ void OoxAlignmentData::setBinTextOrient( sal_uInt8 nTextOrient )
mnRotation = STATIC_ARRAY_SELECT( spnRotations, nTextOrient, OOX_XF_ROTATION_NONE );
}
+// ----------------------------------------------------------------------------
+
+ApiAlignmentData::ApiAlignmentData() :
+ meHorJustify( ::com::sun::star::table::CellHoriJustify_STANDARD ),
+ meVerJustify( ::com::sun::star::table::CellVertJustify_STANDARD ),
+ meOrientation( ::com::sun::star::table::CellOrientation_STANDARD ),
+ mnRotation( 0 ),
+ mnWritingMode( ::com::sun::star::text::WritingMode2::PAGE ),
+ mnIndent( 0 ),
+ mbWrapText( false ),
+ mbShrink( false )
+{
+}
+
+bool operator==( const ApiAlignmentData& rLeft, const ApiAlignmentData& rRight )
+{
+ return
+ (rLeft.meHorJustify == rRight.meHorJustify) &&
+ (rLeft.meVerJustify == rRight.meVerJustify) &&
+ (rLeft.meOrientation == rRight.meOrientation) &&
+ (rLeft.mnRotation == rRight.mnRotation) &&
+ (rLeft.mnWritingMode == rRight.mnWritingMode) &&
+ (rLeft.mnIndent == rRight.mnIndent) &&
+ (rLeft.mbWrapText == rRight.mbWrapText) &&
+ (rLeft.mbShrink == rRight.mbShrink);
+}
+
// ============================================================================
Alignment::Alignment( const WorkbookHelper& rHelper ) :
@@ -1179,65 +1300,65 @@ Alignment::Alignment( const WorkbookHelper& rHelper ) :
void Alignment::importAlignment( const AttributeList& rAttribs )
{
- maOoxData.mnHorAlign = rAttribs.getToken( XML_horizontal, XML_general );
- maOoxData.mnVerAlign = rAttribs.getToken( XML_vertical, XML_bottom );
- maOoxData.mnTextDir = rAttribs.getInteger( XML_readingOrder, OOX_XF_TEXTDIR_CONTEXT );
- maOoxData.mnRotation = rAttribs.getInteger( XML_textRotation, OOX_XF_ROTATION_NONE );
- maOoxData.mnIndent = rAttribs.getInteger( XML_indent, OOX_XF_INDENT_NONE );
- maOoxData.mbWrapText = rAttribs.getBool( XML_wrapText, false );
- maOoxData.mbShrink = rAttribs.getBool( XML_shrinkToFit, false );
- maOoxData.mbJustLastLine = rAttribs.getBool( XML_justifyLastLine, false );
+ maModel.mnHorAlign = rAttribs.getToken( XML_horizontal, XML_general );
+ maModel.mnVerAlign = rAttribs.getToken( XML_vertical, XML_bottom );
+ maModel.mnTextDir = rAttribs.getInteger( XML_readingOrder, OOX_XF_TEXTDIR_CONTEXT );
+ maModel.mnRotation = rAttribs.getInteger( XML_textRotation, OOX_XF_ROTATION_NONE );
+ maModel.mnIndent = rAttribs.getInteger( XML_indent, OOX_XF_INDENT_NONE );
+ maModel.mbWrapText = rAttribs.getBool( XML_wrapText, false );
+ maModel.mbShrink = rAttribs.getBool( XML_shrinkToFit, false );
+ maModel.mbJustLastLine = rAttribs.getBool( XML_justifyLastLine, false );
}
void Alignment::setBinData( sal_uInt32 nFlags )
{
- maOoxData.setBinHorAlign( extractValue< sal_uInt8 >( nFlags, 16, 3 ) );
- maOoxData.setBinVerAlign( extractValue< sal_uInt8 >( nFlags, 19, 3 ) );
- maOoxData.mnTextDir = extractValue< sal_Int32 >( nFlags, 26, 2 );
- maOoxData.mnRotation = extractValue< sal_Int32 >( nFlags, 0, 8 );
- maOoxData.mnIndent = extractValue< sal_uInt8 >( nFlags, 8, 8 );
- maOoxData.mbWrapText = getFlag( nFlags, OOBIN_XF_WRAPTEXT );
- maOoxData.mbShrink = getFlag( nFlags, OOBIN_XF_SHRINK );
- maOoxData.mbJustLastLine = getFlag( nFlags, OOBIN_XF_JUSTLASTLINE );
+ maModel.setBinHorAlign( extractValue< sal_uInt8 >( nFlags, 16, 3 ) );
+ maModel.setBinVerAlign( extractValue< sal_uInt8 >( nFlags, 19, 3 ) );
+ maModel.mnTextDir = extractValue< sal_Int32 >( nFlags, 26, 2 );
+ maModel.mnRotation = extractValue< sal_Int32 >( nFlags, 0, 8 );
+ maModel.mnIndent = extractValue< sal_uInt8 >( nFlags, 8, 8 );
+ maModel.mbWrapText = getFlag( nFlags, OOBIN_XF_WRAPTEXT );
+ maModel.mbShrink = getFlag( nFlags, OOBIN_XF_SHRINK );
+ maModel.mbJustLastLine = getFlag( nFlags, OOBIN_XF_JUSTLASTLINE );
}
void Alignment::setBiff2Data( sal_uInt8 nFlags )
{
- maOoxData.setBinHorAlign( extractValue< sal_uInt8 >( nFlags, 0, 3 ) );
+ maModel.setBinHorAlign( extractValue< sal_uInt8 >( nFlags, 0, 3 ) );
}
void Alignment::setBiff3Data( sal_uInt16 nAlign )
{
- maOoxData.setBinHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
- maOoxData.mbWrapText = getFlag( nAlign, BIFF_XF_WRAPTEXT ); // new in BIFF3
+ maModel.setBinHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
+ maModel.mbWrapText = getFlag( nAlign, BIFF_XF_WRAPTEXT ); // new in BIFF3
}
void Alignment::setBiff4Data( sal_uInt16 nAlign )
{
- maOoxData.setBinHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
- maOoxData.setBinVerAlign( extractValue< sal_uInt8 >( nAlign, 4, 2 ) ); // new in BIFF4
- maOoxData.setBinTextOrient( extractValue< sal_uInt8 >( nAlign, 6, 2 ) ); // new in BIFF4
- maOoxData.mbWrapText = getFlag( nAlign, BIFF_XF_WRAPTEXT );
+ maModel.setBinHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
+ maModel.setBinVerAlign( extractValue< sal_uInt8 >( nAlign, 4, 2 ) ); // new in BIFF4
+ maModel.setBinTextOrient( extractValue< sal_uInt8 >( nAlign, 6, 2 ) ); // new in BIFF4
+ maModel.mbWrapText = getFlag( nAlign, BIFF_XF_WRAPTEXT );
}
void Alignment::setBiff5Data( sal_uInt16 nAlign )
{
- maOoxData.setBinHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
- maOoxData.setBinVerAlign( extractValue< sal_uInt8 >( nAlign, 4, 3 ) );
- maOoxData.setBinTextOrient( extractValue< sal_uInt8 >( nAlign, 8, 2 ) );
- maOoxData.mbWrapText = getFlag( nAlign, BIFF_XF_WRAPTEXT );
+ maModel.setBinHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
+ maModel.setBinVerAlign( extractValue< sal_uInt8 >( nAlign, 4, 3 ) );
+ maModel.setBinTextOrient( extractValue< sal_uInt8 >( nAlign, 8, 2 ) );
+ maModel.mbWrapText = getFlag( nAlign, BIFF_XF_WRAPTEXT );
}
void Alignment::setBiff8Data( sal_uInt16 nAlign, sal_uInt16 nMiscAttrib )
{
- maOoxData.setBinHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
- maOoxData.setBinVerAlign( extractValue< sal_uInt8 >( nAlign, 4, 3 ) );
- maOoxData.mnTextDir = extractValue< sal_Int32 >( nMiscAttrib, 6, 2 ); // new in BIFF8
- maOoxData.mnRotation = extractValue< sal_Int32 >( nAlign, 8, 8 ); // new in BIFF8
- maOoxData.mnIndent = extractValue< sal_uInt8 >( nMiscAttrib, 0, 4 ); // new in BIFF8
- maOoxData.mbWrapText = getFlag( nAlign, BIFF_XF_WRAPTEXT );
- maOoxData.mbShrink = getFlag( nMiscAttrib, BIFF_XF_SHRINK ); // new in BIFF8
- maOoxData.mbJustLastLine = getFlag( nAlign, BIFF_XF_JUSTLASTLINE ); // new in BIFF8(?)
+ maModel.setBinHorAlign( extractValue< sal_uInt8 >( nAlign, 0, 3 ) );
+ maModel.setBinVerAlign( extractValue< sal_uInt8 >( nAlign, 4, 3 ) );
+ maModel.mnTextDir = extractValue< sal_Int32 >( nMiscAttrib, 6, 2 ); // new in BIFF8
+ maModel.mnRotation = extractValue< sal_Int32 >( nAlign, 8, 8 ); // new in BIFF8
+ maModel.mnIndent = extractValue< sal_uInt8 >( nMiscAttrib, 0, 4 ); // new in BIFF8
+ maModel.mbWrapText = getFlag( nAlign, BIFF_XF_WRAPTEXT );
+ maModel.mbShrink = getFlag( nMiscAttrib, BIFF_XF_SHRINK ); // new in BIFF8
+ maModel.mbJustLastLine = getFlag( nAlign, BIFF_XF_JUSTLASTLINE ); // new in BIFF8(?)
}
void Alignment::finalizeImport()
@@ -1246,7 +1367,7 @@ void Alignment::finalizeImport()
namespace csstxt = ::com::sun::star::text;
// horizontal alignment
- switch( maOoxData.mnHorAlign )
+ switch( maModel.mnHorAlign )
{
case XML_center: maApiData.meHorJustify = csstab::CellHoriJustify_CENTER; break;
case XML_centerContinuous: maApiData.meHorJustify = csstab::CellHoriJustify_CENTER; break;
@@ -1259,7 +1380,7 @@ void Alignment::finalizeImport()
}
// vertical alignment
- switch( maOoxData.mnVerAlign )
+ switch( maModel.mnVerAlign )
{
case XML_bottom: maApiData.meVerJustify = csstab::CellVertJustify_BOTTOM; break;
case XML_center: maApiData.meVerJustify = csstab::CellVertJustify_CENTER; break;
@@ -1273,15 +1394,15 @@ void Alignment::finalizeImport()
sal_Int32 nIndent = 0;
switch( getFilterType() )
{
- case FILTER_OOX: nIndent = getUnitConverter().scaleToMm100( 3.0 * maOoxData.mnIndent, UNIT_SPACE ); break;
- case FILTER_BIFF: nIndent = getUnitConverter().scaleToMm100( 10.0 * maOoxData.mnIndent, UNIT_POINT ); break;
+ case FILTER_OOX: nIndent = getUnitConverter().scaleToMm100( 3.0 * maModel.mnIndent, UNIT_SPACE ); break;
+ case FILTER_BIFF: nIndent = getUnitConverter().scaleToMm100( 10.0 * maModel.mnIndent, UNIT_POINT ); break;
case FILTER_UNKNOWN: break;
}
if( (0 <= nIndent) && (nIndent <= SAL_MAX_INT16) )
maApiData.mnIndent = static_cast< sal_Int16 >( nIndent );
// complex text direction
- switch( maOoxData.mnTextDir )
+ switch( maModel.mnTextDir )
{
case OOX_XF_TEXTDIR_CONTEXT: maApiData.mnWritingMode = csstxt::WritingMode2::PAGE; break;
case OOX_XF_TEXTDIR_LTR: maApiData.mnWritingMode = csstxt::WritingMode2::LR_TB; break;
@@ -1289,7 +1410,7 @@ void Alignment::finalizeImport()
}
// rotation: 0-90 means 0 to 90 degrees ccw, 91-180 means 1 to 90 degrees cw, 255 means stacked
- sal_Int32 nOoxRot = maOoxData.mnRotation;
+ sal_Int32 nOoxRot = maModel.mnRotation;
maApiData.mnRotation = ((0 <= nOoxRot) && (nOoxRot <= 90)) ?
(100 * nOoxRot) :
(((91 <= nOoxRot) && (nOoxRot <= 180)) ? (100 * (450 - nOoxRot)) : 0);
@@ -1299,24 +1420,48 @@ void Alignment::finalizeImport()
csstab::CellOrientation_STACKED : csstab::CellOrientation_STANDARD;
// alignment flags (#i84960 automatic line break, if vertically justified/distributed)
- maApiData.mbWrapText = maOoxData.mbWrapText || (maOoxData.mnVerAlign == XML_distributed) || (maOoxData.mnVerAlign == XML_justify);
- maApiData.mbShrink = maOoxData.mbShrink;
+ maApiData.mbWrapText = maModel.mbWrapText || (maModel.mnVerAlign == XML_distributed) || (maModel.mnVerAlign == XML_justify);
+ maApiData.mbShrink = maModel.mbShrink;
}
-void Alignment::writeToPropertySet( PropertySet& rPropSet ) const
+void Alignment::writeToPropertyMap( PropertyMap& rPropMap ) const
{
- getStylesPropertyHelper().writeAlignmentProperties( rPropSet, maApiData );
+ rPropMap[ PROP_HoriJustify ] <<= maApiData.meHorJustify;
+ rPropMap[ PROP_VertJustify ] <<= maApiData.meVerJustify;
+ rPropMap[ PROP_WritingMode ] <<= maApiData.mnWritingMode;
+ rPropMap[ PROP_RotateAngle ] <<= maApiData.mnRotation;
+ rPropMap[ PROP_RotateReference ] <<= ::com::sun::star::table::CellVertJustify_STANDARD; // rotation reference
+ rPropMap[ PROP_Orientation ] <<= maApiData.meOrientation;
+ rPropMap[ PROP_ParaIndent ] <<= maApiData.mnIndent;
+ rPropMap[ PROP_IsTextWrapped ] <<= maApiData.mbWrapText;
+ rPropMap[ PROP_ShrinkToFit ] <<= maApiData.mbShrink;
}
// ============================================================================
-OoxProtectionData::OoxProtectionData() :
+ProtectionModel::ProtectionModel() :
mbLocked( true ), // default in Excel and Calc
mbHidden( false )
{
}
+// ----------------------------------------------------------------------------
+
+ApiProtectionData::ApiProtectionData() :
+ maCellProt( sal_True, sal_False, sal_False, sal_False )
+{
+}
+
+bool operator==( const ApiProtectionData& rLeft, const ApiProtectionData& rRight )
+{
+ return
+ (rLeft.maCellProt.IsLocked == rRight.maCellProt.IsLocked) &&
+ (rLeft.maCellProt.IsFormulaHidden == rRight.maCellProt.IsFormulaHidden) &&
+ (rLeft.maCellProt.IsHidden == rRight.maCellProt.IsHidden) &&
+ (rLeft.maCellProt.IsPrintHidden == rRight.maCellProt.IsPrintHidden);
+}
+
// ============================================================================
Protection::Protection( const WorkbookHelper& rHelper ) :
@@ -1326,49 +1471,49 @@ Protection::Protection( const WorkbookHelper& rHelper ) :
void Protection::importProtection( const AttributeList& rAttribs )
{
- maOoxData.mbLocked = rAttribs.getBool( XML_locked, true );
- maOoxData.mbHidden = rAttribs.getBool( XML_hidden, false );
+ maModel.mbLocked = rAttribs.getBool( XML_locked, true );
+ maModel.mbHidden = rAttribs.getBool( XML_hidden, false );
}
void Protection::setBinData( sal_uInt32 nFlags )
{
- maOoxData.mbLocked = getFlag( nFlags, OOBIN_XF_LOCKED );
- maOoxData.mbHidden = getFlag( nFlags, OOBIN_XF_HIDDEN );
+ maModel.mbLocked = getFlag( nFlags, OOBIN_XF_LOCKED );
+ maModel.mbHidden = getFlag( nFlags, OOBIN_XF_HIDDEN );
}
void Protection::setBiff2Data( sal_uInt8 nNumFmt )
{
- maOoxData.mbLocked = getFlag( nNumFmt, BIFF2_XF_LOCKED );
- maOoxData.mbHidden = getFlag( nNumFmt, BIFF2_XF_HIDDEN );
+ maModel.mbLocked = getFlag( nNumFmt, BIFF2_XF_LOCKED );
+ maModel.mbHidden = getFlag( nNumFmt, BIFF2_XF_HIDDEN );
}
void Protection::setBiff3Data( sal_uInt16 nProt )
{
- maOoxData.mbLocked = getFlag( nProt, BIFF_XF_LOCKED );
- maOoxData.mbHidden = getFlag( nProt, BIFF_XF_HIDDEN );
+ maModel.mbLocked = getFlag( nProt, BIFF_XF_LOCKED );
+ maModel.mbHidden = getFlag( nProt, BIFF_XF_HIDDEN );
}
void Protection::finalizeImport()
{
- maApiData.maCellProt.IsLocked = maOoxData.mbLocked;
- maApiData.maCellProt.IsFormulaHidden = maOoxData.mbHidden;
+ maApiData.maCellProt.IsLocked = maModel.mbLocked;
+ maApiData.maCellProt.IsFormulaHidden = maModel.mbHidden;
}
-void Protection::writeToPropertySet( PropertySet& rPropSet ) const
+void Protection::writeToPropertyMap( PropertyMap& rPropMap ) const
{
- getStylesPropertyHelper().writeProtectionProperties( rPropSet, maApiData );
+ rPropMap[ PROP_CellProtection ] <<= maApiData.maCellProt;
}
// ============================================================================
-OoxBorderLineData::OoxBorderLineData( bool bDxf ) :
+BorderLineModel::BorderLineModel( bool bDxf ) :
mnStyle( XML_none ),
mbUsed( !bDxf )
{
maColor.setIndexed( OOX_COLOR_WINDOWTEXT );
}
-void OoxBorderLineData::setBiffStyle( sal_Int32 nLineStyle )
+void BorderLineModel::setBiffStyle( sal_Int32 nLineStyle )
{
static const sal_Int32 spnStyleIds[] = {
XML_none, XML_thin, XML_medium, XML_dashed,
@@ -1378,15 +1523,15 @@ void OoxBorderLineData::setBiffStyle( sal_Int32 nLineStyle )
mnStyle = STATIC_ARRAY_SELECT( spnStyleIds, nLineStyle, XML_none );
}
-void OoxBorderLineData::setBiffData( sal_uInt8 nLineStyle, sal_uInt16 nLineColor )
+void BorderLineModel::setBiffData( sal_uInt8 nLineStyle, sal_uInt16 nLineColor )
{
maColor.setIndexed( nLineColor );
setBiffStyle( nLineStyle );
}
-// ============================================================================
+// ----------------------------------------------------------------------------
-OoxBorderData::OoxBorderData( bool bDxf ) :
+BorderModel::BorderModel( bool bDxf ) :
maLeft( bDxf ),
maRight( bDxf ),
maTop( bDxf ),
@@ -1397,6 +1542,14 @@ OoxBorderData::OoxBorderData( bool bDxf ) :
{
}
+// ----------------------------------------------------------------------------
+
+ApiBorderData::ApiBorderData() :
+ mbBorderUsed( false ),
+ mbDiagUsed( false )
+{
+}
+
// ============================================================================
namespace {
@@ -1431,40 +1584,20 @@ const BorderLine* lclGetThickerLine( const BorderLine& rBorderLine1, sal_Bool bV
Border::Border( const WorkbookHelper& rHelper, bool bDxf ) :
WorkbookHelper( rHelper ),
- maOoxData( bDxf ),
+ maModel( bDxf ),
mbDxf( bDxf )
{
}
-bool Border::isSupportedContext( sal_Int32 nElement, sal_Int32 nParentContext )
-{
- switch( nParentContext )
- {
- case XLS_TOKEN( border ):
- return (nElement == XLS_TOKEN( left )) ||
- (nElement == XLS_TOKEN( right )) ||
- (nElement == XLS_TOKEN( top )) ||
- (nElement == XLS_TOKEN( bottom )) ||
- (nElement == XLS_TOKEN( diagonal ));
- case XLS_TOKEN( left ):
- case XLS_TOKEN( right ):
- case XLS_TOKEN( top ):
- case XLS_TOKEN( bottom ):
- case XLS_TOKEN( diagonal ):
- return (nElement == XLS_TOKEN( color ));
- }
- return false;
-}
-
void Border::importBorder( const AttributeList& rAttribs )
{
- maOoxData.mbDiagTLtoBR = rAttribs.getBool( XML_diagonalDown, false );
- maOoxData.mbDiagBLtoTR = rAttribs.getBool( XML_diagonalUp, false );
+ maModel.mbDiagTLtoBR = rAttribs.getBool( XML_diagonalDown, false );
+ maModel.mbDiagBLtoTR = rAttribs.getBool( XML_diagonalUp, false );
}
void Border::importStyle( sal_Int32 nElement, const AttributeList& rAttribs )
{
- if( OoxBorderLineData* pBorderLine = getBorderLine( nElement ) )
+ if( BorderLineModel* pBorderLine = getBorderLine( nElement ) )
{
pBorderLine->mnStyle = rAttribs.getToken( XML_style, XML_none );
pBorderLine->mbUsed = true;
@@ -1473,31 +1606,31 @@ void Border::importStyle( sal_Int32 nElement, const AttributeList& rAttribs )
void Border::importColor( sal_Int32 nElement, const AttributeList& rAttribs )
{
- if( OoxBorderLineData* pBorderLine = getBorderLine( nElement ) )
+ if( BorderLineModel* pBorderLine = getBorderLine( nElement ) )
pBorderLine->maColor.importColor( rAttribs );
}
void Border::importBorder( RecordInputStream& rStrm )
{
sal_uInt8 nFlags = rStrm.readuInt8();
- maOoxData.mbDiagTLtoBR = getFlag( nFlags, OOBIN_BORDER_DIAG_TLBR );
- maOoxData.mbDiagBLtoTR = getFlag( nFlags, OOBIN_BORDER_DIAG_BLTR );
- maOoxData.maTop.setBiffStyle( rStrm.readuInt16() );
- rStrm >> maOoxData.maTop.maColor;
- maOoxData.maBottom.setBiffStyle( rStrm.readuInt16() );
- rStrm >> maOoxData.maBottom.maColor;
- maOoxData.maLeft.setBiffStyle( rStrm.readuInt16() );
- rStrm >> maOoxData.maLeft.maColor;
- maOoxData.maRight.setBiffStyle( rStrm.readuInt16() );
- rStrm >> maOoxData.maRight.maColor;
- maOoxData.maDiagonal.setBiffStyle( rStrm.readuInt16() );
- rStrm >> maOoxData.maDiagonal.maColor;
+ maModel.mbDiagTLtoBR = getFlag( nFlags, OOBIN_BORDER_DIAG_TLBR );
+ maModel.mbDiagBLtoTR = getFlag( nFlags, OOBIN_BORDER_DIAG_BLTR );
+ maModel.maTop.setBiffStyle( rStrm.readuInt16() );
+ rStrm >> maModel.maTop.maColor;
+ maModel.maBottom.setBiffStyle( rStrm.readuInt16() );
+ rStrm >> maModel.maBottom.maColor;
+ maModel.maLeft.setBiffStyle( rStrm.readuInt16() );
+ rStrm >> maModel.maLeft.maColor;
+ maModel.maRight.setBiffStyle( rStrm.readuInt16() );
+ rStrm >> maModel.maRight.maColor;
+ maModel.maDiagonal.setBiffStyle( rStrm.readuInt16() );
+ rStrm >> maModel.maDiagonal.maColor;
}
void Border::importDxfBorder( sal_Int32 nElement, RecordInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Border::importDxfBorder - missing conditional formatting flag" );
- if( OoxBorderLineData* pBorderLine = getBorderLine( nElement ) )
+ if( BorderLineModel* pBorderLine = getBorderLine( nElement ) )
{
sal_uInt16 nStyle;
rStrm >> pBorderLine->maColor >> nStyle;
@@ -1509,44 +1642,44 @@ void Border::importDxfBorder( sal_Int32 nElement, RecordInputStream& rStrm )
void Border::setBiff2Data( sal_uInt8 nFlags )
{
OSL_ENSURE( !mbDxf, "Border::setBiff2Data - unexpected conditional formatting flag" );
- maOoxData.maLeft.setBiffData( getFlagValue( nFlags, BIFF2_XF_LEFTLINE, BIFF_LINE_THIN, BIFF_LINE_NONE ), BIFF2_COLOR_BLACK );
- maOoxData.maRight.setBiffData( getFlagValue( nFlags, BIFF2_XF_RIGHTLINE, BIFF_LINE_THIN, BIFF_LINE_NONE ), BIFF2_COLOR_BLACK );
- maOoxData.maTop.setBiffData( getFlagValue( nFlags, BIFF2_XF_TOPLINE, BIFF_LINE_THIN, BIFF_LINE_NONE ), BIFF2_COLOR_BLACK );
- maOoxData.maBottom.setBiffData( getFlagValue( nFlags, BIFF2_XF_BOTTOMLINE, BIFF_LINE_THIN, BIFF_LINE_NONE ), BIFF2_COLOR_BLACK );
- maOoxData.maDiagonal.mbUsed = false;
+ maModel.maLeft.setBiffData( getFlagValue( nFlags, BIFF2_XF_LEFTLINE, BIFF_LINE_THIN, BIFF_LINE_NONE ), BIFF2_COLOR_BLACK );
+ maModel.maRight.setBiffData( getFlagValue( nFlags, BIFF2_XF_RIGHTLINE, BIFF_LINE_THIN, BIFF_LINE_NONE ), BIFF2_COLOR_BLACK );
+ maModel.maTop.setBiffData( getFlagValue( nFlags, BIFF2_XF_TOPLINE, BIFF_LINE_THIN, BIFF_LINE_NONE ), BIFF2_COLOR_BLACK );
+ maModel.maBottom.setBiffData( getFlagValue( nFlags, BIFF2_XF_BOTTOMLINE, BIFF_LINE_THIN, BIFF_LINE_NONE ), BIFF2_COLOR_BLACK );
+ maModel.maDiagonal.mbUsed = false;
}
void Border::setBiff3Data( sal_uInt32 nBorder )
{
OSL_ENSURE( !mbDxf, "Border::setBiff3Data - unexpected conditional formatting flag" );
- maOoxData.maLeft.setBiffData( extractValue< sal_uInt8 >( nBorder, 8, 3 ), extractValue< sal_uInt16 >( nBorder, 11, 5 ) );
- maOoxData.maRight.setBiffData( extractValue< sal_uInt8 >( nBorder, 24, 3 ), extractValue< sal_uInt16 >( nBorder, 27, 5 ) );
- maOoxData.maTop.setBiffData( extractValue< sal_uInt8 >( nBorder, 0, 3 ), extractValue< sal_uInt16 >( nBorder, 3, 5 ) );
- maOoxData.maBottom.setBiffData( extractValue< sal_uInt8 >( nBorder, 16, 3 ), extractValue< sal_uInt16 >( nBorder, 19, 5 ) );
- maOoxData.maDiagonal.mbUsed = false;
+ maModel.maLeft.setBiffData( extractValue< sal_uInt8 >( nBorder, 8, 3 ), extractValue< sal_uInt16 >( nBorder, 11, 5 ) );
+ maModel.maRight.setBiffData( extractValue< sal_uInt8 >( nBorder, 24, 3 ), extractValue< sal_uInt16 >( nBorder, 27, 5 ) );
+ maModel.maTop.setBiffData( extractValue< sal_uInt8 >( nBorder, 0, 3 ), extractValue< sal_uInt16 >( nBorder, 3, 5 ) );
+ maModel.maBottom.setBiffData( extractValue< sal_uInt8 >( nBorder, 16, 3 ), extractValue< sal_uInt16 >( nBorder, 19, 5 ) );
+ maModel.maDiagonal.mbUsed = false;
}
void Border::setBiff5Data( sal_uInt32 nBorder, sal_uInt32 nArea )
{
OSL_ENSURE( !mbDxf, "Border::setBiff5Data - unexpected conditional formatting flag" );
- maOoxData.maLeft.setBiffData( extractValue< sal_uInt8 >( nBorder, 3, 3 ), extractValue< sal_uInt16 >( nBorder, 16, 7 ) );
- maOoxData.maRight.setBiffData( extractValue< sal_uInt8 >( nBorder, 6, 3 ), extractValue< sal_uInt16 >( nBorder, 23, 7 ) );
- maOoxData.maTop.setBiffData( extractValue< sal_uInt8 >( nBorder, 0, 3 ), extractValue< sal_uInt16 >( nBorder, 9, 7 ) );
- maOoxData.maBottom.setBiffData( extractValue< sal_uInt8 >( nArea, 22, 3 ), extractValue< sal_uInt16 >( nArea, 25, 7 ) );
- maOoxData.maDiagonal.mbUsed = false;
+ maModel.maLeft.setBiffData( extractValue< sal_uInt8 >( nBorder, 3, 3 ), extractValue< sal_uInt16 >( nBorder, 16, 7 ) );
+ maModel.maRight.setBiffData( extractValue< sal_uInt8 >( nBorder, 6, 3 ), extractValue< sal_uInt16 >( nBorder, 23, 7 ) );
+ maModel.maTop.setBiffData( extractValue< sal_uInt8 >( nBorder, 0, 3 ), extractValue< sal_uInt16 >( nBorder, 9, 7 ) );
+ maModel.maBottom.setBiffData( extractValue< sal_uInt8 >( nArea, 22, 3 ), extractValue< sal_uInt16 >( nArea, 25, 7 ) );
+ maModel.maDiagonal.mbUsed = false;
}
void Border::setBiff8Data( sal_uInt32 nBorder1, sal_uInt32 nBorder2 )
{
OSL_ENSURE( !mbDxf, "Border::setBiff8Data - unexpected conditional formatting flag" );
- maOoxData.maLeft.setBiffData( extractValue< sal_uInt8 >( nBorder1, 0, 4 ), extractValue< sal_uInt16 >( nBorder1, 16, 7 ) );
- maOoxData.maRight.setBiffData( extractValue< sal_uInt8 >( nBorder1, 4, 4 ), extractValue< sal_uInt16 >( nBorder1, 23, 7 ) );
- maOoxData.maTop.setBiffData( extractValue< sal_uInt8 >( nBorder1, 8, 4 ), extractValue< sal_uInt16 >( nBorder2, 0, 7 ) );
- maOoxData.maBottom.setBiffData( extractValue< sal_uInt8 >( nBorder1, 12, 4 ), extractValue< sal_uInt16 >( nBorder2, 7, 7 ) );
- maOoxData.mbDiagTLtoBR = getFlag( nBorder1, BIFF_XF_DIAG_TLBR );
- maOoxData.mbDiagBLtoTR = getFlag( nBorder1, BIFF_XF_DIAG_BLTR );
- if( maOoxData.mbDiagTLtoBR || maOoxData.mbDiagBLtoTR )
- maOoxData.maDiagonal.setBiffData( extractValue< sal_uInt8 >( nBorder2, 21, 4 ), extractValue< sal_uInt16 >( nBorder2, 14, 7 ) );
+ maModel.maLeft.setBiffData( extractValue< sal_uInt8 >( nBorder1, 0, 4 ), extractValue< sal_uInt16 >( nBorder1, 16, 7 ) );
+ maModel.maRight.setBiffData( extractValue< sal_uInt8 >( nBorder1, 4, 4 ), extractValue< sal_uInt16 >( nBorder1, 23, 7 ) );
+ maModel.maTop.setBiffData( extractValue< sal_uInt8 >( nBorder1, 8, 4 ), extractValue< sal_uInt16 >( nBorder2, 0, 7 ) );
+ maModel.maBottom.setBiffData( extractValue< sal_uInt8 >( nBorder1, 12, 4 ), extractValue< sal_uInt16 >( nBorder2, 7, 7 ) );
+ maModel.mbDiagTLtoBR = getFlag( nBorder1, BIFF_XF_DIAG_TLBR );
+ maModel.mbDiagBLtoTR = getFlag( nBorder1, BIFF_XF_DIAG_BLTR );
+ if( maModel.mbDiagTLtoBR || maModel.mbDiagBLtoTR )
+ maModel.maDiagonal.setBiffData( extractValue< sal_uInt8 >( nBorder2, 21, 4 ), extractValue< sal_uInt16 >( nBorder2, 14, 7 ) );
}
void Border::importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags )
@@ -1557,25 +1690,25 @@ void Border::importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags )
sal_uInt32 nColor;
rStrm >> nStyle >> nColor;
rStrm.skip( 2 );
- maOoxData.maLeft.setBiffData( extractValue< sal_uInt8 >( nStyle, 0, 4 ), extractValue< sal_uInt16 >( nColor, 0, 7 ) );
- maOoxData.maRight.setBiffData( extractValue< sal_uInt8 >( nStyle, 4, 4 ), extractValue< sal_uInt16 >( nColor, 7, 7 ) );
- maOoxData.maTop.setBiffData( extractValue< sal_uInt8 >( nStyle, 8, 4 ), extractValue< sal_uInt16 >( nColor, 16, 7 ) );
- maOoxData.maBottom.setBiffData( extractValue< sal_uInt8 >( nStyle, 12, 4 ), extractValue< sal_uInt16 >( nColor, 23, 7 ) );
- maOoxData.maLeft.mbUsed = !getFlag( nFlags, BIFF_CFRULE_BORDER_LEFT );
- maOoxData.maRight.mbUsed = !getFlag( nFlags, BIFF_CFRULE_BORDER_RIGHT );
- maOoxData.maTop.mbUsed = !getFlag( nFlags, BIFF_CFRULE_BORDER_TOP );
- maOoxData.maBottom.mbUsed = !getFlag( nFlags, BIFF_CFRULE_BORDER_BOTTOM );
+ maModel.maLeft.setBiffData( extractValue< sal_uInt8 >( nStyle, 0, 4 ), extractValue< sal_uInt16 >( nColor, 0, 7 ) );
+ maModel.maRight.setBiffData( extractValue< sal_uInt8 >( nStyle, 4, 4 ), extractValue< sal_uInt16 >( nColor, 7, 7 ) );
+ maModel.maTop.setBiffData( extractValue< sal_uInt8 >( nStyle, 8, 4 ), extractValue< sal_uInt16 >( nColor, 16, 7 ) );
+ maModel.maBottom.setBiffData( extractValue< sal_uInt8 >( nStyle, 12, 4 ), extractValue< sal_uInt16 >( nColor, 23, 7 ) );
+ maModel.maLeft.mbUsed = !getFlag( nFlags, BIFF_CFRULE_BORDER_LEFT );
+ maModel.maRight.mbUsed = !getFlag( nFlags, BIFF_CFRULE_BORDER_RIGHT );
+ maModel.maTop.mbUsed = !getFlag( nFlags, BIFF_CFRULE_BORDER_TOP );
+ maModel.maBottom.mbUsed = !getFlag( nFlags, BIFF_CFRULE_BORDER_BOTTOM );
}
void Border::finalizeImport()
{
- maApiData.mbBorderUsed = maOoxData.maLeft.mbUsed || maOoxData.maRight.mbUsed || maOoxData.maTop.mbUsed || maOoxData.maBottom.mbUsed;
- maApiData.mbDiagUsed = maOoxData.maDiagonal.mbUsed;
+ maApiData.mbBorderUsed = maModel.maLeft.mbUsed || maModel.maRight.mbUsed || maModel.maTop.mbUsed || maModel.maBottom.mbUsed;
+ maApiData.mbDiagUsed = maModel.maDiagonal.mbUsed;
- maApiData.maBorder.IsLeftLineValid = convertBorderLine( maApiData.maBorder.LeftLine, maOoxData.maLeft );
- maApiData.maBorder.IsRightLineValid = convertBorderLine( maApiData.maBorder.RightLine, maOoxData.maRight );
- maApiData.maBorder.IsTopLineValid = convertBorderLine( maApiData.maBorder.TopLine, maOoxData.maTop );
- maApiData.maBorder.IsBottomLineValid = convertBorderLine( maApiData.maBorder.BottomLine, maOoxData.maBottom );
+ maApiData.maBorder.IsLeftLineValid = convertBorderLine( maApiData.maBorder.LeftLine, maModel.maLeft );
+ maApiData.maBorder.IsRightLineValid = convertBorderLine( maApiData.maBorder.RightLine, maModel.maRight );
+ maApiData.maBorder.IsTopLineValid = convertBorderLine( maApiData.maBorder.TopLine, maModel.maTop );
+ maApiData.maBorder.IsBottomLineValid = convertBorderLine( maApiData.maBorder.BottomLine, maModel.maBottom );
if( !mbDxf )
{
@@ -1588,34 +1721,40 @@ void Border::finalizeImport()
maApiData.maBorder.HorizontalLine = *pHorLine;
}
- if( maOoxData.mbDiagTLtoBR )
- convertBorderLine( maApiData.maTLtoBR, maOoxData.maDiagonal );
- if( maOoxData.mbDiagBLtoTR )
- convertBorderLine( maApiData.maBLtoTR, maOoxData.maDiagonal );
+ if( maModel.mbDiagTLtoBR )
+ convertBorderLine( maApiData.maTLtoBR, maModel.maDiagonal );
+ if( maModel.mbDiagBLtoTR )
+ convertBorderLine( maApiData.maBLtoTR, maModel.maDiagonal );
}
-void Border::writeToPropertySet( PropertySet& rPropSet ) const
+void Border::writeToPropertyMap( PropertyMap& rPropMap ) const
{
- getStylesPropertyHelper().writeBorderProperties( rPropSet, maApiData );
+ if( maApiData.mbBorderUsed )
+ rPropMap[ PROP_TableBorder ] <<= maApiData.maBorder;
+ if( maApiData.mbDiagUsed )
+ {
+ rPropMap[ PROP_DiagonalTLBR ] <<= maApiData.maTLtoBR;
+ rPropMap[ PROP_DiagonalBLTR ] <<= maApiData.maBLtoTR;
+ }
}
-OoxBorderLineData* Border::getBorderLine( sal_Int32 nElement )
+BorderLineModel* Border::getBorderLine( sal_Int32 nElement )
{
switch( nElement )
{
- case XLS_TOKEN( left ): return &maOoxData.maLeft;
- case XLS_TOKEN( right ): return &maOoxData.maRight;
- case XLS_TOKEN( top ): return &maOoxData.maTop;
- case XLS_TOKEN( bottom ): return &maOoxData.maBottom;
- case XLS_TOKEN( diagonal ): return &maOoxData.maDiagonal;
+ case XLS_TOKEN( left ): return &maModel.maLeft;
+ case XLS_TOKEN( right ): return &maModel.maRight;
+ case XLS_TOKEN( top ): return &maModel.maTop;
+ case XLS_TOKEN( bottom ): return &maModel.maBottom;
+ case XLS_TOKEN( diagonal ): return &maModel.maDiagonal;
}
return 0;
}
-bool Border::convertBorderLine( BorderLine& rBorderLine, const OoxBorderLineData& rLineData )
+bool Border::convertBorderLine( BorderLine& rBorderLine, const BorderLineModel& rModel )
{
- rBorderLine.Color = rLineData.maColor.getColor( *this, API_RGB_BLACK );
- switch( rLineData.mnStyle )
+ rBorderLine.Color = rModel.maColor.getColor( *this, API_RGB_BLACK );
+ switch( rModel.mnStyle )
{
case XML_dashDot: lclSetBorderLineWidth( rBorderLine, API_LINE_THIN ); break;
case XML_dashDotDot: lclSetBorderLineWidth( rBorderLine, API_LINE_THIN ); break;
@@ -1633,13 +1772,13 @@ bool Border::convertBorderLine( BorderLine& rBorderLine, const OoxBorderLineData
case XML_thin: lclSetBorderLineWidth( rBorderLine, API_LINE_THIN ); break;
default: lclSetBorderLineWidth( rBorderLine, API_LINE_NONE ); break;
}
- return rLineData.mbUsed;
+ return rModel.mbUsed;
}
// ============================================================================
-OoxPatternFillData::OoxPatternFillData( bool bDxf ) :
+PatternFillModel::PatternFillModel( bool bDxf ) :
mnPattern( XML_none ),
mbPattColorUsed( !bDxf ),
mbFillColorUsed( !bDxf ),
@@ -1649,7 +1788,7 @@ OoxPatternFillData::OoxPatternFillData( bool bDxf ) :
maFillColor.setIndexed( OOX_COLOR_WINDOWBACK );
}
-void OoxPatternFillData::setBinPattern( sal_Int32 nPattern )
+void PatternFillModel::setBinPattern( sal_Int32 nPattern )
{
static const sal_Int32 spnPatternIds[] = {
XML_none, XML_solid, XML_mediumGray, XML_darkGray,
@@ -1660,7 +1799,7 @@ void OoxPatternFillData::setBinPattern( sal_Int32 nPattern )
mnPattern = STATIC_ARRAY_SELECT( spnPatternIds, nPattern, XML_none );
}
-void OoxPatternFillData::setBiffData( sal_uInt16 nPatternColor, sal_uInt16 nFillColor, sal_uInt8 nPattern )
+void PatternFillModel::setBiffData( sal_uInt16 nPatternColor, sal_uInt16 nFillColor, sal_uInt8 nPattern )
{
maPatternColor.setIndexed( nPatternColor );
maFillColor.setIndexed( nFillColor );
@@ -1670,7 +1809,7 @@ void OoxPatternFillData::setBiffData( sal_uInt16 nPatternColor, sal_uInt16 nFill
// ----------------------------------------------------------------------------
-OoxGradientFillData::OoxGradientFillData() :
+GradientFillModel::GradientFillModel() :
mnType( XML_linear ),
mfAngle( 0.0 ),
mfLeft( 0.0 ),
@@ -1680,7 +1819,7 @@ OoxGradientFillData::OoxGradientFillData() :
{
}
-void OoxGradientFillData::readGradient( RecordInputStream& rStrm )
+void GradientFillModel::readGradient( RecordInputStream& rStrm )
{
sal_Int32 nType;
rStrm >> nType >> mfAngle >> mfLeft >> mfRight >> mfTop >> mfBottom;
@@ -1688,7 +1827,7 @@ void OoxGradientFillData::readGradient( RecordInputStream& rStrm )
mnType = STATIC_ARRAY_SELECT( spnTypes, nType, XML_TOKEN_INVALID );
}
-void OoxGradientFillData::readGradientStop( RecordInputStream& rStrm, bool bDxf )
+void GradientFillModel::readGradientStop( RecordInputStream& rStrm, bool bDxf )
{
Color aColor;
double fPosition;
@@ -1705,6 +1844,15 @@ void OoxGradientFillData::readGradientStop( RecordInputStream& rStrm, bool bDxf
maColors[ fPosition ] = aColor;
}
+// ----------------------------------------------------------------------------
+
+ApiSolidFillData::ApiSolidFillData() :
+ mnColor( API_RGB_TRANSPARENT ),
+ mbTransparent( true ),
+ mbUsed( false )
+{
+}
+
// ============================================================================
namespace {
@@ -1732,68 +1880,50 @@ Fill::Fill( const WorkbookHelper& rHelper, bool bDxf ) :
{
}
-bool Fill::isSupportedContext( sal_Int32 nElement, sal_Int32 nParentContext )
-{
- switch( nParentContext )
- {
- case XLS_TOKEN( fill ):
- return (nElement == XLS_TOKEN( patternFill )) ||
- (nElement == XLS_TOKEN( gradientFill ));
- case XLS_TOKEN( patternFill ):
- return (nElement == XLS_TOKEN( fgColor )) ||
- (nElement == XLS_TOKEN( bgColor ));
- case XLS_TOKEN( gradientFill ):
- return (nElement == XLS_TOKEN( stop ));
- case XLS_TOKEN( stop ):
- return (nElement == XLS_TOKEN( color ));
- }
- return false;
-}
-
void Fill::importPatternFill( const AttributeList& rAttribs )
{
- mxOoxPattData.reset( new OoxPatternFillData( mbDxf ) );
- mxOoxPattData->mnPattern = rAttribs.getToken( XML_patternType, XML_none );
+ mxPatternModel.reset( new PatternFillModel( mbDxf ) );
+ mxPatternModel->mnPattern = rAttribs.getToken( XML_patternType, XML_none );
if( mbDxf )
- mxOoxPattData->mbPatternUsed = rAttribs.hasAttribute( XML_patternType );
+ mxPatternModel->mbPatternUsed = rAttribs.hasAttribute( XML_patternType );
}
void Fill::importFgColor( const AttributeList& rAttribs )
{
- OSL_ENSURE( mxOoxPattData.get(), "Fill::importFgColor - missing pattern data" );
- if( mxOoxPattData.get() )
+ OSL_ENSURE( mxPatternModel.get(), "Fill::importFgColor - missing pattern data" );
+ if( mxPatternModel.get() )
{
- mxOoxPattData->maPatternColor.importColor( rAttribs );
- mxOoxPattData->mbPattColorUsed = true;
+ mxPatternModel->maPatternColor.importColor( rAttribs );
+ mxPatternModel->mbPattColorUsed = true;
}
}
void Fill::importBgColor( const AttributeList& rAttribs )
{
- OSL_ENSURE( mxOoxPattData.get(), "Fill::importBgColor - missing pattern data" );
- if( mxOoxPattData.get() )
+ OSL_ENSURE( mxPatternModel.get(), "Fill::importBgColor - missing pattern data" );
+ if( mxPatternModel.get() )
{
- mxOoxPattData->maFillColor.importColor( rAttribs );
- mxOoxPattData->mbFillColorUsed = true;
+ mxPatternModel->maFillColor.importColor( rAttribs );
+ mxPatternModel->mbFillColorUsed = true;
}
}
void Fill::importGradientFill( const AttributeList& rAttribs )
{
- mxOoxGradData.reset( new OoxGradientFillData );
- mxOoxGradData->mnType = rAttribs.getToken( XML_type, XML_linear );
- mxOoxGradData->mfAngle = rAttribs.getDouble( XML_degree, 0.0 );
- mxOoxGradData->mfLeft = rAttribs.getDouble( XML_left, 0.0 );
- mxOoxGradData->mfRight = rAttribs.getDouble( XML_right, 0.0 );
- mxOoxGradData->mfTop = rAttribs.getDouble( XML_top, 0.0 );
- mxOoxGradData->mfBottom = rAttribs.getDouble( XML_bottom, 0.0 );
+ mxGradientModel.reset( new GradientFillModel );
+ mxGradientModel->mnType = rAttribs.getToken( XML_type, XML_linear );
+ mxGradientModel->mfAngle = rAttribs.getDouble( XML_degree, 0.0 );
+ mxGradientModel->mfLeft = rAttribs.getDouble( XML_left, 0.0 );
+ mxGradientModel->mfRight = rAttribs.getDouble( XML_right, 0.0 );
+ mxGradientModel->mfTop = rAttribs.getDouble( XML_top, 0.0 );
+ mxGradientModel->mfBottom = rAttribs.getDouble( XML_bottom, 0.0 );
}
void Fill::importColor( const AttributeList& rAttribs, double fPosition )
{
- OSL_ENSURE( mxOoxGradData.get(), "Fill::importColor - missing gradient data" );
- if( mxOoxGradData.get() && (fPosition >= 0.0) )
- mxOoxGradData->maColors[ fPosition ].importColor( rAttribs );
+ OSL_ENSURE( mxGradientModel.get(), "Fill::importColor - missing gradient data" );
+ if( mxGradientModel.get() && (fPosition >= 0.0) )
+ mxGradientModel->maColors[ fPosition ].importColor( rAttribs );
}
void Fill::importFill( RecordInputStream& rStrm )
@@ -1802,70 +1932,70 @@ void Fill::importFill( RecordInputStream& rStrm )
sal_Int32 nPattern = rStrm.readInt32();
if( nPattern == OOBIN_FILL_GRADIENT )
{
- mxOoxGradData.reset( new OoxGradientFillData );
+ mxGradientModel.reset( new GradientFillModel );
sal_Int32 nStopCount;
rStrm.skip( 16 );
- mxOoxGradData->readGradient( rStrm );
+ mxGradientModel->readGradient( rStrm );
rStrm >> nStopCount;
for( sal_Int32 nStop = 0; (nStop < nStopCount) && !rStrm.isEof(); ++nStop )
- mxOoxGradData->readGradientStop( rStrm, false );
+ mxGradientModel->readGradientStop( rStrm, false );
}
else
{
- mxOoxPattData.reset( new OoxPatternFillData( mbDxf ) );
- mxOoxPattData->setBinPattern( nPattern );
- rStrm >> mxOoxPattData->maPatternColor >> mxOoxPattData->maFillColor;
+ mxPatternModel.reset( new PatternFillModel( mbDxf ) );
+ mxPatternModel->setBinPattern( nPattern );
+ rStrm >> mxPatternModel->maPatternColor >> mxPatternModel->maFillColor;
}
}
void Fill::importDxfPattern( RecordInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Fill::importDxfPattern - missing conditional formatting flag" );
- if( !mxOoxPattData )
- mxOoxPattData.reset( new OoxPatternFillData( mbDxf ) );
- mxOoxPattData->setBinPattern( rStrm.readuInt8() );
- mxOoxPattData->mbPatternUsed = true;
+ if( !mxPatternModel )
+ mxPatternModel.reset( new PatternFillModel( mbDxf ) );
+ mxPatternModel->setBinPattern( rStrm.readuInt8() );
+ mxPatternModel->mbPatternUsed = true;
}
void Fill::importDxfFgColor( RecordInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Fill::importDxfFgColor - missing conditional formatting flag" );
- if( !mxOoxPattData )
- mxOoxPattData.reset( new OoxPatternFillData( mbDxf ) );
- mxOoxPattData->maPatternColor.importColor( rStrm );
- mxOoxPattData->mbPattColorUsed = true;
+ if( !mxPatternModel )
+ mxPatternModel.reset( new PatternFillModel( mbDxf ) );
+ mxPatternModel->maPatternColor.importColor( rStrm );
+ mxPatternModel->mbPattColorUsed = true;
}
void Fill::importDxfBgColor( RecordInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Fill::importDxfBgColor - missing conditional formatting flag" );
- if( !mxOoxPattData )
- mxOoxPattData.reset( new OoxPatternFillData( mbDxf ) );
- mxOoxPattData->maFillColor.importColor( rStrm );
- mxOoxPattData->mbFillColorUsed = true;
+ if( !mxPatternModel )
+ mxPatternModel.reset( new PatternFillModel( mbDxf ) );
+ mxPatternModel->maFillColor.importColor( rStrm );
+ mxPatternModel->mbFillColorUsed = true;
}
void Fill::importDxfGradient( RecordInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Fill::importDxfGradient - missing conditional formatting flag" );
- if( !mxOoxGradData )
- mxOoxGradData.reset( new OoxGradientFillData );
- mxOoxGradData->readGradient( rStrm );
+ if( !mxGradientModel )
+ mxGradientModel.reset( new GradientFillModel );
+ mxGradientModel->readGradient( rStrm );
}
void Fill::importDxfStop( RecordInputStream& rStrm )
{
OSL_ENSURE( mbDxf, "Fill::importDxfStop - missing conditional formatting flag" );
- if( !mxOoxGradData )
- mxOoxGradData.reset( new OoxGradientFillData );
- mxOoxGradData->readGradientStop( rStrm, true );
+ if( !mxGradientModel )
+ mxGradientModel.reset( new GradientFillModel );
+ mxGradientModel->readGradientStop( rStrm, true );
}
void Fill::setBiff2Data( sal_uInt8 nFlags )
{
OSL_ENSURE( !mbDxf, "Fill::setBiff2Data - unexpected conditional formatting flag" );
- mxOoxPattData.reset( new OoxPatternFillData( mbDxf ) );
- mxOoxPattData->setBiffData(
+ mxPatternModel.reset( new PatternFillModel( mbDxf ) );
+ mxPatternModel->setBiffData(
BIFF2_COLOR_BLACK,
BIFF2_COLOR_WHITE,
getFlagValue( nFlags, BIFF2_XF_BACKGROUND, BIFF_PATT_125, BIFF_PATT_NONE ) );
@@ -1874,8 +2004,8 @@ void Fill::setBiff2Data( sal_uInt8 nFlags )
void Fill::setBiff3Data( sal_uInt16 nArea )
{
OSL_ENSURE( !mbDxf, "Fill::setBiff3Data - unexpected conditional formatting flag" );
- mxOoxPattData.reset( new OoxPatternFillData( mbDxf ) );
- mxOoxPattData->setBiffData(
+ mxPatternModel.reset( new PatternFillModel( mbDxf ) );
+ mxPatternModel->setBiffData(
extractValue< sal_uInt16 >( nArea, 6, 5 ),
extractValue< sal_uInt16 >( nArea, 11, 5 ),
extractValue< sal_uInt8 >( nArea, 0, 6 ) );
@@ -1884,8 +2014,8 @@ void Fill::setBiff3Data( sal_uInt16 nArea )
void Fill::setBiff5Data( sal_uInt32 nArea )
{
OSL_ENSURE( !mbDxf, "Fill::setBiff5Data - unexpected conditional formatting flag" );
- mxOoxPattData.reset( new OoxPatternFillData( mbDxf ) );
- mxOoxPattData->setBiffData(
+ mxPatternModel.reset( new PatternFillModel( mbDxf ) );
+ mxPatternModel->setBiffData(
extractValue< sal_uInt16 >( nArea, 0, 7 ),
extractValue< sal_uInt16 >( nArea, 7, 7 ),
extractValue< sal_uInt8 >( nArea, 16, 6 ) );
@@ -1894,8 +2024,8 @@ void Fill::setBiff5Data( sal_uInt32 nArea )
void Fill::setBiff8Data( sal_uInt32 nBorder2, sal_uInt16 nArea )
{
OSL_ENSURE( !mbDxf, "Fill::setBiff8Data - unexpected conditional formatting flag" );
- mxOoxPattData.reset( new OoxPatternFillData( mbDxf ) );
- mxOoxPattData->setBiffData(
+ mxPatternModel.reset( new PatternFillModel( mbDxf ) );
+ mxPatternModel->setBiffData(
extractValue< sal_uInt16 >( nArea, 0, 7 ),
extractValue< sal_uInt16 >( nArea, 7, 7 ),
extractValue< sal_uInt8 >( nBorder2, 26, 6 ) );
@@ -1905,41 +2035,41 @@ void Fill::importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags )
{
OSL_ENSURE( mbDxf, "Fill::importCfRule - missing conditional formatting flag" );
OSL_ENSURE( getFlag( nFlags, BIFF_CFRULE_FILLBLOCK ), "Fill::importCfRule - missing fill block flag" );
- mxOoxPattData.reset( new OoxPatternFillData( mbDxf ) );
+ mxPatternModel.reset( new PatternFillModel( mbDxf ) );
sal_uInt32 nFillData;
rStrm >> nFillData;
- mxOoxPattData->setBiffData(
+ mxPatternModel->setBiffData(
extractValue< sal_uInt16 >( nFillData, 16, 7 ),
extractValue< sal_uInt16 >( nFillData, 23, 7 ),
extractValue< sal_uInt8 >( nFillData, 10, 6 ) );
- mxOoxPattData->mbPattColorUsed = !getFlag( nFlags, BIFF_CFRULE_FILL_PATTCOLOR );
- mxOoxPattData->mbFillColorUsed = !getFlag( nFlags, BIFF_CFRULE_FILL_FILLCOLOR );
- mxOoxPattData->mbPatternUsed = !getFlag( nFlags, BIFF_CFRULE_FILL_PATTERN );
+ mxPatternModel->mbPattColorUsed = !getFlag( nFlags, BIFF_CFRULE_FILL_PATTCOLOR );
+ mxPatternModel->mbFillColorUsed = !getFlag( nFlags, BIFF_CFRULE_FILL_FILLCOLOR );
+ mxPatternModel->mbPatternUsed = !getFlag( nFlags, BIFF_CFRULE_FILL_PATTERN );
}
void Fill::finalizeImport()
{
- if( mxOoxPattData.get() )
+ if( mxPatternModel.get() )
{
// finalize the OOX data struct
- OoxPatternFillData& rOoxData = *mxOoxPattData;
+ PatternFillModel& rModel = *mxPatternModel;
if( mbDxf )
{
- if( rOoxData.mbFillColorUsed && (!rOoxData.mbPatternUsed || (rOoxData.mnPattern == XML_solid)) )
+ if( rModel.mbFillColorUsed && (!rModel.mbPatternUsed || (rModel.mnPattern == XML_solid)) )
{
- rOoxData.maPatternColor = rOoxData.maFillColor;
- rOoxData.mnPattern = XML_solid;
- rOoxData.mbPattColorUsed = rOoxData.mbPatternUsed = true;
+ rModel.maPatternColor = rModel.maFillColor;
+ rModel.mnPattern = XML_solid;
+ rModel.mbPattColorUsed = rModel.mbPatternUsed = true;
}
- else if( !rOoxData.mbFillColorUsed && rOoxData.mbPatternUsed && (rOoxData.mnPattern == XML_solid) )
+ else if( !rModel.mbFillColorUsed && rModel.mbPatternUsed && (rModel.mnPattern == XML_solid) )
{
- rOoxData.mbPatternUsed = false;
+ rModel.mbPatternUsed = false;
}
}
// convert to API fill settings
- maApiData.mbUsed = rOoxData.mbPatternUsed;
- if( rOoxData.mnPattern == XML_none )
+ maApiData.mbUsed = rModel.mbPatternUsed;
+ if( rModel.mnPattern == XML_none )
{
maApiData.mnColor = API_RGB_TRANSPARENT;
maApiData.mbTransparent = true;
@@ -1947,7 +2077,7 @@ void Fill::finalizeImport()
else
{
sal_Int32 nAlpha = 0x80;
- switch( rOoxData.mnPattern )
+ switch( rModel.mnPattern )
{
case XML_darkDown: nAlpha = 0x40; break;
case XML_darkGray: nAlpha = 0x60; break;
@@ -1969,28 +2099,28 @@ void Fill::finalizeImport()
case XML_solid: nAlpha = 0x80; break;
}
- if( !rOoxData.mbPattColorUsed )
- rOoxData.maPatternColor.setAuto();
- sal_Int32 nPattColor = rOoxData.maPatternColor.getColor(
+ if( !rModel.mbPattColorUsed )
+ rModel.maPatternColor.setAuto();
+ sal_Int32 nPattColor = rModel.maPatternColor.getColor(
*this, ::oox::drawingml::Color::getSystemColor( XML_windowText ) );
- if( !rOoxData.mbFillColorUsed )
- rOoxData.maFillColor.setAuto();
- sal_Int32 nFillColor = rOoxData.maFillColor.getColor(
+ if( !rModel.mbFillColorUsed )
+ rModel.maFillColor.setAuto();
+ sal_Int32 nFillColor = rModel.maFillColor.getColor(
*this, ::oox::drawingml::Color::getSystemColor( XML_window ) );
maApiData.mnColor = lclGetMixedColor( nPattColor, nFillColor, nAlpha );
maApiData.mbTransparent = false;
}
}
- else if( mxOoxGradData.get() && !mxOoxGradData->maColors.empty() )
+ else if( mxGradientModel.get() && !mxGradientModel->maColors.empty() )
{
- OoxGradientFillData& rOoxData = *mxOoxGradData;
+ GradientFillModel& rModel = *mxGradientModel;
maApiData.mbUsed = true; // no support for differential attributes
- OoxGradientFillData::ColorMap::const_iterator aIt = rOoxData.maColors.begin();
+ GradientFillModel::ColorMap::const_iterator aIt = rModel.maColors.begin();
OSL_ENSURE( !aIt->second.isAuto(), "Fill::finalizeImport - automatic gradient color" );
maApiData.mnColor = aIt->second.getColor( *this );
- if( ++aIt != rOoxData.maColors.end() )
+ if( ++aIt != rModel.maColors.end() )
{
OSL_ENSURE( !aIt->second.isAuto(), "Fill::finalizeImport - automatic gradient color" );
sal_Int32 nEndColor = aIt->second.getColor( *this );
@@ -2000,14 +2130,18 @@ void Fill::finalizeImport()
}
}
-void Fill::writeToPropertySet( PropertySet& rPropSet ) const
+void Fill::writeToPropertyMap( PropertyMap& rPropMap ) const
{
- getStylesPropertyHelper().writeSolidFillProperties( rPropSet, maApiData );
+ if( maApiData.mbUsed )
+ {
+ rPropMap[ PROP_CellBackColor ] <<= maApiData.mnColor;
+ rPropMap[ PROP_IsCellBackgroundTransparent ] <<= maApiData.mbTransparent;
+ }
}
// ============================================================================
-OoxXfData::OoxXfData() :
+XfModel::XfModel() :
mnStyleXfId( -1 ),
mnFontId( -1 ),
mnNumFmtId( -1 ),
@@ -2034,27 +2168,27 @@ Xf::Xf( const WorkbookHelper& rHelper ) :
void Xf::setAllUsedFlags( bool bUsed )
{
- maOoxData.mbAlignUsed = maOoxData.mbProtUsed = maOoxData.mbFontUsed =
- maOoxData.mbNumFmtUsed = maOoxData.mbBorderUsed = maOoxData.mbAreaUsed = bUsed;
+ maModel.mbAlignUsed = maModel.mbProtUsed = maModel.mbFontUsed =
+ maModel.mbNumFmtUsed = maModel.mbBorderUsed = maModel.mbAreaUsed = bUsed;
}
void Xf::importXf( const AttributeList& rAttribs, bool bCellXf )
{
- maOoxData.mbCellXf = bCellXf;
- maOoxData.mnStyleXfId = rAttribs.getInteger( XML_xfId, -1 );
- maOoxData.mnFontId = rAttribs.getInteger( XML_fontId, -1 );
- maOoxData.mnNumFmtId = rAttribs.getInteger( XML_numFmtId, -1 );
- maOoxData.mnBorderId = rAttribs.getInteger( XML_borderId, -1 );
- maOoxData.mnFillId = rAttribs.getInteger( XML_fillId, -1 );
+ maModel.mbCellXf = bCellXf;
+ maModel.mnStyleXfId = rAttribs.getInteger( XML_xfId, -1 );
+ maModel.mnFontId = rAttribs.getInteger( XML_fontId, -1 );
+ maModel.mnNumFmtId = rAttribs.getInteger( XML_numFmtId, -1 );
+ maModel.mnBorderId = rAttribs.getInteger( XML_borderId, -1 );
+ maModel.mnFillId = rAttribs.getInteger( XML_fillId, -1 );
/* Default value of the apply*** attributes is dependent on context:
true in cellStyleXfs element, false in cellXfs element... */
- maOoxData.mbAlignUsed = rAttribs.getBool( XML_applyAlignment, !maOoxData.mbCellXf );
- maOoxData.mbProtUsed = rAttribs.getBool( XML_applyProtection, !maOoxData.mbCellXf );
- maOoxData.mbFontUsed = rAttribs.getBool( XML_applyFont, !maOoxData.mbCellXf );
- maOoxData.mbNumFmtUsed = rAttribs.getBool( XML_applyNumberFormat, !maOoxData.mbCellXf );
- maOoxData.mbBorderUsed = rAttribs.getBool( XML_applyBorder, !maOoxData.mbCellXf );
- maOoxData.mbAreaUsed = rAttribs.getBool( XML_applyFill, !maOoxData.mbCellXf );
+ maModel.mbAlignUsed = rAttribs.getBool( XML_applyAlignment, !maModel.mbCellXf );
+ maModel.mbProtUsed = rAttribs.getBool( XML_applyProtection, !maModel.mbCellXf );
+ maModel.mbFontUsed = rAttribs.getBool( XML_applyFont, !maModel.mbCellXf );
+ maModel.mbNumFmtUsed = rAttribs.getBool( XML_applyNumberFormat, !maModel.mbCellXf );
+ maModel.mbBorderUsed = rAttribs.getBool( XML_applyBorder, !maModel.mbCellXf );
+ maModel.mbAreaUsed = rAttribs.getBool( XML_applyFill, !maModel.mbCellXf );
}
void Xf::importAlignment( const AttributeList& rAttribs )
@@ -2069,29 +2203,29 @@ void Xf::importProtection( const AttributeList& rAttribs )
void Xf::importXf( RecordInputStream& rStrm, bool bCellXf )
{
- maOoxData.mbCellXf = bCellXf;
- maOoxData.mnStyleXfId = rStrm.readuInt16();
- maOoxData.mnNumFmtId = rStrm.readuInt16();
- maOoxData.mnFontId = rStrm.readuInt16();
- maOoxData.mnFillId = rStrm.readuInt16();
- maOoxData.mnBorderId = rStrm.readuInt16();
+ maModel.mbCellXf = bCellXf;
+ maModel.mnStyleXfId = rStrm.readuInt16();
+ maModel.mnNumFmtId = rStrm.readuInt16();
+ maModel.mnFontId = rStrm.readuInt16();
+ maModel.mnFillId = rStrm.readuInt16();
+ maModel.mnBorderId = rStrm.readuInt16();
sal_uInt32 nFlags = rStrm.readuInt32();
maAlignment.setBinData( nFlags );
maProtection.setBinData( nFlags );
// used flags, see comments in Xf::setBiffUsedFlags()
sal_uInt16 nUsedFlags = rStrm.readuInt16();
- maOoxData.mbFontUsed = maOoxData.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_FONT_USED );
- maOoxData.mbNumFmtUsed = maOoxData.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_NUMFMT_USED );
- maOoxData.mbAlignUsed = maOoxData.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_ALIGN_USED );
- maOoxData.mbProtUsed = maOoxData.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_PROT_USED );
- maOoxData.mbBorderUsed = maOoxData.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_BORDER_USED );
- maOoxData.mbAreaUsed = maOoxData.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_AREA_USED );
+ maModel.mbFontUsed = maModel.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_FONT_USED );
+ maModel.mbNumFmtUsed = maModel.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_NUMFMT_USED );
+ maModel.mbAlignUsed = maModel.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_ALIGN_USED );
+ maModel.mbProtUsed = maModel.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_PROT_USED );
+ maModel.mbBorderUsed = maModel.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_BORDER_USED );
+ maModel.mbAreaUsed = maModel.mbCellXf == getFlag( nUsedFlags, OOBIN_XF_AREA_USED );
}
void Xf::importXf( BiffInputStream& rStrm )
{
- BorderRef xBorder = getStyles().createBorder( &maOoxData.mnBorderId );
- FillRef xFill = getStyles().createFill( &maOoxData.mnFillId );
+ BorderRef xBorder = getStyles().createBorder( &maModel.mnBorderId );
+ FillRef xFill = getStyles().createFill( &maModel.mnFillId );
switch( getBiff() )
{
@@ -2110,8 +2244,8 @@ void Xf::importXf( BiffInputStream& rStrm )
maProtection.setBiff2Data( nNumFmtId );
xBorder->setBiff2Data( nFlags );
xFill->setBiff2Data( nFlags );
- maOoxData.mnFontId = static_cast< sal_Int32 >( nFontId );
- maOoxData.mnNumFmtId = static_cast< sal_Int32 >( nNumFmtId & BIFF2_XF_VALFMT_MASK );
+ maModel.mnFontId = static_cast< sal_Int32 >( nFontId );
+ maModel.mnNumFmtId = static_cast< sal_Int32 >( nNumFmtId & BIFF2_XF_VALFMT_MASK );
}
break;
@@ -2123,8 +2257,8 @@ void Xf::importXf( BiffInputStream& rStrm )
rStrm >> nFontId >> nNumFmtId >> nTypeProt >> nAlign >> nArea >> nBorder;
// XF type/parent
- maOoxData.mbCellXf = !getFlag( nTypeProt, BIFF_XF_STYLE ); // new in BIFF3
- maOoxData.mnStyleXfId = extractValue< sal_Int32 >( nAlign, 4, 12 ); // new in BIFF3
+ maModel.mbCellXf = !getFlag( nTypeProt, BIFF_XF_STYLE ); // new in BIFF3
+ maModel.mnStyleXfId = extractValue< sal_Int32 >( nAlign, 4, 12 ); // new in BIFF3
// attribute used flags
setBiffUsedFlags( extractValue< sal_uInt8 >( nTypeProt, 10, 6 ) ); // new in BIFF3
@@ -2133,8 +2267,8 @@ void Xf::importXf( BiffInputStream& rStrm )
maProtection.setBiff3Data( nTypeProt );
xBorder->setBiff3Data( nBorder );
xFill->setBiff3Data( nArea );
- maOoxData.mnFontId = static_cast< sal_Int32 >( nFontId );
- maOoxData.mnNumFmtId = static_cast< sal_Int32 >( nNumFmtId );
+ maModel.mnFontId = static_cast< sal_Int32 >( nFontId );
+ maModel.mnNumFmtId = static_cast< sal_Int32 >( nNumFmtId );
}
break;
@@ -2146,8 +2280,8 @@ void Xf::importXf( BiffInputStream& rStrm )
rStrm >> nFontId >> nNumFmtId >> nTypeProt >> nAlign >> nArea >> nBorder;
// XF type/parent
- maOoxData.mbCellXf = !getFlag( nTypeProt, BIFF_XF_STYLE );
- maOoxData.mnStyleXfId = extractValue< sal_Int32 >( nTypeProt, 4, 12 );
+ maModel.mbCellXf = !getFlag( nTypeProt, BIFF_XF_STYLE );
+ maModel.mnStyleXfId = extractValue< sal_Int32 >( nTypeProt, 4, 12 );
// attribute used flags
setBiffUsedFlags( extractValue< sal_uInt8 >( nAlign, 10, 6 ) );
@@ -2156,8 +2290,8 @@ void Xf::importXf( BiffInputStream& rStrm )
maProtection.setBiff3Data( nTypeProt );
xBorder->setBiff3Data( nBorder );
xFill->setBiff3Data( nArea );
- maOoxData.mnFontId = static_cast< sal_Int32 >( nFontId );
- maOoxData.mnNumFmtId = static_cast< sal_Int32 >( nNumFmtId );
+ maModel.mnFontId = static_cast< sal_Int32 >( nFontId );
+ maModel.mnNumFmtId = static_cast< sal_Int32 >( nNumFmtId );
}
break;
@@ -2168,8 +2302,8 @@ void Xf::importXf( BiffInputStream& rStrm )
rStrm >> nFontId >> nNumFmtId >> nTypeProt >> nAlign >> nArea >> nBorder;
// XF type/parent
- maOoxData.mbCellXf = !getFlag( nTypeProt, BIFF_XF_STYLE );
- maOoxData.mnStyleXfId = extractValue< sal_Int32 >( nTypeProt, 4, 12 );
+ maModel.mbCellXf = !getFlag( nTypeProt, BIFF_XF_STYLE );
+ maModel.mnStyleXfId = extractValue< sal_Int32 >( nTypeProt, 4, 12 );
// attribute used flags
setBiffUsedFlags( extractValue< sal_uInt8 >( nAlign, 10, 6 ) );
@@ -2178,8 +2312,8 @@ void Xf::importXf( BiffInputStream& rStrm )
maProtection.setBiff3Data( nTypeProt );
xBorder->setBiff5Data( nBorder, nArea );
xFill->setBiff5Data( nArea );
- maOoxData.mnFontId = static_cast< sal_Int32 >( nFontId );
- maOoxData.mnNumFmtId = static_cast< sal_Int32 >( nNumFmtId );
+ maModel.mnFontId = static_cast< sal_Int32 >( nFontId );
+ maModel.mnNumFmtId = static_cast< sal_Int32 >( nNumFmtId );
}
break;
@@ -2190,8 +2324,8 @@ void Xf::importXf( BiffInputStream& rStrm )
rStrm >> nFontId >> nNumFmtId >> nTypeProt >> nAlign >> nMiscAttrib >> nBorder1 >> nBorder2 >> nArea;
// XF type/parent
- maOoxData.mbCellXf = !getFlag( nTypeProt, BIFF_XF_STYLE );
- maOoxData.mnStyleXfId = extractValue< sal_Int32 >( nTypeProt, 4, 12 );
+ maModel.mbCellXf = !getFlag( nTypeProt, BIFF_XF_STYLE );
+ maModel.mnStyleXfId = extractValue< sal_Int32 >( nTypeProt, 4, 12 );
// attribute used flags
setBiffUsedFlags( extractValue< sal_uInt8 >( nMiscAttrib, 10, 6 ) );
@@ -2200,8 +2334,8 @@ void Xf::importXf( BiffInputStream& rStrm )
maProtection.setBiff3Data( nTypeProt );
xBorder->setBiff8Data( nBorder1, nBorder2 );
xFill->setBiff8Data( nBorder2, nArea );
- maOoxData.mnFontId = static_cast< sal_Int32 >( nFontId );
- maOoxData.mnNumFmtId = static_cast< sal_Int32 >( nNumFmtId );
+ maModel.mnFontId = static_cast< sal_Int32 >( nFontId );
+ maModel.mnNumFmtId = static_cast< sal_Int32 >( nNumFmtId );
}
break;
@@ -2215,46 +2349,53 @@ void Xf::finalizeImport()
maAlignment.finalizeImport();
maProtection.finalizeImport();
// update used flags from cell style
- if( maOoxData.mbCellXf )
- if( const Xf* pStyleXf = getStyles().getStyleXf( maOoxData.mnStyleXfId ).get() )
+ if( maModel.mbCellXf )
+ if( const Xf* pStyleXf = getStyles().getStyleXf( maModel.mnStyleXfId ).get() )
updateUsedFlags( *pStyleXf );
}
FontRef Xf::getFont() const
{
- return getStyles().getFont( maOoxData.mnFontId );
+ return getStyles().getFont( maModel.mnFontId );
}
bool Xf::hasAnyUsedFlags() const
{
return
- maOoxData.mbAlignUsed || maOoxData.mbProtUsed || maOoxData.mbFontUsed ||
- maOoxData.mbNumFmtUsed || maOoxData.mbBorderUsed || maOoxData.mbAreaUsed;
+ maModel.mbAlignUsed || maModel.mbProtUsed || maModel.mbFontUsed ||
+ maModel.mbNumFmtUsed || maModel.mbBorderUsed || maModel.mbAreaUsed;
}
-void Xf::writeToPropertySet( PropertySet& rPropSet ) const
+void Xf::writeToPropertyMap( PropertyMap& rPropMap ) const
{
StylesBuffer& rStyles = getStyles();
// create and set cell style
- if( maOoxData.mbCellXf )
+ if( maModel.mbCellXf )
{
- const OUString& rStyleName = rStyles.createCellStyle( maOoxData.mnStyleXfId );
- rPropSet.setProperty( CREATE_OUSTRING( "CellStyle" ), rStyleName );
+ const OUString& rStyleName = rStyles.createCellStyle( maModel.mnStyleXfId );
+ rPropMap[ PROP_CellStyle ] <<= rStyleName;
}
- if( maOoxData.mbFontUsed )
- rStyles.writeFontToPropertySet( rPropSet, maOoxData.mnFontId );
- if( maOoxData.mbNumFmtUsed )
- rStyles.writeNumFmtToPropertySet( rPropSet, maOoxData.mnNumFmtId );
- if( maOoxData.mbAlignUsed )
- maAlignment.writeToPropertySet( rPropSet );
- if( maOoxData.mbProtUsed )
- maProtection.writeToPropertySet( rPropSet );
- if( maOoxData.mbBorderUsed )
- rStyles.writeBorderToPropertySet( rPropSet, maOoxData.mnBorderId );
- if( maOoxData.mbAreaUsed )
- rStyles.writeFillToPropertySet( rPropSet, maOoxData.mnFillId );
+ if( maModel.mbFontUsed )
+ rStyles.writeFontToPropertyMap( rPropMap, maModel.mnFontId );
+ if( maModel.mbNumFmtUsed )
+ rStyles.writeNumFmtToPropertyMap( rPropMap, maModel.mnNumFmtId );
+ if( maModel.mbAlignUsed )
+ maAlignment.writeToPropertyMap( rPropMap );
+ if( maModel.mbProtUsed )
+ maProtection.writeToPropertyMap( rPropMap );
+ if( maModel.mbBorderUsed )
+ rStyles.writeBorderToPropertyMap( rPropMap, maModel.mnBorderId );
+ if( maModel.mbAreaUsed )
+ rStyles.writeFillToPropertyMap( rPropMap, maModel.mnFillId );
+}
+
+void Xf::writeToPropertySet( PropertySet& rPropSet ) const
+{
+ PropertyMap aPropMap;
+ writeToPropertyMap( aPropMap );
+ rPropSet.setProperties( aPropMap );
}
void Xf::setBiffUsedFlags( sal_uInt8 nUsedFlags )
@@ -2263,15 +2404,15 @@ void Xf::setBiffUsedFlags( sal_uInt8 nUsedFlags )
- In cell XFs a *set* bit means a used attribute.
- In style XFs a *cleared* bit means a used attribute.
The boolean flags always store true, if the attribute is used.
- The "maOoxData.mbCellXf == getFlag(...)" construct evaluates to true in
+ The "maModel.mbCellXf == getFlag(...)" construct evaluates to true in
both mentioned cases: cell XF and set bit; or style XF and cleared bit.
*/
- maOoxData.mbFontUsed = maOoxData.mbCellXf == getFlag( nUsedFlags, BIFF_XF_FONT_USED );
- maOoxData.mbNumFmtUsed = maOoxData.mbCellXf == getFlag( nUsedFlags, BIFF_XF_NUMFMT_USED );
- maOoxData.mbAlignUsed = maOoxData.mbCellXf == getFlag( nUsedFlags, BIFF_XF_ALIGN_USED );
- maOoxData.mbProtUsed = maOoxData.mbCellXf == getFlag( nUsedFlags, BIFF_XF_PROT_USED );
- maOoxData.mbBorderUsed = maOoxData.mbCellXf == getFlag( nUsedFlags, BIFF_XF_BORDER_USED );
- maOoxData.mbAreaUsed = maOoxData.mbCellXf == getFlag( nUsedFlags, BIFF_XF_AREA_USED );
+ maModel.mbFontUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF_XF_FONT_USED );
+ maModel.mbNumFmtUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF_XF_NUMFMT_USED );
+ maModel.mbAlignUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF_XF_ALIGN_USED );
+ maModel.mbProtUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF_XF_PROT_USED );
+ maModel.mbBorderUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF_XF_BORDER_USED );
+ maModel.mbAreaUsed = maModel.mbCellXf == getFlag( nUsedFlags, BIFF_XF_AREA_USED );
}
void Xf::updateUsedFlags( const Xf& rStyleXf )
@@ -2281,19 +2422,19 @@ void Xf::updateUsedFlags( const Xf& rStyleXf )
differ from the parent style XF.
#109899# ...or if the respective flag is not set in parent style XF.
*/
- const OoxXfData& rStyleData = rStyleXf.maOoxData;
- if( !maOoxData.mbFontUsed )
- maOoxData.mbFontUsed = !rStyleData.mbFontUsed || (maOoxData.mnFontId != rStyleData.mnFontId);
- if( !maOoxData.mbNumFmtUsed )
- maOoxData.mbNumFmtUsed = !rStyleData.mbNumFmtUsed || (maOoxData.mnNumFmtId != rStyleData.mnNumFmtId);
- if( !maOoxData.mbAlignUsed )
- maOoxData.mbAlignUsed = !rStyleData.mbAlignUsed || !(maAlignment.getApiData() == rStyleXf.maAlignment.getApiData());
- if( !maOoxData.mbProtUsed )
- maOoxData.mbProtUsed = !rStyleData.mbProtUsed || !(maProtection.getApiData() == rStyleXf.maProtection.getApiData());
- if( !maOoxData.mbBorderUsed )
- maOoxData.mbBorderUsed = !rStyleData.mbBorderUsed || (maOoxData.mnBorderId != rStyleData.mnBorderId);
- if( !maOoxData.mbAreaUsed )
- maOoxData.mbAreaUsed = !rStyleData.mbAreaUsed || (maOoxData.mnFillId != rStyleData.mnFillId);
+ const XfModel& rStyleData = rStyleXf.maModel;
+ if( !maModel.mbFontUsed )
+ maModel.mbFontUsed = !rStyleData.mbFontUsed || (maModel.mnFontId != rStyleData.mnFontId);
+ if( !maModel.mbNumFmtUsed )
+ maModel.mbNumFmtUsed = !rStyleData.mbNumFmtUsed || (maModel.mnNumFmtId != rStyleData.mnNumFmtId);
+ if( !maModel.mbAlignUsed )
+ maModel.mbAlignUsed = !rStyleData.mbAlignUsed || !(maAlignment.getApiData() == rStyleXf.maAlignment.getApiData());
+ if( !maModel.mbProtUsed )
+ maModel.mbProtUsed = !rStyleData.mbProtUsed || !(maProtection.getApiData() == rStyleXf.maProtection.getApiData());
+ if( !maModel.mbBorderUsed )
+ maModel.mbBorderUsed = !rStyleData.mbBorderUsed || (maModel.mnBorderId != rStyleData.mnBorderId);
+ if( !maModel.mbAreaUsed )
+ maModel.mbAreaUsed = !rStyleData.mbAreaUsed || (maModel.mnFillId != rStyleData.mnFillId);
}
// ============================================================================
@@ -2303,12 +2444,27 @@ Dxf::Dxf( const WorkbookHelper& rHelper ) :
{
}
-FontRef Dxf::importFont( const AttributeList& )
+FontRef Dxf::createFont( bool bAlwaysNew )
{
- createFont( true );
+ if( bAlwaysNew || !mxFont )
+ mxFont.reset( new Font( *this, true ) );
return mxFont;
}
+BorderRef Dxf::createBorder( bool bAlwaysNew )
+{
+ if( bAlwaysNew || !mxBorder )
+ mxBorder.reset( new Border( *this, true ) );
+ return mxBorder;
+}
+
+FillRef Dxf::createFill( bool bAlwaysNew )
+{
+ if( bAlwaysNew || !mxFill )
+ mxFill.reset( new Fill( *this, true ) );
+ return mxFill;
+}
+
void Dxf::importNumFmt( const AttributeList& rAttribs )
{
mxNumFmt = getStyles().importNumFmt( rAttribs );
@@ -2326,19 +2482,6 @@ void Dxf::importProtection( const AttributeList& rAttribs )
mxProtection->importProtection( rAttribs );
}
-BorderRef Dxf::importBorder( const AttributeList& rAttribs )
-{
- createBorder( true );
- mxBorder->importBorder( rAttribs );
- return mxBorder;
-}
-
-FillRef Dxf::importFill( const AttributeList& )
-{
- createFill( true );
- return mxFill;
-}
-
void Dxf::importDxf( RecordInputStream& rStrm )
{
sal_Int32 nNumFmtId = -1;
@@ -2354,28 +2497,28 @@ void Dxf::importDxf( RecordInputStream& rStrm )
nRecEnd += nSubRecSize;
switch( nSubRecId )
{
- case OOBIN_DXF_FILL_PATTERN: createFill( false ); mxFill->importDxfPattern( rStrm ); break;
- case OOBIN_DXF_FILL_FGCOLOR: createFill( false ); mxFill->importDxfFgColor( rStrm ); break;
- case OOBIN_DXF_FILL_BGCOLOR: createFill( false ); mxFill->importDxfBgColor( rStrm ); break;
- case OOBIN_DXF_FILL_GRADIENT: createFill( false ); mxFill->importDxfGradient( rStrm ); break;
- case OOBIN_DXF_FILL_STOP: createFill( false ); mxFill->importDxfStop( rStrm ); break;
- case OOBIN_DXF_FONT_COLOR: createFont( false ); mxFont->importDxfColor( rStrm ); break;
- case OOBIN_DXF_BORDER_TOP: createBorder( false ); mxBorder->importDxfBorder( XLS_TOKEN( top ), rStrm ); break;
- case OOBIN_DXF_BORDER_BOTTOM: createBorder( false ); mxBorder->importDxfBorder( XLS_TOKEN( bottom ), rStrm ); break;
- case OOBIN_DXF_BORDER_LEFT: createBorder( false ); mxBorder->importDxfBorder( XLS_TOKEN( left ), rStrm ); break;
- case OOBIN_DXF_BORDER_RIGHT: createBorder( false ); mxBorder->importDxfBorder( XLS_TOKEN( right ), rStrm ); break;
- case OOBIN_DXF_FONT_NAME: createFont( false ); mxFont->importDxfName( rStrm ); break;
- case OOBIN_DXF_FONT_WEIGHT: createFont( false ); mxFont->importDxfWeight( rStrm ); break;
- case OOBIN_DXF_FONT_UNDERLINE: createFont( false ); mxFont->importDxfUnderline( rStrm ); break;
- case OOBIN_DXF_FONT_ESCAPEMENT: createFont( false ); mxFont->importDxfEscapement( rStrm ); break;
- case OOBIN_DXF_FONT_ITALIC: createFont( false ); mxFont->importDxfFlag( XML_i, rStrm ); break;
- case OOBIN_DXF_FONT_STRIKE: createFont( false ); mxFont->importDxfFlag( XML_strike, rStrm ); break;
- case OOBIN_DXF_FONT_OUTLINE: createFont( false ); mxFont->importDxfFlag( XML_outline, rStrm ); break;
- case OOBIN_DXF_FONT_SHADOW: createFont( false ); mxFont->importDxfFlag( XML_shadow, rStrm ); break;
- case OOBIN_DXF_FONT_HEIGHT: createFont( false ); mxFont->importDxfHeight( rStrm ); break;
- case OOBIN_DXF_FONT_SCHEME: createFont( false ); mxFont->importDxfScheme( rStrm ); break;
- case OOBIN_DXF_NUMFMT_CODE: aFmtCode = rStrm.readString( false ); break;
- case OOBIN_DXF_NUMFMT_ID: nNumFmtId = rStrm.readuInt16(); break;
+ case OOBIN_DXF_FILL_PATTERN: createFill( false )->importDxfPattern( rStrm ); break;
+ case OOBIN_DXF_FILL_FGCOLOR: createFill( false )->importDxfFgColor( rStrm ); break;
+ case OOBIN_DXF_FILL_BGCOLOR: createFill( false )->importDxfBgColor( rStrm ); break;
+ case OOBIN_DXF_FILL_GRADIENT: createFill( false )->importDxfGradient( rStrm ); break;
+ case OOBIN_DXF_FILL_STOP: createFill( false )->importDxfStop( rStrm ); break;
+ case OOBIN_DXF_FONT_COLOR: createFont( false )->importDxfColor( rStrm ); break;
+ case OOBIN_DXF_BORDER_TOP: createBorder( false )->importDxfBorder( XLS_TOKEN( top ), rStrm ); break;
+ case OOBIN_DXF_BORDER_BOTTOM: createBorder( false )->importDxfBorder( XLS_TOKEN( bottom ), rStrm ); break;
+ case OOBIN_DXF_BORDER_LEFT: createBorder( false )->importDxfBorder( XLS_TOKEN( left ), rStrm ); break;
+ case OOBIN_DXF_BORDER_RIGHT: createBorder( false )->importDxfBorder( XLS_TOKEN( right ), rStrm ); break;
+ case OOBIN_DXF_FONT_NAME: createFont( false )->importDxfName( rStrm ); break;
+ case OOBIN_DXF_FONT_WEIGHT: createFont( false )->importDxfWeight( rStrm ); break;
+ case OOBIN_DXF_FONT_UNDERLINE: createFont( false )->importDxfUnderline( rStrm ); break;
+ case OOBIN_DXF_FONT_ESCAPEMENT: createFont( false )->importDxfEscapement( rStrm ); break;
+ case OOBIN_DXF_FONT_ITALIC: createFont( false )->importDxfFlag( XML_i, rStrm ); break;
+ case OOBIN_DXF_FONT_STRIKE: createFont( false )->importDxfFlag( XML_strike, rStrm ); break;
+ case OOBIN_DXF_FONT_OUTLINE: createFont( false )->importDxfFlag( XML_outline, rStrm ); break;
+ case OOBIN_DXF_FONT_SHADOW: createFont( false )->importDxfFlag( XML_shadow, rStrm ); break;
+ case OOBIN_DXF_FONT_HEIGHT: createFont( false )->importDxfHeight( rStrm ); break;
+ case OOBIN_DXF_FONT_SCHEME: createFont( false )->importDxfScheme( rStrm ); break;
+ case OOBIN_DXF_NUMFMT_CODE: aFmtCode = rStrm.readString( false ); break;
+ case OOBIN_DXF_NUMFMT_ID: nNumFmtId = rStrm.readuInt16(); break;
}
rStrm.seek( nRecEnd );
}
@@ -2386,28 +2529,15 @@ void Dxf::importDxf( RecordInputStream& rStrm )
void Dxf::importCfRule( BiffInputStream& rStrm, sal_uInt32 nFlags )
{
if( getFlag( nFlags, BIFF_CFRULE_FONTBLOCK ) )
- {
- createFont( true );
- mxFont->importCfRule( rStrm );
- }
+ createFont()->importCfRule( rStrm );
if( getFlag( nFlags, BIFF_CFRULE_ALIGNBLOCK ) )
- {
rStrm.skip( 8 );
- }
if( getFlag( nFlags, BIFF_CFRULE_BORDERBLOCK ) )
- {
- createBorder( true );
- mxBorder->importCfRule( rStrm, nFlags );
- }
+ createBorder()->importCfRule( rStrm, nFlags );
if( getFlag( nFlags, BIFF_CFRULE_FILLBLOCK ) )
- {
- createFill( true );
- mxFill->importCfRule( rStrm, nFlags );
- }
+ createFill()->importCfRule( rStrm, nFlags );
if( getFlag( nFlags, BIFF_CFRULE_PROTBLOCK ) )
- {
rStrm.skip( 2 );
- }
}
void Dxf::finalizeImport()
@@ -2432,41 +2562,25 @@ const OUString& Dxf::createDxfStyle( sal_Int32 nDxfId )
maFinalName = OUStringBuffer( CREATE_OUSTRING( "ConditionalStyle_" ) ).append( nDxfId + 1 ).makeStringAndClear();
Reference< XStyle > xStyle = createStyleObject( maFinalName, false );
// write style formatting properties
- PropertySet aPropSet( xStyle );
+ PropertyMap aPropMap;
if( mxFont.get() )
- mxFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_CELL );
+ mxFont->writeToPropertyMap( aPropMap, FONT_PROPTYPE_CELL );
if( mxNumFmt.get() )
- mxNumFmt->writeToPropertySet( aPropSet );
+ mxNumFmt->writeToPropertyMap( aPropMap );
if( mxAlignment.get() )
- mxAlignment->writeToPropertySet( aPropSet );
+ mxAlignment->writeToPropertyMap( aPropMap );
if( mxProtection.get() )
- mxProtection->writeToPropertySet( aPropSet );
+ mxProtection->writeToPropertyMap( aPropMap );
if( mxBorder.get() )
- mxBorder->writeToPropertySet( aPropSet );
+ mxBorder->writeToPropertyMap( aPropMap );
if( mxFill.get() )
- mxFill->writeToPropertySet( aPropSet );
+ mxFill->writeToPropertyMap( aPropMap );
+ PropertySet aPropSet( xStyle );
+ aPropSet.setProperties( aPropMap );
}
return maFinalName;
}
-void Dxf::createFont( bool bAlwaysNew )
-{
- if( bAlwaysNew || !mxFont )
- mxFont.reset( new Font( *this, true ) );
-}
-
-void Dxf::createBorder( bool bAlwaysNew )
-{
- if( bAlwaysNew || !mxBorder )
- mxBorder.reset( new Border( *this, true ) );
-}
-
-void Dxf::createFill( bool bAlwaysNew )
-{
- if( bAlwaysNew || !mxFill )
- mxFill.reset( new Fill( *this, true ) );
-}
-
// ============================================================================
namespace {
@@ -2670,7 +2784,7 @@ bool lclGetBuiltinStyleId( sal_Int32& rnBuiltinId, sal_Int32& rnLevel, const OUS
// ----------------------------------------------------------------------------
-OoxCellStyleData::OoxCellStyleData() :
+CellStyleModel::CellStyleModel() :
mnXfId( -1 ),
mnBuiltinId( -1 ),
mnLevel( 0 ),
@@ -2680,12 +2794,12 @@ OoxCellStyleData::OoxCellStyleData() :
{
}
-bool OoxCellStyleData::isDefaultStyle() const
+bool CellStyleModel::isDefaultStyle() const
{
return mbBuiltin && (mnBuiltinId == OOX_STYLE_NORMAL);
}
-OUString OoxCellStyleData::createStyleName() const
+OUString CellStyleModel::createStyleName() const
{
return isBuiltin() ? lclGetBuiltinStyleName( mnBuiltinId, maName, mnLevel ) : maName;
}
@@ -2699,56 +2813,56 @@ CellStyle::CellStyle( const WorkbookHelper& rHelper ) :
void CellStyle::importCellStyle( const AttributeList& rAttribs )
{
- maOoxData.maName = rAttribs.getString( XML_name, OUString() );
- maOoxData.mnXfId = rAttribs.getInteger( XML_xfId, -1 );
- maOoxData.mnBuiltinId = rAttribs.getInteger( XML_builtinId, -1 );
- maOoxData.mnLevel = rAttribs.getInteger( XML_iLevel, 0 );
- maOoxData.mbBuiltin = rAttribs.hasAttribute( XML_builtinId );
- maOoxData.mbCustom = rAttribs.getBool( XML_customBuiltin, false );
- maOoxData.mbHidden = rAttribs.getBool( XML_hidden, false );
+ maModel.maName = rAttribs.getString( XML_name, OUString() );
+ maModel.mnXfId = rAttribs.getInteger( XML_xfId, -1 );
+ maModel.mnBuiltinId = rAttribs.getInteger( XML_builtinId, -1 );
+ maModel.mnLevel = rAttribs.getInteger( XML_iLevel, 0 );
+ maModel.mbBuiltin = rAttribs.hasAttribute( XML_builtinId );
+ maModel.mbCustom = rAttribs.getBool( XML_customBuiltin, false );
+ maModel.mbHidden = rAttribs.getBool( XML_hidden, false );
}
void CellStyle::importCellStyle( RecordInputStream& rStrm )
{
sal_uInt16 nFlags;
- rStrm >> maOoxData.mnXfId >> nFlags;
- maOoxData.mnBuiltinId = rStrm.readuInt8();
- maOoxData.mnLevel = rStrm.readuInt8();
- rStrm >> maOoxData.maName;
- maOoxData.mbBuiltin = getFlag( nFlags, OOBIN_CELLSTYLE_BUILTIN );
- maOoxData.mbCustom = getFlag( nFlags, OOBIN_CELLSTYLE_CUSTOM );
- maOoxData.mbHidden = getFlag( nFlags, OOBIN_CELLSTYLE_HIDDEN );
+ rStrm >> maModel.mnXfId >> nFlags;
+ maModel.mnBuiltinId = rStrm.readuInt8();
+ maModel.mnLevel = rStrm.readuInt8();
+ rStrm >> maModel.maName;
+ maModel.mbBuiltin = getFlag( nFlags, OOBIN_CELLSTYLE_BUILTIN );
+ maModel.mbCustom = getFlag( nFlags, OOBIN_CELLSTYLE_CUSTOM );
+ maModel.mbHidden = getFlag( nFlags, OOBIN_CELLSTYLE_HIDDEN );
}
void CellStyle::importStyle( BiffInputStream& rStrm )
{
sal_uInt16 nStyleXf;
rStrm >> nStyleXf;
- maOoxData.mnXfId = static_cast< sal_Int32 >( nStyleXf & BIFF_STYLE_XFMASK );
- maOoxData.mbBuiltin = getFlag( nStyleXf, BIFF_STYLE_BUILTIN );
- if( maOoxData.mbBuiltin )
+ maModel.mnXfId = static_cast< sal_Int32 >( nStyleXf & BIFF_STYLE_XFMASK );
+ maModel.mbBuiltin = getFlag( nStyleXf, BIFF_STYLE_BUILTIN );
+ if( maModel.mbBuiltin )
{
- maOoxData.mnBuiltinId = rStrm.readuInt8();
- maOoxData.mnLevel = rStrm.readuInt8();
+ maModel.mnBuiltinId = rStrm.readuInt8();
+ maModel.mnLevel = rStrm.readuInt8();
}
else
{
- maOoxData.maName = (getBiff() == BIFF8) ?
+ maModel.maName = (getBiff() == BIFF8) ?
rStrm.readUniString() : rStrm.readByteString( false, getTextEncoding() );
}
}
const OUString& CellStyle::createCellStyle( sal_Int32 nXfId, bool bSkipDefaultBuiltin )
{
- if( maFinalName.getLength() == 0 )
+ if( maCalcName.getLength() == 0 )
{
- bool bBuiltin = maOoxData.isBuiltin();
- if( !bSkipDefaultBuiltin || !bBuiltin || maOoxData.mbCustom )
+ bool bBuiltin = maModel.isBuiltin();
+ if( !bSkipDefaultBuiltin || !bBuiltin || maModel.mbCustom )
{
// name of the style (generate unique name for builtin styles)
- maFinalName = maOoxData.createStyleName();
+ maCalcName = maModel.createStyleName();
// #i1624# #i1768# ignore unnamed user styles
- if( maFinalName.getLength() > 0 )
+ if( maCalcName.getLength() > 0 )
{
Reference< XStyle > xStyle;
#if OOX_XLS_USE_DEFAULT_STYLE
@@ -2760,19 +2874,17 @@ const OUString& CellStyle::createCellStyle( sal_Int32 nXfId, bool bSkipDefaultBu
if( Xf* pXf = getStyles().getStyleXf( nXfId ).get() )
pXf->setAllUsedFlags( true );
// use existing built-in style
- xStyle = getStyleObject( maFinalName, false );
+ xStyle = getStyleObject( maCalcName, false );
}
else
- {
#endif
+ {
/* Insert into cell styles collection, rename existing user styles,
if this is a built-in style, but do not do this in BIFF4 workspace
files, where built-in styles occur repeatedly. */
bool bRenameExisting = bBuiltin && (getBiff() != BIFF4);
- xStyle = createStyleObject( maFinalName, false, bRenameExisting );
-#if OOX_XLS_USE_DEFAULT_STYLE
+ xStyle = createStyleObject( maCalcName, false, bRenameExisting );
}
-#endif
// write style formatting properties
PropertySet aPropSet( xStyle );
@@ -2785,7 +2897,7 @@ const OUString& CellStyle::createCellStyle( sal_Int32 nXfId, bool bSkipDefaultBu
}
}
}
- return maFinalName;
+ return maCalcName;
}
// ============================================================================
@@ -2857,50 +2969,11 @@ void StylesBuffer::importPaletteColor( const AttributeList& rAttribs )
maPalette.importPaletteColor( rAttribs );
}
-FontRef StylesBuffer::importFont( const AttributeList& )
-{
- return createFont();
-}
-
NumberFormatRef StylesBuffer::importNumFmt( const AttributeList& rAttribs )
{
return maNumFmts.importNumFmt( rAttribs );
}
-BorderRef StylesBuffer::importBorder( const AttributeList& rAttribs )
-{
- BorderRef xBorder = createBorder();
- xBorder->importBorder( rAttribs );
- return xBorder;
-}
-
-FillRef StylesBuffer::importFill( const AttributeList& )
-{
- return createFill();
-}
-
-XfRef StylesBuffer::importXf( sal_Int32 nContext, const AttributeList& rAttribs )
-{
- XfRef xXf;
- switch( nContext )
- {
- case XLS_TOKEN( cellXfs ):
- xXf = createCellXf();
- xXf->importXf( rAttribs, true );
- break;
- case XLS_TOKEN( cellStyleXfs ):
- xXf = createStyleXf();
- xXf->importXf( rAttribs, false );
- break;
- }
- return xXf;
-}
-
-DxfRef StylesBuffer::importDxf( const AttributeList& )
-{
- return createDxf();
-}
-
CellStyleRef StylesBuffer::importCellStyle( const AttributeList& rAttribs )
{
CellStyleRef xCellStyle( new CellStyle( *this ) );
@@ -2914,44 +2987,11 @@ void StylesBuffer::importPaletteColor( RecordInputStream& rStrm )
maPalette.importPaletteColor( rStrm );
}
-void StylesBuffer::importFont( RecordInputStream& rStrm )
-{
- createFont()->importFont( rStrm );
-}
-
void StylesBuffer::importNumFmt( RecordInputStream& rStrm )
{
maNumFmts.importNumFmt( rStrm );
}
-void StylesBuffer::importBorder( RecordInputStream& rStrm )
-{
- createBorder()->importBorder( rStrm );
-}
-
-void StylesBuffer::importFill( RecordInputStream& rStrm )
-{
- createFill()->importFill( rStrm );
-}
-
-void StylesBuffer::importXf( sal_Int32 nContext, RecordInputStream& rStrm )
-{
- switch( nContext )
- {
- case OOBIN_ID_CELLXFS:
- createCellXf()->importXf( rStrm, true );
- break;
- case OOBIN_ID_CELLSTYLEXFS:
- createStyleXf()->importXf( rStrm, false );
- break;
- }
-}
-
-void StylesBuffer::importDxf( RecordInputStream& rStrm )
-{
- createDxf()->importDxf( rStrm );
-}
-
void StylesBuffer::importCellStyle( RecordInputStream& rStrm )
{
CellStyleRef xCellStyle( new CellStyle( *this ) );
@@ -3016,7 +3056,7 @@ void StylesBuffer::finalizeImport()
{
// fonts first, are needed to finalize unit converter and XFs below
maFonts.forEachMem( &Font::finalizeImport );
- // finalize unit converter after default font is known
+ // finalize unit coefficients after default font is known
getUnitConverter().finalizeImport();
// number formats
maNumFmts.finalizeImport();
@@ -3091,10 +3131,10 @@ FontRef StylesBuffer::getDefaultFont() const
return xDefFont;
}
-const OoxFontData& StylesBuffer::getDefaultFontData() const
+const FontModel& StylesBuffer::getDefaultFontModel() const
{
FontRef xDefFont = getDefaultFont();
- return xDefFont.get() ? xDefFont->getFontData() : getTheme().getDefaultFontData();
+ return xDefFont.get() ? xDefFont->getModel() : getTheme().getDefaultFontModel();
}
const OUString& StylesBuffer::createCellStyle( sal_Int32 nXfId ) const
@@ -3121,27 +3161,39 @@ const OUString& StylesBuffer::getDefaultStyleName() const
}
#endif
-void StylesBuffer::writeFontToPropertySet( PropertySet& rPropSet, sal_Int32 nFontId ) const
+void StylesBuffer::writeFontToPropertyMap( PropertyMap& rPropMap, sal_Int32 nFontId ) const
{
if( Font* pFont = maFonts.get( nFontId ).get() )
- pFont->writeToPropertySet( rPropSet, FONT_PROPTYPE_CELL );
+ pFont->writeToPropertyMap( rPropMap, FONT_PROPTYPE_CELL );
}
-void StylesBuffer::writeNumFmtToPropertySet( PropertySet& rPropSet, sal_Int32 nNumFmtId ) const
+void StylesBuffer::writeNumFmtToPropertyMap( PropertyMap& rPropMap, sal_Int32 nNumFmtId ) const
{
- maNumFmts.writeToPropertySet( rPropSet, nNumFmtId );
+ maNumFmts.writeToPropertyMap( rPropMap, nNumFmtId );
}
-void StylesBuffer::writeBorderToPropertySet( PropertySet& rPropSet, sal_Int32 nBorderId ) const
+void StylesBuffer::writeBorderToPropertyMap( PropertyMap& rPropMap, sal_Int32 nBorderId ) const
{
if( Border* pBorder = maBorders.get( nBorderId ).get() )
- pBorder->writeToPropertySet( rPropSet );
+ pBorder->writeToPropertyMap( rPropMap );
}
-void StylesBuffer::writeFillToPropertySet( PropertySet& rPropSet, sal_Int32 nFillId ) const
+void StylesBuffer::writeFillToPropertyMap( PropertyMap& rPropMap, sal_Int32 nFillId ) const
{
if( Fill* pFill = maFills.get( nFillId ).get() )
- pFill->writeToPropertySet( rPropSet );
+ pFill->writeToPropertyMap( rPropMap );
+}
+
+void StylesBuffer::writeCellXfToPropertyMap( PropertyMap& rPropMap, sal_Int32 nXfId ) const
+{
+ if( Xf* pXf = maCellXfs.get( nXfId ).get() )
+ pXf->writeToPropertyMap( rPropMap );
+}
+
+void StylesBuffer::writeStyleXfToPropertyMap( PropertyMap& rPropMap, sal_Int32 nXfId ) const
+{
+ if( Xf* pXf = maStyleXfs.get( nXfId ).get() )
+ pXf->writeToPropertyMap( rPropMap );
}
void StylesBuffer::writeCellXfToPropertySet( PropertySet& rPropSet, sal_Int32 nXfId ) const
diff --git a/oox/source/xls/stylesfragment.cxx b/oox/source/xls/stylesfragment.cxx
index f6e4502409b0..194c2605f38f 100644
--- a/oox/source/xls/stylesfragment.cxx
+++ b/oox/source/xls/stylesfragment.cxx
@@ -32,6 +32,7 @@
#include "oox/helper/attributelist.hxx"
using ::rtl::OUString;
+using ::oox::core::ContextHandlerRef;
using ::oox::core::RecordInfo;
namespace oox {
@@ -39,263 +40,262 @@ namespace xls {
// ============================================================================
-OoxStylesFragment::OoxStylesFragment(
- const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
- OoxWorkbookFragmentBase( rHelper, rFragmentPath ),
- mfGradPos( -1.0 )
+OoxIndexedColorsContext::OoxIndexedColorsContext( OoxWorkbookFragmentBase& rFragment ) :
+ OoxWorkbookContextBase( rFragment )
{
}
-// oox.core.ContextHandler2Helper interface -----------------------------------
+ContextHandlerRef OoxIndexedColorsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case XLS_TOKEN( indexedColors ):
+ if( nElement == XLS_TOKEN( rgbColor ) ) getStyles().importPaletteColor( rAttribs );
+ break;
+ }
+ return 0;
+}
-ContextWrapper OoxStylesFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxIndexedColorsContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
{
- sal_Int32 nCurrContext = getCurrentElement();
- switch( nCurrContext )
+ switch( getCurrentElement() )
{
- case XML_ROOT_CONTEXT:
- return (nElement == XLS_TOKEN( styleSheet ));
- case XLS_TOKEN( styleSheet ):
- return (nElement == XLS_TOKEN( colors )) ||
- (nElement == XLS_TOKEN( fonts )) ||
- (nElement == XLS_TOKEN( numFmts )) ||
- (nElement == XLS_TOKEN( borders )) ||
- (nElement == XLS_TOKEN( fills )) ||
- (nElement == XLS_TOKEN( cellXfs )) ||
- (nElement == XLS_TOKEN( cellStyleXfs )) ||
- (nElement == XLS_TOKEN( dxfs )) ||
- (nElement == XLS_TOKEN( cellStyles ));
+ case OOBIN_ID_INDEXEDCOLORS:
+ if( nRecId == OOBIN_ID_RGBCOLOR ) getStyles().importPaletteColor( rStrm );
+ break;
+ }
+ return 0;
+}
- case XLS_TOKEN( colors ):
- return (nElement == XLS_TOKEN( indexedColors ));
- case XLS_TOKEN( indexedColors ):
- return (nElement == XLS_TOKEN( rgbColor ));
+// ============================================================================
- case XLS_TOKEN( fonts ):
- return (nElement == XLS_TOKEN( font ));
- case XLS_TOKEN( font ):
- return mxFont.get() && Font::isSupportedContext( nElement, nCurrContext );
+ContextHandlerRef OoxFontContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ if( mxFont.get() )
+ mxFont->importAttribs( nElement, rAttribs );
+ return 0;
+}
- case XLS_TOKEN( numFmts ):
- return (nElement == XLS_TOKEN( numFmt ));
+// ============================================================================
- case XLS_TOKEN( borders ):
- return (nElement == XLS_TOKEN( border ));
+void OoxBorderContext::onStartElement( const AttributeList& rAttribs )
+{
+ if( mxBorder.get() && (getCurrentElement() == XLS_TOKEN( border )) )
+ mxBorder->importBorder( rAttribs );
+}
+
+ContextHandlerRef OoxBorderContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ if( mxBorder.get() ) switch( getCurrentElement() )
+ {
case XLS_TOKEN( border ):
- case XLS_TOKEN( left ):
- case XLS_TOKEN( right ):
- case XLS_TOKEN( top ):
- case XLS_TOKEN( bottom ):
- case XLS_TOKEN( diagonal ):
- return mxBorder.get() && Border::isSupportedContext( nElement, nCurrContext );
+ mxBorder->importStyle( nElement, rAttribs );
+ return this;
- case XLS_TOKEN( fills ):
- return (nElement == XLS_TOKEN( fill ));
+ default:
+ if( nElement == XLS_TOKEN( color ) )
+ mxBorder->importColor( getCurrentElement(), rAttribs );
+ }
+ return 0;
+}
+
+// ============================================================================
+
+ContextHandlerRef OoxFillContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ if( mxFill.get() ) switch( getCurrentElement() )
+ {
case XLS_TOKEN( fill ):
+ switch( nElement )
+ {
+ case XLS_TOKEN( patternFill ): mxFill->importPatternFill( rAttribs ); return this;
+ case XLS_TOKEN( gradientFill ): mxFill->importGradientFill( rAttribs ); return this;
+ }
+ break;
case XLS_TOKEN( patternFill ):
+ switch( nElement )
+ {
+ case XLS_TOKEN( fgColor ): mxFill->importFgColor( rAttribs ); break;
+ case XLS_TOKEN( bgColor ): mxFill->importBgColor( rAttribs ); break;
+ }
+ break;
case XLS_TOKEN( gradientFill ):
+ if( nElement == XLS_TOKEN( stop ) )
+ {
+ mfGradPos = rAttribs.getDouble( XML_position, -1.0 );
+ return this;
+ }
+ break;
case XLS_TOKEN( stop ):
- return mxFill.get() && Fill::isSupportedContext( nElement, nCurrContext );
-
- case XLS_TOKEN( cellStyleXfs ):
- case XLS_TOKEN( cellXfs ):
- return (nElement == XLS_TOKEN( xf ));
- case XLS_TOKEN( xf ):
- return mxXf.get() &&
- ((nElement == XLS_TOKEN( alignment )) ||
- (nElement == XLS_TOKEN( protection )));
-
- case XLS_TOKEN( dxfs ):
- return (nElement == XLS_TOKEN( dxf ));
- case XLS_TOKEN( dxf ):
- return mxDxf.get() &&
- ((nElement == XLS_TOKEN( font )) ||
- (nElement == XLS_TOKEN( numFmt )) ||
- (nElement == XLS_TOKEN( alignment )) ||
- (nElement == XLS_TOKEN( protection )) ||
- (nElement == XLS_TOKEN( border )) ||
- (nElement == XLS_TOKEN( fill )));
-
- case XLS_TOKEN( cellStyles ):
- return (nElement == XLS_TOKEN( cellStyle ));
+ if( nElement == XLS_TOKEN( color ) )
+ mxFill->importColor( rAttribs, mfGradPos );
+ break;
}
- return false;
+ return 0;
}
-void OoxStylesFragment::onStartElement( const AttributeList& rAttribs )
+// ============================================================================
+
+void OoxXfContext::onStartElement( const AttributeList& rAttribs )
{
- sal_Int32 nCurrContext = getCurrentElement();
- sal_Int32 nPrevContext = getPreviousElement();
+ if( mxXf.get() && (getCurrentElement() == XLS_TOKEN( xf )) )
+ mxXf->importXf( rAttribs, mbCellXf );
+}
- switch( nCurrContext )
+ContextHandlerRef OoxXfContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ if( mxXf.get() ) switch( getCurrentElement() )
{
- case XLS_TOKEN( color ):
- switch( nPrevContext )
+ case XLS_TOKEN( xf ):
+ switch( nElement )
{
- case XLS_TOKEN( font ):
- OSL_ENSURE( mxFont.get(), "OoxStylesFragment::onStartElement - missing font object" );
- mxFont->importAttribs( nCurrContext, rAttribs );
- break;
- case XLS_TOKEN( stop ):
- OSL_ENSURE( mxFill.get(), "OoxStylesFragment::onStartElement - missing fill object" );
- mxFill->importColor( rAttribs, mfGradPos );
- break;
- default:
- OSL_ENSURE( mxBorder.get(), "OoxStylesFragment::onStartElement - missing border object" );
- mxBorder->importColor( nPrevContext, rAttribs );
+ case XLS_TOKEN( alignment ): mxXf->importAlignment( rAttribs ); break;
+ case XLS_TOKEN( protection ): mxXf->importProtection( rAttribs ); break;
}
break;
- case XLS_TOKEN( rgbColor ):
- getStyles().importPaletteColor( rAttribs );
- break;
+ }
+ return 0;
+}
- case XLS_TOKEN( font ):
- mxFont = mxDxf.get() ? mxDxf->importFont( rAttribs ) : getStyles().importFont( rAttribs );
- break;
+// ============================================================================
- case XLS_TOKEN( numFmt ):
- if( mxDxf.get() )
- mxDxf->importNumFmt( rAttribs );
- else
- getStyles().importNumFmt( rAttribs );
- break;
+ContextHandlerRef OoxDxfContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ if( mxDxf.get() ) switch( getCurrentElement() )
+ {
+ case XLS_TOKEN( dxf ):
+ switch( nElement )
+ {
+ case XLS_TOKEN( font ): return new OoxFontContext( *this, mxDxf->createFont() );
+ case XLS_TOKEN( border ): return new OoxBorderContext( *this, mxDxf->createBorder() );
+ case XLS_TOKEN( fill ): return new OoxFillContext( *this, mxDxf->createFill() );
- case XLS_TOKEN( alignment ):
- OSL_ENSURE( mxXf.get() || mxDxf.get(), "OoxStylesFragment::onStartElement - missing formatting object" );
- if( mxXf.get() )
- mxXf->importAlignment( rAttribs );
+ case XLS_TOKEN( numFmt ): mxDxf->importNumFmt( rAttribs ); break;
#if 0
- else if( mxDxf.get() )
- mxDxf->importAlignment( rAttribs );
+ case XLS_TOKEN( alignment ): mxDxf->importAlignment( rAttribs ); break;
+ case XLS_TOKEN( protection ): mxDxf->importProtection( rAttribs ); break;
#endif
+ }
break;
+ }
+ return 0;
+}
- case XLS_TOKEN( protection ):
- OSL_ENSURE( mxXf.get() || mxDxf.get(), "OoxStylesFragment::onStartElement - missing formatting object" );
- if( mxXf.get() )
- mxXf->importProtection( rAttribs );
-#if 0
- else if( mxDxf.get() )
- mxDxf->importProtection( rAttribs );
-#endif
+// ============================================================================
+
+OoxStylesFragment::OoxStylesFragment( const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
+ OoxWorkbookFragmentBase( rHelper, rFragmentPath )
+{
+}
+
+// oox.core.ContextHandler2Helper interface -----------------------------------
+
+ContextHandlerRef OoxStylesFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case XML_ROOT_CONTEXT:
+ if( nElement == XLS_TOKEN( styleSheet ) ) return this;
break;
- case XLS_TOKEN( border ):
- mxBorder = mxDxf.get() ? mxDxf->importBorder( rAttribs ) : getStyles().importBorder( rAttribs );
+ case XLS_TOKEN( styleSheet ):
+ switch( nElement )
+ {
+ case XLS_TOKEN( colors ):
+ case XLS_TOKEN( numFmts ):
+ case XLS_TOKEN( fonts ):
+ case XLS_TOKEN( borders ):
+ case XLS_TOKEN( fills ):
+ case XLS_TOKEN( cellXfs ):
+ case XLS_TOKEN( cellStyleXfs ):
+ case XLS_TOKEN( dxfs ):
+ case XLS_TOKEN( cellStyles ): return this;
+ }
break;
- case XLS_TOKEN( fill ):
- mxFill = mxDxf.get() ? mxDxf->importFill( rAttribs ) : getStyles().importFill( rAttribs );
+ case XLS_TOKEN( colors ):
+ if( nElement == XLS_TOKEN( indexedColors ) ) return new OoxIndexedColorsContext( *this );
break;
- case XLS_TOKEN( patternFill ):
- OSL_ENSURE( mxFill.get(), "OoxStylesFragment::onStartElement - missing fill object" );
- mxFill->importPatternFill( rAttribs );
+ case XLS_TOKEN( numFmts ):
+ if( nElement == XLS_TOKEN( numFmt ) ) getStyles().importNumFmt( rAttribs );
break;
- case XLS_TOKEN( fgColor ):
- OSL_ENSURE( mxFill.get(), "OoxStylesFragment::onStartElement - missing fill object" );
- mxFill->importFgColor( rAttribs );
+ case XLS_TOKEN( fonts ):
+ if( nElement == XLS_TOKEN( font ) ) return new OoxFontContext( *this, getStyles().createFont() );
break;
- case XLS_TOKEN( bgColor ):
- OSL_ENSURE( mxFill.get(), "OoxStylesFragment::onStartElement - missing fill object" );
- mxFill->importBgColor( rAttribs );
+ case XLS_TOKEN( borders ):
+ if( nElement == XLS_TOKEN( border ) ) return new OoxBorderContext( *this, getStyles().createBorder() );
break;
- case XLS_TOKEN( gradientFill ):
- OSL_ENSURE( mxFill.get(), "OoxStylesFragment::onStartElement - missing fill object" );
- mxFill->importGradientFill( rAttribs );
+ case XLS_TOKEN( fills ):
+ if( nElement == XLS_TOKEN( fill ) ) return new OoxFillContext( *this, getStyles().createFill() );
break;
- case XLS_TOKEN( stop ):
- mfGradPos = rAttribs.getDouble( XML_position, -1.0 );
+ case XLS_TOKEN( cellXfs ):
+ if( nElement == XLS_TOKEN( xf ) ) return new OoxXfContext( *this, getStyles().createCellXf(), true );
break;
-
- case XLS_TOKEN( xf ):
- mxXf = getStyles().importXf( nPrevContext, rAttribs );
+ case XLS_TOKEN( cellStyleXfs ):
+ if( nElement == XLS_TOKEN( xf ) ) return new OoxXfContext( *this, getStyles().createStyleXf(), false );
break;
- case XLS_TOKEN( dxf ):
- mxDxf = getStyles().importDxf( rAttribs );
+ case XLS_TOKEN( dxfs ):
+ if( nElement == XLS_TOKEN( dxf ) ) return new OoxDxfContext( *this, getStyles().createDxf() );
break;
-
- case XLS_TOKEN( cellStyle ):
- getStyles().importCellStyle( rAttribs );
+ case XLS_TOKEN( cellStyles ):
+ if( nElement == XLS_TOKEN( cellStyle ) ) getStyles().importCellStyle( rAttribs );
break;
-
- default: switch( nPrevContext )
- {
- case XLS_TOKEN( font ):
- OSL_ENSURE( mxFont.get(), "OoxStylesFragment::onStartElement - missing font object" );
- mxFont->importAttribs( nCurrContext, rAttribs );
- break;
- case XLS_TOKEN( border ):
- OSL_ENSURE( mxBorder.get(), "OoxStylesFragment::onStartElement - missing border object" );
- mxBorder->importStyle( nCurrContext, rAttribs );
- break;
- }
- }
-}
-
-void OoxStylesFragment::onEndElement( const OUString& /*rChars*/ )
-{
- switch( getCurrentElement() )
- {
- case XLS_TOKEN( font ): mxFont.reset(); break;
- case XLS_TOKEN( border ): mxBorder.reset(); break;
- case XLS_TOKEN( fill ): mxFill.reset(); break;
- case XLS_TOKEN( xf ): mxXf.reset(); break;
- case XLS_TOKEN( dxf ): mxDxf.reset(); break;
}
+ return 0;
}
-ContextWrapper OoxStylesFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& )
+ContextHandlerRef OoxStylesFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nRecId == OOBIN_ID_STYLESHEET);
+ if( nRecId == OOBIN_ID_STYLESHEET ) return this;
+ break;
+
case OOBIN_ID_STYLESHEET:
- return (nRecId == OOBIN_ID_COLORS) ||
- (nRecId == OOBIN_ID_FONTS) ||
- (nRecId == OOBIN_ID_NUMFMTS) ||
- (nRecId == OOBIN_ID_BORDERS) ||
- (nRecId == OOBIN_ID_FILLS) ||
- (nRecId == OOBIN_ID_CELLSTYLEXFS) ||
- (nRecId == OOBIN_ID_CELLXFS) ||
- (nRecId == OOBIN_ID_DXFS) ||
- (nRecId == OOBIN_ID_CELLSTYLES);
+ switch( nRecId )
+ {
+ case OOBIN_ID_COLORS:
+ case OOBIN_ID_NUMFMTS:
+ case OOBIN_ID_FONTS:
+ case OOBIN_ID_BORDERS:
+ case OOBIN_ID_FILLS:
+ case OOBIN_ID_CELLXFS:
+ case OOBIN_ID_CELLSTYLEXFS:
+ case OOBIN_ID_DXFS:
+ case OOBIN_ID_CELLSTYLES: return this;
+ }
+ break;
+
case OOBIN_ID_COLORS:
- return (nRecId == OOBIN_ID_INDEXEDCOLORS);
- case OOBIN_ID_INDEXEDCOLORS:
- return (nRecId == OOBIN_ID_RGBCOLOR);
- case OOBIN_ID_FONTS:
- return (nRecId == OOBIN_ID_FONT);
+ if( nRecId == OOBIN_ID_INDEXEDCOLORS ) return new OoxIndexedColorsContext( *this );
+ break;
case OOBIN_ID_NUMFMTS:
- return (nRecId == OOBIN_ID_NUMFMT);
+ if( nRecId == OOBIN_ID_NUMFMT ) getStyles().importNumFmt( rStrm );
+ break;
+ case OOBIN_ID_FONTS:
+ if( nRecId == OOBIN_ID_FONT ) getStyles().createFont()->importFont( rStrm );
+ break;
case OOBIN_ID_BORDERS:
- return (nRecId == OOBIN_ID_BORDER);
+ if( nRecId == OOBIN_ID_BORDER ) getStyles().createBorder()->importBorder( rStrm );
+ break;
case OOBIN_ID_FILLS:
- return (nRecId == OOBIN_ID_FILL);
- case OOBIN_ID_CELLSTYLEXFS:
+ if( nRecId == OOBIN_ID_FILL ) getStyles().createFill()->importFill( rStrm );
+ break;
case OOBIN_ID_CELLXFS:
- return (nRecId == OOBIN_ID_XF);
+ if( nRecId == OOBIN_ID_XF ) getStyles().createCellXf()->importXf( rStrm, true );
+ break;
+ case OOBIN_ID_CELLSTYLEXFS:
+ if( nRecId == OOBIN_ID_XF ) getStyles().createStyleXf()->importXf( rStrm, false );
+ break;
case OOBIN_ID_DXFS:
- return (nRecId == OOBIN_ID_DXF);
+ if( nRecId == OOBIN_ID_DXF ) getStyles().createDxf()->importDxf( rStrm );
+ break;
case OOBIN_ID_CELLSTYLES:
- return (nRecId == OOBIN_ID_CELLSTYLE);
- }
- return false;
-}
-
-void OoxStylesFragment::onStartRecord( RecordInputStream& rStrm )
-{
- switch( getCurrentElement() )
- {
- case OOBIN_ID_RGBCOLOR: getStyles().importPaletteColor( rStrm ); break;
- case OOBIN_ID_FONT: getStyles().importFont( rStrm ); break;
- case OOBIN_ID_NUMFMT: getStyles().importNumFmt( rStrm ); break;
- case OOBIN_ID_BORDER: getStyles().importBorder( rStrm ); break;
- case OOBIN_ID_FILL: getStyles().importFill( rStrm ); break;
- case OOBIN_ID_XF: getStyles().importXf( getPreviousElement(), rStrm ); break;
- case OOBIN_ID_DXF: getStyles().importDxf( rStrm ); break;
- case OOBIN_ID_CELLSTYLE: getStyles().importCellStyle( rStrm ); break;
+ if( nRecId == OOBIN_ID_CELLSTYLE ) getStyles().importCellStyle( rStrm );
+ break;
}
+ return 0;
}
// oox.core.FragmentHandler2 interface ----------------------------------------
diff --git a/oox/source/xls/stylespropertyhelper.cxx b/oox/source/xls/stylespropertyhelper.cxx
deleted file mode 100644
index ae2aa1439b94..000000000000
--- a/oox/source/xls/stylespropertyhelper.cxx
+++ /dev/null
@@ -1,393 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: stylespropertyhelper.cxx,v $
- * $Revision: 1.3.22.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "oox/xls/stylespropertyhelper.hxx"
-#include <com/sun/star/awt/FontFamily.hpp>
-#include <com/sun/star/awt/FontWeight.hpp>
-#include <com/sun/star/awt/FontSlant.hpp>
-#include <com/sun/star/awt/FontUnderline.hpp>
-#include <com/sun/star/awt/FontStrikeout.hpp>
-#include <com/sun/star/awt/FontPitch.hpp>
-#include <com/sun/star/awt/FontType.hpp>
-#include <com/sun/star/text/WritingMode2.hpp>
-#include "oox/helper/propertyset.hxx"
-#include "oox/xls/stylesbuffer.hxx"
-
-using ::rtl::OUString;
-using ::com::sun::star::awt::FontDescriptor;
-
-namespace oox {
-namespace xls {
-
-// ============================================================================
-
-ApiFontUsedFlags::ApiFontUsedFlags( bool bAllUsed ) :
- mbNameUsed( bAllUsed ),
- mbColorUsed( bAllUsed ),
- mbSchemeUsed( bAllUsed ),
- mbHeightUsed( bAllUsed ),
- mbUnderlineUsed( bAllUsed ),
- mbEscapementUsed( bAllUsed ),
- mbWeightUsed( bAllUsed ),
- mbPostureUsed( bAllUsed ),
- mbStrikeoutUsed( bAllUsed ),
- mbOutlineUsed( bAllUsed ),
- mbShadowUsed( bAllUsed )
-{
-}
-
-// ----------------------------------------------------------------------------
-
-ApiScriptFontName::ApiScriptFontName() :
- mnFamily( ::com::sun::star::awt::FontFamily::DONTKNOW ),
- mnCharSet( RTL_TEXTENCODING_DONTKNOW )
-{
-}
-
-// ----------------------------------------------------------------------------
-
-ApiFontData::ApiFontData() :
- maDesc(
- CREATE_OUSTRING( "Calibri" ),
- 220, // height 11 points
- 0,
- OUString(),
- ::com::sun::star::awt::FontFamily::DONTKNOW,
- RTL_TEXTENCODING_DONTKNOW,
- ::com::sun::star::awt::FontPitch::DONTKNOW,
- 100.0,
- ::com::sun::star::awt::FontWeight::NORMAL,
- ::com::sun::star::awt::FontSlant_NONE,
- ::com::sun::star::awt::FontUnderline::NONE,
- ::com::sun::star::awt::FontStrikeout::NONE,
- 0.0,
- sal_False,
- sal_False,
- ::com::sun::star::awt::FontType::DONTKNOW ),
- mnColor( API_RGB_TRANSPARENT ),
- mnEscapement( API_ESCAPE_NONE ),
- mnEscapeHeight( API_ESCAPEHEIGHT_NONE ),
- mbOutline( false ),
- mbShadow( false )
-{
- maLatinFont.maName = maDesc.Name;
-}
-
-// ============================================================================
-
-ApiNumFmtData::ApiNumFmtData() :
- mnIndex( 0 )
-{
-}
-
-// ============================================================================
-
-ApiAlignmentData::ApiAlignmentData() :
- meHorJustify( ::com::sun::star::table::CellHoriJustify_STANDARD ),
- meVerJustify( ::com::sun::star::table::CellVertJustify_STANDARD ),
- meOrientation( ::com::sun::star::table::CellOrientation_STANDARD ),
- mnRotation( 0 ),
- mnWritingMode( ::com::sun::star::text::WritingMode2::PAGE ),
- mnIndent( 0 ),
- mbWrapText( false ),
- mbShrink( false )
-{
-}
-
-bool operator==( const ApiAlignmentData& rLeft, const ApiAlignmentData& rRight )
-{
- return
- (rLeft.meHorJustify == rRight.meHorJustify) &&
- (rLeft.meVerJustify == rRight.meVerJustify) &&
- (rLeft.meOrientation == rRight.meOrientation) &&
- (rLeft.mnRotation == rRight.mnRotation) &&
- (rLeft.mnWritingMode == rRight.mnWritingMode) &&
- (rLeft.mnIndent == rRight.mnIndent) &&
- (rLeft.mbWrapText == rRight.mbWrapText) &&
- (rLeft.mbShrink == rRight.mbShrink);
-}
-
-// ============================================================================
-
-ApiProtectionData::ApiProtectionData() :
- maCellProt( sal_True, sal_False, sal_False, sal_False )
-{
-}
-
-bool operator==( const ApiProtectionData& rLeft, const ApiProtectionData& rRight )
-{
- return
- (rLeft.maCellProt.IsLocked == rRight.maCellProt.IsLocked) &&
- (rLeft.maCellProt.IsFormulaHidden == rRight.maCellProt.IsFormulaHidden) &&
- (rLeft.maCellProt.IsHidden == rRight.maCellProt.IsHidden) &&
- (rLeft.maCellProt.IsPrintHidden == rRight.maCellProt.IsPrintHidden);
-}
-
-// ============================================================================
-
-ApiBorderData::ApiBorderData() :
- mbBorderUsed( false ),
- mbDiagUsed( false )
-{
-}
-
-// ============================================================================
-
-ApiSolidFillData::ApiSolidFillData() :
- mnColor( API_RGB_TRANSPARENT ),
- mbTransparent( true ),
- mbUsed( false )
-{
-}
-
-// ============================================================================
-
-namespace {
-
-/** Property names for Western font name settings. */
-const sal_Char* const sppcLatinFontNameNames[] =
-{
- "CharFontName",
- "CharFontFamily",
- "CharFontCharSet",
- 0
-};
-
-/** Property names for Asian font name settings. */
-const sal_Char* const sppcAsianFontNameNames[] =
-{
- "CharFontNameAsian",
- "CharFontFamilyAsian",
- "CharFontCharSetAsian",
- 0
-};
-
-/** Property names for Complex font name settings. */
-const sal_Char* const sppcCmplxFontNameNames[] =
-{
- "CharFontNameComplex",
- "CharFontFamilyComplex",
- "CharFontCharSetComplex",
- 0
-};
-
-/** Property names for font height settings. */
-const sal_Char* const sppcFontHeightNames[] =
-{
- "CharHeight",
- "CharHeightAsian",
- "CharHeightComplex",
- 0
-};
-
-/** Property names for font weight settings. */
-const sal_Char* const sppcFontWeightNames[] =
-{
- "CharWeight",
- "CharWeightAsian",
- "CharWeightComplex",
- 0
-};
-
-/** Property names for font posture settings. */
-const sal_Char* const sppcFontPostureNames[] =
-{
- "CharPosture",
- "CharPostureAsian",
- "CharPostureComplex",
- 0
-};
-
-/** Property names for font escapement settings. */
-const sal_Char* const sppcFontEscapeNames[] =
-{
- "CharEscapement",
- "CharEscapementHeight",
- 0
-};
-
-/** Property names for alignment. */
-const sal_Char* const sppcAlignmentNames[] =
-{
- "HoriJustify",
- "VertJustify",
- "WritingMode",
- "RotateAngle",
- "RotateReference",
- "Orientation",
- "ParaIndent",
- "IsTextWrapped",
- "ShrinkToFit",
- 0
-};
-
-/** Property names for diagonal cell borders. */
-const sal_Char* const sppcDiagBorderNames[] =
-{
- "DiagonalTLBR",
- "DiagonalBLTR",
- 0
-};
-
-/** Property names for cell fill. */
-const sal_Char* const sppcSolidFillNames[] =
-{
- "CellBackColor",
- "IsCellBackgroundTransparent",
- 0
-};
-
-void lclWriteFontName( PropertySet& rPropSet, PropertySequence& rPropSeq, const ApiScriptFontName& rFontName )
-{
- if( rFontName.maName.getLength() > 0 )
- rPropSeq << rFontName.maName << rFontName.mnFamily << rFontName.mnCharSet >> rPropSet;
-}
-
-} // namespace
-
-// ----------------------------------------------------------------------------
-
-StylesPropertyHelper::StylesPropertyHelper( const WorkbookHelper& rHelper ) :
- WorkbookHelper( rHelper ),
- maLatinFontNameProps( sppcLatinFontNameNames ),
- maAsianFontNameProps( sppcAsianFontNameNames ),
- maCmplxFontNameProps( sppcCmplxFontNameNames ),
- maFontHeightProps( sppcFontHeightNames ),
- maFontWeightProps( sppcFontWeightNames ),
- maFontPostureProps( sppcFontPostureNames ),
- maFontEscapeProps( sppcFontEscapeNames ),
- maAlignProps( sppcAlignmentNames ),
- maDiagBorderProps( sppcDiagBorderNames ),
- maSolidFillProps( sppcSolidFillNames ),
- maCharColorProp( CREATE_OUSTRING( "CharColor" ) ),
- maCharUnderlineProp( CREATE_OUSTRING( "CharUnderline" ) ),
- maCharStrikeoutProp( CREATE_OUSTRING( "CharStrikeout" ) ),
- maCharContouredProp( CREATE_OUSTRING( "CharContoured" ) ),
- maCharShadowedProp( CREATE_OUSTRING( "CharShadowed" ) ),
- maNumFmtProp( CREATE_OUSTRING( "NumberFormat" ) ),
- maCellProtProp( CREATE_OUSTRING( "CellProtection" ) ),
- maBorderProp( CREATE_OUSTRING( "TableBorder" ) )
-{
-}
-
-void StylesPropertyHelper::writeFontProperties( PropertySet& rPropSet,
- const ApiFontData& rFontData, const ApiFontUsedFlags& rUsedFlags, FontPropertyType ePropType )
-{
- // font name properties
- if( rUsedFlags.mbNameUsed )
- {
- lclWriteFontName( rPropSet, maLatinFontNameProps, rFontData.maLatinFont );
- lclWriteFontName( rPropSet, maAsianFontNameProps, rFontData.maAsianFont );
- lclWriteFontName( rPropSet, maCmplxFontNameProps, rFontData.maCmplxFont );
- }
- // font height
- if( rUsedFlags.mbHeightUsed )
- {
- float fHeight = static_cast< float >( rFontData.maDesc.Height / 20.0 ); // twips to points
- maFontHeightProps << fHeight << fHeight << fHeight >> rPropSet;
- }
- // font weight
- if( rUsedFlags.mbWeightUsed )
- {
- float fWeight = rFontData.maDesc.Weight;
- maFontWeightProps << fWeight << fWeight << fWeight >> rPropSet;
- }
- // font posture
- if( rUsedFlags.mbPostureUsed )
- maFontPostureProps << rFontData.maDesc.Slant << rFontData.maDesc.Slant << rFontData.maDesc.Slant >> rPropSet;
- // character color
- if( rUsedFlags.mbColorUsed )
- rPropSet.setProperty( maCharColorProp, rFontData.mnColor );
- // underline style
- if( rUsedFlags.mbUnderlineUsed )
- rPropSet.setProperty( maCharUnderlineProp, rFontData.maDesc.Underline );
- // strike out style
- if( rUsedFlags.mbStrikeoutUsed )
- rPropSet.setProperty( maCharStrikeoutProp, rFontData.maDesc.Strikeout );
- // outline style
- if( rUsedFlags.mbOutlineUsed )
- rPropSet.setProperty( maCharContouredProp, rFontData.mbOutline );
- // shadow style
- if( rUsedFlags.mbShadowUsed )
- rPropSet.setProperty( maCharShadowedProp, rFontData.mbShadow );
- // escapement
- if( rUsedFlags.mbEscapementUsed && (ePropType == FONT_PROPTYPE_RICHTEXT) )
- maFontEscapeProps << rFontData.mnEscapement << rFontData.mnEscapeHeight >> rPropSet;
-}
-
-void StylesPropertyHelper::writeNumFmtProperties(
- PropertySet& rPropSet, const ApiNumFmtData& rNumFmtData )
-{
- rPropSet.setProperty( maNumFmtProp, rNumFmtData.mnIndex );
-}
-
-void StylesPropertyHelper::writeAlignmentProperties(
- PropertySet& rPropSet, const ApiAlignmentData& rAlignData )
-{
- maAlignProps
- << rAlignData.meHorJustify
- << rAlignData.meVerJustify
- << rAlignData.mnWritingMode
- << rAlignData.mnRotation
- << ::com::sun::star::table::CellVertJustify_STANDARD // rotation reference
- << rAlignData.meOrientation
- << rAlignData.mnIndent
- << rAlignData.mbWrapText
- << rAlignData.mbShrink
- >> rPropSet;
-}
-
-void StylesPropertyHelper::writeProtectionProperties(
- PropertySet& rPropSet, const ApiProtectionData& rProtData )
-{
- rPropSet.setProperty( maCellProtProp, rProtData.maCellProt );
-}
-
-void StylesPropertyHelper::writeBorderProperties(
- PropertySet& rPropSet, const ApiBorderData& rBorderData )
-{
- if( rBorderData.mbBorderUsed )
- rPropSet.setProperty( maBorderProp, rBorderData.maBorder );
- if( rBorderData.mbDiagUsed )
- maDiagBorderProps << rBorderData.maTLtoBR << rBorderData.maBLtoTR >> rPropSet;
-}
-
-void StylesPropertyHelper::writeSolidFillProperties(
- PropertySet& rPropSet, const ApiSolidFillData& rFillData )
-{
- if( rFillData.mbUsed )
- maSolidFillProps << rFillData.mnColor << rFillData.mbTransparent >> rPropSet;
-}
-
-// ============================================================================
-
-} // namespace xls
-} // namespace oox
-
diff --git a/oox/source/xls/tablebuffer.cxx b/oox/source/xls/tablebuffer.cxx
index 071540dc33ad..7943ad75ce8d 100644
--- a/oox/source/xls/tablebuffer.cxx
+++ b/oox/source/xls/tablebuffer.cxx
@@ -31,6 +31,7 @@
#include "oox/xls/tablebuffer.hxx"
#include <com/sun/star/sheet/XDatabaseRanges.hpp>
#include <com/sun/star/sheet/XDatabaseRange.hpp>
+#include "properties.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertyset.hxx"
@@ -50,7 +51,7 @@ namespace xls {
// ============================================================================
-OoxTableData::OoxTableData() :
+TableModel::TableModel() :
mnId( -1 ),
mnType( XML_worksheet ),
mnHeaderRows( 1 ),
@@ -68,45 +69,45 @@ Table::Table( const WorkbookHelper& rHelper ) :
void Table::importTable( const AttributeList& rAttribs, sal_Int16 nSheet )
{
- if( getAddressConverter().convertToCellRange( maOoxData.maRange, rAttribs.getString( XML_ref, OUString() ), nSheet, true ) )
- {
- maOoxData.maProgName = rAttribs.getString( XML_name, OUString() );
- maOoxData.maDisplayName = rAttribs.getString( XML_displayName, OUString() );
- maOoxData.mnId = rAttribs.getInteger( XML_id, -1 );
- maOoxData.mnType = rAttribs.getToken( XML_tableType, XML_worksheet );
- maOoxData.mnHeaderRows = rAttribs.getInteger( XML_headerRowCount, 1 );
- maOoxData.mnTotalsRows = rAttribs.getInteger( XML_totalsRowCount, 0 );
- }
+ getAddressConverter().convertToCellRangeUnchecked( maModel.maRange, rAttribs.getString( XML_ref, OUString() ), nSheet );
+ maModel.maProgName = rAttribs.getString( XML_name, OUString() );
+ maModel.maDisplayName = rAttribs.getString( XML_displayName, OUString() );
+ maModel.mnId = rAttribs.getInteger( XML_id, -1 );
+ maModel.mnType = rAttribs.getToken( XML_tableType, XML_worksheet );
+ maModel.mnHeaderRows = rAttribs.getInteger( XML_headerRowCount, 1 );
+ maModel.mnTotalsRows = rAttribs.getInteger( XML_totalsRowCount, 0 );
}
void Table::importTable( RecordInputStream& rStrm, sal_Int16 nSheet )
{
BinRange aBinRange;
- rStrm >> aBinRange;
- if( getAddressConverter().convertToCellRange( maOoxData.maRange, aBinRange, nSheet, true ) )
- {
- sal_Int32 nType;
- rStrm >> nType >> maOoxData.mnId >> maOoxData.mnHeaderRows >> maOoxData.mnTotalsRows;
- rStrm.skip( 32 );
- rStrm >> maOoxData.maProgName >> maOoxData.maDisplayName;
-
- static const sal_Int32 spnTypes[] = { XML_worksheet, XML_TOKEN_INVALID, XML_TOKEN_INVALID, XML_queryTable };
- maOoxData.mnType = STATIC_ARRAY_SELECT( spnTypes, nType, XML_TOKEN_INVALID );
- }
+ sal_Int32 nType;
+ rStrm >> aBinRange >> nType >> maModel.mnId >> maModel.mnHeaderRows >> maModel.mnTotalsRows;
+ rStrm.skip( 32 );
+ rStrm >> maModel.maProgName >> maModel.maDisplayName;
+
+ getAddressConverter().convertToCellRangeUnchecked( maModel.maRange, aBinRange, nSheet );
+ static const sal_Int32 spnTypes[] = { XML_worksheet, XML_TOKEN_INVALID, XML_TOKEN_INVALID, XML_queryTable };
+ maModel.mnType = STATIC_ARRAY_SELECT( spnTypes, nType, XML_TOKEN_INVALID );
}
void Table::finalizeImport()
{
- if( maOoxData.maDisplayName.getLength() > 0 ) try
+ // validate cell range
+ maDestRange = maModel.maRange;
+ bool bValidRange = getAddressConverter().validateCellRange( maDestRange, true, true );
+
+ // create database range
+ if( bValidRange && (maModel.mnId > 0) && (maModel.maDisplayName.getLength() > 0) ) try
{
// find an unused name
Reference< XDatabaseRanges > xDatabaseRanges = getDatabaseRanges();
Reference< XNameAccess > xNameAccess( xDatabaseRanges, UNO_QUERY_THROW );
- OUString aName = ContainerHelper::getUnusedName( xNameAccess, maOoxData.maDisplayName, '_' );
- xDatabaseRanges->addNewByName( aName, maOoxData.maRange );
+ OUString aName = ContainerHelper::getUnusedName( xNameAccess, maModel.maDisplayName, '_' );
+ xDatabaseRanges->addNewByName( aName, maModel.maRange );
Reference< XDatabaseRange > xDatabaseRange( xDatabaseRanges->getByName( aName ), UNO_QUERY_THROW );
PropertySet aPropSet( xDatabaseRange );
- if( !aPropSet.getProperty( mnTokenIndex, CREATE_OUSTRING( "TokenIndex" ) ) )
+ if( !aPropSet.getProperty( mnTokenIndex, PROP_TokenIndex ) )
mnTokenIndex = -1;
}
catch( Exception& )
@@ -140,12 +141,17 @@ TableRef TableBuffer::importTable( RecordInputStream& rStrm, sal_Int16 nSheet )
void TableBuffer::finalizeImport()
{
- maTables.forEachMem( &Table::finalizeImport );
+ maIdTables.forEachMem( &Table::finalizeImport );
}
TableRef TableBuffer::getTable( sal_Int32 nTableId ) const
{
- return maTables.get( nTableId );
+ return maIdTables.get( nTableId );
+}
+
+TableRef TableBuffer::getTable( const OUString& rDispName ) const
+{
+ return maNameTables.get( rDispName );
}
// private --------------------------------------------------------------------
@@ -153,10 +159,13 @@ TableRef TableBuffer::getTable( sal_Int32 nTableId ) const
void TableBuffer::insertTable( TableRef xTable )
{
sal_Int32 nTableId = xTable->getTableId();
- if( nTableId > 0 )
+ const OUString& rDispName = xTable->getDisplayName();
+ if( (nTableId > 0) && (rDispName.getLength() > 0) )
{
- OSL_ENSURE( maTables.find( nTableId ) == maTables.end(), "TableBuffer::insertTable - multiple table identifier" );
- maTables[ nTableId ] = xTable;
+ OSL_ENSURE( maIdTables.find( nTableId ) == maIdTables.end(), "TableBuffer::insertTable - multiple table identifier" );
+ maIdTables[ nTableId ] = xTable;
+ OSL_ENSURE( maNameTables.find( rDispName ) == maNameTables.end(), "TableBuffer::insertTable - multiple table name" );
+ maNameTables[ rDispName ] = xTable;
}
}
diff --git a/oox/source/xls/tablefragment.cxx b/oox/source/xls/tablefragment.cxx
index 9f21d789967b..8e8cca20b534 100644
--- a/oox/source/xls/tablefragment.cxx
+++ b/oox/source/xls/tablefragment.cxx
@@ -31,6 +31,7 @@
#include "oox/xls/tablefragment.hxx"
using ::rtl::OUString;
+using ::oox::core::ContextHandlerRef;
using ::oox::core::RecordInfo;
namespace oox {
@@ -45,40 +46,28 @@ OoxTableFragment::OoxTableFragment( const WorksheetHelper& rHelper, const OUStri
// oox.core.ContextHandler2Helper interface -----------------------------------
-ContextWrapper OoxTableFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxTableFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nElement == XLS_TOKEN( table ));
+ if( nElement == XLS_TOKEN( table ) )
+ mxTable = getTables().importTable( rAttribs, getSheetIndex() );
+ break;
}
- return false;
+ return 0;
}
-void OoxTableFragment::onStartElement( const AttributeList& rAttribs )
-{
- switch( getCurrentElement() )
- {
- case XLS_TOKEN( table ): mxTable = getTables().importTable( rAttribs, getSheetIndex() ); break;
- }
-}
-
-ContextWrapper OoxTableFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& )
+ContextHandlerRef OoxTableFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nRecId == OOBIN_ID_TABLE);
- }
- return false;
-}
-
-void OoxTableFragment::onStartRecord( RecordInputStream& rStrm )
-{
- switch( getCurrentElement() )
- {
- case OOBIN_ID_TABLE: mxTable = getTables().importTable( rStrm, getSheetIndex() ); break;
+ if( nRecId == OOBIN_ID_TABLE )
+ mxTable = getTables().importTable( rStrm, getSheetIndex() );
+ break;
}
+ return 0;
}
// oox.core.FragmentHandler2 interface ----------------------------------------
diff --git a/oox/source/xls/themebuffer.cxx b/oox/source/xls/themebuffer.cxx
index 65f9a2fcfb15..d06757ee1e7e 100644
--- a/oox/source/xls/themebuffer.cxx
+++ b/oox/source/xls/themebuffer.cxx
@@ -30,7 +30,6 @@
#include "oox/xls/themebuffer.hxx"
#include "oox/xls/stylesbuffer.hxx"
-#include "oox/xls/stylespropertyhelper.hxx"
using ::oox::drawingml::ClrScheme;
using ::oox::drawingml::Color;
@@ -91,19 +90,19 @@ static const BuiltinThemeFont spBuiltinThemeFonts[] =
ThemeBuffer::ThemeBuffer( const WorkbookHelper& rHelper ) :
WorkbookHelper( rHelper ),
- mxDefFontData( new OoxFontData )
+ mxDefFontModel( new FontModel )
{
switch( getFilterType() )
{
case FILTER_OOX:
//! TODO: locale dependent font name
- mxDefFontData->maName = CREATE_OUSTRING( "Cambria" );
- mxDefFontData->mfHeight = 11.0;
+ mxDefFontModel->maName = CREATE_OUSTRING( "Cambria" );
+ mxDefFontModel->mfHeight = 11.0;
break;
case FILTER_BIFF:
//! TODO: BIFF dependent font name
- mxDefFontData->maName = CREATE_OUSTRING( "Arial" );
- mxDefFontData->mfHeight = 10.0;
+ mxDefFontModel->maName = CREATE_OUSTRING( "Arial" );
+ mxDefFontModel->mfHeight = 10.0;
break;
case FILTER_UNKNOWN: break;
}
diff --git a/oox/source/xls/unitconverter.cxx b/oox/source/xls/unitconverter.cxx
index 6b4ac7ce82ad..8ee2606a30e9 100644
--- a/oox/source/xls/unitconverter.cxx
+++ b/oox/source/xls/unitconverter.cxx
@@ -29,10 +29,13 @@
************************************************************************/
#include "oox/xls/unitconverter.hxx"
+#include <rtl/math.hxx>
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/awt/DeviceInfo.hpp>
#include <com/sun/star/awt/XFont.hpp>
+#include <com/sun/star/util/Date.hpp>
+#include <com/sun/star/util/DateTime.hpp>
#include "oox/xls/stylesbuffer.hxx"
using ::rtl::OUString;
@@ -41,6 +44,8 @@ using ::com::sun::star::awt::FontDescriptor;
using ::com::sun::star::awt::XDevice;
using ::com::sun::star::awt::DeviceInfo;
using ::com::sun::star::awt::XFont;
+using ::com::sun::star::util::Date;
+using ::com::sun::star::util::DateTime;
namespace oox {
namespace xls {
@@ -54,13 +59,55 @@ const double MM100_PER_POINT = MM100_PER_INCH / 72.0;
const double MM100_PER_TWIP = MM100_PER_POINT / 20.0;
const double MM100_PER_EMU = 1.0 / 360.0;
+// ----------------------------------------------------------------------------
+
+/** Returns true, if the passed year is a leap year. */
+inline sal_Int32 lclIsLeapYear( sal_Int32 nYear )
+{
+ return ((nYear % 4) == 0) && (((nYear % 100) != 0) || ((nYear % 400) == 0));
+}
+
+void lclSkipYearBlock( sal_Int32& ornDays, sal_uInt16& ornYear, sal_Int32 nDaysInBlock, sal_Int32 nYearsPerBlock, sal_Int32 nMaxBlocks )
+{
+ sal_Int32 nBlocks = ::std::min< sal_Int32 >( ornDays / nDaysInBlock, nMaxBlocks );
+ ornYear = static_cast< sal_uInt16 >( ornYear + nYearsPerBlock * nBlocks );
+ ornDays -= nBlocks * nDaysInBlock;
+}
+
+/** Returns the number of days before the passed date, starting from the null
+ date 0000-Jan-01, using standard leap year conventions. */
+sal_Int32 lclGetDays( const Date& rDate )
+{
+ // number of days in all full years before passed date including all leap days
+ sal_Int32 nDays = rDate.Year * 365 + ((rDate.Year + 3) / 4) - ((rDate.Year + 99) / 100) + ((rDate.Year + 399) / 400);
+ OSL_ENSURE( (1 <= rDate.Month) && (rDate.Month <= 12), "lclGetDays - invalid month" );
+ OSL_ENSURE( (1 <= rDate.Day) && (rDate.Day <= 31), "lclGetDays - invalid day" ); // yes, this is weak...
+ if( (1 <= rDate.Month) && (rDate.Month <= 12) )
+ {
+ // number of days at start of month jan feb mar apr may jun jul aug sep oct nov dec
+ static const sal_Int32 spnCumDays[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
+ // add number of days in full months before passed date
+ nDays += spnCumDays[ rDate.Month - 1 ];
+ // add number of days from passed date (this adds one day too much)
+ nDays += rDate.Day;
+ /* Remove the one day added too much if there is no leap day before
+ the passed day in the passed year. This means: remove the day, if
+ we are in january or february (leap day not reached if existing),
+ or if the passed year is not a leap year. */
+ if( (rDate.Month < 3) || !lclIsLeapYear( rDate.Year ) )
+ --nDays;
+ }
+ return nDays;
+}
+
} // namespace
// ----------------------------------------------------------------------------
UnitConverter::UnitConverter( const WorkbookHelper& rHelper ) :
WorkbookHelper( rHelper ),
- maCoeffs( UNIT_ENUM_SIZE, 1.0 )
+ maCoeffs( UNIT_ENUM_SIZE, 1.0 ),
+ mnNullDate( lclGetDays( Date( 30, 12, 1899 ) ) )
{
// initialize constant and default coefficients
maCoeffs[ UNIT_INCH ] = MM100_PER_INCH;
@@ -72,14 +119,14 @@ UnitConverter::UnitConverter( const WorkbookHelper& rHelper ) :
maCoeffs[ UNIT_DIGIT ] = 200.0; // default: 1 digit = 2 mm
maCoeffs[ UNIT_SPACE ] = 100.0; // default 1 space = 1 mm
- // map error code names to BIFF error codes
- maErrorCodes[ CREATE_OUSTRING( "#NULL!" ) ] = BIFF_ERR_NULL;
- maErrorCodes[ CREATE_OUSTRING( "#DIV/0!" ) ] = BIFF_ERR_DIV0;
- maErrorCodes[ CREATE_OUSTRING( "#VALUE!" ) ] = BIFF_ERR_VALUE;
- maErrorCodes[ CREATE_OUSTRING( "#REF!" ) ] = BIFF_ERR_REF;
- maErrorCodes[ CREATE_OUSTRING( "#NAME?" ) ] = BIFF_ERR_NAME;
- maErrorCodes[ CREATE_OUSTRING( "#NUM!" ) ] = BIFF_ERR_NUM;
- maErrorCodes[ CREATE_OUSTRING( "#NA" ) ] = BIFF_ERR_NA;
+ // error code maps
+ addErrorCode( BIFF_ERR_NULL, CREATE_OUSTRING( "#NULL!" ) );
+ addErrorCode( BIFF_ERR_DIV0, CREATE_OUSTRING( "#DIV/0!" ) );
+ addErrorCode( BIFF_ERR_VALUE, CREATE_OUSTRING( "#VALUE!" ) );
+ addErrorCode( BIFF_ERR_REF, CREATE_OUSTRING( "#REF!" ) );
+ addErrorCode( BIFF_ERR_NAME, CREATE_OUSTRING( "#NAME?" ) );
+ addErrorCode( BIFF_ERR_NUM, CREATE_OUSTRING( "#NUM!" ) );
+ addErrorCode( BIFF_ERR_NA, CREATE_OUSTRING( "#NA" ) );
}
void UnitConverter::finalizeImport()
@@ -116,6 +163,12 @@ void UnitConverter::finalizeImport()
}
}
+void UnitConverter::finalizeNullDate( const Date& rNullDate )
+{
+ // convert the nulldate to number of days since 0000-Jan-01
+ mnNullDate = lclGetDays( rNullDate );
+}
+
// conversion -----------------------------------------------------------------
double UnitConverter::scaleValue( double fValue, Unit eFromUnit, Unit eToUnit ) const
@@ -133,10 +186,62 @@ double UnitConverter::scaleFromMm100( sal_Int32 nMm100, Unit eUnit ) const
return static_cast< double >( nMm100 ) / getCoefficient( eUnit );
}
+double UnitConverter::calcSerialFromDateTime( const DateTime& rDateTime ) const
+{
+ sal_Int32 nDays = lclGetDays( Date( rDateTime.Day, rDateTime.Month, rDateTime.Year ) ) - mnNullDate;
+ OSL_ENSURE( nDays >= 0, "UnitConverter::calcDateTimeSerial - invalid date" );
+ OSL_ENSURE( (rDateTime.Hours <= 23) && (rDateTime.Minutes <= 59) && (rDateTime.Seconds <= 59), "UnitConverter::calcDateTimeSerial - invalid time" );
+ return nDays + rDateTime.Hours / 24.0 + rDateTime.Minutes / 1440.0 + rDateTime.Seconds / 86400.0;
+}
+
+DateTime UnitConverter::calcDateTimeFromSerial( double fSerial ) const
+{
+ DateTime aDateTime( 0, 0, 0, 0, 1, 1, 0 );
+ double fDays = 0.0;
+ double fTime = modf( fSerial, &fDays );
+
+ // calculate date from number of days with O(1) complexity
+ sal_Int32 nDays = getLimitedValue< sal_Int32, double >( fDays + mnNullDate, 0, 3652424 );
+ // skip year 0, assumed to be a leap year. By starting at year 1, leap years can be handled easily
+ if( nDays >= 366 ) { ++aDateTime.Year; nDays -= 366; }
+ // skip full blocks of 400, 100, 4 years, and remaining full years
+ lclSkipYearBlock( nDays, aDateTime.Year, 400 * 365 + 97, 400, 24 );
+ lclSkipYearBlock( nDays, aDateTime.Year, 100 * 365 + 24, 100, 3 );
+ lclSkipYearBlock( nDays, aDateTime.Year, 4 * 365 + 1, 4, 24 );
+ lclSkipYearBlock( nDays, aDateTime.Year, 365, 1, 3 );
+ // skip full months of current year
+ static const sal_Int32 spnDaysInMonth[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+ if( (nDays >= 59) && !lclIsLeapYear( aDateTime.Year ) ) ++nDays;
+ const sal_Int32* pnDaysInMonth = spnDaysInMonth;
+ while( *pnDaysInMonth >= nDays ) { ++aDateTime.Month; nDays -= *pnDaysInMonth; ++pnDaysInMonth; }
+ aDateTime.Day = static_cast< sal_uInt16 >( nDays + 1 );
+
+ // calculate time from fractional part of serial
+ sal_Int32 nTime = getLimitedValue< sal_Int32, double >( fTime * 86400, 0, 86399 );
+ aDateTime.Seconds = static_cast< sal_uInt16 >( nTime % 60 );
+ nTime /= 60;
+ aDateTime.Minutes = static_cast< sal_uInt16 >( nTime % 60 );
+ aDateTime.Hours = static_cast< sal_uInt16 >( nTime / 60 );
+
+ return aDateTime;
+}
+
+OUString UnitConverter::calcOoxErrorCode( sal_uInt8 nErrorCode ) const
+{
+ BiffErrorCodeMap::const_iterator aIt = maBiffErrCodes.find( nErrorCode );
+ return (aIt == maBiffErrCodes.end()) ? CREATE_OUSTRING( "#N/A" ) : aIt->second;
+}
+
sal_uInt8 UnitConverter::calcBiffErrorCode( const OUString& rErrorCode ) const
{
- ErrorCodeMap::const_iterator aIt = maErrorCodes.find( rErrorCode );
- return (aIt == maErrorCodes.end()) ? BIFF_ERR_NA : aIt->second;
+ OoxErrorCodeMap::const_iterator aIt = maOoxErrCodes.find( rErrorCode );
+ return (aIt == maOoxErrCodes.end()) ? BIFF_ERR_NA : aIt->second;
+}
+
+void UnitConverter::addErrorCode( sal_uInt8 nErrorCode, const OUString& rErrorCode )
+{
+ maOoxErrCodes[ rErrorCode ] = nErrorCode;
+ maBiffErrCodes[ nErrorCode ] = rErrorCode;
}
double UnitConverter::getCoefficient( Unit eUnit ) const
diff --git a/oox/source/xls/viewsettings.cxx b/oox/source/xls/viewsettings.cxx
index 6126086eb411..83d34949fe01 100644
--- a/oox/source/xls/viewsettings.cxx
+++ b/oox/source/xls/viewsettings.cxx
@@ -34,9 +34,10 @@
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/document/XViewDataSupplier.hpp>
#include <com/sun/star/text/WritingMode2.hpp>
+#include "properties.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/containerhelper.hxx"
-#include "oox/helper/propertysequence.hxx"
+#include "oox/helper/propertymap.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/helper/recordinputstream.hxx"
#include "oox/core/filterbase.hxx"
@@ -137,57 +138,6 @@ const sal_Int16 API_SPLITPANE_BOTTOMRIGHT = 3; /// Bottom-right, or
// ----------------------------------------------------------------------------
-/** Property names for document view settings. */
-const sal_Char* const sppcDocNames[] =
-{
- "Tables",
- "ActiveTable",
- "HasHorizontalScrollBar",
- "HasVerticalScrollBar",
- "HasSheetTabs",
- "RelativeHorizontalTabbarWidth",
- "ShowObjects",
- "ShowCharts",
- "ShowDrawing",
- 0
-};
-
-/** Property names for sheet view settings that are document-global in Calc. */
-const sal_Char* const sppcGlobalSheetNames[] =
-{
- "GridColor",
- "ShowPageBreakPreview",
- "ShowFormulas",
- "ShowGrid",
- "HasColumnRowHeaders",
- "ShowZeroValues",
- "IsOutlineSymbolsSet",
- 0
-};
-
-/** Property names for sheet view settings. */
-const sal_Char* const sppcSheetNames[] =
-{
- "TableSelected",
- "CursorPositionX",
- "CursorPositionY",
- "HorizontalSplitMode",
- "VerticalSplitMode",
- "HorizontalSplitPositionTwips",
- "VerticalSplitPositionTwips",
- "ActiveSplitRange",
- "PositionLeft",
- "PositionTop",
- "PositionRight",
- "PositionBottom",
- "ZoomType",
- "ZoomValue",
- "PageViewZoomValue",
- 0
-};
-
-// ----------------------------------------------------------------------------
-
/** Returns the OOXML pane identifier from the passed OOBIN or BIFF pane id. */
sal_Int32 lclGetOoxPaneId( sal_Int32 nBinPaneId, sal_Int32 nDefaultPaneId )
{
@@ -199,14 +149,14 @@ sal_Int32 lclGetOoxPaneId( sal_Int32 nBinPaneId, sal_Int32 nDefaultPaneId )
// ============================================================================
-OoxSheetSelectionData::OoxSheetSelectionData() :
+PaneSelectionModel::PaneSelectionModel() :
mnActiveCellId( 0 )
{
}
// ----------------------------------------------------------------------------
-OoxSheetViewData::OoxSheetViewData() :
+SheetViewModel::SheetViewModel() :
mnWorkbookViewId( 0 ),
mnViewType( XML_normal ),
mnActivePaneId( XML_topLeft ),
@@ -230,41 +180,41 @@ OoxSheetViewData::OoxSheetViewData() :
maGridColor.setIndexed( OOX_COLOR_WINDOWTEXT );
}
-bool OoxSheetViewData::isPageBreakPreview() const
+bool SheetViewModel::isPageBreakPreview() const
{
return mnViewType == XML_pageBreakPreview;
}
-sal_Int32 OoxSheetViewData::getNormalZoom() const
+sal_Int32 SheetViewModel::getNormalZoom() const
{
const sal_Int32& rnZoom = isPageBreakPreview() ? mnNormalZoom : mnCurrentZoom;
sal_Int32 nZoom = (rnZoom > 0) ? rnZoom : OOX_SHEETVIEW_NORMALZOOM_DEF;
return getLimitedValue< sal_Int32 >( nZoom, API_ZOOMVALUE_MIN, API_ZOOMVALUE_MAX );
}
-sal_Int32 OoxSheetViewData::getPageBreakZoom() const
+sal_Int32 SheetViewModel::getPageBreakZoom() const
{
const sal_Int32& rnZoom = isPageBreakPreview() ? mnCurrentZoom : mnSheetLayoutZoom;
sal_Int32 nZoom = (rnZoom > 0) ? rnZoom : OOX_SHEETVIEW_SHEETLAYZOOM_DEF;
return getLimitedValue< sal_Int32 >( nZoom, API_ZOOMVALUE_MIN, API_ZOOMVALUE_MAX );
}
-const OoxSheetSelectionData* OoxSheetViewData::getSelectionData( sal_Int32 nPaneId ) const
+const PaneSelectionModel* SheetViewModel::getPaneSelection( sal_Int32 nPaneId ) const
{
- return maSelMap.get( nPaneId ).get();
+ return maPaneSelMap.get( nPaneId ).get();
}
-const OoxSheetSelectionData* OoxSheetViewData::getActiveSelectionData() const
+const PaneSelectionModel* SheetViewModel::getActiveSelection() const
{
- return getSelectionData( mnActivePaneId );
+ return getPaneSelection( mnActivePaneId );
}
-OoxSheetSelectionData& OoxSheetViewData::createSelectionData( sal_Int32 nPaneId )
+PaneSelectionModel& SheetViewModel::createPaneSelection( sal_Int32 nPaneId )
{
- OoxSelectionDataMap::mapped_type& rxSelData = maSelMap[ nPaneId ];
- if( !rxSelData )
- rxSelData.reset( new OoxSheetSelectionData );
- return *rxSelData;
+ PaneSelectionModelMap::mapped_type& rxPaneSel = maPaneSelMap[ nPaneId ];
+ if( !rxPaneSel )
+ rxPaneSel.reset( new PaneSelectionModel );
+ return *rxPaneSel;
}
// ----------------------------------------------------------------------------
@@ -276,47 +226,47 @@ SheetViewSettings::SheetViewSettings( const WorksheetHelper& rHelper ) :
void SheetViewSettings::importSheetView( const AttributeList& rAttribs )
{
- OoxSheetViewData& rData = *createSheetViewData();
- rData.maGridColor.setIndexed( rAttribs.getInteger( XML_colorId, OOX_COLOR_WINDOWTEXT ) );
- rData.maFirstPos = getAddressConverter().createValidCellAddress( rAttribs.getString( XML_topLeftCell, OUString() ), getSheetIndex(), false );
- rData.mnWorkbookViewId = rAttribs.getToken( XML_workbookViewId, 0 );
- rData.mnViewType = rAttribs.getToken( XML_view, XML_normal );
- rData.mnCurrentZoom = rAttribs.getInteger( XML_zoomScale, 100 );
- rData.mnNormalZoom = rAttribs.getInteger( XML_zoomScaleNormal, 0 );
- rData.mnSheetLayoutZoom = rAttribs.getInteger( XML_zoomScaleSheetLayoutView, 0 );
- rData.mnPageLayoutZoom = rAttribs.getInteger( XML_zoomScalePageLayoutView, 0 );
- rData.mbSelected = rAttribs.getBool( XML_tabSelected, false );
- rData.mbRightToLeft = rAttribs.getBool( XML_rightToLeft, false );
- rData.mbDefGridColor = rAttribs.getBool( XML_defaultGridColor, true );
- rData.mbShowFormulas = rAttribs.getBool( XML_showFormulas, false );
- rData.mbShowGrid = rAttribs.getBool( XML_showGridLines, true );
- rData.mbShowHeadings = rAttribs.getBool( XML_showRowColHeaders, true );
- rData.mbShowZeros = rAttribs.getBool( XML_showZeros, true );
- rData.mbShowOutline = rAttribs.getBool( XML_showOutlineSymbols, true );
+ SheetViewModel& rModel = *createSheetView();
+ rModel.maGridColor.setIndexed( rAttribs.getInteger( XML_colorId, OOX_COLOR_WINDOWTEXT ) );
+ rModel.maFirstPos = getAddressConverter().createValidCellAddress( rAttribs.getString( XML_topLeftCell, OUString() ), getSheetIndex(), false );
+ rModel.mnWorkbookViewId = rAttribs.getToken( XML_workbookViewId, 0 );
+ rModel.mnViewType = rAttribs.getToken( XML_view, XML_normal );
+ rModel.mnCurrentZoom = rAttribs.getInteger( XML_zoomScale, 100 );
+ rModel.mnNormalZoom = rAttribs.getInteger( XML_zoomScaleNormal, 0 );
+ rModel.mnSheetLayoutZoom = rAttribs.getInteger( XML_zoomScaleSheetLayoutView, 0 );
+ rModel.mnPageLayoutZoom = rAttribs.getInteger( XML_zoomScalePageLayoutView, 0 );
+ rModel.mbSelected = rAttribs.getBool( XML_tabSelected, false );
+ rModel.mbRightToLeft = rAttribs.getBool( XML_rightToLeft, false );
+ rModel.mbDefGridColor = rAttribs.getBool( XML_defaultGridColor, true );
+ rModel.mbShowFormulas = rAttribs.getBool( XML_showFormulas, false );
+ rModel.mbShowGrid = rAttribs.getBool( XML_showGridLines, true );
+ rModel.mbShowHeadings = rAttribs.getBool( XML_showRowColHeaders, true );
+ rModel.mbShowZeros = rAttribs.getBool( XML_showZeros, true );
+ rModel.mbShowOutline = rAttribs.getBool( XML_showOutlineSymbols, true );
}
void SheetViewSettings::importPane( const AttributeList& rAttribs )
{
- OSL_ENSURE( !maSheetDatas.empty(), "SheetViewSettings::importPane - missing view data" );
- if( !maSheetDatas.empty() )
+ OSL_ENSURE( !maSheetViews.empty(), "SheetViewSettings::importPane - missing sheet view model" );
+ if( !maSheetViews.empty() )
{
- OoxSheetViewData& rData = *maSheetDatas.back();
- rData.maSecondPos = getAddressConverter().createValidCellAddress( rAttribs.getString( XML_topLeftCell, OUString() ), getSheetIndex(), false );
- rData.mnActivePaneId = rAttribs.getToken( XML_activePane, XML_topLeft );
- rData.mnPaneState = rAttribs.getToken( XML_state, XML_split );
- rData.mfSplitX = rAttribs.getDouble( XML_xSplit, 0.0 );
- rData.mfSplitY = rAttribs.getDouble( XML_ySplit, 0.0 );
+ SheetViewModel& rModel = *maSheetViews.back();
+ rModel.maSecondPos = getAddressConverter().createValidCellAddress( rAttribs.getString( XML_topLeftCell, OUString() ), getSheetIndex(), false );
+ rModel.mnActivePaneId = rAttribs.getToken( XML_activePane, XML_topLeft );
+ rModel.mnPaneState = rAttribs.getToken( XML_state, XML_split );
+ rModel.mfSplitX = rAttribs.getDouble( XML_xSplit, 0.0 );
+ rModel.mfSplitY = rAttribs.getDouble( XML_ySplit, 0.0 );
}
}
void SheetViewSettings::importSelection( const AttributeList& rAttribs )
{
- OSL_ENSURE( !maSheetDatas.empty(), "SheetViewSettings::importSelection - missing view data" );
- if( !maSheetDatas.empty() )
+ OSL_ENSURE( !maSheetViews.empty(), "SheetViewSettings::importSelection - missing sheet view model" );
+ if( !maSheetViews.empty() )
{
// pane this selection belongs to
sal_Int32 nPaneId = rAttribs.getToken( XML_pane, XML_topLeft );
- OoxSheetSelectionData& rSelData = maSheetDatas.back()->createSelectionData( nPaneId );
+ PaneSelectionModel& rSelData = maSheetViews.back()->createPaneSelection( nPaneId );
// cursor position
rSelData.maActiveCell = getAddressConverter().createValidCellAddress( rAttribs.getString( XML_activeCell, OUString() ), getSheetIndex(), false );
rSelData.mnActiveCellId = rAttribs.getInteger( XML_activeCellId, 0 );
@@ -328,104 +278,104 @@ void SheetViewSettings::importSelection( const AttributeList& rAttribs )
void SheetViewSettings::importChartSheetView( const AttributeList& rAttribs )
{
- OoxSheetViewData& rData = *createSheetViewData();
- rData.mnWorkbookViewId = rAttribs.getToken( XML_workbookViewId, 0 );
- rData.mnCurrentZoom = rAttribs.getInteger( XML_zoomScale, 100 );
- rData.mbSelected = rAttribs.getBool( XML_tabSelected, false );
- rData.mbZoomToFit = rAttribs.getBool( XML_zoomToFit, false );
+ SheetViewModel& rModel = *createSheetView();
+ rModel.mnWorkbookViewId = rAttribs.getToken( XML_workbookViewId, 0 );
+ rModel.mnCurrentZoom = rAttribs.getInteger( XML_zoomScale, 100 );
+ rModel.mbSelected = rAttribs.getBool( XML_tabSelected, false );
+ rModel.mbZoomToFit = rAttribs.getBool( XML_zoomToFit, false );
}
void SheetViewSettings::importSheetView( RecordInputStream& rStrm )
{
- OoxSheetViewData& rData = *createSheetViewData();
+ SheetViewModel& rModel = *createSheetView();
sal_uInt16 nFlags;
sal_Int32 nViewType;
BinAddress aFirstPos;
rStrm >> nFlags >> nViewType >> aFirstPos;
- rData.maGridColor.importColorId( rStrm );
- rData.mnCurrentZoom = rStrm.readuInt16();
- rData.mnNormalZoom = rStrm.readuInt16();
- rData.mnSheetLayoutZoom = rStrm.readuInt16();
- rData.mnPageLayoutZoom = rStrm.readuInt16();
- rStrm >> rData.mnWorkbookViewId;
-
- rData.maFirstPos = getAddressConverter().createValidCellAddress( aFirstPos, getSheetIndex(), false );
+ rModel.maGridColor.importColorId( rStrm );
+ rModel.mnCurrentZoom = rStrm.readuInt16();
+ rModel.mnNormalZoom = rStrm.readuInt16();
+ rModel.mnSheetLayoutZoom = rStrm.readuInt16();
+ rModel.mnPageLayoutZoom = rStrm.readuInt16();
+ rStrm >> rModel.mnWorkbookViewId;
+
+ rModel.maFirstPos = getAddressConverter().createValidCellAddress( aFirstPos, getSheetIndex(), false );
static const sal_Int32 spnViewTypes[] = { XML_normal, XML_pageBreakPreview, XML_pageLayout };
- rData.mnViewType = STATIC_ARRAY_SELECT( spnViewTypes, nViewType, XML_normal );
- rData.mbSelected = getFlag( nFlags, OOBIN_SHEETVIEW_SELECTED );
- rData.mbRightToLeft = getFlag( nFlags, OOBIN_SHEETVIEW_RIGHTTOLEFT );
- rData.mbDefGridColor = getFlag( nFlags, OOBIN_SHEETVIEW_DEFGRIDCOLOR );
- rData.mbShowFormulas = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWFORMULAS );
- rData.mbShowGrid = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWGRID );
- rData.mbShowHeadings = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWHEADINGS );
- rData.mbShowZeros = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWZEROS );
- rData.mbShowOutline = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWOUTLINE );
+ rModel.mnViewType = STATIC_ARRAY_SELECT( spnViewTypes, nViewType, XML_normal );
+ rModel.mbSelected = getFlag( nFlags, OOBIN_SHEETVIEW_SELECTED );
+ rModel.mbRightToLeft = getFlag( nFlags, OOBIN_SHEETVIEW_RIGHTTOLEFT );
+ rModel.mbDefGridColor = getFlag( nFlags, OOBIN_SHEETVIEW_DEFGRIDCOLOR );
+ rModel.mbShowFormulas = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWFORMULAS );
+ rModel.mbShowGrid = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWGRID );
+ rModel.mbShowHeadings = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWHEADINGS );
+ rModel.mbShowZeros = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWZEROS );
+ rModel.mbShowOutline = getFlag( nFlags, OOBIN_SHEETVIEW_SHOWOUTLINE );
}
void SheetViewSettings::importPane( RecordInputStream& rStrm )
{
- OSL_ENSURE( !maSheetDatas.empty(), "SheetViewSettings::importPane - missing view data" );
- if( !maSheetDatas.empty() )
+ OSL_ENSURE( !maSheetViews.empty(), "SheetViewSettings::importPane - missing sheet view model" );
+ if( !maSheetViews.empty() )
{
- OoxSheetViewData& rData = *maSheetDatas.back();
+ SheetViewModel& rModel = *maSheetViews.back();
BinAddress aSecondPos;
sal_Int32 nActivePaneId;
sal_uInt8 nFlags;
- rStrm >> rData.mfSplitX >> rData.mfSplitY >> aSecondPos >> nActivePaneId >> nFlags;
+ rStrm >> rModel.mfSplitX >> rModel.mfSplitY >> aSecondPos >> nActivePaneId >> nFlags;
- rData.maSecondPos = getAddressConverter().createValidCellAddress( aSecondPos, getSheetIndex(), false );
- rData.mnActivePaneId = lclGetOoxPaneId( nActivePaneId, XML_topLeft );
- rData.mnPaneState = getFlagValue( nFlags, OOBIN_PANE_FROZEN, getFlagValue( nFlags, OOBIN_PANE_FROZENNOSPLIT, XML_frozen, XML_frozenSplit ), XML_split );
+ rModel.maSecondPos = getAddressConverter().createValidCellAddress( aSecondPos, getSheetIndex(), false );
+ rModel.mnActivePaneId = lclGetOoxPaneId( nActivePaneId, XML_topLeft );
+ rModel.mnPaneState = getFlagValue( nFlags, OOBIN_PANE_FROZEN, getFlagValue( nFlags, OOBIN_PANE_FROZENNOSPLIT, XML_frozen, XML_frozenSplit ), XML_split );
}
}
void SheetViewSettings::importSelection( RecordInputStream& rStrm )
{
- OSL_ENSURE( !maSheetDatas.empty(), "SheetViewSettings::importSelection - missing view data" );
- if( !maSheetDatas.empty() )
+ OSL_ENSURE( !maSheetViews.empty(), "SheetViewSettings::importSelection - missing sheet view model" );
+ if( !maSheetViews.empty() )
{
// pane this selection belongs to
sal_Int32 nPaneId = rStrm.readInt32();
- OoxSheetSelectionData& rSelData = maSheetDatas.back()->createSelectionData( lclGetOoxPaneId( nPaneId, -1 ) );
+ PaneSelectionModel& rPaneSel = maSheetViews.back()->createPaneSelection( lclGetOoxPaneId( nPaneId, -1 ) );
// cursor position
BinAddress aActiveCell;
- rStrm >> aActiveCell >> rSelData.mnActiveCellId;
- rSelData.maActiveCell = getAddressConverter().createValidCellAddress( aActiveCell, getSheetIndex(), false );
+ rStrm >> aActiveCell >> rPaneSel.mnActiveCellId;
+ rPaneSel.maActiveCell = getAddressConverter().createValidCellAddress( aActiveCell, getSheetIndex(), false );
// selection
BinRangeList aSelection;
rStrm >> aSelection;
- rSelData.maSelection.clear();
- getAddressConverter().convertToCellRangeList( rSelData.maSelection, aSelection, getSheetIndex(), false );
+ rPaneSel.maSelection.clear();
+ getAddressConverter().convertToCellRangeList( rPaneSel.maSelection, aSelection, getSheetIndex(), false );
}
}
void SheetViewSettings::importChartSheetView( RecordInputStream& rStrm )
{
- OoxSheetViewData& rData = *createSheetViewData();
+ SheetViewModel& rModel = *createSheetView();
sal_uInt16 nFlags;
- rStrm >> nFlags >> rData.mnCurrentZoom >> rData.mnWorkbookViewId;
+ rStrm >> nFlags >> rModel.mnCurrentZoom >> rModel.mnWorkbookViewId;
- rData.mbSelected = getFlag( nFlags, OOBIN_CHARTSHEETVIEW_SELECTED );
- rData.mbZoomToFit = getFlag( nFlags, OOBIN_CHARTSHEETVIEW_ZOOMTOFIT );
+ rModel.mbSelected = getFlag( nFlags, OOBIN_CHARTSHEETVIEW_SELECTED );
+ rModel.mbZoomToFit = getFlag( nFlags, OOBIN_CHARTSHEETVIEW_ZOOMTOFIT );
}
void SheetViewSettings::importWindow2( BiffInputStream& rStrm )
{
- OSL_ENSURE( maSheetDatas.empty(), "SheetViewSettings::importWindow2 - multiple WINDOW2 records" );
- OoxSheetViewData& rData = *createSheetViewData();
+ OSL_ENSURE( maSheetViews.empty(), "SheetViewSettings::importWindow2 - multiple WINDOW2 records" );
+ SheetViewModel& rModel = *createSheetView();
if( getBiff() == BIFF2 )
{
- rData.mbShowFormulas = rStrm.readuInt8() != 0;
- rData.mbShowGrid = rStrm.readuInt8() != 0;
- rData.mbShowHeadings = rStrm.readuInt8() != 0;
- rData.mnPaneState = (rStrm.readuInt8() == 0) ? XML_split : XML_frozen;
- rData.mbShowZeros = rStrm.readuInt8() != 0;
+ rModel.mbShowFormulas = rStrm.readuInt8() != 0;
+ rModel.mbShowGrid = rStrm.readuInt8() != 0;
+ rModel.mbShowHeadings = rStrm.readuInt8() != 0;
+ rModel.mnPaneState = (rStrm.readuInt8() == 0) ? XML_split : XML_frozen;
+ rModel.mbShowZeros = rStrm.readuInt8() != 0;
BinAddress aFirstPos;
rStrm >> aFirstPos;
- rData.maFirstPos = getAddressConverter().createValidCellAddress( aFirstPos, getSheetIndex(), false );
- rData.mbDefGridColor = rStrm.readuInt8() != 0;
- rData.maGridColor.importColorRgb( rStrm );
+ rModel.maFirstPos = getAddressConverter().createValidCellAddress( aFirstPos, getSheetIndex(), false );
+ rModel.mbDefGridColor = rStrm.readuInt8() != 0;
+ rModel.maGridColor.importColorRgb( rStrm );
}
else
{
@@ -433,129 +383,129 @@ void SheetViewSettings::importWindow2( BiffInputStream& rStrm )
BinAddress aFirstPos;
rStrm >> nFlags >> aFirstPos;
- rData.maFirstPos = getAddressConverter().createValidCellAddress( aFirstPos, getSheetIndex(), false );
- rData.mnPaneState = getFlagValue( nFlags, BIFF_WINDOW2_FROZEN, getFlagValue( nFlags, BIFF_WINDOW2_FROZENNOSPLIT, XML_frozen, XML_frozenSplit ), XML_split );
- rData.mbSelected = getFlag( nFlags, BIFF_WINDOW2_SELECTED );
- rData.mbRightToLeft = getFlag( nFlags, BIFF_WINDOW2_RIGHTTOLEFT );
- rData.mbDefGridColor = getFlag( nFlags, BIFF_WINDOW2_DEFGRIDCOLOR );
- rData.mbShowFormulas = getFlag( nFlags, BIFF_WINDOW2_SHOWFORMULAS );
- rData.mbShowGrid = getFlag( nFlags, BIFF_WINDOW2_SHOWGRID );
- rData.mbShowHeadings = getFlag( nFlags, BIFF_WINDOW2_SHOWHEADINGS );
- rData.mbShowZeros = getFlag( nFlags, BIFF_WINDOW2_SHOWZEROS );
- rData.mbShowOutline = getFlag( nFlags, BIFF_WINDOW2_SHOWOUTLINE );
+ rModel.maFirstPos = getAddressConverter().createValidCellAddress( aFirstPos, getSheetIndex(), false );
+ rModel.mnPaneState = getFlagValue( nFlags, BIFF_WINDOW2_FROZEN, getFlagValue( nFlags, BIFF_WINDOW2_FROZENNOSPLIT, XML_frozen, XML_frozenSplit ), XML_split );
+ rModel.mbSelected = getFlag( nFlags, BIFF_WINDOW2_SELECTED );
+ rModel.mbRightToLeft = getFlag( nFlags, BIFF_WINDOW2_RIGHTTOLEFT );
+ rModel.mbDefGridColor = getFlag( nFlags, BIFF_WINDOW2_DEFGRIDCOLOR );
+ rModel.mbShowFormulas = getFlag( nFlags, BIFF_WINDOW2_SHOWFORMULAS );
+ rModel.mbShowGrid = getFlag( nFlags, BIFF_WINDOW2_SHOWGRID );
+ rModel.mbShowHeadings = getFlag( nFlags, BIFF_WINDOW2_SHOWHEADINGS );
+ rModel.mbShowZeros = getFlag( nFlags, BIFF_WINDOW2_SHOWZEROS );
+ rModel.mbShowOutline = getFlag( nFlags, BIFF_WINDOW2_SHOWOUTLINE );
if( getBiff() == BIFF8 )
{
- rData.mnViewType = getFlagValue( nFlags, BIFF_WINDOW2_PAGEBREAKMODE, XML_pageBreakPreview, XML_normal );
+ rModel.mnViewType = getFlagValue( nFlags, BIFF_WINDOW2_PAGEBREAKMODE, XML_pageBreakPreview, XML_normal );
- rData.maGridColor.importColorId( rStrm );
+ rModel.maGridColor.importColorId( rStrm );
// zoom data not included in chart sheets
if( (getSheetType() != SHEETTYPE_CHARTSHEET) && (rStrm.getRemaining() >= 6) )
{
rStrm.skip( 2 );
sal_uInt16 nPageZoom, nNormalZoom;
rStrm >> nPageZoom >> nNormalZoom;
- rData.mnSheetLayoutZoom = nPageZoom;
- rData.mnNormalZoom = nNormalZoom;
+ rModel.mnSheetLayoutZoom = nPageZoom;
+ rModel.mnNormalZoom = nNormalZoom;
}
}
else
{
- rData.maGridColor.importColorRgb( rStrm );
+ rModel.maGridColor.importColorRgb( rStrm );
}
}
}
void SheetViewSettings::importPane( BiffInputStream& rStrm )
{
- OSL_ENSURE( !maSheetDatas.empty(), "SheetViewSettings::importPane - missing leading WINDOW2 record" );
- if( !maSheetDatas.empty() )
+ OSL_ENSURE( !maSheetViews.empty(), "SheetViewSettings::importPane - missing leading WINDOW2 record" );
+ if( !maSheetViews.empty() )
{
sal_uInt8 nActivePaneId;
sal_uInt16 nSplitX, nSplitY;
BinAddress aSecondPos;
rStrm >> nSplitX >> nSplitY >> aSecondPos >> nActivePaneId;
- OoxSheetViewData& rData = *maSheetDatas.back();
- rData.mfSplitX = nSplitX;
- rData.mfSplitY = nSplitY;
- rData.maSecondPos = getAddressConverter().createValidCellAddress( aSecondPos, getSheetIndex(), false );
- rData.mnActivePaneId = lclGetOoxPaneId( nActivePaneId, XML_topLeft );
+ SheetViewModel& rModel = *maSheetViews.back();
+ rModel.mfSplitX = nSplitX;
+ rModel.mfSplitY = nSplitY;
+ rModel.maSecondPos = getAddressConverter().createValidCellAddress( aSecondPos, getSheetIndex(), false );
+ rModel.mnActivePaneId = lclGetOoxPaneId( nActivePaneId, XML_topLeft );
}
}
void SheetViewSettings::importScl( BiffInputStream& rStrm )
{
- OSL_ENSURE( !maSheetDatas.empty(), "SheetViewSettings::importScl - missing leading WINDOW2 record" );
- if( !maSheetDatas.empty() )
+ OSL_ENSURE( !maSheetViews.empty(), "SheetViewSettings::importScl - missing leading WINDOW2 record" );
+ if( !maSheetViews.empty() )
{
sal_uInt16 nNum, nDenom;
rStrm >> nNum >> nDenom;
OSL_ENSURE( nDenom > 0, "SheetViewSettings::importScl - invalid denominator" );
if( nDenom > 0 )
- maSheetDatas.back()->mnCurrentZoom = getLimitedValue< sal_Int32, sal_uInt16 >( (nNum * 100) / nDenom, 10, 400 );
+ maSheetViews.back()->mnCurrentZoom = getLimitedValue< sal_Int32, sal_uInt16 >( (nNum * 100) / nDenom, 10, 400 );
}
}
void SheetViewSettings::importSelection( BiffInputStream& rStrm )
{
- OSL_ENSURE( !maSheetDatas.empty(), "SheetViewSettings::importPane - missing leading WINDOW2 record" );
- if( !maSheetDatas.empty() )
+ OSL_ENSURE( !maSheetViews.empty(), "SheetViewSettings::importPane - missing leading WINDOW2 record" );
+ if( !maSheetViews.empty() )
{
// pane this selection belongs to
sal_uInt8 nPaneId = rStrm.readuInt8();
- OoxSheetSelectionData& rSelData = maSheetDatas.back()->createSelectionData( lclGetOoxPaneId( nPaneId, -1 ) );
+ PaneSelectionModel& rPaneSel = maSheetViews.back()->createPaneSelection( lclGetOoxPaneId( nPaneId, -1 ) );
// cursor position
BinAddress aActiveCell;
sal_uInt16 nActiveCellId;
rStrm >> aActiveCell >> nActiveCellId;
- rSelData.maActiveCell = getAddressConverter().createValidCellAddress( aActiveCell, getSheetIndex(), false );
- rSelData.mnActiveCellId = nActiveCellId;
+ rPaneSel.maActiveCell = getAddressConverter().createValidCellAddress( aActiveCell, getSheetIndex(), false );
+ rPaneSel.mnActiveCellId = nActiveCellId;
// selection
- rSelData.maSelection.clear();
+ rPaneSel.maSelection.clear();
BinRangeList aSelection;
aSelection.read( rStrm, false );
- getAddressConverter().convertToCellRangeList( rSelData.maSelection, aSelection, getSheetIndex(), false );
+ getAddressConverter().convertToCellRangeList( rPaneSel.maSelection, aSelection, getSheetIndex(), false );
}
}
void SheetViewSettings::finalizeImport()
{
- // force creation of sheet view data to get the Excel defaults
- OoxSheetViewDataRef xData = maSheetDatas.empty() ? createSheetViewData() : maSheetDatas.front();
+ // force creation of sheet view model to get the Excel defaults
+ SheetViewModelRef xModel = maSheetViews.empty() ? createSheetView() : maSheetViews.front();
// #i59590# #158194# special handling for chart sheets (Excel ignores some settings in chart sheets)
if( getSheetType() == SHEETTYPE_CHARTSHEET )
{
- xData->maSelMap.clear();
- xData->maFirstPos = xData->maSecondPos = CellAddress( getSheetIndex(), 0, 0 );
- xData->mnViewType = XML_normal;
- xData->mnActivePaneId = XML_topLeft;
- xData->mnPaneState = XML_split;
- xData->mfSplitX = xData->mfSplitY = 0.0;
- xData->mbRightToLeft = false;
- xData->mbDefGridColor = true;
- xData->mbShowFormulas = false;
- xData->mbShowGrid = true;
- xData->mbShowHeadings = true;
- xData->mbShowZeros = true;
- xData->mbShowOutline = true;
+ xModel->maPaneSelMap.clear();
+ xModel->maFirstPos = xModel->maSecondPos = CellAddress( getSheetIndex(), 0, 0 );
+ xModel->mnViewType = XML_normal;
+ xModel->mnActivePaneId = XML_topLeft;
+ xModel->mnPaneState = XML_split;
+ xModel->mfSplitX = xModel->mfSplitY = 0.0;
+ xModel->mbRightToLeft = false;
+ xModel->mbDefGridColor = true;
+ xModel->mbShowFormulas = false;
+ xModel->mbShowGrid = true;
+ xModel->mbShowHeadings = true;
+ xModel->mbShowZeros = true;
+ xModel->mbShowOutline = true;
}
// mirrored sheet (this is not a view setting in Calc)
- if( xData->mbRightToLeft )
+ if( xModel->mbRightToLeft )
{
- PropertySet aPropSet( getXSpreadsheet() );
- aPropSet.setProperty( CREATE_OUSTRING( "TableLayout" ), ::com::sun::star::text::WritingMode2::RL_TB );
+ PropertySet aPropSet( getSheet() );
+ aPropSet.setProperty( PROP_TableLayout, ::com::sun::star::text::WritingMode2::RL_TB );
}
// sheet selected (active sheet must be selected)
- bool bSelected = xData->mbSelected || (getSheetIndex() == getViewSettings().getActiveSheetIndex());
+ bool bSelected = xModel->mbSelected || (getSheetIndex() == getViewSettings().getActiveSheetIndex());
// visible area and current cursor position (selection not supported via API)
- CellAddress aFirstPos = xData->maFirstPos;
- const OoxSheetSelectionData* pSelData = xData->getActiveSelectionData();
- CellAddress aCursor = pSelData ? pSelData->maActiveCell : aFirstPos;
+ CellAddress aFirstPos = xModel->maFirstPos;
+ const PaneSelectionModel* pPaneSel = xModel->getActiveSelection();
+ CellAddress aCursor = pPaneSel ? pPaneSel->maActiveCell : aFirstPos;
// freeze/split position default
sal_Int16 nHSplitMode = API_SPLITMODE_NONE;
@@ -566,31 +516,31 @@ void SheetViewSettings::finalizeImport()
sal_Int16 nActivePane = API_SPLITPANE_BOTTOMLEFT;
// freeze/split position
- if( (xData->mnPaneState == XML_frozen) || (xData->mnPaneState == XML_frozenSplit) )
+ if( (xModel->mnPaneState == XML_frozen) || (xModel->mnPaneState == XML_frozenSplit) )
{
/* Frozen panes: handle split position as row/column positions.
#i35812# Excel uses number of visible rows/columns in the
frozen area (rows/columns scolled outside are not incuded),
Calc uses absolute position of first unfrozen row/column. */
const CellAddress& rMaxApiPos = getAddressConverter().getMaxApiAddress();
- if( (xData->mfSplitX >= 1.0) && (xData->maFirstPos.Column + xData->mfSplitX <= rMaxApiPos.Column) )
- nHSplitPos = static_cast< sal_Int32 >( xData->maFirstPos.Column + xData->mfSplitX );
+ if( (xModel->mfSplitX >= 1.0) && (xModel->maFirstPos.Column + xModel->mfSplitX <= rMaxApiPos.Column) )
+ nHSplitPos = static_cast< sal_Int32 >( xModel->maFirstPos.Column + xModel->mfSplitX );
nHSplitMode = (nHSplitPos > 0) ? API_SPLITMODE_FREEZE : API_SPLITMODE_NONE;
- if( (xData->mfSplitY >= 1.0) && (xData->maFirstPos.Row + xData->mfSplitY <= rMaxApiPos.Row) )
- nVSplitPos = static_cast< sal_Int32 >( xData->maFirstPos.Row + xData->mfSplitY );
+ if( (xModel->mfSplitY >= 1.0) && (xModel->maFirstPos.Row + xModel->mfSplitY <= rMaxApiPos.Row) )
+ nVSplitPos = static_cast< sal_Int32 >( xModel->maFirstPos.Row + xModel->mfSplitY );
nVSplitMode = (nVSplitPos > 0) ? API_SPLITMODE_FREEZE : API_SPLITMODE_NONE;
}
- else if( xData->mnPaneState == XML_split )
+ else if( xModel->mnPaneState == XML_split )
{
// split window: view settings API uses twips...
- nHSplitPos = getLimitedValue< sal_Int32, double >( xData->mfSplitX + 0.5, 0, SAL_MAX_INT32 );
+ nHSplitPos = getLimitedValue< sal_Int32, double >( xModel->mfSplitX + 0.5, 0, SAL_MAX_INT32 );
nHSplitMode = (nHSplitPos > 0) ? API_SPLITMODE_SPLIT : API_SPLITMODE_NONE;
- nVSplitPos = getLimitedValue< sal_Int32, double >( xData->mfSplitY + 0.5, 0, SAL_MAX_INT32 );
+ nVSplitPos = getLimitedValue< sal_Int32, double >( xModel->mfSplitY + 0.5, 0, SAL_MAX_INT32 );
nVSplitMode = (nVSplitPos > 0) ? API_SPLITMODE_SPLIT : API_SPLITMODE_NONE;
}
// active pane
- switch( xData->mnActivePaneId )
+ switch( xModel->mnActivePaneId )
{
// no horizontal split -> always use left panes
// no vertical split -> always use *bottom* panes
@@ -611,51 +561,50 @@ void SheetViewSettings::finalizeImport()
}
// automatic grid color
- if( xData->mbDefGridColor )
- xData->maGridColor.setAuto();
+ if( xModel->mbDefGridColor )
+ xModel->maGridColor.setAuto();
// write the sheet view settings into the property sequence
- PropertySequence aSheetProps( sppcSheetNames, sppcGlobalSheetNames );
- aSheetProps
- << bSelected
- << aCursor.Column
- << aCursor.Row
- << nHSplitMode
- << nVSplitMode
- << nHSplitPos
- << nVSplitPos
- << nActivePane
- << aFirstPos.Column
- << aFirstPos.Row
- << xData->maSecondPos.Column
- << ((nVSplitPos > 0) ? xData->maSecondPos.Row : xData->maFirstPos.Row)
- << API_ZOOMTYPE_PERCENT
- << static_cast< sal_Int16 >( xData->getNormalZoom() )
- << static_cast< sal_Int16 >( xData->getPageBreakZoom() )
- << xData->maGridColor.getColor( *this )
- << xData->isPageBreakPreview()
- << xData->mbShowFormulas
- << xData->mbShowGrid
- << xData->mbShowHeadings
- << xData->mbShowZeros
- << xData->mbShowOutline;
+ PropertyMap aPropMap;
+ aPropMap[ PROP_TableSelected ] <<= bSelected;
+ aPropMap[ PROP_CursorPositionX ] <<= aCursor.Column;
+ aPropMap[ PROP_CursorPositionY ] <<= aCursor.Row;
+ aPropMap[ PROP_HorizontalSplitMode ] <<= nHSplitMode;
+ aPropMap[ PROP_VerticalSplitMode ] <<= nVSplitMode;
+ aPropMap[ PROP_HorizontalSplitPositionTwips ] <<= nHSplitPos;
+ aPropMap[ PROP_VerticalSplitPositionTwips ] <<= nVSplitPos;
+ aPropMap[ PROP_ActiveSplitRange ] <<= nActivePane;
+ aPropMap[ PROP_PositionLeft ] <<= aFirstPos.Column;
+ aPropMap[ PROP_PositionTop ] <<= aFirstPos.Row;
+ aPropMap[ PROP_PositionRight ] <<= xModel->maSecondPos.Column;
+ aPropMap[ PROP_PositionBottom ] <<= ((nVSplitPos > 0) ? xModel->maSecondPos.Row : xModel->maFirstPos.Row);
+ aPropMap[ PROP_ZoomType ] <<= API_ZOOMTYPE_PERCENT;
+ aPropMap[ PROP_ZoomValue ] <<= static_cast< sal_Int16 >( xModel->getNormalZoom() );
+ aPropMap[ PROP_PageViewZoomValue ] <<= static_cast< sal_Int16 >( xModel->getPageBreakZoom() );
+ aPropMap[ PROP_GridColor ] <<= xModel->maGridColor.getColor( *this );
+ aPropMap[ PROP_ShowPageBreakPreview ] <<= xModel->isPageBreakPreview();
+ aPropMap[ PROP_ShowFormulas ] <<= xModel->mbShowFormulas;
+ aPropMap[ PROP_ShowGrid ] <<= xModel->mbShowGrid;
+ aPropMap[ PROP_HasColumnRowHeaders ] <<= xModel->mbShowHeadings;
+ aPropMap[ PROP_ShowZeroValues ] <<= xModel->mbShowZeros;
+ aPropMap[ PROP_IsOutlineSymbolsSet ] <<= xModel->mbShowOutline;
// store sheet view settings in global view settings object
- getViewSettings().setSheetViewSettings( getSheetIndex(), xData, Any( aSheetProps.createPropertySequence() ) );
+ getViewSettings().setSheetViewSettings( getSheetIndex(), xModel, Any( aPropMap.makePropertyValueSequence() ) );
}
// private --------------------------------------------------------------------
-OoxSheetViewDataRef SheetViewSettings::createSheetViewData()
+SheetViewModelRef SheetViewSettings::createSheetView()
{
- OoxSheetViewDataRef xData( new OoxSheetViewData );
- maSheetDatas.push_back( xData );
- return xData;
+ SheetViewModelRef xModel( new SheetViewModel );
+ maSheetViews.push_back( xModel );
+ return xModel;
}
// ============================================================================
-OoxWorkbookViewData::OoxWorkbookViewData() :
+WorkbookViewModel::WorkbookViewModel() :
mnWinX( 0 ),
mnWinY( 0 ),
mnWinWidth( 0 ),
@@ -680,31 +629,31 @@ ViewSettings::ViewSettings( const WorkbookHelper& rHelper ) :
void ViewSettings::importWorkbookView( const AttributeList& rAttribs )
{
- OoxWorkbookViewData& rData = createWorkbookViewData();
- rData.mnWinX = rAttribs.getInteger( XML_xWindow, 0 );
- rData.mnWinY = rAttribs.getInteger( XML_yWindow, 0 );
- rData.mnWinWidth = rAttribs.getInteger( XML_windowWidth, 0 );
- rData.mnWinHeight = rAttribs.getInteger( XML_windowHeight, 0 );
- rData.mnActiveSheet = rAttribs.getInteger( XML_activeTab, 0 );
- rData.mnFirstVisSheet = rAttribs.getInteger( XML_firstSheet, 0 );
- rData.mnTabBarWidth = rAttribs.getInteger( XML_tabRatio, 600 );
- rData.mnVisibility = rAttribs.getToken( XML_visibility, XML_visible );
- rData.mbShowTabBar = rAttribs.getBool( XML_showSheetTabs, true );
- rData.mbShowHorScroll = rAttribs.getBool( XML_showHorizontalScroll, true );
- rData.mbShowVerScroll = rAttribs.getBool( XML_showVerticalScroll, true );
- rData.mbMinimized = rAttribs.getBool( XML_minimized, false );
+ WorkbookViewModel& rModel = createWorkbookView();
+ rModel.mnWinX = rAttribs.getInteger( XML_xWindow, 0 );
+ rModel.mnWinY = rAttribs.getInteger( XML_yWindow, 0 );
+ rModel.mnWinWidth = rAttribs.getInteger( XML_windowWidth, 0 );
+ rModel.mnWinHeight = rAttribs.getInteger( XML_windowHeight, 0 );
+ rModel.mnActiveSheet = rAttribs.getInteger( XML_activeTab, 0 );
+ rModel.mnFirstVisSheet = rAttribs.getInteger( XML_firstSheet, 0 );
+ rModel.mnTabBarWidth = rAttribs.getInteger( XML_tabRatio, 600 );
+ rModel.mnVisibility = rAttribs.getToken( XML_visibility, XML_visible );
+ rModel.mbShowTabBar = rAttribs.getBool( XML_showSheetTabs, true );
+ rModel.mbShowHorScroll = rAttribs.getBool( XML_showHorizontalScroll, true );
+ rModel.mbShowVerScroll = rAttribs.getBool( XML_showVerticalScroll, true );
+ rModel.mbMinimized = rAttribs.getBool( XML_minimized, false );
}
void ViewSettings::importWorkbookView( RecordInputStream& rStrm )
{
- OoxWorkbookViewData& rData = createWorkbookViewData();
+ WorkbookViewModel& rModel = createWorkbookView();
sal_uInt8 nFlags;
- rStrm >> rData.mnWinX >> rData.mnWinY >> rData.mnWinWidth >> rData.mnWinHeight >> rData.mnTabBarWidth >> rData.mnFirstVisSheet >> rData.mnActiveSheet >> nFlags;
- rData.mnVisibility = getFlagValue( nFlags, OOBIN_WBVIEW_HIDDEN, XML_hidden, XML_visible );
- rData.mbShowTabBar = getFlag( nFlags, OOBIN_WBVIEW_SHOWTABBAR );
- rData.mbShowHorScroll = getFlag( nFlags, OOBIN_WBVIEW_SHOWHORSCROLL );
- rData.mbShowVerScroll = getFlag( nFlags, OOBIN_WBVIEW_SHOWVERSCROLL );
- rData.mbMinimized = getFlag( nFlags, OOBIN_WBVIEW_MINIMIZED );
+ rStrm >> rModel.mnWinX >> rModel.mnWinY >> rModel.mnWinWidth >> rModel.mnWinHeight >> rModel.mnTabBarWidth >> rModel.mnFirstVisSheet >> rModel.mnActiveSheet >> nFlags;
+ rModel.mnVisibility = getFlagValue( nFlags, OOBIN_WBVIEW_HIDDEN, XML_hidden, XML_visible );
+ rModel.mbShowTabBar = getFlag( nFlags, OOBIN_WBVIEW_SHOWTABBAR );
+ rModel.mbShowHorScroll = getFlag( nFlags, OOBIN_WBVIEW_SHOWHORSCROLL );
+ rModel.mbShowVerScroll = getFlag( nFlags, OOBIN_WBVIEW_SHOWVERSCROLL );
+ rModel.mbMinimized = getFlag( nFlags, OOBIN_WBVIEW_MINIMIZED );
}
void ViewSettings::importWindow1( BiffInputStream& rStrm )
@@ -713,39 +662,39 @@ void ViewSettings::importWindow1( BiffInputStream& rStrm )
rStrm >> nWinX >> nWinY >> nWinWidth >> nWinHeight;
// WINDOW1 record occures in every sheet in BIFF4W
- OSL_ENSURE( maBookDatas.empty() || ((getBiff() == BIFF4) && isWorkbookFile()),
+ OSL_ENSURE( maBookViews.empty() || ((getBiff() == BIFF4) && isWorkbookFile()),
"ViewSettings::importWindow1 - multiple WINDOW1 records" );
- OoxWorkbookViewData& rData = createWorkbookViewData();
- rData.mnWinX = nWinX;
- rData.mnWinY = nWinY;
- rData.mnWinWidth = nWinWidth;
- rData.mnWinHeight = nWinHeight;
+ WorkbookViewModel& rModel = createWorkbookView();
+ rModel.mnWinX = nWinX;
+ rModel.mnWinY = nWinY;
+ rModel.mnWinWidth = nWinWidth;
+ rModel.mnWinHeight = nWinHeight;
if( getBiff() <= BIFF4 )
{
sal_uInt8 nHidden;
rStrm >> nHidden;
- rData.mnVisibility = (nHidden == 0) ? XML_visible : XML_hidden;
+ rModel.mnVisibility = (nHidden == 0) ? XML_visible : XML_hidden;
}
else
{
sal_uInt16 nFlags, nActiveTab, nFirstVisTab, nSelectCnt, nTabBarWidth;
rStrm >> nFlags >> nActiveTab >> nFirstVisTab >> nSelectCnt >> nTabBarWidth;
- rData.mnActiveSheet = nActiveTab;
- rData.mnFirstVisSheet = nFirstVisTab;
- rData.mnTabBarWidth = nTabBarWidth;
- rData.mnVisibility = getFlagValue( nFlags, BIFF_WINDOW1_HIDDEN, XML_hidden, XML_visible );
- rData.mbMinimized = getFlag( nFlags, BIFF_WINDOW1_MINIMIZED );
- rData.mbShowHorScroll = getFlag( nFlags, BIFF_WINDOW1_SHOWHORSCROLL );
- rData.mbShowVerScroll = getFlag( nFlags, BIFF_WINDOW1_SHOWVERSCROLL );
- rData.mbShowTabBar = getFlag( nFlags, BIFF_WINDOW1_SHOWTABBAR );
+ rModel.mnActiveSheet = nActiveTab;
+ rModel.mnFirstVisSheet = nFirstVisTab;
+ rModel.mnTabBarWidth = nTabBarWidth;
+ rModel.mnVisibility = getFlagValue( nFlags, BIFF_WINDOW1_HIDDEN, XML_hidden, XML_visible );
+ rModel.mbMinimized = getFlag( nFlags, BIFF_WINDOW1_MINIMIZED );
+ rModel.mbShowHorScroll = getFlag( nFlags, BIFF_WINDOW1_SHOWHORSCROLL );
+ rModel.mbShowVerScroll = getFlag( nFlags, BIFF_WINDOW1_SHOWVERSCROLL );
+ rModel.mbShowTabBar = getFlag( nFlags, BIFF_WINDOW1_SHOWTABBAR );
}
}
-void ViewSettings::setSheetViewSettings( sal_Int32 nSheet, const OoxSheetViewDataRef& rxViewData, const Any& rProperties )
+void ViewSettings::setSheetViewSettings( sal_Int32 nSheet, const SheetViewModelRef& rxSheetView, const Any& rProperties )
{
- maSheetDatas[ nSheet ] = rxViewData;
+ maSheetViews[ nSheet ] = rxSheetView;
maSheetProps[ nSheet ] = rProperties;
}
@@ -754,8 +703,8 @@ void ViewSettings::finalizeImport()
const WorksheetBuffer& rWorksheets = getWorksheets();
if( rWorksheets.getSheetCount() <= 0 ) return;
- // force creation of workbook view data to get the Excel defaults
- const OoxWorkbookViewData& rData = maBookDatas.empty() ? createWorkbookViewData() : *maBookDatas.front();
+ // force creation of workbook view model to get the Excel defaults
+ const WorkbookViewModel& rModel = maBookViews.empty() ? createWorkbookView() : *maBookViews.front();
// show object mode is part of workbook settings
sal_Int16 nShowMode = getWorkbookSettings().getApiShowObjectMode();
@@ -764,36 +713,37 @@ void ViewSettings::finalizeImport()
Reference< XNameContainer > xSheetsNC = ContainerHelper::createNameContainer( getBaseFilter().getGlobalFactory() );
if( !xSheetsNC.is() ) return;
for( SheetPropertiesMap::const_iterator aIt = maSheetProps.begin(), aEnd = maSheetProps.end(); aIt != aEnd; ++aIt )
- ContainerHelper::insertByName( xSheetsNC, rWorksheets.getFinalSheetName( aIt->first ), aIt->second );
+ ContainerHelper::insertByName( xSheetsNC, rWorksheets.getCalcSheetName( aIt->first ), aIt->second );
- // use data of active sheet to set sheet properties that are document-global in Calc
+ // use active sheet to set sheet properties that are document-global in Calc
sal_Int32 nActiveSheet = getActiveSheetIndex();
- OoxSheetViewDataRef& rxActiveSheetData = maSheetDatas[ nActiveSheet ];
- OSL_ENSURE( rxActiveSheetData.get(), "ViewSettings::finalizeImport - missing active sheet view settings" );
- if( !rxActiveSheetData )
- rxActiveSheetData.reset( new OoxSheetViewData );
-
- PropertySequence aDocProps( sppcDocNames, sppcGlobalSheetNames );
- aDocProps
- << xSheetsNC
- << rWorksheets.getFinalSheetName( nActiveSheet )
- << rData.mbShowHorScroll
- << rData.mbShowVerScroll
- << rData.mbShowTabBar
- << double( rData.mnTabBarWidth / 1000.0 )
- << nShowMode << nShowMode << nShowMode
- << rxActiveSheetData->maGridColor.getColor( *this )
- << rxActiveSheetData->isPageBreakPreview()
- << rxActiveSheetData->mbShowFormulas
- << rxActiveSheetData->mbShowGrid
- << rxActiveSheetData->mbShowHeadings
- << rxActiveSheetData->mbShowZeros
- << rxActiveSheetData->mbShowOutline;
+ SheetViewModelRef& rxActiveSheetView = maSheetViews[ nActiveSheet ];
+ OSL_ENSURE( rxActiveSheetView.get(), "ViewSettings::finalizeImport - missing active sheet view settings" );
+ if( !rxActiveSheetView )
+ rxActiveSheetView.reset( new SheetViewModel );
Reference< XIndexContainer > xContainer = ContainerHelper::createIndexContainer( getBaseFilter().getGlobalFactory() );
if( xContainer.is() ) try
{
- xContainer->insertByIndex( 0, Any( aDocProps.createPropertySequence() ) );
+ PropertyMap aPropMap;
+ aPropMap[ PROP_Tables ] <<= xSheetsNC;
+ aPropMap[ PROP_ActiveTable ] <<= rWorksheets.getCalcSheetName( nActiveSheet );
+ aPropMap[ PROP_HasHorizontalScrollBar ] <<= rModel.mbShowHorScroll;
+ aPropMap[ PROP_HasVerticalScrollBar ] <<= rModel.mbShowVerScroll;
+ aPropMap[ PROP_HasSheetTabs ] <<= rModel.mbShowTabBar;
+ aPropMap[ PROP_RelativeHorizontalTabbarWidth ] <<= double( rModel.mnTabBarWidth / 1000.0 );
+ aPropMap[ PROP_ShowObjects ] <<= nShowMode;
+ aPropMap[ PROP_ShowCharts ] <<= nShowMode;
+ aPropMap[ PROP_ShowDrawing ] <<= nShowMode;
+ aPropMap[ PROP_GridColor ] <<= rxActiveSheetView->maGridColor.getColor( *this );
+ aPropMap[ PROP_ShowPageBreakPreview ] <<= rxActiveSheetView->isPageBreakPreview();
+ aPropMap[ PROP_ShowFormulas ] <<= rxActiveSheetView->mbShowFormulas;
+ aPropMap[ PROP_ShowGrid ] <<= rxActiveSheetView->mbShowGrid;
+ aPropMap[ PROP_HasColumnRowHeaders ] <<= rxActiveSheetView->mbShowHeadings;
+ aPropMap[ PROP_ShowZeroValues ] <<= rxActiveSheetView->mbShowZeros;
+ aPropMap[ PROP_IsOutlineSymbolsSet ] <<= rxActiveSheetView->mbShowOutline;
+
+ xContainer->insertByIndex( 0, Any( aPropMap.makePropertyValueSequence() ) );
Reference< XIndexAccess > xIAccess( xContainer, UNO_QUERY_THROW );
Reference< XViewDataSupplier > xViewDataSuppl( getDocument(), UNO_QUERY_THROW );
xViewDataSuppl->setViewData( xIAccess );
@@ -807,16 +757,16 @@ void ViewSettings::finalizeImport()
sal_Int32 ViewSettings::getActiveSheetIndex() const
{
sal_Int32 nSheetCount = getLimitedValue< sal_Int32, sal_Int32 >( getWorksheets().getSheetCount(), 1, SAL_MAX_INT32 );
- return maBookDatas.empty() ? 0 : getLimitedValue< sal_Int32, sal_Int32 >( maBookDatas.front()->mnActiveSheet, 0, nSheetCount - 1 );
+ return maBookViews.empty() ? 0 : getLimitedValue< sal_Int32, sal_Int32 >( maBookViews.front()->mnActiveSheet, 0, nSheetCount - 1 );
}
// private --------------------------------------------------------------------
-OoxWorkbookViewData& ViewSettings::createWorkbookViewData()
+WorkbookViewModel& ViewSettings::createWorkbookView()
{
- OoxWorkbookViewDataRef xData( new OoxWorkbookViewData );
- maBookDatas.push_back( xData );
- return *xData;
+ WorkbookViewModelRef xModel( new WorkbookViewModel );
+ maBookViews.push_back( xModel );
+ return *xModel;
}
// ============================================================================
diff --git a/oox/source/xls/workbookfragment.cxx b/oox/source/xls/workbookfragment.cxx
index d14c20f2ef0f..15b6e8a3e41e 100644
--- a/oox/source/xls/workbookfragment.cxx
+++ b/oox/source/xls/workbookfragment.cxx
@@ -40,7 +40,7 @@
#include "oox/xls/connectionsfragment.hxx"
#include "oox/xls/externallinkbuffer.hxx"
#include "oox/xls/externallinkfragment.hxx"
-#include "oox/xls/pivotcachefragment.hxx"
+#include "oox/xls/pivotcachebuffer.hxx"
#include "oox/xls/sharedstringsbuffer.hxx"
#include "oox/xls/sharedstringsfragment.hxx"
#include "oox/xls/stylesfragment.hxx"
@@ -57,6 +57,7 @@ using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::table::CellAddress;
+using ::oox::core::ContextHandlerRef;
using ::oox::core::FragmentHandlerRef;
using ::oox::core::RecordInfo;
using ::oox::core::Relation;
@@ -71,11 +72,6 @@ namespace {
const double PROGRESS_LENGTH_GLOBALS = 0.1; /// 10% of progress bar for globals import.
-const sal_uInt16 BIFF_FILEPASS_BIFF2 = 0x0000;
-const sal_uInt16 BIFF_FILEPASS_BIFF8 = 0x0001;
-const sal_uInt16 BIFF_FILEPASS_BIFF8_RCF = 0x0001;
-const sal_uInt16 BIFF_FILEPASS_BIFF8_STRONG = 0x0002;
-
} // namespace
// ============================================================================
@@ -88,46 +84,45 @@ OoxWorkbookFragment::OoxWorkbookFragment(
// oox.core.ContextHandler2Helper interface -----------------------------------
-ContextWrapper OoxWorkbookFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxWorkbookFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nElement == XLS_TOKEN( workbook ));
+ if( nElement == XLS_TOKEN( workbook ) ) return this;
+ break;
+
case XLS_TOKEN( workbook ):
- return (nElement == XLS_TOKEN( workbookPr )) ||
- (nElement == XLS_TOKEN( calcPr )) ||
- (nElement == XLS_TOKEN( sheets )) ||
- (nElement == XLS_TOKEN( bookViews )) ||
- (nElement == XLS_TOKEN( externalReferences )) ||
- (nElement == XLS_TOKEN( definedNames )) ||
- (nElement == XLS_TOKEN( pivotCaches ));
+ switch( nElement )
+ {
+ case XLS_TOKEN( sheets ):
+ case XLS_TOKEN( bookViews ):
+ case XLS_TOKEN( externalReferences ):
+ case XLS_TOKEN( definedNames ):
+ case XLS_TOKEN( pivotCaches ): return this;
+
+ case XLS_TOKEN( workbookPr ): getWorkbookSettings().importWorkbookPr( rAttribs ); break;
+ case XLS_TOKEN( calcPr ): getWorkbookSettings().importCalcPr( rAttribs ); break;
+ }
+ break;
+
case XLS_TOKEN( sheets ):
- return (nElement == XLS_TOKEN( sheet ));
+ if( nElement == XLS_TOKEN( sheet ) ) getWorksheets().importSheet( rAttribs );
+ break;
case XLS_TOKEN( bookViews ):
- return (nElement == XLS_TOKEN( workbookView ));
+ if( nElement == XLS_TOKEN( workbookView ) ) getViewSettings().importWorkbookView( rAttribs );
+ break;
case XLS_TOKEN( externalReferences ):
- return (nElement == XLS_TOKEN( externalReference ));
+ if( nElement == XLS_TOKEN( externalReference ) ) importExternalReference( rAttribs );
+ break;
case XLS_TOKEN( definedNames ):
- return (nElement == XLS_TOKEN( definedName ));
+ if( nElement == XLS_TOKEN( definedName ) ) { importDefinedName( rAttribs ); return this; } // collect formula
+ break;
case XLS_TOKEN( pivotCaches ):
- return (nElement == XLS_TOKEN( pivotCache ));
- }
- return false;
-}
-
-void OoxWorkbookFragment::onStartElement( const AttributeList& rAttribs )
-{
- switch( getCurrentElement() )
- {
- case XLS_TOKEN( workbookPr ): getWorkbookSettings().importWorkbookPr( rAttribs ); break;
- case XLS_TOKEN( calcPr ): getWorkbookSettings().importCalcPr( rAttribs ); break;
- case XLS_TOKEN( sheet ): getWorksheets().importSheet( rAttribs ); break;
- case XLS_TOKEN( workbookView ): getViewSettings().importWorkbookView( rAttribs ); break;
- case XLS_TOKEN( externalReference ): importExternalReference( rAttribs ); break;
- case XLS_TOKEN( definedName ): importDefinedName( rAttribs ); break;
- case XLS_TOKEN( pivotCache ): importPivotCache( rAttribs ); break;
+ if( nElement == XLS_TOKEN( pivotCache ) ) importPivotCache( rAttribs );
+ break;
}
+ return 0;
}
void OoxWorkbookFragment::onEndElement( const OUString& rChars )
@@ -140,48 +135,50 @@ void OoxWorkbookFragment::onEndElement( const OUString& rChars )
}
}
-ContextWrapper OoxWorkbookFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& )
+ContextHandlerRef OoxWorkbookFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nRecId == OOBIN_ID_WORKBOOK);
+ if( nRecId == OOBIN_ID_WORKBOOK ) return this;
+ break;
+
case OOBIN_ID_WORKBOOK:
- return (nRecId == OOBIN_ID_WORKBOOKPR) ||
- (nRecId == OOBIN_ID_CALCPR) ||
- (nRecId == OOBIN_ID_SHEETS) ||
- (nRecId == OOBIN_ID_BOOKVIEWS) ||
- (nRecId == OOBIN_ID_EXTERNALREFS) ||
- (nRecId == OOBIN_ID_DEFINEDNAME);
+ switch( nRecId )
+ {
+ case OOBIN_ID_SHEETS:
+ case OOBIN_ID_BOOKVIEWS:
+ case OOBIN_ID_EXTERNALREFS:
+ case OOBIN_ID_PIVOTCACHES: return this;
+
+ case OOBIN_ID_WORKBOOKPR: getWorkbookSettings().importWorkbookPr( rStrm ); break;
+ case OOBIN_ID_CALCPR: getWorkbookSettings().importCalcPr( rStrm ); break;
+ case OOBIN_ID_DEFINEDNAME: getDefinedNames().importDefinedName( rStrm ); break;
+ }
+ break;
+
case OOBIN_ID_SHEETS:
- return (nRecId == OOBIN_ID_SHEET);
+ if( nRecId == OOBIN_ID_SHEET ) getWorksheets().importSheet( rStrm );
+ break;
case OOBIN_ID_BOOKVIEWS:
- return (nRecId == OOBIN_ID_WORKBOOKVIEW);
+ if( nRecId == OOBIN_ID_WORKBOOKVIEW ) getViewSettings().importWorkbookView( rStrm );
+ break;
+
case OOBIN_ID_EXTERNALREFS:
- return (nRecId == OOBIN_ID_EXTERNALREF) ||
- (nRecId == OOBIN_ID_EXTERNALSELF) ||
- (nRecId == OOBIN_ID_EXTERNALSAME) ||
- (nRecId == OOBIN_ID_EXTERNALADDIN) ||
- (nRecId == OOBIN_ID_EXTERNALSHEETS);
- }
- return false;
-}
+ switch( nRecId )
+ {
+ case OOBIN_ID_EXTERNALREF: importExternalRef( rStrm ); break;
+ case OOBIN_ID_EXTERNALSELF: getExternalLinks().importExternalSelf( rStrm ); break;
+ case OOBIN_ID_EXTERNALSAME: getExternalLinks().importExternalSame( rStrm ); break;
+ case OOBIN_ID_EXTERNALADDIN: getExternalLinks().importExternalAddin( rStrm ); break;
+ case OOBIN_ID_EXTERNALSHEETS: getExternalLinks().importExternalSheets( rStrm ); break;
+ }
+ break;
-void OoxWorkbookFragment::onStartRecord( RecordInputStream& rStrm )
-{
- switch( getCurrentElement() )
- {
- case OOBIN_ID_WORKBOOKPR: getWorkbookSettings().importWorkbookPr( rStrm ); break;
- case OOBIN_ID_CALCPR: getWorkbookSettings().importCalcPr( rStrm ); break;
- case OOBIN_ID_SHEET: getWorksheets().importSheet( rStrm ); break;
- case OOBIN_ID_WORKBOOKVIEW: getViewSettings().importWorkbookView( rStrm ); break;
- case OOBIN_ID_EXTERNALREF: importExternalRef( rStrm ); break;
- case OOBIN_ID_EXTERNALSELF: getExternalLinks().importExternalSelf( rStrm ); break;
- case OOBIN_ID_EXTERNALSAME: getExternalLinks().importExternalSame( rStrm ); break;
- case OOBIN_ID_EXTERNALADDIN: getExternalLinks().importExternalAddin( rStrm ); break;
- case OOBIN_ID_EXTERNALSHEETS: getExternalLinks().importExternalSheets( rStrm ); break;
- case OOBIN_ID_DEFINEDNAME: getDefinedNames().importDefinedName( rStrm ); break;
+ case OOBIN_ID_PIVOTCACHES:
+ if( nRecId == OOBIN_ID_PIVOTCACHE ) importPivotCache( rStrm );
}
+ return 0;
}
// oox.core.FragmentHandler2 interface ----------------------------------------
@@ -193,6 +190,8 @@ const RecordInfo* OoxWorkbookFragment::getRecordInfos() const
{ OOBIN_ID_BOOKVIEWS, OOBIN_ID_BOOKVIEWS + 1 },
{ OOBIN_ID_EXTERNALREFS, OOBIN_ID_EXTERNALREFS + 1 },
{ OOBIN_ID_FUNCTIONGROUPS, OOBIN_ID_FUNCTIONGROUPS + 2 },
+ { OOBIN_ID_PIVOTCACHE, OOBIN_ID_PIVOTCACHE + 1 },
+ { OOBIN_ID_PIVOTCACHES, OOBIN_ID_PIVOTCACHES + 1 },
{ OOBIN_ID_SHEETS, OOBIN_ID_SHEETS + 1 },
{ OOBIN_ID_WORKBOOK, OOBIN_ID_WORKBOOK + 1 },
{ -1, -1 }
@@ -287,6 +286,7 @@ void OoxWorkbookFragment::finalizeImport()
SheetFragmentMap::iterator aIt = aSheetFragments.find( nSheet );
if( aIt != aSheetFragments.end() )
{
+ OOX_LOADSAVE_TIMER( IMPORTSHEETFRAGMENT );
// import the sheet fragment
importOoxFragment( aIt->second );
// delete fragment object, will free all allocated sheet buffers
@@ -296,8 +296,6 @@ void OoxWorkbookFragment::finalizeImport()
// final conversions, e.g. calculation settings and view settings
finalizeWorkbookImport();
-
- getPivotTables().finalizeImport();
}
// private --------------------------------------------------------------------
@@ -315,12 +313,9 @@ void OoxWorkbookFragment::importDefinedName( const AttributeList& rAttribs )
void OoxWorkbookFragment::importPivotCache( const AttributeList& rAttribs )
{
- OUString aFragmentPath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
- if( (aFragmentPath.getLength() > 0) && rAttribs.hasAttribute( XML_cacheId ) )
- {
- sal_uInt32 nCacheId = rAttribs.getUnsignedInteger( XML_cacheId, 0 );
- importOoxFragment( new OoxPivotCacheFragment( *this, aFragmentPath, nCacheId ) );
- }
+ sal_Int32 nCacheId = rAttribs.getInteger( XML_cacheId, -1 );
+ OUString aRelId = rAttribs.getString( R_TOKEN( id ), OUString() );
+ importPivotCacheDefFragment( aRelId, nCacheId );
}
void OoxWorkbookFragment::importExternalRef( RecordInputStream& rStrm )
@@ -329,6 +324,13 @@ void OoxWorkbookFragment::importExternalRef( RecordInputStream& rStrm )
importExternalLinkFragment( *pExtLink );
}
+void OoxWorkbookFragment::importPivotCache( RecordInputStream& rStrm )
+{
+ sal_Int32 nCacheId = rStrm.readInt32();
+ OUString aRelId = rStrm.readString();
+ importPivotCacheDefFragment( aRelId, nCacheId );
+}
+
void OoxWorkbookFragment::importExternalLinkFragment( ExternalLink& rExtLink )
{
OUString aFragmentPath = getFragmentPathFromRelId( rExtLink.getRelId() );
@@ -336,89 +338,16 @@ void OoxWorkbookFragment::importExternalLinkFragment( ExternalLink& rExtLink )
importOoxFragment( new OoxExternalLinkFragment( *this, aFragmentPath, rExtLink ) );
}
-// ============================================================================
-
-namespace {
-
-BiffDecoderRef lclImportFilePass_XOR( const WorkbookHelper& rHelper, BiffInputStream& rStrm )
+void OoxWorkbookFragment::importPivotCacheDefFragment( const OUString& rRelId, sal_Int32 nCacheId )
{
- BiffDecoderRef xDecoder;
- OSL_ENSURE( rStrm.getRemaining() == 4, "lclImportFilePass_XOR - wrong record size" );
- if( rStrm.getRemaining() == 4 )
- {
- sal_uInt16 nBaseKey, nHash;
- rStrm >> nBaseKey >> nHash;
- xDecoder.reset( new BiffDecoder_XOR( rHelper, nBaseKey, nHash ) );
- }
- return xDecoder;
+ // pivot caches will be imported on demand, here we just store the fragment path in the buffer
+ getPivotCaches().registerPivotCacheFragment( nCacheId, getFragmentPathFromRelId( rRelId ) );
}
-BiffDecoderRef lclImportFilePass_RCF( const WorkbookHelper& rHelper, BiffInputStream& rStrm )
-{
- BiffDecoderRef xDecoder;
- OSL_ENSURE( rStrm.getRemaining() == 48, "lclImportFilePass_RCF - wrong record size" );
- if( rStrm.getRemaining() == 48 )
- {
- sal_uInt8 pnDocId[ 16 ];
- sal_uInt8 pnSaltData[ 16 ];
- sal_uInt8 pnSaltHash[ 16 ];
- rStrm.readMemory( pnDocId, 16 );
- rStrm.readMemory( pnSaltData, 16 );
- rStrm.readMemory( pnSaltHash, 16 );
- xDecoder.reset( new BiffDecoder_RCF( rHelper, pnDocId, pnSaltData, pnSaltHash ) );
- }
- return xDecoder;
-}
-
-BiffDecoderRef lclImportFilePass_Strong( const WorkbookHelper& /*rHelper*/, BiffInputStream& /*rStrm*/ )
-{
- // not supported
- return BiffDecoderRef();
-}
-
-BiffDecoderRef lclImportFilePass2( const WorkbookHelper& rHelper, BiffInputStream& rStrm )
-{
- return lclImportFilePass_XOR( rHelper, rStrm );
-}
-
-BiffDecoderRef lclImportFilePass8( const WorkbookHelper& rHelper, BiffInputStream& rStrm )
-{
- BiffDecoderRef xDecoder;
-
- switch( rStrm.readuInt16() )
- {
- case BIFF_FILEPASS_BIFF2:
- xDecoder = lclImportFilePass_XOR( rHelper, rStrm );
- break;
-
- case BIFF_FILEPASS_BIFF8:
- rStrm.skip( 2 );
- switch( rStrm.readuInt16() )
- {
- case BIFF_FILEPASS_BIFF8_RCF:
- xDecoder = lclImportFilePass_RCF( rHelper, rStrm );
- break;
- case BIFF_FILEPASS_BIFF8_STRONG:
- xDecoder = lclImportFilePass_Strong( rHelper, rStrm );
- break;
- default:
- OSL_ENSURE( false, "lclImportFilePass8 - unknown BIFF8 encryption sub mode" );
- }
- break;
-
- default:
- OSL_ENSURE( false, "lclImportFilePass8 - unknown encryption mode" );
- }
-
- return xDecoder;
-}
-
-} // namespace
-
-// ----------------------------------------------------------------------------
+// ============================================================================
-BiffWorkbookFragment::BiffWorkbookFragment( const WorkbookHelper& rHelper, BiffInputStream& rStrm ) :
- BiffWorkbookFragmentBase( rHelper, rStrm )
+BiffWorkbookFragment::BiffWorkbookFragment( const WorkbookHelper& rHelper, const OUString& rStrmName ) :
+ BiffWorkbookFragmentBase( rHelper, rStrmName )
{
}
@@ -493,10 +422,10 @@ bool BiffWorkbookFragment::importWorkspaceFragment()
{
switch( mrStrm.getRecId() )
{
- case BIFF_ID_SHEET: rWorksheets.importSheet( mrStrm ); break;
- case BIFF_ID_CODEPAGE: setCodePage( mrStrm.readuInt16() ); break;
- case BIFF_ID_FILEPASS: bRet = importFilePass(); break;
- case BIFF_ID_SHEETHEADER: mrStrm.rewindRecord(); bLoop = false; break;
+ case BIFF_ID_SHEET: rWorksheets.importSheet( mrStrm ); break;
+ case BIFF_ID_CODEPAGE: setCodePage( mrStrm.readuInt16() ); break;
+ case BIFF_ID_FILEPASS: bRet = getCodecHelper().importFilePass( mrStrm ); break;
+ case BIFF_ID_SHEETHEADER: mrStrm.rewindRecord(); bLoop = false; break;
}
}
xGlobalsProgress->setPosition( 1.0 );
@@ -515,7 +444,7 @@ bool BiffWorkbookFragment::importWorkspaceFragment()
same order as SHEET records are). */
mrStrm.skip( 4 );
OUString aSheetName = mrStrm.readByteString( false, getTextEncoding() );
- sal_Int32 nCurrSheet = rWorksheets.getFinalSheetIndex( aSheetName );
+ sal_Int32 nCurrSheet = rWorksheets.getCalcSheetIndex( aSheetName );
// load the sheet fragment records
BiffFragmentType eSheetFragment = startFragment( getBiff() );
bNextSheet = importSheetFragment( *xSheetProgress, eSheetFragment, nCurrSheet );
@@ -533,6 +462,7 @@ bool BiffWorkbookFragment::importGlobalsFragment( ISegmentProgressBar& rProgress
SharedStringsBuffer& rSharedStrings = getSharedStrings();
StylesBuffer& rStyles = getStyles();
WorksheetBuffer& rWorksheets = getWorksheets();
+ PivotCacheBuffer& rPivotCaches = getPivotCaches();
// collect records that need to be loaded in a second pass
typedef ::std::vector< sal_Int64 > RecordHandleVec;
@@ -556,11 +486,11 @@ bool BiffWorkbookFragment::importGlobalsFragment( ISegmentProgressBar& rProgress
else switch( nRecId )
{
// records in all BIFF versions
- case BIFF_ID_CODEPAGE: setCodePage( mrStrm.readuInt16() ); break;
- case BIFF_ID_DATEMODE: rWorkbookSett.importDateMode( mrStrm ); break;
- case BIFF_ID_FILEPASS: bRet = importFilePass(); break;
- case BIFF_ID_PRECISION: rWorkbookSett.importPrecision( mrStrm ); break;
- case BIFF_ID_WINDOW1: rViewSett.importWindow1( mrStrm ); break;
+ case BIFF_ID_CODEPAGE: setCodePage( mrStrm.readuInt16() ); break;
+ case BIFF_ID_DATEMODE: rWorkbookSett.importDateMode( mrStrm ); break;
+ case BIFF_ID_FILEPASS: bRet = getCodecHelper().importFilePass( mrStrm ); break;
+ case BIFF_ID_PRECISION: rWorkbookSett.importPrecision( mrStrm ); break;
+ case BIFF_ID_WINDOW1: rViewSett.importWindow1( mrStrm ); break;
// BIFF specific records
default: switch( getBiff() )
@@ -611,41 +541,43 @@ bool BiffWorkbookFragment::importGlobalsFragment( ISegmentProgressBar& rProgress
case BIFF5: switch( nRecId )
{
- case BIFF_ID_BOOKBOOL: rWorkbookSett.importBookBool( mrStrm ); break;
- case BIFF_ID_CRN: bExtLinkRec = true; break;
- case BIFF5_ID_DEFINEDNAME: bExtLinkRec = true; break;
- case BIFF5_ID_EXTERNALNAME: bExtLinkRec = true; break;
- case BIFF_ID_EXTERNSHEET: bExtLinkRec = true; break;
- case BIFF5_ID_FONT: rStyles.importFont( mrStrm ); break;
- case BIFF4_ID_FORMAT: rStyles.importFormat( mrStrm ); break;
- case BIFF_ID_HIDEOBJ: rWorkbookSett.importHideObj( mrStrm ); break;
- case BIFF_ID_PALETTE: rStyles.importPalette( mrStrm ); break;
- case BIFF_ID_SHEET: rWorksheets.importSheet( mrStrm ); break;
- case BIFF_ID_STYLE: rStyles.importStyle( mrStrm ); break;
- case BIFF_ID_XCT: bExtLinkRec = true; break;
- case BIFF5_ID_XF: rStyles.importXf( mrStrm ); break;
+ case BIFF_ID_BOOKBOOL: rWorkbookSett.importBookBool( mrStrm ); break;
+ case BIFF_ID_CRN: bExtLinkRec = true; break;
+ case BIFF5_ID_DEFINEDNAME: bExtLinkRec = true; break;
+ case BIFF5_ID_EXTERNALNAME: bExtLinkRec = true; break;
+ case BIFF_ID_EXTERNSHEET: bExtLinkRec = true; break;
+ case BIFF5_ID_FONT: rStyles.importFont( mrStrm ); break;
+ case BIFF4_ID_FORMAT: rStyles.importFormat( mrStrm ); break;
+ case BIFF_ID_HIDEOBJ: rWorkbookSett.importHideObj( mrStrm ); break;
+ case BIFF_ID_PALETTE: rStyles.importPalette( mrStrm ); break;
+ case BIFF_ID_PIVOTCACHE: rPivotCaches.importPivotCacheRef( mrStrm ); break;
+ case BIFF_ID_SHEET: rWorksheets.importSheet( mrStrm ); break;
+ case BIFF_ID_STYLE: rStyles.importStyle( mrStrm ); break;
+ case BIFF_ID_XCT: bExtLinkRec = true; break;
+ case BIFF5_ID_XF: rStyles.importXf( mrStrm ); break;
}
break;
case BIFF8: switch( nRecId )
{
- case BIFF_ID_BOOKBOOL: rWorkbookSett.importBookBool( mrStrm ); break;
- case BIFF_ID_CODENAME: rWorkbookSett.importCodeName( mrStrm ); break;
- case BIFF_ID_CRN: bExtLinkRec = true; break;
- case BIFF5_ID_DEFINEDNAME: bExtLinkRec = true; break;
- case BIFF_ID_EXTERNALBOOK: bExtLinkRec = true; break;
- case BIFF5_ID_EXTERNALNAME: bExtLinkRec = true; break;
- case BIFF_ID_EXTERNSHEET: bExtLinkRec = true; break;
- case BIFF5_ID_FONT: rStyles.importFont( mrStrm ); break;
- case BIFF4_ID_FORMAT: rStyles.importFormat( mrStrm ); break;
- case BIFF_ID_HIDEOBJ: rWorkbookSett.importHideObj( mrStrm ); break;
- case BIFF_ID_PALETTE: rStyles.importPalette( mrStrm ); break;
- case BIFF_ID_SHEET: rWorksheets.importSheet( mrStrm ); break;
- case BIFF_ID_SST: rSharedStrings.importSst( mrStrm ); break;
- case BIFF_ID_STYLE: rStyles.importStyle( mrStrm ); break;
- case BIFF_ID_USESELFS: rWorkbookSett.importUsesElfs( mrStrm ); break;
- case BIFF_ID_XCT: bExtLinkRec = true; break;
- case BIFF5_ID_XF: rStyles.importXf( mrStrm ); break;
+ case BIFF_ID_BOOKBOOL: rWorkbookSett.importBookBool( mrStrm ); break;
+ case BIFF_ID_CODENAME: rWorkbookSett.importCodeName( mrStrm ); break;
+ case BIFF_ID_CRN: bExtLinkRec = true; break;
+ case BIFF5_ID_DEFINEDNAME: bExtLinkRec = true; break;
+ case BIFF_ID_EXTERNALBOOK: bExtLinkRec = true; break;
+ case BIFF5_ID_EXTERNALNAME: bExtLinkRec = true; break;
+ case BIFF_ID_EXTERNSHEET: bExtLinkRec = true; break;
+ case BIFF5_ID_FONT: rStyles.importFont( mrStrm ); break;
+ case BIFF4_ID_FORMAT: rStyles.importFormat( mrStrm ); break;
+ case BIFF_ID_HIDEOBJ: rWorkbookSett.importHideObj( mrStrm ); break;
+ case BIFF_ID_PALETTE: rStyles.importPalette( mrStrm ); break;
+ case BIFF_ID_PIVOTCACHE: rPivotCaches.importPivotCacheRef( mrStrm ); break;
+ case BIFF_ID_SHEET: rWorksheets.importSheet( mrStrm ); break;
+ case BIFF_ID_SST: rSharedStrings.importSst( mrStrm ); break;
+ case BIFF_ID_STYLE: rStyles.importStyle( mrStrm ); break;
+ case BIFF_ID_USESELFS: rWorkbookSett.importUsesElfs( mrStrm ); break;
+ case BIFF_ID_XCT: bExtLinkRec = true; break;
+ case BIFF5_ID_XF: rStyles.importXf( mrStrm ); break;
}
break;
@@ -767,20 +699,6 @@ bool BiffWorkbookFragment::importSheetFragment( ISegmentProgressBar& rProgressBa
return xFragment->isValidSheet() && xFragment->importFragment();
}
-bool BiffWorkbookFragment::importFilePass()
-{
- mrStrm.enableDecoder( false );
- BiffDecoderRef xDecoder = (getBiff() == BIFF8) ?
- lclImportFilePass8( *this, mrStrm ) : lclImportFilePass2( *this, mrStrm );
-
- // set decoder at import stream
- mrStrm.setDecoder( xDecoder );
- //! TODO remember encryption state for export
-// mrStrm.GetRoot().GetExtDocOptions().GetDocSettings().mbEncrypted = true;
-
- return xDecoder.get() && xDecoder->isValid();
-}
-
// ============================================================================
} // namespace xls
diff --git a/oox/source/xls/workbookhelper.cxx b/oox/source/xls/workbookhelper.cxx
index 03a0cc8d97c4..6697b1d86f85 100644
--- a/oox/source/xls/workbookhelper.cxx
+++ b/oox/source/xls/workbookhelper.cxx
@@ -30,7 +30,6 @@
#include "oox/xls/workbookhelper.hxx"
#include <osl/thread.h>
-#include <osl/time.h>
#include <rtl/strbuf.hxx>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
@@ -45,21 +44,23 @@
#include <com/sun/star/sheet/XExternalDocLinks.hpp>
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include "properties.hxx"
#include "oox/helper/progressbar.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/core/binaryfilterbase.hxx"
#include "oox/core/xmlfilterbase.hxx"
#include "oox/drawingml/theme.hxx"
#include "oox/xls/addressconverter.hxx"
+#include "oox/xls/biffcodec.hxx"
#include "oox/xls/defnamesbuffer.hxx"
#include "oox/xls/excelchartconverter.hxx"
#include "oox/xls/externallinkbuffer.hxx"
#include "oox/xls/formulaparser.hxx"
#include "oox/xls/pagesettings.hxx"
+#include "oox/xls/pivotcachebuffer.hxx"
#include "oox/xls/pivottablebuffer.hxx"
#include "oox/xls/sharedstringsbuffer.hxx"
#include "oox/xls/stylesbuffer.hxx"
-#include "oox/xls/stylespropertyhelper.hxx"
#include "oox/xls/tablebuffer.hxx"
#include "oox/xls/themebuffer.hxx"
#include "oox/xls/unitconverter.hxx"
@@ -75,6 +76,7 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_SET_THROW;
using ::com::sun::star::container::XIndexAccess;
using ::com::sun::star::container::XNameAccess;
using ::com::sun::star::container::XNameContainer;
@@ -82,6 +84,9 @@ using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::awt::XDevice;
using ::com::sun::star::document::XActionLockable;
using ::com::sun::star::table::CellAddress;
+using ::com::sun::star::table::CellRangeAddress;
+using ::com::sun::star::table::XCell;
+using ::com::sun::star::table::XCellRange;
using ::com::sun::star::sheet::XSpreadsheetDocument;
using ::com::sun::star::sheet::XSpreadsheet;
using ::com::sun::star::sheet::XNamedRange;
@@ -96,54 +101,156 @@ using ::oox::core::FragmentHandler;
using ::oox::core::XmlFilterBase;
using ::oox::drawingml::Theme;
-// Set this define to 1 to show the load/save time of a document in an assertion.
-#define OOX_SHOW_LOADSAVE_TIME 0
-
namespace oox {
namespace xls {
-// ============================================================================
+// DEBUG ======================================================================
#if OSL_DEBUG_LEVEL > 0
+namespace dbg {
-struct WorkbookDataDebug
-{
-#if OOX_SHOW_LOADSAVE_TIME
- TimeValue maStartTime;
-#endif
- sal_Int32 mnDebugCount;
+// ----------------------------------------------------------------------------
+
+#if OOX_SHOW_LOADSAVE_TIME > 0
- explicit WorkbookDataDebug();
- ~WorkbookDataDebug();
+struct TimeCount
+{
+ sal_Int64 mnTime;
+ sal_Int32 mnCount;
+ inline explicit TimeCount() : mnTime( 0 ), mnCount( 0 ) {}
};
-WorkbookDataDebug::WorkbookDataDebug() :
- mnDebugCount( 0 )
+Timer::Timer( TimeCount& rTimeCount ) :
+ mrTimeCount( rTimeCount )
{
-#if OOX_SHOW_LOADSAVE_TIME
+ ++mrTimeCount.mnCount;
osl_getSystemTime( &maStartTime );
-#endif
}
-WorkbookDataDebug::~WorkbookDataDebug()
+Timer::~Timer()
{
-#if OOX_SHOW_LOADSAVE_TIME
TimeValue aEndTime;
osl_getSystemTime( &aEndTime );
- sal_Int32 nMillis = (aEndTime.Seconds - maStartTime.Seconds) * 1000 + static_cast< sal_Int32 >( aEndTime.Nanosec - maStartTime.Nanosec ) / 1000000;
- OSL_ENSURE( false, OStringBuffer( "load/save time = " ).append( nMillis / 1000.0 ).append( " seconds" ).getStr() );
+ mrTimeCount.mnTime += (SAL_CONST_INT64( 1000000000 ) * (aEndTime.Seconds - maStartTime.Seconds) + aEndTime.Nanosec - maStartTime.Nanosec);
+}
+
+#endif
+
+// ----------------------------------------------------------------------------
+
+struct WorkbookData
+{
+#if OOX_SHOW_LOADSAVE_TIME > 0
+ typedef ::std::vector< TimeCount > TimeCountVector;
+ typedef ::boost::shared_ptr< Timer > TimerRef;
+ TimeCountVector maTimeCounts;
+ TimerRef mxTotal;
#endif
- OSL_ENSURE( mnDebugCount == 0,
- OStringBuffer( "WorkbookDataDebug::~WorkbookDataDebug - failed to delete " ).append( mnDebugCount ).append( " objects" ).getStr() );
+ sal_Int32 mnObjCount;
+
+ explicit WorkbookData();
+ ~WorkbookData();
+#if OOX_SHOW_LOADSAVE_TIME > 0
+ TimeCount& getTimeCount( TimerType eType );
+#endif
+};
+
+WorkbookData::WorkbookData() :
+#if OOX_SHOW_LOADSAVE_TIME > 0
+ maTimeCounts( static_cast< size_t >( TIMER_TOTAL + 1 ) ),
+ mxTotal( new Timer( getTimeCount( TIMER_TOTAL ) ) ),
+#endif
+ mnObjCount( 0 )
+{
}
+WorkbookData::~WorkbookData()
+{
+#if OOX_SHOW_LOADSAVE_TIME > 0
+ mxTotal.reset();
+ static const sal_Char* sppcNames[] =
+ {
+ "importFormula\t",
+ "importSheetFragment",
+ " onCreateSheetContext",
+ " importRow\t",
+ " convertRowFormat",
+ " convertColumnFormat",
+ " importCell\t",
+ " onEndSheetElement",
+ " setCell\t\t",
+ " setCellFormat\t",
+ " mergeCellFormats",
+ " writeCellProperties",
+ " finalizeSheetData",
+ " finalizeDrawing",
+ "finalizeBookData",
+ "total\t\t"
+ };
+ OStringBuffer aBuffer( "Call counts and load/save times:\n" );
+ sal_Int32 nIdx = 0;
+ for( TimeCountVector::iterator aIt = maTimeCounts.begin(), aEnd = maTimeCounts.end(); aIt != aEnd; ++aIt, ++nIdx )
+ {
+ if( aIt->mnCount > 0 )
+ {
+ aBuffer.append( nIdx ).append( ":\t" ).append( sppcNames[ nIdx ] ).
+ append( "\tn=" ).append( aIt->mnCount ).append( ',' ).
+ append( "\tt=" ).append( (aIt->mnTime / 100000000) / 10.0 ).append( 's' ).
+ append( "\t(" ).append( static_cast< sal_Int32 >( ((aIt->mnTime * 1000) / maTimeCounts.back().mnTime) / 10 ) ).append( "%)" );
+ if( aIt->mnCount > 1 )
+ aBuffer.append( "\tt/n=" ).append( static_cast< sal_Int32 >( aIt->mnTime / aIt->mnCount / 1000 ) ).append( "mys" );
+ aBuffer.append( '\n' );
+ }
+ }
+ OSL_ENSURE( false, aBuffer.getStr() );
+#endif
+ OSL_ENSURE( mnObjCount == 0,
+ OStringBuffer( "WorkbookData::~WorkbookData - failed to delete " ).append( mnObjCount ).append( " objects" ).getStr() );
+}
+
+#if OOX_SHOW_LOADSAVE_TIME > 0
+TimeCount& WorkbookData::getTimeCount( TimerType eType )
+{
+ return maTimeCounts[ static_cast< size_t >( eType ) ];
+}
+#endif
+
+// ----------------------------------------------------------------------------
+
+WorkbookHelper::WorkbookHelper( WorkbookData& rBookData ) :
+ mrDbgBookData( rBookData )
+{
+ ++mrDbgBookData.mnObjCount;
+}
+
+WorkbookHelper::WorkbookHelper( const WorkbookHelper& rCopy ) :
+ mrDbgBookData( rCopy.mrDbgBookData )
+{
+ ++mrDbgBookData.mnObjCount;
+}
+
+WorkbookHelper::~WorkbookHelper()
+{
+ --mrDbgBookData.mnObjCount;
+}
+
+#if OOX_SHOW_LOADSAVE_TIME > 0
+TimeCount& WorkbookHelper::getTimeCount( TimerType eType ) const
+{
+ return mrDbgBookData.getTimeCount( eType );
+}
+#endif
+
+// ----------------------------------------------------------------------------
+
+} // namespace dbg
#endif
// ============================================================================
class WorkbookData
#if OSL_DEBUG_LEVEL > 0
- : public WorkbookDataDebug
+ : public dbg::WorkbookData
#endif
{
public:
@@ -173,8 +280,6 @@ public:
/** Returns a reference to the source/target spreadsheet document model. */
inline Reference< XSpreadsheetDocument > getDocument() const { return mxDoc; }
- /** Returns a reference to the specified spreadsheet in the document model. */
- Reference< XSpreadsheet > getSheet( sal_Int32 nSheet ) const;
/** Returns the reference device of the document. */
Reference< XDevice > getReferenceDevice() const;
/** Returns the container for defined names from the Calc document. */
@@ -218,8 +323,10 @@ public:
inline TableBuffer& getTables() const { return *mxTables; }
/** Returns the web queries. */
inline WebQueryBuffer& getWebQueries() const { return *mxWebQueries; }
- /** Returns the pivot tables. */
- inline PivotTableBuffer& getPivotTables() const { return *mxPivotTables; }
+ /** Returns the collection of pivot caches. */
+ inline PivotCacheBuffer& getPivotCaches() const { return *mxPivotCaches; }
+ /** Returns the collection of pivot tables. */
+ inline PivotTableBuffer& getPivotTables() { return *mxPivotTables; }
// converters -------------------------------------------------------------
@@ -231,13 +338,8 @@ public:
inline AddressConverter& getAddressConverter() const { return *mxAddrConverter; }
/** Returns the chart object converter. */
inline ExcelChartConverter& getChartConverter() const { return *mxChartConverter; }
-
- // property helpers -------------------------------------------------------
-
- /** Returns the converter for properties related to cell styles. */
- inline StylesPropertyHelper& getStylesPropertyHelper() const { return *mxStylesPropHlp; }
- /** Returns the converter for properties related to page/print settings. */
- inline PageSettingsPropertyHelper& getPageSettingsPropertyHelper() const { return *mxPageSettPropHlp; }
+ /** Returns the page/print settings converter. */
+ inline PageSettingsConverter& getPageSettingsConverter() const { return *mxPageSettConverter; }
// OOX specific -----------------------------------------------------------
@@ -262,8 +364,8 @@ public:
void setIsWorkbookFile();
/** Recreates global buffers that are used per sheet in specific BIFF versions. */
void createBuffersPerSheet();
- /** Looks for a password provided via API, or queries it via GUI. */
- OUString queryPassword();
+ /** Returns the codec helper that stores the encoder/decoder object. */
+ inline BiffCodecHelper& getCodecHelper() { return *mxCodecHelper; }
private:
/** Initializes some basic members and sets needed document properties. */
@@ -272,32 +374,28 @@ private:
void finalize();
private:
- typedef ::std::auto_ptr< SegmentProgressBar > ProgressBarPtr;
- typedef ::std::auto_ptr< WorkbookSettings > WorkbookSettPtr;
- typedef ::std::auto_ptr< ViewSettings > ViewSettingsPtr;
- typedef ::std::auto_ptr< WorksheetBuffer > WorksheetBfrPtr;
- typedef ::boost::shared_ptr< ThemeBuffer > ThemeBfrRef;
- typedef ::std::auto_ptr< StylesBuffer > StylesBfrPtr;
- typedef ::std::auto_ptr< SharedStringsBuffer > SharedStrBfrPtr;
- typedef ::std::auto_ptr< ExternalLinkBuffer > ExtLinkBfrPtr;
- typedef ::std::auto_ptr< DefinedNamesBuffer > DefNamesBfrPtr;
- typedef ::std::auto_ptr< TableBuffer > TableBfrPtr;
- typedef ::std::auto_ptr< WebQueryBuffer > WebQueryBfrPtr;
- typedef ::std::auto_ptr< PivotTableBuffer > PivotTableBfrPtr;
- typedef ::std::auto_ptr< UnitConverter > UnitConvPtr;
- typedef ::std::auto_ptr< AddressConverter > AddressConvPtr;
- typedef ::std::auto_ptr< ExcelChartConverter > ExcelChartConvPtr;
- typedef ::std::auto_ptr< StylesPropertyHelper > StylesPropHlpPtr;
- typedef ::std::auto_ptr< PageSettingsPropertyHelper > PageSettPropHlpPtr;
- typedef ::std::auto_ptr< FormulaParser > FormulaParserPtr;
-
- OUString maRefDeviceProp; /// Property name for reference device.
- OUString maNamedRangesProp; /// Property name for defined names.
- OUString maDatabaseRangesProp; /// Property name for database ranges.
- OUString maExtDocLinksProp; /// Property name for external links.
- OUString maDdeLinksProp; /// Property name for DDE links.
- OUString maCellStylesProp; /// Property name for cell styles.
- OUString maPageStylesProp; /// Property name for page styles.
+ typedef ::std::auto_ptr< SegmentProgressBar > ProgressBarPtr;
+ typedef ::std::auto_ptr< WorkbookSettings > WorkbookSettPtr;
+ typedef ::std::auto_ptr< ViewSettings > ViewSettingsPtr;
+ typedef ::std::auto_ptr< WorksheetBuffer > WorksheetBfrPtr;
+ typedef ::boost::shared_ptr< ThemeBuffer > ThemeBfrRef;
+ typedef ::std::auto_ptr< StylesBuffer > StylesBfrPtr;
+ typedef ::std::auto_ptr< SharedStringsBuffer > SharedStrBfrPtr;
+ typedef ::std::auto_ptr< ExternalLinkBuffer > ExtLinkBfrPtr;
+ typedef ::std::auto_ptr< DefinedNamesBuffer > DefNamesBfrPtr;
+ typedef ::std::auto_ptr< TableBuffer > TableBfrPtr;
+ typedef ::std::auto_ptr< WebQueryBuffer > WebQueryBfrPtr;
+ typedef ::std::auto_ptr< PivotCacheBuffer > PivotCacheBfrPtr;
+ typedef ::std::auto_ptr< PivotTableBuffer > PivotTableBfrPtr;
+ typedef ::std::auto_ptr< UnitConverter > UnitConvPtr;
+ typedef ::std::auto_ptr< AddressConverter > AddressConvPtr;
+ typedef ::std::auto_ptr< ExcelChartConverter > ExcelChartConvPtr;
+ typedef ::std::auto_ptr< PageSettingsConverter > PageSettConvPtr;
+ typedef ::std::auto_ptr< FormulaParser > FormulaParserPtr;
+ typedef ::std::auto_ptr< BiffCodecHelper > BiffCodecHelperPtr;
+
+ OUString maCellStyles; /// Style family name for cell styles.
+ OUString maPageStyles; /// Style family name for page styles.
OUString maCellStyleServ; /// Service name for a cell style.
OUString maPageStyleServ; /// Service name for a page style.
Reference< XSpreadsheetDocument > mxDoc; /// Document model.
@@ -318,28 +416,25 @@ private:
DefNamesBfrPtr mxDefNames; /// All defined names.
TableBfrPtr mxTables; /// All tables (database ranges).
WebQueryBfrPtr mxWebQueries; /// Web queries buffer.
- PivotTableBfrPtr mxPivotTables; /// Pivot tables buffer.
+ PivotCacheBfrPtr mxPivotCaches; /// All pivot caches in the document.
+ PivotTableBfrPtr mxPivotTables; /// All pivot tables in the document.
// converters
FormulaParserPtr mxFmlaParser; /// Import formula parser.
UnitConvPtr mxUnitConverter; /// General unit converter.
AddressConvPtr mxAddrConverter; /// Cell address and cell range address converter.
ExcelChartConvPtr mxChartConverter; /// Chart object converter.
-
- // property helpers
- StylesPropHlpPtr mxStylesPropHlp; /// Helper for all styles properties.
- PageSettPropHlpPtr mxPageSettPropHlp; /// Helper for page/print properties.
+ PageSettConvPtr mxPageSettConverter; /// Page/print settings converter.
// OOX specific
XmlFilterBase* mpOoxFilter; /// Base OOX filter object.
// BIFF specific
BinaryFilterBase* mpBiffFilter; /// Base BIFF filter object.
- ::rtl::OUString maPassword; /// Password for stream encoder/decoder.
+ BiffCodecHelperPtr mxCodecHelper; /// Encoder/decoder helper.
BiffType meBiff; /// BIFF version for BIFF import/export.
rtl_TextEncoding meTextEnc; /// BIFF byte string text encoding.
bool mbHasCodePage; /// True = CODEPAGE record exists in imported stream.
- bool mbHasPassword; /// True = password already querried.
};
// ----------------------------------------------------------------------------
@@ -373,7 +468,7 @@ Reference< XDevice > WorkbookData::getReferenceDevice() const
{
PropertySet aPropSet( mxDoc );
Reference< XDevice > xDevice;
- aPropSet.getProperty( xDevice, maRefDeviceProp );
+ aPropSet.getProperty( xDevice, PROP_ReferenceDevice );
return xDevice;
}
@@ -381,7 +476,7 @@ Reference< XNamedRanges > WorkbookData::getNamedRanges() const
{
PropertySet aPropSet( mxDoc );
Reference< XNamedRanges > xNamedRanges;
- aPropSet.getProperty( xNamedRanges, maNamedRangesProp );
+ aPropSet.getProperty( xNamedRanges, PROP_NamedRanges );
return xNamedRanges;
}
@@ -389,7 +484,7 @@ Reference< XDatabaseRanges > WorkbookData::getDatabaseRanges() const
{
PropertySet aPropSet( mxDoc );
Reference< XDatabaseRanges > xDatabaseRanges;
- aPropSet.getProperty( xDatabaseRanges, maDatabaseRangesProp );
+ aPropSet.getProperty( xDatabaseRanges, PROP_DatabaseRanges );
return xDatabaseRanges;
}
@@ -397,7 +492,7 @@ Reference< XExternalDocLinks > WorkbookData::getExternalDocLinks() const
{
PropertySet aPropSet( mxDoc );
Reference< XExternalDocLinks > xDocLinks;
- aPropSet.getProperty( xDocLinks, maExtDocLinksProp );
+ aPropSet.getProperty( xDocLinks, PROP_ExternalDocLinks );
return xDocLinks;
}
@@ -405,7 +500,7 @@ Reference< XNameAccess > WorkbookData::getDdeLinks() const
{
PropertySet aPropSet( mxDoc );
Reference< XNameAccess > xDdeLinks;
- aPropSet.getProperty( xDdeLinks, maDdeLinksProp );
+ aPropSet.getProperty( xDdeLinks, PROP_DDELinks );
return xDdeLinks;
}
@@ -416,7 +511,7 @@ Reference< XNameContainer > WorkbookData::getStyleFamily( bool bPageStyles ) con
{
Reference< XStyleFamiliesSupplier > xFamiliesSup( mxDoc, UNO_QUERY_THROW );
Reference< XNameAccess > xFamiliesNA( xFamiliesSup->getStyleFamilies(), UNO_QUERY_THROW );
- xStylesNC.set( xFamiliesNA->getByName( bPageStyles ? maPageStylesProp : maCellStylesProp ), UNO_QUERY_THROW );
+ xStylesNC.set( xFamiliesNA->getByName( bPageStyles ? maPageStyles : maCellStyles ), UNO_QUERY );
}
catch( Exception& )
{
@@ -428,10 +523,10 @@ Reference< XNameContainer > WorkbookData::getStyleFamily( bool bPageStyles ) con
Reference< XStyle > WorkbookData::getStyleObject( const OUString& rStyleName, bool bPageStyle ) const
{
Reference< XStyle > xStyle;
- Reference< XNameContainer > xStylesNC = getStyleFamily( bPageStyle );
- if( xStylesNC.is() ) try
+ try
{
- xStyle.set( xStylesNC->getByName( rStyleName ), UNO_QUERY_THROW );
+ Reference< XNameContainer > xStylesNC( getStyleFamily( bPageStyle ), UNO_SET_THROW );
+ xStyle.set( xStylesNC->getByName( rStyleName ), UNO_QUERY );
}
catch( Exception& )
{
@@ -465,9 +560,9 @@ Reference< XNamedRange > WorkbookData::createNamedRangeObject( OUString& orName,
Reference< XStyle > WorkbookData::createStyleObject( OUString& orStyleName, bool bPageStyle, bool bRenameOldExisting ) const
{
Reference< XStyle > xStyle;
- Reference< XNameContainer > xStylesNC = getStyleFamily( bPageStyle );
- if( xStylesNC.is() ) try
+ try
{
+ Reference< XNameContainer > xStylesNC( getStyleFamily( bPageStyle ), UNO_SET_THROW );
Reference< XMultiServiceFactory > xFactory( mxDoc, UNO_QUERY_THROW );
xStyle.set( xFactory->createInstance( bPageStyle ? maPageStyleServ : maCellStyleServ ), UNO_QUERY_THROW );
orStyleName = ContainerHelper::insertByUnusedName( xStylesNC, orStyleName, ' ', Any( xStyle ), bRenameOldExisting );
@@ -536,36 +631,18 @@ void WorkbookData::createBuffersPerSheet()
}
}
-OUString WorkbookData::queryPassword()
-{
- if( !mbHasPassword )
- {
- //! TODO
- maPassword = OUString();
- // set to true, even if dialog has been cancelled (never ask twice)
- mbHasPassword = true;
- }
- return maPassword;
-}
-
// private --------------------------------------------------------------------
void WorkbookData::initialize( bool bWorkbookFile )
{
- maRefDeviceProp = CREATE_OUSTRING( "ReferenceDevice" );
- maNamedRangesProp = CREATE_OUSTRING( "NamedRanges" );
- maDatabaseRangesProp = CREATE_OUSTRING( "DatabaseRanges" );
- maExtDocLinksProp = CREATE_OUSTRING( "ExternalDocLinks" );
- maDdeLinksProp = CREATE_OUSTRING( "DDELinks" );
- maCellStylesProp = CREATE_OUSTRING( "CellStyles" );
- maPageStylesProp = CREATE_OUSTRING( "PageStyles" );
+ maCellStyles = CREATE_OUSTRING( "CellStyles" );
+ maPageStyles = CREATE_OUSTRING( "PageStyles" );
maCellStyleServ = CREATE_OUSTRING( "com.sun.star.style.CellStyle" );
maPageStyleServ = CREATE_OUSTRING( "com.sun.star.style.PageStyle" );
mnCurrSheet = -1;
mbWorkbook = bWorkbookFile;
meTextEnc = osl_getThreadTextEncoding();
mbHasCodePage = false;
- mbHasPassword = false;
// the spreadsheet document
mxDoc.set( mrBaseFilter.getModel(), UNO_QUERY );
@@ -581,27 +658,27 @@ void WorkbookData::initialize( bool bWorkbookFile )
mxDefNames.reset( new DefinedNamesBuffer( *this ) );
mxTables.reset( new TableBuffer( *this ) );
mxWebQueries.reset( new WebQueryBuffer( *this ) );
+ mxPivotCaches.reset( new PivotCacheBuffer( *this ) );
mxPivotTables.reset( new PivotTableBuffer( *this ) );
mxUnitConverter.reset( new UnitConverter( *this ) );
mxAddrConverter.reset( new AddressConverter( *this ) );
mxChartConverter.reset( new ExcelChartConverter( *this ) );
- mxStylesPropHlp.reset( new StylesPropertyHelper( *this ) );
- mxPageSettPropHlp.reset( new PageSettingsPropertyHelper( *this ) );
+ mxPageSettConverter.reset( new PageSettingsConverter( *this ) );
// set some document properties needed during import
if( mrBaseFilter.isImportFilter() )
{
PropertySet aPropSet( mxDoc );
// enable editing read-only documents (e.g. from read-only files)
- aPropSet.setProperty( CREATE_OUSTRING( "IsChangeReadOnlyEnabled" ), true );
+ aPropSet.setProperty( PROP_IsChangeReadOnlyEnabled, true );
// #i76026# disable Undo while loading the document
- aPropSet.setProperty( CREATE_OUSTRING( "IsUndoEnabled" ), false );
+ aPropSet.setProperty( PROP_IsUndoEnabled, false );
// #i79826# disable calculating automatic row height while loading the document
- aPropSet.setProperty( CREATE_OUSTRING( "IsAdjustHeightEnabled" ), false );
+ aPropSet.setProperty( PROP_IsAdjustHeightEnabled, false );
// disable automatic update of linked sheets and DDE links
- aPropSet.setProperty( CREATE_OUSTRING( "IsExecuteLinkEnabled" ), false );
+ aPropSet.setProperty( PROP_IsExecuteLinkEnabled, false );
// #i79890# disable automatic update of defined names
Reference< XActionLockable > xLockable( getNamedRanges(), UNO_QUERY );
if( xLockable.is() )
@@ -616,28 +693,43 @@ void WorkbookData::initialize( bool bWorkbookFile )
//! TODO: localize progress bar text
mxProgressBar.reset( new SegmentProgressBar( mrBaseFilter.getStatusIndicator(), CREATE_OUSTRING( "Saving..." ) ) );
}
+
+ // filter specific
+ switch( getFilterType() )
+ {
+ case FILTER_BIFF:
+ mxCodecHelper.reset( new BiffCodecHelper( * this ) );
+ break;
+
+ case FILTER_OOX:
+ break;
+
+ case FILTER_UNKNOWN:
+ break;
+ }
}
void WorkbookData::finalize()
{
+ OOX_LOADSAVE_TIMER( FINALIZEBOOKDATA );
// set some document properties needed after import
if( mrBaseFilter.isImportFilter() )
{
PropertySet aPropSet( mxDoc );
// #i74668# do not insert default sheets
- aPropSet.setProperty( CREATE_OUSTRING( "IsLoaded" ), true );
+ aPropSet.setProperty( PROP_IsLoaded, true );
// #i79890# enable automatic update of defined names (before IsAdjustHeightEnabled!)
Reference< XActionLockable > xLockable( getNamedRanges(), UNO_QUERY );
if( xLockable.is() )
xLockable->removeActionLock();
// enable automatic update of linked sheets and DDE links
- aPropSet.setProperty( CREATE_OUSTRING( "IsExecuteLinkEnabled" ), true );
+ aPropSet.setProperty( PROP_IsExecuteLinkEnabled, true );
// #i79826# enable updating automatic row height after loading the document
- aPropSet.setProperty( CREATE_OUSTRING( "IsAdjustHeightEnabled" ), true );
+ aPropSet.setProperty( PROP_IsAdjustHeightEnabled, true );
// #i76026# enable Undo after loading the document
- aPropSet.setProperty( CREATE_OUSTRING( "IsUndoEnabled" ), true );
+ aPropSet.setProperty( PROP_IsUndoEnabled, true );
// disable editing read-only documents (e.g. from read-only files)
- aPropSet.setProperty( CREATE_OUSTRING( "IsChangeReadOnlyEnabled" ), false );
+ aPropSet.setProperty( PROP_IsChangeReadOnlyEnabled, false );
}
}
@@ -645,7 +737,7 @@ void WorkbookData::finalize()
WorkbookHelper::WorkbookHelper( WorkbookData& rBookData ) :
#if OSL_DEBUG_LEVEL > 0
- WorkbookHelperDebug( rBookData.mnDebugCount ),
+ dbg::WorkbookHelper( rBookData ),
#endif
mrBookData( rBookData )
{
@@ -693,12 +785,16 @@ void WorkbookHelper::finalizeWorkbookImport()
mrBookData.getWorkbookSettings().finalizeImport();
mrBookData.getViewSettings().finalizeImport();
+ /* Insert all pivot tables. Must be done after loading all sheets, because
+ data pilots expect existing source data on creation. */
+ mrBookData.getPivotTables().finalizeImport();
+
/* Set 'Default' page style to automatic page numbering (default is manual
number 1). Otherwise hidden tables (e.g. for scenarios) which have
'Default' page style will break automatic page numbering for following
sheets. Automatic numbering is set by passing the value 0. */
PropertySet aDefPageStyle( getStyleObject( CREATE_OUSTRING( "Default" ), true ) );
- aDefPageStyle.setProperty< sal_Int16 >( CREATE_OUSTRING( "FirstPageNumber" ), 0 );
+ aDefPageStyle.setProperty< sal_Int16 >( PROP_FirstPageNumber, 0 );
}
// document model -------------------------------------------------------------
@@ -708,20 +804,6 @@ Reference< XSpreadsheetDocument > WorkbookHelper::getDocument() const
return mrBookData.getDocument();
}
-Reference< XSpreadsheet > WorkbookHelper::getSheet( sal_Int32 nSheet ) const
-{
- Reference< XSpreadsheet > xSheet;
- try
- {
- Reference< XIndexAccess > xSheetsIA( getDocument()->getSheets(), UNO_QUERY_THROW );
- xSheet.set( xSheetsIA->getByIndex( nSheet ), UNO_QUERY_THROW );
- }
- catch( Exception& )
- {
- }
- return xSheet;
-}
-
Reference< XDevice > WorkbookHelper::getReferenceDevice() const
{
return mrBookData.getReferenceDevice();
@@ -747,6 +829,48 @@ Reference< XNameAccess > WorkbookHelper::getDdeLinks() const
return mrBookData.getDdeLinks();
}
+Reference< XSpreadsheet > WorkbookHelper::getSheetFromDoc( sal_Int32 nSheet ) const
+{
+ Reference< XSpreadsheet > xSheet;
+ try
+ {
+ Reference< XIndexAccess > xSheetsIA( getDocument()->getSheets(), UNO_QUERY_THROW );
+ xSheet.set( xSheetsIA->getByIndex( nSheet ), UNO_QUERY_THROW );
+ }
+ catch( Exception& )
+ {
+ }
+ return xSheet;
+}
+
+Reference< XCell > WorkbookHelper::getCellFromDoc( const CellAddress& rAddress ) const
+{
+ Reference< XCell > xCell;
+ try
+ {
+ Reference< XSpreadsheet > xSheet( getSheetFromDoc( rAddress.Sheet ), UNO_SET_THROW );
+ xCell = xSheet->getCellByPosition( rAddress.Column, rAddress.Row );
+ }
+ catch( Exception& )
+ {
+ }
+ return xCell;
+}
+
+Reference< XCellRange > WorkbookHelper::getCellRangeFromDoc( const CellRangeAddress& rRange ) const
+{
+ Reference< XCellRange > xRange;
+ try
+ {
+ Reference< XSpreadsheet > xSheet( getSheetFromDoc( rRange.Sheet ), UNO_SET_THROW );
+ xRange = xSheet->getCellRangeByPosition( rRange.StartColumn, rRange.StartRow, rRange.EndColumn, rRange.EndRow );
+ }
+ catch( Exception& )
+ {
+ }
+ return xRange;
+}
+
Reference< XNameContainer > WorkbookHelper::getStyleFamily( bool bPageStyles ) const
{
return mrBookData.getStyleFamily( bPageStyles );
@@ -824,6 +948,11 @@ WebQueryBuffer& WorkbookHelper::getWebQueries() const
return mrBookData.getWebQueries();
}
+PivotCacheBuffer& WorkbookHelper::getPivotCaches() const
+{
+ return mrBookData.getPivotCaches();
+}
+
PivotTableBuffer& WorkbookHelper::getPivotTables() const
{
return mrBookData.getPivotTables();
@@ -853,14 +982,9 @@ ExcelChartConverter& WorkbookHelper::getChartConverter() const
// property helpers -----------------------------------------------------------
-StylesPropertyHelper& WorkbookHelper::getStylesPropertyHelper() const
-{
- return mrBookData.getStylesPropertyHelper();
-}
-
-PageSettingsPropertyHelper& WorkbookHelper::getPageSettingsPropertyHelper() const
+PageSettingsConverter& WorkbookHelper::getPageSettingsConverter() const
{
- return mrBookData.getPageSettingsPropertyHelper();
+ return mrBookData.getPageSettingsConverter();
}
// OOX specific ---------------------------------------------------------------
@@ -919,9 +1043,9 @@ void WorkbookHelper::createBuffersPerSheet()
mrBookData.createBuffersPerSheet();
}
-OUString WorkbookHelper::queryPassword() const
+BiffCodecHelper& WorkbookHelper::getCodecHelper() const
{
- return mrBookData.queryPassword();
+ return mrBookData.getCodecHelper();
}
// ============================================================================
diff --git a/oox/source/xls/workbooksettings.cxx b/oox/source/xls/workbooksettings.cxx
index c0fb0a28b75f..b91315f663fb 100644
--- a/oox/source/xls/workbooksettings.cxx
+++ b/oox/source/xls/workbooksettings.cxx
@@ -32,10 +32,12 @@
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/sheet/XCalculatable.hpp>
+#include "properties.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/helper/recordinputstream.hxx"
#include "oox/xls/biffinputstream.hxx"
+#include "oox/xls/unitconverter.hxx"
using ::rtl::OUString;
using ::com::sun::star::uno::Reference;
@@ -71,7 +73,7 @@ const sal_Int16 API_SHOWMODE_PLACEHOLDER = 2; /// Show placeholder
// ============================================================================
-OoxWorkbookPrData::OoxWorkbookPrData() :
+WorkbookSettingsModel::WorkbookSettingsModel() :
mnShowObjectMode( XML_all ),
mnUpdateLinksMode( XML_userSet ),
mnDefaultThemeVer( -1 ),
@@ -80,7 +82,7 @@ OoxWorkbookPrData::OoxWorkbookPrData() :
{
}
-void OoxWorkbookPrData::setBinObjectMode( sal_uInt16 nObjMode )
+void WorkbookSettingsModel::setBinObjectMode( sal_uInt16 nObjMode )
{
static const sal_Int32 spnObjModes[] = { XML_all, XML_placeholders, XML_none };
mnShowObjectMode = STATIC_ARRAY_SELECT( spnObjModes, nObjMode, XML_all );
@@ -88,7 +90,7 @@ void OoxWorkbookPrData::setBinObjectMode( sal_uInt16 nObjMode )
// ============================================================================
-OoxCalcPrData::OoxCalcPrData() :
+CalcSettingsModel::CalcSettingsModel() :
mfIterateDelta( 0.001 ),
mnCalcId( -1 ),
mnRefMode( XML_A1 ),
@@ -113,128 +115,128 @@ WorkbookSettings::WorkbookSettings( const WorkbookHelper& rHelper ) :
void WorkbookSettings::importWorkbookPr( const AttributeList& rAttribs )
{
- maOoxBookData.maCodeName = rAttribs.getString( XML_codePage, OUString() );
- maOoxBookData.mnShowObjectMode = rAttribs.getToken( XML_showObjects, XML_all );
- maOoxBookData.mnUpdateLinksMode = rAttribs.getToken( XML_updateLinks, XML_userSet );
- maOoxBookData.mnDefaultThemeVer = rAttribs.getInteger( XML_defaultThemeVersion, -1 );
- maOoxBookData.mbDateMode1904 = rAttribs.getBool( XML_date1904, false );
- maOoxBookData.mbSaveExtLinkValues = rAttribs.getBool( XML_saveExternalLinkValues, true );
+ maBookSettings.maCodeName = rAttribs.getString( XML_codePage, OUString() );
+ maBookSettings.mnShowObjectMode = rAttribs.getToken( XML_showObjects, XML_all );
+ maBookSettings.mnUpdateLinksMode = rAttribs.getToken( XML_updateLinks, XML_userSet );
+ maBookSettings.mnDefaultThemeVer = rAttribs.getInteger( XML_defaultThemeVersion, -1 );
+ maBookSettings.mbSaveExtLinkValues = rAttribs.getBool( XML_saveExternalLinkValues, true );
+ setDateMode( rAttribs.getBool( XML_date1904, false ) );
}
void WorkbookSettings::importCalcPr( const AttributeList& rAttribs )
{
- maOoxCalcData.mfIterateDelta = rAttribs.getDouble( XML_iterateDelta, 0.0001 );
- maOoxCalcData.mnCalcId = rAttribs.getInteger( XML_calcId, -1 );
- maOoxCalcData.mnRefMode = rAttribs.getToken( XML_refMode, XML_A1 );
- maOoxCalcData.mnCalcMode = rAttribs.getToken( XML_calcMode, XML_auto );
- maOoxCalcData.mnIterateCount = rAttribs.getInteger( XML_iterateCount, 100 );
- maOoxCalcData.mnProcCount = rAttribs.getInteger( XML_concurrentManualCount, -1 );
- maOoxCalcData.mbCalcOnSave = rAttribs.getBool( XML_calcOnSave, true );
- maOoxCalcData.mbCalcCompleted = rAttribs.getBool( XML_calcCompleted, true );
- maOoxCalcData.mbFullPrecision = rAttribs.getBool( XML_fullPrecision, true );
- maOoxCalcData.mbIterate = rAttribs.getBool( XML_iterate, false );
- maOoxCalcData.mbConcurrent = rAttribs.getBool( XML_concurrentCalc, true );
+ maCalcSettings.mfIterateDelta = rAttribs.getDouble( XML_iterateDelta, 0.0001 );
+ maCalcSettings.mnCalcId = rAttribs.getInteger( XML_calcId, -1 );
+ maCalcSettings.mnRefMode = rAttribs.getToken( XML_refMode, XML_A1 );
+ maCalcSettings.mnCalcMode = rAttribs.getToken( XML_calcMode, XML_auto );
+ maCalcSettings.mnIterateCount = rAttribs.getInteger( XML_iterateCount, 100 );
+ maCalcSettings.mnProcCount = rAttribs.getInteger( XML_concurrentManualCount, -1 );
+ maCalcSettings.mbCalcOnSave = rAttribs.getBool( XML_calcOnSave, true );
+ maCalcSettings.mbCalcCompleted = rAttribs.getBool( XML_calcCompleted, true );
+ maCalcSettings.mbFullPrecision = rAttribs.getBool( XML_fullPrecision, true );
+ maCalcSettings.mbIterate = rAttribs.getBool( XML_iterate, false );
+ maCalcSettings.mbConcurrent = rAttribs.getBool( XML_concurrentCalc, true );
}
void WorkbookSettings::importWorkbookPr( RecordInputStream& rStrm )
{
sal_uInt32 nFlags;
- rStrm >> nFlags >> maOoxBookData.mnDefaultThemeVer >> maOoxBookData.maCodeName;
- maOoxBookData.setBinObjectMode( extractValue< sal_uInt16 >( nFlags, 13, 2 ) );
- maOoxBookData.mbDateMode1904 = getFlag( nFlags, OOBIN_WORKBOOKPR_DATE1904 );
+ rStrm >> nFlags >> maBookSettings.mnDefaultThemeVer >> maBookSettings.maCodeName;
+ maBookSettings.setBinObjectMode( extractValue< sal_uInt16 >( nFlags, 13, 2 ) );
// set flag means: strip external link values
- maOoxBookData.mbSaveExtLinkValues = !getFlag( nFlags, OOBIN_WORKBOOKPR_STRIPEXT );
+ maBookSettings.mbSaveExtLinkValues = !getFlag( nFlags, OOBIN_WORKBOOKPR_STRIPEXT );
+ setDateMode( getFlag( nFlags, OOBIN_WORKBOOKPR_DATE1904 ) );
}
void WorkbookSettings::importCalcPr( RecordInputStream& rStrm )
{
sal_Int32 nCalcMode, nProcCount;
sal_uInt16 nFlags;
- rStrm >> maOoxCalcData.mnCalcId >> nCalcMode >> maOoxCalcData.mnIterateCount >> maOoxCalcData.mfIterateDelta >> nProcCount >> nFlags;
+ rStrm >> maCalcSettings.mnCalcId >> nCalcMode >> maCalcSettings.mnIterateCount >> maCalcSettings.mfIterateDelta >> nProcCount >> nFlags;
static const sal_Int32 spnCalcModes[] = { XML_manual, XML_auto, XML_autoNoTable };
- maOoxCalcData.mnRefMode = getFlagValue( nFlags, OOBIN_CALCPR_A1, XML_A1, XML_R1C1 );
- maOoxCalcData.mnCalcMode = STATIC_ARRAY_SELECT( spnCalcModes, nCalcMode, XML_auto );
- maOoxCalcData.mnProcCount = getFlagValue< sal_Int32 >( nFlags, OOBIN_CALCPR_MANUALPROC, nProcCount, -1 );
- maOoxCalcData.mbCalcOnSave = getFlag( nFlags, OOBIN_CALCPR_CALCONSAVE );
- maOoxCalcData.mbCalcCompleted = getFlag( nFlags, OOBIN_CALCPR_CALCCOMPLETED );
- maOoxCalcData.mbFullPrecision = getFlag( nFlags, OOBIN_CALCPR_FULLPRECISION );
- maOoxCalcData.mbIterate = getFlag( nFlags, OOBIN_CALCPR_ITERATE );
- maOoxCalcData.mbConcurrent = getFlag( nFlags, OOBIN_CALCPR_CONCURRENT );
+ maCalcSettings.mnRefMode = getFlagValue( nFlags, OOBIN_CALCPR_A1, XML_A1, XML_R1C1 );
+ maCalcSettings.mnCalcMode = STATIC_ARRAY_SELECT( spnCalcModes, nCalcMode, XML_auto );
+ maCalcSettings.mnProcCount = getFlagValue< sal_Int32 >( nFlags, OOBIN_CALCPR_MANUALPROC, nProcCount, -1 );
+ maCalcSettings.mbCalcOnSave = getFlag( nFlags, OOBIN_CALCPR_CALCONSAVE );
+ maCalcSettings.mbCalcCompleted = getFlag( nFlags, OOBIN_CALCPR_CALCCOMPLETED );
+ maCalcSettings.mbFullPrecision = getFlag( nFlags, OOBIN_CALCPR_FULLPRECISION );
+ maCalcSettings.mbIterate = getFlag( nFlags, OOBIN_CALCPR_ITERATE );
+ maCalcSettings.mbConcurrent = getFlag( nFlags, OOBIN_CALCPR_CONCURRENT );
}
void WorkbookSettings::setSaveExtLinkValues( bool bSaveExtLinks )
{
- maOoxBookData.mbSaveExtLinkValues = bSaveExtLinks;
+ maBookSettings.mbSaveExtLinkValues = bSaveExtLinks;
}
void WorkbookSettings::importBookBool( BiffInputStream& rStrm )
{
// value of 0 means save external values, value of 1 means strip external values
- maOoxBookData.mbSaveExtLinkValues = rStrm.readuInt16() == 0;
+ maBookSettings.mbSaveExtLinkValues = rStrm.readuInt16() == 0;
}
void WorkbookSettings::importCalcCount( BiffInputStream& rStrm )
{
- maOoxCalcData.mnIterateCount = rStrm.readuInt16();
+ maCalcSettings.mnIterateCount = rStrm.readuInt16();
}
void WorkbookSettings::importCalcMode( BiffInputStream& rStrm )
{
sal_Int16 nCalcMode = rStrm.readInt16() + 1;
static const sal_Int32 spnCalcModes[] = { XML_autoNoTable, XML_manual, XML_auto };
- maOoxCalcData.mnCalcMode = STATIC_ARRAY_SELECT( spnCalcModes, nCalcMode, XML_auto );
+ maCalcSettings.mnCalcMode = STATIC_ARRAY_SELECT( spnCalcModes, nCalcMode, XML_auto );
}
void WorkbookSettings::importCodeName( BiffInputStream& rStrm )
{
- maOoxBookData.maCodeName = rStrm.readUniString();
+ maBookSettings.maCodeName = rStrm.readUniString();
}
void WorkbookSettings::importDateMode( BiffInputStream& rStrm )
{
- maOoxBookData.mbDateMode1904 = rStrm.readuInt16() != 0;
+ setDateMode( rStrm.readuInt16() != 0 );
}
void WorkbookSettings::importDelta( BiffInputStream& rStrm )
{
- rStrm >> maOoxCalcData.mfIterateDelta;
+ rStrm >> maCalcSettings.mfIterateDelta;
}
void WorkbookSettings::importHideObj( BiffInputStream& rStrm )
{
- maOoxBookData.setBinObjectMode( rStrm.readuInt16() );
+ maBookSettings.setBinObjectMode( rStrm.readuInt16() );
}
void WorkbookSettings::importIteration( BiffInputStream& rStrm )
{
- maOoxCalcData.mbIterate = rStrm.readuInt16() != 0;
+ maCalcSettings.mbIterate = rStrm.readuInt16() != 0;
}
void WorkbookSettings::importPrecision( BiffInputStream& rStrm )
{
- maOoxCalcData.mbFullPrecision = rStrm.readuInt16() != 0;
+ maCalcSettings.mbFullPrecision = rStrm.readuInt16() != 0;
}
void WorkbookSettings::importRefMode( BiffInputStream& rStrm )
{
- maOoxCalcData.mnRefMode = (rStrm.readuInt16() == 0) ? XML_R1C1 : XML_A1;
+ maCalcSettings.mnRefMode = (rStrm.readuInt16() == 0) ? XML_R1C1 : XML_A1;
}
void WorkbookSettings::importSaveRecalc( BiffInputStream& rStrm )
{
- maOoxCalcData.mbCalcOnSave = rStrm.readuInt16() != 0;
+ maCalcSettings.mbCalcOnSave = rStrm.readuInt16() != 0;
}
void WorkbookSettings::importUncalced( BiffInputStream& )
{
// existence of this record indicates incomplete recalc
- maOoxCalcData.mbCalcCompleted = false;
+ maCalcSettings.mbCalcCompleted = false;
}
void WorkbookSettings::importUsesElfs( BiffInputStream& rStrm )
{
- maOoxCalcData.mbUseNlr = rStrm.readuInt16() != 0;
+ maCalcSettings.mbUseNlr = rStrm.readuInt16() != 0;
}
void WorkbookSettings::finalizeImport()
@@ -245,38 +247,38 @@ void WorkbookSettings::finalizeImport()
{
case FILTER_OOX:
case FILTER_BIFF:
- aPropSet.setProperty( CREATE_OUSTRING( "IgnoreCase" ), true ); // always in Excel
- aPropSet.setProperty( CREATE_OUSTRING( "RegularExpressions" ), false ); // not supported in Excel
+ aPropSet.setProperty( PROP_IgnoreCase, true ); // always in Excel
+ aPropSet.setProperty( PROP_RegularExpressions, false ); // not supported in Excel
break;
case FILTER_UNKNOWN:
break;
}
// calculation settings
- Date aNullDate = maOoxBookData.mbDateMode1904 ? Date( 1, 1, 1904 ) : Date( 30, 12, 1899 );
+ Date aNullDate = getNullDate();
- aPropSet.setProperty( CREATE_OUSTRING( "NullDate" ), aNullDate );
- aPropSet.setProperty( CREATE_OUSTRING( "IsIterationEnabled" ), maOoxCalcData.mbIterate );
- aPropSet.setProperty( CREATE_OUSTRING( "IterationCount" ), maOoxCalcData.mnIterateCount );
- aPropSet.setProperty( CREATE_OUSTRING( "IterationEpsilon" ), maOoxCalcData.mfIterateDelta );
- aPropSet.setProperty( CREATE_OUSTRING( "CalcAsShown" ), !maOoxCalcData.mbFullPrecision );
- aPropSet.setProperty( CREATE_OUSTRING( "LookUpLabels" ), maOoxCalcData.mbUseNlr );
+ aPropSet.setProperty( PROP_NullDate, aNullDate );
+ aPropSet.setProperty( PROP_IsIterationEnabled, maCalcSettings.mbIterate );
+ aPropSet.setProperty( PROP_IterationCount, maCalcSettings.mnIterateCount );
+ aPropSet.setProperty( PROP_IterationEpsilon, maCalcSettings.mfIterateDelta );
+ aPropSet.setProperty( PROP_CalcAsShown, !maCalcSettings.mbFullPrecision );
+ aPropSet.setProperty( PROP_LookUpLabels, maCalcSettings.mbUseNlr );
Reference< XNumberFormatsSupplier > xNumFmtsSupp( getDocument(), UNO_QUERY );
if( xNumFmtsSupp.is() )
{
PropertySet aNumFmtProp( xNumFmtsSupp->getNumberFormatSettings() );
- aNumFmtProp.setProperty( CREATE_OUSTRING( "NullDate" ), aNullDate );
+ aNumFmtProp.setProperty( PROP_NullDate, aNullDate );
}
Reference< XCalculatable > xCalculatable( getDocument(), UNO_QUERY );
if( xCalculatable.is() )
- xCalculatable->enableAutomaticCalculation( (maOoxCalcData.mnCalcMode == XML_auto) || (maOoxCalcData.mnCalcMode == XML_autoNoTable) );
+ xCalculatable->enableAutomaticCalculation( (maCalcSettings.mnCalcMode == XML_auto) || (maCalcSettings.mnCalcMode == XML_autoNoTable) );
}
sal_Int16 WorkbookSettings::getApiShowObjectMode() const
{
- switch( maOoxBookData.mnShowObjectMode )
+ switch( maBookSettings.mnShowObjectMode )
{
case XML_all: return API_SHOWMODE_SHOW;
case XML_none: return API_SHOWMODE_HIDE;
@@ -286,6 +288,18 @@ sal_Int16 WorkbookSettings::getApiShowObjectMode() const
return API_SHOWMODE_SHOW;
}
+Date WorkbookSettings::getNullDate() const
+{
+ static const Date saDate1900( 30, 12, 1899 ), saDate1904( 1, 1, 1904 );
+ return maBookSettings.mbDateMode1904 ? saDate1904 : saDate1900;
+}
+
+void WorkbookSettings::setDateMode( bool bDateMode1904 )
+{
+ maBookSettings.mbDateMode1904 = bDateMode1904;
+ getUnitConverter().finalizeNullDate( getNullDate() );
+}
+
// ============================================================================
} // namespace xls
diff --git a/oox/source/xls/worksheetbuffer.cxx b/oox/source/xls/worksheetbuffer.cxx
index ed2f8e6363d0..da011649acb9 100644
--- a/oox/source/xls/worksheetbuffer.cxx
+++ b/oox/source/xls/worksheetbuffer.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XExternalSheetName.hpp>
#include <com/sun/star/sheet/XSheetLinkable.hpp>
+#include "properties.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertyset.hxx"
@@ -75,7 +76,7 @@ OUString lclGetBaseFileName( const OUString& rUrl )
// ============================================================================
-OoxSheetInfo::OoxSheetInfo() :
+SheetInfoModel::SheetInfoModel() :
mnSheetId( -1 ),
mnState( XML_visible )
{
@@ -84,37 +85,36 @@ OoxSheetInfo::OoxSheetInfo() :
// ============================================================================
WorksheetBuffer::WorksheetBuffer( const WorkbookHelper& rHelper ) :
- WorkbookHelper( rHelper ),
- maIsVisibleProp( CREATE_OUSTRING( "IsVisible" ) )
+ WorkbookHelper( rHelper )
{
}
void WorksheetBuffer::initializeSingleSheet()
{
OSL_ENSURE( maSheetInfos.empty(), "WorksheetBuffer::initializeSingleSheet - invalid call" );
- OoxSheetInfo aSheetInfo;
- aSheetInfo.maName = lclGetBaseFileName( getBaseFilter().getFileUrl() );
- insertSheet( aSheetInfo );
+ SheetInfoModel aModel;
+ aModel.maName = lclGetBaseFileName( getBaseFilter().getFileUrl() );
+ insertSheet( aModel );
}
void WorksheetBuffer::importSheet( const AttributeList& rAttribs )
{
- OoxSheetInfo aSheetInfo;
- aSheetInfo.maRelId = rAttribs.getString( R_TOKEN( id ), OUString() );
- aSheetInfo.maName = rAttribs.getString( XML_name, OUString() );
- aSheetInfo.mnSheetId = rAttribs.getInteger( XML_sheetId, -1 );
- aSheetInfo.mnState = rAttribs.getToken( XML_state, XML_visible );
- insertSheet( aSheetInfo );
+ SheetInfoModel aModel;
+ aModel.maRelId = rAttribs.getString( R_TOKEN( id ), OUString() );
+ aModel.maName = rAttribs.getString( XML_name, OUString() );
+ aModel.mnSheetId = rAttribs.getInteger( XML_sheetId, -1 );
+ aModel.mnState = rAttribs.getToken( XML_state, XML_visible );
+ insertSheet( aModel );
}
void WorksheetBuffer::importSheet( RecordInputStream& rStrm )
{
sal_Int32 nState;
- OoxSheetInfo aSheetInfo;
- rStrm >> nState >> aSheetInfo.mnSheetId >> aSheetInfo.maRelId >> aSheetInfo.maName;
+ SheetInfoModel aModel;
+ rStrm >> nState >> aModel.mnSheetId >> aModel.maRelId >> aModel.maName;
static const sal_Int32 spnStates[] = { XML_visible, XML_hidden, XML_veryHidden };
- aSheetInfo.mnState = STATIC_ARRAY_SELECT( spnStates, nState, XML_visible );
- insertSheet( aSheetInfo );
+ aModel.mnState = STATIC_ARRAY_SELECT( spnStates, nState, XML_visible );
+ insertSheet( aModel );
}
void WorksheetBuffer::importSheet( BiffInputStream& rStrm )
@@ -126,13 +126,19 @@ void WorksheetBuffer::importSheet( BiffInputStream& rStrm )
rStrm >> nState;
}
- OoxSheetInfo aSheetInfo;
- aSheetInfo.maName = (getBiff() == BIFF8) ?
+ SheetInfoModel aModel;
+ aModel.maName = (getBiff() == BIFF8) ?
rStrm.readUniString( rStrm.readuInt8() ) :
rStrm.readByteString( false, getTextEncoding() );
static const sal_Int32 spnStates[] = { XML_visible, XML_hidden, XML_veryHidden };
- aSheetInfo.mnState = STATIC_ARRAY_SELECT( spnStates, nState, XML_visible );
- insertSheet( aSheetInfo );
+ aModel.mnState = STATIC_ARRAY_SELECT( spnStates, nState, XML_visible );
+ insertSheet( aModel );
+}
+
+sal_Int16 WorksheetBuffer::insertEmptySheet( const OUString& rPreferredName, bool bVisible )
+{
+ IndexNamePair aIndexName = insertSheet( rPreferredName, SAL_MAX_INT16, bVisible );
+ return aIndexName.first;
}
sal_Int32 WorksheetBuffer::getSheetCount() const
@@ -143,48 +149,49 @@ sal_Int32 WorksheetBuffer::getSheetCount() const
OUString WorksheetBuffer::getSheetRelId( sal_Int32 nSheet ) const
{
OUString aRelId;
- if( const OoxSheetInfo* pInfo = getSheetInfo( nSheet ) )
- aRelId = pInfo->maRelId;
+ if( const SheetInfoModel* pModel = getSheetInfo( nSheet ) )
+ aRelId = pModel->maRelId;
return aRelId;
}
-OUString WorksheetBuffer::getFinalSheetName( sal_Int32 nSheet ) const
+OUString WorksheetBuffer::getCalcSheetName( sal_Int32 nSheet ) const
{
OUString aName;
- if( const OoxSheetInfo* pInfo = getSheetInfo( nSheet ) )
- aName = pInfo->maFinalName;
+ if( const SheetInfoModel* pModel = getSheetInfo( nSheet ) )
+ aName = pModel->maFinalName;
return aName;
}
-OUString WorksheetBuffer::getFinalSheetName( const OUString& rName ) const
+OUString WorksheetBuffer::getCalcSheetName( const OUString& rModelName ) const
{
- for( SheetInfoVec::const_iterator aIt = maSheetInfos.begin(), aEnd = maSheetInfos.end(); aIt != aEnd; ++aIt )
+ for( SheetInfoModelVec::const_iterator aIt = maSheetInfos.begin(), aEnd = maSheetInfos.end(); aIt != aEnd; ++aIt )
// TODO: handle encoded characters
- if( aIt->maName.equalsIgnoreAsciiCase( rName ) )
+ if( aIt->maName.equalsIgnoreAsciiCase( rModelName ) )
return aIt->maFinalName;
return OUString();
}
-sal_Int32 WorksheetBuffer::getFinalSheetIndex( const OUString& rName ) const
+sal_Int32 WorksheetBuffer::getCalcSheetIndex( const OUString& rModelName ) const
{
- for( SheetInfoVec::const_iterator aIt = maSheetInfos.begin(), aEnd = maSheetInfos.end(); aIt != aEnd; ++aIt )
+ for( SheetInfoModelVec::const_iterator aIt = maSheetInfos.begin(), aEnd = maSheetInfos.end(); aIt != aEnd; ++aIt )
// TODO: handle encoded characters
- if( aIt->maName.equalsIgnoreAsciiCase( rName ) )
+ if( aIt->maName.equalsIgnoreAsciiCase( rModelName ) )
return static_cast< sal_Int32 >( aIt - maSheetInfos.begin() );
return -1;
}
// private --------------------------------------------------------------------
-const OoxSheetInfo* WorksheetBuffer::getSheetInfo( sal_Int32 nSheet ) const
+const SheetInfoModel* WorksheetBuffer::getSheetInfo( sal_Int32 nSheet ) const
{
- return ((0 <= nSheet) && (static_cast< size_t >( nSheet ) < maSheetInfos.size())) ?
- &maSheetInfos[ static_cast< size_t >( nSheet ) ] : 0;
+ return ContainerHelper::getVectorElement( maSheetInfos, nSheet );
}
-OUString WorksheetBuffer::insertSheet( const OUString& rName, sal_Int16 nSheet, bool bVisible )
+WorksheetBuffer::IndexNamePair WorksheetBuffer::insertSheet( const OUString& rPreferredName, sal_Int16 nSheet, bool bVisible )
{
- OUString aFinalName = (rName.getLength() == 0) ? CREATE_OUSTRING( "Sheet" ) : rName;
+ IndexNamePair aIndexName;
+ aIndexName.first = -1;
+ aIndexName.second = (rPreferredName.getLength() == 0) ? CREATE_OUSTRING( "Sheet" ) : rPreferredName;
try
{
Reference< XSpreadsheets > xSheets( getDocument()->getSheets(), UNO_QUERY_THROW );
@@ -195,36 +202,42 @@ OUString WorksheetBuffer::insertSheet( const OUString& rName, sal_Int16 nSheet,
{
// existing sheet - try to rename
Reference< XNamed > xSheetName( xSheetsIA->getByIndex( nSheet ), UNO_QUERY_THROW );
- if( xSheetName->getName() != aFinalName )
+ if( xSheetName->getName() != aIndexName.second )
{
- aFinalName = ContainerHelper::getUnusedName( xSheetsNA, aFinalName, ' ' );
- xSheetName->setName( aFinalName );
+ aIndexName.second = ContainerHelper::getUnusedName( xSheetsNA, aIndexName.second, ' ' );
+ xSheetName->setName( aIndexName.second );
}
aPropSet.set( xSheetName );
}
else
{
// new sheet - insert with unused name
- aFinalName = ContainerHelper::getUnusedName( xSheetsNA, aFinalName, ' ' );
- xSheets->insertNewByName( aFinalName, nSheet );
+ aIndexName.second = ContainerHelper::getUnusedName( xSheetsNA, aIndexName.second, ' ' );
+ nSheet = static_cast< sal_Int16 >( xSheetsIA->getCount() );
+ xSheets->insertNewByName( aIndexName.second, nSheet );
aPropSet.set( xSheetsIA->getByIndex( nSheet ) );
}
// sheet properties
- aPropSet.setProperty( maIsVisibleProp, bVisible );
+ aPropSet.setProperty( PROP_IsVisible, bVisible );
+
+ // return final sheet index if sheet exists
+ aIndexName.first = nSheet;
}
catch( Exception& )
{
OSL_ENSURE( false, "WorksheetBuffer::insertSheet - cannot insert or rename worksheet" );
}
- return aFinalName;
+ return aIndexName;
}
-void WorksheetBuffer::insertSheet( const OoxSheetInfo& rSheetInfo )
+void WorksheetBuffer::insertSheet( const SheetInfoModel& rModel )
{
sal_Int16 nSheet = static_cast< sal_Int16 >( maSheetInfos.size() );
- maSheetInfos.push_back( rSheetInfo );
- maSheetInfos.back().maFinalName = insertSheet( rSheetInfo.maName, nSheet, rSheetInfo.mnState == XML_visible );
+ maSheetInfos.push_back( rModel );
+ IndexNamePair aIndexName = insertSheet( rModel.maName, nSheet, rModel.mnState == XML_visible );
+ if( aIndexName.first >= 0 )
+ maSheetInfos.back().maFinalName = aIndexName.second;
}
// ============================================================================
diff --git a/oox/source/xls/worksheetfragment.cxx b/oox/source/xls/worksheetfragment.cxx
index c93980409b39..337223aecd59 100644
--- a/oox/source/xls/worksheetfragment.cxx
+++ b/oox/source/xls/worksheetfragment.cxx
@@ -35,9 +35,11 @@
#include "oox/xls/addressconverter.hxx"
#include "oox/xls/autofiltercontext.hxx"
#include "oox/xls/biffinputstream.hxx"
+#include "oox/xls/commentsfragment.hxx"
#include "oox/xls/condformatcontext.hxx"
#include "oox/xls/externallinkbuffer.hxx"
#include "oox/xls/pagesettings.hxx"
+#include "oox/xls/pivottablebuffer.hxx"
#include "oox/xls/pivottablefragment.hxx"
#include "oox/xls/querytablefragment.hxx"
#include "oox/xls/sheetdatacontext.hxx"
@@ -53,6 +55,7 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::table::CellAddress;
using ::com::sun::star::table::CellRangeAddress;
+using ::oox::core::ContextHandlerRef;
using ::oox::core::RecordInfo;
using ::oox::core::Relations;
using ::oox::core::RelationsRef;
@@ -101,6 +104,134 @@ const sal_uInt16 OOBIN_OLEOBJECT_LINKED = 0x0002;
// ============================================================================
+OoxDataValidationsContext::OoxDataValidationsContext( OoxWorksheetFragmentBase& rFragment ) :
+ OoxWorksheetContextBase( rFragment )
+{
+}
+
+ContextHandlerRef OoxDataValidationsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
+{
+ switch( getCurrentElement() )
+ {
+ case XLS_TOKEN( dataValidations ):
+ if( nElement == XLS_TOKEN( dataValidation ) )
+ {
+ importDataValidation( rAttribs );
+ return this;
+ }
+ break;
+ case XLS_TOKEN( dataValidation ):
+ switch( nElement )
+ {
+ case XLS_TOKEN( formula1 ):
+ case XLS_TOKEN( formula2 ):
+ return this; // collect formulas in onEndElement()
+ }
+ break;
+ }
+ return 0;
+}
+
+namespace {
+
+ApiTokenSequence lclImportDataValFormula( FormulaParser& rParser, const OUString& rFormula, const CellAddress& rBaseAddress )
+{
+ TokensFormulaContext aContext( true, false );
+ aContext.setBaseAddress( rBaseAddress );
+ rParser.importFormula( aContext, rFormula );
+ return aContext.getTokens();
+}
+
+} // namespace
+
+void OoxDataValidationsContext::onEndElement( const OUString& rChars )
+{
+ if( mxValModel.get() ) switch( getCurrentElement() )
+ {
+ case XLS_TOKEN( formula1 ):
+ mxValModel->maTokens1 = lclImportDataValFormula(
+ getFormulaParser(), rChars, mxValModel->maRanges.getBaseAddress() );
+ // process string list of a list validation (convert to list of string tokens)
+ if( mxValModel->mnType == XML_list )
+ getFormulaParser().convertStringToStringList( mxValModel->maTokens1, ',', true );
+ break;
+ case XLS_TOKEN( formula2 ):
+ mxValModel->maTokens2 = lclImportDataValFormula(
+ getFormulaParser(), rChars, mxValModel->maRanges.getBaseAddress() );
+ break;
+ case XLS_TOKEN( dataValidation ):
+ setValidation( *mxValModel );
+ mxValModel.reset();
+ break;
+ }
+}
+
+
+ContextHandlerRef OoxDataValidationsContext::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
+{
+ if( nRecId == OOBIN_ID_DATAVALIDATION )
+ importDataValidation( rStrm );
+ return 0;
+}
+
+void OoxDataValidationsContext::importDataValidation( const AttributeList& rAttribs )
+{
+ mxValModel.reset( new ValidationModel );
+ getAddressConverter().convertToCellRangeList( mxValModel->maRanges, rAttribs.getString( XML_sqref, OUString() ), getSheetIndex(), true );
+ mxValModel->maInputTitle = rAttribs.getString( XML_promptTitle, OUString() );
+ mxValModel->maInputMessage = rAttribs.getString( XML_prompt, OUString() );
+ mxValModel->maErrorTitle = rAttribs.getString( XML_errorTitle, OUString() );
+ mxValModel->maErrorMessage = rAttribs.getString( XML_error, OUString() );
+ mxValModel->mnType = rAttribs.getToken( XML_type, XML_none );
+ mxValModel->mnOperator = rAttribs.getToken( XML_operator, XML_between );
+ mxValModel->mnErrorStyle = rAttribs.getToken( XML_errorStyle, XML_stop );
+ mxValModel->mbShowInputMsg = rAttribs.getBool( XML_showInputMessage, false );
+ mxValModel->mbShowErrorMsg = rAttribs.getBool( XML_showErrorMessage, false );
+ /* The attribute showDropDown@dataValidation is in fact a "suppress
+ dropdown" flag, as it was in the BIFF format! ECMA specification
+ and attribute name are plain wrong! */
+ mxValModel->mbNoDropDown = rAttribs.getBool( XML_showDropDown, false );
+ mxValModel->mbAllowBlank = rAttribs.getBool( XML_allowBlank, false );
+}
+
+void OoxDataValidationsContext::importDataValidation( RecordInputStream& rStrm )
+{
+ ValidationModel aModel;
+
+ sal_uInt32 nFlags;
+ BinRangeList aRanges;
+ rStrm >> nFlags >> aRanges >> aModel.maErrorTitle >> aModel.maErrorMessage >> aModel.maInputTitle >> aModel.maInputMessage;
+
+ // equal flags in BIFF and OOBIN
+ aModel.setBinType( extractValue< sal_uInt8 >( nFlags, 0, 4 ) );
+ aModel.setBinOperator( extractValue< sal_uInt8 >( nFlags, 20, 4 ) );
+ aModel.setBinErrorStyle( extractValue< sal_uInt8 >( nFlags, 4, 3 ) );
+ aModel.mbAllowBlank = getFlag( nFlags, BIFF_DATAVAL_ALLOWBLANK );
+ aModel.mbNoDropDown = getFlag( nFlags, BIFF_DATAVAL_NODROPDOWN );
+ aModel.mbShowInputMsg = getFlag( nFlags, BIFF_DATAVAL_SHOWINPUT );
+ aModel.mbShowErrorMsg = getFlag( nFlags, BIFF_DATAVAL_SHOWERROR );
+
+ // cell range list
+ getAddressConverter().convertToCellRangeList( aModel.maRanges, aRanges, getSheetIndex(), true );
+
+ // condition formula(s)
+ FormulaParser& rParser = getFormulaParser();
+ TokensFormulaContext aContext( true, false );
+ aContext.setBaseAddress( aModel.maRanges.getBaseAddress() );
+ rParser.importFormula( aContext, rStrm );
+ aModel.maTokens1 = aContext.getTokens();
+ rParser.importFormula( aContext, rStrm );
+ aModel.maTokens2 = aContext.getTokens();
+ // process string list of a list validation (convert to list of string tokens)
+ if( (aModel.mnType == XML_list) && getFlag( nFlags, BIFF_DATAVAL_STRINGLIST ) )
+ rParser.convertStringToStringList( aModel.maTokens1, ',', true );
+
+ // set validation data
+ setValidation( aModel );
+}
+
+// ============================================================================
+
OoxWorksheetFragment::OoxWorksheetFragment( const WorkbookHelper& rHelper,
const OUString& rFragmentPath, ISegmentProgressBarRef xProgressBar, WorksheetType eSheetType, sal_Int32 nSheet ) :
OoxWorksheetFragmentBase( rHelper, rFragmentPath, xProgressBar, eSheetType, nSheet )
@@ -109,22 +240,27 @@ OoxWorksheetFragment::OoxWorksheetFragment( const WorkbookHelper& rHelper,
RelationsRef xTableRels = getRelations().getRelationsFromType( CREATE_OFFICEDOC_RELATIONSTYPE( "table" ) );
for( Relations::const_iterator aIt = xTableRels->begin(), aEnd = xTableRels->end(); aIt != aEnd; ++aIt )
importOoxFragment( new OoxTableFragment( *this, getFragmentPathFromTarget( aIt->second.maTarget ) ) );
+
+ // import comments related to this worksheet
+ ::rtl::OUString aCommentsFragmentPath = getFragmentPathFromType( CREATE_OFFICEDOC_RELATIONSTYPE( "comments" ) );
+ if( aCommentsFragmentPath.getLength() > 0 )
+ importOoxFragment( new OoxCommentsFragment( *this, aCommentsFragmentPath ) );
}
// oox.core.ContextHandler2Helper interface -----------------------------------
-ContextWrapper OoxWorksheetFragment::onCreateContext( sal_Int32 nElement, const AttributeList& )
+ContextHandlerRef OoxWorksheetFragment::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT: switch( getSheetType() )
{
- case SHEETTYPE_WORKSHEET: return (nElement == XLS_TOKEN( worksheet ));
- case SHEETTYPE_CHARTSHEET: return false;
- case SHEETTYPE_MACROSHEET: return (nElement == XM_TOKEN( macrosheet ));
- case SHEETTYPE_DIALOGSHEET: return (nElement == XM_TOKEN( dialogsheet ));
- case SHEETTYPE_MODULESHEET: return false;
- case SHEETTYPE_EMPTYSHEET: return false;
+ case SHEETTYPE_WORKSHEET: return (nElement == XLS_TOKEN( worksheet )) ? this : 0;
+ case SHEETTYPE_CHARTSHEET: return 0;
+ case SHEETTYPE_MACROSHEET: return (nElement == XM_TOKEN( macrosheet )) ? this : 0;
+ case SHEETTYPE_DIALOGSHEET: return (nElement == XM_TOKEN( dialogsheet )) ? this : 0;
+ case SHEETTYPE_MODULESHEET: return 0;
+ case SHEETTYPE_EMPTYSHEET: return 0;
}
break;
@@ -132,124 +268,96 @@ ContextWrapper OoxWorksheetFragment::onCreateContext( sal_Int32 nElement, const
case XM_TOKEN( macrosheet ):
switch( nElement )
{
- case XLS_TOKEN( sheetData ):
- return new OoxSheetDataContext( *this );
- case XLS_TOKEN( autoFilter ):
- return new OoxAutoFilterContext( *this );
- case XLS_TOKEN( conditionalFormatting ):
- return new OoxCondFormatContext( *this );
+ case XLS_TOKEN( sheetData ): return new OoxSheetDataContext( *this );
+ case XLS_TOKEN( autoFilter ): return new OoxAutoFilterContext( *this );
+ case XLS_TOKEN( conditionalFormatting ): return new OoxCondFormatContext( *this );
+ case XLS_TOKEN( dataValidations ): return new OoxDataValidationsContext( *this );
+
+ case XLS_TOKEN( sheetViews ):
+ case XLS_TOKEN( cols ):
+ case XLS_TOKEN( mergeCells ):
+ case XLS_TOKEN( hyperlinks ):
+ case XLS_TOKEN( rowBreaks ):
+ case XLS_TOKEN( colBreaks ):
+ case XLS_TOKEN( oleObjects ):
+ case XLS_TOKEN( controls ): return this;
+
+ case XLS_TOKEN( sheetPr ): getWorksheetSettings().importSheetPr( rAttribs ); return this;
+ case XLS_TOKEN( dimension ): importDimension( rAttribs ); break;
+ case XLS_TOKEN( sheetFormatPr ): importSheetFormatPr( rAttribs ); break;
+ case XLS_TOKEN( sheetProtection ): getWorksheetSettings().importSheetProtection( rAttribs ); break;
+ case XLS_TOKEN( phoneticPr ): getWorksheetSettings().importPhoneticPr( rAttribs ); break;
+ case XLS_TOKEN( printOptions ): getPageSettings().importPrintOptions( rAttribs ); break;
+ case XLS_TOKEN( pageMargins ): getPageSettings().importPageMargins( rAttribs ); break;
+ case XLS_TOKEN( pageSetup ): getPageSettings().importPageSetup( getRelations(), rAttribs ); break;
+ case XLS_TOKEN( headerFooter ): getPageSettings().importHeaderFooter( rAttribs ); return this;
+ case XLS_TOKEN( picture ): getPageSettings().importPicture( getRelations(), rAttribs ); break;
+ case XLS_TOKEN( drawing ): importDrawing( rAttribs ); break;
+ case XLS_TOKEN( legacyDrawing ): importLegacyDrawing( rAttribs ); break;
}
- return (nElement == XLS_TOKEN( sheetPr )) ||
- (nElement == XLS_TOKEN( dimension )) ||
- (nElement == XLS_TOKEN( sheetViews )) ||
- (nElement == XLS_TOKEN( sheetFormatPr )) ||
- (nElement == XLS_TOKEN( cols )) ||
- (nElement == XLS_TOKEN( sheetProtection )) ||
- (nElement == XLS_TOKEN( mergeCells )) ||
- (nElement == XLS_TOKEN( phoneticPr )) ||
- (nElement == XLS_TOKEN( dataValidations )) ||
- (nElement == XLS_TOKEN( hyperlinks )) ||
- (nElement == XLS_TOKEN( printOptions )) ||
- (nElement == XLS_TOKEN( pageMargins )) ||
- (nElement == XLS_TOKEN( pageSetup )) ||
- (nElement == XLS_TOKEN( headerFooter )) ||
- (nElement == XLS_TOKEN( picture )) ||
- (nElement == XLS_TOKEN( rowBreaks )) ||
- (nElement == XLS_TOKEN( colBreaks )) ||
- (nElement == XLS_TOKEN( drawing )) ||
- (nElement == XLS_TOKEN( legacyDrawing )) ||
- (nElement == XLS_TOKEN( oleObjects )) ||
- (nElement == XLS_TOKEN( controls ));
+ break;
case XLS_TOKEN( sheetPr ):
- return (nElement == XLS_TOKEN( tabColor )) ||
- (nElement == XLS_TOKEN( outlinePr )) ||
- (nElement == XLS_TOKEN( pageSetUpPr ));
+ switch( nElement )
+ {
+ case XLS_TOKEN( tabColor ): getWorksheetSettings().importTabColor( rAttribs ); break;
+ case XLS_TOKEN( outlinePr ): getWorksheetSettings().importOutlinePr( rAttribs ); break;
+ case XLS_TOKEN( pageSetUpPr ): importPageSetUpPr( rAttribs ); break;
+ }
+ break;
case XLS_TOKEN( sheetViews ):
- return (nElement == XLS_TOKEN( sheetView ));
+ switch( nElement )
+ {
+ case XLS_TOKEN( sheetView ): getSheetViewSettings().importSheetView( rAttribs ); return this;
+ }
+ break;
case XLS_TOKEN( sheetView ):
- return (nElement == XLS_TOKEN( pane )) ||
- (nElement == XLS_TOKEN( selection ));
+ switch( nElement )
+ {
+ case XLS_TOKEN( pane ): getSheetViewSettings().importPane( rAttribs ); break;
+ case XLS_TOKEN( selection ): getSheetViewSettings().importSelection( rAttribs ); break;
+ }
+ break;
case XLS_TOKEN( cols ):
- return (nElement == XLS_TOKEN( col ));
-
+ if( nElement == XLS_TOKEN( col ) ) importCol( rAttribs );
+ break;
case XLS_TOKEN( mergeCells ):
- return (nElement == XLS_TOKEN( mergeCell ));
-
- case XLS_TOKEN( dataValidations ):
- return (nElement == XLS_TOKEN( dataValidation ));
- case XLS_TOKEN( dataValidation ):
- return (nElement == XLS_TOKEN( formula1 )) ||
- (nElement == XLS_TOKEN( formula2 ));
-
+ if( nElement == XLS_TOKEN( mergeCell ) ) importMergeCell( rAttribs );
+ break;
case XLS_TOKEN( hyperlinks ):
- return (nElement == XLS_TOKEN( hyperlink ));
-
- case XLS_TOKEN( headerFooter ):
- return (nElement == XLS_TOKEN( firstHeader )) ||
- (nElement == XLS_TOKEN( firstFooter )) ||
- (nElement == XLS_TOKEN( oddHeader )) ||
- (nElement == XLS_TOKEN( oddFooter )) ||
- (nElement == XLS_TOKEN( evenHeader )) ||
- (nElement == XLS_TOKEN( evenFooter ));
+ if( nElement == XLS_TOKEN( hyperlink ) ) importHyperlink( rAttribs );
+ break;
case XLS_TOKEN( rowBreaks ):
+ if( nElement == XLS_TOKEN( brk ) ) importBrk( rAttribs, true );
+ break;
case XLS_TOKEN( colBreaks ):
- return (nElement == XLS_TOKEN( brk ));
+ if( nElement == XLS_TOKEN( brk ) ) importBrk( rAttribs, false );
+ break;
+
+ case XLS_TOKEN( headerFooter ):
+ switch( nElement )
+ {
+ case XLS_TOKEN( firstHeader ):
+ case XLS_TOKEN( firstFooter ):
+ case XLS_TOKEN( oddHeader ):
+ case XLS_TOKEN( oddFooter ):
+ case XLS_TOKEN( evenHeader ):
+ case XLS_TOKEN( evenFooter ): return this; // collect h/f contents in onEndElement()
+ }
+ break;
case XLS_TOKEN( oleObjects ):
- return (nElement == XLS_TOKEN( oleObject ));
+ if( nElement == XLS_TOKEN( oleObject ) ) importOleObject( rAttribs );
+ break;
case XLS_TOKEN( controls ):
- return (nElement == XLS_TOKEN( control ));
- }
- return false;
-}
-
-void OoxWorksheetFragment::onStartElement( const AttributeList& rAttribs )
-{
- switch( getCurrentElement() )
- {
- case XLS_TOKEN( sheetPr ): getWorksheetSettings().importSheetPr( rAttribs ); break;
- case XLS_TOKEN( tabColor ): getWorksheetSettings().importTabColor( rAttribs ); break;
- case XLS_TOKEN( outlinePr ): getWorksheetSettings().importOutlinePr( rAttribs ); break;
- case XLS_TOKEN( pageSetUpPr ): importPageSetUpPr( rAttribs ); break;
- case XLS_TOKEN( dimension ): importDimension( rAttribs ); break;
- case XLS_TOKEN( sheetView ): getSheetViewSettings().importSheetView( rAttribs ); break;
- case XLS_TOKEN( pane ): getSheetViewSettings().importPane( rAttribs ); break;
- case XLS_TOKEN( selection ): getSheetViewSettings().importSelection( rAttribs ); break;
- case XLS_TOKEN( sheetFormatPr ): importSheetFormatPr( rAttribs ); break;
- case XLS_TOKEN( col ): importCol( rAttribs ); break;
- case XLS_TOKEN( sheetProtection ): getWorksheetSettings().importSheetProtection( rAttribs ); break;
- case XLS_TOKEN( mergeCell ): importMergeCell( rAttribs ); break;
- case XLS_TOKEN( phoneticPr ): getWorksheetSettings().importPhoneticPr( rAttribs ); break;
- case XLS_TOKEN( dataValidation ): importDataValidation( rAttribs ); break;
- case XLS_TOKEN( hyperlink ): importHyperlink( rAttribs ); break;
- case XLS_TOKEN( printOptions ): getPageSettings().importPrintOptions( rAttribs ); break;
- case XLS_TOKEN( pageMargins ): getPageSettings().importPageMargins( rAttribs ); break;
- case XLS_TOKEN( pageSetup ): getPageSettings().importPageSetup( getRelations(), rAttribs ); break;
- case XLS_TOKEN( headerFooter ): getPageSettings().importHeaderFooter( rAttribs ); break;
- case XLS_TOKEN( picture ): getPageSettings().importPicture( getRelations(), rAttribs ); break;
- case XLS_TOKEN( brk ): importBrk( rAttribs ); break;
- case XLS_TOKEN( drawing ): importDrawing( rAttribs ); break;
- case XLS_TOKEN( legacyDrawing ): importLegacyDrawing( rAttribs ); break;
- case XLS_TOKEN( oleObject ): importOleObject( rAttribs ); break;
- case XLS_TOKEN( control ): importControl( rAttribs ); break;
+ if( nElement == XLS_TOKEN( control ) ) importControl( rAttribs );
+ break;
}
+ return 0;
}
-namespace {
-
-ApiTokenSequence lclImportDataValFormula( FormulaParser& rParser, const OUString& rFormula, const CellAddress& rBaseAddress )
-{
- TokensFormulaContext aContext( true, false );
- aContext.setBaseAddress( rBaseAddress );
- rParser.importFormula( aContext, rFormula );
- return aContext.getTokens();
-}
-
-} // namespace
-
void OoxWorksheetFragment::onEndElement( const OUString& rChars )
{
switch( getCurrentElement() )
@@ -262,113 +370,82 @@ void OoxWorksheetFragment::onEndElement( const OUString& rChars )
case XLS_TOKEN( evenFooter ):
getPageSettings().importHeaderFooterCharacters( rChars, getCurrentElement() );
break;
- case XLS_TOKEN( formula1 ):
- if( mxValData.get() )
- {
- mxValData->maTokens1 = lclImportDataValFormula(
- getFormulaParser(), rChars, mxValData->maRanges.getBaseAddress() );
- // process string list of a list validation (convert to list of string tokens)
- if( mxValData->mnType == XML_list )
- getFormulaParser().convertStringToStringList( mxValData->maTokens1, ',', true );
- }
- break;
- case XLS_TOKEN( formula2 ):
- if( mxValData.get() )
- mxValData->maTokens2 = lclImportDataValFormula(
- getFormulaParser(), rChars, mxValData->maRanges.getBaseAddress() );
- break;
- case XLS_TOKEN( dataValidation ):
- if( mxValData.get() )
- setValidation( *mxValData );
- mxValData.reset();
- break;
}
}
-ContextWrapper OoxWorksheetFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& )
+ContextHandlerRef OoxWorksheetFragment::onCreateRecordContext( sal_Int32 nRecId, RecordInputStream& rStrm )
{
switch( getCurrentElement() )
{
case XML_ROOT_CONTEXT:
- return (nRecId == OOBIN_ID_WORKSHEET);
+ if( nRecId == OOBIN_ID_WORKSHEET ) return this;
+ break;
+
case OOBIN_ID_WORKSHEET:
switch( nRecId )
{
- case OOBIN_ID_SHEETDATA:
- return new OoxSheetDataContext( *this );
- case OOBIN_ID_CONDFORMATTING:
- return new OoxCondFormatContext( *this );
+ case OOBIN_ID_SHEETDATA: return new OoxSheetDataContext( *this );
+ case OOBIN_ID_CONDFORMATTING: return new OoxCondFormatContext( *this );
+ case OOBIN_ID_DATAVALIDATIONS: return new OoxDataValidationsContext( *this );
+
+ case OOBIN_ID_SHEETVIEWS:
+ case OOBIN_ID_COLS:
+ case OOBIN_ID_MERGECELLS:
+ case OOBIN_ID_ROWBREAKS:
+ case OOBIN_ID_COLBREAKS:
+ case OOBIN_ID_OLEOBJECTS:
+ case OOBIN_ID_CONTROLS: return this;
+
+ case OOBIN_ID_SHEETPR: getWorksheetSettings().importSheetPr( rStrm ); break;
+ case OOBIN_ID_DIMENSION: importDimension( rStrm ); break;
+ case OOBIN_ID_SHEETFORMATPR: importSheetFormatPr( rStrm ); break;
+ case OOBIN_ID_HYPERLINK: importHyperlink( rStrm ); break;
+ case OOBIN_ID_PAGEMARGINS: getPageSettings().importPageMargins( rStrm ); break;
+ case OOBIN_ID_PAGESETUP: getPageSettings().importPageSetup( getRelations(), rStrm ); break;
+ case OOBIN_ID_PRINTOPTIONS: getPageSettings().importPrintOptions( rStrm ); break;
+ case OOBIN_ID_HEADERFOOTER: getPageSettings().importHeaderFooter( rStrm ); break;
+ case OOBIN_ID_PICTURE: getPageSettings().importPicture( getRelations(), rStrm ); break;
+ case OOBIN_ID_SHEETPROTECTION: getWorksheetSettings().importSheetProtection( rStrm ); break;
+ case OOBIN_ID_PHONETICPR: getWorksheetSettings().importPhoneticPr( rStrm ); break;
+ case OOBIN_ID_DRAWING: importDrawing( rStrm ); break;
+ case OOBIN_ID_LEGACYDRAWING: importLegacyDrawing( rStrm ); break;
}
- return (nRecId == OOBIN_ID_SHEETPR) ||
- (nRecId == OOBIN_ID_DIMENSION) ||
- (nRecId == OOBIN_ID_SHEETFORMATPR) ||
- (nRecId == OOBIN_ID_SHEETVIEWS) ||
- (nRecId == OOBIN_ID_COLS) ||
- (nRecId == OOBIN_ID_MERGECELLS) ||
- (nRecId == OOBIN_ID_HYPERLINK) ||
- (nRecId == OOBIN_ID_DATAVALIDATIONS) ||
- (nRecId == OOBIN_ID_PAGEMARGINS) ||
- (nRecId == OOBIN_ID_PAGESETUP) ||
- (nRecId == OOBIN_ID_PRINTOPTIONS) ||
- (nRecId == OOBIN_ID_HEADERFOOTER) ||
- (nRecId == OOBIN_ID_PICTURE) ||
- (nRecId == OOBIN_ID_ROWBREAKS) ||
- (nRecId == OOBIN_ID_COLBREAKS) ||
- (nRecId == OOBIN_ID_SHEETPROTECTION) ||
- (nRecId == OOBIN_ID_PHONETICPR) ||
- (nRecId == OOBIN_ID_DRAWING) ||
- (nRecId == OOBIN_ID_LEGACYDRAWING) ||
- (nRecId == OOBIN_ID_OLEOBJECTS) ||
- (nRecId == OOBIN_ID_CONTROLS);
+ break;
+
case OOBIN_ID_SHEETVIEWS:
- return (nRecId == OOBIN_ID_SHEETVIEW);
+ switch( nRecId )
+ {
+ case OOBIN_ID_SHEETVIEW: getSheetViewSettings().importSheetView( rStrm ); return this;
+ }
+ break;
case OOBIN_ID_SHEETVIEW:
- return (nRecId == OOBIN_ID_PANE) ||
- (nRecId == OOBIN_ID_SELECTION);
+ switch( nRecId )
+ {
+ case OOBIN_ID_PANE: getSheetViewSettings().importPane( rStrm ); break;
+ case OOBIN_ID_SELECTION: getSheetViewSettings().importSelection( rStrm ); break;
+ }
+ break;
+
case OOBIN_ID_COLS:
- return (nRecId == OOBIN_ID_COL);
+ if( nRecId == OOBIN_ID_COL ) importCol( rStrm );
+ break;
case OOBIN_ID_MERGECELLS:
- return (nRecId == OOBIN_ID_MERGECELL);
- case OOBIN_ID_DATAVALIDATIONS:
- return (nRecId == OOBIN_ID_DATAVALIDATION);
+ if( nRecId == OOBIN_ID_MERGECELL ) importMergeCell( rStrm );
+ break;
case OOBIN_ID_ROWBREAKS:
+ if( nRecId == OOBIN_ID_BRK ) importBrk( rStrm, true );
+ break;
case OOBIN_ID_COLBREAKS:
- return (nRecId == OOBIN_ID_BRK);
+ if( nRecId == OOBIN_ID_BRK ) importBrk( rStrm, false );
+ break;
case OOBIN_ID_OLEOBJECTS:
- return (nRecId == OOBIN_ID_OLEOBJECT);
+ if( nRecId == OOBIN_ID_OLEOBJECT ) importOleObject( rStrm );
+ break;
case OOBIN_ID_CONTROLS:
- return (nRecId == OOBIN_ID_CONTROL);
- }
- return false;
-}
-
-void OoxWorksheetFragment::onStartRecord( RecordInputStream& rStrm )
-{
- switch( getCurrentElement() )
- {
- case OOBIN_ID_SHEETPR: getWorksheetSettings().importSheetPr( rStrm ); break;
- case OOBIN_ID_DIMENSION: importDimension( rStrm ); break;
- case OOBIN_ID_SHEETPROTECTION: getWorksheetSettings().importSheetProtection( rStrm ); break;
- case OOBIN_ID_PHONETICPR: getWorksheetSettings().importPhoneticPr( rStrm ); break;
- case OOBIN_ID_SHEETFORMATPR: importSheetFormatPr( rStrm ); break;
- case OOBIN_ID_SHEETVIEW: getSheetViewSettings().importSheetView( rStrm ); break;
- case OOBIN_ID_PANE: getSheetViewSettings().importPane( rStrm ); break;
- case OOBIN_ID_SELECTION: getSheetViewSettings().importSelection( rStrm ); break;
- case OOBIN_ID_COL: importCol( rStrm ); break;
- case OOBIN_ID_MERGECELL: importMergeCell( rStrm ); break;
- case OOBIN_ID_HYPERLINK: importHyperlink( rStrm ); break;
- case OOBIN_ID_DATAVALIDATION: importDataValidation( rStrm ); break;
- case OOBIN_ID_PAGEMARGINS: getPageSettings().importPageMargins( rStrm ); break;
- case OOBIN_ID_PAGESETUP: getPageSettings().importPageSetup( getRelations(), rStrm ); break;
- case OOBIN_ID_PRINTOPTIONS: getPageSettings().importPrintOptions( rStrm ); break;
- case OOBIN_ID_HEADERFOOTER: getPageSettings().importHeaderFooter( rStrm ); break;
- case OOBIN_ID_PICTURE: getPageSettings().importPicture( getRelations(), rStrm ); break;
- case OOBIN_ID_BRK: importBrk( rStrm ); break;
- case OOBIN_ID_DRAWING: importDrawing( rStrm ); break;
- case OOBIN_ID_LEGACYDRAWING: importLegacyDrawing( rStrm ); break;
- case OOBIN_ID_OLEOBJECT: importOleObject( rStrm ); break;
- case OOBIN_ID_CONTROL: importControl( rStrm ); break;
+ if( nRecId == OOBIN_ID_CONTROL ) importControl( rStrm );
+ break;
}
+ return 0;
}
// oox.core.FragmentHandler2 interface ----------------------------------------
@@ -456,71 +533,47 @@ void OoxWorksheetFragment::importSheetFormatPr( const AttributeList& rAttribs )
void OoxWorksheetFragment::importCol( const AttributeList& rAttribs )
{
- OoxColumnData aData;
- aData.mnFirstCol = rAttribs.getInteger( XML_min, -1 );
- aData.mnLastCol = rAttribs.getInteger( XML_max, -1 );
- aData.mfWidth = rAttribs.getDouble( XML_width, 0.0 );
- aData.mnXfId = rAttribs.getInteger( XML_style, -1 );
- aData.mnLevel = rAttribs.getInteger( XML_outlineLevel, 0 );
- aData.mbShowPhonetic = rAttribs.getBool( XML_phonetic, false );
- aData.mbHidden = rAttribs.getBool( XML_hidden, false );
- aData.mbCollapsed = rAttribs.getBool( XML_collapsed, false );
+ ColumnModel aModel;
+ aModel.mnFirstCol = rAttribs.getInteger( XML_min, -1 );
+ aModel.mnLastCol = rAttribs.getInteger( XML_max, -1 );
+ aModel.mfWidth = rAttribs.getDouble( XML_width, 0.0 );
+ aModel.mnXfId = rAttribs.getInteger( XML_style, -1 );
+ aModel.mnLevel = rAttribs.getInteger( XML_outlineLevel, 0 );
+ aModel.mbShowPhonetic = rAttribs.getBool( XML_phonetic, false );
+ aModel.mbHidden = rAttribs.getBool( XML_hidden, false );
+ aModel.mbCollapsed = rAttribs.getBool( XML_collapsed, false );
// set column properties in the current sheet
- setColumnData( aData );
+ setColumnModel( aModel );
}
void OoxWorksheetFragment::importMergeCell( const AttributeList& rAttribs )
{
CellRangeAddress aRange;
- if( getAddressConverter().convertToCellRange( aRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex(), true ) )
+ if( getAddressConverter().convertToCellRange( aRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex(), true, true ) )
setMergedRange( aRange );
}
-void OoxWorksheetFragment::importDataValidation( const AttributeList& rAttribs )
-{
- mxValData.reset( new OoxValidationData );
- getAddressConverter().convertToCellRangeList( mxValData->maRanges, rAttribs.getString( XML_sqref, OUString() ), getSheetIndex(), true );
- mxValData->maInputTitle = rAttribs.getString( XML_promptTitle, OUString() );
- mxValData->maInputMessage = rAttribs.getString( XML_prompt, OUString() );
- mxValData->maErrorTitle = rAttribs.getString( XML_errorTitle, OUString() );
- mxValData->maErrorMessage = rAttribs.getString( XML_error, OUString() );
- mxValData->mnType = rAttribs.getToken( XML_type, XML_none );
- mxValData->mnOperator = rAttribs.getToken( XML_operator, XML_between );
- mxValData->mnErrorStyle = rAttribs.getToken( XML_errorStyle, XML_stop );
- mxValData->mbShowInputMsg = rAttribs.getBool( XML_showInputMessage, false );
- mxValData->mbShowErrorMsg = rAttribs.getBool( XML_showErrorMessage, false );
- /* The attribute showDropDown@dataValidation is in fact a "suppress
- dropdown" flag, as it was in the BIFF format! ECMA specification
- and attribute name are plain wrong! */
- mxValData->mbNoDropDown = rAttribs.getBool( XML_showDropDown, false );
- mxValData->mbAllowBlank = rAttribs.getBool( XML_allowBlank, false );
-}
-
void OoxWorksheetFragment::importHyperlink( const AttributeList& rAttribs )
{
- OoxHyperlinkData aData;
- if( getAddressConverter().convertToCellRange( aData.maRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex(), true ) )
+ HyperlinkModel aModel;
+ if( getAddressConverter().convertToCellRange( aModel.maRange, rAttribs.getString( XML_ref, OUString() ), getSheetIndex(), true, true ) )
{
- aData.maTarget = getRelations().getTargetFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
- aData.maLocation = rAttribs.getString( XML_location, OUString() );
- aData.maDisplay = rAttribs.getString( XML_display, OUString() );
- aData.maTooltip = rAttribs.getString( XML_tooltip, OUString() );
- setHyperlink( aData );
+ aModel.maTarget = getRelations().getTargetFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
+ aModel.maLocation = rAttribs.getString( XML_location, OUString() );
+ aModel.maDisplay = rAttribs.getString( XML_display, OUString() );
+ aModel.maTooltip = rAttribs.getString( XML_tooltip, OUString() );
+ setHyperlink( aModel );
}
}
-void OoxWorksheetFragment::importBrk( const AttributeList& rAttribs )
+void OoxWorksheetFragment::importBrk( const AttributeList& rAttribs, bool bRowBreak )
{
- OoxPageBreakData aData;
- aData.mnColRow = rAttribs.getInteger( XML_id, 0 );
- aData.mnMin = rAttribs.getInteger( XML_id, 0 );
- aData.mnMax = rAttribs.getInteger( XML_id, 0 );
- aData.mbManual = rAttribs.getBool( XML_man, false );
- switch( getPreviousElement() )
- {
- case XLS_TOKEN( rowBreaks ): setPageBreak( aData, true ); break;
- case XLS_TOKEN( colBreaks ): setPageBreak( aData, false ); break;
- }
+ PageBreakModel aModel;
+ aModel.mnColRow = rAttribs.getInteger( XML_id, 0 );
+ aModel.mnMin = rAttribs.getInteger( XML_id, 0 );
+ aModel.mnMax = rAttribs.getInteger( XML_id, 0 );
+ aModel.mbManual = rAttribs.getBool( XML_man, false );
+ setPageBreak( aModel, bRowBreak );
}
void OoxWorksheetFragment::importDrawing( const AttributeList& rAttribs )
@@ -535,28 +588,28 @@ void OoxWorksheetFragment::importLegacyDrawing( const AttributeList& rAttribs )
void OoxWorksheetFragment::importOleObject( const AttributeList& rAttribs )
{
- OoxOleObjectData aData;
- aData.maProgId = rAttribs.getString( XML_progId, OUString() );
+ OleObjectModel aModel;
+ aModel.maProgId = rAttribs.getString( XML_progId, OUString() );
OSL_ENSURE( rAttribs.hasAttribute( XML_link ) != rAttribs.hasAttribute( R_TOKEN( id ) ),
"OoxWorksheetFragment::importOleObject - either linked or embedded" );
if( rAttribs.hasAttribute( XML_link ) )
(void)0;
if( rAttribs.hasAttribute( R_TOKEN( id ) ) )
- aData.maStoragePath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
- aData.mnAspect = rAttribs.getToken( XML_dvAspect, XML_DVASPECT_CONTENT );
- aData.mnUpdateMode = rAttribs.getToken( XML_oleUpdate, XML_OLEUPDATE_ALWAYS );
- aData.mnShapeId = rAttribs.getInteger( XML_shapeId, 0 );
- aData.mbAutoLoad = rAttribs.getBool( XML_autoLoad, false );
- setOleObject( aData );
+ aModel.maStoragePath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
+ aModel.mnAspect = rAttribs.getToken( XML_dvAspect, XML_DVASPECT_CONTENT );
+ aModel.mnUpdateMode = rAttribs.getToken( XML_oleUpdate, XML_OLEUPDATE_ALWAYS );
+ aModel.mnShapeId = rAttribs.getInteger( XML_shapeId, 0 );
+ aModel.mbAutoLoad = rAttribs.getBool( XML_autoLoad, false );
+ setOleObject( aModel );
}
void OoxWorksheetFragment::importControl( const AttributeList& rAttribs )
{
- OoxFormControlData aData;
- aData.maStoragePath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
- aData.maName = rAttribs.getString( XML_name, OUString() );
- aData.mnShapeId = rAttribs.getInteger( XML_shapeId, 0 );
- setFormControl( aData );
+ FormControlModel aModel;
+ aModel.maStoragePath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) );
+ aModel.maName = rAttribs.getString( XML_name, OUString() );
+ aModel.mnShapeId = rAttribs.getInteger( XML_shapeId, 0 );
+ setFormControl( aModel );
}
void OoxWorksheetFragment::importDimension( RecordInputStream& rStrm )
@@ -589,24 +642,24 @@ void OoxWorksheetFragment::importSheetFormatPr( RecordInputStream& rStrm )
void OoxWorksheetFragment::importCol( RecordInputStream& rStrm )
{
- OoxColumnData aData;
+ ColumnModel aModel;
sal_Int32 nWidth;
sal_uInt16 nFlags;
- rStrm >> aData.mnFirstCol >> aData.mnLastCol >> nWidth >> aData.mnXfId >> nFlags;
+ rStrm >> aModel.mnFirstCol >> aModel.mnLastCol >> nWidth >> aModel.mnXfId >> nFlags;
- // column indexes are 0-based in OOBIN, but OoxColumnData expects 1-based
- ++aData.mnFirstCol;
- ++aData.mnLastCol;
+ // column indexes are 0-based in OOBIN, but ColumnModel expects 1-based
+ ++aModel.mnFirstCol;
+ ++aModel.mnLastCol;
// width is stored as 1/256th of a character in OOBIN, convert to entire character
- aData.mfWidth = static_cast< double >( nWidth ) / 256.0;
+ aModel.mfWidth = static_cast< double >( nWidth ) / 256.0;
// equal flags in BIFF and OOBIN
- aData.mnLevel = extractValue< sal_Int32 >( nFlags, 8, 3 );
- aData.mbShowPhonetic = getFlag( nFlags, BIFF_COLINFO_SHOWPHONETIC );
- aData.mbHidden = getFlag( nFlags, BIFF_COLINFO_HIDDEN );
- aData.mbCollapsed = getFlag( nFlags, BIFF_COLINFO_COLLAPSED );
+ aModel.mnLevel = extractValue< sal_Int32 >( nFlags, 8, 3 );
+ aModel.mbShowPhonetic = getFlag( nFlags, BIFF_COLINFO_SHOWPHONETIC );
+ aModel.mbHidden = getFlag( nFlags, BIFF_COLINFO_HIDDEN );
+ aModel.mbCollapsed = getFlag( nFlags, BIFF_COLINFO_COLLAPSED );
// set column properties in the current sheet
- setColumnData( aData );
+ setColumnModel( aModel );
}
void OoxWorksheetFragment::importMergeCell( RecordInputStream& rStrm )
@@ -614,7 +667,7 @@ void OoxWorksheetFragment::importMergeCell( RecordInputStream& rStrm )
BinRange aBinRange;
rStrm >> aBinRange;
CellRangeAddress aRange;
- if( getAddressConverter().convertToCellRange( aRange, aBinRange, getSheetIndex(), true ) )
+ if( getAddressConverter().convertToCellRange( aRange, aBinRange, getSheetIndex(), true, true ) )
setMergedRange( aRange );
}
@@ -622,62 +675,22 @@ void OoxWorksheetFragment::importHyperlink( RecordInputStream& rStrm )
{
BinRange aBinRange;
rStrm >> aBinRange;
- OoxHyperlinkData aData;
- if( getAddressConverter().convertToCellRange( aData.maRange, aBinRange, getSheetIndex(), true ) )
+ HyperlinkModel aModel;
+ if( getAddressConverter().convertToCellRange( aModel.maRange, aBinRange, getSheetIndex(), true, true ) )
{
- aData.maTarget = getRelations().getTargetFromRelId( rStrm.readString() );
- rStrm >> aData.maLocation >> aData.maTooltip >> aData.maDisplay;
- setHyperlink( aData );
+ aModel.maTarget = getRelations().getTargetFromRelId( rStrm.readString() );
+ rStrm >> aModel.maLocation >> aModel.maTooltip >> aModel.maDisplay;
+ setHyperlink( aModel );
}
}
-void OoxWorksheetFragment::importDataValidation( RecordInputStream& rStrm )
+void OoxWorksheetFragment::importBrk( RecordInputStream& rStrm, bool bRowBreak )
{
- OoxValidationData aData;
-
- sal_uInt32 nFlags;
- BinRangeList aRanges;
- rStrm >> nFlags >> aRanges >> aData.maErrorTitle >> aData.maErrorMessage >> aData.maInputTitle >> aData.maInputMessage;
-
- // equal flags in BIFF and OOBIN
- aData.setBinType( extractValue< sal_uInt8 >( nFlags, 0, 4 ) );
- aData.setBinOperator( extractValue< sal_uInt8 >( nFlags, 20, 4 ) );
- aData.setBinErrorStyle( extractValue< sal_uInt8 >( nFlags, 4, 3 ) );
- aData.mbAllowBlank = getFlag( nFlags, BIFF_DATAVAL_ALLOWBLANK );
- aData.mbNoDropDown = getFlag( nFlags, BIFF_DATAVAL_NODROPDOWN );
- aData.mbShowInputMsg = getFlag( nFlags, BIFF_DATAVAL_SHOWINPUT );
- aData.mbShowErrorMsg = getFlag( nFlags, BIFF_DATAVAL_SHOWERROR );
-
- // cell range list
- getAddressConverter().convertToCellRangeList( aData.maRanges, aRanges, getSheetIndex(), true );
-
- // condition formula(s)
- FormulaParser& rParser = getFormulaParser();
- TokensFormulaContext aContext( true, false );
- aContext.setBaseAddress( aData.maRanges.getBaseAddress() );
- rParser.importFormula( aContext, rStrm );
- aData.maTokens1 = aContext.getTokens();
- rParser.importFormula( aContext, rStrm );
- aData.maTokens2 = aContext.getTokens();
- // process string list of a list validation (convert to list of string tokens)
- if( (aData.mnType == XML_list) && getFlag( nFlags, BIFF_DATAVAL_STRINGLIST ) )
- rParser.convertStringToStringList( aData.maTokens1, ',', true );
-
- // set validation data
- setValidation( aData );
-}
-
-void OoxWorksheetFragment::importBrk( RecordInputStream& rStrm )
-{
- OoxPageBreakData aData;
+ PageBreakModel aModel;
sal_Int32 nManual;
- rStrm >> aData.mnColRow >> aData.mnMin >> aData.mnMax >> nManual;
- aData.mbManual = nManual != 0;
- switch( getPreviousElement() )
- {
- case OOBIN_ID_ROWBREAKS: setPageBreak( aData, true ); break;
- case OOBIN_ID_COLBREAKS: setPageBreak( aData, false ); break;
- }
+ rStrm >> aModel.mnColRow >> aModel.mnMin >> aModel.mnMax >> nManual;
+ aModel.mbManual = nManual != 0;
+ setPageBreak( aModel, bRowBreak );
}
void OoxWorksheetFragment::importDrawing( RecordInputStream& rStrm )
@@ -692,27 +705,27 @@ void OoxWorksheetFragment::importLegacyDrawing( RecordInputStream& rStrm )
void OoxWorksheetFragment::importOleObject( RecordInputStream& rStrm )
{
- OoxOleObjectData aData;
+ OleObjectModel aModel;
sal_Int32 nAspect, nUpdateMode;
sal_uInt16 nFlags;
- rStrm >> nAspect >> nUpdateMode >> aData.mnShapeId >> nFlags >> aData.maProgId;
+ rStrm >> nAspect >> nUpdateMode >> aModel.mnShapeId >> nFlags >> aModel.maProgId;
if( getFlag( nFlags, OOBIN_OLEOBJECT_LINKED ) )
(void)0;
else
- aData.maStoragePath = getFragmentPathFromRelId( rStrm.readString() );
- aData.mnAspect = (nAspect == OOBIN_OLEOBJECT_ICON) ? XML_DVASPECT_ICON : XML_DVASPECT_CONTENT;
- aData.mnUpdateMode = (nUpdateMode == OOBIN_OLEOBJECT_ONCALL) ? XML_OLEUPDATE_ONCALL : XML_OLEUPDATE_ALWAYS;
- aData.mbAutoLoad = getFlag( nFlags, OOBIN_OLEOBJECT_AUTOLOAD );
- setOleObject( aData );
+ aModel.maStoragePath = getFragmentPathFromRelId( rStrm.readString() );
+ aModel.mnAspect = (nAspect == OOBIN_OLEOBJECT_ICON) ? XML_DVASPECT_ICON : XML_DVASPECT_CONTENT;
+ aModel.mnUpdateMode = (nUpdateMode == OOBIN_OLEOBJECT_ONCALL) ? XML_OLEUPDATE_ONCALL : XML_OLEUPDATE_ALWAYS;
+ aModel.mbAutoLoad = getFlag( nFlags, OOBIN_OLEOBJECT_AUTOLOAD );
+ setOleObject( aModel );
}
void OoxWorksheetFragment::importControl( RecordInputStream& rStrm )
{
- OoxFormControlData aData;
- rStrm >> aData.mnShapeId;
- aData.maStoragePath = getFragmentPathFromRelId( rStrm.readString() );
- rStrm >> aData.maName;
- setFormControl( aData );
+ FormControlModel aModel;
+ rStrm >> aModel.mnShapeId;
+ aModel.maStoragePath = getFragmentPathFromRelId( rStrm.readString() );
+ rStrm >> aModel.maName;
+ setFormControl( aModel );
}
// ============================================================================
@@ -722,6 +735,10 @@ BiffWorksheetFragment::BiffWorksheetFragment( const BiffWorkbookFragmentBase& rP
{
}
+BiffWorksheetFragment::~BiffWorksheetFragment()
+{
+}
+
bool BiffWorksheetFragment::importFragment()
{
// initial processing in base class WorksheetHelper
@@ -828,6 +845,7 @@ bool BiffWorksheetFragment::importFragment()
case BIFF_ID_MERGEDCELLS: importMergedCells(); break; // #i62300# also in BIFF5
case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break;
case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break;
+ case BIFF_ID_PTDEFINITION: importPTDefinition(); break;
case BIFF_ID_SAVERECALC: rWorkbookSett.importSaveRecalc( mrStrm ); break;
case BIFF_ID_SCENPROTECT: rWorksheetSett.importScenProtect( mrStrm ); break;
case BIFF_ID_SCL: rSheetViewSett.importScl( mrStrm ); break;
@@ -851,14 +869,15 @@ bool BiffWorksheetFragment::importFragment()
case BIFF_ID_LABELRANGES: importLabelRanges(); break;
case BIFF_ID_MERGEDCELLS: importMergedCells(); break;
case BIFF_ID_OBJECTPROTECT: rWorksheetSett.importObjectProtect( mrStrm ); break;
+ case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break;
+ case BIFF_ID_PHONETICPR: rWorksheetSett.importPhoneticPr( mrStrm ); break;
case BIFF_ID_PICTURE: rPageSett.importPicture( mrStrm ); break;
+ case BIFF_ID_PTDEFINITION: importPTDefinition(); break;
case BIFF_ID_SAVERECALC: rWorkbookSett.importSaveRecalc( mrStrm ); break;
case BIFF_ID_SCENPROTECT: rWorksheetSett.importScenProtect( mrStrm ); break;
case BIFF_ID_SCL: rSheetViewSett.importScl( mrStrm ); break;
case BIFF_ID_SHEETPR: rWorksheetSett.importSheetPr( mrStrm ); break;
case BIFF_ID_SHEETPROTECTION: rWorksheetSett.importSheetProtection( mrStrm ); break;
- case BIFF_ID_PAGESETUP: rPageSett.importPageSetup( mrStrm ); break;
- case BIFF_ID_PHONETICPR: rWorksheetSett.importPhoneticPr( mrStrm ); break;
case BIFF_ID_STANDARDWIDTH: importStandardWidth(); break;
case BIFF_ID_UNCALCED: rWorkbookSett.importUncalced( mrStrm ); break;
case BIFF_ID_VCENTER: rPageSett.importVerCenter( mrStrm ); break;
@@ -873,6 +892,9 @@ bool BiffWorksheetFragment::importFragment()
// record not processed, try cell records
if( mrStrm.tellBase() == nStrmPos )
aSheetData.importRecord();
+ // record still not processed, try pivot table records
+ if( mxPTContext.get() && (mrStrm.tellBase() == nStrmPos) )
+ mxPTContext->importRecord();
}
}
@@ -888,26 +910,26 @@ void BiffWorksheetFragment::importColInfo()
sal_uInt16 nFirstCol, nLastCol, nWidth, nXfId, nFlags;
mrStrm >> nFirstCol >> nLastCol >> nWidth >> nXfId >> nFlags;
- OoxColumnData aData;
- // column indexes are 0-based in BIFF, but OoxColumnData expects 1-based
- aData.mnFirstCol = static_cast< sal_Int32 >( nFirstCol ) + 1;
- aData.mnLastCol = static_cast< sal_Int32 >( nLastCol ) + 1;
+ ColumnModel aModel;
+ // column indexes are 0-based in BIFF, but ColumnModel expects 1-based
+ aModel.mnFirstCol = static_cast< sal_Int32 >( nFirstCol ) + 1;
+ aModel.mnLastCol = static_cast< sal_Int32 >( nLastCol ) + 1;
// width is stored as 1/256th of a character in BIFF, convert to entire character
- aData.mfWidth = static_cast< double >( nWidth ) / 256.0;
- aData.mnXfId = nXfId;
- aData.mnLevel = extractValue< sal_Int32 >( nFlags, 8, 3 );
- aData.mbShowPhonetic = getFlag( nFlags, BIFF_COLINFO_SHOWPHONETIC );
- aData.mbHidden = getFlag( nFlags, BIFF_COLINFO_HIDDEN );
- aData.mbCollapsed = getFlag( nFlags, BIFF_COLINFO_COLLAPSED );
+ aModel.mfWidth = static_cast< double >( nWidth ) / 256.0;
+ aModel.mnXfId = nXfId;
+ aModel.mnLevel = extractValue< sal_Int32 >( nFlags, 8, 3 );
+ aModel.mbShowPhonetic = getFlag( nFlags, BIFF_COLINFO_SHOWPHONETIC );
+ aModel.mbHidden = getFlag( nFlags, BIFF_COLINFO_HIDDEN );
+ aModel.mbCollapsed = getFlag( nFlags, BIFF_COLINFO_COLLAPSED );
// set column properties in the current sheet
- setColumnData( aData );
+ setColumnModel( aModel );
}
void BiffWorksheetFragment::importColumnDefault()
{
sal_uInt16 nFirstCol, nLastCol, nXfId;
mrStrm >> nFirstCol >> nLastCol >> nXfId;
- convertColumnFormat( nFirstCol, nLastCol, nXfId );
+ setDefaultColumnFormat( nFirstCol, nLastCol, nXfId );
}
void BiffWorksheetFragment::importColWidth()
@@ -916,14 +938,14 @@ void BiffWorksheetFragment::importColWidth()
sal_uInt16 nWidth;
mrStrm >> nFirstCol >> nLastCol >> nWidth;
- OoxColumnData aData;
- // column indexes are 0-based in BIFF, but OoxColumnData expects 1-based
- aData.mnFirstCol = static_cast< sal_Int32 >( nFirstCol ) + 1;
- aData.mnLastCol = static_cast< sal_Int32 >( nLastCol ) + 1;
+ ColumnModel aModel;
+ // column indexes are 0-based in BIFF, but ColumnModel expects 1-based
+ aModel.mnFirstCol = static_cast< sal_Int32 >( nFirstCol ) + 1;
+ aModel.mnLastCol = static_cast< sal_Int32 >( nLastCol ) + 1;
// width is stored as 1/256th of a character in BIFF, convert to entire character
- aData.mfWidth = static_cast< double >( nWidth ) / 256.0;
+ aModel.mfWidth = static_cast< double >( nWidth ) / 256.0;
// set column properties in the current sheet
- setColumnData( aData );
+ setColumnModel( aModel );
}
void BiffWorksheetFragment::importDefColWidth()
@@ -988,40 +1010,40 @@ ApiTokenSequence lclReadDataValFormula( BiffInputStream& rStrm, FormulaParser& r
void BiffWorksheetFragment::importDataValidation()
{
- OoxValidationData aData;
+ ValidationModel aModel;
// flags
sal_uInt32 nFlags;
mrStrm >> nFlags;
- aData.setBinType( extractValue< sal_uInt8 >( nFlags, 0, 4 ) );
- aData.setBinOperator( extractValue< sal_uInt8 >( nFlags, 20, 4 ) );
- aData.setBinErrorStyle( extractValue< sal_uInt8 >( nFlags, 4, 3 ) );
- aData.mbAllowBlank = getFlag( nFlags, BIFF_DATAVAL_ALLOWBLANK );
- aData.mbNoDropDown = getFlag( nFlags, BIFF_DATAVAL_NODROPDOWN );
- aData.mbShowInputMsg = getFlag( nFlags, BIFF_DATAVAL_SHOWINPUT );
- aData.mbShowErrorMsg = getFlag( nFlags, BIFF_DATAVAL_SHOWERROR );
+ aModel.setBinType( extractValue< sal_uInt8 >( nFlags, 0, 4 ) );
+ aModel.setBinOperator( extractValue< sal_uInt8 >( nFlags, 20, 4 ) );
+ aModel.setBinErrorStyle( extractValue< sal_uInt8 >( nFlags, 4, 3 ) );
+ aModel.mbAllowBlank = getFlag( nFlags, BIFF_DATAVAL_ALLOWBLANK );
+ aModel.mbNoDropDown = getFlag( nFlags, BIFF_DATAVAL_NODROPDOWN );
+ aModel.mbShowInputMsg = getFlag( nFlags, BIFF_DATAVAL_SHOWINPUT );
+ aModel.mbShowErrorMsg = getFlag( nFlags, BIFF_DATAVAL_SHOWERROR );
// message strings
- aData.maInputTitle = lclReadDataValMessage( mrStrm );
- aData.maErrorTitle = lclReadDataValMessage( mrStrm );
- aData.maInputMessage = lclReadDataValMessage( mrStrm );
- aData.maErrorMessage = lclReadDataValMessage( mrStrm );
+ aModel.maInputTitle = lclReadDataValMessage( mrStrm );
+ aModel.maErrorTitle = lclReadDataValMessage( mrStrm );
+ aModel.maInputMessage = lclReadDataValMessage( mrStrm );
+ aModel.maErrorMessage = lclReadDataValMessage( mrStrm );
// condition formula(s)
FormulaParser& rParser = getFormulaParser();
- aData.maTokens1 = lclReadDataValFormula( mrStrm, rParser );
- aData.maTokens2 = lclReadDataValFormula( mrStrm, rParser );
+ aModel.maTokens1 = lclReadDataValFormula( mrStrm, rParser );
+ aModel.maTokens2 = lclReadDataValFormula( mrStrm, rParser );
// process string list of a list validation (convert to list of string tokens)
- if( (aData.mnType == XML_list) && getFlag( nFlags, BIFF_DATAVAL_STRINGLIST ) )
- rParser.convertStringToStringList( aData.maTokens1, '\0', true );
+ if( (aModel.mnType == XML_list) && getFlag( nFlags, BIFF_DATAVAL_STRINGLIST ) )
+ rParser.convertStringToStringList( aModel.maTokens1, '\0', true );
// cell range list
BinRangeList aRanges;
mrStrm >> aRanges;
- getAddressConverter().convertToCellRangeList( aData.maRanges, aRanges, getSheetIndex(), true );
+ getAddressConverter().convertToCellRangeList( aModel.maRanges, aRanges, getSheetIndex(), true );
// set validation data
- setValidation( aData );
+ setValidation( aModel );
}
void BiffWorksheetFragment::importDimension()
@@ -1063,7 +1085,7 @@ OUString BiffWorksheetFragment::readHyperlinkString( rtl_TextEncoding eTextEnc,
void BiffWorksheetFragment::importHyperlink()
{
- OoxHyperlinkData aData;
+ HyperlinkModel aModel;
// read cell range for the hyperlink
BinRange aBiffRange;
@@ -1071,7 +1093,7 @@ void BiffWorksheetFragment::importHyperlink()
// #i80006# Excel silently ignores invalid hi-byte of column index (TODO: everywhere?)
aBiffRange.maFirst.mnCol &= 0xFF;
aBiffRange.maLast.mnCol &= 0xFF;
- if( !getAddressConverter().convertToCellRange( aData.maRange, aBiffRange, getSheetIndex(), true ) )
+ if( !getAddressConverter().convertToCellRange( aModel.maRange, aBiffRange, getSheetIndex(), true, true ) )
return;
BiffGuid aGuid;
@@ -1085,10 +1107,10 @@ void BiffWorksheetFragment::importHyperlink()
// display string
if( getFlag( nFlags, OLE_HYPERLINK_HASDISPLAY ) )
- aData.maDisplay = readHyperlinkString( getTextEncoding(), true );
+ aModel.maDisplay = readHyperlinkString( getTextEncoding(), true );
// frame string
if( getFlag( nFlags, OLE_HYPERLINK_HASFRAME ) )
- aData.maFrame = readHyperlinkString( getTextEncoding(), true );
+ aModel.maFrame = readHyperlinkString( getTextEncoding(), true );
// target
if( getFlag( nFlags, OLE_HYPERLINK_HASTARGET ) )
@@ -1096,7 +1118,7 @@ void BiffWorksheetFragment::importHyperlink()
if( getFlag( nFlags, OLE_HYPERLINK_ASSTRING ) )
{
OSL_ENSURE( getFlag( nFlags, OLE_HYPERLINK_ABSOLUTE ), "BiffWorksheetFragment::importHyperlink - link not absolute" );
- aData.maTarget = readHyperlinkString( getTextEncoding(), true );
+ aModel.maTarget = readHyperlinkString( getTextEncoding(), true );
}
else // hyperlink moniker
{
@@ -1107,7 +1129,7 @@ void BiffWorksheetFragment::importHyperlink()
sal_Int16 nUpLevels;
mrStrm >> nUpLevels;
OSL_ENSURE( (nUpLevels == 0) || !getFlag( nFlags, OLE_HYPERLINK_ABSOLUTE ), "BiffWorksheetFragment::importHyperlink - absolute filename with upcount" );
- aData.maTarget = readHyperlinkString( getTextEncoding(), false );
+ aModel.maTarget = readHyperlinkString( getTextEncoding(), false );
mrStrm.skip( 24 );
sal_Int32 nBytes = mrStrm.readInt32();
if( nBytes > 0 )
@@ -1115,19 +1137,19 @@ void BiffWorksheetFragment::importHyperlink()
sal_Int64 nEndPos = mrStrm.tell() + ::std::max< sal_Int32 >( nBytes, 0 );
sal_uInt16 nChars = getLimitedValue< sal_uInt16, sal_Int32 >( mrStrm.readInt32() / 2, 0, SAL_MAX_UINT16 );
mrStrm.skip( 2 ); // key value
- aData.maTarget = mrStrm.readUnicodeArray( nChars ); // NOT null terminated
+ aModel.maTarget = mrStrm.readUnicodeArray( nChars ); // NOT null terminated
mrStrm.seek( nEndPos );
}
if( !getFlag( nFlags, OLE_HYPERLINK_ABSOLUTE ) )
for( sal_Int16 nLevel = 0; nLevel < nUpLevels; ++nLevel )
- aData.maTarget = CREATE_OUSTRING( "../" ) + aData.maTarget;
+ aModel.maTarget = CREATE_OUSTRING( "../" ) + aModel.maTarget;
}
else if( aGuid == BiffHelper::maGuidUrlMoniker )
{
// URL, maybe relative and with leading '../'
sal_Int32 nBytes = mrStrm.readInt32();
sal_Int64 nEndPos = mrStrm.tell() + ::std::max< sal_Int32 >( nBytes, 0 );
- aData.maTarget = mrStrm.readNulUnicodeArray();
+ aModel.maTarget = mrStrm.readNulUnicodeArray();
mrStrm.seek( nEndPos );
}
else
@@ -1140,7 +1162,7 @@ void BiffWorksheetFragment::importHyperlink()
// target location
if( getFlag( nFlags, OLE_HYPERLINK_HASLOCATION ) )
- aData.maLocation = readHyperlinkString( getTextEncoding(), true );
+ aModel.maLocation = readHyperlinkString( getTextEncoding(), true );
// try to read the SCREENTIP record
if( (mrStrm.getNextRecId() == BIFF_ID_SCREENTIP) && mrStrm.startNextRecord() )
@@ -1149,20 +1171,20 @@ void BiffWorksheetFragment::importHyperlink()
// the cell range, again
mrStrm >> aBiffRange;
CellRangeAddress aRange;
- if( getAddressConverter().convertToCellRange( aRange, aBiffRange, getSheetIndex(), true ) &&
- (aRange.StartColumn == aData.maRange.StartColumn) &&
- (aRange.StartRow == aData.maRange.StartRow) &&
- (aRange.EndColumn == aData.maRange.EndColumn) &&
- (aRange.EndRow == aData.maRange.EndRow) )
+ if( getAddressConverter().convertToCellRange( aRange, aBiffRange, getSheetIndex(), true, true ) &&
+ (aRange.StartColumn == aModel.maRange.StartColumn) &&
+ (aRange.StartRow == aModel.maRange.StartRow) &&
+ (aRange.EndColumn == aModel.maRange.EndColumn) &&
+ (aRange.EndRow == aModel.maRange.EndRow) )
{
/* This time, we have no string length, no flag field, and a
null-terminated 16-bit character array. */
- aData.maTooltip = mrStrm.readNulUnicodeArray();
+ aModel.maTooltip = mrStrm.readNulUnicodeArray();
}
}
// store the hyperlink settings
- setHyperlink( aData );
+ setHyperlink( aModel );
}
void BiffWorksheetFragment::importLabelRanges()
@@ -1187,21 +1209,27 @@ void BiffWorksheetFragment::importMergedCells()
void BiffWorksheetFragment::importPageBreaks( bool bRowBreak )
{
- OoxPageBreakData aData;
- aData.mbManual = true; // only manual breaks stored in BIFF
+ PageBreakModel aModel;
+ aModel.mbManual = true; // only manual breaks stored in BIFF
bool bBiff8 = getBiff() == BIFF8; // skip start/end columns or rows in BIFF8
sal_uInt16 nCount;
mrStrm >> nCount;
for( sal_uInt16 nIndex = 0; !mrStrm.isEof() && (nIndex < nCount); ++nIndex )
{
- aData.mnColRow = mrStrm.readuInt16();
- setPageBreak( aData, bRowBreak );
+ aModel.mnColRow = mrStrm.readuInt16();
+ setPageBreak( aModel, bRowBreak );
if( bBiff8 )
mrStrm.skip( 4 );
}
}
+void BiffWorksheetFragment::importPTDefinition()
+{
+ mxPTContext.reset( new BiffPivotTableContext( *this, getPivotTables().createPivotTable() ) );
+ mxPTContext->importRecord();
+}
+
void BiffWorksheetFragment::importStandardWidth()
{
sal_uInt16 nWidth;
diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx
index 58c12c41f460..2e7a1b1f31fd 100644
--- a/oox/source/xls/worksheethelper.cxx
+++ b/oox/source/xls/worksheethelper.cxx
@@ -36,7 +36,10 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/util/NumberFormat.hpp>
#include <com/sun/star/util/XMergeable.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/util/XNumberFormatTypes.hpp>
#include <com/sun/star/table/XColumnRowRange.hpp>
#include <com/sun/star/sheet/TableValidationVisibility.hpp>
#include <com/sun/star/sheet/ValidationType.hpp>
@@ -52,11 +55,13 @@
#include <com/sun/star/sheet/XMultipleOperation.hpp>
#include <com/sun/star/sheet/XLabelRanges.hpp>
#include <com/sun/star/text/XText.hpp>
+#include "properties.hxx"
#include "tokens.hxx"
#include "oox/helper/containerhelper.hxx"
#include "oox/helper/propertyset.hxx"
#include "oox/core/filterbase.hxx"
#include "oox/xls/addressconverter.hxx"
+#include "oox/xls/commentsbuffer.hxx"
#include "oox/xls/condformatbuffer.hxx"
#include "oox/xls/drawingfragment.hxx"
#include "oox/xls/formulaparser.hxx"
@@ -66,6 +71,7 @@
#include "oox/xls/stylesbuffer.hxx"
#include "oox/xls/unitconverter.hxx"
#include "oox/xls/viewsettings.hxx"
+#include "oox/xls/workbooksettings.hxx"
#include "oox/xls/worksheetbuffer.hxx"
#include "oox/xls/worksheetsettings.hxx"
@@ -75,9 +81,14 @@ using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::uno::UNO_SET_THROW;
+using ::com::sun::star::lang::Locale;
using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::util::DateTime;
using ::com::sun::star::util::XMergeable;
+using ::com::sun::star::util::XNumberFormatsSupplier;
+using ::com::sun::star::util::XNumberFormatTypes;
using ::com::sun::star::awt::Point;
using ::com::sun::star::awt::Size;
using ::com::sun::star::table::BorderLine;
@@ -123,6 +134,12 @@ void lclUpdateProgressBar( ISegmentProgressBarRef xProgressBar, const CellRangeA
}
}
+void lclUpdateProgressBar( ISegmentProgressBarRef xProgressBar, double fPosition )
+{
+ if( xProgressBar.get() )
+ xProgressBar->setPosition( fPosition );
+}
+
// ----------------------------------------------------------------------------
struct ValueRange
@@ -200,7 +217,7 @@ void ValueRangeSet::intersect( ValueRangeVector& orRanges, sal_Int32 nFirst, sal
// ============================================================================
// ============================================================================
-void OoxCellData::reset()
+void CellModel::reset()
{
mxCell.clear();
maValueStr = maFormulaRef = OUString();
@@ -211,7 +228,7 @@ void OoxCellData::reset()
// ----------------------------------------------------------------------------
-OoxDataTableData::OoxDataTableData() :
+DataTableModel::DataTableModel() :
mb2dTable( false ),
mbRowTable( false ),
mbRef1Deleted( false ),
@@ -221,7 +238,7 @@ OoxDataTableData::OoxDataTableData() :
// ----------------------------------------------------------------------------
-OoxColumnData::OoxColumnData() :
+ColumnModel::ColumnModel() :
mnFirstCol( -1 ),
mnLastCol( -1 ),
mfWidth( 0.0 ),
@@ -233,24 +250,25 @@ OoxColumnData::OoxColumnData() :
{
}
-bool OoxColumnData::tryExpand( const OoxColumnData& rNewData )
+bool ColumnModel::tryExpand( const ColumnModel& rModel )
{
bool bExpandable =
- (mnFirstCol <= rNewData.mnFirstCol) &&
- (rNewData.mnFirstCol <= mnLastCol + 1) &&
- (mfWidth == rNewData.mfWidth) &&
+ (mnFirstCol <= rModel.mnFirstCol) &&
+ (rModel.mnFirstCol <= mnLastCol + 1) &&
+ (mfWidth == rModel.mfWidth) &&
// ignore mnXfId, cell formatting is always set directly
- (mnLevel == rNewData.mnLevel) &&
- (mbHidden == rNewData.mbHidden) &&
- (mbCollapsed == rNewData.mbCollapsed);
+ (mnLevel == rModel.mnLevel) &&
+ (mbHidden == rModel.mbHidden) &&
+ (mbCollapsed == rModel.mbCollapsed);
+
if( bExpandable )
- mnLastCol = rNewData.mnLastCol;
+ mnLastCol = rModel.mnLastCol;
return bExpandable;
}
// ----------------------------------------------------------------------------
-OoxRowData::OoxRowData() :
+RowModel::RowModel() :
mnFirstRow( -1 ),
mnLastRow( -1 ),
mfHeight( 0.0 ),
@@ -266,25 +284,26 @@ OoxRowData::OoxRowData() :
{
}
-bool OoxRowData::tryExpand( const OoxRowData& rNewData )
+bool RowModel::tryExpand( const RowModel& rModel )
{
bool bExpandable =
- (mnFirstRow <= rNewData.mnFirstRow) &&
- (rNewData.mnFirstRow <= mnLastRow + 1) &&
- (mfHeight == rNewData.mfHeight) &&
+ (mnFirstRow <= rModel.mnFirstRow) &&
+ (rModel.mnFirstRow <= mnLastRow + 1) &&
+ (mfHeight == rModel.mfHeight) &&
// ignore mnXfId, mbCustomFormat, mbShowPhonetic - cell formatting is always set directly
- (mnLevel == rNewData.mnLevel) &&
- (mbCustomHeight == rNewData.mbCustomHeight) &&
- (mbHidden == rNewData.mbHidden) &&
- (mbCollapsed == rNewData.mbCollapsed);
+ (mnLevel == rModel.mnLevel) &&
+ (mbCustomHeight == rModel.mbCustomHeight) &&
+ (mbHidden == rModel.mbHidden) &&
+ (mbCollapsed == rModel.mbCollapsed);
+
if( bExpandable )
- mnLastRow = rNewData.mnLastRow;
+ mnLastRow = rModel.mnLastRow;
return bExpandable;
}
// ----------------------------------------------------------------------------
-OoxPageBreakData::OoxPageBreakData() :
+PageBreakModel::PageBreakModel() :
mnColRow( 0 ),
mbManual( false )
{
@@ -292,13 +311,13 @@ OoxPageBreakData::OoxPageBreakData() :
// ----------------------------------------------------------------------------
-OoxHyperlinkData::OoxHyperlinkData()
+HyperlinkModel::HyperlinkModel()
{
}
// ----------------------------------------------------------------------------
-OoxValidationData::OoxValidationData() :
+ValidationModel::ValidationModel() :
mnType( XML_none ),
mnOperator( XML_between ),
mnErrorStyle( XML_stop ),
@@ -309,14 +328,14 @@ OoxValidationData::OoxValidationData() :
{
}
-void OoxValidationData::setBinType( sal_uInt8 nType )
+void ValidationModel::setBinType( sal_uInt8 nType )
{
static const sal_Int32 spnTypeIds[] = {
XML_none, XML_whole, XML_decimal, XML_list, XML_date, XML_time, XML_textLength, XML_custom };
mnType = STATIC_ARRAY_SELECT( spnTypeIds, nType, XML_none );
}
-void OoxValidationData::setBinOperator( sal_uInt8 nOperator )
+void ValidationModel::setBinOperator( sal_uInt8 nOperator )
{
static const sal_Int32 spnOperators[] = {
XML_between, XML_notBetween, XML_equal, XML_notEqual,
@@ -324,7 +343,7 @@ void OoxValidationData::setBinOperator( sal_uInt8 nOperator )
mnOperator = STATIC_ARRAY_SELECT( spnOperators, nOperator, XML_TOKEN_INVALID );
}
-void OoxValidationData::setBinErrorStyle( sal_uInt8 nErrorStyle )
+void ValidationModel::setBinErrorStyle( sal_uInt8 nErrorStyle )
{
static const sal_Int32 spnErrorStyles[] = { XML_stop, XML_warning, XML_information };
mnErrorStyle = STATIC_ARRAY_SELECT( spnErrorStyles, nErrorStyle, XML_stop );
@@ -332,7 +351,7 @@ void OoxValidationData::setBinErrorStyle( sal_uInt8 nErrorStyle )
// ----------------------------------------------------------------------------
-OoxOleObjectData::OoxOleObjectData() :
+OleObjectModel::OleObjectModel() :
mnAspect( XML_DVASPECT_CONTENT ),
mnUpdateMode( XML_OLEUPDATE_ALWAYS ),
mnShapeId( 0 ),
@@ -342,7 +361,7 @@ OoxOleObjectData::OoxOleObjectData() :
// ----------------------------------------------------------------------------
-OoxFormControlData::OoxFormControlData() :
+FormControlModel::FormControlModel() :
mnShapeId( 0 )
{
}
@@ -371,7 +390,7 @@ public:
inline sal_Int16 getSheetIndex() const { return mnSheet; }
/** Returns the XSpreadsheet interface of the current sheet. */
inline const ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet >&
- getXSpreadsheet() const { return mxSheet; }
+ getSheet() const { return mxSheet; }
/** Returns the XCell interface for the passed cell address. */
Reference< XCell > getCell( const CellAddress& rAddress ) const;
@@ -403,6 +422,8 @@ public:
inline SharedFormulaBuffer& getSharedFormulas() { return maSharedFmlas; }
/** Returns the conditional formattings in this sheet. */
inline CondFormatBuffer& getCondFormats() { return maCondFormats; }
+ /** Returns the buffer for all cell comments in this sheet. */
+ inline CommentsBuffer& getComments() { return maComments; }
/** Returns the page/print settings for this sheet. */
inline PageSettings& getPageSettings() { return maPageSett; }
/** Returns the view settings for this sheet. */
@@ -413,23 +434,23 @@ public:
/** Sets the dimension (used area) of the sheet. */
void setDimension( const CellRangeAddress& rRange );
/** Stores the cell format at the passed address. */
- void setCellFormat( const OoxCellData& rCellData );
+ void setCellFormat( const CellModel& rModel );
/** Merges the cells in the passed cell range. */
void setMergedRange( const CellRangeAddress& rRange );
/** Sets a column or row page break described in the passed struct. */
- void setPageBreak( const OoxPageBreakData& rData, bool bRowBreak );
+ void setPageBreak( const PageBreakModel& rModel, bool bRowBreak );
/** Inserts the hyperlink URL into the spreadsheet. */
- void setHyperlink( const OoxHyperlinkData& rHyperlink );
+ void setHyperlink( const HyperlinkModel& rModel );
/** Inserts the data validation settings into the spreadsheet. */
- void setValidation( const OoxValidationData& rValData );
+ void setValidation( const ValidationModel& rModel );
/** Sets the path to the DrawingML fragment of this sheet. */
void setDrawingPath( const OUString& rDrawingPath );
/** Sets the path to the legacy VML drawing fragment of this sheet. */
void setVmlDrawingPath( const OUString& rVmlDrawingPath );
/** Sets additional data for an OLE object. */
- void setOleObject( const OoxOleObjectData& rOleObjectData );
+ void setOleObject( const OleObjectModel& rModel );
/** Sets additional data for an OCX form control. */
- void setFormControl( const OoxFormControlData& rFormControlData );
+ void setFormControl( const FormControlModel& rModel );
/** Sets base width for all columns (without padding pixels). This value
is only used, if base width has not been set with setDefaultColumnWidth(). */
@@ -440,19 +461,19 @@ public:
/** Sets column settings for a specific column range.
@descr Column default formatting is converted directly, other settings
are cached and converted in the finalizeImport() call. */
- void setColumnData( const OoxColumnData& rData );
+ void setColumnModel( const ColumnModel& rModel );
/** Sets default height and hidden state for all unused rows in the sheet. */
void setDefaultRowSettings( double fHeight, bool bCustomHeight, bool bHidden, bool bThickTop, bool bThickBottom );
/** Sets row settings for a specific row.
@descr Row default formatting is converted directly, other settings
are cached and converted in the finalizeImport() call. */
- void setRowData( const OoxRowData& rData );
+ void setRowModel( const RowModel& rModel );
/** Converts column default cell formatting. */
- void convertColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId );
+ void convertColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId ) const;
/** Converts row default cell formatting. */
- void convertRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId );
+ void convertRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ) const;
/** Initial conversion before importing the worksheet. */
void initializeWorksheetImport();
@@ -461,12 +482,24 @@ public:
private:
typedef ::std::vector< sal_Int32 > OutlineLevelVec;
- typedef ::std::map< sal_Int32, OoxColumnData > OoxColumnDataMap;
- typedef ::std::map< sal_Int32, OoxRowData > OoxRowDataMap;
- typedef ::std::list< OoxHyperlinkData > OoxHyperlinkList;
- typedef ::std::list< OoxValidationData > OoxValidationList;
- typedef ::std::map< sal_Int32, OoxOleObjectData > OoxOleObjectDataMap;
- typedef ::std::map< sal_Int32, OoxFormControlData > OoxFormControlDataMap;
+ typedef ::std::map< sal_Int32, ColumnModel > ColumnModelMap;
+ typedef ::std::map< sal_Int32, RowModel > RowModelMap;
+ typedef ::std::list< HyperlinkModel > HyperlinkModelList;
+ typedef ::std::list< ValidationModel > ValidationModelList;
+ typedef ::std::map< sal_Int32, OleObjectModel > OleObjectModelMap;
+ typedef ::std::map< sal_Int32, FormControlModel > FormControlModelMap;
+
+ struct XfIdRowRange
+ {
+ sal_Int32 mnFirstRow; /// Index of first row.
+ sal_Int32 mnLastRow; /// Index of last row.
+ sal_Int32 mnXfId; /// XF identifier for the row range.
+
+ explicit XfIdRowRange();
+ bool intersects( const CellRangeAddress& rRange ) const;
+ void set( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId );
+ bool tryExpand( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId );
+ };
struct XfIdRange
{
@@ -474,8 +507,8 @@ private:
sal_Int32 mnXfId; /// XF identifier for the range.
sal_Int32 mnNumFmtId; /// Number format id overriding the XF.
- void set( const OoxCellData& rCellData );
- bool tryExpand( const OoxCellData& rCellData );
+ void set( const CellModel& rModel );
+ bool tryExpand( const CellModel& rModel );
bool tryMerge( const XfIdRange& rXfIdRange );
};
@@ -484,7 +517,7 @@ private:
CellRangeAddress maRange; /// The formatted cell range.
sal_Int32 mnHorAlign; /// Horizontal alignment in the range.
- explicit MergedRange( const CellRangeAddress& rAddress );
+ explicit MergedRange( const CellRangeAddress& rRange );
explicit MergedRange( const CellAddress& rAddress, sal_Int32 nHorAlign );
bool tryExpand( const CellAddress& rAddress, sal_Int32 nHorAlign );
};
@@ -493,6 +526,8 @@ private:
typedef ::std::map< RowColKey, XfIdRange > XfIdRangeMap;
typedef ::std::list< MergedRange > MergedRangeList;
+ /** Writes all cell formatting attributes to the passed row range. */
+ void writeXfIdRowRangeProperties( const XfIdRowRange& rXfIdRowRange ) const;
/** Writes all cell formatting attributes to the passed cell range. */
void writeXfIdRangeProperties( const XfIdRange& rXfIdRange ) const;
/** Tries to merge the ranges last inserted in maXfIdRanges with existing ranges. */
@@ -519,12 +554,12 @@ private:
/** Converts column properties for all columns in the sheet. */
void convertColumns();
/** Converts column properties. */
- void convertColumns( OutlineLevelVec& orColLevels, sal_Int32 nFirstCol, sal_Int32 nLastCol, const OoxColumnData& rData );
+ void convertColumns( OutlineLevelVec& orColLevels, sal_Int32 nFirstCol, sal_Int32 nLastCol, const ColumnModel& rModel );
/** Converts row properties for all rows in the sheet. */
void convertRows();
/** Converts row properties. */
- void convertRows( OutlineLevelVec& orRowLevels, sal_Int32 nFirstRow, sal_Int32 nLastRow, const OoxRowData& rData, double fDefHeight = -1.0 );
+ void convertRows( OutlineLevelVec& orRowLevels, sal_Int32 nFirstRow, sal_Int32 nLastRow, const RowModel& rModel, double fDefHeight = -1.0 );
/** Converts outline grouping for the passed column or row. */
void convertOutlines( OutlineLevelVec& orLevels, sal_Int32 nColRow, sal_Int32 nLevel, bool bCollapsed, bool bRows );
@@ -535,29 +570,18 @@ private:
const OUString maTrueFormula; /// Replacement formula for TRUE boolean cells.
const OUString maFalseFormula; /// Replacement formula for FALSE boolean cells.
const OUString maSheetCellRanges; /// Service name for a SheetCellRanges object.
- const OUString maRightBorderProp; /// Property name of the right border of a cell.
- const OUString maBottomBorderProp; /// Property name of the bottom border of a cell.
- const OUString maWidthProp; /// Property name for column width.
- const OUString maHeightProp; /// Property name for row height.
- const OUString maPositionProp; /// Property name for cell position.
- const OUString maSizeProp; /// Property name for cell size.
- const OUString maVisibleProp; /// Property name for column/row visibility.
- const OUString maTextWrapProp; /// Property name for automatic text wrap in cells.
- const OUString maPageBreakProp; /// Property name of a page break.
const OUString maUrlTextField; /// Service name for a URL text field.
- const OUString maUrlProp; /// Property name for the URL string in a URL text field.
- const OUString maReprProp; /// Property name for the URL representation in a URL text field.
- const OUString maValidationProp; /// Property name for data validation settings.
const CellAddress& mrMaxApiPos; /// Reference to maximum Calc cell address from address converter.
CellRangeAddress maDimension; /// Dimension (used) area of the sheet.
- OoxColumnData maDefColData; /// Default column formatting.
- OoxColumnDataMap maColDatas; /// Column data sorted by first column index.
- OoxRowData maDefRowData; /// Default row formatting.
- OoxRowDataMap maRowDatas; /// Row data sorted by row index.
- OoxHyperlinkList maHyperlinks; /// Cell ranges containing hyperlinks.
- OoxValidationList maValidations; /// Cell ranges containing data validation settings.
- OoxOleObjectDataMap maOleObjects; /// OLE object data, mapped to VML shape identifier.
- OoxFormControlDataMap maFormControls; /// OCX form control data, mapped to VML shape identifier.
+ ColumnModel maDefColModel; /// Default column formatting.
+ ColumnModelMap maColModels; /// Columns sorted by first column index.
+ RowModel maDefRowModel; /// Default row formatting.
+ RowModelMap maRowModels; /// Rows sorted by row index.
+ HyperlinkModelList maHyperlinks; /// Cell ranges containing hyperlinks.
+ ValidationModelList maValidations; /// Cell ranges containing data validation settings.
+ OleObjectModelMap maOleObjects; /// OLE objects, mapped to VML shape identifier.
+ FormControlModelMap maFormControls; /// OCX form controls, mapped to VML shape identifier.
+ XfIdRowRange maXfIdRowRange; /// Cached XF identifier for a range of rows.
XfIdRangeMap maXfIdRanges; /// Collected XF identifiers for cell ranges.
MergedRangeList maMergedRanges; /// Merged cell ranges.
MergedRangeList maCenterFillRanges; /// Merged cell ranges from 'center across' or 'fill' alignment.
@@ -565,6 +589,7 @@ private:
WorksheetSettings maSheetSett; /// Global settings for this sheet.
SharedFormulaBuffer maSharedFmlas; /// Buffer for shared formulas in this sheet.
CondFormatBuffer maCondFormats; /// Buffer for conditional formattings.
+ CommentsBuffer maComments; /// Buffer for all cell comments in this sheet.
PageSettings maPageSett; /// Page/print settings for this sheet.
SheetViewSettings maSheetViewSett; /// View settings for this sheet.
OUString maDrawingPath; /// Path to DrawingML fragment.
@@ -585,23 +610,12 @@ WorksheetData::WorksheetData( const WorkbookHelper& rHelper, ISegmentProgressBar
maTrueFormula( CREATE_OUSTRING( "=TRUE()" ) ),
maFalseFormula( CREATE_OUSTRING( "=FALSE()" ) ),
maSheetCellRanges( CREATE_OUSTRING( "com.sun.star.sheet.SheetCellRanges" ) ),
- maRightBorderProp( CREATE_OUSTRING( "RightBorder" ) ),
- maBottomBorderProp( CREATE_OUSTRING( "BottomBorder" ) ),
- maWidthProp( CREATE_OUSTRING( "Width" ) ),
- maHeightProp( CREATE_OUSTRING( "Height" ) ),
- maPositionProp( CREATE_OUSTRING( "Position" ) ),
- maSizeProp( CREATE_OUSTRING( "Size" ) ),
- maVisibleProp( CREATE_OUSTRING( "IsVisible" ) ),
- maTextWrapProp( CREATE_OUSTRING( "IsTextWrapped" ) ),
- maPageBreakProp( CREATE_OUSTRING( "IsStartOfNewPage" ) ),
maUrlTextField( CREATE_OUSTRING( "com.sun.star.text.TextField.URL" ) ),
- maUrlProp( CREATE_OUSTRING( "URL" ) ),
- maReprProp( CREATE_OUSTRING( "Representation" ) ),
- maValidationProp( CREATE_OUSTRING( "Validation" ) ),
mrMaxApiPos( rHelper.getAddressConverter().getMaxApiAddress() ),
maSheetSett( *this ),
maSharedFmlas( *this ),
maCondFormats( *this ),
+ maComments( *this ),
maPageSett( *this ),
maSheetViewSett( *this ),
mxProgressBar( xProgressBar ),
@@ -610,28 +624,28 @@ WorksheetData::WorksheetData( const WorkbookHelper& rHelper, ISegmentProgressBar
mbHasDefWidth( false )
{
OSL_ENSURE( nSheet <= SAL_MAX_INT16, "WorksheetData::WorksheetData - invalid sheet index" );
- mxSheet = getSheet( nSheet );
+ mxSheet = getSheetFromDoc( nSheet );
if( !mxSheet.is() )
mnSheet = -1;
maDimension.Sheet = mnSheet;
// default column settings (width and hidden state may be updated later)
- maDefColData.mfWidth = 8.5;
- maDefColData.mnXfId = -1;
- maDefColData.mnLevel = 0;
- maDefColData.mbHidden = false;
- maDefColData.mbCollapsed = false;
+ maDefColModel.mfWidth = 8.5;
+ maDefColModel.mnXfId = -1;
+ maDefColModel.mnLevel = 0;
+ maDefColModel.mbHidden = false;
+ maDefColModel.mbCollapsed = false;
// default row settings (height and hidden state may be updated later)
- maDefRowData.mfHeight = 0.0;
- maDefRowData.mnXfId = -1;
- maDefRowData.mnLevel = 0;
- maDefRowData.mbCustomHeight = false;
- maDefRowData.mbCustomFormat = false;
- maDefRowData.mbShowPhonetic = false;
- maDefRowData.mbHidden = false;
- maDefRowData.mbCollapsed = false;
+ maDefRowModel.mfHeight = 0.0;
+ maDefRowModel.mnXfId = -1;
+ maDefRowModel.mnLevel = 0;
+ maDefRowModel.mbCustomHeight = false;
+ maDefRowModel.mbCustomFormat = false;
+ maDefRowModel.mbShowPhonetic = false;
+ maDefRowModel.mbHidden = false;
+ maDefRowModel.mbCollapsed = false;
if( mxProgressBar.get() )
{
@@ -693,9 +707,8 @@ Reference< XCellRange > WorksheetData::getColumn( sal_Int32 nCol ) const
try
{
Reference< XColumnRowRange > xColRowRange( mxSheet, UNO_QUERY_THROW );
- Reference< XTableColumns > xColumns = xColRowRange->getColumns();
- if( xColumns.is() )
- xColumn.set( xColumns->getByIndex( nCol ), UNO_QUERY );
+ Reference< XTableColumns > xColumns( xColRowRange->getColumns(), UNO_SET_THROW );
+ xColumn.set( xColumns->getByIndex( nCol ), UNO_QUERY );
}
catch( Exception& )
{
@@ -709,8 +722,8 @@ Reference< XCellRange > WorksheetData::getRow( sal_Int32 nRow ) const
try
{
Reference< XColumnRowRange > xColRowRange( mxSheet, UNO_QUERY_THROW );
- Reference< XTableRows > xRows = xColRowRange->getRows();
- xRow.set( xRows->getByIndex( nRow ), UNO_QUERY );
+ Reference< XTableRows > xRows( xColRowRange->getRows(), UNO_SET_THROW );
+ xRow.set( xRows->getByIndex( nRow ), UNO_QUERY );
}
catch( Exception& )
{
@@ -748,7 +761,7 @@ Point WorksheetData::getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const
{
Point aPoint;
PropertySet aCellProp( getCell( CellAddress( mnSheet, nCol, nRow ) ) );
- aCellProp.getProperty( aPoint, maPositionProp );
+ aCellProp.getProperty( aPoint, PROP_Position );
return aPoint;
}
@@ -756,7 +769,7 @@ Size WorksheetData::getCellSize( sal_Int32 nCol, sal_Int32 nRow ) const
{
Size aSize;
PropertySet aCellProp( getCell( CellAddress( mnSheet, nCol, nRow ) ) );
- aCellProp.getProperty( aSize, maSizeProp );
+ aCellProp.getProperty( aSize, PROP_Size );
return aSize;
}
@@ -764,7 +777,7 @@ Size WorksheetData::getDrawPageSize() const
{
Size aSize;
PropertySet aRangeProp( getCellRange( CellRangeAddress( mnSheet, 0, 0, mrMaxApiPos.Column, mrMaxApiPos.Row ) ) );
- aRangeProp.getProperty( aSize, maSizeProp );
+ aRangeProp.getProperty( aSize, PROP_Size );
return aSize;
}
@@ -773,9 +786,10 @@ void WorksheetData::setDimension( const CellRangeAddress& rRange )
maDimension = rRange;
}
-void WorksheetData::setCellFormat( const OoxCellData& rCellData )
+void WorksheetData::setCellFormat( const CellModel& rModel )
{
- if( rCellData.mxCell.is() && ((rCellData.mnXfId >= 0) || (rCellData.mnNumFmtId >= 0)) )
+ OOX_LOADSAVE_TIMER( SETCELLFORMAT );
+ if( rModel.mxCell.is() && ((rModel.mnXfId >= 0) || (rModel.mnNumFmtId >= 0)) )
{
// try to merge existing ranges and to write some formatting properties
if( !maXfIdRanges.empty() )
@@ -783,14 +797,15 @@ void WorksheetData::setCellFormat( const OoxCellData& rCellData )
// get row index of last inserted cell
sal_Int32 nLastRow = maXfIdRanges.rbegin()->second.maRange.StartRow;
// row changed - try to merge ranges of last row with existing ranges
- if( rCellData.maAddress.Row != nLastRow )
+ if( rModel.maAddress.Row != nLastRow )
{
mergeXfIdRanges();
// write format properties of all ranges above last row and remove them
XfIdRangeMap::iterator aIt = maXfIdRanges.begin(), aEnd = maXfIdRanges.end();
while( aIt != aEnd )
{
- if( aIt->second.maRange.EndRow < nLastRow )
+ // check that range cannot be merged with current row, and that range is not in cached row range
+ if( (aIt->second.maRange.EndRow < nLastRow) && !maXfIdRowRange.intersects( aIt->second.maRange ) )
{
writeXfIdRangeProperties( aIt->second );
maXfIdRanges.erase( aIt++ );
@@ -802,21 +817,21 @@ void WorksheetData::setCellFormat( const OoxCellData& rCellData )
}
// try to expand last existing range, or create new range entry
- if( maXfIdRanges.empty() || !maXfIdRanges.rbegin()->second.tryExpand( rCellData ) )
- maXfIdRanges[ RowColKey( rCellData.maAddress.Row, rCellData.maAddress.Column ) ].set( rCellData );
+ if( maXfIdRanges.empty() || !maXfIdRanges.rbegin()->second.tryExpand( rModel ) )
+ maXfIdRanges[ RowColKey( rModel.maAddress.Row, rModel.maAddress.Column ) ].set( rModel );
// update merged ranges for 'center across selection' and 'fill'
- if( const Xf* pXf = getStyles().getCellXf( rCellData.mnXfId ).get() )
+ if( const Xf* pXf = getStyles().getCellXf( rModel.mnXfId ).get() )
{
- sal_Int32 nHorAlign = pXf->getAlignment().getOoxData().mnHorAlign;
+ sal_Int32 nHorAlign = pXf->getAlignment().getModel().mnHorAlign;
if( (nHorAlign == XML_centerContinuous) || (nHorAlign == XML_fill) )
{
/* start new merged range, if cell is not empty (#108781#),
or try to expand last range with empty cell */
- if( rCellData.mnCellType != XML_TOKEN_INVALID )
- maCenterFillRanges.push_back( MergedRange( rCellData.maAddress, nHorAlign ) );
+ if( rModel.mnCellType != XML_TOKEN_INVALID )
+ maCenterFillRanges.push_back( MergedRange( rModel.maAddress, nHorAlign ) );
else if( !maCenterFillRanges.empty() )
- maCenterFillRanges.rbegin()->tryExpand( rCellData.maAddress, nHorAlign );
+ maCenterFillRanges.rbegin()->tryExpand( rModel.maAddress, nHorAlign );
}
}
}
@@ -827,23 +842,23 @@ void WorksheetData::setMergedRange( const CellRangeAddress& rRange )
maMergedRanges.push_back( MergedRange( rRange ) );
}
-void WorksheetData::setPageBreak( const OoxPageBreakData& rData, bool bRowBreak )
+void WorksheetData::setPageBreak( const PageBreakModel& rModel, bool bRowBreak )
{
- if( rData.mbManual && (rData.mnColRow > 0) )
+ if( rModel.mbManual && (rModel.mnColRow > 0) )
{
- PropertySet aPropSet( bRowBreak ? getRow( rData.mnColRow ) : getColumn( rData.mnColRow ) );
- aPropSet.setProperty( maPageBreakProp, true );
+ PropertySet aPropSet( bRowBreak ? getRow( rModel.mnColRow ) : getColumn( rModel.mnColRow ) );
+ aPropSet.setProperty( PROP_IsStartOfNewPage, true );
}
}
-void WorksheetData::setHyperlink( const OoxHyperlinkData& rHyperlink )
+void WorksheetData::setHyperlink( const HyperlinkModel& rModel )
{
- maHyperlinks.push_back( rHyperlink );
+ maHyperlinks.push_back( rModel );
}
-void WorksheetData::setValidation( const OoxValidationData& rValData )
+void WorksheetData::setValidation( const ValidationModel& rModel )
{
- maValidations.push_back( rValData );
+ maValidations.push_back( rModel );
}
void WorksheetData::setDrawingPath( const OUString& rDrawingPath )
@@ -856,16 +871,16 @@ void WorksheetData::setVmlDrawingPath( const OUString& rVmlDrawingPath )
maVmlDrawingPath = rVmlDrawingPath;
}
-void WorksheetData::setOleObject( const OoxOleObjectData& rOleObjectData )
+void WorksheetData::setOleObject( const OleObjectModel& rModel )
{
- if( rOleObjectData.mnShapeId > 0 )
- maOleObjects[ rOleObjectData.mnShapeId ] = rOleObjectData;
+ if( rModel.mnShapeId > 0 )
+ maOleObjects[ rModel.mnShapeId ] = rModel;
}
-void WorksheetData::setFormControl( const OoxFormControlData& rFormControlData )
+void WorksheetData::setFormControl( const FormControlModel& rModel )
{
- if( rFormControlData.mnShapeId > 0 )
- maFormControls[ rFormControlData.mnShapeId ] = rFormControlData;
+ if( rModel.mnShapeId > 0 )
+ maFormControls[ rModel.mnShapeId ] = rModel;
}
void WorksheetData::setBaseColumnWidth( sal_Int32 nWidth )
@@ -876,7 +891,7 @@ void WorksheetData::setBaseColumnWidth( sal_Int32 nWidth )
/* #i3006# add 5 pixels padding to the width, assuming 1 pixel =
1/96 inch. => 5/96 inch == 1.32 mm. */
const UnitConverter& rUnitConv = getUnitConverter();
- maDefColData.mfWidth = rUnitConv.scaleFromMm100( rUnitConv.scaleToMm100( nWidth, UNIT_DIGIT ) + 132, UNIT_DIGIT );
+ maDefColModel.mfWidth = rUnitConv.scaleFromMm100( rUnitConv.scaleToMm100( nWidth, UNIT_DIGIT ) + 132, UNIT_DIGIT );
}
}
@@ -885,66 +900,82 @@ void WorksheetData::setDefaultColumnWidth( double fWidth )
// overrides a width set with setBaseColumnWidth()
if( fWidth > 0.0 )
{
- maDefColData.mfWidth = fWidth;
+ maDefColModel.mfWidth = fWidth;
mbHasDefWidth = true;
}
}
-void WorksheetData::setColumnData( const OoxColumnData& rData )
+void WorksheetData::setColumnModel( const ColumnModel& rModel )
{
// convert 1-based OOX column indexes to 0-based API column indexes
- sal_Int32 nFirstCol = rData.mnFirstCol - 1;
- sal_Int32 nLastCol = rData.mnLastCol - 1;
+ sal_Int32 nFirstCol = rModel.mnFirstCol - 1;
+ sal_Int32 nLastCol = rModel.mnLastCol - 1;
if( (0 <= nFirstCol) && (nFirstCol <= mrMaxApiPos.Column) )
{
// set column formatting directly, nLastCol is checked inside the function
- convertColumnFormat( nFirstCol, nLastCol, rData.mnXfId );
+ convertColumnFormat( nFirstCol, nLastCol, rModel.mnXfId );
// expand last entry or add new entry
- if( maColDatas.empty() || !maColDatas.rbegin()->second.tryExpand( rData ) )
- maColDatas[ nFirstCol ] = rData;
+ if( maColModels.empty() || !maColModels.rbegin()->second.tryExpand( rModel ) )
+ maColModels[ nFirstCol ] = rModel;
}
}
void WorksheetData::setDefaultRowSettings( double fHeight, bool bCustomHeight, bool bHidden, bool bThickTop, bool bThickBottom )
{
- maDefRowData.mfHeight = fHeight;
- maDefRowData.mbCustomHeight = bCustomHeight;
- maDefRowData.mbHidden = bHidden;
- maDefRowData.mbThickTop = bThickTop;
- maDefRowData.mbThickBottom = bThickBottom;
+ maDefRowModel.mfHeight = fHeight;
+ maDefRowModel.mbCustomHeight = bCustomHeight;
+ maDefRowModel.mbHidden = bHidden;
+ maDefRowModel.mbThickTop = bThickTop;
+ maDefRowModel.mbThickBottom = bThickBottom;
}
-void WorksheetData::setRowData( const OoxRowData& rData )
+void WorksheetData::setRowModel( const RowModel& rModel )
{
// convert 1-based OOX row indexes to 0-based API row indexes
- sal_Int32 nFirstRow = rData.mnFirstRow - 1;
- sal_Int32 nLastRow = rData.mnLastRow - 1;
+ sal_Int32 nFirstRow = rModel.mnFirstRow - 1;
+ sal_Int32 nLastRow = rModel.mnLastRow - 1;
if( (0 <= nFirstRow) && (nFirstRow <= mrMaxApiPos.Row) )
{
- // set row formatting directly
- if( rData.mbCustomFormat )
- convertRowFormat( nFirstRow, nLastRow, rData.mnXfId );
+ // set row formatting
+ if( rModel.mbCustomFormat )
+ {
+ // try to expand cached row range, if formatting is equal
+ if( (maXfIdRowRange.mnLastRow < 0) || !maXfIdRowRange.tryExpand( nFirstRow, nLastRow, rModel.mnXfId ) )
+ {
+ writeXfIdRowRangeProperties( maXfIdRowRange );
+ maXfIdRowRange.set( nFirstRow, nLastRow, rModel.mnXfId );
+ }
+ }
+ else if( maXfIdRowRange.mnLastRow >= 0 )
+ {
+ // finish last cached row range
+ writeXfIdRowRangeProperties( maXfIdRowRange );
+ maXfIdRowRange.set( -1, -1, -1 );
+ }
+
// expand last entry or add new entry
- if( maRowDatas.empty() || !maRowDatas.rbegin()->second.tryExpand( rData ) )
- maRowDatas[ nFirstRow ] = rData;
+ if( maRowModels.empty() || !maRowModels.rbegin()->second.tryExpand( rModel ) )
+ maRowModels[ nFirstRow ] = rModel;
}
lclUpdateProgressBar( mxRowProgress, maDimension, nLastRow );
}
-void WorksheetData::convertColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId )
+void WorksheetData::convertColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId ) const
{
+ OOX_LOADSAVE_TIMER( CONVERTCOLUMNFORMAT );
CellRangeAddress aRange( mnSheet, nFirstCol, 0, nLastCol, mrMaxApiPos.Row );
- if( getAddressConverter().validateCellRange( aRange, false ) )
+ if( getAddressConverter().validateCellRange( aRange, true, false ) )
{
PropertySet aPropSet( getCellRange( aRange ) );
getStyles().writeCellXfToPropertySet( aPropSet, nXfId );
}
}
-void WorksheetData::convertRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId )
+void WorksheetData::convertRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId ) const
{
+ OOX_LOADSAVE_TIMER( CONVERTROWFORMAT );
CellRangeAddress aRange( mnSheet, 0, nFirstRow, mrMaxApiPos.Column, nLastRow );
- if( getAddressConverter().validateCellRange( aRange, false ) )
+ if( getAddressConverter().validateCellRange( aRange, true, false ) )
{
PropertySet aPropSet( getCellRange( aRange ) );
getStyles().writeCellXfToPropertySet( aPropSet, nXfId );
@@ -957,7 +988,7 @@ void WorksheetData::initializeWorksheetImport()
#else
// set default cell style for unused cells
PropertySet aPropSet( mxSheet );
- aPropSet.setProperty( CREATE_OUSTRING( "CellStyle" ), getStyles().getDefaultStyleName() );
+ aPropSet.setProperty( PROP_CellStyle, getStyles().getDefaultStyleName() );
#endif
/* remember current sheet index in global data, needed by some global
@@ -967,20 +998,23 @@ void WorksheetData::initializeWorksheetImport()
void WorksheetData::finalizeWorksheetImport()
{
- if( mxRowProgress.get() )
- mxRowProgress->setPosition( 1.0 );
+ OOX_LOADSAVE_TIMER( FINALIZESHEETDATA );
+ lclUpdateProgressBar( mxRowProgress, 1.0 );
finalizeXfIdRanges();
+ lclUpdateProgressBar( mxFinalProgress, 0.25 );
finalizeHyperlinkRanges();
finalizeValidationRanges();
finalizeMergedRanges();
maCondFormats.finalizeImport();
maPageSett.finalizeImport();
maSheetViewSett.finalizeImport();
+ lclUpdateProgressBar( mxFinalProgress, 0.5 );
convertColumns();
convertRows();
+ lclUpdateProgressBar( mxFinalProgress, 0.75 );
+ maComments.finalizeImport();
finalizeDrawing();
- if( mxFinalProgress.get() )
- mxFinalProgress->setPosition( 1.0 );
+ lclUpdateProgressBar( mxFinalProgress, 1.0 );
// reset current sheet index in global data
setCurrentSheetIndex( -1 );
@@ -988,21 +1022,58 @@ void WorksheetData::finalizeWorksheetImport()
// private --------------------------------------------------------------------
-void WorksheetData::XfIdRange::set( const OoxCellData& rCellData )
+WorksheetData::XfIdRowRange::XfIdRowRange() :
+ mnFirstRow( -1 ),
+ mnLastRow( -1 ),
+ mnXfId( -1 )
+{
+}
+
+bool WorksheetData::XfIdRowRange::intersects( const CellRangeAddress& rRange ) const
+{
+ return (rRange.StartRow <= mnLastRow) && (mnFirstRow <= rRange.EndRow);
+}
+
+void WorksheetData::XfIdRowRange::set( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId )
+{
+ mnFirstRow = nFirstRow;
+ mnLastRow = nLastRow;
+ mnXfId = nXfId;
+}
+
+bool WorksheetData::XfIdRowRange::tryExpand( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId )
+{
+ if( mnXfId == nXfId )
+ {
+ if( mnLastRow + 1 == nFirstRow )
+ {
+ mnLastRow = nLastRow;
+ return true;
+ }
+ if( mnFirstRow == nLastRow + 1 )
+ {
+ mnFirstRow = nFirstRow;
+ return true;
+ }
+ }
+ return false;
+}
+
+void WorksheetData::XfIdRange::set( const CellModel& rModel )
{
- maRange.Sheet = rCellData.maAddress.Sheet;
- maRange.StartColumn = maRange.EndColumn = rCellData.maAddress.Column;
- maRange.StartRow = maRange.EndRow = rCellData.maAddress.Row;
- mnXfId = rCellData.mnXfId;
- mnNumFmtId = rCellData.mnNumFmtId;
+ maRange.Sheet = rModel.maAddress.Sheet;
+ maRange.StartColumn = maRange.EndColumn = rModel.maAddress.Column;
+ maRange.StartRow = maRange.EndRow = rModel.maAddress.Row;
+ mnXfId = rModel.mnXfId;
+ mnNumFmtId = rModel.mnNumFmtId;
}
-bool WorksheetData::XfIdRange::tryExpand( const OoxCellData& rCellData )
+bool WorksheetData::XfIdRange::tryExpand( const CellModel& rModel )
{
- if( (mnXfId == rCellData.mnXfId) && (mnNumFmtId == rCellData.mnNumFmtId) &&
- (maRange.StartRow == rCellData.maAddress.Row) &&
- (maRange.EndRow == rCellData.maAddress.Row) &&
- (maRange.EndColumn + 1 == rCellData.maAddress.Column) )
+ if( (mnXfId == rModel.mnXfId) && (mnNumFmtId == rModel.mnNumFmtId) &&
+ (maRange.StartRow == rModel.maAddress.Row) &&
+ (maRange.EndRow == rModel.maAddress.Row) &&
+ (maRange.EndColumn + 1 == rModel.maAddress.Column) )
{
++maRange.EndColumn;
return true;
@@ -1048,20 +1119,30 @@ bool WorksheetData::MergedRange::tryExpand( const CellAddress& rAddress, sal_Int
return false;
}
+void WorksheetData::writeXfIdRowRangeProperties( const XfIdRowRange& rXfIdRowRange ) const
+{
+ if( (rXfIdRowRange.mnLastRow >= 0) && (rXfIdRowRange.mnXfId >= 0) )
+ convertRowFormat( rXfIdRowRange.mnFirstRow, rXfIdRowRange.mnLastRow, rXfIdRowRange.mnXfId );
+}
+
void WorksheetData::writeXfIdRangeProperties( const XfIdRange& rXfIdRange ) const
{
+ OOX_LOADSAVE_TIMER( WRITECELLPROPERTIES );
StylesBuffer& rStyles = getStyles();
- PropertySet aPropSet( getCellRange( rXfIdRange.maRange ) );
+ PropertyMap aPropMap;
if( rXfIdRange.mnXfId >= 0 )
- rStyles.writeCellXfToPropertySet( aPropSet, rXfIdRange.mnXfId );
+ rStyles.writeCellXfToPropertyMap( aPropMap, rXfIdRange.mnXfId );
if( rXfIdRange.mnNumFmtId >= 0 )
- rStyles.writeNumFmtToPropertySet( aPropSet, rXfIdRange.mnNumFmtId );
+ rStyles.writeNumFmtToPropertyMap( aPropMap, rXfIdRange.mnNumFmtId );
+ PropertySet aPropSet( getCellRange( rXfIdRange.maRange ) );
+ aPropSet.setProperties( aPropMap );
}
void WorksheetData::mergeXfIdRanges()
{
if( !maXfIdRanges.empty() )
{
+ OOX_LOADSAVE_TIMER( MERGECELLFORMAT );
// get row index of last range
sal_Int32 nLastRow = maXfIdRanges.rbegin()->second.maRange.StartRow;
// process all ranges located in the same row of the last range
@@ -1080,21 +1161,18 @@ void WorksheetData::mergeXfIdRanges()
void WorksheetData::finalizeXfIdRanges()
{
+ // write default formatting of remaining row range
+ writeXfIdRowRangeProperties( maXfIdRowRange );
// try to merge remaining inserted ranges
mergeXfIdRanges();
// write all formatting
- sal_Int32 nLastRow = -1;
for( XfIdRangeMap::const_iterator aIt = maXfIdRanges.begin(), aEnd = maXfIdRanges.end(); aIt != aEnd; ++aIt )
- {
writeXfIdRangeProperties( aIt->second );
- if( aIt->first.first > nLastRow )
- lclUpdateProgressBar( mxFinalProgress, maDimension, nLastRow = aIt->first.first );
- }
}
void WorksheetData::finalizeHyperlinkRanges() const
{
- for( OoxHyperlinkList::const_iterator aIt = maHyperlinks.begin(), aEnd = maHyperlinks.end(); aIt != aEnd; ++aIt )
+ for( HyperlinkModelList::const_iterator aIt = maHyperlinks.begin(), aEnd = maHyperlinks.end(); aIt != aEnd; ++aIt )
{
OUStringBuffer aUrlBuffer;
if( aIt->maTarget.getLength() > 0 )
@@ -1117,9 +1195,9 @@ void WorksheetData::finalizeHyperlinkRanges() const
sal_Int32 nNamePos = bQuotedName ? 2 : 1;
sal_Int32 nNameLen = nSepPos - (bQuotedName ? 3 : 1);
OUString aSheetName = aUrl.copy( nNamePos, nNameLen );
- OUString aFinalName = getWorksheets().getFinalSheetName( aSheetName );
- if( aFinalName.getLength() > 0 )
- aUrl = aUrl.replaceAt( nNamePos, nNameLen, aFinalName );
+ OUString aCalcName = getWorksheets().getCalcSheetName( aSheetName );
+ if( aCalcName.getLength() > 0 )
+ aUrl = aUrl.replaceAt( nNamePos, nNameLen, aCalcName );
}
}
@@ -1150,8 +1228,8 @@ void WorksheetData::finalizeHyperlink( const CellAddress& rAddress, const OUStri
{
// properties of the URL field
PropertySet aPropSet( xUrlField );
- aPropSet.setProperty( maUrlProp, rUrl );
- aPropSet.setProperty( maReprProp, xText->getString() );
+ aPropSet.setProperty( PROP_URL, rUrl );
+ aPropSet.setProperty( PROP_Representation, xText->getString() );
try
{
// insert the field into the cell
@@ -1190,12 +1268,12 @@ void WorksheetData::finalizeHyperlink( const CellAddress& rAddress, const OUStri
void WorksheetData::finalizeValidationRanges() const
{
- for( OoxValidationList::const_iterator aIt = maValidations.begin(), aEnd = maValidations.end(); aIt != aEnd; ++aIt )
+ for( ValidationModelList::const_iterator aIt = maValidations.begin(), aEnd = maValidations.end(); aIt != aEnd; ++aIt )
{
PropertySet aPropSet( getCellRangeList( aIt->maRanges ) );
Reference< XPropertySet > xValidation;
- if( aPropSet.getProperty( xValidation, maValidationProp ) && xValidation.is() )
+ if( aPropSet.getProperty( xValidation, PROP_Validation ) && xValidation.is() )
{
PropertySet aValProps( xValidation );
namespace csss = ::com::sun::star::sheet;
@@ -1214,7 +1292,7 @@ void WorksheetData::finalizeValidationRanges() const
case XML_whole: eType = csss::ValidationType_WHOLE; break;
default: OSL_ENSURE( false, "WorksheetData::finalizeValidationRanges - unknown validation type" );
}
- aValProps.setProperty( CREATE_OUSTRING( "Type" ), eType );
+ aValProps.setProperty( PROP_Type, eType );
// convert error alert style to API enum
ValidationAlertStyle eAlertStyle = csss::ValidationAlertStyle_STOP;
@@ -1225,22 +1303,22 @@ void WorksheetData::finalizeValidationRanges() const
case XML_warning: eAlertStyle = csss::ValidationAlertStyle_WARNING; break;
default: OSL_ENSURE( false, "WorksheetData::finalizeValidationRanges - unknown error style" );
}
- aValProps.setProperty( CREATE_OUSTRING( "ErrorAlertStyle" ), eAlertStyle );
+ aValProps.setProperty( PROP_ErrorAlertStyle, eAlertStyle );
// convert dropdown style to API visibility constants
sal_Int16 nVisibility = aIt->mbNoDropDown ? csss::TableValidationVisibility::INVISIBLE : csss::TableValidationVisibility::UNSORTED;
- aValProps.setProperty( CREATE_OUSTRING( "ShowList" ), nVisibility );
+ aValProps.setProperty( PROP_ShowList, nVisibility );
// messages
- aValProps.setProperty( CREATE_OUSTRING( "ShowInputMessage" ), aIt->mbShowInputMsg );
- aValProps.setProperty( CREATE_OUSTRING( "InputTitle" ), aIt->maInputTitle );
- aValProps.setProperty( CREATE_OUSTRING( "InputMessage" ), aIt->maInputMessage );
- aValProps.setProperty( CREATE_OUSTRING( "ShowErrorMessage" ), aIt->mbShowErrorMsg );
- aValProps.setProperty( CREATE_OUSTRING( "ErrorTitle" ), aIt->maErrorTitle );
- aValProps.setProperty( CREATE_OUSTRING( "ErrorMessage" ), aIt->maErrorMessage );
+ aValProps.setProperty( PROP_ShowInputMessage, aIt->mbShowInputMsg );
+ aValProps.setProperty( PROP_InputTitle, aIt->maInputTitle );
+ aValProps.setProperty( PROP_InputMessage, aIt->maInputMessage );
+ aValProps.setProperty( PROP_ShowErrorMessage, aIt->mbShowErrorMsg );
+ aValProps.setProperty( PROP_ErrorTitle, aIt->maErrorTitle );
+ aValProps.setProperty( PROP_ErrorMessage, aIt->maErrorMessage );
// allow blank cells
- aValProps.setProperty( CREATE_OUSTRING( "IgnoreBlankCells" ), aIt->mbAllowBlank );
+ aValProps.setProperty( PROP_IgnoreBlankCells, aIt->mbAllowBlank );
try
{
@@ -1258,7 +1336,7 @@ void WorksheetData::finalizeValidationRanges() const
}
// write back validation settings to cell range(s)
- aPropSet.setProperty( maValidationProp, xValidation );
+ aPropSet.setProperty( PROP_Validation, xValidation );
}
}
}
@@ -1284,41 +1362,38 @@ void WorksheetData::finalizeMergedRange( const CellRangeAddress& rRange )
xMerge->merge( sal_True );
// if merging this range worked (no overlapping merged ranges), update cell borders
- Reference< XCell > xTopLeft = getCell( CellAddress( mnSheet, rRange.StartColumn, rRange.StartRow ) );
- if( xTopLeft.is() )
- {
- PropertySet aTopLeftProp( xTopLeft );
+ Reference< XCell > xTopLeft( getCell( CellAddress( mnSheet, rRange.StartColumn, rRange.StartRow ) ), UNO_SET_THROW );
+ PropertySet aTopLeftProp( xTopLeft );
- // copy right border of top-right cell to right border of top-left cell
- if( bMultiCol )
- {
- PropertySet aTopRightProp( getCell( CellAddress( mnSheet, rRange.EndColumn, rRange.StartRow ) ) );
- BorderLine aLine;
- if( aTopRightProp.getProperty( aLine, maRightBorderProp ) )
- aTopLeftProp.setProperty( maRightBorderProp, aLine );
- }
+ // copy right border of top-right cell to right border of top-left cell
+ if( bMultiCol )
+ {
+ PropertySet aTopRightProp( getCell( CellAddress( mnSheet, rRange.EndColumn, rRange.StartRow ) ) );
+ BorderLine aLine;
+ if( aTopRightProp.getProperty( aLine, PROP_RightBorder ) )
+ aTopLeftProp.setProperty( PROP_RightBorder, aLine );
+ }
- // copy bottom border of bottom-left cell to bottom border of top-left cell
- if( bMultiRow )
- {
- PropertySet aBottomLeftProp( getCell( CellAddress( mnSheet, rRange.StartColumn, rRange.EndRow ) ) );
- BorderLine aLine;
- if( aBottomLeftProp.getProperty( aLine, maBottomBorderProp ) )
- aTopLeftProp.setProperty( maBottomBorderProp, aLine );
- }
+ // copy bottom border of bottom-left cell to bottom border of top-left cell
+ if( bMultiRow )
+ {
+ PropertySet aBottomLeftProp( getCell( CellAddress( mnSheet, rRange.StartColumn, rRange.EndRow ) ) );
+ BorderLine aLine;
+ if( aBottomLeftProp.getProperty( aLine, PROP_BottomBorder ) )
+ aTopLeftProp.setProperty( PROP_BottomBorder, aLine );
+ }
- // #i93609# merged range in a single row: test if manual row height is needed
- if( !bMultiRow )
+ // #i93609# merged range in a single row: test if manual row height is needed
+ if( !bMultiRow )
+ {
+ bool bTextWrap = aTopLeftProp.getBoolProperty( PROP_IsTextWrapped );
+ if( !bTextWrap && (xTopLeft->getType() == ::com::sun::star::table::CellContentType_TEXT) )
{
- bool bTextWrap = aTopLeftProp.getBoolProperty( maTextWrapProp );
- if( !bTextWrap && (xTopLeft->getType() == ::com::sun::star::table::CellContentType_TEXT) )
- {
- Reference< XText > xText( xTopLeft, UNO_QUERY );
- bTextWrap = xText.is() && (xText->getString().indexOf( '\x0A' ) >= 0);
- }
- if( bTextWrap )
- maManualRowHeights.insert( rRange.StartRow );
+ Reference< XText > xText( xTopLeft, UNO_QUERY );
+ bTextWrap = xText.is() && (xText->getString().indexOf( '\x0A' ) >= 0);
}
+ if( bTextWrap )
+ maManualRowHeights.insert( rRange.StartRow );
}
}
catch( Exception& )
@@ -1331,7 +1406,10 @@ void WorksheetData::finalizeDrawing()
OSL_ENSURE( (getFilterType() == FILTER_OOX) || (maDrawingPath.getLength() == 0),
"WorksheetData::finalizeDrawing - unexpected DrawingML path" );
if( (getFilterType() == FILTER_OOX) && (maDrawingPath.getLength() > 0) )
+ {
+ OOX_LOADSAVE_TIMER( FINALIZEDRAWING );
importOoxFragment( new OoxDrawingFragment( *this, maDrawingPath ) );
+ }
}
void WorksheetData::convertColumns()
@@ -1341,16 +1419,16 @@ void WorksheetData::convertColumns()
// stores first grouped column index for each level
OutlineLevelVec aColLevels;
- for( OoxColumnDataMap::const_iterator aIt = maColDatas.begin(), aEnd = maColDatas.end(); aIt != aEnd; ++aIt )
+ for( ColumnModelMap::const_iterator aIt = maColModels.begin(), aEnd = maColModels.end(); aIt != aEnd; ++aIt )
{
// convert 1-based OOX column indexes to 0-based API column indexes
sal_Int32 nFirstCol = ::std::max( aIt->second.mnFirstCol - 1, nNextCol );
sal_Int32 nLastCol = ::std::min( aIt->second.mnLastCol - 1, nMaxCol );
- // process gap between two column datas, use default column data
+ // process gap between two column models, use default column model
if( nNextCol < nFirstCol )
- convertColumns( aColLevels, nNextCol, nFirstCol - 1, maDefColData );
- // process the column data
+ convertColumns( aColLevels, nNextCol, nFirstCol - 1, maDefColModel );
+ // process the column model
convertColumns( aColLevels, nFirstCol, nLastCol, aIt->second );
// cache next column to be processed
@@ -1358,30 +1436,30 @@ void WorksheetData::convertColumns()
}
// remaining default columns to end of sheet
- convertColumns( aColLevels, nNextCol, nMaxCol, maDefColData );
+ convertColumns( aColLevels, nNextCol, nMaxCol, maDefColModel );
// close remaining column outlines spanning to end of sheet
convertOutlines( aColLevels, nMaxCol + 1, 0, false, false );
}
void WorksheetData::convertColumns( OutlineLevelVec& orColLevels,
- sal_Int32 nFirstCol, sal_Int32 nLastCol, const OoxColumnData& rData )
+ sal_Int32 nFirstCol, sal_Int32 nLastCol, const ColumnModel& rModel )
{
PropertySet aPropSet( getColumns( nFirstCol, nLastCol ) );
// column width: convert 'number of characters' to column width in 1/100 mm
- sal_Int32 nWidth = getUnitConverter().scaleToMm100( rData.mfWidth, UNIT_DIGIT );
+ sal_Int32 nWidth = getUnitConverter().scaleToMm100( rModel.mfWidth, UNIT_DIGIT );
// macro sheets have double width
if( meSheetType == SHEETTYPE_MACROSHEET )
nWidth *= 2;
if( nWidth > 0 )
- aPropSet.setProperty( maWidthProp, nWidth );
+ aPropSet.setProperty( PROP_Width, nWidth );
// hidden columns: TODO: #108683# hide columns later?
- if( rData.mbHidden )
- aPropSet.setProperty( maVisibleProp, false );
+ if( rModel.mbHidden )
+ aPropSet.setProperty( PROP_IsVisible, false );
// outline settings for this column range
- convertOutlines( orColLevels, nFirstCol, rData.mnLevel, rData.mbCollapsed, false );
+ convertOutlines( orColLevels, nFirstCol, rModel.mnLevel, rModel.mbCollapsed, false );
}
void WorksheetData::convertRows()
@@ -1391,57 +1469,57 @@ void WorksheetData::convertRows()
// stores first grouped row index for each level
OutlineLevelVec aRowLevels;
- for( OoxRowDataMap::const_iterator aIt = maRowDatas.begin(), aEnd = maRowDatas.end(); aIt != aEnd; ++aIt )
+ for( RowModelMap::const_iterator aIt = maRowModels.begin(), aEnd = maRowModels.end(); aIt != aEnd; ++aIt )
{
// convert 1-based OOX row indexes to 0-based API row indexes
sal_Int32 nFirstRow = ::std::max( aIt->second.mnFirstRow - 1, nNextRow );
sal_Int32 nLastRow = ::std::min( aIt->second.mnLastRow - 1, nMaxRow );
- // process gap between two row datas, use default row data
+ // process gap between two row models, use default row model
if( nNextRow < nFirstRow )
- convertRows( aRowLevels, nNextRow, nFirstRow - 1, maDefRowData );
- // process the row data
- convertRows( aRowLevels, nFirstRow, nLastRow, aIt->second, maDefRowData.mfHeight );
+ convertRows( aRowLevels, nNextRow, nFirstRow - 1, maDefRowModel );
+ // process the row model
+ convertRows( aRowLevels, nFirstRow, nLastRow, aIt->second, maDefRowModel.mfHeight );
// cache next row to be processed
nNextRow = nLastRow + 1;
}
// remaining default rows to end of sheet
- convertRows( aRowLevels, nNextRow, nMaxRow, maDefRowData );
+ convertRows( aRowLevels, nNextRow, nMaxRow, maDefRowModel );
// close remaining row outlines spanning to end of sheet
convertOutlines( aRowLevels, nMaxRow + 1, 0, false, true );
}
void WorksheetData::convertRows( OutlineLevelVec& orRowLevels,
- sal_Int32 nFirstRow, sal_Int32 nLastRow, const OoxRowData& rData, double fDefHeight )
+ sal_Int32 nFirstRow, sal_Int32 nLastRow, const RowModel& rModel, double fDefHeight )
{
// row height: convert points to row height in 1/100 mm
- double fHeight = (rData.mfHeight >= 0.0) ? rData.mfHeight : fDefHeight;
+ double fHeight = (rModel.mfHeight >= 0.0) ? rModel.mfHeight : fDefHeight;
sal_Int32 nHeight = getUnitConverter().scaleToMm100( fHeight, UNIT_POINT );
if( nHeight > 0 )
{
ValueRangeVector aManualRows;
- if( rData.mbCustomHeight )
+ if( rModel.mbCustomHeight )
aManualRows.push_back( ValueRange( nFirstRow, nLastRow ) );
else
maManualRowHeights.intersect( aManualRows, nFirstRow, nLastRow );
for( ValueRangeVector::const_iterator aIt = aManualRows.begin(), aEnd = aManualRows.end(); aIt != aEnd; ++aIt )
{
PropertySet aPropSet( getRows( aIt->mnFirst, aIt->mnLast ) );
- aPropSet.setProperty( maHeightProp, nHeight );
+ aPropSet.setProperty( PROP_Height, nHeight );
}
}
// hidden rows: TODO: #108683# hide rows later?
- if( rData.mbHidden )
+ if( rModel.mbHidden )
{
PropertySet aPropSet( getRows( nFirstRow, nLastRow ) );
- aPropSet.setProperty( maVisibleProp, false );
+ aPropSet.setProperty( PROP_IsVisible, false );
}
// outline settings for this row range
- convertOutlines( orRowLevels, nFirstRow, rData.mnLevel, rData.mbCollapsed, true );
+ convertOutlines( orRowLevels, nFirstRow, rModel.mnLevel, rModel.mbCollapsed, true );
}
void WorksheetData::convertOutlines( OutlineLevelVec& orLevels,
@@ -1517,9 +1595,9 @@ sal_Int16 WorksheetHelper::getSheetIndex() const
return mrSheetData.getSheetIndex();
}
-const Reference< XSpreadsheet >& WorksheetHelper::getXSpreadsheet() const
+const Reference< XSpreadsheet >& WorksheetHelper::getSheet() const
{
- return mrSheetData.getXSpreadsheet();
+ return mrSheetData.getSheet();
}
Reference< XCell > WorksheetHelper::getCell( const CellAddress& rAddress ) const
@@ -1557,7 +1635,7 @@ Reference< XCellRange > WorksheetHelper::getCellRange( const CellRangeAddress& r
Reference< XCellRange > WorksheetHelper::getCellRange( const OUString& rRangeStr, CellRangeAddress* opRange ) const
{
CellRangeAddress aRange;
- if( getAddressConverter().convertToCellRange( aRange, rRangeStr, mrSheetData.getSheetIndex(), true ) )
+ if( getAddressConverter().convertToCellRange( aRange, rRangeStr, mrSheetData.getSheetIndex(), true, true ) )
{
if( opRange ) *opRange = aRange;
return mrSheetData.getCellRange( aRange );
@@ -1568,7 +1646,7 @@ Reference< XCellRange > WorksheetHelper::getCellRange( const OUString& rRangeStr
Reference< XCellRange > WorksheetHelper::getCellRange( const BinRange& rBinRange, CellRangeAddress* opRange ) const
{
CellRangeAddress aRange;
- if( getAddressConverter().convertToCellRange( aRange, rBinRange, mrSheetData.getSheetIndex(), true ) )
+ if( getAddressConverter().convertToCellRange( aRange, rBinRange, mrSheetData.getSheetIndex(), true, true ) )
{
if( opRange ) *opRange = aRange;
return mrSheetData.getCellRange( aRange );
@@ -1669,6 +1747,11 @@ CondFormatBuffer& WorksheetHelper::getCondFormats() const
return mrSheetData.getCondFormats();
}
+CommentsBuffer& WorksheetHelper::getComments() const
+{
+ return mrSheetData.getComments();
+}
+
PageSettings& WorksheetHelper::getPageSettings() const
{
return mrSheetData.getPageSettings();
@@ -1693,6 +1776,18 @@ void WorksheetHelper::setSharedStringCell( const Reference< XCell >& rxCell, sal
getSharedStrings().convertString( Reference< XText >( rxCell, UNO_QUERY ), nStringId, nXfId );
}
+void WorksheetHelper::setDateTimeCell( const Reference< XCell >& rxCell, const DateTime& rDateTime ) const
+{
+ OSL_ENSURE( rxCell.is(), "WorksheetHelper::setDateTimeCell - missing cell interface" );
+ // write serial date/time value into the cell
+ double fSerial = getUnitConverter().calcSerialFromDateTime( rDateTime );
+ rxCell->setValue( fSerial );
+ // set appropriate number format
+ using namespace ::com::sun::star::util::NumberFormat;
+ sal_Int16 nStdFmt = (fSerial < 1.0) ? TIME : (((rDateTime.Hours > 0) || (rDateTime.Minutes > 0) || (rDateTime.Seconds > 0)) ? DATETIME : DATE);
+ setStandardNumFmt( rxCell, nStdFmt );
+}
+
void WorksheetHelper::setBooleanCell( const Reference< XCell >& rxCell, bool bValue ) const
{
OSL_ENSURE( rxCell.is(), "WorksheetHelper::setBooleanCell - missing cell interface" );
@@ -1715,31 +1810,47 @@ void WorksheetHelper::setErrorCell( const Reference< XCell >& rxCell, sal_uInt8
}
}
-void WorksheetHelper::setOoxCell( OoxCellData& orCellData ) const
+void WorksheetHelper::setCell( CellModel& orModel ) const
{
- OSL_ENSURE( orCellData.mxCell.is(), "WorksheetHelper::setCell - missing cell interface" );
- if( orCellData.mbHasValueStr ) switch( orCellData.mnCellType )
+ OSL_ENSURE( orModel.mxCell.is(), "WorksheetHelper::setCell - missing cell interface" );
+ OOX_LOADSAVE_TIMER( SETCELL );
+ if( orModel.mbHasValueStr ) switch( orModel.mnCellType )
{
case XML_b:
- setBooleanCell( orCellData.mxCell, orCellData.maValueStr.toDouble() != 0.0 );
+ setBooleanCell( orModel.mxCell, orModel.maValueStr.toDouble() != 0.0 );
// #108770# set 'Standard' number format for all Boolean cells
- orCellData.mnNumFmtId = 0;
+ orModel.mnNumFmtId = 0;
break;
case XML_n:
- orCellData.mxCell->setValue( orCellData.maValueStr.toDouble() );
+ orModel.mxCell->setValue( orModel.maValueStr.toDouble() );
break;
case XML_e:
- setErrorCell( orCellData.mxCell, orCellData.maValueStr );
+ setErrorCell( orModel.mxCell, orModel.maValueStr );
break;
case XML_str:
- setStringCell( orCellData.mxCell, orCellData.maValueStr );
+ setStringCell( orModel.mxCell, orModel.maValueStr );
break;
case XML_s:
- setSharedStringCell( orCellData.mxCell, orCellData.maValueStr.toInt32(), orCellData.mnXfId );
+ setSharedStringCell( orModel.mxCell, orModel.maValueStr.toInt32(), orModel.mnXfId );
break;
}
}
+void WorksheetHelper::setStandardNumFmt( const Reference< XCell >& rxCell, sal_Int16 nStdNumFmt ) const
+{
+ try
+ {
+ Reference< XNumberFormatsSupplier > xNumFmtsSupp( getDocument(), UNO_QUERY_THROW );
+ Reference< XNumberFormatTypes > xNumFmtTypes( xNumFmtsSupp->getNumberFormats(), UNO_QUERY_THROW );
+ sal_Int32 nIndex = xNumFmtTypes->getStandardFormat( nStdNumFmt, Locale() );
+ PropertySet aPropSet( rxCell );
+ aPropSet.setProperty( PROP_NumberFormat, nIndex );
+ }
+ catch( Exception& )
+ {
+ }
+}
+
void WorksheetHelper::setSheetType( WorksheetType eSheetType )
{
mrSheetData.setSheetType( eSheetType );
@@ -1750,9 +1861,9 @@ void WorksheetHelper::setDimension( const CellRangeAddress& rRange )
mrSheetData.setDimension( rRange );
}
-void WorksheetHelper::setCellFormat( const OoxCellData& rCellData )
+void WorksheetHelper::setCellFormat( const CellModel& rModel )
{
- mrSheetData.setCellFormat( rCellData );
+ mrSheetData.setCellFormat( rModel );
}
void WorksheetHelper::setMergedRange( const CellRangeAddress& rRange )
@@ -1760,34 +1871,34 @@ void WorksheetHelper::setMergedRange( const CellRangeAddress& rRange )
mrSheetData.setMergedRange( rRange );
}
-void WorksheetHelper::setPageBreak( const OoxPageBreakData& rData, bool bRowBreak )
+void WorksheetHelper::setPageBreak( const PageBreakModel& rModel, bool bRowBreak )
{
- mrSheetData.setPageBreak( rData, bRowBreak );
+ mrSheetData.setPageBreak( rModel, bRowBreak );
}
-void WorksheetHelper::setHyperlink( const OoxHyperlinkData& rHyperlink )
+void WorksheetHelper::setHyperlink( const HyperlinkModel& rModel )
{
- mrSheetData.setHyperlink( rHyperlink );
+ mrSheetData.setHyperlink( rModel );
}
-void WorksheetHelper::setValidation( const OoxValidationData& rValData )
+void WorksheetHelper::setValidation( const ValidationModel& rModel )
{
- mrSheetData.setValidation( rValData );
+ mrSheetData.setValidation( rModel );
}
-void WorksheetHelper::setTableOperation( const CellRangeAddress& rRange, const OoxDataTableData& rTableData ) const
+void WorksheetHelper::setTableOperation( const CellRangeAddress& rRange, const DataTableModel& rModel ) const
{
- OSL_ENSURE( getAddressConverter().checkCellRange( rRange, false ), "WorksheetHelper::setTableOperation - invalid range" );
+ OSL_ENSURE( getAddressConverter().checkCellRange( rRange, true, false ), "WorksheetHelper::setTableOperation - invalid range" );
bool bOk = false;
- if( !rTableData.mbRef1Deleted && (rTableData.maRef1.getLength() > 0) && (rRange.StartColumn > 0) && (rRange.StartRow > 0) )
+ if( !rModel.mbRef1Deleted && (rModel.maRef1.getLength() > 0) && (rRange.StartColumn > 0) && (rRange.StartRow > 0) )
{
CellRangeAddress aOpRange = rRange;
CellAddress aRef1, aRef2;
- if( getAddressConverter().convertToCellAddress( aRef1, rTableData.maRef1, mrSheetData.getSheetIndex(), true ) ) try
+ if( getAddressConverter().convertToCellAddress( aRef1, rModel.maRef1, mrSheetData.getSheetIndex(), true ) ) try
{
- if( rTableData.mb2dTable )
+ if( rModel.mb2dTable )
{
- if( !rTableData.mbRef2Deleted && getAddressConverter().convertToCellAddress( aRef2, rTableData.maRef2, mrSheetData.getSheetIndex(), true ) )
+ if( !rModel.mbRef2Deleted && getAddressConverter().convertToCellAddress( aRef2, rModel.maRef2, mrSheetData.getSheetIndex(), true ) )
{
// API call expects input values inside operation range
--aOpRange.StartColumn;
@@ -1800,7 +1911,7 @@ void WorksheetHelper::setTableOperation( const CellRangeAddress& rRange, const O
bOk = true;
}
}
- else if( rTableData.mbRowTable )
+ else if( rModel.mbRowTable )
{
// formula range is column to the left of operation range
CellRangeAddress aFormulaRange( mrSheetData.getSheetIndex(), aOpRange.StartColumn - 1, aOpRange.StartRow, aOpRange.StartColumn - 1, aOpRange.EndRow );
@@ -1841,9 +1952,9 @@ void WorksheetHelper::setLabelRanges( const ApiCellRangeList& rColRanges, const
{
const CellAddress& rMaxPos = getAddressConverter().getMaxApiAddress();
Reference< XLabelRanges > xLabelRanges;
- PropertySet aPropSet( getXSpreadsheet() );
+ PropertySet aPropSet( getSheet() );
- if( !rColRanges.empty() && aPropSet.getProperty( xLabelRanges, CREATE_OUSTRING( "ColumnLabelRanges" ) ) && xLabelRanges.is() )
+ if( !rColRanges.empty() && aPropSet.getProperty( xLabelRanges, PROP_ColumnLabelRanges ) && xLabelRanges.is() )
{
for( ApiCellRangeList::const_iterator aIt = rColRanges.begin(), aEnd = rColRanges.end(); aIt != aEnd; ++aIt )
{
@@ -1862,7 +1973,7 @@ void WorksheetHelper::setLabelRanges( const ApiCellRangeList& rColRanges, const
}
}
- if( !rRowRanges.empty() && aPropSet.getProperty( xLabelRanges, CREATE_OUSTRING( "RowLabelRanges" ) ) && xLabelRanges.is() )
+ if( !rRowRanges.empty() && aPropSet.getProperty( xLabelRanges, PROP_RowLabelRanges ) && xLabelRanges.is() )
{
for( ApiCellRangeList::const_iterator aIt = rRowRanges.begin(), aEnd = rRowRanges.end(); aIt != aEnd; ++aIt )
{
@@ -1892,14 +2003,14 @@ void WorksheetHelper::setVmlDrawingPath( const OUString& rVmlDrawingPath )
mrSheetData.setVmlDrawingPath( rVmlDrawingPath );
}
-void WorksheetHelper::setOleObject( const OoxOleObjectData& rOleObjectData )
+void WorksheetHelper::setOleObject( const OleObjectModel& rModel )
{
- mrSheetData.setOleObject( rOleObjectData );
+ mrSheetData.setOleObject( rModel );
}
-void WorksheetHelper::setFormControl( const OoxFormControlData& rFormControlData )
+void WorksheetHelper::setFormControl( const FormControlModel& rModel )
{
- mrSheetData.setFormControl( rFormControlData );
+ mrSheetData.setFormControl( rModel );
}
void WorksheetHelper::setBaseColumnWidth( sal_Int32 nWidth )
@@ -1912,29 +2023,24 @@ void WorksheetHelper::setDefaultColumnWidth( double fWidth )
mrSheetData.setDefaultColumnWidth( fWidth );
}
-void WorksheetHelper::setColumnData( const OoxColumnData& rData )
-{
- mrSheetData.setColumnData( rData );
-}
-
-void WorksheetHelper::setDefaultRowSettings( double fHeight, bool bCustomHeight, bool bHidden, bool bThickTop, bool bThickBottom )
+void WorksheetHelper::setDefaultColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId )
{
- mrSheetData.setDefaultRowSettings( fHeight, bCustomHeight, bHidden, bThickTop, bThickBottom );
+ mrSheetData.convertColumnFormat( nFirstCol, nLastCol, nXfId );
}
-void WorksheetHelper::setRowData( const OoxRowData& rData )
+void WorksheetHelper::setColumnModel( const ColumnModel& rModel )
{
- mrSheetData.setRowData( rData );
+ mrSheetData.setColumnModel( rModel );
}
-void WorksheetHelper::convertColumnFormat( sal_Int32 nFirstCol, sal_Int32 nLastCol, sal_Int32 nXfId )
+void WorksheetHelper::setDefaultRowSettings( double fHeight, bool bCustomHeight, bool bHidden, bool bThickTop, bool bThickBottom )
{
- mrSheetData.convertColumnFormat( nFirstCol, nLastCol, nXfId );
+ mrSheetData.setDefaultRowSettings( fHeight, bCustomHeight, bHidden, bThickTop, bThickBottom );
}
-void WorksheetHelper::convertRowFormat( sal_Int32 nFirstRow, sal_Int32 nLastRow, sal_Int32 nXfId )
+void WorksheetHelper::setRowModel( const RowModel& rModel )
{
- mrSheetData.convertRowFormat( nFirstRow, nLastRow, nXfId );
+ mrSheetData.setRowModel( rModel );
}
void WorksheetHelper::initializeWorksheetImport()
diff --git a/oox/source/xls/worksheetsettings.cxx b/oox/source/xls/worksheetsettings.cxx
index 6ab897565c69..55a168329671 100644
--- a/oox/source/xls/worksheetsettings.cxx
+++ b/oox/source/xls/worksheetsettings.cxx
@@ -37,8 +37,9 @@
#include "oox/xls/workbooksettings.hxx"
using ::rtl::OUString;
+using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
using ::com::sun::star::util::XProtectable;
namespace oox {
@@ -78,7 +79,7 @@ const sal_uInt16 BIFF_SHEETPROT_SELECT_UNLOCKED = 0x4000;
// ============================================================================
-OoxSheetPrData::OoxSheetPrData() :
+SheetSettingsModel::SheetSettingsModel() :
mbFilterMode( false ),
mbApplyStyles( false ),
mbSummaryBelow( true ),
@@ -88,7 +89,7 @@ OoxSheetPrData::OoxSheetPrData() :
// ============================================================================
-OoxSheetProtectionData::OoxSheetProtectionData() :
+SheetProtectionModel::SheetProtectionModel() :
mnPasswordHash( 0 ),
mbSheet( false ),
mbObjects( false ),
@@ -129,53 +130,53 @@ WorksheetSettings::WorksheetSettings( const WorksheetHelper& rHelper ) :
void WorksheetSettings::importSheetPr( const AttributeList& rAttribs )
{
- maOoxSheetData.maCodeName = rAttribs.getString( XML_codeName, OUString() );
- maOoxSheetData.mbFilterMode = rAttribs.getBool( XML_filterMode, false );
+ maSheetSettings.maCodeName = rAttribs.getString( XML_codeName, OUString() );
+ maSheetSettings.mbFilterMode = rAttribs.getBool( XML_filterMode, false );
}
void WorksheetSettings::importChartSheetPr( const AttributeList& rAttribs )
{
- maOoxSheetData.maCodeName = rAttribs.getString( XML_codeName, OUString() );
+ maSheetSettings.maCodeName = rAttribs.getString( XML_codeName, OUString() );
}
void WorksheetSettings::importTabColor( const AttributeList& rAttribs )
{
- maOoxSheetData.maTabColor.importColor( rAttribs );
+ maSheetSettings.maTabColor.importColor( rAttribs );
}
void WorksheetSettings::importOutlinePr( const AttributeList& rAttribs )
{
- maOoxSheetData.mbApplyStyles = rAttribs.getBool( XML_applyStyles, false );
- maOoxSheetData.mbSummaryBelow = rAttribs.getBool( XML_summaryBelow, true );
- maOoxSheetData.mbSummaryRight = rAttribs.getBool( XML_summaryRight, true );
+ maSheetSettings.mbApplyStyles = rAttribs.getBool( XML_applyStyles, false );
+ maSheetSettings.mbSummaryBelow = rAttribs.getBool( XML_summaryBelow, true );
+ maSheetSettings.mbSummaryRight = rAttribs.getBool( XML_summaryRight, true );
}
void WorksheetSettings::importSheetProtection( const AttributeList& rAttribs )
{
- maOoxProtData.mnPasswordHash = lclGetCheckedHash( rAttribs.getHex( XML_password, 0 ) );
- maOoxProtData.mbSheet = rAttribs.getBool( XML_sheet, false );
- maOoxProtData.mbObjects = rAttribs.getBool( XML_objects, false );
- maOoxProtData.mbScenarios = rAttribs.getBool( XML_scenarios, false );
- maOoxProtData.mbFormatCells = rAttribs.getBool( XML_formatCells, true );
- maOoxProtData.mbFormatColumns = rAttribs.getBool( XML_formatColumns, true );
- maOoxProtData.mbFormatRows = rAttribs.getBool( XML_formatRows, true );
- maOoxProtData.mbInsertColumns = rAttribs.getBool( XML_insertColumns, true );
- maOoxProtData.mbInsertRows = rAttribs.getBool( XML_insertRows, true );
- maOoxProtData.mbInsertHyperlinks = rAttribs.getBool( XML_insertHyperlinks, true );
- maOoxProtData.mbDeleteColumns = rAttribs.getBool( XML_deleteColumns, true );
- maOoxProtData.mbDeleteRows = rAttribs.getBool( XML_deleteRows, true );
- maOoxProtData.mbSelectLocked = rAttribs.getBool( XML_selectLockedCells, false );
- maOoxProtData.mbSort = rAttribs.getBool( XML_sort, true );
- maOoxProtData.mbAutoFilter = rAttribs.getBool( XML_autoFilter, true );
- maOoxProtData.mbPivotTables = rAttribs.getBool( XML_pivotTables, true );
- maOoxProtData.mbSelectUnlocked = rAttribs.getBool( XML_selectUnlockedCells, false );
+ maSheetProt.mnPasswordHash = lclGetCheckedHash( rAttribs.getHex( XML_password, 0 ) );
+ maSheetProt.mbSheet = rAttribs.getBool( XML_sheet, false );
+ maSheetProt.mbObjects = rAttribs.getBool( XML_objects, false );
+ maSheetProt.mbScenarios = rAttribs.getBool( XML_scenarios, false );
+ maSheetProt.mbFormatCells = rAttribs.getBool( XML_formatCells, true );
+ maSheetProt.mbFormatColumns = rAttribs.getBool( XML_formatColumns, true );
+ maSheetProt.mbFormatRows = rAttribs.getBool( XML_formatRows, true );
+ maSheetProt.mbInsertColumns = rAttribs.getBool( XML_insertColumns, true );
+ maSheetProt.mbInsertRows = rAttribs.getBool( XML_insertRows, true );
+ maSheetProt.mbInsertHyperlinks = rAttribs.getBool( XML_insertHyperlinks, true );
+ maSheetProt.mbDeleteColumns = rAttribs.getBool( XML_deleteColumns, true );
+ maSheetProt.mbDeleteRows = rAttribs.getBool( XML_deleteRows, true );
+ maSheetProt.mbSelectLocked = rAttribs.getBool( XML_selectLockedCells, false );
+ maSheetProt.mbSort = rAttribs.getBool( XML_sort, true );
+ maSheetProt.mbAutoFilter = rAttribs.getBool( XML_autoFilter, true );
+ maSheetProt.mbPivotTables = rAttribs.getBool( XML_pivotTables, true );
+ maSheetProt.mbSelectUnlocked = rAttribs.getBool( XML_selectUnlockedCells, false );
}
void WorksheetSettings::importChartProtection( const AttributeList& rAttribs )
{
- maOoxProtData.mnPasswordHash = lclGetCheckedHash( rAttribs.getHex( XML_password, 0 ) );
- maOoxProtData.mbSheet = rAttribs.getBool( XML_content, false );
- maOoxProtData.mbObjects = rAttribs.getBool( XML_objects, false );
+ maSheetProt.mnPasswordHash = lclGetCheckedHash( rAttribs.getHex( XML_password, 0 ) );
+ maSheetProt.mbSheet = rAttribs.getBool( XML_content, false );
+ maSheetProt.mbObjects = rAttribs.getBool( XML_objects, false );
}
void WorksheetSettings::importPhoneticPr( const AttributeList& rAttribs )
@@ -187,15 +188,15 @@ void WorksheetSettings::importSheetPr( RecordInputStream& rStrm )
{
sal_uInt16 nFlags1;
sal_uInt8 nFlags2;
- rStrm >> nFlags1 >> nFlags2 >> maOoxSheetData.maTabColor;
+ rStrm >> nFlags1 >> nFlags2 >> maSheetSettings.maTabColor;
rStrm.skip( 8 ); // sync anchor cell
- rStrm >> maOoxSheetData.maCodeName;
+ rStrm >> maSheetSettings.maCodeName;
// sheet settings
- maOoxSheetData.mbFilterMode = getFlag( nFlags2, OOBIN_SHEETPR_FILTERMODE );
+ maSheetSettings.mbFilterMode = getFlag( nFlags2, OOBIN_SHEETPR_FILTERMODE );
// outline settings, equal flags in BIFF and OOBIN
- maOoxSheetData.mbApplyStyles = getFlag( nFlags1, BIFF_SHEETPR_APPLYSTYLES );
- maOoxSheetData.mbSummaryRight = getFlag( nFlags1, BIFF_SHEETPR_SYMBOLSRIGHT );
- maOoxSheetData.mbSummaryBelow = getFlag( nFlags1, BIFF_SHEETPR_SYMBOLSBELOW );
+ maSheetSettings.mbApplyStyles = getFlag( nFlags1, BIFF_SHEETPR_APPLYSTYLES );
+ maSheetSettings.mbSummaryRight = getFlag( nFlags1, BIFF_SHEETPR_SYMBOLSRIGHT );
+ maSheetSettings.mbSummaryBelow = getFlag( nFlags1, BIFF_SHEETPR_SYMBOLSBELOW );
/* Fit printout to width/height - for whatever reason, this flag is still
stored separated from the page settings */
getPageSettings().setFitToPagesMode( getFlag( nFlags1, BIFF_SHEETPR_FITTOPAGES ) );
@@ -204,37 +205,37 @@ void WorksheetSettings::importSheetPr( RecordInputStream& rStrm )
void WorksheetSettings::importChartSheetPr( RecordInputStream& rStrm )
{
rStrm.skip( 2 ); // flags, contains only the 'published' flag
- rStrm >> maOoxSheetData.maTabColor >> maOoxSheetData.maCodeName;
+ rStrm >> maSheetSettings.maTabColor >> maSheetSettings.maCodeName;
}
void WorksheetSettings::importSheetProtection( RecordInputStream& rStrm )
{
- rStrm >> maOoxProtData.mnPasswordHash;
+ rStrm >> maSheetProt.mnPasswordHash;
// no flags field for all these boolean flags?!?
- maOoxProtData.mbSheet = rStrm.readInt32() != 0;
- maOoxProtData.mbObjects = rStrm.readInt32() != 0;
- maOoxProtData.mbScenarios = rStrm.readInt32() != 0;
- maOoxProtData.mbFormatCells = rStrm.readInt32() != 0;
- maOoxProtData.mbFormatColumns = rStrm.readInt32() != 0;
- maOoxProtData.mbFormatRows = rStrm.readInt32() != 0;
- maOoxProtData.mbInsertColumns = rStrm.readInt32() != 0;
- maOoxProtData.mbInsertRows = rStrm.readInt32() != 0;
- maOoxProtData.mbInsertHyperlinks = rStrm.readInt32() != 0;
- maOoxProtData.mbDeleteColumns = rStrm.readInt32() != 0;
- maOoxProtData.mbDeleteRows = rStrm.readInt32() != 0;
- maOoxProtData.mbSelectLocked = rStrm.readInt32() != 0;
- maOoxProtData.mbSort = rStrm.readInt32() != 0;
- maOoxProtData.mbAutoFilter = rStrm.readInt32() != 0;
- maOoxProtData.mbPivotTables = rStrm.readInt32() != 0;
- maOoxProtData.mbSelectUnlocked = rStrm.readInt32() != 0;
+ maSheetProt.mbSheet = rStrm.readInt32() != 0;
+ maSheetProt.mbObjects = rStrm.readInt32() != 0;
+ maSheetProt.mbScenarios = rStrm.readInt32() != 0;
+ maSheetProt.mbFormatCells = rStrm.readInt32() != 0;
+ maSheetProt.mbFormatColumns = rStrm.readInt32() != 0;
+ maSheetProt.mbFormatRows = rStrm.readInt32() != 0;
+ maSheetProt.mbInsertColumns = rStrm.readInt32() != 0;
+ maSheetProt.mbInsertRows = rStrm.readInt32() != 0;
+ maSheetProt.mbInsertHyperlinks = rStrm.readInt32() != 0;
+ maSheetProt.mbDeleteColumns = rStrm.readInt32() != 0;
+ maSheetProt.mbDeleteRows = rStrm.readInt32() != 0;
+ maSheetProt.mbSelectLocked = rStrm.readInt32() != 0;
+ maSheetProt.mbSort = rStrm.readInt32() != 0;
+ maSheetProt.mbAutoFilter = rStrm.readInt32() != 0;
+ maSheetProt.mbPivotTables = rStrm.readInt32() != 0;
+ maSheetProt.mbSelectUnlocked = rStrm.readInt32() != 0;
}
void WorksheetSettings::importChartProtection( RecordInputStream& rStrm )
{
- rStrm >> maOoxProtData.mnPasswordHash;
+ rStrm >> maSheetProt.mnPasswordHash;
// no flags field for all these boolean flags?!?
- maOoxProtData.mbSheet = rStrm.readInt32() != 0;
- maOoxProtData.mbObjects = rStrm.readInt32() != 0;
+ maSheetProt.mbSheet = rStrm.readInt32() != 0;
+ maSheetProt.mbObjects = rStrm.readInt32() != 0;
}
void WorksheetSettings::importPhoneticPr( RecordInputStream& rStrm )
@@ -253,9 +254,9 @@ void WorksheetSettings::importSheetPr( BiffInputStream& rStrm )
setSheetType( SHEETTYPE_DIALOGSHEET );
}
// outline settings
- maOoxSheetData.mbApplyStyles = getFlag( nFlags, BIFF_SHEETPR_APPLYSTYLES );
- maOoxSheetData.mbSummaryRight = getFlag( nFlags, BIFF_SHEETPR_SYMBOLSRIGHT );
- maOoxSheetData.mbSummaryBelow = getFlag( nFlags, BIFF_SHEETPR_SYMBOLSBELOW );
+ maSheetSettings.mbApplyStyles = getFlag( nFlags, BIFF_SHEETPR_APPLYSTYLES );
+ maSheetSettings.mbSummaryRight = getFlag( nFlags, BIFF_SHEETPR_SYMBOLSRIGHT );
+ maSheetSettings.mbSummaryBelow = getFlag( nFlags, BIFF_SHEETPR_SYMBOLSBELOW );
// fit printout to width/height
getPageSettings().setFitToPagesMode( getFlag( nFlags, BIFF_SHEETPR_FITTOPAGES ) );
// save external linked values, in BIFF5-BIFF8 moved to BOOKBOOK record
@@ -265,22 +266,22 @@ void WorksheetSettings::importSheetPr( BiffInputStream& rStrm )
void WorksheetSettings::importProtect( BiffInputStream& rStrm )
{
- maOoxProtData.mbSheet = rStrm.readuInt16() != 0;
+ maSheetProt.mbSheet = rStrm.readuInt16() != 0;
}
void WorksheetSettings::importObjectProtect( BiffInputStream& rStrm )
{
- maOoxProtData.mbObjects = rStrm.readuInt16() != 0;
+ maSheetProt.mbObjects = rStrm.readuInt16() != 0;
}
void WorksheetSettings::importScenProtect( BiffInputStream& rStrm )
{
- maOoxProtData.mbScenarios = rStrm.readuInt16() != 0;
+ maSheetProt.mbScenarios = rStrm.readuInt16() != 0;
}
void WorksheetSettings::importPassword( BiffInputStream& rStrm )
{
- rStrm >> maOoxProtData.mnPasswordHash;
+ rStrm >> maSheetProt.mnPasswordHash;
}
void WorksheetSettings::importSheetProtection( BiffInputStream& rStrm )
@@ -288,21 +289,21 @@ void WorksheetSettings::importSheetProtection( BiffInputStream& rStrm )
rStrm.skip( 19 );
sal_uInt16 nFlags = rStrm.readuInt16();
// set flag means protection is disabled
- maOoxProtData.mbObjects = !getFlag( nFlags, BIFF_SHEETPROT_OBJECTS );
- maOoxProtData.mbScenarios = !getFlag( nFlags, BIFF_SHEETPROT_SCENARIOS );
- maOoxProtData.mbFormatCells = !getFlag( nFlags, BIFF_SHEETPROT_FORMAT_CELLS );
- maOoxProtData.mbFormatColumns = !getFlag( nFlags, BIFF_SHEETPROT_FORMAT_COLUMNS );
- maOoxProtData.mbFormatRows = !getFlag( nFlags, BIFF_SHEETPROT_FORMAT_ROWS );
- maOoxProtData.mbInsertColumns = !getFlag( nFlags, BIFF_SHEETPROT_INSERT_COLUMNS );
- maOoxProtData.mbInsertRows = !getFlag( nFlags, BIFF_SHEETPROT_INSERT_ROWS );
- maOoxProtData.mbInsertHyperlinks = !getFlag( nFlags, BIFF_SHEETPROT_INSERT_HLINKS );
- maOoxProtData.mbDeleteColumns = !getFlag( nFlags, BIFF_SHEETPROT_DELETE_COLUMNS );
- maOoxProtData.mbDeleteRows = !getFlag( nFlags, BIFF_SHEETPROT_DELETE_ROWS );
- maOoxProtData.mbSelectLocked = !getFlag( nFlags, BIFF_SHEETPROT_SELECT_LOCKED );
- maOoxProtData.mbSort = !getFlag( nFlags, BIFF_SHEETPROT_SORT );
- maOoxProtData.mbAutoFilter = !getFlag( nFlags, BIFF_SHEETPROT_AUTOFILTER );
- maOoxProtData.mbPivotTables = !getFlag( nFlags, BIFF_SHEETPROT_PIVOTTABLES );
- maOoxProtData.mbSelectUnlocked = !getFlag( nFlags, BIFF_SHEETPROT_SELECT_UNLOCKED );
+ maSheetProt.mbObjects = !getFlag( nFlags, BIFF_SHEETPROT_OBJECTS );
+ maSheetProt.mbScenarios = !getFlag( nFlags, BIFF_SHEETPROT_SCENARIOS );
+ maSheetProt.mbFormatCells = !getFlag( nFlags, BIFF_SHEETPROT_FORMAT_CELLS );
+ maSheetProt.mbFormatColumns = !getFlag( nFlags, BIFF_SHEETPROT_FORMAT_COLUMNS );
+ maSheetProt.mbFormatRows = !getFlag( nFlags, BIFF_SHEETPROT_FORMAT_ROWS );
+ maSheetProt.mbInsertColumns = !getFlag( nFlags, BIFF_SHEETPROT_INSERT_COLUMNS );
+ maSheetProt.mbInsertRows = !getFlag( nFlags, BIFF_SHEETPROT_INSERT_ROWS );
+ maSheetProt.mbInsertHyperlinks = !getFlag( nFlags, BIFF_SHEETPROT_INSERT_HLINKS );
+ maSheetProt.mbDeleteColumns = !getFlag( nFlags, BIFF_SHEETPROT_DELETE_COLUMNS );
+ maSheetProt.mbDeleteRows = !getFlag( nFlags, BIFF_SHEETPROT_DELETE_ROWS );
+ maSheetProt.mbSelectLocked = !getFlag( nFlags, BIFF_SHEETPROT_SELECT_LOCKED );
+ maSheetProt.mbSort = !getFlag( nFlags, BIFF_SHEETPROT_SORT );
+ maSheetProt.mbAutoFilter = !getFlag( nFlags, BIFF_SHEETPROT_AUTOFILTER );
+ maSheetProt.mbPivotTables = !getFlag( nFlags, BIFF_SHEETPROT_PIVOTTABLES );
+ maSheetProt.mbSelectUnlocked = !getFlag( nFlags, BIFF_SHEETPROT_SELECT_UNLOCKED );
}
void WorksheetSettings::importPhoneticPr( BiffInputStream& rStrm )
@@ -312,11 +313,13 @@ void WorksheetSettings::importPhoneticPr( BiffInputStream& rStrm )
void WorksheetSettings::finalizeImport()
{
- if( maOoxProtData.mbSheet )
+ if( maSheetProt.mbSheet ) try
+ {
+ Reference< XProtectable > xProtectable( getSheet(), UNO_QUERY_THROW );
+ xProtectable->protect( OUString() );
+ }
+ catch( Exception& )
{
- Reference< XProtectable > xProtectable( getXSpreadsheet(), UNO_QUERY );
- if( xProtectable.is() )
- xProtectable->protect( OUString() );
}
}