summaryrefslogtreecommitdiff
path: root/oox/source/xls/worksheethelper.cxx
diff options
context:
space:
mode:
authorIvo Hinkelmann <ihi@openoffice.org>2009-07-15 14:57:49 +0000
committerIvo Hinkelmann <ihi@openoffice.org>2009-07-15 14:57:49 +0000
commit0851da4d8a0a557f1e9a31af652a530c615c2989 (patch)
tree4c630979f4764c52e84314e9bb16d22416a447b2 /oox/source/xls/worksheethelper.cxx
parente49ca2777ba38f75b24a49d30f59c2f0d2be79e6 (diff)
CWS-TOOLING: integrate CWS dr68
2009-06-19 17:43:48 +0200 oc r273175 : #i102946# some lines for new dialog added 2009-06-19 14:17:45 +0200 oc r273158 : #i102946# three lines added 2009-05-19 11:56:14 +0200 dr r272065 : #i99677# wrong attribute name 2009-05-18 18:37:05 +0200 dr r272045 : #i10000# suncc warning 2009-05-05 16:46:13 +0200 dr r271536 : #i10000# adoptions after rebase to master containing dr67 2009-05-05 16:01:19 +0200 dr r271530 : #i10000# adoptions after rebase to master containing dr67 2009-05-04 14:20:39 +0200 dr r271453 : CWS-TOOLING: rebase CWS dr68 to trunk@271427 (milestone: DEV300:m47) 2009-04-28 17:01:14 +0200 dr r271332 : CWS-TOOLING: rebase CWS dr68 to trunk@270723 (milestone: DEV300:m46) 2009-04-23 12:21:40 +0200 dr r271149 : #i100688# missing checkins 2009-04-23 12:18:16 +0200 dr r271147 : #i100978# relations path handling 2009-04-22 19:25:45 +0200 nn r271136 : #i49491# show navigator for double click on document position status bar control 2009-04-22 11:28:36 +0200 nn r271085 : #i60401# small text change 2009-04-21 16:53:23 +0200 dr r271044 : #i10000# missing dtor 2009-04-20 13:39:25 +0200 nn r270977 : #i60401# add dialog to extend sort range (patch from maoyg) 2009-04-08 12:11:08 +0200 dr r270630 : #i100943# prevent assertion when loading chart with empty category ranges 2009-04-07 19:03:00 +0200 dr r270609 : #i100688# missing bits for OLE 2009-04-07 17:14:06 +0200 dr r270605 : ported fix for #i100710# 2009-04-07 17:12:50 +0200 dr r270604 : #i10000# wae 2009-04-07 15:31:55 +0200 dr r270598 : import system colors moved to FilterBase class, more rework on fill and color contexts 2009-04-06 15:00:03 +0200 dr r270552 : #i99677# prevent recursive loading of the current document 2009-04-03 18:28:42 +0200 dr r270515 : added import of brightness/contrast and mono/grayscale color effects for image shapes 2009-04-03 17:36:03 +0200 dr r270509 : cache already imported embedded graphics 2009-04-03 16:46:34 +0200 dr r270500 : more rework on bitmap fill and graphic object handling 2009-03-31 12:28:10 +0200 dr r270271 : #i10000# unxlngi6 wae 2009-03-31 09:04:10 +0200 dr r270261 : CWS-TOOLING: rebase CWS dr68 to trunk@270033 (milestone: DEV300:m45) 2009-03-30 17:42:05 +0200 dr r270249 : #i91122# add missing doc 2009-03-30 17:37:08 +0200 dr r270248 : #i91122# add missing doc 2009-03-30 16:59:15 +0200 dr r270241 : #i99677# add import of ActiveX scrollbar controls 2009-03-30 14:30:36 +0200 dr r270230 : #i91122# missing/wrong documentation 2009-03-30 13:03:38 +0200 dr r270220 : #i99677# add import of ActiveX combobox and spinbutton controls 2009-03-27 11:46:59 +0100 dr r270144 : #i99677# import ActiveX listbox controls (Forms.ListBox.1) 2009-03-26 19:58:00 +0100 dr r270104 : #i99677# move more OLE import code into ole submodule 2009-03-26 15:15:02 +0100 dr r270082 : #i100546# add import of chart bitmap fills, add import of X/Y offset in tiled bitmap fills of all shapes 2009-03-25 12:54:59 +0100 dr r270018 : #i99677# import ActiveX edit text control (Forms.TextBox.1) 2009-03-24 10:59:29 +0100 dr r269921 : #i99677# moved import of OLE StdHlink to 'ole' submodule, added string import helpers to BinaryStreamBase class, removed implementation of ST_XString import from docprop in favour of the implementation in class AttributeList 2009-03-24 10:40:18 +0100 dr r269919 : #i100502# implicit precedence of '&&' was intended 2009-03-24 10:18:29 +0100 dr r269917 : #i100502# missing parentheses 2009-03-23 15:17:48 +0100 dr r269876 : #i99677# more code reorg, added graphic helper and OLE helper object per filter, added OLE/control import to PPTX/XLSX filter, moved helpers from XmlFilterBase to FilterBase 2009-03-19 12:45:20 +0100 dr r269740 : #i99677# interface changes in oox 2009-03-18 15:51:50 +0100 dr r269683 : #i99677# improved relation handling (internal/external), added preprocessor for VML streams to eat MS specific instructions, added OCX ToggleButton/OptionButton import, added DIB import for BIFF (page background picture, lots of other minor improvements 2009-03-16 15:25:30 +0100 dr r269551 : #i99677# import excel form control client data (printable, cell link) 2009-03-13 18:37:17 +0100 dr r269494 : #i99677# import image controls and check boxes 2009-03-12 15:08:18 +0100 dr r269420 : #i10000# rebase problems 2009-03-12 14:43:09 +0100 dr r269418 : #i10000# rebase problems 2009-03-12 14:42:41 +0100 dr r269417 : #i10000# missing delivered header 2009-03-12 13:57:06 +0100 dr r269405 : #i10000# typos 2009-03-12 12:58:52 +0100 dr r269391 : CWS-TOOLING: rebase CWS dr68 to trunk@269297 (milestone: DEV300:m43) 2009-03-12 11:11:46 +0100 dr r269374 : #i99677# first step to import BIFF8 page background 2009-03-12 10:21:53 +0100 dr r269364 : #i99677# rework of graphic import in entire filter, added import of AX Label controls 2009-03-09 16:44:50 +0100 dr r269202 : #i99677# import some formatting attributes of command buttons 2009-03-05 15:31:46 +0100 dr r268911 : #i99677# use VML shape client data to import excel VML shape positions 2009-03-05 11:39:48 +0100 dr r268888 : #i99677# create UNO control shapes from VML control shapes 2009-03-05 11:38:59 +0100 dr r268886 : #i99677# change attribute Shapes to DrawPage for import of embedded form controls 2009-03-05 11:30:40 +0100 dr r268885 : #i99677# change attribute Shapes to DrawPage for import of embedded form controls 2009-03-04 18:46:05 +0100 dr r268860 : adapt namespace ids according to oox 2009-03-04 18:43:49 +0100 dr r268859 : #i99677# more VML import rework 2009-03-03 13:38:36 +0100 dr r268721 : #i99677# more cleanup for VML filter 2009-03-03 13:13:15 +0100 dr r268719 : #i99807# do not iterate beyond end of std::list 2009-03-02 11:55:49 +0100 dr r268644 : add ST_XString support (encoded characters in attribute values) 2009-02-26 17:07:18 +0100 dr r268542 : #i99677# first steps of ax control import: dummy AX base classes, reimplement VML import (hopefully without breaking anything), register embedded AX controls at VML drawing 2009-02-23 17:43:50 +0100 dr r268365 : #i99426# remaining work on scenario import 2009-02-19 16:56:25 +0100 dr r268295 : #i99426# base implementations for scenarios import
Diffstat (limited to 'oox/source/xls/worksheethelper.cxx')
-rw-r--r--oox/source/xls/worksheethelper.cxx114
1 files changed, 58 insertions, 56 deletions
diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx
index 2e7a1b1f31fd..be8ac3d359db 100644
--- a/oox/source/xls/worksheethelper.cxx
+++ b/oox/source/xls/worksheethelper.cxx
@@ -40,6 +40,7 @@
#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/drawing/XDrawPageSupplier.hpp>
#include <com/sun/star/table/XColumnRowRange.hpp>
#include <com/sun/star/sheet/TableValidationVisibility.hpp>
#include <com/sun/star/sheet/ValidationType.hpp>
@@ -91,6 +92,8 @@ 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::drawing::XDrawPage;
+using ::com::sun::star::drawing::XDrawPageSupplier;
using ::com::sun::star::table::BorderLine;
using ::com::sun::star::table::CellAddress;
using ::com::sun::star::table::CellRangeAddress;
@@ -349,23 +352,6 @@ void ValidationModel::setBinErrorStyle( sal_uInt8 nErrorStyle )
mnErrorStyle = STATIC_ARRAY_SELECT( spnErrorStyles, nErrorStyle, XML_stop );
}
-// ----------------------------------------------------------------------------
-
-OleObjectModel::OleObjectModel() :
- mnAspect( XML_DVASPECT_CONTENT ),
- mnUpdateMode( XML_OLEUPDATE_ALWAYS ),
- mnShapeId( 0 ),
- mbAutoLoad( false )
-{
-}
-
-// ----------------------------------------------------------------------------
-
-FormControlModel::FormControlModel() :
- mnShapeId( 0 )
-{
-}
-
// ============================================================================
// ============================================================================
@@ -409,6 +395,9 @@ public:
/** Returns the XTableRows interface for a range of rows. */
Reference< XTableRows > getRows( sal_Int32 nFirstRow, sal_Int32 nLastRow ) const;
+ /** Returns the XDrawPage interface of the draw page of the current sheet. */
+ Reference< XDrawPage > getDrawPage() const;
+
/** Returns the absolute cell position in 1/100 mm. */
Point getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const;
/** Returns the cell size in 1/100 mm. */
@@ -428,6 +417,8 @@ public:
inline PageSettings& getPageSettings() { return maPageSett; }
/** Returns the view settings for this sheet. */
inline SheetViewSettings& getSheetViewSettings() { return maSheetViewSett; }
+ /** Returns the VML drawing page for this sheet (OOX only!). */
+ inline VmlDrawing& getVmlDrawing() { return *mxVmlDrawing; }
/** Changes the current sheet type. */
inline void setSheetType( WorksheetType eSheetType ) { meSheetType = eSheetType; }
@@ -447,10 +438,6 @@ public:
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 OleObjectModel& rModel );
- /** Sets additional data for an OCX form control. */
- 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(). */
@@ -486,8 +473,6 @@ private:
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
{
@@ -548,8 +533,10 @@ private:
/** Merges the passed merged range and updates right/bottom cell borders. */
void finalizeMergedRange( const CellRangeAddress& rRange );
- /** Imports the drawing layer of the sheet. */
+ /** Imports the drawing layer of the sheet (DrawingML part). */
void finalizeDrawing();
+ /** Imports the drawing layer of the sheet (VML part). */
+ void finalizeVmlDrawing();
/** Converts column properties for all columns in the sheet. */
void convertColumns();
@@ -567,6 +554,8 @@ private:
void groupColumnsOrRows( sal_Int32 nFirstColRow, sal_Int32 nLastColRow, bool bCollapsed, bool bRows );
private:
+ typedef ::std::auto_ptr< VmlDrawing > VmlDrawingPtr;
+
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.
@@ -579,8 +568,6 @@ private:
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.
@@ -592,6 +579,7 @@ private:
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.
+ VmlDrawingPtr mxVmlDrawing; /// Collection of all VML shapes.
OUString maDrawingPath; /// Path to DrawingML fragment.
OUString maVmlDrawingPath; /// Path to legacy VML drawing fragment.
ISegmentProgressBarRef mxProgressBar; /// Sheet progress bar.
@@ -647,6 +635,11 @@ WorksheetData::WorksheetData( const WorkbookHelper& rHelper, ISegmentProgressBar
maDefRowModel.mbHidden = false;
maDefRowModel.mbCollapsed = false;
+ // buffers
+ if( getFilterType() == FILTER_OOX )
+ mxVmlDrawing.reset( new VmlDrawing( *this ) );
+
+ // prepare progress bars
if( mxProgressBar.get() )
{
mxRowProgress = mxProgressBar->createSegment( 0.5 );
@@ -690,8 +683,7 @@ Reference< XSheetCellRanges > WorksheetData::getCellRangeList( const ApiCellRang
Reference< XSheetCellRanges > xRanges;
if( mxSheet.is() && !rRanges.empty() ) try
{
- Reference< XMultiServiceFactory > xFactory( getDocument(), UNO_QUERY_THROW );
- xRanges.set( xFactory->createInstance( maSheetCellRanges ), UNO_QUERY_THROW );
+ xRanges.set( getDocumentFactory()->createInstance( maSheetCellRanges ), UNO_QUERY_THROW );
Reference< XSheetCellRangeContainer > xRangeCont( xRanges, UNO_QUERY_THROW );
xRangeCont->addRangeAddresses( ContainerHelper::vectorToSequence( rRanges ), sal_False );
}
@@ -757,6 +749,20 @@ Reference< XTableRows > WorksheetData::getRows( sal_Int32 nFirstRow, sal_Int32 n
return xRows;
}
+Reference< XDrawPage > WorksheetData::getDrawPage() const
+{
+ Reference< XDrawPage > xDrawPage;
+ try
+ {
+ Reference< XDrawPageSupplier > xDrawPageSupp( mxSheet, UNO_QUERY_THROW );
+ xDrawPage = xDrawPageSupp->getDrawPage();
+ }
+ catch( Exception& )
+ {
+ }
+ return xDrawPage;
+}
+
Point WorksheetData::getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const
{
Point aPoint;
@@ -871,27 +877,15 @@ void WorksheetData::setVmlDrawingPath( const OUString& rVmlDrawingPath )
maVmlDrawingPath = rVmlDrawingPath;
}
-void WorksheetData::setOleObject( const OleObjectModel& rModel )
-{
- if( rModel.mnShapeId > 0 )
- maOleObjects[ rModel.mnShapeId ] = rModel;
-}
-
-void WorksheetData::setFormControl( const FormControlModel& rModel )
-{
- if( rModel.mnShapeId > 0 )
- maFormControls[ rModel.mnShapeId ] = rModel;
-}
-
void WorksheetData::setBaseColumnWidth( sal_Int32 nWidth )
{
// do not modify width, if setDefaultColumnWidth() has been used
if( !mbHasDefWidth && (nWidth > 0) )
{
- /* #i3006# add 5 pixels padding to the width, assuming 1 pixel =
- 1/96 inch. => 5/96 inch == 1.32 mm. */
+ // #i3006# add 5 pixels padding to the width
const UnitConverter& rUnitConv = getUnitConverter();
- maDefColModel.mfWidth = rUnitConv.scaleFromMm100( rUnitConv.scaleToMm100( nWidth, UNIT_DIGIT ) + 132, UNIT_DIGIT );
+ maDefColModel.mfWidth = rUnitConv.scaleFromMm100(
+ rUnitConv.scaleToMm100( nWidth, UNIT_DIGIT ) + rUnitConv.scaleToMm100( 5, UNIT_SCREENX ), UNIT_DIGIT );
}
}
@@ -1014,6 +1008,7 @@ void WorksheetData::finalizeWorksheetImport()
lclUpdateProgressBar( mxFinalProgress, 0.75 );
maComments.finalizeImport();
finalizeDrawing();
+ finalizeVmlDrawing();
lclUpdateProgressBar( mxFinalProgress, 1.0 );
// reset current sheet index in global data
@@ -1217,12 +1212,11 @@ void WorksheetData::finalizeHyperlink( const CellAddress& rAddress, const OUStri
// #i54261# restrict creation of URL field to text cells
case ::com::sun::star::table::CellContentType_TEXT:
{
- Reference< XMultiServiceFactory > xFactory( getDocument(), UNO_QUERY );
Reference< XText > xText( xCell, UNO_QUERY );
- if( xFactory.is() && xText.is() )
+ if( xText.is() )
{
// create a URL field object and set its properties
- Reference< XTextContent > xUrlField( xFactory->createInstance( maUrlTextField ), UNO_QUERY );
+ Reference< XTextContent > xUrlField( getDocumentFactory()->createInstance( maUrlTextField ), UNO_QUERY );
OSL_ENSURE( xUrlField.is(), "WorksheetData::finalizeHyperlink - cannot create text field" );
if( xUrlField.is() )
{
@@ -1412,6 +1406,14 @@ void WorksheetData::finalizeDrawing()
}
}
+void WorksheetData::finalizeVmlDrawing()
+{
+ OSL_ENSURE( (getFilterType() == FILTER_OOX) || (maVmlDrawingPath.getLength() == 0),
+ "WorksheetData::finalizeVmlDrawing - unexpected VML path" );
+ if( (getFilterType() == FILTER_OOX) && (maVmlDrawingPath.getLength() > 0) )
+ importOoxFragment( new OoxVmlDrawingFragment( *this, maVmlDrawingPath ) );
+}
+
void WorksheetData::convertColumns()
{
sal_Int32 nNextCol = 0;
@@ -1717,6 +1719,11 @@ Reference< XTableRows > WorksheetHelper::getRows( sal_Int32 nFirstRow, sal_Int32
return mrSheetData.getRows( nFirstRow, nLastRow );
}
+Reference< XDrawPage > WorksheetHelper::getDrawPage() const
+{
+ return mrSheetData.getDrawPage();
+}
+
Point WorksheetHelper::getCellPosition( sal_Int32 nCol, sal_Int32 nRow ) const
{
return mrSheetData.getCellPosition( nCol, nRow );
@@ -1762,6 +1769,11 @@ SheetViewSettings& WorksheetHelper::getSheetViewSettings() const
return mrSheetData.getSheetViewSettings();
}
+VmlDrawing& WorksheetHelper::getVmlDrawing() const
+{
+ return mrSheetData.getVmlDrawing();
+}
+
void WorksheetHelper::setStringCell( const Reference< XCell >& rxCell, const OUString& rText ) const
{
OSL_ENSURE( rxCell.is(), "WorksheetHelper::setStringCell - missing cell interface" );
@@ -2003,16 +2015,6 @@ void WorksheetHelper::setVmlDrawingPath( const OUString& rVmlDrawingPath )
mrSheetData.setVmlDrawingPath( rVmlDrawingPath );
}
-void WorksheetHelper::setOleObject( const OleObjectModel& rModel )
-{
- mrSheetData.setOleObject( rModel );
-}
-
-void WorksheetHelper::setFormControl( const FormControlModel& rModel )
-{
- mrSheetData.setFormControl( rModel );
-}
-
void WorksheetHelper::setBaseColumnWidth( sal_Int32 nWidth )
{
mrSheetData.setBaseColumnWidth( nWidth );