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 a70bb145cd2a..21f5de28970e 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -64,6 +64,8 @@ #include <svtools/soerr.hxx> #include <comphelper/processfactory.hxx> +#include <sfx2/lokhelper.hxx> + #define SFX_CLIENTACTIVATE_TIMEOUT 100 using namespace com::sun::star; @@ -394,7 +396,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 ); } @@ -409,7 +431,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 ); } @@ -878,7 +915,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 { @@ -929,8 +972,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(); |