summaryrefslogtreecommitdiff
path: root/sc/source/filter/xml
diff options
context:
space:
mode:
authorSascha Ballach <sab@openoffice.org>2001-04-05 14:55:29 +0000
committerSascha Ballach <sab@openoffice.org>2001-04-05 14:55:29 +0000
commit09f04fb53406f6ba3bb5d8bcfa1f220c12f9c09c (patch)
tree043e3d742ba7d61d3b323859272714bb19d8ae6e /sc/source/filter/xml
parent07495068375e2e68aaf9645ccd69c5c25e08f48d (diff)
#85774#; don't resize shapes when recalculating the row height and column width while importing xml and set the size self
Diffstat (limited to 'sc/source/filter/xml')
-rw-r--r--sc/source/filter/xml/XMLTableShapeImportHelper.cxx15
-rw-r--r--sc/source/filter/xml/XMLTableShapeResizer.cxx10
-rw-r--r--sc/source/filter/xml/XMLTableShapeResizer.hxx8
-rw-r--r--sc/source/filter/xml/xmlsubti.cxx26
-rw-r--r--sc/source/filter/xml/xmlsubti.hxx19
5 files changed, 45 insertions, 33 deletions
diff --git a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx
index 05150598ee6f..1b78301f6f24 100644
--- a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx
+++ b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLTableShapeImportHelper.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: sab $ $Date: 2001-03-20 16:19:41 $
+ * last change: $Author: sab $ $Date: 2001-04-05 15:55:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -124,8 +124,6 @@ void XMLTableShapeImportHelper::finishShape(
Rectangle* pRect = NULL;
sal_Int32 nEndX(-1);
sal_Int32 nEndY(-1);
- sal_Int32 nStartX(-1);
- sal_Int32 nStartY(-1);
sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
table::CellAddress aEndCell;
for( sal_Int16 i=0; i < nAttrCount; i++ )
@@ -139,10 +137,6 @@ void XMLTableShapeImportHelper::finishShape(
&aLocalName );
if(nPrefix = XML_NAMESPACE_TABLE)
{
- if (aLocalName.compareToAscii(sXML_x) ==0)
- static_cast<ScXMLImport&>(mrImporter).GetMM100UnitConverter().convertMeasure(nStartX, rValue);
- if (aLocalName.compareToAscii(sXML_y) ==0)
- static_cast<ScXMLImport&>(mrImporter).GetMM100UnitConverter().convertMeasure(nStartY, rValue);
if (aLocalName.compareToAscii(sXML_end_cell_address) == 0)
{
sal_Int32 nOffset(0);
@@ -171,10 +165,9 @@ void XMLTableShapeImportHelper::finishShape(
if (!bOnTable)
{
- if (nEndX >= 0 && nEndY >= 0 &&
- nStartX >= 0 && nStartY >= 0)
+ if (nEndX >= 0 && nEndY >= 0)
static_cast<ScXMLImport&>(mrImporter).GetTables().AddShape(rShape, aStartCell, aEndCell,
- nStartX, nStartY, nEndX, nEndY);
+ nEndX, nEndY);
else
DBG_ERROR("no or wrong position given");
SvxShape* pShapeImp = SvxShape::getImplementation(rShape);
diff --git a/sc/source/filter/xml/XMLTableShapeResizer.cxx b/sc/source/filter/xml/XMLTableShapeResizer.cxx
index 1ea444e43b60..6da68d14688a 100644
--- a/sc/source/filter/xml/XMLTableShapeResizer.cxx
+++ b/sc/source/filter/xml/XMLTableShapeResizer.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLTableShapeResizer.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: sab $ $Date: 2001-03-20 16:19:41 $
+ * last change: $Author: sab $ $Date: 2001-04-05 15:55:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -93,14 +93,12 @@ ScMyShapeResizer::~ScMyShapeResizer()
void ScMyShapeResizer::AddShape(uno::Reference <drawing::XShape>& rShape,
table::CellAddress& rStartAddress, table::CellAddress& rEndAddress,
- sal_Int32 nStartX, sal_Int32 nStartY, sal_Int32 nEndX, sal_Int32 nEndY)
+ sal_Int32 nEndX, sal_Int32 nEndY)
{
ScMyToResizeShape aShape;
aShape.xShape = rShape;
aShape.aEndCell = rEndAddress;
aShape.aStartCell = rStartAddress;
- aShape.nStartY = nStartY;
- aShape.nStartX = nStartX;
aShape.nEndY = nEndY;
aShape.nEndX = nEndX;
aShapes.push_back(aShape);
@@ -149,7 +147,7 @@ void ScMyShapeResizer::ResizeShapes(uno::Reference< sheet::XSpreadsheet > xSheet
sal_Int32 Y (nHeight - aItr->nEndY);
aItr->nEndX += pRect->Left();
Y = pRect->Bottom() - Y;
- awt::Point aPoint(aItr->nStartX, aItr->nStartY);// = aItr->xShape->getPosition();
+ awt::Point aPoint = aItr->xShape->getPosition();
awt::Size aSize = aItr->xShape->getSize();
aPoint.X += aRefPoint.X;
aPoint.Y += aRefPoint.Y;
diff --git a/sc/source/filter/xml/XMLTableShapeResizer.hxx b/sc/source/filter/xml/XMLTableShapeResizer.hxx
index f7d4e257094c..b371d9b7ceb0 100644
--- a/sc/source/filter/xml/XMLTableShapeResizer.hxx
+++ b/sc/source/filter/xml/XMLTableShapeResizer.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLTableShapeResizer.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: sab $ $Date: 2001-03-20 16:19:41 $
+ * last change: $Author: sab $ $Date: 2001-04-05 15:55:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -82,8 +82,6 @@ struct ScMyToResizeShape
com::sun::star::uno::Reference <com::sun::star::drawing::XShape> xShape;
com::sun::star::table::CellAddress aEndCell;
com::sun::star::table::CellAddress aStartCell;
- sal_Int32 nStartX;
- sal_Int32 nStartY;
sal_Int32 nEndX;
sal_Int32 nEndY;
};
@@ -101,7 +99,7 @@ public:
void AddShape(com::sun::star::uno::Reference <com::sun::star::drawing::XShape>& rShape,
com::sun::star::table::CellAddress& rStartAddress,
com::sun::star::table::CellAddress& rEndAddress,
- sal_Int32 nStartX, sal_Int32 nStartY, sal_Int32 nEndX, sal_Int32 nEndY);
+ sal_Int32 nEndX, sal_Int32 nEndY);
void ResizeShapes(::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > xSheet);
};
diff --git a/sc/source/filter/xml/xmlsubti.cxx b/sc/source/filter/xml/xmlsubti.cxx
index fa5a5781fc33..1c8c2e980d41 100644
--- a/sc/source/filter/xml/xmlsubti.cxx
+++ b/sc/source/filter/xml/xmlsubti.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlsubti.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: sab $ $Date: 2001-03-20 16:19:41 $
+ * last change: $Author: sab $ $Date: 2001-04-05 15:55:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,6 +77,9 @@
#ifndef _SC_XMLCONVERTER_HXX
#include "XMLConverter.hxx"
#endif
+#ifndef SC_DOCUNO_HXX
+#include "docuno.hxx"
+#endif
#include <xmloff/xmltkmap.hxx>
#include <xmloff/nmspmap.hxx>
@@ -213,7 +216,8 @@ ScMyTables::ScMyTables(ScXMLImport& rTempImport)
nCurrentSheet( -1 ),
nCurrentDrawPage( -1 ),
nCurrentXShapes( -1 ),
- aResizeShapes(rTempImport)
+ aResizeShapes(rTempImport),
+ aVDev()
{
aTableVec.resize(nDefaultTabCount, NULL);
}
@@ -636,6 +640,17 @@ void ScMyTables::NewTable(sal_Int32 nTempSpannedCols)
}
}
+void ScMyTables::UpdateRowHeights()
+{
+ // update automatic row heights
+ Point aLogic = aVDev.LogicToPixel( Point(1000,1000), MAP_TWIP );
+ double nPPTX = aLogic.X() / 1000.0;
+ double nPPTY = aLogic.Y() / 1000.0;
+ nPPTX /= ScModelObj::getImplementation(rImport.GetModel())->GetOutputFactor(); // needed for screen or VDev
+ Fraction aZoom(1,1);
+ rImport.GetDocument()->SetOptimalHeight( 0,MAXROW, nCurrentSheet,0, &aVDev, nPPTX,nPPTY, aZoom,aZoom, FALSE );
+}
+
void ScMyTables::DeleteTable()
{
if (nTableCount > 0)
@@ -657,6 +672,7 @@ void ScMyTables::DeleteTable()
xProtectable->protect(sKey);
}*/
}
+ UpdateRowHeights();
aResizeShapes.ResizeShapes(xCurrentSheet);
}
@@ -719,7 +735,7 @@ sal_Bool ScMyTables::HasXShapes()
void ScMyTables::AddShape(uno::Reference <drawing::XShape>& rShape,
table::CellAddress& rStartAddress, table::CellAddress& rEndAddress,
- sal_Int32 nStartX, sal_Int32 nStartY, sal_Int32 nEndX, sal_Int32 nEndY)
+ sal_Int32 nEndX, sal_Int32 nEndY)
{
- aResizeShapes.AddShape(rShape, rStartAddress, rEndAddress, nStartX, nStartY, nEndX, nEndY);
+ aResizeShapes.AddShape(rShape, rStartAddress, rEndAddress, nEndX, nEndY);
}
diff --git a/sc/source/filter/xml/xmlsubti.hxx b/sc/source/filter/xml/xmlsubti.hxx
index f67a4ebee1fe..8b4549d2be24 100644
--- a/sc/source/filter/xml/xmlsubti.hxx
+++ b/sc/source/filter/xml/xmlsubti.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlsubti.hxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: sab $ $Date: 2001-03-20 16:19:41 $
+ * last change: $Author: sab $ $Date: 2001-04-05 15:55:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -64,6 +64,9 @@
#ifndef _XMLOFF_XMLICTXT_HXX
#include <xmloff/xmlictxt.hxx>
#endif
+#ifndef _XMLOFF_XMLIMP_HXX
+#include <xmloff/xmlimp.hxx>
+#endif
#ifndef _COM_SUN_STAR_SHEET_XSPREADSHEET_HPP_
#include <com/sun/star/sheet/XSpreadsheet.hpp>
@@ -80,12 +83,14 @@
#ifndef _COM_SUN_STAR_TABLE_CELLRANGEADDRESS_HPP_
#include <com/sun/star/table/CellRangeAddress.hpp>
#endif
-#ifndef _XMLOFF_XMLIMP_HXX
-#include <xmloff/xmlimp.hxx>
-#endif
#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_
#include <com/sun/star/frame/XModel.hpp>
#endif
+
+#ifndef _SV_VIRDEV_HXX
+#include <vcl/virdev.hxx>
+#endif
+
#ifndef __SGI_STL_VECTOR
#include <vector>
#endif
@@ -152,6 +157,7 @@ private:
ScXMLImport& rImport;
ScMyShapeResizer aResizeShapes;
+ VirtualDevice aVDev;
::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > xCurrentSheet;
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > xDrawPage;
@@ -184,6 +190,7 @@ public:
void CloseRow();
void AddColumn(sal_Bool bIsCovered);
void NewTable(sal_Int32 nTempSpannedCols);
+ void UpdateRowHeights();
void DeleteTable();
com::sun::star::table::CellAddress GetRealCellPos();
void AddColCount(sal_Int32 nTempColCount);
@@ -202,7 +209,7 @@ public:
void AddShape(com::sun::star::uno::Reference <com::sun::star::drawing::XShape>& rShape,
com::sun::star::table::CellAddress& rStartAddress,
com::sun::star::table::CellAddress& rEndAddress,
- sal_Int32 nStartX, sal_Int32 nStartY, sal_Int32 nEndX, sal_Int32 nEndY);
+ sal_Int32 nEndX, sal_Int32 nEndY);
};
#endif