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 SwPosition& GetOtherMarkPos() const;
45             virtual SwPosition& GetMarkStart() const
46                 { return *m_pPos1; }
47             virtual SwPosition& GetMarkEnd() const
48                 { return *m_pPos1; }
49             virtual bool IsExpanded() const
50                 { return false; }
51 
52             // setters
53             virtual void SetMarkPos(const SwPosition& rNewPos);
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             }
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 ::rtl::OUString GenerateNewName();
77             static bool IsLegalName(const ::rtl::OUString& rName);
78             static const ::rtl::OUString our_sNamePrefix;
79     };
80 
81     class CrossRefNumItemBookmark
82         : public CrossRefBookmark
83     {
84         public:
85             CrossRefNumItemBookmark(const SwPaM& rPaM,
86                 const KeyCode& rCode,
87                 const ::rtl::OUString& rName,
88                 const ::rtl::OUString& rShortName);
89             static ::rtl::OUString GenerateNewName();
90             static bool IsLegalName(const ::rtl::OUString& rName);
91             static const ::rtl::OUString our_sNamePrefix;
92     };
93 
94 }}
95 #endif
96