1*1d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*1d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*1d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*1d2dbeb0SAndrew Rist * distributed with this work for additional information 6*1d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*1d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*1d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 9*1d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 10*1d2dbeb0SAndrew Rist * 11*1d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*1d2dbeb0SAndrew Rist * 13*1d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*1d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 15*1d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*1d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 17*1d2dbeb0SAndrew Rist * specific language governing permissions and limitations 18*1d2dbeb0SAndrew Rist * under the License. 19*1d2dbeb0SAndrew Rist * 20*1d2dbeb0SAndrew Rist *************************************************************/ 21*1d2dbeb0SAndrew Rist 22*1d2dbeb0SAndrew Rist 23cdf0e10cSrcweir #ifndef _IMARK_HXX 24cdf0e10cSrcweir #define _IMARK_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <vcl/keycod.hxx> 27cdf0e10cSrcweir #include <calbck.hxx> 28cdf0e10cSrcweir #include <pam.hxx> 29cdf0e10cSrcweir #include <boost/operators.hpp> 30cdf0e10cSrcweir #include <map> 31cdf0e10cSrcweir 32cdf0e10cSrcweir #ifndef SW_DECL_SWSERVEROBJECT_DEFINED 33cdf0e10cSrcweir #define SW_DECL_SWSERVEROBJECT_DEFINED 34cdf0e10cSrcweir SV_DECL_REF( SwServerObject ) 35cdf0e10cSrcweir #endif 36cdf0e10cSrcweir 37cdf0e10cSrcweir 38cdf0e10cSrcweir struct SwPosition; 39cdf0e10cSrcweir 40cdf0e10cSrcweir namespace sw { namespace mark 41cdf0e10cSrcweir { 42cdf0e10cSrcweir class IMark 43cdf0e10cSrcweir : virtual public SwModify // inherited as interface 44cdf0e10cSrcweir , public ::boost::totally_ordered<IMark> 45cdf0e10cSrcweir { 46cdf0e10cSrcweir public: 47cdf0e10cSrcweir //getters 48cdf0e10cSrcweir virtual const SwPosition& GetMarkPos() const =0; 49cdf0e10cSrcweir // GetOtherMarkPos() is only guaranteed to return a valid 50cdf0e10cSrcweir // reference if IsExpanded() returned true 51cdf0e10cSrcweir virtual const SwPosition& GetOtherMarkPos() const =0; 52cdf0e10cSrcweir virtual const SwPosition& GetMarkStart() const =0; 53cdf0e10cSrcweir virtual const SwPosition& GetMarkEnd() const =0; 54cdf0e10cSrcweir virtual const ::rtl::OUString& GetName() const =0; 55cdf0e10cSrcweir virtual bool IsExpanded() const =0; 56cdf0e10cSrcweir virtual bool IsCoveringPosition(const SwPosition& rPos) const =0; 57cdf0e10cSrcweir 58cdf0e10cSrcweir //setters 59cdf0e10cSrcweir // not available in IMark 60cdf0e10cSrcweir // inside core, you can cast to MarkBase and use its setters, 61cdf0e10cSrcweir // make sure to update the sortings in Markmanager in this case 62cdf0e10cSrcweir 63cdf0e10cSrcweir //operators and comparisons (non-virtual) operator <(const IMark & rOther) const64cdf0e10cSrcweir bool operator<(const IMark& rOther) const 65cdf0e10cSrcweir { return GetMarkStart() < rOther.GetMarkStart(); } operator ==(const IMark & rOther) const66cdf0e10cSrcweir bool operator==(const IMark& rOther) const 67cdf0e10cSrcweir { return GetMarkStart() == rOther.GetMarkStart(); } StartsBefore(const SwPosition & rPos) const68cdf0e10cSrcweir bool StartsBefore(const SwPosition& rPos) const 69cdf0e10cSrcweir { return GetMarkStart() < rPos; } StartsAfter(const SwPosition & rPos) const70cdf0e10cSrcweir bool StartsAfter(const SwPosition& rPos) const 71cdf0e10cSrcweir { return GetMarkStart() > rPos; } EndsBefore(const SwPosition & rPos) const72cdf0e10cSrcweir bool EndsBefore(const SwPosition& rPos) const 73cdf0e10cSrcweir { return GetMarkEnd() < rPos; } EndsAfter(const SwPosition & rPos) const74cdf0e10cSrcweir bool EndsAfter(const SwPosition& rPos) const 75cdf0e10cSrcweir { return GetMarkEnd() > rPos; } 76cdf0e10cSrcweir 77cdf0e10cSrcweir virtual rtl::OUString ToString( ) const =0; 78cdf0e10cSrcweir }; 79cdf0e10cSrcweir 80cdf0e10cSrcweir class IBookmark 81cdf0e10cSrcweir : virtual public IMark 82cdf0e10cSrcweir { 83cdf0e10cSrcweir public: 84cdf0e10cSrcweir virtual const ::rtl::OUString& GetShortName() const =0; 85cdf0e10cSrcweir virtual const KeyCode& GetKeyCode() const =0; 86cdf0e10cSrcweir virtual void SetShortName(const ::rtl::OUString&) =0; 87cdf0e10cSrcweir virtual void SetKeyCode(const KeyCode&) =0; 88cdf0e10cSrcweir }; 89cdf0e10cSrcweir 90cdf0e10cSrcweir class IFieldmark 91cdf0e10cSrcweir : virtual public IMark 92cdf0e10cSrcweir { 93cdf0e10cSrcweir public: 94cdf0e10cSrcweir typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any> parameter_map_t; 95cdf0e10cSrcweir //getters 96cdf0e10cSrcweir virtual ::rtl::OUString GetFieldname() const =0; 97cdf0e10cSrcweir virtual ::rtl::OUString GetFieldHelptext() const =0; 98cdf0e10cSrcweir virtual parameter_map_t* GetParameters() =0; 99cdf0e10cSrcweir virtual const parameter_map_t* GetParameters() const =0; 100cdf0e10cSrcweir 101cdf0e10cSrcweir //setters 102cdf0e10cSrcweir virtual void SetFieldname(const ::rtl::OUString& rFieldname) =0; 103cdf0e10cSrcweir virtual void SetFieldHelptext(const ::rtl::OUString& rFieldHelptext) =0; 104cdf0e10cSrcweir virtual void Invalidate() = 0; 105cdf0e10cSrcweir }; 106cdf0e10cSrcweir 107cdf0e10cSrcweir class ICheckboxFieldmark 108cdf0e10cSrcweir : virtual public IFieldmark 109cdf0e10cSrcweir { 110cdf0e10cSrcweir public: 111cdf0e10cSrcweir virtual bool IsChecked() const =0; 112cdf0e10cSrcweir virtual void SetChecked(bool checked) =0; 113cdf0e10cSrcweir }; 114cdf0e10cSrcweir }} 115cdf0e10cSrcweir #endif 116