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 _CROSSREFBOOKMRK_HXX
24 #define _CROSSREFBOOKMRK_HXX
25 
26 #include <IMark.hxx>
27 #include <bookmrk.hxx>
28 #include <rtl/ustring.hxx>
29 
30 
31 namespace sw { namespace mark
32 {
33     class CrossRefBookmark
34         : public Bookmark
35     {
36         public:
37             CrossRefBookmark(const SwPaM& rPaM,
38                 const KeyCode& rCode,
39                 const ::rtl::OUString& rName,
40                 const ::rtl::OUString& rShortName,
41                 const ::rtl::OUString& rPrefix);
42 
43             // getters
44             virtual const SwPosition& GetOtherMarkPos() const;
GetMarkStart() const45             virtual const SwPosition& GetMarkStart() const
46                 { return *m_pPos1; }
GetMarkEnd() const47             virtual const SwPosition& GetMarkEnd() const
48                 { return *m_pPos1; }
IsExpanded() const49             virtual bool IsExpanded() const
50                 { return false; }
51 
52             // setters
53             virtual void SetMarkPos(const SwPosition& rNewPos);
SetOtherMarkPos(const SwPosition &)54             virtual void SetOtherMarkPos(const SwPosition&)
55             {
56                 OSL_PRECOND(false,
57                     "<CrossRefBookmark::SetOtherMarkPos(..)>"
58                     " - misusage of CrossRefBookmark: other bookmark position isn't allowed to be set." );
59             }
ClearOtherMarkPos()60             virtual void ClearOtherMarkPos()
61             {
62                 OSL_PRECOND(false,
63                     "<SwCrossRefBookmark::ClearOtherMarkPos(..)>"
64                     " - misusage of CrossRefBookmark: other bookmark position isn't allowed to be set or cleared." );
65             }
66     };
67 
68     class CrossRefHeadingBookmark
69         : public CrossRefBookmark
70     {
71         public:
72             CrossRefHeadingBookmark(const SwPaM& rPaM,
73                 const KeyCode& rCode,
74                 const ::rtl::OUString& rName,
75                 const ::rtl::OUString& rShortName);
76             static bool IsLegalName(const ::rtl::OUString& rName);
77     };
78 
79     class CrossRefNumItemBookmark
80         : public CrossRefBookmark
81     {
82         public:
83             CrossRefNumItemBookmark(const SwPaM& rPaM,
84                 const KeyCode& rCode,
85                 const ::rtl::OUString& rName,
86                 const ::rtl::OUString& rShortName);
87             static bool IsLegalName(const ::rtl::OUString& rName);
88             static const ::rtl::OUString our_sNamePrefix;
89     };
90 
91 }}
92 #endif
93