2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 // $XConsortium: c_api_graphic.cc /main/3 1996/06/11 17:27:16 cde-hal $
25 #include "oliasdb/c_api_common.h"
27 static graphic_smart_ptr*
28 getGraphicUsingLocAndProid(DtMmdbInfoRequest* request, Boolean checkLocOnly = false)
31 info_base* x = getBookCase(request -> bookcase_descriptor);
32 if ( x == 0 ) return 0;
34 const char* str = getLocator(request);
37 return new graphic_smart_ptr(x, str);
40 if ( checkLocOnly == true ) return 0;
42 oid_t * id = getPrimiaryOid(request);
44 if ( id == 0 ) return 0;
46 return new graphic_smart_ptr(x, *id);
49 mcatch (mmdbException &,e)
57 DtMmdbGraphicGetData(DtMmdbInfoRequest* request, unsigned int* data_length)
60 graphic_smart_ptr* x = getGraphicUsingLocAndProid(request, true);
62 if ( x == 0 ) return 0;
65 fprintf(stderr, " graphicInfo: mmdb_oid = %d.%d\n", (int)(*x).its_oid().ccode(), (int)(*x).its_oid().icode());
68 const char* y = x -> data();
69 if ( data_length ) *data_length = x -> data_size();
75 mcatch (mmdbException &,e)
83 DtMmdbGraphicGetInfo(DtMmdbInfoRequest* request)
87 graphic_smart_ptr* x = getGraphicUsingLocAndProid(request, true);
89 if ( x == 0 ) return 0;
93 DtMmdbGraphicInfo* z = newDtMmdbGraphicInfo();
95 if ( z == 0 ) return 0;
97 z -> type = x -> coding();
98 z -> width = x -> width();
99 z -> height = x -> height();
100 z -> llx = x -> llx();
101 z -> lly = x -> lly();
102 z -> urx = x -> urx();
103 z -> ury = x -> ury();
110 mcatch (mmdbException &,e)
117 const char* DtMmdbGraphicGetLoc(DtMmdbInfoRequest* request)
120 graphic_smart_ptr* x = getGraphicUsingLocAndProid(request, true);
122 if ( x == 0 ) return 0;
124 const char* y = x -> locator();
130 mcatch (mmdbException &,e)
137 void DtMmdbFreeGraphicInfo(DtMmdbGraphicInfo* x)