summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2017-01-11 14:30:11 +0100
committerJochen Nitschke <j.nitschke+logerrit@ok.de>2017-01-11 23:08:28 +0000
commit88f561204d7cee25633df8117cc8d7e1ebd8e9ad (patch)
treeb7e18674e3fbe6720b81550d3cb5b5af42caf88b
parent34006130756be2cec73a623cf65b3e71493276a1 (diff)
tdf#48140 replace CellAddress in xlsx import (3)
Change-Id: Ie56cea7fdee7ff6c9e72880e56f9e31ce5f7e03b Reviewed-on: https://gerrit.libreoffice.org/32970 Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de> Tested-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
-rw-r--r--sc/source/filter/oox/querytablebuffer.cxx8
-rw-r--r--sc/source/filter/oox/worksheethelper.cxx15
2 files changed, 11 insertions, 12 deletions
diff --git a/sc/source/filter/oox/querytablebuffer.cxx b/sc/source/filter/oox/querytablebuffer.cxx
index d5614934412f..aa973a7c381f 100644
--- a/sc/source/filter/oox/querytablebuffer.cxx
+++ b/sc/source/filter/oox/querytablebuffer.cxx
@@ -99,7 +99,7 @@ OUString lclBuildWebQueryTables( const WebPrModel::TablesVector& rTables )
}
Reference< XAreaLink > lclFindAreaLink(
- const Reference< XAreaLinks >& rxAreaLinks, const CellAddress& rDestPos,
+ const Reference< XAreaLinks >& rxAreaLinks, const ScAddress& rDestPos,
const OUString& rFileUrl, const OUString& rTables, const OUString& rFilterName, const OUString& rFilterOptions )
{
try
@@ -112,7 +112,7 @@ Reference< XAreaLink > lclFindAreaLink(
PropertySet aPropSet( xAreaLink );
CellRangeAddress aDestArea = xAreaLink->getDestArea();
OUString aString;
- if( (rDestPos.Sheet == aDestArea.Sheet) && (rDestPos.Column == aDestArea.StartColumn) && (rDestPos.Row == aDestArea.StartRow) &&
+ if( (rDestPos.Tab() == aDestArea.Sheet) && (rDestPos.Col() == aDestArea.StartColumn) && (rDestPos.Row() == aDestArea.StartRow) &&
(rTables == xAreaLink->getSourceArea()) &&
aPropSet.getProperty( aString, PROP_Url ) && (rFileUrl == aString) &&
aPropSet.getProperty( aString, PROP_Filter ) && (rFilterName == aString) &&
@@ -233,13 +233,13 @@ void QueryTable::finalizeImport()
OSL_ENSURE( bIsRange, "QueryTable::finalizeImport - defined name does not contain valid cell range" );
if( bIsRange && getAddressConverter().checkCellRange( aDestRange, false, true ) )
{
- CellAddress aDestPos( aDestRange.aStart.Tab(), aDestRange.aStart.Col(), aDestRange.aStart.Row() );
// find tables mode: entire document, all tables, or specific tables
OUString aTables = pWebPr->mbHtmlTables ? lclBuildWebQueryTables( pWebPr->maTables ) : "HTML_all";
if( !aTables.isEmpty() ) try
{
PropertySet aDocProps( getDocument() );
Reference< XAreaLinks > xAreaLinks( aDocProps.getAnyProperty( PROP_AreaLinks ), UNO_QUERY_THROW );
+ CellAddress aDestPos( aDestRange.aStart.Tab(), aDestRange.aStart.Col(), aDestRange.aStart.Row() );
OUString aFilterName = "calc_HTML_WebQuery";
OUString aFilterOptions;
xAreaLinks->insertAtPosition( aDestPos, aFileUrl, aTables, aFilterName, aFilterOptions );
@@ -247,7 +247,7 @@ void QueryTable::finalizeImport()
sal_Int32 nRefreshPeriod = xConnection->getModel().mnInterval * 60;
if( nRefreshPeriod > 0 )
{
- PropertySet aPropSet( lclFindAreaLink( xAreaLinks, aDestPos, aFileUrl, aTables, aFilterName, aFilterOptions ) );
+ PropertySet aPropSet( lclFindAreaLink( xAreaLinks, aDestRange.aStart, aFileUrl, aTables, aFilterName, aFilterOptions ) );
aPropSet.setProperty( PROP_RefreshPeriod, nRefreshPeriod );
}
}
diff --git a/sc/source/filter/oox/worksheethelper.cxx b/sc/source/filter/oox/worksheethelper.cxx
index f739be348dcf..d3a281123952 100644
--- a/sc/source/filter/oox/worksheethelper.cxx
+++ b/sc/source/filter/oox/worksheethelper.cxx
@@ -337,7 +337,7 @@ private:
/** Generates the final URL for the passed hyperlink. */
OUString getHyperlinkUrl( const HyperlinkModel& rHyperlink ) const;
/** Inserts a hyperlinks into the specified cell. */
- void insertHyperlink( const CellAddress& rAddress, const OUString& rUrl );
+ void insertHyperlink( const ScAddress& rAddress, const OUString& rUrl );
/** Inserts all imported data validations into their cell ranges. */
void finalizeValidationRanges() const;
@@ -961,8 +961,8 @@ void WorksheetGlobals::finalizeHyperlinkRanges()
OUString aUrl = getHyperlinkUrl( *aIt );
// try to insert URL into each cell of the range
if( !aUrl.isEmpty() )
- for( CellAddress aAddress( getSheetIndex(), aIt->maRange.aStart.Col(), aIt->maRange.aStart.Row() ); aAddress.Row <= aIt->maRange.aEnd.Row(); ++aAddress.Row )
- for( aAddress.Column = aIt->maRange.aStart.Col(); aAddress.Column <= aIt->maRange.aEnd.Col(); ++aAddress.Column )
+ for( ScAddress aAddress( aIt->maRange.aStart.Col(), aIt->maRange.aStart.Row(), getSheetIndex() ); aAddress.Row() <= aIt->maRange.aEnd.Row(); aAddress.IncRow() )
+ for( aAddress.SetCol(aIt->maRange.aStart.Col()); aAddress.Col() <= aIt->maRange.aEnd.Col(); aAddress.IncCol() )
insertHyperlink( aAddress, aUrl );
}
}
@@ -1004,11 +1004,10 @@ OUString WorksheetGlobals::getHyperlinkUrl( const HyperlinkModel& rHyperlink ) c
return aUrl;
}
-void WorksheetGlobals::insertHyperlink( const CellAddress& rAddress, const OUString& rUrl )
+void WorksheetGlobals::insertHyperlink( const ScAddress& rAddress, const OUString& rUrl )
{
ScDocumentImport& rDoc = getDocImport();
- ScAddress aPos(rAddress.Column, rAddress.Row, rAddress.Sheet);
- ScRefCellValue aCell(rDoc.getDoc(), aPos);
+ ScRefCellValue aCell(rDoc.getDoc(), rAddress);
if (aCell.meType == CELLTYPE_STRING || aCell.meType == CELLTYPE_EDIT)
{
@@ -1020,7 +1019,7 @@ void WorksheetGlobals::insertHyperlink( const CellAddress& rAddress, const OUStr
SvxFieldItem aURLItem(aURLField, EE_FEATURE_FIELD);
rEE.QuickInsertField(aURLItem, ESelection());
- rDoc.setEditCell(aPos, rEE.CreateTextObject());
+ rDoc.setEditCell(rAddress, rEE.CreateTextObject());
}
else
{
@@ -1035,7 +1034,7 @@ void WorksheetGlobals::insertHyperlink( const CellAddress& rAddress, const OUStr
// attribute ) for better interoperability.
SfxStringItem aItem(ATTR_HYPERLINK, rUrl);
- rDoc.getDoc().ApplyAttr(rAddress.Column, rAddress.Row, rAddress.Sheet, aItem);
+ rDoc.getDoc().ApplyAttr(rAddress.Col(), rAddress.Row(), rAddress.Tab(), aItem);
}
}