openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arie...@apache.org
Subject svn commit: r1468299 [5/5] - in /openoffice/trunk/main: ./ default_images/minimizer/ default_images/res/commandimagelist/ helpcontent2/prj/ helpcontent2/source/text/simpress/ helpcontent2/source/text/simpress/minimizer/ helpcontent2/util/simpress/ offi...
Date Tue, 16 Apr 2013 03:55:36 GMT
Modified: openoffice/trunk/main/sdext/source/minimizer/unodialog.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sdext/source/minimizer/unodialog.cxx?rev=1468299&r1=1468298&r2=1468299&view=diff
==============================================================================
--- openoffice/trunk/main/sdext/source/minimizer/unodialog.cxx (original)
+++ openoffice/trunk/main/sdext/source/minimizer/unodialog.cxx Tue Apr 16 03:55:34 2013
@@ -25,20 +25,23 @@
 #include "precompiled_sdext.hxx"
 
 #include "unodialog.hxx"
-#include <com/sun/star/text/XTextRange.hpp>
-#include <com/sun/star/drawing/XShapes.hpp>
+
+#include <com/sun/star/awt/MessageBoxButtons.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/awt/PosSize.hpp>
+#include <com/sun/star/awt/XMessageBoxFactory.hpp>
+#include <com/sun/star/awt/XStyleSettingsSupplier.hpp>
 #include <com/sun/star/container/XIndexAccess.hpp>
-#include <com/sun/star/view/XSelectionSupplier.hpp>
-#include <com/sun/star/view/XControlAccess.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
 #include <com/sun/star/frame/XDispatch.hpp>
-#include <com/sun/star/awt/XMessageBoxFactory.hpp>
-#include <com/sun/star/awt/MessageBoxButtons.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/view/XControlAccess.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
 
 // -------------
 // - UnoDialog -
 // -------------
 
-using namespace ::rtl;
 using namespace ::com::sun::star::awt;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::util;
@@ -48,44 +51,58 @@ using namespace ::com::sun::star::frame;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::script;
 
-UnoDialog::UnoDialog( const Reference< XComponentContext > &rxMSF, Reference<
XFrame >& rxFrame ) :
-	mxMSF( rxMSF ),
-	mxController( rxFrame->getController() ),
-	mxDialogModel( mxMSF->getServiceManager()->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM(
-		"com.sun.star.awt.UnoControlDialogModel" ) ), mxMSF ), UNO_QUERY_THROW ),
+using ::rtl::OUString;
+
+UnoDialog::UnoDialog(
+    const Reference< XComponentContext > &rxContext,
+    const Reference< XWindowPeer >& rxParent ) :
+	mxContext( rxContext ),
+	mxParent( rxParent ),
+	mxDialogModel( mxContext->getServiceManager()->createInstanceWithContext( OUString(
RTL_CONSTASCII_USTRINGPARAM(
+		"com.sun.star.awt.UnoControlDialogModel" ) ), mxContext ), UNO_QUERY_THROW ),
 	mxDialogModelMultiPropertySet( mxDialogModel, UNO_QUERY_THROW ),
 	mxDialogModelPropertySet( mxDialogModel, UNO_QUERY_THROW ),
 	mxDialogModelMSF( mxDialogModel, UNO_QUERY_THROW ),
 	mxDialogModelNameContainer( mxDialogModel, UNO_QUERY_THROW ),
 	mxDialogModelNameAccess( mxDialogModel, UNO_QUERY_THROW ),
 	mxControlModel( mxDialogModel, UNO_QUERY_THROW ),
-	mxDialog( mxMSF->getServiceManager()->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM(
-		"com.sun.star.awt.UnoControlDialog" ) ), mxMSF ), UNO_QUERY_THROW ),
+	mxDialog( mxContext->getServiceManager()->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM(
+		"com.sun.star.awt.UnoControlDialog" ) ), mxContext ), UNO_QUERY_THROW ),
 	mxControl( mxDialog, UNO_QUERY_THROW ),
 	mbStatus( sal_False )
 {
+    OSL_TRACE("UnoDialog::UnoDialog");
 	mxControl->setModel( mxControlModel );
 	mxDialogControlContainer = Reference< XControlContainer >( mxDialog, UNO_QUERY_THROW
);
-	mxDialogComponent = Reference< XComponent >( mxDialog, UNO_QUERY_THROW );
-	mxDialogWindow = Reference< XWindow >( mxDialog, UNO_QUERY_THROW );
-
-	Reference< XFrame > xFrame( mxController->getFrame() );
-	Reference< XWindow > xContainerWindow( xFrame->getContainerWindow() );
-	mxWindowPeer = Reference< XWindowPeer >( xContainerWindow, UNO_QUERY_THROW );
-	createWindowPeer( mxWindowPeer );		
+    mxDialogWindow = Reference< XWindow >( mxDialog, UNO_QUERY );
+	mxDialogWindowPeer = createWindowPeer();
 }
 
 // -----------------------------------------------------------------------------
 
 UnoDialog::~UnoDialog()
 {
-
+    OSL_TRACE("UnoDialog::~UnoDialog");
+    Reference< XComponent > xComponent( mxDialog, UNO_QUERY );
+    if ( xComponent.is() )
+    {
+        xComponent->dispose();
+    }
 }
 
 // -----------------------------------------------------------------------------
 
+void UnoDialog::setTitle( const rtl::OUString &rTitle )
+{
+    if ( rTitle.getLength() )
+    {
+        mxDialog->setTitle( rTitle );
+    }
+}
+
 void UnoDialog::execute()
 {
+    OSL_TRACE("UnoDialog::execute");
 	mxDialogWindow->setEnable( sal_True );
 	mxDialogWindow->setVisible( sal_True );
 	mxDialog->execute();
@@ -93,22 +110,55 @@ void UnoDialog::execute()
 
 void UnoDialog::endExecute( sal_Bool bStatus )
 {
+    OSL_TRACE("UnoDialog::endExecute");
 	mbStatus = bStatus;
 	mxDialog->endExecute();
 }
 
+void UnoDialog::centerDialog()
+{
+    Reference< XWindow > xParent( mxParent, UNO_QUERY );
+    if ( !xParent.is() )
+        return;
+
+    Rectangle aParentPosSize = xParent->getPosSize();
+    Rectangle aWinPosSize = mxDialogWindow->getPosSize();
+    Point aWinPos((aParentPosSize.Width - aWinPosSize.Width) / 2,
+                  (aParentPosSize.Height - aWinPosSize.Height) / 2);
+
+    if ( ( aWinPos.X + aWinPosSize.Width ) > ( aParentPosSize.X + aParentPosSize.Width
) )
+        aWinPos.X = aParentPosSize.X + aParentPosSize.Width - aWinPosSize.Width;
+
+    if ( ( aWinPos.Y + aWinPosSize.Height ) > ( aParentPosSize.Y + aParentPosSize.Height
) )
+        aWinPos.Y = aParentPosSize.Y + aParentPosSize.Height - aWinPosSize.Height;
+
+    mxDialogWindow->setPosSize( aWinPos.X, aWinPos.Y,
+                                aWinPosSize.Width,
+                                aWinPosSize.Height,
+                                PosSize::POS );
+}
+
 // -----------------------------------------------------------------------------
 
-Reference< XWindowPeer > UnoDialog::createWindowPeer( Reference< XWindowPeer >
xParentPeer )
+Reference< XWindowPeer > UnoDialog::createWindowPeer()
 	throw ( Exception )
 {
-	mxDialogWindow->setVisible( sal_False );
-	Reference< XToolkit > xToolkit( mxMSF->getServiceManager()->createInstanceWithContext(
OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ), mxMSF ), UNO_QUERY_THROW
 );
-	if ( !xParentPeer.is() )
-		xParentPeer = xToolkit->getDesktopWindow();
+    mxDialogWindow->setVisible( sal_False );
+
+    // reuse the parent's toolkit
+	Reference< XToolkit > xToolkit;
+    if ( mxParent.is() )
+        xToolkit.set( mxParent->getToolkit() );
+
+    if ( !xToolkit.is() )
+         xToolkit.set( mxContext->getServiceManager()->createInstanceWithContext(
+             OUString( RTL_CONSTASCII_USTRINGPARAM(
+                 "com.sun.star.awt.Toolkit" ) ), mxContext ),
+                    UNO_QUERY_THROW  );
+
 	mxReschedule = Reference< XReschedule >( xToolkit, UNO_QUERY );
-	mxControl->createPeer( xToolkit, xParentPeer );
-//	xWindowPeer = xControl.getPeer();
+	mxControl->createPeer( xToolkit, mxParent );
+
 	return mxControl->getPeer();
 }
 
@@ -153,14 +203,9 @@ sal_Bool UnoDialog::isHighContrast()
 	sal_Bool bHighContrast = sal_False;
 	try
 	{
-		sal_Int32 nBackgroundColor = 0;
-		if ( mxDialogModelPropertySet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM(
"BackgroundColor" ) ) ) >>= nBackgroundColor )
-		{
-			sal_uInt8 nLum( static_cast< sal_uInt8 >( ( static_cast< sal_uInt8 >( nBackgroundColor
>> 16 ) * 28 +
-														static_cast< sal_uInt8 >( nBackgroundColor >> 8 ) * 151 +
-														static_cast< sal_uInt8 >( nBackgroundColor ) * 77 ) >> 8 ) );
-			bHighContrast = nLum <= 38;
-		}
+        Reference< XStyleSettingsSupplier > xStyleSettingsSuppl( mxDialogWindow, UNO_QUERY_THROW
);
+        Reference< XStyleSettings > xStyleSettings( xStyleSettingsSuppl->getStyleSettings()
);
+        bHighContrast = xStyleSettings->getHighContrastMode();
 	}
 	catch( Exception& )
 	{

Modified: openoffice/trunk/main/sdext/source/minimizer/unodialog.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sdext/source/minimizer/unodialog.hxx?rev=1468299&r1=1468298&r2=1468299&view=diff
==============================================================================
--- openoffice/trunk/main/sdext/source/minimizer/unodialog.hxx (original)
+++ openoffice/trunk/main/sdext/source/minimizer/unodialog.hxx Tue Apr 16 03:55:34 2013
@@ -26,9 +26,7 @@
 
 #include <com/sun/star/uno/Sequence.h>
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#ifndef _COM_SUN_STAR_LANG_XMULTI_COMPONENT_FACTORY_HPP_
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#endif
 #include <com/sun/star/container/XIndexContainer.hpp>
 #include <com/sun/star/frame/XController.hpp>
 #include <com/sun/star/frame/XFrame.hpp>
@@ -53,9 +51,6 @@
 #include <com/sun/star/awt/XReschedule.hpp>
 #include <com/sun/star/awt/XDialog.hpp>
 #include <com/sun/star/awt/Size.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase3.hxx>
 
 // -------------
 // - UnoDialog -
@@ -67,23 +62,24 @@ class UnoDialog
 {
 public :
 
-	UnoDialog( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext
>& rxMSF, com::sun::star::uno::Reference< com::sun::star::frame::XFrame >&
rxFrame );
-    ~UnoDialog();
+	UnoDialog( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext
>& rxContext,
+               const com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer
>& rxParent);
+    virtual ~UnoDialog();
+    void execute();
+    void endExecute( sal_Bool bStatus );
+    void setTitle( const rtl::OUString &rTitle);
+
+protected:
+    void setVisible( const rtl::OUString& rName, sal_Bool bVisible );
+    sal_Int32 getMapsFromPixels( sal_Int32 nPixels ) const;
+    sal_Bool isHighContrast();
+    void centerDialog();
 
-	void execute();
-	void endExecute( sal_Bool bStatus );
-
-	com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer > createWindowPeer(
com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer > xParentPeer )
-		throw ( com::sun::star::uno::Exception );
+	com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer > createWindowPeer()
throw ( com::sun::star::uno::Exception );
 
 	com::sun::star::uno::Reference< com::sun::star::uno::XInterface > insertControlModel(
const rtl::OUString& rServiceName, const rtl::OUString& rName,
 		const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames, const com::sun::star::uno::Sequence<
com::sun::star::uno::Any >& rPropertyValues );
 
-	void setVisible( const rtl::OUString& rName, sal_Bool bVisible );
-
-	sal_Bool isHighContrast();
-
-	sal_Int32 getMapsFromPixels( sal_Int32 nPixels ) const;
 
 	com::sun::star::uno::Reference< com::sun::star::awt::XButton > insertButton( const
rtl::OUString& rName,
 		com::sun::star::uno::Reference< com::sun::star::awt::XActionListener > xActionListener,
const com::sun::star::uno::Sequence< rtl::OUString >& rPropertyNames,
@@ -112,15 +108,13 @@ public :
 
 	void setControlProperty( const rtl::OUString& rControlName, const rtl::OUString&
rPropertyName, const com::sun::star::uno::Any& rPropertyValue );
 	com::sun::star::uno::Any getControlProperty( const rtl::OUString& rControlName, const
rtl::OUString& rPropertyName );
-#if 0
-	void showMessageBox( const rtl::OUString& rTitle, const rtl::OUString& rMessage,
sal_Bool bErrorBox ) const;
-#endif
 	void enableControl( const rtl::OUString& rControlName );
 	void disableControl( const rtl::OUString& rControlName );
 
-	com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >		mxMSF;
-	com::sun::star::uno::Reference< com::sun::star::frame::XController >			mxController;
-	com::sun::star::uno::Reference< com::sun::star::awt::XReschedule >				mxReschedule;
+protected:
+
+	com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >		mxContext;
+    com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer >            
 mxParent;
 
 	com::sun::star::uno::Reference< com::sun::star::uno::XInterface >				mxDialogModel;
 	com::sun::star::uno::Reference< com::sun::star::beans::XMultiPropertySet >		mxDialogModelMultiPropertySet;
@@ -128,18 +122,16 @@ public :
 	com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >	mxDialogModelMSF;
 	com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >		mxDialogModelNameContainer;
 	com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >		mxDialogModelNameAccess;
-
 	com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >			mxControlModel;
-
 	com::sun::star::uno::Reference< com::sun::star::awt::XDialog >					mxDialog;
 	com::sun::star::uno::Reference< com::sun::star::awt::XControl >					mxControl;
-	com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer >				mxWindowPeer;
+    sal_Bool                                                                        mbStatus;
 
 	com::sun::star::uno::Reference< com::sun::star::awt::XControlContainer >		mxDialogControlContainer;
-	com::sun::star::uno::Reference< com::sun::star::lang::XComponent >				mxDialogComponent;
 	com::sun::star::uno::Reference< com::sun::star::awt::XWindow >					mxDialogWindow;
+    com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer >            
 mxDialogWindowPeer;
 
-	sal_Bool																		mbStatus;
+    com::sun::star::uno::Reference< com::sun::star::awt::XReschedule >            
 mxReschedule;
 };
 
 #endif // UNODIALOG_HXX

Modified: openoffice/trunk/main/set_soenv.in
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/set_soenv.in?rev=1468299&r1=1468298&r2=1468299&view=diff
==============================================================================
--- openoffice/trunk/main/set_soenv.in (original)
+++ openoffice/trunk/main/set_soenv.in Tue Apr 16 03:55:34 2013
@@ -1676,7 +1676,6 @@ ToFile( "ENABLE_CAIRO",      "@ENABLE_CA
 ToFile( "ENABLE_CAIRO_CANVAS", "@ENABLE_CAIRO_CANVAS@",     "e" );
 ToFile( "ENABLE_OPENGL",     "@ENABLE_OPENGL@",    "e" );
 ToFile( "ENABLE_PDFIMPORT",  "@ENABLE_PDFIMPORT@", "e" );
-ToFile( "ENABLE_MINIMIZER",   "@ENABLE_MINIMIZER@","e" );
 ToFile( "ENABLE_PRESENTER_SCREEN","@ENABLE_PRESENTER_SCREEN@","e" );
 ToFile( "ENABLE_REPORTBUILDER","@ENABLE_REPORTBUILDER@","e" );
 ToFile( "SYSTEM_JFREEREPORT","@SYSTEM_JFREEREPORT@","e" );



Mime
View raw message