OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 17-06-2010, 21:32
nathan
Guest
 
Posts: n/a
Default Get all object in one page use C++

Hi, I want get all the information of objects in one page. for example, count .type .position ,size , fontName,and so on. I see some functions like this: GetObjectCount.GetObjectData.GetObjectType et al. How to use these? I can't find any help and code in draw_vba.chm.
How can i do that?

Thanks,

nathan
Reply With Quote
  #2  
Old 18-06-2010, 11:37
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default Getting to know C++ and CorelDRAW

Hi Nathan,

I have a complete started project and some notes of using C++ with CorelDRAW at my forum:

http://www.leonardcncsoftware.com/ph....php?f=13&t=12

These projects (a plugin and a DLL) show how to make a hybrid application that runs from a CorelDRAW plugin but has most of the code in a DLL. There is a debug message system which is essential for working woth plugins and DLLS.

To get all the objects (shapes) on a page you must access the individual layers. I typically write functions to use the ActiveLayer so I can simply activate a layer then use the function, it is universal. Here is a sample that shows how to iterate the shapes on the ActiveLayer:

Code:
	    IDrawApplicationPtr app(CDR_PROGID);

		if (NULL != app) {

			DbgMsg(("app ptr OK"));

			IDrawDocumentPtr doc = app->ActiveDocument;

			if (NULL != doc) {
 
				IDrawLayerPtr layer = doc->ActiveLayer;

				if (NULL != layer) {

					DbgMsg(("layer ptr ok"));

					layer->get_Shapes(&shapes);

					if (NULL != shapes) {

						DbgMsg(("shapes"));

						// shapes->Count is the number of shapes on this layer

						for (shpIdx = 1L; shpIdx <= shapes->Count; shpIdx++) {

							shape = shapes->Item[_variant_t(shpIdx)];

							// shape->Type is the shape type - I.E. cdrCurveShape
							// this is in the cdrShapeType enum in the .tlh file
							// that was generated from the #import


							// shape->PositionX = X location

							// shape->PositionY = Y location

							// shape->SizeHeight = height

							// shape->SizeWidth = width




						}
					}
				}
			}
		}
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
Reply With Quote
  #3  
Old 18-06-2010, 12:53
nathan
Guest
 
Posts: n/a
Default thanks

thank you very much!
Reply With Quote
  #4  
Old 19-06-2010, 01:23
nathan
Guest
 
Posts: n/a
Default question type

code:
shape->Type ; or shape->GetType();

error:
error C2556: 'enum cdrShapeType __thiscall CorelDRAW::IDrawShape::GetType(void)' : overloaded function differs only by return type from 'enum CorelDRAW::cdrShapeType __thiscall CorelDRAW::IDrawShape::GetType(
void)'

I would like to determine the type. How Can I do?
Reply With Quote
  #5  
Old 19-06-2010, 11:20
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default

Hi Nathan,

I was at my day job, working from memory. Sorry...

First declare the type variable;

CorelDRAW::cdrShapeType st;

Then you can retrieve it with:

hr = shape->get_Type(&st);

hr is a HRESULT that you can test for SUCCEEDED

-James
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
Reply With Quote
  #6  
Old 21-06-2010, 00:06
nathan
Guest
 
Posts: n/a
Default

Hi James.
Thank you for your help!Your answer is very clear,and I can get all object .
these are the other three questions
question one:
I open a file of cdr, but the system does not contain the relevant fonts, for example, cdr file used the font of "Wingdings 2", but my system does not install. In corelDRAW, Tips out of the dialog box.Let us choose a existing font to replace missing fonts. but in the VC,How can I know whether same fonts have miss and what the missing fonts are?
question two:
I read a cdrTextShape in a file, the shape like this
"
nathan luxu summy
clover mary jason
"
these six names are in a shape. I can get the positon of the shape. How do I get the position of each name? for example , I want know the position of mary.

question three:
if the shape is a image , I want to export it; what can I do?
Reply With Quote
  #7  
Old 21-06-2010, 20:59
nathan
Guest
 
Posts: n/a
Default

I know that use this code to pop up a PANOSE matching dialog.
code:
CorelDRAW::IDrawApplicationPtr app(__uuidof(CorelDRAW::Application));
app->Visible = VARIANT_TRUE;
app->InitializeVBA();
app->put_PanoseMatching(CorelDRAW::cdrPanosePrompt);
CorelDRAW::IDrawDocumentPtr doc = app->OpenDocument(_bstr_t(Path),0);

It works well! But I want to know which text shape is missing fonts and the names of the missed fonts ? How can I do?
Reply With Quote
  #8  
Old 22-06-2010, 16:16
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default

Hi Nathan,

I do not know if this can be done. You should ask the VBA experts first and search the forums for solutions in VBA. Then you can work out how to do it in C++.

I have never had a need for this so I have no idea or any code to show.

-James
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
Reply With Quote
  #9  
Old 02-07-2010, 11:44
Craig Tucker
Guest
 
Posts: n/a
Default Serialize Objects To XML in C#

Hi All,
Along these lines, has anyone tried to scan through an open document and serialize to an XML document the various objects? It would be nice to export customized document objects to XML string to store in Database for recreation later (maybe even deserialize back)...
Thanks much, Craig.
Reply With Quote
  #10  
Old 02-07-2010, 15:28
jemmyell jemmyell is offline
Senior Member
 
Join Date: Jan 2005
Location: Orange County, California, USA, Earth, Solar System, Milky Way Galaxy
Posts: 157
Default

Hi Craig,

I currently do a version of that with a customized DXF export for CAD / CAM use. You can see that at:

http://www.coreldrawtools.com

BUT, completely capturing the state of a CorelDRAW document would be a daunting task. I'm not sure the object model has all the features needed to do that.

-James
__________________
-James Leonard
CNC Inlay Guy - www.CorelDRAWCadCam.com
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Positionin few object to few object VaaL2004 CorelDRAW/Corel DESIGNER VBA 1 10-10-2008 01:18
Duplicating original page for multi-page layout psypha General 1 06-08-2007 14:05
Selected object to other page Duplicate method ? ljesus7 CorelDRAW/Corel DESIGNER VBA 5 12-02-2007 16:37
How to select object inside another object jukos General 4 24-10-2005 21:27
Page selection and object moving problems wbochar CorelDRAW/Corel DESIGNER VBA 1 15-04-2003 09:10


All times are GMT -5. The time now is 11:28.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com