summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorDaniel Rentz <dr@openoffice.org>2001-06-08 13:55:10 +0000
committerDaniel Rentz <dr@openoffice.org>2001-06-08 13:55:10 +0000
commit5a7bfce77e3f643d87a18ec0481b822c6d86ec31 (patch)
treeaafeb4ccc85c9402b9e599864ce40dd49917adf0 /sc
parent8a1020938cb15879a1e69b231bf75b4e297fd524 (diff)
#81094# OLE conversion on excel import
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/scextopt.hxx24
-rw-r--r--sc/source/filter/excel/colrowst.cxx22
-rw-r--r--sc/source/filter/excel/impop.cxx41
-rw-r--r--sc/source/filter/excel/read.cxx6
-rw-r--r--sc/source/filter/inc/imp_op.hxx5
-rw-r--r--sc/source/ui/docshell/docsh.cxx10
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx9
-rw-r--r--sc/source/ui/view/viewdata.cxx12
8 files changed, 101 insertions, 28 deletions
diff --git a/sc/inc/scextopt.hxx b/sc/inc/scextopt.hxx
index 7e53c137cc74..39d041972abe 100644
--- a/sc/inc/scextopt.hxx
+++ b/sc/inc/scextopt.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: scextopt.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: dr $ $Date: 2001-05-10 17:22:51 $
+ * last change: $Author: dr $ $Date: 2001-06-08 14:51:06 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -146,10 +146,14 @@ private:
String* pCodenameWB;
CodenameList* pCodenames;
+
+ BOOL bChanged; // for import: copy data only first time to doc
+
public:
UINT32 nLinkCnt; // Zaehlt die Rekursionstufe beim Laden
// von externen Dokumenten
UINT16 nActTab; // aktuelle Tabelle
+ ScRange* pOleSize; // visible range if embedded
UINT16 nSelTabs; // count of selected sheets
Color* pGridCol; // Farbe Grid und Row-/Col-Heading
UINT16 nZoom; // in %
@@ -167,12 +171,17 @@ public:
void SetGridCol( const Color& rColor );
void SetActTab( UINT16 nTab );
+ void SetOleSize( USHORT nFirstCol, USHORT nFirstRow, USHORT nLastCol, USHORT nLastRow );
void SetCursor( UINT16 nCol, UINT16 nRow );
void SetZoom( UINT16 nZaehler, UINT16 nNenner );
+ inline void SetChanged( BOOL bChg ) { bChanged = bChg; }
+ inline BOOL IsChanged() const { return bChanged; }
void Add( const ColRowSettings& rCRS );
inline const ScExtTabOptions* GetExtTabOptions( const UINT16 nTabNum ) const;
+ inline ScExtTabOptions* GetExtTabOptions( const UINT16 nTabNum );
+ inline const ScRange* GetOleSize() const { return pOleSize; }
inline const String* GetCodename( void ) const; // for Workbook globals
inline CodenameList* GetCodenames( void ); // for tables
@@ -265,10 +274,13 @@ inline void ScExtTabOptions::operator =( const ScExtTabOptions& rCpy )
inline const ScExtTabOptions* ScExtDocOptions::GetExtTabOptions( const UINT16 nTab ) const
{
- if( nTab <= MAXTAB )
- return ppExtTabOpts[ nTab ];
- else
- return NULL;
+ return (nTab <= MAXTAB) ? ppExtTabOpts[ nTab ] : NULL;
+}
+
+
+inline ScExtTabOptions* ScExtDocOptions::GetExtTabOptions( const UINT16 nTab )
+{
+ return (nTab <= MAXTAB) ? ppExtTabOpts[ nTab ] : NULL;
}
diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx
index bb509ff66750..0705ffbf8e8f 100644
--- a/sc/source/filter/excel/colrowst.cxx
+++ b/sc/source/filter/excel/colrowst.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: colrowst.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: dr $ $Date: 2001-05-11 09:19:40 $
+ * last change: $Author: dr $ $Date: 2001-06-08 14:52:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -921,6 +921,7 @@ ScExtDocOptions::ScExtDocOptions( void )
{
pGridCol = NULL;
nActTab = nSelTabs = nCurCol = nCurRow = 0;
+ pOleSize = NULL;
nLinkCnt = 0; // -> 'Root'-Dokument
nZoom = 100;
@@ -930,6 +931,7 @@ ScExtDocOptions::ScExtDocOptions( void )
pCodenameWB = NULL;
pCodenames = NULL;
+ bChanged = TRUE;
fColScale = 0.0;
}
@@ -939,6 +941,8 @@ ScExtDocOptions::~ScExtDocOptions()
{
if( pGridCol )
delete pGridCol;
+ if( pOleSize )
+ delete pOleSize;
for( UINT16 nCnt = 0 ; nCnt <= MAXTAB ; nCnt++ )
{
@@ -1004,6 +1008,8 @@ ScExtDocOptions& ScExtDocOptions::operator =( const ScExtDocOptions& rCpy )
if( rCpy.pCodenames )
pCodenames = new CodenameList( *rCpy.pCodenames );
+ bChanged = rCpy.bChanged;
+
fColScale = rCpy.fColScale;
return *this;
@@ -1033,6 +1039,18 @@ void ScExtDocOptions::SetActTab( UINT16 nTab )
}
+void ScExtDocOptions::SetOleSize( USHORT nFirstCol, USHORT nFirstRow, USHORT nLastCol, USHORT nLastRow )
+{
+ if( pOleSize )
+ {
+ pOleSize->aStart.Set( nFirstCol, nFirstRow, 0 );
+ pOleSize->aEnd.Set( nLastCol, nLastRow, 0 );
+ }
+ else
+ pOleSize = new ScRange( nFirstCol, nFirstRow, 0, nLastCol, nLastRow, 0 );
+}
+
+
void ScExtDocOptions::SetCursor( UINT16 nCol, UINT16 nRow )
{
nCurCol = ( nCol <= MAXCOL )? nCol : MAXCOL;
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 6f76e9994128..965199f23d01 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: impop.cxx,v $
*
- * $Revision: 1.18 $
+ * $Revision: 1.19 $
*
- * last change: $Author: er $ $Date: 2001-05-16 09:59:38 $
+ * last change: $Author: dr $ $Date: 2001-06-08 14:52:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -87,6 +87,11 @@
#include <sfx2/printer.hxx>
#include <svtools/zforlist.hxx>
+#include <so3/embobj.hxx>
+#include <sfx2/objsh.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+#include "docuno.hxx"
+
#if defined( WNT ) || defined( WIN )
#include <math.h>
#else
@@ -124,6 +129,7 @@
#include "excform.hxx"
#include "flttools.hxx"
+using namespace ::com::sun::star;
const double ImportExcel::fExcToTwips =
@@ -215,6 +221,7 @@ ImportExcel::ImportExcel( SvStream& aStream, ScDocument* pDoc ):
pExcRoot->pExtDocOpt = new ScExtDocOptions;
if( pDoc->GetExtDocOptions() )
*pExcRoot->pExtDocOpt = *pDoc->GetExtDocOptions();
+ pExcRoot->pExtDocOpt->SetChanged( TRUE );
pExcRoot->pProgress = NULL;
pExcRoot->pEdEng = NULL;
pExcRoot->pEdEngHF = NULL;
@@ -1624,6 +1631,16 @@ void ImportExcel::Rstring( void )
}
+void ImportExcel::Olesize( void )
+{
+ aIn.Ignore( 2 );
+ UINT16 nFirstRow, nLastRow;
+ UINT8 nFirstCol, nLastCol;
+ aIn >> nFirstRow >> nLastRow >> nFirstCol >> nLastCol;
+ pExcRoot->pExtDocOpt->SetOleSize( nFirstCol, nFirstRow, nLastCol, nLastRow );
+}
+
+
void ImportExcel::XF5( void )
{
UINT16 nAttr0, nAlign, nIndexFormat, nIndexFont, nFillCol,
@@ -2742,6 +2759,26 @@ void ImportExcel::PostDocLoad( void )
aDocOpt.SetFormulaRegexEnabled( FALSE ); // regular expressions? what's that?
pD->SetDocOptions( aDocOpt );
+ // visible area if embedded OLE
+ SfxObjectShell* pShell = pD->GetDocumentShell();
+ if( pShell )
+ {
+ uno::Reference< frame::XModel > xModel( pShell->GetModel() );
+ ScModelObj* pDocObj = ScModelObj::getImplementation( xModel );
+ if( pDocObj )
+ {
+ SvEmbeddedObject* pEmbObj = pDocObj->GetEmbeddedObject();
+ const ScRange* pOleSize = pExcRoot->pExtDocOpt->GetOleSize();
+ if( pEmbObj && pOleSize )
+ {
+ pEmbObj->SetVisArea( pD->GetMMRect(
+ pOleSize->aStart.Col(), pOleSize->aStart.Row(),
+ pOleSize->aEnd.Col(), pOleSize->aEnd.Row(), pExcRoot->pExtDocOpt->nActTab ) );
+ pD->SetVisibleTab( pExcRoot->pExtDocOpt->nActTab );
+ }
+ }
+ }
+
pExcRoot->pExtDocOpt->fColScale = pExcRoot->fColScale;
pD->SetExtDocOptions( pExcRoot->pExtDocOpt );
pExcRoot->pExtDocOpt = NULL;
diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx
index 181a49ef5491..dbd1a2da17de 100644
--- a/sc/source/filter/excel/read.cxx
+++ b/sc/source/filter/excel/read.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: read.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: gt $ $Date: 2001-05-28 13:44:50 $
+ * last change: $Author: dr $ $Date: 2001-06-08 14:52:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -600,6 +600,7 @@ FltError ImportExcel::Read( void )
case 0x8D: Hideobj(); break; // HIDEOBJ [ 345]
case 0x92: Palette(); break; // PALETTE [ 345]
case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45]
+ case 0xDE: Olesize(); break;
case 0xE0: XF5(); break; // XF [ 5]
case 0x0218: Name34(); break; // NAME [ 34 ]
case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[ 345]
@@ -1125,6 +1126,7 @@ FltError ImportExcel8::Read( void )
case 0x99: Standardwidth(); break; // STANDARDWIDTH[ 45 ]
case 0xD3: bHasBasic = TRUE; break;
case 0xD5: SXIdStm(); break; // SXIDSTM ##++##
+ case 0xDE: Olesize(); break;
case 0xE0: Xf(); break; // XF [ 5 ]
case 0xE3: SXVs(); break; // SXVS ##++##
case 0xEB: Msodrawinggroup(); break;
diff --git a/sc/source/filter/inc/imp_op.hxx b/sc/source/filter/inc/imp_op.hxx
index 09c7ae9b6e3d..e3d96504755f 100644
--- a/sc/source/filter/inc/imp_op.hxx
+++ b/sc/source/filter/inc/imp_op.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: imp_op.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: dr $ $Date: 2001-04-12 08:44:16 $
+ * last change: $Author: dr $ $Date: 2001-06-08 14:53:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -246,6 +246,7 @@ protected:
void Mulrk( void ); // 0xBD
void Mulblank( void ); // 0xBE
void Rstring( void ); // 0xD6
+ void Olesize( void ); // 0xDE
void XF5( void ); // 0xE0
void Blank34( void ); // 0x0201
void Number34( void ); // 0x0203
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index f0c9865a2c30..9a06c6536aeb 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: docsh.cxx,v $
*
- * $Revision: 1.30 $
+ * $Revision: 1.31 $
*
- * last change: $Author: sab $ $Date: 2001-06-01 10:08:16 $
+ * last change: $Author: dr $ $Date: 2001-06-08 14:54:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1698,14 +1698,14 @@ BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
{
WaitObject aWait( GetDialogParent() );
- ScExtDocOptions* pExtDocOpt = NULL;
ScTabViewShell* pViewShell = GetBestViewShell();
if( pViewShell )
{
- pExtDocOpt = new ScExtDocOptions;
+ ScExtDocOptions* pExtDocOpt = aDocument.GetExtDocOptions();
+ if( !pExtDocOpt )
+ aDocument.SetExtDocOptions( pExtDocOpt = new ScExtDocOptions );
pViewShell->GetViewData()->WriteExtOptions( *pExtDocOpt );
}
- aDocument.SetExtDocOptions( pExtDocOpt );
BOOL bFake97 = ( aFltName.EqualsAscii(pFilterExcel97) || aFltName.EqualsAscii(pFilterEx97Temp) );
FltError eError = ScExportExcel5( rMed, &aDocument, bFake97, RTL_TEXTENCODING_MS_1252 );
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index bd38d15ed034..0675c1673270 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tabvwsh4.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: nn $ $Date: 2001-06-08 12:44:08 $
+ * last change: $Author: dr $ $Date: 2001-06-08 14:55:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -122,7 +122,7 @@
#include "dpobject.hxx"
#include "prevwsh.hxx"
#include "tpprint.hxx"
-
+#include "scextopt.hxx"
void ActivateOlk( ScViewData* pViewData );
void DeActivateOlk( ScViewData* pViewData );
@@ -1583,11 +1583,12 @@ void ScTabViewShell::Construct()
pDoc->MakeTable(i);
}
- const ScExtDocOptions* pExtOpt = pDoc->GetExtDocOptions();
+ ScExtDocOptions* pExtOpt = pDoc->GetExtDocOptions();
if (pExtOpt)
{
GetViewData()->ReadExtOptions(*pExtOpt); // Excel-View Optionen
SetTabNo( GetViewData()->GetTabNo(), TRUE );
+ pExtOpt->SetChanged( FALSE );
//! alles von ReadUserData auch hier
}
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index d7a8d170a261..c22059245bb2 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: viewdata.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: nn $ $Date: 2001-06-06 09:14:46 $
+ * last change: $Author: dr $ $Date: 2001-06-08 14:55:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -2013,7 +2013,10 @@ void ScViewData::WriteExtOptions(ScExtDocOptions& rOpt)
ScViewDataTable* pViewTab = pTabData[ nTab ];
if( pViewTab )
{
- ScExtTabOptions* pTabOpt = new ScExtTabOptions;
+ ScExtTabOptions* pTabOpt = rOpt.GetExtTabOptions( nTab );
+ if( !pTabOpt )
+ rOpt.SetExtTabOptions( nTab, pTabOpt = new ScExtTabOptions );
+
pTabOpt->nTabNum = nTab;
pTabOpt->bSelected = GetMarkData().GetTableSelect( nTab );
if( pTabOpt->bSelected )
@@ -2058,8 +2061,6 @@ void ScViewData::WriteExtOptions(ScExtDocOptions& rOpt)
pTabOpt->aLastSel.aStart.Set( pViewTab->nCurX, pViewTab->nCurY, nTab );
pTabOpt->aLastSel.aEnd = pTabOpt->aLastSel.aStart;
-
- rOpt.SetExtTabOptions( nTab, pTabOpt );
}
}
}
@@ -2067,6 +2068,7 @@ void ScViewData::WriteExtOptions(ScExtDocOptions& rOpt)
void ScViewData::ReadExtOptions( const ScExtDocOptions& rOpt )
{
// for Excel import
+ if( !rOpt.IsChanged() ) return;
USHORT nTabCount = pDoc->GetTableCount();
for (USHORT nTab=0; nTab<nTabCount; nTab++)