merge the formfield patch from ooo-build
[ooovba.git] / sw / inc / IMark.hxx
blob5143843cab8b6dff475fd4785f932c454465f6aa
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: bookmrk.hxx,v $
10 * $Revision: 1.11 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _IMARK_HXX
31 #define _IMARK_HXX
33 #include <vcl/keycod.hxx>
34 #include <calbck.hxx>
35 #include <pam.hxx>
36 #include <boost/operators.hpp>
38 #ifndef SW_DECL_SWSERVEROBJECT_DEFINED
39 #define SW_DECL_SWSERVEROBJECT_DEFINED
40 SV_DECL_REF( SwServerObject )
41 #endif
44 struct SwPosition;
46 namespace sw { namespace mark
48 class IMark
49 : virtual public SwModify // inherited as interface
50 , public ::boost::totally_ordered<IMark>
52 public:
53 //getters
54 virtual SwPosition& GetMarkPos() const =0;
55 // GetOtherMarkPos() is only guaranteed to return a valid
56 // reference if IsExpanded() returned true
57 virtual SwPosition& GetOtherMarkPos() const =0;
58 virtual SwPosition& GetMarkStart() const =0;
59 virtual SwPosition& GetMarkEnd() const =0;
60 virtual const ::rtl::OUString& GetName() const =0;
61 virtual bool IsExpanded() const =0;
62 virtual bool IsCoveringPosition(const SwPosition& rPos) const =0;
64 //setters
65 // not available in IMark
66 // inside core, you can cast to MarkBase and use its setters,
67 // make sure to update the sortings in Markmanager in this case
69 //operators and comparisons (non-virtual)
70 bool operator<(const IMark& rOther) const
71 { return GetMarkStart() < rOther.GetMarkStart(); }
72 bool operator==(const IMark& rOther) const
73 { return GetMarkStart() == rOther.GetMarkStart(); }
74 bool StartsBefore(const SwPosition& rPos) const
75 { return GetMarkStart() < rPos; }
76 bool StartsAfter(const SwPosition& rPos) const
77 { return GetMarkStart() > rPos; }
78 bool EndsBefore(const SwPosition& rPos) const
79 { return GetMarkEnd() < rPos; }
80 bool EndsAfter(const SwPosition& rPos) const
81 { return GetMarkEnd() > rPos; }
83 // Use for debugging purpose
84 virtual rtl::OUString toString( ) const = 0;
87 class IBookmark
88 : virtual public IMark
90 public:
91 virtual const ::rtl::OUString& GetShortName() const =0;
92 virtual const KeyCode& GetKeyCode() const =0;
93 virtual void SetShortName(const ::rtl::OUString&) =0;
94 virtual void SetKeyCode(const KeyCode&) =0;
97 class IFieldmark
98 : virtual public IMark
100 public:
101 typedef std::pair< ::rtl::OUString, ::rtl::OUString > ParamPair_t;
103 //getters
104 virtual ::rtl::OUString GetFieldname() const =0;
105 virtual ::rtl::OUString GetFieldHelptext() const =0;
107 virtual void addParam( rtl::OUString rParamName,
108 rtl::OUString rParamValue,
109 bool bReplaceExisting = true ) = 0;
110 virtual void addParam( const char* paramName, int value ) = 0;
111 virtual void addParams( std::vector<ParamPair_t>& params ) = 0;
112 virtual int getNumOfParams() const = 0;
113 virtual ParamPair_t getParam( int pos ) const = 0;
114 virtual ParamPair_t getParam( const char *name, const char *defaultValue = NULL ) const = 0;
116 //setters
117 virtual void SetFieldname(const ::rtl::OUString& rFieldname) =0;
118 virtual void SetFieldHelptext(const ::rtl::OUString& rFieldHelptext) =0;
119 virtual void invalidate( ) = 0;
122 class ICheckboxFieldmark
123 : virtual public IFieldmark
125 public:
126 virtual bool IsChecked() const =0;
127 virtual void SetChecked(bool checked) =0;
130 #endif