[ooo-build-commit] Branch 'ooo/master' - 9 commits - drawinglayer/source formula/inc formula/source fpicker/source framework/source officecfg/registry sfx2/inc sfx2/source svx/inc svx/source uui/source xmloff/source

Jan Holesovsky kendy at kemper.freedesktop.org
Fri Jul 31 18:05:54 PDT 2009


 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx |   63 ++
 drawinglayer/source/processor2d/vclprocessor2d.cxx         |  242 ++++-----
 formula/inc/formula/IFunctionDescription.hxx               |    5 
 formula/source/ui/dlg/formula.cxx                          |   58 +-
 fpicker/source/win32/filepicker/VistaFilePicker.cxx        |   16 
 fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx    |  125 +++-
 fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx    |    5 
 fpicker/source/win32/filepicker/filepickerstate.cxx        |   23 
 framework/source/services/frame.cxx                        |    9 
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |   19 
 sfx2/inc/sfx2/app.hxx                                      |    1 
 sfx2/inc/sfx2/filedlghelper.hxx                            |    2 
 sfx2/source/appl/app.cxx                                   |    8 
 sfx2/source/appl/shutdownicon.cxx                          |    6 
 sfx2/source/dialog/filedlghelper.cxx                       |   46 +
 sfx2/source/doc/docfile.cxx                                |   41 -
 sfx2/source/doc/doctemplates.cxx                           |    2 
 sfx2/source/doc/objmisc.cxx                                |   28 +
 sfx2/source/doc/objstor.cxx                                |   28 -
 sfx2/source/inc/objshimp.hxx                               |    2 
 svx/inc/mscodec.hxx                                        |   40 +
 svx/inc/svx/sdr/attribute/sdrtextattribute.hxx             |    4 
 svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx           |   19 
 svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx         |   12 
 svx/inc/svx/sdr/properties/properties.hxx                  |    5 
 svx/inc/svx/sdr/properties/textproperties.hxx              |    7 
 svx/inc/svx/svdograf.hxx                                   |    3 
 svx/inc/svx/svdpntv.hxx                                    |    4 
 svx/inc/svx/xcolit.hxx                                     |    2 
 svx/inc/svx/xflclit.hxx                                    |    2 
 svx/inc/svx/xflftrit.hxx                                   |    2 
 svx/inc/svx/xflgrit.hxx                                    |    2 
 svx/inc/svx/xflhtit.hxx                                    |    2 
 svx/inc/svx/xftshcit.hxx                                   |    2 
 svx/inc/svx/xit.hxx                                        |    8 
 svx/inc/svx/xlnclit.hxx                                    |    2 
 svx/inc/svx/xlndsit.hxx                                    |    2 
 svx/inc/svx/xlnedit.hxx                                    |    2 
 svx/inc/svx/xlnstit.hxx                                    |    2 
 svx/inc/svx/xsflclit.hxx                                   |    2 
 svx/source/cui/optpath.cxx                                 |   24 
 svx/source/dialog/dlgctrl.cxx                              |   38 -
 svx/source/msfilter/mscodec.cxx                            |   35 +
 svx/source/outliner/outliner.cxx                           |    2 
 svx/source/sdr/attribute/sdrtextattribute.cxx              |    8 
 svx/source/sdr/contact/viewcontactofgraphic.cxx            |  335 +++++++++++--
 svx/source/sdr/contact/viewcontactofsdrpathobj.cxx         |  119 ++--
 svx/source/sdr/contact/viewobjectcontactofgraphic.cxx      |   29 +
 svx/source/sdr/contact/viewobjectcontactofpageobj.cxx      |    3 
 svx/source/sdr/properties/properties.cxx                   |    5 
 svx/source/sdr/properties/textproperties.cxx               |   23 
 svx/source/svdraw/svdcrtv.cxx                              |   14 
 svx/source/svdraw/svdobj.cxx                               |    5 
 svx/source/svdraw/svdograf.cxx                             |   25 
 svx/source/xoutdev/xattr.cxx                               |   50 +
 uui/source/iahndl.cxx                                      |   93 +++
 uui/source/iahndl.hxx                                      |   16 
 uui/source/passcrtdlg.cxx                                  |   12 
 uui/source/passcrtdlg.hrc                                  |   27 -
 uui/source/passcrtdlg.hxx                                  |    2 
 uui/source/passcrtdlg.src                                  |   67 +-
 xmloff/source/chart/SchXMLSeries2Context.cxx               |    5 
 62 files changed, 1343 insertions(+), 447 deletions(-)

New commits:
commit b69898b51477499ebc399b843c3f42b8855e49b6
Author: Jens-Heiner Rechtien <hr at openoffice.org>
Date:   Fri Jul 31 11:37:50 2009 +0000

    #i10000#: call to a aBlockTextPrimitive(): adapt first parameter to interface definition

diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index 40f005d..29ee7ef 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -302,7 +302,7 @@ namespace sdr
 
                     // directly create temp SdrBlockTextPrimitive2D
                     drawinglayer::primitive2d::SdrBlockTextPrimitive2D aBlockTextPrimitive(
-                        *pSdrText,
+                        pSdrText,
                         *pOPO,
                         aTextRangeTransform,
                         false,
commit d56994ff3cb3cada585a016b24e197df04b300ae
Author: Jens-Heiner Rechtien <hr at openoffice.org>
Date:   Fri Jul 31 11:23:54 2009 +0000

    #i10000#: (merge error): proper initialization of xDataProvider

diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx
index 2702ec9..82a8973 100644
--- a/xmloff/source/chart/SchXMLSeries2Context.cxx
+++ b/xmloff/source/chart/SchXMLSeries2Context.cxx
@@ -665,7 +665,10 @@ void SchXMLSeries2Context::EndElement()
         }
     }
     
-    Reference< chart2::data::XDataProvider > xDataProvider( mrImportHelper.GetDataProvider( mxNewDoc ));
+    Reference< chart2::data::XDataProvider > xDataProvider;
+    if ( mxNewDoc.is() ) {
+        xDataProvider = mxNewDoc->getDataProvider();
+    }
     for( std::vector< DomainInfo >::reverse_iterator aIt( aDomainInfos.rbegin() ); aIt!= aDomainInfos.rend(); ++aIt )
     {
         DomainInfo aDomainInfo( *aIt );
commit 2792f3d9750382a9f713a36ac3203a36ac376f52
Author: Jens-Heiner Rechtien <hr at openoffice.org>
Date:   Fri Jul 31 10:04:40 2009 +0000

    #i10000#: twice declared method (merge artifact), remove one

diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx
index c5ec0b9..ba4032b 100644
--- a/sfx2/inc/sfx2/filedlghelper.hxx
+++ b/sfx2/inc/sfx2/filedlghelper.hxx
@@ -239,9 +239,6 @@ public:
     /** Provides the selected files with full path information */
     ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSelectedFiles() const;
     
-    /** Provides the selected files with full path information */
-    ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSelectedFiles() const;
-
     void                     AddFilter( const String& rFilterName, const String& rExtension );
     void                     SetCurrentFilter( const String& rFilter );
 
commit b61c41075439251d3f4fc695a7f34f66137de590
Author: Jens-Heiner Rechtien <hr at openoffice.org>
Date:   Thu Jul 30 10:52:48 2009 +0000

    CWS-TOOLING: integrate CWS fwk114
    2009-07-08 Mikhail Voytenko #i102448# fix typo
    2009-07-08 Mikhail Voytenko #i102448# detect the document of new format correctly
    2009-07-03 Mikhail Voytenko #i101418# adjust header
    2009-07-02 Mikhail Voytenko #i103001# Integrate the patch
    2009-07-01 Mikhail Voytenko rebase to DEV300_m51
    2009-06-25 Mikhail Voytenko #i71512# integrate the patch
    2009-06-19 Mikhail Voytenko #i102931# check whether the file was changed even in case of system file locking
    2009-06-10 Mikhail Voytenko #i102448# allow to turn the office update dialog off
    2009-06-10 Mikhail Voytenko #i102448# allow to turn the office update dialog off
    2009-06-09 Mikhail Voytenko #i96091# the disposed frame should throw DisposedException
    2009-06-09 Mikhail Voytenko #i100835# commit the patch
    2009-05-26 Mikhail Voytenko #i89514# integrate the patch
    2009-05-26 Mikhail Voytenko #i30373# integrate the patch
    2009-05-26 Mikhail Voytenko #i101418# fix the error handling

diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index 74728b4..6b3231b 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -350,6 +350,15 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Frame::loadComponentFromUR
                                                                                                                                                                    css::lang::IllegalArgumentException ,
                                                                                                                                                                    css::uno::RuntimeException          )
 {
+    {
+        // If the frame is closed the call might lead to crash even with target "_blank",
+        // so the DisposedException should be thrown in this case
+        // It still looks to be too dangerous to set the transaction for the whole loading process
+        // so the guard is used in scopes to let the standard check be used
+
+        TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS );
+    }
+
     ReadGuard aReadLock(m_aLock);
     css::uno::Reference< css::frame::XComponentLoader > xThis(static_cast< css::frame::XComponentLoader* >(this), css::uno::UNO_QUERY);
     css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xFactory;
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index b9bd1b5..a9f0b85 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -2346,6 +2346,13 @@ Dymamic border coloring means that when the mouse is hovered over a control, and
 				</info>
 				<value>true</value>
 			</prop>
+			<prop oor:name="ShowOfficeUpdateDialog" oor:type="xs:boolean">
+				<info>
+					<author>MAV</author>
+					<desc>Specifies whether the office update dialog should be shown in case the loaded document has newer ODF version than the maximal supported one.</desc>
+				</info>
+				<value>true</value>
+			</prop>
 		</group>
 		<group oor:name="Security">
 			<info>
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 7028edc..e0314ea 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -576,33 +576,30 @@ void SfxMedium::CheckFileDate( const util::DateTime& aInitDate )
       || pImp->m_aDateTime.Month != aInitDate.Month
       || pImp->m_aDateTime.Year != aInitDate.Year )
     {
-        if ( !IsSystemFileLockingUsed() )
-        {
-            uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler();
+        uno::Reference< task::XInteractionHandler > xHandler = GetInteractionHandler();
 
-            if ( xHandler.is() )
+        if ( xHandler.is() )
+        {
+            try
             {
-                try
-                {
-                    ::rtl::Reference< ::ucbhelper::InteractionRequest > xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny(
-                        document::ChangedByOthersRequest() ) );
-                    uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 3 );
-                    aContinuations[0] = new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() );
-                    aContinuations[1] = new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() );
-                    xInteractionRequestImpl->setContinuations( aContinuations );
+                ::rtl::Reference< ::ucbhelper::InteractionRequest > xInteractionRequestImpl = new ::ucbhelper::InteractionRequest( uno::makeAny(
+                    document::ChangedByOthersRequest() ) );
+                uno::Sequence< uno::Reference< task::XInteractionContinuation > > aContinuations( 3 );
+                aContinuations[0] = new ::ucbhelper::InteractionAbort( xInteractionRequestImpl.get() );
+                aContinuations[1] = new ::ucbhelper::InteractionApprove( xInteractionRequestImpl.get() );
+                xInteractionRequestImpl->setContinuations( aContinuations );
 
-                    xHandler->handle( xInteractionRequestImpl.get() );
+                xHandler->handle( xInteractionRequestImpl.get() );
 
-                    ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection();
-                    if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() )
-                    {
-                        SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
-                    }
+                ::rtl::Reference< ::ucbhelper::InteractionContinuation > xSelected = xInteractionRequestImpl->getSelection();
+                if ( uno::Reference< task::XInteractionAbort >( xSelected.get(), uno::UNO_QUERY ).is() )
+                {
+                    SetError( ERRCODE_ABORT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
                 }
-                catch ( uno::Exception& )
-                {}
-            } 
-        }
+            }
+            catch ( uno::Exception& )
+            {}
+        } 
     }
 }
 
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 6b07a22..c61060c 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -2064,7 +2064,7 @@ sal_Bool SfxDocTplService_Impl::addTemplate( const OUString& rGroupName,
         Content aResultContent;
         if ( Content::create( aNewTemplateTargetURL, xEnv, aResultContent ) )
         {
-            ::rtl::OUString aPropertyName( RTL_CONSTASCII_USTRINGPARAM( "IsReadonly" ) );
+            ::rtl::OUString aPropertyName( RTL_CONSTASCII_USTRINGPARAM( "IsReadOnly" ) );
             uno::Any aProperty;
             sal_Bool bReadOnly = sal_False;
             if ( getProperty( aResultContent, aPropertyName, aProperty ) && ( aProperty >>= bReadOnly ) && bReadOnly )
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 88b3ab7..3b03a9d 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -84,6 +84,7 @@
 
 #include <comphelper/processfactory.hxx>
 #include <comphelper/componentcontext.hxx>
+#include <comphelper/configurationhelper.hxx>
 
 #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
 #include <com/sun/star/frame/XModel.hpp>
@@ -2251,6 +2252,33 @@ sal_Bool SfxObjectShell::UseInteractionToHandleError(
     return bResult;
 }
 
+sal_Bool SfxObjectShell_Impl::NeedsOfficeUpdateDialog()
+{
+    // if the configuration is not available for any reason, the default behavior is to show the message
+    sal_Bool bResult = sal_True;
+
+    try
+    {
+        uno::Reference< lang::XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+        uno::Reference< uno::XInterface > xCommonConfig(
+                        ::comphelper::ConfigurationHelper::openConfig(
+                            xServiceManager,
+                            ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common" ) ),
+                            ::comphelper::ConfigurationHelper::E_STANDARD ),
+                        uno::UNO_SET_THROW );
+
+        ::comphelper::ConfigurationHelper::readRelativeKey(
+                        xCommonConfig,
+                        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Load/" ) ),
+                        ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ShowOfficeUpdateDialog" ) ) ) >>= bResult;
+    }
+    catch( uno::Exception& )
+    {
+    }
+
+    return bResult;
+}
+
 sal_Int16 SfxObjectShell_Impl::getCurrentMacroExecMode() const
 {
     sal_Int16 nImposedExecMode( MacroExecMode::NEVER_EXECUTE );
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 1590d15..0c240d0 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -828,37 +828,28 @@ sal_Bool SfxObjectShell::DoLoad( SfxMedium *pMed )
             }
         }
 
-        uno::Reference< XInteractionHandler > xHandler( pMedium->GetInteractionHandler() );
-        if ( xHandler.is() && !SFX_APP()->Get_Impl()->bODFVersionWarningLater )
-        {
-            // scan the generator string (within meta.xml)
-            uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
-                GetModel(), uno::UNO_QUERY_THROW);
-            uno::Reference<document::XDocumentProperties> xDocProps
-                = xDPS->getDocumentProperties();
-            if ( xDocProps.is() )
+        if ( pMedium->HasStorage_Impl() )
+        {
+            uno::Reference< XInteractionHandler > xHandler( pMedium->GetInteractionHandler() );
+            if ( xHandler.is() && !SFX_APP()->Get_Impl()->bODFVersionWarningLater )
             {
-                uno::Reference<beans::XPropertySet> xUserDefinedProps(
-                    xDocProps->getUserDefinedProperties(), uno::UNO_QUERY_THROW);
-                uno::Any aAny;
+                uno::Reference<beans::XPropertySet> xStorageProps( pMedium->GetStorage(), uno::UNO_QUERY_THROW );
+                ::rtl::OUString sVersion;
                 try
                 {
-                    aAny = xUserDefinedProps->getPropertyValue(
-                            DEFINE_CONST_UNICODE("ODFVersion"));
+                    xStorageProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Version" ) ) ) >>= sVersion;
                 }
                 catch( const uno::Exception& )
                 {
                     // Custom Property "ODFVersion" does not exist
                 }
 
-                ::rtl::OUString sVersion;
-                if ( (aAny >>= sVersion) && sVersion.getLength() )
+                if ( sVersion.getLength() )
                 {
                     double nVersion = sVersion.toDouble();
-                    if ( nVersion > 1.20001 )
+                    if ( nVersion > 1.20001  && SfxObjectShell_Impl::NeedsOfficeUpdateDialog() )
                         // ODF version greater than 1.2 - added some decimal places to be safe against floating point conversion errors (hack)
                     {
-
                         ::rtl::OUString sDocumentURL( pMedium->GetOrigURL() );
                         ::rtl::OUString aSystemFileURL;
                         if ( osl::FileBase::getSystemPathFromFileURL( sDocumentURL, aSystemFileURL ) == osl::FileBase::E_None )
@@ -2100,6 +2091,7 @@ sal_Bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed )
     }
 
     pMedium->ClearBackup_Impl();
+    pMedium->LockOrigFileOnDemand( sal_True, sal_False );
 
     return bOk;
 }
diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx
index cf8aedb..77d8cae 100644
--- a/sfx2/source/inc/objshimp.hxx
+++ b/sfx2/source/inc/objshimp.hxx
@@ -174,6 +174,8 @@ struct SfxObjectShell_Impl : public ::sfx2::IMacroDocumentAccess
     SfxObjectShell_Impl( SfxObjectShell& _rDocShell );
     virtual ~SfxObjectShell_Impl();
 
+    static sal_Bool NeedsOfficeUpdateDialog();
+    
     // IMacroDocumentAccess overridables
     virtual sal_Int16 getCurrentMacroExecMode() const;
     virtual sal_Bool setCurrentMacroExecMode( sal_uInt16 nMacroMode );
commit 0ae578eaad7c0ffa16a6645debe0da30bf17ced3
Author: Jens-Heiner Rechtien <hr at openoffice.org>
Date:   Thu Jul 30 10:40:37 2009 +0000

    CWS-TOOLING: integrate CWS aw074_DEV300
    2009-07-06 13:21:50 +0200 aw  r273737 : CWS-TOOLING: rebase CWS aw074 to branches/OOO310 at 273700 (milestone: OOO310:m15)
    2009-07-06 11:12:35 +0200 aw  r273728 : #i102637# corrected condition to add gray frame to page visualisation objects
    2009-07-03 14:43:00 +0200 aw  r273702 : #i102380# always swap n GrafObjects on MasterPages synchronously
    2009-07-03 12:14:57 +0200 aw  r273686 : #i102548# corrected SdrPathPrimitive2D's usage of unit polygon
    2009-07-02 16:06:16 +0200 aw  r273662 : #i103255# added control when to show the draft graphic visualisation (in VOC, of course) and when not. Changed text visualisation to BlockText
    2009-07-01 17:36:55 +0200 aw  r273609 : #i103116# clear GaphicLink for interaction clone of graphic objets
    2009-07-01 16:42:09 +0200 aw  r273601 : #i101491# corrected some minor glitches in line geometry creation
    2009-06-30 18:47:44 +0200 aw  r273532 : #i102380# committed the cleanups/additions for the fix
    2009-06-26 13:16:17 +0200 aw  r273404 : #i101491# finetuning changes
    2009-06-26 13:15:57 +0200 aw  r273403 : #i101491# finetuning changes
    2009-06-25 16:31:26 +0200 aw  r273387 : #i101491# first version checkin for linux/mac tests
    2009-06-25 16:31:04 +0200 aw  r273386 : #i101491# first version checkin for linux/mac tests
    2009-06-24 15:35:05 +0200 aw  r273350 : #i101734# corrected VclMetafileProcessor2D::impTryToCreateSvtGraphicStroke to use the current ObjectTransformation
    2009-06-24 15:01:58 +0200 aw  r273348 : #i101811# added ViewInformation2D to renderChartPrimitive2D to allow embedding of object transformation to target MapMode
    2009-06-24 12:27:05 +0200 aw  r273328 : #i101980# use a hairline LineWitdth for SdrObject::TakeContour() calculation (like the old implementation did)
    2009-06-24 11:29:43 +0200 aw  r273321 : #i101781# corrected creation fallback for FullDrag for circle objects
    2009-06-23 17:26:58 +0200 aw  r273300 : #i101556# made primitive text attributes take versioned base text attribute sets into account

diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 74baf37..c75e500 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1010,7 +1010,68 @@ namespace drawinglayer
                     adaptLineToFillDrawMode();
 
                     impStartSvtGraphicStroke(pSvtGraphicStroke);
-                    process(rCandidate.get2DDecomposition(getViewInformation2D()));
+
+                    // #i101491#
+                    // Change default of fat line generation for MetaFiles: Create MetaPolyLineAction
+                    // instead of decomposing all geometries when the polygon has more than given amount of
+                    // points; else the decomposition will get too expensive quiclky. OTOH
+                    // the decomposition provides the better quality e.g. taking edge roundings
+                    // into account which will NOT be taken into account with LineInfo-based actions
+                    const sal_uInt32 nSubPolygonCount(rStrokePrimitive.getB2DPolygon().count());
+                    bool bDone(0 == nSubPolygonCount);
+
+                    if(!bDone && nSubPolygonCount > 1000)
+                    {
+                        // create MetaPolyLineActions, but without LINE_DASH
+                        const attribute::LineAttribute& rLine = rStrokePrimitive.getLineAttribute();
+
+                        if(basegfx::fTools::more(rLine.getWidth(), 0.0))
+                        {
+                            const attribute::StrokeAttribute& rStroke = rStrokePrimitive.getStrokeAttribute();
+                            basegfx::B2DPolyPolygon aHairLinePolyPolygon;
+
+                            if(0.0 == rStroke.getFullDotDashLen())
+                            {
+                                aHairLinePolyPolygon.append(rStrokePrimitive.getB2DPolygon());
+                            }
+                            else
+                            {
+                                basegfx::tools::applyLineDashing(
+                                    rStrokePrimitive.getB2DPolygon(), rStroke.getDotDashArray(), 
+                                    &aHairLinePolyPolygon, 0, rStroke.getFullDotDashLen());
+                            }
+
+                            const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLine.getColor()));
+                            mpOutputDevice->SetLineColor(Color(aHairlineColor));
+                            mpOutputDevice->SetFillColor();
+
+                            aHairLinePolyPolygon.transform(maCurrentTransformation);
+
+                            const LineInfo aLineInfo(LINE_SOLID, basegfx::fround(rLine.getWidth()));
+
+                            for(sal_uInt32 a(0); a < aHairLinePolyPolygon.count(); a++)
+                            {
+                                const basegfx::B2DPolygon aCandidate(aHairLinePolyPolygon.getB2DPolygon(a));
+
+                                if(aCandidate.count() > 1)
+                                {
+                                    const Polygon aToolsPolygon(aCandidate);
+
+                                    mrMetaFile.AddAction(new MetaPolyLineAction(aToolsPolygon, aLineInfo));
+                                }
+                            }
+
+                            bDone = true;
+                        }
+                    }
+
+                    if(!bDone)
+                    {
+                        // use decomposition (creates line geometry as filled polygon
+                        // geometry)
+                        process(rCandidate.get2DDecomposition(getViewInformation2D()));
+                    }
+
                     impEndSvtGraphicStroke(pSvtGraphicStroke);
                     
                     // restore DrawMode
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index 1116eef..62eb3fb 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -1011,6 +1011,8 @@ namespace drawinglayer
 
         void VclProcessor2D::RenderPolygonStrokePrimitive2D(const primitive2d::PolygonStrokePrimitive2D& rPolygonStrokeCandidate)
         {
+            // #i101491# method restructured to clearly use the DrawPolyLine
+            // calls starting from a deined line width
             const attribute::LineAttribute& rLineAttribute = rPolygonStrokeCandidate.getLineAttribute();
             const double fLineWidth(rLineAttribute.getWidth());
             bool bDone(false);
@@ -1019,157 +1021,163 @@ namespace drawinglayer
             {
                 const basegfx::B2DVector aDiscreteUnit(maCurrentTransformation * basegfx::B2DVector(fLineWidth, 0.0));
                 const double fDiscreteLineWidth(aDiscreteUnit.getLength());
-                const bool bAntiAliased(getOptionsDrawinglayer().IsAntiAliasing());
-                const double fAllowedUpperBound(bAntiAliased ? 3.0 : 2.5);
+                const attribute::StrokeAttribute& rStrokeAttribute = rPolygonStrokeCandidate.getStrokeAttribute();
+                const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLineAttribute.getColor()));
+                basegfx::B2DPolyPolygon aHairlinePolyPolygon;
 
-                if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, fAllowedUpperBound))
+                mpOutputDevice->SetLineColor(Color(aHairlineColor));
+                mpOutputDevice->SetFillColor();
+
+                if(0.0 == rStrokeAttribute.getFullDotDashLen())
+                {
+                    // no line dashing, just copy
+                    aHairlinePolyPolygon.append(rPolygonStrokeCandidate.getB2DPolygon());
+                }
+                else
                 {
-                    // force to hairline
-                    const attribute::StrokeAttribute& rStrokeAttribute = rPolygonStrokeCandidate.getStrokeAttribute();
-                    const basegfx::BColor aHairlineColor(maBColorModifierStack.getModifiedColor(rLineAttribute.getColor()));
-                    basegfx::B2DPolyPolygon aHairlinePolyPolygon;
+                    // else apply LineStyle
+                    basegfx::tools::applyLineDashing(rPolygonStrokeCandidate.getB2DPolygon(),
+                        rStrokeAttribute.getDotDashArray(),
+                        &aHairlinePolyPolygon, 0, rStrokeAttribute.getFullDotDashLen());
+                }
 
-                    mpOutputDevice->SetLineColor(Color(aHairlineColor));
-                    mpOutputDevice->SetFillColor();
+                const sal_uInt32 nCount(aHairlinePolyPolygon.count());
 
-                    if(0.0 == rStrokeAttribute.getFullDotDashLen())
-                    {
-                        // no line dashing, just copy
-                        aHairlinePolyPolygon.append(rPolygonStrokeCandidate.getB2DPolygon());
-                    }
-                    else
-                    {
-                        // else apply LineStyle
-                        basegfx::tools::applyLineDashing(rPolygonStrokeCandidate.getB2DPolygon(),
-                            rStrokeAttribute.getDotDashArray(),
-                            &aHairlinePolyPolygon, 0, rStrokeAttribute.getFullDotDashLen());
-                    }
-
-                    const sal_uInt32 nCount(aHairlinePolyPolygon.count());
+                if(nCount)
+                {
+                    const bool bAntiAliased(getOptionsDrawinglayer().IsAntiAliasing());
+                    aHairlinePolyPolygon.transform(maCurrentTransformation);
 
-                    if(nCount)
+                    for(sal_uInt32 a(0); a < nCount; a++)
                     {
-                        aHairlinePolyPolygon.transform(maCurrentTransformation);
+                        basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
 
                         if(bAntiAliased)
                         {
-                            for(sal_uInt32 a(0); a < nCount; a++)
+                            if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.0))
+                            {
+                                // line in range ]0.0 .. 1.0[
+                                // paint as simple hairline
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                                bDone = true;
+                            }
+                            else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.0))
                             {
-                                basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
+                                // line in range [1.0 .. 2.0[
+                                // paint as 2x2 with dynamic line distance
+                                basegfx::B2DHomMatrix aMat;
+                                const double fDistance(fDiscreteLineWidth - 1.0);
+                                const double fHalfDistance(fDistance * 0.5);
+
+                                aMat.set(0, 2, -fHalfDistance);
+                                aMat.set(1, 2, -fHalfDistance);
+                                aCandidate.transform(aMat);
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+
+                                aMat.set(0, 2, fDistance);
+                                aMat.set(1, 2, 0.0);
+                                aCandidate.transform(aMat);
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+
+                                aMat.set(0, 2, 0.0);
+                                aMat.set(1, 2, fDistance);
+                                aCandidate.transform(aMat);
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+
+                                aMat.set(0, 2, -fDistance);
+                                aMat.set(1, 2, 0.0);
+                                aCandidate.transform(aMat);
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                                bDone = true;
+                            }
+                            else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 3.0))
+                            {
+                                // line in range [2.0 .. 3.0]
+                                // paint as cross in a 3x3  with dynamic line distance
+                                basegfx::B2DHomMatrix aMat;
+                                const double fDistance((fDiscreteLineWidth - 1.0) * 0.5);
 
-                                if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.0))
-                                {
-                                    // line in range ]0.0 .. 1.0[
-                                    // paint as simple hairline
-                                    mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-                                }
-                                else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.0))
-                                {
-                                    // line in range [1.0 .. 2.0[
-                                    // paint as 2x2 with dynamic line distance
-                                    basegfx::B2DHomMatrix aMat;
-                                    const double fDistance(fDiscreteLineWidth - 1.0);
-                                    const double fHalfDistance(fDistance * 0.5);
-
-                                    aMat.set(0, 2, -fHalfDistance);
-                                    aMat.set(1, 2, -fHalfDistance);
-                                    aCandidate.transform(aMat);
-                                    mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
-                                    aMat.set(0, 2, fDistance);
-                                    aMat.set(1, 2, 0.0);
-                                    aCandidate.transform(aMat);
-                                    mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
-                                    aMat.set(0, 2, 0.0);
-                                    aMat.set(1, 2, fDistance);
-                                    aCandidate.transform(aMat);
-                                    mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
-                                    aMat.set(0, 2, -fDistance);
-                                    aMat.set(1, 2, 0.0);
-                                    aCandidate.transform(aMat);
-                                    mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-                                }
-                                else
-                                {
-                                    // line in range [2.0 .. 3.0]
-                                    // paint as cross in a 3x3  with dynamic line distance
-                                    basegfx::B2DHomMatrix aMat;
-                                    const double fDistance((fDiscreteLineWidth - 1.0) * 0.5);
-
-                                    mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-                                    
-                                    aMat.set(0, 2, -fDistance);
-                                    aMat.set(1, 2, 0.0);
-                                    aCandidate.transform(aMat);
-                                    mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-                                
-                                    aMat.set(0, 2, fDistance);
-                                    aMat.set(1, 2, -fDistance);
-                                    aCandidate.transform(aMat);
-                                    mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
                                 
-                                    aMat.set(0, 2, fDistance);
-                                    aMat.set(1, 2, fDistance);
-                                    aCandidate.transform(aMat);
-                                    mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-                                
-                                    aMat.set(0, 2, -fDistance);
-                                    aMat.set(1, 2, fDistance);
-                                    aCandidate.transform(aMat);
-                                    mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-                                }
+                                aMat.set(0, 2, -fDistance);
+                                aMat.set(1, 2, 0.0);
+                                aCandidate.transform(aMat);
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                            
+                                aMat.set(0, 2, fDistance);
+                                aMat.set(1, 2, -fDistance);
+                                aCandidate.transform(aMat);
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                            
+                                aMat.set(0, 2, fDistance);
+                                aMat.set(1, 2, fDistance);
+                                aCandidate.transform(aMat);
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                            
+                                aMat.set(0, 2, -fDistance);
+                                aMat.set(1, 2, fDistance);
+                                aCandidate.transform(aMat);
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                                bDone = true;
+                            }
+                            else
+                            {
+                                // #i101491# line width above 3.0
                             }
                         }
                         else
                         {
-                            if(basegfx::fTools::more(fDiscreteLineWidth, 1.5))
+                            if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 1.5))
+                            {
+                                // line width below 1.5, draw the basic hairline polygon
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                                bDone = true;
+                            }
+                            else if(basegfx::fTools::lessOrEqual(fDiscreteLineWidth, 2.5))
                             {
                                 // line width is in range ]1.5 .. 2.5], use four hairlines
                                 // drawn in a square
                                 basegfx::B2DHomMatrix aMat;
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
 
-                                for(sal_uInt32 a(0); a < nCount; a++)
-                                {
-                                    basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
-                                    mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-
-                                    aMat.set(0, 2, 1.0);
-                                    aMat.set(1, 2, 0.0);
-                                    aCandidate.transform(aMat);
+                                aMat.set(0, 2, 1.0);
+                                aMat.set(1, 2, 0.0);
+                                aCandidate.transform(aMat);
 
-                                    mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
 
-                                    aMat.set(0, 2, 0.0);
-                                    aMat.set(1, 2, 1.0);
-                                    aCandidate.transform(aMat);
+                                aMat.set(0, 2, 0.0);
+                                aMat.set(1, 2, 1.0);
+                                aCandidate.transform(aMat);
 
-                                    mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
 
-                                    aMat.set(0, 2, -1.0);
-                                    aMat.set(1, 2, 0.0);
-                                    aCandidate.transform(aMat);
+                                aMat.set(0, 2, -1.0);
+                                aMat.set(1, 2, 0.0);
+                                aCandidate.transform(aMat);
 
-                                    mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-                                }
+                                mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
+                                bDone = true;
                             }
                             else
                             {
-                                for(sal_uInt32 a(0); a < nCount; a++)
-                                {
-                                    // draw the basic hairline polygon
-                                    const basegfx::B2DPolygon aCandidate(aHairlinePolyPolygon.getB2DPolygon(a));
-                                    mpOutputDevice->DrawPolyLine(aCandidate, 0.0);
-                                }
+                                // #i101491# line width is above 2.5
                             }
                         }
-                    }
 
-                    bDone = true;
+                        if(!bDone && rPolygonStrokeCandidate.getB2DPolygon().count() > 1000)
+                        {
+                            // #i101491# If the polygon complexity uses more than a given amount, do
+                            // use OuputDevice::DrawPolyLine directly; this will avoid buffering all
+                            // decompositions in primtives (memory) and fallback to old line painting
+                            // for very complex polygons, too
+                            mpOutputDevice->DrawPolyLine(aCandidate, fDiscreteLineWidth, rLineAttribute.getLineJoin());
+                            bDone = true;
+                        }
+                    }
                 }
             }
-
+            
             if(!bDone)
             {
                 // remeber that we enter a PolygonStrokePrimitive2D decomposition,
diff --git a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
index e3643ad..48d3cb1 100644
--- a/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
+++ b/svx/inc/svx/sdr/attribute/sdrtextattribute.hxx
@@ -65,6 +65,9 @@ namespace drawinglayer
             sal_Int32								maTextRightDistance;
             sal_Int32								maTextLowerDistance;
 
+            // #i101556# use versioning from text attributes to detect changes
+            sal_uInt32                              maPropertiesVersion;
+
             // bitfield
             unsigned								mbContour : 1;
             unsigned								mbFitToSize : 1;
@@ -111,6 +114,7 @@ namespace drawinglayer
             sal_Int32 getTextUpperDistance() const { return maTextUpperDistance; }
             sal_Int32 getTextRightDistance() const { return maTextRightDistance; }
             sal_Int32 getTextLowerDistance() const { return maTextLowerDistance; }
+            sal_uInt32 getPropertiesVersion() const { return maPropertiesVersion; }
 
             // animation timing generation
             void getBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const;
diff --git a/svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx b/svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx
index f977de5..322b55b 100644
--- a/svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx
+++ b/svx/inc/svx/sdr/contact/viewcontactofgraphic.hxx
@@ -38,6 +38,8 @@
 // predeclarations
 
 class SdrGrafObj;
+namespace drawinglayer { namespace attribute { class SdrLineFillShadowTextAttribute; }}
+class GraphicAttr;
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -47,6 +49,16 @@ namespace sdr
     {
         class ViewContactOfGraphic : public ViewContactOfTextObj
         {
+        private:
+            // helpers for constructing various primitive visualisations in various states
+            drawinglayer::primitive2d::Primitive2DSequence createVIP2DSForPresObj(
+                const basegfx::B2DHomMatrix& rObjectMatrix,
+                const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute,
+                const GraphicAttr& rLocalGrafInfo) const;
+            drawinglayer::primitive2d::Primitive2DSequence createVIP2DSForDraft(
+                const basegfx::B2DHomMatrix& rObjectMatrix,
+                const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const;
+
         protected:
             // Create a Object-Specific ViewObjectContact, set ViewContact and
             // ObjectContact. Always needs to return something.
@@ -63,6 +75,13 @@ namespace sdr
             ViewContactOfGraphic(SdrGrafObj& rGrafObj);
             virtual ~ViewContactOfGraphic();
 
+            // #i102380#
+            void flushGraphicObjects();
+
+            // helpers for viusualisation state
+            bool visualisationUsesPresObj() const;
+            bool visualisationUsesDraft() const;
+
         protected:
             // This method is responsible for creating the graphical visualisation data
             // ONLY based on model data
diff --git a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx
index defaa73..199f3c4 100644
--- a/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx
+++ b/svx/inc/svx/sdr/primitive2d/sdrpathprimitive2d.hxx
@@ -49,9 +49,9 @@ namespace drawinglayer
         class SdrPathPrimitive2D : public BasePrimitive2D
         {
         private:
-            ::basegfx::B2DHomMatrix						maTransform;
+            basegfx::B2DHomMatrix						maTransform;
             attribute::SdrLineFillShadowTextAttribute	maSdrLFSTAttribute;
-            ::basegfx::B2DPolyPolygon					maUnitPolyPolygon;
+            basegfx::B2DPolyPolygon						maUnitPolyPolygon;
 
         protected:
             // local decomposition.
@@ -59,14 +59,14 @@ namespace drawinglayer
 
         public:
             SdrPathPrimitive2D(
-                const ::basegfx::B2DHomMatrix& rTransform, 
+                const basegfx::B2DHomMatrix& rTransform, 
                 const attribute::SdrLineFillShadowTextAttribute& rSdrLFSTAttribute,
-                const ::basegfx::B2DPolyPolygon& rUnitPolyPolygon);
+                const basegfx::B2DPolyPolygon& rUnitPolyPolygon);
 
             // data access
-            const ::basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
+            const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
             const attribute::SdrLineFillShadowTextAttribute& getSdrLFSTAttribute() const { return maSdrLFSTAttribute; }
-            const ::basegfx::B2DPolyPolygon& getUnitPolyPolygon() const { return maUnitPolyPolygon; }
+            const basegfx::B2DPolyPolygon& getUnitPolyPolygon() const { return maUnitPolyPolygon; }
 
             // compare operator
             virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
diff --git a/svx/inc/svx/sdr/properties/properties.hxx b/svx/inc/svx/sdr/properties/properties.hxx
index 855b8a2..2b8928e 100644
--- a/svx/inc/svx/sdr/properties/properties.hxx
+++ b/svx/inc/svx/sdr/properties/properties.hxx
@@ -184,6 +184,11 @@ namespace sdr
             // ClearItemAndBroadcast() and SetItemSetAndBroadcast(), see above.
             // But also from inside SdrObjects.
             void BroadcastItemChange(const ItemChangeBroadcaster& rChange);
+            
+            // #i101556# add versioning mechanism; used from e.g. text attribute set to
+            // allow detection of e.g. style sheet or single text attribute changes. The
+            // default implementation returns 0 (zero)
+            virtual sal_uInt32 getVersion() const;
         };
     } // end of namespace properties
 } // end of namespace sdr
diff --git a/svx/inc/svx/sdr/properties/textproperties.hxx b/svx/inc/svx/sdr/properties/textproperties.hxx
index 5dcc8f5..08f2603 100644
--- a/svx/inc/svx/sdr/properties/textproperties.hxx
+++ b/svx/inc/svx/sdr/properties/textproperties.hxx
@@ -42,6 +42,10 @@ namespace sdr
     {
         class SVX_DLLPUBLIC TextProperties : public AttributeProperties
         {
+        private:
+            // #i101556# versioning support
+            sal_uInt32                  maVersion;
+
         protected:
             // create a new itemset
             virtual SfxItemSet& CreateObjectSpecificItemSet(SfxItemPool& rPool);
@@ -82,6 +86,9 @@ namespace sdr
             // Set single item at the local ItemSet. *Does not use* AllowItemChange(),
             // ItemChange(), PostItemChange() and ItemSetChanged() calls.
             void SetObjectItemNoBroadcast(const SfxPoolItem& rItem);
+
+            // #i101556# versioning support
+            virtual sal_uInt32 getVersion() const;
         };
     } // end of namespace properties
 } // end of namespace sdr
diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx
index 667085a..8a81917 100644
--- a/svx/inc/svx/svdograf.hxx
+++ b/svx/inc/svx/svdograf.hxx
@@ -226,6 +226,9 @@ public:
     sal_Bool IsObjectTransparent() const;
     
     ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > getInputStream();
+
+    // #i103116# FullDrag support
+    virtual SdrObject* getFullDragClone() const;
 };
 
 #endif //_SVDOGRAF_HXX
diff --git a/svx/source/outliner/outliner.cxx b/svx/source/outliner/outliner.cxx
index 106f30c..f290864 100644
--- a/svx/source/outliner/outliner.cxx
+++ b/svx/source/outliner/outliner.cxx
@@ -1526,7 +1526,7 @@ void Outliner::ImplCheckParagraphs( USHORT nStart, USHORT nEnd )
         if (pPara)
         {
             pPara->Invalidate();
-            ImplCalcBulletText( static_cast< USHORT >(n), FALSE, FALSE );
+            ImplCalcBulletText( n, FALSE, FALSE );
         }
     }
 }
diff --git a/svx/source/sdr/attribute/sdrtextattribute.cxx b/svx/source/sdr/attribute/sdrtextattribute.cxx
index 93661e2..09f5299 100644
--- a/svx/source/sdr/attribute/sdrtextattribute.cxx
+++ b/svx/source/sdr/attribute/sdrtextattribute.cxx
@@ -37,6 +37,7 @@
 #include <svx/outlobj.hxx>
 #include <svx/editobj.hxx>
 #include <svx/flditem.hxx>
+#include <svx/sdr/properties/properties.hxx>
 
 //////////////////////////////////////////////////////////////////////////////
 // pointer compare define
@@ -69,6 +70,7 @@ namespace drawinglayer
             maTextUpperDistance(aTextUpperDistance),
             maTextRightDistance(aTextRightDistance),
             maTextLowerDistance(aTextLowerDistance),
+            maPropertiesVersion(0),
             mbContour(bContour),
             mbFitToSize(bFitToSize),
             mbHideContour(bHideContour),
@@ -82,6 +84,11 @@ namespace drawinglayer
                 const SfxItemSet& rSet = getSdrText().GetItemSet();
                 mpSdrFormTextAttribute = new SdrFormTextAttribute(rSet);
             }
+
+            // #i101556# init with version number to detect changes of single text
+            // attribute and/or style sheets in primitive data without having to
+            // copy that data locally (which would be better from principle)
+            maPropertiesVersion = rSdrText.GetObject().GetProperties().getVersion();
         }
 
         SdrTextAttribute::~SdrTextAttribute()
@@ -158,6 +165,7 @@ namespace drawinglayer
                 && getTextUpperDistance() == rCandidate.getTextUpperDistance()
                 && getTextRightDistance() == rCandidate.getTextRightDistance()
                 && getTextLowerDistance() == rCandidate.getTextLowerDistance()
+                && getPropertiesVersion() == rCandidate.getPropertiesVersion()
                 && isContour() == rCandidate.isContour()
                 && isFitToSize() == rCandidate.isFitToSize()
                 && isHideContour() == rCandidate.isHideContour()
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index 3f6ac13..40f005d 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -53,6 +53,18 @@
 #include <svdglob.hxx>
 #include <vcl/svapp.hxx>
 
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
+#include <drawinglayer/primitive2d/maskprimitive2d.hxx>
+
+#include <svx/sdr/primitive2d/sdrtextprimitive2d.hxx>
+#include <svx/eeitem.hxx>
+#include <svx/colritem.hxx>
+//#include <svx/xtable.hxx>
+
 //////////////////////////////////////////////////////////////////////////////
 
 namespace sdr
@@ -78,6 +90,238 @@ namespace sdr
         {
         }
 
+        void ViewContactOfGraphic::flushGraphicObjects()
+        {
+            // #i102380# The graphic is swapped out. To let that have an effect ist is necessary to
+            // delete copies of the GraphicObject which are not swapped out and have no SwapHandler set
+            // (this is what happnes when the GraphicObject gets copied to a SdrGrafPrimitive2D). This
+            // is best achieved for the VC by clearing the local decomposition cache. It would be possible
+            // to also do this for the VOC cache, but that VOCs exist exactly expresss that the object
+            // gets visualised, so this would be wrong.
+            flushViewIndependentPrimitive2DSequence();
+        }
+
+        drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createVIP2DSForPresObj(
+            const basegfx::B2DHomMatrix& rObjectMatrix,
+            const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute,
+            const GraphicAttr& rLocalGrafInfo) const
+        {
+            drawinglayer::primitive2d::Primitive2DSequence xRetval;
+            GraphicObject aEmptyGraphicObject;
+            GraphicAttr	aEmptyGraphicAttr;
+            
+            // SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
+            const drawinglayer::primitive2d::Primitive2DReference xReferenceA(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
+                rObjectMatrix, 
+                rAttribute, 
+                aEmptyGraphicObject, 
+                aEmptyGraphicAttr));
+            xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1);
+
+            // SdrGrafPrimitive2D with content (which is the preview graphic) scaled to smaller size and
+            // without attributes
+            basegfx::B2DHomMatrix aSmallerMatrix;
+            
+            // #i94431# for some reason, i forgot to take the PrefMapMode of the graphic
+            // into account. Since EmptyPresObj's are only used in Draw/Impress, it is
+            // safe to assume 100th mm as target.
+            Size aPrefSize(GetGrafObject().GetGrafPrefSize());
+
+            if(MAP_PIXEL == GetGrafObject().GetGrafPrefMapMode().GetMapUnit())
+            {
+                aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MAP_100TH_MM);
+            }
+            else
+            {
+                aPrefSize = Application::GetDefaultDevice()->LogicToLogic(aPrefSize, GetGrafObject().GetGrafPrefMapMode(), MAP_100TH_MM);
+            }
+            
+            // decompose object matrix to get single values
+            basegfx::B2DVector aScale, aTranslate;
+            double fRotate, fShearX;
+            rObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+            
+            const double fOffsetX((aScale.getX() - aPrefSize.getWidth()) / 2.0);
+            const double fOffsetY((aScale.getY() - aPrefSize.getHeight()) / 2.0);
+
+            if(basegfx::fTools::moreOrEqual(fOffsetX, 0.0) && basegfx::fTools::moreOrEqual(fOffsetY, 0.0))
+            {
+                // create the EmptyPresObj fallback visualisation. The fallback graphic
+                // is already provided in rGraphicObject in this case, use it
+                aSmallerMatrix.scale(aPrefSize.getWidth(), aPrefSize.getHeight());
+                aSmallerMatrix.translate(fOffsetX, fOffsetY);
+                aSmallerMatrix.shearX(fShearX);
+                aSmallerMatrix.rotate(fRotate);
+                aSmallerMatrix.translate(aTranslate.getX(), aTranslate.getY());
+
+                const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
+                const drawinglayer::attribute::SdrLineFillShadowTextAttribute aEmptyAttributes(0, 0, 0, 0, 0, 0);
+                const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
+                    aSmallerMatrix, 
+                    aEmptyAttributes, 
+                    rGraphicObject, 
+                    rLocalGrafInfo));
+
+                drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReferenceB);
+            }
+
+            return xRetval;
+        }
+
+        drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createVIP2DSForDraft(
+            const basegfx::B2DHomMatrix& rObjectMatrix,
+            const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const
+        {
+            drawinglayer::primitive2d::Primitive2DSequence xRetval;
+            GraphicObject aEmptyGraphicObject;
+            GraphicAttr	aEmptyGraphicAttr;
+            
+            // SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
+            const drawinglayer::primitive2d::Primitive2DReference xReferenceA(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
+                rObjectMatrix, 
+                rAttribute, 
+                aEmptyGraphicObject, 
+                aEmptyGraphicAttr));
+            xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1);
+
+            if(!rAttribute.getLine())
+            {
+                // create a surrounding frame when no linestyle given
+                const Color aColor(Application::GetSettings().GetStyleSettings().GetShadowColor());
+                const basegfx::BColor aBColor(aColor.getBColor());
+                const basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0);
+
+                basegfx::B2DPolygon aOutline(basegfx::tools::createPolygonFromRect(aUnitRange));
+                aOutline.transform(rObjectMatrix);
+
+                drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
+                    drawinglayer::primitive2d::Primitive2DReference(
+                        new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
+                            aOutline,
+                            aBColor)));
+            }
+
+            // decompose object matrix to get single values
+            basegfx::B2DVector aScale, aTranslate;
+            double fRotate, fShearX;
+            rObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
+
+            // define a distance value, used for distance from bitmap to borders and from bitmap
+            // to text, too (2 mm)
+            const double fDistance(200.0);
+
+            // consume borders from values
+            aScale.setX(std::max(0.0, aScale.getX() - (2.0 * fDistance)));
+            aScale.setY(std::max(0.0, aScale.getY() - (2.0 * fDistance)));
+            aTranslate.setX(aTranslate.getX() + fDistance);
+            aTranslate.setY(aTranslate.getY() + fDistance);
+
+            // draw a draft bitmap
+            const Bitmap aDraftBitmap(ResId(BMAP_GrafikEi, *ImpGetResMgr()));
+
+            if(!aDraftBitmap.IsEmpty())
+            {
+                Size aPrefSize(aDraftBitmap.GetPrefSize());
+
+                if(MAP_PIXEL == aDraftBitmap.GetPrefMapMode().GetMapUnit())
+                {
+                    aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aDraftBitmap.GetSizePixel(), MAP_100TH_MM);
+                }
+                else
+                {
+                    aPrefSize = Application::GetDefaultDevice()->LogicToLogic(aPrefSize, aDraftBitmap.GetPrefMapMode(), MAP_100TH_MM);
+                }
+                
+                const double fBitmapScaling(2.0);
+                const double fWidth(aPrefSize.getWidth() * fBitmapScaling);
+                const double fHeight(aPrefSize.getHeight() * fBitmapScaling);
+                
+                if(basegfx::fTools::more(fWidth, 1.0) 
+                    && basegfx::fTools::more(fHeight, 1.0)
+                    && basegfx::fTools::lessOrEqual(fWidth, aScale.getX())
+                    && basegfx::fTools::lessOrEqual(fHeight, aScale.getY()))
+                {
+                    basegfx::B2DHomMatrix aBitmapMatrix;
+
+                    aBitmapMatrix.scale(fWidth, fHeight);
+                    aBitmapMatrix.shearX(fShearX);
+                    aBitmapMatrix.rotate(fRotate);
+                    aBitmapMatrix.translate(aTranslate.getX(), aTranslate.getY());
+                    
+                    drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
+                        drawinglayer::primitive2d::Primitive2DReference(
+                            new drawinglayer::primitive2d::BitmapPrimitive2D(
+                                BitmapEx(aDraftBitmap),
+                                aBitmapMatrix)));
+
+                    // consume bitmap size in X
+                    aScale.setX(std::max(0.0, aScale.getX() - (fWidth + fDistance)));
+                    aTranslate.setX(aTranslate.getX() + fWidth + fDistance);
+                }
+            }
+
+            // Build the text for the draft object
+            XubString aDraftText = GetGrafObject().GetFileName();
+            
+            if(!aDraftText.Len())
+            {
+                aDraftText = GetGrafObject().GetName();
+                aDraftText.AppendAscii(" ...");
+            }
+            
+            if(aDraftText.Len() && GetGrafObject().GetModel())
+            {
+                // #i103255# Goal is to produce TextPrimitives which hold the given text as
+                // BlockText in the available space. It would be very tricky to do
+                // an own word wrap/line layout here.
+                // Using SdrBlockTextPrimitive2D OTOH is critical since it internally
+                // uses the SdrObject it references. To solve this, create a temp
+                // SdrObject with Attributes and Text, generate a SdrBlockTextPrimitive2D
+                // directly and immediately decompose it. After that, it is no longer
+                // needed and can be deleted.
+
+                // create temp RectObj as TextObj and set needed attributes
+                SdrRectObj aRectObj(OBJ_TEXT);
+                aRectObj.SetModel(GetGrafObject().GetModel());
+                aRectObj.NbcSetText(aDraftText);
+                aRectObj.SetMergedItem(SvxColorItem(Color(COL_LIGHTRED), EE_CHAR_COLOR));
+
+                // get SdrText and OPO
+                SdrText* pSdrText = aRectObj.getText(0);
+                OutlinerParaObject* pOPO = aRectObj.GetOutlinerParaObject();
+
+                if(pSdrText && pOPO)
+                {
+                    // directly use the remaining space as TextRangeTransform
+                    basegfx::B2DHomMatrix aTextRangeTransform;
+                    
+                    aTextRangeTransform.scale(aScale.getX(), aScale.getY());
+                    aTextRangeTransform.shearX(fShearX);
+                    aTextRangeTransform.rotate(fRotate);
+                    aTextRangeTransform.translate(aTranslate.getX(), aTranslate.getY());
+
+                    // directly create temp SdrBlockTextPrimitive2D
+                    drawinglayer::primitive2d::SdrBlockTextPrimitive2D aBlockTextPrimitive(
+                        *pSdrText,
+                        *pOPO,
+                        aTextRangeTransform,
+                        false,
+                        false,
+                        false);
+
+                    // decompose immediately with neutral ViewInformation. This will
+                    // layout the text to more simple TextPrimitives from drawinglayer
+                    const drawinglayer::geometry::ViewInformation2D aViewInformation2D(0);
+
+                    drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(
+                        xRetval, 
+                        aBlockTextPrimitive.get2DDecomposition(aViewInformation2D));
+                }
+            }
+
+            return xRetval;
+        }
+
         drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createViewIndependentPrimitive2DSequence() const
         {
             drawinglayer::primitive2d::Primitive2DSequence xRetval;
@@ -86,7 +330,8 @@ namespace sdr
             if(pSdrText)
             {
                 const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet();
-                drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText);
+                drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = 
+                    drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText);
                 bool bVisible(pAttribute && pAttribute->isVisible());
 
                 // create and fill GraphicAttr
@@ -131,7 +376,7 @@ namespace sdr
                         // which will use the primitive data we just create in the near future
                         const Rectangle& rRectangle = GetGrafObject().GetGeoRect();
                         const ::basegfx::B2DRange aObjectRange(rRectangle.Left(), rRectangle.Top(), rRectangle.Right(), rRectangle.Bottom());
-                        ::basegfx::B2DHomMatrix aObjectMatrix;
+                        basegfx::B2DHomMatrix aObjectMatrix;
 
                         // look for mirroring
                         const GeoStat& rGeoStat(GetGrafObject().GetGeoStat());
@@ -170,60 +415,25 @@ namespace sdr
                         // get the current, unchenged graphic obect from SdrGrafObj
                         const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
 
-                        if(GetGrafObject().IsEmptyPresObj())
+                        if(visualisationUsesPresObj())
                         {
                             // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one
                             // with the content which is the placeholder graphic
-                            GraphicObject aEmptyGraphicObject;
-                            GraphicAttr	aEmptyGraphicAttr;
-                            drawinglayer::attribute::SdrLineFillShadowTextAttribute aEmptyAttributes(0, 0, 0, 0, 0, 0);
-                            
-                            // SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
-                            const drawinglayer::primitive2d::Primitive2DReference xReferenceA(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
-                                aObjectMatrix, *pAttribute, aEmptyGraphicObject, aEmptyGraphicAttr));
-                            xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1);
-
-                            // SdrGrafPrimitive2D with content (which is the preview graphic) scaled to smaller size and
-                            // without attributes
-                            basegfx::B2DHomMatrix aSmallerMatrix;
-                            
-                            // #i94431# for some reason, i forgot to take the PrefMapMode of the graphic
-                            // into account. Since EmptyPresObj's are only used in Draw/Impress, it is
-                            // safe to assume 100th mm as target.
-                            Size aPrefSize(GetGrafObject().GetGrafPrefSize());
-
-                            if(MAP_PIXEL == GetGrafObject().GetGrafPrefMapMode().GetMapUnit())
-                            {
-                                aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MAP_100TH_MM);
-                            }
-                            else
-                            {
-                                aPrefSize = Application::GetDefaultDevice()->LogicToLogic(aPrefSize, GetGrafObject().GetGrafPrefMapMode(), MAP_100TH_MM);
-                            }
-                            
-                            const double fOffsetX((aObjectRange.getWidth() - aPrefSize.getWidth()) / 2.0);
-                            const double fOffsetY((aObjectRange.getHeight() - aPrefSize.getHeight()) / 2.0);
-
-                            if(basegfx::fTools::moreOrEqual(fOffsetX, 0.0) && basegfx::fTools::moreOrEqual(fOffsetY, 0.0))
-                            {
-                                aSmallerMatrix.scale(aPrefSize.getWidth(), aPrefSize.getHeight());
-                                aSmallerMatrix.translate(fOffsetX, fOffsetY);
-                                aSmallerMatrix.shearX(fShearX);
-                                aSmallerMatrix.rotate(fRotate);
-                                aSmallerMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY());
-                             
-                                const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
-                                    aSmallerMatrix, 
-                                    aEmptyAttributes, 
-                                    rGraphicObject, 
-                                    aLocalGrafInfo));
-
-                                drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReferenceB);
-                            }
+                            xRetval = createVIP2DSForPresObj(aObjectMatrix, *pAttribute, aLocalGrafInfo);
+                        }
+                        else if(visualisationUsesDraft())
+                        {
+                            // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism
+                            // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious
+                            // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent
+                            // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster
+                            // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages
+                            xRetval = createVIP2DSForDraft(aObjectMatrix, *pAttribute);
                         }
                         else
                         {
-                            // create primitive
+                            // create primitive. Info: Calling the copy-constructor of GraphicObject in this
+                            // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic
                             const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
                                 aObjectMatrix, 
                                 *pAttribute, 
@@ -241,6 +451,31 @@ namespace sdr
             return xRetval;
         }
 
+        bool ViewContactOfGraphic::visualisationUsesPresObj() const
+        {
+            return GetGrafObject().IsEmptyPresObj();
+        }
+
+        bool ViewContactOfGraphic::visualisationUsesDraft() const
+        {
+            // no draft when already PresObj
+            if(visualisationUsesPresObj())
+                return false;
+
+            // draft when swapped out
+            const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
+            static bool bAllowReplacements(true);
+
+            if(rGraphicObject.IsSwappedOut() && bAllowReplacements)
+                return true;
+
+            // draft when no graphic
+            if(GRAPHIC_NONE == rGraphicObject.GetType() || GRAPHIC_DEFAULT == rGraphicObject.GetType())
+               return true;
+
+            return false;
+        }
+
     } // end of namespace contact
 } // end of namespace sdr
 
diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
index da467f8..1cb99de 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
@@ -62,59 +62,86 @@ namespace sdr
 
             if(pSdrText)
             {
-                drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(rItemSet, *pSdrText);
+                drawinglayer::attribute::SdrLineFillShadowTextAttribute* pAttribute = 
+                    drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
+                        rItemSet, 
+                        *pSdrText);
 
                 if(pAttribute)
                 {
                     if(pAttribute->isVisible())
                     {
-                        // prepare object transformation and unit polygon (direct model data)
-                        ::basegfx::B2DHomMatrix aObjectMatrix;
-                        ::basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly());
-                        const bool bIsLine(
-                            !aUnitPolyPolygon.areControlPointsUsed()
-                            && 1L == aUnitPolyPolygon.count() 
-                            && 2L == aUnitPolyPolygon.getB2DPolygon(0L).count());
-
-                        if(bIsLine)
-                        {
-                            // special handling for single line mode (2 points)
-                            const ::basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0L));
-                            const ::basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0L));
-                            const ::basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1L));
-                            const ::basegfx::B2DVector aLine(aEnd - aStart);
-
-                            // create new polygon
-                            ::basegfx::B2DPolygon aNewPolygon;
-                            aNewPolygon.append(::basegfx::B2DPoint(0.0, 0.0));
-                            aNewPolygon.append(::basegfx::B2DPoint(aLine.getLength(), 0.0));
-                            aUnitPolyPolygon.setB2DPolygon(0L, aNewPolygon);
-
-                            // fill objectMatrix with rotation and offset (no shear for lines, scale in polygon)
-                            aObjectMatrix.rotate(atan2(aLine.getY(), aLine.getX()));
-                            aObjectMatrix.translate(aStart.getX(), aStart.getY());
-                        }
-                        else
+                        basegfx::B2DPolyPolygon aUnitPolyPolygon(GetPathObj().GetPathPoly());
+                        const sal_uInt32 nPolyCount(aUnitPolyPolygon.count());
+
+                        if(nPolyCount)
                         {
-                            // create scaled, but unsheared, unrotated and untranslated polygon
-                            // by creating the object matrix and back-transforming the polygon
-                            const ::basegfx::B2DRange aObjectRange(::basegfx::tools::getRange(aUnitPolyPolygon));
-                            const GeoStat& rGeoStat(GetPathObj().GetGeoStat());
-
-                            aObjectMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000));
-                            aObjectMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000);
-                            aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY());
-
-                            // ceate scaled unit polygon from object's absolute path
-                            ::basegfx::B2DHomMatrix aInverse(aObjectMatrix);
-                            aInverse.invert();
-                            aUnitPolyPolygon.transform(aInverse);
+                            // prepare object transformation and unit polygon (direct model data)
+                            basegfx::B2DHomMatrix aObjectMatrix;
+                            const bool bIsLine(
+                                !aUnitPolyPolygon.areControlPointsUsed()
+                                && 1 == nPolyCount 
+                                && 2 == aUnitPolyPolygon.getB2DPolygon(0).count());
+
+                            if(bIsLine)
+                            {
+                                // special handling for single line mode (2 points)
+                                const basegfx::B2DPolygon aSubPolygon(aUnitPolyPolygon.getB2DPolygon(0));
+                                const basegfx::B2DPoint aStart(aSubPolygon.getB2DPoint(0));
+                                const basegfx::B2DPoint aEnd(aSubPolygon.getB2DPoint(1));
+                                const basegfx::B2DVector aLine(aEnd - aStart);
+
+                                // #i102548# create new unit polygon for line (horizontal)
+                                basegfx::B2DPolygon aNewPolygon;
+                                aNewPolygon.append(basegfx::B2DPoint(0.0, 0.0));
+                                aNewPolygon.append(basegfx::B2DPoint(1.0, 0.0));
+                                aUnitPolyPolygon.setB2DPolygon(0, aNewPolygon);
+
+                                // #i102548# fill objectMatrix with rotation and offset (no shear for lines)
+                                aObjectMatrix.scale(aLine.getLength(), 1.0);
+                                aObjectMatrix.rotate(atan2(aLine.getY(), aLine.getX()));
+                                aObjectMatrix.translate(aStart.getX(), aStart.getY());
+                            }
+                            else
+                            {
+                                // #i102548# create unscaled, unsheared, unrotated and untranslated polygon
+                                // (unit polygon) by creating the object matrix and back-transforming the polygon
+                                const basegfx::B2DRange aObjectRange(basegfx::tools::getRange(aUnitPolyPolygon));
+                                const GeoStat& rGeoStat(GetPathObj().GetGeoStat());
+                                const double fWidth(aObjectRange.getWidth());
+                                const double fHeight(aObjectRange.getHeight());
+
+                                aObjectMatrix.scale(
+                                    basegfx::fTools::equalZero(fWidth) ? 1.0 : fWidth,
+                                    basegfx::fTools::equalZero(fHeight) ? 1.0 : fHeight);
+
+                                if(rGeoStat.nShearWink)
+                                {
+                                    aObjectMatrix.shearX(tan((36000 - rGeoStat.nShearWink) * F_PI18000));
+                                }
+
+                                if(rGeoStat.nDrehWink)
+                                {
+                                    aObjectMatrix.rotate((36000 - rGeoStat.nDrehWink) * F_PI18000);
+                                }
+
+                                aObjectMatrix.translate(aObjectRange.getMinX(), aObjectRange.getMinY());
+
+                                // ceate unit polygon from object's absolute path
+                                basegfx::B2DHomMatrix aInverse(aObjectMatrix);
+                                aInverse.invert();
+                                aUnitPolyPolygon.transform(aInverse);
+                            }
+
+                            // create primitive
+                            const drawinglayer::primitive2d::Primitive2DReference xReference(
+                                new drawinglayer::primitive2d::SdrPathPrimitive2D(
+                                    aObjectMatrix, 
+                                    *pAttribute, 
+                                    aUnitPolyPolygon));
+
+                            xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
                         }
-
-                        // create primitive
-                        const drawinglayer::primitive2d::Primitive2DReference xReference(
-                            new drawinglayer::primitive2d::SdrPathPrimitive2D(aObjectMatrix, *pAttribute, aUnitPolyPolygon));
-                        xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
                     }
 
                     delete pAttribute;
diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
index 7a6e115..4b3f2b6 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
@@ -38,6 +38,7 @@
 #include <svx/svdograf.hxx>
 #include <svx/sdr/contact/objectcontact.hxx>
 #include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
 
 //////////////////////////////////////////////////////////////////////////////
 
@@ -245,10 +246,19 @@ namespace sdr
         {
             // prepare primitive generation with evtl. loading the graphic when it's swapped out
             SdrGrafObj& rGrafObj = const_cast< ViewObjectContactOfGraphic* >(this)->getSdrGrafObj();
-            const bool bDoAsynchronGraphicLoading(rGrafObj.GetModel() && rGrafObj.GetModel()->IsSwapGraphics());
+            bool bDoAsynchronGraphicLoading(rGrafObj.GetModel() && rGrafObj.GetModel()->IsSwapGraphics());
             static bool bSuppressAsynchLoading(false);
             bool bSwapInDone(false);
 
+            if(bDoAsynchronGraphicLoading 
+                && rGrafObj.IsSwappedOut() 
+                && rGrafObj.GetPage() 
+                && rGrafObj.GetPage()->IsMasterPage())
+            {
+                // #i102380# force Swap-In for GraphicObjects on MasterPage to have a nicer visualisation
+                bDoAsynchronGraphicLoading = false;
+            }
+
             if(bDoAsynchronGraphicLoading && !bSuppressAsynchLoading)
             {
                 bSwapInDone = const_cast< ViewObjectContactOfGraphic* >(this)->impPrepareGraphicWithAsynchroniousLoading();
@@ -261,6 +271,23 @@ namespace sdr
             // get return value by calling parent
             drawinglayer::primitive2d::Primitive2DSequence xRetval = ViewObjectContactOfSdrObj::createPrimitive2DSequence(rDisplayInfo);
 
+            if(xRetval.hasElements())
+            {
+                // #i103255# suppress when graphic needs draft visualisation and output
+                // is for PDF export/Printer
+                const ViewContactOfGraphic& rVCOfGraphic = static_cast< const ViewContactOfGraphic& >(GetViewContact());
+
+                if(rVCOfGraphic.visualisationUsesDraft())
+                {
+                    const ObjectContact& rObjectContact = GetObjectContact();
+
+                    if(rObjectContact.isOutputToPDFFile() || rObjectContact.isOutputToPrinter())
+                    {
+                        xRetval = drawinglayer::primitive2d::Primitive2DSequence();
+                    }
+                }
+            }
+
             // if swap in was forced only for printing, swap out again
             const bool bSwapInExclusiveForPrinting(bSwapInDone && GetObjectContact().isOutputToPrinter());
 
diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
index f69f4d5..87ba0b8 100644
--- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx
@@ -291,7 +291,8 @@ namespace sdr
             }
 
             // add a gray outline frame, except not when printing
-            if(!GetObjectContact().isOutputToPrinter())
+            // #i102637# add frame also when printing and page exists (handout pages)
+            if(!GetObjectContact().isOutputToPrinter() || pPage)
             {
                 const Color aFrameColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES).nColor);
                 basegfx::B2DPolygon aOwnOutline(basegfx::tools::createPolygonFromRect(basegfx::B2DRange(0.0, 0.0, 1.0, 1.0)));
diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx
index 0d6cb3b..fe317a4 100644
--- a/svx/source/sdr/properties/properties.cxx
+++ b/svx/source/sdr/properties/properties.cxx
@@ -180,6 +180,11 @@ namespace sdr
                 GetSdrObject().SendUserCall(SDRUSERCALL_CHGATTR, rChange.GetRectangle(a));
             }
         }
+
+        sal_uInt32 BaseProperties::getVersion() const
+        {
+            return 0;
+        }
     } // end of namespace properties
 } // end of namespace sdr
 
diff --git a/svx/source/sdr/properties/textproperties.cxx b/svx/source/sdr/properties/textproperties.cxx
index 139d2fb..229ba89 100644
--- a/svx/source/sdr/properties/textproperties.cxx
+++ b/svx/source/sdr/properties/textproperties.cxx
@@ -72,12 +72,14 @@ namespace sdr
         }
 
         TextProperties::TextProperties(SdrObject& rObj)
-        :	AttributeProperties(rObj)
+        :	AttributeProperties(rObj),
+            maVersion(0)
         {
         }
 
         TextProperties::TextProperties(const TextProperties& rProps, SdrObject& rObj)
-        :	AttributeProperties(rProps, rObj)
+        :	AttributeProperties(rProps, rObj),
+            maVersion(rProps.getVersion())
         {
         }
 
@@ -93,10 +95,11 @@ namespace sdr
         void TextProperties::ItemSetChanged(const SfxItemSet& rSet)
         {
             SdrTextObj& rObj = (SdrTextObj&)GetSdrObject();
-
-
             sal_Int32 nText = rObj.getTextCount();
 
+            // #i101556# ItemSet has changed -> new version
+            maVersion++;
+
             while( --nText >= 0 )
             {
                 SdrText* pText = rObj.getText( nText );
@@ -237,6 +240,9 @@ namespace sdr
             // call parent
             AttributeProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr);
 
+            // #i101556# StyleSheet has changed -> new version
+            maVersion++;
+
             if( rObj.GetModel() /*&& !rObj.IsTextEditActive()*/ && !rObj.IsLinkedText() )
             {
                 SdrOutliner& rOutliner = rObj.ImpGetDrawOutliner();
@@ -577,6 +583,9 @@ namespace sdr
                             rObj.ActionChanged();
                             //rObj.BroadcastObjectChange();
                         }
+
+                        // #i101556# content of StyleSheet has changed -> new version
+                        maVersion++;
                     }
 
                     if(SFX_HINT_DYING == nId)
@@ -616,6 +625,12 @@ namespace sdr
                 }
             }
         }
+        
+        // #i101556# Handout version information
+        sal_uInt32 TextProperties::getVersion() const
+        {
+            return maVersion;
+        }
     } // end of namespace properties
 } // end of namespace sdr
 
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx
index cc8f620..54cb04d 100644
--- a/svx/source/svdraw/svdcrtv.cxx
+++ b/svx/source/svdraw/svdcrtv.cxx
@@ -824,13 +824,15 @@ void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, BOOL bFull*/)
                 }
             }
 
-            // #i68562# Force to non-solid dragging when not creating a full circle and up to step three
-            if(bUseSolidDragging 
-                && pAktCreate->ISA(SdrCircObj) 
-                && OBJ_CIRC != (SdrObjKind)(static_cast< SdrCircObj* >(pAktCreate)->GetObjIdentifier())
-                && aDragStat.GetPointAnz() < 4L)
+              // #i101781# force to non-solid dragging when not creating a full circle
+            if(bUseSolidDragging)
             {
-                bUseSolidDragging = false;
+                SdrCircObj* pCircObj = dynamic_cast< SdrCircObj* >(pAktCreate);
+
+                if(pCircObj && OBJ_CIRC != pCircObj->GetObjIdentifier())
+                {
+                    bUseSolidDragging = false;
+                }
             }
 
             if(bUseSolidDragging)
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 507b86f..d11b317 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -1165,6 +1165,11 @@ basegfx::B2DPolyPolygon SdrObject::TakeContour() const
 
         SfxItemSet aNewSet(*GetObjectItemPool());
 
+        // #i101980# ignore LineWidth; that's what the old implementation
+        // did. With linewidth, the result may be huge due to fat/thick
+        // line decompositions
+        aNewSet.Put(XLineWidthItem(0));
+
         // solid black lines and no fill
         aNewSet.Put(XLineStyleItem(XLINE_SOLID));
         aNewSet.Put(XLineColorItem(String(), Color(COL_BLACK)));
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 3898f25..67d02ac 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -659,6 +659,23 @@ void SdrGrafObj::TakeObjNamePlural( XubString& rName ) const
 
 // -----------------------------------------------------------------------------
 
+SdrObject* SdrGrafObj::getFullDragClone() const
+{
+    // call parent
+    SdrGrafObj* pRetval = static_cast< SdrGrafObj* >(SdrRectObj::getFullDragClone());
+
+    // #i103116# the full drag clone leads to problems
+    // with linked graphics, so reset the link in this
+    // temporary interaction object and load graphic
+    if(pRetval && IsLinkedGraphic())
+    {
+        pRetval->ForceSwapIn();
+        pRetval->ReleaseGraphicLink();
+    }
+
+    return pRetval;
+}
+
 void SdrGrafObj::operator=( const SdrObject& rObj )
 {
     SdrRectObj::operator=( rObj );
@@ -1090,6 +1107,14 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO )
                     pRet = GRFMGR_AUTOSWAPSTREAM_TEMP;
                     pGraphic->SetUserData();
                 }
+
+                // #i102380#
+                sdr::contact::ViewContactOfGraphic* pVC = dynamic_cast< sdr::contact::ViewContactOfGraphic* >(&GetViewContact());
+
+                if(pVC)
+                {
+                    pVC->flushGraphicObjects();
+                }
             }
         }
     }
commit 2882ddb948aa65f88031bba5905652862168723c
Author: Jens-Heiner Rechtien <hr at openoffice.org>
Date:   Thu Jul 30 10:30:12 2009 +0000

    CWS-TOOLING: integrate CWS filepicker02
    2009-07-24 16:20:33 +0200 cd  r274312 : #i95152# Use trimTrailingBlanks() correctly
    2009-07-21 14:41:50 +0200 cd  r274197 : #i103566# Makes fixes for MinGW port
    2009-07-20 10:45:57 +0200 cd  r274112 : #i95152# Return empty string when there are only blanks
    2009-07-17 14:53:51 +0200 cd  r274093 : #i95152# Old Windows file picker implementation now trims trailing blanks like the new Vista file picker
    2009-07-17 09:45:38 +0200 cd  r274080 : #i99759# Apply stability fixes from CWS filepicker01 to help QA
    2009-07-17 09:00:26 +0200 cd  r274078 : #i95336# Extend SfxApplication to reset last used directory
    2009-07-17 08:59:10 +0200 cd  r274077 : #i99759# Apply fix from filepicker01 to filepicker02 to help QA
    2009-07-17 08:58:45 +0200 cd  r274076 : #i99759# Apply fix from filepicker01 to filepicker02 to help QA
    2009-07-16 16:08:17 +0200 cd  r274059 : #103566# Use AddPlace as a fallback for directories which are not change the current folder
    2009-07-16 11:54:26 +0200 cd  r274038 : #i103566# Use provided folder and filename to decide to set the folder in the file dialog
    2009-07-15 17:19:47 +0200 cd  r274016 : #i95336# Set flag to true to force the file picker to use the default working path.
    2009-07-14 14:49:48 +0200 cd  r273977 : #i103346# Set work path flag to indicate file picker to use work path once
    2009-07-14 14:47:49 +0200 cd  r273976 : #i95336# New configuration entry for work path changes via Tools-Options
    2009-07-14 14:46:19 +0200 cd  r273975 : #i95336# Force file picker to use a changed work path once
    2009-07-14 10:19:54 +0200 cd  r273961 : #i103346# Add new advice for file picker usage. Especially for Windows Vista and higher.
    2009-07-09 10:32:08 +0200 cd  r273852 : #i97053# Use SetFolder()/AddPlace() for Open dialog, too.
    2009-07-06 14:59:06 +0200 cd  r273746 : #i103346# Destroy dialog instance within close handler to prevent problems with custom controls under Windows
    2009-07-03 15:25:48 +0200 cd  r273707 : #i94054# Add resource access to read localized labels for custom controls. Use SetControlLabel to set the localized label

diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
index fe6ebbf..a80604c 100644
--- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
@@ -51,6 +51,7 @@
 #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
 
 #include <cppuhelper/interfacecontainer.h>
+#include <comphelper/configurationhelper.hxx>
 #include <osl/diagnose.h>
 #include <osl/mutex.hxx>
 #include <osl/file.hxx>
@@ -294,9 +295,24 @@ void SAL_CALL VistaFilePicker::setDisplayDirectory(const ::rtl::OUString& sDirec
     throw (css::lang::IllegalArgumentException,
            css::uno::RuntimeException         )
 {
+    const ::rtl::OUString aPackage( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/"));
+    const ::rtl::OUString aRelPath( RTL_CONSTASCII_USTRINGPARAM("Path/Info"));
+    const ::rtl::OUString aKey( RTL_CONSTASCII_USTRINGPARAM("WorkPathChanged"));
+
+    css::uno::Any aValue = ::comphelper::ConfigurationHelper::readDirectKey(
+        m_xSMGR, aPackage, aRelPath, aKey, ::comphelper::ConfigurationHelper::E_READONLY);
+    
+    bool bChanged(false);
+    if (( aValue >>= bChanged ) && bChanged )
+    {
+        ::comphelper::ConfigurationHelper::writeDirectKey(
+            m_xSMGR, aPackage, aRelPath, aKey, css::uno::makeAny(false), ::comphelper::ConfigurationHelper::E_STANDARD);
+    }
+
     RequestRef rRequest(new Request());
     rRequest->setRequest (VistaFilePickerImpl::E_SET_DIRECTORY);
     rRequest->setArgument(PROP_DIRECTORY, sDirectory);
+    rRequest->setArgument(PROP_FORCE, bChanged);
 
     m_aAsyncExecute.triggerRequestThreadAware(rRequest, AsyncRequests::NON_BLOCKED);
 }
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
index 70c906a..0be04ec 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
@@ -40,6 +40,7 @@
 #include <comphelper/sequenceasvector.hxx>
 #include <osl/file.hxx>
 #include <osl/mutex.hxx>
+#include "..\misc\WinImplHelper.hxx"
 
  inline bool is_current_process_window(HWND hwnd)
 {
@@ -461,6 +462,14 @@ static const ::sal_Int32 GROUP_IMAGETEMPLATE   =   3;
 static const ::sal_Int32 GROUP_CHECKBOXES      =   4;
 
 //-------------------------------------------------------------------------------
+static void setLabelToControl(CResourceProvider& rResourceProvider, TFileDialogCustomize iCustom, sal_uInt16 nControlId)
+{
+    ::rtl::OUString aLabel = rResourceProvider.getResString(nControlId);
+    aLabel = SOfficeToWindowsLabel(aLabel);
+    iCustom->SetControlLabel(nControlId, reinterpret_cast<LPCWSTR>(aLabel.getStr()) );
+}
+
+//-------------------------------------------------------------------------------
 void VistaFilePickerImpl::impl_sta_enableFeatures(::sal_Int32 nFeatures, ::sal_Int32 nTemplate)
 {
     GUID aGUID = {};
@@ -535,23 +544,48 @@ void VistaFilePickerImpl::impl_sta_enableFeatures(::sal_Int32 nFeatures, ::sal_I
 
     iCustom->StartVisualGroup (GROUP_CHECKBOXES, L"");
 
+    sal_uInt16 nControlId(0);
     if ((nFeatures & FEATURE_AUTOEXTENSION) == FEATURE_AUTOEXTENSION)
-        iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, L"Auto Extension", true);
+    {
+        nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION;
+        iCustom->AddCheckButton (nControlId, L"Auto Extension", true);
+        setLabelToControl(m_ResProvider, iCustom, nControlId);
+    }
     
     if ((nFeatures & FEATURE_PASSWORD) == FEATURE_PASSWORD)
-        iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, L"Password", false);
+    {
+        nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_PASSWORD;
+        iCustom->AddCheckButton (nControlId, L"Password", false);
+        setLabelToControl(m_ResProvider, iCustom, nControlId);
+    }
     
     if ((nFeatures & FEATURE_READONLY) == FEATURE_READONLY)
-        iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_READONLY, L"Readonly", false);
+    {
+        nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_READONLY;
+        iCustom->AddCheckButton (nControlId, L"Readonly", false);
+        setLabelToControl(m_ResProvider, iCustom, nControlId);
+    }
     
     if ((nFeatures & FEATURE_FILTEROPTIONS) == FEATURE_FILTEROPTIONS)
-        iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS, L"Filter Options", false);
+    {
+        nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS;
+        iCustom->AddCheckButton (nControlId, L"Filter Options", false);
+        setLabelToControl(m_ResProvider, iCustom, nControlId);
+    }
     
     if ((nFeatures & FEATURE_LINK) == FEATURE_LINK)
-        iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, L"Link", false);
+    {
+        nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK;
+        iCustom->AddCheckButton (nControlId, L"Link", false);
+        setLabelToControl(m_ResProvider, iCustom, nControlId);
+    }
     
     if ((nFeatures & FEATURE_SELECTION) == FEATURE_SELECTION)
-        iCustom->AddCheckButton (css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_SELECTION, L"Selection", false);
+    {
+        nControlId = css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_SELECTION;
+        iCustom->AddCheckButton (nControlId, L"Selection", false);
+        setLabelToControl(m_ResProvider, iCustom, nControlId);
+    }
 
     /* can be ignored ... new COM dialog supports preview native now  !
     if ((nFeatures & FEATURE_PREVIEW) == FEATURE_PREVIEW)
@@ -619,8 +653,9 @@ void VistaFilePickerImpl::impl_sta_SetFileName(const RequestRef& rRequest)
 void VistaFilePickerImpl::impl_sta_SetDirectory(const RequestRef& rRequest)
 {
     ::rtl::OUString sDirectory = rRequest->getArgumentOrDefault(PROP_DIRECTORY, ::rtl::OUString());
+    bool            bForce     = rRequest->getArgumentOrDefault(PROP_FORCE, false);
     
-    if( !m_bInExecute )
+    if( !m_bInExecute)
     {
         // Vista stores last used folders for file dialogs
         // so we don't want the application to change the folder
@@ -628,7 +663,6 @@ void VistaFilePickerImpl::impl_sta_SetDirectory(const RequestRef& rRequest)
         // Store the requested folder in the mean time and decide later
         // what to do
         m_sDirectory = sDirectory;
-        return;
     }
 
     // SYNCHRONIZED->
@@ -646,7 +680,13 @@ void VistaFilePickerImpl::impl_sta_SetDirectory(const RequestRef& rRequest)
     if ( FAILED(hResult) )
         return;
     
-    iDialog->SetFolder(pFolder);
+    if ( m_bInExecute || bForce )
+        iDialog->SetFolder(pFolder);
+    else
+    {
+        // Use set default folder as Microsoft recommends in the IFileDialog documentation.
+        iDialog->SetDefaultFolder(pFolder);
+    }
 }
 
 void VistaFilePickerImpl::impl_sta_GetDirectory(const RequestRef& rRequest)
@@ -814,21 +854,62 @@ void VistaFilePickerImpl::impl_sta_ShowDialogModal(const RequestRef& rRequest)
     aLock.clear();    
     // <- SYNCHRONIZED
 
+    // we set the directory only if we have a save dialog and a filename
+    // for the other cases, the file dialog remembers its last location
+    // according to its client guid.
     if( m_sDirectory.getLength()) 
     {
-        // we set the directory only if we have a save dialog and a filename
-        // for the other cases, the file dialog remembers its last location
-        // according to its client guid.
-        if (iSave.is() && m_sFilename.getLength())
+        ComPtr< IShellItem > pFolder;
+        #ifdef __MINGW32__
+            HRESULT hResult = SHCreateItemFromParsingName ( reinterpret_cast<LPCTSTR>(m_sDirectory.getStr()), NULL, IID_IShellItem, (void**)(&pFolder) );
+        #else
+            HRESULT hResult = SHCreateItemFromParsingName ( m_sDirectory, NULL, IID_PPV_ARGS(&pFolder) );
+        #endif
+        if ( SUCCEEDED(hResult) )
         {
-            ComPtr< IShellItem > pFolder;
-            #ifdef __MINGW32__
-                HRESULT hResult = SHCreateItemFromParsingName ( reinterpret_cast<LPCTSTR>(m_sDirectory.getStr()), NULL, IID_IShellItem, (void**)(&pFolder) );
-            #else
-                HRESULT hResult = SHCreateItemFromParsingName ( m_sDirectory, NULL, IID_PPV_ARGS(&pFolder) );
-            #endif
-            if ( SUCCEEDED(hResult) )
-                iDialog->SetFolder(pFolder);
+            if (m_sFilename.getLength())
+            {
+                ::rtl::OUString aFileURL(m_sDirectory);
+                sal_Int32 nIndex = aFileURL.lastIndexOf('/');
+                if (nIndex != aFileURL.getLength()-1)
+                    aFileURL += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/"));
+                aFileURL += m_sFilename;
+                
+                TFileDialogCustomize iCustom = impl_getCustomizeInterface();
+                
+                BOOL bValue = FALSE;
+                HRESULT hResult = iCustom->GetCheckButtonState( css::ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, &bValue);
+                if ( bValue )
+                {
+                    ::rtl::OUString aExt;
+                    UINT nFileType;
+                    hResult = iDialog->GetFileTypeIndex(&nFileType);
+                    if ( SUCCEEDED(hResult) )
+                    {
+                        ::std::vector< COMDLG_FILTERSPEC > lFilters = lcl_buildFilterList(m_lFilters);
+                        LPCWSTR lpFilterExt = lFilters[nFileType].pszSpec;
+
+                        lpFilterExt = wcsrchr( lpFilterExt, '.' );
+                        if ( lpFilterExt )
+                            aFileURL += reinterpret_cast<const sal_Unicode*>(lpFilterExt);
+                    }
+                }
+
+                // Check existence of file. Set folder only for this special case
+                ::rtl::OUString aSystemPath;
+                osl_getSystemPathFromFileURL( aFileURL.pData, &aSystemPath.pData );
+
+                WIN32_FIND_DATA	aFindFileData;
+                HANDLE	hFind = FindFirstFile( reinterpret_cast<LPCWSTR>(aSystemPath.getStr()), &aFindFileData );
+                if (hFind != INVALID_HANDLE_VALUE)
+                    iDialog->SetFolder(pFolder);
+                else
+                    hResult = iDialog->AddPlace(pFolder, FDAP_TOP);
+
+                FindClose( hFind );
+            }
+            else
+                hResult = iDialog->AddPlace(pFolder, FDAP_TOP);
         }
     }
     
@@ -1047,7 +1128,7 @@ void VistaFilePickerImpl::impl_sta_SetControlLabel(const RequestRef& rRequest)
 }
 
 //-------------------------------------------------------------------------------
-void VistaFilePickerImpl::impl_sta_GetControlLabel(const RequestRef& rRequest)
+void VistaFilePickerImpl::impl_sta_GetControlLabel(const RequestRef& /*rRequest*/)
 {
 }
 
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
index 4a0145a..6f660ee 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.hxx
@@ -42,6 +42,7 @@
 #include "FilterContainer.hxx"
 #include "VistaFilePickerEventHandler.hxx"
 #include "IVistaFilePickerInternalNotify.hxx"
+#include "..\misc\resourceprovider.hxx"
 
 #include <com/sun/star/uno/Sequence.hxx>
 
@@ -101,6 +102,7 @@ static const ::rtl::OUString PROP_FEATURES            = ::rtl::OUString::createF
 static const ::rtl::OUString PROP_TEMPLATE_DESCR	  = ::rtl::OUString::createFromAscii("templatedescription"); // [sal_Int32]
 static const ::rtl::OUString PROP_FILTER_TITLE        = ::rtl::OUString::createFromAscii("filter_title"       ); // [OUString]
 static const ::rtl::OUString PROP_FILTER_VALUE        = ::rtl::OUString::createFromAscii("filter_value"       ); // [OUString]
+static const ::rtl::OUString PROP_FORCE               = ::rtl::OUString::createFromAscii("force"              ); // [sal_Bool]
 
 static const ::rtl::OUString PROP_CONTROL_ID          = ::rtl::OUString::createFromAscii("control_id"         ); // [sal_Int16]
 static const ::rtl::OUString PROP_CONTROL_ACTION      = ::rtl::OUString::createFromAscii("control_action"     ); // [sal_Int16]
@@ -334,6 +336,9 @@ class VistaFilePickerImpl : private ::cppu::BaseMutex
 
         //
         ::rtl::OUString m_sFilename;
+
+        // Resource provider
+        CResourceProvider m_ResProvider;      
 };
 
 } // namespace vista
diff --git a/fpicker/source/win32/filepicker/filepickerstate.cxx b/fpicker/source/win32/filepicker/filepickerstate.cxx
index 4fbf9f7..dc0858a 100644
--- a/fpicker/source/win32/filepicker/filepickerstate.cxx
+++ b/fpicker/source/win32/filepicker/filepickerstate.cxx
@@ -220,6 +220,26 @@ OUString MatchFixBrokenPath(const OUString& path)
     return path;   
 }
 
+//-----------------------------------------------------------------------------------------
+// 
+//-----------------------------------------------------------------------------------------
+static ::rtl::OUString trimTrailingSpaces(const ::rtl::OUString& rString)
+{
+    rtl::OUString aResult(rString);
+    
+    sal_Int32 nIndex = rString.lastIndexOf(' ');
+    if (nIndex == rString.getLength()-1)
+    {
+        while (nIndex >= 0 && rString[nIndex] == ' ')
+            nIndex--;
+        if (nIndex >= 0)
+            aResult = rString.copy(0,nIndex+1);
+        else
+            aResult = ::rtl::OUString();
+    }
+    return aResult;
+}
+        
 Sequence< OUString > SAL_CALL CNonExecuteFilePickerState::getFiles( CFileOpenDialog* aFileOpenDialog )
 {
     OSL_PRECOND( aFileOpenDialog, "invalid parameter" );
@@ -258,8 +278,9 @@ Sequence< OUString > SAL_CALL CNonExecuteFilePickerState::getFiles( CFileOpenDia
 
         for ( sal_Int32 i = 0; i < lenFileList; i++ )
         {	        
+            aFilePath = trimTrailingSpaces(aFilePathList[i]);
             rc = ::osl::FileBase::getFileURLFromSystemPath( 
-                aFilePathList[i], aFilePathURL );
+                aFilePath, aFilePathURL );
                 
             // we do return all or nothing, that means
             // in case of failures we destroy the sequence
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 52045f4..b9bd1b5 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -1455,6 +1455,18 @@ Dymamic border coloring means that when the mouse is hovered over a control, and
 				<author>MBA</author>
 				<desc>Contains the current and default path settings used by the Office.</desc>
 			</info>
+      <group oor:name="Info">
+        <info>
+          <author>CD</author>
+          <desc>Contains various properties information purpose only.</desc>
+        </info>
+        <prop oor:name="WorkPathChanged" oor:type="xs:boolean">
+          <info>
+            <desc>A flag which is set by the tools options dialog whenever a user changed the work path.</desc>
+          </info>
+          <value>true</value>
+        </prop>
+      </group>
 			<group oor:name="Current">
 				<info>
 					<author>MBA</author>
diff --git a/sfx2/inc/sfx2/app.hxx b/sfx2/inc/sfx2/app.hxx
index 4968b7a..39dde5c 100644
--- a/sfx2/inc/sfx2/app.hxx
+++ b/sfx2/inc/sfx2/app.hxx
@@ -262,6 +262,7 @@ public:
                                                   BOOL bActivate,
                                                   BOOL bForbidVisible = FALSE,
                                                   const String* pPostStr = 0);
+    void                        ResetLastDir();
 
 //#if 0 // _SOLAR__PRIVATE
     SAL_DLLPRIVATE static SfxApplication* Is_Impl() { return pApp;}
diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx
index 84e6ebb..c5ec0b9 100644
--- a/sfx2/inc/sfx2/filedlghelper.hxx
+++ b/sfx2/inc/sfx2/filedlghelper.hxx
@@ -238,6 +238,9 @@ public:
     
     /** Provides the selected files with full path information */
     ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSelectedFiles() const;
+    
+    /** Provides the selected files with full path information */
+    ::com::sun::star::uno::Sequence< ::rtl::OUString > GetSelectedFiles() const;
 
     void                     AddFilter( const String& rFilterName, const String& rExtension );
     void                     SetCurrentFilter( const String& rFilter );
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index 78a078e..135f2f3 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -460,6 +460,14 @@ void SfxApplication::SetLastDir_Impl
 
 //--------------------------------------------------------------------
 
+void SfxApplication::ResetLastDir()
+{
+    String aEmpty;
+    pAppData_Impl->aLastDir = aEmpty;
+}
+
+//--------------------------------------------------------------------
+
 SfxDispatcher* SfxApplication::GetDispatcher_Impl()
 {
     return pAppData_Impl->pViewFrame? pAppData_Impl->pViewFrame->GetDispatcher(): pAppData_Impl->pAppDispat;
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx
index cd94dd3..693af2d 100644
--- a/sfx2/source/appl/shutdownicon.cxx
+++ b/sfx2/source/appl/shutdownicon.cxx
@@ -494,6 +494,12 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR
         }
     }
 
+#ifdef WNT
+    // #103346 Destroy dialog to prevent problems with custom controls
+    delete pThis->m_pFileDlg;
+    pThis->m_pFileDlg = NULL;
+#endif
+
     LeaveModalMode();
     return 0;
 }
diff --git a/svx/source/cui/optpath.cxx b/svx/source/cui/optpath.cxx
index 5469549..ec58967 100644
--- a/svx/source/cui/optpath.cxx
+++ b/svx/source/cui/optpath.cxx
@@ -41,6 +41,7 @@
 #include <tools/shl.hxx>
 #include <vcl/msgbox.hxx>
 #include <sfx2/filedlghelper.hxx>
+#include <sfx2/app.hxx>
 #include <svtools/pickerhelper.hxx>
 #include <svtools/aeitem.hxx>
 #include <svtools/svtabbx.hxx>
@@ -52,6 +53,7 @@
 #include <unotools/localfilehelper.hxx>
 #include <svtools/pathoptions.hxx>
 #include <svtools/moduleoptions.hxx>
+#include <svtools/viewoptions.hxx>
 
 #define _SVX_OPTPATH_CXX
 
@@ -62,6 +64,7 @@
 #include <svx/dialogs.hrc>
 #include "helpid.hrc"
 #include <comphelper/processfactory.hxx>
+#include <comphelper/configurationhelper.hxx>
 #include <com/sun/star/uno/Exception.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -91,6 +94,7 @@ using namespace svx;
 #define POSTFIX_WRITABLE    String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_writable" ) )
 #define POSTFIX_READONLY    String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "_readonly" ) )
 #define VAR_ONE             String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "%1" ) )
+#define IODLG_CONFIGNAME	String(DEFINE_CONST_UNICODE("FilePicker_Save"))
 
 // struct OptPath_Impl ---------------------------------------------------
 
@@ -536,6 +540,26 @@ void SvxPathTabPage::ChangeCurrentEntry( const String& _rFolder )
         pPathImpl = (PathUserData_Impl*)pPathBox->GetEntry(nPos)->GetUserData();
         pPathImpl->eState = SFX_ITEM_SET;
         pPathImpl->sWritablePath = sNewPathStr;
+        if ( SvtPathOptions::PATH_WORK == pPathImpl->nRealId )
+        {
+            // Remove view options entry so the new work path
+            // will be used for the next open dialog.
+            SvtViewOptions aDlgOpt( E_DIALOG, IODLG_CONFIGNAME );
+            aDlgOpt.Delete();
+            // Reset also last used dir in the sfx application instance
+            SfxApplication *pSfxApp = SFX_APP();
+            pSfxApp->ResetLastDir();
+            
+            // Set configuration flag to notify file picker that it's necessary
+            // to take over the path provided.
+            Reference < XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+            ::comphelper::ConfigurationHelper::writeDirectKey(xFactory,
+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice.Office.Common/")),
+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Path/Info")),
+                ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkPathChanged")),
+                ::com::sun::star::uno::makeAny(true),
+                ::comphelper::ConfigurationHelper::E_STANDARD);
+        }
     }
 }
 
commit 134f7be2681e0fdfb94039cfeb77d634a9382dc5
Author: Jens-Heiner Rechtien <hr at openoffice.org>
Date:   Thu Jul 30 10:24:24 2009 +0000

    CWS-TOOLING: integrate CWS wordencryption
    2009-07-10 09:42:25 +0200 mav  r273872 : resolve merge problem
    2009-07-08 07:46:13 +0200 mav  r273815 : CWS-TOOLING: rebase CWS wordencryption to trunk at 273468 (milestone: DEV300:m51)
    2009-07-03 10:38:03 +0200 mav  r273682 : #i10000# resolve conflict
    2009-07-02 08:47:35 +0200 steve_yin  r273618 : Removed IBM(C) from modified files.
    2009-06-22 04:34:44 +0200 steve_yin  r273191 : Based on Mikhail suggestions, I changed some code.
    2009-06-18 09:37:14 +0200 mav  r273100 : #i10000# get rid of windows warnings
    2009-06-17 08:18:33 +0200 mav  r273047 : #i10000# adopt for linux build

diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index ef6b5b3..adb6b58 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -87,6 +87,7 @@
 #endif
 #include <svtools/pickerhelper.hxx>
 #include <svtools/docpasswdrequest.hxx>
+#include <svtools/docmspasswdrequest.hxx>
 #include <ucbhelper/content.hxx>
 #include <ucbhelper/commandenvironment.hxx>
 #include <comphelper/storagehelper.hxx>
@@ -556,6 +557,15 @@ void FileDialogHelper_Impl::updateSelectionBox()
 }
 
 // ------------------------------------------------------------------------
+struct CheckMSPasswordCapability
+{
+    sal_Bool operator() ( const String rFilterName )
+    {
+        return rFilterName.EqualsAscii("MS Word 97");
+    }
+};
+
+// ------------------------------------------------------------------------
 struct CheckPasswordCapability
 {
     sal_Bool operator() ( const SfxFilter* _pFilter )
@@ -572,8 +582,9 @@ struct CheckPasswordCapability
             return true;
 #endif
 
-        return _pFilter->IsOwnFormat() && _pFilter->UsesStorage()
-            && ( SOFFICE_FILEFORMAT_60 <= _pFilter->GetVersion() );
+        return  ( _pFilter->IsOwnFormat() && _pFilter->UsesStorage()
+            &&	( SOFFICE_FILEFORMAT_60 <= _pFilter->GetVersion() )	)	
+            || CheckMSPasswordCapability()( _pFilter->GetFilterName() );
     }
 };
 
@@ -1660,15 +1671,30 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
                     if( xInteractionHandler.is() )
                     {
                         // TODO: find out a way to set the 1-15 char limits on MS Excel 97 filter.
-                        RequestDocumentPassword* pPasswordRequest = new RequestDocumentPassword(
-                            ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) );
- 
-                        uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest );
-                        xInteractionHandler->handle( rRequest );
-                        if ( pPasswordRequest->isPassword() )
-                            rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) );
+                        if ( CheckMSPasswordCapability()( rFilter ) )
+                        {
+                            RequestMSDocumentPassword* pMSPasswordRequest = new RequestMSDocumentPassword(
+                                ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) );
+     
+                            uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pMSPasswordRequest );
+                            xInteractionHandler->handle( rRequest );
+                            if ( pMSPasswordRequest->isPassword() )
+                                rpSet->Put( SfxStringItem( SID_PASSWORD, pMSPasswordRequest->getPassword() ) );
+                            else
+                                return ERRCODE_ABORT;
+                        }
                         else
-                            return ERRCODE_ABORT;
+                        {
+                            RequestDocumentPassword* pPasswordRequest = new RequestDocumentPassword(
+                                ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) );
+ 
+                            uno::Reference< com::sun::star::task::XInteractionRequest > rRequest( pPasswordRequest );
+                            xInteractionHandler->handle( rRequest );
+                            if ( pPasswordRequest->isPassword() )
+                                rpSet->Put( SfxStringItem( SID_PASSWORD, pPasswordRequest->getPassword() ) );
+                            else
+                                return ERRCODE_ABORT;
+                        }
                     }
                 }
             }
diff --git a/svx/inc/mscodec.hxx b/svx/inc/mscodec.hxx
index be67b46..b80a778 100644
--- a/svx/inc/mscodec.hxx
+++ b/svx/inc/mscodec.hxx
@@ -239,6 +239,28 @@ public:
     bool                CreateSaltDigest( 
                             const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16] );
 
+    /** Encodes a block of memory.
+
+        @see rtl_cipher_encode()
+
+        @precond
+            The codec must be initialized with InitKey() before this function
+            can be used. The destination buffer must be able to take all
+            unencoded data from the source buffer (usually this means it must be
+            as long as or longer than the source buffer).
+
+        @param pData
+            Unencrypted source data block.
+        @param nDatLen
+            Size of the passed source data block.
+        @param pBuffer
+            Destination buffer for the encrypted data.
+        @param nBufLen
+            Size of the destination buffer.
+
+        @return
+            true = Encoding was successful (no error occured).
+    */
     bool                Encode(
                             const void* pData, sal_Size nDatLen,
                             sal_uInt8* pBuffer, sal_Size nBufLen );
@@ -283,6 +305,24 @@ public:
      */
     bool                Skip( sal_Size nDatLen );
 
+    /** Gets salt data and salt digest.
+
+        @precond
+            The codec must be initialized with InitKey() before this function
+            can be used.
+
+        @param pSalt
+            Salt, a random number.
+        @param pSaltData
+            Salt data block generated from the salt.
+        @param pSaltDigest
+            Salt digest generated from the salt.
+     */
+    void				GetEncryptKey (	
+                            const sal_uInt8 pSalt[16], 
+                            sal_uInt8 pSaltData[16], 
+                            sal_uInt8 pSaltDigest[16]);
+    
 private:
     void                GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8 pDigest[16] );
 
diff --git a/svx/source/msfilter/mscodec.cxx b/svx/source/msfilter/mscodec.cxx
index 39342fe..54da76c 100644
--- a/svx/source/msfilter/mscodec.cxx
+++ b/svx/source/msfilter/mscodec.cxx
@@ -432,11 +432,12 @@ bool MSCodec_Std97::CreateSaltDigest( const sal_uInt8 nSaltData[16], sal_uInt8 n
     return (result);
 }
 
-bool MSCodec_Std97::Encode(
+bool MSCodec_Std97::Encode (
     const void *pData,   sal_Size nDatLen,
     sal_uInt8  *pBuffer, sal_Size nBufLen)
 {
     rtlCipherError result;
+
     result = rtl_cipher_encode (
         m_hCipher, pData, nDatLen, pBuffer, nBufLen);
 
@@ -498,6 +499,38 @@ void MSCodec_Std97::GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8
     memcpy(pDigest, pDigestLocal, 16);
 }
 
+void MSCodec_Std97::GetEncryptKey (
+    const sal_uInt8 pSalt[16],
+    sal_uInt8 pSaltData[16],
+    sal_uInt8 pSaltDigest[16])
+{    
+    if (InitCipher(0))
+    {
+        sal_uInt8 pDigest[RTL_DIGEST_LENGTH_MD5];
+        sal_uInt8 pBuffer[64];
+      
+        rtl_cipher_encode (
+            m_hCipher, pSalt, 16, pSaltData, sizeof(pBuffer));
+
+        (void)memcpy( pBuffer, pSalt, 16 );
+
+        pBuffer[16] = 0x80;
+        (void)memset (pBuffer + 17, 0, sizeof(pBuffer) - 17);
+        pBuffer[56] = 0x80;
+        
+        rtl_digest_updateMD5 (
+            m_hDigest, pBuffer, sizeof(pBuffer));
+        rtl_digest_rawMD5 (
+            m_hDigest, pDigest, sizeof(pDigest));
+       
+        rtl_cipher_encode (
+            m_hCipher, pDigest, 16, pSaltDigest, 16);
+        
+        (void)memset (pBuffer, 0, sizeof(pBuffer));
+        (void)memset (pDigest, 0, sizeof(pDigest));
+    }
+}
+
 // ============================================================================
 
 } // namespace svx
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index 46f7ebe..c58794c 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -63,6 +63,7 @@
 #include "com/sun/star/task/XInteractionHandler.hpp" 
 #include "com/sun/star/task/XInteractionHandler2.hpp"
 #include "com/sun/star/task/DocumentPasswordRequest.hpp"
+#include "com/sun/star/task/DocumentMSPasswordRequest.hpp"
 #include "com/sun/star/task/ErrorCodeIOException.hpp"
 #include "com/sun/star/task/ErrorCodeRequest.hpp"
 #include "com/sun/star/task/MasterPasswordRequest.hpp"
@@ -1132,6 +1133,15 @@ bool UUIInteractionHelper::handleDialogRequests(
         return true;
     }
 
+    star::task::DocumentMSPasswordRequest aDocumentMSPasswordRequest;
+    if (aAnyRequest >>= aDocumentMSPasswordRequest)
+    {
+        handleMSPasswordRequest(aDocumentMSPasswordRequest.Mode,
+                              rRequest->getContinuations(),
+                              aDocumentMSPasswordRequest.Name);
+        return true;
+    }
+
     star::task::PasswordRequest aPasswordRequest;
     if (aAnyRequest >>= aPasswordRequest)
     {
@@ -1839,6 +1849,48 @@ UUIInteractionHelper::executePasswordDialog(
 }
 
 void
+UUIInteractionHelper::executeMSPasswordDialog(
+    LoginErrorInfo & rInfo,
+    star::task::PasswordRequestMode nMode,
+    ::rtl::OUString aDocName)
+       SAL_THROW((star::uno::RuntimeException))
+{
+    try
+    {
+        vos::OGuard aGuard(Application::GetSolarMutex());
+
+        std::auto_ptr< ResMgr >
+            xManager(ResMgr::CreateResMgr(CREATEVERSIONRESMGR_NAME(uui)));
+    if( nMode == star::task::PasswordRequestMode_PASSWORD_CREATE )
+    {
+        std::auto_ptr< PasswordCreateDialog >
+        xDialog(new PasswordCreateDialog(
+                            getParentProperty(), xManager.get(), true));
+
+        rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
+                ERRCODE_BUTTON_CANCEL);
+        rInfo.SetPassword( xDialog->GetPassword() );
+    }
+    else
+    {
+        std::auto_ptr< PasswordDialog >
+        xDialog(new PasswordDialog(
+                            getParentProperty(), nMode, xManager.get(), aDocName ));
+
+        rInfo.SetResult(xDialog->Execute() == RET_OK ? ERRCODE_BUTTON_OK :
+                ERRCODE_BUTTON_CANCEL);
+        rInfo.SetPassword( xDialog->GetPassword() );
+    }
+    }
+    catch (std::bad_alloc const &)
+    {
+        throw star::uno::RuntimeException(
+            rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("out of memory")),
+            star::uno::Reference< star::uno::XInterface>());
+    }
+}
+
+void
 UUIInteractionHelper::executeCookieDialog(CntHTTPCookieRequest & rRequest)
     SAL_THROW((star::uno::RuntimeException))
 {
@@ -2558,6 +2610,47 @@ UUIInteractionHelper::handlePasswordRequest(
 }
 
 void
+UUIInteractionHelper::handleMSPasswordRequest(
+    star::task::PasswordRequestMode nMode,
+    star::uno::Sequence< star::uno::Reference<
+                             star::task::XInteractionContinuation > > const &
+        rContinuations,
+    ::rtl::OUString aDocumentName )
+    SAL_THROW((star::uno::RuntimeException))
+{
+    star::uno::Reference< star::task::XInteractionRetry > xRetry;
+    star::uno::Reference< star::task::XInteractionAbort > xAbort;
+    star::uno::Reference< star::task::XInteractionPassword >
+        xPassword;
+    getContinuations(
+        rContinuations, 0, 0, &xRetry, &xAbort, 0, &xPassword, 0, 0);
+    LoginErrorInfo aInfo;
+
+    executeMSPasswordDialog(aInfo, nMode, aDocumentName);
+
+    switch (aInfo.GetResult())
+    {
+    case ERRCODE_BUTTON_OK:
+        if (xPassword.is())
+        {
+        xPassword->setPassword(aInfo.GetPassword());
+        xPassword->select();
+        }
+        break;
+
+    case ERRCODE_BUTTON_RETRY:
+        if (xRetry.is())
+        xRetry->select();
+        break;
+
+    default:
+        if (xAbort.is())
+            xAbort->select();
+        break;
+    }
+}
+
+void
 UUIInteractionHelper::handleCookiesRequest(
     star::ucb::HandleCookiesRequest const & rRequest,
     star::uno::Sequence< star::uno::Reference<
diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx
index f173f59..9475e72 100644
--- a/uui/source/iahndl.hxx
+++ b/uui/source/iahndl.hxx
@@ -201,6 +201,12 @@ private:
               ::rtl::OUString aDocumentName)
         SAL_THROW((com::sun::star::uno::RuntimeException));
 
+    void
+    executeMSPasswordDialog(LoginErrorInfo & rInfo,
+                          com::sun::star::task::PasswordRequestMode nMode,
+              ::rtl::OUString aDocumentName)
+        SAL_THROW((com::sun::star::uno::RuntimeException));
+
     void executeCookieDialog(CntHTTPCookieRequest & rRequest)
         SAL_THROW((com::sun::star::uno::RuntimeException));
     
@@ -280,6 +286,16 @@ private:
     ::rtl::OUString aDocumentName = ::rtl::OUString())
         SAL_THROW((com::sun::star::uno::RuntimeException));
 
+     void
+    handleMSPasswordRequest(
+        com::sun::star::task::PasswordRequestMode nMode,
+        com::sun::star::uno::Sequence<
+        com::sun::star::uno::Reference<
+            com::sun::star::task::XInteractionContinuation > > const &
+    rContinuations,
+    ::rtl::OUString aDocumentName = ::rtl::OUString())
+        SAL_THROW((com::sun::star::uno::RuntimeException));
+
     void
     handleCookiesRequest(
         com::sun::star::ucb::HandleCookiesRequest const & rRequest,
diff --git a/uui/source/passcrtdlg.cxx b/uui/source/passcrtdlg.cxx
index c3aa597..878802d 100644
--- a/uui/source/passcrtdlg.cxx
+++ b/uui/source/passcrtdlg.cxx
@@ -69,19 +69,19 @@ IMPL_LINK( PasswordCreateDialog, OKHdl_Impl, OKButton *, EMPTYARG )
 
 // -----------------------------------------------------------------------
 
-PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr )
+PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr, bool bMSCryptoMode)
     :ModalDialog( _pParent, ResId( DLG_UUI_PASSWORD_CRT, *pResMgr ) )
     ,aFTPasswordCrt           ( this, ResId( FT_PASSWORD_CRT, *pResMgr )             )
     ,aEDPasswordCrt       ( this, ResId( ED_PASSWORD_CRT, *pResMgr )        )
     ,aFTPasswordRepeat           ( this, ResId( FT_PASSWORD_REPEAT, *pResMgr )             )
     ,aEDPasswordRepeat       ( this, ResId( ED_PASSWORD_REPEAT, *pResMgr )        )
-    ,aFTWarning           ( this, ResId( FT_PASSWORD_WARNING, *pResMgr )             )
+    ,aFTWarning           ( this, ResId( bMSCryptoMode ? FT_MSPASSWORD_WARNING : FT_PASSWORD_WARNING, *pResMgr )             )
     ,aFixedLine1       ( this, ResId( FL_FIXED_LINE_1, *pResMgr )        )
     ,aOKBtn   ( this, ResId( BTN_PASSCRT_OK, *pResMgr )    )
     ,aCancelBtn   ( this, ResId( BTN_PASSCRT_CANCEL, *pResMgr )    )
     ,aHelpBtn   ( this, ResId( BTN_PASSCRT_HELP, *pResMgr )    )
     ,pResourceMgr			( pResMgr )
-    ,nMinLen(5)
+    ,nMinLen( bMSCryptoMode ? 1 : 5 )
 {
     FreeResource();
 
@@ -90,6 +90,12 @@ PasswordCreateDialog::PasswordCreateDialog( Window* _pParent, ResMgr * pResMgr )
 
     aOKBtn.Enable( sal_False );
 
+    if ( bMSCryptoMode )
+    {
+        aEDPasswordCrt.SetMaxTextLen( 15 );
+        aEDPasswordRepeat.SetMaxTextLen( 15 );
+    }
+
     long nLabelWidth = aFTWarning.GetSizePixel().Width();
     long nLabelHeight = aFTWarning.GetSizePixel().Height();
     long nTextWidth = aFTWarning.GetCtrlTextWidth( aFTWarning.GetText() );
diff --git a/uui/source/passcrtdlg.hrc b/uui/source/passcrtdlg.hrc
index a899f98..7add4dc 100644
--- a/uui/source/passcrtdlg.hrc
+++ b/uui/source/passcrtdlg.hrc
@@ -28,19 +28,20 @@
  *
  ************************************************************************/
 
-#ifndef UUI_PASSCRTDLG_HRC
-#define UUI_PASSCRTDLG_HRC
+#ifndef UUI_PASSCRTDLG_HRC
+#define UUI_PASSCRTDLG_HRC
 
-// local identifiers
-#define BTN_PASSCRT_CANCEL 1
-#define ED_PASSWORD_CRT     2
-#define FT_PASSWORD_REPEAT          3
-#define FT_PASSWORD_WARNING          4
-#define ED_PASSWORD_REPEAT     5
-#define FL_FIXED_LINE_1     6
-#define BTN_PASSCRT_OK 7
-#define BTN_PASSCRT_HELP 8
-#define FT_PASSWORD_CRT          9
+// local identifiers
+#define BTN_PASSCRT_CANCEL 1
+#define ED_PASSWORD_CRT     2
+#define FT_PASSWORD_REPEAT          3
+#define FT_PASSWORD_WARNING          4
+#define ED_PASSWORD_REPEAT     5
+#define FL_FIXED_LINE_1     6
+#define BTN_PASSCRT_OK 7
+#define BTN_PASSCRT_HELP 8
+#define FT_PASSWORD_CRT          9
+#define FT_MSPASSWORD_WARNING 10
 
 
-#endif // UUI_PASSCRTDLG_HRC
+#endif // UUI_PASSCRTDLG_HRC
diff --git a/uui/source/passcrtdlg.hxx b/uui/source/passcrtdlg.hxx
index eeb2ca3..76f0435 100644
--- a/uui/source/passcrtdlg.hxx
+++ b/uui/source/passcrtdlg.hxx
@@ -58,7 +58,7 @@ class PasswordCreateDialog : public ModalDialog
     DECL_LINK( EditHdl_Impl, Edit * );
 
 public:
-    PasswordCreateDialog( Window* pParent, ResMgr * pResMgr );
+    PasswordCreateDialog( Window* pParent, ResMgr * pResMgr, bool bMSCryptoMode = false );
 
     String			GetPassword() const { return aEDPasswordCrt.GetText(); }
 };
diff --git a/uui/source/passcrtdlg.src b/uui/source/passcrtdlg.src
index 719d13a..8afff12 100644
--- a/uui/source/passcrtdlg.src
+++ b/uui/source/passcrtdlg.src
@@ -34,7 +34,7 @@
 #include <ids.hrc>
 #endif
 #ifndef UUI_PASSCRTDLG_HRC
-#include "passcrtdlg.hrc"
+#include "passcrtdlg.hrc"
 #endif
 
 ModalDialog DLG_UUI_PASSWORD_CRT
@@ -44,61 +44,68 @@ ModalDialog DLG_UUI_PASSWORD_CRT
     Moveable = TRUE ;
     OutputSize = TRUE ;
     SVLook = TRUE ;
-    Size = MAP_APPFONT( 145, 129 );
+    Size = MAP_APPFONT( 145, 129 );
     FixedText FT_PASSWORD_CRT
     {
-        Pos = MAP_APPFONT( 3, 4 );
-        Size = MAP_APPFONT( 139, 9 );
-        Text [ en-US ] = "Enter password";
+        Pos = MAP_APPFONT( 3, 4 );
+        Size = MAP_APPFONT( 139, 9 );
+        Text [ en-US ] = "Enter password";
     };
     Edit ED_PASSWORD_CRT
     {
         Border = TRUE ;
-        Pos = MAP_APPFONT( 3, 17 );
+        Pos = MAP_APPFONT( 3, 17 );
         Size = MAP_APPFONT( 139, 13 );
         PassWord = TRUE ;
     };
     Edit ED_PASSWORD_REPEAT
     {
         Border = TRUE ;
-        Pos = MAP_APPFONT( 3, 47 );
+        Pos = MAP_APPFONT( 3, 47 );
         Size = MAP_APPFONT( 139, 13 );
         PassWord = TRUE ;
     };
     OKButton BTN_PASSCRT_OK
     {
-        Pos = MAP_APPFONT( 27, 110 );
+        Pos = MAP_APPFONT( 27, 110 );
         Size = MAP_APPFONT( 37, 15 );
         DefButton = TRUE ;
     };
     CancelButton BTN_PASSCRT_CANCEL
     {
-        Pos = MAP_APPFONT( 66, 110 );
-        Size = MAP_APPFONT( 37, 15 );
+        Pos = MAP_APPFONT( 66, 110 );
+        Size = MAP_APPFONT( 37, 15 );
     };
     HelpButton BTN_PASSCRT_HELP
     {
-        Pos = MAP_APPFONT( 105, 110 );
-        Size = MAP_APPFONT( 37, 15 );
+        Pos = MAP_APPFONT( 105, 110 );
+        Size = MAP_APPFONT( 37, 15 );
     };	
-    FixedText FT_PASSWORD_REPEAT
-    {
-        Pos = MAP_APPFONT( 3, 34 );
-        Size = MAP_APPFONT( 139, 9 );
-        Text [ en-US ] = "Reenter password";
-    };
-    FixedText FT_PASSWORD_WARNING
-    {
-        Pos = MAP_APPFONT( 4, 64 );
-        Size = MAP_APPFONT( 137, 40 );
-        Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive and at least five characters long.";
-        WordBreak = TRUE;
-    };
-    FixedLine FL_FIXED_LINE_1
-    {
-        Pos = MAP_APPFONT( 0, 104 );
-        Size = MAP_APPFONT( 145, 6 );
+    FixedText FT_PASSWORD_REPEAT
+    {
+        Pos = MAP_APPFONT( 3, 34 );
+        Size = MAP_APPFONT( 139, 9 );
+        Text [ en-US ] = "Reenter password";
+    };
+    FixedText FT_PASSWORD_WARNING
+    {
+        Pos = MAP_APPFONT( 4, 64 );
+        Size = MAP_APPFONT( 137, 40 );
+        Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive and at least five characters long.";
+        WordBreak = TRUE;
+    };
+    FixedText FT_MSPASSWORD_WARNING
+    {
+        Pos = MAP_APPFONT( 4, 64 );
+        Size = MAP_APPFONT( 137, 40 );
+        Text [ en-US ] = "WARNING: If you lose or forget the password, it cannot be recovered. It is advisable to keep passwords in a safe place. Passwords are case-sensitive and at most fifteen characters long.";
+        WordBreak = TRUE;
+    };
+    FixedLine FL_FIXED_LINE_1
+    {
+        Pos = MAP_APPFONT( 0, 104 );
+        Size = MAP_APPFONT( 145, 6 );
     };	
-    Text [ en-US ] = "Enter Password";
+    Text [ en-US ] = "Enter Password";
 };
 
commit 271f576a60491d6849096b31ddcb41d7832ed7d5
Author: Jens-Heiner Rechtien <hr at openoffice.org>
Date:   Wed Jul 29 15:33:56 2009 +0000

    CWS-TOOLING: integrate CWS cmcfixes61
    2009-07-22 10:53:14 +0200 cmc  r274224 : #i103714# duplicate patch
    2009-07-22 10:45:26 +0200 cmc  r274223 : #i103715# fix up m68k makefile.mk
    2009-07-22 10:32:16 +0200 cmc  r274222 : #i103714# || && new gcc warnings
    2009-07-21 13:29:17 +0200 cmc  r274190 : #i103651# fix for subpixel gray line in cairo canvas animations
    2009-07-20 17:35:58 +0200 cmc  r274151 : #i103668# WaE over use of const
    2009-07-20 15:53:51 +0200 cmc  r274146 : #i103664# use boost::addressof instead
    2009-07-20 15:38:40 +0200 cmc  r274145 : #i103451# long -> INT32 for these streamable values
    2009-07-20 15:33:15 +0200 cmc  r274144 : #i103663 clear low-hanging aliasing warnings
    2009-07-20 15:28:23 +0200 cmc  r274143 : #i103662 clear low-hanging aliasing warnings
    2009-07-20 15:21:46 +0200 cmc  r274142 : #i103661 clear low-hanging aliasing warnings
    2009-07-20 15:16:05 +0200 cmc  r274141 : #i103660 clear low-hanging aliasing warnings

diff --git a/svx/inc/svx/svdpntv.hxx b/svx/inc/svx/svdpntv.hxx
index d6eca83..d9af2ff 100644
--- a/svx/inc/svx/svdpntv.hxx
+++ b/svx/inc/svx/svdpntv.hxx
@@ -320,8 +320,8 @@ public:
     USHORT GetHitTolerancePixel() const { return (USHORT)nHitTolPix; }
 
     // data read access on logic HitTolerance and MinMoveTolerance
-    const USHORT getHitTolLog() const { return nHitTolLog; }
-    const USHORT getMinMovLog() const { return nMinMovLog; }
+    USHORT getHitTolLog() const { return nHitTolLog; }
+    USHORT getMinMovLog() const { return nMinMovLog; }
 
     // Flag zur Visualisierung von Gruppen abfragen/testen
     BOOL DoVisualizeEnteredGroup() const { return bVisualizeEnteredGroup; }
diff --git a/svx/inc/svx/xcolit.hxx b/svx/inc/svx/xcolit.hxx
index 2c36e77..f1bc9f0 100644
--- a/svx/inc/svx/xcolit.hxx
+++ b/svx/inc/svx/xcolit.hxx
@@ -48,7 +48,7 @@ class SVX_DLLPUBLIC XColorItem : public NameOrIndex
 public:
             TYPEINFO();
             XColorItem() {}
-            XColorItem(USHORT nWhich, long nIndex, const Color& rTheColor);
+            XColorItem(USHORT nWhich, INT32 nIndex, const Color& rTheColor);
 
     virtual	sal_Bool        	 QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const;
     virtual	sal_Bool			 PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 );
diff --git a/svx/inc/svx/xflclit.hxx b/svx/inc/svx/xflclit.hxx
index a913899..c579b66 100644
--- a/svx/inc/svx/xflclit.hxx
+++ b/svx/inc/svx/xflclit.hxx
@@ -46,7 +46,7 @@ class SVX_DLLPUBLIC XFillColorItem : public XColorItem
 public:
             TYPEINFO();
             XFillColorItem() {}
-            XFillColorItem(long nIndex, const Color& rTheColor);
+            XFillColorItem(INT32 nIndex, const Color& rTheColor);
             XFillColorItem(const String& rName, const Color& rTheColor);
             XFillColorItem(SvStream& rIn);
 
diff --git a/svx/inc/svx/xflftrit.hxx b/svx/inc/svx/xflftrit.hxx
index abac4dc..9737cf3 100644
--- a/svx/inc/svx/xflftrit.hxx
+++ b/svx/inc/svx/xflftrit.hxx
@@ -50,7 +50,7 @@ public:
                             TYPEINFO();
 
                             XFillFloatTransparenceItem();
-                            XFillFloatTransparenceItem( long nIndex, const XGradient& rGradient, BOOL bEnable = TRUE );
+                            XFillFloatTransparenceItem( INT32 nIndex, const XGradient& rGradient, BOOL bEnable = TRUE );
                             XFillFloatTransparenceItem(const String& rName, const XGradient& rGradient, BOOL bEnable = TRUE );
                             XFillFloatTransparenceItem(SfxItemPool* pPool, const XGradient& rTheGradient, BOOL bEnable = TRUE );
                             XFillFloatTransparenceItem(SfxItemPool* pPool );
diff --git a/svx/inc/svx/xflgrit.hxx b/svx/inc/svx/xflgrit.hxx
index be4da4c..cf1bdca 100644
--- a/svx/inc/svx/xflgrit.hxx
+++ b/svx/inc/svx/xflgrit.hxx
@@ -47,7 +47,7 @@ class SVX_DLLPUBLIC XFillGradientItem : public NameOrIndex
 public:
             TYPEINFO();
             XFillGradientItem() : NameOrIndex(XATTR_FILLGRADIENT, -1) {}
-            XFillGradientItem(long nIndex, const XGradient& rTheGradient);
+            XFillGradientItem(INT32 nIndex, const XGradient& rTheGradient);
             XFillGradientItem(const UniString& rName, const XGradient& rTheGradient);
             XFillGradientItem(SfxItemPool* pPool, const XGradient& rTheGradient);
             XFillGradientItem(SfxItemPool* pPool );
diff --git a/svx/inc/svx/xflhtit.hxx b/svx/inc/svx/xflhtit.hxx
index a67fa8e..4f6ffef 100644
--- a/svx/inc/svx/xflhtit.hxx
+++ b/svx/inc/svx/xflhtit.hxx
@@ -47,7 +47,7 @@ class SVX_DLLPUBLIC XFillHatchItem : public NameOrIndex
 public:
                             TYPEINFO();
                             XFillHatchItem() : NameOrIndex(XATTR_FILLHATCH, -1) {}
-                            XFillHatchItem(long nIndex, const XHatch& rTheHatch);
+                            XFillHatchItem(INT32 nIndex, const XHatch& rTheHatch);
                             XFillHatchItem(const String& rName, const XHatch& rTheHatch);
                             XFillHatchItem(SfxItemPool* pPool, const XHatch& rTheHatch);
                             XFillHatchItem(SfxItemPool* pPool );
diff --git a/svx/inc/svx/xftshcit.hxx b/svx/inc/svx/xftshcit.hxx
index 353a022..f05319f 100644
--- a/svx/inc/svx/xftshcit.hxx
+++ b/svx/inc/svx/xftshcit.hxx
@@ -45,7 +45,7 @@ class SVX_DLLPUBLIC XFormTextShadowColorItem : public XColorItem
 public:
             TYPEINFO();
             XFormTextShadowColorItem() {}
-            XFormTextShadowColorItem(long nIndex, const Color& rTheColor);
+            XFormTextShadowColorItem(INT32 nIndex, const Color& rTheColor);
             XFormTextShadowColorItem(const String& rName, const Color& rTheColor);
             XFormTextShadowColorItem(SvStream& rIn);
 
diff --git a/svx/inc/svx/xit.hxx b/svx/inc/svx/xit.hxx
index c175469..35b7855 100644
--- a/svx/inc/svx/xit.hxx
+++ b/svx/inc/svx/xit.hxx
@@ -54,7 +54,7 @@ typedef BOOL (*SvxCompareValueFunc)( const NameOrIndex* p1, const NameOrIndex* p
 //-------------------
 class SVX_DLLPUBLIC NameOrIndex : public SfxStringItem
 {
-    long    nPalIndex;
+    INT32    nPalIndex;
 
 protected:
     void    Detach()    { nPalIndex = -1; }
@@ -62,7 +62,7 @@ protected:
 public:
             TYPEINFO();
             NameOrIndex() { nPalIndex = -1; }
-            NameOrIndex(USHORT nWhich, long nIndex);
+            NameOrIndex(USHORT nWhich, INT32 nIndex);
             NameOrIndex(USHORT nWhich,
                         const String& rName= String());
             NameOrIndex(USHORT nWhich, SvStream& rIn);
@@ -76,8 +76,8 @@ public:
 
             String       GetName() const              { return GetValue();   }
             void         SetName(const String& rName) { SetValue(rName);     }
-            long         GetIndex() const             { return nPalIndex;    }
-            void         SetIndex(long nIndex)        { nPalIndex = nIndex;  }
+            INT32        GetIndex() const             { return nPalIndex;    }
+            void         SetIndex(INT32 nIndex)        { nPalIndex = nIndex;  }
             BOOL         IsIndex() const          { return (nPalIndex >= 0); }
 
     /** this static checks if the given NameOrIndex item has a unique name for its value.
diff --git a/svx/inc/svx/xlnclit.hxx b/svx/inc/svx/xlnclit.hxx
index b935781..be073ff 100644
--- a/svx/inc/svx/xlnclit.hxx
+++ b/svx/inc/svx/xlnclit.hxx
@@ -42,7 +42,7 @@ class SVX_DLLPUBLIC XLineColorItem : public XColorItem
 public:
             TYPEINFO();
             XLineColorItem() {}
-            XLineColorItem(long nIndex, const Color& rTheColor);
+            XLineColorItem(INT32 nIndex, const Color& rTheColor);
             XLineColorItem(const String& rName, const Color& rTheColor);
             XLineColorItem(SvStream& rIn);
 
diff --git a/svx/inc/svx/xlndsit.hxx b/svx/inc/svx/xlndsit.hxx
index cabb050..a39e078 100644
--- a/svx/inc/svx/xlndsit.hxx
+++ b/svx/inc/svx/xlndsit.hxx
@@ -50,7 +50,7 @@ class SVX_DLLPUBLIC XLineDashItem : public NameOrIndex
 public:
                             TYPEINFO();
                             XLineDashItem() : NameOrIndex(XATTR_LINEDASH, -1) {}
-                            XLineDashItem(long nIndex, const XDash& rTheDash);
+                            XLineDashItem(INT32 nIndex, const XDash& rTheDash);
                             XLineDashItem(const String& rName, const XDash& rTheDash);
                             XLineDashItem(SfxItemPool* pPool, const XDash& rTheDash);
                             XLineDashItem(SfxItemPool* pPool );
diff --git a/svx/inc/svx/xlnedit.hxx b/svx/inc/svx/xlnedit.hxx
index 5d9b265..a0ec1ab 100644
--- a/svx/inc/svx/xlnedit.hxx
+++ b/svx/inc/svx/xlnedit.hxx
@@ -46,7 +46,7 @@ class SVX_DLLPUBLIC XLineEndItem : public NameOrIndex
 
 public:
             TYPEINFO();
-            XLineEndItem(long nIndex = -1);
+            XLineEndItem(INT32 nIndex = -1);
             XLineEndItem(const String& rName, const basegfx::B2DPolyPolygon& rPolyPolygon);
             XLineEndItem(SfxItemPool* pPool, const basegfx::B2DPolyPolygon& rPolyPolygon);
             XLineEndItem(SfxItemPool* pPool );
diff --git a/svx/inc/svx/xlnstit.hxx b/svx/inc/svx/xlnstit.hxx
index 3068687..24475fc 100644
--- a/svx/inc/svx/xlnstit.hxx
+++ b/svx/inc/svx/xlnstit.hxx
@@ -46,7 +46,7 @@ class SVX_DLLPUBLIC XLineStartItem : public NameOrIndex
 
 public:
             TYPEINFO();
-            XLineStartItem(long nIndex = -1);
+            XLineStartItem(INT32 nIndex = -1);
             XLineStartItem(const String& rName, const basegfx::B2DPolyPolygon& rPolyPolygon);
             XLineStartItem(SfxItemPool* pPool, const basegfx::B2DPolyPolygon& rPolyPolygon);
             XLineStartItem(SfxItemPool* pPool );
diff --git a/svx/inc/svx/xsflclit.hxx b/svx/inc/svx/xsflclit.hxx
index b543913..f8bf2fe 100644
--- a/svx/inc/svx/xsflclit.hxx
+++ b/svx/inc/svx/xsflclit.hxx
@@ -41,7 +41,7 @@ class XSecondaryFillColorItem : public XColorItem
 public:
             TYPEINFO();
             XSecondaryFillColorItem() {}
-            XSecondaryFillColorItem(long nIndex, const Color& rTheColor);
+            XSecondaryFillColorItem(INT32 nIndex, const Color& rTheColor);
             XSecondaryFillColorItem(const String& rName, const Color& rTheColor);
             XSecondaryFillColorItem(SvStream& rIn);
 
diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx
index c330524..2d3b9d3 100644
--- a/svx/source/dialog/dlgctrl.cxx
+++ b/svx/source/dialog/dlgctrl.cxx
@@ -173,24 +173,22 @@ void SvxRectCtl::InitRectBitmap( void )
     pBitmap = new Bitmap( SVX_RES( RID_SVXCTRL_RECTBTNS ) );
 
     // set bitmap-colors
-    long	aTempAry1[(7*sizeof(Color))/sizeof(long)];
-    long	aTempAry2[(7*sizeof(Color))/sizeof(long)];
-    Color*	pColorAry1 = (Color*)aTempAry1;
-    Color*	pColorAry2 = (Color*)aTempAry2;
-    pColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 );	// light-gray
-    pColorAry1[1] = Color( 0xFF, 0xFF, 0x00 );	// yellow
-    pColorAry1[2] = Color( 0xFF, 0xFF, 0xFF );	// white
-    pColorAry1[3] = Color( 0x80, 0x80, 0x80 );	// dark-gray
-    pColorAry1[4] = Color( 0x00, 0x00, 0x00 );  // black
-    pColorAry1[5] = Color( 0x00, 0xFF, 0x00 );	// green
-    pColorAry1[6] = Color( 0x00, 0x00, 0xFF );	// blue
-    pColorAry2[0] = rStyles.GetDialogColor();		// background
-    pColorAry2[1] = rStyles.GetWindowColor();
-    pColorAry2[2] = rStyles.GetLightColor();
-    pColorAry2[3] = rStyles.GetShadowColor();
-    pColorAry2[4] = rStyles.GetDarkShadowColor();
-    pColorAry2[5] = Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
-    pColorAry2[6] = rStyles.GetDialogColor();
+    Color	aColorAry1[7];
+    Color	aColorAry2[7];
+    aColorAry1[0] = Color( 0xC0, 0xC0, 0xC0 );	// light-gray
+    aColorAry1[1] = Color( 0xFF, 0xFF, 0x00 );	// yellow
+    aColorAry1[2] = Color( 0xFF, 0xFF, 0xFF );	// white
+    aColorAry1[3] = Color( 0x80, 0x80, 0x80 );	// dark-gray
+    aColorAry1[4] = Color( 0x00, 0x00, 0x00 );  // black
+    aColorAry1[5] = Color( 0x00, 0xFF, 0x00 );	// green
+    aColorAry1[6] = Color( 0x00, 0x00, 0xFF );	// blue
+    aColorAry2[0] = rStyles.GetDialogColor();		// background
+    aColorAry2[1] = rStyles.GetWindowColor();
+    aColorAry2[2] = rStyles.GetLightColor();
+    aColorAry2[3] = rStyles.GetShadowColor();
+    aColorAry2[4] = rStyles.GetDarkShadowColor();
+    aColorAry2[5] = Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
+    aColorAry2[6] = rStyles.GetDialogColor();
 
 #ifdef DBG_UTIL
     static BOOL		bModify = FALSE;
@@ -205,11 +203,11 @@ void SvxRectCtl::InitRectBitmap( void )
         UINT8&			rr = r;
         UINT8&			rg = g;
         UINT8&			rb = b;
-        pColorAry2[ rn ] = Color( rr, rg, rb );
+        aColorAry2[ rn ] = Color( rr, rg, rb );
     }
 #endif
 
-    pBitmap->Replace( pColorAry1, pColorAry2, 7, NULL );
+    pBitmap->Replace( aColorAry1, aColorAry2, 7, NULL );
 }
 
 // -----------------------------------------------------------------------
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index dca95ac..1e52788 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -66,6 +66,8 @@
 #include <basegfx/point/b2dpoint.hxx>
 #include <basegfx/vector/b2dvector.hxx>
 
+#include <stdio.h>
+
 using namespace ::rtl;
 using namespace ::com::sun::star;
 
@@ -108,7 +110,7 @@ long ScaleMetricValue( long nVal, long nMul, long nDiv )
 
 /*************************************************************************
 |*
-|*	  NameOrIndex::NameOrIndex(USHORT nWhich, long nIndex)
+|*	  NameOrIndex::NameOrIndex(USHORT nWhich, INT32 nIndex)
 |*
 |*	  Beschreibung
 |*	  Ersterstellung	14.11.94
@@ -116,7 +118,7 @@ long ScaleMetricValue( long nVal, long nMul, long nDiv )
 |*
 *************************************************************************/
 
-NameOrIndex::NameOrIndex(USHORT _nWhich, long nIndex) :
+NameOrIndex::NameOrIndex(USHORT _nWhich, INT32 nIndex) :
     SfxStringItem(_nWhich, aNameOrIndexEmptyString),
     nPalIndex(nIndex)
 {
@@ -134,7 +136,7 @@ NameOrIndex::NameOrIndex(USHORT _nWhich, long nIndex) :
 
 NameOrIndex::NameOrIndex(USHORT _nWhich, const XubString& rName) :
     SfxStringItem(_nWhich, rName),
-    nPalIndex((long)-1)
+    nPalIndex(-1)
 {
 }
 
@@ -230,7 +232,7 @@ SfxPoolItem* NameOrIndex::Create(SvStream& rIn, USHORT /*nVer*/) const
 SvStream& NameOrIndex::Store( SvStream& rOut, USHORT nItemVersion ) const
 {
     SfxStringItem::Store( rOut, nItemVersion );
-    rOut << (INT32)nPalIndex;
+    rOut << nPalIndex;
     return rOut;
 }
 
@@ -369,11 +371,11 @@ TYPEINIT1_AUTOFACTORY(XColorItem, NameOrIndex);
 
 /*************************************************************************
 |*
-|*	  XColorItem::XColorItem(USHORT nWhich, long nIndex, const Color& rTheColor)
+|*	  XColorItem::XColorItem(USHORT nWhich, INT32 nIndex, const Color& rTheColor)
 |*
 \************************************************************************/
 
-XColorItem::XColorItem(USHORT _nWhich, long nIndex, const Color& rTheColor) :
+XColorItem::XColorItem(USHORT _nWhich, INT32 nIndex, const Color& rTheColor) :
     NameOrIndex(_nWhich, nIndex),
     aColor(rTheColor)
 {
@@ -884,7 +886,7 @@ TYPEINIT1_AUTOFACTORY(XLineDashItem, NameOrIndex);
 
 /*************************************************************************
 |*
-|*	  XLineDashItem::XLineDashItem(long nIndex, const XDash& rTheDash)
+|*	  XLineDashItem::XLineDashItem(INT32 nIndex, const XDash& rTheDash)
 |*
 |*	  Beschreibung
 |*	  Ersterstellung	15.11.94
@@ -892,7 +894,7 @@ TYPEINIT1_AUTOFACTORY(XLineDashItem, NameOrIndex);
 |*
 *************************************************************************/
 
-XLineDashItem::XLineDashItem(long nIndex, const XDash& rTheDash) :
+XLineDashItem::XLineDashItem(INT32 nIndex, const XDash& rTheDash) :
     NameOrIndex(XATTR_LINEDASH, nIndex),
     aDash(rTheDash)
 {
@@ -1501,7 +1503,7 @@ TYPEINIT1_AUTOFACTORY(XLineColorItem, XColorItem);
 
 /*************************************************************************
 |*
-|*	  XLineColorItem::XLineColorItem(long nIndex, const Color& rTheColor)
+|*	  XLineColorItem::XLineColorItem(INT32 nIndex, const Color& rTheColor)
 |*
 |*	  Beschreibung
 |*	  Ersterstellung	15.11.94
@@ -1509,7 +1511,7 @@ TYPEINIT1_AUTOFACTORY(XLineColorItem, XColorItem);
 |*
 *************************************************************************/
 
-XLineColorItem::XLineColorItem(long nIndex, const Color& rTheColor) :
+XLineColorItem::XLineColorItem(INT32 nIndex, const Color& rTheColor) :
     XColorItem(XATTR_LINECOLOR, nIndex, rTheColor)
 {
 }
@@ -1720,7 +1722,7 @@ TYPEINIT1_AUTOFACTORY(XLineStartItem, NameOrIndex);
 
 /*************************************************************************
 |*
-|*	  XLineStartItem::XLineStartItem(long nIndex)
+|*	  XLineStartItem::XLineStartItem(INT32 nIndex)
 |*
 |*	  Beschreibung
 |*	  Ersterstellung	15.11.94
@@ -1728,7 +1730,7 @@ TYPEINIT1_AUTOFACTORY(XLineStartItem, NameOrIndex);
 |*
 *************************************************************************/
 
-XLineStartItem::XLineStartItem(long nIndex) 
+XLineStartItem::XLineStartItem(INT32 nIndex) 
 :	NameOrIndex(XATTR_LINESTART, nIndex)
 {
 }
@@ -2192,7 +2194,7 @@ TYPEINIT1_AUTOFACTORY(XLineEndItem, NameOrIndex);
 
 /*************************************************************************
 |*
-|*	  XLineEndItem::XLineEndItem(long nIndex)
+|*	  XLineEndItem::XLineEndItem(INT32 nIndex)
 |*
 |*	  Beschreibung
 |*	  Ersterstellung	15.11.94
@@ -2200,7 +2202,7 @@ TYPEINIT1_AUTOFACTORY(XLineEndItem, NameOrIndex);
 |*
 *************************************************************************/
 
-XLineEndItem::XLineEndItem(long nIndex) 
+XLineEndItem::XLineEndItem(INT32 nIndex) 
 :	NameOrIndex(XATTR_LINEEND, nIndex)
 {
 }
@@ -2664,7 +2666,7 @@ TYPEINIT1_AUTOFACTORY(XLineStartWidthItem, SfxMetricItem);
 
 /*************************************************************************
 |*
-|*	  XLineStartWidthItem::XLineStartWidthItem(long nWidth)
+|*	  XLineStartWidthItem::XLineStartWidthItem(INT32 nWidth)
 |*
 |*	  Beschreibung
 |*	  Ersterstellung	15.11.94
@@ -3249,7 +3251,7 @@ TYPEINIT1_AUTOFACTORY(XFillColorItem, XColorItem);
 
 /*************************************************************************
 |*
-|*	  XFillColorItem::XFillColorItem(long nIndex, const Color& rTheColor)
+|*	  XFillColorItem::XFillColorItem(INT32 nIndex, const Color& rTheColor)
 |*
 |*	  Beschreibung
 |*	  Ersterstellung	15.11.94
@@ -3257,7 +3259,7 @@ TYPEINIT1_AUTOFACTORY(XFillColorItem, XColorItem);
 |*
 *************************************************************************/
 
-XFillColorItem::XFillColorItem(long nIndex, const Color& rTheColor) :
+XFillColorItem::XFillColorItem(INT32 nIndex, const Color& rTheColor) :
     XColorItem(XATTR_FILLCOLOR, nIndex, rTheColor)
 {
 }
@@ -3372,7 +3374,7 @@ sal_Bool XFillColorItem::PutValue( const ::com::sun::star::uno::Any& rVal, BYTE
 // -----------------------------
 TYPEINIT1_AUTOFACTORY(XSecondaryFillColorItem, XColorItem);
 
-XSecondaryFillColorItem::XSecondaryFillColorItem(long nIndex, const Color& rTheColor) :
+XSecondaryFillColorItem::XSecondaryFillColorItem(INT32 nIndex, const Color& rTheColor) :
     XColorItem(XATTR_SECONDARYFILLCOLOR, nIndex, rTheColor)
 {
 }
@@ -3510,7 +3512,7 @@ TYPEINIT1_AUTOFACTORY(XFillGradientItem, NameOrIndex);
 
 /*************************************************************************
 |*
-|*	  XFillGradientItem::XFillGradientItem(long nIndex,
+|*	  XFillGradientItem::XFillGradientItem(INT32 nIndex,
 |*										 const XGradient& rTheGradient)
 |*
 |*	  Beschreibung
@@ -3519,7 +3521,7 @@ TYPEINIT1_AUTOFACTORY(XFillGradientItem, NameOrIndex);
 |*
 *************************************************************************/
 
-XFillGradientItem::XFillGradientItem(long nIndex,
+XFillGradientItem::XFillGradientItem(INT32 nIndex,
                                    const XGradient& rTheGradient) :
     NameOrIndex(XATTR_FILLGRADIENT, nIndex),
     aGradient(rTheGradient)
@@ -4042,7 +4044,7 @@ XFillFloatTransparenceItem::XFillFloatTransparenceItem() :
 
 //------------------------------------------------------------------------
 
-XFillFloatTransparenceItem::XFillFloatTransparenceItem( long nIndex, const XGradient& rGradient, BOOL bEnable ) :
+XFillFloatTransparenceItem::XFillFloatTransparenceItem( INT32 nIndex, const XGradient& rGradient, BOOL bEnable ) :
     XFillGradientItem	( nIndex, rGradient ),
     bEnabled			( bEnable )
 {
@@ -4246,7 +4248,7 @@ TYPEINIT1_AUTOFACTORY(XFillHatchItem, NameOrIndex);
 
 /*************************************************************************
 |*
-|*	  XFillHatchItem::XFillHatchItem(long nIndex,
+|*	  XFillHatchItem::XFillHatchItem(INT32 nIndex,
 |*								   const XHatch& rTheHatch)
 |*
 |*	  Beschreibung
@@ -4255,7 +4257,7 @@ TYPEINIT1_AUTOFACTORY(XFillHatchItem, NameOrIndex);
 |*
 *************************************************************************/
 
-XFillHatchItem::XFillHatchItem(long nIndex,
+XFillHatchItem::XFillHatchItem(INT32 nIndex,
                              const XHatch& rTheHatch) :
     NameOrIndex(XATTR_FILLHATCH, nIndex),
     aHatch(rTheHatch)
@@ -5258,7 +5260,7 @@ TYPEINIT1_AUTOFACTORY(XFormTextShadowColorItem, XColorItem);
 |*
 *************************************************************************/
 
-XFormTextShadowColorItem::XFormTextShadowColorItem(long nIndex,
+XFormTextShadowColorItem::XFormTextShadowColorItem(INT32 nIndex,
                                                      const Color& rTheColor) :
     XColorItem(XATTR_FORMTXTSHDWCOLOR, nIndex, rTheColor)
 {
commit 68683aee7be3e449032f71b0b9e90338f3a87fc9
Author: Jens-Heiner Rechtien <hr at openoffice.org>
Date:   Wed Jul 29 14:46:52 2009 +0000

    CWS-TOOLING: integrate CWS dr71
    2009-07-07 16:26:00 +0200 dr  r273805 : #i10000# unused variables
    2009-07-07 10:27:14 +0200 dr  r273780 : CWS-TOOLING: rebase CWS dr71 to trunk at 273468 (milestone: DEV300:m51)
    2009-07-01 11:28:24 +0200 dr  r273559 : #101471# special handling for XL library functions in ODF formulas (EUROCONVERT)
    2009-06-29 17:48:46 +0200 dr  r273478 : #i101471# typo
    2009-06-29 17:35:16 +0200 dr  r273477 : #i101471# import msoxl: formulas from conditional formatting and data validation
    2009-06-18 13:45:17 +0200 dr  r273115 : #101471# changed interface css.sheet.XFormulaParser
    2009-06-18 13:44:43 +0200 dr  r273114 : #101471# changed interface css.sheet.XFormulaParser
    2009-06-17 17:29:23 +0200 dr  r273089 : #i101471# extend the XFormulaParser interface with a ReferencePosition parameter, make rel-refs from msoxl: namespace working
    2009-06-17 17:28:39 +0200 dr  r273088 : #i101471# extend the XFormulaParser interface with a ReferencePosition parameter
    2009-06-17 17:28:19 +0200 dr  r273087 : #i101471# extend the XFormulaParser interface with a ReferencePosition parameter
    2009-06-17 17:27:19 +0200 dr  r273086 : #i101471# extend the XFormulaParser interface with a ReferencePosition parameter, remove that property from FormulaParser service
    2009-06-17 12:52:20 +0200 dr  r273059 : #i101471# import cell formulas from msoxl: namespace
    2009-06-16 11:40:50 +0200 dr  r273013 : #i101471# import formula namespace from xml elements
    2009-06-12 18:34:13 +0200 dr  r272935 : #i101471# external formula parser for oox in odf
    2009-06-12 18:33:13 +0200 dr  r272934 : #i101471# external formula parsers
    2009-06-12 18:29:46 +0200 dr  r272933 : #i101471# external formula parsers
    2009-06-05 15:53:47 +0200 dr  r272705 : #i101471# provide OOX formula parser as UNO service

diff --git a/formula/inc/formula/IFunctionDescription.hxx b/formula/inc/formula/IFunctionDescription.hxx
index 2ed4b70..90f736b 100644
--- a/formula/inc/formula/IFunctionDescription.hxx
+++ b/formula/inc/formula/IFunctionDescription.hxx
@@ -1,7 +1,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2008 by Sun Microsystems, Inc.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -143,7 +143,7 @@ namespace formula
         virtual bool calculateValue(const String& _sExpression,String& _rResult) = 0;
 
         virtual void switchBack() = 0;
-        
+
         virtual void clear() = 0;
         virtual void deleteFormData() = 0;
         virtual void setReferenceInput(const FormEditData* _pData) = 0;
@@ -153,6 +153,7 @@ namespace formula
 
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const = 0;
         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const = 0;
+        virtual ::com::sun::star::table::CellAddress getReferencePosition() const = 0;
 
         virtual void setDispatcherLock( BOOL bLock ) = 0;
         virtual void dispatch(BOOL _bOK,BOOL _bMartixChecked) = 0;
diff --git a/formula/source/ui/dlg/formula.cxx b/formula/source/ui/dlg/formula.cxx
index 86bb6dc..f886998 100644
--- a/formula/source/ui/dlg/formula.cxx
+++ b/formula/source/ui/dlg/formula.cxx
@@ -1,7 +1,7 @@
 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2008 by Sun Microsystems, Inc.
  *
  * OpenOffice.org - a multi-platform office productivity suite
@@ -66,7 +66,7 @@
 #include "formula/formulahelper.hxx"
 #include "structpg.hxx"
 #include "parawin.hxx"
-#include "ModuleHelper.hxx" 
+#include "ModuleHelper.hxx"
 #include "ForResId.hrc"
 #include <com/sun/star/sheet/FormulaToken.hpp>
 #include <com/sun/star/sheet/FormulaLanguage.hpp>
@@ -88,7 +88,7 @@ namespace formula
     {
         sal_Int32   m_nParaCount;
         bool        m_bIsFunction;
-        
+
     public:
         OFormulaToken(bool _bFunction,sal_Int32 _nParaCount) : m_nParaCount(_nParaCount),m_bIsFunction(_bFunction){}
 
@@ -110,7 +110,7 @@ namespace formula
         void			DeleteArgs();
         xub_StrLen      GetFunctionPos(xub_StrLen nPos);
         void			ClearAllParas();
-        
+
         void            MakeTree(IStructHelper* _pTree,SvLBoxEntry* pParent,FormulaToken* _pToken,long Count);
         void            fillTree(IStructHelper* _pTree);
         void            UpdateTokenArray( const String& rStrExp);
@@ -124,7 +124,7 @@ namespace formula
         void			UpdateArgInput( USHORT nOffset, USHORT nInput );
         void			Update();
         void            Update(const String& _sExp);
-        
+
 
         void			SaveArg( USHORT nEd );
         void			UpdateSelection();
@@ -227,7 +227,7 @@ namespace formula
         const String	aTitle2;
         const String	aTxtEnd;
         const String	aTxtOk;		// hinter aBtnEnd
-        FormulaHelper    
+        FormulaHelper
                         m_aFormulaHelper;
 
         SmartId         m_aSmartEditHelpId;
@@ -311,7 +311,7 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
     nArgs			(0)
 {
     pParaWin = new ParaWin( pParent,_pDlg, aGEdit.GetPosPixel());
-    aGEdit.Hide();    
+    aGEdit.Hide();
     pParaWin->Hide();
     aFtEditName.Hide();
     aEdRef.Hide();
@@ -320,7 +320,7 @@ FormulaDlg_Impl::FormulaDlg_Impl(Dialog* pParent
     pMEdit = aMEFormula.GetEdit();
     m_aSmartEditHelpId = pMEdit->GetSmartHelpId();
     pMEdit->SetSmartUniqueId(m_aSmartEditHelpId);
-    
+
     bEditFlag=FALSE;
     bStructUpdate=TRUE;
     Point aPos=aGEdit.GetPosPixel();
@@ -427,7 +427,7 @@ void FormulaDlg_Impl::PreNotify( NotifyEvent& rNEvt )
             }
             if(nActivWinId!=0)
             {
-                
+
                 FormEditData* pData = m_pHelper->getFormEditData();
 
                 if (pData && !aTimer.IsActive()) // wird nicht ueber Close zerstoert;
@@ -469,7 +469,7 @@ void FormulaDlg_Impl::DeleteArgs()
     ::std::vector< ::rtl::OUString>().swap(m_aArguments);
     nArgs = 0;
 }
-namespace 
+namespace
 {
     // comparing two property instances
     struct OpCodeCompare : public ::std::binary_function< sheet::FormulaOpCodeMapEntry, sal_Int32 , bool >
@@ -497,6 +497,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
     if ( m_aTokenList.getLength() )
     {
         const uno::Reference< sheet::XFormulaParser > xParser(m_pHelper->getFormulaParser());
+        const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
 
         const sheet::FormulaToken* pIter = m_aTokenList.getConstArray();
         const sheet::FormulaToken* pEnd = pIter + m_aTokenList.getLength();
@@ -509,7 +510,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
                 const sal_Int32 eOp = pIter->OpCode;
                 uno::Sequence<sheet::FormulaToken> aArgs(1);
                 aArgs[0] = *pIter;
-                const String aString = xParser->printFormula(aArgs);
+                const String aString = xParser->printFormula(aArgs, aRefPos);
                 const sheet::FormulaToken* pNextToken = pIter + 1;
 
                 if(!bUserMatrixFlag && FormulaCompiler::IsMatrixFunction((OpCode)eOp) )
@@ -533,7 +534,7 @@ xub_StrLen FormulaDlg_Impl::GetFunctionPos(xub_StrLen nPos)
                     if ( pNextToken != pEnd )
                     {
                         aArgs[0] = *pNextToken;
-                        const String a2String = xParser->printFormula(aArgs);
+                        const String a2String = xParser->printFormula(aArgs, aRefPos);
                         const xub_StrLen n3 = aFormString.Search(a2String,nXXX);
                         if ( n3 < nTokPos )
                             nTokPos = n3;
@@ -681,7 +682,8 @@ void FormulaDlg_Impl::MakeTree(IStructHelper* _pTree,SvLBoxEntry* pParent,Formul
         aArgs[0] = m_aTokenMap.find(pOrigToken)->second;
         try
         {
-            const String aResult = m_pHelper->getFormulaParser()->printFormula(aArgs);
+            const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
+            const String aResult = m_pHelper->getFormulaParser()->printFormula(aArgs, aRefPos);
 
             if ( nParas > 0 )
             {
@@ -749,7 +751,8 @@ void FormulaDlg_Impl::UpdateTokenArray( const String& rStrExp)
     m_aTokenList.realloc(0);
     try
     {
-        m_aTokenList = m_pHelper->getFormulaParser()->parseFormula(rStrExp);
+        const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
+        m_aTokenList = m_pHelper->getFormulaParser()->parseFormula(rStrExp, aRefPos);
     }
     catch(const uno::Exception&)
     {
@@ -820,7 +823,7 @@ void FormulaDlg_Impl::FillListboxes()
 
     //	ResizeArgArr jetzt schon in UpdateFunctionDesc
 
-    
+
     m_pHelper->setDispatcherLock( TRUE);// Modal-Modus einschalten
 
     aNewTitle = aTitle1;
@@ -962,12 +965,13 @@ String FormulaDlg_Impl::RepairFormula(const String& aFormula)
 
         if ( m_aTokenList.getLength() )
         {
-            const String sFormula(m_pHelper->getFormulaParser()->printFormula(m_aTokenList));
+            const table::CellAddress aRefPos(m_pHelper->getReferencePosition());
+            const String sFormula(m_pHelper->getFormulaParser()->printFormula(m_aTokenList, aRefPos));
             if ( !sFormula.Len() || sFormula.GetChar(0) != '=' )
                 aResult += sFormula;
             else
                 aResult = sFormula;
-      
+
         }
     }
     catch(const uno::Exception& )
@@ -994,7 +998,7 @@ void FormulaDlg_Impl::DoEnter(BOOL bOk)
     m_pHelper->dispatch(bOk,aBtnMatrix.IsChecked());
     //	Daten loeschen
     m_pHelper->deleteFormData();
-    
+
     //	Dialog schliessen
     m_pHelper->doClose(bOk);
 }
@@ -1060,14 +1064,14 @@ void FormulaDlg_Impl::ResizeArgArr( const IFunctionDescription* pNewFunc )
 void FormulaDlg_Impl::UpdateFunctionDesc()
 {
     FormEditData* pData = m_pHelper->getFormEditData();
-    if (!pData) 
+    if (!pData)
         return;
     USHORT nCat = pFuncPage->GetCategory();
-    if ( nCat == LISTBOX_ENTRY_NOTFOUND ) 
+    if ( nCat == LISTBOX_ENTRY_NOTFOUND )
         nCat = 0;
     pData->SetCatSel( nCat );
     USHORT nFunc = pFuncPage->GetFunction();
-    if ( nFunc == LISTBOX_ENTRY_NOTFOUND ) 
+    if ( nFunc == LISTBOX_ENTRY_NOTFOUND )
         nFunc = 0;
     pData->SetFuncSel( nFunc );
 
@@ -1150,7 +1154,7 @@ void FormulaDlg_Impl::SetData(xub_StrLen nFStart,xub_StrLen nNextFStart,xub_StrL
     if(!bEditFlag)
         pMEdit->SetText(m_pHelper->getCurrentFormula());
 
-    
+
     m_pHelper->getSelection( PrivStart, PrivEnd);
     if(!bEditFlag)
     {
@@ -1167,7 +1171,7 @@ void FormulaDlg_Impl::SetData(xub_StrLen nFStart,xub_StrLen nNextFStart,xub_StrL
 }
 // -----------------------------------------------------------------------------
 void FormulaDlg_Impl::EditThisFunc(xub_StrLen nFStart)
-{	
+{
     FormEditData* pData = m_pHelper->getFormEditData();
     if (!pData) return;
 
@@ -1205,7 +1209,7 @@ void FormulaDlg_Impl::EditThisFunc(xub_StrLen nFStart)
 void FormulaDlg_Impl::EditNextFunc( BOOL bForward, xub_StrLen nFStart )
 {
     FormEditData* pData = m_pHelper->getFormEditData();
-    if (!pData) 
+    if (!pData)
         return;
 
     String aFormula = m_pHelper->getCurrentFormula();
@@ -1324,7 +1328,7 @@ IMPL_LINK( FormulaDlg_Impl, FxHdl, ParaWin*, pPtr )
     {
         aBtnForward.Enable(TRUE); //@ Damit eine neue Fkt eingegeben werden kann.
         aTabCtrl.SetCurPageId(TP_FUNCTION);
-        
+
         String aUndoStr = m_pHelper->getCurrentFormula();		// bevor unten ein ";" eingefuegt wird
         FormEditData* pData = m_pHelper->getFormEditData();
         if (!pData) return 0;
@@ -1368,7 +1372,7 @@ IMPL_LINK( FormulaDlg_Impl, ModifyHdl, ParaWin*, pPtr )
 
 IMPL_LINK( FormulaDlg_Impl, FormulaHdl, MultiLineEdit*, EMPTYARG )
 {
-    
+
     FormEditData* pData = m_pHelper->getFormEditData();
     if (!pData) return 0;
 
@@ -1951,7 +1955,7 @@ void FormulaModalDialog::SetFocusWin(Window *pWin,ULONG nUniqueId)
 long FormulaModalDialog::PreNotify( NotifyEvent& rNEvt )
 {
     m_pImpl->PreNotify( rNEvt );
-    
+
     return ModalDialog::PreNotify(rNEvt);
 }
 


More information about the ooo-build-commit mailing list