Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / userdat.hxx
blob8b1b1cee9e7742ec7477f144a1c3eaafa509e047
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_SC_INC_USERDAT_HXX
21 #define INCLUDED_SC_INC_USERDAT_HXX
23 #include <svx/svdobj.hxx>
24 #include <tools/link.hxx>
25 #include <svtools/imap.hxx>
26 #include "global.hxx"
27 #include "address.hxx"
28 #include "drwlayer.hxx"
30 // Object IDs for UserData
31 #define SC_UD_OBJDATA 1
32 #define SC_UD_IMAPDATA 2
33 #define SC_UD_MACRODATA 3
35 class SC_DLLPUBLIC ScDrawObjData : public SdrObjUserData
37 public:
38 enum Type { CellNote, ValidationCircle, DetectiveArrow, DrawingObject };
40 ScAddress maStart;
41 ScAddress maEnd;
42 Point maStartOffset;
43 Point maEndOffset;
44 Type meType;
45 bool mbResizeWithCell = false;
46 bool mbWasInHiddenRow = false;
48 explicit ScDrawObjData();
50 const tools::Rectangle & getShapeRect() { return maShapeRect; };
51 const tools::Rectangle & getLastCellRect() { return maLastCellRect; };
52 void setShapeRect(const ScDocument* rDoc, tools::Rectangle rNewRect, bool bIsVisible=true)
54 // bIsVisible should be false when the object is hidden obviously. we dont want to store the old cell rect in that
55 // case because it will have height=0
56 if (maStart.IsValid() && mbResizeWithCell && bIsVisible)
57 maLastCellRect = ScDrawLayer::GetCellRect(*rDoc, maStart, true);
58 maShapeRect = rNewRect;
59 mbWasInHiddenRow = !bIsVisible;
62 private:
63 virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* pObj ) const override;
65 // Stores the last cell rect this shape was anchored to.
66 // Needed when the cell is resized to resize the image accordingly.
67 tools::Rectangle maLastCellRect;
68 // Stores the rect of the shape to which this ScDrawObjData belongs.
69 tools::Rectangle maShapeRect;
72 class ScIMapInfo : public SdrObjUserData
74 ImageMap aImageMap;
76 public:
77 ScIMapInfo( const ImageMap& rImageMap );
78 ScIMapInfo( const ScIMapInfo& rIMapInfo );
79 virtual ~ScIMapInfo() override;
81 virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* pObj ) const override;
83 void SetImageMap( const ImageMap& rIMap ) { aImageMap = rIMap; }
84 const ImageMap& GetImageMap() const { return aImageMap; }
87 class ScMacroInfo : public SdrObjUserData
89 public:
90 ScMacroInfo();
91 virtual ~ScMacroInfo() override;
93 virtual std::unique_ptr<SdrObjUserData> Clone( SdrObject* pObj ) const override;
95 void SetMacro( const OUString& rMacro ) { maMacro = rMacro; }
96 const OUString& GetMacro() const { return maMacro; }
98 void SetHlink( const OUString& rHlink ) { maHlink = rHlink; }
99 const OUString& GetHlink() const { return maHlink; }
101 private:
102 OUString maMacro;
103 OUString maHlink;
106 #endif
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */