Kaydet (Commit) 9991b50c authored tarafından Zolnai Tamás's avatar Zolnai Tamás Kaydeden (comit) Markus Mohrhard

Make opengl chart window always active

Fortunately there is a special ole object group with
the MS_EMBED_ACTIVATEWHENVISIBLE flag which define this
behaviour.
Problem is that both Aspect and EmbedMisc are MS specific
enums so we can't use them directly for non-MS objects. But we
can handle opengl charts the same as this ole object group.

Change-Id: I49abeffce319cbb775709a72ba198a1f76b65374
üst bd9a4e19
...@@ -26,6 +26,7 @@ $(eval $(call gb_Library_use_libraries,embobj,\ ...@@ -26,6 +26,7 @@ $(eval $(call gb_Library_use_libraries,embobj,\
cppu \ cppu \
cppuhelper \ cppuhelper \
sal \ sal \
svt \
vcl \ vcl \
tl \ tl \
$(gb_UWINAPI) \ $(gb_UWINAPI) \
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <rtl/process.h> #include <rtl/process.h>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <svtools/embedhlp.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/namedvaluecollection.hxx> #include <comphelper/namedvaluecollection.hxx>
...@@ -72,9 +73,9 @@ ...@@ -72,9 +73,9 @@
#include "commonembobj.hxx" #include "commonembobj.hxx"
#include "intercept.hxx" #include "intercept.hxx"
#define HATCH_BORDER_WIDTH ((((m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) || \
#define HATCH_BORDER_WIDTH (((m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) && \ (svt::EmbeddedObjectRef::IsGLChart(m_pEmbedObj)) ) && \
m_pEmbedObj->getCurrentState()!=embed::EmbedStates::UI_ACTIVE) ? 0 : 4 ) m_pEmbedObj->getCurrentState()!=embed::EmbedStates::UI_ACTIVE) ? 0 : 4 )
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -1256,7 +1257,8 @@ awt::Rectangle SAL_CALL DocumentHolder::calcAdjustedRectangle( const awt::Rectan ...@@ -1256,7 +1257,8 @@ awt::Rectangle SAL_CALL DocumentHolder::calcAdjustedRectangle( const awt::Rectan
void SAL_CALL DocumentHolder::activated( ) throw (::com::sun::star::uno::RuntimeException, std::exception) void SAL_CALL DocumentHolder::activated( ) throw (::com::sun::star::uno::RuntimeException, std::exception)
{ {
if ( (m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ) if ( (m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
svt::EmbeddedObjectRef::IsGLChart(m_pEmbedObj) )
{ {
if ( m_pEmbedObj->getCurrentState() != embed::EmbedStates::UI_ACTIVE && if ( m_pEmbedObj->getCurrentState() != embed::EmbedStates::UI_ACTIVE &&
!(m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_NOUIACTIVATE) ) !(m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_NOUIACTIVATE) )
......
...@@ -68,6 +68,7 @@ public: ...@@ -68,6 +68,7 @@ public:
throw(); throw();
static bool IsChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj); static bool IsChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj);
static bool IsGLChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj);
const com::sun::star::uno::Reference <com::sun::star::embed::XEmbeddedObject>& operator->() const; const com::sun::star::uno::Reference <com::sun::star::embed::XEmbeddedObject>& operator->() const;
const com::sun::star::uno::Reference <com::sun::star::embed::XEmbeddedObject>& GetObject() const; const com::sun::star::uno::Reference <com::sun::star::embed::XEmbeddedObject>& GetObject() const;
...@@ -109,6 +110,7 @@ public: ...@@ -109,6 +110,7 @@ public:
bool IsLocked() const; bool IsLocked() const;
bool IsChart() const; bool IsChart() const;
bool IsGLChart() const;
OUString GetChartType(); OUString GetChartType();
......
...@@ -1048,7 +1048,8 @@ void SfxInPlaceClient::DeactivateObject() ...@@ -1048,7 +1048,8 @@ void SfxInPlaceClient::DeactivateObject()
m_pViewSh->GetViewFrame()->GetTopFrame().LockResize_Impl(true); m_pViewSh->GetViewFrame()->GetTopFrame().LockResize_Impl(true);
if ( m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) if ( (m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
svt::EmbeddedObjectRef::IsGLChart(m_pImp->m_xObject) )
{ {
m_pImp->m_xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE ); m_pImp->m_xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
if (bHasFocus) if (bHasFocus)
...@@ -1081,7 +1082,8 @@ void SfxInPlaceClient::ResetObject() ...@@ -1081,7 +1082,8 @@ void SfxInPlaceClient::ResetObject()
try try
{ {
m_pImp->m_bUIActive = false; m_pImp->m_bUIActive = false;
if ( m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) if ( (m_pImp->m_xObject->getStatus( m_pImp->m_nAspect ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
svt::EmbeddedObjectRef::IsGLChart(m_pImp->m_xObject) )
m_pImp->m_xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE ); m_pImp->m_xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
else else
{ {
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <unotools/pathoptions.hxx> #include <unotools/pathoptions.hxx>
#include <svtools/miscopt.hxx> #include <svtools/miscopt.hxx>
#include <svtools/soerr.hxx> #include <svtools/soerr.hxx>
#include <svtools/embedhlp.hxx>
#include <basic/basmgr.hxx> #include <basic/basmgr.hxx>
#include <basic/sbuno.hxx> #include <basic/sbuno.hxx>
...@@ -1735,7 +1736,8 @@ void SfxViewShell::CheckIPClient_Impl( SfxInPlaceClient *pIPClient, const Rectan ...@@ -1735,7 +1736,8 @@ void SfxViewShell::CheckIPClient_Impl( SfxInPlaceClient *pIPClient, const Rectan
bool bAlwaysActive = bool bAlwaysActive =
( ( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY ) != 0 ); ( ( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY ) != 0 );
bool bActiveWhenVisible = bool bActiveWhenVisible =
( ( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) != 0 ); ( (( pIPClient->GetObjectMiscStatus() & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) != 0 ) ||
svt::EmbeddedObjectRef::IsGLChart(pIPClient->GetObject()));
// this method is called when either a client is created or the "Edit/Plugins" checkbox is checked // this method is called when either a client is created or the "Edit/Plugins" checkbox is checked
if ( !pIPClient->IsObjectInPlaceActive() && pImp->m_bPlugInsActive ) if ( !pIPClient->IsObjectInPlaceActive() && pImp->m_bPlugInsActive )
......
...@@ -801,6 +801,11 @@ bool EmbeddedObjectRef::IsChart(const ::com::sun::star::uno::Reference < ::com:: ...@@ -801,6 +801,11 @@ bool EmbeddedObjectRef::IsChart(const ::com::sun::star::uno::Reference < ::com::
return false; return false;
} }
bool EmbeddedObjectRef::IsGLChart(const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj)
{
return IsChart(xObj) && getenv("CHART_DUMMY_FACTORY");
}
void EmbeddedObjectRef::UpdateReplacement() void EmbeddedObjectRef::UpdateReplacement()
{ {
GetReplacement( true ); GetReplacement( true );
...@@ -834,6 +839,14 @@ bool EmbeddedObjectRef::IsChart() const ...@@ -834,6 +839,14 @@ bool EmbeddedObjectRef::IsChart() const
return EmbeddedObjectRef::IsChart(mpImpl->mxObj); return EmbeddedObjectRef::IsChart(mpImpl->mxObj);
} }
bool EmbeddedObjectRef::IsGLChart() const
{
if (!mpImpl->mxObj.is())
return false;
return EmbeddedObjectRef::IsGLChart(mpImpl->mxObj);
}
// MT: Only used for getting accessible attributes, which are not localized // MT: Only used for getting accessible attributes, which are not localized
OUString EmbeddedObjectRef::GetChartType() OUString EmbeddedObjectRef::GetChartType()
{ {
......
...@@ -98,7 +98,8 @@ namespace sdr ...@@ -98,7 +98,8 @@ namespace sdr
} }
SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView(); SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
if(pPageView && (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE)) if(pPageView && ((nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
xObjRef.IsGLChart()))
{ {
// connect plugin object // connect plugin object
pPageView->GetView().DoConnect(const_cast< SdrOle2Obj* >(&rSdrOle2)); pPageView->GetView().DoConnect(const_cast< SdrOle2Obj* >(&rSdrOle2));
......
...@@ -396,7 +396,8 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::activatingUI() ...@@ -396,7 +396,8 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::activatingUI()
uno::Reference< embed::XEmbeddedObject > xObject = pObj->GetObjRef(); uno::Reference< embed::XEmbeddedObject > xObject = pObj->GetObjRef();
try try
{ {
if ( xObject->getStatus( pObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) if ( (xObject->getStatus( pObj->GetAspect() ) & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
svt::EmbeddedObjectRef::IsGLChart(xObject) )
xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE ); xObject->changeState( embed::EmbedStates::INPLACE_ACTIVE );
else else
{ {
......
...@@ -1055,8 +1055,9 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons ...@@ -1055,8 +1055,9 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
::svt::EmbeddedObjectRef::DrawPaintReplacement( Rectangle( aPosition, aSize ), pOLENd->GetOLEObj().GetCurrentPersistName(), pOut ); ::svt::EmbeddedObjectRef::DrawPaintReplacement( Rectangle( aPosition, aSize ), pOLENd->GetOLEObj().GetCurrentPersistName(), pOut );
sal_Int64 nMiscStatus = pOLENd->GetOLEObj().GetOleRef()->getStatus( pOLENd->GetAspect() ); sal_Int64 nMiscStatus = pOLENd->GetOLEObj().GetOleRef()->getStatus( pOLENd->GetAspect() );
if ( !bPrn && pShell->ISA( SwCrsrShell ) && if ( !bPrn && pShell->ISA( SwCrsrShell ) && (
nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE ) (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) ||
pOLENd->GetOLEObj().GetObject().IsGLChart()))
{ {
const SwFlyFrm *pFly = FindFlyFrm(); const SwFlyFrm *pFly = FindFlyFrm();
assert( pFly != NULL ); assert( pFly != NULL );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment