summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2010-10-13 10:17:11 +0100
committerNoel Power <noel.power@novell.com>2010-10-13 10:17:11 +0100
commit5a9064d007fb1268ef72073466c554f43f0b8439 (patch)
treebbc57d9f7210e36f48d2b32ea6cd3c62a38af529 /basctl
parent762dbbb4b11279cf087cc52c0dd4c3d38f3ca220 (diff)
parente31e563d728078ea564a3d398b74d3467e0ba56a (diff)
Merge branch 'vba' fix conflics ( below ), trailing ws and leading tabs
Conflicts: forms/source/component/RadioButton.cxx forms/source/inc/property.hrc
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/baside3.cxx19
-rw-r--r--basctl/source/basicide/basides3.cxx2
-rw-r--r--basctl/source/basicide/moduldlg.cxx4
-rw-r--r--basctl/source/basicide/scriptdocument.cxx10
-rw-r--r--basctl/source/dlged/dlged.cxx9
-rw-r--r--basctl/source/dlged/dlgedobj.cxx40
-rw-r--r--basctl/source/inc/dlged.hxx5
7 files changed, 60 insertions, 29 deletions
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index 1d21dc963cbd..0755e668ad20 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -80,6 +80,7 @@
#include <com/sun/star/resource/XStringResourceResolver.hpp>
#include <com/sun/star/resource/StringResourceWithLocation.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
using namespace comphelper;
using namespace ::com::sun::star;
@@ -110,8 +111,16 @@ DialogWindow::DialogWindow( Window* pParent, const ScriptDocument& rDocument, St
{
InitSettings( TRUE, TRUE, TRUE );
- pEditor = new DlgEditor();
+ pEditor = new DlgEditor( rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
pEditor->SetWindow( this );
+ // set vba mode on DialogModel ( allows it to work in 100thmm instead of MAP_APPFONT )
+ if ( rDocument.isDocument() && rDocument.getDocument().is() )
+ {
+ uno::Reference< script::vba::XVBACompatibility > xDocVBAMode( rDocument.getLibraryContainer( E_SCRIPTS ), uno::UNO_QUERY );
+ uno::Reference< script::vba::XVBACompatibility > xDialogModelVBAMode( xDialogModel, uno::UNO_QUERY );
+ if ( xDocVBAMode.is() && xDialogModelVBAMode.is() )
+ xDialogModelVBAMode->setVBACompatibilityMode( xDocVBAMode->getVBACompatibilityMode() );
+ }
pEditor->SetDialog( xDialogModel );
// Undo einrichten
@@ -726,7 +735,7 @@ BOOL DialogWindow::SaveDialog()
Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
Reference< XInputStream > xInput( xISP->createInputStream() );
Reference< XSimpleFileAccess > xSFI( xMSF->createInstance
@@ -1008,7 +1017,7 @@ BOOL implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocumen
Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
String aXmlDlgName;
Reference< beans::XPropertySet > xDialogModelPropSet( xDialogModel, UNO_QUERY );
@@ -1234,7 +1243,7 @@ BOOL implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocumen
}
}
- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
bool bSuccess = rDocument.insertDialog( aLibName, aNewDlgName, xISP );
if( bSuccess )
{
@@ -1344,7 +1353,7 @@ void DialogWindow::StoreData()
Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
xLib->replaceByName( ::rtl::OUString( GetName() ), makeAny( xISP ) );
}
}
diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx
index 22fbdc4a9c7b..322faa0bcc11 100644
--- a/basctl/source/basicide/basides3.cxx
+++ b/basctl/source/basicide/basides3.cxx
@@ -96,7 +96,7 @@ DialogWindow* BasicIDEShell::CreateDlgWin( const ScriptDocument& rDocument, cons
Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
LocalizationMgr::setStringResourceAtDialog( rDocument, rLibName, aDlgName, xDialogModel );
// new dialog window
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
index 02e6a4940dd8..325befcde8e4 100644
--- a/basctl/source/basicide/moduldlg.cxx
+++ b/basctl/source/basicide/moduldlg.cxx
@@ -308,7 +308,7 @@ void BasicIDEShell::CopyDialogResources( Reference< io::XInputStreamProvider >&
Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext );
+ ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rSourceDoc.isDocument() ? rSourceDoc.getDocument() : Reference< frame::XModel >() );
if( xDialogModel.is() )
{
@@ -325,7 +325,7 @@ void BasicIDEShell::CopyDialogResources( Reference< io::XInputStreamProvider >&
{
LocalizationMgr::setResourceIDsForDialog( xDialogModel, xDestMgr );
}
- io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
+ io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDestDoc.isDocument() ? rDestDoc.getDocument() : Reference< frame::XModel >() );
}
}
diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx
index 6b16316d889c..98cd27c55668 100644
--- a/basctl/source/basicide/scriptdocument.cxx
+++ b/basctl/source/basicide/scriptdocument.cxx
@@ -453,14 +453,12 @@ namespace basctl
bool ScriptDocument_Impl::isInVBAMode() const
{
bool bResult = false;
-#ifdef FUTURE_VBA_CWS
if ( !isApplication() )
{
Reference< XVBACompatibility > xVBACompat( getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
if ( xVBACompat.is() )
bResult = xVBACompat->getVBACompatibilityMode();
}
-#endif
return bResult;
}
@@ -678,7 +676,7 @@ namespace basctl
if ( !_rxExistingDialogModel.is() )
{
Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW );
- ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext() );
+ ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() );
}
// set new name as property
@@ -686,12 +684,12 @@ namespace basctl
xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rNewName ) );
// export dialog model
- xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext() );
+ xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() );
aElement <<= xISP;
}
// insert element by new name in container
- else if ( _eType == E_SCRIPTS )
+ if ( _eType == E_SCRIPTS )
{
Reference< XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY );
if ( xVBAModuleInfo->hasModuleInfo( _rOldName ) )
@@ -798,7 +796,7 @@ namespace basctl
xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rDialogName ) );
// export dialog model
- _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext() );
+ _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() );
// insert dialog into library
xLib->insertByName( _rDialogName, makeAny( _out_rDialogProvider ) );
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index fd1d6dfa3bdc..4680ea529f19 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -203,7 +203,7 @@ BOOL DlgEditor::RemarkDialog()
//----------------------------------------------------------------------------
-DlgEditor::DlgEditor()
+DlgEditor::DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel )
:pHScroll(NULL)
,pVScroll(NULL)
,pDlgEdModel(NULL)
@@ -225,6 +225,7 @@ DlgEditor::DlgEditor()
,bCreateOK(TRUE)
,bDialogModelChanged(FALSE)
,mnPaintGuard(0)
+ ,m_xDocument( xModel )
{
pDlgEdModel = new DlgEdModel();
pDlgEdModel->GetItemPool().FreezeIdRanges();
@@ -833,7 +834,7 @@ void DlgEditor::Copy()
Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext );
+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
Reference< XInputStream > xStream( xISP->createInputStream() );
Sequence< sal_Int8 > DialogModelBytes;
implCopyStreamToByteSequence( xStream, DialogModelBytes );
@@ -866,7 +867,7 @@ void DlgEditor::Copy()
uno::Reference< resource::XStringResourceManager >
xStringResourceManager( xStringResourcePersistence, uno::UNO_QUERY );
LocalizationMgr::resetResourceForDialog( xClipDialogModel, xStringResourceManager );
- Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext );
+ Reference< XInputStreamProvider > xISP2 = ::xmlscript::exportDialogModel( xClipDialogModel, xContext, m_xDocument );
Reference< XInputStream > xStream2( xISP2->createInputStream() );
Sequence< sal_Int8 > NoResourceDialogModelBytes;
implCopyStreamToByteSequence( xStream2, NoResourceDialogModelBytes );
@@ -1012,7 +1013,7 @@ void DlgEditor::Paste()
Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
OSL_ASSERT( xProps.is() );
OSL_VERIFY( xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
- ::xmlscript::importDialogModel( ::xmlscript::createInputStream( *((::rtl::ByteSequence*)(&DialogModelBytes)) ) , xClipDialogModel, xContext );
+ ::xmlscript::importDialogModel( ::xmlscript::createInputStream( *((::rtl::ByteSequence*)(&DialogModelBytes)) ) , xClipDialogModel, xContext, m_xDocument );
}
// get control models from clipboard dialog model
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index f21d7990012e..efd08902435c 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -72,6 +72,22 @@ TYPEINIT1(DlgEdObj, SdrUnoObj);
DBG_NAME(DlgEdObj);
//----------------------------------------------------------------------------
+MapMode lcl_getMapModeForForm( DlgEdForm* pForm )
+{
+ MapMode aMode( MAP_APPFONT ); //Default
+ try
+ {
+ uno::Reference< beans::XPropertySet > xProps( pForm ? pForm->GetUnoControlModel() : NULL, uno::UNO_QUERY_THROW );
+ sal_Bool bVBAForm = sal_False;
+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBAForm;
+ if ( bVBAForm )
+ aMode = MapMode( MAP_100TH_MM );
+ }
+ catch ( Exception& )
+ {
+ }
+ return aMode;
+}
DlgEdObj::DlgEdObj()
:SdrUnoObj(String(), sal_False)
@@ -192,8 +208,9 @@ bool DlgEdObj::TransformSdrToControlCoordinates(
}
// convert pixel to logic units
- aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_APPFONT ) );
- aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_APPFONT ) );
+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
+ aPos = pDevice->PixelToLogic( aPos, aConvMode );
+ aSize = pDevice->PixelToLogic( aSize, aConvMode );
// set out parameters
nXOut = aPos.Width();
@@ -240,10 +257,10 @@ bool DlgEdObj::TransformSdrToFormCoordinates(
aSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset;
aSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset;
}
-
+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
// convert pixel to logic units
- aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_APPFONT ) );
- aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_APPFONT ) );
+ aPos = pDevice->PixelToLogic( aPos, aConvMode );
+ aSize = pDevice->PixelToLogic( aSize, aConvMode );
// set out parameters
nXOut = aPos.Width();
@@ -285,9 +302,10 @@ bool DlgEdObj::TransformControlToSdrCoordinates(
DBG_ASSERT( pDevice, "DlgEdObj::TransformControlToSdrCoordinates: missing default device!" );
if ( !pDevice )
return false;
- aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_APPFONT ) );
- aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_APPFONT ) );
- aFormPos = pDevice->LogicToPixel( aFormPos, MapMode( MAP_APPFONT ) );
+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
+ aPos = pDevice->LogicToPixel( aPos, aConvMode );
+ aSize = pDevice->LogicToPixel( aSize, aConvMode );
+ aFormPos = pDevice->LogicToPixel( aFormPos, aConvMode );
// add form position
aPos.Width() += aFormPos.Width();
@@ -331,14 +349,16 @@ bool DlgEdObj::TransformFormToSdrCoordinates(
DBG_ASSERT( pDevice, "DlgEdObj::TransformFormToSdrCoordinates: missing default device!" );
if ( !pDevice )
return false;
- aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_APPFONT ) );
- aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_APPFONT ) );
// take window borders into account
DlgEdForm* pForm = NULL;
if ( !lcl_getDlgEdForm( this, pForm ) )
return false;
+ MapMode aConvMode = lcl_getMapModeForForm( pForm );
+ aPos = pDevice->LogicToPixel( aPos, aConvMode );
+ aSize = pDevice->LogicToPixel( aSize, aConvMode );
+
// take window borders into account
Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY );
DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformFormToSdrCoordinates: no form property set!" );
diff --git a/basctl/source/inc/dlged.hxx b/basctl/source/inc/dlged.hxx
index 1444bab59c65..f49d684cbe80 100644
--- a/basctl/source/inc/dlged.hxx
+++ b/basctl/source/inc/dlged.hxx
@@ -32,6 +32,7 @@
#include <com/sun/star/awt/XControlContainer.hpp>
#include <com/sun/star/datatransfer/DataFlavor.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/frame/XModel.hpp>
#include <tools/link.hxx>
#include <tools/gen.hxx>
#include <vcl/timer.hxx>
@@ -128,9 +129,11 @@ protected:
BOOL bDialogModelChanged;
Timer aMarkTimer;
long mnPaintGuard;
+ ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocument;
+ DlgEditor(); // not implemented
public:
- DlgEditor();
+ DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel );
~DlgEditor();
void SetWindow( Window* pWindow );