diff options
-rw-r--r-- | sc/inc/sc.hrc | 7 | ||||
-rw-r--r-- | sc/inc/tablink.hxx | 6 | ||||
-rw-r--r-- | sc/sdi/cellsh.sdi | 6 | ||||
-rw-r--r-- | sc/sdi/scalc.sdi | 23 | ||||
-rw-r--r-- | sc/source/ui/docshell/arealink.cxx | 27 | ||||
-rw-r--r-- | sc/source/ui/docshell/tablink.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/inc/linkarea.hrc | 76 | ||||
-rw-r--r-- | sc/source/ui/inc/linkarea.hxx | 149 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/linkarea.cxx | 347 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/linkarea.src | 158 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/makefile.mk | 10 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 41 | ||||
-rw-r--r-- | sc/source/ui/view/tabview3.cxx | 5 |
13 files changed, 822 insertions, 50 deletions
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index d1413cd78f07..4ebd8f7b90dd 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -2,9 +2,9 @@ * * $RCSfile: sc.hrc,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: er $ $Date: 2001-04-25 14:00:39 $ + * last change: $Author: nn $ $Date: 2001-04-27 19:23:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -449,6 +449,7 @@ #define SID_CHOOSE_DESIGN (SC_VIEW_START + 82) #define SID_EURO_CONVERTER (SC_VIEW_START + 83) #define SID_CHG_PROTECT (SC_VIEW_START + 84) +#define SID_EXTERNAL_SOURCE (SC_VIEW_START + 85) // Nachrichten ------------------------------------------------------------- @@ -1367,6 +1368,8 @@ #define RID_SCDLG_DAPISERVICE (SC_DIALOGS_START + 130) #define RID_SCDLG_DAPIDATA (SC_DIALOGS_START + 131) +#define RID_SCDLG_LINKAREA (SC_DIALOGS_START + 132) + #define SC_DIALOGS_END (SC_DIALOGS_START + 150) #ifndef STD_MASKCOLOR diff --git a/sc/inc/tablink.hxx b/sc/inc/tablink.hxx index deb2b7e1737c..45e1daac4f75 100644 --- a/sc/inc/tablink.hxx +++ b/sc/inc/tablink.hxx @@ -2,9 +2,9 @@ * * $RCSfile: tablink.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: er $ $Date: 2001-04-21 20:31:39 $ + * last change: $Author: nn $ $Date: 2001-04-27 19:23:46 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -139,6 +139,8 @@ public: BOOL IsError() const; String GetTitle() const; + void ReleaseDocRef(); // without calling DoClose + static String GetOptions( SfxMedium& rMedium ); static void GetFilterName( const String& rFileName, String& rFilter, String& rOptions ); diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 912c22af309d..2b6c56eac419 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -3,7 +3,7 @@ // StarCalc // // (C) 1994 StarDivision GmbH, Hamburg, Germany - // $Author: nn $ $Date: 2001-04-23 11:43:56 $ $Revision: 1.4 $ + // $Author: nn $ $Date: 2001-04-27 19:27:02 $ $Revision: 1.5 $ // $Logfile: T:/sc/sdi/cellsh.sdv $ $Workfile: cellsh.sdi $ //---------------------------------------------------------------------------- @@ -133,6 +133,7 @@ interface CellSelection : Selection SID_GET_CLPBRD_FORMAT_COUNT [ ExecMethod = ExecuteEdit; ] SID_GET_CLPBRD_FORMAT_BY_IDX [ ExecMethod = ExecuteEdit; ] SID_GET_CLPBRD_FORMAT_NAME [ ExecMethod = ExecuteEdit; ] + SID_EXTERNAL_SOURCE [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] FID_MERGE_ON [ ExecMethod = Execute; StateMethod = GetState; ] FID_MERGE_OFF [ ExecMethod = Execute; StateMethod = GetState; ] SID_OUTLINE_HIDE [ ExecMethod = ExecuteEdit; StateMethod = GetState; ] @@ -377,6 +378,9 @@ shell ScCellShell : ScFormatShell /*------------------------------------------------------------------------ $Log: not supported by cvs2svn $ + Revision 1.4 2001/04/23 11:43:56 nn + slot for clipboard controller + Revision 1.3 2001/03/26 19:18:57 nn transliteration menu functions diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index 6e2b338bada1..4a49c74c8045 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -3462,29 +3462,6 @@ SfxBoolItem TraceChangeMode FID_CHG_RECORD ] //-------------------------------------------------------------------------- -SfxVoidItem ProtectTraceChangeMode SID_CHG_PROTECT -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - Synchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_EDIT; -] - -//-------------------------------------------------------------------------- SfxVoidItem CommentChange FID_CHG_COMMENT (SfxStringItem Comment FID_CHG_COMMENT) [ diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index 875acdc7c25a..c539e8fd842d 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -2,9 +2,9 @@ * * $RCSfile: arealink.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: dr $ $Date: 2001-04-24 14:48:21 $ + * last change: $Author: nn $ $Date: 2001-04-27 19:30:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -85,6 +85,7 @@ #include "markdata.hxx" #include "hints.hxx" #include "htmlimp.hxx" +#include "linkarea.hxx" // dialog #include "attrib.hxx" // raus, wenn ResetAttrib am Dokument #include "patattr.hxx" // raus, wenn ResetAttrib am Dokument @@ -122,16 +123,19 @@ __EXPORT ScAreaLink::~ScAreaLink() BOOL __EXPORT ScAreaLink::Edit(Window* pParent) { + // use own dialog instead of SvBaseLink::Edit... // DefModalDialogParent setzen, weil evtl. aus der DocShell beim ConvertFrom // ein Optionen-Dialog kommt... - Window* pOldParent = Application::GetDefDialogParent(); - if (pParent) - Application::SetDefDialogParent(pParent); - - BOOL bRet = SvBaseLink::Edit(pParent); - - Application::SetDefDialogParent(pOldParent); + BOOL bRet = FALSE; + ScLinkedAreaDlg* pDlg = new ScLinkedAreaDlg( pParent ); + pDlg->InitFromOldLink( aFileName, aFilterName, aOptions, aSourceArea, GetRefreshDelay() ); + if (pDlg->Execute() == RET_OK) + { + aOptions = pDlg->GetOptions(); + bRet = Refresh( pDlg->GetURL(), pDlg->GetFilter(), pDlg->GetSource(), pDlg->GetRefresh() ); + } + delete pDlg; return bRet; } @@ -466,8 +470,9 @@ BOOL ScAreaLink::Refresh( const String& rNewFile, const String& rNewFilter, if ( aOldRange.aEnd.Row() != aNewRange.aEnd.Row() ) nPaintEndY = MAXROW; - pDocShell->PostPaint( aDestPos.Col(),aDestPos.Row(),nDestTab, - nPaintEndX,nPaintEndY,nDestTab, PAINT_GRID ); + if ( !pDocShell->AdjustRowHeight( aDestPos.Row(), nPaintEndY, nDestTab ) ) + pDocShell->PostPaint( aDestPos.Col(),aDestPos.Row(),nDestTab, + nPaintEndX,nPaintEndY,nDestTab, PAINT_GRID ); aModificator.SetDocumentModified(); } else diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx index 36c082a38d44..48c4557c8ab0 100644 --- a/sc/source/ui/docshell/tablink.cxx +++ b/sc/source/ui/docshell/tablink.cxx @@ -2,9 +2,9 @@ * * $RCSfile: tablink.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: er $ $Date: 2001-04-21 20:28:55 $ + * last change: $Author: nn $ $Date: 2001-04-27 19:30:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -501,6 +501,19 @@ ScDocumentLoader::~ScDocumentLoader() delete pMedium; } +void ScDocumentLoader::ReleaseDocRef() +{ + if ( aRef.Is() ) + { + // release reference without calling DoClose - caller must + // have another reference to the doc and call DoClose later + + pDocShell = NULL; + pMedium = NULL; + aRef.Clear(); + } +} + ScDocument* ScDocumentLoader::GetDocument() { return pDocShell ? pDocShell->GetDocument() : 0; diff --git a/sc/source/ui/inc/linkarea.hrc b/sc/source/ui/inc/linkarea.hrc new file mode 100644 index 000000000000..af81595f9301 --- /dev/null +++ b/sc/source/ui/inc/linkarea.hrc @@ -0,0 +1,76 @@ +/************************************************************************* + * + * $RCSfile: linkarea.hrc,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: nn $ $Date: 2001-04-27 19:28:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <sc.hrc> + +#define BTN_OK 1 +#define BTN_CANCEL 2 +#define BTN_HELP 3 +#define FL_LOCATION 4 +#define CB_URL 5 +#define BTN_BROWSE 6 +#define FT_HINT 7 +#define FT_RANGES 8 +#define LB_RANGES 9 +#define BTN_RELOAD 10 +#define NF_DELAY 11 +#define FT_SECONDS 12 + diff --git a/sc/source/ui/inc/linkarea.hxx b/sc/source/ui/inc/linkarea.hxx new file mode 100644 index 000000000000..93881b158cc8 --- /dev/null +++ b/sc/source/ui/inc/linkarea.hxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * $RCSfile: linkarea.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: nn $ $Date: 2001-04-27 19:28:25 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef SC_LINKAREA_HXX +#define SC_LINKAREA_HXX + +#ifndef _SV_DIALOG_HXX +#include <vcl/dialog.hxx> +#endif + +#ifndef _SV_BUTTON_HXX +#include <vcl/button.hxx> +#endif +#ifndef _SV_FIELD_HXX +#include <vcl/field.hxx> +#endif +#ifndef _SV_FIXED_HXX +#include <vcl/fixed.hxx> +#endif +#ifndef _SV_LSTBOX_HXX +#include <vcl/lstbox.hxx> +#endif +#ifndef _STDCTRL_HXX +#include <svtools/stdctrl.hxx> +#endif +#ifndef _SFX_INETTBC_HXX +#include <sfx2/inettbc.hxx> +#endif + + +#ifndef _EMBOBJ_HXX //autogen +#include <so3/embobj.hxx> +#endif + +#ifndef SO2_DECL_SVEMBEDDEDOBJECT_DEFINED +#define SO2_DECL_SVEMBEDDEDOBJECT_DEFINED +SO2_DECL_REF(SvEmbeddedObject) +#endif + +class ScDocShell; + + +//------------------------------------------------------------------------ + +class ScLinkedAreaDlg : public ModalDialog +{ +private: + FixedLine aFlLocation; + SfxURLBox aCbUrl; + PushButton aBtnBrowse; + FixedInfo aTxtHint; + FixedText aFtRanges; + MultiListBox aLbRanges; + CheckBox aBtnReload; + NumericField aNfDelay; + FixedText aFtSeconds; + OKButton aBtnOk; + CancelButton aBtnCancel; + HelpButton aBtnHelp; + + ScDocShell* pSourceShell; + SvEmbeddedObjectRef aSourceRef; + + DECL_LINK( FileHdl, ComboBox* ); + DECL_LINK( BrowseHdl, PushButton* ); + DECL_LINK( RangeHdl, MultiListBox* ); + DECL_LINK( ReloadHdl, CheckBox* ); + void UpdateSourceRanges(); + void UpdateEnable(); + void LoadDocument( const String& rFile, const String& rFilter, + const String& rOptions ); + +public: + ScLinkedAreaDlg( Window* pParent ); + ~ScLinkedAreaDlg(); + + void InitFromOldLink( const String& rFile, const String& rFilter, + const String& rOptions, const String& rSource, + ULONG nRefresh ); + + virtual short Execute(); // overwritten to set dialog parent + + String GetURL(); + String GetFilter(); // may be empty + String GetOptions(); // filter options + String GetSource(); // separated by ";" + ULONG GetRefresh(); // 0 if disabled +}; + +#endif + diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx new file mode 100644 index 000000000000..5fc6cc8f3585 --- /dev/null +++ b/sc/source/ui/miscdlgs/linkarea.cxx @@ -0,0 +1,347 @@ +/************************************************************************* + * + * $RCSfile: linkarea.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: nn $ $Date: 2001-04-27 19:29:36 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifdef PCH +#include "ui_pch.hxx" +#endif + +#pragma hdrstop + +//------------------------------------------------------------------ + +#include <sfx2/app.hxx> +#include <sfx2/docfile.hxx> +#include <sfx2/docfilt.hxx> +#include <svtools/ehdl.hxx> +#include <svtools/sfxecode.hxx> +#include <vcl/waitobj.hxx> + +#include "linkarea.hxx" +#include "linkarea.hrc" +#include "scresid.hxx" +#include "sc.hrc" +#include "rangeutl.hxx" +#include "docsh.hxx" +#include "tablink.hxx" + +//================================================================== + +ScLinkedAreaDlg::ScLinkedAreaDlg( Window* pParent ) : + ModalDialog ( pParent, ScResId( RID_SCDLG_LINKAREA ) ), + // + aFlLocation ( this, ScResId( FL_LOCATION ) ), + aCbUrl ( this, ScResId( CB_URL ) ), + aBtnBrowse ( this, ScResId( BTN_BROWSE ) ), + aTxtHint ( this, ScResId( FT_HINT ) ), + aFtRanges ( this, ScResId( FT_RANGES ) ), + aLbRanges ( this, ScResId( LB_RANGES ) ), + aBtnReload ( this, ScResId( BTN_RELOAD ) ), + aNfDelay ( this, ScResId( NF_DELAY ) ), + aFtSeconds ( this, ScResId( FT_SECONDS ) ), + aBtnOk ( this, ScResId( BTN_OK ) ), + aBtnCancel ( this, ScResId( BTN_CANCEL ) ), + aBtnHelp ( this, ScResId( BTN_HELP ) ), + // + pSourceShell( NULL ) +{ + FreeResource(); + + aCbUrl.SetSelectHdl( LINK( this, ScLinkedAreaDlg, FileHdl ) ); + aBtnBrowse.SetClickHdl( LINK( this, ScLinkedAreaDlg, BrowseHdl ) ); + aLbRanges.SetSelectHdl( LINK( this, ScLinkedAreaDlg, RangeHdl ) ); + aBtnReload.SetClickHdl( LINK( this, ScLinkedAreaDlg, ReloadHdl ) ); + UpdateEnable(); +} + +ScLinkedAreaDlg::~ScLinkedAreaDlg() +{ + // pSourceShell is deleted by aSourceRef +} + +short ScLinkedAreaDlg::Execute() +{ + // set parent for file dialog or filter options + + Window* pOldDefParent = Application::GetDefDialogParent(); + Application::SetDefDialogParent( this ); + + short nRet = ModalDialog::Execute(); + + Application::SetDefDialogParent( pOldDefParent ); + + return nRet; +} + +IMPL_LINK( ScLinkedAreaDlg, BrowseHdl, PushButton*, EMPTYARG ) +{ + // dialog parent has been set in execute + + SfxApplication* pApp = SFX_APP(); + SfxMedium* pMed = pApp->InsertDocumentDialog( 0, ScDocShell::Factory() ); + + if ( pMed ) + { + WaitObject aWait( this ); + + // ERRCTX_SFX_OPENDOC -> "Fehler beim Laden des Dokumentes" + SfxErrorContext aEc( ERRCTX_SFX_OPENDOC, pMed->GetName() ); + + if (pSourceShell) + pSourceShell->DoClose(); // deleted when assigning aSourceRef + + pSourceShell = new ScDocShell; + aSourceRef = pSourceShell; + pSourceShell->DoLoad( pMed ); + + ULONG nErr = pSourceShell->GetErrorCode(); + if (nErr) + ErrorHandler::HandleError( nErr ); // including warnings + + if ( !pSourceShell->GetError() ) // only errors + { + //aCbUrl.SetText( pSourceShell->GetTitle( SFX_TITLE_FULLNAME ) ); + aCbUrl.SetText( pMed->GetName() ); + } + else + { + pSourceShell->DoClose(); + pSourceShell = NULL; + aSourceRef.Clear(); + + aCbUrl.SetText( EMPTY_STRING ); + } + } + + UpdateSourceRanges(); + UpdateEnable(); + return 0; +} + +IMPL_LINK( ScLinkedAreaDlg, FileHdl, ComboBox*, EMPTYARG ) +{ + String aEntered = aCbUrl.GetURL(); + if (pSourceShell) + { + SfxMedium* pMed = pSourceShell->GetMedium(); + if ( pMed->GetName() == aEntered ) + { + // already loaded - nothing to do + return 0; + } + } + + LoadDocument( aEntered, EMPTY_STRING, EMPTY_STRING ); + + UpdateSourceRanges(); + UpdateEnable(); + return 0; +} + +void ScLinkedAreaDlg::LoadDocument( const String& rFile, const String& rFilter, const String& rOptions ) +{ + if ( pSourceShell ) + { + // unload old document + pSourceShell->DoClose(); + pSourceShell = NULL; + aSourceRef.Clear(); + } + + if ( rFile.Len() ) + { + WaitObject aWait( this ); + + String aNewFilter = rFilter; + String aNewOptions = rOptions; + + ScDocumentLoader aLoader( rFile, aNewFilter, aNewOptions ); + pSourceShell = aLoader.GetDocShell(); + if ( pSourceShell ) + { + aSourceRef = pSourceShell; + aLoader.ReleaseDocRef(); // don't call DoClose in DocLoader dtor + } + } +} + +void ScLinkedAreaDlg::InitFromOldLink( const String& rFile, const String& rFilter, + const String& rOptions, const String& rSource, + ULONG nRefresh ) +{ + LoadDocument( rFile, rFilter, rOptions ); + if (pSourceShell) + { + SfxMedium* pMed = pSourceShell->GetMedium(); + aCbUrl.SetText( pMed->GetName() ); + } + else + aCbUrl.SetText( EMPTY_STRING ); + + UpdateSourceRanges(); + + xub_StrLen nRangeCount = rSource.GetTokenCount(); + for ( xub_StrLen i=0; i<nRangeCount; i++ ) + { + String aRange = rSource.GetToken(i); + aLbRanges.SelectEntry( aRange ); + } + + BOOL bDoRefresh = ( nRefresh != 0 ); + aBtnReload.Check( bDoRefresh ); + if (bDoRefresh) + aNfDelay.SetValue( nRefresh ); + + UpdateEnable(); +} + +IMPL_LINK( ScLinkedAreaDlg, RangeHdl, MultiListBox*, EMPTYARG ) +{ + UpdateEnable(); + return 0; +} + +IMPL_LINK( ScLinkedAreaDlg, ReloadHdl, CheckBox*, EMPTYARG ) +{ + UpdateEnable(); + return 0; +} + +void ScLinkedAreaDlg::UpdateSourceRanges() +{ + aLbRanges.SetUpdateMode( FALSE ); + + aLbRanges.Clear(); + if ( pSourceShell ) + { + ScAreaNameIterator aIter( pSourceShell->GetDocument() ); + ScRange aDummy; + String aName; + while ( aIter.Next( aName, aDummy ) ) + aLbRanges.InsertEntry( aName ); + } + + aLbRanges.SetUpdateMode( TRUE ); + + if ( aLbRanges.GetEntryCount() == 1 ) + aLbRanges.SelectEntryPos(0); +} + +void ScLinkedAreaDlg::UpdateEnable() +{ + BOOL bEnable = ( pSourceShell && aLbRanges.GetSelectEntryCount() ); + aBtnOk.Enable( bEnable ); + + BOOL bReload = aBtnReload.IsChecked(); + aNfDelay.Enable( bReload ); + aFtSeconds.Enable( bReload ); +} + +String ScLinkedAreaDlg::GetURL() +{ + if (pSourceShell) + { + SfxMedium* pMed = pSourceShell->GetMedium(); + return pMed->GetName(); + } + return EMPTY_STRING; +} + +String ScLinkedAreaDlg::GetFilter() +{ + if (pSourceShell) + { + SfxMedium* pMed = pSourceShell->GetMedium(); + return pMed->GetFilter()->GetFilterName(); + } + return EMPTY_STRING; +} + +String ScLinkedAreaDlg::GetOptions() +{ + if (pSourceShell) + { + SfxMedium* pMed = pSourceShell->GetMedium(); + return ScDocumentLoader::GetOptions( *pMed ); + } + return EMPTY_STRING; +} + +String ScLinkedAreaDlg::GetSource() +{ + String aSource; + USHORT nCount = aLbRanges.GetSelectEntryCount(); + for (USHORT i=0; i<nCount; i++) + { + if (i > 0) + aSource.Append( (sal_Unicode) ';' ); + aSource.Append( aLbRanges.GetSelectEntry( i ) ); + } + return aSource; +} + +ULONG ScLinkedAreaDlg::GetRefresh() +{ + if ( aBtnReload.IsChecked() ) + return aNfDelay.GetValue(); + else + return 0; // disabled +} + diff --git a/sc/source/ui/miscdlgs/linkarea.src b/sc/source/ui/miscdlgs/linkarea.src new file mode 100644 index 000000000000..2e472d812431 --- /dev/null +++ b/sc/source/ui/miscdlgs/linkarea.src @@ -0,0 +1,158 @@ +/************************************************************************* + * + * $RCSfile: linkarea.src,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: nn $ $Date: 2001-04-27 19:29:36 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include "linkarea.hrc" + +ModalDialog RID_SCDLG_LINKAREA +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Moveable = TRUE ; + Closeable = TRUE ; + Size = MAP_APPFONT ( 274 , 190 ) ; + Text = "Externe Datenquelle" ; + Text [ ENGLISH ] = "External Data Source" ; + OKButton BTN_OK + { + Pos = MAP_APPFONT ( 218 , 8 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + DefButton = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 218 , 25 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 218 , 49 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + }; + FixedLine FL_LOCATION + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 204 , 8 ) ; + Text = "~URL der externen Datenquelle" ; + Text [ ENGLISH ] = "External Data Source Location" ; + }; + ComboBox CB_URL + { + Pos = MAP_APPFONT ( 12 , 15 ) ; + Size = MAP_APPFONT ( 174 , 80 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + PushButton BTN_BROWSE + { + Pos = MAP_APPFONT ( 190 , 14 ) ; + Size = MAP_APPFONT ( 14 , 14 ) ; + Text = "..." ; + }; + FixedText FT_HINT + { + Pos = MAP_APPFONT ( 12 , 31 ) ; + Size = MAP_APPFONT ( 192 , 26 ) ; + WordBreak = TRUE ; + Text = "(URL des Quelldokuments im lokalen Dateisystem oder im Internet)" ; + Text [ ENGLISH ] = "(Insert a local file location or an URL from a web site here)" ; + }; + FixedText FT_RANGES + { + Pos = MAP_APPFONT ( 6 , 62 ) ; + Size = MAP_APPFONT ( 198 , 8 ) ; + Text = "~Verfgbare Tabellen/Bereiche" ; + Text [ ENGLISH ] = "Available Tables/Ranges" ; + }; + MultiListBox LB_RANGES + { + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 74 ) ; + Size = MAP_APPFONT ( 174 , 80 ) ; + AutoHScroll = TRUE ; + }; + CheckBox BTN_RELOAD + { + Pos = MAP_APPFONT ( 12 , 168 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + Text = "~Aktualisierung alle" ; + Text [ ENGLISH ] = "Auto reload data every" ; + }; + NumericField NF_DELAY + { + Border = TRUE ; + Pos = MAP_APPFONT ( 113 , 166 ) ; + Size = MAP_APPFONT ( 32 , 12 ) ; + TabStop = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 99999 ; + Value = 60 ; + }; + FixedText FT_SECONDS + { + Pos = MAP_APPFONT ( 149 , 168 ) ; + Size = MAP_APPFONT ( 59 , 8 ) ; + Text = "Sekunden" ; + Text [ ENGLISH ] = "seconds" ; + }; +}; + diff --git a/sc/source/ui/miscdlgs/makefile.mk b/sc/source/ui/miscdlgs/makefile.mk index 826d192d803a..937fb6487b53 100644 --- a/sc/source/ui/miscdlgs/makefile.mk +++ b/sc/source/ui/miscdlgs/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1.1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: hr $ $Date: 2000-09-18 16:45:02 $ +# last change: $Author: nn $ $Date: 2001-04-27 19:29:36 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -95,7 +95,7 @@ CXXFILES = \ crnrdlg.cxx shtabdlg.cxx \ instbdlg.cxx acredlin.cxx \ highred.cxx simpref.cxx \ - redcom.cxx + redcom.cxx linkarea.cxx SLOFILES = \ $(SLO)$/delcldlg.obj $(SLO)$/inscldlg.obj \ @@ -111,11 +111,11 @@ SLOFILES = \ $(SLO)$/crnrdlg.obj $(SLO)$/shtabdlg.obj \ $(SLO)$/instbdlg.obj $(SLO)$/acredlin.obj \ $(SLO)$/highred.obj $(SLO)$/simpref.obj \ - $(SLO)$/redcom.obj + $(SLO)$/redcom.obj $(SLO)$/linkarea.obj SRCFILES = \ instbdlg.src acredlin.src \ - highred.src + highred.src linkarea.src NOOPTFILES=\ $(SLO)$/chartdlg.obj diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 3fd96751f9f8..8e930da3b0d5 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cellsh1.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: nn $ $Date: 2001-04-23 14:47:52 $ + * last change: $Author: nn $ $Date: 2001-04-27 19:31:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -128,6 +128,8 @@ #include "inputhdl.hxx" #include "transobj.hxx" #include "drwtrans.hxx" +#include "linkarea.hxx" +#include "docfunc.hxx" #include "globstr.hrc" @@ -1811,6 +1813,41 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } break; + case SID_EXTERNAL_SOURCE: + { + ScLinkedAreaDlg* pDlg = new ScLinkedAreaDlg( pTabViewShell->GetDialogParent() ); + if (pDlg->Execute() == RET_OK) + { + ScRange aLinkRange; + BOOL bMove = FALSE; + + ScViewData* pViewData = GetViewData(); + ScMarkData& rMark = pViewData->GetMarkData(); + rMark.MarkToSimple(); + if ( rMark.IsMarked() ) + { + rMark.GetMarkArea( aLinkRange ); + bMove = TRUE; // insert/delete cells to fit range + } + else + aLinkRange = ScRange( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() ); + + String aFile = pDlg->GetURL(); + String aFilter = pDlg->GetFilter(); + String aOptions = pDlg->GetOptions(); + String aSource = pDlg->GetSource(); + ULONG nRefresh = pDlg->GetRefresh(); + if ( aFile.Len() && aSource.Len() ) // filter may be empty + { + ScDocFunc aFunc(*pViewData->GetDocShell()); + aFunc.InsertAreaLink( aFile, aFilter, aOptions, aSource, + aLinkRange, nRefresh, bMove, FALSE ); + } + } + delete pDlg; + } + break; + // // // diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index bb6604e40222..0f52843a84a8 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -2,9 +2,9 @@ * * $RCSfile: tabview3.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: nn $ $Date: 2001-04-20 18:53:41 $ + * last change: $Author: nn $ $Date: 2001-04-27 19:31:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -456,6 +456,7 @@ void ScTabView::SelectionChanged() // rBindings.Invalidate( FID_CONDITIONAL_FORMAT ); rBindings.Invalidate( SID_OPENDLG_CONDFRMT ); rBindings.Invalidate( FID_VALIDATION ); + rBindings.Invalidate( SID_EXTERNAL_SOURCE ); CellContentChanged(); } |