Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 :
21 : #include <vcl/metaact.hxx>
22 : #include <vcl/cvtgrf.hxx>
23 :
24 : #include <salinst.hxx>
25 : #include <svdata.hxx>
26 :
27 : // --------------
28 : // - Callback -
29 : // --------------
30 :
31 : // --------------------
32 : // - GraphicConverter -
33 : // --------------------
34 :
35 32 : GraphicConverter::GraphicConverter() :
36 32 : mpConvertData( NULL )
37 : {
38 32 : }
39 :
40 : // ------------------------------------------------------------------------
41 :
42 0 : GraphicConverter::~GraphicConverter()
43 : {
44 0 : }
45 :
46 : // ------------------------------------------------------------------------
47 :
48 0 : sal_uLong GraphicConverter::Import( SvStream& rIStm, Graphic& rGraphic, sal_uLong nFormat )
49 : {
50 0 : GraphicConverter* pCvt = ImplGetSVData()->maGDIData.mpGrfConverter;
51 0 : sal_uLong nRet = ERRCODE_IO_GENERAL;
52 :
53 0 : if( pCvt && pCvt->GetFilterHdl().IsSet() )
54 : {
55 0 : ConvertData aData( rGraphic, rIStm, nFormat );
56 :
57 0 : if( pCvt->GetFilterHdl().Call( &aData ) )
58 : {
59 0 : rGraphic = aData.maGraphic;
60 0 : nRet = ERRCODE_NONE;
61 : }
62 0 : else if( rIStm.GetError() )
63 0 : nRet = rIStm.GetError();
64 : }
65 :
66 0 : return nRet;
67 : }
68 :
69 : // ------------------------------------------------------------------------
70 :
71 62 : sal_uLong GraphicConverter::Export( SvStream& rOStm, const Graphic& rGraphic, sal_uLong nFormat )
72 : {
73 62 : GraphicConverter* pCvt = ImplGetSVData()->maGDIData.mpGrfConverter;
74 62 : sal_uLong nRet = ERRCODE_IO_GENERAL;
75 :
76 62 : if( pCvt && pCvt->GetFilterHdl().IsSet() )
77 : {
78 62 : ConvertData aData( rGraphic, rOStm, nFormat );
79 :
80 62 : if( pCvt->GetFilterHdl().Call( &aData ) )
81 62 : nRet = ERRCODE_NONE;
82 0 : else if( rOStm.GetError() )
83 0 : nRet = rOStm.GetError();
84 : }
85 :
86 62 : return nRet;
87 : }
88 :
89 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|