summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorRavindra Vidhate <ravindra.vidhate@synerzip.com>2014-04-28 15:05:54 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-05-06 09:57:59 +0200
commitcbcc6189e300b6aa5e9e8e6883598a4d28b770c0 (patch)
treeb4641e4d761e85ef12944e8a7b5d7b434fe235ed /writerfilter
parenta4ff20eefaa52f97bacbdb2db16ae5b05a71f536 (diff)
fdo#77887 : Floating Table positions are not preserved when doing Export
The margin of the floating table from top of the page is not being preserved correctly and it also get increased. The w:tblpPr tag is also not preserved. Reviewed on: https://gerrit.libreoffice.org/9185 Change-Id: I8a27a4bab94a1afd27a7ba49ca55ff014918fffc
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableHandler.cxx65
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableManager.cxx8
-rw-r--r--writerfilter/source/dmapper/DomainMapperTableManager.hxx1
-rw-r--r--writerfilter/source/dmapper/TablePositionHandler.hxx42
4 files changed, 105 insertions, 11 deletions
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index a167dd15a7cc..49ea9ac62dc9 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/text/RelOrientation.hpp>
#include <com/sun/star/text/SizeType.hpp>
#include <dmapperLoggers.hxx>
+#include <TablePositionHandler.hxx>
#ifdef DEBUG_DMAPPER_TABLE_HANDLER
#include <PropertyMapHelper.hxx>
@@ -354,8 +355,50 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
PropertyMap::iterator aTableStyleIter =
m_aTableProperties->find(META_PROP_TABLE_STYLE_NAME);
- uno::Sequence< beans::PropertyValue > aGrabBag( 5 );
+ uno::Sequence< beans::PropertyValue > aGrabBag( 6 );
sal_Int32 nGrabBagSize = 0;
+
+ if (0 != m_rDMapper_Impl.getTableManager().getCurrentTableRealPosition())
+ {
+ TablePositionHandler *pTablePositions = m_rDMapper_Impl.getTableManager().getCurrentTableRealPosition();
+
+ uno::Sequence< beans::PropertyValue > aGrabBagTS( 10 );
+
+ aGrabBagTS[0].Name = "bottomFromText";
+ aGrabBagTS[0].Value = uno::makeAny(pTablePositions->getBottomFromText() );
+
+ aGrabBagTS[1].Name = "horzAnchor";
+ aGrabBagTS[1].Value = uno::makeAny( pTablePositions->getHorzAnchor() );
+
+ aGrabBagTS[2].Name = "leftFromText";
+ aGrabBagTS[2].Value = uno::makeAny( pTablePositions->getLeftFromText() );
+
+ aGrabBagTS[3].Name = "rightFromText";
+ aGrabBagTS[3].Value = uno::makeAny( pTablePositions->getRightFromText() );
+
+ aGrabBagTS[4].Name = "tblpX";
+ aGrabBagTS[4].Value = uno::makeAny( pTablePositions->getX() );
+
+ aGrabBagTS[5].Name = "tblpXSpec";
+ aGrabBagTS[5].Value = uno::makeAny( pTablePositions->getXSpec() );
+
+ aGrabBagTS[6].Name = "tblpY";
+ aGrabBagTS[6].Value = uno::makeAny( pTablePositions->getY() );
+
+ aGrabBagTS[7].Name = "tblpYSpec";
+ aGrabBagTS[7].Value = uno::makeAny( pTablePositions->getYSpec() );
+
+ aGrabBagTS[8].Name = "topFromText";
+ aGrabBagTS[8].Value = uno::makeAny( pTablePositions->getTopFromText() );
+
+ aGrabBagTS[9].Name = "vertAnchor";
+ aGrabBagTS[9].Value = uno::makeAny( pTablePositions->getVertAnchor() );
+
+ aGrabBag[nGrabBagSize].Name = "TablePosition";
+ aGrabBag[nGrabBagSize].Value = uno::makeAny( aGrabBagTS );
+ nGrabBagSize++;
+ }
+
if(aTableStyleIter != m_aTableProperties->end())
{
// Apply table style properties recursively
@@ -366,8 +409,8 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
pTableStyle = dynamic_cast<TableStyleSheetEntry*>( pStyleSheet.get( ) );
m_aTableProperties->erase( aTableStyleIter );
- aGrabBag[0].Name = "TableStyleName";
- aGrabBag[0].Value = uno::makeAny( sTableStyleName );
+ aGrabBag[nGrabBagSize].Name = "TableStyleName";
+ aGrabBag[nGrabBagSize].Value = uno::makeAny( sTableStyleName );
nGrabBagSize++;
if( pStyleSheet )
@@ -384,26 +427,26 @@ TableStyleSheetEntry * DomainMapperTableHandler::endTableGetTableStyle(TableInfo
TableInfo rStyleInfo;
if (lcl_extractTableBorderProperty(pMergedProperties, PROP_TOP_BORDER, rStyleInfo, aBorderLine))
{
- aGrabBag[1].Name = "TableStyleTopBorder";
- aGrabBag[1].Value = uno::makeAny( aBorderLine );
+ aGrabBag[nGrabBagSize].Name = "TableStyleTopBorder";
+ aGrabBag[nGrabBagSize].Value = uno::makeAny( aBorderLine );
nGrabBagSize++;
}
if (lcl_extractTableBorderProperty(pMergedProperties, PROP_BOTTOM_BORDER, rStyleInfo, aBorderLine))
{
- aGrabBag[2].Name = "TableStyleBottomBorder";
- aGrabBag[2].Value = uno::makeAny( aBorderLine );
+ aGrabBag[nGrabBagSize].Name = "TableStyleBottomBorder";
+ aGrabBag[nGrabBagSize].Value = uno::makeAny( aBorderLine );
nGrabBagSize++;
}
if (lcl_extractTableBorderProperty(pMergedProperties, PROP_LEFT_BORDER, rStyleInfo, aBorderLine))
{
- aGrabBag[3].Name = "TableStyleLeftBorder";
- aGrabBag[3].Value = uno::makeAny( aBorderLine );
+ aGrabBag[nGrabBagSize].Name = "TableStyleLeftBorder";
+ aGrabBag[nGrabBagSize].Value = uno::makeAny( aBorderLine );
nGrabBagSize++;
}
if (lcl_extractTableBorderProperty(pMergedProperties, PROP_RIGHT_BORDER, rStyleInfo, aBorderLine))
{
- aGrabBag[4].Name = "TableStyleRightBorder";
- aGrabBag[4].Value = uno::makeAny( aBorderLine );
+ aGrabBag[nGrabBagSize].Name = "TableStyleRightBorder";
+ aGrabBag[nGrabBagSize].Value = uno::makeAny( aBorderLine );
nGrabBagSize++;
}
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 126cec097c16..3bf3ce3eca34 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -457,6 +457,14 @@ const uno::Sequence<beans::PropertyValue> DomainMapperTableManager::getCurrentTa
return uno::Sequence< beans::PropertyValue >( 0 );
}
+TablePositionHandler* DomainMapperTableManager::getCurrentTableRealPosition()
+{
+ if ( !m_aTablePositions.empty( ) && m_aTablePositions.back() )
+ return (m_aTablePositions.back( )).get();
+ else
+ return 0;
+}
+
void DomainMapperTableManager::startLevel( )
{
DomainMapperTableManager_Base_t::startLevel( );
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.hxx b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
index b229b4de0ff1..29896ae85454 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.hxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.hxx
@@ -94,6 +94,7 @@ public:
const OUString& getTableStyleName() const { return m_sTableStyleName; }
const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> getCurrentTablePosition();
+ TablePositionHandler* getCurrentTableRealPosition();
virtual void cellProps(TablePropertyMapPtr pProps) SAL_OVERRIDE
{
diff --git a/writerfilter/source/dmapper/TablePositionHandler.hxx b/writerfilter/source/dmapper/TablePositionHandler.hxx
index 592b13485c51..6fd28b47f816 100644
--- a/writerfilter/source/dmapper/TablePositionHandler.hxx
+++ b/writerfilter/source/dmapper/TablePositionHandler.hxx
@@ -38,6 +38,48 @@ class TablePositionHandler
virtual void lcl_sprm(Sprm& sprm) SAL_OVERRIDE;
public:
+ int getY()
+ {
+ return m_nY;
+ }
+ int getX()
+ {
+ return m_nX;
+ }
+ int getLeftFromText()
+ {
+ return m_nLeftFromText;
+ }
+ int getRightFromText()
+ {
+ return m_nRightFromText;
+ }
+ int getTopFromText()
+ {
+ return m_nTopFromText;
+ }
+ int getBottomFromText()
+ {
+ return m_nBottomFromText;
+ }
+
+ OUString getVertAnchor()
+ {
+ return m_aVertAnchor;
+ }
+ OUString getYSpec()
+ {
+ return m_aYSpec;
+ }
+ OUString getHorzAnchor()
+ {
+ return m_aHorzAnchor;
+ }
+ OUString getXSpec()
+ {
+ return m_aXSpec;
+ }
+
TablePositionHandler();
virtual ~TablePositionHandler();