fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dtrans / source / win32 / dtobj / Fetc.cxx
blob9f60a0e5d68ef35eb2b0a1693c37613f8c1123f2
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 #include <osl/diagnose.h>
21 #include "Fetc.hxx"
22 #include "../misc/ImplHelper.hxx"
24 CFormatEtc::CFormatEtc( )
26 m_FormatEtc.cfFormat = 0;
27 m_FormatEtc.ptd = NULL;
28 m_FormatEtc.dwAspect = 0;
29 m_FormatEtc.lindex = -1;
30 m_FormatEtc.tymed = TYMED_NULL;
33 // transfer of ownership
35 CFormatEtc::CFormatEtc( const FORMATETC& aFormatEtc )
37 CopyFormatEtc( &m_FormatEtc, &const_cast< FORMATETC& >( aFormatEtc ) );
40 CFormatEtc::~CFormatEtc( )
42 DeleteTargetDevice( m_FormatEtc.ptd );
45 CFormatEtc::CFormatEtc( CLIPFORMAT cf, DWORD tymed, DVTARGETDEVICE* ptd, DWORD dwAspect, LONG lindex )
47 m_FormatEtc.cfFormat = cf;
48 m_FormatEtc.ptd = CopyTargetDevice( ptd );
49 m_FormatEtc.dwAspect = dwAspect;
50 m_FormatEtc.lindex = lindex;
51 m_FormatEtc.tymed = tymed;
54 CFormatEtc::CFormatEtc( const CFormatEtc& theOther )
56 m_FormatEtc.cfFormat = theOther.m_FormatEtc.cfFormat;
57 m_FormatEtc.ptd = CopyTargetDevice( theOther.m_FormatEtc.ptd );
58 m_FormatEtc.dwAspect = theOther.m_FormatEtc.dwAspect;
59 m_FormatEtc.lindex = theOther.m_FormatEtc.lindex;
60 m_FormatEtc.tymed = theOther.m_FormatEtc.tymed;
63 CFormatEtc& CFormatEtc::operator=( const CFormatEtc& theOther )
65 if ( this != &theOther )
67 DeleteTargetDevice( m_FormatEtc.ptd );
69 m_FormatEtc.cfFormat = theOther.m_FormatEtc.cfFormat;
70 m_FormatEtc.ptd = CopyTargetDevice( theOther.m_FormatEtc.ptd );
71 m_FormatEtc.dwAspect = theOther.m_FormatEtc.dwAspect;
72 m_FormatEtc.lindex = theOther.m_FormatEtc.lindex;
73 m_FormatEtc.tymed = theOther.m_FormatEtc.tymed;
76 return *this;
79 CFormatEtc::operator FORMATETC*( )
81 return &m_FormatEtc;
84 CFormatEtc::operator FORMATETC( )
86 return m_FormatEtc;
89 void CFormatEtc::getFORMATETC( LPFORMATETC lpFormatEtc )
91 OSL_ASSERT( lpFormatEtc );
92 OSL_ASSERT( !IsBadWritePtr( lpFormatEtc, sizeof( FORMATETC ) ) );
94 CopyFormatEtc( lpFormatEtc, &m_FormatEtc );
97 CLIPFORMAT CFormatEtc::getClipformat( ) const
99 return m_FormatEtc.cfFormat;
102 DWORD CFormatEtc::getTymed( ) const
104 return m_FormatEtc.tymed;
107 void CFormatEtc::getTargetDevice( DVTARGETDEVICE** lpDvTargetDevice ) const
109 OSL_ASSERT( lpDvTargetDevice );
110 OSL_ASSERT( !IsBadWritePtr( lpDvTargetDevice, sizeof( DVTARGETDEVICE ) ) );
112 *lpDvTargetDevice = NULL;
114 if ( m_FormatEtc.ptd )
115 *lpDvTargetDevice = CopyTargetDevice( m_FormatEtc.ptd );
118 DWORD CFormatEtc::getDvAspect( ) const
120 return m_FormatEtc.dwAspect;
123 LONG CFormatEtc::getLindex( ) const
125 return m_FormatEtc.lindex;
128 void CFormatEtc::setClipformat( CLIPFORMAT cf )
130 m_FormatEtc.cfFormat = cf;
133 void CFormatEtc::setTymed( DWORD tymed )
135 m_FormatEtc.tymed = tymed;
138 // transfer of ownership!
140 void CFormatEtc::setTargetDevice( DVTARGETDEVICE* ptd )
142 DeleteTargetDevice( m_FormatEtc.ptd );
143 m_FormatEtc.ptd = ptd;
146 void CFormatEtc::setDvAspect( DWORD dwAspect )
148 m_FormatEtc.dwAspect = dwAspect;
151 void CFormatEtc::setLindex( LONG lindex )
153 m_FormatEtc.lindex = lindex;
156 sal_Int32 operator==( const CFormatEtc& lhs, const CFormatEtc& rhs )
158 return CompareFormatEtc( &lhs.m_FormatEtc, &rhs.m_FormatEtc );
161 sal_Int32 operator!=( const CFormatEtc& lhs, const CFormatEtc& rhs )
163 return ( ( lhs == rhs ) != 1 );
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */