xref: /AOO41X/main/sc/source/core/data/userdat.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sc.hxx"
30 
31 // -----------------------------------------------------------------------
32 
33 #include "userdat.hxx"
34 #include <tools/debug.hxx>
35 #include "drwlayer.hxx"
36 #include "rechead.hxx"
37 
38 // -----------------------------------------------------------------------
39 
40 ScDrawObjFactory::ScDrawObjFactory()
41 {
42 	SdrObjFactory::InsertMakeUserDataHdl( LINK ( this, ScDrawObjFactory, MakeUserData ) );
43 }
44 
45 ScDrawObjFactory::~ScDrawObjFactory()
46 {
47 	SdrObjFactory::RemoveMakeUserDataHdl( LINK ( this, ScDrawObjFactory, MakeUserData ) );
48 }
49 
50 IMPL_LINK_INLINE_START( ScDrawObjFactory, MakeUserData, SdrObjFactory *, pObjFactory )
51 {
52 	if ( pObjFactory->nInventor == SC_DRAWLAYER )
53 	{
54 		if ( pObjFactory->nIdentifier == SC_UD_OBJDATA )
55 			pObjFactory->pNewData = new ScDrawObjData;
56 		else if ( pObjFactory->nIdentifier == SC_UD_IMAPDATA )
57 			pObjFactory->pNewData = new ScIMapInfo;
58 		else if ( pObjFactory->nIdentifier == SC_UD_MACRODATA )
59 			pObjFactory->pNewData = new ScMacroInfo;
60 		else
61 		{
62 			DBG_ERROR("MakeUserData: falsche ID");
63 		}
64 	}
65 	return 0;
66 }
67 IMPL_LINK_INLINE_END( ScDrawObjFactory, MakeUserData, SdrObjFactory *, pObjFactory )
68 
69 //------------------------------------------------------------------------
70 
71 ScDrawObjData::ScDrawObjData() :
72     SdrObjUserData( SC_DRAWLAYER, SC_UD_OBJDATA, 0 ),
73     maStart( ScAddress::INITIALIZE_INVALID ),
74     maEnd( ScAddress::INITIALIZE_INVALID ),
75     mbNote( false )
76 {
77 }
78 
79 ScDrawObjData* ScDrawObjData::Clone( SdrObject* ) const
80 {
81 	return new ScDrawObjData( *this );
82 }
83 
84 //------------------------------------------------------------------------
85 
86 ScIMapInfo::ScIMapInfo() :
87 	SdrObjUserData( SC_DRAWLAYER, SC_UD_IMAPDATA, 0 )
88 {
89 }
90 
91 ScIMapInfo::ScIMapInfo( const ImageMap& rImageMap ) :
92 	SdrObjUserData( SC_DRAWLAYER, SC_UD_IMAPDATA, 0 ),
93 	aImageMap( rImageMap )
94 {
95 }
96 
97 ScIMapInfo::ScIMapInfo( const ScIMapInfo& rIMapInfo ) :
98 	SdrObjUserData( rIMapInfo ),
99 	aImageMap( rIMapInfo.aImageMap )
100 {
101 }
102 
103 ScIMapInfo::~ScIMapInfo()
104 {
105 }
106 
107 SdrObjUserData* ScIMapInfo::Clone( SdrObject* ) const
108 {
109 	return new ScIMapInfo( *this );
110 }
111 
112 //------------------------------------------------------------------------
113 
114 ScMacroInfo::ScMacroInfo() :
115     SdrObjUserData( SC_DRAWLAYER, SC_UD_MACRODATA, 0 )
116 {
117 }
118 
119 ScMacroInfo::~ScMacroInfo()
120 {
121 }
122 
123 SdrObjUserData* ScMacroInfo::Clone( SdrObject* /*pObj*/ ) const
124 {
125    return new ScMacroInfo( *this );
126 }
127 
128