xref: /aoo42x/main/sw/inc/IMark.hxx (revision 1d2dbeb0)
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 _IMARK_HXX
24 #define _IMARK_HXX
25 
26 #include <vcl/keycod.hxx>
27 #include <calbck.hxx>
28 #include <pam.hxx>
29 #include <boost/operators.hpp>
30 #include <map>
31 
32 #ifndef SW_DECL_SWSERVEROBJECT_DEFINED
33 #define SW_DECL_SWSERVEROBJECT_DEFINED
34 SV_DECL_REF( SwServerObject )
35 #endif
36 
37 
38 struct SwPosition;
39 
40 namespace sw { namespace mark
41 {
42     class IMark
43         : virtual public SwModify // inherited as interface
44         , public ::boost::totally_ordered<IMark>
45     {
46         public:
47             //getters
48             virtual const SwPosition& GetMarkPos() const =0;
49             // GetOtherMarkPos() is only guaranteed to return a valid
50             // reference if IsExpanded() returned true
51             virtual const SwPosition& GetOtherMarkPos() const =0;
52             virtual const SwPosition& GetMarkStart() const =0;
53             virtual const SwPosition& GetMarkEnd() const =0;
54             virtual const ::rtl::OUString& GetName() const =0;
55             virtual bool IsExpanded() const =0;
56             virtual bool IsCoveringPosition(const SwPosition& rPos) const =0;
57 
58             //setters
59             // not available in IMark
60             // inside core, you can cast to MarkBase and use its setters,
61             // make sure to update the sortings in Markmanager in this case
62 
63             //operators and comparisons (non-virtual)
operator <(const IMark & rOther) const64             bool operator<(const IMark& rOther) const
65                 { return GetMarkStart() < rOther.GetMarkStart(); }
operator ==(const IMark & rOther) const66             bool operator==(const IMark& rOther) const
67                 { return GetMarkStart() == rOther.GetMarkStart(); }
StartsBefore(const SwPosition & rPos) const68             bool StartsBefore(const SwPosition& rPos) const
69                 { return GetMarkStart() < rPos; }
StartsAfter(const SwPosition & rPos) const70             bool StartsAfter(const SwPosition& rPos) const
71                 { return GetMarkStart() > rPos; }
EndsBefore(const SwPosition & rPos) const72             bool EndsBefore(const SwPosition& rPos) const
73                 { return GetMarkEnd() < rPos; }
EndsAfter(const SwPosition & rPos) const74             bool EndsAfter(const SwPosition& rPos) const
75                 { return GetMarkEnd() > rPos; }
76 
77             virtual rtl::OUString ToString( ) const =0;
78     };
79 
80     class IBookmark
81         : virtual public IMark
82     {
83         public:
84             virtual const ::rtl::OUString& GetShortName() const =0;
85             virtual const KeyCode& GetKeyCode() const =0;
86             virtual void SetShortName(const ::rtl::OUString&) =0;
87             virtual void SetKeyCode(const KeyCode&) =0;
88     };
89 
90     class IFieldmark
91         : virtual public IMark
92     {
93         public:
94             typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any> parameter_map_t;
95             //getters
96             virtual ::rtl::OUString GetFieldname() const =0;
97             virtual ::rtl::OUString GetFieldHelptext() const =0;
98             virtual parameter_map_t* GetParameters() =0;
99             virtual const parameter_map_t* GetParameters() const =0;
100 
101             //setters
102             virtual void SetFieldname(const ::rtl::OUString& rFieldname) =0;
103             virtual void SetFieldHelptext(const ::rtl::OUString& rFieldHelptext) =0;
104             virtual void Invalidate() = 0;
105     };
106 
107     class ICheckboxFieldmark
108         : virtual public IFieldmark
109     {
110         public:
111             virtual bool IsChecked() const =0;
112             virtual void SetChecked(bool checked) =0;
113     };
114 }}
115 #endif
116