1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SC_TABLINK_HXX 29 #define SC_TABLINK_HXX 30 31 #include "scdllapi.h" 32 #include "refreshtimer.hxx" 33 #include <sfx2/lnkbase.hxx> 34 35 #include <sfx2/objsh.hxx> 36 //REMOVE #ifndef SO2_DECL_SVEMBEDDEDOBJECT_DEFINED 37 //REMOVE #define SO2_DECL_SVEMBEDDEDOBJECT_DEFINED 38 //REMOVE SO2_DECL_REF(SvEmbeddedObject) 39 //REMOVE #endif 40 41 class ScDocShell; 42 struct TableLink_Impl; 43 44 class ScTableLink : public ::sfx2::SvBaseLink, public ScRefreshTimer 45 { 46 private: 47 TableLink_Impl* pImpl; 48 String aFileName; 49 String aFilterName; 50 String aOptions; 51 sal_Bool bInCreate; 52 sal_Bool bInEdit; 53 sal_Bool bAddUndo; 54 sal_Bool bDoPaint; 55 56 public: 57 TYPEINFO(); 58 ScTableLink( ScDocShell* pDocSh, const String& rFile, 59 const String& rFilter, const String& rOpt, sal_uLong nRefresh ); 60 ScTableLink( SfxObjectShell* pShell, const String& rFile, 61 const String& rFilter, const String& rOpt, sal_uLong nRefresh ); 62 virtual ~ScTableLink(); 63 virtual void Closed(); 64 virtual void DataChanged( const String& rMimeType, 65 const ::com::sun::star::uno::Any & rValue ); 66 67 virtual void Edit( Window*, const Link& rEndEditHdl ); 68 69 sal_Bool Refresh(const String& rNewFile, const String& rNewFilter, 70 const String* pNewOptions /* = NULL */, sal_uLong nNewRefresh ); 71 void SetInCreate(sal_Bool bSet) { bInCreate = bSet; } 72 void SetAddUndo(sal_Bool bSet) { bAddUndo = bSet; } 73 void SetPaint(sal_Bool bSet) { bDoPaint = bSet; } 74 75 const String& GetFileName() const { return aFileName; } 76 const String& GetFilterName() const { return aFilterName; } 77 const String& GetOptions() const { return aOptions; } 78 79 sal_Bool IsUsed() const; 80 81 DECL_LINK( RefreshHdl, ScTableLink* ); 82 DECL_LINK( TableEndEditHdl, ::sfx2::SvBaseLink* ); 83 }; 84 85 class ScDocument; 86 class SfxMedium; 87 88 class SC_DLLPUBLIC ScDocumentLoader 89 { 90 private: 91 ScDocShell* pDocShell; 92 SfxObjectShellRef aRef; 93 SfxMedium* pMedium; 94 95 public: 96 ScDocumentLoader( const String& rFileName, 97 String& rFilterName, String& rOptions, 98 sal_uInt32 nRekCnt = 0, sal_Bool bWithInteraction = sal_False ); 99 ~ScDocumentLoader(); 100 ScDocument* GetDocument(); 101 ScDocShell* GetDocShell() { return pDocShell; } 102 sal_Bool IsError() const; 103 String GetTitle() const; 104 105 void ReleaseDocRef(); // without calling DoClose 106 107 static String GetOptions( SfxMedium& rMedium ); 108 109 /** Returns the filter name and options from a file name. 110 @param bWithContent 111 true = Tries to detect the filter by looking at the file contents. 112 false = Detects filter by file name extension only (should be used in filter code only). 113 @return sal_True if a filter could be found, sal_False otherwise. */ 114 static sal_Bool GetFilterName( const String& rFileName, 115 String& rFilter, String& rOptions, 116 sal_Bool bWithContent, sal_Bool bWithInteraction ); 117 118 static void RemoveAppPrefix( String& rFilterName ); 119 }; 120 121 #endif 122