1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: linkmgr.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <bf_so3/linksrc.hxx>
36 #ifndef _TOOLS_STRING_HXX
37 #include <tools/string.hxx>
40 #include <bf_svtools/svarray.hxx>
43 #ifndef INCLUDED_SO3DLLAPI_H
44 #include "bf_so3/so3dllapi.h"
54 typedef SvBaseLinkRef
* SvBaseLinkRefPtr
;
55 SV_DECL_PTRARR( SvBaseLinks
, SvBaseLinkRefPtr
, 1, 1 )
57 typedef SvLinkSource
* SvLinkSourcePtr
;
58 SV_DECL_PTRARR( SvLinkSources
, SvLinkSourcePtr
, 1, 1 )
60 class SO3_DLLPUBLIC SvLinkManager
64 SvLinkSources aServerTbl
;
65 SvPersist
*pPersist
; // LinkMgr muss vor SvPersist freigegeben werden
67 BOOL
InsertLink( SvBaseLink
* pLink
, USHORT nObjType
, USHORT nUpdateType
,
68 const String
* pName
= 0 );
71 virtual ~SvLinkManager();
73 SvPersist
* GetPersist() const { return pPersist
; }
74 void SetPersist( SvPersist
* p
) { pPersist
= p
; }
76 void Remove( SvBaseLink
*pLink
);
77 void Remove( USHORT nPos
, USHORT nCnt
= 1 );
78 BOOL
Insert( SvBaseLink
* pLink
);
80 // den Link mit einem SvLinkSource verbinden und in die Liste eintragen
81 BOOL
InsertDDELink( SvBaseLink
*,
82 const String
& rServer
,
84 const String
& rItem
);
86 // falls am Link schon alles eingestellt ist !
87 BOOL
InsertDDELink( SvBaseLink
* );
89 // erfrage die Strings fuer den Dialog
90 virtual BOOL
GetDisplayNames( const SvBaseLink
*,
94 String
* pFilter
= 0 ) const;
96 virtual SvLinkSourceRef
CreateObj( SvBaseLink
* );
98 void UpdateAllLinks( BOOL bCallErrHdl
,
99 BOOL bUpdateGrfLinks
);
101 // Liste aller Links erfragen (z.B. fuer Verknuepfungs-Dialog)
102 const SvBaseLinks
& GetLinks() const { return aLinkTbl
; }
104 // ----------------- Serverseitige Verwaltung --------------------
106 // Liste der zu serviereden Links erfragen
107 const SvLinkSources
& GetServers() const { return aServerTbl
; }
108 // einen zu servierenden Link eintragen/loeschen
109 BOOL
InsertServer( SvLinkSource
* rObj
);
110 void RemoveServer( SvLinkSource
* rObj
);
111 void RemoveServer( USHORT nPos
, USHORT nCnt
= 1 )
112 { aServerTbl
.Remove( nPos
, nCnt
); }
115 // diese Methoden gibts nicht!
116 SO3_DLLPRIVATE
SvLinkManager( const SvLinkManager
& );
117 SO3_DLLPRIVATE SvLinkManager
& operator=( const SvLinkManager
& );
120 // Trenner im LinkName fuer die DDE-/File-/Grafik- Links
121 // (nur wer es braucht, um einen SvLinkName zusammenzubasteln)
122 const sal_Char cTokenSeperator
= '\xff';
124 // erzeuge einen String fuer den SvLinkName. Fuer
125 // - DDE die ersten 3 Strings, (Server, Topic, Item)
126 // - File-/Grf-LinkNms die letzen 3 Strings (FileName, Bereich, Filter)
127 void SO3_DLLPUBLIC
MakeLnkName( String
& rName
,
128 const String
* pType
, // kann auch 0 sein !!
131 const String
* pFilter
= 0 );