update emoji autocorrect entries from po-files
[LibreOffice.git] / include / sfx2 / linkmgr.hxx
blob6d4bc03fd6aebdc9df969618f7c45d5cc9afe2ce
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SFX2_LINKMGR_HXX
20 #define INCLUDED_SFX2_LINKMGR_HXX
22 #include <rtl/ustring.hxx>
23 #include <sal/config.h>
24 #include <sfx2/dllapi.h>
25 #include <sfx2/linksrc.hxx>
26 #include <sfx2/lnkbase.hxx>
27 #include <set>
28 #include <vector>
30 class SfxObjectShell;
31 class Graphic;
32 class Size;
34 namespace com { namespace sun { namespace star {
35 namespace lang {
36 class XComponent;
38 }}}
40 namespace sfx2
42 // For the link to receive information about the status of graphics that
43 // will be loaded the FileObject sends a SvData, which contains the
44 // FormatID "RegisterStatusInfoId" and a string as the data container.
45 // This contains the following enum.
47 typedef std::vector<SvBaseLinkRef*> SvBaseLinks;
49 typedef std::set<SvLinkSource*> SvLinkSources;
51 class SFX2_DLLPUBLIC LinkManager
53 typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > >
54 CompVector;
55 CompVector maCachedComps;
57 SvBaseLinks aLinkTbl;
58 SvLinkSources aServerTbl;
60 SfxObjectShell *pPersist; // LinkMgr must be release before SfxObjectShell
61 protected:
62 bool InsertLink( SvBaseLink* pLink, sal_uInt16 nObjType, SfxLinkUpdateMode nUpdateType,
63 const OUString* pName = 0 );
64 public:
66 enum LinkState
68 STATE_LOAD_OK,
69 STATE_LOAD_ERROR,
70 STATE_LOAD_ABORT
73 LinkManager( SfxObjectShell * pCacheCont );
74 ~LinkManager();
76 /**
77 * Insert a component loaded during link update, which needs to be closed
78 * when the update is complete.
80 * @param xComp component loaded during link update.
82 void InsertCachedComp(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xComp);
84 void CloseCachedComps();
86 SfxObjectShell* GetPersist() const { return pPersist; }
87 void SetPersist( SfxObjectShell * p ) { pPersist = p; }
89 void Remove( SvBaseLink *pLink );
90 void Remove( size_t nPos, size_t nCnt = 1 );
91 bool Insert( SvBaseLink* pLink );
93 // the links connect to a SvLinkSource and adds to the list
94 bool InsertDDELink( SvBaseLink*,
95 const OUString& rServer,
96 const OUString& rTopic,
97 const OUString& rItem );
99 // if everything is already set at the link!
100 bool InsertDDELink( SvBaseLink* );
102 // Connect the links to a pseudo-object and add to the list
103 bool InsertFileLink( sfx2::SvBaseLink&,
104 sal_uInt16 nFileType,
105 const OUString& rFileNm,
106 const OUString* pFilterNm = NULL,
107 const OUString* pRange = NULL );
109 void ReconnectDdeLink(SfxObjectShell& rServer);
112 * Reconnect the server document shell to a DDE link object.
114 * @param rPath path to the server document
115 * @param rServer server document shell instance
116 * @param rLink link object of the client document
118 static void LinkServerShell(const OUString& rPath, SfxObjectShell& rServer, ::sfx2::SvBaseLink& rLink);
120 // Obtain the string for the dialog
121 static bool GetDisplayNames( const SvBaseLink *,
122 OUString* pType,
123 OUString* pFile = NULL,
124 OUString* pLink = NULL,
125 OUString* pFilter = NULL );
127 static SvLinkSourceRef CreateObj( SvBaseLink* );
129 void UpdateAllLinks( bool bAskUpdate = true,
130 bool bCallErrHdl = true,
131 bool bUpdateGrfLinks = false,
132 vcl::Window* pParentWin = 0 );
134 // Call for list of links (eg for link-dialog)
135 const SvBaseLinks& GetLinks() const { return aLinkTbl; }
137 // ----------------- Server-side management --------------------
139 // Call with list of links to server
140 const SvLinkSources& GetServers() const { return aServerTbl; }
141 // Link register/delete
142 bool InsertServer( SvLinkSource* rObj );
143 void RemoveServer( SvLinkSource* rObj );
145 // A transfer is aborted, so cancel all download media
146 // (for the time being this is only of interest for the FileLinks!)
147 void CancelTransfers();
149 // To send status information from the FileObject to the Baselink,
150 // for this there exist a separate ClipBoardId. The SvData-object has
151 // got the appropriate information as a string.
152 // Is now required for FileObject in conjunction with JavaScript
153 // this needs information about Load/Abort/Error
154 static SotClipboardFormatId RegisterStatusInfoId();
156 // if the mimetype says graphic/bitmap/gdimetafile then get the
157 // graphic from the Any. Return says no errors
158 static bool GetGraphicFromAny( const OUString& rMimeType,
159 const ::com::sun::star::uno::Any & rValue,
160 Graphic& rGrf );
162 private:
163 LinkManager( const LinkManager& ) SAL_DELETED_FUNCTION;
164 LinkManager& operator=( const LinkManager& ) SAL_DELETED_FUNCTION;
167 // Separator in the link name for the DDE-/File-/Graphics- links
168 // (only those who need to construct a SvLinkName)
169 const sal_Unicode cTokenSeparator = 0xFFFF;
171 // create a string for the SvLinkName. For:
172 // - DDE the first 3 Strings, (Server, Topic, Item)
173 // - File-/Graphics-LinkNames the last 3 Strings (FileName, Region, Filter)
174 SFX2_DLLPUBLIC void MakeLnkName( OUString& rName,
175 const OUString* pType, // Can also be null!!
176 const OUString& rFile,
177 const OUString& rLink,
178 const OUString* pFilter = 0 );
182 #endif
184 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */