xref: /aoo4110/main/sw/inc/swserv.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _SWSERV_HXX
24 #define _SWSERV_HXX
25 
26 #include <sfx2/linksrc.hxx>
27 #include <IMark.hxx>
28 
29 class SwSectionNode;
30 class SwBaseLink;
31 class SwTableNode;
32 struct SwPosition;
33 class SwPaM;
34 
35 class SwServerObject : public ::sfx2::SvLinkSource
36 {
37     using sfx2::SvLinkSource::SendDataChanged;
38 
39 protected:
40     enum ServerModes { BOOKMARK_SERVER, TABLE_SERVER, SECTION_SERVER, NONE_SERVER } eType;
41     union {
42         ::sw::mark::IMark* pBkmk;
43         SwTableNode* pTblNd;
44         SwSectionNode* pSectNd;
45     } CNTNT_TYPE;
46 
47     SwServerObject();
48 
49 public:
SwServerObject(::sw::mark::IMark & rBookmark)50     SwServerObject( ::sw::mark::IMark& rBookmark )
51         : eType( BOOKMARK_SERVER )
52     {
53         CNTNT_TYPE.pBkmk = &rBookmark;
54     }
SwServerObject(SwTableNode & rTableNd)55     SwServerObject( SwTableNode& rTableNd )
56         : eType( TABLE_SERVER )
57     {
58         CNTNT_TYPE.pTblNd = &rTableNd;
59     }
SwServerObject(SwSectionNode & rSectNd)60     SwServerObject( SwSectionNode& rSectNd )
61         : eType( SECTION_SERVER )
62     {
63         CNTNT_TYPE.pSectNd = &rSectNd;
64     }
65     virtual ~SwServerObject();
66 
67     virtual sal_Bool GetData( ::com::sun::star::uno::Any & rData,
68                             const String & rMimeType,
69                             sal_Bool bSynchron = sal_False );
70 
71     sal_Bool SetData( const String & rMimeType,
72                     const ::com::sun::star::uno::Any& rData );
73 
74     virtual void SendDataChanged( const SwPosition& rPos );
75     virtual void SendDataChanged( const SwPaM& rRange );
76 
77     sal_Bool IsLinkInServer( const SwBaseLink* ) const;
78 
79     void SetNoServer();
80     void SetDdeBookmark( ::sw::mark::IMark& rBookmark);
81 };
82 
83 #ifndef SW_DECL_SWSERVEROBJECT_DEFINED
84 #define SW_DECL_SWSERVEROBJECT_DEFINED
85 SV_DECL_REF( SwServerObject )
86 #endif
87 
88 #endif  // _SWSERV_HXX
89 
90