1*9e0e4191SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9e0e4191SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9e0e4191SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9e0e4191SAndrew Rist  * distributed with this work for additional information
6*9e0e4191SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9e0e4191SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9e0e4191SAndrew Rist  * "License"); you may not use this file except in compliance
9*9e0e4191SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9e0e4191SAndrew Rist  *
11*9e0e4191SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9e0e4191SAndrew Rist  *
13*9e0e4191SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9e0e4191SAndrew Rist  * software distributed under the License is distributed on an
15*9e0e4191SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9e0e4191SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9e0e4191SAndrew Rist  * specific language governing permissions and limitations
18*9e0e4191SAndrew Rist  * under the License.
19*9e0e4191SAndrew Rist  *
20*9e0e4191SAndrew Rist  *************************************************************/
21*9e0e4191SAndrew Rist 
22*9e0e4191SAndrew Rist 
23cdf0e10cSrcweir #include "precompiled_reportdesign.hxx"
24cdf0e10cSrcweir #include "GroupExchange.hxx"
25cdf0e10cSrcweir #include <sot/formats.hxx>
26cdf0e10cSrcweir #include <sot/storage.hxx>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir namespace rptui
29cdf0e10cSrcweir {
30cdf0e10cSrcweir 	using namespace ::com::sun::star;
31cdf0e10cSrcweir 	using namespace ::com::sun::star::uno;
32cdf0e10cSrcweir 	using namespace ::com::sun::star::beans;
33cdf0e10cSrcweir 
getReportGroupId()34cdf0e10cSrcweir     sal_uInt32 OGroupExchange::getReportGroupId()
35cdf0e10cSrcweir     {
36cdf0e10cSrcweir         static sal_uInt32 s_nReportFormat = (sal_uInt32)-1;
37cdf0e10cSrcweir 		if ( (sal_uInt32)-1 == s_nReportFormat )
38cdf0e10cSrcweir 		{
39cdf0e10cSrcweir 			s_nReportFormat = SotExchange::RegisterFormatName(String::CreateFromAscii("application/x-openoffice;windows_formatname=\"reportdesign.GroupFormat\"" ));
40cdf0e10cSrcweir 			OSL_ENSURE((sal_uInt32)-1 != s_nReportFormat, "Bad exchange id!");
41cdf0e10cSrcweir         }
42cdf0e10cSrcweir         return s_nReportFormat;
43cdf0e10cSrcweir     }
OGroupExchange(const uno::Sequence<uno::Any> & _aGroupRow)44cdf0e10cSrcweir 	OGroupExchange::OGroupExchange(const uno::Sequence< uno::Any >& _aGroupRow)
45cdf0e10cSrcweir 		: m_aGroupRow(_aGroupRow)
46cdf0e10cSrcweir 	{
47cdf0e10cSrcweir 	}
48cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
AddSupportedFormats()49cdf0e10cSrcweir 	void OGroupExchange::AddSupportedFormats()
50cdf0e10cSrcweir 	{
51cdf0e10cSrcweir 		if ( m_aGroupRow.getLength() )
52cdf0e10cSrcweir         {
53cdf0e10cSrcweir 			AddFormat(OGroupExchange::getReportGroupId());
54cdf0e10cSrcweir         }
55cdf0e10cSrcweir 	}
56cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
GetData(const::com::sun::star::datatransfer::DataFlavor & rFlavor)57cdf0e10cSrcweir 	sal_Bool OGroupExchange::GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor )
58cdf0e10cSrcweir 	{
59cdf0e10cSrcweir 		sal_uLong nFormat = SotExchange::GetFormat(rFlavor);
60cdf0e10cSrcweir 		if(nFormat == OGroupExchange::getReportGroupId() )
61cdf0e10cSrcweir 		{
62cdf0e10cSrcweir 			return SetAny(uno::makeAny(m_aGroupRow),rFlavor);
63cdf0e10cSrcweir 		}
64cdf0e10cSrcweir 		return sal_False;
65cdf0e10cSrcweir 	}
66cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
ObjectReleased()67cdf0e10cSrcweir 	void OGroupExchange::ObjectReleased()
68cdf0e10cSrcweir 	{
69cdf0e10cSrcweir 		m_aGroupRow.realloc(0);
70cdf0e10cSrcweir 	}
71cdf0e10cSrcweir 	// -----------------------------------------------------------------------------
72cdf0e10cSrcweir }
73