| View previous topic :: View next topic |
| Author |
Message |
apple Guest
|
Posted: Tue Dec 09, 2003 1:59 pm Post subject: writer ViewSettings |
|
|
Hi there,
I am trying to set the zoomtype zoomvalue in ViewSettings of writer
I'm doing my development in C++ using OLE but I should be able to figure out how to do it from any language if someone has an example. |
|
| Back to top |
|
 |
geoff_f OOo Enthusiast

Joined: 21 Nov 2003 Posts: 181 Location: Canberra, Australia
|
Posted: Tue Dec 09, 2003 5:37 pm Post subject: |
|
|
This is what Record Macro gave for changing a ViewSetting to 75% from 150% and from 100% using View->Zoom: | Code: |
sub Test1
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Zoom.Value"
args1(0).Value = 75
args1(1).Name = "Zoom.ValueSet"
args1(1).Value = 28703
args1(2).Name = "Zoom.Type"
args1(2).Value = 0
dispatcher.executeDispatch(document, ".uno:Zoom", "", 0, args1())
end sub | Although this is in OpenOffice Basic (StarBasic?), C++ should have equivalent variables for the args1() values. If you haven't used this version of Basic before, don't be confused by the declaration of 'dim args1(2)'. In OpenOffice Basic, the number within brackets after the array specifies the highest element number, not the number of elements in the array. Ie, in this case, the highest element is args1(2), giving a total of three elements (it being preceded by args1(0) and args1(1)).
HTH. |
|
| Back to top |
|
 |
apple Guest
|
Posted: Wed Dec 10, 2003 1:21 pm Post subject: |
|
|
i use code in so_activex example like :
HRESULT hr;
CComPtr<IDispatch> pdispgetCurrentComponent;
hr = GetIDispByFunc( pdispDesktop, L"getCurrentComponent", NULL, 0, pdispgetCurrentComponent );
if( !SUCCEEDED( hr ) ) return hr;
CComVariant aDispArgsInOut1[2];
aDispArgsInOut1[0] = CComVariant();
aDispArgsInOut1[0].vt = VT_BOOL;
aDispArgsInOut1[0].boolVal = isRecord ? VARIANT_TRUE :VARIANT_FALSE;
aDispArgsInOut1[1] = CComVariant( L"RecordChanges" );
CComVariant dummyResult;
hr = ExecuteFunc( pdispgetCurrentComponent, L"setPropertyValue", aDispArgsInOut1, 2, &dummyResult );
if( !SUCCEEDED( hr ) ) return hr;
/*
before here code is ok,and RecordChanges will change,but i try to change ZoomType and ZoomValue like :
*/
CComVariant aDispArgsInOut2[4];
aDispArgsInOut2[0] = CComVariant();
aDispArgsInOut2[0].vt = VT_INT;
aDispArgsInOut2[0].intVal = 120;
aDispArgsInOut2[1] = CComVariant( L"ZoomValue" );
//aDispArgsInOut2[2] = CComVariant();
//aDispArgsInOut2[2].vt = VT_INT;
//aDispArgsInOut2[2].intVal = 28703;
//aDispArgsInOut2[3] = CComVariant( L"ZoomValueSet" );
aDispArgsInOut2[2] = CComVariant();
aDispArgsInOut2[2].vt = VT_INT;
aDispArgsInOut2[2].intVal = 0;
aDispArgsInOut2[3] = CComVariant( L"ZoomType" );
hr = ExecuteFunc( pdispgetCurrentComponent, L"setPropertyValue", aDispArgsInOut2, 4, &dummyResult );
if( !SUCCEEDED( hr ) ) return hr;
/*
return value hr is not S_OK
*/ |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|