From 7303928aa8e013c58c68e661155196b51f199b46 Mon Sep 17 00:00:00 2001
From: "Philipp Lohmann [pl]" <Philipp.Lohmann@Oracle.COM>
Date: Thu, 4 Nov 2010 18:49:17 +0100
Subject: vcl117: #i115056# remove now unused svtools PrintDialog

---
 sfx2/source/doc/printhelper.cxx |  74 ----------------------
 sfx2/source/view/printer.cxx    |  75 ++--------------------
 sfx2/source/view/viewprn.cxx    | 136 ++--------------------------------------
 3 files changed, 11 insertions(+), 274 deletions(-)

(limited to 'sfx2/source')

diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index 2cd195976832..1dc2423bcdaf 100755
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -53,7 +53,6 @@
 #include <ucbhelper/content.hxx>
 #include <cppuhelper/interfacecontainer.hxx>
 #include <vos/mutex.hxx>
-#include <svtools/printdlg.hxx>
 #include <cppuhelper/implbase1.hxx>
 
 #include <sfx2/viewfrm.hxx>
@@ -799,81 +798,8 @@ void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHin
             {
                 if ( !m_xPrintJob.is() )
                     m_xPrintJob = new SfxPrintJob_Impl( this );
-/*
-                PrintDialog* pDlg = pPrintHint->GetPrintDialog();
-                Printer* pPrinter = pPrintHint->GetPrinter();
-                ::rtl::OUString aPrintFile ( ( pPrinter && pPrinter->IsPrintFileEnabled() ) ? pPrinter->GetPrintFile() : String() );
-                ::rtl::OUString aRangeText ( ( pDlg && pDlg->IsRangeChecked(PRINTDIALOG_RANGE) ) ? pDlg->GetRangeText() : String() );
-                sal_Bool bSelectionOnly = ( ( pDlg && pDlg->IsRangeChecked(PRINTDIALOG_SELECTION) ) ? sal_True : sal_False );
-
-                sal_Int32 nArgs = 2;
-                if ( aPrintFile.getLength() )
-                    nArgs++;
-                if ( aRangeText.getLength() )
-                    nArgs++;
-                else if ( bSelectionOnly )
-                    nArgs++;
-
-                m_aPrintOptions.realloc(nArgs);
-                m_aPrintOptions[0].Name = DEFINE_CONST_UNICODE("CopyCount");
-                m_aPrintOptions[0].Value <<= (sal_Int16) (pPrinter ? pPrinter->GetCopyCount() : 1 );
-                m_aPrintOptions[1].Name = DEFINE_CONST_UNICODE("Collate");
-                m_aPrintOptions[1].Value <<= (sal_Bool) (pDlg ? pDlg->IsCollateChecked() : sal_False );
-
-                if ( bSelectionOnly )
-                {
-                    m_aPrintOptions[2].Name = DEFINE_CONST_UNICODE("Selection");
-                    m_aPrintOptions[2].Value <<= bSelectionOnly;
-                }
-                else if ( aRangeText.getLength() )
-                {
-                    m_aPrintOptions[2].Name = DEFINE_CONST_UNICODE("Pages");
-                    m_aPrintOptions[2].Value <<= aRangeText;
-                }
-
-                if ( aPrintFile.getLength() )
-                {
-                    m_aPrintOptions[nArgs-1].Name = DEFINE_CONST_UNICODE("FileName");
-                    m_aPrintOptions[nArgs-1].Value <<= aPrintFile;
-                }
-*/
                 m_aPrintOptions = pPrintHint->GetOptions();
             }
-/*
-            else if ( pPrintHint->GetWhich() == -3 )    // -3 : AdditionalPrintOptions
-            {
-                    uno::Sequence < beans::PropertyValue >& lOldOpts = m_aPrintOptions;
-                    const uno::Sequence < beans::PropertyValue >& lNewOpts = pPrintHint->GetAdditionalOptions();
-                    sal_Int32 nOld = lOldOpts.getLength();
-                    sal_Int32 nAdd = lNewOpts.getLength();
-                    lOldOpts.realloc( nOld + nAdd );
-
-                    // assume that all new elements are overwriting old ones and so don't need to be added
-                    sal_Int32 nTotal = nOld;
-                    for ( sal_Int32 n=0; n<nAdd; n++ )
-                    {
-                        sal_Int32 m;
-                        for ( m=0; m<nOld; m++ )
-                            if ( lNewOpts[n].Name == lOldOpts[m].Name )
-                                // new option overwrites old one
-                                break;
-
-                        if ( m == nOld )
-                        {
-                            // this is a new option, so add it to the resulting sequence - counter must be incremented
-                            lOldOpts[nTotal].Name = lNewOpts[n].Name;
-                            lOldOpts[nTotal++].Value = lNewOpts[n].Value;
-                        }
-                        else
-                            // overwrite old option with new value, counter stays unmodified
-                            lOldOpts[m].Value = lNewOpts[n].Value;
-                    }
-
-                    if ( nTotal != lOldOpts.getLength() )
-                        // at least one new options has overwritten an old one, so we allocated too much
-                        lOldOpts.realloc(  nTotal );
-            }
-*/
             else if ( pPrintHint->GetWhich() != -2 )    // -2 : CancelPrintJob
             {
                 view::PrintJobEvent aEvent;
diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index 46a96bafab9a..fb4b93ae8475 100644
--- a/sfx2/source/view/printer.cxx
+++ b/sfx2/source/view/printer.cxx
@@ -30,7 +30,6 @@
 #include <vcl/virdev.hxx>
 #include <vcl/metric.hxx>
 #include <vcl/msgbox.hxx>
-#include <svtools/printdlg.hxx>
 #include <unotools/printwarningoptions.hxx>
 #include <svtools/printoptions.hxx>
 #include <vector>
@@ -337,51 +336,22 @@ void SfxPrinter::SetOptions( const SfxItemSet &rNewOptions )
 
 void SfxPrinter::EnableRange( USHORT nRange )
 {
-    PrintDialogRange eRange = (PrintDialogRange)nRange;
-
-    if ( eRange == PRINTDIALOG_ALL )
-        pImpl->mbAll = TRUE;
-    else if ( eRange == PRINTDIALOG_SELECTION )
-        pImpl->mbSelection = TRUE;
-    else if ( eRange == PRINTDIALOG_FROMTO )
-        pImpl->mbFromTo = TRUE;
-    else if ( eRange == PRINTDIALOG_RANGE )
-        pImpl->mbRange = TRUE;
+    OSL_ENSURE( 0, "dead code !" );
 }
 
 //--------------------------------------------------------------------
 
 void SfxPrinter::DisableRange( USHORT nRange )
 {
-    PrintDialogRange eRange = (PrintDialogRange)nRange;
-
-    if ( eRange == PRINTDIALOG_ALL )
-        pImpl->mbAll = FALSE;
-    else if ( eRange == PRINTDIALOG_SELECTION )
-        pImpl->mbSelection = FALSE;
-    else if ( eRange == PRINTDIALOG_FROMTO )
-        pImpl->mbFromTo = FALSE;
-    else if ( eRange == PRINTDIALOG_RANGE )
-        pImpl->mbRange = FALSE;
+    OSL_ENSURE( 0, "dead code !" );
 }
 
 //--------------------------------------------------------------------
 
 BOOL SfxPrinter::IsRangeEnabled( USHORT nRange ) const
 {
-    PrintDialogRange eRange = (PrintDialogRange)nRange;
-    BOOL bRet = FALSE;
-
-    if ( eRange == PRINTDIALOG_ALL )
-        bRet = pImpl->mbAll;
-    else if ( eRange == PRINTDIALOG_SELECTION )
-        bRet = pImpl->mbSelection;
-    else if ( eRange == PRINTDIALOG_FROMTO )
-        bRet = pImpl->mbFromTo;
-    else if ( eRange == PRINTDIALOG_RANGE )
-        bRet = pImpl->mbRange;
-
-    return bRet;
+    OSL_ENSURE( 0, "dead code !" );
+    return TRUE;
 }
 
 //--------------------------------------------------------------------
@@ -484,41 +454,8 @@ const SfxFont* SfxPrinter::GetFontByName( const String &rFontName )
 
 BOOL SfxPrinter::InitJob( Window* pUIParent, BOOL bAskAboutTransparentObjects )
 {
-    const SvtPrinterOptions     aPrinterOpt;
-    const SvtPrintFileOptions   aPrintFileOpt;
-    const SvtBasePrintOptions*  pPrinterOpt = &aPrinterOpt;
-    const SvtBasePrintOptions*  pPrintFileOpt = &aPrintFileOpt;
-    PrinterOptions              aNewPrinterOptions;
-    BOOL                        bRet = TRUE;
-
-    ( ( IsPrintFileEnabled() && GetPrintFile().Len() ) ? pPrintFileOpt : pPrinterOpt )->GetPrinterOptions( aNewPrinterOptions );
-
-    if( bAskAboutTransparentObjects && !aNewPrinterOptions.IsReduceTransparency() )
-    {
-        if ( !Application::IsHeadlessModeEnabled() )
-        {
-            SvtPrintWarningOptions aWarnOpt;
-
-            if( aWarnOpt.IsTransparency() )
-            {
-                TransparencyPrintWarningBox aWarnBox( pUIParent );
-                const USHORT                nRet = aWarnBox.Execute();
-
-                if( nRet == RET_CANCEL )
-                    bRet = FALSE;
-                else
-                {
-                    aNewPrinterOptions.SetReduceTransparency( nRet != RET_NO );
-                    aWarnOpt.SetTransparency( !aWarnBox.IsNoWarningChecked() );
-                }
-            }
-        }
-    }
-
-    if( bRet )
-        SetPrinterOptions( aNewPrinterOptions );
-
-    return bRet;
+    OSL_ENSURE( 0, "dead code !" );
+    return FALSE;
 }
 
 //--------------------------------------------------------------------
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 4ed0173be8e1..7dae3a4a4735 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -34,7 +34,6 @@
 
 #include <svl/itempool.hxx>
 #include <vcl/msgbox.hxx>
-#include <svtools/printdlg.hxx>
 #include <svtools/prnsetup.hxx>
 #include <svl/flagitem.hxx>
 #include <svl/stritem.hxx>
@@ -338,30 +337,6 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt
     }
 }
 
-// -----------------------------------------------------------------------
-
-void DisableRanges( PrintDialog& rDlg, SfxPrinter* pPrinter )
-
-/*      [Beschreibung]
-
-    Mit dieser Funktion werden die nicht verf"ugbaren Ranges
-    vom Printer zum PrintDialog geforwarded.
-*/
-
-{
-    if ( !pPrinter )
-        return;
-
-    if ( !pPrinter->IsRangeEnabled( PRINTDIALOG_ALL ) )
-        rDlg.DisableRange( PRINTDIALOG_ALL );
-    if ( !pPrinter->IsRangeEnabled( PRINTDIALOG_SELECTION ) )
-        rDlg.DisableRange( PRINTDIALOG_SELECTION );
-    if ( !pPrinter->IsRangeEnabled( PRINTDIALOG_FROMTO ) )
-        rDlg.DisableRange( PRINTDIALOG_FROMTO );
-    if ( !pPrinter->IsRangeEnabled( PRINTDIALOG_RANGE ) )
-        rDlg.DisableRange( PRINTDIALOG_RANGE );
-}
-
 //====================================================================
 
 class SfxDialogExecutor_Impl
@@ -378,7 +353,6 @@ class SfxDialogExecutor_Impl
 {
 private:
     SfxViewShell*           _pViewSh;
-    PrintDialog*            _pPrintParent;
     PrinterSetupDialog*     _pSetupParent;
     SfxItemSet*             _pOptions;
     sal_Bool                _bModified;
@@ -387,7 +361,6 @@ private:
     DECL_LINK( Execute, void * );
 
 public:
-            SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrintDialog* pParent );
             SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrinterSetupDialog* pParent );
             ~SfxDialogExecutor_Impl() { delete _pOptions; }
 
@@ -398,22 +371,9 @@ public:
 
 //--------------------------------------------------------------------
 
-SfxDialogExecutor_Impl::SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrintDialog* pParent ) :
-
-    _pViewSh        ( pViewSh ),
-    _pPrintParent   ( pParent ),
-    _pSetupParent   ( NULL ),
-    _pOptions       ( NULL ),
-    _bModified      ( sal_False ),
-    _bHelpDisabled  ( sal_False )
-
-{
-}
-
 SfxDialogExecutor_Impl::SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrinterSetupDialog* pParent ) :
 
     _pViewSh        ( pViewSh ),
-    _pPrintParent   ( NULL ),
     _pSetupParent   ( pParent ),
     _pOptions       ( NULL ),
     _bModified      ( sal_False ),
@@ -429,27 +389,13 @@ IMPL_LINK( SfxDialogExecutor_Impl, Execute, void *, EMPTYARG )
     // Options lokal merken
     if ( !_pOptions )
     {
-        DBG_ASSERT( _pPrintParent || _pSetupParent, "no dialog parent" );
-        if( _pPrintParent )
-            _pOptions = ( (SfxPrinter*)_pPrintParent->GetPrinter() )->GetOptions().Clone();
-        else if( _pSetupParent )
+        DBG_ASSERT( _pSetupParent, "no dialog parent" );
+        if( _pSetupParent )
             _pOptions = ( (SfxPrinter*)_pSetupParent->GetPrinter() )->GetOptions().Clone();
     }
 
-    if ( _pOptions && _pPrintParent && _pPrintParent->IsSheetRangeAvailable() )
-    {
-        SfxItemState eState = _pOptions->GetItemState( SID_PRINT_SELECTEDSHEET );
-        if ( eState != SFX_ITEM_UNKNOWN )
-        {
-            PrintSheetRange eRange = _pPrintParent->GetCheckedSheetRange();
-            BOOL bValue = ( PRINTSHEETS_ALL != eRange );
-            _pOptions->Put( SfxBoolItem( SID_PRINT_SELECTEDSHEET, bValue ) );
-        }
-    }
-
     // Dialog ausf"uhren
-    SfxPrintOptionsDialog* pDlg = new SfxPrintOptionsDialog( _pPrintParent ? static_cast<Window*>(_pPrintParent)
-                                                                           : static_cast<Window*>(_pSetupParent),
+    SfxPrintOptionsDialog* pDlg = new SfxPrintOptionsDialog( static_cast<Window*>(_pSetupParent),
                                                              _pViewSh, _pOptions );
     if ( _bHelpDisabled )
         pDlg->DisableHelp();
@@ -458,15 +404,6 @@ IMPL_LINK( SfxDialogExecutor_Impl, Execute, void *, EMPTYARG )
         delete _pOptions;
         _pOptions = pDlg->GetOptions().Clone();
 
-        if ( _pOptions && _pPrintParent && _pPrintParent->IsSheetRangeAvailable() )
-        {
-            const SfxPoolItem* pItem;
-            if ( SFX_ITEM_SET == _pOptions->GetItemState( SID_PRINT_SELECTEDSHEET, FALSE , &pItem ) )
-            {
-                _pPrintParent->CheckSheetRange( ( (const SfxBoolItem*)pItem )->GetValue()
-                    ? PRINTSHEETS_SELECTED_SHEETS : PRINTSHEETS_ALL );
-            }
-        }
     }
     delete pDlg;
 
@@ -673,7 +610,6 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
     USHORT                  nDialogRet = RET_CANCEL;
     // BOOL                    bCollate=FALSE;
     SfxPrinter*             pPrinter = 0;
-    PrintDialog*            pPrintDlg = 0;
     SfxDialogExecutor_Impl* pExecutor = 0;
     bool                    bSilent = false;
     BOOL bIsAPI = rReq.GetArgs() && rReq.GetArgs()->Count();
@@ -881,16 +817,12 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
                     // forget new printer, it was taken over (as pPrinter) or deleted
                     pDlgPrinter = NULL;
 
-                    /* Now lets reset the Dialog printer, since its freed */
-                    if (pPrintDlg)
-                        pPrintDlg->SetPrinter (pPrinter);
                 }
                 else
                 {
                     // PrinterDialog is used to transfer information on printing,
                     // so it will only be deleted here if dialog was cancelled
                     DELETEZ( pDlgPrinter );
-                    DELETEZ( pPrintDlg );
                     rReq.Ignore();
                     if ( SID_PRINTDOC == nId )
                         rReq.SetReturnValue(SfxBoolItem(0,FALSE));
@@ -909,30 +841,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
 
 //--------------------------------------------------------------------
 
-PrintDialog* SfxViewShell::CreatePrintDialog( Window* /*pParent*/ )
-
-/*  [Beschreibung]
-
-    Diese Methode kann "uberladen werden, um einen speziellen PrintDialog
-    zu erzeugen. Dies ist z.B. notwendig wenn spezielle <StarView> Features
-    wie drucken von Seitenbereichen.
-*/
-
-{
-    #if 0
-    PrintDialog *pDlg = new PrintDialog( pParent, false );
-    pDlg->SetFirstPage( 1 );
-    pDlg->SetLastPage( 9999 );
-    pDlg->EnableCollate();
-    return pDlg;
-    #else
-    return NULL;
-    #endif
-}
-
-//--------------------------------------------------------------------
-
-void SfxViewShell::PreparePrint( PrintDialog * )
+void SfxViewShell::PreparePrint()
 {
 }
 
@@ -940,45 +849,10 @@ void SfxViewShell::PreparePrint( PrintDialog * )
 
 
 ErrCode SfxViewShell::DoPrint( SfxPrinter* /*pPrinter*/,
-                               PrintDialog* /*pPrintDlg*/,
                                BOOL /*bSilent*/, BOOL /*bIsAPI*/ )
 {
-    #if 0
-    // Printer-Dialogbox waehrend des Ausdrucks mu\s schon vor
-    // StartJob erzeugt werden, da SV bei einem Quit-Event h"angt
-    SfxPrintProgress *pProgress = new SfxPrintProgress( this, !bSilent );
-    SfxPrinter *pDocPrinter = GetPrinter(TRUE);
-    if ( !pPrinter )
-        pPrinter = pDocPrinter;
-    else if ( pDocPrinter != pPrinter )
-    {
-        pProgress->RestoreOnEndPrint( pDocPrinter->Clone() );
-        SetPrinter( pPrinter, SFX_PRINTER_PRINTER );
-    }
-    pProgress->SetWaitMode(FALSE);
-
-    // Drucker starten
-    PreparePrint( pPrintDlg );
-    SfxObjectShell *pObjShell = GetViewFrame()->GetObjectShell();
-    if ( pPrinter->StartJob(pObjShell->GetTitle(0)) )
-    {
-        // Drucken
-        Print( *pProgress, bIsAPI, pPrintDlg );
-        pProgress->Stop();
-        pProgress->DeleteOnEndPrint();
-        pPrinter->EndJob();
-    }
-    else
-    {
-        // Printer konnte nicht gestartet werden
-        delete pProgress;
-    }
-
-    return pPrinter->GetError();
-    #else
     DBG_ERROR( "DoPrint called, dead code !" );
     return ERRCODE_IO_NOTSUPPORTED;
-    #endif
 }
 
 //--------------------------------------------------------------------
@@ -1008,7 +882,7 @@ void SfxViewShell::LockPrinter( BOOL bLock)
 
 //--------------------------------------------------------------------
 
-USHORT SfxViewShell::Print( SfxProgress& /*rProgress*/, BOOL /*bIsAPI*/, PrintDialog* /*pDlg*/ )
+USHORT SfxViewShell::Print( SfxProgress& /*rProgress*/, BOOL /*bIsAPI*/ )
 {
     return 0;
 }
-- 
cgit 


From 5adb4c0572ebb341a8db83888181b13a08704c7d Mon Sep 17 00:00:00 2001
From: "Philipp Lohmann [pl]" <Philipp.Lohmann@Oracle.COM>
Date: Fri, 5 Nov 2010 11:17:34 +0100
Subject: fix warnings

---
 sfx2/source/view/printer.cxx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'sfx2/source')

diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index fb4b93ae8475..fb8f60241b8e 100644
--- a/sfx2/source/view/printer.cxx
+++ b/sfx2/source/view/printer.cxx
@@ -334,21 +334,21 @@ void SfxPrinter::SetOptions( const SfxItemSet &rNewOptions )
 
 //--------------------------------------------------------------------
 
-void SfxPrinter::EnableRange( USHORT nRange )
+void SfxPrinter::EnableRange( USHORT )
 {
     OSL_ENSURE( 0, "dead code !" );
 }
 
 //--------------------------------------------------------------------
 
-void SfxPrinter::DisableRange( USHORT nRange )
+void SfxPrinter::DisableRange( USHORT )
 {
     OSL_ENSURE( 0, "dead code !" );
 }
 
 //--------------------------------------------------------------------
 
-BOOL SfxPrinter::IsRangeEnabled( USHORT nRange ) const
+BOOL SfxPrinter::IsRangeEnabled( USHORT ) const
 {
     OSL_ENSURE( 0, "dead code !" );
     return TRUE;
@@ -452,7 +452,7 @@ const SfxFont* SfxPrinter::GetFontByName( const String &rFontName )
 
 //--------------------------------------------------------------------
 
-BOOL SfxPrinter::InitJob( Window* pUIParent, BOOL bAskAboutTransparentObjects )
+BOOL SfxPrinter::InitJob( Window*, BOOL )
 {
     OSL_ENSURE( 0, "dead code !" );
     return FALSE;
-- 
cgit 


From 1fc75ad6800275b23242e0b82e52dc2327cf16b3 Mon Sep 17 00:00:00 2001
From: "Philipp Lohmann [pl]" <Philipp.Lohmann@Oracle.COM>
Date: Mon, 8 Nov 2010 14:43:10 +0100
Subject: vcl117: #i115477# remove unused methods

---
 sfx2/source/view/printer.cxx | 30 ------------------------------
 1 file changed, 30 deletions(-)

(limited to 'sfx2/source')

diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index fb8f60241b8e..243e3c508966 100644
--- a/sfx2/source/view/printer.cxx
+++ b/sfx2/source/view/printer.cxx
@@ -334,28 +334,6 @@ void SfxPrinter::SetOptions( const SfxItemSet &rNewOptions )
 
 //--------------------------------------------------------------------
 
-void SfxPrinter::EnableRange( USHORT )
-{
-    OSL_ENSURE( 0, "dead code !" );
-}
-
-//--------------------------------------------------------------------
-
-void SfxPrinter::DisableRange( USHORT )
-{
-    OSL_ENSURE( 0, "dead code !" );
-}
-
-//--------------------------------------------------------------------
-
-BOOL SfxPrinter::IsRangeEnabled( USHORT ) const
-{
-    OSL_ENSURE( 0, "dead code !" );
-    return TRUE;
-}
-
-//--------------------------------------------------------------------
-
 SV_IMPL_PTRARR(SfxFontArr_Impl,SfxFont*)
 
 //--------------------------------------------------------------------
@@ -452,14 +430,6 @@ const SfxFont* SfxPrinter::GetFontByName( const String &rFontName )
 
 //--------------------------------------------------------------------
 
-BOOL SfxPrinter::InitJob( Window*, BOOL )
-{
-    OSL_ENSURE( 0, "dead code !" );
-    return FALSE;
-}
-
-//--------------------------------------------------------------------
-
 SfxPrintOptionsDialog::SfxPrintOptionsDialog( Window *pParent,
                                               SfxViewShell *pViewShell,
                                               const SfxItemSet *pSet ) :
-- 
cgit 


From d6c96ba8a0fd7ef324cd40fb2525ef15bfb23bdf Mon Sep 17 00:00:00 2001
From: "Philipp Lohmann [pl]" <Philipp.Lohmann@Oracle.COM>
Date: Tue, 9 Nov 2010 15:20:35 +0100
Subject: vcl117: #i115477# clean up unused methods

---
 sfx2/source/view/printer.cxx | 221 +------------------------------------------
 sfx2/source/view/viewprn.cxx |  23 -----
 2 files changed, 1 insertion(+), 243 deletions(-)

(limited to 'sfx2/source')

diff --git a/sfx2/source/view/printer.cxx b/sfx2/source/view/printer.cxx
index 243e3c508966..e446b24a1d7a 100644
--- a/sfx2/source/view/printer.cxx
+++ b/sfx2/source/view/printer.cxx
@@ -46,54 +46,23 @@
 #include "sfxresid.hxx"
 #include "view.hrc"
 
-#ifdef MSC
-// der ist buggy
-#define NEW_OBJECTS(Class, nCount) ((Class*) new char[ sizeof(Class) * (nCount) ])
-#else
-#define NEW_OBJECTS(Class, nCount) (new Class[nCount])
-#endif
-
-
-USHORT SfxFontSizeInfo::pStaticSizes[] =
-{
-    60,
-    80,
-    100,
-    120,
-    140,
-    180,
-    240,
-    360,
-    480,
-    600,
-    720
-};
-
-//--------------------------------------------------------------------
-
-SV_DECL_PTRARR_DEL(SfxFontArr_Impl,SfxFont*,10,5)
-
 // struct SfxPrinter_Impl ------------------------------------------------
 
 struct SfxPrinter_Impl
 {
-    SfxFontArr_Impl*    mpFonts;
     BOOL                mbAll;
     BOOL                mbSelection;
     BOOL                mbFromTo;
     BOOL                mbRange;
 
     SfxPrinter_Impl() :
-        mpFonts     ( NULL ),
         mbAll       ( TRUE ),
         mbSelection ( TRUE ),
         mbFromTo    ( TRUE ),
         mbRange     ( TRUE ) {}
-    ~SfxPrinter_Impl() { delete mpFonts; }
+    ~SfxPrinter_Impl() {}
 };
 
-#define FONTS() pImpl->mpFonts
-
 struct SfxPrintOptDlg_Impl
 {
     sal_Bool        mbHelpDisabled;
@@ -102,98 +71,6 @@ struct SfxPrintOptDlg_Impl
         mbHelpDisabled  ( sal_False ) {}
 };
 
-//--------------------------------------------------------------------
-
-SfxFontSizeInfo::SfxFontSizeInfo( const SfxFont &rFont,
-                                  const OutputDevice &rDevice ) :
-
-    pSizes(0),
-    nSizes(0),
-    bScalable(TRUE)
-
-{
-    if ( 0 == rDevice.GetDevFontCount() )
-        bScalable = FALSE;
-    else
-    {
-        OutputDevice &rDev = (OutputDevice&) rDevice;
-        Font aFont(rFont.GetName(), Size(0,12));
-        aFont.SetFamily(rFont.GetFamily());
-        aFont.SetPitch(rFont.GetPitch());
-        aFont.SetCharSet(rFont.GetCharSet());
-
-        // verfuegbare Groessen in die Liste eintragen, Groesse in 10tel Punkt
-        int nSizeCount = rDev.GetDevFontSizeCount(aFont);
-        pSizes = NEW_OBJECTS(Size, nSizeCount);
-        const MapMode aOldMapMode = rDev.GetMapMode();
-        MapMode aMap(aOldMapMode);
-        aMap.SetMapUnit(MAP_POINT);
-        const Fraction aTen(1, 10);
-        aMap.SetScaleX(aTen);
-        aMap.SetScaleY(aTen);
-        rDev.SetMapMode(aMap);
-
-        // Es gibt Fonts mit Bitmaps und skalierbaren Groessen
-        // In diesem Fall wird der Fonts als skalierbar behandelt.
-        BOOL bFoundScalable = FALSE;
-        for ( int i = 0; i < nSizeCount; ++i )
-        {
-            const Size aSize( rDev.GetDevFontSize(aFont, i) );
-            if ( aSize.Height() != 0 )
-                pSizes[nSizes++] = aSize;
-            else
-                bFoundScalable |= TRUE;
-        }
-        if( !bFoundScalable )
-            bScalable = FALSE;
-        else
-        {
-            // statische Font-Sizes verwenden
-            delete [] pSizes;
-            nSizes = 0;
-        }
-        rDev.SetMapMode(aOldMapMode);
-    }
-
-    if ( 0 == nSizes )
-    {
-        nSizes = sizeof(pStaticSizes) / sizeof(USHORT);
-        pSizes = NEW_OBJECTS(Size, nSizes);
-        for ( USHORT nPos = 0; nPos <nSizes; ++nPos )
-           pSizes[nPos] = Size( 0, pStaticSizes[nPos] );
-    }
-}
-
-//--------------------------------------------------------------------
-
-SfxFontSizeInfo::~SfxFontSizeInfo()
-{
-    delete [] pSizes;
-}
-
-//--------------------------------------------------------------------
-
-BOOL SfxFontSizeInfo::HasSize(const Size &rSize) const
-{
-    if ( bScalable )
-        return TRUE;
-    for ( USHORT i = 0; i < nSizes; ++i)
-        if ( pSizes[i] == rSize )
-            return TRUE;
-    return FALSE;
-}
-
-//--------------------------------------------------------------------
-
-SfxFont::SfxFont( const FontFamily eFontFamily, const String& aFontName,
-                  const FontPitch eFontPitch, const CharSet eFontCharSet ):
-    aName( aFontName ),
-    eFamily( eFontFamily ),
-        ePitch( eFontPitch ),
-    eCharSet( eFontCharSet )
-{
-}
-
 // class SfxPrinter ------------------------------------------------------
 
 SfxPrinter* SfxPrinter::Create( SvStream& rStream, SfxItemSet* pOptions )
@@ -334,102 +211,6 @@ void SfxPrinter::SetOptions( const SfxItemSet &rNewOptions )
 
 //--------------------------------------------------------------------
 
-SV_IMPL_PTRARR(SfxFontArr_Impl,SfxFont*)
-
-//--------------------------------------------------------------------
-
-const SfxFont* SfxFindFont_Impl( const SfxFontArr_Impl& rArr,
-                                 const String& rName )
-{
-    const USHORT nCount = rArr.Count();
-    for ( USHORT i = 0; i < nCount; ++i )
-    {
-        const SfxFont *pFont = rArr[i];
-        if ( pFont->GetName() == rName )
-            return pFont;
-    }
-    return NULL;
-}
-
-//--------------------------------------------------------------------
-
-void SfxPrinter::UpdateFonts_Impl()
-{
-    VirtualDevice *pVirDev = 0;
-    const OutputDevice *pOut = this;
-
-        // falls kein Drucker gefunden werden konnte, ein
-        // temp. Device erzeugen fuer das Erfragen der Fonts
-    if( !IsValid() )
-        pOut = pVirDev = new VirtualDevice;
-
-    int nCount = pOut->GetDevFontCount();
-    FONTS() =  new SfxFontArr_Impl((BYTE)nCount);
-
-    std::vector< Font > aNonRegularFonts;
-    for(int i = 0;i < nCount;++i)
-    {
-        Font aFont(pOut->GetDevFont(i));
-        if ( (aFont.GetItalic() != ITALIC_NONE) ||
-             (aFont.GetWeight() != WEIGHT_MEDIUM) )
-        {
-            // First: Don't add non-regular fonts. The font name is not unique so we have
-            // to filter the device font list.
-            aNonRegularFonts.push_back( aFont );
-        }
-        else if ( FONTS()->Count() == 0 ||
-             (*FONTS())[FONTS()->Count()-1]->GetName() != aFont.GetName() )
-        {
-            DBG_ASSERT(0 == SfxFindFont_Impl(*FONTS(), aFont.GetName()), "Doppelte Fonts vom SV-Device!");
-            SfxFont* pTmp = new SfxFont( aFont.GetFamily(), aFont.GetName(),
-                                         aFont.GetPitch(), aFont.GetCharSet() );
-            FONTS()->C40_INSERT(SfxFont, pTmp, FONTS()->Count());
-        }
-    }
-    delete pVirDev;
-
-    // Try to add all non-regular fonts. It could be that there was no regular font
-    // with the same name added.
-    std::vector< Font >::const_iterator pIter;
-    for ( pIter = aNonRegularFonts.begin(); pIter != aNonRegularFonts.end(); pIter++ )
-    {
-        if ( SfxFindFont_Impl( *FONTS(), pIter->GetName() ) == 0 )
-        {
-            SfxFont* pTmp = new SfxFont( pIter->GetFamily(), pIter->GetName(),
-                                         pIter->GetPitch(), pIter->GetCharSet() );
-            FONTS()->C40_INSERT( SfxFont, pTmp, FONTS()->Count() );
-        }
-    }
-}
-
-//--------------------------------------------------------------------
-
-USHORT SfxPrinter::GetFontCount()
-{
-    if ( !FONTS() )
-        UpdateFonts_Impl();
-    return FONTS()->Count();
-}
-
-//--------------------------------------------------------------------
-
-const SfxFont* SfxPrinter::GetFont( USHORT nNo ) const
-{
-    DBG_ASSERT( FONTS(), "bitte erst GetFontCount() abfragen!" );
-    return (*FONTS())[ nNo ];
-}
-
-//--------------------------------------------------------------------
-
-const SfxFont* SfxPrinter::GetFontByName( const String &rFontName )
-{
-    if ( !FONTS() )
-        UpdateFonts_Impl();
-    return SfxFindFont_Impl(*FONTS(), rFontName);
-}
-
-//--------------------------------------------------------------------
-
 SfxPrintOptionsDialog::SfxPrintOptionsDialog( Window *pParent,
                                               SfxViewShell *pViewShell,
                                               const SfxItemSet *pSet ) :
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 6f39487b406e..7e71821ac75b 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -855,22 +855,6 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
 
 //--------------------------------------------------------------------
 
-void SfxViewShell::PreparePrint()
-{
-}
-
-//--------------------------------------------------------------------
-
-
-ErrCode SfxViewShell::DoPrint( SfxPrinter* /*pPrinter*/,
-                               BOOL /*bSilent*/, BOOL /*bIsAPI*/ )
-{
-    DBG_ERROR( "DoPrint called, dead code !" );
-    return ERRCODE_IO_NOTSUPPORTED;
-}
-
-//--------------------------------------------------------------------
-
 BOOL SfxViewShell::IsPrinterLocked() const
 {
     return pImp->m_nPrinterLocks > 0;
@@ -900,13 +884,6 @@ void SfxViewShell::LockPrinter( BOOL bLock)
 
 //--------------------------------------------------------------------
 
-USHORT SfxViewShell::Print( SfxProgress& /*rProgress*/, BOOL /*bIsAPI*/ )
-{
-    return 0;
-}
-
-//--------------------------------------------------------------------
-
 SfxPrinter* SfxViewShell::GetPrinter( BOOL /*bCreate*/ )
 {
     return 0;
-- 
cgit 


From da55906d78a8dc986e25cb13186cb810f021de1a Mon Sep 17 00:00:00 2001
From: "Philipp Lohmann [pl]" <Philipp.Lohmann@Oracle.COM>
Date: Mon, 15 Nov 2010 14:08:49 +0100
Subject: vcl117: #i97832# remove unused code (thanks cmc!)

---
 sfx2/source/appl/appmain.cxx | 15 ---------------
 1 file changed, 15 deletions(-)

(limited to 'sfx2/source')

diff --git a/sfx2/source/appl/appmain.cxx b/sfx2/source/appl/appmain.cxx
index cf097b900b52..6987d9feabfc 100644
--- a/sfx2/source/appl/appmain.cxx
+++ b/sfx2/source/appl/appmain.cxx
@@ -116,21 +116,6 @@ void SfxApplication::Init
     <SfxApplication::OpenClients()>
 */
 {
-#ifdef DDE_AVAILABLE
-#ifndef DBG_UTIL
-    InitializeDde();
-#else
-    if( !InitializeDde() )
-    {
-        ByteString aStr( "Kein DDE-Service moeglich. Fehler: " );
-        if( GetDdeService() )
-            aStr += GetDdeService()->GetError();
-        else
-            aStr += '?';
-        DBG_ASSERT( sal_False, aStr.GetBuffer() )
-    }
-#endif
-#endif
 }
 
 //--------------------------------------------------------------------
-- 
cgit 


From af173db727b060d49733bd15fb210fd2f58598f1 Mon Sep 17 00:00:00 2001
From: Mikhail Voytenko <mav@openoffice.org>
Date: Mon, 3 Jan 2011 13:40:23 +0100
Subject: fwk162: #i115902# review usage of SfxObjectShellRef,
 SfxObjecShellLock; remove unused some methods

---
 sfx2/source/doc/doctempl.cxx           |  4 +++
 sfx2/source/doc/docvor.cxx             | 18 ++++++++++--
 sfx2/source/doc/objcont.cxx            | 50 ----------------------------------
 sfx2/source/doc/objxtor.cxx            | 25 ++---------------
 sfx2/source/doc/printhelper.cxx        |  8 +++---
 sfx2/source/view/frmload.cxx           | 40 +++------------------------
 sfx2/source/view/sfxbasecontroller.cxx | 10 +++----
 7 files changed, 35 insertions(+), 120 deletions(-)

(limited to 'sfx2/source')

diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index db6f2a2d133f..1fefa2279209 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -137,7 +137,11 @@ namespace DocTempl {
 class DocTempl_EntryData_Impl
 {
     RegionData_Impl*    mpParent;
+
+    // the following member must be SfxObjectShellLock since it controlls that SfxObjectShell lifetime by design
+    // and users of this class expect it to be so.
     SfxObjectShellLock  mxObjShell;
+
     OUString            maTitle;
     OUString            maOwnURL;
     OUString            maTargetURL;
diff --git a/sfx2/source/doc/docvor.cxx b/sfx2/source/doc/docvor.cxx
index 719dc5b8d223..b3de1afa5358 100644
--- a/sfx2/source/doc/docvor.cxx
+++ b/sfx2/source/doc/docvor.cxx
@@ -546,6 +546,9 @@ BOOL SfxOrganizeListBox_Impl::Select( SvLBoxEntry* pEntry, BOOL bSelect )
         return SvTreeListBox::Select(pEntry,bSelect);
 
     Path aPath(this, pEntry);
+
+    // it is ok to use the SfxObjectShellRef here since the object that
+    // provides it ( GetObjectShell() calls CreateObjectShell() ) has a lock on it
     GetObjectShell(aPath)->TriggerHelpPI(
         aPath[nLevel+1], aPath[nLevel+2], aPath[nLevel+3]);
     return SvTreeListBox::Select(pEntry,bSelect);
@@ -691,10 +694,12 @@ BOOL SfxOrganizeListBox_Impl::MoveOrCopyContents(SvLBox *pSourceBox,
     BOOL bRemovedFromSource = FALSE;
     Path aSource(pSourceBox, pSource);
     Path aTarget(this, pTarget);
-    SfxObjectShellRef aSourceDoc =
-        ((SfxOrganizeListBox_Impl *)pSourceBox)->GetObjectShell(aSource);
 
+    // it is ok to use the SfxObjectShellRef here since the object that
+    // provides it ( GetObjectShell() calls CreateObjectShell() ) has a lock on it
+    SfxObjectShellRef aSourceDoc = ((SfxOrganizeListBox_Impl *)pSourceBox)->GetObjectShell(aSource);
     SfxObjectShellRef aTargetDoc = GetObjectShell(aTarget);
+
     const USHORT nSLevel =
         ((SfxOrganizeListBox_Impl *)pSourceBox)->GetDocLevel();
     const USHORT nTLevel = GetDocLevel();
@@ -1210,6 +1215,9 @@ void SfxOrganizeListBox_Impl::RequestingChilds( SvLBoxEntry* pEntry )
         {
             const USHORT nDocLevel = GetDocLevel();
             Path aPath(this, pEntry);
+
+            // it is ok to use the SfxObjectShellRef here since the object that
+            // provides it ( GetObjectShell() calls CreateObjectShell() ) has a lock on it
             SfxObjectShellRef aRef = GetObjectShell(aPath);
             if(aRef.Is())
             {
@@ -1887,6 +1895,9 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( USHORT nId, Menu* _pMenu )
                 if(!QueryDelete_Impl(pDialog, STR_DELETE_TEMPLATE, pFocusBox->GetEntryText(pEntry)))
                     return 1;
                 Path aPath(pFocusBox, pEntry);
+
+                // it is ok to use the SfxObjectShellRef here since the object that
+                // provides it ( GetObjectShell() calls CreateObjectShell() ) has a lock on it
                 SfxObjectShellRef aRef = pFocusBox->GetObjectShell(aPath);
                 if(aRef.Is() &&
                     aRef->Remove(aPath[1+pFocusBox->GetDocLevel()],
@@ -1953,6 +1964,9 @@ long SfxOrganizeDlg_Impl::Dispatch_Impl( USHORT nId, Menu* _pMenu )
             if ( !pEntry )
                 return 1;
             Path aPath( pFocusBox, pEntry );
+
+            // it is ok to use the SfxObjectShellRef here since the object that
+            // provides it ( GetObjectShell() calls CreateObjectShell() ) has a lock on it
             SfxObjectShellRef aRef = pFocusBox->GetObjectShell( aPath );
             if ( aRef.Is() )
             {
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index e0e63da04bb8..a5ef8cd398a4 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -1088,60 +1088,10 @@ void SfxObjectShell::UpdateFromTemplate_Impl(  )
 //REPLACE                   pInfo->Save(xDocStor);
                 }
             }
-/*
-        SfxConfigManager *pCfgMgr = SFX_CFGMANAGER();
-        {
-            SfxConfigManager *pTemplCfg = new SfxConfigManager(aTemplStor, pCfgMgr);
-            SetConfigManager(pTemplCfg);
-            SetTemplateConfig(TRUE);
-
-            // Falls der gerade zerst"orte CfgMgr des Dokuments der
-            // aktive war, pCfgMgr lieber neu holen
-            pCfgMgr = SFX_CFGMANAGER();
-
-            // ggf. den neuen ConfigManager aktivieren
-            if ( this == SfxObjectShell::Current() )
-                pTemplCfg->Activate(pCfgMgr);
-        }
-*/
-        // Template und Template-DocInfo werden nicht mehr gebraucht
-//            delete pTemplInfo;
         }
     }
 }
 
-SfxObjectShellRef MakeObjectShellForOrganizer_Impl( const String& aTargetURL, BOOL bForWriting )
-{
-    // check for own format
-    SfxObjectShellRef xDoc;
-    StreamMode nMode = bForWriting ? SFX_STREAM_READWRITE : SFX_STREAM_READONLY;
-    SfxMedium *pMed = new SfxMedium( aTargetURL, nMode, FALSE, 0 );
-    const SfxFilter* pFilter = NULL;
-    pMed->UseInteractionHandler(TRUE);
-    if( SFX_APP()->GetFilterMatcher().GuessFilter( *pMed, &pFilter ) == ERRCODE_NONE && pFilter && pFilter->IsOwnFormat() )
-    {
-        // create document
-        xDoc = SfxObjectShell::CreateObject( pFilter->GetServiceName(), SFX_CREATE_MODE_ORGANIZER );
-        if ( xDoc.Is() )
-        {
-            // partially load, so don't use DoLoad!
-            xDoc->DoInitNew(0);
-            // TODO/LATER: make sure that we don't use binary templates!
-            if( xDoc->LoadFrom( *pMed ) )
-            {
-                // connect to storage, abandon temp. storage
-                xDoc->DoSaveCompleted( pMed );
-            }
-            else
-                xDoc.Clear();
-        }
-    }
-    else
-        delete pMed;
-
-    return xDoc;
-}
-
 sal_Bool SfxObjectShell::IsHelpDocument() const
 {
     const SfxFilter* pFilter = GetMedium()->GetFilter();
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index b7567b89f02f..f85a6c3b1079 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -172,12 +172,7 @@ void SAL_CALL SfxModelListener_Impl::disposing( const com::sun::star::lang::Even
         SfxObjectShell::SetCurrentComponent( Reference< XInterface >() );
     }
 
-    if ( mpDoc->Get_Impl()->bHiddenLockedByAPI )
-    {
-        mpDoc->Get_Impl()->bHiddenLockedByAPI = FALSE;
-        mpDoc->OwnerLock(FALSE);
-    }
-    else if ( !mpDoc->Get_Impl()->bClosing )
+    if ( !mpDoc->Get_Impl()->bClosing )
         // GCC stuerzt ab, wenn schon im dtor, also vorher Flag abfragen
         mpDoc->DoClose();
 }
@@ -812,22 +807,6 @@ void SfxObjectShell::InitBasicManager_Impl()
     DBG_ASSERT( pImp->pBasicManager->isValid(), "SfxObjectShell::InitBasicManager_Impl: did not get a BasicManager!" );
 }
 
-//--------------------------------------------------------------------
-#if 0 //(mba)
-SotObjectRef SfxObjectShell::CreateAggObj( const SotFactory* pFact )
-{
-    // SvDispatch?
-    SotFactory* pDispFact = SvDispatch::ClassFactory();
-    if( pFact == pDispFact )
-        return( (SfxShellObject*)GetSbxObject() );
-
-    // sonst unbekannte Aggregation
-    DBG_ERROR("unkekannte Factory");
-    SotObjectRef aSvObjectRef;
-    return aSvObjectRef;
-}
-#endif
-
 //--------------------------------------------------------------------
 
 sal_uInt16 SfxObjectShell::Count()
@@ -851,7 +830,7 @@ SfxObjectShell* SfxObjectShell::GetObjectShell()
 
 //--------------------------------------------------------------------
 
-SEQUENCE< OUSTRING > SfxObjectShell::GetEventNames()
+uno::Sequence< ::rtl::OUString > SfxObjectShell::GetEventNames()
 {
     static uno::Sequence< ::rtl::OUString >* pEventNameContainer = NULL;
 
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index 2cd195976832..018bef6208b2 100755
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -345,7 +345,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
         // Name-Property?
         if ( rProp.Name.compareToAscii( "Name" ) == 0 )
         {
-            OUSTRING sTemp;
+            ::rtl::OUString sTemp;
             if ( ( rProp.Value >>= sTemp ) == sal_False )
                 throw ::com::sun::star::lang::IllegalArgumentException();
 
@@ -619,9 +619,9 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
         if ( rProp.Name.compareToAscii( "FileName" ) == 0 )
         {
             // unpack th URL and check for a valid and well known protocol
-            OUSTRING sTemp;
+            ::rtl::OUString sTemp;
             if (
-                ( rProp.Value.getValueType()!=::getCppuType((const OUSTRING*)0))  ||
+                ( rProp.Value.getValueType()!=::getCppuType((const ::rtl::OUString*)0))  ||
                 (!(rProp.Value>>=sTemp))
                )
             {
@@ -718,7 +718,7 @@ void SAL_CALL SfxPrintHelper::print(const uno::Sequence< beans::PropertyValue >&
         // Pages-Property
         else if ( rProp.Name.compareToAscii( "Pages" ) == 0 )
         {
-            OUSTRING sTemp;
+            ::rtl::OUString sTemp;
             if( rProp.Value >>= sTemp )
             {
                 aCheckedArgs[nProps].Name = rProp.Name;
diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx
index df252b831803..5544e2e8fde2 100644
--- a/sfx2/source/view/frmload.cxx
+++ b/sfx2/source/view/frmload.cxx
@@ -263,25 +263,6 @@ sal_Bool SfxFrameLoader_Impl::impl_createNewDocWithSlotParam( const USHORT _nSlo
     return lcl_getDispatchResult( SFX_APP()->ExecuteSlot( aRequest ) );
 }
 
-// --------------------------------------------------------------------------------------------------------------------
-void SfxFrameLoader_Impl::impl_lockHiddenDocument( SfxObjectShell& i_rDocument, const ::comphelper::NamedValueCollection& i_rDescriptor ) const
-{
-    const sal_Bool bHidden = i_rDescriptor.getOrDefault( "Hidden", sal_False );
-    if ( !bHidden )
-        return;
-
-    const SfxViewFrame* pExistingViewFrame = SfxViewFrame::GetFirst( &i_rDocument );
-    if ( pExistingViewFrame )
-        return;
-
-    // the document is to be loaded hidden, and it is not yet displayed in any other frame
-    // To prevent it from being closed when the loader returns, increase its OwnerLock
-    // (the OwnerLock is normally increased by every frame in which the document is displayed, and by this loader)
-    i_rDocument.RestoreNoDelete();
-    i_rDocument.OwnerLock( TRUE );
-    i_rDocument.Get_Impl()->bHiddenLockedByAPI = TRUE;
-}
-
 // --------------------------------------------------------------------------------------------------------------------
 void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollection& io_rDescriptor ) const
 {
@@ -332,7 +313,7 @@ void SfxFrameLoader_Impl::impl_determineFilter( ::comphelper::NamedValueCollecti
 }
 
 // --------------------------------------------------------------------------------------------------------------------
-SfxObjectShellLock SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel2 >& i_rxDocument ) const
+SfxObjectShellRef SfxFrameLoader_Impl::impl_findObjectShell( const Reference< XModel2 >& i_rxDocument ) const
 {
     for ( SfxObjectShell* pDoc = SfxObjectShell::GetFirst( NULL, FALSE ); pDoc; pDoc = SfxObjectShell::GetNext( *pDoc, NULL, FALSE ) )
     {
@@ -636,15 +617,12 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA
             // tell the doc its (current) load args.
             impl_removeLoaderArguments( aDescriptor );
             xModel->attachResource( xModel->getURL(), aDescriptor.getPropertyValues() );
-                // TODO: not sure this is correct. The original, pre-refactoring code did it this way. However, I could
-                // imagine scenarios where it is *not* correct to overrule the *existing* model args (XModel::getArgs)
-                // with the ones passed to the loader here. For instance, what about the MacroExecutionMode? The document
-                // might have a mode other than the one passed to the loader, and we always overwrite the former with
-                // the latter.
         }
 
         // get the SfxObjectShell (still needed at the moment)
-        const SfxObjectShellLock xDoc = impl_findObjectShell( xModel );
+        // SfxObjectShellRef is used here ( instead of ...Lock ) since the model is closed below if necessary
+        // SfxObjectShellLock would be even dangerous here, since the lifetime control should be done outside in case of success
+        const SfxObjectShellRef xDoc = impl_findObjectShell( xModel );
         ENSURE_OR_THROW( xDoc.Is(), "no SfxObjectShell for the given model" );
 
         // ensure the ID of the to-be-created view is in the descriptor, if possible
@@ -652,16 +630,6 @@ sal_Bool SAL_CALL SfxFrameLoader_Impl::load( const Sequence< PropertyValue >& rA
         const sal_Int16 nViewNo = xDoc->GetFactory().GetViewNo_Impl( nViewId, 0 );
         const ::rtl::OUString sViewName( xDoc->GetFactory().GetViewFactory( nViewNo ).GetAPIViewName() );
 
-        // if the document is created hidden, prevent it from being deleted until it is shown or disposed
-        impl_lockHiddenDocument( *xDoc, aDescriptor );
-            // TODO; if we wouldn't use a SfxObjectShellLock instance for xDoc, but a simple SfxObjectShellRef,
-            // then this would not be necessary, /me thinks. That is, the *Lock classes inc/dec a "Lock" counter
-            // (additional to the ref counter) in their ctor/dtor, and if the lock counter goes to 0, the
-            // object is closed (DoClose). The impl_lockHiddenDocument is to prevent exactly that premature
-            // closing. However, a *Ref object wouldn't close, anyway. And in case of unsuccessfull loading, the
-            // code at the very end of this method cares for closing the XModel, which should also close the
-            // ObjectShell.
-
         // plug the document into the frame
         impl_createDocumentView( xModel, _rTargetFrame, aViewCreationArgs, sViewName );
         bLoadSuccess = sal_True;
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index 19aa4b75ee0f..828e687b260a 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -734,7 +734,7 @@ ANY SfxBaseController::getViewData() throw( ::com::sun::star::uno::RuntimeExcept
     if ( m_pData->m_pViewShell )
     {
         m_pData->m_pViewShell->WriteUserData( sData1 ) ;
-        OUSTRING    sData( sData1 );
+        ::rtl::OUString    sData( sData1 );
         aAny <<= sData ;
     }
 
@@ -750,7 +750,7 @@ void SAL_CALL SfxBaseController::restoreViewData( const ANY& aValue ) throw( ::c
     ::vos::OGuard aGuard( Application::GetSolarMutex() );
     if ( m_pData->m_pViewShell )
     {
-        OUSTRING sData;
+        ::rtl::OUString sData;
         aValue >>= sData ;
         m_pData->m_pViewShell->ReadUserData( sData ) ;
     }
@@ -781,7 +781,7 @@ REFERENCE< XMODEL > SAL_CALL SfxBaseController::getModel() throw( ::com::sun::st
 //________________________________________________________________________________________________________
 
 REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch(   const   UNOURL&             aURL            ,
-                                                                    const   OUSTRING&           sTargetFrameName,
+                                                                    const   ::rtl::OUString&            sTargetFrameName,
                                                                             sal_Int32           eSearchFlags    ) throw( RUNTIMEEXCEPTION )
 {
     ::vos::OGuard aGuard( Application::GetSolarMutex() );
@@ -938,12 +938,12 @@ REFERENCE< XDISPATCH > SAL_CALL SfxBaseController::queryDispatch(   const   UNOU
 //  SfxBaseController -> XDispatchProvider
 //________________________________________________________________________________________________________
 
-SEQUENCE< REFERENCE< XDISPATCH > > SAL_CALL SfxBaseController::queryDispatches( const SEQUENCE< DISPATCHDESCRIPTOR >& seqDescripts ) throw( ::com::sun::star::uno::RuntimeException )
+uno::Sequence< REFERENCE< XDISPATCH > > SAL_CALL SfxBaseController::queryDispatches( const uno::Sequence< DISPATCHDESCRIPTOR >& seqDescripts ) throw( ::com::sun::star::uno::RuntimeException )
 {
     // Create return list - which must have same size then the given descriptor
     // It's not allowed to pack it!
     sal_Int32 nCount = seqDescripts.getLength();
-    SEQUENCE< REFERENCE< XDISPATCH > > lDispatcher( nCount );
+    uno::Sequence< REFERENCE< XDISPATCH > > lDispatcher( nCount );
 
     for( sal_Int32 i=0; i<nCount; ++i )
     {
-- 
cgit 


From fdf0c3f3c73229588d52893c5c77faea0228a5fb Mon Sep 17 00:00:00 2001
From: Mikhail Voytenko <mav@openoffice.org>
Date: Fri, 7 Jan 2011 15:19:05 +0100
Subject: fwk162: #i115902# review usage of SfxObjectShellRef,
 SfxObjecShellLock

---
 sfx2/source/appl/app.cxx | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'sfx2/source')

diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index 727d9f17c493..eb9307ad7538 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -375,6 +375,8 @@ SfxApplication::SfxApplication()
 
 SfxApplication::~SfxApplication()
 {
+    OSL_ENSURE( GetObjectShells_Impl().Count() == 0, "Memory leak: some object shells were not removed!" );
+
     Broadcast( SfxSimpleHint(SFX_HINT_DYING) );
 
     SfxModule::DestroyModules_Impl();
-- 
cgit 


From d646413d464dc5d6518f87daa8538cd0c600797f Mon Sep 17 00:00:00 2001
From: Ivo Hinkelmann <ihi@openoffice.org>
Date: Wed, 19 Jan 2011 12:28:29 +0100
Subject: masterfix: #i10000# resource fix

---
 sfx2/source/config/config.hrc   | 41 -----------------------------------------
 sfx2/source/config/config.src   | 35 -----------------------------------
 sfx2/source/config/evntconf.cxx |  3 +--
 3 files changed, 1 insertion(+), 78 deletions(-)
 delete mode 100644 sfx2/source/config/config.hrc
 delete mode 100644 sfx2/source/config/config.src

(limited to 'sfx2/source')

diff --git a/sfx2/source/config/config.hrc b/sfx2/source/config/config.hrc
deleted file mode 100644
index 582a2972f913..000000000000
--- a/sfx2/source/config/config.hrc
+++ /dev/null
@@ -1,41 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SFX_CONFIG_HRC
-#define _SFX_CONFIG_HRC
-
-#include <sfx2/sfx.hrc>
-
-// #defines *****************************************************************
-
-#define BTN_OK                          2
-#define BTN_CANCEL                      3
-#define FT_OK                           4
-#define FT_CANCEL                       5
-
-#endif
-
diff --git a/sfx2/source/config/config.src b/sfx2/source/config/config.src
deleted file mode 100644
index cb3259e09ad0..000000000000
--- a/sfx2/source/config/config.src
+++ /dev/null
@@ -1,35 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-//#include "config.hrc"
-//#include "sfxlocal.hrc"
-#include <sfx2/sfx.hrc>
-
-String STR_FILTERNAME_CFG
-{
-    Text [ en-US ] = "Configuration" ;
-};
diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx
index 185ec0626c51..59c56cc291a7 100644
--- a/sfx2/source/config/evntconf.cxx
+++ b/sfx2/source/config/evntconf.cxx
@@ -34,7 +34,7 @@
 #include <basic/sbmod.hxx>
 #include <tools/urlobj.hxx>
 #include <basic/sbx.hxx>
-    #include <sot/storage.hxx>
+#include <sot/storage.hxx>
 #include <unotools/securityoptions.hxx>
 
 #include <rtl/ustring.h>
@@ -47,7 +47,6 @@
 #include <sfx2/app.hxx>
 #include <sfx2/objsh.hxx>
 #include <sfx2/dispatch.hxx>
-#include "config.hrc"
 #include "sfx2/sfxresid.hxx"
 #include "eventsupplier.hxx"
 
-- 
cgit