1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _IMARK_HXX 28 #define _IMARK_HXX 29 30 #include <vcl/keycod.hxx> 31 #include <calbck.hxx> 32 #include <pam.hxx> 33 #include <boost/operators.hpp> 34 #include <map> 35 36 #ifndef SW_DECL_SWSERVEROBJECT_DEFINED 37 #define SW_DECL_SWSERVEROBJECT_DEFINED 38 SV_DECL_REF( SwServerObject ) 39 #endif 40 41 42 struct SwPosition; 43 44 namespace sw { namespace mark 45 { 46 class IMark 47 : virtual public SwModify // inherited as interface 48 , public ::boost::totally_ordered<IMark> 49 { 50 public: 51 //getters 52 virtual const SwPosition& GetMarkPos() const =0; 53 // GetOtherMarkPos() is only guaranteed to return a valid 54 // reference if IsExpanded() returned true 55 virtual const SwPosition& GetOtherMarkPos() const =0; 56 virtual const SwPosition& GetMarkStart() const =0; 57 virtual const SwPosition& GetMarkEnd() const =0; 58 virtual const ::rtl::OUString& GetName() const =0; 59 virtual bool IsExpanded() const =0; 60 virtual bool IsCoveringPosition(const SwPosition& rPos) const =0; 61 62 //setters 63 // not available in IMark 64 // inside core, you can cast to MarkBase and use its setters, 65 // make sure to update the sortings in Markmanager in this case 66 67 //operators and comparisons (non-virtual) 68 bool operator<(const IMark& rOther) const 69 { return GetMarkStart() < rOther.GetMarkStart(); } 70 bool operator==(const IMark& rOther) const 71 { return GetMarkStart() == rOther.GetMarkStart(); } 72 bool StartsBefore(const SwPosition& rPos) const 73 { return GetMarkStart() < rPos; } 74 bool StartsAfter(const SwPosition& rPos) const 75 { return GetMarkStart() > rPos; } 76 bool EndsBefore(const SwPosition& rPos) const 77 { return GetMarkEnd() < rPos; } 78 bool EndsAfter(const SwPosition& rPos) const 79 { return GetMarkEnd() > rPos; } 80 81 virtual rtl::OUString ToString( ) const =0; 82 }; 83 84 class IBookmark 85 : virtual public IMark 86 { 87 public: 88 virtual const ::rtl::OUString& GetShortName() const =0; 89 virtual const KeyCode& GetKeyCode() const =0; 90 virtual void SetShortName(const ::rtl::OUString&) =0; 91 virtual void SetKeyCode(const KeyCode&) =0; 92 }; 93 94 class IFieldmark 95 : virtual public IMark 96 { 97 public: 98 typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any> parameter_map_t; 99 //getters 100 virtual ::rtl::OUString GetFieldname() const =0; 101 virtual ::rtl::OUString GetFieldHelptext() const =0; 102 virtual parameter_map_t* GetParameters() =0; 103 virtual const parameter_map_t* GetParameters() const =0; 104 105 //setters 106 virtual void SetFieldname(const ::rtl::OUString& rFieldname) =0; 107 virtual void SetFieldHelptext(const ::rtl::OUString& rFieldHelptext) =0; 108 virtual void Invalidate() = 0; 109 }; 110 111 class ICheckboxFieldmark 112 : virtual public IFieldmark 113 { 114 public: 115 virtual bool IsChecked() const =0; 116 virtual void SetChecked(bool checked) =0; 117 }; 118 }} 119 #endif 120