<commit_before>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: bookmrk.hxx,v $
 *
 *  $Revision: 1.8 $
 *
 *  last change: $Author: kz $ $Date: 2006-11-08 13:20:14 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/
#ifndef _BOOKMRK_HXX
#define _BOOKMRK_HXX

#include "hintids.hxx"      //die Ids der Attribute, vor macitem damit die
                            //die Attribut richtig angezogen werden.
#ifndef _SFXMACITEM_HXX
#include <svtools/macitem.hxx>
#endif

#ifndef _KEYCOD_HXX //autogen
#include <vcl/keycod.hxx>
#endif
#ifndef _TOOLS_REF_HXX
#include <tools/ref.hxx>
#endif
#ifndef IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED
#include <IDocumentBookmarkAccess.hxx>
#endif
#ifndef _CALBCK_HXX
#include <calbck.hxx>
#endif
#ifndef _PAM_HXX
#include <pam.hxx>
#endif

#ifndef SW_DECL_SWSERVEROBJECT_DEFINED
#define SW_DECL_SWSERVEROBJECT_DEFINED
SV_DECL_REF( SwServerObject )
#endif


struct SwPosition;  // fwd Decl. wg. UI

class SwBookmark : public SwModify
{
    friend class SwDoc;         // fuers Loeschen
//  friend class Sw3IoImp;      // fuers Setzen der Position(en)

    SwPosition *pPos1, *pPos2;  // wird im CTOR gesetzt, im DTOR geloescht
                                // pPos1 is always != 0, pPos2 may be 0
    SwServerObjectRef refObj;   // falls DataServer -> Pointer gesetzt

protected:
    SvxMacro    aStartMacro;
    SvxMacro    aEndMacro;
    String      aName;
    String      aShortName;
    KeyCode     aCode;
    IDocumentBookmarkAccess::BookmarkType eMarkType;

public:
    TYPEINFO();

    SwBookmark(const SwPosition& aPos);
    SwBookmark(const SwPosition& aPos,
        const KeyCode& rCode,
        const String& rName, const String& rShortName);
    // Beim Loeschen von Text werden Bookmarks mitgeloescht!
    virtual ~SwBookmark();

    const SwPosition& GetPos() const { return *pPos1; }
    const SwPosition* GetOtherPos() const { return pPos2; }

    // nicht undofaehig
    const String& GetName() const { return aName; }
    // nicht undofaehig
    const String& GetShortName() const { return aShortName; }
    // nicht undofaehig
    const KeyCode& GetKeyCode() const { return aCode; }

    // Vergleiche auf Basis der Dokumentposition
    BOOL operator < (const SwBookmark &) const;
    BOOL operator ==(const SwBookmark &) const;
    // falls man wirklich auf gleiche Position abfragen will.
    BOOL IsEqualPos( const SwBookmark &rBM ) const;

    BOOL IsBookMark() const     { return IDocumentBookmarkAccess::BOOKMARK == eMarkType; }
    BOOL IsMark() const         { return IDocumentBookmarkAccess::MARK == eMarkType; }
    BOOL IsDDEMark() const      { return IDocumentBookmarkAccess::DDE_BOOKMARK == eMarkType; }
    BOOL IsUNOMark() const      { return IDocumentBookmarkAccess::UNO_BOOKMARK == eMarkType; }
    BOOL IsHiddenBookMark() const { return IDocumentBookmarkAccess::HIDDEN_BOOKMARK == eMarkType; }
    void SetType( IDocumentBookmarkAccess::BookmarkType eNewType )  { eMarkType = eNewType; }
    IDocumentBookmarkAccess::BookmarkType GetType() const   { return eMarkType; }

    void SetStartMacro(const SvxMacro& rSt)     { aStartMacro = rSt; }
    const SvxMacro& GetStartMacro()             { return aStartMacro; }
    void SetEndMacro(const SvxMacro& rSt)       { aEndMacro = rSt; }

        // Daten Server-Methoden
    void SetRefObject( SwServerObject* pObj );
    const SwServerObject* GetObject() const     {  return &refObj; }
          SwServerObject* GetObject()           {  return &refObj; }
    BOOL IsServer() const                       {  return refObj.Is(); }

    // to access start and end of a bookmark.
    // start and end may be the same
    const SwPosition *Start() const
    {
        return pPos2 ? (*pPos1 <= *pPos2 ? pPos1 : pPos2) : pPos1;
    }
    const SwPosition *End()   const
    {
        return pPos2 ? (*pPos1 >= *pPos2 ? pPos1 : pPos2) : pPos1;
    }

private:
    // fuer METWARE:
    // es wird (vorerst) nicht kopiert und nicht zugewiesen
    SwBookmark(const SwBookmark &);
    SwBookmark &operator=(const SwBookmark &);
};

class SwMark: public SwBookmark
{
public:
    SwMark(const SwPosition& aPos,
        const KeyCode& rCode,
        const String& rName, const String& rShortName);
};

class SwUNOMark: public SwBookmark
{
public:
    SwUNOMark(const SwPosition& aPos,
        const KeyCode& rCode,
        const String& rName, const String& rShortName);
};


#endif<commit_msg>INTEGRATION: CWS swcrossref01_DEV300 (1.8.382); FILE MERGED 2007/10/18 13:16:48 od 1.8.382.6: #i81002# introduction of new bookmark type <SwCrossRefBookmark> 2007/09/28 10:16:56 od 1.8.382.5: #i81002# class <SwBookmark> 	 - revise names for new methods for setting <pPos1> and <pPos2> 2007/09/28 09:59:38 od 1.8.382.4: #i81002# refactoring of class <SwBookmark> 	 - rename methods <GetPos()> and <GetOtherPos()> to 	   <GetBookmarkPos()> and <GetOtherBookmarkPos()> 2007/09/26 15:02:09 od 1.8.382.3: #i81002# refactoring of class <SwBookmark> and its sub classes 	 - provide constructor, which takes a <SwPaM> instance to 	   retrieve on its own the values of members <pPos1> and <pPos2> 	 - remove friend class declaration from class <SwBookmark> 2007/09/26 12:17:25 od 1.8.382.2: #i81002# class <SwBookmark> 	 - rename methods <Start()> and <End()> to <BookmarkStart()> and 	   <BookmarkEnd()> 	 - introduce virtual methods <SetBookmarkPos1(..)> and 	   <SetBookmarkPos2(..)> to apply new Pos1 and Pos2 to the bookmark. 2007/09/17 11:49:11 od 1.8.382.1: #i81002# class <SwBookmark> 	 - remove unnecessary bookmark type HIDDEN_BOOKMARK<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: bookmrk.hxx,v $
 *
 *  $Revision: 1.9 $
 *
 *  last change: $Author: obo $ $Date: 2008-02-26 10:28:53 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/
#ifndef _BOOKMRK_HXX
#define _BOOKMRK_HXX

#include "hintids.hxx"      //die Ids der Attribute, vor macitem damit die
                            //die Attribut richtig angezogen werden.
#ifndef _SFXMACITEM_HXX
#include <svtools/macitem.hxx>
#endif

#ifndef _KEYCOD_HXX //autogen
#include <vcl/keycod.hxx>
#endif
#ifndef _TOOLS_REF_HXX
#include <tools/ref.hxx>
#endif
#ifndef IDOCUMENTBOOKMARKACCESS_HXX_INCLUDED
#include <IDocumentBookmarkAccess.hxx>
#endif
#ifndef _CALBCK_HXX
#include <calbck.hxx>
#endif
#ifndef _PAM_HXX
#include <pam.hxx>
#endif

#ifndef SW_DECL_SWSERVEROBJECT_DEFINED
#define SW_DECL_SWSERVEROBJECT_DEFINED
SV_DECL_REF( SwServerObject )
#endif


struct SwPosition;  // fwd Decl. wg. UI

class SwBookmark : public SwModify
{
    SwPosition *pPos1, *pPos2;  // wird im CTOR gesetzt, im DTOR geloescht
                                // pPos1 is always != 0, pPos2 may be 0
    SwServerObjectRef refObj;   // falls DataServer -> Pointer gesetzt

protected:
    String      aName;
    String      aShortName;
    KeyCode     aCode;
    IDocumentBookmarkAccess::BookmarkType eMarkType;

    SwBookmark( const SwPosition& aPos,
                const KeyCode& rCode,
                const String& rName, const String& rShortName);

public:
    TYPEINFO();

    SwBookmark( const SwPosition& aPos );
    // --> OD 2007-09-26 #i81002#
    SwBookmark( const SwPaM& aPaM,
                const KeyCode& rCode,
                const String& rName, const String& rShortName);
    // <--

    // Beim Loeschen von Text werden Bookmarks mitgeloescht!
    virtual ~SwBookmark();

    // --> OD 2007-10-10 #i81002#
    // made virtual and thus no longer inline
    virtual const SwPosition& GetBookmarkPos() const;
    virtual const SwPosition* GetOtherBookmarkPos() const;
    // <--

    // nicht undofaehig
    const String& GetName() const { return aName; }
    // nicht undofaehig
    const String& GetShortName() const { return aShortName; }
    // nicht undofaehig
    const KeyCode& GetKeyCode() const { return aCode; }

    // Vergleiche auf Basis der Dokumentposition
    BOOL operator < (const SwBookmark &) const;
    BOOL operator ==(const SwBookmark &) const;
    // falls man wirklich auf gleiche Position abfragen will.
    BOOL IsEqualPos( const SwBookmark &rBM ) const;

    BOOL IsBookMark() const    { return IDocumentBookmarkAccess::BOOKMARK == eMarkType; }
//    // --> OD 2007-10-17 #TESTING#
//    BOOL IsBookMark() const
//    {
//        return IDocumentBookmarkAccess::BOOKMARK == eMarkType ||
//               IsCrossRefMark();
//    }
//    // <--
    BOOL IsMark() const         { return IDocumentBookmarkAccess::MARK == eMarkType; }
    BOOL IsUNOMark() const      { return IDocumentBookmarkAccess::UNO_BOOKMARK == eMarkType; }
    // --> OD 2007-10-11 #i81002# - bookmark type for cross-references
    BOOL IsCrossRefMark() const { return IDocumentBookmarkAccess::CROSSREF_BOOKMARK == eMarkType; }
    // <--
    void SetType( IDocumentBookmarkAccess::BookmarkType eNewType )  { eMarkType = eNewType; }
    IDocumentBookmarkAccess::BookmarkType GetType() const   { return eMarkType; }

        // Daten Server-Methoden
    void SetRefObject( SwServerObject* pObj );
    const SwServerObject* GetObject() const     {  return &refObj; }
          SwServerObject* GetObject()           {  return &refObj; }
    BOOL IsServer() const                       {  return refObj.Is(); }

    // --> OD 2007-10-10 #i81002#
    // made virtual and thus no longer inline
    // to access start and end of a bookmark.
    // start and end may be the same
    virtual const SwPosition* BookmarkStart() const;
    virtual const SwPosition* BookmarkEnd() const;
    // <--

    // --> OD 2007-09-26 #i81002#
    virtual void SetBookmarkPos( const SwPosition* pNewPos1 );
    virtual void SetOtherBookmarkPos( const SwPosition* pNewPos2 );
    // <--

private:
    // fuer METWARE:
    // es wird (vorerst) nicht kopiert und nicht zugewiesen
    SwBookmark(const SwBookmark &);
    SwBookmark &operator=(const SwBookmark &);
};

class SwMark: public SwBookmark
{
public:
    SwMark( const SwPosition& aPos,
            const KeyCode& rCode,
            const String& rName, const String& rShortName);
};

class SwUNOMark: public SwBookmark
{
public:
    // --> OD 2007-09-26 #i81002#
    SwUNOMark( const SwPaM& aPaM,
               const KeyCode& rCode,
               const String& rName, const String& rShortName);
    // <--
};


#endif
{'fraction_non_alphanumeric': 0.1219589759898235, 'fraction_numerical': 0.030131976466846875, 'mean_word_length': 3.06167258637391, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3782768', 'n_tokens_mistral': 4239, 'n_tokens_neox': 3898, 'n_words': 1232}