Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _IMARK_HXX
20 : #define _IMARK_HXX
21 :
22 : #include <vcl/keycod.hxx>
23 : #include <calbck.hxx>
24 : #include <pam.hxx>
25 : #include <boost/operators.hpp>
26 : #include <map>
27 : #include "swdll.hxx"
28 :
29 : #ifndef SW_DECL_SWSERVEROBJECT_DEFINED
30 : #define SW_DECL_SWSERVEROBJECT_DEFINED
31 158 : SV_DECL_REF( SwServerObject )
32 : #endif
33 :
34 :
35 : struct SwPosition;
36 :
37 : namespace sw { namespace mark
38 : {
39 4155 : class SAL_DLLPUBLIC_EXPORT IMark
40 : : virtual public SwModify // inherited as interface
41 : , public ::boost::totally_ordered<IMark>
42 : {
43 : public:
44 : //getters
45 : virtual const SwPosition& GetMarkPos() const =0;
46 : // GetOtherMarkPos() is only guaranteed to return a valid
47 : // reference if IsExpanded() returned true
48 : virtual const SwPosition& GetOtherMarkPos() const =0;
49 : virtual const SwPosition& GetMarkStart() const =0;
50 : virtual const SwPosition& GetMarkEnd() const =0;
51 : virtual const ::rtl::OUString& GetName() const =0;
52 : virtual bool IsExpanded() const =0;
53 : virtual bool IsCoveringPosition(const SwPosition& rPos) const =0;
54 :
55 : //setters
56 : // not available in IMark
57 : // inside core, you can cast to MarkBase and use its setters,
58 : // make sure to update the sortings in Markmanager in this case
59 :
60 : //operators and comparisons (non-virtual)
61 : bool operator<(const IMark& rOther) const
62 : { return GetMarkStart() < rOther.GetMarkStart(); }
63 4 : bool operator==(const IMark& rOther) const
64 4 : { return GetMarkStart() == rOther.GetMarkStart(); }
65 4469 : bool StartsBefore(const SwPosition& rPos) const
66 4469 : { return GetMarkStart() < rPos; }
67 1 : bool StartsAfter(const SwPosition& rPos) const
68 1 : { return GetMarkStart() > rPos; }
69 0 : bool EndsBefore(const SwPosition& rPos) const
70 0 : { return GetMarkEnd() < rPos; }
71 : bool EndsAfter(const SwPosition& rPos) const
72 : { return GetMarkEnd() > rPos; }
73 :
74 : virtual rtl::OUString ToString( ) const =0;
75 : };
76 :
77 30 : class SAL_DLLPUBLIC_EXPORT IBookmark
78 : : virtual public IMark
79 : {
80 : public:
81 : virtual const ::rtl::OUString& GetShortName() const =0;
82 : virtual const KeyCode& GetKeyCode() const =0;
83 : virtual void SetShortName(const ::rtl::OUString&) =0;
84 : virtual void SetKeyCode(const KeyCode&) =0;
85 : };
86 :
87 10 : class SAL_DLLPUBLIC_EXPORT IFieldmark
88 : : virtual public IMark
89 : {
90 : public:
91 : typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any> parameter_map_t;
92 : //getters
93 : virtual ::rtl::OUString GetFieldname() const =0;
94 : virtual ::rtl::OUString GetFieldHelptext() const =0;
95 : virtual parameter_map_t* GetParameters() =0;
96 : virtual const parameter_map_t* GetParameters() const =0;
97 :
98 : //setters
99 : virtual void SetFieldname(const ::rtl::OUString& rFieldname) =0;
100 : virtual void SetFieldHelptext(const ::rtl::OUString& rFieldHelptext) =0;
101 : virtual void Invalidate() = 0;
102 : };
103 :
104 1 : class SAL_DLLPUBLIC_EXPORT ICheckboxFieldmark
105 : : virtual public IFieldmark
106 : {
107 : public:
108 : virtual bool IsChecked() const =0;
109 : virtual void SetChecked(bool checked) =0;
110 : };
111 : }}
112 : #endif
113 :
114 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|