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_svx.hxx"
26 #include <svx/sdr/properties/emptyproperties.hxx>
27 #include <tools/debug.hxx>
28 #include <svl/itemset.hxx>
29 #include <svx/svddef.hxx>
30 #include <svx/svdobj.hxx>
31 #include <svx/svdpool.hxx>
32 
33 //////////////////////////////////////////////////////////////////////////////
34 
35 namespace sdr
36 {
37 	namespace properties
38 	{
39 		// create a new itemset
CreateObjectSpecificItemSet(SfxItemPool & rPool)40 		SfxItemSet& EmptyProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
41 		{
42 			// Basic implementation; Basic object has NO attributes
43 			DBG_ASSERT(sal_False, "EmptyProperties::CreateObjectSpecificItemSet() should never be called");
44 			return *(new SfxItemSet(rPool));
45 		}
46 
EmptyProperties(SdrObject & rObj)47 		EmptyProperties::EmptyProperties(SdrObject& rObj)
48 		:	BaseProperties(rObj),
49 			mpEmptyItemSet(0L)
50 		{
51 		}
52 
EmptyProperties(const EmptyProperties & rProps,SdrObject & rObj)53 		EmptyProperties::EmptyProperties(const EmptyProperties& rProps, SdrObject& rObj)
54 		:	BaseProperties(rProps, rObj),
55 			mpEmptyItemSet(0L)
56 		{
57 			// #115593#
58 			// do not gererate an assert, else derivations like PageProperties will generate an assert
59 			// using the Clone() operator path.
60 		}
61 
~EmptyProperties()62 		EmptyProperties::~EmptyProperties()
63 		{
64 			if(mpEmptyItemSet)
65 			{
66 				delete mpEmptyItemSet;
67 				mpEmptyItemSet = 0L;
68 			}
69 		}
70 
Clone(SdrObject & rObj) const71 		BaseProperties& EmptyProperties::Clone(SdrObject& rObj) const
72 		{
73 			return *(new EmptyProperties(*this, rObj));
74 		}
75 
GetObjectItemSet() const76 		const SfxItemSet& EmptyProperties::GetObjectItemSet() const
77 		{
78 			if(!mpEmptyItemSet)
79 			{
80 				((EmptyProperties*)this)->mpEmptyItemSet = &(((EmptyProperties*)this)->CreateObjectSpecificItemSet(*GetSdrObject().GetObjectItemPool()));
81 			}
82 
83 			DBG_ASSERT(mpEmptyItemSet, "Could not create an SfxItemSet(!)");
84 			DBG_ASSERT(sal_False, "EmptyProperties::GetObjectItemSet() should never be called (!)");
85 
86 			return *mpEmptyItemSet;
87 		}
88 
SetObjectItem(const SfxPoolItem &)89 		void EmptyProperties::SetObjectItem(const SfxPoolItem& /*rItem*/)
90 		{
91 			DBG_ASSERT(sal_False, "EmptyProperties::SetObjectItem() should never be called (!)");
92 		}
93 
SetObjectItemDirect(const SfxPoolItem &)94 		void EmptyProperties::SetObjectItemDirect(const SfxPoolItem& /*rItem*/)
95 		{
96 			DBG_ASSERT(sal_False, "EmptyProperties::SetObjectItemDirect() should never be called (!)");
97 		}
98 
ClearObjectItem(const sal_uInt16)99 		void EmptyProperties::ClearObjectItem(const sal_uInt16 /*nWhich*/)
100 		{
101 			DBG_ASSERT(sal_False, "EmptyProperties::ClearObjectItem() should never be called (!)");
102 		}
103 
ClearObjectItemDirect(const sal_uInt16)104 		void EmptyProperties::ClearObjectItemDirect(const sal_uInt16 /*nWhich*/)
105 		{
106 			DBG_ASSERT(sal_False, "EmptyProperties::ClearObjectItemDirect() should never be called (!)");
107 		}
108 
SetObjectItemSet(const SfxItemSet &)109 		void EmptyProperties::SetObjectItemSet(const SfxItemSet& /*rSet*/)
110 		{
111 			DBG_ASSERT(sal_False, "EmptyProperties::SetObjectItemSet() should never be called (!)");
112 		}
113 
ItemSetChanged(const SfxItemSet &)114 		void EmptyProperties::ItemSetChanged(const SfxItemSet& /*rSet*/)
115 		{
116 			DBG_ASSERT(sal_False, "EmptyProperties::ItemSetChanged() should never be called (!)");
117 		}
118 
AllowItemChange(const sal_uInt16,const SfxPoolItem *) const119 		sal_Bool EmptyProperties::AllowItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/) const
120 		{
121 			DBG_ASSERT(sal_False, "EmptyProperties::AllowItemChange() should never be called (!)");
122 			return sal_True;
123 		}
124 
ItemChange(const sal_uInt16,const SfxPoolItem *)125 		void EmptyProperties::ItemChange(const sal_uInt16 /*nWhich*/, const SfxPoolItem* /*pNewItem*/)
126 		{
127 			DBG_ASSERT(sal_False, "EmptyProperties::ItemChange() should never be called (!)");
128 		}
129 
PostItemChange(const sal_uInt16)130 		void EmptyProperties::PostItemChange(const sal_uInt16 /*nWhich*/)
131 		{
132 			DBG_ASSERT(sal_False, "EmptyProperties::PostItemChange() should never be called (!)");
133 		}
134 
SetStyleSheet(SfxStyleSheet *,sal_Bool)135 		void EmptyProperties::SetStyleSheet(SfxStyleSheet* /*pNewStyleSheet*/, sal_Bool /*bDontRemoveHardAttr*/)
136 		{
137 			DBG_ASSERT(sal_False, "EmptyProperties::SetStyleSheet() should never be called (!)");
138 		}
139 
GetStyleSheet() const140 		SfxStyleSheet* EmptyProperties::GetStyleSheet() const
141 		{
142 			DBG_ASSERT(sal_False, "EmptyProperties::GetStyleSheet() should never be called (!)");
143 			return 0L;
144 		}
145 	} // end of namespace properties
146 } // end of namespace sdr
147 
148 //////////////////////////////////////////////////////////////////////////////
149 // eof
150