xref: /trunk/main/sc/source/core/data/userdat.cxx (revision b3f79822)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26 
27 // -----------------------------------------------------------------------
28 
29 #include "userdat.hxx"
30 #include <tools/debug.hxx>
31 #include "drwlayer.hxx"
32 #include "rechead.hxx"
33 
34 // -----------------------------------------------------------------------
35 
ScDrawObjFactory()36 ScDrawObjFactory::ScDrawObjFactory()
37 {
38 	SdrObjFactory::InsertMakeUserDataHdl( LINK ( this, ScDrawObjFactory, MakeUserData ) );
39 }
40 
~ScDrawObjFactory()41 ScDrawObjFactory::~ScDrawObjFactory()
42 {
43 	SdrObjFactory::RemoveMakeUserDataHdl( LINK ( this, ScDrawObjFactory, MakeUserData ) );
44 }
45 
IMPL_LINK_INLINE_START(ScDrawObjFactory,MakeUserData,SdrObjFactory *,pObjFactory)46 IMPL_LINK_INLINE_START( ScDrawObjFactory, MakeUserData, SdrObjFactory *, pObjFactory )
47 {
48 	if ( pObjFactory->nInventor == SC_DRAWLAYER )
49 	{
50 		if ( pObjFactory->nIdentifier == SC_UD_OBJDATA )
51 			pObjFactory->pNewData = new ScDrawObjData;
52 		else if ( pObjFactory->nIdentifier == SC_UD_IMAPDATA )
53 			pObjFactory->pNewData = new ScIMapInfo;
54 		else if ( pObjFactory->nIdentifier == SC_UD_MACRODATA )
55 			pObjFactory->pNewData = new ScMacroInfo;
56 		else
57 		{
58 			DBG_ERROR("MakeUserData: falsche ID");
59 		}
60 	}
61 	return 0;
62 }
IMPL_LINK_INLINE_END(ScDrawObjFactory,MakeUserData,SdrObjFactory *,pObjFactory)63 IMPL_LINK_INLINE_END( ScDrawObjFactory, MakeUserData, SdrObjFactory *, pObjFactory )
64 
65 //------------------------------------------------------------------------
66 
67 ScDrawObjData::ScDrawObjData() :
68     SdrObjUserData( SC_DRAWLAYER, SC_UD_OBJDATA, 0 ),
69     maStart( ScAddress::INITIALIZE_INVALID ),
70     maEnd( ScAddress::INITIALIZE_INVALID ),
71     mbNote( false )
72 {
73 }
74 
Clone(SdrObject *) const75 ScDrawObjData* ScDrawObjData::Clone( SdrObject* ) const
76 {
77 	return new ScDrawObjData( *this );
78 }
79 
80 //------------------------------------------------------------------------
81 
ScIMapInfo()82 ScIMapInfo::ScIMapInfo() :
83 	SdrObjUserData( SC_DRAWLAYER, SC_UD_IMAPDATA, 0 )
84 {
85 }
86 
ScIMapInfo(const ImageMap & rImageMap)87 ScIMapInfo::ScIMapInfo( const ImageMap& rImageMap ) :
88 	SdrObjUserData( SC_DRAWLAYER, SC_UD_IMAPDATA, 0 ),
89 	aImageMap( rImageMap )
90 {
91 }
92 
ScIMapInfo(const ScIMapInfo & rIMapInfo)93 ScIMapInfo::ScIMapInfo( const ScIMapInfo& rIMapInfo ) :
94 	SdrObjUserData( rIMapInfo ),
95 	aImageMap( rIMapInfo.aImageMap )
96 {
97 }
98 
~ScIMapInfo()99 ScIMapInfo::~ScIMapInfo()
100 {
101 }
102 
Clone(SdrObject *) const103 SdrObjUserData* ScIMapInfo::Clone( SdrObject* ) const
104 {
105 	return new ScIMapInfo( *this );
106 }
107 
108 //------------------------------------------------------------------------
109 
ScMacroInfo()110 ScMacroInfo::ScMacroInfo() :
111     SdrObjUserData( SC_DRAWLAYER, SC_UD_MACRODATA, 0 )
112 {
113 }
114 
~ScMacroInfo()115 ScMacroInfo::~ScMacroInfo()
116 {
117 }
118 
Clone(SdrObject *) const119 SdrObjUserData* ScMacroInfo::Clone( SdrObject* /*pObj*/ ) const
120 {
121    return new ScMacroInfo( *this );
122 }
123 
124