[Libreoffice-commits] .: 2 commits - oox/source sc/source
Noel Power
noelp at kemper.freedesktop.org
Mon Jun 4 10:05:50 PDT 2012
oox/source/token/properties.txt | 1
sc/source/filter/inc/drawingbase.hxx | 4 -
sc/source/filter/oox/drawingbase.cxx | 28 -------------
sc/source/filter/oox/drawingfragment.cxx | 3 -
sc/source/filter/oox/sheetdatabuffer.cxx | 2
sc/source/filter/oox/worksheethelper.cxx | 18 --------
sc/source/ui/unoobj/docuno.cxx | 64 -------------------------------
7 files changed, 2 insertions(+), 118 deletions(-)
New commits:
commit 764752f5d85cb7c86ad21340dfdda4b62754790c
Author: Noel Power <noel.power at novell.com>
Date: Mon Jun 4 18:00:36 2012 +0100
better import xlsx heights
don't call UpdateAllRowHeights when IsAdjustHeightEnabled property is set and additionally set manual heights for *all* imported row heights ( same afaics xls import does ) - certainly this improves import ( also see documents attached in i#94028, i#93609 )
Change-Id: Id8aff727587ed4fa19fd0897aaf25b2202737084
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx
index 6d4e305..2a04f8a 100644
--- a/sc/source/filter/oox/sheetdatabuffer.cxx
+++ b/sc/source/filter/oox/sheetdatabuffer.cxx
@@ -793,8 +793,6 @@ void SheetDataBuffer::applyCellMerging( const CellRangeAddress& rRange )
{
if( const EditTextObject* pEditObj = static_cast< const ScEditCell* >( rDoc.GetCell( rStart ) )->GetData() )
bTextWrap = pEditObj->GetParagraphCount() > 1;
- if( bTextWrap )
- setManualRowHeight( rStart.Row() );
}
}
}
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index 43c1b33..48dc7d6 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -342,8 +342,6 @@ public:
@descr Row default formatting is converted directly, other settings
are cached and converted in the finalizeImport() call. */
void setRowModel( const RowModel& rModel );
- /** Specifies that the passed row needs to set its height manually. */
- void setManualRowHeight( sal_Int32 nRow );
/** Initial conversion before importing the worksheet. */
void initializeWorksheetImport();
@@ -401,7 +399,6 @@ private:
RowModelRangeMap maRowModels; /// Ranges of rows sorted by first row index.
HyperlinkModelList maHyperlinks; /// Cell ranges containing hyperlinks.
ValidationModelList maValidations; /// Cell ranges containing data validation settings.
- ValueRangeSet maManualRowHeights; /// Rows that need manual height independent from own settings.
SheetDataBuffer maSheetData; /// Buffer for cell contents and cell formatting.
CondFormatBuffer maCondFormats; /// Buffer for conditional formatting.
CommentsBuffer maComments; /// Buffer for all cell comments in this sheet.
@@ -938,11 +935,6 @@ void WorksheetGlobals::setRowModel( const RowModel& rModel )
lclUpdateProgressBar( mxRowProgress, maUsedArea, nRow );
}
-void WorksheetGlobals::setManualRowHeight( sal_Int32 nRow )
-{
- maManualRowHeights.insert( nRow );
-}
-
void WorksheetGlobals::initializeWorksheetImport()
{
// set default cell style for unused cells
@@ -1236,10 +1228,7 @@ void WorksheetGlobals::convertRows( OutlineLevelVec& orRowLevels,
custom height, otherwise get all rows specified in the class member
maManualRowHeights that are inside the passed row model. */
ValueRangeVector aManualRows;
- if( rModel.mbCustomHeight )
- aManualRows.push_back( rRowRange );
- else
- aManualRows = maManualRowHeights.getIntersection( rRowRange );
+ aManualRows.push_back( rRowRange );
for( ValueRangeVector::const_iterator aIt = aManualRows.begin(), aEnd = aManualRows.end(); aIt != aEnd; ++aIt )
{
PropertySet aPropSet( getRows( *aIt ) );
@@ -1551,11 +1540,6 @@ void WorksheetHelper::setRowModel( const RowModel& rModel )
mrSheetGlob.setRowModel( rModel );
}
-void WorksheetHelper::setManualRowHeight( sal_Int32 nRow )
-{
- mrSheetGlob.setManualRowHeight( nRow );
-}
-
void WorksheetHelper::putValue( const CellAddress& rAddress, double fValue ) const
{
ScAddress aAddress;
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index a7589d8..2220e2d 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1683,11 +1683,7 @@ void SAL_CALL ScModelObj::setPropertyValue(
bool bOldAdjustHeightEnabled = pDoc->IsAdjustHeightEnabled();
bool bAdjustHeightEnabled = ScUnoHelpFunctions::GetBoolFromAny( aValue );
if( bOldAdjustHeightEnabled != bAdjustHeightEnabled )
- {
pDoc->EnableAdjustHeight( bAdjustHeightEnabled );
- if( bAdjustHeightEnabled )
- pDocShell->UpdateAllRowHeights();
- }
}
else if ( aString.EqualsAscii( SC_UNO_ISEXECUTELINKENABLED ) )
{
commit d59a707f6e9308c2b89ebf4e71693175c37b7ed6
Author: Noel Power <noel.power at novell.com>
Date: Mon Jun 4 14:49:31 2012 +0100
remove anchor to cell shape (re)position hack
this change manaully reverts c07e9299bb2c8d5477669568b12708bd2ff12684 & 4908c16a73b397f83c327789f113658c1ea4d904
Change-Id: Ia8656631f84709430c8e94e8d9dfa961e81d5746
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 7330203..f2442e6 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -9,7 +9,6 @@ AdjustLuminance
AdjustmentValues
Address
Align
-Anchor
AnchorPosition
ApplyFormDesignMode
AreaLinks
diff --git a/sc/source/filter/inc/drawingbase.hxx b/sc/source/filter/inc/drawingbase.hxx
index 339d1b5..9da0985 100644
--- a/sc/source/filter/inc/drawingbase.hxx
+++ b/sc/source/filter/inc/drawingbase.hxx
@@ -109,10 +109,6 @@ public:
/** Calculates the resulting shape anchor in 1/100 mm. */
::com::sun::star::awt::Rectangle calcAnchorRectHmm(
const ::com::sun::star::awt::Size& rPageSizeHmm ) const;
- /** Returns the 'from' cell if it exists */
- ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > getFromCell() const;
- /** Applies Cell Anchor to an XShape if needed*/
- void applyToXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& rxShape );
private:
/** Converts the passed anchor to an absolute position in EMUs. */
::oox::drawingml::EmuPoint calcCellAnchorEmu( const CellAnchorModel& rModel ) const;
diff --git a/sc/source/filter/oox/drawingbase.cxx b/sc/source/filter/oox/drawingbase.cxx
index 1cf511c..98b61a2 100644
--- a/sc/source/filter/oox/drawingbase.cxx
+++ b/sc/source/filter/oox/drawingbase.cxx
@@ -266,34 +266,6 @@ Rectangle ShapeAnchor::calcAnchorRectHmm( const Size& rPageSizeHmm ) const
return Rectangle( lclEmuToHmm( aAnchorRect.X ), lclEmuToHmm( aAnchorRect.Y ), lclEmuToHmm( aAnchorRect.Width ), lclEmuToHmm( aAnchorRect.Height ) );
}
-::com::sun::star::uno::Reference< ::com::sun::star::table::XCell >
-ShapeAnchor::getFromCell() const
-{
- CellAddress aAddress;
- aAddress.Sheet = getSheetIndex();
- aAddress.Row = maFrom.mnRow;
- aAddress.Column = maFrom.mnCol;
- return getCell( aAddress );
-}
-
-void
-ShapeAnchor::applyToXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& rxShape )
-{
- if ( ( meAnchorType == ANCHOR_TWOCELL || meAnchorType == ANCHOR_ONECELL ) && getFromCell().is() )
- {
- PropertySet aShapeProp( rxShape );
- aShapeProp.setProperty( PROP_Anchor, getFromCell() );
- CellAnchorModel offSets;
- offSets.mnColOffset = maFrom.mnColOffset;
- offSets.mnRowOffset = maFrom.mnRowOffset;
- EmuPoint aPos = calcCellAnchorEmu( offSets );
- aShapeProp.setProperty( PROP_HoriOrientPosition, lclEmuToHmm( aPos.X ) );
- aShapeProp.setProperty( PROP_VertOrientPosition, lclEmuToHmm( aPos.Y ) );
- }
-}
-
-// private --------------------------------------------------------------------
-
EmuPoint ShapeAnchor::calcCellAnchorEmu( const CellAnchorModel& rModel ) const
{
// calculate position of top-left edge of the cell
diff --git a/sc/source/filter/oox/drawingfragment.cxx b/sc/source/filter/oox/drawingfragment.cxx
index 9b7d07a..73e6b47 100644
--- a/sc/source/filter/oox/drawingfragment.cxx
+++ b/sc/source/filter/oox/drawingfragment.cxx
@@ -277,8 +277,7 @@ void DrawingFragment::onEndElement()
basegfx::B2DHomMatrix aTransformation;
mxShape->addShape( getOoxFilter(), &getTheme(), mxDrawPage, aTransformation, &aShapeRectEmu32 );
- // apply Cell anchoring if necessary
- mxAnchor->applyToXShape( mxShape->getXShape() );
+
/* Collect all shape positions in the WorksheetHelper base
class. But first, scale EMUs to 1/100 mm. */
Rectangle aShapeRectHmm(
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index a1e7a1e..a7589d8 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -194,55 +194,6 @@ const SfxItemPropertyMapEntry* lcl_GetRowsPropertyMap()
return aRowsPropertyMap_Impl;
}
-struct OrientationInfo
-{
- OrientationInfo() : mnVert( 0 ), mnHori( 0 ) {}
- uno::Reference< beans::XPropertySet > mxShape;
- sal_Int32 mnVert;
- sal_Int32 mnHori;
-};
-
-void lcl_captureShapeOrientationInfo( std::vector< OrientationInfo >& infos, ScModelObj& rModel )
-{
- rtl::OUString sHori( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_HORIPOS ) );
- rtl::OUString sVert( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_VERTPOS ) );
-
- uno::Reference<container::XIndexAccess> xPages( rModel.getDrawPages(), uno::UNO_QUERY );
- if ( xPages.is() )
- {
- for ( sal_Int32 nIndex = 0, nPages = xPages->getCount(); nIndex < nPages; ++nIndex )
- {
- uno::Reference<container::XIndexAccess> xShapes( xPages->getByIndex( nIndex ), uno::UNO_QUERY );
- for ( sal_Int32 nShapeIndex = 0, nShapes = xShapes->getCount(); nShapeIndex < nShapes; ++nShapeIndex )
- {
- uno::Reference< beans::XPropertySet > xShape( xShapes->getByIndex( nShapeIndex ), uno::UNO_QUERY );
- uno::Reference< table::XCell > xCell( xShape->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_ANCHOR ) ) ), uno::UNO_QUERY );
- // only capture orientation if the shape is anchored to cell
- if ( xShape.is() && xCell.is() )
- {
- uno::Reference< beans::XPropertySetInfo > xPropInfo = xShape->getPropertySetInfo();
- if ( xPropInfo.is() && xPropInfo->hasPropertyByName( sHori ) && xPropInfo->hasPropertyByName( sVert ) )
- {
- OrientationInfo aShape;
- aShape.mxShape = xShape;
- xShape->getPropertyValue( sHori ) >>= aShape.mnHori;
- xShape->getPropertyValue( sVert ) >>= aShape.mnVert;
- infos.push_back( aShape );
- }
- }
- }
- }
- }
-}
-
-void lcl_applyShapeOrientationInfo( std::vector< OrientationInfo >& infos )
-{
- for ( std::vector< OrientationInfo >::iterator it = infos.begin(), it_end = infos.end(); it != it_end; ++it )
- {
- it->mxShape->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_HORIPOS ) ), uno::makeAny( it->mnHori ) );
- it->mxShape->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SC_UNONAME_VERTPOS ) ), uno::makeAny( it->mnVert ) );
- }
-}
using sc::HMMToTwips;
using sc::TwipsToHMM;
@@ -1735,18 +1686,7 @@ void SAL_CALL ScModelObj::setPropertyValue(
{
pDoc->EnableAdjustHeight( bAdjustHeightEnabled );
if( bAdjustHeightEnabled )
- {
- // during import ( e.g. oox ) shapes anchored by cell lose
- // any additional Hori/Vert orientation ( which offsets the
- // shape position relative to the cell ) when
- // UpdateAllRowHeights is called. Save Hori/Vert values
- // before calling UpdateAllRowHeights and re-apply them
- // after
- std::vector< OrientationInfo > savedOrientations;
- lcl_captureShapeOrientationInfo( savedOrientations, *this );
pDocShell->UpdateAllRowHeights();
- lcl_applyShapeOrientationInfo( savedOrientations );
- }
}
}
else if ( aString.EqualsAscii( SC_UNO_ISEXECUTELINKENABLED ) )
More information about the Libreoffice-commits
mailing list