xref: /trunk/main/sw/inc/swserv.hxx (revision cdf0e10c)
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 #ifndef _SWSERV_HXX
28 #define _SWSERV_HXX
29 
30 #include <sfx2/linksrc.hxx>
31 #include <IMark.hxx>
32 
33 class SwSectionNode;
34 class SwBaseLink;
35 class SwTableNode;
36 struct SwPosition;
37 class SwPaM;
38 
39 class SwServerObject : public ::sfx2::SvLinkSource
40 {
41     using sfx2::SvLinkSource::SendDataChanged;
42 
43 protected:
44     enum ServerModes { BOOKMARK_SERVER, TABLE_SERVER, SECTION_SERVER, NONE_SERVER } eType;
45     union {
46         ::sw::mark::IMark* pBkmk;
47         SwTableNode* pTblNd;
48         SwSectionNode* pSectNd;
49     } CNTNT_TYPE;
50 
51     SwServerObject();
52 
53 public:
54     SwServerObject( ::sw::mark::IMark& rBookmark )
55         : eType( BOOKMARK_SERVER )
56     {
57         CNTNT_TYPE.pBkmk = &rBookmark;
58     }
59     SwServerObject( SwTableNode& rTableNd )
60         : eType( TABLE_SERVER )
61     {
62         CNTNT_TYPE.pTblNd = &rTableNd;
63     }
64     SwServerObject( SwSectionNode& rSectNd )
65         : eType( SECTION_SERVER )
66     {
67         CNTNT_TYPE.pSectNd = &rSectNd;
68     }
69     virtual ~SwServerObject();
70 
71     virtual sal_Bool GetData( ::com::sun::star::uno::Any & rData,
72                             const String & rMimeType,
73                             sal_Bool bSynchron = sal_False );
74 
75     sal_Bool SetData( const String & rMimeType,
76                     const ::com::sun::star::uno::Any& rData );
77 
78     virtual void SendDataChanged( const SwPosition& rPos );
79     virtual void SendDataChanged( const SwPaM& rRange );
80 
81     sal_Bool IsLinkInServer( const SwBaseLink* ) const;
82 
83     void SetNoServer();
84     void SetDdeBookmark( ::sw::mark::IMark& rBookmark);
85 };
86 
87 #ifndef SW_DECL_SWSERVEROBJECT_DEFINED
88 #define SW_DECL_SWSERVEROBJECT_DEFINED
89 SV_DECL_REF( SwServerObject )
90 #endif
91 
92 #endif  // _SWSERV_HXX
93 
94