Ask Your Question

Writer: get current zoom value (for ENTIRE_PAGE zoom type) with C++ [closed]

asked 2015-07-02 14:15:06 +0100

urbanhusky gravatar image


is it possible to read the current zoom value if the zoom type is set to ENTIRE_PAGE? If so, how would I achieve this with C++?

I want to know the value because setting the zoom to 125% or 85% and then back to 100% yields a different zoom than ENTIRE_PAGE does.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-08-22 22:49:36.070956

2 Answers

Sort by » oldest newest most voted

answered 2015-07-04 14:26:55 +0100

pierre-yves samyn gravatar image

Hi - Below a Basic example.

Sub PysDisplayZoom

dim sMsg as string

with thiscomponent.currentcontroller.ViewSettings
    select case .ZoomType
            sMsg = "OPTIMAL"
            sMsg = "PAGE_WIDTH"
            sMsg = "ENTIRE_PAGE"
            sMsg = "BY_VALUE"
            sMsg = "PAGE_WIDTH_EXACT"
    end select
    msgbox sMsg & chr(13) & " Value: " & .ZoomValue
end with
End Sub

HTH - Regards

edit flag offensive delete link more


Any idea how I could translate accessing the ViewSettings into C++? I have the current controller as an XController interface...

urbanhusky gravatar imageurbanhusky ( 2015-07-06 08:07:43 +0100 )edit

Unfortunately no. I guess you already looked here ?

pierre-yves samyn gravatar imagepierre-yves samyn ( 2015-07-06 08:30:01 +0100 )edit

Yes, the only thing I have found so far is that ViewSettings returns an Any, which does not really implement any interface. That's not really documented :\

urbanhusky gravatar imageurbanhusky ( 2015-07-06 11:21:57 +0100 )edit

answered 2015-07-09 17:14:54 +0100

urbanhusky gravatar image

This works, but not directly after setting the zoom to ENTIRE_PAGE on load (assuming that xControlleris the XControllerfor the current XModel):

Reference< XViewSettingsSupplier  > XViewSettingsSupplier(xController, UNO_QUERY);
Reference< XPropertySet  > viewprops = XViewSettingsSupplier->getViewSettings();
Any anyZoomValue = viewprops->getPropertyValue(OUString::createFromAscii("ZoomValue"));
sal_Int16 actualZoomValue = 0;
anyZoomValue >>= actualZoomValue;
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-07-02 14:15:06 +0100

Seen: 168 times

Last updated: Jul 09 '15