1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_SC_INC_USERDAT_HXX
21 #define INCLUDED_SC_INC_USERDAT_HXX
23 #include <svx/svdobj.hxx>
24 #include <svtools/imap.hxx>
25 #include "address.hxx"
26 #include "drwlayer.hxx"
28 // Object IDs for UserData
29 #define SC_UD_OBJDATA 1
30 #define SC_UD_IMAPDATA 2
31 #define SC_UD_MACRODATA 3
33 class SC_DLLPUBLIC ScDrawObjData
: public SdrObjUserData
36 enum Type
{ CellNote
, ValidationCircle
, DetectiveArrow
, DrawingObject
};
43 bool mbResizeWithCell
= false;
44 bool mbWasInHiddenRow
= false;
46 explicit ScDrawObjData();
48 const tools::Rectangle
& getShapeRect() { return maShapeRect
; };
49 const tools::Rectangle
& getLastCellRect() { return maLastCellRect
; };
50 void setShapeRect(const ScDocument
* rDoc
, tools::Rectangle rNewRect
, bool bIsVisible
=true)
52 // bIsVisible should be false when the object is hidden obviously. we dont want to store the old cell rect in that
53 // case because it will have height=0
54 if (maStart
.IsValid() && mbResizeWithCell
&& bIsVisible
)
55 maLastCellRect
= ScDrawLayer::GetCellRect(*rDoc
, maStart
, true);
56 maShapeRect
= rNewRect
;
57 mbWasInHiddenRow
= !bIsVisible
;
61 virtual std::unique_ptr
<SdrObjUserData
> Clone( SdrObject
* pObj
) const override
;
63 // Stores the last cell rect this shape was anchored to.
64 // Needed when the cell is resized to resize the image accordingly.
65 tools::Rectangle maLastCellRect
;
66 // Stores the rect of the shape to which this ScDrawObjData belongs.
67 tools::Rectangle maShapeRect
;
70 class ScIMapInfo
: public SdrObjUserData
75 ScIMapInfo( const ImageMap
& rImageMap
);
76 ScIMapInfo( const ScIMapInfo
& rIMapInfo
);
77 virtual ~ScIMapInfo() override
;
79 virtual std::unique_ptr
<SdrObjUserData
> Clone( SdrObject
* pObj
) const override
;
81 void SetImageMap( const ImageMap
& rIMap
) { aImageMap
= rIMap
; }
82 const ImageMap
& GetImageMap() const { return aImageMap
; }
85 class ScMacroInfo
: public SdrObjUserData
89 virtual ~ScMacroInfo() override
;
91 ScMacroInfo(ScMacroInfo
const &) = default;
92 ScMacroInfo(ScMacroInfo
&&) = default;
93 ScMacroInfo
& operator =(ScMacroInfo
const &) = default;
94 ScMacroInfo
& operator =(ScMacroInfo
&&) = default;
96 virtual std::unique_ptr
<SdrObjUserData
> Clone( SdrObject
* pObj
) const override
;
98 void SetMacro( const OUString
& rMacro
) { maMacro
= rMacro
; }
99 const OUString
& GetMacro() const { return maMacro
; }
101 void SetHlink( const OUString
& rHlink
) { maHlink
= rHlink
; }
102 const OUString
& GetHlink() const { return maHlink
; }
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */