diff options
Diffstat (limited to 'sfx2/source/view/ipclient.cxx')
-rw-r--r-- | sfx2/source/view/ipclient.cxx | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index e894546b4346..1c9d9a062c9d 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -63,6 +63,8 @@ #include <svtools/soerr.hxx> #include <comphelper/processfactory.hxx> +#include <sfx2/lokhelper.hxx> + #define SFX_CLIENTACTIVATE_TIMEOUT 100 using namespace com::sun::star; @@ -426,7 +428,27 @@ awt::Rectangle SAL_CALL SfxInPlaceClient_Impl::getPlacement() aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_aScaleWidth, Fraction( aRealObjArea.GetHeight() ) * m_aScaleHeight ) ); - aRealObjArea = m_pClient->GetEditWin()->LogicToPixel( aRealObjArea ); + // In Writer and Impress the map mode is disabled. So when a chart is + // activated (for in place editing) we get the chart win size in 100th mm + // and any method that should return pixels returns 100th mm and the chart + // window map mode has a ~26.485 scale factor. + // All that does not fit with current implementation for handling chart + // editing in LOK. + if (comphelper::LibreOfficeKit::isActive()) + { + vcl::Window* pEditWin = m_pClient->GetEditWin(); + bool bMapModeEnabled = pEditWin->IsMapModeEnabled(); + if (!bMapModeEnabled) + pEditWin->EnableMapMode(); + aRealObjArea = m_pClient->GetEditWin()->LogicToPixel( aRealObjArea ); + if (!bMapModeEnabled && pEditWin->IsMapModeEnabled()) + pEditWin->EnableMapMode(false); + } + else + { + aRealObjArea = m_pClient->GetEditWin()->LogicToPixel( aRealObjArea ); + } + return AWTRectangle( aRealObjArea ); } @@ -443,7 +465,22 @@ awt::Rectangle SAL_CALL SfxInPlaceClient_Impl::getClipRectangle() aRealObjArea.SetSize( Size( Fraction( aRealObjArea.GetWidth() ) * m_aScaleWidth, Fraction( aRealObjArea.GetHeight() ) * m_aScaleHeight ) ); - aRealObjArea = m_pClient->GetEditWin()->LogicToPixel( aRealObjArea ); + // See comment for SfxInPlaceClient_Impl::getPlacement. + if (comphelper::LibreOfficeKit::isActive()) + { + vcl::Window* pEditWin = m_pClient->GetEditWin(); + bool bMapModeEnabled = pEditWin->IsMapModeEnabled(); + if (!bMapModeEnabled) + pEditWin->EnableMapMode(); + aRealObjArea = m_pClient->GetEditWin()->LogicToPixel( aRealObjArea ); + if (!bMapModeEnabled && pEditWin->IsMapModeEnabled()) + pEditWin->EnableMapMode(false); + } + else + { + aRealObjArea = m_pClient->GetEditWin()->LogicToPixel( aRealObjArea ); + } + return AWTRectangle( aRealObjArea ); } @@ -928,7 +965,13 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) if ( !nError ) { - + // See comment for SfxInPlaceClient_Impl::getPlacement. + vcl::Window* pEditWin = GetEditWin(); + bool bMapModeEnabled = pEditWin->IsMapModeEnabled(); + if (comphelper::LibreOfficeKit::isActive() && !bMapModeEnabled) + { + pEditWin->EnableMapMode(); + } m_pViewSh->GetViewFrame()->GetFrame().LockResize_Impl(true); try { @@ -979,8 +1022,13 @@ ErrCode SfxInPlaceClient::DoVerb( long nVerb ) " exception caught: " << e.Message); nError = ERRCODE_SO_GENERALERROR; //TODO/LATER: better error handling - } + } + if (comphelper::LibreOfficeKit::isActive() && !bMapModeEnabled + && pEditWin->IsMapModeEnabled()) + { + pEditWin->EnableMapMode(false); + } SfxViewFrame* pFrame = m_pViewSh->GetViewFrame(); pFrame->GetFrame().LockResize_Impl(false); pFrame->GetFrame().Resize(); |