Hi Mikhail,
With your instructions I made a patch to the embeddedobj module, it
seems the result on my machine can met the expectations, would you
please review it for me? Thanks very much. :-)
Best Regards,
Felix.
Mikhail Voitenko 写道:
Hi Felix,
The patch looks good. Now we have to detect the size of the desktop
and center the window just before it is shown ( just before the method
XWindow::setVisible() that you have added ).
To do so please do the following:
- use the service "com.sun.star.awt.DisplayAccess" as it is done in
the file "sd/source/ui/view/presvish.cxx" to get the default display
index;
- after that please use the index to get the display and get the
position and size from it as it is done in the file
"vcl/win/source/window/salframe.cxx". The only difference in our case
is that "WorkArea" instead of "ScreenArea" should be used;
- please get the size of the container window using
XWindow::getPosSize();
- based on the size of the ContainerWindow and the size of the
"WorkArea" calculate the new offset for the ContainerWindow placement
( please do not forget to add the position of the "WorkArea" to the
offset ) and set the offset using XWindow::setPosSize().
As for the modules, in few words the module "embeddedobj" is an
implementation of the embedding of documents into OOo documents,
"embedserv" is an implementation of the OOo OLE server ( possibility
to embed OOo documents into OLE containers ). The same name of the
help class "DocumentHolder" is just a coincidence, although the
implementations have similar ( but not completely the same )
functions. They control the document, listen for related events and etc.
As for the service names, each service implementation has usually own
unique implementation name, it could be referred by. There is no
policy how to generate it, so it depends from the developer.
The difference in services count is caused by implementation name of
the OLESimpleStorage that is declared as supported service name. I
will discuss what is the best way to solve the inconsistence. Thank
you for reporting the problem.
Best Regards,
Mikhail.
Zhang Xiaofei wrote:
Hi Mikhail,
Thanks very much for your instructions, I have made a patch to
/embeddedobj/source/general/docholder.cxx. By far the modification did
not cause obvious problems on my machine. Please check if it is right.
And I'm looking forward to do the rest of work for this issue asap. :-)
I might need your instructions on the projects and classes related to
this issue:
- What are the functions for modules embeddedobj and embedserv,
respectively?( while most of the modules in framework are described
briefly on the main page of the project, these two are not in the list)
- What is the function of class DocumentHolder in embeddedobj? I find a
class with the same name in embedserv, while the first one implements:
=======================
util::XCloseListener,
frame::XTerminateListener,
util::XModifyListener,
document::XEventListener,
frame::XBorderResizeListener,
embed::XHatchWindowController.
-----------------------
The latter one implements:
=======================
util::XCloseListener,
frame::XTerminateListener,
util::XModifyListener,
ui::XDockingAreaAcceptor
-----------------------
Could you please explain the relationship between the two classes, and
why they do not implement the exactly same interfaces?
The last question may not be related to this issue, but something I
don't understand with our previous issues:
While Running
=======================
$ ./regview.exe services.rdb |grep OLESimpleStorage
-----------------------
displays:
=======================
/ com.sun.star.comp.embed.OLESimpleStorage
/ com.sun.star.embed.OLESimpleStorage
/ com.sun.star.comp.embed.OLESimpleStorage
/ com.sun.star.embed.OLESimpleStorage
Data = 0 = "com.sun.star.comp.embed.OLESimpleStorage"
/ com.sun.star.comp.embed.OLESimpleStorage
Data = 0 = "com.sun.star.comp.embed.OLESimpleStorage"
-----------------------
Running
=======================
$ ./regview.exe services.rdb |grep TempFile
-----------------------
displays:
=======================
/ com.sun.star.io.comp.TempFile
/ com.sun.star.io.TempFile
/ com.sun.star.io.TempFile
Data = 0 = "com.sun.star.io.comp.TempFile"
-----------------------
- What does the "comp" in the namespace of a service stand for?
- Why the "comp"s in the two are inserted in different position, with
the first before "embed", and the latter after "io"?
Thanks and Best Regards,
Felix.
Mikhail Voitenko 写道:
Hi Felix,
Good that the problem with the breakpoint is solved. I must confess I
could not reproduce the problem in our environment, the breakpoint is
reachable after the file in sfx2 is built with debug information. It
probably depends from the office build that is used.
Thank you for the stack. It shows that the final resize of the inner
document size happens asynchronously based on the outer window. But
that
mean that at this point the outer window should already have the
correct
size and can be centered.
The window can be centered only after the document is loaded. To avoid
the flickering of the window let it be created invisible, to do this
please insert a new property "MakeVisible" set to false into
m_aOutplaceFrameProps sequence. That should be done in the
embeddedobj/source/general/docholder.cxx in the constructor of the
"DocumentHolder".
To let the document be visible please call the method
XWindow::setVisible( sal_True ) on the container window of the frame
retrieved by XFrame::getContainerWindow() method. That should be
done at
the end of the DocumentHolder::GetDocFrame() method.
Please implement this and in case it works well, we will introduce the
centering after the document is loaded and the layout manager is
unlocked.
Best Regards,
Mikhail.
Zhang Xiaofei wrote:
Hi Mikhail,
The breakpoint starts to work after I built the 'desktop' project with
debug information as well.With the call stack of the last call of
SetVisArea() in the attachment, I'm trying to dig into the related
functions, could you give me any hints, please?
With Best Regards,
Felix.
Zhang Xiaofei 写道:
Hi Mikhail,
I'm trying to debug around the issue but the application does not
break
in the method as anticipated, below are the steps I took, could you
point out what I have done wrong please? (the steps are taken on a
source that has been built completely without debug information)
- Remove the output directories of 'embeddedobj' and 'dbaccess'
projects.
- 'touch source/doc/objembed.cxx' in '$SOURCE_PATH/sfx2/'.
- 'build debug=true' in all the three projects above.
- Copy all the generated .dll files in the three projects to
'$INSTALL_PATH/program/'.
Best Regards,
Felix.
------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
diff -urNpw @embeddedobj/source/general/docholder.cxx
embeddedobj/source/general/docholder.cxx
--- @embeddedobj/source/general/docholder.cxx 2007-07-30 12:42:04.000000000
+0800
+++ embeddedobj/source/general/docholder.cxx 2007-11-07 16:56:52.000000000
+0800
@@ -162,6 +162,9 @@
#ifndef _COM_SUN_STAR_EMBED_STATECHANGEINPROGRESSEXCEPTION_HPP_
#include <com/sun/star/embed/StateChangeInProgressException.hpp>
#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
#include <com/sun/star/embed/EmbedMisc.hpp>
#include <com/sun/star/embed/EmbedStates.hpp>
@@ -271,13 +274,17 @@ DocumentHolder::DocumentHolder( const un
m_nNoBorderResizeReact( 0 ),
m_nNoResizeReact( 0 )
{
- m_aOutplaceFrameProps.realloc( 2 );
+ m_aOutplaceFrameProps.realloc( 3 );
beans::NamedValue aArg;
aArg.Name = ::rtl::OUString::createFromAscii("TopWindow");
aArg.Value <<= sal_True;
m_aOutplaceFrameProps[0] <<= aArg;
+ aArg.Name = ::rtl::OUString::createFromAscii("MakeVisible");
+ aArg.Value <<= sal_False;
+ m_aOutplaceFrameProps[1] <<= aArg;
+
const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM (
"com.sun.star.frame.Desktop" ) );
uno::Reference< frame::XDesktop > xDesktop( m_xFactory->createInstance(
aServiceName ), uno::UNO_QUERY );
if ( xDesktop.is() )
@@ -294,10 +301,10 @@ DocumentHolder::DocumentHolder( const un
aArg.Name = ::rtl::OUString::createFromAscii("ParentFrame");
aArg.Value <<= xDesktop; //TODO/LATER: should use parent
document frame
- m_aOutplaceFrameProps[1] <<= aArg;
+ m_aOutplaceFrameProps[2] <<= aArg;
}
else
- m_aOutplaceFrameProps.realloc( 1 );
+ m_aOutplaceFrameProps.realloc( 2 );
}
//---------------------------------------------------------------------------
@@ -1025,6 +1032,32 @@ uno::Reference< frame::XFrame > Document
xOwnLM->unlock();
}
+ try
+ {
+ uno::Reference< awt::XWindow > xHWindow =
m_xFrame->getContainerWindow();
+ uno::Reference< beans::XPropertySet > xMonProps(
m_xFactory->createInstance(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.awt.DisplayAccess" ) ) ), uno::UNO_QUERY_THROW );
+ const rtl::OUString sPropName( RTL_CONSTASCII_USTRINGPARAM(
"DefaultDisplay" ) );
+ sal_Int32 nDisplay = 0;
+ xMonProps->getPropertyValue( sPropName ) >>= nDisplay;
+
+ uno::Reference< container::XIndexAccess > xMultiMon(
m_xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.awt.DisplayAccess" ) ) ), uno::UNO_QUERY_THROW );
+
+ uno::Reference< beans::XPropertySet > xMonitor( xMultiMon->getByIndex(
nDisplay ), uno::UNO_QUERY_THROW );
+ awt::Rectangle aWorkRect;
+ xMonitor->getPropertyValue( rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM( "WorkArea" ) ) ) >>= aWorkRect;
+ awt::Rectangle aWindowRect = xHWindow->getPosSize();
+
+ int OffsetX = ( aWorkRect.Width - aWindowRect.Width ) / 2 +
aWorkRect.X;
+ int OffsetY = ( aWorkRect.Height - aWindowRect.Height ) /2 +
aWorkRect.Y;
+
+ xHWindow->setPosSize( OffsetX, OffsetY,
aWindowRect.Width,aWindowRect.Height, awt::PosSize::POSSIZE );
+
+ xHWindow->setVisible( sal_True );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+
return m_xFrame;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]