Revert "jsdialogs: set LOKNotifier in Deck"
[LibreOffice.git] / include / basic / sbxcore.hxx
blobaee3b428d29ca85170f9c06390fe06362673a1c2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_BASIC_SBXCORE_HXX
21 #define INCLUDED_BASIC_SBXCORE_HXX
23 #include <basic/basicdllapi.h>
24 #include <basic/sbxdef.hxx>
25 #include <rtl/ustring.hxx>
26 #include <tools/ref.hxx>
28 class SvStream;
29 class ErrCode;
31 // The following Macro defines four (five) necessary methods within a
32 // SBX object. LoadPrivateData() and StorePrivateData() must be implemented.
33 // They are necessary for loading/storing the data of derived classes.
34 // Load() and Store() must not be overridden.
36 // This version of the Macros does not define Load/StorePrivateData()-methods
37 #define SBX_DECL_PERSIST_NODATA( nSbxId, nVer ) \
38 virtual sal_uInt16 GetVersion() const override { return nVer; } \
39 virtual sal_uInt16 GetSbxId() const override { return nSbxId; }
41 class SbxFactory;
42 class SbxObject;
44 class BASIC_DLLPUBLIC SbxBase : virtual public SvRefBase
46 virtual bool LoadData( SvStream&, sal_uInt16 ) = 0;
47 virtual bool StoreData( SvStream& ) const = 0;
48 protected:
49 SbxFlagBits nFlags; // Flag-Bits
51 SbxBase();
52 SbxBase( const SbxBase& );
53 SbxBase& operator=( const SbxBase& );
54 virtual ~SbxBase() override;
56 virtual sal_uInt16 GetVersion() const = 0;
57 virtual sal_uInt16 GetSbxId() const = 0;
59 public:
60 inline void SetFlags( SbxFlagBits n );
61 inline SbxFlagBits GetFlags() const;
62 inline void SetFlag( SbxFlagBits n );
63 inline void ResetFlag( SbxFlagBits n );
64 inline bool IsSet( SbxFlagBits n ) const;
65 inline bool IsReset( SbxFlagBits n ) const;
66 inline bool CanRead() const;
67 inline bool CanWrite() const;
68 inline bool IsModified() const;
69 inline bool IsHidden() const;
70 inline bool IsVisible() const;
72 virtual bool IsFixed() const;
73 virtual void SetModified( bool );
75 virtual SbxDataType GetType() const;
77 virtual void Clear() = 0;
79 static SbxBase* Load( SvStream& );
80 bool Store( SvStream& );
81 virtual bool LoadCompleted();
83 static ErrCode const & GetError();
84 static void SetError( ErrCode );
85 static bool IsError();
86 static void ResetError();
88 // Set the factory for Load/Store/Create
89 static void AddFactory( SbxFactory* );
90 static void RemoveFactory( SbxFactory const * );
92 static SbxBase* Create( sal_uInt16, sal_uInt32 );
93 static SbxObject* CreateObject( const OUString& );
96 typedef tools::SvRef<SbxBase> SbxBaseRef;
98 inline void SbxBase::SetFlags( SbxFlagBits n )
99 { nFlags = n; }
101 inline SbxFlagBits SbxBase::GetFlags() const
102 { return nFlags; }
104 inline void SbxBase::SetFlag( SbxFlagBits n )
105 { nFlags |= n; }
107 inline void SbxBase::ResetFlag( SbxFlagBits n )
108 { nFlags &= ~n; }
110 inline bool SbxBase::IsSet( SbxFlagBits n ) const
111 { return ( nFlags & n ) != SbxFlagBits::NONE; }
113 inline bool SbxBase::IsReset( SbxFlagBits n ) const
114 { return ( nFlags & n ) == SbxFlagBits::NONE; }
116 inline bool SbxBase::CanRead() const
117 { return IsSet( SbxFlagBits::Read ); }
119 inline bool SbxBase::CanWrite() const
120 { return IsSet( SbxFlagBits::Write ); }
122 inline bool SbxBase::IsModified() const
123 { return IsSet( SbxFlagBits::Modified ); }
125 inline bool SbxBase::IsHidden() const
126 { return IsSet( SbxFlagBits::Hidden ); }
128 inline bool SbxBase::IsVisible() const
129 { return IsReset( SbxFlagBits::Invisible ); }
131 #endif
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */