[Libreoffice-commits] core.git: sc/source unusedcode.easy
Caolán McNamara
caolanm at redhat.com
Thu Nov 13 08:09:16 PST 2014
sc/source/filter/inc/drawingmanager.hxx | 89 ----------
sc/source/filter/oox/drawingmanager.cxx | 266 --------------------------------
unusedcode.easy | 1
3 files changed, 356 deletions(-)
New commits:
commit 18eab4c154eb033e8751c85df3b170a3946e3a20
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Nov 13 11:05:37 2014 +0000
callcatcher: BiffDrawingObjectBase is never constructed
which has a bunch of related knock-on effects given that logic.
Change-Id: Ib245af1005e37464e1a782018d88b379300641a2
diff --git a/sc/source/filter/inc/drawingmanager.hxx b/sc/source/filter/inc/drawingmanager.hxx
index 6ea03c9..c9a50fa 100644
--- a/sc/source/filter/inc/drawingmanager.hxx
+++ b/sc/source/filter/inc/drawingmanager.hxx
@@ -62,89 +62,6 @@ struct BiffObjFillModel
// BIFF drawing objects
class BiffDrawingBase;
-class BiffDrawingObjectBase;
-typedef ::boost::shared_ptr< BiffDrawingObjectBase > BiffDrawingObjectRef;
-
-class BiffDrawingObjectContainer
-{
-public:
- explicit BiffDrawingObjectContainer();
-
- /** Returns true, if the object list is empty. */
- inline bool empty() const { return maObjects.empty(); }
-
- /** Creates and inserts all UNO shapes into the passed shape container. */
- void convertAndInsert( BiffDrawingBase& rDrawing,
- const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
- const ::com::sun::star::awt::Rectangle* pParentRect = 0 ) const;
-
-private:
- typedef RefVector< BiffDrawingObjectBase > BiffDrawingObjectVector;
- BiffDrawingObjectVector maObjects;
-};
-
-/** Base class for all BIFF drawing objects (OBJ records). */
-class BiffDrawingObjectBase : public WorksheetHelper
-{
-public:
- explicit BiffDrawingObjectBase( const WorksheetHelper& rHelper );
- virtual ~BiffDrawingObjectBase();
-
- /** Sets whether this is an area object (then its width and height must be greater than 0). */
- inline void setAreaObj( bool bAreaObj ) { mbAreaObj = bAreaObj; }
- /** If set to true, the object supports a simple on-click macro and/or hyperlink. */
- inline void setSimpleMacro( bool bMacro ) { mbSimpleMacro = bMacro; }
-
- /** If set to false, the UNO shape will not be created, processed, or inserted into the draw page. */
- inline void setProcessShape( bool bProcess ) { mbProcessShape = bProcess; }
- /** If set to false, the UNO shape will be created or processed, but not be inserted into the draw page. */
- inline void setInsertShape( bool bInsert ) { mbInsertShape = bInsert; }
- /** If set to true, a new custom UNO shape will be created while in DFF import (BIFF8 only). */
- inline void setCustomDffObj( bool bCustom ) { mbCustomDff = bCustom; }
-
- /** Returns the object identifier from the OBJ record. */
- inline sal_uInt16 getObjId() const { return mnObjId; }
- /** Returns the object type from the OBJ record. */
- inline sal_uInt16 getObjType() const { return mnObjType; }
-
- /** Returns true, if the object is hidden. */
- inline bool isHidden() const { return mbHidden; }
- /** Returns true, if the object is visible. */
- inline bool isVisible() const { return mbVisible; }
- /** Returns true, if the object is printable. */
- inline bool isPrintable() const { return mbPrintable; }
-
- /** Creates the UNO shape and inserts it into the passed shape container. */
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
- convertAndInsert( BiffDrawingBase& rDrawing,
- const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
- const ::com::sun::star::awt::Rectangle* pParentRect = 0 ) const;
-
-protected:
- /** Converts the passed line formatting to the passed property map. */
- void convertLineProperties( ::oox::drawingml::ShapePropertyMap& rPropMap, const BiffObjLineModel& rLineModel, sal_uInt16 nArrows = 0 ) const;
- /** Converts the passed fill formatting to the passed property map. */
- void convertFillProperties( ::oox::drawingml::ShapePropertyMap& rPropMap, const BiffObjFillModel& rFillModel ) const;
-
- /** Derived classes create the corresponding XShape and insert it into the passed container. */
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
- implConvertAndInsert( BiffDrawingBase& rDrawing,
- const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
- const ::com::sun::star::awt::Rectangle& rShapeRect ) const = 0;
-
-private:
- ShapeAnchor maAnchor; /// Position of the drawing object.
- sal_uInt16 mnObjId; /// The object identifier (unique per drawing).
- sal_uInt16 mnObjType; /// The object type from OBJ record.
- bool mbHidden; /// True = object is hidden.
- bool mbVisible; /// True = object is visible (form controls).
- bool mbPrintable; /// True = object is printable.
- bool mbAreaObj; /// True = width and height must be greater than 0.
- bool mbSimpleMacro; /// True = create simple macro link and hyperlink.
- bool mbProcessShape; /// True = object is valid, do processing and insertion.
- bool mbInsertShape; /// True = insert the UNO shape into the draw page.
- bool mbCustomDff; /// True = recreate UNO shape in DFF import (BIFF8 only).
-};
// BIFF drawing page
@@ -181,14 +98,8 @@ public:
const ::com::sun::star::awt::Rectangle& rShapeRect ) = 0;
private:
- typedef RefMap< sal_uInt16, BiffDrawingObjectBase > BiffDrawingObjectMapById;
- typedef ::std::vector< sal_uInt16 > BiffObjIdVector;
-
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >
mxDrawPage; /// UNO draw page used to insert the shapes.
- BiffDrawingObjectContainer maRawObjs; /// Drawing objects without DFF data.
- BiffDrawingObjectMapById maObjMapId; /// Maps drawing objects by their object identifiers.
- BiffObjIdVector maSkipObjs; /// Identifiers of all objects to be skipped.
};
/** Drawing manager of a single sheet. */
diff --git a/sc/source/filter/oox/drawingmanager.cxx b/sc/source/filter/oox/drawingmanager.cxx
index 90b6310..d6804e4 100644
--- a/sc/source/filter/oox/drawingmanager.cxx
+++ b/sc/source/filter/oox/drawingmanager.cxx
@@ -103,265 +103,7 @@ BiffObjFillModel::BiffObjFillModel() :
{
}
-// BIFF drawing objects
-
-BiffDrawingObjectContainer::BiffDrawingObjectContainer()
-{
-}
-
-void BiffDrawingObjectContainer::convertAndInsert( BiffDrawingBase& rDrawing, const Reference< XShapes >& rxShapes, const css::awt::Rectangle* pParentRect ) const
-{
- maObjects.forEachMem( &BiffDrawingObjectBase::convertAndInsert, ::boost::ref( rDrawing ), ::boost::cref( rxShapes ), pParentRect );
-}
-
-BiffDrawingObjectBase::BiffDrawingObjectBase( const WorksheetHelper& rHelper ) :
- WorksheetHelper( rHelper ),
- maAnchor( rHelper ),
- mnObjId( BIFF_OBJ_INVALID_ID ),
- mnObjType( BIFF_OBJTYPE_UNKNOWN ),
- mbHidden( false ),
- mbVisible( true ),
- mbPrintable( true ),
- mbAreaObj( false ),
- mbSimpleMacro( true ),
- mbProcessShape( true ),
- mbInsertShape( true ),
- mbCustomDff( false )
-{
-}
-
-BiffDrawingObjectBase::~BiffDrawingObjectBase()
-{
-}
-
-Reference< XShape > BiffDrawingObjectBase::convertAndInsert( BiffDrawingBase& rDrawing,
- const Reference< XShapes >& rxShapes, const css::awt::Rectangle* pParentRect ) const
-{
- Reference< XShape > xShape;
- if( rxShapes.is() && mbProcessShape && !mbHidden ) // TODO: support for hidden objects?
- {
- // base class 'ShapeAnchor' calculates the shape rectangle in 1/100 mm
- // in BIFF3-BIFF5, all shapes have absolute anchor (also children of group shapes)
- css::awt::Rectangle aShapeRect = maAnchor.calcAnchorRectHmm( getDrawPageSize() );
-
- // convert the shape, if the calculated rectangle is not empty
- bool bHasWidth = aShapeRect.Width > 0;
- bool bHasHeight = aShapeRect.Height > 0;
- if( mbAreaObj ? (bHasWidth && bHasHeight) : (bHasWidth || bHasHeight) )
- {
- xShape = implConvertAndInsert( rDrawing, rxShapes, aShapeRect );
- /* Notify the drawing that a new shape has been inserted (but not
- for children of group shapes). For convenience, pass the
- rectangle that contains position and size of the shape. */
- if( !pParentRect && xShape.is() )
- rDrawing.notifyShapeInserted( xShape, aShapeRect );
- }
- }
- return xShape;
-}
-
-void BiffDrawingObjectBase::convertLineProperties( ShapePropertyMap& rPropMap, const BiffObjLineModel& rLineModel, sal_uInt16 nArrows ) const
-{
- if( rLineModel.mbAuto )
- {
- BiffObjLineModel aAutoModel;
- aAutoModel.mbAuto = false;
- convertLineProperties( rPropMap, aAutoModel, nArrows );
- return;
- }
-
- /* Convert line formatting to DrawingML line formatting and let the
- DrawingML code do the hard work. */
- LineProperties aLineProps;
-
- if( rLineModel.mnStyle == BIFF_OBJ_LINE_NONE )
- {
- aLineProps.maLineFill.moFillType = XML_noFill;
- }
- else
- {
- aLineProps.maLineFill.moFillType = XML_solidFill;
- aLineProps.maLineFill.maFillColor.setPaletteClr( rLineModel.mnColorIdx );
- aLineProps.moLineCompound = XML_sng;
- aLineProps.moLineCap = XML_flat;
- aLineProps.moLineJoint = XML_round;
-
- // line width: use 0.35 mm per BIFF line width step
- sal_Int32 nLineWidth = 0;
- switch( rLineModel.mnWidth )
- {
- default:
- case BIFF_OBJ_LINE_HAIR: nLineWidth = 0; break;
- case BIFF_OBJ_LINE_THIN: nLineWidth = 20; break;
- case BIFF_OBJ_LINE_MEDIUM: nLineWidth = 40; break;
- case BIFF_OBJ_LINE_THICK: nLineWidth = 60; break;
- }
- aLineProps.moLineWidth = getLimitedValue< sal_Int32, sal_Int64 >( convertHmmToEmu( nLineWidth ), 0, SAL_MAX_INT32 );
-
- // dash style and transparency
- switch( rLineModel.mnStyle )
- {
- default:
- case BIFF_OBJ_LINE_SOLID:
- aLineProps.moPresetDash = XML_solid;
- break;
- case BIFF_OBJ_LINE_DASH:
- aLineProps.moPresetDash = XML_lgDash;
- break;
- case BIFF_OBJ_LINE_DOT:
- aLineProps.moPresetDash = XML_dot;
- break;
- case BIFF_OBJ_LINE_DASHDOT:
- aLineProps.moPresetDash = XML_lgDashDot;
- break;
- case BIFF_OBJ_LINE_DASHDOTDOT:
- aLineProps.moPresetDash = XML_lgDashDotDot;
- break;
- case BIFF_OBJ_LINE_MEDTRANS:
- aLineProps.moPresetDash = XML_solid;
- aLineProps.maLineFill.maFillColor.addTransformation( XML_alpha, 50 * PER_PERCENT );
- break;
- case BIFF_OBJ_LINE_DARKTRANS:
- aLineProps.moPresetDash = XML_solid;
- aLineProps.maLineFill.maFillColor.addTransformation( XML_alpha, 75 * PER_PERCENT );
- break;
- case BIFF_OBJ_LINE_LIGHTTRANS:
- aLineProps.moPresetDash = XML_solid;
- aLineProps.maLineFill.maFillColor.addTransformation( XML_alpha, 25 * PER_PERCENT );
- break;
- }
-
- // line ends
- bool bLineStart = false;
- bool bArrow = false;
- bool bFilled = false;
- switch( extractValue< sal_uInt8 >( nArrows, 0, 4 ) )
- {
- case BIFF_OBJ_ARROW_OPEN: bLineStart = false; bArrow = true; bFilled = false; break;
- case BIFF_OBJ_ARROW_OPENBOTH: bLineStart = true; bArrow = true; bFilled = false; break;
- case BIFF_OBJ_ARROW_FILLED: bLineStart = false; bArrow = true; bFilled = true; break;
- case BIFF_OBJ_ARROW_FILLEDBOTH: bLineStart = true; bArrow = true; bFilled = true; break;
- }
- if (bArrow)
- {
- // arrow type (open or closed)
- sal_Int32 nArrowType = bFilled ? XML_triangle : XML_arrow;
- aLineProps.maEndArrow.moArrowType = nArrowType;
- aLineProps.maStartArrow.moArrowType = bLineStart ? nArrowType : XML_none;
-
- // arrow width
- sal_Int32 nArrowWidth = XML_med;
- switch( extractValue< sal_uInt8 >( nArrows, 4, 4 ) )
- {
- case BIFF_OBJ_ARROW_NARROW: nArrowWidth = XML_sm; break;
- case BIFF_OBJ_ARROW_MEDIUM: nArrowWidth = XML_med; break;
- case BIFF_OBJ_ARROW_WIDE: nArrowWidth = XML_lg; break;
- }
- aLineProps.maStartArrow.moArrowWidth = aLineProps.maEndArrow.moArrowWidth = nArrowWidth;
-
- // arrow length
- sal_Int32 nArrowLength = XML_med;
- switch( extractValue< sal_uInt8 >( nArrows, 8, 4 ) )
- {
- case BIFF_OBJ_ARROW_NARROW: nArrowLength = XML_sm; break;
- case BIFF_OBJ_ARROW_MEDIUM: nArrowLength = XML_med; break;
- case BIFF_OBJ_ARROW_WIDE: nArrowLength = XML_lg; break;
- }
- aLineProps.maStartArrow.moArrowLength = aLineProps.maEndArrow.moArrowLength = nArrowLength;
- }
- }
-
- aLineProps.pushToPropMap( rPropMap, getBaseFilter().getGraphicHelper() );
-}
-
-void BiffDrawingObjectBase::convertFillProperties( ShapePropertyMap& rPropMap, const BiffObjFillModel& rFillModel ) const
-{
- if( rFillModel.mbAuto )
- {
- BiffObjFillModel aAutoModel;
- aAutoModel.mbAuto = false;
- convertFillProperties( rPropMap, aAutoModel );
- return;
- }
-
- /* Convert fill formatting to DrawingML fill formatting and let the
- DrawingML code do the hard work. */
- FillProperties aFillProps;
-
- if( rFillModel.mnPattern == BIFF_OBJ_PATT_NONE )
- {
- aFillProps.moFillType = XML_noFill;
- }
- else
- {
- const sal_Int32 spnPatternPresets[] = {
- XML_TOKEN_INVALID, XML_TOKEN_INVALID, XML_pct50, XML_pct50, XML_pct25,
- XML_dkHorz, XML_dkVert, XML_dkDnDiag, XML_dkUpDiag, XML_smCheck, XML_trellis,
- XML_ltHorz, XML_ltVert, XML_ltDnDiag, XML_ltUpDiag, XML_smGrid, XML_diagCross,
- XML_pct20, XML_pct10 };
- sal_Int32 nPatternPreset = STATIC_ARRAY_SELECT( spnPatternPresets, rFillModel.mnPattern, XML_TOKEN_INVALID );
- if( nPatternPreset == XML_TOKEN_INVALID )
- {
- aFillProps.moFillType = XML_solidFill;
- aFillProps.maFillColor.setPaletteClr( rFillModel.mnPattColorIdx );
- }
- else
- {
- aFillProps.moFillType = XML_pattFill;
- aFillProps.maPatternProps.maPattFgColor.setPaletteClr( rFillModel.mnPattColorIdx );
- aFillProps.maPatternProps.maPattBgColor.setPaletteClr( rFillModel.mnBackColorIdx );
- aFillProps.maPatternProps.moPattPreset = nPatternPreset;
- }
-#if 0
- static const sal_uInt8 sppnPatterns[][ 8 ] =
- {
- { 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55 },
- { 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD },
- { 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22 },
- { 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00 },
- { 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC },
- { 0x33, 0x66, 0xCC, 0x99, 0x33, 0x66, 0xCC, 0x99 },
- { 0xCC, 0x66, 0x33, 0x99, 0xCC, 0x66, 0x33, 0x99 },
- { 0xCC, 0xCC, 0x33, 0x33, 0xCC, 0xCC, 0x33, 0x33 },
- { 0xCC, 0xFF, 0x33, 0xFF, 0xCC, 0xFF, 0x33, 0xFF },
- { 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00 },
- { 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88 },
- { 0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88 },
- { 0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11 },
- { 0xFF, 0x11, 0x11, 0x11, 0xFF, 0x11, 0x11, 0x11 },
- { 0xAA, 0x44, 0xAA, 0x11, 0xAA, 0x44, 0xAA, 0x11 },
- { 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 },
- { 0x80, 0x00, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00 }
- };
- const sal_uInt8* const pnPattern = sppnPatterns[ ::std::min< size_t >( rFillData.mnPattern - 2, SAL_N_ELEMENTS( sppnPatterns ) ) ];
- // create 2-colored 8x8 DIB
- SvMemoryStream aMemStrm;
-// { 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00 }
- aMemStrm << sal_uInt32( 12 ) << sal_Int16( 8 ) << sal_Int16( 8 ) << sal_uInt16( 1 ) << sal_uInt16( 1 );
- aMemStrm << sal_uInt8( 0xFF ) << sal_uInt8( 0xFF ) << sal_uInt8( 0xFF );
- aMemStrm << sal_uInt8( 0x00 ) << sal_uInt8( 0x00 ) << sal_uInt8( 0x00 );
- for( size_t nIdx = 0; nIdx < 8; ++nIdx )
- aMemStrm << sal_uInt32( pnPattern[ nIdx ] ); // 32-bit little-endian
- aMemStrm.Seek( STREAM_SEEK_TO_BEGIN );
- Bitmap aBitmap;
- aBitmap.Read( aMemStrm, FALSE );
- XOBitmap aXOBitmap( aBitmap );
- aXOBitmap.Bitmap2Array();
- aXOBitmap.SetBitmapType( XBITMAP_8X8 );
- if( aXOBitmap.GetBackgroundColor().GetColor() == COL_BLACK )
- ::std::swap( aPattColor, aBackColor );
- aXOBitmap.SetPixelColor( aPattColor );
- aXOBitmap.SetBackgroundColor( aBackColor );
- rSdrObj.SetMergedItem( XFillStyleItem( XFILL_BITMAP ) );
- rSdrObj.SetMergedItem( XFillBitmapItem( EMPTY_OUSTRING, aXOBitmap ) );
-#endif
- }
-
- aFillProps.pushToPropMap( rPropMap, getBaseFilter().getGraphicHelper() );
-}
-
// BIFF drawing page
-
BiffDrawingBase::BiffDrawingBase( const WorksheetHelper& rHelper, const Reference< XDrawPage >& rxDrawPage ) :
WorksheetHelper( rHelper ),
mxDrawPage( rxDrawPage )
@@ -374,14 +116,6 @@ void BiffDrawingBase::finalizeImport()
OSL_ENSURE( xShapes.is(), "BiffDrawingBase::finalizeImport - no shapes container" );
if( !xShapes.is() )
return;
-
- // process list of objects to be skipped
- for( BiffObjIdVector::const_iterator aIt = maSkipObjs.begin(), aEnd = maSkipObjs.end(); aIt != aEnd; ++aIt )
- if( BiffDrawingObjectBase* pDrawingObj = maObjMapId.get( *aIt ).get() )
- pDrawingObj->setProcessShape( false );
-
- // process drawing objects without DFF data
- maRawObjs.convertAndInsert( *this, xShapes );
}
BiffSheetDrawing::BiffSheetDrawing( const WorksheetHelper& rHelper ) :
diff --git a/unusedcode.easy b/unusedcode.easy
index 58bd4f8..2dd6df1 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -184,7 +184,6 @@ connectivity::sdbcx::OGroup::OGroup(rtl::OUString const&, bool)
oglcanvas::CanvasHelper::flush() const
oglcanvas::TextLayout::draw(com::sun::star::rendering::ViewState const&, com::sun::star::rendering::RenderState const&, com::sun::star::uno::Reference<com::sun::star::rendering::XGraphicDevice> const&) const
oox::drawingml::TextListStyle::dump() const
-oox::xls::BiffDrawingObjectBase::BiffDrawingObjectBase(oox::xls::WorksheetHelper const&)
sc::CLBuildKernelThread::CLBuildKernelThread()
sc::CLBuildKernelThread::consume()
sc::CLBuildKernelThread::finish()
More information about the Libreoffice-commits
mailing list