Ask Your Question
0

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

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

urbanhusky gravatar image

Hi,

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 close merge delete

2 Answers

Sort by » oldest newest most voted
0

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

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
0

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

pierre-yves samyn gravatar image

Hi - Below a Basic example.

Sub PysDisplayZoom

dim sMsg as string

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

HTH - Regards

edit flag offensive delete link more

Comments

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 +0200 )edit

Unfortunately no. I guess you already looked here ?

pierre-yves samyn gravatar imagepierre-yves samyn ( 2015-07-06 08:30:01 +0200 )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 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

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

Seen: 82 times

Last updated: Jul 09 '15